20 shots. 3 opportunities. 1 success.

No wireless remote control.

This is my first time experience of shooting lightening. I pressed the button with finger to take a photos but it caused blurring images.


Referencing Firefox Default Preferences from JavaScript

Firefox preferences denote configuratiosn or some other information saved for Firefox. It can be accessed with URL (about:config) manually.

Steps to view preferences manually:

  1. Open firefox
  2. Enter ‘about:config’ in address bar
  3. Press Enter key
  4. Preferences table will be displayed

Referencing from JavaScript

In some occasion, it is necessary to modify the preferences values by automatically.
The steps necessary to reference the preferences system from within the JavaScript code could have been made simpler, but it is not too bad. First, your file must have access to the Preference Manager component. To do that, you must add the following line of code to your file:

var prefManager = Components.classes[";1"]

Now that you have access to the preference manager you can get and set preferences using getIntPref()/getBoolPref()/getCharPref() and setIntPref()/setBoolPref()/setCharPref(). These functions are very straight forward and have been used in the code samples above.
Following example shows to modify the default home page in Firefox

To get preference value:

var prefString = prefManager.getCharPref("browser.startup.homepage");

To set preferences value:

var prefString = prefManager.getCharPref("browser.startup.homepage", “”);

කිමදෝ නොහැගුනේ

මා නිදනා මේ නිශන්තයේ
නුඹ ආවා හීනයක් ලෙසේ
ඉගි පාන නෙත් අද්දරේ
ඔබ නොවෙද හිතවතියේ

මේ වසන්තයේ අප හමුවුනා
වසත වැසි බිදු වැටෙනා
මදනලයි මේ හමනා
ඔබෙ සුසුමයි මා වෙලනා

සිනහවයි ඔබෙ නැගෙනා
රාවයයි ඔබෙ ඇසෙනා
මතකයයි ඔබෙ මැවෙනා
නින්ද කිම නොයෙනා


Uploadify is a jquery pluging that can be integrated with web site to upload files. It is fully customizable. It is developed based on the mixture of JavaScript, ActionScript to be able to use with any server-side language.



  • Query Implementation
  • Multiple File Upload CapabilitiesSWFObject Integration
  • Compatibility with Popular Server-Side Languages
  • Highly-Customizable
  • Large Support Community
  • Extensive Documentation with Examples

Dynamic PDF generation using PHP

PDF format is very common document format in present IT world. As same as its popularity, Dynamic PDF generation is very important requirement for some project because PDF very famous document format for creating reports and some document and sharing.

Based on my ongoing PHP project, it has one requirement to generate PDF dynamically, based on predefined PDF template. Whilst searching, I could find a solution to generating PDF on the fly.

I used two libraries called FPDF and FPDI. Then, I wrote php code to generate document based on template on the fly.

Here, it loads page by page and insert the required text, which is to be added dynamically. Following is the example.


// initiate FPDI
$pdf = new FPDI();

// add a page

// set the sourcefile

// import page 1
$tplIdx = $pdf->importPage(1);

// use the imported page and place it at point 0, 0 with a width of 210 mm and height of 297mm
$pdf->useTemplate($tplIdx, 0, 0, 210, 297);

// now write some text above the imported page
$pdf->SetXY(35.7, 116.5);
$pdf->Write(0, "first_name last name");
$pdf->SetXY(35.7, 120.9);
$pdf->Write(0, "street 1 2");

// import page 2
$tplIdx = $pdf->importPage(2);

// use the imported page and place it at point 10,10 with a width of 100 mm
$pdf->useTemplate($tplIdx, 0, 0, 210, 297);

// now write some text above the imported page
$pdf->SetFont('Times', ‘B’, ‘24’);
$pdf->SetXY(35.7, 116.5);
$pdf->Write(0, "first_name, last name");

$pdf->Output('NewFile.pdf', 'I');


Generated output file can be retrieved using either from 4 options as follows.
e.g.: $pdf->Output($filename, $option);
This sends the file to either given location to be saved, browser or string. When it sends to browser, user can download it as file or open it inside browser using pdf reader plug-in installed.

Paramerts :

$filename :
The name of the file. If not specified, the document will be sent to the browser (destination I) with the name doc.pdf.

$option :
Destination where to send the document. It can take one of the following values:

  • I: send the file inline to the browser. The plug-in is used if available. The name given by name is used when one selects the “Save as” option on the link generating the PDF.
  • D: send to the browser and force a file download with the name given by name.
  • F: save to a local file with the name given by name (may include a path).
  • S: return the document as a string. name is ignored.

References :