Archive for the ‘How To...’ Category.

TweetDeck not showing up in primary monitor

I’m currently using TweetDeck v0.21b as my default Tweeter client for my Windows Vista machine.  Having a dual-monitor setup at home (laptop and an external monitor), I always move TweetDeck to the external monitor as a personal preference.  While I’m waiting in the airport for my next flight, the sudden idea to tweet that specific fact came to my mind.  Unfortunately, TweetDeck’s UI doesn’t show up when I launch the application.  I know it’s running because I can see the little black bird icon on the system tray, but it still thinks it’s suppose to show on my external monitor.  That’s not good, because I don’t normally carry my external monitor with me when I’m on the go.  Clearly this is a bug, but not one that will stop me from tweeting the fact that I’m waiting at the airport! 

So these are the steps you should follow if your TweetDeck doesn’t show up in the primary (and only) monitor because it’s thinking it should display on an external monitor:

  1. If you’re using Windows Vista, browse to the following directory: C:\Users\<username>\AppData\Roaming.  If you’re using Windows XP, browse to the following directory instead: C:\Documents and Settings\<username>\AppData.
  2. Locate the folder that begins with TweetDeckFast.  For example, the complete name of that folder on my PC is TweetDeckFast.F9107117265DB7542C1A806C8DB837742CE14C21.1.
  3. Open the Local Store folder.
  4. Edit the preferences_<username>.xml configuration file with your favorite text editor.
  5. Change the windowState XML element’s x attribute to 0.  If you don’t see the TweetDeck UI, it is because the x attribute’s value is negative (which makes sense if the external monitor was on the left side).
  6. Save your changes to that file and load TweetDeck.  You should now be able to see the UI.

How to recursively traverse a DOM element in JavaScript

Suppose you want to traverse all the child nodes of a DOM element in order to do something with them, such as disabling them for example.  Here’s one way to do it.


In this example, the function that is responsible to traverse the DOM element’s child nodes and disable them is the recursive function EnableDisableDOMElement.  You have no choice but to use a while loop because you don’t know exactly the depth of each child nodes of every DOM element. 

You can use this code by calling the DisableDOMElementTree function (feel free to name it according to your intention) and pass it a DOM element as a parameter. For instance, in the onload event of the body element, you can call DisableDOMElementTree and pass it a valid DOM element which is the root of the elements tree. You can use document.getElementById with the name of a DOM element as a parameter to the function.

Hope it helps!

How to retrieve your ISP credentials from a DLink DIR-615 router (or any other router for that matter)

NOTE: This trick might or might not work for all routers.  I currently have a DLink DIR-615 and this trick works just fine.  My guess is that it should work on your router too even though it might be a different model than mine…but then again I’m just guessing.

Requirements for this trick to work:

If you do not want to install these applications in your machine just to do this trick, simply download Altiris SVS which is a free software virtualization tool that allows you to install Windows applications in a virtual layer.  It’s a safer and more practical way to install Windows applications for temporary usage.

Here are the steps to follow in order to retrieve your ISP credentials from a DLink DIR-615 router (or other routers for that matter):

  1. Log in the router’s configuration page as an administrator.  In my case, I just have to launch a Web browser and point it to http://192.168.0.1.  This IP address might be different for you.  In order to know your own gateway IP address, open a command prompt window (DOS), type ipconfig and press enter.  The IP address corresponding to your router is the one associated with “Default Gateway“.
  2. Go to the Setup section and click on Manual Internet Connection Setup (refer to Figure 1 and Figure 2). It’s okay if you have a different router than mine.   Just try to find the page where you can configure your ISP account information.
  3. In the page where you can see your login name (see Figure 2), right-click on it and then click on View Page Source.  Here, we just want to view the HTML source of the page.  If the page doesn’t allow you to right-click on it, then you can either disable javascript on the browser and try again, or from your browser’s menu try to find the command that allows you to view the HTML code for the page.  If that still doesn’t work, then we’re going to be more brutal: copy the page’s URL in the clipboard (Ctrl+C), then launch Notepad++ and paste (Ctrl+V) the URL as a file path in the Open File window dialog.  That should do it.
  4. Now that you can see the HTML code for that page, make a search for your username as it will be a faster way to find the location where your ISP credentials are located.  For example, in my case I will search for “Brian”.
  5. Look around that search area for your password.  It should be displayed as clear text (refer to Figure 3).

