Fedora Update

By Jacob Cohen | July 4, 2008

The Fedora system has been running for a few days now. One minor annoyance I’ve encountered so far is the way the system uses yum. It’s not that I find yum to be a bad package manager. On the contrary, it is very easy to use. The problem comes from how yum will create a lock file whenever it is doing anything, and no other yum operation will proceed until that lock is available.

I can understand the purpose behind such a lock. After all, you wouldn’t want concurrent modification of the system’s picture of what is installed and what version everything is, and so on. However, the problem arises from the fact that the lock is held for absolutely everything. I started a routine system update, and it held the lock for the entire time it was downloading all the new packages. It was waiting for network data while holding an exclusive lock on the whole system.

It is generally considered best practice to hold an exclusive lock for the minimum amount of time necessary to ensure correct behavior. It seems yum is going far beyond this limitation and just trying to acquire the lock before anything happens at all.

Topics: General | No Comments »

Set up a Fedora development box

By Jacob Cohen | June 26, 2008

I decided to switch my spare (old) PC to run Fedora for development purposes. I was able to set up a reasonable approximation using Cygwin, but this will more closely resemble the environments to which I deploy my projects.

Getting Fedora running was more difficult than I expected, though this was not entirely Fedora’s fault. The first issue I was having was that the computer did not want to boot from a burned CD-R with the installation image. I tried two different CD burners and even verified that the computer would still boot from a OEM Windows XP cd, but it just wasn’t going to boot up from the burned disc. Fortunately, I had a couple spare USB keys lying around, so I used one of them to create a bootable drive for the installation.

Installing to the hard drive was trivial once I had booted from the USB key. After installation, I rebooted, which is where I encountered my next set of hurdles. The new package manager front end that comes with Fedora 9, called PackageKit, would not show me any software to install. It just sat there with a status message saying “Waiting for other tasks to complete”. What other tasks? Can I see what their progress is? Apparently not.

I wanted to get going with git and ruby on rails, so I checked out my environment. Hmm. It barely comes with anything. Not even make or gcc. I added myself to my sudoers file to make installing my necessary software easier. At least I appear to have yum installed, so I used that to get myself back to a reasonable starting point.

(snipped the password prompts and output from these for brevity)
[cohen@localhost ~]$ sudo yum install git
[cohen@localhost ~]$ sudo yum install ruby
[cohen@localhost ~]$ sudo yum install rubygems
[cohen@localhost ~]$ sudo gem install -y rails

Now I’m back to a reasonable baseline and can continue development.

Topics: General | No Comments »

Ruby on Rails, Cygwin, and Git part 1

By Jacob Cohen | May 9, 2008

This is the first of what will probably become a series on using Ruby on Rails under Cygwin, with source control managed by Git. This might raise a couple of questions, which I will attempt to answer here.

As for getting it all running, I’ve covered that in a previous post.

For now, I’ll just cover the basics of getting a Rails project started under Cygwin, using Git for source control.

First, I’ll create the directory which will hold the rails application, git repository, and everything else I’m working on. Then, I’ll initialize a git repository, and see that everything is working.

cohen@ceres ~
$ mkdir paste

cohen@ceres ~
$ cd paste

cohen@ceres ~/paste
$ git init
Initialized empty Git repository in .git/

cohen@ceres ~/paste
$ git status
# On branch master
#
# Initial commit
#
nothing to commit (create/copy files and use "git add" to track)

As you may have guessed, I’m going to be using my Nopaste application as a project, rewritten using Ruby on Rails. Next, I’ll run rails to initialize my project and check what Git thinks has changed. (Note: I originally had an issue under Cygwin where rails couldn’t read from /dev/urandom, but I was able to get around it by removing the :urandom entry from the GENERATORS line in the random generator file. Running rails -t will print a backtrace on errors so it’s easy to find the right files to tinker with.)

cohen@ceres ~/paste
$ rails .
      exists
      create  app/controllers
      create  app/helpers
      create  app/models
  ... snip ...
      create  log/production.log
      create  log/development.log
      create  log/test.log

cohen@ceres ~/paste
$ git status
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add …” to include in what will be committed)
#
#       README
#       Rakefile
#       app/
#       config/
#       doc/
#       log/
#       public/
#       script/
#       test/
nothing added to commit but untracked files present (use “git add” to track)

