Thursday, April 23, 2009

Unpack/Decompress Java Script

For better security of code you can compress your javascript using PACKER
  1. Copy the script to http://dean.edwards.name/packer/
  2. Check the both option
  3. Paste to original place and save that script

And to Decompress that script Simply follow two steps :
  1. Put Eval = alert on the top of your script (In Opera browser :))
  2. Select all that output of script and paste that code to :http://jsbeautifier.org/

Wednesday, April 22, 2009

Change FCKEditor font size listing in Numeric value

Find the file fckconfig.js in FCKEditor fckconfig.js

Change the line

FCKConfig.FontSizes = 'smaller;larger;xx-small;x-small;small;medium;large;x-large;xx-large' ;

with

FCKConfig.FontSizes = '1/5;2/6;3/7;4/8;5/9;6/10;7/11;8/12;9/14;10/16;11/18;12/20;13/24;14/28;15/30;16/60;17/90' ;


And you will get Numeric list in your FCKEditor instead of String.

Open uploaded pdf files in other browser tab with drupal

As in MAC OS and Linux the uploaded file in drupal site is default open with Save As Dialog box, but where as in Windows the pdf file is open in current browser window.

To Open that pdf in other window

In the core upload module of Drupal go to modules/upload/upload.module is where you will find the function theme_upload_attachments() as follows:

function theme_upload_attachments($files) {
$header = array(t('Attachment'), t('Size'));
$rows = array();
foreach (
$files as $file) {
$file = (object)$file;
if (
$file->list && empty($file->remove)) {
$href = file_create_url($file->filepath);
$text = $file->description ? $file->description : $file->filename;
$rows[] = array(l($text, $href), format_size($file->filesize));
}
}
if (
count($rows)) {
return
theme('table', $header, $rows, array('id' => 'attachments'));
}
}


In this function change

$rows[] = array(l($text, $href), format_size($file->filesize));

with

$rows[] = array(l($text, $href, array('attributes' => array('target' => '_blank'))), format_size($file->filesize));


And you can get files are being open in other browser tab rather than current browser window.

Friday, April 10, 2009

Integrate Gujarati Dictionary StarDict with Linux And MAc

You have to follow some simple steps to integrate your dictionary/ your collection of data to StarDict dictionary.

Here I am giving example to integrate Gujarati dictionary

== Tools Required ==

StarDict

StarDict Tools

== Process ==

* Installation:
apt-get install stardict-tools

* Open the stardic-editor
stardict-editor

* Pass your data/text file to that editor


File Format: write the search word first, then a Tab character, and the definition. If the definition contains new line, just write \n, if contains \ character, just write \\.

* Create tab file
Tab file results Total Number of word and create
.dic and .ifo file

* Compile that file




* Then in Decompile tab pass the .ifo file and decompile and varify it


Which will create .idx file

* Zip your dictionary file:

dictzip yourfile.dic


== StarDict Dictionary ==

* Installation:
apt-get install stardict

* Create folder of your dic in /usr/shar/stardict/dic/yourdic_name
* Copy the out file .dic.dz, .ifo and .idx file to /usr/shar/stardict/dic/yourdic_name/




Here you can see Gujarati word search results in itz Gujarati meaning and english word results is gujarati meaning