Information Technology

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


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


Oracle Trunc Function

2008-11-24

Among various helpful functions provided by Oracle, Trunc function took my attention today because I had to fix a defect where some one has misunderstood and misused this function.

As the name itself suggests, the trunc function is capable of truncating a value. This function can be used either on a date type value or a numeric value.

Using trunc for numeric values

When it comes to numbers, trunc function can return a number truncated to a certain number of decimal places.

syntax:

trunc( number, [ decimal_places ] )

Example usage:

trunc(125.815) would return 125
trunc(125.815, 0) would return 125
trunc(125.815, 1) would return 125.8
trunc(125.815, 2) would return 125.81
trunc(125.815, 3) would return 125.815
trunc(-125.815, 2) would return -125.81
trunc(125.815, -1) would return 120
trunc(125.815, -2) would return 100
trunc(125.815, -3) would return 0

Menol

Note: The trunc function does not round the values like in round function. It simply truncates the number as instructed.

Using trunc for date values

The trunc function is capable to truncate a date value to a specific unit of measure.

Syntax:

trunc ( date, [ format ] )

Possible values for format parameter:

Unit Valid format parameters
Year SYYYY, YYYY, YEAR, SYEAR, YYY, YY, Y
ISO Year IYYY, IY, I
Quarter Q
Month MONTH, MON, MM, RM
Week WW
IW IW
W W
Day DDD, DD, J
Start day of the week DAY, DY, D
Hour HH, HH12, HH24
Minute MI

Menol

Example Usage:

trunc(to_date(’22-AUG-03′), ‘YEAR’) would return ’01-JAN-03′
trunc(to_date(’22-AUG-03′), ‘Q’) would return ’01-JUL-03′
trunc(to_date(’22-AUG-03′), ‘MONTH’) would return ’01-AUG-03′
trunc(to_date(’22-AUG-03′), ‘DDD’) would return ’22-AUG-03′
trunc(to_date(’22-AUG-03′), ‘DAY’) would return ’17-AUG-03′

Menol

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

Cassian Menol Razeek


  • Visitors Since Oct, 2008
  • Copyright © 1996-2010 I Learnt Today.... All rights reserved.
    iDream theme by Templates Next | Powered by WordPress