Make your code search-friendly
Here’s something about coding style that you may not have considered: is your code “search-friendly”? That is, does the format of your code help or hinder someone who might be searching it for context while debugging, extending, or just learning how it works?
Seriously Contrived Example (from Perl):
my $string = q{Your transaction could not be} .
q{ processed due to a charge} .
q{ card error.};
return $string;Now someone’s going to experience this error and wonder where it occurs. So armed with grep, or ack, or git-grep, they set off into the wilderness:
$ git grep 'could not be processed'
$ git grep 'charge card error'
$ git grep -e 'transaction.*charge.*error'
$ alsdkjgalkghkf(The last simulates pounding the keyboard with both fists.) I would suggest humbly that “strings you emit as a line should appear as a line in your code”, if for no other reason than that it makes it so much easier for you or others to find them. Thus:
my $string = <<'MSG';
Your transaction could not be processed due to a charge card error.
MSG
return $string;perl search
Tips for job applicants
This a public service announcement for job applicants, a list of assorted suggestions I’ve collected over the years based on my own observations and conversations I’ve had with others who were hiring.
General
-
When you apply for a job, make sure you actually have time to pursue it. It’s rude to say you’re too busy to interview except late in the evening or for 15 minutes on your cell phone in the parking lot outside work. Finding a job takes some investment and you shouldn’t waste potential employers’ time if you’re not ready to put some of your vacation time on the line.
-
This is old advice, but important as always: Don’t claim to have abilities or experience that you don’t! Be honest about your strengths and if directly asked, admit what you lack. We will find out anyway, and it’s pretty embarrassing to all of us to have to see you’re dishonest and clueless about something you claimed as a skill.
Code samples and technical evaluation
-
If you’re applying for a programming job, be prepared to show recent code samples. Saying that all your work is under NDA with employers may be true, but doesn’t help us see what your code is like. If you can’t show any code from work, assemble …
tips
Three Things: Photography, Facebook on WordPress, and the watch command
1. Photography News
There’s been some recent news in the photography space. Adobe announced Photoshop CS6, and Lightroom 4, and Adobe Photoshop Touch recently. The Lytro Light Field camera has picked up recognition lately. The new Nikon D4 recently became available, as well as the Canon 5D MK III, both high end DSLRs.
2. Facebook Comments for WordPress
Last week, I was working on WordPress development for The Best Game Apps, and I came across a strange Facebook integration error about compatibility mode, show in the screen below:
The site uses the WordPress plugin Facebook Comments for WordPress. After some research, I decided to dig into the Facebook documentation and the code to make the following change myself to specify the post URL as the href attribute in the facebook markup:
219c219
- echo "\t<fb:comments xid='$xid' url='$postUrl' $siteisdark ",
+ echo "\t<fb:comments xid='$xid' href='$postUrl' url='$postUrl' $siteisdark ",
In the context of:
219 echo "\t<fb:comments xid='$xid' href='$postUrl' url='$postUrl' $siteisdark ",
220 …tips
Guide to Ubuntu 11.10 on a Samsung Netbook
12.04 UPDATE: Unsurprisingly, after installing 12.04 which includes the 3.2.x kernel, brightness controls work perfectly out of the box. Sadly, it’s still necessary to tweak modprobe to get wireless working after a suspend/resume. Also, don’t forget to reboot after making the changes!
After reading a few too many reviews about netbook hardware and its compatibility with Linux, I settled on a Samsung NF310 netbook. However, like all things worth doing, it wasn’t nearly as easy as I’d hoped. This post highlights some of the lessons learned from my first days with Linux on my Samsung netbook.
Pre-Installation
I had been eagerly awaiting the arrival of my new hardware and had already gotten a fresh copy of Fedora 16 ready. The crippled Windows 7 Starter Edition was going to be off that netbook as a first order of business, as a matter of principle. If I had it to do over again, I would have installed the Windows-only BIOS update for the Netbook first. I’m working through using BartPE, but the installation onto the USB drive hasn’t gone well. Best to do these kinds of Windows-only activities while Windows is still easily available.
Additionally, I would have used YUMI multiboot USB …
linux tips hardware
Custom Apache log to only show HTML requests
Today while working on an AJAX issue for CollegeDistrict.com I came across a need to only see HTML requests to Apache while leaving out all of the many requests for images, CSS, and JavaScript files. This would make it quite easy to see when AJAX requests were making it through properly.
I found a solution which worked well and used these settings in our development httpd.conf:
SetEnvIf Request_URI "(\.html|\.shtml)$" html
CustomLog logs/html.log common env=htmlapache sysadmin
MWRC Highlights Part 2 of 2
This is Part 2 of my 2012 Mountain West Ruby Conference Highlights article I posted the week of the conference. To date, I still have a ton of TODO reading from the conference. Here are some of the things mentioned during Day 2 of the conference that are on that list.
Rollout: a gem that enables/disables sets of features for certain conditions, users, etc.
- Rollout is a very slick way to activate or deactivate features within your web app programmatically. Perhaps you want to deploy a new feature in production, but only for internal IP addresses, or certain @users, or a percentage of your @users. Perhaps you do and that feature blows up in production, but it’s no big deal because with Rollout it only takes one line of code to turn that feature off for everyone. Perhaps it doesn’t “blow up” as much as “melt down” and you’d like your app to turn off that feature automagically before you get an angry call from your CTO? Check out the Degrade gem for that, Rollout’s awesome superhero sidekick.
- By James Golick
- Get it: https://github.com/jamesgolick/rollout
- Mentioned by: Matt White in his “Continuous Deployment” talk
Vagrant: an open source tool that manages virtual machines and their …
conference ruby rails
Stateful IPv6 tracking in RHEL 5: Fail
Are you a RHEL 5 user? Or CentOS or Scientific Linux, for that matter? Have you started deploying IPv6 on RHEL 5? If you’re using ip6tables as a firewall in this environment, you may want to double check its configuration.
The short version: The 2.6.18 kernel RHEL 5 ships doesn’t have a working conntrack module for IPv6. The conntrack module is what ip6tables uses for stateful packet tracking. You may already be familiar with it from the IPv4 version of iptables, looking something like this in your firewall config:
-m state --state ESTABLISHED,RELATED -j ACCEPTip6tables will accept that as well, it just doesn’t do much. The rule is effectively skipped, and the processing eventually gets down to where ip6tables is set to drop or reject, unless it matches something else along the way. Thus it appears that outgoing connections are blocked for most servers, but maybe not everywhere, even if you don’t have any rules in your OUTPUT chain.
Incoming connections will of course work fine, as those don’t rely on the state match (at least initially) and instead match explicitly defined rules for public ports, specific source addresses, etc. RHEL 6 is also fine, as the more recent kernel has …
ipv6 redhat
Web Development for HeARTs Speak
Many of my colleagues know that I’m fairly involved in animal rescue as a photographer and more recently as a foster. I recently became involved in HeARTs Speak, a non-profit, volunteer-driven organization that brings together artists (photographers and more) who volunteer at animal rescue organizations. |
|
|
|
|
I worked with them to help launch a new website with a design from Enso Blue, which brings us to the point of the article. Given a choice of many platforms and tools, what tools did I use in development of a new site with the only restriction being how much time I was able to put into development and maintenance? Here’s a quick rundown the tools I used for the new website. |
|
Ruby on Rails: Here at End Point, we develop many applications in Ruby and Ruby on Rails. It’s a platform that encourages decent code organization and efficient development. Another option that came up was PHP with WordPress. However, since the website required a custom application and voting process for joining members, I concluded that WordPress would be a bit of a hassle with this level of customization (though I’m personally a big fan of WordPress and its community). … |
performance rails tips tools

