Learning jQuery

jQuery is a comprehensive free javascript library that is a must for every designer and developer. It is extremely powerfull and very easy to learn and use and saves a developer a hell lot of time. It can be used to build powerful interactive User Interfaces and sites.You can take a look at some awesome sites built using jquery at jQueryStyle.com to better understand what this little wonder library is capable of.
The library was first written by John Resig back in 2006. The current realease version at the time of writing is 1.3.2. Due to its DOM centered approach, jQuery is very easy to learn for a person who already has some css and xhtml background.
You can download your copy of jQuery from the homepage of jQuery.com
There are a number of free resources on the web which teach you jQuery right from the start, but i would recommend LearningJQuery as it is well documented and has three separate sections for beginner,intermediate and advanced levels. LearningJQuery is authored by Karl Swedberg and some other authors. it is a good place to start with for people new to jQuery. Also the jQuery Docs is good place to refer to whenever you find yourself stuck with a problem.


Why not to rely on free web hosts?

I launched Scrapground.co.cc around an year ago when Orkut enabled html scraps. The site was my first project as i had just taught my self css and php. It featured an online “scrap creating tool” which designed your scrap in 40 different html templates and all you had to do was copy and paste the code given below any template into your friends scrapbook. The site was hosted for free at www.x10hosting.com and had a free .co.cc domain. It worked fine untill i moved to India and stopped logging in into my hosting account frequently, i got suspended a couple of times for inactivity and last week i found out to my surprise that my hosting account had been terminated for inactivity!!! I lost both of my sites as i didnt have a backup of it on my local machine!!! :(

The lesson i learnt were : Never rely on free webhosts and if you cant do without a free host Take regular backup of your site so even if you are kicked off the hosting service you can still quickly switch to another free host.

There are even more reasons as to why free hosts are highly un-reliable, like:

  • Limited or low bandwidth
  • Limited or very less web space
  • Frequent server downtimes
  • No or limited customer support
  • Lack of freedom/ restrictions
  • Search Engines ignore you

Creattica – best design inspiration site

Every designer, at the start of his career, needs some inspiration, i mean great ideas dont simply come out of nowhere in a beginners mind. We all have been or are copiers, we need some push in the right direction, some ready examples of great design work really boosts up our own creativity level, this is exactly what inspiration sites do, and www.creattica.com is my most favourite site for inspiration. It features thousands of user submitted photoshop artwork, beatiful web designs and impressive business cards. So if you are one of those looking for some great examples to learn from (not to copy from) then make sure you visit www.creattica.com.


How to write browser specific css

Usually when it comes to browser specific css we often mean IE specific code. You might be aware of the conditional comments tag you can use to target different versions of Internet Explorer. But 2day i’ll be showing you a much simpler way to tame IE 6 and 7 to your needs . Lets suppose for some reasons you want a div to have a height of 10px in all browsers, but a height of 12px in IE 7 and 15px in IE 6, here is how it can be done without the use of conditional comments:

div {
//for all browsers

//for IE 6,others will ignore this

//for IE 7

isnt it much simpler than writing conditional comments?
The same technique can be applied to other properties as well. You can even use this hack to request your IE 6 users to upgrade to a modern browser,how? Just make a div and write your message in it and set its “display” to “none” while set “_display” to “block”.This will simply tell all browsers not to display the div while IE 6 will. Hope you enjoyed the post.


Javascript quadratic equation solver

Here is a simple javascript that solves quadratic equations of the form ax²+bx+c = O. You just have to specify the values of a ,b and c and the script then calculates the two real roots alpha(x1) and beta (x2)  of the equation. The script also tells you if the equation has a real root or not, depending upon the value of D (Discriminant). The equation is solved using the quadratic formula x = -b±(b²-4ac)½/2a .
The script is located here ->http://www.dynamicguru.com/files/quadratic_equation.html

Here is the source code of the script :

//Place this within the  section
<script type="text/javascript"><
function calculate()
     var a=prompt("enter value of a");
     var b=prompt("enter value of b");
     var c=prompt("enter value of c");
     var a2=2*a;
     var ac=4*a*c;
     var dis=b*b;
     var dis=dis-ac;
        document.getElementById('Equation').innerHTML='No real roots exist since Discriminant < 0 !<br />D = ' + dis + ' <br />The Equation = ' + a + 'x&#178; + ' + b + 'x + ' + c + '<br />';
        document.getElementById('x1').innerHTML='&nbsp; ';
        document.getElementById('x2').innerHTML='&nbsp; ';
        var dis_sqrt=Math.sqrt(dis);
        var x1=-b+dis_sqrt;
        var x1=x1/a2;
        var x2=-b-dis_sqrt;
        var x2=x2/a2;
        document.getElementById('Equation').innerHTML=" Equation = " + a + "x&#178; + " + b + "x + " + c + "<br />";
        document.getElementById('x1').innerHTML=' Alpha (x1) = ' + x1;
        document.getElementById('x2').innerHTML=' Beta (x2) = ' + x2;

//Place this within the section:
<h1><a onclick="calculate()" href="#"> Click to solve »»</a></h1>
    <div id="Equation"></div>
    <div id="x1"></div>
    <div id="x2"></div>


.htaccess – A quick guide

.htaccess , Whats is it?

According to Apache:

.htaccess files (or “distributed configuration files”) provide a way to make configuration changes on a per-directory basis. A file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory, and all subdirectories thereof

‘Directives’ usually refer to the commands that are contained in the .htaccess files, which control or modify your server’s various behaviours. Many free and paid web hosts permit you to change and modify your .htaccess files but remember if you have a website running on Yahoo Geo Cities,Goolge sites or freewebs then this article is meaningless for you cause they dont allow access to .htaccess files

What can you do with .htaccess?

.htaccess can be used in many different creative ways , but its most common usage is for:

  • Setting up custom 404 error pages
  • Enable/Disable directory browsing
  • Change default homepage for a directory
  • Block certain users from accessing your site
  • Block specific refferers
  • Prevent certain files from being viewed
  • Block Hotlinking

How to create one?

Create a text file from any text editor, Note Pad,Text Pad and save it as .htaccess ( remember the period before htaccess and no .txt extension ).
Upload it in your home directory…The rules in .htaccess file apply to all the sub directories in your files directory

Doing some cool stuff

Now here comes the real thing…
To enable your server to use a custom 404 file not found page for broken links or URL typos…
include the following code in your .htaccess file:

[code lang="php"]
#The page notfound.html should be in the same directory as your .htaccess
ErrorDocument 404 /notfound.html 

#Alternatively you can specify just raw html to be used instead of a page
ErrorDocument 404 "<h1>yikes! that  page passed away a while ago...</h1>"

Enable / Disable directory browsing
[code lang=”php”]
Options +Indexes
## Block some specific file types from showing
IndexIgnore *.avi *.mp3 *.pdf

Change directory homepage

[code lang=”php”]
##the pages are used in order
DirectoryIndex myhomepage.html index.html index.php

Block some users from accessing your site
[code lang=”php”]

order deny,allow
deny from
deny from
deny from .hackers.com
allow from all

2017 All rights reserved | Powered by WordPress
Back to top
Theme by dynamicguru.com