26 November 2008

Skills needed to survive the IT Slowdown!!

You may ignore it, but have to accept the fact that global recession has also it the IT industry. It may even happen that before you open your eyes and smell the Coffee..your PINK SLIP might be ready in your Bosse's office. But hey! don't panic cause everyone knows that a highly Skilled person can never be out of work for a long time! So here are a few skills sets, which if you posses will definitely see you through this bad time!

1.Know your Framework
BE it ASP or PHP knowing the framework thoroughly will definitely put you ahead in the race. All ASP.NET developers might have already come to know that no matter how much you "think" you know ASP.NET there's already something new yet to be discovered and before you figure it out, Microsoft might have already updated the technology.

And as for PHP developers knowing a framework has become quite important. With the meteoric rise to fame of Rails, Django, and other MVC frameworks, developers have learned that they can build websites much faster with the help of these tools. Frameworks help you cut out much of the repetitive tasks that normal custom programming would require. Having knowledge of the top frameworks (Rails, Django, CakePHP, Symfony, and a few others), can give you a whole other dimension to your skill set.

2.Custom CMS themes
Designers and developers can always find work creating or customizing a CMS theme. As the popularity of CMS like Wordpress and Drupal have risen over the past years, so has the demand for creating themes for the software.

Many people use CMS to power their personal or business websites, so this work is always going to be around. A decent website needs a unique and usable design that reflects well on the brand behind it.

3.CMS Customizations and plugin development

CMS are great because it gives site owners with little technical know-how the ability to change aspects of their site on the fly with the help of modules. While most CMS platforms have a long list of modules to offer, many businesses and personal sites need more, and custom modules or plugins are the perfect solution.

Developers can have thriving businesses in CMS development and customization alone. Here are a few (and by no means all) of the top CMS platforms that could use plugin development and other customizations:

* ExpressionEngine
* Wordpress
* Drupal
* MovableType
* Joomla

4.PSD to XHTML services.
Another one of the more popular skills needed is converting Photoshop files (PSD) to XHTML files for template use. Because designers don't always know how to convert Photoshop layouts into template files, a CSS and XHTML ninja can always find work.
Because of the array of browsers now in common use and the niggling differences in how they render sites, you want to be a web developer who can build-out sites that display the same in any browser. This kind of design to code service is the most sought after of them all.

5.Javascript Plugin creation

Much like the rise of CMS and MVC frameworks, Javascript frameworks are just as popular. These Javascript frameworks are built with the ability to add custom functionality in the form of modules. If you're a developer who knows how to build custom Javascript modules for frameworks like jQuery or Dojo, you'll have plenty of work available. Here are some of the most
popular Javascript frameworks you might need to get a handle on.

* jQuery
* Scriptaculous
* Dojo
* MooTools

6.Facebook/MySpace applications-API Development
Facebook and MySpace have both opened up their platform to allow developers API access, and the demand for social network apps has been huge since then. A whole new industry for web development sprang up overnight, and hundreds of applications are now added on a daily basis. The social media application platform has been found to be very viral and potentially very lucrative.

Some of these applications are built to make money or drive brand awareness, but ultimately the applications can be very successful and viral if they're done properly. A solid developer can make a decent living creating Facebook and MySpace applications.
Social networks like Facebook require that you learn their own language of syntax, like the FBML (Facebook Markup Language), so there is a small learning curve to this skill.

7.iPhone & Mobile Applications development
Yet another platform-specific skill set, building Mobile applications can be very profitable, and much like the social media applications, a great skill for any developer to know. Making an iPhone app that is accepted into Apple's platform has an excellent chance at making great money or receiving tons of downloads.

This is a great thing for web developers because companies are starting to see the value in developing iPhone and other mobile technologies, and consequently will be wanting more and more applications developed in the future.

8.Ecommerce integration
Business web sites are always going to need ecommerce integration. Essentially, if you can take a language or framework (PHP or Rails) and fuse it with a payment gateway (like Paypal or Authorize.net), you'll do well for yourself. I'm predicting that we're going to see more paid services than free, ad-supported services being developed in the near future, as less money is
being doled out to startups.

