Sunday, December 20, 2009

Avoid Using Updatepanel

Updatepanel is part of AJAX Extension 1.0 and later provided by Microsoft. Update panel is used to hide page refresh using some standard mechanism. But What about speed? In my experience updatepanel is the best solution if your page does not contain large number of components. And make sure controls you used is supported by updatepanel. Because controls like GridView,Treeview and more , are not supported by updatepanel. So you can expect behaviours change if you put it inside updatepanel.


I have recently trusted on updatepanel and used in my page where speed is the primary concern and that page was almost dead. So avoid using updatepanel where speed is primary requirement.


I have used Prototype AJAX in my application. It’s faster and better. Give it a try. I tried to use jQuery AJAX but it has not that much support for ASP.net 2.0, its very good if you working on ASP.net 3.0 or ASP.net 3.5 version of .net.


So the conclusion is , avoid using updatepanel to get better speed , insted you can use Prototype or jQuery AJAX to get the best speed and performance of your application. Googling around the web and you will get many working example of protory and jquery.

Saturday, September 19, 2009

MySQL With .Net 2.0/3.0/3.5

MySQL is open source database. We had always seen MySQL with PHP. Generally we know MySQL is database engine for PHP. It’s true because .net does not have inbuilt support for MySQL database. We need to install other tools to make it work perfectly. In order to work with MySQL in .net you need to install MySQL Server and MySQL Connector. You can create function and procedure in MySQL version 5.1 and later. At the same time you will get great user interface to manage database. You will get interface just like MS SQL server management studio. MySQL Connector is used to add database connectivity support in Visual Studio. Download Connector depending upon the .net framework you use and Visual studio you work on. Version 5.1 GA (Generally Available) and later is recommended for .net framework 2.0 and higher.



Problems I faced:

  1. Syntax of MySQL is very different from MS SQL server.

  2. Error console of MySQL is not that user friendly.

  3. Migration of MS SQL Database to MySQL is quite difficult.

  4. Because it’s not Microsoft product you won’t find any inbuilt programming level support. Ex. It’s really hard to work use LINQ if your backend is MySQL.


Download Latest MySQL Database Server and Connector (Click Here).

Sunday, August 23, 2009

Enable Disable Controls During AJAX Postback

Most of us use Microsoft AJAX Toolkit and Controls but we don’t know when Ajax Request starts and when it ends. Sometimes we need to do enabling and disabling controls during postback. This can be done using the code below.


var _employee=null;
var _department=null;
var _subdepartment=null;

