Friday, December 25, 2009

Vizio TV Remote Code for Samsung BDP 1590/1600 Blue Ray Player

The manual does not list a code for the Samsung BDP 1590/1600s remote so that it can control a Vizio TV. I found that the LG TV code worked for me:

Press and Hold the TV power button on the Samsung Remote. Press 1,9 (code 19). Release the power button. Your TV should shut off (or turn on based on whether it was on or off before you started this process). This means that you found the right code for your TV.

Only downside: the TV source button did not work for me. Yet, this is better than lugging around 2 remotes to watch a movie.

Next: Looking for the remote code to control the BlueRay player using my Comcast DVR remote. (any ideas any one?)

Thursday, December 24, 2009

Changing the SMTP server used by Team Foundation Server (TFS)

Go to the folder: [TFS_INSTALL_FOLDER]\Web Services\Services (typically this will be “C:\Program Files\Microsoft Visual Studio 2008 Team Foundation Server\Web Services\Services”)

Open up the web.config file and update the following to values under “appSettings”
<add key="smtpServer" value="smtp server address" />
<add key="emailNotificationFromAddress" value="from email address" />

Monday, December 21, 2009

Session state unavailable in Global.asax event Application_PostAcquireRequestState

Under some circumstances (typically application start up and shut down) I would get the following “Session state is not available in this context” error within the Global.asax event: “Application_PostAcquireRequestState” whenever I tried to access the Session object.

image

According to the documentation: “The PostAcquireRequestState event is raised after the AcquireRequestState event has occurred.” And the AcquireRequestState documentation states: “Occurs when ASP.NET acquires the current state (for example, session state) that is associated with the current request.”

So I am not sure why the Session object was not available in the PostAcquireRequestStateMethod. The simple way around this issue is to wrap the access to Session state object in a try catch block and forget about it. But it bothered me, because I had the debugger set to break at all exceptions. So I wanted to find a better way.

And the better way is to wrap your access to the Session state object in the following if statement:

if (Context.Handler is IRequiresSessionState || Context.Handler is IReadOnlySessionState) {….}

Not sure exactly why the method gets called multiple times, but by making sure the ContextHandler needs the session state object, we can be sure that the session state object is available – as our access is from the PostAcquireRequestStateMethod event.

Reference:
http://msdn.microsoft.com/en-us/library/system.web.httpapplication.acquirerequeststate.aspx
http://msdn.microsoft.com/en-us/library/system.web.httpapplication.postacquirerequeststate.aspx

Saturday, December 19, 2009

DenverGov.org 1999 – 2009 – An evolutionary tale

Yesterday, we released a new version of the City and County of Denver’s website. It is mainly a skinning change authored by our web-master (Chani Goering). (The site is also undergoing changes related to hardware as well as the technologies used by some of the applications hosted on the site).

At this point I thought it would be good to take a look at how DenverGov has evolved since 1999 (the earliest that I could find a historical archive for the website). It is a telling tale and clearly shows the major leap that yesterday’s update to the site made in to the Web2.0 age.

Here is a video of the presentation taking you on a tour from 1999 to 2009.

And here is the presentation as a GoogleDoc

Thursday, December 17, 2009

JQuery Print Plugin

Just found the Jquery print plugin “JQuery Print Element” by ErikZ – works great.

http://plugins.jquery.com/project/printElement

Demo: http://erikzaadi.github.com/jQueryPlugins/jQuery.printElement/Sample

Only thing that I had to change was the use of $ symbol in the JS code (as in my environment it conflicts with some other JS APIs that I use).

Saturday, December 12, 2009

Some Gmail features have failed to load due to an Internet connectivity

Google Chrome error: Some Gmail features have failed to load due to an Internet connectivity

The above error started happening since yesterday in Google Chrome whenever I tried to open an email. I found that clearing the browser history fixed it.

Click on Wrench Icon.
Click on Options.
Goto Personal Stuff tab.
Click on Clear browsing history, select everything and then Clear Browsing Data.

Shutdown Chrome and then restart it.

Thursday, December 10, 2009

CSS – Style Inheritance

I was wondering how I could get style inheritance so that I could derive new styles from an existing style.

Looks like that is not possible (please correct me if I am wrong).

But the next best thing is to realize that you can use multiple styles on an element. The style is applied left to right. This provides a behavior that would be similar to what inheritance would provide me.

example:

.style1 { color:red; }
.style2 { font-weight:bold; }

To apply them both on a DIV:
<div class=”style1 style2”>Hello World</div>

ASP.Net – Custom Validator – Setting the error message in client script

Question: How do you set the error message in the Client Validation Script.

Answer: If the client validation method is called CheckEntry, then your code would need to look like this:

<script type="text/javascript" language="javascript">
    function CheckEntry(sender, args) {
        ctrl1 = document.getElementById("<%=ctrlToValidate1.ClientID%>");
        ctrl2 = document.getElementById("<%=ctrlToValidate2.ClientID%>");

        if (isBlank(ctrl1 .value) && isBlank(ctrl1 .value)) {
                args.IsValid = false; 
                sender.errormessage = "Please provide atleast one search criteria"
                return;
            }
        }
        args.IsValid = true;
        return;
    }
    
    function isBlank(str) {
        str = ValidatorTrim(str);
        if (str == null || str.length < 1)
            return true;
        else
            return false;
    }
</script>

The error message is updated via the sender.errormessage property. The “ValidatorTrim” method is provided by a method from JavaScript that ASP.Net injects for you into the page whenever you use a validation control.

Simple and Easy!

ASP.Net - Custom Validator – Multiple Controls

In ASP.Net, when you use a CustomValidator, it is easy to make it validate one control. But how do you use it to validate multiple controls (for eg: you want to make sure that if the City field has been filled out then you want the State field to also be filled out).

You first create your custom validator. But you do not assign it a ControlToValidate. Instead you add the following code to your aspx/ascx file:

<script type="text/javascript">
<!--
    ValidatorHookupControlID("<%= ctrlToValidate1.ClientID %>",
     document.getElementById("<%= customValidationCtrl.ClientID %>"));
    ValidatorHookupControlID("<%= ctrlToValidate1.ClientID %>",
     document.getElementById("<%= customValidationCtrl.ClientID %>"));
    ValidatorHookupControlID("<%= ctrlToValidate1.ClientID %>",
     document.getElementById("<%= customValidationCtrl.ClientID %>"));
