Blog Home  Home RSS 2.0 Atom 1.0 CDF  
The Efficient Coder - Friday, December 28, 2007
There has got to be a better way of communicating with our computers!
 
 Friday, December 28, 2007

Upgrading .NET FX 2.0 to .NET FX 3.5 and LINQ

After recently upgrading a web project from the 2.0 framework to 3.5 I attempted to use the new language feature LINQ (actually found a really good use for I'll blog about later) however I ran into a problem where it wasn't recognizing the LINQ syntax...after a bit of research I discovered the following, for the ASP.NET compiler to recognize the syntax I need to add the following chunk of xml to my web.config file.  Not sure how this works with the compiled ASP.NET apps and my CI environment, if I need to do anything else I'll post it...

</system.web>
...
<
system.codedom>
   <
compilers>
      <
compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
         
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <
providerOption name="CompilerVersion" value="v3.5"/>
      <
providerOption name="WarnAsError" value="false"/>
   </
compiler>
   <
compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4"
         
type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <
providerOption name="CompilerVersion" value="v3.5"/>
      <
providerOption name="OptionInfer" value="true"/>
      <
providerOption name="WarnAsError" value="false"/>
   </
compiler>
</
compilers>
</
system.codedom>
...
<system.webServer>

Make sense if you think about it...

-ec

12/28/2007 11:54:40 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]   ASP.NET  |  Trackback
 Wednesday, November 28, 2007

Table vs DIV Tag Layouts

Am I a bad person because I fall back on using Tables to some of my layouts?  Ok, maybe "bad-person" isn't the right term, but over the past year or so I've started to pay extra-special attention to the HTML.  I'm trying to carve out for my apps to build the HTML with DIV tags and not tables, for the most part this works good, but in some cases after about 15 minutes of screwing around I fall back to my crutch of just doing the old table with colspan and rowspan.  In most cases where I get in trouble is with more complicated layouts that include nested divs/spans with images using the float:left style.  It seems like these get real tricky to keep lined up right when you want to keep the "flow" concept of HTML intact instead of doing absolute or relative position.  It also gets a bit interesting when you try to make it work on different browsers, layouts in one browser look good but because of different rendering techniques paragraphs with images that "floated" nicely all of a sudden look like a mess.

So I guess I can understand some possible performance improvements with a div strategy (are these really negligible) and unless you are doing absolute positioning, (which I feel sort-of dirty after doing so) are there any downfalls to just falling back to tables?

Comments?  Thoughts?  Two-Cents?

-ec

11/28/2007 4:20:10 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]    |  Trackback
 Monday, November 26, 2007

Upgrade to .NET FX 3.5 - Assembly Binding

I've officially converted my main ASP.NET application from 2.0 to 3.5 this morning overall it was very painless, for the most part, just adjust the class libraries to use the .Net Frameworks 3.5, and modify web.config entries from System.Web.UI.Extensions, Version 1.0.61025.0 to System.Web.Extensions, Version=3.5.0.0.  The problem I ran into was that some of the control libraries I was using were compiled against the 2.0 framework.  Adding the following keys to the bottom of my web.config files clean that up.<configuration>
  ....
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

-ec

11/26/2007 11:41:35 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]   .NET 3.5 | ASP.NET  |  Trackback
 Monday, November 19, 2007

The next leg of our journey officially begins today...VS.NET 2008 RTM!

http://weblogs.asp.net/scottgu/archive/2007/11/19/visual-studio-2008-and-net-3-5-released.aspx

11/19/2007 3:38:08 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]    |  Trackback
 Wednesday, November 14, 2007

VS.NET 2008 & VS.NET 2005 Solution Files

I recently made the move to Beta 2 for my main project and so-far-so-good, I haven't made the move to the 3.5 framework yet, I probably will as soon as I get the RTM later this month.  I'm being a bit cautious and not installing and beta components on my build server so I did a little research and found this article on information for working with your projects in both VS.NET 2008 and VS.NET 2005 concurrently.

http://west-wind.com/weblog/posts/122975.aspx

Basically just make a copy of your solution file, then change the "Format Version" and "# Visual Studio"

ProjectName_2005.sln

 

ProjectName_2008.sln

