HTML code: <form action="login.php" method="post" id="login"> <fieldset> <legend>Login</legend> <label for="username" class="label">Username</label> <input type="text" name="username" id="username" class="text" maxlength="30" /> <label for="password" class="label">Password</label> <input type="password" name="password" id="password" class="text" maxlength="30" /> <input type="checkbox" name="remember" id="remember" /> <label for="remember">Remember me</label> <input type="submit" name="submit" value="Login" /> </fieldset> </form> Javascript code: The first javacript snippet will be used to store username [...]
Continue reading Store login information in cookie using jQuery
It is not uncommon for a WordPress blog to display a list of all posts in an alphabetical order. I was using <?php wp_get_archives(‘type=postbypost’);?> to display all posts by post title but I couldn’t find a way to sort the post titles in an alphabetical order. After looking at the source code (general-templates.php), I noticed [...]
Continue reading A list of all posts in an alphabetical order
jQuery Calendar Widget Plugin A simple jQuery Calendar Widget Plugin with a month view. You can specify which month you would like to display or have it display the current month. With just 100 lines of Javascript code, this plugin is light-weight and is perfect for its purpose. Recommended Books on jQuery jQuery Cookbook: Solutions [...]
Continue reading jQuery Calendar Widget Plugin
jQuery validation plugin – demo A simple form validation plugin (using jQuery) that checks that all required fields are filled in when a form is submitted. Recommended Books on jQuery jQuery Cookbook: Solutions & Examples for jQuery Developers jQuery in Action Technorati Tags: jquery, javascript, plugin
Continue reading jQuery validation plugin
jQuery gallery plugin – demo An accessible gallery plugin (using jQuery) that replaces the main image and image heading on the fly when a thumbnail is clicked. The Previous and Next links as well as the current image position are updated automatically. Recommended Books on jQuery jQuery Cookbook: Solutions & Examples for jQuery Developers jQuery [...]
Continue reading jQuery gallery plugin
Backuping a single table from a database mysqldump -u -p database_one table_name > /var/www/backups/table_name.sql Restoring the table into another database mysql -u -p database_two < /var/www/backups/table_name.sql For more Linux commands, please refer to: Practical Guide to Linux Commands, Editors, and Shell Programming
Continue reading Backuping and restoring a single table using mysqldump
DELETE FROM `tablename` WHERE `created` < DATE_SUB(NOW(), INTERVAL 5 DAY); DELETE FROM `tablename` WHERE `created` < DATE_SUB(NOW(), INTERVAL 1 MONTH);
Continue reading Delete rows older than x days or x months in MySQL
The following javascript snippet will get the name of a random file from a list of files specified. <script type="text/javascript"> //name of files filenames = [ "filename1.gif", "filename2.gif", "filename3.gif", "filename4.gif" ]; //get a random entry from an array of filenames var filename = filenames[Math.floor(Math.random()*filenames.length)]; //display filename here document.write("path/to/file" + filename); </script> Technorati Tags: javascript, snippet
Continue reading Display a flash/image/text file randomly using javascript
du -hs /var/www/ You may omit the directory path if you’d like to find out the size of the current directory that you are in. du -hs For more Linux/Unix commands, visit Useful Linux Commands page or refer to the following book. Practical Guide to Linux Commands, Editors, and Shell Programming
Continue reading Get directory size using Linux command
In PHP, exporting data into an excel file (.csv) can be achieved very easily by sending a raw HTTP header. And having a formula in cells is no brainier either (and I only found that out after searching through google and not finding any solution – hehe). The following is a rough example of how [...]
Continue reading Export into excel with formula in PHP
Hello! Welcome to Web development blog! My name is Ei Sabai and on this blog, I write about web development, mobile app development, latest web technologies and the likes. Read more 