Figure 1. Go to the Internet connection options page
image

Figure 2. This is the ISP connection page for my DLink DIR-615 router (you should be able to find a similar page in your router)
image

Figure 3. Make a search for your ISP username to easily locate the ISP account information area in the HTML code.  Then look around for your ISP password.
image

Virtual PC Console window doesn’t show up when launching

At Avanade, we tend to develop all of our projects in controlled virtual environments for obvious reasons.  I am a big fan of VMWare products, notably VMWare Workstation, but at work we use Microsoft Virtual PC 2007.  Something annoying happened with Virtual PC this week.  For some obscure reason, the Virtual PC Console simply didn’t show up or disappeared from the screen every time I clicked on it via the taskbar.  At first, I thought the application crashed, but Process Explorer showed me otherwise, as I could clearly see that the Virtual PC process was running.  The problem seems to be that the screen position of the Virtual PC Console window was modified in the configuration file used by it.  I don’t know why that happened, but I do know how to fix it.

Here are the steps to follow if the Virtual PC Console window doesn’t show up or tends to disappear every time you click on it via the taskbar:

  1. Make sure none of the virtual machines are currently running.  If they are, save their sessions or shut them down.  Also, kill the Virtual PC process if it’s still running.  Have no mercy.
  2. If you’re using Windows XP, go to the Documents and Settings\$USER$\Application Data\Microsoft\Virtual PC folder.  If you’re using Windows Vista, go to the Users\$USER$\AppData\Roaming\Microsoft\Virtual PC folder.  Both of these root directories should be located in your system drive (C:\ for most users).
  3. Edit the Options.xml file with your favorite text editor (Notepad++ of course!)
  4. Search for the <window> element because it holds the location information for the console window (in my case, the <window> element was located at the end of the file).  Refer to Figure 1 for an example of what the <window> element looks like.
  5. Take a look at the values for both the <left_position> and <top_position> elements.  These values (4294935296) seem way out of proportion for our current monitors and screen resolutions don’t you think?  Change the value of these elements to something more realistic, such as 100.  Take a look at Figure 2 to see what I mean by that.
  6. Save the file and launch Virtual PC again.  This time you should see the Console window in the top and left part of the screen.

Figure 1. We can clearly see that the values for the left (<left_position>) and top (<top_position>) don’t make sense.
image

Figure 2. We simply changed the values for the left and top position to something more realistic.
image

The Management Survivor Guide

I was reading an interesting article in The Globe And Mail this week about how more and more managers are getting laid off their positions in the corporation due to the economic situation we’re currently in.  This affliction doesn’t affect the IT industry alone; it’s striking almost every companies in every sector in every country.  In order for workers in management to increase their stakes at keeping their current job or getting more attention for further opportunities, there are a few key points that should be considered.

In the Management Survivor Guide, Monika Morrow of Right Management points out a few ideas to make yourself more profitable and valuable.  Since this article pretty much goes in hands with my post on how to become a more valuable software professional, I thought that Morrow’s article would be a good complement to it.  So, without further a due, here’s the “Management survivor guide” which aside from targeting managers can actually benefit software professionals alike.

