Entries tagged with “Review”

The Black Hole War

The Black Hole War I recently finished reading The Black Hole War by Leonard Susskind and really enjoyed it. Billed as “the riveting inside account of the battle between Stephen Hawking, Leonard Susskind, and Gerard ‘t Hooft over the true nature of black holes,” I ended up learning a lot from the book about black holes, quantum mechanics, and gravity.

Information Loss

The central issue at stake in the book is the idea, proposed by Stephen Hawking in 1981, that information is lost when an object is devoured by a black hole. That is to say, if you or I happened to get sucked into a black hole, when that black hole evaporated (as all eventually do), there would be no sign that we ever existed. This may seem to make sense, but it violates a central law of physics that information cannot be destroyed. Even if you think of burning a book, you may not be able to read the pages any more, but, if you were able to catch all the light given off from the fire and collect any remaining physical pieces, you could reconstruct the book as it was, so the information contained within it still exists.

Susskind, upon hearing this pronouncement, spent the next 20 years trying to disprove Hawking. Though Susskind initially was in the minority, he eventually was able to convince physicists that information is indeed conserved when an object enters a black hole. While it’s a book about some very complicated physical interactions, Susskind presents it in a way which is very accessible to the average person.

Physics as Thought Experiments and Analogies

One of my favorite aspects of Susskind’s book was how he was able to boil down even the most complex problems to simple thought experiments or analogies. For instance, to explain how gravity can bend light’s path, he used the example of a very fast elevator, and to describe what someone would look like as he or she fell into a black hole, he used an analogy of fish in a pond getting sucked down a hole in the middle. This is one of my favorite parts about studying physics–most complicated problems can be explained through simple thought experiments, which is exactly how Albert Einstein first came up with the special theory of relativity.

As Susskind got into more advanced quantum mechanical topics, I could tell he was having trouble explaining the concepts without mathematics (there were perhaps only 2 equations in the entire book). This is not his fault, as the interactions on a quantum scale are so bizarre that there really are no analogs in the real world. Humans were not made to be able to understand these things, so it requires a lot of “rewiring,” as Susskind puts it, to really understand what is going on, more so than can be done in a 450-page book. That being said, Susskind does an admirable job of giving enough insight into what is going on without having to go into the specifics.

Definitely Recommended

If you have any interest in black holes at all, I’d definitely recommend reading The Black Hole War, as it is definitely a book created so that everyone can have at least some understanding of the complexities of black holes. For me, I wish it had been a bit more on the technical side, but I can definitely understand why Susskind wrote it the way he did. If nothing else, it excited me to learn more about what are some of the strangest objects in our universe, and I’m really looking forward to go more in depth about their properties in my classes at school.

Posted on February 8, 2009 Leave a Comment
Tagged with: , , , , , ,

A Review of Sennheiser HD-555 Headphones

Sennheiser HD-555 A few months back, I got my hands on a pair of Sennheiser HD-555 headphones, and my experience so far has been overwhelmingly positive. Though they may be a little pricy for those who are used to paying $20-30 for headphones, they are more than worth it and make listening to music a joy.

I’ve had some past experience with Sennheiser products: my first pair were the HD 457s, which were followed by a pair of the portable yet powerful PX 100s, after which I got a pair of the HD-280s. Although I really enjoyed the HD-280s, I wanted to try out an open pair of cans (instead of closed), so I went ahead and got the HD-555s.

Closed vs. Open

One of the most important factors to consider when buying a pair of quality headphones is whether you want them to be “open” or “closed”. With closed headphones, your ears are completely sealed off, whereas with open headphones, there’s an opening for sound waves to propagate out from the headphones. Open headphones are generally higher quality, as the waves aren’t resonating off a closed earcup. However, it’s possible for people around you to hear what you’re listening to, which doesn’t happen with closed headphones. Also, the closed design blocks out a lot of external sound, so they’re great if you want to block things out.

Sennheiser HD-555

The HD-555s are open, and I can definitely notice a difference compared to my HD-280s. Bass is punchier, and music is, in general, much crisper. The 555s are also super comfortable: I’ve listened to music for hours at a time without feeling any discomfort, whereas the HD-280s get uncomfortable after about an hour or so.

Some negatives: if someone’s sitting near me while I’m using the HD-555s, they can definitely hear what I’m listening to. For the most part, it’s not an issue, but if I’m somewhere quiet, like the library or something, I usually use different headphones so as not to annoy others. In a similar vein, outside noises are definitely more noticeable with the closed design. With the 280s, I could take them on the plane and not hear the engine at all, with my iPod only at about 50% volume. My 555s, however, require me to turn the volume almost all the way up, and even then, it can be hard to hear quieter songs.

That being said, I definitely would recommend the HD-555s to anyone looking to get a high quality pair of headphones for a reasonable price (they’re right around $100). You could spend hundreds more and get some amazing headphones, but for casual listening, these are a great value.

Posted on December 22, 2008 Leave a Comment
Tagged with: , , ,

Advanced Rails Recipes

Advanced Rails Recipes

A couple weeks ago, I received my copy of Advanced Rails Recipes by Mike Clark (and others), and so far, I’ve really been enjoying it. The first book by Chad Fowler was easily my favorite Rails book at the time, and the new edition has definitely continued the trend. I’ve always learned best from examples, and the recipes in the book are all top-notch, real world scenarios that can be quickly and easily applied to your application. Already, I’ve used many of them while working on my site, and below are a few of my favorites.

  • Respond To Custom Formats
  • Freshen Up Your Models with Scope
  • Handle Multiple Models in One Form
  • Upload Images with Thumbnails
  • Send E-mail via Gmail
  • Preserve Files Between Deployments
  • Give Users Their Own Subdomain

