amcharts – dynamic data generated with PHP

Hits: 3195  

AmCharts is a set of Flash charts for your websites and Web-based products. AmCharts can extract data from simple CSV or XML files, or they can read dynamic data generated with PHP, .NET, Java, Ruby on Rails, Perl, ColdFusion, and many other programming languages.




Hits: 1627  

pdftohtml converters  PDF documents into HTML format, which is more suitable for Internet publishing. The converter produces HTML documents with texts, pictures, graphics and bookmarks.

pdftohtml software does not require Adobe Acrobat, or even Acrobat Reader.

Install pdftohtml on Fedora/Linux:

# yum install pdftohtml
# which pdftohtml

Usage: pdftohtml [Option] <PDF File> [<HTM File>]


pdftk – fedora – merge pdf files

Hits: 2351  

Pdftk allows to manipulate PDF easily and freely. It does not require Acrobat, and it runs on Windows, Linux, Mac OS X, FreeBSD and Solaris etc.


  • Merge PDF Documents
  • Split PDF Pages into a New Document
  • Rotate PDF Pages or Documents
  • Decrypt Input as Necessary (Password Required)
  • Encrypt Output as Desired
  • Fill PDF Forms with FDF Data or XFDF Data and/or Flatten Forms
  • Apply a Background Watermark or a Foreground Stamp
  • Report on PDF Metrics such as Metadata, Bookmarks, and Page Labels
  • Update PDF Metadata
  • Attach Files to PDF Pages or the PDF Document
  • Unpack PDF Attachments
  • Burst a PDF Document into Single Pages
  • Uncompress and Re-Compress Page Streams
  • Repair Corrupted PDF (Where Possible)

Install pdftk on fedora/linux:

# yum install pdftk
# which pdftk

Merge Two or More PDFs into a New Document
# pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf

Resume Builder pdf2txt, word2txt

Hits: 1734  

Reading PDF Files

XPDF package includes “pdftotext.” You have to install XPDF/pdftotext then run the following PHP statement to get the PDF text:

$txtcontent = exec('/usr/local/bin/pdftotext svnlabs.pdf -');

Reading DOC Files

This package is called Antiword. Here’s the PHP code to grab the Word DOC content:

$txtcontent = exec('/usr/local/bin/antiword svnlabs.doc');

Publish HTML2PDF

Hits: 1807  

HTMLDOC converts HTML files and web pages into HTML, PostScript and PDF files suitable for on-line viewing and printing. HTMLDOC is used for anything that needs to be viewed or printed including on-line billing, books, financial statements, automated network configuration guides, mailing lists and labels, marketing flyers, quarterly reports, technical manuals, and users manuals. We can use HTMLDOC for all of documentation and reports, and it is the core of our PDF-o-matic demonstration page.


A limited-use open source version is also available at

# htmldoc --webpage -f output.pdf filename.html ENTER

# htmldoc --book -f 12book.pdf 1book.html 2book.html --titlefile bookcover.jpg ENTER

Configure Amazon EC2

Hits: 2121  

