Tuesday, June 21, 2011

પેન ડ્રાઈવમાં પાર્ટિશન કેવી રીતે કરશો?(ટેક્નો ટ્રાવેલ)

ડેટા સ્ટોરેજ ડિવાઈસમાં પહેલાં ફ્લોપી ડ્રાઈવ, ઝીપ ડ્રાઈવ આવી પછી સીડી-ડીવીડી, એક્સટર્નલ હાર્ડ ડ્રાઈવ અને છેલ્લે સૌથી નાની એવી પેન ડ્રાઈવ કે યુએસબી ફ્લેશ ડ્રાઈવ આવી. આ બધાં જ ડિવાઈસ ડેટાનો સંગ્રહ કરવા અને એક જગ્યાએથી બીજી જગ્યાએ લઈ જવા માટે ખૂબ જ ઉપયોગી છે. એક્સટર્નલ હાર્ડ ડ્રાઈવ અને પેન ડ્રાઈવ અત્યારે ખૂબ ચલણમાં છે. એક્સટર્નલ હાર્ડ ડ્રાઈવનું પાર્ટિશન કરવું એ બહુ મુશ્કેલ કામ નથી. પરંતુ પછી પ્રશ્ન એ થાય કે શું નાનકડી પેન ડ્રાઈવમાં પાર્ટિશન પડી શકે? તો તેનો જવાબ છે હા, તેમાં પાર્ટિશન પડી શકે. પાર્ટિશન કરવાથી ડેટાને અલગ તારવી શકાય છે. એક જ ડ્રાઈવને ફોર્મેટ કરીએ તો પણ બાકીના સુરક્ષિત રહે છે. એક ડ્રાઈવમાં વાઈરસ હોય તો બીજો ડ્રાઈવ તેનાથી બચી શકે છે. આમ અનેક ગણા ફાયદા થાય છે. પેન ડ્રાઈવમાં પાર્ટિશન કરવા માટે નીચેના સ્ટેપ્સને અનુસરો.

સ્ટેપ-૧

પેન ડ્રાઈવને પીસીના યુએસબી પોર્ટમાં પ્લગઈન કરો.

સ્ટેપ-૨

પેન ડ્રાઈવનું ફોલ્ડર ઓપન કરો. તેના માટે ડેસ્કટોપ પર અથવા સ્ટાર્ટમાં જઈને માય કમ્પ્યુટર પર ક્લિક કરો. હવે જે વિન્ડો ખૂલે તેમાં વિવિધ ડ્રાઈવરના લિસ્ટમાંથી ‘Removable Media’ મીડિયા પર જઈને માઉસની રાઈટ ક્લિક કરો, પછી ફોર્મેટ પર ક્લિક કરો. ફોર્મેટ વિન્ડો ખૂલશે જેમાં ત્રણ ચેકબોક્ષમાંથી ‘Quick Format’ પર ક્લિક કરો, ત્યારબાદ ફોર્મેટ પર ક્લિક કરો અને પ્રોસેસ ફિનિશ થવાની રાહ જુઓ. ફિનિશ થઈ ગયા પછી ફોર્મેટ વિન્ડોને ક્લોઝ કરી દો.

સ્ટેપ-૩

Lexar’s Boot It સોફ્ટવેર ડાઉનલોડ કરો. Boot It ને યુએસબી ડિવાઈસના પાર્ટિશન માટે ખાસ ડિઝાઈન (બનાવવું) કરવામાં આવ્યું છે. તેનાથી કોઈ પણ પ્રકારના યુએસબી ડિવાઈસ તથા યુએસબી પેન ડ્રાઈવમાં પાર્ટિશન કરી શકાય છે. આ સોફ્ટવેરને કમ્પ્યુટરમાં ઈન્સ્ટોલ કરીને કમ્પ્યુટરને રિસ્ટાર્ટ કરી દો.

સ્ટેપ-૪

Boot Itના આઈકન પર ક્લિક કરીને તેને રન કરો. હવે ડિવાઈસ સેક્સનમાં પેન ડ્રાઈવનો લેટર સિલેક્ટ કરો અને ‘Flip Removable Bit’ ના બટન પર ક્લિક કરો.

સ્ટેપ-૫

પેન ડ્રાઈવને ડિસ્કનેક્ટ કરવા માટે અનપ્લગ કરો, પછી ફરીથી તેને પ્લગ-ઈન કરો.

સ્ટેપ-૬

ટાસ્કબારમાં સ્ટાર્ટ પર ક્લિક કરો, પછી સર્ચ પર ક્લિક કરી સર્ચ ફાઈલ સિલેક્ટ કરીને તેમાં ‘Disk Management’ ટાઈપ કરીને એન્ટર આપો.

સ્ટેપ-૭

