Saturday, July 12, 2008

Broadband benefits

Have converted my internet connection to broadband. It absolutely rocks!!

Sunday Musings

Sunday morning, am sitting at the computer thinking about all the progress that has happened in the last few years. Have finally been able to reduce the amount of money being spent and reduce the amount of frivolous expenditure.

When I look back at how my expense and income has been distributed over the last couple of years, a few things become evident:

  • Spending on video games and other entertainment was more expensive then I imagined. Its always better to put that money into other investments.
  • Its more fun to spend money when there is someone to spend it on. Being alone is more expensive then being a couple, there is someone to talk to and you can always share your emotions and thoughts.
  • Its always a good idea to invest in a good music device when you are alone. However its a better idea to invest in a multi-function device. Once you are no longer alone, a standalone mp3 player does not make so much sense anymore.
  • On the other hand a mp3 player is indispensable when on a long flight. The alternative is a good book that engages your mind. Flights are not the same as train journeys, wherein you can always look outside the window. In an airplane, there is nothing to look at outside.



Wednesday, July 02, 2008

Limited Accounts and windows.

Looked for quite a while on the internet.
A limited account is extremely useful to prevent most spyware from hooking on to the computer. Since my last spyware infection, I removed windows, reinstalled it, moved on to NTFS, updated my antivirus, did the windows update via the windows update feature. Took all night but then I use the computer for a lot of work and its useful to have it as up to date as possible.

And of course, moved to a limited windows account. No more admin accounts for me in windows.

Tuesday, July 01, 2008

windows problems

The computer finally had a virus. Was able to "heal" it with AVG.
However decided to reinstall windows anyways so as to completely cure
the system.
Took a day to install after upgrading the file system to ntfs. Also
decided to stop using the admin account for anything other then well
"Administration".
Had to install everything again and also removed ability to execute exes
for the limited accounts from the data drives by using polsec.msc.
Hmm I guess it is almost as secure as linux. The limited accounts and
the new file system should prevent files from getting hit by viruses.
But still I have an updated antivirus and am also updating the windows
updates to prevent issues with the computer.

Saturday, June 28, 2008

Running Windows On a reduced account.

This morning as I was reading my regular news feeds, I realized that the home computer did not have a spyware detecter anymore.
 
I downloaded spybot. And lo and behold, there are 10 spyware on my machine. Got to stop using the admin account going forward.

Sunday, June 22, 2008

Tuesday, June 03, 2008

Switched down cable service.

Switched out premier channels from cable. Instead subscribed to a online video and book library. It will be cheaper then cable.

Thursday, May 29, 2008

Structures in C#

Structures:

 

Points:

1. Its a value type so if we assign a value to another struct then it is stored at two different point in the stack.

2. We cannot have a explicit empty constructor in a structure.

3. Structure cannot have constructors that do not completely initialize all the variables in it.

4. There is a 16 byte size limit to structure's instance. All value types are 16 bytes or shorter.

5. It is logically a single value.

6. It will not be cast to a reference type.

7. If a copy of a structure is passed to another procedure or function then the original will not change after the call. This is because a copy is passed to that procedure or function.

8. Value types are far more efficient then reference types however there is a instance size limit.

Strategy Pattern Part-2.

Tried to create the strategy pattern example as a vehicle that can fly or a drive on the road.
Intreastingly the go method that is implemented in each of the vehicle sub classes is not hard coded into the subclass itself.
That means that a car go method is not very different from a helicopter go method. And here is the kicker: The method is not implemented in the car and vehicle classes.

The go method is instead created in an interface.
So whats the big idea? We could as well create an interface and then implement it there.

ah but the interface is implemented in two classes GoDriving class and GoFlying class.

The abstract Vehicle class has a method that takes in an interface and decides what function to call. And then takes that interface and decides what go method to call.

Its easy to understand because an interface in the Vehicle class is replced by the actual class(goFlying or goDriving is used) that implements that interface in the car class. Then the go method of

And all that is there in the car class is a call to GoDriving class to intantiate a variable.
The helicopter class therefore has only a call to GoFlying. This ensures that the go method can be modified without modifying the Car and Helicopter classes.