1.Boot 2 linux servers on EC2
2.Assign elastic IP to each of them
3.Register a domain (eg
4.On the domain settings – create 2 host records – and and point each record to each of the elastic IPs.
5.On your 2 nameserver instances – create dns zone for ns1. and ns2 respectively
6.Make ns2 a slave of ns1 – you can if you wish add ns3… ns4.. etc etc but its not necessary unless your site is getting millions of users.
7.Boot another EC instance and install the Scalr application.
8.Create a user on ns1. called “named” that has permissions to update the dns zone records on ns1.
9.The DNS settings of the scalr application will refer to the nameservers ns1. with user “named” and password as set on ns1.
10.Your application for example will have the domain  Register this domain and set its nameservers to your ns1. and ns2 mentioned previously.
11.You need to first create a new zone file on ns1 for
12.In Scalr when asked for the application domain name – simply enter – and scalr will handle the rest.


You will need to register a domain name with a domain registrar.  After registering, you will need to enter your NS records for the domain name.  The NS records should point to a Domain Name Server (DNS).  Most registrars require at least two DNS servers to eliminate a single point of failure.

Some registrars provide free DNS services.  If you choose such a registrar, you would need to add a CNAME record for your sub-domain and ask any DNS application support related questions to your registrar.

Alternatively, you can launch and configure your own DNS servers on Amazon EC2.  A popular choice for Linux based DNS servers is BIND:

Another option is to outsource your DNS servers using a third-party provider, for example


Lab Tips

Hits: 2858  

1. Delete all information from databse related to, if deleting user or any content from CMS.
2. Use PDO, ADO, Pear, Zend etc. library to connect to database.
3. Take regular backup for database.
4. Use better naming convension.

1. Use better naming convension.
2. Take regular backup for folders.
3. Protect project’s folder to unauthorized access, just put index.html or use apache security.
4. Folder name are case sensitive on servers like linux.
5. Don’t use 0777 permission on any folder use 0755.

1. Use better naming convension.
2. Use better documentation for web files, apply comments for coding and indent it.
3. Make consistency in DB, Filesnames, Variables, Page design.
4. Take regular backup for files.
5. Use caching for file to make site speed more fast.
6. Create debug files .txt, .log, .html etc. (fopen() | fwrite()) for tracking logical bugs.

1. Use version number in image URL to avoid image caching.
(<img src=”san.jpg?ver=123″ alt=”san” />)
2. Images should have Etags, Max Age and far future expired header for caching.
3. Use a global funtion to display images ( draw_images($src, $attr); )

1. Use better naming convension.
2. Use encryption class (md5, sha, base64 etc. with salt) for storing password and important data into database.
3. Spidering web page (Curl, Pear etc.) is used for getting content of web page.

1. Use function or include files for multiple use of web data to make reusability, integrity and productivity.
2. Use PHP session ID, remote IP and page name on increment views/hits.
3. Make function to load CSS, JS, Links, Forms & Elements, Images, Iframes etc. on webpage. (load_css_file(), load_js_file()….)
4. Looping should be start from Left to Right…

1. Use better naming convension.
2. Use defined variables/constants for folder names, DB table names, Files and global variables (avoid hard coding, be happy coder).

1. Avoid inline CSS on pages because it effect the page load time & speed also it matter in W3C validation.
2. Combine multiple CSS file in a single file with cached version.
3. Avoid conflict in CSS.
4. Avoid CSS expressions.
5. Use CSS Sprite for images.

1. Avoid inline JS on pages because it effect the page load time & speed also it matter in W3C validation.
2. Combine multiple JS file in a single file with cached version.
3. Use valid syntax for browser checking in javascript.
4. Avoid duplicate JS function.

1. Minimize the errors in HTML closing tags etc.
2. Use proper hyrarchy for HTML tags.
3. Use Math.random() in Ajax URL as parameter.
4. Send URL as parameter after encodeURIComponent() similar to urlencode() in PHP.
5. Use file_get_contents($url) for first time filling Ajax DIV.
6. Use new window to display javascript alert debug messages as append messages in log files.
7. Use Ajax Cached version.

1. On login page username/password should be case sensitive.
2. Open terms of use page in popup window on registration page.
3. Use better UI for Errors/Success messages.
4. Use cancle button near submit button.
5. Use captcha code on pages by session value to avoid Spams.
6. Put valid ALT values in IMG tags.
7. Use Enter button event on form’s submit control.
8. Use scrolling DIV on webpages for better GUI.
9. Use returnto parameter for redirecting page after login.
10. Use remember option on login page.
11. Use valid/correct statements in error/success/warning messages.
12. Use dynamic Title and Meta tags on page.
13. Use error pages like 404, 500 etc. by .htaccess
14. Use good NO/Blank image for image not found.
15. Use htmlspecialchars() in strings displayed on webpages for W3C validations.
16. Use favicon for webpages for better GUI.

1. Use good words like Dear, Regards, Thanks etc. in emails.
2. Attach some links, images, videos etc. for proper understanding.
3. Use reference and ref. # in emails.

1. Use IDE like APTANA, Dreamweaver, Zend Editor.
2. Use DW’s context menu for HTML/PHP code to avoid W3C errors/warnings.
3. Use FireFox plugins for development (Web Developer, Firebug, Scribefire, ColorZilla, FireFTP, S3Fire, ElastoFox, Gtalk, GrabScreen, YSlow, FireShot etc.) for site’s speed, performance and optimization.
4. Make sure we are using secure FTP, Email Client….
5. Command Line tools (putty, CMD etc.) are very good utilities for batch processes and large files.

1. View source and display function (echo, print etc.) are very useful for finding bugs and faults.
2. Try to search visual concept like jQuery, Ajax etc. on google images search engine.
3. Use google operator for getting better results.

Keep browsing, happy coding…………