So You Want to Learn to Program

The Web Dev Stack

As I have gotten more involved in the programming community and local Philadelphia tech scene, I’ve had more people ask me how to learn to program. The best part of programming and working with technology is that there is so much to learn! You are never bored. Since my 9-to-5 is working as a backend dev for a website, a lot of the resources below apply to website development. However, there are general programming and small project resources too.

My biggest piece of advice is to find your motivator. Do you like crafting? Try hardware hacking with soft circuits and Arduino. Are you a language nerd like me? Try programming a text-based adventure game in a beginner-friendly language like Python or Ruby. I think the key thing is to find something that keeps you working on your new skill set. Then, once you have developed some confidence, try something new that is outside of your box. Reach out to the programming community online and in your area to make some developer friends. The key to sticking with it is to stay motivated but not frustrated. If you get frustrated, step away from the keyboard or reach out to your community for help. If you aren’t feeling challenged, your dev community can steer you in the right direction too. Programming is exciting, challenging, and satisfying. You are in for such a fun ride :)

Free Online Classes

A structured series of free classes, with a focus on going form zero to pro. Many of these classes are focused on technologies behind website development — the stuff in the picture above.
https://www.codeschool.com
http://teamtreehouse.com/
http://www.codecademy.com/

Hardcore computer science classes offered by some of the best universities in the US. This is a great way to get a deep dive on the math behind programming languages, fundamental principles of programming, and cool stuff like functional programming.
https://www.coursera.org/

Boot Camp

Have some time free time to deep dive into programming? Check out this three month immersion program in New York. It’s amazing and has support from the talented engineering team at Etsy.
https://www.hackerschool.com/

A free 10 day bootcamp by the awesome devs at skill crush.
https://skillcrush.com/skillcrush-10-day-bootcamp/

The four semester graduate program I went through. I cannot say enough good things about this.
http://www.cis.upenn.edu/grad/mcit/

Make Your Own Blog

If you love design, try getting started with a blog and one of the most popular content management systems out there.
http://codex.wordpress.org/Introduction_to_Blogging
http://wordpress.com/

Front End Dev

Ready for more detailed info on front end development?
http://slidedeck.io/EliseWei/gdi-intro-web-concepts — A great overview of front end dev by Elise Wei
http://www.w3.org/ — nerdy details on web standards and lots of references for coding up your own front end.
http://www.w3schools.com/js/ — a popular standard for making your site interactive
http://www.w3schools.com/html/html5_intro.asp — a popular standard for making your site interactive
http://www.csszengarden.com/ — a powerful demonstration of the power of CSS

Back End Dev

Interested in back end development?
http://learnpythonthehardway.org/ — an exercise-based start to programming and Python
http://rubykoans.com/ — get started with Ruby
http://codingbat.com/ — small, hands-on activities for learning Java and Python
http://ruby.railstutorial.org/ — get started with the Ruby web dev framework, Rails
https://docs.djangoproject.com/en/dev/intro/tutorial01/ — get started with the Python web dev framework, Django

Hardware Hacking

Make some cool projects and toys! Use these small but mighty hardware components and code to make RC cars, musical instruments, and so much more.
https://www.adafruit.com/
http://www.raspberrypi.org/
http://www.arduino.cc/

Classes and Resources in Philadelphia

In Philly? Here are some great local classes and events:
http://www.meetup.com/Girl-Develop-It-Philadelphia/ — an on going series of front end and back end classes
http://railsgirls.com/ — coming to town April 2014!
Don’t forget about user groups! You can meet some talented devs, check out some cool shops, and see the amazing things people are doing with code. Many can be found on meetup.com. My faves are Philly Python User Group and Philly Ruby Users Group.

Fundamental Dev Skills

These are what I consider to be essential, language agnostic skills every developer should know. Having these skills and judiciously applying them are two different things, so tread carefully as you craft your code.
Object Oriented Programming — an essential concept and design pattern for many languages
Model View Controller — an essential design pattern that describes how an OOP program is organized
Recursion — an essential programming skill for solving certain problems like navigating trees
Functional Programming — a feature of many languages
DRY Programming — a general principle for writing good code
Test Driven Development — a development methodology that emphasizes testing and planning
Pair Programming — a development methodology that emphasizes the value two people reviewing code as it is created
Code Review — the general idea of someone reviewing your code before it can be called “dev done”
Mocks and Stubs — a really handy testing feature, especially for testing integrations
Regular Expressions — a handy pattern identifier
Version Control with git w/GitHub — an essential tool for sharing, showcasing, and storing your code

Memory Problems on an AWS Micro Instance

This site has lately been plagued with mysql crashes. After lots of procrastination, I finally decided to look under the hood rather than just restart the mysql daemon. Here’s what I found in the mysqld.log:

mysql crash

Yep, that’s a fatal error.

Did you see the fatal error in there? Looks like this micro instance it having difficulty allocating memory. After doing a little Internet research, I discovered that AWS micro instances with Linux do not have a swap space configured by default. So, without swap space, the database was crashing whenever memory became unavailable (which was becoming more frequent). Boo!

