Archive for the ‘Web Development’ Category

SmartPhone Applications Play Bigger Part in our Lives Today!

Thursday, August 4th, 2011

SmartPhones have transformed the mobile market and it is growing at a rapid pace and has changed the way we live, work and play. According to a recent research, the smartphone market is expected to grow approximately 49.2% in 2011 as more and more number of users are switching from feature phones to smartphones. SmartPhones are dominating the market and have outpaced the rest of the mobile market

SmartPhone is a small all-in-one mobile phone like iPhone, Android, Blackberry, etc. that is enhanced with advanced capabilities like Voice, function, SMS, Multiple connection, personal information management, Internet Browsing, Email, Multimedia, GPS, e-book reader capability etc. In short it can be said that SmartPhones are small computers having phone capabilities in it.

Smartphone Applications or “SmartPhone Apps” are software products built for iPhone, Android, Blackberry and others, both for business as well as everyday use. A Smartphone application allows the user to stay connected with exciting happenings in their field of interest. Moreover, one can also share interesting things with friends through various social media channels available like Facebook and Twitter.

SmartPhone applications have brought down the world at fingertips. These applications allow a variety of features to easily manage your business and life with more ease and fun. There are thousands of apps, some are free and some paid ones also. With time, this market is hoping to see newer apps with more advanced functionality and innovative methods of communicating, entertaining and engagement.

Having a Smartphone Application has become the need of the hour, as it offers real opportunity in advancing entrepreneurship in this developing world. To advertise, expose— to new as well as growing audience and to accelerate revenues; companies, across all verticals are using Smartphone Apps.

These applications have revolutionized the way you interact with your customers and even you can get customized apps as per your business requirements. There are various software companies that create customized SmartPhone applications to accentuate their SmartPhone potential to their clients. RedAlkemi has also expanded it’s borders and ventured into SmartPhone Application Development to provide turn-key solutions to the clients.

Mobile technology has altered the way people operate— from a simple voice communication to a highly evolved interactive multi-media experience; SmartPhone apps have created a rage. It is believed that Smartphone Application development is the key to future and will grow at a much faster rate than ever before.



How to speed up your website

Tuesday, November 30th, 2010

We often hear that websites should be fast-loading. But how fast is fast, and how slow is slow? And if your website is slow, how can it be speed up?   

Users are becoming less and less accepting when it comes to slow sites as internet maturity increases. The size of the page is the main deciding factor for download times, coupled with bandwidth.

Most of the tips are the ones that you probably know. So, you can use the list as a checklist (which it normally is in my “customer notes sheet” : ) ).

Here are the tips:

1. Get A Fast & Less-Loaded Web Server

This is a must. Whatever you do to make your website faster, if it is served slow, there’s nothing to do.

Make sure that the server your website is hosted has low ping values & it is not over-loaded. Especially if you’ve a database and/or using dynamic files (like asp, asp.net, php, ruby…) server over-load can kill the performance.

If you’ve a simple website with few visitors then shared hosting is ok. For a website getting popular, think of a VPS with guaranteed RAM & CPU usage. If the website is already popular, a dedicated server will be the best performing one.

2. Know When To Use GIF, JPG & PNG Files. 

Playing with the quality of images will dramatically lower the sizes of them while they will still be looking good.

GIF is suitable for images with few colors like logos, text & line art. When saving a GIF file, make sure you use a small color palette.

JPG is good for images with lots of colors & details like photographs. Decrease the quality of a JPG image before saving. It will still look good for a web image.

PNG, a format especially for websites, has great quality – both transparent & non-transparent – is especially functional when you’re in need of quality transparent images. Don’t forget that IE6 has problems in displaying them.

3. Use XHTML – No Tables

This is easy to tell but may be harder to implement for anyone that has few experience with XHTML.

The thing is, tables are rendered slower than DIVs by browsers. You can do more with less code & no need to say it is much better to be compatible with any browser (including mobile browsers), in means of SEO, etc..

Update: There may be cases when using tables are much more logical like “tabular data”. You may have to code a lot for creating the look of a simple 5 columned table. Don’t do that & use tables when needed.

What is tried to be mentioned here is, use XHTML rather than tables in general. But don’t try to draw images with XHTML.

