A Dutch software developer living in Chile
# Friday, June 05, 2009
Installed syntax highlighter

As you might have noticed in the previous post, I’ve installed syntax highlighter. This together with PreCode Snippet allows you to insert code snippets very easily using Live Writer. If you have a coding blog, I can recommend you these tools!


Friday, June 05, 2009 5:36:38 PM (Pacific SA Standard Time, UTC-04:00)  #    Comments [0]  

Adding some UI elements with jQuery to an MVC app

One of the requirements that I have on an application that I’m working on is that the user can select a date easily when a textbox has focus. I wanted this to do in such a manner that programmatically this can be done with minimum effort, and that a few extra things are taken into account:

  • Nullable dates (i.e. end dates) should be allowed with an empty text box
  • Not-nullable dates should default to the date of today
  • Multiple date pickers should be possible within the same form

Ingredients

For this to work out, I’ve used the date picker control that’s available at http://jqueryui.com/ Besides that, I’m using ASP.Net MVC 1.0

Creating an extension method for System.Web.Mvc.ViewUserControl

For the view, I’m using an extension method that’s called “DateField”. This allows me to use the date field without having to use things like “RenderPartial” and creating custom models.

This class looks like this:

public static class ViewUserControlDateFieldExtension
{
  public static string DateField(this IViewDataContainer control, string fieldName)
  {
    return DateField(control, fieldName, control.ViewData.Eval(fieldName) as DateTime?, false);
  }

  public static string DateField(this IViewDataContainer control, string fieldName, bool allowNulls)
  {
    return DateField(control, fieldName, control.ViewData.Eval(fieldName) as DateTime?, allowNulls);
  }

  public static string DateField(this IViewDataContainer control, string fieldName, DateTime? value)
  {
    return DateField(control, fieldName, value, false);
  }

  public static string DateField(this IViewDataContainer control, string fieldName, DateTime? value, bool allowNulls)
  {
    StringBuilder sb = new StringBuilder();
    sb.AppendFormat("<input type=\"text\" name=\"{0}\" value=\"{1}\" class=\"datepicker\" />", fieldName, GetFieldValue(control, value, allowNulls));
    return sb.ToString();
  }

  private static string GetFieldValue(IViewDataContainer control, DateTime? value, bool allowNulls)
  {
    if (allowNulls)
    {
      if (value.HasValue)
        return value.Value.ToString("dd-MM-yyyy");
      else
        return String.Empty;
    }
    else
    {
      if (value.HasValue)
      {
        if (value.Value == DateTime.MinValue)
          return DateTime.Now.ToString("dd-MM-yyyy");
        else
          return value.Value.ToString("dd-MM-yyyy");
      }
      else
        return DateTime.Now.ToString("dd-MM-yyyy");
    }
  }
}

Next, adding some jQuery script

Adding the script to the master page is easy. Just a few <script> tags and that’s it.

<link href="/themes/redmond/ui.all.css" type="text/css" rel="Stylesheet" />
<script src="/Scripts/jquery-1.3.2.js" type="text/javascript"></script>
<script src="/Scripts/ui/ui.core.js" type="text/javascript"></script>
<script src="/Scripts/ui/ui.datepicker.js" type="text/javascript"></script>
<script src="/Scripts/ui/i18n/ui.datepicker-nl.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
  // Configure and add a date picker.
  $(function() {
  $(".datepicker").datepicker({
    changeMonth: true,
    changeYear: true
  });
  $(".datepicker").datepicker('option', { dateFormat: 'dd-mm-yy' });
  $.datepicker.setDefaults($.extend({ showMonthAfterYear: false }, $.datepicker.regional['nl']))
});
</script>

Finally, use the class

Using the class is as easy as using this little line of code for a date field:

<% = this.DateField("EndDate", true) %>

The result looks like this:

image

The most nice part? It works in IE7, IE8, Opera, Chrome, FireFox and Safari.

UPDATE: Why use IViewDataContainer