The advantage becomes apparent when there is a huge number of classes and they may keep changing over time.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{

public interface goInterface
{
void goMethod();

}

class goDriving : goInterface
{

#region goInterface Members

void goInterface.goMethod()
{
System.Console.WriteLine("Go Driving");
}

#endregion
}

class goFlying : goInterface
{
#region goInterface Members

public void goMethod()
{
System.Console.WriteLine("Go Flying");
}

#endregion
}

public abstract class Vehicle : goInterface
{
public goInterface travelMode;
public void setTravelMode(goInterface x)
{
travelMode = x;
}
public void goMethod()
{
travelMode.goMethod();
}


}

public class Car : Vehicle
{
public Car()
{
goDriving drx = new goDriving();
setTravelMode(drx);
}


}

public class AeroPlane : Vehicle
{


}



class Program
{
static void Main(string[] args)
{
Car x = new Car();
x.goMethod();
System.Console.ReadLine();
}

}
}

Why use design patterns

1. they are a quick and easy way to benefit from the knowledge of others.
2. There is no point in reinventing the wheel.

Have been reading some books to increase my awareness of the subject.
Design Pattern in C# by Steven John
and Design Patterns for dummies.
The dummies book is in java so that is fine.

Strategy Design Pattern

Strategy Design Pattern:
Have been reading Strategy design pattern from various books including Design Patterns in C# and Design Pattern for dummies.

Use when there is a section of code that will change frequently.
1. Instead of modelling is a relationship

like Class Vehicle
then Class car:Vehicle
        Class plane:Vehicle,

        We do class Vehicle:IDriving;
                so car:Vehicle, IDriving
                and plane:Vehicle, IDriving
           which is not so good because if something changes then it has
           to be changed in each class file.


                               so

1. Create a n interface that the subclasses will use
        in this case

 public Interface Igo{
                        public void  go();
                                              
                        }


2  public class goDriving: Igo
  {

   go(){
   System.Console.Writeline("Driving");
   }

  }
3.
  public class goFlying: Igo
  {

   go(){
   System.Console.Writeline("Flying");
   }

  }


4.
  public abstract class Vehicle
  {
     private Igo goMethod;
          
  }


Database Access in ADO.NET

Database Access in ADO.NET

Data providers:  Set of classes that allows us to
access a particular database, execute commands and
retrieve/update data.

Data providers generally have the following classes
1. Connection   : use to connect
2. Command      : used to execute commands or stored procs
3. DataReader   :Object that provides read only,forward
only access
4. DataAdapter  :Object that is used to populate the
dataset(disconnected tables). Or used to apply changes
to  a database.

There are four providers
1. SQL Server Provider  : Access to sql server
2. OLE DB Provider      :Access to data sources which
provide ole db drivers
3. Oracle provider              : Optimized access to Oracle
database.
4. ODBC provider                :access to an odbc data source.


Try Catch Throw

Throw Catch Exceptions
1. Try the block
2. Catch the exception.
3. Cleanup any remaining issues within the finally section.

Filtering Exceptions: We can use multiple catch for a single try section.
Only the first catch will be executed and then it will switch to finally.

The finally section cannot access variables declare in the try section.

If we want to create a variable declaration and make sure that it is cleaned
up even if an error occurs, then use the "using" keyword.

Tuesday, May 13, 2008

Asp.Net

Say wonder what is the need of the reusable property in i http
handler? It enables sharing of the instance with other requests so
what? Whats the advantage in using that?

--
Sent from Gmail for mobile | mobile.google.com

Wednesday, April 30, 2008

Trying to join a group.

--
Sent from Gmail for mobile | mobile.google.com

Storm aftermath

After the storm last night, the power is back up again. Its amazing
how fast things moved.

--
Sent from Gmail for mobile | mobile.google.com

Tuesday, April 29, 2008

Newspapers

Is the print media dead? Has everyone moved to online tools and online news?

--
Sent from Gmail for mobile | mobile.google.com

Travel

Travelled from bang to mad on the weekend. Took 350 for the taxi. It
was not too good. Temperature there was hot. The humidity gets you
when you are in the open. Wonder how the local people deal with the
heat. I guess they stay indoor in the afternoon.

--
Sent from Gmail for mobile | mobile.google.com

Pizza and power

There was a huge storm in the city today. As a result the power is
out. The more immediate reason is a huge part of a tree which fell on
a power line and took half of the cables with it. So no power and
without power there is no water too. Hmm so things dont look so rosy.
Its a nice thing my wife is not here right now. I wonder when will
they restore the power. Have drinking water that will last three days.
Not enough water to bath in though. Plus there are the mosquitoes to
be dealt with. Fun i guess.

--
Sent from Gmail for mobile | mobile.google.com

No power

No power in the house. There was a storm.

--
Sent from Gmail for mobile | mobile.google.com

Biog

Test

--
Sent from Gmail for mobile | mobile.google.com