4. Use CSS Smartly & Compressed

  • Mention every style in CSS files.
  • Find the common properties in objects define them once & try not to repeat them.
  • If using a significant amount of totally different properties for a specific page define them in another CSS file & only include on that page. So users viewing other pages won’t need to download those properties.
  • Compress your CSS file.

5. Merge & Compress JavaScript Files

Try merging JavaScript files prevent multiple includes (see step 6).

If a JavaScript file will be used only in few pages, try to include them inside those pages only (like CSS in step 4).

Compress JavaScript files. It lowers the size seriously & doesn’t have any bad effects on your side.

6. Manage Included Files Better

There may be several files included in webpages like CSS files, JavaScript files and other JavaScript files for statistic services, social bookmarking sites, widgets & more.

Try to decrease the number of these files:

  • If using digg-reddit-like voting widgets, don’t use them in stories that won’t hit the front page & remove the ones that were submitted few days ago as they won’t have any help after sometime.
  • Use only 1 statistic service if possible. Every web-based service requires new files to be installed & they are called each time a page is loaded.
  • Host files on your side & don’t use web addresses as file paths.
    • If you’re using any JS frameworks like jQuery or MooTools, don’t call the .js files from their websites but download & upload them to your website.
    • Don’t try to call any file from a web address like “http://..” As this always requires dns queries to be done & will work slower.
  • PHP Speedy (WRD post)is a very effective solution that does all the combining & compressing automatically. You may want to try it.

7. Use HTTP Compression

HTTP compression is one of the most effective step with a little effort.

Today, almost every browser & web server supports HTTP compression. Using it, your files are sent to the visitor compressed & un-compressed on their side & you can have up to 90% success for the text based files (like HTML).

You have 2 popular choices with this:

  • HTTP compression: a feature of the web server (can be enabled on the server side)
  • Gzip: can be enabled at the site level.

8. Better Coding

This is for websites which does not use any ready-to-use systems like WordPress, Drupal, Expression Engine or similar (if you’re using these then you’re lucky as they are already well-coded).

Besides the better XHTML & CSS coding, the dynamic coding of the website directly affects the performance.

As you can guess, this is a huge subject. But there are some major things like:

  • Separate the static & dynamic content. This will help writing less-code.
  • Create smart & effective functions. For ex: if you’re going to use a user’s name & birthdate at the same page, don’t run 2 queries or functions, your function must call 2 of them. Simply, try to do everything once.
  • Connect to the database as few as you can & once connected; call only the data you need.
  • Try to keep database sizes small. If you’ve a large database, sometimes separating it into several databases perform better, especially for the data which is reached not so often. From the server’s point of view: 4-250mbs of dbs perform better than 1-1gb of db.

9. Cache Webpages

Caching is a superb way of decreasing the stress on the server by running more static files & less queries. It simply saves a static, HTML version of the page to be displayed & displays that file rather than the dynamic one.

For CMS applications like WordPress, there are already ready-to-use caching plugins (like WP-Cache).

A small note, caching can also be done at the web server level. But if you’re on a shared hosting account, you better be lucky to have it on.



How to be a better Programmer

Wednesday, October 20th, 2010

The field of programming itself calls for a lot of creativity. This makes it quiet challenging for the ones who took up programming just because someone told them to. Then you are set to reach NOWHERE. All good programmers I know are good because they loved what they did. Once you develop the zeal to learn all things ill fall in place.

Below mentioned are some of the attributes suitable for the efficient and effective programmers. One must set them as milestones to achieve success in this field:
1.    Work within classes and functions. Never work globally
2.    Document everything. Be clear and precise
3.    Check ALL parameters. Try to catch the caller (critical in public functions)
4.    Return error indications (Use call by reference if needed or throw exceptions)
5.    Assume the worst
6.    Check caller privileges to perform the task in the current context
7.    Spell-check your work
8.    Write efficient code
9.    Cover all cases, giving treatment for each
10.    Test your code (Test cases should be written by someone else)
11.    Log conditionally
12.    Stop and think before you code. Document steps  in the top of the function
13.    Don’t pass constants as parameters. Always pass variables
14.    Check the return value of EVERY function call and act accordingly
15.    Use meaningful function and variable names
16.    Use wrappers for common system calls
17.    Never use magic numbers
18.    No code spagetization (if, else, else, if else….)
19.    Follow the coding guidelines strictly
20.    Write short functions. User helper private functions when needed
21.    Working with database, check type and size of values before update/insert
22.    Work from the end to the beginning



