Moved to a new blog

Add Comment | Nov 05, 2006

This blog has moved to http://www.thousandtyone.com/blog. GWB has been a great community and I've learnt a lot by reading the Feed! It has been fun blogging here; I'll continue to Agregate with the GWB feed and read posts but becuase of my inability to maintain multiple blogs:),  all my future posts will be posted at my new blog!

Please do visit!

Customizing the Dot Net Nuke Search Input

One Comment | Apr 13, 2006

Customizing - DotNetNuke Search Input - The Problem

In a Recent Project I had felt the need to customize the DotNetNuke search input. If you've used DotNetNuke Search Inputs before you might have realized that the search Input Module is a little limiting in terms of customization. So, basically the kind of search inputs that you can have in DotNetNuke (based on what I currently know) are:

Of course, you could customize this slightly or you could have another kind with a picture just by changing the module settings:

And Finally you can have one with a search button (which of course can also be further customized)

How Ever there are times where you might want to further customize this Module beyond the out of box customizations that are allowed by DotNetNuke. The Control of course is available under Admin/Search/SearchInput.ascx but then again changing core modules is not such a good idea, is it?

Recently I had small requirement on a project which uses DotNetNuke where I had to customize this input and display something like this:

 

Customizing - DotNetNuke Search Input - The Solution

Apparently, I didn't find anything out of the box in DotNetNuke that will let me reach this level of customization and modifying the core didn't seem like such a good idea anyways - So I started out by taking a copy of the Two Files - SearchInput.ascx and InputSettings.ascx and App_LocalResource Folder (which has the resource files). Created a New Folder Under DesktopModules Folder Called CutomizedSearch which now contained a Copy of those two files and the resource files inside a App_LocalResource sub folder. I started out by modifying the Code For SearchInput.ascx by Adding a new TR and moving the buttons in the next Row

Once  Done I Added A new Module Definition by replicating the exact settings that were present in the module definition for the default search input module. Once done I dropped the module on my site and executed it:

So Far So Good, Next I Set out to replacing the image with one I wanted using preferred DotNetNuke method of customization. For this I modified the resource files in my Customized Module's folder to point to the New Image.

Now, I Set out to write a New Container - my ultimate aim was to make the search box look like this -

For this I started out with the CSS (provided by highly efficient graphics person) and quickly wrote up quick Container Code which was some fairly simple HTML.

Zipped the container and uploaded it and allowed DNN to do the rest. Now that I was controlling the Title and area around the text box with the container the "Inside" (the actual control was still white) - I made minor modifications to TD's of SearchInput.ascx file that I had copied just to make sure the correct style were being applied to the body of the control as well, aligned the button within the TD and Ran the Code:

The Image on the left shows the basic point I had started out with Dot Net Nuke Search box. Image On the Right is where I had arrived. The lines of code that I wrote pertaining to Search - 0! Finally I topped it with a cherry - by setting the default text of search box exactly as needed in the Project and doing some more polishing:

Now that I'm done - I'm thinking - could this have been done in a simpler / better / more elegant way? Anyone out there who would rather do it differently?

 

 

Office 2007, The New Interface - Ahh! So That's what they've Been Hiding!

2 Comments | Jun 28, 2006

“Huh!?” – that’s how I reacted when I first started a Word 2007 instance early this week. Now, as you can see (from the image below) the reaction was a combination of both surprise and… more surprise.

Here are some surprises (All Pleasant ones)

Where did my Menu’s go? That's Gone! Yadda! Zip! Choo! Gone! Just Like That! At least in Microsoft Word, PowerPoint and Excel. The Ribbon (which is like a really cool tabbed menu) is a pleasant experience to work with. Outlook (which has tons of new features) still has the old menu type navigation.

Smart Tabs In Ribbon -  It looked like the ribbon had all picture related menu’s missing! Then I inserted a picture and a Format Tab just magically showed up! Sweet! Way better than disabling and enabling Menus.

My Office 2003 Shortcuts still work – I discovered this out of my instinct to press ALT + T + O to go into word options. Even though no tool  menu existed Word Very Smartly asked me to “Continue typing the Office 2003 menu key sequence”

Outlook search is Real Time and Way Cooler – outlook comes  with a REALLY Cool MSN Search that searches my indexed emails (full header and messages) real time as I type.  