વોલ્યુમ સેક્સન (એક બોક્ષ કે ભાગ) માં જઈને પેન ડ્રાઈવને સિલેક્ટ કરો. તેના પર રાઈટ ક્લિક કરો અને ‘Shrink Volume’ ને સિલેક્ટ કરો. હવે નવા પાર્ટિશનની સ્ટોરેજ અમાઉન્ટ (આંકડો) લખો કે પસંદ કરો. જેમ કે ૪જીબીની પેન ડ્રાઈવના બે પાર્ટિશન પાડવા હોય તો રજીબી પસંદ કરો. આટલું કર્યા પછી Shrink પર ક્લિક કરો.

સ્ટેપ-૮

હવે નવી ‘Unallocated Space’ પર રાઈટ ક્લિક કરો અને ‘New Simple Volume’ સિલેક્ટ કરો. ફાઈલ સિસ્ટમમાં NTFS પસંદ કરો અને પાર્ટિશનને ગમે તે નામ કે લેટર આપો. નેક્સ્ટ પર ક્લિક કરો પછી ઓકે પર ક્લિક કરો.

નોંધઃ (૧) પેન ડ્રાઈવને ફોર્મેટ અથવા પાર્ટિશન કરતાં પહેલાં તેમાં રહેલાં બધાં જ ડેટાનો બેકઅપ લઈ લેવો હિતાવહ છે.

(૨) સર્ચ એન્જિનમાં જઈને free bootit download ટાઈપ કરીને એન્ટર કરતાં સોફ્ટવેરના વિવિધ સોર્સિસ ઓપન થશે. જેમાંથી કેટલાંક ટ્રાયલ વર્ઝન ફ્રી છે જ્યારે ફુલ વર્ઝન ખરીદવા પડે છે.


Apache Content Permission


getsebool -a | grep httpd

setsebool -P httpd_enable_cgi 1

setsebool -P httpd_allow_httpd_anon_write 1

chcon -R -t httpd_sys_rw_content_t 'directory_a'
chcon -R -t httpd_sys_rw_content_t '/var/www/'

Wednesday, August 25, 2010

Creating web thumbnails with PHP Imagick


// the location of your image $imagePath = '/path/to/source_image'; // these are treated as maximums and aspect ratio is maintained $thumbnailWidth = 100; $thumbnailHeight = 100; // path to the sRGB ICC profile $srgbPath = '/path/to/sRGB_v4_ICC_preference.icc'; // load the original image $image = new Imagick($imagePath); // get the original dimensions $width = $image->getImageWidth(); $height = $image->getImageHeight(); // set colour profile // this step is necessary even though the profiles are stripped out in the next step to reduce file size $srgb = file_get_contents($srgbPath); $image->profileImage('icc', $srgb); // strip colour profiles $image->stripImage(); // set colorspace $image->setImageColorspace(Imagick::COLORSPACE_SRGB); // determine which dimension to fit to $fitWidth = ($thumbnailWidth / $width) < ($thumbnailHeight / $height); // create thumbnail $image->thumbnailImage(   $fitWidth ? $thumbnailWidth : 0,   $fitWidth ? 0 : $thumbnailHeight ); // generate a thumbnail filename $imagePathParts = pathinfo($imagePath); $thumbnailPath =   $imagePathParts['dirname'].'/'.   $imagePathParts['filename'].'_'.   $thumbnailWidth.'x'.$thumbnailHeight.   '.jpg'; // save thumbnail and free up memory $image->writeImage($thumbnailPath); $image->clear(); $image->destroy();

Symfony 1.2 Embede multi forms chield tables

http://ezzatron.com/2009/12/03/expanding-forms-with-symfony-1-2-and-doctrine/

Tuesday, August 24, 2010

Bash Script to Batch Resize all Images in a Folder

A simple script which will recognize all image types in the PWD and reduce them by 50% and copy them to the resized folder under PWD. Good for bulk resizing of images.


#!/bin/bash
files=($(file -i * | awk -F ':' 'BEGIN {ORS=""} /^.*:[ \t]*image\/[a-z]*; charset=binary/ {for(i=1;i<NF-1;i++) {print $i":"} {print $(NF-1)"\n"} }' | sed 's/ /:spacecharacter:/g' | tr '\n' ' '))
echo ${files[@]}
mkdir -p resized
for file in ${files[@]}
do
file=$(echo $file | sed 's/:spacecharacter:/ /')
convert -resize 50% "$file" resized/"$file"
#You can use mogrify instead of resize if you want to edit the images in place.
#mogrify -resize 50% "$file"
done

Copy the script to ~/bin directory and make it executable chmod +x resize_images. Change into the directory containing the images and execute the script.

Find Duplicate Lines in a File

sort PATH_TO_FILE | uniq -d

Continuously watch for duplicate lines as you work on a file


watch "sort PATH_TO_FILE | uniq -d"

Find Duplicate Lines in a File

sort PATH_TO_FILE | uniq -d

Continuously watch for duplicate lines as you work on a file


watch "sort PATH_TO_FILE | uniq -d"