Open source photo gallery - Plogger

Tuesday, May 26, 2009 Posted by Md. Monjurul Hasan 0 comments
I was in need of a photo gallery - ofcourse open source, and I got two choices - Plogger and Gallery. Gallery2 will give you many features while plogger is really simple and worth for my small requirements. It has easy admin panel and also gives the basic features including slideshow - so I decided to rely on Plogger. I have modified the default theme and it worked fine.
First I removed the footer-text ('Powered by Plogger') from page (for that I commented out this line - print plogger_link_back(); in ploggerdir/themes/default/footer.php)
and
modified the css to decrease the search box width (added this line

#jump-search-container input[type=text] {
width: 120px;
}

in ploggerdir/themes/default/gallery.css ).

Still working on it.

Debug Shell and Python Script from console

Tuesday, May 19, 2009 Posted by Md. Monjurul Hasan 0 comments
> When running Shell script, enable the debug mode with -x option.E.g. sh -x yourscript.sh
> When running Python script, import pdb - the Python debugger, call the set_trace() function and enter n in the console for next debug output. E.g.

#!/usr/bin/python
# epdb1.py -- experiment with the Python debugger, pdb
import pdb
def combine(s1,s2): # define subroutine combine, which...
s3 = s1 + s2 + s1 # sandwiches s2 between copies of s1, ...
s3 = '"' + s3 +'"' # encloses it in double quotes,...
return s3 # and returns it.
a = "aaa"
pdb.set_trace()
b = "bbb"
c = "ccc"
final = combine (a,b)
print final
Labels:

Email tips for PHP Pear

Posted by Md. Monjurul Hasan 0 comments
Email facility is required for almost every application. Hence these tips are helpful.

1. For datetime in proper format,
$headers["Date"] = date("r");

2. For both HTML and text mail,
 $headers["Content-Type"] = "multipart/alternative";

3. For sending mail with SMTP Authentication,
$mail = Mail::factory(
"smtp",
array ('host' => $host,
'auth' => 'true',
'username' => $username,
'password' => $password)
);


A quick helpful tutorial: http://email.about.com/od/emailprogrammingtips/qt/et073006.htm
Labels: , ,

Upgraded to Windows® 7 RC

Posted by Md. Monjurul Hasan 0 comments
Just safely upgraded my windows from vista to 7 without taking backup. It required additional 8 GB in installation directory. Looks pretty cool. Like the new taskbar. This version is valid till June,2010. So I am an original windows user at last!!
Labels: ,

HTTP VS HTTPS

Posted by Md. Monjurul Hasan 0 comments
I was trying to study the basics of them. Summarized here what I have got.

> http send everything you do in plan text for any one to read.

> https is slower and requires a secure server and therefore would be much more expensive. Browsing doesn't require secure socket layer.

https encrypts everything you do so that no one can read what you type but the recipient.

The problem with encrypting data is that you cant just encrypt it and say only yahoo can read it. Both you and yahoo have to have a secret key so that yahoo can decrypt what you sent and encrypt private stuff for you to read.

This is accomplised by an encryption scheme known as public key. Yahoo puts out a public key so that every one can encrypt stuff that only yahoo can read its like a one way key: you can package stuff up and send it to yahoo so that they can read it with theire private key but some one with a public key cant see what you encrypted.

So you package up a key for yahoo to use to talk to you and you are all set.

Why all internet communication isn't done like this is because of what is known as the man in the middle attack, and its solution.

It's quite simply to pretend to be yahoo.com if you know what you doing. so I pretend to be yahoo and all traffic you think is going to yahoo comes to me. you ask me for my public key I respond back with an fake public private key pair that I made then I ask yahoo for there public key and every thing you to I do I just watch for anything interesting like Credit cards etc.

To be continued...
Labels: ,

Tips for Dom PDF

Posted by Md. Monjurul Hasan 0 comments
See what I have experienced so far. May be useful for you too.

  1. No need to install, can be called directly.But be sure php-xml package is installed. You can be sure from phpinfo().

  2. When using, change the path in dompdf_config.inc if necessary

  3. Be sure that the html code is clean i.e. tags are closed

  4. Dom PDF can not render multiple html pages with a single table. I was facing of getting a single page while original was more than one


To be continued....
Labels:

SugarCRM: Search directly using url

Posted by Md. Monjurul Hasan 0 comments
This url can save your time! It takes you to the SugarCRM search form and gives the search result for the desired string in Accounts module. Can search in multiple modules (use &)

http://yoursugarcrm.com/index.php?module=Home&query_string=test&advanced=true&action=UnifiedSearch&search_form=false&query_string=yourstring&search_mod_Accounts=true

Remember, you have to login into your SugarCRM before using this url.
Labels:

Dom PDF: PDF support for Smarty templates

Posted by Md. Monjurul Hasan 0 comments
I was having some troubles with PDF report generation. I used Smarty Templates, so I was looking for PDF class that will support Smarty output.

Finally I stayed on Dom PDF. It supports PHP 5 and CSS 2.1.


//include the dom pdf
require('dompdf/dompdf_config.inc.php');

//fetch the HTML output from smarty template
$htmlcontent=$smarty->fetch('smarty_template.tpl');

//call dom pdf class
$dompdf = new DOMPDF();
$dompdf->load_html($htmlcontent);
$dompdf->render();
//display output in browser
$dompdf->stream();
//or, save as a pdf
$pdf = $dompdf->output();
file_put_contents("tmp/filename.pdf", $pdf);


There are other options like set paper size etc. You can try this.
Labels: ,