Quick Launch bars – the items next to the office button – these is VERY Intelligent use of title bar.

Microsoft Office Button -  The Office Button at the top left corresponded to File Menu on Steroids. This thing has tons of new features like the ability to blog using Microsoft word and create shared workspaces.

The Dam thing is skin-able – all I can say is… “at last!”

I would type more but my tired fingers won’t let me… Let’s just say I am on 2007 Beta and wouldn’t mind using it as my Primary Office application. It’s fairly stable and Worth a try!!

Transactions, Identity Columns and Foreign Key Constraint Errors - The Chicken Egg Situation

One Comment | Sep 08, 2006

I faced this problem while using NetTires which I highly recommend for anyone who wants to quickly generate a Data Access Layer using Microsoft Enterprise Library without having to do the grunt work and writing boilerplate Data Access Code.

In my efforts to not digress from the Topic I am going to keep some other data access mechanisms that I've used in the past out of the scope of this post and just state that NetTires is a Decent enough Data Access Mechanism I am currently in love with and am using it for a personal open source initiative. So, coming back to the point...

What's the problem?

"If you have two Tables having a Parent Child relationship bound by key which is an Identity Column Directly trying to Save the parent followed by the child in a single Transaction leads to a Foreign Key Violation Exception" - To Elaborate further I explain with an example. Consider the tables Student and Student Marks which are hooked to together into a one-to-many relationship by a StudentID which is an Identify Column.

So, if my application has a screen where a person enters student information and his marks at one single shot and I want to ensure that I either save the entire information entered (for both student and his marks) at one shot or nothing at all I would use transactions.

The steps involved would be typically open a transaction in ASP.NET (using NetTires in my case; or directly ADO.NET in other cases), save changes to Students table followed by saving changes to Student Exams table, followed by Committing the transaction.

So, what ever I've said till now "sounds" logical but it's not. The catch here is that I am using Identity Columns To identity a student and identity columns are generated by the database. So, assuming that this is the second student I am adding SQL Server generates Student ID as 2. The catch here is that there's no way to find out that 2 was Generated unless I've committed the transaction since the value 2 doesn't make it to the data base table unless the transaction is committed!

So, basically you can't save the child till you commit the parent and a transaction is not considered committed till both parent and child are successfully saved. A chicken-egg situation (somewhat).

And The Solution?

This is a classic ADO.NET problem (it's not even a problem, since it's been solved so many times before) and a lot of us might have addressed this in the past using this approach or some form of it. With NetTires the situation is a little difficult to track and fix specially when using DeepSave on the Parent (in our example Students) object.