I had a question from someone who wanted to know why I choose to extend IViewDataContainer in stead of WebControl/WebPage. The reason is simple. Both the System.Web.Mvc.ViewPage en System.Web.Mvc.ViewControl implement IViewDataContainer. This makes the interface the easiest target to implement.


Friday, June 05, 2009 5:03:17 PM (Pacific SA Standard Time, UTC-04:00)  #    Comments [0]  MVC | Programming

Giving BitLocker a try

BitLocker can work with an external USB flash drive, so I thought, let’s give this a try. In short, it works fine, I didn’t see any noticeable performance degradation, but it simply does not work for me. There are a few reasons to this, all which I’ll explain below.

The BIOS and the flash drive

My MoBo’s BIOS has a tendency to put the flash drive on top of the list when it considers which device it should use to boot up. This is a pain in the neck, since once I removed the USB drive and I insert it again, my BIOS tends to forget the changes. So the workaround would be pressing F12 during the POST or maybe updating the BIOS… This is the most nasty part of using BitLocker with a USB drive. And putting the RAID array as a secondary doesn’t work either. This is for me the showstopper.

Making duplicates of the USB flash key

This is a good thing of BitLocker, you can easily make a new flash drive using either a new key or simply copy a key from your current one. Also, the password you can put into your vault is a good thing to have. So no comments on this.

You can only encrypt drives on which Windows is installed

You can not encrypt other hard drives in the system. This means that I have 33% of my data protected, while the other is easy to get. This means for me that EFS (Encrypting File System) is a better alternative.

My conclusion

BitLocker has it’s limitations, and with a TPM chip on board things will certainly be a lot better. For notebooks I’d say: Go and use this. For a workstation? Unless you got one hard disk to protect and a TPM chip onboard, use EFS. It’s easier to manage and deploy once you’ve set it up. So I’ll be doing this for the coming hours:

image


Friday, June 05, 2009 4:25:33 PM (Pacific SA Standard Time, UTC-04:00)  #    Comments [0]  

# Tuesday, June 02, 2009
Windows 7: RTM next month

In less than 9 weeks from now, Microsoft will be RTM-ing Windows 7. Ina Fried has posted the news about 30 minutes ago on CNet news website.

Official launch date? October 22nd. We’ll have it a few months earlier though :)


Tuesday, June 02, 2009 3:40:46 PM (Pacific SA Standard Time, UTC-04:00)  #    Comments [0]  

# Monday, June 01, 2009
Putting BING to the test

Bing launched today, which is a new search engine made by Microsoft. Now the question is, is it any better than Google or Live Search?

Let’s put it to the test.

Search number one: My company. Phrase: “The Wheel Automatisering”. I’m looking for my company’s web site.

  • Google puts this at number 1.
  • Bing puts this at number 1.

Seach #2: A tech phrase which is related with my job, which is programming. The phrase: “system.net.smtpclient”. I’m looking for the MSDN documentation

  • Google puts the MSDN documentation at number 1.
  • Bing does not put the MSDN documentation on the first page.

Search #3: A phrase of the front page of the English Wikipedia: “tropical cyclone”, I’m expecting the Wikipedia article on the topic.

  • Google puts the Wikipedia article right at number 1.
  • Bing? The same result as Google.

But this result is more interesting. Bing reports a bunch of wiki’s which Google puts a news item on number 4.

Since I’m using more programming related searches and Bing did not do good on that one, I’ll be using Google for the time to come. But you know what? I started back in the 80’s with Infoseek, Altavista was later, Go.com I also used, Google came around and that’s been my favorite for the last decade, so I guess Bing has to offer something substantially better for me to make the switch.

No doubt that Microsoft will try a lot to make things even better, but popularity of pages is still the most important aspect of getting results, which is Google’s formula up to today.


Monday, June 01, 2009 4:39:11 PM (Pacific SA Standard Time, UTC-04:00)  #    Comments [0]  

Articles that don’t tell anything