Introduction for the upcoming Technology-JSON

Wednesday, October 13th, 2010

What is JSON?

JSON, or JavaScript Object Notation, has been getting a large amount of attention recently in the IT world. This is mostly powered by its extremely lightweight implementation, its common usage in Web service responses, and its already supportted in JavaScript. JSON isn’t very simply a way to code objects in JavaScript, but it is the actual form that a JavaScript engine will map the object to in memory. It is an extremely fast and powerful method of transporting data between two interfaces. like in web service.

How does it work?

JSON is capable of building up data constructs for integers, strings, arrays, and booleans – the most essential data building blocks. Using a carefully defined syntactical construct, JSON can be used to outline an object and with the use of javascript’s eval() function, they can be converted to a working object.

But the power does not end there. Other popular programming languages have been implementing native support for JSON, such as PHP, .Net, Cold Fusion and ActionScript. For example, PHP can now convert an associative array of data into a JSON string by using the new json_encode() function. For other languages without native support, you can find a full range of implementation classes available at the JSON website(http://json.org/).

JSON and XML

Benefits of JSON:
- The simplest of reading.
- The easiness of using.

Benefits of XML:
- XML is extensible.
- It is widely used and recognized by almost all programming languages.

Unfortunally, both XML and JSON are enable to integrate a large amount of data in binary form.

The syntax of JSON
The components of JSON:
- An object: contains objets or attributes or properties.
- A scalar variable: Number, String, Boolean.
- An array.
- Literal values: null, true, false, “string of characters”, and numerical values.

Example of JSON file
A simple example, designing a menu:
It is an object made of members that are an attribute and an array that holds other objects, the rows of the menu.
{
“menu”: “Edit”,
“commands”: [
{
"title": "Copy",
"action":"CopyText"
},
{
"title": "Past",
"action": "PastText"
},
{
"title": "Replace",
"action": "ReplaceText"
}
]
}

The XML equivalent:
<?xml version=”1.0″ ?>
<root>
<menu>Edit</menu>
<commands>
<item>
<title>Copy</value>
<action>CopyText</action>
</item>
<item>
<title>Past</value>
<action>PastText</action>
</item>
<item>
<title>Replace</value>
<action>ReplaceText</action>
</item>
</commands>
</root>.

How to use the format
The JSON file allows to load data from the server end or to send data to it, in this format. For example, storing the content of a form, just filled by an user. This involves three steps: the browser processing, the server processing, and the data exchange between them.

Client side (browser)

This is rather easy, as JSON is a part of the JavaScript definition. The content of a file, or the definition of the data is assigned to a variable, and this variable becomes an object of the program.

Server side

JSON file are used by various programming languages, including PHP and Java thanks to parsers that allow to get the content and that may even convert it into classes and attributes of the language.
The json.org includes a C parser and a list of parsers in other languages.

Data exchange

Loading a file may be accomplished from JavaScript in several ways:
- direct including of the file into the HTML page, as a JavaScript .js external file.
- loading by a JavaScript command.
- using XMLHttpRequest.
The JSON file is parsed by the eval() JavaScript function.

Example
The XMLHttpRequest code:

var req = new XMLHttpRequest();
req.open(“GET”, “filetoread.json”, true);
req.onreadystatechange = myCode;   // the handler
req.send(null);
The JavaScript handler:

function myCode()
{
if (req.readyState == 4)
{
var doc = eval(‘(‘ + req.responseText + ‘)’);
}
}
Using the data:
var menuName = document.getElementById(‘jsmenu’);   // finding a field
menuName.value = doc.menu.value;           // assigning a value to the field
How to access data:
doc.commands[0].title      // read value of the “title” field in the array
doc.commands[0].action     // read value of the “action” field in the array



How to Enhance Website Speed

Friday, April 30th, 2010

Continued…

 

3) Compression Techniques: Compressing CSS, JavaScript and PHP

