Tuesday, December 18, 2007

If you've ever listened to Hanselminutes, you've no doubt heard Scott mention "code smell" or "pretty code".  The new language features in VB9, including LINQ and XML being a native type, make XML generation not only easy, but beautiful.  Aside from the color scheme, look at how smooth this code snippet is.

Dim _order As New XElement(<Order>
    <ShipperRef><%= h.UniqueRef %></ShipperRef>
    <UniqueRef><%= IIf(h.CustomerPo <> "", h.CustomerPo, h.JdeNumber) %></UniqueRef>
    <Comments><%= _orderComments %></Comments>
    <OrderType><%= h.OrderType %></OrderType>
    <Workflow><%= h.Workflow %></Workflow>
    <RORRelationship><%= h.RORRelationship %></RORRelationship>
    <Supplier><%= h.SupplierNumber.ToString %></Supplier>
    <Customer><%= h.Customer.ToString %></Customer>
    <FreightBillableParty><%= h.FreightBillableParty %></FreightBillableParty>
    <MethodOfPayment>Prepay</MethodOfPayment>
    <HAZMAT><%= h.Hazmat %></HAZMAT>
    <GroupAssignment><%= SetGroupAssignment(h.GroupAssignment) %></GroupAssignment>
    <Weight><%= _orderWeight.ToString %></Weight>
    <Volume><%= _orderCube.ToString %></Volume>
    <OrderContact><%= h.PrimaryContactAssignment %></OrderContact>
    <ShipmentContact><%= h.PrimaryContactAssignment %></ShipmentContact>
    </Order>)

My VS 2008 theme is DesertNights, and the code was copied with CopySourceAsHtml.

 |  |  | 
Tuesday, December 18, 2007 12:41:21 PM (Eastern Standard Time, UTC-05:00)
 Tuesday, December 11, 2007

Tip: Install one of the Express editions before you go.

Visual Studio 2008 Installfests are going on around the country.  We had ours in Pittsburgh today, and the place was packed.  It was fun just to tinker with a bunch of other developers around.

Most people brought laptops, which means there were varying degrees of success with the installation (usually due to incomplete removal of beta bits).  One of the longest parts of the process is the installation of the .NET 3.5 Framework.

My installation was flawless and quick.  Just after VS 2008 shipped, I installed VB.NET express, which included the lengthy framework installation.  Since I already had he framework, my installation was complete a great deal of time before anyone else's, and I had time to bang out a quick Linq demo.

In some towns, there are little programming or example contests for swag.  The extra time could do you some good.

Tuesday, December 11, 2007 7:12:48 PM (Eastern Standard Time, UTC-05:00)
 Wednesday, November 28, 2007

December 11, 2-4 pm, or 5-7 pm (two sessions). 

Tuesday, December 11, 2007 (EST) - Visual Studio 2008 Community Launch Party

location: Microsoft Offices

Join us for the Visual Studio 2008 community launch party at Microsoft! We're having 2 sessions: 2-4 pm and 5-7 pm, with lots of giveaways, including 125 full Visual Studio 2008 licenses!

Join the Pittsburgh .NET User's Group on Tuesday, December 11th for
our Visual Studio 2008 Launch Event.  Danilo "Dani" Diaz, Microsoft
Developer Evangelist for Microsoft's Mid-Atlantic Region will be our
featured speaker.  Dani will be demonstrating the new features of
Visual Studio 2008 along with the new features of the .NET Framework
3.5.  Bring your laptop as we'll be providing trial editions of VS2008
for you to install and try out new features as Dani discusses them.
We'll also have a coding competition to see who can utilize the new
VS2008 features the best in creating a killer app; winners of the
local coding competition will be entered into a regional competition
where the stakes (and prizes) definitely increase!  All attendees (up
to a max of 125) will receive, via email, a free license to Visual
Studio 2008 Professional.
 
Due to the expected turnout for the event, we will be having two
sessions for our launch event.  Both will be held at Microsoft's
offices on the North Shore.  The sessions will be held from 2-4 PM and
from 5-7 PM on Tuesday, December 11th.  We'll also have lots of
give-aways at both events.  So come to the December .NET User's Group
on Tuesday, December 11th, and kick your holidays off to a good start.

 
Full info and RSVP link at http://pghdotnet.org/Events/430.aspx.

Wednesday, November 28, 2007 11:55:21 AM (Eastern Standard Time, UTC-05:00)
 Wednesday, November 21, 2007

You may receive this error if:

  1. you created a project in a pre-release Visual Studio 2008, and
  2. your project contains DBML files (created by database designer, like when using LINQ), and
  3. This is the first time you're opening the project in VS2008 RTM.

Fortunately, the answer is simple.  In the code view of the DBML file, you need to change the encoding from utf-16 to utf-8.