Sometimes you have an article on a news website, that tells something scary and doesn’t backup it’s claims. Today there’s another one of those published at ZDNet: http://blogs.zdnet.com/security/?p=3476 

“20.000 sites hit with drive-by malware attack code”, which does not include:

  • Which type of vulnerability was used.
  • Which platform(s) where affected.
  • Which sites were affected. (I can assume that’s something they don’t want to publish because those companies might get hurt if they did.)
  • How those sites got affected.
  • Did some hackers get caught?
  • Where did these attacks come from?

But in the mean time, webmasters are worried about their sites, and this kind of news does not tell anyone how to protect their sites against these attacks. So please explain me, what is the use of putting an article like this in the wild? The only reason I can think of, it getting more advertising revenue.

So folks at ZDNet: Do your research, post a complete story and don’t go into scare tactics, most people are more than tired of that, including yours truly.


Monday, June 01, 2009 4:21:31 PM (Pacific SA Standard Time, UTC-04:00)  #    Comments [0]  

# Sunday, May 31, 2009
How to figure out who’s behind a Mafia Wars attack

Anyone who’s playing Mafia Wars online using facebook can easily find out who is attacking or robbing property. An example…

image

Right-click on the name “Pedro” and copy the link… you get something like: http://apps.facebook.com/inthemafia/remote/html_server.php?…&user=1619114746

The “user” part is important here… Take that number and put it into this URL: http://www.facebook.com/profile.php?id=1619114746

Paste that URL into the browser and voila!

image

Nice to know you, Richard Burt :)

So you’re not anonymous in Mafia Wars, and no, I don’t hold any grudges because it’s just a game, and robbing is just a part of it.


Sunday, May 31, 2009 3:11:20 PM (Pacific SA Standard Time, UTC-04:00)  #    Comments [0]  

# Friday, May 29, 2009
My new PC Components

Yesterday night I’ve installed my new PSU and one of my new graphics cards. The other one will have to wait, because my current Mobo has a bit of a problem. Guess where the SATA connectors are? Yep, right below the card, which means I either yank out 3 disks or I replace the board if I want to have my new graphics card installed.

This is a big disappointment, but that does not stop me for looking a bit further, it seems that they sell DFI boards at PCFactory. I’ll order a DK 790FXB M2RS which has the SATA ports on the side of the board and has all the nice over clocking features that you only can dream of. It’s just too bad they don’t sell the “H” model, which includes a better heat sink and heat pipe. So I guess a few extra ventilators will have to cool down the system.

Besides this, the new PSU does an outstanding job, as well as my new card. I’ve tried Call of Duty 5 and with everything maxed out, it simply runs fluently. One word: Fantastic!

So this board will be my new one:

image

Time to place another order… board number 4. (One ECS died after 8 months of use, 2 are still in service but one is replaced because of this mess.)

Update: Since this board doesn’t have a heat pipe, and the cooling is kind of important when you’re working with a 3 Ghz processor and 2 huge video cards, I’m still looking a bit further so see if there are some alternatives.


Friday, May 29, 2009 9:41:39 PM (Pacific SA Standard Time, UTC-04:00)  #    Comments [0]  

# Thursday, May 28, 2009
A closer look at my new AT HD2870 cards

The first question you might have: Why did you buy 2 of these monsters? Reason: I have 3 monitors. And not just simple monitors, but these babies:

image

Each has a resolution of 1920 * 1200,  which brings the total up to 6.912.000 pixels. My current HD2600XT and HD2600 PRO are simply not cutting it. I’ve got poor performance with Windows Aero and even worst with Windows Presentation Foundation. Gaming is out of the question, it simply stutters too much and I get shot dead even before I can aim… (which does not have anything to do with my gaming skills!)