function pageLoad(sender, args){
// Register start request and end request event handler Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequest);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequest); }

// fired when ajax request starts
function beginRequest(sender, args){
_ employee = $get('ctl00_ContentPlaceHolder1_ddlemployee);
_ department = $get('ctl00_ContentPlaceHolder1_ddldepartment);
_ subdepartment = $get('ctl00_ContentPlaceHolder1_ddlsubdepartment);
_ employee.disabled=true;
_ department.disabled=true;
_ subdepartment.disabled=true; }

// fired when ajax request ends
function endRequest(sender, args) {
_ employee.disabled=false;
_ department.disabled=false;
_ subdepartment.disabled=false;
}


Here I have added two event handlers to request manager class instance. Event will be fired when request starts or ends. Isn’t it easy? :)

Ref : http://mattberseth.com/blog/

Monday, August 10, 2009

Online Money Transfer

This post is completely non-technical but useful in many places. I want to share my experience with different companies for online money transfer. Few days back, I planned to buy some product over internet but the only problem I faced was How to transfer money in foreign country? I look up many websites which provide this facility but amongst all I would recommend every to go with Xoom and MoneyBooker. I transferred money to china using Xoom. Nowadays, there are lots of options available for online money transfer. Options like Western Union, T/T are good but they charge more or need to study.

I found very nice alternate for online money transfer. Xoom.com. If you search “Online Money Transfer” in Google.com. You may find this website ranked first. Believe me Service is excellent. First time I had tried this website to credit money from PayPal to Indian Bank Account. Money was transferred in few days and I got letter from xoom.com about this transaction. Sound good!


I recently sent money to “Bank Of China”. This means that you can credit requested amount directly to the bank account. One of the nicest things about Xoom is that their executives call to recipient and confirm the details before they proceed.


Another website namely “Moneybooker” provides online money transfer. The feature I like in this website is escrow money. This is the best thing if you purchase product online.



Wednesday, July 15, 2009

Read SMS Using AT Command

Before I start explaining, you must be sure that your handset supports SMS read functionality using an AT command.

How can I test whether my handset supports or not?

Answer is pretty simple, try executing AT+CMGR=? AT Command. If it returns ”\r\nOK\r\n” then congratulation your handset modem supports Read SMS functionality.

Reading an SMS from memory location is always a big headache J. I waste lot of time just to read an SMS using AT command.

If you know SMS memory location then task will be simpler.

  1. First of all set memory type. Use AT+CPMS=”ME” command to set memory from which you are going to read SMS.

  2. After that execute AT+CMGR=”messageID” to read message.


Tip : Whenever you execute AT command never forget quotation mark (“), Carriage Return etc.

You will get message text directly if you are working under TEXT mode. In case of PDU mode you need to convert PDU into Original Message Text by writing some algorithms.

If you want indication for incoming SMS in your application then you need to enable this functionality.

Try “AT+CNMI=?” Command to test whether new message indication functionality is available in your handset or not.

If result does not contain any error and will return some parameters then congratulation again J

Now, use "AT+CNMI=2,1,0,1" AT command to enable new message indication to TE (terminal equipment).

Last but not the least, don’t forget to use "AT+CSMS=0" AT command set ISO 8859-1 character set.

Saturday, July 4, 2009

Send SMS using AT Commands

If you are writing an application which sends SMS using AT commands then, you must read this post. Few days ago I started to develop an application which is completely AT command based. Here I am going to explain the things that I learnt from experience.

First and the foremost thing before you start developing an application based on AT command , know which mode (text/pdu) your mobile handset supports.

If handset supports TEXT mode then work is simple.

  1. First you need to set text mode by using AT+CMFG=1 Command.

  2. And then use AT+CMGS=”+CellPhoneNumber” <enter>.

  3. If command execute successfully then It will return “>” as a response.

  4. After getting success response simply write your message ex. “this is test SMS”. This will submit SMS to network and will return the Message ID.

  5. If you want to send long message i.e. greater than 160 character length message then, this is really very useful.


I will cover how to send long message in my succeeding posts.

If handset supports PDU mode then work will be little lengthy and need some more efforts.

  1. For PDU mode, you need to set pdu mode by using AT+CMFG=0 Command.

  2. And then write AT+CMGS=<length><CR> command for modem to response. Here you can’t send the length of actual message. You need to convert the text into 7-bit or 8-bit encoding scheme. I included some useful links and sample application at the bottom of the page to accomplish this task.

  3. If command execute successfully then It will return “>” as a response.

  4. After getting success response, send <PDU><ctr-z/esc > sequence. This will submit SMS to network and will return the Message ID.

  5. If you want to send long message i.e. greater than 160 character length message then, this is really very useful.


Reference :

  1. PDU message format : http://www.dreamfabric.com/sms/

  2. Complete information about all AT Commands : http://www.developershome.com/sms/operatingMode.asp

  3. Text to PDU converter : http://nerdlabs.org/tools/pdu.php


Sample Application :

  1. PDU Decoder : http://www.codeproject.com/KB/IP/PDUDecoder.aspx

  2. Sample Applications : http://www.scampers.org/steve/sms/samples.htm


Do share new things with me.

Friday, July 3, 2009

Google Search Engine Optimization Guidelines and Best Practices

If you want better rank in Google Search Engine then, why not to follow guidelines given by Google itself. Read the article below to know what Google officials have to say for Search engine optimization.

I have taken much of the information from the Google SEO guideline document.

1. Title Tag


Do

  • Title should be unique and accurately described the page content.

  • Write unique page title for each page of your website. So that Google know how each page is different from other.

  • Title can be short or long. If your title is large then Google will show only portion of it.


Avoid

  • Writing Title which has no relation to the page content.

  • Using Blank or unnamed title like “New Page 1” or “Untitled”

  • Using Single title for all the pages or group of pages.

  • Using unneeded keywords in title.


2. Description Meta Tag

Do

  • Write description that would be both informative and interesting.

  • Unique description for each page.


Avoid

  • Writing Title which has no relation to the page content.

  • Writing Generic description like “page about...” or “this is the page that...” or something like that.

  • Filling it with only keywords.

  • Writing single description for each page.




3. Improve URLs Structure

Do

  • Use words in the URL link that are relevant to your website content.

  • Proper directory structure should be there.

  • Unique URL to reach any document.


Avoid

  • Using page name like “WebPage1.html”

  • Using long URLs or session ids or querystring variables.

  • Using directory names like “Dir1” or “Folder1” etc.

  • Using directory name that does not relate to page content.

  • Mixing www. And without www. URLS



  1. 4. Website Navigation Should be Simple


Do

  • Good linking structure from top to bottom with proper manner.

  • Use text links to navigate from one page to other. So that crawler can easily understand your website.

  • Use “breadcrumb” navigation (ex. Yoursitename >> items >> productname). Using breadcrumb navigation not only gives idea about where you are in the website, but also allow user to go to previous section very easily.

  • Use HTML site map page with XML site map file. This is huge benefit for SEO purpose.

  • Have meaningful and useful 404 page. Visit Google’s widget for 404 Page.


Avoid

  • Creating complex navigation links web.

  • Using image, javascript, dropdowns or flash object for website navigation.

  • Linking broken or dead links in Site map.

  • Using unorganized sitemap page.

  • Using vague message like “page not found”.


5. Quality of Content

Do

  • Write easy and meaningful content.

  • Organize the different topics in the content.

  • Include keywords that user always search. See the search volume of keywords that you have included in your content.

  • Write Fresh and Unique content.

  • Offer exclusive content or services.

  • Create content for users not for search engine. J John chow is also telling the same thing please read more about John chow


Avoid

  • Spelling and Grammatical mistakes.

  • Coping existing content.

  • Avoid unnecessary keywords.


6. Anchor tag text

Do

Avoid

  • Writing the generic content like “Click Here”.

  • Unrelated anchor text.

  • Lengthy anchor text like sentences or paragraph.

  • Using CSS that makes text and link identical in look.

  • Using excessive keywords.


7. Heading Tag

Do

  • Distinguish the main points and sub points and use heading tag appropriately.

  • Not use too many heading tags on the page. This will confuse user about the end of the content.

  • Create proper page structure using heading tag.


Avoid

  • Writing unrelated content in heading tag.

  • Avoid using heading tag where <em> or <strong> tag is appropriate.

  • Putting whole page content into heading tag.

  • Using tag if you only want to give style.




8. Image Tag

Do

  • Give reasonably good file and brief description about what the images is all about.

  • Write very good description when you use image as a link. (Must).

  • Store all the website images under one common directory.

  • Use JPEG,GIF, PNG and BMP images because this are the common file types that all browser can easily understand.


Avoid

  • Giving random file name like image1.jpeg or pic1.gif etc.

  • Extremely lengthy file name

  • Writing keywords and long sentences in alt tag.




9. Use robots.txt Effectively

Basic Idea : robots.txt is the file which tells google.com about the pages that user do not wish to crawl. This file stay under the root directory. Google web master tool help you to create this file.

Do

  • Use secure method for some sensible content.

  • .htaccess, encryption, password protection are the better alternatives.


Avoid

  • Allowing search result kind of pages to be crawled.


10. rel=”nofollow” attribute of Link (anchor tag)

Do

  • Use nofollow set to the link for which you don’t want to pass your reputation to other.


Ex. If you want to inform others about the spam link then you can use nofollow for such link to avoid passing your reputation on to it.

Use nofollow set to the link for which you don’t want to pass your reputation to

  • Write <meta name=”robots” content=”nofollow”> if you're interested in nofollowing all of the links on a page.


This are the guidelines and best practices given by the Google Web Master team. Hope you enjoy reading this article.

Wednesday, June 24, 2009

How to Improve slow running query performance using an Index ?

I recently come across the situation where my query was running very slow. I written a perfect query with good inner join and with proper condition. Have a look at query and its executing plan.

Query Execution Plan Before indexing

As you can see in the image query takes 1.28 minute to execute successfully. And as you can see in the figure , cause for the problem is Clustered Index Scan on LotDetails Table.

See the image below to get the clear idea about Clustered Index Scan Cost in this query.

Query Execution plan Analysis

What I did was Created Non-clustered index on “SlipID” and added “Active” column into Included Columns.

Create Index On Table

Include columns in index


After doing this when I run my query it took 0 second to execute successfully. And Clustered index scan is now turned into Index seek which is 3% of the total execution cost.

Query Execution Plan After indexing

So use index as and when required to boost the performance of your T-SQL Query.

Please correct me if I am wrong anywhere. :)

Saturday, June 6, 2009

Six Useful tips To Earn Money With Google Adsense

I recently went through different articles written under AdSense Help Section. All articles are worth reading if you are interested in earning good income with Google AdSense. I found some interesting tips in this section

  1. Ad Type : 336x280 Large Rectangle, 300x250 Medium Rectangle and the 160x600 Wide Skyscraper this are the good performer.

  2. Text + Image : Always prefer or give a try to Text and image ad combination.

  3. Positioning Ads : Ad just above the website content or just below the end of the content tends to perform well. Also, ads placed in between the content are also a good performer. If are you running a blog then the case may be different. In case of blog the add unit on the right hand side and add unit just below each post is very good money making machine.
    Reference : https://www.google.com/adsense/support/bin/answer.py?answer=43869 https://www.google.com/adsense/support/bin/answer.py?answer=17954

  4. Wider ad formats tend to be more reader-friendly.

  5. Try putting as many ads you can in page. Right now you can place only 3 ads per page.

  6. Colour : Change link colour, ad content colour and title colour depending upon your webpage colour scheme. The impact of using this technique is user would have difficult to understand that whether it’s google ad your website link.


Reference : https://www.google.com/adsense/support/bin/answer.py?answer=17957

Click on the link below to find out all the useful tips given by the google for adsense.

https://www.google.com/adsense/support/bin/static.py?page=tips.html

Note : I have just try to summarise whatever is written in Google Adsense help section. All credit for this goes to Google Adsense Team.

Friday, June 5, 2009

Right Keyword Selection for SEO

In this post I am going to tell you how good keyword selection can affect your site in general.

You open a search engine website , typed some search word(s) and press search button and in return search engine will give you number of results that matches your criteria. So here is my point ? How search engine will return those thousands or millions or billions results? Well, the answer is simple by looking at each page and search for the term you entered.



So when you are selecting keyword for search engine optimization you should think from the client perspective.

Let me explain by example , suppose you have written “Software Consultant India” , What will search engine do when you hit search button,

It will return

  • all the pages containing the exact phrase “Software Consultant India”

  • all the pages containing the words “Software”, “Consultant” and “India” with nearby relation.

  • all the pages containing the word “Software”, “Consultant” and “India” without looking closeness in mind

  • all the pages that have links that contain this “Software Consultant India” phrase

  • all the pages that has the word “Software”

  • all the pages that has the word “Consultant”

  • all the pages that has the word “India”


So choose the right keyword you will surely get better rank in search engine.

One more thing to remember is that don’t ever include irrelative keywords in your page. What will happen in that case, even if people found your web site it will be useless for them because your site contain different information than they are looking for.



Bottom line is that Use right keywords and relative to your domain or business.

At any point if you feel that I am wrong then don't hasitate to post a comment with correction.

Database Publishing Wizard - SQL server 2005

The topic is self explanatory :).

What would you do if you want to generate script that contains data and schema too. To generate script with schema is pretty simple but what about data. Microsoft Database Publishing Wizard is the tool that work with SQL server 2005 to generate that kind of script. Below are the steps to get started.



Step 1
database publishing wizard


Step 2
database publishing wizard


Step 3
database publishing wizard


Step 4
database publishing wizard


Step 5
database publishing wizard


Step 6
database publishing wizard


Step 7
database publishing wizard


Step 8
database publishing wizard

this is the example of database publishing wizard 1.1. I have not used the versions after 1.1 because this version served all my purpose.


Download Microsoft SQL Server Database Publishing Wizard 1.1


if you are sql server 2008 user then you can not use this :) because good news is that sql server 2008 has this wizard by default.


