Author: Moazzam

  • Light sensor for Arduino

    Okay, I know this is not rocket science. All you do is hook up a photocell to a resister and hook that up to Arduino. Viola! you have a light sensor. I wanted to create a modular light sensor I could attach / detach from projects so I took a container of Airborne and put…

  • Wirelessly controlling Arduino

    After I got my curtains open/close from my computer, I wanted to be able to do things wirelessly so I didn’t have to go to my computer every time I wanted to switch my fan on or open and close my curtains. If you don’t want to get the XBee wireless module for Arduino (which…

  • My adventures with Arduino

    About two month ago, someone I know told me about this micro-controller called Arduino that can be used to make some cool things. So, I started experimenting with it and I have to say it really is very cool. You can make robots with it, control your lights, open or close your curtains, etc. The…

  • Copying tables in MySQL

    There are multiple ways this can be done. I will mention two here. Method 1 In MySQL, run these statements: /*This will create table2 with the schema of table1*/ CREATE TABLE `table2` LIKE `table1` /*This will copy the data from table1 to table2*/ INSERT INTO `table2` SELECT * FROM `table1` Method 2 On the command…

  • Get just the fields names of a table in MySQL

    If you do: describe `table_name` Mysql will give you table information which will contain field names, their types, etc. What if you want just the field names and nothing else? You can run this query and do just that: SELECT column_name FROM INFORMATION_SCHEMA.columns WHERE table_name = ‘tablename’ AND table_schema = ‘dbname’;

  • 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.…

  • 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` FIELDS TERMINATED BY ‘,’ OPTIONALLY ENCLOSED BY “\”” LINES TERMINATED BY ‘\n’ (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…

  • Tips for a Speedy Zend Studio

    I found a good article on how to speed up your Zend Studio (eclipse based) on Zend’s website. Hopefully everyone else will find it as helpful as I found it to be: http://kb.zend.com/index.php?View=entry&EntryID=480

  • Virtual hosts look up taking too long in OSX Lion

    If your mac (OSX Lion) is taking too long to get pages with your local web server and you have virtual hosts setup, then it’s probably because it is checking the DNS servers before it checks for it in your /etc/hosts. The way to resolve this is to have a ::1 entry in your hosts…