So that answers the “Why?” question. Now let’s take a look at the rest. The HD4870 can be crossfired, but once you do that, you have only one monitor to work with. So what I want is that my primary monitor will do the heavy lifting (the one in the middle), and the other 2 on the sides are used with ATI Surround View. ATI’s CCC (Catalyst Control Center) is for this a big help. You can use CCC for enabling and disabling Crossfire. Simply make 2 profiles, one with Crossfire enabled and one without Crossfire and with 3 monitors enabled. Guess what the result is? Excellent performance for my programming work, and even better for gaming. Now that would be ideal, wouldn’t it? This is what I’m trying to accomplish, I’ll know if it works once my system is installed. 

The cards

image

When opening the box, this is what you get. Crossfire cable, power cables which you can use if you PSU doesn’t have the right connectors, a DVI2HDMI and DVI2VGA connector, Composite video cable, SVHS, a CD and a little booklet. Oh, and the video card of course ;)

The card is quite big. It will probably be the biggest video card I’ve seen, but since I’m out of the hardware business a long time now, that doesn’t say much. It uses 2 slots, one for ventilation, the other for connecting the screens.

image

This heat sink is no joke…

The card requires 2 PCI-E power connections.

image

With 1 GB of GDDR5 memory, it should make my PC considerably faster. The rest is already in place (1 Quad core 4 Ghz Proc, 8 GB memory and 2 RAID0 sets on SATA2 hard disks), this is just the final piece of the puzzle.

Next post within a few hours, with some more photos.


Thursday, May 28, 2009 8:20:22 PM (Pacific SA Standard Time, UTC-04:00)  #    Comments [0]  

A closer look at my new PSU

image

I have never had a modular PSU with these kind of connectors, it was for me kind of surprising to see how these cables are all put together.

First, I wanted to make sure that my PSU supports 230V. In the manual it states: “Make sure the correct input voltage is selected and change the switch if necessary.” I’m looking for a switch but I can’t find it anywhere. On the side sticker it says: “115V-230V 60/50Hz”, so it seems that this PSU does figure it out by itself. I wanted to be absolutely sure though, so I looked it up online. There the specs of my specific model said: “Full range active PFC”… which kind of gives me a hint that this should be the case. Looking a bit further, yep. An “Full range active PFC” means actually: “Full range active power factor correction”, which does figure out what the input voltage is and corrects it when needed. When I would have 160V here, it still would work. (I’ve got 220V)

So it’s safe to plug it into my outlet here. Now the next step, the cabling. This PSU comes with 8 cables to connect to peripherals, which each include 2 or more connectors to connect to your devices and one connector for the PSU. The PSU has 4 connectors that are reserved for video cards, and 4 for other appliances. The motherboard cables are hard-wired.

One cable contains for example 4 SATA connectors and another one contains  a PCI-E Graphics connector. In total you’ll have enough to connect 2 full-blown heavy-duty graphics adapters without a problem.

image image image image image image image image

 image The nice part of a modular PSU is that you only have to connect the cables you actually need. Other cables you can leave in the box and those do not clutter up your system (and prevent proper cooling.) There’s a huge ventilator on that thing. I’ve never seen a ventilator of that size before, it is simply as wide as possible. That will do the job of cooling. It’s quite big… did I mention it’s big? It’s also quite heavy, a 4.1 Kg of metal.

I’ve been reading some reviews (before I bought it) and I’m curious to see it in action. In less than 2 hours my friend arrives here and we’ll build this machine.

About cooling, I’ve got a big case, a side-fan and a big front fan. I hope it is enough.

Can I recommend this PSU? I’ll know once it is installed. Time for some open-heart surgery :)


Thursday, May 28, 2009 7:44:45 PM (Pacific SA Standard Time, UTC-04:00)  #    Comments [0]  

Jippie, just got my things :)

I' just received my 2 video cards and the power supply I ordered. I have never seen anything remotely like it, what a huge devices.

My video cards looks like this:

image

These Radeon HD4870 cards are fast and also consume a lot of power. So I bought the right power supply to go with it:

image

This beast does a 1000W, has an amount of cables I’ve never seen come out of a PSU and – most importantly – does 220V/50 Hz :)

