Skip to content

existence, refactored

With kindness comes naïveté. Courage becomes foolhardiness. And dedication has no reward.

Archive

Category: Software Engineering

Earlier this week, I had to interview a bunch of applicants for a web developer role. The idea is to filter out those who aren’t really experienced as the job asks for people with at least 6 months of experience.

Anyway, below is the test I gave them. I don’t feel like giving something like it again in the future (it’s pretty crappy IMHO) so I think it would be a good idea to share it instead of just throwing it away.

Determine whether the statements below are true or false. Be prepared to explain your answer.

  1. A primary key can be composed of multiple columns.
  2. When you have two tables in a parent-child relationship (i.e. one table has a foreign key referring to the other table) deleting a parent record will delete all child records of that record.
  3. Escaping special characters is the best way to avoid SQL injection.
  4. You can undo UPDATE and DELETE changes to the database.
  5. The VARCHAR data type can be used to save space when used over CHAR.
  6. When using an RDBMS, normalization must be done for all tables.
  7. Indexes speed up database actions.
  8. Foreign keys are usually indexed.
  9. Many-to-many relationships are implemented via junction/join tables.
  10. Some HTML elements have been deprecated in favor of CSS.
  11. The <strong> element can be used interchangeably with the <b> element.
  12. Under strict XHTML rules, <br> is not a valid usage of the line break element.
  13. The href attribute of the anchor element only accepts relative and absolute links.
  14. The image tag is a block element.
  15. When a form is submitted, the submitted data is derived from only the input elements inside the form.
  16. Multiple elements can have the same id attribute.
  17. Web servers serve content at port 443.
  18. A web server can identify if a client has visited the website before.
  19. POST is idempotent.
  20. A browser redirect can be initiated by a response with an empty body.
  21. In JavaScript, the var keyword is optional when declaring variables so it can be omitted in all cases.
  22. You must specify a function name when declaring JavaScript functions.
  23. Ajax will prevent you from performing other actions until the Ajax action is completed.
  24. You are limited to using XML in Ajax.
  25. You cannot change the values of a class variable.
  26. Constructors are instance methods.
  27. Polymorphism refers to the ability to define functions to have different behaviors depending on the passed arguments.
  28. High cohesion and loose coupling can improve coding speed.
  29. You can combine the features of two classes via inheritance.
  30. Encapsulation is primarily used for security reasons.

Answers below the cut.

continue reading…

Update: Tutorial for Rails 3.1 here!

crud screen

Every Rails developer knows how to create a Rails app. It’s easy as

rails new APP-NAME-HERE

But how many know how to create an app from scratch that looks good enough to sell to clients i.e. with slick design, authentication, authorization, and all that? Sure, there are tutorials out there that cover those components, but most of them cover them only in isolation from each other. A quick tutorial containing multiple components at a time would be a valuable resource to anyone planning to start a new app.

As the resident dilettante in these parts, I’ve decided to create such a tutorial based on a recent demo I made for a prospective client.

This post will discuss how to create a Rails 3 application that looks good enough to sell to clients (of course, YMMV) while still having components found in “professional” apps. This tutorial will cover the following:

  • Andrea Franz’s web-app-theme gem – I only recently found out about this theme generator gem. Had I discovered this sooner, I might not have made “I hate web design” a catchphrase. Basically this gem generates themes for your web app (hence the name). The demo and the list of available themes can be found on this page. The main downside to this gem is the lack of tutorials on the net about it. Hopefully this post will give people an idea what to expect with the gem.
  • Devise – our authentication module. Authlogic‘s fine, but I find Devise’s approach less obtrusive.
  • Haml – replaces Erb. Not perfect (e.g. screws up with inline a tags) but the drastic decrease in code makes passing it up difficult.
  • Rspec – replaces Test::Unit. Only setup will be covered in this post, actual usage is left to the reader.
  • will_paginate – gem for pagination. Everybody uses it, so what the hell…

Rest of the tutorial is below the cut.

continue reading…

Rails FTW

Following the release of Ruby1.9.2-p136 source and RubyInstaller, I’ve taken time to update RailsFTW accordingly. Head on over to http://railsftw.bryanbibat.net/ for the latest installer.

Aside from updating the patch level, I’ve also taken time to figure out how to build the mysql2 gem using MariaDB instead of MySQL. Less chance of lawsuits = more fun for us.

As a bonus, here’s a screenshot of RailsFTW showing HAML, rspec, and Capybara working properly on Windows:

ANSICON FTW

In our age of rampant consumerism, it’s easy to fall into the trap of believing that you could only achieve great things only with the best equipment available.

There are two unfortunate side effects to this mentality:

  1. People who can’t get those equipment are discouraged from even trying out that field, and
  2. People who can get those equipment think they’re a lot better than they actually are.

But the reality is you don’t need to shell out tons of cash to be good at what you want to do. Ask any expert from any field, from the arts, to scientific fields, to sports, and they will all tell you one thing: focus on the basics.

Here’s what Freddie Wong (maker of famous After Effects heavy videos like Flower Warfare and Time Crisis) has to say about this:

continue reading…

Courier New vs Consolas

Aside from revision control and coding standards, college students aren’t exposed to another important part of software development, namely, the significance behind the choice of programming font.

Okay, so the choice of font isn’t really that important. But it’s still worth considering when you take into account that you’re going to get noticeable benefits for such a small investment.

continue reading…

Went to talk about Ruby and Ruby on Rails last Tuesday at the mini-DevCon at University of Perpetual Help System – DALTA. That’s the 4th public talk for this year (4.5th if you count the RailsFTW plugging last month).

No “transcript” here, though. Just imagine me giving the presentation in front of college students right after I make a class roster app in front of them in under 5 minutes, installation to demo. And yeah, Microsoft is the sponsor I was referring to in the talk.

Rails FTW

I hate design work.

Wait, that’s how I started my last blog post. =/

Anyway, I just came to post that I spent the past 10 hours building the mini-site for RailsFTW. There you could download the latest version of RailsFTW (v0.3) which contains the recently released Rails 3.0.3.

That site also contains lists of recommended links and downloads for people who want to use Ruby and Rails in Windows. If you have some suggestions, feel free to send them over to me.

I don’t like design work.

Whether I like it or not, I still have to do it since it’s part being a web developer. Fortunately, I get to learn a couple of tricks once in a while to make life a bit more interesting.

One of those is how to turn a boring link into a “Web 2.0″ button:

link and button

Half a decade ago, you’d have to use an image for this effect. Thanks to the CSS3 support in modern browsers, you can implement this using only CSS. Here’s how you do it.

continue reading…

yayifications!

With mysql2 now working on Windows here’s a small update to my hacked together Rails on Windows installer. I also took the opportunity to update the Rails to 3.0.1.

Also replaced the libmysql.dll with the one from MariaDB. That should probably be enough to keep the Oracle lawyers at bay…

Download Rails For (the) Windows v0.2

latest version is v0.4. grab it here

Below is a screenshot of AWStats showing a list of requests which caused 404 errors for bryanbibat.net for the month of October.

folder/script scanning

Sure, security by obscurity isn’t the best way of avoiding this, but at least you’re not making things too easy for hackers.