Thanks to Julie Lerman for the solution.  Some additional information at Converting web site projects from Visual Studio 2008 Beta 2 to Visual Studio 2008 RTM.

Wednesday, November 21, 2007 3:39:31 PM (Eastern Standard Time, UTC-05:00)
 Tuesday, November 20, 2007

You need to get out waaaaayy more if I'm the one telling you Visual Studio 2008 has shipped for MSDN subscribers.  It's available for download as of yesterday from the MSDN Subscribers Download.

Kudos to the Visual Studio team this time--uninstillation of beta 2 and installation of the RTM bits is so much smoother this time.  Not everything you need to uninstall is removed when you remove beta 2, so you have to go through the add/remove programs and get the stragglers.  Use the list at http://www.microsoft.com/express/support/uninstall/ for guidance.  But, some of the names on the list vary slightly (Crystal Reports 2007 was listed in my Add/Remove as Crystal Reports for Visual Studio 2008), but they're easy to match up.  Also, some of the items on the list (e.g., Microsoft .NET Framework 3.5) are removed by the beta 2 uninstaller, so you may see them in Add/Remove, and get an error when you try to uninstall them.  They clean up with the next reboot.  Expect 2-3 hours of uninstallation, manual clean up and reinstallation.

All in all, though, so much better than with VS 2005.

Tuesday, November 20, 2007 5:26:00 PM (Eastern Standard Time, UTC-05:00)

The ACE Team (Application Consulting and Engineering) has released a beta version of their tool to scan managed code and detect potential vulnerabilities to cross-site scripting.  XSSDetect runs as a visual studio plug-in.

From their blog:

One of the biggest, constant problems we've seen our enterprise customers deal with and we here at Microsoft have to also contend with is that of the XSS (Cross Site Scripting) bug.  It's very common and unfortunately, still an issue we have to deal with in many web applications.  Internally, the ACE Team has been working on several projects to help mitigate and fix these issues, as well as detect them in the code bases that we review so that they can be fixed before going live.

They also have a follow-up post which discusses using XSSDetect to scan large applications.  For very large applications, you may run into an "out of memory" error.  Besides bigger and badder hardware, the suggestion is to analyze binaries in smaller chunks.

Tuesday, November 20, 2007 12:37:16 PM (Eastern Standard Time, UTC-05:00)
 Monday, October 29, 2007

When working with some Linq today, I kept getting the following error:

String must be exactly one character long.

This one had me scratching my head for a while.  Turns out the problem was in the Linq to SQL designer, and the way the code generator interpreted results from the view I was using.

The problem stems from the designer translating a varchar(1) to a system.char(1), a fixed length variable, instead of a system.string, which can have a variable length.  If the value is blank or NULL (allowable in the database), the fixed length condition isn't met and an error is thrown.

To remedy this, go back to the designer, pin the Properties sidebar open, and look at the elements which have been mapped.  Any one which is mapped to Char(1) should be changed to a String.  This should fix your problem.

Below, the image on the left shows the improper mapping, and the image on the right shows the fixed mapping.

Monday, October 29, 2007 5:34:47 PM (Eastern Standard Time, UTC-05:00)
 Friday, October 19, 2007

Anytime something doesn't work quite right, there's always the question of which version and service pack level of SQL Server you're running.

For SQL Server 2005, there's a simple query you can run which will tell you the version, service pack and edition (standard, enterprise, etc):

SELECT  SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition')

The full article, with queries for SQL Server 6.5 to 2005, is at http://support.microsoft.com/kb/321185.

Friday, October 19, 2007 11:25:23 AM (Eastern Standard Time, UTC-05:00)
 Sunday, September 16, 2007

Flip Video Ultra Series

Summary: Totally unsuitable for a wedding videographer, but a total blast for a wedding guest.

I'm on my way to a conference next week, and I want to take a small video camera with me.  After reading the Wall Street Journal's review, I picked up the Flip Video Ultra Series today.  w00t!

Unboxing the Flip was pleasant--their packaging engineers obviously took notes from Apple's group, since the experience was evocative of unboxing an iPod.  When you remove the inner packaging, you're greeted with the question "What will you see today?", which makes you feel creative, or at least feel like trying to be creative.

Immediate gratification nuts will be pleased that the Flip video is powered by two AA batteries, which are included in the box.  Not only can you start playing with the camera immediately, if you find yourself short of power, but far from a plug, you can usually find AAs nearby.

Recording your first video is almost too easy.  Find the dog or the baby, turn on the device, aim it, and press the red button to start.  You're recording!  Press the same red button to stop.  When you have a video or two, you can play it back on the small screen on the back of the camera.  Or, it's time to connect the Flip to your computer.  Simply turn it off, pop out the USB connector (it opens with a sexy switchblade type of action), and plug it in to the USB port on your computer.  You might want to think about a USB extension cable here, if your USB ports are in an awkward location or closely packed (honestly, nearly all of them are).