Compressing PHP, HTML, JavaScript and CSS content leads to a reduction in page size, which results in the pages being served faster to the browser.

  • Compress all text and html:

AddOutputFilterByType DEFLATE text/html text/plain text/xml

  • Or, compress certain file types by extension:

<Files *.html>

SetOutputFilter DEFLATE

</Files>

  • Also, you can add following code in your htaccess file and enable compression using mod_gzip.

<IfModule mod_gzip.c>

mod_gzip_on Yes

mod_gzip_dechunk Yes

mod_gzip_item_include file (html?|txt|css|js|php|pl)$

mod_gzip_item_include handler ^cgi-script$

mod_gzip_item_include mime ^text/.*

mod_gzip_item_include mime ^application/x-javascript.*

mod_gzip_item_exclude mime ^image/.*

mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*

</IfModule>

4) Other Practices for enhancing website speed:

  • Put StyleSheets at the top
  • Put Scripts at the bottom
  • Make JavaScript and CSS external
  • Minify JavaScript and CSS
  • Optimize images
  • Do not scale images in HTML

Hope all these points will help you to enhance your website speed. Do comment!



How to Enhance Website Speed

Sunday, April 25th, 2010

Website Speed is one of the most critical diagnostics for measuring the website performance. A slow website, with a large response time is more of a turn-off in terms of user experience than a badly designed fast responding website.

We all have been developing websites, but how many times have we truly optimized it for speed? Presented below, are some simple, yet useful techniques for improving the website’s performance by improving its speed.

1.Database indexing: Faster database querying

All the avid, as well as, the not-so-avid readers know the importance of the Index Page in a book. The index of a book serves as a page, which tells you where to look for particular information inside the book. Just similarly, the index created on a database table tells the query engine exactly where to look for a particular record in the database.

The general rule of thumb for database indexes is: items that are contained in your WHERE clause are ideal to be indexed.

  • Create ONE index for the multiple fields.
  • Include fields in the ORDER BY clause as indexes as well. By adding indexes for your ORDER BY clauses it will prevent MySQL from having to re-sort your data each time before it is returned to you.

However, there are down falls to having too many indexes. The more indexes you have, the longer each insert statement you perform will take because MySQL needs to update the indexes to include the new data.

2.Use Cache: A repository of web pages

It is the technique in which the HTTP request fetches its response from a repository of previous responses, rather than going to the server for fetching information. The thing to be kept in mind here is:

Let the response come from the cache if the information has not changed on the server, or has not become stale, however, go to the server in case the information has changed since the last fetch.

We normally use ‘Expires’ or ‘Cache control’ headers for implementing caching.

  • Expires is used for static content like images which, usually do not change regularly, and even for letting the cache know when should it refresh itself in case of dynamically (but regularly changing content).

Syntax: Expires: Fri, 30 Oct 1998 14:19:41 GMT

  • Cache-Control are a special class of HTTP headers, which are more flexible and more powerful than the Expires header.

Syntax: Cache-Control: max-age=3600, must-revalidate

Visit the blog again for more information on how to enhance your website speed. To be continued…



MySql Delete Duplicates

Thursday, September 10th, 2009

We all must have faced to delete the duplicate entries in a table.
Here’s the simple solution to that. :)

The scenario is:
The table has 3 columns, A, B, and C. Column A is unique for all rows
but the columns B and C can be duplicated across rows. Now if you need
to remove the rows where B and C are duplicated.

DELETE
FROM daTable
WHERE a NOT IN
( SELECT MIN(a)
FROM daTable
GROUP
BY b,c )



Database Connection Pooling

Friday, August 21st, 2009

Connection pooling is a technique used to avoid the overhead making of new database connection every time. An application or server object requires access to a database. This technique of “pooling” connections is based on the fact that most applications only need a thread to have access JDBC connection when they are actively processing a transaction, which usually take only milliseconds to complete. While not processing a transaction, the connection would otherwise sit idle. Instead, connection pooling allows the idle connection to be used by some other thread to-do his useful work.

Connection pooling enables the ODBC driver to re-use existing connections to a given database from a pool of connections, instead of opening a new connection each time the database is accessed. By enabling connection pooling you can improve the overall performance of your application by lowering the time taken to open a connection to a database in the connection pool.