Please follow http://www.kodyaz.com/articles/sql-server-script-data-with-generate-script-wizard.aspx link for sql server 2008 database publishing.


Share your thought with me !! :))

First step towards the SEO

I would not go into detail, I want you to take some action now. Do the things below if it is applicable to your web site.


  • Remove Flash
    Flash is useless if you want better ranking in search engine. it does not cater any purpose.




  • Convert image into text
    If you have image in your page that contain simple plain text then better you should use real text instead of image. More content on your page better your ranking in search engine.




  • Enrich content with good keywords
    If you have enough content for your website then make sure your content is enriched with better keyword. Better keyword matters a lot. To choose best keywords you can use Google Keyword Suggestion tool. Use heading tag, bullet list, bold, Italic effect.

  • If Possible, Navigation Links should have proper keywords in it.

Sunday, May 31, 2009

SEO - Title and Description Tag

Title tag is very important if you want to have good page ranking in major search engine. Title tag now only tells the browser about the page’s title but it’s the SUBJECT line for GOOGLE kind of search engine.

You can find title tag just below the tag.

Example of title tag :

<HEAD>

<TITLE>Your title text here</TITLE>

Make sure each of your web page has title tag and it’s well written. One more thing there should be only one title tag per page. :)

Also DESCRIPTION tag is very important for SEO. Previously GOOGLE was not looking at description tag for keywords and contents , instead it was taking the required information from the page itself. But now GOOGLE is also looking at DESCRIPTION tag.

