Monday, September 21, 2009

Event full weekend



Saturday, yesterday , started the day by going to the service station at 6:30AM in the morning.As usual I was the first to the service station and I was walking up and down in the premises till they started.Then came the owner of the station and he opened the doors to the pump house and generator house.
After about 45 minutes , the service man started the work with my car.It took 3 hrs to finish the job.
Then I took the car to the Tissa Electricals to check my radiator fan.The problem I had was , it was boiled when I come to the office on last Monday and I thought this may be due to the fact that my AC condenser fan was not working, the clue was I saw my heat indicator going up and when i turned off the AC it came back to the normal.So that was the history.
I told that story to the technician who run the place and I told I need to lay a harness to my power doors.After the removal of manual doors last year I replaced them with power doors, which has the options of power shutters , power mirrors , central locking , but never had a chance to complete the laying of the harness.

Then owner asked one of his technicians to take a look at this and Sampth is the name of this guy.Very talkative guy.After spending few minutes with him , I realized that he is not only talkative but also competent which is the most important thing.
Then he started to explore the vehicle.
First what he did was took the Carman Scan II diagnostic tool (a hand held device) which can be connected to the ECU via the interface provided (OBD-II),see the image at left.
Using that device he turn on/off the radiator fan,that concludes the signal is correctly passed into the fan, from the control unit.Then he concludes that by judging the speed of the fan, it has to be replaced and further checking the AC condenser fan it also has to be replaced.
Found a original AC condenser fan and get the fan unit and put it into the existing bracket.And found a radiator fan and replace it.Since Tissa electricals had recondition items , it wasn’t a difficult job for me to get the required fans.That saved me a lot of time.
The story was not ended there.While inspecting the fan, learn that the two power transmission belts also need to be replaced.One belt was already started to break from the edge.He said better to replace both at the same time.If I drive another hundreds of Km’s with those two, I could well be sit on the edge of the road with hazards on.
He recommended two brands to me which I haven’t heard.Because I am new to this belts.One was “Brando” and the other one was “Mitsuboshi”.
Then they started to remove the belts from the engine and by no means that was an easy job.
While it was going on Sampath started to remove all the door covers(apostings) and and estimated the length of wires required for the wire harness.
Estimation was 30m from number 14 and 10m from number 9.The number indicates the number of threads in the wire.That is 14 threads and 9 threads respectively.Plus power mirror switch and 3 gum tapes.
I had to go to “Pathma Motors” at kadawatha to bring those belts plus others.It took 1.5hrs by bus.

Once they got the stuffs started working on the harness and the belts.The time was 6:00PM , and stumps of the day.
Sunday morning at 8:30AM commenced the laying the harness.

To be continued…

Tuesday, September 15, 2009

Internal names should be used in SPQuery

Today I found out an interesting issue when I accidentally changed a field name used in a query used in SPQuery.

I wanted to change the display names of my fields and after doing that I renamed all the usages of that field name in my web part code.

After deploying the solution I got the error message "One or more field types are not installed properly. Go to the list settings page to delete these fields"

I had no clue what so ever when you read that error message.This is not the only error message that share point generates which we cannot figure out by looking at this.

I spent considerable amount of time debugging the solution until I decided to Google the error message.

Then found that in one of the msdn forums that the internal names of the fields should be used in the CAML queries.

reference : http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/a2c6bed0-eee1-4f9b-b468-fc57c2e45c16

And that was indeed the trick.

Monday, September 14, 2009

US Open 2009 Men’s single final


Who would have thought, the world number 6 seed Juan Martin Del Porto , Argentinean, will storm into final , by beating Rafael Nadal in straight sets to face non other than world number one Roger Federer who never loss at US Open since 2004.Without a doubt Federer will do everything to make it 6 in a row at Flushing Meadows.

Even though Federer has a 6:0 winning ratio against Del Porto , he will be a tough opponent in this final.I cannot wait to see this match which is schedule at not before 16:00Hrs which is early tomorrow morning in my time.That’s a worrying sign for me.

more info at www.usopen.org

Wednesday, September 02, 2009

How to create active directory users programmatically

Recently one of my colleagues wanted a piece of code which can be created 500 users in Active Directory for some testing purposes.Knowing that this won’t be a big challenge I said I will give it a try.

Frankly speaking, initially I thought this will be a easy walk in the park.Creating the user in AD part was a piece of cake but the created user was not enabled by default.

I had to figure out how to enable a user account programmatically.That was the only tricky part.

Check the user enabling code segment in the code.(Setting the "userAccountControl" property of the user)

Here is the code

string ldapPath = "LDAP://" + server + "/cn=Users,dc=ec,dc=test";

DirectoryEntry entry = new DirectoryEntry(ldapPath, user, pwd);

for (int i = 0; i < userCount; i++)
{
string tempName = userPrifix + i;
DirectoryEntry newUser = entry.Children.Add("CN=" + tempName, "user");
newUser.Properties["givenName"].Add(tempName);
newUser.Properties["userPrincipalName"].Add(tempName + "@ec.test");
newUser.Properties["sAMAccountName"].Add(tempName);
newUser.Password = userPwd;

newUser.CommitChanges();

// Enabling the above created account
int flags = (int)newUser.Properties["userAccountControl"].Value;
newUser.Properties["userAccountControl"].Value = flags & ~0x2;

newUser.CommitChanges();

newUser.Close();
entry.Close();
}
References :

http://www.codeproject.com/KB/system/everythingInAD.aspx

http://www.computerperformance.co.uk/Logon/LDAP_attributes_active_directory.htm