From what I can tell so far, the actual project files just aren't a problem.

-ec

11/14/2007 10:58:26 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]   ASP.NET | Continuous Integration  |  Trackback
 Tuesday, November 13, 2007

AJAX File Upload

As we all know that if you put any sort of file upload control on a form where you use AJAX (ex. the ASP.NET ScriptManager and UpdatePanel) it won't upload the file via an XMLHttpRequest.  So that means you have two options; first not use the update panel; second, put a button on the form that does a full post back to upload the file, and another one to just do the save.  Actually the second one could be fairly attractive for providing some sort of feedback on large file uploads, but that isn't the point of this post.

Here's a hack that at least allows me to do this until I can figure out a more elegant approach, but first a quick background.  Within my architecture I have web parts which are essentially a tool bar with Save, Cancel & Delete and a form of fields that get updated.  I have this wrapped into a nice server side custom control and all my panels use the same architecture so this was a change only in one spot.

Basically what I do is capture the "onchange" event on the <input type="file" id="foo" onchange="swapSaveButtons();" /> control.  I then invoke some java script that swaps out the save button on the form that is registered for an async post back (it does this by default on an update panel) for one that does a full post back:

<asp:UpdatePanel ID="oUpdatePanel" runat='server'>
   
<Triggers>
      
<asp:PostBackTrigger ControlID="btnFoo" />
   
</Triggers>
</asp:UpdatePanel>

A more elegant approach would be to interact with the ScriptManager with client javascript, but I couldn't find any APIs.  So basically in most cases, the normal save button that does the async post back triggers the trip to the server and the AJAX panel is happy.  In the case where the user selects a file, we swap out the normal save button with one that does a full post back and the file gets uploaded.  Of course this solution isn't perfect, but the worst case scenario is one where there is no file to upload and we still do a round trip.  That probably isn't the end of the world.

I would be very happy to hear of other approaches that would be transparent to the user and workflow.

-ec

 

11/13/2007 2:16:24 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]    |  Trackback
 Sunday, November 11, 2007

Annual Computer Upgrade

Well it’s time for my annual computer upgrade.  After reading Scott Hanselmans post on the ultimate developer rig, Scott Guthries post on Drive Speed and their impact on compiling and the much anticipated release of VS.NET 2008, I decided it’s time for a new computer.  After looking at all the high end machines out there, they seemed to be focused mainly on gaming so I decided to roll my own.  The guy I talked to said I could over clock the CPU to around 3.2GHz so picked up a huge CPU cooling fan.  I stopped off at CompUSA this afternoon and went on a shopping spree and picked up the following components:

  1. I also purchased a two year walk-in warranty on the processor and mother board since it's my intention to overclock these.
     

All in all it set me back about $2000.  It’s 4:15PM on Saturday and I’m going to start assembling, as I go I’ll be putting some of my findings and as well as how much work and time is involved with assembling this type of machine:

<notes>
     <note> I’ll be doing a little write-up as I go</note>
     <note> I think the last machine I built from scratch as an 80286, does anyone remember that processor? </note>
     <note> Since this was on a Saturday and after listening to Cigar Dave, this was after a couple beers and a cigar</note>
</notes>

Your mileage will probably vary ...

Here goes!

Step 1 – 4:20 -- Mount the Power Supply and Motherboard to the Chassis
Step 0.5 4:35      Ok, I’ve never been too good about reading the manuals…after all it’s only hardware right?  Need to install the processor on the board BEFORE installing the Motherboard on the chassis.  This is necessary because there is a brace for the cooling fan on the back side of the motherboard.

The brace is installed on the back and the fan on the front, when installing the fan the “S” clip doesn’t look like it will bend into place but if you put one side in then carefully hold the other end down you can tighten it up.  I probably should have gotten some lock-tight to hold these screws in place, but it should be alright

Mounting Bracket on back of mother board

Mounting Bracket on front of mother board

Quad Core Processor

Processor Installed with cooling fan

 

Step 2.0 5:00      Install Ram, this was fairly straight forward, I purchased 2 2GB sticks so I can later put in an extra 4GB.  The person that helped me pick out the parts also suggested a RAM cooler, for $15 I thought it probably wasn’t a bad idea.  Besides it has a cool blue LED that J

 