When a thread needs to do work against a MySQL or other database with
JDBC, it requests a connection from the pool. When the thread is finished using the connection, it returns it to the pool, so that it can be used by any other threads. The overhead time for establishing a database connection is typically around 1 to 3 seconds. This is the time it takes to locate the database server to establish communication channel and exchange information.  Sun has standardized the concept of connection pooling in JDBC through the JDBC-2.0 “Optional” interfaces, and all major application servers have implementations of these APIs that work fine with MySQL Connector.





Indexing General

Wednesday, July 15th, 2009

An index is a database structure designed to facilitate faster data retrieval Indexes provide a way for SQL Server to organize pointers to the data required An index in a database works the same way as an index in a reference book.

Why Index?
Speed
Without index SQL Server must perform a table scan or read every row in a table
Speed up query joins between tables

Indexing Architecture
SQL Server indexes are stored as B-Tree (Balanced Tree) structures
There are three levels of a B-Tree:
Root Level
Leaf Level
Intermediate Level
A B-Tree structure is built for every index defined in SQL Server

Types of Indexing
There are two types of SQL Server indexes
Clustered
Non-Clustered
Both are built upon B-Tree structures

Clustered Index
The data is physically stored in the sorted order
The leaf pages are the actual data
Only one clustered index is allowed per table
Generally offers better performance than non-clustered index

Non-Clustered Index
Non-clustered indexes create a logical order and therefore, the leaf page merely points to the actual data Create up to 249 Non-clustered indexes per table. Non-clustered index are larger than clustered indexes because of the extra level of leaf pages

Index Creation
CREATE [ UNIQUE ] [ CLUSTERED | NONCLUSTERED ] INDEX index_name
ON { table | view } ( column [ ASC | DESC ] [ ,...n ] )
Indexes can be created at the same time table is created or at a later time
Create clustered first before adding non-clustered indexes.

When to use Clustered vs. Non-Clustered index
Clustered
Columns that are used in range queries
Columns used in ORDER BY or GROUP BY queries
Queries returning large result sets
Static look up tables with large data set
Non-Clustered
Columns used in aggregate functions
Foreign Keys
Queries returning small result sets
Primary keys that are sequential ID keys, such as identity columns

What NOT to index
Tables with a small number of rows
Might be more efficient to do table scan
Columns with small range of values
For example: (yes/no, 0/1, 1,2,3)
Tables with heavy transaction (insert,update,delete) activity but very few select queries run against it
Tables with indexes slow down data modifications
Columns not used in queries
If the column(s) are defined as TEXT, NTEXT, or IMAGE data types

Additional Tips
Try to create indexes on columns that have integer values
Integer values have less overhead than character values
When creating indexes, try to make them unique indexes
Columns used in joins should have an appropriate index
Don’t accidentally add the same index twice on a table
Don’t over index your OLTP tables
Remove unused indexes.

Re-indexing
Periodically (weekly or monthly) perform a database reorganization on all the indexes on all the tables in your database
Frequency depends on transaction activity in database
This will rebuild the indexes so that the data is no longer fragmented
Fragmented data can cause SQL Server to perform unnecessary data reads, slowing down SQL Server’s performance
Use DBCC DBREINDEX(@TableName,’ ‘,90) for specific tables
Use Update Statistics Command
after bulk insert/update to table

Index Tuning Wizard
Powerful tool designed to help you identify existing indexes that aren’t being used
Recommends new indexes that can be used to help speed up queries
Excellent starting point for indexing if you aren’t sure what to index

Index Tuning Wizard 
Don’t blindly accept every recommendation made by the wizard
Sometimes the wizard will not recommend an index
Review each recommendation carefully, sometimes rewriting a query will do more good than adding an additional index

Conclusion

Indexing properly can dramatically improve overall query and application performance
There are many factors to consider when deciding to index
Index wisely



Plugoo: A cool way to be in touch with your web site visitors

Wednesday, July 15th, 2009

A cool widget enables your website visitors to get in touch with you in real time, directly on your Instant Messenger (MSN Messenger, GoogleTalk, Yahoo! Messenger, AOL AIM, ICQ, Jabber…). If your messenger status is online, visitors can send you an instant message through the Plugoo Buddy in your messenger buddy list. You can thus chat with them; answer their questions; more over communicate with prospect customer when they need you.