I plugged the Flip in to my laptop's USB port, and it was recognized instantly, even on a very old laptop running Windowx XP SP2.  It showed up as an extrernal drive, so I could copy the AVI file from the Flip to my laptop.  However, when I tried to play the video, Windows Media Player needed to downlad a codec, which failed.  I was prompted to download an update to WiMP, which started the lengthy process of downloading and installing WiMP 11.  Even on cable internet, this takes a while, and requires a reboot to finish.  If Windows Media Player gives you problems, just avoid it.  The good news is, the wonderful Gomplayer worked like a charm.  And, being free, I'd recommend checking this out, rather than diddling around with Windows Media Player.

The Flip Video also includes its own software, which I tried after my experiment with Gomplayer.  The software lives and runs on the camera, so there’s no installation.  On PCs with the autorun feature turned on, the software should automatically start when you connect the camera.  The camera’s software allows you to play videos directly on the device, copy them to your computer, share them with  others via e-mail, YouTube, AOL Video or shrink the viideos for uploading to other sites yourself.  Also included is Muvee, which you can use to make video mashups with what you record.  There is software for both Mac and Windows.  For uploading, videos are converted to WMV from AVI, and shrunk to a smaller screen size.  Even still, on a computer monitor, the compressed videos had enough detail so you really knew what was going on.

This is a device meant for small-screen recording, and fairly close to the subjects.  The zoom is only 2x, so this isn't a device you'd want to use to record a seminar from the back of the room.  It might work in a classroom to record lectures, but it's really better designed for carrying around and shooting in close social environments.  The condensor mike is internal and on the front of the camera, and doesn't pick up sounds too far away, which can also be a good thing since there isn't a lot of background noise.  What's really impressive is the way the camera automatically and quickly adjusts to light conditions.  You can point the camera at a TV or window, and in around a second, the camera has adjusted itself so you have a clear image of what's on TV or going on outside.  Pan back to a darker area, and again in about a second the camera has readjusted itself so you have a fairly clear view of what you’re aiming at.

Included in the package is a cable you can use to connect the Flip Video directly to a TV (the standard 1 video/stereo audio cable, nothing fancy).  I did the experiment, and hooked my Flip up directly to a 34” Sony Bravia HDTV.  On this TV, the picture quality is lower than an analog TV signal, but still good enough to share party or vacation videos on.  I recommend sticking to lower resolution PC monitors, but on a standard TV, you probably couldn’t tell the difference between the Flip and the TV signal.

While talking to the sales guy, my buddy Jon Palmiero of Honda North walks by, and starts ogling the Flip Video I'm carrying.  He was picking up a new point-and-click for an upcoming vacation, and I promised he could play with my Flip when he gets back.  Watch for some little videos on their blog (http://www.hondanorthblog.com/) after we're all back from vacations.

Overall, I'm really impressed.  I wondered about the video quality and the light adjustment, but both seem to be quite good.  I'm not sure if I'd hand this to a very small child, but older children would have a blast with this camera, and even your grandmother could use it.  There’s nothing fancy about this camera—it’s just a little device which works.

Positives:

  1. Unbelievably incredibly easy to use.
  2. Very compact--almost the identical size as my Treo 700w (minus anntenna).
  3. Decent image quality with good automatic exposure compensation, but meant for the smaller, lower resolution screens.
  4. Tripod connector, for stability
  5. The software is carried around on the device, so no matter what computer you plug into, you can compress and share the videos you make, right from the camera.
  6. 2 GB of onboard RAM, no cards, hard drives, tapes, etc.

Negatives:

  1. Tough to plug in on my laptop with a second device (such as the wireless mouse fob), and when it is plugged in, it hangs a little awkwardly from the USB port.  I recommend purchasing a USB extension cord.  It would be really cool if they're include even a short one in the package--I tink that would be more useful than the cable to connect the camera to your TV.   I would have happily paid a few bucks more to have a short cable included in the package, and avoid the PITA (and wait) of obtaining one myself.
  2. Since the software lives on the device, you will need something else to play/edit your files when the camera is not connected.  Use your favorite, or check out Gomplayer to play, and find an editor on this list of open source video editing software.  If you’re really into the portability aspects, you can find portable versions of a couple of tools at Portable Apps.
  3. No lens cap.  Be really, really careful with the camera.
  4. No pause function.  You start and stop, but can’t pause a recording.
  5. You get 60 min, and then you need to move some videos to your PC.  You can’t simply switch out a tape or a memory card.
Sunday, September 16, 2007 7:38:35 PM (Eastern Standard Time, UTC-05:00)