Archive for August, 2010

Import .csv file into MySQL database

Aug 22 2010 Published by under MySQL

I was implementing PhishTank database to one of my projects.

PhishTank is a service, operated by OpenDNS which updates a current list of phishing sites on the Internet.

When dealing with large number or requests it is advised that you download their hourly updated database dump.

I decided to grab the .csv dump and import it in my database using cron.

The heart of this cron is the following command which imports .csv data into local database

mysql -u$username -p$password -e \
"load  \
    data local
infile  \
    \"./verified_online.csv\" \
into table  \
    $database.$table \
fields terminated by \",\" \
enclosed by '\"' \
lines terminated by \"\n\" \
( \
    phish_id, \
    phish_detail_url, \
    url, \
    submission_time, \
    verified, \
    verification_time, \
    online, \
    target \
);"

Make sure that you already have the table created with following fields “phish_id, phish_detail_url, url, submission_time, verified, verification_time, online, target”

Comments Off

Switch SVN local copy to new server location

Aug 19 2010 Published by under Misc

When an SVN repository switches the server you need to update your working copy with new repository url.
First, you need to get the old repository url by typing ‘svn info’. You will get a listing saying ‘URL: http://oldserver/path/to/repo/trunk’.

svn info
URL: http://oldserver/path/to/repo/trunk

Copy that url and execute the following from the root folder of your local copy

cd /path/to/your/local/copy/
svn switch --relocate \
http://oldserver/path/to/repo/trunk \
http://newserver/path/to/repo/trunk \
. \

After that update your local copy and you’re ready to go

svn update

Comments Off

Mount Windows Share folder on Ubuntu

Aug 17 2010 Published by under Samba

In order to mount remote shared folder ‘/svn/foo’ from remote host 192.168.1.2 to ‘foo’ folder on your Desktop do this:

mount -t cifs \
//192.168.1.2/svn/foo \
-o username=MyUsername,password=MyPassword \
/home/haris/Desktop/foo

Comments Off

Performance Optimization WordPress Plugins by W3 EDGE