There’s an easy solution, however — set up swap space on the instance. Here’s how I did that

  1. Run dd if=/dev/zero of=/swapfile bs=1M count=1024
    • this says, read from file /dev/zero, write to file /swapfile, reading 1m of data at a time, copying only 1024 input blocks.
    • For more on dd utility, see the wikipedia dd entry.
  2. Run mkswap /swapfile
    • make the swap area
  3. Run swapon /swapfile
    • turn on swapping
  4. In the /etc/fstab file, add this line: /swapfile swap swap defaults 0 0
    • this sets up the swapfile automatically after a restart

I then decided to take a closer look at total memory usage on the box by running free -m.

Yikes!

Yikes!

Whoa, that’s no good. Only 7M available? How much of that memory is actively being used by mysql? To check that out, I got the mysql pid by running ps -ef | grep mysql. Then I looked at the process status file at /proc/$pid/status.

Looks OK, but I just restarted this process.

Looks OK, but I just restarted this process.

Humm, not much memory being used here, but I just restarted the process not that long ago. To be safe, I set a bound on the amount of memory that mysql can allocate. I updated the /ect/my.cnf file to set a buffer pool size:

I then went back to looking at how memory is being used across the system by running top, shift+m.

well it's not using too much memory

Well, mysql is not using too much memory.

Looks like apache might be a bit of a pig too for this low memory machine. To limit the amount of work apache is doing on this little box, I made a special optimizing_memory.conf file in my /etc/httpd/conf.d directory; my http.conf file in /etc/http/conf automatically includes all config files from the httpd directory. Keeping my apache config changes in a separate file helps me keep track of my modifications versus the defaults. The content of the optimizing_memory.conf file are below, ripped directly out of this helpful apache tuning article.

I don’t think I need to adjust the memory usage in my php.ini file — it looks pretty reasonable.

php memory limit seems ok

The php memory limit seems ok.

Ok, so how is memory usage now? One more time with top, shift+m.

now apache is doing less work

Now apache is doing less work.

And how about free -m?

Sweet, not there is more memory available system wide!

Sweet, not there is more memory available system wide!

Looks like things are a little more under control. Now that I have a gig of swap set up and some bounds on memory usage, it’s time to sit back and hope that the site stays up more reliably :)

More Reading

Making a Baby Quilt

quilt

Bah! I can’t believe that my programming partner and buddy from grad school is going to have a baby. To celebrate the coming n00b, I decided to make Kelly a baby quilt. Have I made a quilt before? Nope. Was that going to stop me? Nope :) Many people helped to make this quilt a reality: the nice ladies at various quilt shops who answered my endless questions, my mom who cheered me on by email as I sent her updates, and Sarah Johnson whose enthusiasm bolstered me as I hurriedly finished the quilt. Babies wait for no one.

Sources for Fabrics, Notions, and Tools

  • Cloth & Bobbin – This shop stocks a nice variety of preppy and cheerful patterns. I bought the all-important yellow bee fabric here.
  • Lonni Rossi Fabrics – The owner/designer makes all sorts of art quilts and has tons of nature-inspired designs.
  • Spoonflower – I had these guys custom print the quilt label. They also have a really cool collection of designs that you can have printed on-demand. Check out the geek fabric section for some nerdy fun.
  • Joann Fabrics – My go-to source for notions and machine quilting thread.
  • Steve’s Sew and Vac – I got my sewing machine and walking foot from this shop. Their staff is fantastic and went to extraordinary lengths to help me set up my machine.

How To Guides

Supplies List

  • 2 1/2 yards of centerpiece fabric. You’ll want 12 4.5″ x 4.5″ squares, the border, and backing from this yardage.
    • This is the yellow bee fabric for this project.
  • 1 yard of dark fabric. Make 24 4.5″ x 4.5″ squares and the binding.
    • Gray fabric.
  • 1/2 yard of light fabric. Make 12 4.5″ x 4.5″ squares and the corner border patches.
    • Light orange fabric.
  • 1/2 yard of background fabric 1. Make 24 4.5″ x 4.5″ squares.
    • Plain white fabric.
  • 1/2 yard of background fabric 2. Make 24 4.5″ x 4.5″ squares.
    • Patterned white fabric.
  • 1/4 yard of accent fabric 1. Make 6 4.5″ x 4.5″ squares.
    • Bright orange fabric.
  • 1/4 yard of accent fabric 2. Make 6 4.5″ x 4.5″ squares.
    • Bright teal fabric.
  • Low pile, all cotton quilt batting.
  • Two spools of machine quilting thread.
  • Two spools of fine cotton thread for assembling the patches.
  • A walking foot for your sewing machine, if you don’t already have one.
  • Essential quilting supplies like a rotary cutter, cutting mat, cutting ruler, sharp scissors, iron, ironing board, starch, pins, and seam ripper. There is no substitute for the right tool for the job.
  • Time & patience.