Git is saying it has noticed a bunch of new stuff that it currently isn’t tracking. We need to get this stuff into our Git repository. I’ll do that, then commit it all onto the master branch.

cohen@ceres ~/paste
$ git add *

cohen@ceres ~/paste
$ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached …” to unstage)
#
#       new file: README
#       new file: Rakefile
#       new file: app/controllers/application.rb
#       new file: app/helpers/application_helper.rb
    … snip …
#       new file: script/runner
#       new file: script/server
#       new file: test/test_helper.rb
#

cohen@ceres ~/paste
$ git commit -m “Generated an initial Rails project”
Created initial commit cf547ba: Generated an initial Rails project
 43 files changed, 8339 insertions(+), 0 deletions(-)
 create mode 100644 README
 create mode 100644 Rakefile
 create mode 100644 app/controllers/application.rb
 create mode 100644 app/helpers/application_helper.rb
    … snip …
 create mode 100755 script/runner
 create mode 100755 script/server
 create mode 100644 test/test_helper.rb

Now I can test my new rails project and see what I get.

cohen@ceres ~/paste
$ ruby script/server
=> Booting WEBrick...
=> Rails application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2008-05-09 00:56:59] INFO  WEBrick 1.3.1
[2008-05-09 00:56:59] INFO  ruby 1.8.6 (2007-03-13) [i386-cygwin]
[2008-05-09 00:56:59] INFO  WEBrick::HTTPServer#start: pid=3012 port=3000
127.0.0.1 - - [09/May/2008:00:57:01 GMT-8:00] "GET / HTTP/1.1" 200 7557
- -> /
127.0.0.1 - - [09/May/2008:00:57:01 GMT-8:00] "GET /javascripts/prototype.js HTTP/1.1" 200 125605
http://localhost:3000/ -> /javascripts/prototype.js
127.0.0.1 - - [09/May/2008:00:57:01 GMT-8:00] "GET /javascripts/effects.js HTTP/1.1" 200 38916
http://localhost:3000/ -> /javascripts/effects.js
127.0.0.1 - - [09/May/2008:00:57:01 GMT-8:00] "GET /images/rails.png HTTP/1.1" 200 1787
http://localhost:3000/ -> /images/rails.png

Next, I’ll start using branches to make some modifications, such as creating my database configuration.

Topics: General | 2 Comments »

Interviewing, Part 1

By Jacob Cohen | May 3, 2008

This is the first installment in what may become a series of posts on how to do better in technical interviews.

Most technical interviews have a few key areas in which you need to demonstrate some skill or experience, such as problem solving, algorithms, data structures, programming language concepts, dealing with ambiguity, writing code, and communications skills.

Let’s take an example problem that might come up in a technical interview situation: printing a binary tree in depth level order. This type of problem tests several areas at once. First, do you know what a binary tree is, and how to perform various operations on them? Next, do you recognize that this requires a breadth-first search algorithm instead of the usual depth-first searches you would use to, for example, print the tree in value order? Then, can you pick relevant and useful data structures to help attack the problem, and can you write code that had a reasonable chance of compiling and solving the problem correctly?

If you’re weak in any of the above areas, you will have difficulty with a problem like this, even though it seems like a basic coding problem on the surface. Other problems will cover different combinations of various technical skills and aptitudes, so you need to be pretty well versed in everything to pass a technical interview.

So to prepare for a technical interview, take some time to make sure you are adept in all of these areas. Tackle unfamiliar problems and make sure you write code to solve them. Be familiar with standard data structures and how they are found in the programming languages you expect to use to solve the problem. (e.g. it’s difficult to solve a graph problem in Java if you don’t know how to represent or manipulate a graph in Java).

And make sure you are solid in your programming language of choice. Nothing makes an interview go bad faster than forgetting how to do simple things like string/integer conversion, sorting, basic arithmetic operations, memory allocation/deallocation (if applicable), and so on. A candidate for a programming position is expected to already be solid at programming. You need to give the impression that the time the company will invest in getting you up to speed is going to be spent familiarizing you with the company’s code base and particular way of doing things, *not* teaching you how to write basic code.

Topics: General | No Comments »

Added Remove Paste Capability to Nopaste