There are three cases that you should keep in mind while writing META DESCRIPTION tag.

  1. If GOOGLE found all the keywords from the description tag then, GOOGLE displays the whole content in the search.
  2. If GOOGLE found the partial keywords in the description tag then, in that case google takes the search content from the web page.
  3. But it GOOGLE does not found any keywords compare to page then it avoids DESCRIPTION tag as a whole.
Example of META DESCRIPTION tag :
<meta content="write" name="description">


If you want to learn more about HTML then you can visit the W3C School website.

I thing I am clear enough :)

Sunday, May 24, 2009

How do you know that your page is in Google index?

After you add your page into Google search index, It is obvious question arise in mind that does my web page properly indexed in Google or not. If this is the case, then you should try the following search terms in Google Search to know the current scenario of your web page.


try cache:http://hiteshagja.blogspot.com(change domain name)


This will show that your page is in Google Cache or not.


Also try site:skywardsms.com -abcdefg(change domainname)


This search term tells the Google that please show me the pages according to domain which does not contain the word abcdefg. So you will get all the pages from the Google from your domain which does not contain the world abcdefg.

If you don’t find anything in the above search term then simply type your domain name in search textbox and press search button. If your site is in Google database then you will see in the search page otherwise it’s not. This is the case with all the search engines. You can try this thing in all the search engines.

