Search found 199 matches

by chris
Wed Sep 22, 2010 12:10 pm
Forum: SQL
Topic: How do I load a csv file in MYSQL
Replies: 4
Views: 25047

Re: How do I load a csv file in MYSQL

MYSQL needs not only read access on the file, but also execution rights on directory. It reads using the rights of the mysqld process (user: mysql) You probably don't want your home-dir accessible by everyone. So a quick solution it to copy the file to the /tmp -dir and load it from there. LOAD DATA...
by chris
Thu Sep 16, 2010 10:40 pm
Forum: SQL
Topic: How do I load a csv file in MYSQL
Replies: 4
Views: 25047

Re: How do I load a csv file in MYSQL

You can login in mysql:

Code: Select all

mysql -u You -p database
and the you can use the LOAD DATA INFILE command

Code: Select all

LOAD DATA INFILE 'data.csv' INTO TABLE table
You can get the complete explanation here:
http://dev.mysql.com/doc/refman/5.0/en/load-data.html
by chris
Fri Sep 03, 2010 10:09 am
Forum: General
Topic: Solved: Remove the ^M Character
Replies: 2
Views: 25618

Re: Remove the ^M Character

When you move files from windows to (l)unix, you always have problems with white characters. Thats because windows and linux handle with spaces differently. Sed can be found on most linux/unix distributions. sed s/\r// hello.txt > goodhello.txt you can also do the same with perl: perl -pie 's/\r//g'...
by chris
Tue Aug 31, 2010 2:07 pm
Forum: General
Topic: How do i get columns out of text in shell
Replies: 1
Views: 24019

Re: How do i get columns out of text in shell

Hi,

you can do this with awk

For example:

Code: Select all

awk '{ print $2 }' list.txt
This gets the second column from the file list.txt
Standard the separation is space (" ")
With -F you can change this

Code: Select all

awk -F ";" '{ print $2 }' list.txt
You can also use gawk as an alternative.
by chris
Wed Aug 04, 2010 10:46 pm
Forum: PHP
Topic: update php on CentOS
Replies: 2
Views: 24223

Re: update php on CentOS

You can find a complete explanation here: http://blog.famillecollet.com/pages/Config-en In short: You have to install EPEL: wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm rpm -Uvh epel-release-5*.rpm Then set the Remi repository: cd /etc/yum.repos.d wget http://rp...
by chris
Mon Jul 19, 2010 9:24 pm
Forum: PHP
Topic: PHP yesterday date
Replies: 1
Views: 22061

Re: PHP yesterday date

Hi,

mktime() works fine for me:

Code: Select all

$yesterday=date('Y-m-d', mktime(0, 0, 0, date("m") , date("d") - 1, date("Y")));
But you can also use the following code:

Code: Select all

$yesterday=date("Y-m-d", time()-86400);
The result should be the same.
by chris
Sun Jul 18, 2010 8:33 pm
Forum: PHP
Topic: SOLVED: How to send a HTML mail
Replies: 1
Views: 21645

Re: How to send a HTML mail

With PHP it is easily done. You create the body of your message in html. Don't forget <html><body></body></html> and in the headers you tell it is a HTML-mail with the following line: Content-type: text/html\r\n So the complete code looks something like this: $email='someone@somewhere.com'; $subject...
by chris
Mon Jun 28, 2010 9:54 am
Forum: Servers
Topic: Solved: bincimap not starting
Replies: 2
Views: 33365

Re: bincimap not starting

are yo sure svscan is running?

On my gentoo machine I can check this with:

Code: Select all

/etc/init.d/svscan status
If the status is stopped
You can start it with

Code: Select all

/etc/init.d/svscan start
then run

Code: Select all

svc -u /service/bincimap/
and it should work.

Regards
by chris
Mon Jun 14, 2010 11:14 pm
Forum: PHP
Topic: Solved: print of double/float
Replies: 1
Views: 21758

Re: print of double/float

You can do this with the function number_format()

Code: Select all

$float = 55.3333333333;
$new_num = number_format($float, 2);

echo $new_num; //55.33
by chris
Sun May 16, 2010 5:50 pm
Forum: Postfix
Topic: Solved: How do I create non-local aliases in postfix
Replies: 2
Views: 48872

Re: How do I create non-local aliases in postfix

You probably want something like virtual alias domains . Add/edit the following in /etc/postfix/main.cf : virtual_alias_domains = example.com, example.net, example2.com virtual_alias_maps = regexp:/etc/postfix/virtual_alias The create the file /etc/postfix/virtual_alias with the aliases you need: po...