Tuesday, October 23, 2007

Traveling Back Home [with my new Samsung SyncMaster 206 BW 20" LCD]

I'm leaving Sweden tomorrow and will be back in India on 26th October.  Can't wait to hookup my shiny, Samsung SyncMaster 206 BW 20" LCD Monitor :)  I have to see how compatible is my "old" Nvidia GeForce 6200 card.

Wednesday, October 17, 2007

Bake vs. Boobs?

[17th October 2007 15:15PM] Update: Fine... I don't have to build one... It already exists in  the Boo Build System.  I think I need to stop using my blog as a scratch pad of ideas ;)  Still, it would be nice to know if Boobs meets the goals I had in mind:

  • It's full fledged DSL for Build [like Rake.  So very powerful.  I suspect Boo can do stuff that Ruby cannot in terms of extensible syntax. ]
  • It should be able to leverage the tasks already written for Nant [in other .Net languages]
  • Easy to use

Tuesday, October 16, 2007

Bake (?) - A Rake Port in Boo?

I defined a Build Process and wrote the NAnt build scripts [MSBuild wasn't even in its beta then]  for one of the .Net projects I was with quite sometimes ago.  Can you imagine a fortune 500 company's billion dollar Enterprise Web site without a Source Control system or Build system in place?   No way, right?  Wise up guys!

I'll reserve posting about the actual process for later.  Suffice to say that this project found so many issues with VSS 6.0d [which the company was insisting we use it].  And then I had an opportunity work with Perforce and I loved it!

Now, I can actually have track builds with all the changelists they include and mail to individual developers that had checked-in code, in case of a broken build.

Because Rahien is so vocal about DSL and evangelizing Boo, I was thinking of building a DSL that would ease my pain of having to define a Build Process for each of the Source Control / Build System Provider combinations.  

Let me make no bones about it:  While I'm comfortable with the concept of "DSL"s, I'm quite new to the idea of building one.  And I'm new to Boo.  

But the idea of a DSL was so compelling till I found great minds have already been at work ;)  I think it's Paul Graham who said "If you think you have a good idea, chances are that somebody's already working on it" .  Sigh!  Also, My idea of DSL for a Build language has evolved once I've seen how Rake is implemented.

But I guess, it would be a good idea to still implement this [at least just to learn Boo].

One disadvantage of an "internal DSL" as Martin Fowler calls them is ignoring large number of Tasks that Ant/Nant/MSBuild projects have accumulated over time.  If I need a SubVersion checkout task, I may have to reinvent the wheel in my DSL, unless my DSL has a way of integrating this body of work. 

If my DSL is in C# [Well... Rahien says C# is not "suitable" for writing such a DSL.  I choose to believe him as I have a vested interest in learning Boo], I may well be able to leverage all of Nant's tasks.

My vision is [was] to have a single language that would describe the build process   The language would "compile" down to the requirements you have either Ant/Nant/MSBuild scripts with appropriate tasks for Source control provider of your choice.  Since the Build Systems themselves are extendible and have massive community that revolve around them, it seems like a very good idea.  It may be esoterically dumb!  Let me think about it a bit more.

 

[17th October 2007 14:37PM] Update:   OK.  Why to compile it "down" to Nant/MSBuild scripts?  Since Boo is already in .Net fold, we can just use the existing tasks [from NantContrib/ MSBuildContrib?] as is!  No?

Monday, October 15, 2007

350 GB External HDD & Fat32

I ran into an interesting problem over the weekend.  On Saturday, I had bought Elements External Hard Disk Drive, a 350 GB mammoth just to back up some stuff from my laptop.

Aside: Hmm.. backing up for turning your laptop in is no fun.  Hate this part of the consulting business.

When I switched it on and connected to my laptop, it purred happily and identified itself as D:.   First up was the VS.Net 2008 Beta VPC download.    In you go!

It copied first two files [base*.*] and choked on the third one, OrcasBeta2_VSTS.vhd, the eleven GB  virtual hard disk.    The message? 

"You're running out of disk space in drive D:

 Do you want windows to help clean your mess up and free some space?"

Not exactly.  It was close though for a WTF!  Ever had the sinking feeling thinking your newly bought device is just money down the drain?  Fortunately, Google bailed me out - as usual - with this information that also lead me here.

Well, well, it seems that the file format that HDD came with was Fat32.  Surprise, Surprise!  Just ran the convert utility to peace of mind.

 

usbhddntfs

 

Thursday, October 11, 2007

Google, Where are you taking me today?

One of my colleagues asked me why I love Google so much [among millions of others]?  I, in turn, asked him how he uses Google.  He gave me a stare that said, "Are you nuts?  Everyone knows that Google is the best search engine out there!".  I took him to my desk and gave him a crash-course on "Google: How to".  Here's an except from the conversation:

[Note: Bear with me, I'm starting from the very beginning]

  1. Get yourself a Google - Gmail - id
  2. Enable Web History
    • Have you ever felt your browser based bookmarks are inadequate?
    • Have you ever searched for links bookmarked earlier?
    • Have you missed your home PC while at office or vice versa?
      • For the browser history etc. I mean
    • If you have answered 'Yes' any of the above, EWH is for you.
      • Privacy Paranoid:  You can manage your data        [Add/Delete]
      • Also:  You have the option of logging out if you don't want Google to know
        • They know it anyway... but ignorance is bliss.  We'll hope Google is more ethical.
  3. Install Google Toolbar
  4. Google Bookmarks
    • Use bookmarks in Google Toolbar to tag links
      • Multiple tags are allowed.  Use as many as possible for you to be able to find it though multiple avenues [of thought] later. 
    • Carry your Bookmarks everywhere
    • I have one complaint though:  Hierarchical Tagging. 
      • Why can't I have a Tag hierarchy?  It'll will halve my Bookmark menu.
      • Google can infer hierarchy from labels too. 
        • I use labels like: .Net:Security, MS:JavaScript, Agile:Scrum etc.
      • Can't we extend Google Toolbar to implement this?  I digress.
  5.  iGoogle: Customize home page
    • Some of the widgets I use
      • Google Reader
      • Gmail
      • iSuggest [15th Oct '07] Update : Thanks to this post here, I now can convert my iGoogle into Google Suggest
      • TODO
      • Google Bookmarks
      • Wikipedia
      • Search.Net [Google Custom Search!  What the heck!  I'll come to it in a minute]
      • Google Calendar and
      • Dilbert!
  6. Google Notebook
    • Clip HTML from any site [if you have the browser extension]
    • Add your own notes to search results using "Note This" link
  7. Google Search Specials
    • define: SOA
      • Expands Acronyms... SOA ==> Service Oriented Architecture
    • Advanced Search [A full list is out of scope]
      • Site Search
        • site:msdn.microsoft.com filetype:pdf
      • Image Search
        • filetype:gif
      • Use Google as calculator
  8. Google Office(!)
    • Spreadsheets / Documents
      • Online Collaboration
      • Share documents that you and your friend can edit online
    • Calendar
  9. Blogger
    • Create your own blog
    • Blogger does not allow image uploads.  See Picassa
    • You can host your blog in your own domain
  10. Page Creator
    • Create simple HTML Pages
  11. Google Apps
    • Do you own a domain?  Google can host it for you - Free of cost
    • You can create - up to 100 email ids - me@mynewstartup.com
    • You can also create your own pages for your site
      • A word of warning:  You need to disable this if you want to host your blog in the same domain.
  12. Google Photos aka. Picassa
    • You may download Picassa plugin for Windows Live Writer
  13. Google Code
    •  Open Source Code Hosting
    • Note:  You need Subversion to download code
  14. Google Checkout
    • A Service like Paypal [Registered but haven't used yet]
  15. Google Reader
    • It's an online feed [RSS / Atom] Reader
  16. Google Talk
    • You can even talk with friends who have logged into Gmail
      • Client not absolutely a must
    • I use Yahoo! at home most of the time.  Microsoft Messenger & Google Talk at office. 
  17. Google Maps
    • Custom Maps
    • Street View
  18. Google Custom Search
  19. Google Directory
    • Categorized Search  akin to looking up Yellow Pages
  20. Google Suggest
    • I use Google Toolbar, so I do not use the Web version often

Disclaimer:

There are entire books devoted to what you can do with Google. Try amazon.  You can also get a full list of Google offerings here and here.  I have not mentioned Google Gears, Google Desktop or other Google APIs.  I have not mentioned Google Timeline view or Google Shortcuts.

I've only included only what I use  [today] that has transformed my browsing experience.  Give in to the temptation!

Wednesday, October 10, 2007

Color.FromArgb(r, g, b).ToKnownColor()

I was going through the code of CSAH when I came across the class HtmlColor.  It does a mapping of r, g, b colors to a name by doing this:

this.color = String.Format("#{0:x2}{1:x2}{2:x2}", r, g, b);
switch (this.color)
{
    case "#00ffff":
        this.color = "aqua";
        break;
    case "#000000":
        this.color = "black";
        break;
        // more code

 

I tried this:

Enum.GetName(typeof(KnownColor), Color.FromArgb(255, r, g, b).ToKnownColor());

 

Nope.. didn't work!  ToKnownColor() was returning zero.  A quick lookup in MSDN Documentation proved my worst fears.  Unless you create a Color FromName, ToKnownColor() will return zero!

I googled and found this solution.  Here's my improved(?) version:

Dictionary<int, string> colorCache = new Dictionary<int, string>();
public string GetKnownColorName(int r, int g, int b)
{
    int iArgb = Color.FromArgb(r, g, b).ToArgb();
 
    if (this.colorCache.ContainsKey(iArgb)) 
        return this.colorCache[iArgb];
 
    string namedColor = null;
    foreach (string name in Enum.GetNames(typeof(KnownColor)))
    {
        Color kc = Color.FromName(name);
        if (!kc.IsSystemColor && kc.ToArgb() == iArgb)
        {
            namedColor = kc.Name;
            this.colorCache.Add(iArgb, namedColor);
            break;
        }
    }
 
    return namedColor;
}
 
Technorati Tags: ,

Local Storage != Offline?

I'm tinkering with at Dojo Offline Toolkit now.  It seems that Dojo Offline integrates with Google Gears as well.  I didn't suspect "Offline" [or "Offlining"] might be greater than Local Storage.  Dumb me!

Yeah, Dojo 0.9.0 download has GearsStorageProvider & FlashStorageProvider scripts under dojox\storage folder [No SilverlightProvider yet].

Will post my understanding soon as I get my 'aha' :)

 

Aside: Dojo 0.9.0's archive is a *.tar.gz file.  I used UltimateZip Command Line 1.0 to unzip it.

 

Monday, October 08, 2007

Ajax Local Storage and Grinding Google Gears

You're on a proxy server which requires authentication. Please note that we're currently unable to support this type of proxy.

This is the error Google Gears displays because I'm behind a corporate firewall [that requires authentication, naturally].  Considering that it must be trivial for Google to provide this functionality out of the box, its absence is puzzling.

Fiddler2 does it out-of-the-box but then it's not an IE plug-in.  Nikhil's WebDevelopmentHelper does it [it's an IE plug-in] but may not be a "man-in-the-middle".  It may just be listening in on the conversation between IE & the proxy.

So, today, for local storage, you could use:

Hello Microsoft, [knock... knock] are you guys listening?   Here's your chance for one-up-man-ship.  By providing local storage and every other thing everybody has been asking for in Silverlight,  you could still be ahead of Google [Gears]!.   [Aside: Hey, let's not panic,  YouOS  is no reason for us to not improve IE, right? :) ]

  • You can wait for Microsoft to update Silverlight or roll your own IE plug-in.  Easier to do in VB 6.0 than in .Net  [Need no CLR or the Framework].  Write a signed Script-able ActiveX control that could be configured by JavaScript.  Users could also override that info through a Configuration screen.   For example, override the application preference for 100GB of local space [:)] and deny access to his/her webcam etc. etc. [just as in Flash].