Step 3.0 5:10      Install Mother Board – OK let’s try this again, fairly straight forward, was a little tighter trying to get some of the screw in place but not bad.

Step 4.0 5:15      Connect the power, this one could be interesting…connecting the power wasn’t too bad, only three connectors there are two eight pin blocks, and of course I tried the wrong one first for the auxiliary power, but as I remembered from the last time I built a system, for the most part, you can’t put the wrong connector in place.

Step 5.0 5:25      Install the hard drives, this case has an awesome drive bay, I probably won’t ever fill it up but it’s a nice way to organize the hardware.  To start with I’m going to go with two Raptor 10K 150GB hard drives.  To start with I’m not going to use RAID, but have the programs on one and my source code on another as per Scott G.'s post.  I’m pretty good about committing my changes throughout the day so I’m not too worried about losing any data.  Also with this machine, I’m going to try to be very good about only installing the bare minimum on the actual host machine, then use either VM Ware or a different computer for installing all the other “crap”.  I just need this machine to fly and if I need to repave it at some point this type of configuration (only a few core apps and snapshots of my VMs) should make it relatively painless.

This was incredibly simple, access to the back with the removable back panel made this even simpler than I had hoped.

Step 6.0 5:45      Connect Power Switch, Power LED, Reset Switch and HDD LED.  This was fairly straight forward since, however since the LED’s have a +/- polarity, I needed to get this right.  I couldn’t find anything in the documentation on this however I saw a little “G” by one of the pins, I’m going to assume that this is ground or “-“, this was also on the white wire.  I have a 50/50 shot and I think I increased my odds a bit with the “G”.  I should know soon enough wrong assumption…exactly opposite is the case the white wire is the “+”.

Step 7.0 5:50      Install the rest of the front panel connectors.  External SATA (wow this could be really interesting) a few USB 2.0 connectors as well as some audio and an IE1394…I expect this to go smoothly…yup no problems.  The only gotcha here is that on the audio connector there is one for HD audio and one for AC97.  The mother board said HD so we’ll go with that one.

Step 8.0 6:00      Install the fan connectors…again I hope this to be straight forward…yup, no problem.  The only little gotcha here was the inside the coil on the cooler for the CPU the fan cable was sort of bunched up. So I had to fish this out…not really a problem.  Four external fans on this thing…it better run cool!!!  I just hope it doesn’t sound like a jet engine when I fire it up.

Step 8.5 6:05      The better half said the chili was ready, so since she let me get the new machine, I guess I better eat with her J.  I think after dinner I just need to install a graphics card and DVD drive and I should be ready to try a POST.

Step 9.0 6:45      After a quick dinner, I’m back at it now just install a VGA card and the DVD drive and I’ll be ready to test.  No problem.  I’m going to order a couple Dual DVI NVidia Cards, but for now I stuffed an older ATI PCI Express card to get ‘er fired up.

Step 10.0 6:50    Hook up keyboard, mouse, monitor and power cables

Step 11.0 6:55    Power up????????...no go L The diagnostics LEDs say Code 7F, check the POST error, but the monitor isn’t coming on.  I’m using an ATI PCIx card in an NVidia Mother board, I think I’ll try an old NVidia PCI card.  Yup, that was it…video card wasn’t pumping out anything.  Alright from unpacking to a successful POST, was a little under 3 hours with about a 45 minute dinner break.  In summary I really love the case, it was worth the extra $75.  Now for the fun!

Step 12.0 7:10    Install Windows Vista Business 64 bit edition

Complete 7:45 – probably took about ½ hour to do the complete Vista install.

Step 13.0 8:00    Overclocking - I found this thread on http://www.hardocp.com  this was a pretty good overview of everything I needed to know and was especially good since I've never done this before.  After playing with it a bit, it looks like my processor isn’t very happy at around 3.0 GHz, so I throttled it back to around 2.81Ghz and I’m running Prime 95 on it overnight to do a little stress testing.  If that looks good, I’ll probably settle in on that.  I a little worried in that a few times when I booted it didn’t find the main hard drive, but this was when I had it set to 3.0 GHz so we’ll have to keep an eye on that.