By Jacob Cohen | April 17, 2008

Every so often I receive an e-mail from someone who has posted something they didn’t mean to to my Nopaste site, and they want it taken down. Since I don’t check my rafb.net e-mail very often, I usually can’t catch these before they have been deleted by the 24 hour expiration period anyway.

However, as a means of helping these people out, I’ve added the ability to remove pastes that you have created. At the top of the page there is a “Remove this paste” link which will remove all publicly-visible traces of the file from the system, and indeed the content is absolutely gone. I don’t archive the content of pastes.

Topics: General | 2 Comments »

Word’s Ribbon seems to be missing an important feature

By Jacob Cohen | February 29, 2008

Microsoft’s Office software has been redesigned with a new “Ribbon” instead of the old toolbar. The idea is that the ribbon can give better design based on information architecture to put the give greatest prominence to whatever the most relevant tools are for whatever it is you are doing.

And rather than using obscure menu names like “File” and “View” and “Edit”, the ribbon is categorized based on general categories that more accurately reflect the things you can do from that view of the ribbon, such as “insert” and “page layout”.

This all seems like a pretty neat concept. The operations I use most often are all within easy reach. Or are they? How do I print the document?

Let’s see.. maybe it’s on the Home ribbon:
word1_t.png

Or on the Insert ribbon:
word1_t.png

Or perhaps the Page Layout ribbon:
word1_t.png

Hmm.. maybe the References ribbon:
word1_t.png

Mailings doesn’t seem likely, but we’ll see:
word1_t.png

Ah, Review sounds likely, maybe it is there:
word1_t.png

Last ribbon, it must be here:
word1_t.png

But wait, it wasn’t on any of the ribbons. If you want to print, you have to click on the “Office logo menu” or whatever this thing is supposed to be.
word1_t.png

Why is this functionality buried in some obscure menu that doesn’t even look like a menu? Why isn’t it on the ribbon? Surely printing a document is a task of primary importance to the average user of this application.

Then I thought, perhaps the ribbon only represents things you can do to edit the document, and the operations you do with the document, such as saving, opening, printing, and so forth, are found elsewhere. But why can’t this be a category on the ribbon? Why should I have to remember what’s in that unlabeled dropdown menu when the rest of the operations are presented visually?

Topics: General | 8 Comments »

New Car Wish List

By Jacob Cohen | February 14, 2008

Similar to my Mobile Phone Wish List, this is a list of the features I would want on my next car.

Topics: General | 5 Comments »

Can a Hardware Platform be Closed?

By Jacob Cohen | January 29, 2008

In the comments left for Jeff Atwood’s recent post on closed platforms, there is a discussion about his comparison between traditional dongles and the hardware of the Apple Macintosh itself.

A user named Brandon left the comment,

I’m not sure Apple hardware, say PPC and Intel on, counts as much of a dongle. Especially Intel based hardware. You can freely install any OS you want on it, they [Apple] even bundle the Windows drivers for all the proprietary hardware, backlight keyboard, webcam, volume, eject button, etc.. on the Leopard install disc.

He has the meaning of dongle reversed here. The point isn’t that you can’t install other stuff onto the Mac, the point is that the software won’t run on anything else. This is enforced by the license agreement as well as a hardware key (dongle) which is the Mac itself.

In the age of ubiquitous virtualization of computer hardware, however, the hardware dongle is not nearly as hard to copy as it used to be. Consider it like The Matrix for computers. The software only sees the interfaces exposed by the operating system. The operating system only sees the interfaces exposed by the hardware it is running on.

The operating system doesn’t know if it can trust what it is getting from the hardware, or indeed if it is even running on hardware at all. This is probably the issue that causes Apple to disallow running their OS X software product inside a virtualization server. They recently updated their license to allow virtual server instances of OS X Leopard, but only on Apple hardware.

