MySQL: recover root password

Apparently there is a pretty straight forward way to recover MySQL password. Although server root access is mandatory it is great solution in certain cases like recovering password of abandoned test server or when server was configured by someone else etc.

The key for success is to be able to (re)start MySQL using -skip-grant-tables option. In that case MySQL won’t ask for password.
Then simply reset MySQL password and restart MySQL ordinarily.

Details for each step are described by Vivek Gite in Recover MySQL root Password.

Android and cats

Sprint came out with entertaining Nexus 4G commercial introducing Android and cats.

Salesman interview or 13 x 7 is 28

Guide on how to understand English better

This hilarious guide can be actually used two ways:

  • it helps to understand the meaning hidden by some common phrases;
  • and it shows how to express yourself in a polite manner. 🙂

PHP Community Conference

It has been written a lot about PHP Community Conference in Nashville, TN. The conference was definitely worth visiting. It was packed with outstanding PHP developers who were willing to share their knowledge and experience.

This post is mostly for my own records. Thus further reading:

And traditionally a few pictures from the field.

Looking forward to PHP Community Conference 2012!

Scaling CouchDB

Recently I’ve decided to work further on my writing skills and volunteered to review Bradley Holt’s new book Scaling CouchDB. Especially since I am working on scaling MySQL and playing with MongoDB, I figured it would be a great opportunity to take a look at CouchDB too.

What’s in the book.

  • Good introduction on what scaling is and how it is different from high availability
  • Extensive overview of major scaling blocks like replication, load balancing and clustering including load testing guide using Tsung.
  • Comprehensive examples which actually could work as a CouchDB reference\cookbook. However if there are no plans for detailed review or trying the code, sometimes one may feel like it is not much to read once examples are skipped.
  • Great insight on how CouchDB works internally in certain cases. The book does not say ‘just do this’, it also explains how CouchDB processes certain commands internally.
  • Valuable warning and recommendation notes as great addition to examples.

Conclusion.

The book is short and really informative reference on scaling CouchDB. Also it is still a good reading with respect to scaling topic for those who are not working with CouchDB but interested in peeking at NoSQL world.

P.S.: I would like to thank Bradley Holt for letting me review his new book and providing an ebook version before the paper one was even printed.

Correct posture while using computer

MongoATL Conference

Two month after Meetup with Tom Albers I was able to attend MongoATL Conference. The event was very well organized and really useful and igniting for MongoDB newbies (like myself at that time).

Of course the first thing I did after the conference was installing MongoDB and playing with its native PHP extension. Although I wanted to document that experience Vikram Vaswani had already come up with a great article on Getting Started with MongoDB and PHP.

In addition just a few things to highlight:

  • MongoDB is really easy to start with and just works out of the box without any issues. So I was running my first query just a few seconds after it was downloaded.
  • Despite the above mongodb.org offers browser shell to try MongoDB out online. So there is a way to play with it even before any download\installation is needed!
  • If you are using Windows it is worth checking out a GUI tool MongoVUE which can be a great addition to the command line. Especially it comes really handy if one want to import some test data from MySQL or MS SQL.
  • The Little MongoDB Book is a free ebook by Karl Seguin which should help get started with MongoDB as well as answer common questions.

At the end couple pictures from the event via my cell phone. 🙂


This is before Indexing and Query Optimization talk. It is still a break – that is why it looks empty.

This is bonus picture from GA Tech parking lot where the conference was held.

Meetup with Tom Albers

Back in December I attended a project management meetup with Tom Albers.

While Tom has an impressive list of companies where he was either senior manager or vice president, the most notable and attractive was the fact that he was manager of web development at MySpace.com. It seems like that kind of background allowed him to gather over 100 software developers and project managers.

It was interesting to learn something new from Tom’s experience as well as hear few insights about software development at MySpace. Although many his recommendations overlapped with Rework, I would like to point out two things which are basically must know and follow for anyone who related to managing software development:

  • Present the problem, not the solution.
    Unfortunately there are so many cases when customers or managers do not trust their software engineers and ask them to implement certain solution without disclosing the problem or saying that it is the only possible solution. But it is not rare when after long discussions it turns out that the initial ‘solution’ is either not that great or even may not solve the problem at all.

  • If you are not drawing, you are not communicating your team.
    Hopefully it is not true anymore but some time ago it was not rare when white boards were considered unnecessary. Also Tom pointed out that a tablet (iPad in his case) works as a perfect tool for communication with remote teams. It takes just seconds to draw something using touchscreen and then share (unlike traditional desktop applications since it take more time to draw using mouse and keyboard).

At the end just couple pictures taken with my cell phone.


Tom is explaining his vision on who senior developer is.

Coffee-break.

More (and better quality) pictures are posted here.

PHP: IP Address Validation

It’s common to use a regular expression to validate IP addresses.
However I’ve run into couple reliable ways to validate IP address without help of regexps. This should make code cleaner and easier to read or debug in case of any issues.

The first way is to use PHP function filter_var() which returns the filtered data, or false if the filter fails.

$ip = filter_var($ip, FILTER_VALIDATE_IP);
if ($ip !== false)
{
  // IP address is valid
}

Note that filter_var() has been supported since PHP 5.2. So it will not work for ‘older’ production environments.
So here comes another way to validate an IP address which should work even for PHP 4.

if (long2ip(ip2long($ip))) == $ip)
{
  // IP address is valid
}

Also fliter_var() unlike ip2long()/long2ip() supports IPv6. For instance, there are four additional flags:

  • FILTER_FLAG_IPV4 – allow only IPv4;
  • FILTER_FLAG_IPV6 – allow only IPv6;
  • FILTER_FLAG_NO_PRIV_RANGE – dot not allow IP from private range;
  • FILTER_FLAG_NO_RES_RANGE – do not allow IP from reserved range.

For example, the code to allow only IPv6 not from reserved range should look like this:

 
$ip = "2a01:e35:aaa4:6860:a5e7:5ba9:965e:cc93";
$ip = filter_var($ip, FILTER_VALIDATE_IP, array(
                  FILTER_FLAG_IPV6, FILTER_FLAG_NO_RES_RANGE));
if ($ip !== false)
{
  // IP address is valid
}

« Previous PageNext Page »