Step 14.0 9:40 Finish for today…let Prime 95 run overnight and see if I have a stable machine.

Done – 6:30 AM   Prime 95 ran all night without any problems.  The CPU’s actually remained fairly cool.  I may try to bump up the clock speed, but let’s see how a quad core 2.8GHz machine does on some basic bench marks

Benchmarks

These are from my 2.2 GHz Core 2 Duo box running Windows Ultimate with approximately 3.8 GB of useable RAM.  It should be noted that this machine is about 1 year since the last fresh OS install and is in desperate need of repaving.

1)      Power on until login screen is ready 1 minute 27 seconds

2)      Login until all the “junk” is loaded 1 minute 40 seconds

3)      Load my main VS.NET project 37 sub projects and probably about 200K LOC 22 seconds

4)      Full rebuild of my main project 56 seconds

 

Once I get VS 2008 RTM, I'll post my bench marks of the new machine

 

-ec

11/11/2007 9:38:56 AM (Eastern Standard Time, UTC-05:00)  #    Comments [1]   Hardware  |  Trackback
 Friday, November 09, 2007

DevConn 2007

I had a hard time convincing my self to go to Fall DevConnections 2007 in Las Vegas.  I was really glad I went, I think I'm finally feeling that I'm on the tail end of the learning curve with the new technology releases from Microsoft.  I can't by any stretch of my imagination an expert in any of the new technologies but at least with some recent development experiences and attending numerous sessions over the past few days at think I've got a good lay of the land, at least to a point where I have a good sense of the capabilities of the new technologies and should be able to match up a problem to the right solution. 

Here are some of my findings from this conference:
1) I'm anxious to start using VS.NET 2008 (to be released later November), specifically I'm interested in the better support for developing AJAX sites with intellisense and script debugging.  I'm also interested to see the performance enhancements in the new product.  I'm starting to get a little frustrated with some performance issues in VS.NET 2005.

2) I'm starting to "feel-the-love" with Silverlight 1.0.  Although it's extremely exciting to think that Silverlight 1.1 can be programmed with any .NET languages instead of just JavaScript as in 1.0, I'm just not there yet for 1.1.  I like it that there is a nice and small 1-2MB file that can be loaded and installed with little to no friction is great for 1.0, but although I appreciate the ambition of moving .NET into all the different worlds with Silverlight 1.1 I think there might be too many moving parts.  I think the XAML Browsers applications are probably a better alternative...we will see, I sincerely hope to be proved wrong :).

3) I think I'm starting to feel a little better about LINQ as well.  In the past LINQ seems to have been presented as a completely different way of working with data, well yes it is, but in demos I've seen this was going to start leaking into the UI layer.  It seems like there are two really different uses for LINQ, the first working with pure objects via collections of different sorts, and the second is LINQ to SQL.  As with my previous post, it seems like for the most part we should let the Database handle the getting/filtering of data and that is what LINQ to SQL does (saw some awesome demos of seeing the SQL that LINQ generates and the execute it).  I'm still not sold on the other approach (at least in the 90% apps that sit on top of a database) where we use LINQ to work with collections of objects.  I can see some edge cases where this might be kind of nice, but I just can't see this in the vast majority.  I need to get my hands dirty with LINQ to SQL, it might be a nice alternative to CodeGen which I'm still a big fan of...stay tuned.

4) I attended a session on the Microsoft Sync Platform, very cool...kind of packages up a lot of nice features I built into a client application.  It was good verification that I got the architecture right!

5) There are some new additions to WF in 2008, specifically the ability to create WCF end points for sending and receiving messages.  I can't say I completely understand this yet, but there most certainly appears to be some interesting capabilities here.  There is also a project to embed a WF designer into client applications.  This could get very interesting.

6) It seemed like in a number of sessions I went to the presenters had one problem or another with their technologies, I guess this is probably a case of being on the tail end of the betas for Microsoft's latest releases.  I also give a few presentations on some of the latest cutting edge stuff and it makes me feel just a bit better that I'm not the only one that runs into some "technical challenges" doing demos.

In summary...another good conference, the next one will be in April in Orlando 

-ec

11/9/2007 8:51:23 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]   Software Engineering  |  Trackback
Copyright © 2010 Kevin D. Wolf. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: