Archive for December, 2008

Looking Back at 2008!

2008-12-31

I am not happy about my last year because I did not make much significant achievements on my carrier in the year! At the beginning of the year I had a goal to obtain MCTS certification but I could not achieve that.

However there were some small achievements as well:

What I feel as the best achievement of the last year is this blog itself. I made this on November and I am very happy about this because it feels so great to see someone out there is reading my posts.

A software solution provider company chose me as a technical consultant to solve their problems and I am so happy that I could solve many problems that many of their staff could not solve. I consider this as one of my major achievements of the last year.

I have survived in my work place and after taking the recent lay-offs into my consideration, I would take this as an achievement!

I could take my family on a trip and they were so happy about it and we all enjoyed it. It was the best personal achievement for me!

Also me and my girl friend could go several short picnics to beautiful places like beaches. Those were romantic achievements to me because those moments brought us even closer to each other!

I don’t remember everything I achieved or missed through out the last year at this moment so I will publish this post at this point and will update as I remember…!

Cassian Menol Razeek


ASP.NET – AutoPostBack : What is AutoPostBack and How AutoPostBack Works

2008-12-26

Today I was experimenting on a grid view where I was trying to select multiple rows of the grid view using a check box column.

I wrote some code in the CheckedChanged of checkbox but then I found that the code was not executed when the state of the checkbox is changed.

So I did a little googling and found out about this AutoPostBack property. This property defines whether the control should post back to the server each time when the user interacts with the control. Or, according to this scenario, a post back will fire when the user clicks on the check box or when the Checked property is changed.

AutoPostBack :

This value holds a boolean value (true/false)

If the property is set to true, a post back is sent immediately to the server and no post back is occurred when set to false.

The Use of AutoPostBack:

According to MSDN, for most WebControls, when AutoPostBack is false, only the events from actions that cause a net change in the state of the control are submitted to the server.

In other words some events are not queued to the server. For example no event is fired when a user selects a value from a drop down list or when user presses Enter or Tab key after entering a value to a textbox.

If you want such events to be fired then you have to enable autopostback by setting autopostback property to true.

How AutoPostBack Works :

When AutoPostBack is enabled, the .Net framework automatically injects following additional items into the generated HTML code.

  1. Two Hidden variables with name __EVENTTARGET and __EVENTARGUMENT
  2. A Java script method with name __doPostBack (eventtarget, eventargument)
  3. OnChange JavaScript event to the control

What is __EVENTTARGET :

__EVENTTARGET tells the server which control wants to fire the event so that the framework can fire the event on that control.

What is __EVENTARGUMENT :

__EVENTARGUMENT can be used to provide additional information to the server about the event.

What is __doPostBack (eventtarget, eventargument) :

Parameters sent to this method holds relevant target and event argument values and this method sets those values into __EVENTTARGET and __EVENTARGUMENT hidden variables so that the server can read those.

Then this method submits the form to the server where the appropriate event will be fired.

What is OnChange JavaScript event to the control :

Every control has a client side event called OnChange. When AutoPostBack is enabled for a control the framework sets the handler for this client side event as the __doPostBack method and will pass the name of the control as the first parameter, eventtarget.

Ex/

Following shows how the framework binds the __doPostBack method to the OnChange event.

<input type=”checkbox” onclick=“javascript:setTimeout(‘__doPostBack(‘CheckBox1′,”)‘, 0)” />

Was this post helpful to you? How can I improve? – Your comment is highly appreciated!

Cassian Menol Razeek

Recommended Books:


How to Save a Copy of a Visual Studio 2005 Solution

2008-12-22

Sometimes things we consider as simple take much time to be accomplished than we expect just because we forget!

Today I wanted to save a copy of a web based visual studio 2005 solution but it took life 10 minutes for me to accomplish that because I had completely forgotten the method to do it. Since keeping track of what I learn is one objective of this blog I decided to include this small detail today.

How to save a copy a solution in visual studio 2005 (Save As)

Select the solution (click on it) in the solution explorer

Now go to File menu and there will be a command to Save the solution to any place you want.

Ex/

If your solution name is “My Solution.sln”

When you select your solution in the solution explorer and go to the file menu, you will see command like:

Save My Solution.sln As

Simply click on that and you will get the usual Save As dialog box.

Some Details

Even though you can select the place to save project files in web based solutions such as web sites, the solution is saved in a different location which is located in your My Documents folder.

The solution file contains information about your projects and files including paths so if you want to move the entire solution to a different computer to continue work on a different workstation then this tip will become handy unless you don’t forget things as I do :-D

Was this post helpful to you? How can I improve? – Your comment is highly appreciated!

Cassian Menol Razeek

Recommended Books:


Internet Explorer Major Security Flaw!

2008-12-16

Internet Explorer, one of the most widely used Microsoft products, Considered as the world’s most popular web browser has received a Red Alert!

The situation was raised when Andreas Sandblad from Sweden reported a vulnerability to Microsoft.

The vulnerability:

Point of Origin: The Cross-Domain Security Model

Fix: Not Available Yet, Microsoft is still investigating on this

Description:

This Cross-Domain Security model is supposed to keep windows of different domains from sharing information.

An Incomplete Security Checking has caused Internet explorer to allow one web site to potentially access information from another domain loaded into a different Internet Explorer window when using certain dialog boxes.

The vulnerability would allow a malicious web site to load malicious code into the client’s system. Not only that, through this security hole, an attacker can either execute any executable available in the victim’s system or perform any action that is entitled or available for the privileges of the victim.

For an example, if the victim is an administrator on the system the attacker can perform critical actions as the attacker now has administrator privileges on the system.

The Spread:

According to Trend Micro, due to this vulnerability, more than 10,000 web sites have already been compromised to take advantage of the flaw!

Many web sites which are mostly Chinese have been used to steel computer games passwords which have good prices in black market.

Affected Version(s) of IE:

According to Microsoft, so far attacks have been found only for version 7 but they warned that other versions were “Potentially Unsafe”

How to Protect Yourself:

The advice given by computer security experts at the moment is to switch to a different web browser till this major security flaw is fixed.

Was this post helpful to you? How can I improve? – Your comment is highly appreciated!

Cassian Menol Razeek


5 Ways to Get Rid of Financial Stress and Optimal Utilization of Money

2008-12-14


With the rise of Global Financial Crisis, Financial stress has become a hot topic in the Internet. Since I am also a victim, I thought to make a small research on this. In this post I am trying my best to explain what I gained during my research. I hope you would find this interesting!

We go to school, high school, university, technical colleges, … etc. then we find a job, then focus on collecting additional qualifications to climb the ladder… etc.

Why do we do these things? Yes to have a happy life, to make the life better.

If we keep the other factors like qualifications apart for a while, we earn money to make sure we have a happy life but in the middle of the way we become exhausted and stressed out just because of money which is meant to make our life better.

100 people would give 100 explanations for this as different people could see this from different angles. Some may say it’s a foolishness to make the life stressed out for money while some other would say that it is worth taking that stress because there’s almost nothing that can achieved without a sound financial standing.

In this article, I am not trying to elaborate on these complicated and human dependent explanations but rather I would introduce the five ways that I found as helpful to reduce financial stress and I will try to inject my experience into each method when ever I feel applicable.

1 Separate Needs from Wants

It would be safe if I say that we are living in a world where marketing plays a major role. For any industry, marketing has become a crucial factor.

Today’s marketing professionals are very tricky and would sell a ‘trip around the world’ ticket at a gas station for a guy who simply stops for a quick refill.

As a result of this tricky marketing environment most of us have become unable to separate our needs from our wants. For an instance someday in last month I went to a super market to buy cartridges for my Gillette 7 ‘O clock razor which I have been using for more than a year but I came out with a Gillette Mach3 razor because there was a perfectly organized marketing campaign inside the supermarket which could make me literally forget what I had planned to buy. I knew I was going for something which was not crucial for me or something I want, in other words but I could not help myself out of the situation.

So how could we overcome such situations without doing exactly what marketing guys expect from us? Well, different people use different strategies. Some people don’t keep credit cards, some people don’t keep extra money, etc. Even though these methods look very effective (and may be they are effective) these methods have their cons as well. Like we can never replace the benefits we get from credit or debit cards from money.

Well, I know this sounds like impractical but I still believe in controlling the thought itself. Even though I have not met perfection, I have practiced this for some time and it works to some extent. What I do when I meet something that I want is make a small argument in my heart where I think what would I lose if I spend for this at this moment. So, most of the time, I have seen that my short term financial goals get affected by purchasing such things. At that time it becomes much more comfortable to leave the place without buying it.

As I leave the place without buying…, I think like, “What’s the big rush, I can allocate some money for this in next month’s budget and buy this…” so I don’t become disappointed at that moment.

2 Change the Attitude Towards Money

This is something I newly learned from my research. I was used to be very upset when I don’t have as much as money I thought that suit my qualification and experience levels. This truly leads us to a huge stress because we always feel disappointed and spend most of the time thinking what we cannot achieve with current financial standing. So how can we possibly get rid of these feelings? Well, I could find many suggestions such as meditating and yoga I am not against these methods buy I believe more on the other thing I learned which is positive thinking. We usually think about what we cannot do but we rarely think about what we cannot do.

I was used to be sad when I see when other people are traveling by their cars while I ride my bike. But I never noticed the significantly larger number of people who walk while I ride…!

3 Ask for Help

This is something most of us don’t like to do! In many societies asking for financial help is considered as an act of weakness but we can always ask for help or instructions to improve our financial management skills. If we get the right help at the right time to improve this skill, we will be able to survive in many financial problems without asking for direct financial help.

4 Don’t Keep Debt

What am I talking? Nobody likes to keep debt….!

Yes, it’s true, but the reality is we do keep debt around us. The most common trap for most of us is credit cards. Most of us think these paper-like pieces of plastic have amazing powers to bring things that are impossible to achieve with the power of our monthly wages.

The very simple yet strong truth is “Nothing Is Free”. Credit cards only bring the good to our hands and put the payment to the future. Of course this becomes a great help in certain situations.

I do not blame credit cards or credit card owners. A credit card is a powerful tool like fire, if we use it wisely we can make our day to day life much better and of course if we lose the grip we are doomed!

The most common mistake people do with credit cards is paying the minimum due payment and let the interest add up. I have this great lesson learned from my first credit card. I used that credit card so freely and paid the whole amount regularly in the beginning but eventually I started to pay only the minimum payment due. The interest kept growing and I did not care for about a year and I only realize how much I have paid when I made the sum after my father instructed me. I had paid several times of my initial amount of debt as interest.

After that incident my father gave me a nice advice. He said:

“Id doesn’t matter how you pay or when you pay, you do have to pay your debts someday. The only difference is you have to pay with an extra interest if you pay late, so why not pay it at the first possible time and save the interest?”

5 Make a Budget and Stick to It

Most of us already are good in making a budget. It’s the later part that makes us sweat! How to stick to the budget?

Well, in this case we have no excuses against paper work! We have to have a clear idea on our fixed expenditures such as phone bills, water bills, etc. We cannot skip paying these bills so we must allocate funds to these expenditures as the very first step.

Then make the list of other expenditures you wish to make in this month such as that handy new razor, expensive perfume, New Five star dines, Oh what am I doing? You don’t need examples on this. Do you?

The listing is always fun but then comes the worst part; you have to prioritize these expenditures and cut the less important ones. I know it’s hard! Keep in mind that this is your own good when allocating money…!

Wait…! Before you allocate money for the second type of expenditure we just discussed, allocate a certain amount of money as the saving for the period and consider it as an important expenditure you cannot cut so that you will not consider your saving as an option in the middle when executing your planned budget.

Basically, this is the whole idea behind a happy life with a less (I wouldn’t say “no”) financial stress.

Before we end this discussion, I’d like to remind you that we do need money to live this life and we do have to earn it! The most important thing is we have to make sure that in the middle of the way while trying to make money, we should not forget the fact that we have to use money to bring HAPPINESS into our life.

Money alone can do nothing but money and a wise mind can do anything!

Was this post helpful to you? How can I improve? – Your comment is highly appreciated!

Cassian Menol Razeek


Computer Hardware – Memory : Static RAM Vs Dynamic RAM

2008-12-10

Random Access Memory plays a crucial role inside a computer. RAM is where the processor keeps the data it needs to work. The computer always has to load necessary data into the RAM because the speed of hard disks is very low for processor to work with.

Actually even the RAM is not fast enough for the processor so computers use many types of memories in different places such as cache or registers for different purposes. The purpose of this article is not to elaborate on how RAM works so without wasting time I will go into our topic.

Basically, there are two types of RAM which are Static RAM and Dynamic RAM. In this article we will compare these two types of RAM focusing on following aspects:

  • How these two types are designed
  • How these operate
  • Issues with each type
  • What is the most fast and what is most cost effective
  • Where these memories are used in our computers

Dynamic RAM

This is the most common type of RAM in use today. In a dynamic RAM chip, a bit is stored in a single memory cell. Each memory cell includes a transistor and a capacitor. Thanks to the revolution of technology these transistors and capacitors have become extremely small so that a single chip can hold millions of memory cells.

How these cells operate

In a memory cell, the capacitor holds electrons to store a binary 1. To store a binary 0, the capacitor is emptied. The transistor serves as a switch to allow the memory controller of the chip to read or change the state of a capacitor. In other words, the memory controller which is a circuit operates through the transistor to either empty the capacitor to store a binary 0 or to fill the capacitor with electrons to store a binary 1.

Problem with dynamic RAM

The problem with capacitors is capacitors have leakages so those can’t keep electrons for a long time without getting discharged. So in a dynamic RAM either the CPU or the memory controller has to recharge all capacitors which stores binary 1 before those get discharged (it’s not necessary to recharge capacitors which represents binary 0 because those capacitors are needed to be empty). This automatic refresh has to take place thousands of times per second. This refresh process takes time and therefore slows down all memory operations carried out on dynamic RAMs.

Static RAM

Static RAM stores a bit in a completely different mechanism called flip-flop which does not need a recharge. A flip-flop is an advanced yet interesting topic so keeping that for a future discussion I will publish only the definition of what is a flip-flop which I believe is enough to understand the scope of this article. A flip-flop is an electronic circuit that has two stable states and thereby is capable of serving as one-bit memory. Static RAM is made of an array or a collection of flip-flops.

Since flip-flops do not use capacitors, static RAM does not need to be recharged. So this property makes static RAM faster than dynamic RAM.

Ok now what’s wrong with Static RAM?

To implement a flip-flop it takes 4 or 6 transistors so Static RAM takes more space compared to dynamic RAM leading to a less memory per chip ratio and static RAM takes more electronic components than dynamic RAM to store a bit which then makes static RAM much more expensive than dynamic RAM.

Finally, where in my computer can I find these memories?

Since Static RAM is fast and expensive whereas Dynamic RAM is cheaper and slower, the speed sensitive cache area in the CPU is made of Static RAM while the large RAM area is made of comparatively cheaper Dynamic RAM.

Was this post helpful to you? How can I improve? – Your comment is highly appreciated!

Cassian Menol Razeek


What is a Trojan Horse and How does it Attack Computers?

2008-12-08

A Little History

Trojan War is considered as the most significant conflicts in Greek mythology.

This is where Trojan horse comes into play for the first time. The great warrior Odysseus brought this strategy to find a way into the city of Troy. He commanded his army to make a massive wooden horse large enough to host several Greek soldiers in it.

Then all Greek soldiers fled from Troy except for great warrior Odysseus and several other warriors who hid inside the wooden structure.

There was another man called Sinon was sitting duck to the enemy. His duty was to make sure that the Trojans take the bate by convincing them that his fellow Greeks had betrayed him and fled from the city. He convinced the Trojans that the wooden horse left by Greeks is safe and would bring them luck.

Even though Trojans had already defeated the Greeks they still wanted more luck and decided to wheel the horse through their gates unknowingly granting the Greek enemy access to the city of Troy where all of Trojans were partying after proclaiming victory.

Without noticing the handful of great enemy hiding inside the giant horse standing in the middle of them, the citizens of Troy went to sleep after the huge parties took all over the city.

It was the hour of Odysseus and his men who were patiently waiting for the moment. They sneaked out of the horse, to which the Trojans were praying a while ago, and wreaked havoc on the city.

Back To Computer

I gave that brief idea about the history of the Trojan Horse to give you the impression of the computer Trojan Horses.

Computer Trojans are exactly as same as the first Trojan Horse. A Trojan is a small program embedded into a harmless program such as a game, animation, etc.

