Hardcore Software

How hard it can get?

Sharing spreadsheets using Microsoft Excel February 27, 2007

Filed under: Software — Hemant @ 8:11 am

When was the last time you needed to quickly collect some information from you colleagues and you couldn’t find an easy way to do this? When was the last time you opened an Excel Spreadsheet and it said “This workbook is locked for editing by user blah. What would you like to do?”

Problem is many people doesn’t know about a neat feature of Microsoft Excel which allows collaboration and sharing of Excel Spreadsheets. This essentially means, more than one user can edit a spreadsheet at the same time. Interested in how to do this?

In Microsoft Excel 2003, you need to follow “Tools > Share Workbook” menu:

In Microsoft Excel 2007, this option is located in “Review” ribbon:

Firing above option shows a dialog presenting a check-box which says something like “Allow changes by more than one user at the same time..blah blah”. Select this option and save the work book in a network location where all the persons who need to edit this workbook has write access and you are done!

Advertisements
 

Thinking of using constants in Delphi? Consider class properties!

Filed under: .NET,Delphi — Hemant @ 5:39 am
If you have gone through any *real* software project you will understand the need of using constants in code. Your professor would have told you thousand times that don’t use any magic numbers in code and if you need, define a constant and use *that* in code. I wouldn’t go into the flexibility constants brings in (define and change at single place and use million times stuff).

What I want to discuss is an alternative to constant. There are called “class properties”. In C world, these would be called static properties. Yes, you guess right. These are properties which relate to a “class” rather than an “object” (instance of the class). With Delphi.NET, we now have:

  1. Class Fields
  2. Class Methods (Both procedures and functions)
  3. Class Properties

Class fields and class properties and not available in Delphi for Win32 (well, programmers take “never say die” approach).

So class properties allows us to write something like:

var
number: Integer;
begin
number := TPredefinedNumbers.DefaultNumber;
//do something with number
end;

Here, “DefaultNumber” is a class property of TPredefinedNumbers class and we can access DefaultNumber using class name and without actually creating an instance of it. .NET framework makes extensive use of class properties. Refer SystemColors, Brushes etc.

Why class properties qualifies as an (perhaps better) alternative for constants? The reason is, you never know what crazy requirement will be raised by your sales or marketing person which calls for user control on that constant. Perhaps you would think that using the INI file for that constant value would be better so that you can control it. Perhaps day after tomorrow it will qualify to sit in a database field. Who knows?

So class properties provide a great abstraction. When you want to change the location where that constant value resides, all you need to change the get method of class property. And everything works fine..

type
TPredefinedNumbers = class
private
class function GetDefaultNumber: Integer;

published
class property DefaultNumber: Integer read GetDefaultNumber;

end;

implementation

class function TPredefinedNumbers.GetDefaultNumber: Integer;
begin
//You can return a hard coded value
Result := 0;

//or you can get from INI file or database or whatever and return
end;

 

Back from Bihar! February 24, 2007

Filed under: Life — Hemant @ 4:57 pm

So I am finally back from Bihar. Though it wasn’t the first time I was visiting Bihar but things are new every time you visit a place. Some bad food habits made me suffer in later part of tour but that’s fine considering how much we enjoyed.

Take a look at the sample photograph of some exotic location in Bihar. Not exactly like you heard about Bihar in many ghost stories. Right?

 

A little Super-Man act February 17, 2007

Filed under: Uncategorized — Hemant @ 8:04 pm

Pretty good Super-Man act in my home. Thanks to my friend Shripal for photo-timing…:)

Posted by Picasa
 

Cricket tournament preparation

Filed under: Life — Hemant @ 6:19 pm

So we are fighting for Entity Cup. Here is our official team logo:


Tez-Dhaar team is ready to take on any team. Beware opponents!

 

Using the HashTable in Delphi for hybrid collections February 16, 2007

Filed under: .NET,Delphi — Hemant @ 6:53 am

While working on one of my project I came across a problem of maintaining a collection of item who were of different types. As I was using Delphi.NET, I was able to use HashTable class (in System.Collections namespace) for this purpose.

Here is code snippet:

{$AUTOBOX ON}
procedure UsingHashTable;
var
hybridCollection: Hashtable;
stringValue: string;
dateTimeValue: DateTime;
integerValue: Integer;
begin
hybridCollection := Hashtable.Create;

stringValue := ‘A String…’;
dateTimeValue := System.DateTime.Now;
integerValue := 1000;

//stuff different type of values in the collection
hybridCollection.Add (1, stringValue); //Add a string
hybridCollection.Add (2, dateTimeValue); //Add a datetime
hybridCollection.Add (3, integerValue); //Add an integer

//Get the values back
stringValue := hybridCollection[1] as System.&String;
dateTimeValue := hybridCollection[2] as DateTime;
integerValue := hybridCollection[3] as Integer;

console.WriteLine (stringValue);
console.WriteLine (dateTimeValue);
console.WriteLine (integerValue);
end;
{$AUTOBOX OFF}

Above code snippet produces following output:
A String…
16-Feb-07 12:15:05 PM
1000

 

Did you know? February 15, 2007

Filed under: Software — Hemant @ 10:37 am
  • The original name for Windows was Interface Manager.
  • Windows 1.0 first released in 1985. By 1990, over 10 million copies had been sold.
  • In August 1995, Windows 95 was released in a buying fever so great that even people without home computers bought it. Over one million copies were sold in the first four days, and in the first seven weeks, over 7 million copies were sold worldwide.
  • Windows is the most widely used operating system in the world, with an estimated 300 million copies in current use.
  • Windows 3.1 (released in 1992) had three million lines of code, but less than 10 years later, Windows XP (released in 2001) had over 45 million lines of code. Windows Server 2003 has over 50 million lines of code.