Recently I was working on optimising our internal application at work that is heavily MySQL driven. I was focusing on reworking SQL statements and making sure we are utilizing indexes properly. Modyfing and toying around with tables on live server is less than ideal so I needed a way to reliably and quickly move the data elsewhere so I can steadily experiment and fine tune sql statements and tables. Instead of using available phpmyadmin export options I decided to work directly with mysql which gives you more controll.
Here’s the syntax to perform mysqldump form MySQL docs:
shell> mysqldump [options] db_name [tbl_name ...]
An example of this for InnoDB table would be:
mysqldump -u myusername -p --single-transaction exampledb exampletable > exampletable.sql
This command executed on the server where your MySQL is installed will export to the file “exampletable.sql” in the current working path.
By default mysqldump will lock the tables. That means if there are any insert/update/delete commands issued they will wait until dump is finished. Again, this is less than ideal if you’re exporting data from your live database.
In our case we can skip locking tables since we just want this data for testing purposes but you should learn more about why sometimes you want to lock the tables.
In example above the table is using InnoDB storage engine. For that setup you want to use –single-transaction option in order to avoid locking the table. If your table is using MyISAM storage engine you should use –lock-tables=false option.
Now to load it into a new database, we execute the following command:
mysql -u myusername -p testdb < exampletable.sql
Importing table will take a bit longer than exporting it due to HDD I/O characteristics but the whole process in general is pretty quick.
Now you can profile your sql statements, tune indexes etc. on your table without affecting your live application.
Once you're done with the tunnig and you know what you want apply your findings to the live table.
Here’s an example of how to calculate Euler number. The higher the number of iterations the more precise Euler number will be, but the time to compute it grows exponentially Learn more about Euler number
>>> a = 1.0
>>> for z in range(1, 100):
... a += (1.0 / reduce(lambda x,y:x*y, +range(1,z+1)))
Whenever I work on small web projects I tend to edit files live to speed up the process. I used to use Filezilla FTP client for this purpose although every time you’re saving the file, Filezilla asks you if you want to overwrite the file. This becomes a little bit annoying over time.
On another note, If you’re developing on Windows I suggest you look at WinSCP free FTP client that will let you edit file live and won’t bug you every time you’re saving it.
If you like to develop websites using Ubuntu Linux I suggest using native file explorer called Nautilus to access your FTP files.
Nautilus let’s you mount FTP resource as a folder and edit files on the fly.
To set it up go to “Places” >> “Home Folder” in the top bar or type in “nautilus” in the terminal. After application loaded click on “Go” >> “Location”. In the Location box type in the following: ftp://email@example.com (you can also use IP address instead of domain). For secure ftp just change the protocol name to sftp://. Once you connected successfully a new window will open with your ftp resource. Now you can just click and edit the file with your favorite file editor.
Client: Amtec Intl of NY
While working for Amtec in the advertising department, my manager asked me if I could create a website for them. The objective was to create a clean and slick website for Polish Beer fans. The website was to contain information about beers from Zywiec Brewery, user registration and a listing with upcoming events related to the product. The website also has a simple and custom-made Content Management System (CMS) to provide administration over registered users and gives the possibility to send HTML formatted e-mails.
XHTML, CSS, XML, Flash, jQuery, PHP, MySQL
Orent is a design and renovation company located in NY. Initially they hired me to take photos and make panoramas of some of the apartments they worked on. Soon after, they asked me if I could work on the website too. Wojtek and Adam, the brains of the firm are both amazing guys. The first time we met, they already knew what they were looking for. The idea was to bring a very clean and bright web design to focus more on their accomplishments in the portfolio section of the site.
XHTML, CSS, jQuery, PHP
Polish Sailing Club of NY
Client: Damis Restaurant
My first project after moving to the US was creating a website for Damis Restaurant. The website you see here is actually a second reincarnation that was created 2 years after the first website. The design was completely changed to match the restaurant’s feel. It includes a simple, custom-made CMS that gives the ability to post News/Events and control entries in the Guestbook. Additionally, the 360 degree panorama was made to show the restaurant from the inside.
XHTML, CSS, PHP, MySQL
Most of us would probably agree that if you wanted to create a single language website and wanted it to be accessible to the broadest audience, you should write the content in the English language. Although the English language has become international, there are still many countries where it is not spoken. What do you do if you want your website to be easily accessible for viewers from specific nationalities? You simply include multilingual content on your website.