Code Snippets

mysql import progress

2014/06/24 | Permalink | Comment?

It’s really easy to keep an eye on the importing progress, as easy as:

pv database_backup.sql | mysql -u user -p

What really pv does? It monitors the progress of data through a pipe.
So the progress bar and ETA will not be accurate, because the speed of the import will depend on other factors too, but it’s a great indicator.

Tags: , ,

Code Snippets

Counting the files in a Unix Directory

2013/11/22 | Permalink | Comment?

Count files in the actual folder and his subdirectories.


find . -type f | wc -l

via Counting All Files in a Linux Directory.

Tags: , ,

Bookmarks

Why use your application-level cache if database already provides caching?

2013/11/06 | Permalink | Comment?

Dean Harding

  1. Generate the SQL from the ORM’s “native” query format
  2. Do a network round-trip to the database server
  3. Parse the SQL
  4. Fetch the data from the cache
  5. Serialise the data to the database’s over-the-wire format
  6. Deserialize the data into the database client library’s format
  7. Convert the database client librarie’s format into language-level objects (i.e. a collection of whatevers)

Robert Christie

  1. An application caches just what it needs so you should get a better cache hit ratio
  2. Accessing a local cache will probably be a couple of orders of magnitude faster than accessing the database due to network latency – even with a fast network

java – Why use your application-level cache if database already provides caching? – Stack Overflow.

Tags: , ,

Bookmarks

How to Install Command Line Tools in 10.9 Mavericks Fresh Install

2013/10/27 | Permalink | Comment?
xcode-select --install

via How to Install Command Line Tools in 10.9 Mavericks Fresh Install.

Tags: , , ,

Bookmarks

Where are MySQL data files stored?

2013/10/25 | Permalink | Comment?

MySQL installed with the official .pkg installer

Socket File

/tmp/mysql.sock

Data Files

/usr/local/mysql/data/

Error Log

/usr/local/mysql/data/HOSTNAME.err (insert your hostname)

Base Directory

/usr/local/mysql/ (this is a symbolic link)

MySQL pre-installed on Mac OS X Server

Socket File

/var/mysql/mysql.sock

MySQL 5 installed with MacPorts

Socket File

/opt/local/var/run/mysql5/mysqld.sock

Data Files

/opt/local/var/db/mysql5/

Error Log

/opt/local/var/db/mysql5/HOSTNAME.err (insert your hostname)

MySQL installed with MAMP

Socket File

/Applications/MAMP/tmp/mysql/mysql.sock

Data Files

/Applications/MAMP/db/mysql/

Base Directory

/Applications/MAMP/Library/

Error Log

/Applications/MAMP/logs/mysql_error_log

MySQL installed with MAMP PRO

MAMP PRO shares many paths with MAMP, with the following difference:

Data Files

/Library/Application Support/appsolute/MAMP PRO/db/mysql

MySQL installed with XAMPP

Socket File

/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock

Data Files

/Applications/XAMPP/xamppfiles/var/mysql

Configuration File

/Applications/XAMPP/xamppfiles/etc/my.cnf

MySQL installed with Zend Server CE

Socket File

/usr/local/zend/mysql/tmp/mysql.sock

via Sequel Pro

Tags: , ,

Bookmarks

How to check if an email address exists

2013/10/22 | Permalink | Comment?

Besides syntactical validation of email addresses, sometimes could be really useful to check if a given email address actually exists. For example when you know that you’ll have to send very important communications to your user (tickets, bills? non just newsletters).

Here is how to use the SMTP protocol to do this without actually sending an email. Basically you can initiate a standard communication with the recipients SMTP server, set the recipients’ email address and read the server response, which will be an error if the address is wrong. Then simply quit the communication without sending any email. Simple!

Here is the complete article: http://www.webdigi.co.uk/blog/2009/how-to-check-if-an-email-address-exists-without-sending-an-email/

Tags: , , , ,

Bookmarks, Code Snippets

jQuery jsonp

2013/10/17 | Permalink | Comment?

Library to better manage JSONP requests, and to handle errors.

jaubourg/jquery-jsonp.

Tags: , , , , ,

Code Snippets

Install mcrypt for PHP (and Laravel?) on Mac OSX

2013/10/10 | Permalink | Comment?

Install with MacPorts


sudo macports php5-mcrypt

Then do not forget to edit the php.ini and add the entire extension path!


extension=/opt/local/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so

via osx – Installing Mcrypt extension for PHP on Mac OS X 10.5.8 – Stack Overflow.

Tags: , , , ,

Code Snippets

Install OpenSSL for PHP on OS X

| Permalink | Comment?

Quite slow but it works


sudo port sync

sudo port selfupdate

sudo port install php5-openssl

via Can’t run Composer on my Mac Mountain Lion – openssl extensionpen.

Tags: , , , ,

Code Snippets

Install composer (globally) on Mac

2013/10/09 | Permalink | Comment?
curl -s http://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer.phar

And if youre even more lazy, like me, you can create an alias:

alias composer=/usr/local/bin/composer.phar

This way you can invoke composer with just composer

Update: Composer now offers another method as well on the website:

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

via php – Global Installation of Composer manual – Ask Ubuntu.

Tags: , , , ,
« Previous Entries