Skip to main content

Posts

Recent posts

What is CronTab? What does it do?

What if you want to execute a file daily at particular time ? Running it manually daily is  absolutely not a good idea ..!   Then What do you do ? For this kind of manual works , To Automate it , there is a daemon in linux called "CRONTAB" . Crontab : Crontab called as CRON TABle Where  cron is a daemon to run periodically on a given time and Table consists of scheduled tasks , jobs  i . e , Crons . Crontab Options:    crontab - l : lists all the crontabs scheduled . crontab - e : Edits existing cron or else create new cron. crontab - r : Removes scheduled cron jobs . crontab - i - r : Prompts before deleting user 's crontab i.e,asks your permission.  crontab -u username -l : lists all the crons of a particular user.    Setting up a cron: Press Ctrl+Alt+t to open the terminal and paste following command.

What is the difference between Array.length = 0 and Array =[]?

foo=[];              Creates a new Array without affecting the older reference variables. foo.length=0;              Creates a new Array by affecting the older reference variables. Example: var foo = [ 'f' , 'o' , 'o' ]; var bar = [ 'b' , 'a' , 'r' ]; var foo2 = foo; var bar2 = bar; foo = []; //Creates a new Array without affecting the reference variable   bar.length = 0 ; //Creates a new Array by affecting the reference variable var foo3=foo; //Notice the difference for foo2 and foo3   console.log( "foo is" ,foo, "bar is" ,bar); console.log( "foo2 is" ,foo2, "bar2 is" ,bar2); console.log( "foo3 is:" ,foo3);       Output: "foo is" Array [] "bar is" Array [] "foo2 is" Array ["f", "o", "o"] "bar2 is" Array [] "foo3 is:" Array []  

Importing and Exporting a Database using command prompt?

Importing .sql file to a database through command prompt: mysql -u root -p It will prompt you to enter mysql_Password Enter password:give_your_mysql_password_here use database_name_to_which_.sqlfile_should_import; SOURCE /path/to/sql_file                   (or) mysql -u root -p database_name_to_which_.sqlfile_should_import < example.sql; Example: use sample; SOURCE  /home/desktop/sample.sql; Exporting Database to a .sql file through command prompt: mysqldump -u root -p database_name_to_export > example.sql; It will prompt you to enter mysql_Password Enter password:give_your_mysql_password_here

Send Email(with subject,body,attachment) using SSMTP through Terminal in linux?

1.Install ssmtp as              $ sudo apt-get update && sudo apt-get install ssmtp 2.Configure smtp file by editing the following file as, $ sudo gedit /etc/ssmtp/ssmtp.conf Update file with the following: AuthUser=Sendermail@gmail.com AuthPass=SenderPasswordforGMAIL FromLineOverride=YES mailhub=smtp.gmail.com:587 UseSTARTTLS=YES Now ssmtp.conf file should look like as the following one, AuthUser=Sendermail@gmail.com AuthPass=SenderPasswordforGMAIL # # Config file for sSMTP sendmail # # The person who gets all mail for userids < 1000 # Make this empty to disable rewriting. root=postmaster # The place where the mail goes. The actual machine name is required no # MX records are consulted. Commonly mailhosts are named mail.domain.com mailhub=smtp.gmail.com:587 # Where will the mail seem to come from? #rewriteDomain= # The full hostname hostname=tele-desktop118 # Are users allowed to set their own From: address? # Y

Attach a Font awesome icon to bottom right of an image using HTML and CSS?

< html > < style > .profile-item { text-align : center; border : none; } .profile-picture { padding : 2px ; border-radius : 0% ; -webkit-box-sizing : content-box; -moz-box-sizing : content-box; box-sizing : content-box; margin : 0 auto; width : 300px ; height : 300px ; overflow : hidden; position : relative; } .profile-picture img { width : 240px ; height : 240px ; margin-top : - 5px ; text-align :center; } </ style > < body > < div class = "profile-item" style = "height:400px;" > < div class = "profile-picture big-profile-picture" > < img src = "http://s3.amazonaws.com/37assets/svn/765-default-avatar.png" > < span style = "position: absolute;bottom: 45px;right: 0;" > < i style = "color:whit

Backup (or) Download MYSQL Database as a zip file Using PHP

NOTE:Please change below credentials  with respect to your Database and Run the file. <?php define ( "DB_USER" ,  'DatabaseUSERNAME' ); define ( "DB_PASSWORD" ,  'DatabasePASSWORD' ); define ( "DB_NAME" ,  'DatabaseNAME' ); define ( "DB_HOST" ,  'localhost' ); define ( "BACKUP_DIR" ,  'myphp-backup-files' );  // Comment this line to use same script's directory ('.') define ( "TABLES" ,  '*' );  // Full backup //define("TABLES", 'table1, table2, table3'); // Partial backup of required tables define ( "CHARSET" ,  'utf8' ); define ( "GZIP_BACKUP_FILE" ,  true );   // Set to false if you want plain SQL backup files (not gzipped) class  Backup_Database {     var  $host ;     var  $username ;     var  $passwd ;     var  $dbName ;     var  $charset ;     var  $conn ;     var  $backupDir ;     var  $backupFile ;     var  $