A little bit of investigation into the nHibernate Generated stored procedures revealed that they were intelligently using SELECT SCOPE_IDENTITY. This means that a DeepSave on Student Table that was giving Foreign key violation exception can be fixed by:

  1. Not Using Transactions with Deep Save. This ensures that student is saved to DB and then StudentExam save is attempted. (Not really a solution, but a Band-aid - if you're looking for one :))

    OR
     
  2. Using the Following Algorithm:
    1. Open A Transaction using a TransactionManager object;
    2. Call the Save Method of Student Entity by passing the same TransactionManager object (Don't Deep Save!);
    3. Once you do this the SELECT SCOPE_IDENTITY at the end of each generated stored procedure ensures that StudentID now has the new generated ID value even though the transaction hasn't committed!
    4. This Means that now it's possible to iterate through the collection of StudentExamsCollection available in the student object and do something like:
      objStudent.StudentExamCollection[i].StudentID = objStudent.ID (inside the for loop that's iterating through these objects).
    5. Once this is done all your data is consistent. Call the Save Method of StudentExams table by passing the same TransactionManager object;
    6. Commit the transaction.

The whole Identity Column Vs. GUID's is a religious argument and this problem doesn't exist in the GUID world; but the GUID Vs. Identity Column argument for another post :) -

So, this post is my two cents, if you're using Identity Columns with connected tables and transactions, and are running into Foreign Key Constraints.

Back To The Basics And Beyond! Generic Methods and Multiple Constraints.

Add Comment | Sep 09, 2006

A couple of days ago I was asked if there was any way by which I could overload a method to "return" more than one type. If I was in a class room, or I was teaching a programming class (I've done that for some part of my life :)) my instant answer would have been "No." And then I would have proceeded to explain why the whole idea was not valid in the Object Orientation world. 

However, this question was not coming from a high school student. In all probabilities it was coming based on a practical requirement and business problem.  My reaction to this question was: "why do you want to do something like that?" - At the first sound of it the question sounds like a fundamental High school Object Orientation question. But it isn't.

C# 2.0 and Generics is changing the fundamental way in which DotNet Programmers (me included; If I can can call myself a real programmer :)) are thinking. Any programmer worth his salt is asking himself some very basic and fundamental questions: How can I write better and lesser code? How can I write Generic Code? How can I write Code which I can reuse and leverage in situations which are "somewhat similar", even if they are not exactly the same. Anyway, I Digress...

So, this Post is about trying to answer that question. But before I attempt to answer it I would like to rephrase the question a little bit: The question (if you really think about it) that I heard was: 

"If I need to write the exactly same functions which have the exact same 'business logic' but need to return 5 different types do I really HAVE TO Write 5 different functions with completely different Names?"

My answer to that is: Not Really. I Fumble a bit with syntaxes and memory every now and then so I'm going to Google for syntaxes and give some basic code examples to explain my point as I type, but long story short I think the answer to this question is "Generic Methods with Constraints". If you know what these are and have already seen where I am going with this the rest of the post is not for you. If you don't know what these are Read on.

If You Goggled to this page to find the syntax of how you can have a different Constraint for each Generic Parameter and Return Type skip the rant and go to the "Yet Another Long Example" section.

With Generic Methods I Keep the method Generic (wow! that was easy to explain :)). In other words, While writing the method I don't specific what is the type of Parameters it expects or the Type of object it returns. The following code snippet illustrates:
 

   18         public static T WhatsGreater(T x, T y)

   19         {

   20                 // Implementation

   21         }

Worth noticing that in the above code all I am telling the compiler is: "Function WhatsGreater is going to Expect two Parameter of Type T and return an object of Type T where the calling code is going to tell you what T is".

Now, we do have a problem here. Since we've told the compiler nothing about T it means that the calling code can specify T to be any class or type. And Since I know nothing about T when I am writing this function it makes it really difficult for me to implement this function. In other words, while writing the implementation I have to "assume" that T is could be anything. It could even be an object of the "object" type.

This is where Constraints come into play. By Using Constraints I narrow down the possibilities of what T can be. For Example, I could tell he compiler.  "Function WhatsGreater is going to Expect two Parameter of Type T and return an object of Type T where the calling code is going to tell you what T is, BUT T HAS TO Implement the IComparable Interface!" The following Code Illustrates:
 

   19         public static T WhatsGreater(T x, T y) where T : IComparable

   20         {

   21                 // Implementation

   22         }

Now that I can be sure that both x and y are going to implement the IComparable Interface (because they're objects of T), I can actually "compare" them by assuming that they will implement the methods IComparable Expects them to implement (methods like CompareTo). Following Code Snippet Illustrates:
 

   18         public static T WhatsGreater(T x, T y) where T : IComparable

   19         {

   20             if (x.CompareTo(y) > 0) // if x is greater than y

   21                 return x;

   22             else return y;

   23         }

So, what we now have is a generic function that I can use with Any object that uses the IComparable Interface! Let's try calling this was two integers:
 

    9         static void Main(string[] args)

   10         {

   11             int GreaterInteger = WhatsGreater<int>(40,15);

   12             Console.WriteLine("Greater Integer is : " + GreaterInteger.ToString());

   13             Console.Read(); // Wait Till I See the Output

   14         }

In the above code snippet, notice that I specify that T is an integer (in the calling code) and that I am Passing two integers to WhatsGreater method when I say "WhatsGreater(40,15)" - Alternately I could have also specified that T is a double. The following Code snippet illustrates:
 

    9         static void Main(string[] args)

   10         {

   11             double GreaterDouble = WhatsGreater<double>(40.0,15.0);

   12             Console.WriteLine("Greater Double is : " + GreaterDouble .ToString());

   13             Console.Read(); // Wait Till I See the Output

   14         }

So, Apparently I can use the same "WhatsGreater" function in a Type Safe Manner and Make it return different Data Types without resorting to any boxing / un-boxing.

Now, I spend a couple of minutes on a Rattle which explains why this code is better than the convectional way of doing it. If you're already convinced that it is better, feel free to skip the next few code snippets and go to the "Another Long Example" section.

To any object oriented programmer this doesn't sound like a big deal. Does it? You could do this same thing with fundamentals of inheritance. The below code snippet would achieve the exactly same thing without generics:
 

   19         public static IComparable WhatsGreaterWithoutGenerics(IComparable x, IComparable y)

   20         {

   21             if (x.CompareTo(y) > 0) // if x is greater than y

   22                 return x;

   23             else return y;

   24         }

And the calling Code:
 

    9         static void Main(string[] args)

   10         {

   11            int t  = (int) WhatsGreat(5, 4);

   12            Console.WriteLine(t.ToString());

   13            Console.Read();

   14         }

This old technique works too, much like the generic method implementation BUT It's not type safe. In other words if I changed the implementation of WhatsGreaterWithoutGenerics method to return a double instead of an int (which the calling code is "expecting") it would result in a runtime exception. The following code snippet illustrates:
 

    9         static void Main(string[] args)

   10         {

   11            int t = (int)WhatsGreaterWithoutGenerics(5, 4);

   12             // The above line results in a Runtime Exception!

   13            Console.WriteLine(t.ToString());

   14            Console.Read();

   15         }

   16 

   17         public static IComparable WhatsGreaterWithoutGenerics(IComparable x, IComparable y)

   18         {

   19         // just return a double

   20             double returnValue = 4.3;

   21             return returnValue;

   22         }

Now, let's do the same thing on the Generic Method:
 

    9         static void Main(string[] args)

   10         {

   11            int i = WhatsGreater<int>(5, 4);

   12            Console.WriteLine(i.ToString());

   13            Console.Read();

   14         }

   15 

   16         public static T WhatsGreater(T x, T y) where T : IComparable

   17         {

   18             // Let's try returning a double

   19             double g = 5;

   20             return g;

   21             // This Results in a Compilation Error Because this method is type safe!

   22         }

Obviously this doesn't even compile. Because the method is Type Safe and it has to return an object of T i.e. x or y. The point that I'm trying to make from this long story is that A Generic method could return more than one type of object (depending on how you call it) in a Type Safe manner.

Yet Another Long Example

When talking about fundamental concepts I prefer not to use too much code. It just confuses things badly. But now that I've explained the basic concept I'm trying to write another example to show how the same concepts explained above could be utilized to address something very different.

Below code snippet contains three basic interfaces, A Guy and A Girl (who are going to get married, and when they do the last name of the girl will change to that of the guy's):
 

   32     public interface IGuy

   33     {

   34         // The FirstName of the Guy Followed by A Space Followed By the Last Name

   35         string GuysName { get; set; }

   36     }

   37 

   38     public interface IGirl

   39     {

   40         // The FirstName of the Guy Followed by A Space Followed By the Last Name

   41         string GirlsName { get; set; }

   42     }

And their Implementation:
 

   52     public class Guy : IGuy

   53     {

   54         private string _GuysName = "";

   55         public string GuysName

   56         {

   57             get { return _GuysName;  }

   58             set { _GuysName = value; }

   59         }

   60     }

   61     public class Girl : IGirl

   62     {

   63         private string _GirlsName = "";

   64         public string GirlsName

   65         {

   66             get { return _GirlsName; }

   67             set { _GirlsName = value; }

   68         }

   69     }

Now, we write a Generic function which could take any classes derived from the Interfaces and would return the Girls Name After she marries the guy:
 

   20         public static TypeGirl GetWifeNameAfterMarriage

   21             (TypeGuy guy, TypeGirl girl) where TypeGirl : IGirl where TypeGuy : IGuy

   22         {

   23             string GirlsFirstName = (girl.GirlsName.Split(' '))[0];

   24             string GuysLastName = (guy.GuysName.Split(' ')[1]);

   25             girl.GirlsName = GirlsFirstName + " " + GuysLastName;

   26             return girl;

   27         }

Notice how each parameter has been limited using a separate constraint. What this function basically does is, allows the calling code to specify any class that derives out of IGuy class and any class that derives out of IGirl class and then pass their objects to this this function. Once the objects are passed this generic function takes the first name of the girl and the last name of the guy and returns the girls full name After their marriage.

Finally we write the calling function:
 

    9         static void Main(string[] args)

   10         {

   11             Guy guy = new Guy();

   12             guy.GuysName = "Joe Smith";

   13             Girl girl = new Girl();

   14             girl.GirlsName = "Anna Williams";

   15             girl = GetWifeNameAfterMarriage<Guy, Girl>(guy, girl);

   16             Console.WriteLine(girl.GirlsName);

   17             Console.ReadLine(); // Output is Anna Smith

   18         }

Besides the first example the intent of this example was to show that you can actually set make a generic function expect more than one generic types and then set constraint on each of those generic types individually.

I've seen a lot of people focus on Generic classes and use them for custom collections but Generic Methods have many other potential uses than just custom collections. In fact, they're the first step of moving of your code to generic classes, if you think about it. I hope this long explanation helps clear out a few basic concepts. There are many other crazy things that can can be done with Generic functions but a sleepy brain and tired fingers won't let me type more (at least not on this post).

These are just my two cent and I don't claim to be a Generic Guru :) but all comments / suggestions / feedback and questions (if any) are always welcome from anyone who reads this.

Nullable Types, What does int followed by Question-mark (int?) Mean? What's with the Double Question Marks and Other Syntaxes?

3 Comments | Sep 09, 2006

I first read about Nullable Types around 6 months or so ago. Since I last heard about / used Nullable types, I had completely forgotten about the syntaxes and was completely stumped when I was asked what "int? x" meant by a couple of guys at work. 

I'll not Blog about the basic concepts of Nullable Types here. I think this MSDN Article does a particularly good job at it. What I'll Blog how ever is the basic syntax which is so darn confusing at times that I've read about it once, seen it getting used twice and forgotten all about it.
 

   14         ///

   15         /// Nullable Types The Simple Format

   16         ///

   17         public static string Foo(Nullable<int> x)

   18         {

   19             if (x.HasValue)

   20                 return "You Passed A Valid Integer. Value Passed is : " + x.Value.ToString();

   21             else

   22                 return "You Passed A Null";

   23         }

So, Function Foo can now accept both nulls and Integers (but no other type). Using HasValue I can determine if null was passed to the function or not and then using Value I can actually get the Integer value if null wasn't passed.

(Needless to mention that doing a x.Value without checking is x Has a Value (x.HasValue) will result in a runtime Exception).

The same code could be written slightly differently:
 

   14        ///

   15         /// Nullable Types The Question Mark Syntax

   16         ///

   17         public static string Foo(int? x)

   18         {

   19             if (x.HasValue)

   20                 return "You Passed A Valid Integer. Value Passed is : " + x.Value.ToString();

   21             else

   22                 return "You Passed A Null";

   23         }


Notice the use of the ? character here. Saying "int? x" is the same as saying "Nullable x".

Now let's come to another scenario where I want to return 0 if the value of x is null or the actual value if x has any other valid value.
 

   14         ///

   15         /// Nullable Types The Question Mark Syntax. Return the correct Value if X

   16         /// contains a value. 0 if X contains a Null.

   17         ///

   18         public static int Foo(int? x)

   19         {

   20             int i;

   21             if (x.HasValue)

   22                 i = x.Value ;

   23             else

   24                 i = 0;

   25 

   26             return i;

   27         }

The whole if... else can be avoided using a slightly different syntax:
 

   15         ///

   16         /// Nullable Types The Question Mark Syntax. Return the correct Value if X

   17         /// contains a value. 0 if X contains a Null.

   18         ///

   19         public static int Foo(int? x)

   20         {

   21             // same as saying, if x has a value i = x; if x is null i = 0.

   22             int i = x ?? 0;

   23             return i;

   24         }

So, I could return the actual value of x if x contains a value or return any other hard-coded value of my choice if x contains null. In 99.99% (we talk about the other 0.01% of the cases later) of the cases however, I would want this "hard-coded value of my choice" to be 0 since that's the default value of integers when they are not assigned any value.

So, in the above function what I am basically saying is - if x contains a value return the value. If it doesn't, return 0 (which is the default value for value type int). I could also write this code as:
 

   15         ///

   16         /// Nullable Types The Question Mark Syntax. Return the correct Value if X

   17         /// contains a value. 0 if X contains a Null.

   18         ///

   19         public static int Foo(int? x)

   20         {

   21             return x.GetValueOrDefault();

   22         }

Since I am using Nullable types there's a 0.01% possibility that I want the Nullable type to have a different default value than what it's supposed to have. So, let's say that if X contains null I want to interpret that null as 7. I could say:

   15         ///

   16         /// Nullable Types The Question Mark Syntax. Return the correct Value if X

   17         /// contains a value. 7 if X contains a Null.

   18         ///

   19         public static int Foo(int? x)

   20         {

   21             int i;

   22             i = x ?? 7;

   23             return i;

   24         }

Or I could write it as:
 

   15         ///

   16         /// Nullable Types The Question Mark Syntax. Return the correct Value if X

   17         /// contains a value. 7 if X contains a Null.

   18         ///

   19         public static int Foo(int? x)

   20         {

   21             return x.GetValueOrDefault(7);

   22         }

So, with Nullable Types you have multiple ways of writing the same thing. This post just attempts to answer all questions I've been asked regarding Nullable Types. Final question was - how would I Convert a Nullable type to it's corresponding value type. e.g. How would I convert int? x to an integer and assign it to another integer.

As the above code snippets illustrate I would assume that the best way would be:

   13         static void Main(string[] args)

   14         {

   15             int? x = null;

   16             int y = x.GetValueOrDefault();

   17             // or int y = x.GetValueOrDefault(foo2);

   18             // where foo2 is the value I want to assign to y if x is null.

   19         }


(For all those who didn't like the black background and color of the code snippets; Sorry, but I'm now a part of a group of freaks who like to use non-white color schemes in Visual Studio :))

Free Tools To Magnify Your Screen / Parts of it in Real Time (For Creative Guys / Designers and Guys who want to Magnify stuff during presentations).

One Comment | Sep 11, 2006

A Few days ago I had a discussion with a person from our creative team who informed me about (and liked) the fact that in MAC you could just zoom in and magnify any part of your screen in real-time.

This was one feature I could use during technical presentations as well. So I decided to go searching  for some free tools that let me do this same thing in windows and met a whole throng of free tools that let me do this. Here are the best two that I came across:

http://www.sysinternals.com/Utilities/ZoomIt.html - (Everyone loves SysInternals :)) [Highly Recommended]

Pros: I Like the ability to scroll to Zoom deeper and Right click to come out. Typical Sys-Internal "No need to install" single Exe is particularly cool if you want to carry this thing around on a USB drive. Love the Pen Feature which lets me draw on and highlight parts of the zoomed area.

Cons: Pretty much zooms the entire screen. Doesn't let me choose the height and width of the magnifier or the particular areas on screen that I want to zoom.

http://magnifier.sourceforge.net/ - Free, open source Magnification for Windows, Linux and Free BSD. [Highly Recommended]

Pros: I like the fact that I can choose the Magnification level, the size and the graphic tool feature is particularly interesting.

Cons: I can't zoom in and keep increasing the magnification level, on real time. Need to reach out for my system tray icon and set the Zoom Parameter which can make my presentations slow :)

Here's A Big List of other free (and some paid) tools to achieve the same thing. Enjoy!

Auto-complete in Dos (Hitting Tab to Complete Directory / File Names in CMD.EXE), Does Not Work!

Add Comment | Sep 09, 2006

Besides being a DotNet developer I've spent some part of my life (3 odd months) in the past, being a Linux Administrator. Every guy in the Linux world loves the bash Auto-complete feature. The part where you type the partial name of file or directory and hit the tab button and the console completes the typing of the entire file / directory name for you.

I just think it's Natural (and super cool) for an OS to be able to reduce the number of clicks (or keystrokes, for that matter) and help you get to where you want to get faster.

The Windows CMD.EXE had started supporting this feature; since, I don't when. I don't recall when I hit the tab key while I was working in the Dos Console. The Auto complete worked (just like Linux bash). In fact it worked so smoothly that I didn't even realize or think about the fact that it wasn't supposed to work! I was in DOS (CMD.EXE of windows 2003 server edition), not Linux!

Anyway, so basically, what I am trying to say is that I've been using the Auto Complete on tab feature of MS-DOS without even knowing / realizing / remembering since how long I've been using it.  Recently I showed this to another Linux IT guy who was working in MS-DOS and his reaction was - "Wow! I didn't know Dos Supports This!"

So, basically looks like this feature has been a part of MS-DOS for a VERY long time and most IT guys I've worked with or talked to don't even know / remember when this feature became a part of MS-DOS.

Recently I reinstalled Windows 2003 Server on my laptop (I was having problems with a direct install coz my Dell 700m would just hang - so I had to install windows 2000 and then upgrade to 2003) after a format and a "fresh start" and discovered that the Auto Complete on Tab feature wouldn't work any more!

As it turns out, this is a feature that may / may not be enabled on your machine by default. If you've upgraded from Windows 2000 or a previous OS to Windows 2003 Server this feature may be disabled by default. Enabling it is simple though.

Use the registry editor and change the value of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor\CompletionChar from 0x40 to 0x9

I had a difficult time Goggling an answer for this problem so I thought I'd post it here. Here's the URL where this Information originally comes from. (Just so that I give Due credit to the guy for posting the solution :) )

Hack your Tungsten-E to improve it's Battery life!

2 Comments | Jul 29, 2006

I’ve been reading a LOT lately, mostly during my commute. I’ve been a MP3 Audio Book guy for the past few months but nothing beats reading. So, lately I’ve been accompanied by my 1.5 year old Tungsten E reading on my way home and to office.

 

The T/E has shown some battery drain issues last week. I had nothing to do this Saturday, (practically half of my family is out holidaying) so, I decided to waste some time trying to investigate what I can do about the battery drain issue the gadget has been showing.

 

Here are some basic guidelines which are quite easy to figure out:

  1. Keep the Auto Beam feature off. That’s the major power eater.
  2. Keep the Backlight display brightness to a minimum (more on this follows).
  3. At times even External Launchers eat battery (I learnt this on some posts) – so I’m going to try disabling ZLauncher for some time on my Tungsten and see what happens.
  4. This one was hard to believe and I read it in an unofficial blog, so don’t quote me on this one – the T/E ACTUALLY consumes more batter if you have more applications loaded! Phew! I’m going to uninstall the ones I don’t need and find out if this is true.
  5. SD cards in slots eat battery! I couldn’t Google any information on this but this IS a personal experience. I’ve actually seen the battery consumption increase considerably when the card is plugged into the PDA. So, I’ve been pondering with the idea of removing the card when I’m not using it.

Cool Tools to Hack your PDA and give you more Battery Life:

  1. SilkDimmer – This thing gives you “COMPLETE” control over your backlight brightness. (Notice the word complete in caps. It was intended.) The control this thing offers is more than what the Palm OS gives you. You can practically switch your backlight display off and still run the PDA (wouldn’t recommend that, but you technically could) if you wanted to or set it to ANY value you like – even below the lowest value the Palm OS allows you.
  2. LightSpeed – This allows you to under-clock our PDA processor and is practically the only over-clock / under-clock utility out there. It also solves the problem with the noisey screens some guys have complained about. (I've never faced this problem). No doubt the makers are expecting to make some money out of it and it’s NOT Open source or free like SilkDimmer.
    For now they are giving a Beta free which once in a while, pops up a Message every now and then when I am starting applications. I under-clocked my Acrobat Reader to 48 and it seems to be working fine. Under-clocking a 3rd party chess to a very low speed however, produced BAD results and I had to wait for 5 minutes (literally) before it would render the screen, drawing parts of the screen at a time. The good thing here however, is that you can control clock speed on a per application basis!

So, with all this set I’m hoping the T/E gives a better battery life and I don’t see an unexpected drain anytime soon!

 

If you’ve goggled to this page I can’t tell you for now, if all / some of the above tips work – but I’ll update this post as soon as the T/E stands the test of life this Monday during a “normal” business day.

 

Upate: Looks like some (or most) of the above tips worked. My Battery “seems” to be giving a MUCH longer hold.

DRM! Moving you DRM Protected eBooks to Mobile Devices

Add Comment | Jul 29, 2006

If you’ve tried moving an eBook you bought on Amazon that was protected with DRM to your palm device and have been successful skip this post. However, if you’ve tried your hands at if and failed (becuase you were as confused as me) read on.

 

Trying to the use the Acrobat Reader for Palm OS (that works for all of my other PDFs) kept throwing the following error - "This document has not been encrypted using stand security handler and therefore could not be opened"

 

A Few minutes on Google brought me to This Thread.

 

Just for the Sake of Redundancy, I Quote –

 

“To send your DRM protected e-Books on your Palm device you need to use your desktop Adobe Reader (version 7.0 or later). For which you need to:

 

Activate your Palm device from your desktop reader's File --> Digital Editions --> Authorize devices. Go to File -->Digital Editions --> My Digital Editions

Click on the book you need to send to your Palm device (add it if it doesn't show there by the "Add File" button), and click 'Send to Mobile Device'.

Then your eBook is prepared and sent to your List of files to be transferred in Hotsync manager.”

 

I just wished Amazon / ADOBE had provided clear instructions for this. When a person buys an eBook in all probabilities he wants to read it on his PDA! It is frustrating go to Google and waste an hour after spending money on the book and then not being able to carry it around!

Internet Explorer Beta 3 For Windows 2003 Server. Finally!

Add Comment | Jul 15, 2006

In an earlier post I described how Internet Explorer 7.0 Beta 2 can be made to work on Windows 2003 Server even though it’s intended to run on Windows XP only. Tricks like that one are not required any more.

Microsoft finally has a Internet Explorer 7.0 Beta 3 Version for Windows 2003 Server SP1 users. Don’t walk, Run! Download it from http://www.microsoft.com/windows/ie/downloads/default.mspx

If you’re using the 64 Bit Itanium the same URL offers you a download too.

 

Static Variables In ASP.NET - "I Didn't know this" Moment Number 42

Add Comment | Jul 05, 2006

Yet another "I didn't know this" moment - Turns out, static variables in a class in ASP.NET are pretty similar to application objects but I am going to keep my long-winded posts really short this time.

Long story short: "A key reason that the Application object exists in ASP.NET is for compatibility with classic ASP code—to allow easier migration of existing applications to ASP.NET. If you are creating an ASP.NET application from scratch, you will want to consider storing data in static members of the application class rather than in the Application object" (MSDN)

As always there are Pro's and Con's of using both Application Object and Static Variables.

http://msdn.microsoft.com/library/default.asp?url=/archive/en-us/dnaraskdr/html/askgui09172002.asp , http://support.microsoft.com/default.aspx?scid=kb;en-us;Q312607

That's the 42nd "I didn't know this moment" ever since I got into the habit of counting :)

How Do I Get the Atlas Control Toolkit to Show Up On My Visual Studio.NET 2005 Toolbox?

4 Comments | Jun 29, 2006

One of the Questions I was asked on my Article on Atlas @ Code Project at http://www.codeproject.com/Ajax/HelloAtlas.asp was How do you make the Atlas Controls Appear on your Visual Studio toolbox once you download them. The official documentation from Microsoft states these steps:

  1. Create a new web site from the "Atlas" web site template by opening the "File" menu, clicking "New", "Web Site...", and picking ""Atlas" Web Site" under "My Templates"
  2. Right-click on the Toolbox and select "Add Tab", and add a tab called "Atlas Control Toolkit"
  3. Inside that tab, right-click on the Toolbox and select "Choose Items..."
  4. When the "Choose Toolbox Items" dialog appears, click the "Browse..." button. Navigate to the folder where you installed the "Atlas" Control Toolkit package. You will find a folder called "SampleWebSite", and under that another folder called "bin". Inside that folder, select "AtlasControlToolkit.dll" and click OK. Click OK again to close the Choose Items Dialog. (This is the step that’s confusing most of the time. See Note Below)
  5. You can now use the included sample controls in your websites.

Yes, so, step number 4 is a little confusing. Not because of what it says but the way the Atlas control installer works. Actually, the installer explodes everything under your Temporary Folder i.e. if you’re the Administrator it explodes everything to C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp!! So, basically you need to either specify a different path where you want to expand this or copy this “SampleWebSite” folder step 4 talks about from your temp folder to any folder you want. Once you’ve done that follow step 4, point to DLL in the Bin folder inside this folder and you should be all set!

Internet Explorer 7.0 Beta on Windows 2003 Server!

Add Comment | Jun 26, 2006

As much as I would like to take the credit for this post, it was actually the author of this post that figured it out!&nbs