Let it crash can be a good thing, especially if the alternative is empty catch blocks, or generally failing silently. If you can provide an equally attention grabbing alternative to crashing, like logging an error that also sends a critical message/email/event that could work if you can gaurantee not leaving the app in an unknown state.
The only error checking a program needs are for errors that can actually happen during normal control flow.
Here are more posts on the subject.
I’m sticking my toe into Android Development
Here are some reference links
What version of Android should you develop for? Many say develop to the oldest version that you can in order to support the biggest market share. However the older versions are only in a small % of the phones. The newest versions of Android are not supported in many phones yet. The sweet spot in my opinion starts at 10% coverage which today is 2.1. Visit this site for the latest stats.
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.