As the economy turns sour and the ad industry starts to get a little tighter, websites that use a subscription-based revenue model will start to become more common. Having the knowledge to piece together integration with online banking services like Paypal and Google Checkout will be great skills to have.

9.Flash and Actionscript Knowledge

Flash animation can do a lot for a website. Flash can be used to create videos, interesting navigation, fun animated sequences, widgets, and many other useful things on the Internet. The flash technology can add a very professional dimension to any website, and large websites and corporations always pay to have their sites look professional, and often commission Flash animated interfaces to showcase their products. With search engines working on ways to have Flash communicated better with them, this is a skill that's sure to boom as the search technology advances.

10.Widget development - Google Gadgets

Widgets have changed how web development has been done in the past couple of years. With the advent of widgets, data has become more portable, interactive and most importantly, viral. It's in almost every web startup's business plan to include a widget or two at some point, mainly because it helps increase their audience and puts more eyeballs on their content.

Widget development requires knowing Javascript and/or flash, not to mention knowledge of the regular language that the parent site is built in.


As a Conclusion i would like to leave a message on behalf of everyone:
"I tried so hard and got so far but In The End it doesn't even matter!!!!!"

25 November 2008

Five JavaScript Best Practices

JavaScript is an extremely powerful and flexible scripting language. Unfortunately flexible, for many people, means fallible. I am going to highlight 5 best practices that you can use in any JavaScript project.

>>.First and foremost, keep your code simple, clean and well documented. This is by no means unique to JavaScript but many people seem to think it is the exception to the rule. Your code should naturally comment itself but it is also important to at least introduce every function. I recommend two versions, a fully documented and formatted version and then a compressed version that you use in production. There are a number of free online utilities that can strip out comments and pack your script. There is no need to push out the extra size required for the documentation and formatting.

>>.Second, keep your JavaScript in an external file. The only exception to this rule is if you have some very lightweight script specific to a single page or are setting up variables that cannot be done in the external JS. An external file results in greater scalability, maintainability and degradability. The correct way to reference an external JS file is as follows:

<script type="text/javascript" src="script.js"></script>

>>.Third, separate your JavaScript from the presentation layer. We have all heard of unobtrusive JavaScript but we still see inline script all the time. Instead of cluttering your font-end code with dozens of event handlers add them dynamically. There are exceptions to this rule so please use common sense and separate the layers when it makes sense. An example of adding an onclick event handler from JavaScript:

var div = document.getElementById('div');
div.onclick = new Function("processClick(this)");

>>.Fourth, properly define and scope variables. Many of the scripts I download hoping to use in a project I immediately throw out. The reason being that the programmer did not take the time to properly define and scope variables. Always reference the first instance of a variable by using var. Otherwise the only way someone can know if that is the first reference to that variable is by starting at the top and reading all the way down. It is also important to scope variables correctly. Don’t scope a variable on the global level unless you need it there. I also recommend differentiation of global and local variables though some kind of visual identifier such is all caps on global variables or some easily identifiable character.

>>.Fifth, don’t assume JavaScript support in the first place. Depending on your audience you may choose to disregard this suggestion but for mainstream websites I highly suggest coding with the minority in mind (an estimated 5-10% of web users do not have JavaScript enabled) and degrade your scripts gracefully. JavaScript should be considered as an added feature and not a dependency. An examples of this would be links, the most fundamental element of a web page.

<a href="javascript:processClick()">link</a>
<a href="#" onclick="javascript:processClick()">link</a>


If the user clicks the either of the links above with JavaScript disabled nothing will happen. However, with the code below they could still navigate.

<a href="link.html" onclick="processClick(); return false;">link</a>

24 November 2008

jQuery

jQuery is a lightweight open source java-script library (only 15kb in size) that in a relatively short span of time has become one of the most popular libraries on the web.

A big part of the appeal of jQuery is that it allows you to elegantly (and efficiently) find and manipulate HTML elements with minimum lines of code. jQuery supports this via a nice "selector" API that allows developers to query for HTML elements, and then apply "commands" to them. One of the characteristics of jQuery commands is that they can be "chained"
together - so that the result of one command can feed into another. jQuery also includes a built-in set of animation APIs that can be used as commands. The combination allows you to do some really cool things with only a few keystrokes.

