Railsbridge NYC
Last week I attended a Ruby on Rails workshop hosted by Railsbridge NYC. The organization promotes diversity in tech by introducing web development concepts to a community of technology professionals and enthusiasts. It’s geared towards women, but open to all.
Installfest
As the website describes, the workshop consists of an Installfest (about a 2 hour event), followed by a full day of learning the following day. The Installfest is a series of step-by-step instructions to install Ruby, Rails and other tools you would need for your particular OS. The detailed instructions helped make the entire process effortless, and most students were able to install all the tools without major issues.
An Introduction to Ruby and Rails
The next day was the actual workshop, beginning promptly at 9am. The skill level of the women in attendance varied; some were programmers proficient in other languages, while others, like myself, were new to programming. After a short welcome presentation, the organizers divided the group into two, with the “more advanced” students heading off to their own room for a slightly more quick-paced session.
I remained in the beginner group, which was significantly larger. …
conference ruby rails
Converting root filesystem from ext3 to ext4 on CentOS and RHEL 5.9
Here’s a quick explanation of the procedure to convert the root / filesystem on RHEL and CentOS 5.9 from ext3 to ext4, because ext3 wasn’t available during install time.
Note that this is not a configuration Red Hat supports, but it works fine. (I believe you cannot convert the /boot filesystem to ext4 on standard RHEL/CentOS 5 because its GRUB can’t handle it, but you can convert all the other filesystems.)
Ideally do this only on a fairly freshly-installed system you don’t mind losing. Back everything up first unless this is a system you don’t mind destroying! This is a risky operation and (ahem) things can go wrong.
You’ll need direct console or KVM access to the server. You can do without that if you can remount -o ro / but that usually won’t work with sshd or other daemons that keep files open on the / filesystem.
You will of course need to adapt the current kernel version and root filesystem block device path in the examples below.
Now, to live dangerously:
- yum -y install e4fsprogs
- Edit /etc/fstab so that the / filesystem is mounted as ext4 (which works with the existing ext3 filesystem as well). If you’re using a battery-backed RAID controller you may want to add the …
hosting redhat
Installing PostgreSQL without Root
PostgreSQL can be installed using installers prepared for your operation system. However this way you just depend on the installation settings chosen by the packages mainainers. Installation requires root privileges, on some machines programmers are not allowed to do that. What’s more, this way you rather will not install the PostgreSQL beta version.
The only way to install Postgres without root privileges, in home directory, is to compile it from sources. That’s not very difficult.
Download Sources
First of all you need to download sources. I use GitHub for getting the latest sources. There is a Postgres GitHub mirror. I clone that, but you could just download zip file.
Unpack it somewhere, and you have the Postgres sources you need.
Install Needed Software
For compiling Postgres you will need some libraries and programs. The complete list can be found in Postgres documentation.
I’m using Ubuntu, the packages I use for compiling Postgres are:
- gcc — C compiler
- libreadline6, libreadline6-dev — readline support
- zlib1g, zlib1g-dev — compression library used internally by Postgres
- libpython2.7, libpython2.7-dev — for compiling with PL/Python support
If you are using different system, …
postgres
PostgreSQL Functional Indexes
PostgreSQL has got the great feature named “functional indexes”. A normal index just stores sorted values of some field. It is great for searching, as the values are already sorted.
You can create an index with a simple query like:
CREATE INDEX i_test ON test (i);It will store all values of column i from table test. This index can be used with a query like:
SELECT * FROM test WHERE i < 100 ORDER BY i;Functional Indexes
There is also something I like most. Index can store all values you want, they don’t need to be values from the table. You can use values calculated from the table columns. They will be sorted, so searching with those indexes will be pretty fast.
Creating such index is simple:
CREATE INDEX i_test_lower_i ON test (lower(i));The main rule is: this index can be used if you have the same function call in your query, something like:
SELECT * FROM test WHERE lower(i) = 'aaa';Example
Let’s check something more complicated. My test table looks like:
CREATE TABLE test(t timestamp);I filled this table with sample data. We need some bigger number of rows:
INSERT INTO test(t) SELECT generate_series(now() - '1 year'::interval, now(), '1 …postgres
Creating custom button graphics in Android
In the Android timesheet app I’m working on, I have a scrollable layout of RadioButtons for the user to pick how much time they’ve spent on a project (see my earlier blog post about it), and for that I use custom button graphics to make it look nice. So, I’m going to show you how to do that with 9-patch PNGs and selector XML.
First, what’s a 9-patch PNG? A 9-patch is a special PNG image where you specify regions that can be stretched to make room for text. Android will automatically resize a 9-patch to best fit whatever contents you give it. The tool you need to create a 9-patch image is included in the Android SDK Tools, so download that if you haven’t already.
More information about 9-patch images can be found here.
Okay! I’ve got custom button graphics (72x72 for HDPI screens), drawn in the Gimp and saved in my project’s res/drawable-hdpi/ folder as button_selected.png and button_unselected.png:
|
|
To convert it to a 9-patch, browse to the tools/ directory of the Android SDK and run draw9patch. This will open a window with a graphical editor on the left, and a button preview on the right. The editor window is for specifying which parts of the image will be stretched. The …
android graphics
JSConf US — Day 2
Choose Your Own Adventure
For day two of JSConf, the organizers decided to try something new. Rather than a day of scheduled talks, attendees could choose from a variety of activities. There was kayaking, golf, segway tours, scavenger hunts or you could just hang out at the pool if you like. There was also the opportunity to hack on NodeBots or Node Copters. While the outdoor stuff sounded awesome, I opted to hack on and play with the nodecopters.
Node Copter
With the help of nodejitsu, Chris Williams was able to bring 50 Parrot AR Drone quadcopters for teams to play with and hack on with JavaScript. Felix Geisendorfer and a contingent of volunteers showed us how to fly the quadcopters (with either an iOS or Android device) and how they could be controlled with JavaScript code. Felix is the author of the ar-drone node.js module which makes this possible. With a laptop connected to the quadcopter, the following code is all you need to have it take off, rotate a little bit, perform a flip and then land:
var arDrone = require('ar-drone');
var client = arDrone.createClient();
client.takeoff();
client
.after(5000, function() {
this.clockwise(0.5);
})
.after(3000, …browsers conference javascript
Window functions in action
Image by Wikimedia user Ardfern
Yesterday I ran on to a nice practical application of a number of slightly unusual SQL features, in particular, window functions. PostgreSQL has had window functions for quite a while now (since version 8.4, in fact, the oldest version still officially supported), but even though they’re part of the SQL standard, window functions aren’t necessarily a feature people use every day. As a bonus, I also threw in some common table expressions (also known as CTEs, also a SQL standard feature), to help break up what could have been a more confusing, complex query.
A client of ours noticed a problem in some new code they were working on. It was possible for users to submit duplicate orders to the system in quick succession, by double-clicking or something similar. This was fixed in the code easily enough, but we needed to clean up the duplicate orders in the database. Which meant we had to find them. We defined a group of duplicates as all orders involving the same line items, with one of a set of possible status codes, created in an interval of less than five minutes by the same user.
This discussion of the time interval between two different records should …
database postgres sql
DevOps engineer job opening (remote)
This position has been filled. See our active job listings here.
End Point continues to grow! We are looking for a full-time, salaried DevOps engineer to work on projects with our internal server hosting team and our external clients. If you like to figure out and solve problems, if you take responsibility for getting a job done well without intensive oversight, please read on.
What is in it for you?
- Work from your home office
- Flexible full-time work hours
- Health insurance benefit
- 401(k) retirement savings plan
- Annual bonus opportunity
- Ability to move without being tied to your job location
- Collaborate with a team that knows their stuff
What you will be doing:
- Remotely set up and maintain Linux servers (mostly RHEL/CentOS, Debian, and Ubuntu), with custom software written mostly in Ruby, Python, Perl, and PHP
- Audit and improve security, backups, reliability, monitoring (with Nagios etc.)
- Support developer use of major language ecosystems: Perl’s CPAN, Python PyPI (pip/easy_install), Ruby gems, PHP PEAR/PECL, etc.
- Automate provisioning with Ansible, Chef, Puppet, etc.
- Use open source tools and contribute back as opportunity arises
- Use your desktop platform of choice: Linux, Mac OS X, Windows
What you will need:
- Professional experience with …
jobs-closed devops remote-work


