mySQL csv import via LOAD DATA INFILE

Well it’s actually quite simple. That sample worked for me like a charm:


LOAD DATA INFILE "C:\\\\us_mag_sizes.csv"
INTO TABLE support_sizes_US
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY """"
LINES TERMINATED BY "\r\n"
IGNORE 1 LINES


LOAD DATA INFILE "C:\\\\time_pojas.csv"
INTO TABLE pt_time
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY """"
LINES TERMINATED BY "\r\n" IGNORE 1 LINES
(name_full,time,name)

Posted on February 11, 2010 at 18:33 by admin · Permalink · Leave a comment
In: English, sql

New cool web site about… cats and fun :) And more!

Web site called www.mapikcha.com and everybody welcome to visit and create new funny pictures!

Like this for example:
Funny Picture from www.mapikcha.com!!!
see more funny pictures on www.mapikcha.com

Posted on January 18, 2010 at 12:05 by admin · Permalink · Leave a comment
In: English, Fun · Tagged with: , ,

Backup and Restore PostgreSQL database

I am not quite sure why phpPGAdmin doesn’t have “import” feature and only have “export”, but… who cares?

Dump Individual DBs with pg_dump

PostgreSQL provides the utility program pg_dump for dumping individual DBs:

pg_dump dbname > outfile

pg_dump writes its results to the standard output.

pg_dump is a regular PostgreSQL client application.
This means that you can do this backup procedure from any remote host that has access to the DB.
pg_dump does not operate with special permissions. You must have read access to all tables that you want to back up.

Large objects (blobs) are not dumped by default.

Restoring the dump

The text files created by pg_dump are intended to be read in by the psql program:

psql dbname < infile

Note: The DB dbname will not be created by this command, you must create it yourself before.
psql and pg_dump support options for controlling the DB server location and the user names.

Read the rest of this post »

Posted on November 11, 2009 at 17:42 by admin · Permalink · Leave a comment
In: Uncategorized

Here I go. I am oficially gonna create new jQuery plugin.

Just one link to follow:

Simple tutorial

possibly more to follow….

Posted on June 8, 2009 at 18:11 by admin · Permalink · Leave a comment
In: Uncategorized

WordPress plugin for nice colourfull code in posts

Today is gonna be a very short post.

Oddly enough I asked myself – why I still don’t have any nice plugins to display programming languages code with different colours?

And now here we go: Dojox WordPress Syntax Highlighter
Available codes:
PHP, Phyton, Java, Javascript, Delphi, Css, HTML, HTML+Django

Syntax:


<pre>
<code class="HTML">
// Put your code here.
</code>
</pre>
 
 // Put your code here.
 $(document).ready(function() {  

     $('ulmenu li:even').addClass('even');  

     $('ulmenu li a').mouseover(function() {  

         $(this).animate( { paddingLeft:"20px" }, { queue:false, duration:500 });  

     }).mouseout(function() {  

         $(this).animate( { paddingLeft:"0" }, { queue:true, duration:500 });  

     }).click(function() {  

         $(this).animate( { fontSize:"20px" }, { queue:false, duration:500 });
     });  

 });    

Posted on June 8, 2009 at 17:37 by admin · Permalink · 2 Comments
In: Uncategorized

RPM’s on Red Hat 5 and “yum”

RPM on Reh Hat Linux seems like a good solution, but sometimes it just gives you headakes and nothing else.

Here are few good comand samples to use with RPM’s:

To list all installed modules with “mysql-” name:

rpm -qa | grep -i ‘^mysql-‘

Forced Update:


rpm -Uhv --force MySQL-server-community-5.1.34-0.rhel5.i386.rpm

And one more thing… don’t forget nice command called: YUM

yum upgrade mysql-server

yum install ***

yum erase ***

That’s all for today 🙂

Posted on May 7, 2009 at 12:01 by admin · Permalink · Leave a comment
In: English, Fighting the system · Tagged with: , ,

How to find duplicated values in MySQL (or/and probably any other RDBM)

As an example I take one real (almost) table I have in my db.

Structure is very simple :

Table name: “words”, field “filename” name of the file and “words” just some information about each file.
+—————–+———————+
|   filename     |     words         |
+—————–+———————+

Suddenly we had a few files with exactly same name and I could find them, so… SQL here to help!

SELECT count( * ) AS num, filename
FROM words
GROUP BY filename
HAVING count( * ) > 1

Simple and quick explanation: we group output by “filename” and count output, if output amount more then 1, display it, together with filename.

PS: why we had duplicated fields? We had two fields with NULL values inside. Stupid import from MS Access…

Posted on February 16, 2009 at 14:55 by admin · Permalink · Leave a comment
In: English, sql · Tagged with: , ,

Not very often used HTML tags

We all know <form> tag, as well as <ul><li> and so on… but how many of web developers used good old (and sometimes not just usefull, but VERY usefull) html tags in forms:

<fieldset>

<legend>

and

<optgroup label=”label”></optgroup>

in <select> ?

here are two good samples to use (taken from my new template engine version):


<form name="login" action="admin.php" method="post"  id="login">
	<input type="hidden" name="core_process" value="login"/>
	<fieldset>
		<legend>Your login:</legend>
		<label>Login</label><input type="text" value="" name="login"/><span class="core_req">required</span><br class="cleaner"/>
		<label>Password</label><input type="password" value="" name="password"/><span class="core_req">required</span><br class="cleaner"/>
		<label>&nbsp;</label><input type="submit" value="Login!"/><br class="cleaner"/>
	</fieldset>
</form>

and


    <select name="Counties">
    <optgroup label="England">
		<option>Bedfordshire</option>
		<option>Berkshire</option>
		<option>Bristol</option>
		<option>Buckinghamshire</option>
		<option>Cambridgeshire</option>
		<option>Cheshire</option>
		<option>City of London</option>
	</select>

Use it and mercifull god of W3C and HTML1.0 will (most likely) bless you!

Posted on February 16, 2009 at 14:54 by admin · Permalink · Leave a comment
In: English, JavaScript, WEB2.0 · Tagged with: , ,

Ukulele Orchestra of GB – The Good the Bad the Ugly

These guys really rock! I’ve heared their other compositions and they always do everthing look and sound so-o-o-o cool 🙂

Posted on January 12, 2009 at 21:17 by admin · Permalink · Leave a comment
In: English, Fun, JavaScript · Tagged with: , , ,

Latest from the cat’s life

This little fella is a really a good actor:

Posted on December 12, 2008 at 00:43 by admin · Permalink · Leave a comment
In: English, Fun