Site visitors need neither to download any software nor create an account before they can contact you. They never have access to your instant messaging information (username). Conversation between a visitor and you is strictly private – other simultaneous visitors on the website don’t see the conversation. You don’t have to change your habits; you keep using your favorite messenger on your desktop or from your mobile phone.

You embed a Plugoo on your web site. Visitors on your website can see the Plugoo and write through it a message for you.

As this Plugoo is directly connected to your Instant Messenger, it forwards you in real time all the messages your website visitors can send to you. You reply to your visitors from your Messenger while they are currently browsing your website.

You can also use myPlugoo, a simple link http://www.myPlugoo.com/… to let your friends IM you from any web site, email or blog. For instance, you can add this link to your email signatures or to your blog/forum comments… This way, your emails recipients or other Net surfer have the opportunity to pop-up your Plugoo Widget with just one click and start a LIVE conversation with you!

For more details, surf http://www.plugoo.com/



Basic understanding of Multithreading in .Net Applications

Tuesday, June 30th, 2009

Multithreading is a powerful tool for creating high performance applications, especially those that require user interaction. Microsoft .NET has broken down the barriers that once existed in creating multithreaded applications. 

Newer operating systems, such as Windows 2000, support pre-emptive multitasking, which allocates each thread a time slice. When the time slice of the currently executing thread has elapsed, the thread is suspended by the operating system, context of the thread is saved, context of another thread is loaded, and the other thread then resumes execution according to its previous state. This gives the appearance that multiple threads are executing at the same time and helps prevent the system from becoming unresponsive from a single thread. On systems that have more that one-processor threads are distributed across all of the processors so there really are multiple threads executing at the same time. 

.NET has been designed to support multi-threaded operation. There are two main ways of multi-threading in .NET: -

  1. Thread class
  2. Thread pool

Every thread has a priority. You can assign different priorities to the threads in application. That means you can tell the system which thread can be done first, which thread can interrupt others and which thread cannot be interrupted. Each thread with the highest priority can interrupt a thread with a lower priority. Below are values for thread priority -

  1. Highest
  2. AboveNormal
  3. Normal
  4. BelowNormal
  5. Lowest

A thread can be stopped for a given period of time. To make a thread stop you can use sleep method with number of milliseconds to sleep. The thread will resume after the specified milliseconds.

We can stop a thread by using suspend() method. This way thread will wait until you call it back to action. To call a thread back to action you can use resume() method.

We can stop or abort a thread at any time by using abort() method. This will destroy all the data related to that thread.

.Net makes it easy to add multithreading to your application. By this you can make the application more interactive and can increase the user’s experience.

Happy Programming!



SQL – Injection

Tuesday, June 30th, 2009

SQL Injection is a technique where an attacker/hacker creates or alters existing SQL queries to expose hidden data, or to override valuable ones, or even to execute dangerous system level commands on the database host. This is accomplished by the application taking user input and combining it with static parameters to build a SQL query.
Using SQL injection, a user can damage the database, delete tables, insert fake data into database, steal secure information from the database and can delete the database as well.
To avoid this issue, the code should have the ability to avoid this injection. There should be proper validations on the server end to avoid SQL injection.
The following example will make the process of SQL injection clear.

Example: Login form – when you enter text in the Username and Password fields of a login screen, the data you input is typically inserted into an SQL command. This command checks the data you’ve entered against the relevant table in the database. If your input matches table/row data, you’re granted access. If not, you’re knocked back out.

How to Test for SQL Injection Vulnerabilities:

Suppose we enter the following string in a Username field: `OR 1=1

The authorization SQL query that is run by the server, the command which must be satisfied to allow access, will be something along the lines of:

SELECT * FROM users WHERE username = `USRTEXT `AND password = `PASSTEXT`

…where USRTEXT and PASSTEXT are what the user enters in the login fields of the web form.

So entering `OR 1=1 — as your username, could result in the following actually being run:

