$preparedReport = array( 0=>array('name'=>'Alf','revenue'=>1000), 1=>array('name'=>'Boor','revenue'=>3000), 2=>array('name'=>'Cat','revenue'=>4000),);usort($preparedReport, 'sortByRevenueOrder');// use $this in object context //usort($preparedReport, array($this, 'sortByRevenueOrder'));function sortByRevenueOrder($a, $b) { if ($a['revenue'] == $b['revenue']) { return 0; } return ($a['revenue'] > $b['revenue']) ? 1 : -1; // ascending order // return ($a['revenue'] < $b['revenue']) ? 1 : -1; descending order
This is a simple way to back up your database everydayGo to ubuntu command line and log in as root user, type following command to open crontab file >crontab -e type the following command in the file 0 0 * * * mysqldump -uYOURUSER -pYOURPASSWORD YOURDBNAME > /home/tommy/my_back_up/mydb_`date +\%y-\%m-\%d`.sql you can restart cron by typing >restart cron OR >/etc/init.d/cron restartThis ...
/** * Converts minutes to hours * @param type $mins * @return string */ public static function m2h($mins) { if ($mins < 0) { $min = Abs($mins); } else { $min = $mins; } $H = Floor($min / 60); $M = ($min - ($H * 60)) / 100; $hours = $H + $M; if ($mins < 0) { $hours = ...
If you need an array representation of a calender month this function will come in handy. This functionwill return an array of a given month with days properly distributed in to weeks, as in real calendar.public function buildMonthCalendar($year, $month) { $calendar = array( 'week-1' => array('Mon' => null, 'Tue' => null, 'Wed' => null, 'Thu' => null, 'Fri' => null, ...
If the table id is punchData and if you are changing second column color$("#punchData > tbody > tr > td:nth-child(2)").css("background","#F5D0A9");
for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done
Jquery selector for the label of a checkbox$("label[for=genTaxRateOrder]").
class A { public static function get_A() { return new self(); } public static function get_me() { return new static(); }}class B extends A {}echo get_class(B::get_A()); // out put Aecho get_class(B::get_me()); // out put Becho get_class(A::get_me()); // out put A
$db->getProfiler()->setEnabled(true);$db->update($data, array('id = ?' => $Posts->id));print $db->getProfiler()->getLastQueryProfile()->getQuery();print_r($db->getProfiler()->getLastQueryProfile()->getQueryParams());$db->getProfiler()->setEnabled(false);
git archivegit archive master | tar -x -C /somewhere/elseIf you want a compressed archive .git archive master | bzip2 >source-tree.tar.bz2ZIP archivegit archive --format zip --output /full/path/to/zipfile.zip master
1. Append the following line to your /etc/apache2/apache2.conf . NameVirtualHost 127.0.0.2:802 . Create unique files for each of my domains within the /etc/apache2/sites-available/ folder.Create a fie called mysitename.com<VirtualHost 127.0.0.2:80>ServerName mysitename.comServerAlias www.mysitename.comServerAdmin me@ubuntu.comDocumentRoot /var/www/mysitename/html</VirtualHost>3. Enable it by creating a symbolic link from one folder to the next ( etc/apache2/sites-enabled/)sudo a2ensite mysitenam
A simple function to find if a positive numberfunction isNumber(n) { return !isNaN(parseFloat(n)) && isFinite(n);}
1.Create a folder in C:\xampp\htdocs\mysite2. Edit your hosts file in windows located in C:\WINDOWS\system32\drivers\etc\ and add following line127.0.0.1 mysite.localhostDon’t delete the existing “127.0.0.1 localhost” line3.Open your C:\xampp\apache\conf\extra\httpd-vhosts.conf file and add the following linesNameVirtualHost *:80<VirtualHost *:80> DocumentRoot "C:\xampp\htdocs" ServerName localhost</VirtualHost><VirtualHost *:80> ServerName mysite.localhost DocumentRoot C:\xampp\htdocs\mys
If you want to get the phpunit coverage report for a single class you can use --filter setting with the --coverageoption.phpunit --coverage-html ./report --filter InsuranceStatusEligibilityFilterTest PluginAllTests.php
svn gedit svn:externals ./Gedit is the editor that you will see the external repository information, do the nessasary change and save tochange the edit external svn repositories
if($('#cbxEmployeeFamily_'+planId).is(':checked')){ $('#cbxEmployeeFamily_'+planId).attr('checked', true); }
Pass the frequency and current date to get an array of dates.eg.getDatesForYear(4,'2011-01-01');the array you get will have the following dates"2011-04-30","2011-08-31","2011-12-31"public function getDatesForYear($monthlyFequency,$date){$dateParts = explode("-",$date); $firstDayOfTheYear = $dateParts[0] . '-01-01'; $lastDayOfTheYear = $dateParts[0] . '-12-31'; $i = $firstDayOfTheYear;for(strtotime($i);strtotime($i)<=strtotime($lastDayOfTheYear);) { $accruDate[] = date('Y-m-d',strtotime($i . " +$monthlyFe
SET GLOBAL FOREIGN_KEY_CHECKS = 0;
XAMPP 1.7.2 comes bundled with the appropriate Xdebug .dll file. You only have to configure php.ini to use it. Note that all Xdebug settings have text explaining them.Locate and open XAMPP_HOME\php\php.ini for editing. This is the only php.ini file in XAMPP 1.7.2.Find and uncomment the line zend_extension = "XAMPP_HOME\php\ext\php_xdebug.dll".Find and uncomment the line xdebug.remote_host=localhost. Change the value of the setting ...