//-->
</script>

The “ValidatorHookupControlID” method used above, is automatically injected into the page for you by ASP.Net whenever you use a validation control in your page.

One thing that I found is that I needed to add the code to the end of an ascx control, or next to the end of the form tag in an aspx page. Otherwise it throws an annoying JavaScript error.

HTML – Nested tables – removing the space

If you have nested tables then you will notice that there is a space between the 2 tables.

Sample nested text
Sample Text

To fix this, all you need to do is set the cellspacing="0" cellpadding="0" for the 2 tables.

Sample nested text
Sample Text

Tuesday, December 08, 2009

More climate data – global annual temperature variations since 1880

This time I decided to look at the range between the maximum and minimum temperatures annually. The data again is from the Goddard Institute for Space Studies (GISS). (Global-mean monthly, annual and seasonal dTs based on met.station data, 1880-present, updated through most recent month)

What I thought I would see is a range that grew since 1880. But instead what I observed was that the range grew smaller. But what was even more surprising is that both the maximum temperature and the minimum temperature trendlines were both sloping upwards. This meant that not only were the summer months getting warmer, but so were the winter months!

http://spreadsheets.google.com/pub?key=t1-Xl4C6zccrFEDvd5aBMsg&output=html

global temperature variations since 1880 
TMax – trendline for maximum temperature, TMin – trendline for minimum temperature, TRange – trendline for range

I havent seen this analysis before, so if you happen by this post, I would be interested in your thoughts.

Monday, December 07, 2009

Climate Facts – 10 warmest years

Based on data from the Goddard Institute for Space Studies (GISS), the 10 warmest years on record occurred in the last 11 years.

Here is a Google Spreadsheet with the data from GISS:

http://spreadsheets.google.com/pub?key=tiOjptDEMMFEh1JlYEzXWyA&single=true&gid=2&output=html

Read more:
http://data.giss.nasa.gov/gistemp/graphs/

Date downloaded from: http://data.giss.nasa.gov/gistemp/graphs/Fig.A2.txt

URI vs URL – whats the difference?

First off – URL is deprecated terminology. You are better of using URI where ever you used to use URL.

Here is why:
URI – Uniform Resource Identifier
URL – Uniform Resource Locator
*notice: its not universal as many end up calling it – it is uniform.

The URI allows for the identification of resources using the identifier. The following are all examples of URIs:
ftp://ftp.sample.com/samplefiles/readme.txt
http://www.sample.com/samplefiles/readme.html
http://www.sample.com/samplefiles/readme.txt
https://www.sample.com/samplefiles/readme.html
mailto:jane.doe@sample.com

Even the scheme “tel:+1-800-800-8000” is considered a URI. In the early days (!), a URI was either a URN or a URL (i.e, the URI either referred to the the name without the location or the location of a resource). The term URL is now considered to be a URI that identifies a resource via its access mechanism (http, ftp, etc). Here the http, ftp, etc in the URL address are known as URI schemes (and define the syntax that is legal in the URI). So just remember, basically the URL is a subset of URI. (i.e., all URLs are URIs).

So, instead of worrying about the difference, just use the TLA URI instead of URL from now on.

reference:
Uniform Resource Identifier: Generic Syntax: http://labs.apache.org/webarch/uri/rfc/rfc3986.html
Uniform Resource Identifiers (URIs), URLs, and Uniform Resource Names(URNs): Clarifications and Recommendations: http://www.ietf.org/rfc/rfc3305.txt

Sunday, December 06, 2009

Ad Music – Annie Little – Fly Me Away – Amazon Kindle

The Amazon Kindle Ad

The song Fly Me Away is available as a free download from Amazon.

Lyrics
Silver Moons and paper chains,
Faded maps and shiny things.
You're my favorite one-man show.
A million different ways to go.
Will you fly me away?
Take me away with you,
My love.
Painted scenes, I'm up all night.
Slaying monsters, flying kites.
Speak to me in foreign tongues.
Share your secrets one by one.
Will you fly me away?
Take me away with you,
My love.
Now I cant think what life was like
Before I had you by my side.
Cant say what I'd do without you,
Knowing what its like to have you.
Hidden walk ways back in time.
Endless stories, lovers cry.
In my mind I've been set free.
Will you take this Journey
You and Me?
Will you Fly me away?
Take me away with you,
My love.
Fly me away with you,
My Love.
Take me away with you,
My Love.

Saturday, December 05, 2009

Using Google DSN on your Apple Mac

Google Public DNS is a free, global Domain Name System (DNS) resolution service, that you can use as an alternative to your current DNS provider.

Why do you need a DNS service?

You might not realize it, but you already use a DNS service, typically this is automatically setup for you by your ISP and so you dont have to do anything special to get it working. The DNS service is what allows you to type a named address (such as www.google.com) in your web-browser and get to the website. The DNS service resolves the name to the actual address of the server where the website is located.

So why use Google’s DNS service?

Its provided by Google – good enough for me.