For example, the below java-script uses jQuery to find all <div> elements within a page that have a CSS class of "product", and then animate them to slowly disappear:

$("div.product").slideUp('slow').addClass("removed");


As another example, the java-script below uses jQuery to find a specific <table> on the page with an id of "datagrid1", then retrieves every other <tr> row within the datagrid, and sets those <tr> elements to have a CSS class of "even" - which could be used to alternate the background color of each row:


$("#datagrid1 tr:nth-child(even)").addClass("even");


[Note: both of these samples were adapted from code snippets in the excellent jQuery in Action book]

Providing the ability to perform selection and animation operations like above is something that a lot of developers have been begging for years. Such simplicity has never been offered before by any other development environment or library.

As a result even Microsoft has accepted this technology and they have already began shipping their Visual Studio 2008 package with jQuery preinstalled and with full support for it including intellisense. According to Scott Gu (Microsoft Developer, Blogger) - Microsoft is even working on adding new features and bug fixes to the jQuery Library.

22 November 2008

How to Set MaxLength of a Multiline TextBox

Ever tried setting up the maxlength property of a ASP.NET Multiline TextBox and ended up finding out that its doesn't work at all!! HEre's a simple solution using Javascript..
You can use the below script to set up the maxlength of a Multiline TextBox or even a HTML TextArea Tag:

<script type="text/javascript" language="javascript">

function ismaxlength(obj){
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
if (obj.getAttribute && obj.value.length>mlength)
obj.value=obj.value.substring(0,mlength)
}
</script>

Inside any textarea you wish to add a "maxlength" attribute to, simply do the following:

<textarea maxlength="40" onkeyup="return ismaxlength(this)" ></textarea>
or
<asp:TextBox ID="txt1" runat="server" maxlength="40" onkeyup="return ismaxlength(this)" />

The part in green is what you should add, with "40" obviously being the maximum number of characters accepted by this textarea.
Note: In ASP.NET setting up the maxlength might not work. Hence you should replace the textbox with a textarea and run it as a server control using runat="server"

21 November 2008

Hide/Show Div Elements Using JavaScript

JavaScript can be used to bring interactivity to you web pages by performing client side scripting. Using the style property of an HTML element, the element can be hidden or shown to the user based upon the required condition. For Example:

<script>
function setDiv(id)
{
if(document.getElementById(id).value==0)
{
document.getElementById('myDiv').style.display='none';
}
else
{

document.getElementById('myDiv').style.display='block';
}
}
</script>

This function can be called on any event of another HTML element as:

<select id="mySelect" name="mySelect" onchange="setDiv(this.id)">
<option>Select one</option>
<option value="0">Hide</option>
<option value="1">Show</option>
</select>

<div id="myDiv" name="myDiv" style="display:none;">
<span>Hi......!!!!!!! </span>
</div>

You can place any thing inside the myDiv element. Further more buy using some jQuery you can even add some animation effects.

18 November 2008

Using T-SQL to Simplify Coding

A sign of a good web developer is determined by his knowledge of SQL. Generally speaking if you know SQL well (be it SQL Server or MySQL) chances are that most of your coding will be reduced dramatically saving you lots of time and also increasing website performance.
Take for example if you wanted to change the status of a registered user from Active to De active or vice verse on the click of a single button and you are using a int field for it in the database( 0 and 1). Now as a novice what I used to do is run a SELECT query and get the user status field. Then compare the status in client side scripting language, and then again run a Update query to change the user status.
But as i studied more on SQL i found out that this could be done just by using a single query/stored procedure and only passing the id of the user to the query as follows(for SQL Server):

Create Procedure changeStatus
@ID integer
BEGIN
Declare @status integer
Select @status= status from UserTable where UserId=@ID
if @status=1
Update UserTable set status=0 where UserId=@ID
ELSE
Update UserTable set status=1 where UserId=@ID
END
END

So you see this has saved me a lot of time and coding. Also modification also becomes easy. Hence if you still think that SQL knowledge is not that important for Development; its time to wake up and brush up on YOUR SQL SKILLS!!!!!!

