November 29, 2010

The important of the Web browser


I could estimate that 90 percent of everything I do on a computer is now in a web browser. Coding is the only thing I don’t do using the browser. But for an example, my wife only uses the Web browser, and she’s a typical everyday computer user.

Web browse is the mostly used program in the recent years with the internet evolution and it is the most important software program of all. Since the focus has been on to the Browser—Google has made a wise decision to release a Computer Operating System (OS) which only focuses on the web browser. Most probably you can see an early preview of their OS in next few weeks.

So it's time now to seriously think about the cloud computing. 

November 25, 2010

Get Color from Hex values in Silverlight

Since Silverlight does not support System.Drawing.ColorTranslator the following method can be used to convert Html Color values to a Color object.


public static Color GetColor(string htmlColor) {
            return Color.FromArgb(255,
                Convert.ToByte(htmlColor.Substring(1, 2), 16),
                    Convert.ToByte(htmlColor.Substring(3, 2), 16),
                    Convert.ToByte(htmlColor.Substring(5, 2), 16)
            );
        }

November 18, 2010

Anywhere, anytime on any device – documents

It was Microsoft’s vision to connect people—anywhere, anytime on any device. However after a decade of their .Net vision, people are connected to each other more than ever—primarily using Social Networks (i.e. Facebook, Twitter etc).

But this post isn’t about Social Network. It’s about taking your documents online or to the cloud, where you can access them from anywhere, anytime on any device. This is the first in a series of posts on how to take your personal computer to the cloud, such as photos, videos, projects, emails etc.

Generally I use four computing devices;
  • Office PC
  • Home PC
  • Personal Notebook
  • Mobile (iPhone)
I write articles, books and business proposals and sometimes I have to work on them regardless of where I am. For example, I could write an article at home and would like to proof read it while I’m travelling. So I use the following setup (please refer to the following diagram) within my four computing devices. More importantly I’m completely independent from those devices, which means I have access to any of my documents from anywhere.


Steps to setup your devices; 
  • Download and install Dropbox(http://www.dropbox.com) in your Home, Office and Personal computers. Also download Dropbox for iPhone.
  • Download and install OffiSync (http://www.offisync.com) in your Home, Office and Personal computers. 
  • Register for Google account (if you don’t have any), this is to use Google docs for your documents. 
  • Create document repository in DropBox’s Private folder—this is where you save your documents.
Let’s create a document and access it from anywhere.
  • Create MS word document and enter some text. 
  • Save the document in DropBox’s Private folder. 
  • Also save the same document to Google docs using OffiSync MS Word plug-in.
  • Now change your computers and browse the relevant folders and your document has been synced with all the computers (Office, Home and Personal).
  • Open Google docs in your iPhone and you can now edit the same document while you are travelling. 
  • More importantly you can access the same document from anywhere—you only required a computer with Internet access. 
I still DO NOT save documents which contains Bank details or Passwords using this method. So I suggest you should do the same. 

Hope this helps and stay tuned for the next post— Anywhere, anytime and on any device – Photos.

November 17, 2010

Using Predicate to filter NSMutableArray

To filter NSMutableArray you could use Predicates in Objective-C. This will returns a new array which matches to the given predicate.


NSMutableArray *list =
    [NSMutableArray arrayWithObjects:@"Mark", @"Balmer", @"Bill", @"Steve", nil];
NSPredicate *listBPredicate = [NSPredicate predicateWithFormat:@"SELF beginswith[c] 'b'"];
NSArray *namesBeginB = [list filteredArrayUsingPredicate:listBPredicate];

NSPredicate *listContainsPredicate = [NSPredicate predicateWithFormat:@"SELF contains[c] 'e'"];

NSArray *namesWithE = [list filterArrayUsingPredicate:listContainsPredicate];

listBPredicate will return names which starts in "b" and listContainsPredicate will return all the names which has letter "e".

November 15, 2010

How to save User preferences in iPhone app

Saving user preferences in iPhone app is fairly easy. It work as key/value pairs in NSUserDefaults object.


To save whether user prefers sounds on or off in your application you can do it as the following code block.

[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"soundsOn"];

And to retrieve the sounds preferences value;


BOOL soundsOn = [[NSUserDefaults standardUserDefaults] boolForKey:@"soundsOn"];