The Management Survivor Guide by Monika Morrow of Right Management:

  • Position Yourself
    Scan the organization and the industry and make sure you are involved in an area that is hot and growing.
  • Think Strategically
    Discuss the organization’s strategy with senior executives and point out how you fit their coming needs.
  • Be Multitalented
    If two operations are being combined, a manager who knows both parts will be more valuable than one who has experience in only one part.
  • Get Advice
    Ask trusted colleagues or a coach to critique your management style and experience for areas where you might need development.
  • Market Yourself
    Develop and tell stories of your successes.  You want to be known as the problem solver too valuable to let go.  (I highly recommend reading Jean-Paul Boodhoo’s blog to get an example of this point.  JP clearly nails this one as he constantly shares his successes publicly on his blog)
  • Be Seen As An Authority
    Offer to mentor, organize training and speak at industry functions.
  • Don’t Rush
    If it becomes clear you are facing the axe, don’t just take the first job that comes along without assessing whether it meets your interests and long-term goals. (This one is very important in my opinion.  Don’t waste your time on a job that isn’t compatible with your values and dreams.  If you are in such a situation, I also recommend you to read The Dip by Seth Godin.  Seth gives you some key points to consider in such situations)

Using the “Source Control – Team Foundation” toolbar to perform common TFS operations on the current document within Visual Studio

If you happen to be using Visual Studio with Team Foundation Server (TFS) as the source code repository, you might be wasting your precious time in trying to find the specific file in the Solution Explorer that you want to perform some action against it (check out the file, check in the file, view the file’s history, etc.).  This is especially true for a solution which comprises a multitude of projects and a sea of various files.  FYI, I don’t pin the Solution Explorer when I code because I like to have the widest view on my code rather than to share the screen space on the structure of the solution, so it’s a pain to always display the Solution Explorer or use the File –> Source Control menu to perform a TFS operation on a current file.

Here’s a little trick that’s available for which allows you to perform common TFS operations against the current open document in Visual Studio.

  1. imageRight-click anywhere on the toolbar container and click on the Source Control – Team Foundation item (the list is in alphabetical order).  Peek on the huge screenshot on the right for guidance.
  2. You should now see the TFS toolbar (take a look at Figure 1 below) which allows you to perform common TFS operations to the current document.

Figure 1. The Source Control – Team Foundation toolbar
image

Starting from the left side, these different items allow you to:

  • Change Source Control
  • Get Latest Version (of the current document)
  • Get Specific Version (of the current document)
  • Check Out For Edit (of the current document)
  • Check In (the current document)
  • Undo Pending Changes
  • View History (of the current document)
  • Refresh Status (of the current document)

You shouldn’t need to use the Solution Explorer or use the File->Source Control menu to perform common TFS operations on the current document anymore.

"Copying a file too large for the destination file system"…Yeah, right!

At work, we tend to develop our projects in virtual environments, more precisely with Microsoft Virtual PC.  Given that today’s external hard drives are cheaper ($) to buy, I decided to purchase one and have the virtual machine run on it instead of executing directly on my laptop’s hard drive.  This little scenario allows the host drive to focus entirely on processing OS threads and other kernel and application processes instead of sharing the spinning cycles for the virtual machine.  In other words, your OS runs faster and your virtual machine runs faster.

That being said, I wanted to copy the 20GB+ virtual machine from the laptop’s drive to the external hard drive using Windows Vista SP1, but I kept getting the “File Too Large” error message.

This was without a doubt a false negative because I clearly had lots of free space available in the external hard drive. After searching online for some solution, I found out that Scott Hanselman posted a remedy to this problem.  As Scott points out:

This hard drive came formatted as FAT32, which doesn’t support files larger than 4 gigs. You can either Format the drive, by right clicking the Drive in My Computer and using the Tools tab, or, if you already have a bunch of files on it…

The solution is very simple:

  1. If you don’t have any files in your hard drive, then go ahead and simply format it as an NTFS file system.  That’s it, you’re done.  On the other hand, keep reading…
  2. Launch an external command prompt window as an Administrator.
  3. Type the following command: convert <drive:> /fs:ntfs /nosecurity.  You’ll need to make sure that the hard drive is not being used by another process before doing this.  The convert.exe application converts a FAT volume to NTFS.
  4. Th-th-th-that’s all folks! You can now copy your virtual machine to your external hard drive.