Saturday, May 23, 2009

Search Engine Basics

  • Search engine is the place where you can search millions of web pages and directories for your desired search term.
  • Search engine uses thousands of computers that use software known as spiders or robots.
  • In case of Google its Google Bot
  • Two major search directories present in the web are Yahoo! and Open directory project
  • Different search engine uses different method for ranking of web page
  • Most of the search sites result come from different source.
  • Most popular search engines are
  1. Google.com
  2. AOL.com
  3. Yahoo.com
  4. MSN.com
  5. AskJeeves.com
  6. InfoSpace.com
  7. AltaVista.com
  8. Overture.com
  9. Netscape.com
  10. EarthLink.com
  11. LookSmart.com
  12. Lycos.com

Tuesday, May 19, 2009

Microsoft Visual Studio 2010 and .Net Framwork 4.0

Microsoft VS 2010 CTP is just released and it’s better than before.

Download VS 2010 Community Technology Preview (CTP)

You can also learn the complete list of features provided in the vs2010.
Follow the link : http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx
Or direct download from Microsoft. PDF XPS

Friday, May 15, 2009

Working with AT Commands (Mobile Application)

In this article I am going to explain how you can use at commands for mobile application development. Before I am going to explain AT command I want to share some knowledge with you. AT commands are for GSM modem only so in order to execute at command you need mobile with GSM modem. Each mobile has either a Text mode or PDU mode or both. Depend upon the different mobile manufacture. So there are different at commands for different modes.

