Monday, June 15, 2009

Tips for Better Productivity

Deadlines
Don’t rely on deadlines. Start soon and complete asap. have a clear vision or plan on your work.

Less Stress - More Work
If you have your 9-6 work, you have 15 hours for your life to have fun and spend time with family.

Minimize OverNight Work
The quality of work will be less compared to day.
More prone to bugs, High pressure and frustration.

Red Rabbit Technique:
If you get constant comments from the clients or the Boss
That looks great, but can you please make that line a bit thinner
Why did you choose 24px Verdana for headline? I think 25px will do much better
That green you picked is too green. Is there a way you can change it to something more yellow?
I love those icons very much. Can you move them 2px up? And make them 2% brighter

First you need do create the design in the way you think is the best. Move it around, polish it, use the fonts you like… Create whatever you think the final design should look like. Save your masterpiece and backup it.

It’s time for Red Rabbit! Basically, what you need to do now is to decrease the quality of your design. Create one simple eye catching mistake everyone will notice. Something like the sample I’ve provided above. You can do practically everything you wouldn’t do for real. Here are some ideas:
Destroy your color scheme. Add a strong color that is out of any harmony from your layout

Change your headline font to some old-school one like Times New Roman (this might be to obvious)

Replace your cool photo you’ve spent 3 days to find with something you found on Google Image Search

Saturday, May 30, 2009

Windows 7 Review

I have been using this since RC and couple of weeks ago Microsoft has come up with the BETA.

Tested in the following specification

Desktop Compaq Presario (1GB +P4(2+GHz) +40GB)

Laptop IBM R52(2GB +M(1.73 GHz)+40GB)

Plus (+)

Its seems to be like working on a windows xp machine with a Vista look and feel.
Comes with dozens of drivers and you don't have to manually install anything.
Rich UI
Cool features of Docking around the screen as you drag.
File transfer and installing software's are much faster.
Boots up faster and wakes in a second from sleep(not as I do snooze several times).
Minimum 1GB RAM is a good start.
Choosing different network on the fly to protect your PC with firewall.
Drag a window right and left like wiping the screen will minimize all other windows.
New Taskbar will a lot of features.

Minus(-)

Depends a Good Graphics card and doesn't go well with the normal ones.(My PC Sub score 1.0)
Aero and other tabbed preview are disabled.
Painting issues in the desktop rarely.
If some errors are thrown after installation it will not correct (do a clean install again)
If System hangs no way of using Ctrl+Alt+Del have to do a hard reboot.
Space occupied for installation 12GB after installing all the software's it comes to 18GB
I would suggest people using Windows XP can give a try to this.Its really yet another good product from Microsoft.

(Note:Beta download is free to use till June 2010)

Thursday, May 21, 2009

Usefull Firefox Addons for Developement

I came across the following usefull addons for firefox each web developer has to make use of

FireBug
I hope you will be using this.Inspect the page on the fly and change the styles and see the output immdly.

Pinger
Ping all the links in the page and will show the statistics of broken links.

Firesizer
Resize the browser window to the dimensions used by the enduser.Mainly used for tesiting in the wide screen machines.

IE Tab
Render a page in FireFox with IE rendering engine.

ColorZilla
Pick a color on the fly

Measure It
Draw out a ruler to get the pixel width and height of any elements

ScreenGrab
Take the screenshot of the webpage with scrolling.

Y'Slow
Used to test the performance of a site and tuneup things as per their suggestions.

Wednesday, April 15, 2009

SQL CE with ASP .NET Application

