Friday, May 31, 2013

Save output as CSV file and ask for download using PHP

<?php
header("Content-Type: text/csv");
header("Cache-Control: no-store, no-cache");
header('Content-Disposition: attachment; Filename="Selected_Resumes.csv"');

$outstream = fopen("php://output",'w');  //Directly ask for download with out saving
//$outstream = fopen('bath/list.csv', 'w'); // Save file on sever then ask for download

fputcsv($outstream, $titles);

foreach ($result as $data) {
    fputcsv($outstream, $data);
}
fclose($outstream);

//unlink('bath/list.csv');  // Use this to delete file, if you are using save file on server.
?>

Note: Better we can directly ask for download output as CSV, with out saving them in server.

Thursday, May 30, 2013

செங்கோட்டை பாசஞ்சர் - சிறுகதை

'ஐ லவ் யூவுக்கு என்ன வயசு சார் இருக்கும்?'' என்றபடி என் அருகில் அமர்ந்த ஆல்வினை எனக்கு அவ்வளவு பிடித்திருந்தது. அவன் இந்தக் கேள்வியைக் கேட்கவும் கலெக்டர் கொடி அசைக்கவும், ரயில் புறப்படவும் சரியாக இருந்தது. சமயங்களில் இப்படித்தான் எல்லாம் சொல்லிவைத்தபடி நிகழ்ந்துவிடுகிறது. ஆல்வின் சொன்ன வார்த்தைகள் என்று இல்லை...

continue reading here: http://goo.gl/MlKsd


MGR கொலை முயற்சி வழக்கு, 1967 (நிகழ்வை படித்து உங்கள் கருத்தை சொல்லுங்கள்.)

1967-ம் ஆண்டு ஜனவரி 12-ம் நாள் மாலை 5 மணி அளவில் எம்.ஆர். இராதாவும், திரைப்படத் தயாரிப்பாளார் வாசுவும் எம்.ஜி.ஆரின் நந்தம்பாக்கம் வீட்டிற்குச் சென்று அவரைச் சந்தித்துப் பேசியுள்ளனர். இந்த சந்திப்பின்போது எம்.ஜி.ஆர். துப்பாக்கியால் தனது இடது காதருகே சுடப்பட்டார். இராதாவின் உடலில் நெற்றிப் பொட்டிலும் தோளிலுமாக இரு குண்டுகள் பாய்ந்தன. மருத்துவமனையில் அனுமதிக்கப்பட்ட இருவரும் உயிர்பிழைத்தனர். இந்தத் துப்பாக்கிச் சூட்டையடுத்து...

continue reading here: http://goo.gl/U1t96


Git Basic Commands

git status                                         -    display changes
git checkout .                                  -    clear all files from last edit
git checkout <file> <file>                -    clear specified files last edit only
git pull                                             -    pull all files from server
git diff > <file>                                 -    write whole diff on new file
git diff <file> > <file>                       -    write specific file diff on new file
git diff <file> <file> > <file>             -    write more than one files diff on new file
git add .                                           -    add all files to client from buffer 
git commit -m “msg”                       -    record local changes to local repository
git push                                           -    push the local repository recorded code(done by git commit) to server repository.
git add <file>                                   -    add untracked file to buffer
git diff --cached >> <file>               -    append new file changes to exist diff file.
git log                                              -    List commits
ctrl l or clear                                   -    clear screen
git diff --diff-filter=D >> <file>         -    Append all deleted file details to diff
git help <verb>                               -    Detail about specific verb
git reset HEAD <file>                     -    Move file from staged to unstage (Note: When new file added and send for push by       diff(used --cached), and if you try to pull from repository first you use ‘git reset HEAD <file>’ and then delete that file manually, then only you can pull.)
ctrl + ins (or) ctrl + shift + c           -    Copy
shift + ins (or) ctrl + shift + v         -    Paste
Q                                                    -    Go to new cmd
ctrl + c                                            -    Stop / Cancel current process
patch -p1 --dry-run < <diff_file>    -    List affecting file if we add or integrate specific diff file.
patch -p1 < <diff_file>                   -    Add or integrate specific diff file
git clone https://site.com/dir/project.git <localfolder> - Clone git from server using https
(Note: First open terminal and go to local folder where you want to pull and use above command to copy/ clone project to local.)
git checkout <branch_name>      -    Will switch to specified branch.
git branch <branch_name>          -    Will create a branch.
git checkout -b <branch_name>  - Will create and switch to branch at the same time.

Note: Be care full when using red marked comments above. Because it may affect your codes permanently, and most of the time will only used by admin of the project.

Friday, May 24, 2013

Sisyphus.js: Persist your form's data in a browser's Local Storage

Use: Persist your form's data in a browser's Local Storage and never loose them on occasional tabs closing, browser crashes and other disasters!

By using this Jquery app you can make avail form data, even browser closed certainly or any crash. And data are repopulated when we open that URL. Data are stored in browser local storage. Can destroy data after submit or reset.

Good to use in large or multi step forms. But I am in doubt, It may or may not work on dynamically populated input elements. I am tried it not working for dynamic inputs. May any solution avail..

Get it here: http://sisyphus-js.herokuapp.com/

Learn jquery here


Learn jquery here. And this site has many tutorial as animation or video. A good place for learn.

http://www.codeschool.com/courses/try-jquery

Thursday, May 23, 2013

JQuery toast message / notice


http://akquinet.github.io/jquery-toastmessage-plugin/demo/demo.html

JQuery drag and drop


http://www.webresourcesdepot.com/wp-content/uploads/file/jquerydragdrop/

http://nettuts.s3.amazonaws.com/127_iNETTUTS/demo/index.html

http://jqueryui.com/draggable/

http://threedubmedia.com/code/event/drag/demo/

Wednesday, May 22, 2013

File and Directory Permissions in UNIX / Linux

Source: UNIX / Linux: Beginners Guide to File and Directory Permissions

Unix file and directory permission is in the form of a 3×3 structure. i.e Three permissions (read, write and execute) available for three types of users (owner, groups and others).


Three file permissions:
  • read: permitted to read the contents of file.
  • write: permitted to write to the file.
  • execute: permitted to execute the file as a program/script.
Three directory permissions:
  • read: permitted to read the contents of directory (view files and sub-directories in that directory ).
  • write: permitted to write in to the directory. ( create files and sub-directories in that directory )
  • execute: permitted to enter into that directory.
Numeric values for the read, write and execute permissions:
  • read 4
  • write 2
  • execute 1
To have combination of permissions, add required numbers. For example, for read and write permission, it is 4+2 = 6.

Change File and Directory Permissions Using Chmod Command
You can use either the octal representation or symbolic representation to change the permission of a file or directory.

Octal representation for permissions:
  • First number is for user
  • Second number is for group
  • Third number is for others
For example, give read, write ( 4+2 = 6 ) to user and read ( 4 ) to group and others.


$ chmod 644 filename

For example, give read, execute ( 4 + 1 = 5 ) to user and read (4 ) to group, and nothing ( 0 ) to others.
$ chmod 540 filename

For example, give read, write ( 4 + 2 = 6 ) to user and nothing ( 0 ) to group, and read ( 4 ) to others.
$ chmod 604 filename

Learn JavaScript - String and its methods - 16

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>String and it's methods - JS&l...