The following screenshot gives you an idea of the final output.  The whole process took less than a minute to convert a 250GB hard drive to NTFS file system.

The following is a list of the commands available for convert.exe (you can get this list by typing convert/? on the command prompt):

CONVERT volume /FS:NTFS [/V] [/CvtArea:filename] [/NoSecurity] [/X]

volume:  Specifies the drive letter (followed by a colon), mount point, or volume name.
/FS:NTFS:  Specifies that the volume will be converted to NTFS.
/V:  Specifies that Convert will be run in verbose mode.
/CvtArea:filename:  Specifies a contiguous file in the root directory that will be the place holder for NTFS system files.
/NoSecurity:  Specifies that the security settings on the converted files and directories allow access by all users.
/X: Forces the volume to dismount first if necessary.All open handles to the volume will not be valid.

NOTE: Think twice before going this route if you’re planning to use the NTFS-converted hard drive on other non-Windows machine.  Make sure those operating systems support the NTFS file system prior to conversion.

Quickly Search For An Exact Match in .NET Reflector

I love Lutz Roeder’s .NET Reflector. It’s one of those tools that makes me enjoy programming with .NET much like ReSharper does.

Whenever you’re searching for a type, a property or a string, you’ll get back a list of results containing the keystrokes you type. If you’re looking for an exact match for your search, you’d normally take your mouse and click on the Exact Match button (the last button from the search bar). I don’t like to swap my hand from the keyboard to the mouse for these kinds of operations.

Well, there’s a quicker way to search for an exact match in Reflector without having to click the Exact Match button. Just enclose your search query inside a pair of double quotes as the following screenshots demonstrate:

Searching for ‘Thread’ without the double quotes will return a huge list of types that contain the word “thread” in their name or namespace (see Figure 1).


Figure 1. Searching for ‘Thread’ without double quotes
image

Searching for ‘Threadwith double quotes will perform an exact match (see Figure 2).


Figure 2. Searching for ‘Thread’ with double quotes
image

Integrating Enterprise Library 3.1 Configuration Tool in Visual Studio 2008

I’m getting my hands dirty with Enterprise Library for the first time and we’re currently targeting EntLib v3.1 with Visual Studio 2008.  At first I was editing the configuration files by hand, but then after reading the documentation, I found out that there’s a Configuration Tool that’s shipped with the EntLib installer.  The only problem is that it doesn’t integrate with the IDE automatically upon the installation. 

Here are the steps necessary to have the EntLib’s Configuration Tool integrated with Visual Studio 2008:

  1. Exit all instances of your Visual Studio 2008 before proceeding.
  2. Download and import the registry file that you will find in CodePlex.
  3. Open a Visual Studio 2008 Command Prompt and type devenv /setup.  This operation should take less than a minute to complete.

Now, you can launch Visual Studio 2008 and when you right-click a config file from the Solution Explorer, you’ll be able to edit its configuration using the Enterprise Library Configuration tool. 

NOTE: In order to view/edit an element’s properties, you’ll need to activate the IDE’s Properties Window (from the View menu, select Properties Window or hit F4 on your keyboard).

Problem Installing SQL Server 2005 on Windows Vista with IIS 7.0

I had such a hard time installing SQL Server 2005 on my Windows Vista Enterprise Edition machine running IIS 7.0 this afternoon. In fact, during the setup of SQL Server 2005, I received the following warning message next to the IIS Feature Requirement item on the System Configuration Check page, as shown in the following screenshot.



After Googling for a while, I found out that this situation was already documented by Microsoft as Knowledge Base #920201 in their Help and Support page.

The root cause for this problem is that not all of the IIS 7.0 components essential to SQL Server have been installed. The solution to this problem is (as you may have guessed it) to install those IIS components. To access the IIS configuration page on Vista, you need to go to Start->Control Panel->Programs and Features, then click on “Turn Windows features on or off” on the left pane of the window.

The following table shows you which components (there are 10) to enable with their corresponding folder. The screenshot below the table is a visual representation of the IIS components you should have enabled by ticking the checkbox next to the component.


