Install Spark IM client on Linux


Make sure you should install JAVA before proceeding Spark installation because it’s mandatory to run Spark.

# Checking JAVA Version #
$ java -version
java version "1.7.0_95"
OpenJDK Runtime Environment (IcedTea 2.6.4) (7u95-2.6.4-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)

# Download Spark Archive file # 
$ sudo wget http://download.igniterealtime.org/spark/spark_2_7_6.tar.gz

# Extract Spark Archive file #
$ sudo tar -zxvf spark_2_7_6.tar.gz
$ sudo mkdir /opt/spark
$ sudo mv Spark/.[!.]* /opt/spark/
# Download Spark Icon # 
$ sudo wget https://dl.dropbox.com/u/50880014/spark.png 
$ sudo mv spark.png /opt/spark/

# Prerequiest library # 
$ sudo apt-get install libxtst6:i386 libxi6:i386

# if you want to create a Ubuntu Unity Desktop Launcher, create a desktop launcher file with 
$ sudo gedit /usr/share/applications/spark.desktop
   
# Then add the following information and save :
[Desktop Entry]
Name=Spark
Version=2.6.3
GenericName=Spark
X-GNOME-FullName=Spark
Comment=ignite realtime Spark IM client
Type=Application
Categories=Application;Utility;
Path=/opt/spark
Exec=/bin/bash Spark
Terminal=false
StartupNotify=true
Icon=/opt/spark/spark.png
TargetEnvironment=Unity

You will then be able to search for Spark in you unity dash and launch Spark.

spark-01

Finally log in with a valid Spark user and enter the server details.

spark-02

Advertisements

Add recurring task php


<?php

$startDate = $postData[‘start_date’];
$endDate = $postData[‘end_date’];
$endDate = date(“Y-m-d”, strtotime($endDate . ” +1 day”));

/* For weekly schedule
* frequency_id:
*      ‘1’ => ‘Daily’,
*      ‘2’ => ‘alternative day’,
*      —-Every——–
*      ‘3’ => ‘Monday’,
*      ‘4’ => ‘Tuesday’,
*      ‘5’ => ‘Wednesday’,
*      ‘6’ => ‘Thursday’,
*      ‘7’ => ‘Friday’,
*      ‘8’ => ‘Saturday’,
*      ‘9’ => ‘Sunday’
*  */
if (in_array ($postData[‘frequency_id’], array(3,4,5,6,7,8,9))) {
$beginDate = new DateTime($startDate);
$endDate1 = new DateTime($endDate);

$interval = DateInterval::createFromDateString(‘1 day’);
$period = new DatePeriod($beginDate, $interval, $endDate1);

$arrDay = array(‘3’ => ‘Monday’, ‘4’ => ‘Tuesday’, ‘5’ => ‘Wednesday’, ‘6’ => ‘Thursday’, ‘7’ => ‘Friday’, ‘8’ => ‘Saturday’, ‘9’ => ‘Sunday’);

foreach ($period as $dt)
if ($dt->format(“l”) == $arrDay[$postData[‘frequency_id’]]) {
$startDate = $dt->format(“Y-m-d”);
break;
}
}

$begin = new DateTime($startDate);
$end = new DateTime($endDate);

if ($postData[‘frequency_id’] == ‘1’) { // daily
$interval = DateInterval::createFromDateString(‘1 day’);
} elseif ($postData[‘frequency_id’] == ‘2’) { // alternative day
$interval = DateInterval::createFromDateString(‘2 day’);
} elseif (in_array ($postData[‘frequency_id’], array(3,4,5,6,7,8,9))) {
$interval = DateInterval::createFromDateString(‘7 day’);
}

$period = new DatePeriod($begin, $interval, $end);

foreach ($period as $dt) {
$postData[‘frequency_post_id’] = $frequencyPostAdd;
$postData[‘post_date’] = $dt->format(“Y-m-d”);

/********** Your Logik *************/
}

phpmyadmin not working after updating php


Create a link in /var/www like this:

sudo ln -s /usr/share/phpmyadmin /var/www/

Note: since 14.04 you may want to use /var/www/html/ instead of /var/www/ (same for php 5)

If thats not working for you, you need to include phpmyadmin inside apache configuration.

Open apache.conf using your favorite editor, mine is vim 🙂

sudo vim /etc/apache2/apache2.conf

Then add the following line:

Include /etc/phpmyadmin/apache.conf

Hour dropdown


<select id='time'>
<?php for($i = 1; $i <= 24; $i++): ?>
    <option value="<?= $i; ?>"><?= date("h.iA", strtotime("$i:00")); ?></option>
<?php endfor; ?>
</select>
<select id='time'>
    <option value="1">01.00AM</option>
    <option value="2">02.00AM</option>
    <option value="3">03.00AM</option>
    <option value="4">04.00AM</option>
    <option value="5">05.00AM</option>
    <option value="6">06.00AM</option>
    <option value="7">07.00AM</option>
    <option value="8">08.00AM</option>
    <option value="9">09.00AM</option>
    <option value="10">10.00AM</option>
    <option value="11">11.00AM</option>
    <option value="12">12.00PM</option>
    <option value="13">01.00PM</option>
    <option value="14">02.00PM</option>
    <option value="15">03.00PM</option>
    <option value="16">04.00PM</option>
    <option value="17">05.00PM</option>
    <option value="18">06.00PM</option>
    <option value="19">07.00PM</option>
    <option value="20">08.00PM</option>
    <option value="21">09.00PM</option>
    <option value="22">10.00PM</option>
    <option value="23">11.00PM</option>
    <option value="24">12.00AM</option>
</select>

Sending HTML Mail via PHP


<?php
 require_once "Mail.php";
 require_once "Mail/mime.php";
 
 // see http://pear.php.net/manual/en/package.mail.mail-mime.php
 // for further extended documentation on Mail_Mime

 $from = "Web Master ";
 $to = "Nobody ";
 $subject = "Test HTML email using PHP Pear w/ SMTP\r\n\r\n";
 $text = "This is a text test email message";
 $html = "

This is an html test email message This Is A Link

"; $crlf = "\n"; // create a new Mail_Mime for use $mime = new Mail_mime($crlf); // define body for Text only receipt $mime->setTXTBody($text); // define body for HTML capable recipients $mime->setHTMLBody($html); // specify a file to attach below, relative to the script's location // if not using an attachment, comment these lines out // set appropriate MIME type for attachment you are using below, if applicable // for reference see http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types $file = "attachment.jpg"; $mimetype = "image/jpeg"; $mime->addAttachment($file, $mimetype); // specify the SMTP server credentials to be used for delivery // if using a third party mail service, be sure to use their hostname $host = "mail.emailsrvr.com"; $username = "webmaster@example.com"; $password = "yourPassword"; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password)); $body = $mime->get(); $headers = $mime->headers($headers); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { echo(" " . $mail->getMessage() . " "); } else { echo(" Message successfully sent! "); } ?>