Trojans do not spread themselves as computer viruses. It needs the computer user to initiate it. In other words, when you try that new game you got free from a web site, the Trojan inside that gets installed into your computer without your understanding.

The worst thing is since the Trojan is executed by the computer user, Trojan gets the same set of privileges as the user does. So if you are an Administrator and you play a game with a Trojan, you grant all rights that you have to the Trojan, Just like what happened in Troy!

Most Trojans connects to its creator from the infected computer. These computer geniuses who use their skills to cause damages to the public are called Crackers. If anyone carelessly opens an untrusted program and launches a Trojan, His or her computer can be controlled by the cracker for his malicious work. These computers are called Zombie Computers because the real owner of the computer doesn’t even know that his computer is been controlled by a different party.

Crackers use networks of zombie computers to send more viruses or to get anything done. These networks are called Botnets.

How to protect yourself form Trojans?

There are very basic and simple precautions to follow:

  • Never open any attachment/file sent by unknown senders
  • Never open any file you receive without scanning for threats (even if it’s from a very close friend. Because he may already be a victim and can be sending Trojans with his mails without knowing)

You must have seen and heard these precautions more than you have heard or seen about threats but we never tend to follow these and that’s what crackers always want.

An Example; Trojan Horse I Made Some Time Ago…

Well, don’t take me wrong, I also have made a Trojan once but it was not to damage anyone…

When I was in my first job where I met my girl friend, before going and ask her, I wanted to run a check on her computer to see if I could find any evidence of a boy friend :-)

At that time I already had made a TCP/IP chat software. So what I did was I made a nice animation of Winnie the Pooh and embedded a Trojan which could read the password file in her computer it was easy because she launched my Trojan with her admin rights. So while she was enjoying the Winnie the Pooh animation which I downloaded from the Internet to decoy her, my Trojan read her password file and sent all entries to my computer through TCP/IP which I could capture using my Chat Server.

Then it was only a matter of a brute force attack to get her password. I still remember her password :-D

I told her about it very soon and she was amazed to hear her password from my voice! And of course it was a plus point for me too :-D

So the conclusion I want to make here is that a Trojan is a very powerful concept which can be used by your enemies to use your own powers and privileges to take control and harm your computer and many others. So always be careful when dealing with email attachments and executable files.

Being extra cautious is always good and can protect you from many threats…!

Was this post helpful to you? How can I improve? – Your comment is highly appreciated!

Cassian Menol Razeek


How to (Full and Transaction Log) backup and restore a database in Microsoft SQL Server 2005

2008-12-04

In this article I will discus how to backup a database as a FULL backup or with Transaction Log (Tail Log) backup and how to restore the database, how to recover transactions made after you taking the backup, etc.

Since it is not easy to use and organize images in the post itself I have uploaded a compiled pdf file of this article.

Please download the complete manual from following link:

How to backup and restore a database in Microsoft SQL Server 2005

Was this post helpful to you? How can I improve? – Your comment is highly appreciated!

Cassian Menol Razeek


C# ASP.NET – GridView : How to Keep Modified Data of Template Fields when Paging is Enabled?

2008-12-04

Today I had to take care of a problem of a certain company (CIS) that I consult. They had a problem of keeping the values modified in a template field of a gridview when the user moves from one page of the grid to another.

Template fields allow us to add custom columns into a datagrid or gridview. For an instance, we can add a grid column which has a textbox in each cell.

When the gridview has several pages, the gridview holds only the rows that are displayed in its Rows (collection) property. So we cannot access the values in other pages using the gridview.Rows property.

Then I thought that I could access the whole collection of rows by referring to the DataSource property of the gridview. This is a good idea because even though the gridview only shows the rows on the current page for display purposes, the data source property of the gridview holds the whole collection of rows in it.

ASP.Net clears the data source of any control at post backs. This is done to optimize performance of communications. In addition, the state of each control is stored in ViewState so it is not necessary to keep the datasource between postbacks.

The problem is worse now because I could not use both datasource and the direct row collection from the gridview.

Of course we can use either cache or session to keep the datasouce.


Session["DataSource"] = dt;  // store our table in the session

Then to synchronize (update) the datasource which was stored in the session we have to:

  • Go to each row in the gridview
  • Get the matching data row from the data table
  • Update the fields of the data table row

