I love The Pomodoro Technique. It’s so simple. You pick some task you have to do, set a timer for 25 minutes and go. For those 25 minutes, don’t do anything else. Just do the task. No facebook, no videos, no nothin’. Then take a 5 minute break and do it again. when you take your fourth break, make it 20 minutes. Lather, rinse, repeat. There’s more to it: getting better at avoiding distractions, time estimation, etc. I really should get around to reading the book sometime.

How to learn Ruby while sitting on the toilet.

This post is only for those of you with an android phone. If that’s you, go install the Ruboto irb app on your phone. Open up Ruboto and type the following:

print "chunky bacon"


Hit “go” and you should see this:

>> chunky baconnil


Don’t worry about that ‘nil’ thing at the end. It’s just the value that print returns. If that annoys you you can add a space:

print "chunky bacon "

Now you need a Ruby tutorial. I heartily recommend Why’s Poignant Guide To Ruby. It’s full of fun, silliness, it’s a great read, and you’ll be learning before you know it.

The Basecamp Books

I’ve just bought and read what many people might think of as the 37signals or Basecamp Books: Getting Real, REWORK, and REMOTE. They’re all gold. Getting Real is about how to develop a web application without most of the detritus (documents, charts, long time tables, large teams, and other crap) that can surround such efforts. It’s an agile book. Agile and Scrum are (apparently widely adopted) methodologies for software development that I intend to learn more about.

The Basecamp folks (formerly named 37Signals) realized that the principles in Getting Real applied to more than just web development. They expanded and add to their ideas of keeping your products and business small and sensible in REWORK. REMOTE is all about how to successfully run a business in which many or most employees work remotely.

I kept laughing and nodding my head all the way through these books. I have fallen in love with these people. They have inspired me to create my own application and, perhaps, my own business. It will be a personal organization app. Boy do I need help with personal organization, time management, goals, and all that stuff. I’ll keep you posted on my progress.

Why don’t we sleep enough?

We all know we’re supposed to. And now there’s evidence that not sleeping enough causes freaking brain damage. So why don’t we do it? In his book, Rework, Jason Fried encourages us to go to sleep. If you don’t, he claims you get stubborn about working on a problem for too long without a break and you lose your creativity. That seems to match my experience.

Well I’m done. The fact that I may have already irreversibly damaged my brain by years of not sleeping enough really bothers me. From now on if I have to choose between finishing an assignment on time and sleeping for 8 hours, I choose sleep. I should be planning better anyway so I don’t have to make that kind of choice. I’ve been sleeping right for the last few days. Wish me luck and go to sleep early tonight!


GNU Make

Intimidated by the GNU building tool Make? I sure am. I mean I can get buy but I’d like to know it better so I can take advantage of more features. My instructor in one of my classes has made a good introductory pdf tutorial, in the tutorial he also links to the free O’Reilly make book. I’m only making a simple program at the moment so here’s what I wrote for my assignment:

  1 all: My_Program.c
  2     gcc -Wall -g -o My_Program My_Program.c
  4 clean:
  5     rm My_Program
  7 make_run_clean:
  8     gcc -Wall -g -o My_Program My_Program.c
  9     ./My_Program
 10     rm My_Program

I’m positive this is not the most elegant way to do this but here’s how it works. Every one of those words with a colon after it (like all: up there) is a rule that gets executed when you execute the make command with the name of the rule like so:

$ make all


$ make clean

In the case of all it compiles My_Program. clean removes the compiled program (the executable file generated by the compiler). And make_run_clean compiles the program, runs it, and then gets rid of the executable file. This way all I have to do to recompile and run my program is type this in my terminal:

$ make make_run_clean

Otherwise I’d have to do all those steps separately.

Showing My Work: Design Patterns Homework

I just finished Austin Kleon’s wonderful book Show Your Work. At the end of the book is an assignment to share what I’m working on right now. For me that’s homework. I can’t share my code but I can write a little about the assignment I just finished.

One of the classes I’m taking is Object Oriented Design Patterns which uses the famous (at least in software development circles) Design Patterns book as a text. I’ve also been reading a bit of the Head First Design Patterns book, which has been recommended to me by lots of people.

Basically design patterns are a collection of solutions to common software development problems. It makes sense that, eventually, developers would start to notice the same kinds of solutions come up again and again in different applications. Our textbook is a basically a catalogue of some of these. From what I’ve learned so far, the idea behind most of them is to abstract away and isolate those things in your program that are likely to change a lot. That way it’s easier to change those pieces without worrying about breaking the rest of your program.

