I do a lot of system work at Tobi and one of my most valuable tools is top. This is always a starting point. I prefer this to ps since ps will inevitably lead to doing things like grep, sort, cut ...
top and .toprc
Blocks and Procs, Blocks are anonymous Procs!
Block and Procs can be very confusing! What is the difference between the two? How do you call the code? When do you use a block or a proc?
As it turns out, blocks are anonymous procs and you can use them almost interchangeably.
In the below code both yield and call work. There is a subtle difference though. You can not send the call message to the object if you don't explicitly state that the method accepts a block. Personally, I like to send the message call to the anonymous proc object myself since it makes the method signature clearer, you know there is a block being passed in. Another point of confusion is that if you want to actually pass in your proc you need to use the ampersand.
- def foo(&block)
- yield
- block.call
- end
- proc = Proc.new {puts "proc"}
- foo(&proc)
- foo{ puts "block" }
- ben@jefferson ~ $ ruby test.rb
- proc
- proc
- block
- block
Natural Patterns
I read a good RSS about the Presenter Pattern today by Jay Fields. I have Jay on my Reader.
I have used this pattern in the Java world, the old world... Actually, you have to or else you lose focus quick.
I think this can help us all out. In Jay's example he is using the pattern more for saving data and doesn't emphasize enough about how this pattern will pull a ton of logic out of the partials and expose this logic for deeper testing! This is really the strength of the pattern.
I am a huge fan of patterns but I can never remember what patterns are called. Earlier in my career this lead me to steer away from them and focus more on natural patterns. Natural patterns are something I often refer to as Patterns that are just organically grown in your own code base. This is how I think patterns as a whole get extracted out and become formal patterns. However, this can lead to anti-patterns, so you have to be careful.
Back in the "Old World", I used to have one object, my presenter, encapsulate an entire JSP page. At the time of course, this was just a natural pattern that I came up with, who knew it was a presenter! Anyway, this allowed me to pull logic specific to this JSP into the presenter and out of the Servlet, JSP, DAL (Data Access Layer) and wherever. I was also able to inject things I needed for deeper testing.
In the New World, RoR of course, the presenter is equally as important even though we already have this build in structure and testing. I don't think the pattern needs to apply globally here though, just where needed when your controller and view starts getting nasty.
Ahh Paris
My Paris e-mail.
My wife and I rented a flat in Paris for 3 full weeks back in 04. It was a great vacation but that is a digression. This was my standard Paris e-mail that I would send out to anyone I knew that was going to Paris, the city of light!
There are three places that you absolutely have to go to eat in Paris.
If you don't go to all of these places than I just don't think we
could be friends anymore! You need to buy the "petit plan de Paris
par arrondissement". This is a must have so you wont get lost taking
the metro! It will be your most precious map! The best place by far
is Le Petit Trouquet! You will definitley need a reservation and want
the window seat. It is very intimate and the chef is to die for!
Le Petit Troquet
28 rue de l'Exposition, 7th
tel: 01.47.05.80.39
Angelina's Tea Salon has the best damn hot chocolate! You might kill
your spouse for seconds! I recommend getting a pot of it.
Angelina's Tea Salon
226 rue de Rivoli. 1st
tel: 01.42.60.82.00
Le grand epicerie paris is actually a grocery store that you can get
great food to eat in. You wont even believe such a place exists.
Also this is right next to a huge cool ass Paris mall and park.
"insert wifes name" would love the stuff in the stores there.
La Grand Epicerie paris http://www.lebonmarche.fr/anglais/indexbis.htm
Now for things to do! Don't wast your time with the lame shit like
the Eifell tower. What you want to do is climb to the top of the Arc
De Triumph, you can have a blast on top watching the tourists try to
cross the circle also, climb to the top of the DOME of Sacre Coeur.
The dome is by far the best view in all of Paris. Next, strolling
down the champs d'elysee is a must. There are lots of shops,
restaurants and people. This will take you to the Arc.
If you are thinking about a museum you'll want to goto Museum D'orsay!
Also eat in the cafe there. Not the restaurant but the cafe. We
went to almost every notable museum and this was by far the best. One
last thing which was actually our favorite was the segway tour of
Paris. This was just amazing and so much fun.
http://www.citysegwaytours.com/paris/
Dont forget to stop at a local bakery and get a bagett or pan de chocolat.
It's All Text
I love this add-on. I have been thinking about looking for something that would allow me to edit a text area in a proper editor. I ran across this and you can get the add-on for firefox here. Of course it doesn't work with every editor like IDEA
Ben's Software Manifesto
I know we have all read the Manifesto for Agile Software Development and The Programmers Bill of Rights but I have my own.
MY SOFTWARE MANIFESTO
- Always think you can do better, You can!
- Always leave a file in better shape then when you entered it.
- Write and test your code together at the same time.
- Write code so that the code does one thing and one thing only.
- Write self documenting code.
- Remove dead code!
- Compile, test, and check in your code often. At least once a day.
- Use patterns to guide you.
- Reuse code!
- Use your hammer where appropriate
- Refactor, Refactor, Refactor.
- Adopt a coding standard, it doesn't matter who's it is.
- Don't be lazy.
- KISS
- Meet with your Project Manager and Manager daily to keep the ship right.
- Meet with your peers frequently to openly discuss code, algorithms, patterns, and methodologies both in and out of the office (umm Beer).
- Most Important, Don't get attached to your code and don't be afraid of someone else's.
- Embrace new technology.
TV Commercials
I watch Top Chef, mainly because my wife does, but I got sucked in... Anyway, we always record shows on our PVRs or DVRs or Tivo if you have been branded. I have been impressed by their marketing blitz during their show. Since we fast forward through commercials we are basically not marketed too except by Bravo with some of their newer programming such as Top Chef. They are always in the "Kenmore Pro Kitchen". During the shows they had the "Kraft" food condiment challenge and the "Nestle" baking challenge. Then of course their was the "Hilton Resort" in the finale. Anyway you get the point.
I have also noticed this on their other shows such as Project Runway and Top Design. So since we never watch commercials due to our PVRs we are now being directly marketed too. Those advertisers will find a way to reach us somehow! I haven't noticed this on other networks to the same extent yet. Perhaps PVRs haven't reached a critical mass. Anyway, I am see this type of marketing as the future and the commercial as a thing of the past especially with products like Apple TV out.
Pet Peeves
- Not Washing your hands after you do your business! Make sure you watch the videos at http://www.washyourhands.tv
Google, you are on the list!
I use a pretty big set of Google products but my favorites are G-Mail, Reader, Calendar, Groups, and Docs & Spreadsheets. What I can't understand is why these aren't integrated better!
Lets get right to the rant, or rather list. Yes that is correct, Google you are on the list.
Google
- When I am logged into Google, I shouldn't have to log in to Google Analytics or any other Google Service. Come on Google, lets get the Single Sign On (SSO) working already!
- Why is the breadcrumb only in G-Mail?
- If I have read the New Features page of a product, then make the link go away.
- If I am already forwarding my email to a different account, I don't need to see a message on how to forward my email.
- If I already have G-mail on my personalized Google homepage then I don't need to be asked if I would like to do that.
- In G-Mail, how about making my little bread crumb what I actually use most often and not what you think I use. I rarely goto photos but I goto Reader, Blogger and Google Analytics a lot.
- Why can't we upload PDF's?
- Where is my G-Mail bread crumb?
- Where is the chat between the collaborators?
- Why is there a cap on what you can upload?
- Why isn't there a Google Page Site for the Group?
- Why can't we use the Docs & Spreadsheets for our group easier?
- Why isn't G-Mail the message editor? I'd like to spell check and use a rich editor.
- Where is my G-Mail bread crumb?
- Where is the group calendar?
About Ben Kruger
Ben Kruger's Pages
Tags
- Linux System (1)
- Ruby (1)
Archives
Blog Roll
-
Marc Andreessen Talk – May 13, 20101 year ago
-
-
Keep AJAX browser history on redirects3 years ago