SELECT * FROM users WHERE username = ` OR 1=1 — `AND password = `

1 is always equal to 1. So if you grant an access this means website is not secure.

Prevention Techniques: These are some of the few basic techniques that, if applied to the code, will go a long way in making the website more secure and robust.

Editing Lengths Of Form Components: There should be proper validation for field lengths. To restrict input fields to the absolute minimum- usually anywhere from 7-12 characters is fine. Doing so will make long queries unable to be input, since the field is only enough characters for smaller queries. This will actually not prevent an SQL injection, but will make the work harder for those trying to make use of one.

Data Type Validation: There should be proper data type validation implemented on all the form fields. Numeric fields should allow only the numeric values and text field should allow only the textual data. If a user had to input an age, make sure the input is an actual number. If it was a date, make sure the date is in proper format. Using this we cannot avoid sql injection, however it makes work harder for those trying to exploit an SQL server.

User Privileges: User privileges at database level should be applied properly. The main user that will be used in creating connection should not have the privileges to delete tables or database etc. It is better to be able to create a “super user” in one’s own database that can create, drop, and edit tables at will. The security-obsessive webmaster will want to make individual users that can only do one or two tasks at a time. This method is still useful for throwing attackers off track, as well as minimizing risk from areas of a website that aren’t critical to the security of the database.
Magic Quotes: Magic quotes are horrible for portability issues, performance issues, and they mess with other data that doesn’t need to be escaped

  1.   Many scripts made with magic quotes won`t work on servers that have (intelligently) turned the feature off.
  2. Performance loss is observed because not all of the data is being input into a database- we are wasting process time.
  3. Magic quotes are just inconvenient. They add an extra slash (\) to all of our form data, even when it might not be needed. To fix this, we have to use another process to fix it (If you are unfortunate enough to have used magic quotes, look up the stripslashes() function, and consider switching if possible)



The Code looks Good, but is it Search Engine Friendly too?

Wednesday, June 4th, 2008

Search Engine Friedly HTMLNo matter how good a developer is, each one makes few mistake while writing HTML code. And I am talking precisely about mistakes which the Search Engines don’t like – some small ones and some fatal search engine disasters. These mistakes happen not because we don’t know how to write an HTML code but because after we are done writing the code, we say to our selves, it’s done and it’s looking fine; why bother change it now for Search Engines. Not every developer is a Search Engine guru and very few know (or bother to know) that couple of such coding mistakes here and there might cause the site to choke to death. But don’t panic yet, it’s easy to avoid these mistakes – just consider the following while you code a website next time:

  • Make it a thumb rule to avoid repeating yourself. If it’s a commonly used object property, place it in CSS. If it’s a repeated Javascript, store it in an external file and call where ever required.

  • Don’t mess up the code with unused or unclosed DIV’s. If a DIV opens, it should close as well and if it doesn’t, it shouldn’t open. It’s as simple as that.

  • The most common web developer mistake – every page has it’s own unique title and description, please do not put the title and description tag in the include files.

  • Please make all links and references to images, CSS and JavaScript root relative by starting them with a slash, “/”. Dreamweaver users, please set the “Links relative” option to “Site root” in the Site Definition wizard. This is handy because root relative links don’t break when files are moved from one directory to another.

  • Don’t put too many files in a single directory. Keep the heirachy going and manage the files in different directories.

  • Use Validator to keep the code and CSS clean. Clean code is easier to manage then something that’s messed up.

  • Don’t use <br> for <p> tag as it’s unprofessional and results in inconsistent layout in different browsers.

  • Avoid spacer graphics and nested tables. Use heading tags, unordered lists and numbered lists to organize content instead.

  • Make it a habit to put a forward back slash ‘/’ at the end of every URL.

Image credit:Flickr




The dilemma of Page Rank Sculpting, follow or nofollow

Saturday, April 19th, 2008

While every one around the SEO corner is busy hoarding the page rank of their site using nofollow attribute in quest to rank the important pages of a website, I am quite sure this practice (page rank sculpting) is just an accident waiting to happen as webmasters will abuse it up to an extent that Google will do what they have done to ‘keyword meta tag’ – start ignoring it. After the public announcements and claims done by Rand Fishkin, Stephen Spencer, Danny Sullivan and even Matt Cutts, that directing the link juice to the important pages of a website improves the Search Engine Ranking of a website, the SEO community is using nofollow on anything they don’t want to rank for, claiming it a ‘wastage of link juice’ otherwise. But I personally believe that this nofollow practice is taking the SEO community no where, as webmasters have a license to get away to rank their websites even with a poor internal navigation and hence poor user experience. So obviously the nofollow era is facilitating more spammy websites making it to the top of the Search Engine lists. It’s just matter of time, when Google will take an evasive action.