I definitely recommend the book to any Rails developer, new or old, because the book truly has something for everyone.

Posted on June 7, 2008 Leave a Comment
Tagged with: , , ,

A Review of CakePHP

CakePHP Logo Recently, on a somewhat secret project, I’ve had the opportunity to try out CakePHP, an MVC framework for PHP. I wanted to take some time to share my thoughts on what I’ve liked and disliked in my experience so far.

Missing Migrations

My #1 favorite feature in Rails has to be migrations. They allow you to very easily add and remove fields of a database without trying to keep track of SQL queries. In CakePHP, nothing like this exists (at least that I’m aware of). I’ve already had numerous issues with databases being out of sync due to having the code in three different environments (dev, staging, and production). I’ve had to resort to a combination of phpMyAdmin and text files with SQL to keep track of all the changes that need to be made.

Models Fall Short

Personally, I’m a huge subscriber to the “fat model, skinny controller” method of structuring code, which stipulates that the majority of code should reside in your models (which handle the data), rather than the controllers and views. With CakePHP, however, this is a little difficult to implement. When querying the database using a model like $this->User->findAll();, the function just returns a text array, rather than an array of objects like Rails does.

To demonstrate my point, let’s pretend I have a table of users that stores their first name as first_name and last name as last_name. I want to print out their first name, last name, and their full name (which is generated from their first and last name). With Rails, I just add the method User#full_name to the User model. Since the full object is passed to the view, I can call that method directly:

First Name: <%= @user.first_name %><br />
Last Name: <%= @user.last_name %><br />
Full Name: <%= @user.full_name %>

However, with CakePHP, since it’s only an array that’s passed, I can’t call a function, and the code gets a little messy:

First Name: <?php echo $user['User']['first_name']; ?><br />
Last Name: <?php echo $user['User']['last_name']; ?><br />
Full Name: <?php echo $user['User']['first_name] . ' ' . $user['User']['last_name']; ?>

Granted, I could use a helper function in the view, but in my eyes, generating the full name is something that should reside in the model. In this example, it’s really not that big of a problem, but as you want to do more complicated manipulations of the data, it gets a little messy with CakePHP.

Messy Syntax

While it isn’t totally the fault of CakePHP, but rather of PHP itself, Cake requires some pretty messy syntax to accomplish things. For example, let’s say I have posts that have both an editor and an author. To define these relationships in Cake, I’d have to do the following:

// user.php
class User extends AppModel {
  var $name = 'User';
  var $hasMany = array('EditedPosts' => 
                        array('className' => 'Post',
                              'foreignKey' => 'editor_id'),
                        'AuthoredPosts' =>
                         array('className' => 'Post',
                               'foreignKey' => 'author_id')
                      );
}

// post.php
class Post extends AppModel {
  var $name = 'Post';
  var $belongsTo = array('Editor' => 
                          array('className'  => 'User',
                                'foreignKey' => 'editor_id'),
                         'Author' =>
                          array('className'  => 'User',
                                'foreignKey' => 'author_id')
                        );
}

Pretty confusing, huh? All the arrays really get in the way. In Rails, the same situation would be done like this:

# user.rb
class User < ActiveRecord::Base
  has_many :edited_posts,   :foreign_key => 'editor_id',
                            :class       => 'Post'
  has_many :authored_posts, :foreign_key => 'author_id',
                            :class       => 'Post'
end

# post.rb
class Post < ActiveRecord::Base
  belongs_to :editor, :class => 'User'
  belongs_to :author, :class => 'User'
end

To me, the Rails code is a lot easier to read and makes much more sense. Like I said before though, this is really a Ruby vs PHP issue and not Rails vs CakePHP.

Super Easy Deployment

It may seem like I’m really ragging on CakePHP, but there are definitely things I like compared to Rails. One of my (and many others’) major gripes about Rails is how difficult it is to deploy an application: there’s a lot of server side configuration that can get really confusing. With CakePHP, however, it’s practically a non-issue. Since that supports PHP (which I’m guessing is 99% of shared hosting). Just upload your files, and you’re ready to go. With Rails, setting up a production environment would require setting up Apache forwarding, Mongrel instances, and more. In this department, Rails really can’t compete with Cake.

More Resources for the Beginner

PHP has perhaps the best online documentation of any language out there. Every function is well documented, and most have user comments below with tips and explanations on various quirks. It’s also a very widely used language, which means a lot more people can help you out if you have issues. Even though CakePHP itself isn’t particularly well documented, it definitely benefits from the many PHP resources out there. Ruby, on the other hand, though things are getting better, isn’t nearly as well documented as PHP and doesn’t really have a central place to go like PHP.net. There also aren’t nearly as many people that are familiar with the language.

CakePHP is Beginner-Friendly

Though CakePHP is lacking in a many areas where Rails really excels, I think it definitely has its place in the world of web frameworks. I would definitely consider using it on smaller-scale projects where I don’t want to deal with the complicated setup of a Rails production environment. It’s also a little more accessible for beginners than Rails because of the vast PHP community. However, for a user requiring a more powerful framework, I currently don’t think there’s much out there that’s better than Rails.

Posted on April 6, 2008 8 Comments
Tagged with: , , , ,