If you implement an infinite loop in a thread you may see 50% to 100% CPU utilization. This is because even though your thread may not be doing anything waiting for some event, you are still getting CPU slices unless you make a call to give up the CPU. This is easily done by calling a sleep function such as Thread.Sleep(5000) // milliseconds
I’ve been working a lot lately with the DataGridView. One instance of a DataGridView would refuse to be editable even though I checked all the relevant settings (Enabled, EditMode, ReadOnly, RowTemplate.ReadOnly, Columns.ReadOnly). I had previously missed the RowTemplate.ReadOnly setting and had it working once I set it to false, but then it stopped working again. I found that removing the set property for the data members that were specified in the Column Properties DataPropertyName value, was the reason it stopped working. Kinda makes sense but I wish there was better feedback from VisualStudio to alert me of the mismatched settings.
VMWare has been around for over 10 years. It’s an amazing piece of technology. I’ve not had a chance to use it until now. VMWare let’s you run “virtual” OS s on your computer using virtualization. This is how VMWare defines virtualization:
Today’s x86 computer hardware was designed to run a single operating system and a single application, leaving most machines vastly underutilized. Virtualization lets you run multiple virtual machines on a single physical machine, with each virtual machine sharing the resources of that one physical computer across multiple environments. Different virtual machines can run different operating systems and multiple applications on the same physical computer.
Basically, it means you can run ANY version of Windows on a single Windows PC, or on a single Mac or a single Linux machine. You can also run any version of Windows on a Mac which is what we have standardized on at TabbedOut. We get 13in Macbook Pros with 4 Meg of memory and a large external monitor. We then install VMWare and run whatever version of windows we need to on it! This combined with Spaces for the Mac makes for a pretty nice development environment.
A few notes about VMWare Fusion:
- To rename a VM, go to VM Library, select the VM you want to rename, select settings, then click on the name to change it in place.
- To rename the folder containing a VM, remove the VM from the VM Library by selecting delete and removing it from the list but be sure to KEEP the file so you don’t remove it from disk. Then just rename the folder and reload it back into the VM Library by using the File…Open command
- To increase the hard drive size of a VM you must delete all snapshots, select hard drive settings and increase the hard drive size. Run the VM and in the OS increase the size of the partition. For XP you must use a 3rd party app as this is not supported natively. I used the free EASEUS Home edition.
I’m digging the Spaces feature of the Mac OS. I should have been using this a long time ago!
If you are unfamiliar with Spaces, the feature gives you multiple “virtual” windows that you can switch between.
It’s like having multiple monitors connected to your computer each with different views of your running apps.
In the Settings for Spaces I redefined the hotkeys that switches between spaces. It was assigned to <Ctrl>arrows but that prevented me from using those hotkeys to move around (word advance) in Visual Studio (using VMWare). I reassigned the hotkey to be <option>arrows which had the added benefit of disabling Windows 7 hotkey to resize the current window (which I find annoying).
Who says you can’t have it all? I’ll be leaving my current job soon and with it the use of a Windows laptop and MacBook Pro. Last week I decided to go all in and spend the $2000 plus on a new MacBook Pro and install Windows 7 on it. The installation of Windows 7 using Bootcamp went smoothly. Windows 7 runs great and looks great on it! I used the free copy of Windows 7 Ultimate I received in the mail. I now have some great hardware that I can boot Mac OSX or Windows 7 on and do my Mac or Windows development from a single laptop. The MacBook is fast and I have Vegas Movie Studio HD Platinum 10 installed to do video editing. I can render out a video from Vegas and playback video real-time at the same time!
I have to discover and get use to how to do things in Windows from the MacBook. Here are some items of note:
forward delete: <fn><delete>
Start of line: <fn><left arrow>
End of line: <fn><right arrow>
Next word: <control><right arrow>
Previous word: <control><left arrow>
PageUp: <fn><arrow up>
PageDn: <fn><arrow dn>
Scroll Line Up: <fn><arrow up>
Scroll Line Down: <fn><arrow down>
Move cursor to top of screen: <control><fn><arrow up>
Move cursor to bottom of screen: <control><fn><arrow down>
PrintScreen on Windows using Macbook Pro keyboard:
You can find all the Mac hotkeys here.
Print Screen on Mac
How to Print Screen to a file on the desktop on Mac
The basic functionality of taking a screen capture of a window or desktop in Mac OS X takes an image and dumps it to a file on the Mac desktop. Each uses the pressing of Command and Shift keys concurrently as the basis for execution, followed by a number:
- Command+Shift+3: takes a screenshot of the full screen (or screens if multiple monitors), and save it as a file to the desktop
- Command+Shift+4: brings up a selection box so you can specify an area to take a screenshot of, then save it as a file to the desktop
- Command+Shift+4, then spacebar, then click a window: takes a screenshot of a window only and saves it as a file to the desktop
How to Print Screen to the Clipboard on a Mac
This functions a lot more like Print Screen in the Windows world. If you want to do the equivalent of Print Screen to the clipboard so that you can paste it into another app, these are the commands you’d want to use:
- Command+Control+Shift+3: take a screenshot of the entire screen (screens if multiple monitors), and saves it to the clipboard for pasting elsewhere
- Command+Control+Shift+4, then select an area: takes a screenshot of selection and saves it to the clipboard for pasting elsewhere
- Command+Control+Shift+4, then space, then click a window: takes a screenshot of a window and saves it to the clipboard for pasting
- Add a new project of type Empty Project (I name it BuildAll).
- I like renaming the project in the solution as _BuildAll so that it appears first
- Change the Configuration Type to Utility (Configuration Properties…General)
- Delete default filter folders.
- Add install related files to the project. Any readme files, the .iss Inno setup script, etc.
- Set project dependencies for the _BuildAll project
- Select project’s Post-Build Event setting (Configuration Properties…Build Events). Add something similar to:
iscc /DConfigurationName=$(ConfigurationName) “$(SolutionDir)\Installers\sample.iss”
Be sure ISCC.exe is in the system path (Right-click Computer…Properties…Advanced system settings…Environment Variables). Add C:\Program Files (x86)\Inno Setup 5 to the Path.
Points and counter points on whether programming should be something all kids should learn: Should Johnny Learn to Program?
I’m on the side of no, programming is not a basic skill everyone should learn. I like this counterpoint:
The giant hole in our workforce isn’t entry level developers who can hash out c code and write a compiler from scratch. It is for people with combined skills who can APPLY encapsulated technology (lots thanks to companies has been encapsulated) to specific domains.
Let’s stop trying to train the mass of high school students to become preservation carpenters, and instead make them very good contractors.
I would recommend a deeper understanding of computing for the USER. People don’t have a clue of the very basics of computing.
How many people click on an attachment to save and can never find it again? People don’t understand the concept of CC vs BCC. Folks don’t not the difference between an Operating System, a browser, and a website. Learning how to program is NOT something everyone should learn. Phillips is right on the mark in suggesting we adjust the education system to teach application of encapsulated technology. A good book on the subject is Daniel Pink’s A While New Mind.
User Access Control has been causing me fits.
With UAC on, if you attempt to open a registry key in the LOCAL_MACHINE hive and you specify WRITE permissions, it will fail (that was a bug on my part).
Something else to consider is that processes of different integrity levels cannot send/post messages to each other. This post has a good explanation of that and a work around.
There is TortoiseHG for Explorer Integration which is what I installed which included Mercurial.
Update: I was unable to get hgscc to work on Windows 7 VS 2008. Any attempts to add a file from within VS resulted in a generic error message. I uninstalled hgscc by right clicking the .msi install file and selecting uninstall