Posted by: msh134 on: November 19, 2008
When working with JavaScript in one of my projects I needed to trim strings and pad them. I googled for a solution and many sources I have got the following codes and sharing with you.
Trimming:
//trimming space from both side of the string
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g,"");
}
//trimming space from left side of the string
String.prototype.ltrim = function() {
return this.replace(/^\s+/,"");
}
//trimming space from right side of the string
String.prototype.rtrim = function() {
return this.replace(/\s+$/,"");
}
Using Trim Functions:
//write the code given above
var str = " black ";
alert("a" + str.trim() + "b"); //result "ablackb"
alert("a" + str.ltrim() + "b"); //result "ablack b"
alert("a" + str.rtrim() + "b"); //result "a blackb"
Posted by: msh134 on: October 28, 2008
I am a fan of CodeIgniter for its ease of use. I have developed several ecommerce projects using this “beautiful” framework. While working on my first ecommerce project with CodeIgniter, I faced a problem with URLs. The site was suppose to use both “http” and “https”. But with CodeIgnitor we can define one base URL, which can be either “http” or “https”. Then I came up with an idea and now I am going to share that idea with you.
Posted by: msh134 on: June 21, 2008
I have modified the plugin for DOMPDF which is found in CodeIgniter forum. I have added the paper size and orientation parameters. Here is the code to share with you.
Posted by: msh134 on: June 21, 2008
I was implementing PDF generation in one of projects which is built with CodeIgniter. I searched for PDF support for CodeIgniter and found issue. I was happy, but the problem was with the PDFLib. Its not free and our client would not buy it. I thought that DOMPDF will not work without the help of PDFLib. Soon I loss my happiness and started looking for an alternate solution. Then our team decided to use HTML2FPDF. But the result was not satisfactory. We had to rewrite our html files. It was lacking lots of HTML support. I was not happy with the output. So I started googling again for a PDF library. While searching I came accross a library called HTML2PS/HTML2PDF. But, it seemed to me complex. I again started searching for any solution which will help me use DOMPDF in my project without PDFLib. At last I got the solution from DOMPDF site
.
Posted by: msh134 on: June 21, 2008
I have used DOMPDF in my project. But I was facing problem with Attachment. In FireFox it was working fine. But in Internet Explorer (I used IE 6) it ended with an error. In IE it was showing the download dialogue box offering the script page I used to generate the PDF file. When I tried to download the file it showed an error.
Posted by: msh134 on: June 21, 2008
Based on my last post on paging using PHP and MySQL, I have coded this class. It is very easy to implement and it will save your time. Here is a code snippet to show how simple to use it.
Posted by: msh134 on: June 21, 2008
Date control is a combination of three drop downs with month, day and year valus. It can be used as an alternative to the date picker control. Suppose a user needs to select a date before/after 10 years. At this point selecting the date with a date picker will not be easy and time consuming. So, in this situation, this control may be helpful.
Posted by: msh134 on: June 21, 2008
From various sources I have collected the following regular expression patterns. They helped me a lot in front-end and back-end validation.
Pattern: ^[a-zA-Z_ ]+$
Description: Allows only ‘A-Z’, ‘a-z’, space ( ‘ ‘ ) and underscore ( ‘_’).
Pattern: ^[a-zA-Z0-9_ ]+$
Description: Allows only ‘A-Z’, ‘a-z’, ‘0-9′, space ( ‘ ‘ ) and underscore ( ‘_’).
Posted by: msh134 on: June 21, 2008
This game is based on a paper game, Snake and Ladder. You may have played this game before. I have added nothing more. I have just programmed it for my nephews and nieces. They give me the inspiration for designing and programming this game. Hope you will like it.
Posted by: msh134 on: June 21, 2008
This is a puzzle game and it is freeware. You can freely distribute to your friends. It is mainly developed for children and for the beginners of computer operation. This will help them to improve their mouse movement. But anyone can play it and have fun. It is the first edition of the game. In this edition I have included 5 pictures’ puzzle. Hope you will enjoy the game.