Use the below code snippet to make SQL CE it work with ASP .NET application
[C#]
protected void Page_Load(object sender, EventArgs e)
{
AppDomain.CurrentDomain.SetData("SQLServerCompactEditionUnderWebHosting", true);
string connectionString = @"Data Source=|DataDirectory|\Northwind.sdf";
Northwind nw = new Northwind(connectionString);
var DataSource = nw.Orders.Skip(0).Take(100).Select(o => o);
}
[WebConfig]
<assemblies>
<add assembly="System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91">
</assemblies >

Monday, April 13, 2009

SQL CE db creation with C#

I hope this would be useful for porting a MDF Sql db to CE Sql db.
we all very much familiar with ADO.NET the namespaces available for SQL server data provider are System.Data and System.Data.SqlClient similarly in ADOCE.NET for SQL CE data provider are System.Data and System.Data.SqlserverCE. The process to develop an application to use SQL Server CE is
  • Check for database available or not if not create the database through SqlCeEngine object as below

    if
    (!File.Exists(\\My Documents\\EmpDB.sdf))
    {
    SqlCeEngine empEngine = new
    SqlCeEngine("Data Source = \\My Documents\\EmpDB.sdf");
    empEngine.CreateDatabase();}

    Note : the database file name must have .sdf extension

  • After create the database is created next step is to create the required tables

    SqlCeConnection empCon;
    SqlCeCommand empCom;
    empCon =
    new SqlCeConnection("Data Source = \\My Documents\\EmpDB.sdf");
    empCon.Open();
    empCom = empCon.CreateCommand();
    string
    strQuery = "CREATE TABLE Employee (EmpID int IDENTITY(0,1) PRIMARY KEY,EmpName nvarchar(10),Salary int)";
    empCom.CommandText=strQuery;
    empCom.ExecuteNonQuery();

    This code snippet create a table with three columns ( empid,emp name & salary )

  • Once you setup the database then further operations are store or fetch data , ii can be done through SqlCeDataReader as below

    string strQuery = "SELECT * FROM Employee ORDER By EmpName ASC";
    empCom.CommandText = strQuery;
    SqlCeDataReader empReader = empCom.ExecuteReader();

you can use the code and fill the datas from the existing MDF to CE.

Thursday, October 30, 2008

Bank that credits your account each morning with Rs 86,400

Imagine there is a bank that credits your account each morning with Rs 86,400. It carries over no balance from day to day; allows you to keep no cash balance; every night deletes whatever part of the balance you failed to use during the day. What would you do with such an account Draw out every penny, of course!!!


Every one of us has such a ‘bank’. Its name is TIME. Every morning it credits you with 86,400 seconds. Every night it writes off as lost whatever of this you have failed to invest to good purpose. It carries over no balance. It allows no overdraft.

 

Each day it opens a new account for you. Each night it burns the records of the day. If you fail to use the day’s deposits, the loss is yours. There is no going back. There is no drawing against tomorrow. You must live in the present -on today’s deposits. Invest it so as to get from it the utmost in health, happiness and success!

 

The clock is running. Make the most of today!! And make it a great week ahead!!

Thursday, October 23, 2008

Visual Studio Tips & Tricks that Every Developer Should Know

Tips & Tricks that Every Developer Should Know

In this blog entry, I list the essential tips and tricks that every developer who uses Visual Studio 2008 should know. I wanted to keep this list brief. I also wanted to focus on only those tips and tricks that I use on a daily basis. Almost all of these tips and tricks are just as useful regardless of whether you are building an ASP.NET Web Forms or ASP.NET MVC application.

Tip #1 – You don’t need to select a line to copy or delete it

I always cringe whenever I see someone select an entire line of code in the Visual Studio code editor before copying the line or deleting the line (see Figure 1). You don’t need to do this.

Figure 1

clip_image002

If you want to copy a line of code then you can simply press CTRL-c to copy the line and press CTRL-v to paste the line. If you want to delete a line, don’t select it first, just press CTRL-x. You’ll be surprised how much time this one tip will save you.

Tip #2 – You can add a namespace automatically by pressing CTRL-.

In the old days, before Visual Studio 2008, if you used a class in your code that was not a member of any of the existing namespaces imported in your code then you had no choice but to look up the class in the documentation and enter a using statement to import the new namespace.

Visual Studio 2008 is smart enough to import namespaces for you automatically. If you type the name of a class that inhabits a namespace that has not been imported then Visual Studio displays a red bar beneath the class in the editor (see Figure 2). You can press CTRL-. to display a dialog box for picking the right namespace to import. Finally, just press the ENTER key to select a namespace (see Figure 3).

Figure 2

clip_image004

Figure 3

clip_image006

Tip #3 – Never create properties by hand

Never type property declarations by hand. It takes forever! Instead, just type prop + TAB + TAB. When you type prop + TAB + TAB, you get a code snippet (template) for entering a property. Use TAB to move between the template parameters. Press the ENTER key when you are finished creating the property (see Figure 4). This tip has saved me from many days of tedious property typing.

Figure 4

clip_image008

Tip #4 – You can remove and sort unnecessary using statements

Whenever I finish creating a class, I always clean up the list of using statements that appear at the top of the class file. I like to remove any unused using statements to reduce the amount of visual clutter in my classes. You can remove using statements that are not required by your code by right-clicking the top of your code file, selecting the menu option Organize Usings, and select Remove and Sort.

Figure 5

clip_image010

Tip #5 – Use CTRL-k+c to comment out code

If you need to temporarily disable a block of code, or a section of an ASP.NET page, then you can comment out the region by pressing CTRL-k+c. I always do this when I want to rewrite an existing section of code, but I am afraid to delete the old code before writing the new code.

For example, Figure 6 illustrates commented out code in the code editor.

Figure 6

clip_image012

You can use the very same key combination to comment out code almost anywhere. For example, you can comment out code in ASP.NET pages, web.config files, and JavaScript files (see Figure 7).

Figure 7

clip_image014

You can perform the opposite operation, and uncomment out code, by using the keyboard combination CTRL-k+u.

Tip #6 – You can close all documents except the current one

After working in Visual Studio for an extended period of time, I end up with a lot of open documents. I like to quickly switch between open documents by hitting the keyboard combination CTRL-TAB (you can also use CTRL-TAB to shift focus to different tool windows). If you have too many documents open, using CTRL-TAB becomes more difficult because you must hunt through the set of open documents.

There are two ways that you can close open documents. You can use the menu option Window, Close All Documents. Better yet, you can right click a tab that corresponds to an open document and select the menu option Close All But This. Selecting this latter option closes all open documents except the document corresponding to the tab (see Figure 8).

Figure 8

clip_image016

Tip #7 – You can open a database by double-clicking the database file in App_Data

After you add a user instance of a SQL Express database to a project (a RANU database), you can quickly connect to the database by double-clicking the .mdf file in the App_Data folder. Double-clicking the database opens the Server Explorer/Database Explorer window and expands the objects in the database automatically.

Tip #8 – You can copy a file or folder into a project by dragging and dropping

I’m always composing new Visual Studio projects from bits and pieces of previous Visual Studio projects. For example, I might need to add a folder from a previous project or a set of files. You can add existing files to Visual Studio by right-clicking in the Solution Explorer window and selecting the menu option Add, Existing Item. But, this method of adding files is slow. Furthermore, you can’t add folders using this method.

The best method of adding files and folders to Visual Studio project is to just drag the files or folder into the Solution Explorer window (or copy and paste the files or folder). For example, I am constantly adding my MoviesDB.mdf movies SQL Express database to new projects. I keep this file on my desktop and drag it into the App_Data folder whenever I need the database in a new Visual Studio project.

Tip #9 – Use CTRL-SPACE to perform statement completion

This tip is particularly relevant for developers who build applications by using test-driven development. When doing test-driven development, you write a unit test first and then write code that satisfies the unit test. When writing the unit test, you often have to fight with statement auto-completion.

There is an easy solution to this problem. Disable automatic statement completion by selecting Tools, Options, Text Editor, All Languages and uncheck the Auto list members checkbox (see Figure 9).

Figure 9

clip_image018

After you disable auto list members, you can still display suggestions for statement completion by using the keyboard combination CTRL-SPACE.

Tip #10 – Add new items by pressing CTRL-N or CTRL-SHIFT+A

In general, using the mouse to perform an action in Visual Studio is slower than entering a keyboard combination. The fastest way to add a new item into a Visual Studio project is to hit the keyboard combination CTRL-n or the keyboard combination CTRL-SHIFT+A. The first keyboard combination works in ASP.NET Websites and the second keyboard combination works in both Website and ASP.NET MVC Web Application projects.

This keyboard combination opens the Add New Item dialog box (see Figure 10).

Figure 10

clip_image020

You can use the TAB and arrow keys to select an item from the dialog box and navigate to the Open button. Press the ENTER key to invoke the Open button.

Tip #11 – You don’t need to type file extensions when adding a file

This tip is related to the previous one. After using the TAB key to navigate to the Name textbox in the Add New Item dialog box, you can enter the name of the new item. When typing the name of a new item, you don’t need to include the file extension. Visual Studio can determine the file extension from the selected template.

For example, when adding a new Web Form named MyPage.aspx, you can simply type MyPage. When adding a new Master Page named Site.master, you can simply type Site.

You might think that avoiding typing a couple of characters would not matter. But, if you add dozens of files to a Visual Studio project, the number of characters that you can avoid typing quickly adds up.


Source: Stephen Walther(ASP.Net)