image

Following this procedure, you can launch the setup for SQL Server 2005 again, and this time you should see the following results:


If you’re looking for more information on how to install/configure IIS 7.0 on Vista, I highly recommend you to read the following page: http://learn.iis.net/page.aspx/28/installing-iis7-on-vista/. If you’re looking for the same information, but for Windows Server 2008, this link will be more appropriate for you: http://learn.iis.net/page.aspx/29/installing-iis7-on-windows-server-2008/.

Installing Linux Ubuntu as a Windows Application with Wubi

With the latest release of the popular Linux-based operating system, Ubuntu Hardy Heron, the installation process just got easier for Windows users who wish to try out an alternative to Vista or XP.  Even .NET developers who are looking out on trying the Mono project (the .NET platform for Linux-based operating systems) can benefit from it.  All this is possible thanks to a little Windows utility called Wubi, which is an installer for Ubuntu.

As described by Wikipedia’s definition on the tool:

Wubi adds an entry to the Windows boot menu which allows you to run Linux. Ubuntu is installed within a file in the Windows file system (c:\wubi\disks\system.virtual.disk), as opposed to being installed within its own partition. This file is seen by Linux as a real hard disk.

According to Wubi’s official site, Wubi is an officially supported Ubuntu installer for Windows users that can bring you to the Linux world with a single click.  Wubi allows you to install and uninstall Ubuntu as any other Windows application, in a simple and safe way.

The beauty of Wubi is that:

  • You don’t need to burn a CD. Just run the installer, enter a password for the new account, and click “Install”, go grab a coffee, and when your are back, Ubuntu will be ready for you.
  • You keep Windows as it is, Wubi only adds an extra option to boot into Ubuntu. Wubi does not require you to modify the partitions of your PC, or to use a different bootloader, and does not install special drivers. It works just like any other application. Wubi is spyware and malware free, and being open source, anyone can verify that.
  • Wubi keeps most of the files in one folder, and if you do not like it, you can simply uninstall it as any other application.
  • It’s free!

The following screenshot, which was taken from Wubi’s official site, shows you how easy it is to configure Ubuntu’s installation as a Windows application.

Remember that you don’t have to create a new partition to install Ubuntu with Wubi.  In fact, it will install the Linux-based operating system in the same partition that Windows is installed (just like a standard application).  You can choose whether to boot in Windows or Ubuntu whenever you reboot your computer.

There are some things to consider with this installation model:

  1. The performance is identical to a standard installation, except for hard-disk access which is slightly slower than an installation to a dedicated partition. If your hard disk is very fragmented the performance will degenerate.
  2. Hibernation is not supported under Wubi, moreover Wubi filesystem is more vulnerable to hard-reboots (turning off the power) and power outages than a normal filesystem, so try to avoid unplugging the power. An Ubuntu installation to a dedicated partition provides a filesystem that is more robust and can better tolerate such events.

For more information, I suggest you to skim through Wubi’s FAQ page.

Eight Simple Tips To Improve Your Presentation Skills

Recently, a user group held a conference whose subject was Domain-Driven Design with nHibernate. Now, this is a really cool topic of discussion! So, I decided to attend the conference in order to improve my perspective and knowledge on the subject. Little did I know that the speaker was an introverted programmer who greatly lacked in public speaking skills. Many people, including myself, left early, as the presentation became unbearably tedious and awkward.

What follows is a list of tips which I feel to be important when it comes to giving a presentation. This is not an exhaustive list, so I hope you would add your own comments to elaborate on these ideas or to add to the list. [I am also looking to improve my communication and presentation skills, so these rules and principles also apply to me].

Tip #1: Introduce yourself properly

When I was a kid and people asked me what my name was, I used to reply “My name is Brian…don’t you know that?” You see, back then, I thought everybody knew my name: it’s a common name, it’s easy to remember and it’s simple to pronounce. However, in reality, this is not usually the case. Therefore, before beginning a presentation, introduce yourself to your audience. What is your name? What do you do for a living? Why do you want to talk to us about your subject? How can we contact you? Do you have a Web site or a blog?