Also, while I am not privy to Microsoft’s motivations behind the Palladium project (now known as the Next-Generation Secure Computing Base, I suspect this issue had something to do with it. Otherwise, what’s to prevent someone from installing 20 copies of Windows XP onto different instances of a virtual PC that emulates the same processor ID and MAC address? What would be unique about any given installation of Windows that the operating system software could trust when trying to determine if it is a legitimate copy?

This leads to the question, can a hardware platform ever truly be as closed as the manufacturer would like? Or will they always have to fall back on licensing restrictions to discourage cloning and manipulation of their product? I don’t think we’ve seen the answer to this yet.

Topics: General | No Comments »

Programming: Engineering, Science, or Art?

By Jacob Cohen | January 29, 2008

When you’re looking to hire programmers, what do you look for in their education? How should the colleges and universities be educating the next round of students who are destined for careers in software development? There seem to be several schools of thought on this.

Programming as a Science
Traditionally, going to school with the intention of becoming a programmer meant getting a degree in computer science, which was typically taught in either the mathematics or engineering school within a university. There was, and still is, in many schools, a lot of emphasis on mathematics, engineering, and science courses as part of the curriculum for earning this degree. Should the future programmers have to care about vector calculus or electronic circuits or fluid dynamics? What about graph theory, logic circuit design, or computer architecture? How much “science” do programmers really need to know?

Programming as an Art
Some believe that programming is less of a science, and more of an art. Joel Spolsky seems to think this way. According to this school of thought, programming is an art, and aspiring artists go to school to learn by doing, and by studying under accomplished artists who can teach them how it supposed to be done.

Programming as Engineering
To others, programming is an engineering discipline. You’re not a programmer, you’re a software engineer. You’re an architect. You’re building and creating with the finest attention to detail. You’ve measured your code twice and it will fit in 64K of memory. As you build more and more software, you begin to establish a set of practices and guidelines to prevent past failures from reoccurring. You have little patience for the new upstart programmers who lack all of the discipline you’ve carefully acquired.

So what should the schools teach?
All of the above! Aspiring software developers need the science, the theory, the engineering principles and the artistic trade aspects in order to be well-rounded.

If you leave out the theory, you might create a batch of programmers who don’t know why a Shlemiel the Painter’s algorithm is bad, or how to avoid it.

If you leave out engineering principles, you might get programmers who don’t know what to do in response to a bug that is found in their code. How do they know that bug is fixed? How do they prevent it from reoccurring?

If you leave out the art of programming, you might find people who know about software, but not how to create it. The software industry might need a few well-trained critics, but this is probably not the best use of a university’s software development curriculum.

Topics: General | 1 Comment »

Ruby on Rails under Windows XP with Cygwin

By Jacob Cohen | January 27, 2008

I like to use Cygwin for development under Windows, as I frequently use standard command line utilities like find and grep, and I find the Windows command line environment to be more painful to use than it is worth.

The first time I tried to get this all running, it was in this sort of hybrid Cygwin/windows mode where running certain applications (such as rails or gem) required using the Windows command prompt, where others (such as running the rails-generated scripts) could be run from within Cygwin.

This proved to be too irritating to manage, so I’ve reinstalled the Cygwin version of Ruby, downloaded RubyGems from source, and rebuilt that using my Cygwin version of Ruby. As a neat gotcha, if the Windows version of Ruby has added “RUBYOPTS=-rubygems” to your environment variables, running “ruby setup.rb” in the RubyGems directory will fail with “ruby: no such file to load — ubygems (LoadError)”. Just unset this environment variable and re-run it, and it should be fine.

Now that I got Ruby and Gem installed under Cygwin, I’ve reinstalled Rails (”gem install rails”). One of the other persistent hiccups I’ve been encountering with my setup is how to get my machine connect to the MySQL database I’m running on a separate machine. I don’t want to install the MySQL server software on this machine just to be able to connect, what I need is just the client libraries. Unfortunately, it appears that the mysql ruby adapter requires bits of the server components of MySQL. It won’t build properly if you build just the client libraries of MySQL.

Now that mysql is installed, Gem can install the ruby/mysql adapter, which will allow my Rails projects to connect to my MySQL database on the other machine.

Essentially, here are the steps in the order needed to get this to work.

  1. Install Cygwin. Get gcc-core and gcc-cpp (to compiled MySQL), and Ruby.
  2. Install RubyGems
  3. Install Rails (gem install rails)
  4. Download the MySQL source, and build it under Cygwin.
  5. Install the MySQL Ruby adapter (gem install mysql)

And that’s it. Not as simple as it should be, but not impossible.

Topics: General | 3 Comments »

« Previous Entries