Code Assist in Zend Studio (eclipse based)

Have you noticed there is a delay autocomplete suggestions when you type in a variable name or a function name? My typing speed is decent and I found the code assist delay to be too much. By the time Zend Studio was ready to show me the suggestions, I had already typed the variable name.

By default, Zend Studio has a 200 millisecond delay in showing code assist. You can shorten it if you feel the delay is too long. I set it to 100 milliseconds.

Go to Preferences -> Java -> Editor -> Content Assist -> Auto-Activation and decrease Auto activation delay from 200 to 100 (or whatever suits you better).

Importing a CSV file into a table in MySQL

Here’s how you would import data into MySQL using a query

If the CSV file was created in Windows, then replace '\n' with '\r\n' 
LOAD DATA LOCAL INFILE '/path/to/csv_file.csv' INTO TABLE `table_name`
(field1, field2, field3);

Cool things you can do with MySQL

Run a query from command line

# Use the -e flag
shell>mysql -e "select * from table"

Tell MySQL to output the results of a query in HTML or XML

# On command line you would write the following to 
# tell MySQL to output the results in HTML format
shell>mysql -e "select * from table" --html

# This is for XML
shell> mysql -e "select * from table" --xml

# This is for batched results
shell> mysql -e "select * from table" --batch

Zend Server and Zend Studio9

If you have Zend Server installed and you have an instance of MySQL that didn’t come with Zend Server, then Zend Studio will try to connect to the one that came with Zend Server. I discovered this the hard way when my PHPUnit tests kept failing in Zend Studio but ran perfectly from the command line (I had PHPUnit installed from PEAR and the one that came with Zend Studio).

So I decided to make Zend Server connect to my default MySQL instance instead of uninstalling Zend Server (because I want to play with it). For those with the same problem, you can do this:

# Rename Zend Studio's socket file to something else
# If you didn't choose the default, installation path then 
# use the path to that location instead
mv /usr/local/zend/mysql/tmp/mysql.sock /usr/local/zend/mysql/tmp/mysql_old.sock

# My MySQL installation's socket file is located in /tmp
# If your's is different, then you will have to modify the source path

ln -s /tmp/mysql.sock /usr/local/zend/mysql/tmp