Search found 198 matches

by chris
Tue Oct 15, 2013 6:02 pm
Forum: PHP
Topic: Change the timezone for a script
Replies: 2
Views: 24072

Re: Change the timezone for a script

You can use the date_default_timezone_set() function

Code: Select all

date_default_timezone_set('America/Los_Angeles');
print date("Y-m-d");
date_default_timezone_set('Europe/Brussels');
print date("Y-m-d");
by chris
Wed Oct 09, 2013 7:38 pm
Forum: Shell
Topic: Solved: bash create md5 from string
Replies: 2
Views: 22710

Re: bash create md5 from string

You can pipe it using | echo -n "test" | md5sum (You need option -n because else md5sum will calculate the string with newline char.) should give something like: 098f6bcd4621d373cade4e832627b4f6 - if you don't like the - at the end echo -n "test" | md5sum | gawk '{ print $1 }'
by chris
Thu Sep 05, 2013 7:37 pm
Forum: General
Topic: Linux warning: database /etc/mail/aliases.db is older than
Replies: 1
Views: 23254

Re: Linux warning: database /etc/mail/aliases.db is older th

this is the database postfix uses to deliver the mails. /etc/mail/aliases is the plain text file you can update. If you didn't update it, check it for any strange user names. Perhaps you upgraded postfix, could have changed the date stamp of the file? /etc/mail/aliases.db is the hashed file used pos...
by chris
Sat Aug 31, 2013 1:16 pm
Forum: Shell
Topic: grep multiple words
Replies: 1
Views: 20387

Re: grep multiple words

grep has an -E option (--extended-regexp)
This allows to us regular expressions.

Code: Select all

grep -E 'right|left' name_of_file.txt
You can check for more than 2:

Code: Select all

grep -E 'right|left|up|down' name_of_file.txt
by chris
Thu Aug 15, 2013 10:59 pm
Forum: PHP
Topic: Generate random colors
Replies: 1
Views: 20894

Re: Generate random colors

I don't know of a special function,
but this is a function I use.

function random_color()
{
$r=rand(128,255);
$g=rand(128,255);
$b=rand(128,255);
$color=dechex($r).dechex($g).dechex($b);
return "#".$color;
}
by chris
Tue Jul 09, 2013 10:34 am
Forum: Servers
Topic: Linux update/install new kernel
Replies: 1
Views: 31596

Re: Linux update/install new kernel

Well most of the time your linux flavor has some automatic upgrade tools. gentoo : emerge debian/ubuntu : apt-get I recommend you use those. But if you want to do it manually, you can download the latest kernel from https://www.kernel.org/ wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.10...
by chris
Mon May 27, 2013 6:49 pm
Forum: General
Topic: Shell get yesterdays date
Replies: 1
Views: 23626

Re: Shell get yesterdays date

You can do this by adding --date="-1 day" date +"%A, %B %-d, %Y" --date="-1 day" or even shorter date +"%A, %B %-d, %Y" -d yesterday You can also get the day for tomorrows or work with months or week. date +"%A, %B %-d, %Y" -d tomorrow date +"%A...
by chris
Mon May 27, 2013 6:49 pm
Forum: Shell
Topic: Shell get yesterdays date
Replies: 1
Views: 21206

Re: Shell get yesterdays date

You can do this by adding --date="-1 day" date +"%A, %B %-d, %Y" --date="-1 day" or even shorter date +"%A, %B %-d, %Y" -d yesterday You can also get the day for tomorrows or work with months or week. date +"%A, %B %-d, %Y" -d tomorrow date +"%A...
by chris
Mon Mar 18, 2013 5:37 pm
Forum: HTML
Topic: CSS valign table
Replies: 1
Views: 37306

Re: CSS valign table

you are looking for vertical-align:top (equals valign=top in html) But I think it won't work for the entire table, you'll have to put (a separated class) in <tr> or <td> so something like this: <table class=test_table> <tr class=test_tr> <td>cell1</td> <td>cel2 test</td> </tr> </table> css file: .te...
by chris
Wed Feb 27, 2013 9:03 pm
Forum: Servers
Topic: Solved: Log-file flooded with udevd error message
Replies: 2
Views: 33206

Re: Log-file flooded with udevd error message

I had the same problem after a restart of one of my servers. It was the kernel that was too old. I think udev needs kernel 3.0 or newer to use this function (Not sure) I regularly update my programs, but rarely recompile the kernel. This happens when your server runs for years on end. Anyway I recom...