Tonight I’m going to build my machine, and I’ll report back on how it went. Can’t wait!


Thursday, May 28, 2009 5:55:20 PM (Pacific SA Standard Time, UTC-04:00)  #    Comments [0]  

This is weird…

I’m getting a YSOD (Yellow Screen of Death) on this line of code: (Line 19)

Line 17:       <td valign="top">Geslacht:</td>
Line 18:       <td>
Line 19:         <% = Html.RadioButton("Gender", "M", Model.Gender == 'M') %> Man<br />
Line 20:         <% = Html.RadioButton("Gender", "F", Model.Gender == 'F') %> Vrouw<br />
Line 21:       </td>

Model is not null.

[NullReferenceException: Object reference not set to an instance of an object.]
   System.Web.Mvc.HtmlHelper.GetModelStateValue(String key, Type destinationType) +63
   System.Web.Mvc.Html.InputExtensions.InputHelper(HtmlHelper htmlHelper, InputType inputType, String name, Object value, Boolean useViewData, Boolean isChecked, Boolean setId, Boolean isExplicitValue, IDictionary`2 htmlAttributes) +328
   System.Web.Mvc.Html.InputExtensions.RadioButton(HtmlHelper htmlHelper, String name, Object value, Boolean isChecked, IDictionary`2 htmlAttributes) +193
   System.Web.Mvc.Html.InputExtensions.RadioButton(HtmlHelper htmlHelper, String name, Object value, Boolean isChecked, Object htmlAttributes) +67
   System.Web.Mvc.Html.InputExtensions.RadioButton(HtmlHelper htmlHelper, String name, Object value, Boolean isChecked) +16
   ASP.areas_agencies_views_contact_contactedit_aspx.__RenderContent1(HtmlTextWriter __w, Control parameterContainer) in c:\VSP\Boulder\The Wheel Ict CV\TheWheel.IctCv.Web\Areas\Agencies\Views\Contact\ContactEdit.aspx:19
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +256
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
   System.Web.UI.Control.Render(HtmlTextWriter writer) +10
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   ASP.views_shared_site_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in c:\VSP\Boulder\The Wheel Ict CV\TheWheel.IctCv.Web\Views\Shared\Site.Master:25
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +256
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
   System.Web.UI.Control.Render(HtmlTextWriter writer) +10
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
   System.Web.UI.Page.Render(HtmlTextWriter writer) +29
   System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer) +59
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266
Anybody got any ideas?
UPDATE: It had to do with the fact that the field validation caused problems when multiple fields have the same name. 


Thursday, May 28, 2009 1:06:58 AM (Pacific SA Standard Time, UTC-04:00)  #    Comments [0]  

# Tuesday, May 26, 2009
Getting support faster via Twitter

I just read an excellent post by Scott Hanselman, about getting quicker (and better service) via Twitter than via a 1-800 number

My company does not hunt Twitter yet, maybe we should? Of course my company provides good service to their clients, it’s our specialty! But then again, we don’t do retail :)


Tuesday, May 26, 2009 7:01:36 PM (Pacific SA Standard Time, UTC-04:00)  #    Comments [0]  

Help in Visual Studio

I press F1 in Visual Studio… and guess what…

image

This took more than 5 minutes…

After that:

image

And then…

The help item that I did not need…

Is it me, or is this really a productivity killer?


Tuesday, May 26, 2009 6:28:07 PM (Pacific SA Standard Time, UTC-04:00)  #    Comments [0]  