Tip #2: Make eye contact

Bear in mind that the audience came to see YOU. Therefore, you should be mindful of the fact that we have decided to take time out of OUR day to see YOU, when we could be somewhere else (at home, a friend’s party, a late night dinner, etc.) That being said, PLEASE acknowledge this fact by at least looking at your audience. Don’t stare at the ceiling, the floor or the walls. Don’t stare at your PowerPoint slides either. I think it costs about two calories to move your eyes from one direction to another at variable intervals. In other words: it doesn’t hurt and it doesn’t take a lot of energy to do that. I know some developers are very introverted, and that is in their nature, but would you ask someone out on a date while staring at the wall or the ceiling instead of looking into his/her eyes? This takes practice, but the resulting impact on your audience is well worth the effort!

Tip #3: Talk with a smile

Do you know that the human being is the only living being in Earth that can smile to express different emotions? There are hundreds of muscles and nerves that are being contracted when you smile. Yet it doesn’t hurt. In fact, smiling at an audience changes the atmosphere and the ambience of the room to make it more natural, more humanized and more comfortable. Again, would you ask someone on a date without smiling? I don’t think so.

Tip #4: Move around a little

Just like a shark cannot stay alive without swimming around, so should you be moving and walking around a little on the platform. That platform is yours and you should feel free to walk on it so the whole audience can have a chance to feel your presence and to see you. Don’t stay near the computer just because you want to be there for clicking that button to go to the next slide. The computer is just a tool, not an altar.

Tip #5: Carefully prepare your presentation

Take the necessary time and resources to prepare your material: watch out for grammatical errors which can compromise your credibility, don’t go overboard with the information for a slide. Just like a good class design, your slide should be highly cohesive. What is your intent for a given timeframe? That answer should be reflected on your slide. I personally don’t care much for PowerPoint slides as a participant. What you’re telling me should be enough to understand your intent. I’ll look at your slide to complement your vision or your intent, not to get a second understanding of what you just said. Another thing you can do is to make your PowerPoint presentation available to everyone or by request. That way, the audience can focus on you in a more relaxing manner because they know that your presentation is there for them to look at anytime.

Tip #6: Anticipate obvious questions that could arise and prepare your answers

If your audience is at all interested in your subject, be sure that some people will ask you questions about it. For this, I like to imagine myself as part of the audience and see another projection of myself giving a talk. What kind of question could I ask the speaker right about now? Maybe something I said wasn’t clear or needed an example to better complete the picture. For some abstract or complex subjects, you can try answering some questions related to the 5Ws (Who? What? Where? When? Why? How?). You can also ask a friend what he thinks about your material. Prior feedback is always a good thing!

Tip #7: It’s okay to admit that you don’t know it all (However, do not use this as an excuse to come unprepared!)

This one is simple, but very hard to act on. If you are asked a question which you are unable to answer, just say these three little words: I don’t know. It doesn’t mean that you are completely ignorant. It just means that you don’t know. Even the greatest world leaders don’t have all the answers…no one does! Don’t sacrifice your credibility and your professionalism by risking an incorrect answer or solution. I remember someone once told me “Brian, it is better to remain silent and thought a fool, than to open your mouth and remove all doubt.

Tip #8: Have a plan B in case something goes wrong

Over the years, I have come to realize that Murphy’s Law is true and no one is safe from it. Not even developers. The law states that whatever can go wrong will go wrong. Therefore, prepare a second plan (or more!) in case things don’t go as planned. For example, if you’re modifying code in front of your audience and your system crashes, you shouldn’t take time out of your presentation to fix the problem. You will lose your audience!!! Just scrap the code and use the duplicate that you have as a backup.

There are many (free) resources online about how to improve presentation skills. I strongly suggest you to visit Kathy Sierra’s blog on human usability. It’s really worth it!