Honor your elders (and others)
What an odd topic, you might be thinking. Some time ago, I began teaching my elders (who are rapidly becoming my contemporaries, curse you, Father Time) how to navigate the Internet. After almost two years of this, I’ve become more sensitized to seeing the ’Net from their POV.
Here’s a small fragment of a page I saw today (actual size):
The page numbers and arrowheads are the only navigation elements on this huge, complex page that allow you to move around the list of products. The numbers are an 11px font, and the arrowheads are 6px by 8px. For a senior citizen, or indeed anyone with less than perfect vision and eye-hand coordination, this is pretty challenging to find on the page, let alone use.
Here’s a quick challenge for you as web designer: try dimming your screen down a bit, to the point where it’s noticeably uncomfortable to use. Does your page still seem easy to navigate? Now try switching from your dominant hand to your other hand, and try clicking your page navigation elements (not just buttons, but drop-downs, menus, etc.). Still usable? If not, you may be designing your page to keep away some users. Just a thought.
design user-interface
End Point Liquid Galaxy Projects at Google I/O 2013
This last week End Point participated in the Google I/O conference for the third year in a row. As the lead agency for Liquid Galaxy development and deployment, our engineers were active in the development efforts for the two Liquid Galaxy systems that were showcased at the conference this year.
We sent two of our rock stars to the show, Kiel and Matt. This year both Liquid Galaxies used Google Maps API functionality in the browser rather than the stand-alone Google Earth app:
-
Treadmill-driven Google Trekker: Working with Sparks Online, this showed a treadmill connected to the Google Trekker Trails panoramic imagery. Walking on the treadmill moves the view forward through the Bright Angel Trail in Grand Canyon. The tricky part being the curves in the trail, especially switchbacks: with no mouse to adjust the view, how to keep the view on the path when the input (the movement of the treadmill) was just “straight forward”? Our engineer, Kiel, used functions around Maps API data to automatically calculate the “closest frame” that would be next in line, and then force-feeds it to the Trail View, so “forward” is always centered on the path, no matter if the next frame is actually five …
conference event visionport maps
Travis build log doesn’t display
Remember when “clear your cookies and try it again” was the first suggestion when a webpage was behaving badly? I remember that time of darkness, that time of early Internet Explorer, well, existing. I remember it being the only browser allowed in some offices and even being mandatory for some major websites. Remember that? Pepperidge Farm remembers.
But we’ve evolved. These are brighter days. Around these parts, “Did you clear your cookies?” is typically only said in jest. So, imagine my surprise when I accidentally discovered that clearing my cookies was exactly what resolved my issue with our Travis-CI.org build logs failing to display. Seriously. Imagine it. Go ahead, I’ll wait.
On March 21st 2013, the beautiful and talented Travis CI service deployed a bad build of their own app. It contained a bug that caused build logs to fail to display. You could still see the builds and statuses under the Build History tab, but never any logs. This was right about the same time I had pushed a big refactor that used a new config file format for our app. It passed all our tests locally, but it was driving me nuts that I couldn’t find out why it was failing on Travis. It was also displaying …
browsers tips
Isolation Test Helper for Rails Development
Lately I’ve been inspired to test drive my development as much as possible. One thing that is absolutely critical for test driven development is fast feedback from your tests. Because of this, I try to remove the “Rails” dependency as often as possible from my tests so I don’t have to wait for Rails to load for my tests to run. Sure, I could use spork or zeus to pre-load Rails, but I find that those tools don’t always reload the files I’m working on. Besides, I believe that much of your application should be plain old ruby objects that are well designed.
One of the things I continually bump against with isolated tests is that there are a few things that I always have to do to get my isolated tests to work. Since we are accustomed to requiring spec_helper.rb or test_helper.rb for tests dependent on Rails, I decided to build a helper for when I run isolated tests to just load some niceties that make running them a little easier.
So, here’s the full code from my isolation helper (this one works with RSpec).
# spec/isolation_helper.rb
DO_ISOLATION = ! defined?(Rails)
def isolate_from_rails(&block)
return unless DO_ISOLATION
block.call
end
isolate_from_rails do
require …
ruby rails testing
Making Python Code a Little Bit Cleaner
When you develop a program in a group of programmers, it is really important to have some standards. Especially helpful are standards of naming things and formatting code. If all team members format the code in the same way and use consistent names, then it is much easier to read the code. This also means that the team works faster.
The same rules apply when you develop software in Python.
For Python there is a document which describes some of the most desirable style features for Python code Style Guide for Python Code. However there are some problems with that, as even the standard Python library has some libraries which are not consistent. This shouldn’t be an excuse for your team to be inconsistent as well. Ensuring that the code is nice and readable is worth working for a moment on that.
In Python there are two tools which I use for writing code in Python—Python style guide checker and Python code static checker.
pep8
Program pep8 is a simple tool checking Python code against some of the style conventions in PEP 8 document.
Installation
You can install it within your virtual environment with simple:
pip install pep8
Usage
Let’s test the pep8 command on such an ugly Python …
python
Adventures with using Ruby 2.0 and libreadline
I was asked to develop a prototype app for one of our clients lately. The basis for this app was an old Rails app:
- Rails 3.2.8
- RailsAdmin
- MySQL
- rbenv + ruby-build
I wanted to upgrade the stack to work with latest toys all cool kids are so thrilled about. I also didn’t have Rails console facility at my disposal since the Ruby version installed on the development machine hadn’t been compiled against libreadline.
Not having root or sudo access on the machine I embarked on a sligthly hacky journey to make myself a better working environment.
Ruby 2.0
After reading Mike Farmer’s blog post about Ruby 2.0 and tons of other material about it on the Internet, I wanted to get a feeling of how faster & greater the new Ruby is. It’s always great also to stay up-to-date with latest technologies. It’s great for me as a developer, and more importantly—it’s great for our clients.
Importance of libreadline in development with Ruby
To be productive developing any Rails-based application, we have to have Rails-console available at any moment. It serves a multitude of purposes. It’s also a great scratch-pad when developing methods.
While you don’t need your Ruby to support libreadline for basic …
shell environment ruby rails
Breaking Up Your Asset Pipeline
The Rails Asset Pipeline to me is kind of like Bundler. At first I was very nervous about it and thought that it would be very troublesome. But after a while of using it, I realized the wisdom behind it and my life got a lot easier. The asset pipeline is fabulous for putting all your assets into a single file, compressing them, and serving them in your site without cluttering everything up. Remember these days?
<%= javascript_include_tag 'jquery.validate.min.js','jquery.watermark.min.js','jquery.address-1.4.min','jquery.ba-resize.min','postmessage','jquery.cookie','jquery.tmpl.min','underscore','rails','knockout-1.3.0beta','knockout.mapping-latest' %>
A basic component of the Asset Pipeline is the manifest file. A manifest looks something like this
// Rails asset pipeline manifest file
// app/assets/javascript/application.js
//= require jquery
//= require jquery_ujs
//= require_tree .
For a quick rundown on how the Asset Pipeline works, I highly recommend taking a few minutes to watch Railscast episode 279. But there are a few things that I’d like to point out here.
First, notice that …
javascript rails
Selenium Testing File Uploads in Django Admin
The Django framework version 1.4 added much better integration with Selenium for in-browser functional testing. This made Test-Driven Development an even more obvious decision for our new Liquid Galaxy Content Management System. This went very well until we needed to test file uploads in the Django admin interface.
A browser’s file upload control has some unique security concerns that prevent JavaScript from setting its value. Trying to do so may raise INVALID_STATE_ERR: DOM Exception 11. Selenium’s WebDriver may sometimes send keystrokes directly into the input element, but this did not work for me within Django’s admin interface.
To work around this limitation, Ryan Kelly developed a Middleware to emulate successful file uploads for automated testing. This middleware inserts additional hidden fields into any forms sent to the client. Setting their value causes a file upload to happen locally on the server. (I used a slightly newer version of this Middleware from another project.)
However, Selenium intentionally will not interact with hidden elements. To work around this, we must send JavaScript to be executed directly in the browser using WebDriver’s execute_script method.
self …
django testing