Trying out Visual Studio 2010… no WiX :(

I’ve been playing with Visual Studio 2010 a bit (the Team Suite edition) but I noticed that WiX was not included…

image

Looking a bit further… http://robmensching.com/blog/posts/2009/4/1/Visual-Studio-will-not-ship-the-WiX-toolset-contributes-only

The WiX toolset is a great compliment to Visual Studio. WiX provides complete access to the Windows Installer technology and integrates well into the build process. Visual Studio will continue to contribute to the project but will not ship the WiX toolset.

Simply put… this is a sad story. WiX is perfectly ready for simple deployments, and does a great job of generating MSI installers. Notice that the MSI itself is installed with Windows Installer and therefore this is not a process that is effected by the Beta. Problems arise when WiX would generate incorrect MSIs, but this can (and of course is) checked before deployment. Once the MSIs are OK, installation is not affected by WiX.

Shortly it comes down to this: WiX V3.0 will be locked down for Visual Studio 2008, which is the IDE we use here to develop production code. WiX V3.5 will be created for Visual Studio 2010, which will be released about the same time Visual Studio 2010 releases. It will still be an add-on, but a good one at that. I hope that they will have WiX production stable by the time Visual Studio 2010 ships, which looks more and more like the end of 2009. Probably we’ll migrate here to 2010 about 1 month after it ships.


Tuesday, May 26, 2009 12:35:27 AM (Pacific SA Standard Time, UTC-04:00)  #    Comments [0]  

# Monday, May 25, 2009
It’s almost here

My package has arrived in Santiago, so tomorrow morning will be the paperwork for custom clearance.

image

This is good news, because this means that I’ll be able to speed up my system. I bought 2 video cards (2x Saphire ATI HD 4870) and a power supply (1KW) online. These cards are significantly faster than the HD 2600 XT and the HD2600 PRO, which are the ones I’m using today. Can’t wait!

-- Jeroen


Monday, May 25, 2009 4:28:21 PM (Pacific SA Standard Time, UTC-04:00)  #    Comments [0]  

Another blog is live

I just finished setting up a blog for my wife’s little club, the “Clan de los monos” (or in English: “The Monkey Clan.”) This name, by the way, has absolutely nothing to do with Rokugan. She has a tendency to call everyone around here a “Mona” or “Mono”, which is Spanish for “Monkey”, so that’s why.

The blog will be a multi-athor blog in Spanish, which you can see at http://www.a-micos.com This blog is served on the same server as the blog of yours truly.

-- Jeroen


Monday, May 25, 2009 4:09:07 PM (Pacific SA Standard Time, UTC-04:00)  #    Comments [0]  

Microsoft Aims Big Guns at Google, Asks Consumers to Rethink Search

Microsoft’s marketing department is a(t)/(dd)-it again… A $80-$100 mln for attacking their major Internet rival, Google. See http://adage.com/digital/article?article_id=136847

Come’on MS, create a better search engine if you want to attack Google, because your products are great, but Live Search sucks big time! Instead of spending all that money on advertising, you should spend it on hiring the best minds for this job and increase the quality of your product. $80-$100 mln buys a lot of talent, workers and knowledge.

-- Jeroen

(Yeah, I know this is my opinion, it’s also my blog so I’m allowed to express it.)


Monday, May 25, 2009 1:13:43 PM (Pacific SA Standard Time, UTC-04:00)  #    Comments [0]  

Long Zeng: Higher resolution Windows 7 logo, presention style guide and retail concept all leaked in one big burst

This is some cool stuff! Microsoft’s marketing department did a great job again:

See the post here


Monday, May 25, 2009 10:40:08 AM (Pacific SA Standard Time, UTC-04:00)  #    Comments [0]  

Passports – It’s that time again

My passport is due to expire in March 2003, but knowing that they are going to change the proceedings for passports in Europe, I’m going to change mine a bit ahead of schedule.

My brother alerted me on this and he told me that they are about to change the rules soon. I asked the consul here and guess what? I have 2 weeks to arrange it here, after that I have to go to Santiago to arrange my passport.

Santiago is about 850 kilometers from here, which means: a 2-day trip at the least.

To my brother: A BIG THANKS for alerting me! I’ll be arranging this A.S.A.P.


Monday, May 25, 2009 10:34:51 AM (Pacific SA Standard Time, UTC-04:00)  #    Comments [0]  Chilean Adventures