15 November 2008

What is Web 2.0?

Ever since i started with Web Development, I have been constantly coming across this WEB2.0 word..be it websites, blogs or online pop ups. I neglected it for a long time until finally decided to read about it.
Well here's a few things i found out about WEB 2.0
1. Its not a technology or Web Standard. It's just a way of how new Web Applications are developed.
2. Most of the Web 2.0 buzz has been related to Google Technology as its constantly making big progress towards making Web Applications more and more like desktop apps.
3.Web 2.0 is quite an old term and has been regularly re-phrased.
4. Use of technology such as AJAX, Silverlight, Flash etc.
They have some good stuff written about WEB 2.0 on Wikipedia. You might want to see for learning more.
So this WEB 2.0 term really doesn't mean much to us developers as long as we keep our imaginations flying and showing our creative work....May be as i write this blog post some extra minded people may even be talking about WEB 3.0, 4.0 ,5.0 ......

12 November 2008

Best Browser For Web Development




Which is the best browser for web development?
The Browser war may be at its highest intense level ever right now with Internet Explorer,
Mozilla Firefox, Opera, Safari haven released their latest versions promising a lot to the
customers and Google haven jumped into the arena with its latest Chrome browser with all new
neat javascript supporting technology.
But all these new web browsers have also put us web developers into a great jepoardy!!! As we have to make sure that our web site runs similarly in all of the above (at least these 3 browsers). Even the testers are having hard time looking at 3 to 5 different windows of the same page at the same time(Good luck to them too!!).

In this all chaos the one browser that i trust and use for my development purpose is Mozilla

Firefox (latest version). Some of its best features are:
1.Tabbed browsing....Now every one seems to have this one
2.Support for Addon Tools and Themes
3.Definately faster browsing speed than IE
4.Huge open source development team!!

Apart from this Firefox is also well responsive to CSS and Javascript. It also has very
powerful web development Adon tools which are worth mentioning here.
1.FireBug-For tracking CSS,Javascript & HTML
2.Web Developer Bar -Provides advanced features including error reporting of Javscript
3.Html Validator -W3C standard HTML validator

One may now think that i am trying to promote Mozilla here, but honestly i have tried IE, Firefox 3 & Chrome, and Firefox surpasses them all with a great margin (provided you install the addons).
Also i would like to mention that Google Chrome seems to be quite promising browser and will definately catch up within a year or so. One unique feature of chrome that i found is that
even if one tab in a window hangs/freezes for some reason you don't have to close the entire
window (I experimented this by putting a javascript into a endless loop)
I havent played with Safari or Opera yet (never needed to!!) but if you readers have
anything worth mentioning about them please feel free to post.
Right now MOZILLA FIREFOX IS THE BEST FOR ME!!

11 November 2008

Javascript function to open a popup

This is a very important and handy javascript to open a popup window, useful in showing small bits of information to user without taking them to different page.

<script> function popup(url) { newwindow=window.open(url,'popup_name','height=500,width=400,left=100,top=100 resizable=yes,scrollbars=yes,toolbar=yes,status=yes'); if(window.focus){newwindow.focus();} } </script>

This function can be called on any event like mouse click by passing the url of the page to be opened in a popup.
Please Note: Firefox does not allow the popup window to be non resizable, hence this feature can not be seen in Mozilla Firefox.

10 November 2008

FCKeditor Common Problem

FCKeditor Problem:
A Potential Dangerous Request Form value was detected from client("")

FCKeditorFCKeditor is great free Web-based HTML text editor to integrate into your website for HTML
editing. Be it ASP.NET or PHP it provides quite a host of features like
fileupload, stylesheets, image uploads etc.
But a very nagging problem that is associated with Fckeditor while using in ASP.NET is the above
titled error.
This error is mostly received when a page containing the Fckeditor server control is loading and
suddenly the user clicks on any other link/button on the page before the current page loads
completely.
Keep in mind that this is a ASP.NET security feature.
A very simple solution to this problem is to set the Page Directives ValidateRequest property to
false. This can be set in the first line of the aspx page as follows..

