MySQL Data Imports

Posted by & filed under PHP, Programming.

I recently needed to import a large CSV file into MySQL. After trying unsuccessfully to import the CSV through phpmyadmin’s web interface, and then trying equally as unsuccessfully to increase PHP’s size limitations, I decided to go right to the source.

After running some data cleanup commands, I had my CSV file ready to go on the server — /tmp/data.csv:

reports@reports:~$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.

mysql> connect my_database
Connection id:    4098
Current database: my_database

Query OK, 106249 rows affected, 65535 warnings (4.60 sec)
Records: 106249  Deleted: 0  Skipped: 0  Warnings: 1738230

As you can see, I have “LINES TERMINATED BY” set to “<>” which is the special character I needed to use at the end of my rows in my special situation. The field delimiter has also been changed to a pipe (|) symbol to alleviate issues with commas in the fields.

Lastly, I returned quite a few errors, and we can look at these by issuing:

| Level   | Code | Message                                                                  |
| Warning | 1264 | Out of range value for column 'ind_custom_date_02' at row 1              |
| Warning | 1264 | Out of range value for column 'ind_custom_date_03' at row 1              |
| Warning | 1264 | Out of range value for column 'ind_custom_date_04' at row 1              |
| Warning | 1264 | Out of range value for column 'ind_custom_date_05' at row 1              |
| Warning | 1264 | Out of range value for column 'ind_custom_date_06' at row 1              |

And I see that the warnings are fine, and due to empty fields in the source csv.


Posted by & filed under Programming, Web Development.

LESS extends CSS with dynamic behavior such as variables, mixins, operations and functions. LESS runs on both the client-side (IE 6+, Webkit, Firefox) and server-side, with Node.js.

Variables allow you to specify widely used values in a single place, and then re-use them throughout the style sheet, making global changes as easy as changing one line of code.

Mixins allow you to embed all the properties of a class into another class by simply including the class name as one of its properties. It’s just like variables, but for whole classes. Mixins can also behave like functions, and take arguments, as seen in the example bellow.

Rather than constructing long selector names to specify inheritance, in Less you can simply nest selectors inside other selectors. This makes inheritance clear and style sheets shorter.

Are some elements in your style sheet proportional to other elements? Operations let you add, subtract, divide and multiply property values and colors, giving you the power to create complex relationships between properties. Functions map one-to-one with JavaScript code, allowing you to manipulate values however you want.

PlayTerm — Watch the linux guru at work

Posted by & filed under Linux.

PLAYTERM is intended to raise the skills of terminal CLI users, share their skills and inspire others.
PLAYTERM wants to push forward a new way of education, because terminalsessions are language-independent, extremely educative & entertaining.

Basically, PlayTerm lets you ‘look over’ a guru’s shoulder, helping to learn the concept in the video.

It may sound strange, but eventhough CLI stuff sounds like an isolated environment, it is an extremely social playground. Since the eighties, billions of users have helped eachother improving their skills, to get things done faster.
However, there was never a playground for sharing this live, but only peeking over the shoulder of your neighbour (or a *N*X screen -x session).

PLAYTERM wants to restore the actual ‘live’ feeling, which was once established in the BBS scene. There, the BBS’es system operators could ‘takeover’ a users’s session..and show him the way around, or teach him a new programming language.