Since we have enabled paging for the gridview, we have to do this when ever user changes the page he/she is viewing to preserve his/her modifications.

So we need to write our code in the PageIndexChanging event handler of the GridView.

In my example I have two columns of the grid view called “ID” and “Name” and the name is the only template column I have used so I am only updating that column in the stored data table.

Code:


protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
// get the datatable from the
DataTable dTable = (DataTable)Session["dataSource"];

// now we will iterate through all rows of the grid
// then get the matching row from the data table (datasource of our grid)
// and append the updated data (by the user) to the selected data row
foreach (GridViewRow grv in this.GridView1.Rows)
{
// get the matching row from the data table
DataRow dRow = dTable.Rows.Find(this.GridView1.DataKeys[grv.RowIndex].Value);

// set values of updated columns : here I have only let the user to edit "Name" column
dRow["Name"] = ((TextBox)grv.FindControl("txtName")).Text;
}

// go to the next page of the grid
this.GridView1.PageIndex = e.NewPageIndex;
this.GridView1.DataSource = (DataTable)Session["DataSource"];
this.GridView1.DataBind();

// show the whole collection of data in the second grid (used only to display)
this.GridView2.DataSource = (DataTable)Session["DataSource"];
this.GridView2.DataBind();
}

I have used a different gridview called GridView2 to show the whole data source without paging.

So don’t misunderstand the use of GridView2 in the last section of the code. It’s used only do display the whole set of data (without paging).

I cannot upload my code into this blog because it seems like zip files are not supported. If you like to take a glance of my code just add a comment so I’ll send the code to you via email.

Was this post helpful to you? How can I improve? – Your comment is highly appreciated!

Cassian Menol Razeek


Failures are the Pillars of Success!

2008-12-01

Today I went to the embassy to get the response for the visa application I submitted about a month back.

I had kept a lot of hopes on this. Today was like a junction in my life. If I get the permission to work, I would get a much better financial standing, more qualifications, more experience, etc.

So I went and waited on the queue waiting for the officer to read my name.

Mean while I remembered what my mother told me before I had to switch off my phone in-order to enter this office. She told me that what ever the result could be, don’t worry because God always have a plan for you and it will always show you the best possible path even it might look not great at this moment.

So while I was in the queue, I prayed God and asked him to make me strong to hold on to what ever the result that I would get in a while.

At the end I got my response and when I opened to cover I saw the letter headed “Notice of Refusal”. Yes I felt all my dreams crashing but only for a while. Don’t think I am trying to make myself a God’s child but within minutes I could recover because I had much worst experience where initially I though I failed but later I realized it was the best path for me.

I thanked God for making me comfortable with the result I received and then I went to meet my lawyer who prepared my application. After going thorough the letter I received, my lawyer start laughing, the person who examined my application had made a lot of mistakes. Lawyer promised me that he could argue on these matters and get my application approved.

After that talk he said that he would like to talk on a different topic with me and told me about starting his dream company. The company needs reliable software to make its decisions in other words the company would operate on the software. He had tried many Indians before and even one of his friends but he has never been able to make his dream come true. So he asked me whether I could make the software for him. According to my experience I felt like it would not be a huge challenge so I agreed to do it.

I don’t say that making software would replace all my dreams I had on having a work permit in rich country but I could win his heart and make him more prone to get my work done while I am working on to make his dream come true.

So what I want to emphasize here is that we have to be positive at every times regardless of the outcome. When I got that letter, I could simply get upset and go home or I could lose my enthusiasm on everything and make me the saddest guy on earth.

I learnt from it…

If my application was accepted at the first glance, I would never know how it feels when this type of hope is dissolved and very specially how to overcome this type of a situation which is a very valuable experience.

And I am very happy for getting this experience at this age itself. Because I had my parents to back me up rather than having this type of experience when I am a parent which I assume a much harder to face.

As I said in an earlier post…,

It’s all about the way we see things…

Cassian Menol Razeek


  • Visitors Since Oct, 2008
  • Protected By Copyscape Duplicate Content Checker
    Do Not Copy Without Referencing To This Site
  • Copyright © 1996-2010 I Learnt Today.... All rights reserved.
    iDream theme by Templates Next | Powered by WordPress