SMX RedAlkemi page rank sculpting

If we have a look at the origin of a nofollow attribute, we find that nofollow attribute was made with the primary motto to combat comment spam (which it has failed miserably as comment spammers are still employed). Further Google found that nofollow can also help Google bots to firstly determine the most important pages out of huge websites with complex blog categories in little time and secondly the webmasters could use nofollow while linking to some website content which they don’t want to get associated with and vote to. Here is a recent precise statement made by Matt Cutts on use of nofollow attribute:

“The nofollow attribute is just a mechanism that gives webmasters the ability to modify PageRank flow at link-level granularity. Plenty of other mechanisms would also work (e.g. a link through a page that is robot.txt’ed out), but nofollow on individual links is simpler for some folks to use. There’s no stigma to using nofollow, even on your own internal links; for Google, nofollow’ed links are dropped out of our link graph; we don’t even use such links for discovery. By the way, the nofollow meta tag does that same thing, but at a page level.”

Now getting back to my anti-nofollow visionary, the nofollow tags also facilitate a fake information architecture. As we know Google ranks the sites with solid internal navigational architecture higher on SERP as these are the sites which provide rich user experience to the Google users as the important content is just 3 clicks away, nofollow isn’t helping to their cause. Coz what most webmasters are doing at the moment is hoarding the page rank and shooting it on the targeted pages even when the target page is nothing but pure crap and weakly linked from other pages of the site.

Having said that, please don’t take me wrong, as I am not questioning the effectiveness of page rank sculpting, because it’s working great at the moment, but I am not too sure how long will this nofollow rampage last: I am afraid not too long. So I have a simple advise to give – use nofollow but only after you have crystallized your internal navigation and don’t rely 100% on this nofollow ploy as you might soon see Google derank the websites with weak internal structure indulging in page rank sculpting. I am looking forward to SMX Advanced and hopeful that it might clear up the mounted clouds over rank sculpting dilemma.



Meet the family: Meta name= “robots”

Tuesday, April 1st, 2008

In my last post on SEO feast, I offered you so many things to eat – PR Bar, optimizer beer, Energy drinks and what not. But did you ever wonder, what do Search Engine bots eat? Yes they love eating fresh content & HTML on your website; but there are few things on your website, that you never want to feed bots with like – flash, silly javascripts, duplicate content, affiliate links (that pass link juice) etc. So how do you stop these dumb bots – Simple, by defining robots meta tag values:

<meta name=”robots” value=” <value> “

I just happened to stumble upon this cute flicker pic of five robots, I could relate to Google, Yahoo, MSN, Ask & Altavista. So I just simply used my paint brush and wrote their names accordingly. Looks so cool to me ! :)

botfamily1.jpg

And now that you have met the bot family, let’s discuss different values you can serve to these witty Search Engine bots:

  1. Index: Allows bots to index the page. This a default value, you need not define it on all the pages.
  2. Noindex: Search Engines will not index the page and hence the page will not appear in its results.
  3. None: It’s like shortcut for noindex, nofollow. “None” gives strict instruction to search engines – Don’t do any thing with the page at all.
  4. Follow: Tell search engine bots, to follow the links on the page and take them as a vote to the linking website ie. pass the link juice.
  5. Nofollow: Gives strict instruction to bots not to follow any links at all.
  6. Noarchive: Stops paparazzi bots from showing the cached version of the page in its reults.
  7. Nocache: Prevents MSN/Live to show the cached version of the page in its results.
  8. Nosnippet: Stops the bots from not only reflecting a snippet of the page in search results but also doesn’t let them cache the page.
  9. Noodp: Makes sure that search engines don’t use the description of the containing page in DMOZ as the snippet for your page in the search results.
  10. Noydir: Works just like noodp, but used exclusively for Yahoo!

BTW, you may also want to go through our comprehensive article on Working with robots.txt file. I hope you enjoyed the post. Cheers!
Image credit:
flickr.