Tuesday, September 27, 2005

Saturday, August 20, 2005

Customizing From address in Gmail

Gmail has added a new feature - the ability to change the From address. The details are available here.

You cannot change the From address to any address. Gmail verifies that the new From address is yours by sending a verification mail to the new From address.

Account settings page

Composing mails

Friday, August 19, 2005

Moved to Ubuntu 64bit

Finally, I removed the Ubuntu x86 Edition from my AMD 64 machine and installed the AMD64 edition. I bought the AMD machine thinking that I'll install the 64bit OS. But, somehow I stuck with the x86 version of Ubuntu, because there are a few applications that will not run on 64 bit linux.

I was satisfied with the x86 version except for two issues:

1. Display problems

Cris-cross lines appear suddenly while using the system. The main culprits are openoffice and gThumb. Sometimes the text on menus disappear. You have to move the cursor over the menu to display the text again.

2. System freezes after logon

This problem started after a upgrade. within 5 minutes after logon, the system will freeze. The mouse moves, but the windows doesn't respond. After 5 or 6 hard reboots, the system will work normally.

Well..I first thought I'll try Xandros. I installed it . The system froze when I tried to update it. Goodbye Xandros!

Then I put in the new Ubuntu AMD64 cd that arrived a few days back. (My previous Ubuntu installation was also hoary/5.04) . The installation was smooth. It took less than half an hour.

And the best part, I'm not facing the above mentioned problems. I think I'll stick with this installation for now.

Now, the only problem is the Macromedia flash and the Win32codecs. If I can get them to work on AMD64, that'll be great.

Thursday, August 18, 2005

To call or not to call dispose on DataSet

From http://weblogs.asp.net/jarnold/archive/2004/08/10/211969.aspx


Dispose() releases an object's memory.


Well, it's called 'Dispose' isn't it?


Dispose() is merely a convenient place for a class' developer to place any resource clean-up code, in the hope that clients will call it. Dispose does not free the managed memory allocated for an object. The only thing that can do that is the garbage collector; there is no way to deterministically (or manually) release memory.

Now, why should we call dispose() for datasets and datatables and other disposable objects ?

Let’s see an example:

Dim dsSomeData as Dataset

dsSomeData = objSomeObject.GetSomeData()


dgDataGrid.DataSource = dsSomeData


If the Dispose() actually releases memory and marks it for disposing in the next garbage collection, this should throw an exception. But, guess what? The above code runs fine.

So, what does dispose() for dataset and datatable actually do? Nothing! You can call the dispose() method for the dataset, and the dataset still contains the dataset. No release of memory.

The Dispose method in DataSet exists ONLY because of side effect of inheritance-- in other words, it doesn't actually do anything useful in the finalization. The class DataSet inherits from "System.ComponentModel.MarshalByValueCompenent" which implements the IDisposable interface because it is a component. That being the case, it is only used to be treated as a component that you can put on a form. The method is not overridden in the System.Data.Dataset class and as such, it all depends what MarshalByValueCompenent does. Calling Dispose is just going to remove the DataSet from any component site that it's been added to.

This is the disassembled code of MarshalByValueComponent

Public Sub Dispose()
End Sub

And the internal Me.Dispose(True) does this:

Protected Overridable Sub Dispose(ByVal disposing As Boolean)
If disposing Then
SyncLock Me
If ((Not Me.site Is Nothing) AndAlso (Not Me.site.Container Is Nothing)) Then
End If
If (Not Me.events Is Nothing) Then
Dim handler1 As EventHandler = CType(Me.events.Item(MarshalByValueComponent.EventDisposed), EventHandler)
If (handler1 Is Nothing) Then
End If
handler1.Invoke(Me, EventArgs.Empty)
End If
End SyncLock
End If
End Sub

Since the DataSet do not have a container, the above code practically doesn’t do anything other than telling GC not to call Finalize method. If I understand this correctly, we’ll never have to call dispose method on DataSets and DataTables.

Wednesday, August 17, 2005

UTStarCom UT300R2 modem configuration for Dataone

BSNL is now supplying UT300R2 modem for their Dataone broadband connection.

It's very easy to setup the UT300R2 modem for a broadband connection. Here's how I did it in my Ubuntu box.

Step 1. Login to the modem administration interface

Start your browser and enter the address as (Before this set the address of your ethernet card to . Enter the user name as admin and password as utstar (the default password).

Step 2. Create a new connection

Select the Setup tab of the interface. Remove all the existing connections by selecting the connection in the left pane and click the delete button.

Click on the New connection link in the left pane. Select the Type as PPPOE. Give a name for the connection, say, DataOne. Enter your username and password. Enter 35 in the VCI field. Click on the Apply button.

Step 3. Save the changes

Applying the changes doesn't save it to the modem. Select the Tools tab and click on System commands. The following screen will be displayed. Click on Save All.

Switch off and then switch on the modem. Congrats! your machine is now connected to the internet. To disconnect, just switch off the modem. To connect, just switch on the modem.

Object=Nothing ?

Is it really required to set objects to nothing ? What does it do that the GC doesn’t automatically do ? It’s OK to release unmanaged resources like database connections. But for the managed resources, is it required to explicitly release the resource. I was under the impression that the .Net GC is smart enough to dispose the memory, especially if it’s a local variable, once the function exits.

Setting an object to nothing right after it finishes it’s work is OK.

Fo example :

Public Sub DoSomething()
Dim obj As New SomeObject()
obj = Nothing
' do other stuff
' do some other stuff
End Sub

But setting them to Nothing at the end of the method defeats the optimization built into the .Net runtime and may cause the program to consume more resources than it needs to.

Public Sub DoSomething()
Dim obj As New SomeObject()
' do other stuff
' do some other stuff
obj = Nothing
End Sub

Any thoughts ?