<%@ Page language="C#" CodeFile="index.aspx" Inherits="Index.aspx.cs" ValidateRequest="false" %>

Note: ValidateRequest is a ASP.NET security mechanism that protects a website from Cross Side Scripting attacks. Disabling this would leave your site vulnerable to such attacks! You can find more about this CSC by googling around.

07 November 2008

Multiple web applications

Disabling web.config Inheritance for Child Applications in Subfolders in ASP.NET 2.0!!
(making multiple web applications work together)


Each ASP.NET Web Application has its own configuration file called web.config file.
In fact every directory in ASP.NET application can have one. Settings in each web.config file apply to the pages in the directory where its placed, and all the subdirectories of that directory.

This is called Configuration Inheritance.

So if you create an ASP.NET application and set its web.config file, add custom HttpHandlers, UrlRewriting module etc and try to create another ASP.NET Web Application in the subfolder, you can end up having problems because application in the subfolder will inherit all the settings from its parent web.config.

So if you for example setup UrlRewriter module in your root web applications like this:

<httpModules>

<add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter"/>

<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

</httpModules>

And in your child web application (in subfolder) you are not using UrlRewriteModule, then if you try to run the child Web Application in your browser, you will get error like this:
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Could not load file or assembly 'UrlRewritingNet.UrlRewriter' or one of its dependencies. The system cannot find the file specified. (d:\Projects\VS\AspDotNetFaqProject\Website\web.config line 89)

Source Error:

Line 88: <httpModules>
Line 89: <add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter"/>
Line 90: <add name="ScriptModule" type="System.Web.Handlers.ScriptModule,

System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
Line 91: </httpModules>


What happens here is that because UrlRewriteModule is configured in the parent's folder web.config file, this setting is inherited by the child application's web.config file, and because of this ASP.NET is looking for the UrlRewriteModule DLL file in the BIN directory, and off course its not there.

Luckily, there is a easy solution to this problem.

First thing you can do is to remove the problematic HttpModule in your child application web.config file using the remove command like this:

<httpModules>

<remove name="UrlRewriteModule" />

</httpModules>

This would remove the handler and your application would run fine.
Or you could use <clear/> command like this:

<httpModules>

<clear/>

</httpModules>

This would clear all the HttpModules in your child application.

But what to do when there are many settings in your root web.config file that you don't want to be propagated to your child applications?

Here is the solution:
With the <location> attribute with inheritInChildApplications set to false in your root web.config file you can restrict configuration inheritance.
So, by wrapping a section of your web.config file in <location> attribute you can instruct ASP.NET not to inherit those settings to child applications/folders and their web.config files.

In fact you can wrap the whole <system.web> section in one <location> attribute and disable configuration inheritance so none of the parent settings from <system.web> will be inherited to the child applications you create in subfolders.

Here is how to use this in practice:

<location path="." inheritInChildApplications="false">

<system.web>
...

</system.web>
</location>

NOTE: Do remember that if you do this, you need to manually insert all the settings you need in the <system.web> for your child applications because none of the settings from the root web.config will be propagated...

01 November 2008

Enforcing SSL Security For WebPages

Many times we need to add SSL security to few of our web pages for secure transactions.
Now initailly when i wanted to do so i tried to hard code the link by using "https://mylink.com ". But if the user typed the link as "http://mylink.com" the page still opened in non secure mode.
To overcome this problem i found a simple function that automatically detects if the page is in secure mode or not and then force it to go into secure mode.

Here is the code for ASP.NET 2.0:

protected void ForceHTTPS()
{
if(!Request.IsSecureConnection)
{
string server_name=HttpUtility.UrlEncode(Request.ServerVariables["SERVER_NAME"]);
string forceurl="https://"+ server_name + Request.FilePath;
Response.Redirect(forceurl);
}
}


and for PHP 5:

function ForceHTTPS()
{
if($_SERVER['HTTPS']!="on")
{
$forceurl="http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
header("location:$forceurl");
exit;
}
}

These can be very handy when only a few web pages need SSL.
Note: Please make sure that the server has a valid SSL certificate( need to purchase) for https:// to work other wise you will get page not found error or certificate expired error.