Friday, July 12, 2013

How turn on sql_mode to stric in mysql

1) Edit my.cnf
For Debian :
located at /etc/mysql/my.cnf , add to my.cnf
    [mysqld]
    sql_mode="STRICT_ALL_TABLES"
 If you want strict mode with full group by use this
[mysqld]
sql_mode="STRICT_ALL_TABLES,ONLY_FULL_GROUP_BY"

2) Restart mysql

3) Check it by running this query
SELECT @@GLOBAL.sql_mode;
Note: If you want turn off strict mode on run time just run this query
SET @@global.sql_mode='STRICT_ALL_TABLES'
OR
SET @@session.sql_mode='STRICT_ALL_TABLES'
Thats it.





Wednesday, March 27, 2013

Working with GhostScript : Convert PDF to images using ghostscript


Ghostscript is an interpreter for PostScript™ and (PDF) files, lets see how we can use it convert PDF to images.

-Install Ghostscript (I am using ubunutu, so I can perform)
sudo apt-get install ghostscript

- run these script via console to make images from pdf

gs -dUseCropBox -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dAdjustWidth=0 -dNOPROMPT -sDEVICE=jpeg -dSAFER -dBATCH -dNOPAUSE -r140 -dJPEGQ=80  -dFirstPage='1' -dLastPage='8' -sOutputFile=/tmp/output/image-%d.jpg /tmp/downloads/sample.pdf

You can see output like this :


and your output folders will list your images :




FYI - Params :
-dFirstPage and -dLastPage specifies page limits , which is optional
-sOutputFile [output file] [input file]




:)


Wednesday, March 6, 2013

How to add force quit option in ubutnu 12.04

Just got updated my ubuntu version to 12.04 , One of my favorite tool was missing there -Force Quit .
Followed these step and I restored it there in panel

1- create a file named 'Force_Quit.desktop' and contents should be like this

[Desktop Entry]
Name=Force Quit
Comment=Force Kill an Unresponsive Running Application or Window
Exec=xkill
Icon=gnome-panel-force-quit
Terminal=false
Type=Application
StartupNotify=true

2- Place it applications folder , you can open application folder directly using these command
    nautilus ~/.local/share/applications/
3- Drag and drop 'Force_Quit.desktop' file in to Unity launcher.

Thats it !