How can you execute AT Command ?
You can execute AT commands by programmatically or by HyperTerminal.
Go to Start >> Programs >> Accessories >> Communications >> HyperTerminal
And then connect your mobile using serial port and start play with AT commands.

If you want to develop a mobile application then you should go with C/C++, VB, VB.net, C#.net. My choice of language is C#.net.
.net has a class for serial port communication which you can use directly and built your application. You need the deep knowledge of threading and delegate to develop such kind of application.

Capabilities of AT commands are seamless. By using AT commands you can send SMS,Receive SMS, Call etc... In short you can handle all your mobile handset function by using your PC.

AT commands for Text Mode :
AT+CSMS Select Message Service
AT+CPMS Preferred Message Storage
AT+CMGF Message Format
AT+CSCA Service Centre Address
AT+CSMP Set Text Mode Parameters
AT+CSDH Show Text Mode Parameters
AT+CSCB Select Cell Broadcast Message Types
AT+CSAS Save Settings
AT+CRES Restore Settings
AT+CNMI New Message Indications to TE
AT+CMGL List Messages
AT+CMGR Read Message
AT+CNMA New Message Acknowledgement to ME/TA
AT+CMGS Send Message
AT+CMSS Send Message from Storage
AT+CMGW Write Message to Memory
AT+CMGD Delete Message

AT commands for PDU Mode :
AT Attention command
AT+CMGL List message
AT+CMGR Read message
AT+CMGS Send message
AT+CMSS Send from storage
AT+CMGW Write message to memory
AT+CMGD Delete message
You can download complete AT command list from the links below.

For text mode :
Download PDF
For pdu mode :
Download PDF

These two files contain the detailed information on what are the commands for Mobile Handset and what will be the output of each command. It is easy believe me !!

NOTE : all the content I wrote is related to mobile application development using AT commands. AT commands are very useful for serial port communication with attached device on serial port.

Thursday, April 30, 2009

ASP.net - Unterminated String Constants

This is common JavaScript error occurred while working with asp.net. I have faced this problem numerous times and believe me this is really very cumbersome error. This error occurs because of badly written JavaScript or due to access permission to the particular file, folder or image(s). Sometimes in your code if you have written path which does not exist in your .net web application. This kind error may occur. Friends, I have got this error many times and trust me each and every time its tuff to find where the problem is. Even my colleagues got this kind error many times. I have searched a lot about this error on Internet but not able to find the exact solution. Everybody is saying that it’s because of unclosed quotation mark in JavaScript. It’s true but not in every case.

In addition, what happens sometime you may not get this error while you work locally and the time when you deploy it to web-server you will get ‘unterminated string constant’ error. Am I correct ?

Here are the checklists/suggestions to resolve this error.

  1. Check you javascript for unclosed quotation mark. Check inline as well as reference JavaScript file. Starts with inline JavaScript.

  2. Give proper permission (rights) to directory under which your aspx page laying. Ex. Rights for IIS user, ASP.net process.

  3. Also check permission (rights) for image directory, if you are working with images.

  4. Check for the hard coded path in the CS(Class file in C#) ,if any, check existence for the path.

I hope the solutions above might be useful to resolve unterminated string constants error.

Query Performance Optimization

We all know how to create database, how to create tables etc... But do we know how to improve query performance when your database growing. Imaging the situation when your table will have more than a million rows. Just think what will be the query output time??

I personally working on the application where there are daily around more than 5000 transactions happens. So you can imagine what will be my table size after a few months. When I was writing this article, my table already has around ½ million rows.

I personally feel that this kind of large database will teach you a lot about the real power of SQL Server and best practices.

In my case, the query which was giving me result in less than a second, now taking more than 30 seconds. It’s because of half a million rows in transaction table. That’s the worst thing in terms of performance.

Luckily, I got help from Mr. Pinal Dave, he is Most Valuable Person (MVP) , he is SQL Guru, he is founder of sqlauthority.com, he has written more than 900 blogs till now. He is lot more than that. He is well known personality in the IT world.
He taught me and my of my co-workers, how to use joins, indexes and many more SQL related things. He solved my problem efficiently and also explain me the things he has done on tables. I learn a lot from that and I am confident that I can improve performance of large database.

You can contact me for the SQL Query Optimization related issues.