Other reasons:
Google has its DNS servers located all over the globe and they use intelligent algorithms to use the closest one to your computer. This means faster browsing of the web.
Also, Google has a public privacy policy and so you know exactly what they are doing with the data they capture while you use their DNS service. I have no idea how my ISP uses the information it collects while I use their DNS service. (Google stores your IP address for 24 hours, and no other identifying information is stored for longer than that. Read more at http://code.google.com/speed/public-dns/faq.html#privacy)

Alternatives: There is OpenDNS (http://www.opendns.com), but that is not Google!

How to use it:

You need to configure your TCP/IP settings to use the following DNS servers: 8.8.8.8 and 8.8.4.4

Configuring your Mac to use Google DSN.

1. I use a WiFi network to get to the Internet from my Mac. So click on the Wireless icon (2nd from right)
Screen shot 2009-12-05 at 5.06.35 AM 
2. Select “Open Network Preferences”.
Screen shot 2009-12-05 at 5.07.12 AM
3. Click on AirPort and then “Advanced…”Screen shot 2009-12-05 at 5.07.26 AM
4. Click on DNS and enter the numbers “8.8.8.8” and “8.8.4.4”

Screen shot 2009-12-05 at 5.07.41 AM

And you are done. Close the dialog and fire up your browser. Browse to your home-page or my web-page (http://raj.aggregatedIntelligence.com/) and if it shows up – you are good to go.

Monday, November 30, 2009

Path from where a user control was loaded (ASCX)

Here is the code to retreive the path from where a user control (ASCX) was loaded.

protected string GetLoadDirectory()
{
    string controlPath = this.ResolveUrl(this.AppRelativeVirtualPath);
    if (string.IsNullOrEmpty(controlPath) == false)
    {
        int indexOfLastSlash = controlPath.LastIndexOf("/");
        controlPath = controlPath.Substring(0, indexOfLastSlash + 1);
    }
    return controlPath;
}

CSS box model

Two useful graphics that I found in my trolling about the box-model used in CSS

clip_image001

clip_image002

Thursday, November 19, 2009

Do math in your head

A nice little wiki with some short-cuts on how to perform some simple math calculations mentally.

howto.Wired.com

http://howto.wired.com/wiki/Do_Speedy_Math_in_Your_Head

Leaving yourself a message on Google Voice

Why? Well because you could leave a note to self and it will be automatically transcribed and available in your mailbox for searching, archiving, forwarding, etc.

Whats the problem now? When you call your Google Voice number from a registered cell number – you are automatically taken to the administrator's voice prompts menu. No way to leave yourself a message by default.

Workaround: Simple really. Go to Google Voice settings. Click on the Phones Tab. Click Edit on the cell phone number you use to forward calls to when your Google Voice number is called.

image

Click on “Show Advanced Settings” 

image

Set Voicemail Access to “No”. (by default this is set to Yes for mobile phones).

image

Now when you call your cell – you will be presented the same greeting that all callers are presented. You can leave a message to yourself. And if you want to access the administration menu – just press the * button. (This doesnt bother me too much – because I mainly use the website to access my voice mails).

Extra tip

You can also create a contact for yourself and setup the contact information so that when you call from that phone, you will be directly forwarded to your voicemail. I think this makes it a lot more quicker to get to the point where you can leave yourself a message (fewer rings).

Steps:

Click on contacts in the left bar. (If you dont have one for yourself, create it)
Select the contact.
Click on Edit Google Voice Settings
Under the heading “When this contact calls you:” click Edit.
Select the option “Send to Voicemail”

Free LIDAR training from ESRI

ESRI is offering its online LIDAR training for ArcGIS for free. Check it out at - http://training.esri.com/acb2000/showdetl.cfm?DID=6&Product_ID=945

The overview on page states:

This seminar introduces lidar in general, discusses how to manage lidar data using ArcGIS, and also addresses the needs of those who would like to know the benefits of using lidar data in ArcGIS.

Lidar datasets are massive and contain three-dimensional spatial information about features such as buildings, trees, power lines, etc. Lidar datasets are raw point cloud formats that are not easily interpreted. ArcGIS Spatial Analyst and ArcGIS 3D Analyst provide the functionality and tools you need to represent and extract feature information from lidar data.

The presenter will discuss:

  • Introduction to lidar
  • Understanding and interpreting lidar data using ArcGIS
  • Lidar applications and derived products using ArcGIS

Wednesday, November 18, 2009

ASP.Net, DNN and scroll position

In ASP.Net you can use the Page.MaintainScrollPositionPostBack to setup a page so that it remembers the scrolled location the user was at after a post-back has occurred. It is extremely useful on long pages that perform a post-back.

If you want the page to remember the scroll position you set the value to true, otherwise false.

But recently on a DotNetNuke page, we found that the scroll position was being remembered on a page, even though we were setting the Page.MaintainScrollPositionPostBack to false. We tried setting this value on the Page-Load event, as well as the event that was being fired after the post-back occurred – no luck – the page scrolled position was being remembered. The page we were working on had a multi-step Wizard control and it was really annoying when you moved from a long step to a short step, as the page wouldnt end up scrolling to the top.

After some digging we found that DNN had its own code to maintain the scroll position during post-backs. This scroll position is maintained using a hidden field called “ScrollTop”. DNN has javascript code that runs during a page load, that uses the ScrollTop value to set the windows scroll position. (I have no idea why DNN has this redundant functionality – when it is already present in Asp.Net via the MaintainScrollPositionPostBack property).

Anyways, we used JQuery to work around this issue. Basically, you perform a query to get the ScrollTop element and set its value to 0. This way, when DNN’s javascript code runs, it automatically scrolls to the top.

<script type="text/javascript" src="JQuery/js-jquery/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
  jQuery.noConflict(); //needed to remove conflict of the alias $ that is already being used by DNN
  jQuery(document).ready(function() {
      jQuery("#ScrollTop").val(0);
  });
</script>

2009 Most-Livable Bargain Markets

According to MSN.com

1. Des Moines, Iowa
2. Buffalo-Niagara Falls, N.Y.
3. Oklahoma City
4. Scranton-Wilkes-Barre, Pa.
5. Minneapolis-St. Paul, Minn./Bloomington, Minn.-Wis.
6. Little Rock-North Little Rock, Ark.
7. Ogden-Clearfield, Utah
8. Columbia, S.C.
9. Houston-Sugar Land-Baytown, Texas
10. Columbus, Ohio

http://realestate.msn.com/slideshow.aspx?cp-documentid=22334217

Tuesday, November 17, 2009

Use Google Voice for all your voice-mail needs

I love Google Voice as it provides me with a copy of the voice mail and an email with a transcript of the voice mail. I really wanted to be able to use GoogleVoice for all my voice mail needs and today I figured out how to do this and now I dont have to miss important calls while I am in a meeting.

The technology used is called conditional call forwarding. Conditional, because when people call us and the number is either busy, unavailable or unanswered, we want the caller to be forwarded to Google Voice.

I have an AT&T cellphone and here is how I did it:

activate conditional call forwarding by dial the following number (replacing the xxxxxxxxxx with your GoogleVoice number)
*004*1xxxxxxxxxx#

To disable call forwarding dial
##004#

Information for other carriers: http://www.google.com/support/forum/p/voice/thread?tid=00a93855af6943b4&hl=en

Friday, November 13, 2009

Empty Design View for User Controls

Came across a bug in Visual Studio 2008, where the design view all of a sudden turned blank. I was working on a user web-control, when the design view turned blank.

Turns out the problem was because I had added a style element to the user control. Because the user-control (ascx) is embedded into a web-page (aspx) it does not have a head section. When the designer comes across a style or link tag, it infers and generates the head tag – so as to allow the designer to display the page just like any other web-page. But sometimes the designer does not know when to exit the head section and hence the entire contents of the user-control end up inside the head section and hence the white screen of death.

The easiest solution – wrap your contents in a <div> element. It signals to the web-designer to exit the head section and enter the body section of the page. Alternatively (move the head parts to the end of the ascx document) – I think this is very hacky and like the first work-around better.

For more info read the following post - http://blogs.msdn.com/webdevtools/archive/2008/04/27/workaround-empty-design-view-for-user-controls.aspx

Wednesday, November 11, 2009

Ad Music – Chrysler Connect

The song in the Chrysler Connect ad is Straight Lines by Dawn Landes

Tuesday, November 10, 2009

Using Windows 7 theme desktop background on your Mac

I have a Windows 7 laptop and my wife has a Mac.

Microsoft has some beautiful wall-papers that they provide as part of their Windows 7 theme packs.

image

My wife wanted these for her laptop too. So instead of just copying the files over to her computer, I decided to try and figure out how to let her open up themes directly on her own Mac so that she could use them.

Here are the steps:

The Windows 7 theme packs are just zip files. Unfortunately, just renaming them and then trying to unzip them on a Mac does not work. Instead what you need is the StuffIt Expander tool: Download it from: http://www.apple.com/downloads/macosx/system_disk_utilities/stuffitexpander.html

Next go over to the Microsoft Personalization Gallery: http://windows.microsoft.com/en-us/windows/downloads/personalize and download a theme to your desktop.

Screen shot 2009-11-10 at 7.06.27 PM

Go to the Applications folder and open up StuffIt Expander.
Screen shot 2009-11-10 at 7.08.13 PM

Next drag the theme file on to the StuffIt Expander window.

Screen shot 2009-11-10 at 7.08.41 PM

This will extract the files from inside the theme file onto your desktop. Browse to the folder inside containing all the wall-papers for the theme. Copy the images over to your pictures folder (or where ever you keep all your wall paper images). Thats it. you are done!

Screen shot 2009-11-10 at 7.09.12 PM Screen shot 2009-11-10 at 7.09.31 PM

One of my favorite themes is the “Bing’s Best” theme. (The thumbnails in the first image in this post are from that theme).

Enjoy!

Monday, November 09, 2009

Windows 7 – Boot from VHD – Simple as pie instructions

Here is the simplest set of instructions for setting up Windows 7 to boot from VHD.

First of – why would you want to boot from VHD – because it gives you a experimental machine which is faster than running with VirtualPC but slower than running it natively. The reason I did it is so that I could test out Visual Studio 2010, without having to muck up my machine.

Having said that remember this important piece of information: Boot from VHD is only supported by the Ultimate and Enterprise editions of Windows 7. I learnt this the hard way and wasted at least an hour trying to setup a Win7 Starter boot from VHD machine.

Step 1: Create the VHD:

  1. Go to Start –> Right Click on My Computer –> Choose Manage. This will bring up the Computer Management Window
  2. Under the Storage node –> Select Disk Management.
  3. Right click and select Create VHD
  4. Set the location and choose dynamically expanding. Choose a size of at least 15GB. (I choose 20gb). Dont worry, because it is a dynamically expanding disk, it will use only what it needs.
    image
  5. You should now have a hard-disk appear in your disk-management window
    image
  6. Right click on the newly added disk and select initialize.
  7. Leave the default options and select OK.
    The disk will not report its status as being Online.
  8. Right click on the disk again and select “New Simple Volume”
  9. Select the defaults and keep clicking through.
    On the 3rd screen, note down the drive letter the volume will be assigned
    image 
  10. On the next screen, choose a name for your volume label. Also make sure that the FileSystem selected is NTFS
    image
  11. On the next screen select Finish.
    If everything went correctly you should see something like this: (The size will be different).
    image

Step 2: Use ImageX to Setup the Windows 7 on the VHD volume:

  1. First we need to download the Windows Automated Installation Toolkit (WAIK). Get it from the download center.
    Unfortunately its a big download (1.7GB) for a small file that we will end up using.
  2. Once you install the WAIK onto your computer, you can copy out ImageX.exe to a convenient folder (like c:\). (You will find ImageX.exe in the following folder - C:\Program Files\Windows AIK\Tools\x86)
  3. You will also need the Windows 7 installer DVD. On the DVD you will find the install.wim file in the sources folder.
  4. Run the following command:
    imagex /info "d:\sources\install.wim"
    This will output a whole lot of text to the screen, and will provide you with information regarding the available images in the install.wim file.
    Two parts are important – the image index and the “EditionID”. You want the image index that corresponds to the Enterprise edition or the Ultimate edition of Win7.
  5. Now to apply the selected image to the VHD drive. (Remember we selected drive G in 1.9 above).
    imagex /apply d:\sources\install.wim 1 g:\
    The process should take about 15 minutes to complete.
    In the above command the 1 represents the 1 image index we obtained in step 4 and we are applying it to drive g – which is the VHD drive we created.
  6. Now you can disconnect the drive.
    Right click on the disk and make it go offline.
    On the dialog – make sure that the option to delete the VHD file is not selected:
    image

Step 3: Add an entry into the boot menu:

  1. This step will provide you the option to select the VHD boot drive during startup.
  2. There are multiple bcdedit commands that need to be run:
    bcdedit /copy {current} /d "Win7 on VHD"
    returns a GUID after copying the current configuration. Copy the returned GUID for use in the next few steps.
  3. run the following command
    bcdedit /set {guid} device vhd=[C:]\test.vhd
    {guid} is the GUID returned previously. vhd= points to the VHD file. The square brackets [] are needed.
  4. run the following command
    bcdedit /set {guid} osdevice vhd=[C:]\test.vhd
  5. run this final command
    bcdedit /set {guid} detecthal on
    This turns on hardware abstraction layer detection.
  6. Now restart your computer.
    After restart, you should be shown a menu with “Win7 on VHD” as an option.
    The first time you run Windows on the VHD drive, it will step you through the setup process. Keep your Win7 registration key handy, as you will need it.

And you are done!

In case you run into a problem while setting up BCDEDIT, run the following command to delete the entry and then run through the above steps to resetup the entry.
bcdedit /delete {guid} /cleanup

Sunday, November 08, 2009

Ads – the Prized Possesion

Travelers Insurance – Prized Possesion – Ad with the dog.

The Song: Ray Lamontagne – Trouble.

Monday, November 02, 2009

Video Games – Real Time Racing

Real Time Racing is developing technology that will allow for video games that will allow you to race in real-time against actual race car drivers that are competing in an actual race. The technology is very cool and it uses LIDAR to generate maps of the race-tracks (which is how I came across the game).

Its was recently show-cased on the BBC’s Click program.

http://news.bbc.co.uk/2/hi/programmes/click_online/8334595.stm

Real Time Racing

Sunday, November 01, 2009

Google Wave – Bots List

Bots are robots that provide some sort of functionality within a Google Wave. You just drag and drop them just like any other contact onto your wave and you can begin using them. The one weird thing I have found is that there does not seem to be any way to find and add them from within Google Wave. So after a little Googling here are some of the useful ones I have found:

Preview Bug: If you copy and paste the email address into your add contact dialog, Google Wave might not enable the Submit button. If this happens, just delete one of the letters and retype them and it should enable the submit button.

Added 11/01/2009

blog-wave@appspot.com - Used to interact with blog-posts in Blogger. This is a very useful bot.
image 

wikifier@appspot.com - Used to interact with Wikipedia
image 

tweety-wave@appspot.com – Used to interact with Twitter. Add new tweets or search for tweets. Very cool

image

amazon-withwaves-com@appspot.com – Retrieves information from Amazon.com.

image

Friday, October 30, 2009

Linux shell scripts – name of script file

How to get the filename and directory name of the shell script being run:

directoryName=${0%/*} #capture everything before the last /
filename=${0##*/} #capture everything after the last /

Thursday, October 29, 2009

Types of brackets

Disambiguation of {braces parentheses brackets}
note: they are all types of brackets

from Wikipedia

  • ( ) - round brackets, open brackets or parentheses
  • [ ] - square brackets, closed brackets or box brackets
  • { } - curly brackets, squiggly brackets, swirly brackets, braces
  • < > - angle brackets, diamond brackets, cone brackets, wickets, chevrons

Wednesday, October 28, 2009

Windows port of some useful UNIX commands

Recently I came across the “Cut” and “Paste” commands in Linux. Man, these are useful tools as they allow you to rearrange your data from an existing file.

And now to make my life easier in Windows, I have found a SourceForge project that has ported many of these commands to Windows.

Find it at: http://unxutils.sourceforge.net/. Very Nice!

The list of UNIX/Linux commands available in the download I got:

agrep.exe
ansi2knr.exe
basename.exe
bison.exe
bzip2.exe
bunzip2.exe
bzip2recover.exe
cat.exe
chgrp.exe
chmod.exe
chown.exe
cksum.exe
cmp.exe
comm.exe
compress.exe
cp.exe
csplit.exe
cut.exe
date.exe
dd.exe
df.exe
diff.exe
diff3.exe
dirname.exe
du.exe
echo.exe
egrep.exe
env.exe
expand.exe
expr.exe
factor.exe
fgrep.exe
find.exe
flex.exe
fmt.exe
fold.exe
gawk.exe
make.exe
grep.exe
gsar.exe
gunzip.exe
gzip.exe
head.exe
id.exe
install.exe
join.exe
less.exe
ln.exe
logname.exe
ls.exe
m4.exe
md5sum.exe
mkdir.exe
mkfifo.exe
mknod.exe
mv.exe
mvdir.exe
nl.exe
od.exe
paste.exe
patch.exe
pathchk.exe
pr.exe
printenv.exe
printf.exe
ptx.exe
recode.exe
rm.exe
rman.exe
rmdir.exe
sdiff.exe
sed.exe
seq.exe
sleep.exe
sort.exe
sh.exe
shar.exe
split.exe
stego.exe
su.exe
sum.exe
sync.exe
tac.exe
tail.exe
tar.exe
tee.exe
test.exe
touch.exe
tr.exe
uname.exe
unexpand.exe
uniq.exe
unrar.exe
unshar.exe
uudecode.exe
uuencode.exe
wc.exe
wget.exe
which.exe
whoami.exe
xargs.exe
yes.exe
zcat.exe

Ubuntu + VirtualBox + low screen resolutions

If you run Ubuntu and you get only a low screen resolution of 800x600 (and not the native resolution of your host machine), then what you may need are the “Guest Additions”.

Here is what you need to do:

1. Run Ubuntu in VirtualBox

2. Use the host key to get to the host OS (normally the right ctrl key). This will allow you to move your mouse out into the world of your actual machine.

3. Click on "Install Guest Additions" under the devices menu:
image 
This should load up a window that will display the contents of Guest Additions cd.
image 
If you do not see the above disk on your Ubuntu desktop, then you might have to mount the guest additions. Here is how:
Go to Devices –> Mount CD/DVD-ROM –> CD/DVD-ROM Image…

image

Go to the CD/DVD Images tab and Click on Add.

Browse to the Virtual Box folder and select the “VBoxGuestAdditions.iso” file.
image
Click on Select on the “CD/DVD Images” tab.

You should get the CD for VBoxAdditions on your Ubuntu desktop now.

4. Double click the CD to view its contents. Which should look like this (and have some more files).
image

5. Depending on your host system you will have to run one of the “VBoxLinuxAdditions-XXX.run” files.

6. Unfortunately, its not as simple as double clicking the file to run it (as it needs to be run as an admin). Here is what you need to do:

Open a terminal prompt (Applications –> Accessories –> Terminal)

Navigate to the CD drive (type cd /media/cdrom0/)

Type LS and you should see all the files in the folder:
image

Type sudo sh ./VBoxLinuxAdditions-x86.run (remember its case sensitive)

You should be prompted for your password. Ubuntu should then run for a short while installing everything and you will be asked to restart.

Once you restart, you should get your native resolution. If not check the display settings.
image

Note: I had to install the Guest additions 2 times to get the new resolution in my Ubuntu virtual installation.

Note 2: Additional good stuff: Your mouse is no longer captured by Virtual box – which means you can seamlessly move between the host machine and the virtual machine. Also, copy paste will work across the 2 machines too. (Very nice!)

Monday, October 26, 2009

Study!

Get over the idea that only children should spend their time in study. Be a student so long as you still have something to learn, and this will mean all your life. ~Henry L. Doherty

The Google Story - 1995 to now

The Google Story - 1995 to now

Saturday, October 24, 2009

Personalize Windows 7

Themes, backgrounds, gadgets to make your Windows 7 computer your very own.

http://windows.microsoft.com/en-US/windows/downloads/personalize

My vote is for “Bing’s Best” theme pack. Very nice.

Words - debouch

de⋅bouch

1.
to march out from a narrow or confined place into open country, as a body of troops: The platoon debouched from the defile into the plain.

2.
Physical Geography.

a.
to emerge from a relatively narrow valley upon an open plain: A river or glacier debouches on the plains.

b.
to flow from a small valley into a larger one.

3.
to come forth; emerge.

Friday, October 23, 2009

Download YouTube video bookmarklet

via the GoogleSystem blog:

Here is a book-marklet that lets you download YouTube videos as MP4 files. (just drag the link on to your book-mark toolbar or right click and add to favorites).

Download YouTube Bookmarklet

Tuesday, October 20, 2009

DNN – Module Load Warning Error

Last week, one of my DNN installations all of a sudden started giving me the following error:

2009-10-14_142153

Typically, if you log in as an administrator, then you can view the error information. But in my case, I was unable to see any information. In fact, I was unable to log in to the DNN portal. Upon further investigation what I realized was that even the content was not being rendered.

The only information that I was able to find out was from the event log tables in the database, which had the following information:

2009-10-14_142222

So it looked like the error was being thrown in the “DotNetNuke.UI.Skins.Skin.InjectModule” method and it looked like a property or a method was being invoked on an object that was null. But the above information is not very helpful.

Without any other information, I decided to modify the DNN code so that I could add additional logging information to the InjectModule code to see what was going on. To do this, I decided to use a simple text file to log the information. VB.Net is not my primary development language so I had to look up the syntax to create a file in append mode:

Using writer As StreamWriter = New StreamWriter(Server.MapPath(".\log\") & "attempts.txt", True)
    'call code in here
    InjectModule(......)
    writer.WriteLine("log info using writeline")
End Using

Once I had the code modified to perform in-depth logging, I found out that the InjectModule method would use the LoadControl method to load a user-control into a page. But before that, it would need to create the container into which it needed to load the user control. In version 4.6.2 of the DNN code, the code never expects the container to be null (ctlContainer.FindControl(glbDefaultPane)) and in our case the ctlContainer object was turning up null and was causing the “Object reference not set to an instance of an object” error.

But why was ctlContainer turning up Null. Turns out some files in the “Portals\_default\Containers” folder and in the “admin\Containers” folder had gone missing. Unfortunately for us, even the default containers had gone missing and hence ctlContainer was turning up null.

I am not sure why the files in those folders got deleted (module mis-behaving, user error, etc), but it sure was hard to track down this bug and fix it. Luckily DNN is an open-source project and we were able to track down the issue by modifying the core code for this purpose.

Monday, October 19, 2009

ViewState, dynamically loaded User Controls and ASP.Net

If you find that your ViewState is unavailable to your user control in ASP.Net and if you loaded the user-control dynamically (using the LoadControl method), then check to make sure that you are dynamically loading the user-control in the OnInit method. Most people make the mistake of loading the user-control in the Page_Load method and the problem with that is that the state is loaded before the Page_Load method is called (see diagram below – Page_Load is the Load event). When the view state is loaded and processed, ASP.Net will look for the control and if it is there – it will fill it with the data from the view-state and if the control isnt available, then it will be ignored.

By loading the user-control in the Init event, you ensure that the control will be available when the LoadViewState method is called by the framework and it will then be filled out correctly with the values from the view-state. (This is usually followed by the Raise xxxx Events, where you typically check the value of the control to perform further processing).

25792822

If you find that the LoadViewState method is not being called, then it is most probably because your control it-self is not using the View-State. To ensure that it is called try and over-ride the SaveViewState method and save a dummy value to the view-state. After this the LoadViewState should begin getting called.

Friday, October 16, 2009

TFS – Work Item Manager

I was searching for a better taskboard to use with Team Foundation Server (TFS) than the one that comes canned with the Scrum for Team System (SFTS) template (which is a static report) and I came across the Work Item Manager.

In one word – its AWESOME!!!!

Work Item Manager is a beta product from Telerik and it does much, much more than just being an interactive task-board (which it does very well). Apart from the task-board, it provides so much more functionality that in some ways it comes close to becoming a replacement for Team Explorer (although it runs on top of Team-Explorer and so you do need to have TeamExplorer installed on your machine).

The task-board not only allows you to review the different states in which your work-items are in, but also allows you to change state by dragging and dropping them in a different state swim-lane. You can add work-items, review work-items, filter them and a whole lot more. Another cool feature is the Project Dashboard, a constantly updating screen of project information – a great way to get a quick overview of the project.

The WIM is a very cool project and you should take a look at the video that Telerik has made demoing all its features. (video)

tb Task-board sample.

Telerik Work Item Manager

Monitor text files in real-time

As a developer I use text files all the time to write out information to log application events. These logs become extremely valuable when I am trying to debug a problem (especially while an app is running in production).

Typically I used to load up the file in NotePad++, which would provide me with a notification everytime the log file changed, allowing me to decide if NotePad++ should reload the document. (TextPad also provides similar functionality).

Today, I came across an awesome tool called BareTail, that allows me to monitor log files in real-time. BareTail automatically updates itself as the log file changes and it can display lines that were added or deleted. BareTail almost feels like a video player that is streaming what is happening to your log file.

Apparently, the origin of the name Bare-Tail is from the UNIX tool that provides similar capability called “tail” (run as tail –f).

It is definitely a tool that you should add to your dev-tools box.

BareTail - http://www.baremetalsoft.com/baretail/

NotePad++ - http://notepad-plus.sourceforge.net/uk/site.htm

Happy Diwali – Diwali song from the Office!

Thursday, October 15, 2009

TFS – Forcing refresh of reports

The data that is used by TFS in its reports is stored in a SQL Analysis Services database. This data is stored in an OLAP cube. The cube is not update in real-time, which is the reason that TFS sometimes shows out of date information in its reports.

Fortunately, there is a way to request* for the cube to be updated. To do this, you need to log in to your TFS server. Open a browser and browse to:

http://localhost:8080/Warehouse/v1.0/WarehouseController.asmx
Select the “Run” method, then click the Invoke button.

You should receive a XML response with the value true in it. A value of true signals that the OLAP update process has been started. Now to determine when the update process has completed, you can invoke the “GetWarehouseStatus” method. This will return the values “Idle” or “Processing Olap”. The ware-house is refreshed once you get the Idle response status. 

*The reason that I said “request” is that in practice I have found that Sql Server Analysis Services does not always begun refreshing the cube and will always return the Idle response. In this case – go home and come back the next day – by when it should update the cube.

Monday, October 12, 2009

jQuery UI Dialog and Positioning

Sometimes the default and automatic center positioning of a jQuery dialog upon opening does not work.

jQuery("#dialogDiv").dialog({ height: 'auto', modal: true, width: 400, autoOpen: false, position: 'center' });

I found the following code works to position the jQuery UI dialog in the center of the screen:

var x = document.body.clientWidth / 2;
var y = document.body.clientHeight / 2;
var dlg = jQuery("#dialogDiv");
dlg.dialog('option', 'position', [x, y]); //dlg.dialog('option', 'position', 'center');
dlg.dialog('open');

Sunday, October 11, 2009

Two DNN issues I had to fight with this weekend

Had to really weird DotNetNuke (DNN) issues to work through that had me working most of this weekend.

The first one had to do with what manifested as a javascript error - “this.container.parentnode is null or not an object”

The issue turned out to be because I was using the JQuery javascript library. The library provides the $ macro as a shortcut to jQuery. But DNN already uses the $ macro, which causes issues. Fortunately, the fix is simple. Call the following method in a script block in the head of the document:

jQuery.noConflict();

This stops jQuery from trying to use the $ alias. Which means that you cannot use the $ alias to select DOM objects. Instead, whereever you use $ to work with JQuery, you need to directly reference the library using “jQuery”.

eg: $(document) becomes jQuery(document)

The second issue had to do with ViewState and a user control that was loaded using LoadControl

In other words, the user-control was being loaded dynamically using the LoadControl module. For the most part, the control was working. What was not working was the ListBox was not keeping its SelectedItem value, after I had selected an item in the ListBox and then clicked a button that caused a post-back.

After running around in many many circles, the thought that I have is that its because the ViewState is not working correctly. (The user-control works fine if I directly reference the user-control in a aspx page. The problem only occurs when the user-control is added dynamically using the LoadControl module).

The way I worked around this issue is that whenever I added items to the ListBox, I stored the items to the Session object. I then over-rode the OnInit method, and use the items in the Session object to load into the ListBox. The reason that I think this solution works is that the view-state is not working correctly and so I am giving the control a helping hand by filling it with the values that it should have after a post-back. All other events occur after the OnInit method has been called, allowing the SelectedItem to be correctly set.

Saturday, October 10, 2009

Messaging & Positioning 101

From Camberely Bates presentation at the New Tech group (video):

For who: Identify your customer

Does what: what problem does it solve or how does it improve my life/job

Unlike: what differentiates you from the competition

iPhone – Applications start and shut down immediately

Since last night, my iPhone had started acting weirdly. Every 3rd party application that I attempted to use would start up and immediately shut down. The only applications that worked were the ones that came with the iPhone originally.

Most posts that I read prescribed that I wipe out the iPhone and reinstall everything – that would take too long and didnt sound like the way I wanted to spend my weekend. So on a whim I tried a couple of steps and voila! all applications began working again.

Here are those steps:

1. Perform a complete shut-down of the iPhone. (Hold the round button on the face and the power button on the top of the iPhone for a few seconds and the iPhone will perform a hard shut down).

2. Start up the iPhone.

3. Now install some new app that you dont have already on your iPhone.

4. Try opening one of the apps that wasnt working. (Cross your fingers, cause if it doesn't work – then you might be out of luck and might have to do a complete reinstall). If the app does work – then rejoice – you just kicked the iPhone back into behaving correctly.

Friday, October 09, 2009

JQuery – Attribute Filters

JQuery attribute filters make it easy to select and modify particular attributes in your HTML DOM.

For example: if you wanted to hide all links in a page, here is what you need to do

$("a[href]").toggle();

But what if you need to hide only some of the links on your page?

Maybe the one that links to “http://www.ai.com/”

$("a[href='http://www.ai.com/']").toggle();

Maybe all the ones that have google in the href….

$("a[href*='google']").toggle();

(the key to above filter is the “*” – which matches anywhere in the attribute’s value)

Maybe all the ones that end with org

$("a[href$='org']").toggle();

(the key to the above filter is the “$” – which matches to the end of the attribute’s value)

Maybe all the ones that begin with http://doc

$("a[href^='http://docs']").toggle();

(here the the key is the “^” character – which matches only to the beginning of the attribute’s value)

Here are important points to remember:

  1. The filters are case sensitive. (I dont think there is a way to make them case-insensitive)
  2. Unlike regular RegEx expressions – you do not need to escape characters (such as “/” and “&”)
  3. This was true as of JQuery 1.3.2

Tuesday, October 06, 2009

How things work - Shaazam

I always wondered how Shaazam worked (the app that automagically identifies songs). And today, I came across this document by one of the Shaazam creators that explains how it works:
http://www.ee.columbia.edu/~dpwe/papers/Wang03-shazam.pdf

The basic idea is that it uses a songs spectrogram (a graph of time on the x axis, frequency on the y axis) to generate a signature for each song. Samples uploaded from phones are converted to a spectrogram and compared against a database of pre-generated spectrograms to figure out information about the songs.

Fluent Tutorials

4 useful tutorials on using Fluent for NHibernate.

A fluent interface to NHibernate - Part 1
A fluent interface to NHibernate - Part 2 - Value Objects
A fluent interface to NHibernate - Part 3 - Mapping Relations
A fluent interface to NHibernate - Part 4 – Configuration

Also, remember, Fluent is an interface to NHibernate, so you can do anything you could do with NHibernate. A good example is performing queries. I searched all over for information on how to perform queries using Fluent for NHibernate and didnt find any. And then when it dawned on me that I could use NHibernate, I found a ton of resources.

Here is one from NHibernate’s documentation pages: https://www.hibernate.org/hib_docs/nhibernate/html/querycriteria.html

Virtual Sphere – Cool interface to computers

PhotoSketch – A cool way to create new images from existing ones

PhotoSketch: Internet Image Montage from tao chen on Vimeo.

Read more about PhotoSketch on ZDNet - http://blogs.zdnet.com/weblife/?p=965

Get the source code from: http://cg.cs.tsinghua.edu.cn/montage/files/Binary.zip

Monday, October 05, 2009

Fluent NHibernate – Connecting to SQLServer

Here is the code to create a ISessionFactory that can be used to work with a SqlServer database

ISessionFactory sessionFactory = Fluently.Configure()
.Database( MsSqlConfiguration.MsSql2008
.ConnectionString(m => m.Server(@".\SqlExpress")
.Database("Fluent_Test")
.TrustedConnection()))
.Mappings(m =>
m.FluentMappings.AddFromAssembly(Assembly.GetExecutingAssembly()))
.ExposeConfiguration((Configuration config) => new SchemaExport(config).Create(false,true))
.BuildSessionFactory();
return sessionFactory;

The code uses a local SqlExpress database called “Fluent_Test”. The mappings are stored in the same assembly as the method in which the above code is placed.

Saturday, October 03, 2009

Do you know what Google Wave is?

A quick video on what Google Wave is…..

Windows 7 Tips

  1. Command prompt here
    Up until Windows Vista, we had to download a registry hack to get the option to start a command prompt from Windows Explorer.
    In Windows 7, just press shift and then right click on a folder and presto, you get the option “Open Command Window Here”.
  2. Presentation Mode
    Press Windows Key + “P”. You get a window that allows you to quickly choose where the video from your computer is directed:
    image
  3. Windows + “Home”: Minimize all windows except the currently active one
  4. Start apps as administrator (“Run as Administrator”): Click on the application icon with Shift and Ctrl buttons pressed.
  5. Use Sticky Notes: Search for Sticky Notes
    image
  6. Windows Power Shell - Batch scripts evolved: If you need to write complex batch scripts, check out Windows Power Shell. And while you are at it, try out the Windows PowerShell ISE (Integrated Scripting Environment) as the editor for creating and editing these scripts. (Search for PowerShell ISE)

Get more advanced tips from: http://technet.microsoft.com/en-us/magazine/2009.10.77windows.aspx

Wednesday, September 30, 2009

Ads – Song from Target Ad

Today I woke up and I found more, more, more…..

The song is by Minnutes and called “More to Love”.

And here is the ad

Sunday, September 27, 2009

Pre-existing conditions clauses in Health Insurance must go

Saw this documentary on PBS that chronicled the hardships 3 families had to go through while trying to provide health-care for their loved ones. It really drives home the point as to why the pre-existing conditions clauses need to be removed: many of us just don't realize that we are just one medical surprise away from loosing our homes and bankruptcy and everything we have worked so hard for. Remember the only body that can change it is Congress and you need to tell your elected representative what you want done in your name.

Read more about the documentary and pre-existing medical condition clauses on the PBS website: http://www.pbs.org/now/shows/health-care-reform/now-segment.html

Monday, September 21, 2009

Words - Laodicean

Laodicean • \lay-ah-duh-SEE-un\  • adjective
: lukewarm or indifferent in religion or politics

Sunday, September 20, 2009

DEKA Arm

Just saw this piece on 60 minutes about the latest in prosthetic arm technology – its called Luke.


The degree to which the robotic arm mimics a real arm is amazing. The robotic leg that is shown is very cool too and its amazing how close it looks to the legs that were seen on RoboCop in the movie RoboCop.

Lending money to family and friends and the IRS

Came across an interesting article on CNNMoney, that talked about the fact that if you lend money to anybody at below a certain rate, then you could be assessed the difference as part of your income tax.

The minimum rate that you need to lend money at is determined by the Applicable Federal Rates (AFR). The rates are published monthly at http://www.irs.gov/app/picklist/list/federalRates.html

There are 3 sets of rates – short-term (under 3 years), mid-term (3 to 9 years) and long-term (beyond 9 years).

And here is the CNN Money article where I first came across this information: http://money.cnn.com/2009/09/14/pf/expert/family_lending.moneymag/index.htm?postversion=2009091505

Saturday, September 19, 2009

NTS - .Net Service Bus

Starting a new category of posts that are aimed at me as a “Note To Self” (NTS).

My first one is to check out the .Net Service Bus

WCF Coding Standard

While looking for coding guidelines for Windows Communications Framework (WCF), I found the following resource from the IDesign website.

Here is a direct link to the zip file containing the standards - IDesign WCF Coding Standard

Whats your site worth? WebTrafficAgent

A good way to stoke your ego (or make it drop)…. check out what its valued at by WebTrafficAgents. Check out what my blog is worth: http://www.webtrafficagents.com/WebSiteValue/blog.aggregatedintelligence.com

WCF and SilverLight – Cross-Domain issues

If your WCF service and SilverLight app are hosted on 2 separate domains then you might come across the following cross-domain access error:

An error occurred while trying to make a request to URI 'http://xxxx'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details.

I use Verio to host my web-sites and I had to add this very simple XML information to the root folder to overcome this error: (file should be named crossdomain.xml)

<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>

Note:

What about using ClientAccessPolicy.xml?

It turns out that you can also use the ClientAccessPolicy.xml file to provide cross-domain access. Here is what the contents should look like (the file needs to be copied to the same location as crossdomain.xml – the root of the website).

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*"/>
</allow-from>
<grant-to>
<!--Change WCFServiceFolder to reflect your setup -->
<!--If you want to provide access to all folder use /-->
<resource path="/WCFServiceFolder" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>

So which one should you use:

The crossdomain.xml file is used by both SilverLight and Flash apps. But crossdomain.xml does not provide you the fine grained control that ClientAccessPolicy.xml provides (you can see that in my example above, where I provide cross-domain access only to the WCFServiceFolder sub-folder). Also, Silverlight will first check if the ClientAccessPolicy.xml file exists and will use the CrossDomain.xml file only if it doesnt find the ClientAccessPolicy.xml. So its a good idea to use both.

Get more information from this post:
Using Silverlight 2.0 clientaccesspolicy.xml vs. crossdomain.xml for Web-Service cross-domain access (from Cesar da la Torre Blog)

Working in Visual Studio with the Visual Studio Development Server:

Just drop the above ClientAccessPolicy.xml file in to the root folder of your web-service solution and you should be good to go.