Here’s a quick command you can use to find any folders that are over a GB in size on a Linux OS.
sudo du -h / | grep '[0-9\.]\+G'
I recently found myself with the need to connect to a Mongo DB instance from a PHP application running on Amazon EC2. The PHP docs led me to this MongoDB extension, which seemed to be a good fit for my needs. Still, the matter of installation was a little bit less clear, considering that the EC2 instance was pretty barebones and lacked a fair number of the “standard” libraries that would enable this single line installation to work.
After a bit of finagling, I got everything to work via the steps I’ve outlined below.
Whenever a MySQL query contains a WHERE conditional, the database server must find all the matching rows before it can execute any operations. In order to optimize this matching, a database administrator might define an index on any columns he or she knows will be used more frequently in WHERE conditions.
Adding an index to an existing table with many rows, however, can take a long time or even fail entirely. Here’s a quick tip to deal with those situations.
Easier said than done, but nothing worth doing is ever easy, right?
1) Don’t complain about anything you’re not willing to make an effort to change. If you do choose to complain, then you have an obligation to do something about it.
2) Barring truly extenuating circumstances, do what you say you will, and do not do what you say you will not. Let your word speak volumes because it is your bond. If you are uncertain, remain explicitly uncertain to all relevant parties until such time as you can commit. Be wary of others who may sully the reputation of your word – either intentionally so or not – by ascribing false or unqualified quotes to you.
3) Let every choice you make be an opportunity to discover and define yourself more deeply. Make no unexamined turns, however unimportant they may seem. Be deliberate. Consider how your past and future selves will perceive your present words and actions. Strive such that your choices transform into principles you want to have. Actions form habits.
4) Endeavor to enter into all that you do without reservations nor expectations. Don’t hold back, and don’t only do things because of what you hope to gain. Respect the journey. Live fully and expect nothing, and everything will feel like a blessing.
5) Accept the existence of your worst self. Stare into a mirror until you cry. I guarantee no matter how comfortable you are with yourself, this will happen if you stare long enough. When you break, don’t look away. Realize that you are exactly the way you are meant to be – perfectly imperfect. It is alright to feel uncertain and to experience failure and to even hate yourself.
Recognize that you will not always be your worst self, nor can you always be your best self.
I recently had to export a database with over 50MM rows, and while I love using PHPMyAdmin for most database operations, the tool’s export functionality tends to crap out on larger data sets. This article outlines how to export a large MySQL database (with compression to save space!).
“Why the shoelaces?”
The question had emanated unexpectedly from the slight, dark-skinned woman working the register at CVS. I stopped fumbling with my wallet long enough to glance upward and meet a pair of striking, hazel eyes, which abruptly broke contact with mine before wandering for a few long seconds, settling finally upon the crest of my right shoulder. I checked to see if I had missed a stain.
“I’m hoping to make a noose, actually,” I replied. “You wouldn’t happen to know how to tie a hangman’s knot, would you?”
Our scene opens on a charming coffee shop on the edge of the Boston commons. It’s a crisp autumn day and I’m grabbing a midday pick-me-up with an aspiring entrepreneur friend, who has just informed me that she (or he) has enrolled in an intro to computer science course.
“Cool!” I’ll exclaim. Then, with a raised brow, I’ll often inquire, “What are you hoping to get out of it?”
Invariably, my friend will patch together a response involving some combination of the following two reasons:
…I usually respond with a dejected sigh. This is a scenario that I’ve experienced more times than I can count, and each time I’m two parts excited by my friend’s initiative and by the prospect of future CS-related banter, but one part concerned that my friend might not get what he (or she) wants out of the class.
The fact is, neither of the above responses are great reasons to enroll in an introductory computer science course (hereafter, “CS intro”), and here’s why…
The following is a thought piece I wrote for the internal Plastiq wiki. I wanted to share it in case others may find it useful for their place of work. Please be in touch with any questions, comments, or suggestions! A document like this only gets better with iteration.
Meetings are useful for two reasons and two reasons only: information sharing and decision making. A meeting should be called for one, the other, or both reasons.
Importantly, when I refer to “meetings”, I don’t mean ad hoc chats that may arise spontaneously around the office, although it’s important to be mindful of those too. Rather, meetings in this context refer to a time and place reserved for a set list of attendees to gather together and accomplish a well-defined goal. They can range from the informal (one-on-one catchups) to the formal (exec weeklys), and generally they would be well-served to follow some general guidelines.
So, without further ado, here are my 11 tips for productive meetings (in no particular order)…
If you’re SSH’d into a MySQL server and want to export MySQL query results to CSV (readable by Excel), simply add the below snippet to the end of your query.
INTO OUTFILE '/tmp/results.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n'
Note that ‘/tmp/results.csv’ in the code above should correspond to a writeable destination, and the file can’t already exist.