I love peer reviews… I hate peer reviews

Mostly, I love them. Peer reviews are one of the best ways I know of learning valuable lessons  from other programmers, usually programmers that are a lot more skilled than me. The only thing  I can think of that would be better than that is pair programming.  Peer reviews allow you to get input on the code you wrote, fresh ideas, a different point of view, not necessarily better, but always different. They may inspire you to refactor the whole thing or  to take a whole new approach that could very well be easier than what you were trying to do in the first place. You may even find out that what you were trying to do is not really needed or is being already accomplished in a different way. Other coders can certainly see things you can’t.

code-review-2And yet, there are those days when I kind of hate them. Those days when I’ve been working on the same issue for what feels like an eternity, yet instead of giving me their seal of approval,  my reviewers keep requesting more changes with every commit.  Those days when I wish my reviewers were not always trying to DRY everything or refactor everything and would just agree with my code… if it works… sort of. Ugh. Yeah, those are the days when I have to remind myself that it is a really good thing they don’t just agree with my code. Even if it’s frustrating. This too shall pass… and I’ll come out of it all a better programmer… after I’ve suffered a while. It’s the only way to learn.

 

When you loan your son your computer…

When you work as a web application developer, one thing you’re sure to find pretty much everywhere is Linux. There’s no way around it. Even if you happened to work off a Windows computer, you will at the very least have to use Linux at the command line while interacting with a remote server. Up until now, I’ve learned just enough Linux to get the job done, picking up a few things from here and there. That’s why when I saw a free class on Linux being offered by edX.org I just had to enroll myself in it. There was [...]

Diary of a Junior Ruby Developer

I was introduced to Ruby and Rails during the time I spent working for Manilla.com. Those were four really great months in my life that I will never forget. Back then, working as a robot developer, my goal was to slowly acquire the skills that would allow me to eventually move into the Rails team. Sadly, Manilla closed its doors before I could get a chance to achieve that goal.

Shortly after Manilla closed, I found another job working remotely for a company that provides enterprise publishing solutions. I was hired as a Junior Ruby on Rails Developer and now [...]

Packt’s 10 year anniversary means $10.00 books and videos!

One more time, my favorite IT book publisher is having a fantastic sale. This time, Packt Publishing is celebrating 10 years of providing great learning and information materials for IT professionals. According to their press release, during that time Packt has published over 2000 titles and helped projects become household names, awarding over $400,000 through its Open Source Project Royalty Scheme.

To celebrate this milestone, Packt is offering all their books and videos for only $10.00 each. There’s no limit how many books or videos you can purchase from them, but this offer will only last until July 5th.

[...]

Celebrate Day Against DRM with Packt!

I just heard news of Packt’s Day Against DRM (#DayAgainstDRM) that will take place on May 6th 2014, and wanted to share the good news with you. For 24 hours, all of Packt’s ebooks and videos will be only $10.00 each. This is a great opportunity to stock up on their most popular and/or newest titles!

According to the definition of DRM on Wikipedia, Digital Rights Management (DRM) is a class of technologies that are used by hardware manufacturers, publishers, copyright holders, and individuals with the intent to control the use of digital content and devices after sale.

However, Packt [...]

Packtpub is celebrating their 2000th title with a BOGO sale!

I love Packtpub books! I just had to spread the word about their milestone sale as it is a great opportunity for packtpub books lovers everywhere to acquire a few more titles. Hurry! The sale is for a limited time! :-)

 

Known for their extensive range of pragmatic IT ebooks, Packt Publishing are celebrating their 2000th book title `Learning Dart’– they want their customers to celebrate too.

To mark this milestone Packt Publishing will launch a ‘Buy One Get One Free’ offer across all eBooks on March 18th – for a limited period only.

Packt is one of the [...]

Accessing a Private Method for Testing

Sometimes, I come across a private method in one of the models that I really need to test. Rather than try to change the way the model is written, I’ve found a way around this limitation using ReflectionMethod.

Suppose we have a class with a private method such as this one:

class MyClass { private function myPrivateMethod( $some_value){ $new_value = $some_value + 5; return $new_value; } }

Granted, that is a very silly method, but is only meant as an easy example. In order to be able to test this method, we can do the following:

$testMethod = new ReflectionMethod('MyClass', [...]

Quick Tip: Sorting arrays with array_multisort

Sometimes you need to sort an associative array in more than one way. Let’s say you have an array such as this one, representing the toys inside a toy box. The keys are the name of the toy and the values are how many of each we have:

$items = array( "balls" => 5, "toy cars" => 1, "ropes" => 5, "dolls" => 3, "jumping jacks" => 5, "tea sets" => 2 );

And you need to sort this array in order to print a list displaying the toys of which we have the most showing up first. Those toys [...]

Quick Tip: MySQL Subqueries

This is a little tip that a co-worker shared with me some time ago and has made my life so much easier. I am often faced with a situation very similar to this: let’s say we have a table called users_rooms that includes the columns user, room, deleted, created and modified. I am required to insert new rows in this table where the values of the room column for user 123 should match all the available ones for the same column for user 128. This is something easy to do with subqueries, like this:

"insert into users_rooms (user, room, created, [...]

Moving and Deleting messages with PHP IMAP

PHP provides a great deal of functions to operate with the IMAP protocol, but implementing them isn’t always so straightforward. For example, how to best mark multiple messages as read or unread, move them to a different folder or mark them as deleted without running into a situation where some of them “return” to your inbox next time you sync to the account or worse, you end up marking as deleted other messages you did not intend to. This is actually a real-life issue we ran into at work.

Given a sequence of messages, you have a message number and [...]