We’ve been following an example in the textbook and building (step by step through multiple assignments) a document editor called Lexi. Lexi uses the Composite Pattern where every element in the document is an object (called a Glyph) that, to other parts of the object, look exactly the same. There are Row Glyphs and Column Glyphs. These can contain other Glyphs, including other Column or Row Glyphs. Other Glyphs can be shapes like Rectangle Glyphs or individual Character Glyphs.

A document in Lexi is simply a recursive structure of Glyphs. The advantage of this approach is that you can use a very simple formatting algorithm to format it all. The formatter, or Compositor as it’s called in the book, doesn’t have to know what kind of Glyph each thing is. When formatting, it pretty much treats characters, rows, columns, and whatever exactly the same.

The Compositor uses the Strategy Pattern. which makes it easy to switch between formatting algorithms and have each individual Glyph easily have its own unique Compositor (containing its own unique formatting algorithm) if need be. The assignment I just turned in added the Decorator Pattern, which allows you to easily add responsibilities to an object without having to rewrite that object’s class. We used it to add borders and scrollbars to Glyphs, but, like all of these patterns, you can do a lot more with it.

By the way, this last assignment was way harder than I thought it should have been. Making the Decorator behave properly proved to be a big challenge. I should do a post about hitting a wall with difficult problems, or those moments in assignments when everything seems to go wrong.

Java varargs

This is kinda neat.

SomeClass someFunction(SomeOtherClass... someArguments) {
    for(int i = 0; i < someArguments.length(); i++) {

I discovered the syntax for it in this post. I’m currently using it to write code in a sort of functional style where most of these functions take any number of arguments:

//Yes, I'm writing Java this way.
//Don't shoot me if I've got the parentheses wrong. :P

Getting Started With SQL

I’m taking a databases class this semester and after spend a lot of time with EER diagrams we’ve finally gotten to the good stuff, SQL, the database language. Databases are those things that applications use to store data. Amazon has one to keep track of all its books, customers, purchases, etc. Facebook uses one to keep track of all its users and their data. Google uses one for Gmail, Google Maps, and most of its other services. Databases keep track of your pay at work. They’re used for damn near everything.

Do you want in on some of this action? Here are some MYSQL installation instructions for Ubuntu and The Mac. W3 Schools (a wonderful tutorial site for all things web) has a very nice tutorial to get you going. Also, here is a detailed explanation of common queries with a diagram at the bottom that I ended up referring to a lot.  I found very helpful while doing homework.

As you get more adept, you’ll start to write more complicated queries. Queries are simply requests you make to a database. They’re requests for information the database contains, or requests to change some part of the database. Queries written in SQL are equivalent to english language statements like “Show me all the employees who make less than $50,000 a year”, “Show me the record high temperature for today”, or “Add new album”. Of course, first someone has to create an employee, weather, or music store database and fill it with data before you can make queries like that. The above tutorials will show you how.

So far I’ve found that, since the SQL database is basically designed to hold sets of records, it really helps to think of your queries as set manipulation. You can join sets together, exclude stuff from sets, if the set you looking for is too difficult to figure out you can look for everything not in the set, not A, and then ask for not not A.

That should be enough to get you going. If you have any questions, please feel free to post them in the comments below.

Posted in SQL

It’s All Gone Wrong

Well…. Maybe I’m being a bit too dramatic but, as always, my plans went aglay. At the beginning of the semester I had the idea that, since I’m taking less than a full semester’s worth of units and I’m not working at my internship, I ought to try to study 2 to 3 hours for every credit hour, like people recommend. For someone who tends to rail against being told what to do, I sure find myself doing the recommended thing often enough, usually to my detriment.

Now, just a few weeks into the semester, that’s all gone out of the window. I’m my normally disorganized self and feel a little bit at sea. Not only that, projects that I think are pretty important to my future career (involving Big Data, learning Data Structures and Algorithms really well, and learning how to manage a development team) are either just limping along or haven’t gotten off the ground. Also, my house is still messy, I’m not bringing food from home because I’m too disorganized, and I’m not following through with my resolution to get more fit.

Why should I work any more than I need to? Shouldn’t I, instead of focusing on how much time I’ve spent studying, concentrate on learning the least amount I need to know in the fastest way possible? Once I’ve done that, I can then decide what I think is worth doing/learning. How fast can I get the assignment done? How can I make sure it’s right? How can I, most quickly, learn what I need to to get a good test grade? How can I verify that I’m ready? At the moment this approach makes more sense to me.