Saturday, December 18, 2010

OpenDNS Internet Filtering

We have been using OpenDNS for several months to protect our home computer network from pornography.  We had been using BSecure but it did not have an easy way to protect our whole network, and it sometimes caused problems on the computers we installed it on.  OpenDNS can be configured on your router and so there is no need to install or configure anything on any device connected to your router.

See a previous post for more info.

Wednesday, October 27, 2010

Change Firefox awesome bar search engine

I have gotten used to just typing in whatever in the Google Chrome omnibar to search.  I also use Firefox, and the awesome bar does not work the same by default.  Change Firefox awesome bar search engine at cnet shows how to change it.

- Go to "about:config" in firefox
- Double click on the keyword.URL setting.  Save the setting in case you want to go back.  Mine was ""
- Change it to the value you want I changed mine to ""

That changed it so it uses the vanilla settings of Google.

UPDATE 2011-01-12: This does not seem to work any more.

Friday, September 03, 2010

Visual Studio Formatting Settings

Here is a list of formatting settings that I like in Visual Studio.

View White Space
Edit -> Advanced -> View White Space
This allow me to see if I have tabs or spaces.

Also Edit -> Advanced -> Untabify Selected Lines

Place open brace on new line for functions and control blocks
In Visual Studio, click Tools -> Options. In the Options dialog on the left pane select Text editor -> JScript -> Formatting
See here for a picture.

Thursday, June 24, 2010

Tight internal cohesion and Loose external coupling

This basically means that each method in a class should have one task and the class as a whole should have one major responsibility (tight internal cohesion) and that other classes should not depend on the inner workings of this class but should be designed to the "interface" of the class (loose external coupling).

Monday, May 17, 2010

PowerCommands for Visual Studio 2010

PowerCommands adds new items to the context menu when you are in the solution explorer like opening a command prompt for the directory of the file or folder you are in.  You also get the "Transform Templates" context menu for folders with .tt file in them

Add it by going to Tools\Extension Manger and search for PowerCommands

Monday, May 10, 2010

Numbers are Beautiful

"A short movie inspired on numbers, geometry and nature"

Wednesday, May 05, 2010

Enable AHCI Hard Drive

On my machine I have enabled AHCI drives

I changed a registry setting to 0

In the bios I had to enable SATA AHCI as well as SATA AHCI Legacy

Now it seems to have increased HD speed 50%.

Saturday, May 01, 2010

The Great Robot Race

From Nova:
Twenty-three bizarre looking vehicles line up at the gate of the DARPA Grand Challenge with one thing in common: there's nobody behind the wheel. With names like Terramax, Ghostrider, and Stanley, these vehicles are armed with cutting-edge technology.

Monday, April 12, 2010

Daylight Savings Notice

Our office does not observe Daylight Savings. I wanted to display a notice on our order form to make users aware when daylight savings was changing. After spending hours not finding a way, I found code here . I added a method to it adapted from his code. I just wanted the dates daylight saving start and ends for a given TimeZone. I had already tried:

DaylightTime daylight = TimeZone.CurrentTimeZone.GetDaylightChanges(DateTime.Today.Year);

But that only gives it for the time zone of the server. I needed to get a System.Globalization.DaylightTime for a timezone that observes Daylight Saving.

public static DaylightTime GetDaylightChanges(TimeZoneInfo InTimeZoneInfo, int InYear)
   TimeZoneInfo.AdjustmentRule ruleFound = null;

   TimeZoneInfo.AdjustmentRule[] adjustments = InTimeZoneInfo.GetAdjustmentRules();
   if (adjustments.Length == 0)
    throw new Exception(InTimeZoneInfo.StandardName + " has no adjustment rules");
   //Find the correct adjustment rule
   foreach (TimeZoneInfo.AdjustmentRule adjustment in adjustments)
    if (adjustment.DateStart.Year <= InYear && adjustment.DateEnd.Year >= InYear)
     ruleFound = adjustment;
   if (ruleFound == null)
    throw new Exception("No TimeZoneInfo.AdjustmentRule found for TimeZoneInfo "
     + InTimeZoneInfo.StandardName +" for year " + InYear);

   DaylightTime outDaylightTime = new DaylightTime(
      GetDateTime(InYear, ruleFound.DaylightTransitionStart)
     , GetDateTime(InYear, ruleFound.DaylightTransitionEnd)
     , ruleFound.DaylightDelta);

   return outDaylightTime;

public static DateTime GetDateTime(int Year, TimeZoneInfo.TransitionTime transactionTime)
//Create a datetime to begin with 1st of the transition month
DateTime dt = new DateTime(Year, transactionTime.Month,
1, transactionTime.TimeOfDay.Hour,
transactionTime.TimeOfDay.Minute, transactionTime.TimeOfDay.Second);

//If the dayofweek of 1st is same as the transition day then exit
if (dt.DayOfWeek != transactionTime.DayOfWeek)
//If transition dayofweek is greater than 1st dayofweek then we need to move further
//Eg : Transition dayofweek is tuesday and 1st day of week is monday then we need to move 1 day ahead to point to 
//the transition day
if (dt.DayOfWeek < transactionTime.DayOfWeek)
dt.AddDays(transactionTime.DayOfWeek - dt.DayOfWeek);
//else its not in the 1st week so we move 7 days ahead and move back again
dt = dt.AddDays(7 - (dt.DayOfWeek - transactionTime.DayOfWeek));

//Since we are already pointing to the first week of the transition date
//Add remaining no of weeks to the datetime
return dt.AddDays((transactionTime.Week - 1) * 7);

Here is the usage.

TimeZoneInfo PacificTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time");
DaylightTime daylight = CustomTimeZone.GetDaylightChanges(PacificTimeZone, 2010);
Console.WriteLine("daylight.Start = " + daylight.Start);
Console.WriteLine("daylight.End = " + daylight.End);
Console.WriteLine("daylight.Delta = " + daylight.Delta);

Saturday, January 09, 2010

Setting Up Gmail and Outlook on iPod Touch

On the iPod Touch, you can only set up one Exchange account. It is this kind of account Google recommends you set up to synch your contacts with the iPod. I want to be able to access both my Gmail and my work Exchange accounts on my iPod. I also want my Gmail contacts on the iPod. This is how I did it.

I created a sub folder named "Personal Contacts" to my contacts in Outlook. Following these steps I exported my Gmail contacts to a file and then imported them into "Personal Contacts". On my iPod, I set up Gmail as an IMAP account and my work email as my Exchange account.

I now have both email accounts and both sets of contacts available in my iPod.