Foreign Data Wrappers
Original images from Flickr user jenniferwilliams
One of our clients, for various historical reasons, runs both MySQL and PostgreSQL to support their website. Information for user login lives in one database, but their customer activity lives in the other. The eventual plan is to consolidate these databases, but thus far, other concerns have been more pressing. So when they needed a report combining user account information and customer activity, the involvement of two separate databases became a significant complicating factor.
In similar situations in the past, using earlier versions of PostgreSQL, we’ve written scripts to pull data from MySQL and dump it into PostgreSQL. This works well enough, but we’ve updated PostgreSQL fairly recently, and can use the SQL/MED features added in version 9.1. SQL/MED (“MED” stands for “Management of External Data”) is a decade-old standard designed to allow databases to make external data sources, such as text files, web services, and even other databases look like normal database tables, and access them with the usual SQL commands. PostgreSQL has supported some of the SQL/MED standard since version 9.1, with a feature called Foreign Data …
database mysql open-source postgres sql tools
Lanyrd: Finding conferences for the busy or travel-weary developer
Recently I had planned to attend a nearby technical conference on a weekend, but my plans fell through. As a result, my supervisor encouraged me to find a replacement, but having been out of the “free T-shirt and all the presentations you can stay awake through” circuit for many years, I didn’t have any ideas of where to start.
I wanted to filter the conferences by topic: no sense attending a Web Development conference if all the presentations were far afield from what I do; I’m not a Ruby developer at present, and have no immediate plans to become one, so not much point in attending a deep exploration of that topic.
I also wanted to stay local: if there’s something I can get to by car in a day, I’d prefer it.
I stumbled upon Lanyrd.com almost by accident: it’s a sharp, well-engineered central point for data about upcoming conferences on a dizzying array of topics. Not just software: library science, economics, photography, water management, social media, and medicine were represented in just the one day on which I wrote this post.
I subscribed to about a dozen topics, limiting each to the USA, and Lanyrd immediately suggested 46 events in which I might be interested.
You can …
community conference
Dynamically adding custom radio buttons in Android
I’ve been writing a timesheet tracking app for End Point. In working on various features of this app, I’ve had more than a few problems to work through, since this project is one of my first on Android and I’ve never used many of the Android features that I’m now using. One particularly fun bit was setting up a scrollable list of radio buttons with numbers from 0 – 23 (no, we don’t often have people working 23 hours on a project in a day, but just in case!) when the user is creating an entry, as a prettier and more backward-compatible alternative to using a number picker to indicate how many hours were spent on this particular job.
In Android, view layouts are usually defined in XML like this:
layout/activity_hour_picker.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button android:id="@+id/button"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:onClick="doStuff"
android:text="Hello World!" …
android mobile
Dimensional Modeling
People occasionally bring up the question, “What exactly is a data warehouse?” Though answers to this question vary, in short a data warehouse exists to analyze data and its behavior over large swaths of time or many different data sources. There’s more to it, though, than simply cramming historical data into the same old database. There are a number of defining characteristics, including the following:
- Query patterns and behavior
- Data retention policy
- Database structure
Query Behavior
Data warehouses are sometimes called “OLAP” databases, which stands for “on-line analytical processing”, in contrast to the more common “OLTP”, or “on-line transaction processing” databases that manage data for an online storefront, a bug tracker, or a blog. A typical OLTP database supports applications that issue short, simple queries, and expect quick answers and support for many simultaneous transactions. The average OLAP query, by contrast, is generally read-only, but can be quite complex, and might take minutes or hours to complete. Such queries will often include heavy-duty statistical processing and data mining, involving terabytes of data.
Data Retention
In a typical e-commerce database, …
database pentaho reporting casepointer
Using Modernizr with the Rails Asset Pipeline
Like many web developers, I use Google Chrome to develop my front-end user interface. I do this because the Chrome Developer Tools are very nice at letting me fix CSS styles and debug JavaScript. One downfall to using Google Chrome as my only view of my website while developing, however, is that I often find that I’ve used some feature of HTML or CSS that isn’t supported by other browsers. While this problem seems to come less often these days, I still find the occasional glitch. Most notably, this seems to happen with Microsoft’s Internet Explorer (IE) more than any other browser.
During a recent project, I finished up the UI so that everything looked and felt great. Then I popped open IE to see what sort of things I would need to fix. One feature of HTML that I didn’t know wasn’t supported by IE was that of placeholder text for form inputs. For example:
<input type="text" name="user_name" placeholder="Enter your user name" />
This HTML generates a nice looking input box with the words “Enter your user name” already entered into the input field. When a user clicks on the field, the placeholder text disappears so that the user can begin to add their …
javascript rails
End Point Europe meeting in Warsaw
Recently End Point’s European crew from Italy, Germany, and Poland met up for two full days in Warsaw. We rented an apartment and the four full-time End Pointers (Kamil, Szymon, Lele, and Jon) and two interns (Zed, Phin) worked together there on several projects.
It was great to take advantage of the chance to collaborate in person on several projects, many of which we just got off the ground there:
- Kamil and Szymon started work on a new AngularJS auto-CRUD admin (like RailsAdmin and the Django admin), which may grow into the Interchange 6 admin. Jon added support to Perl’s SQL::Translator (aka SQLFairy) to import/export database schemas in JSON format, which the Angular.js admin app can use.
- Lele started work on upgrading our Request Tracker instance, which is more complicated than we would like, but needs to be done.
- Szymon showed us all some details of Debian (and Ubuntu) package building that he’s done for Google, and packaged some simple internal scripts that we’ve only had in RPM and Yum to date.
- Zed worked more on our Android time tracking app, and Kamil threatened to start an iOS port of it since he’s fallen in love with Objective-C.
- Phin worked more on the Interchange …
company conference remote-work travel
Rackspace Load Balancers network issues and “desperate” solution
Most people in IT already know the common “Have you tried turning it off and on again?” joke and about all of them also know that sometimes it just works.
In a sense that’s what I experienced with Rackspace Load Balancers when after a day of networking troubleshooting, which involved (but was not limited to):
- iptables rules proof-reading
- overlapping network mask checks
- tcpdump network traffic troubleshooting
- software functionality testing both via localhost and different hosts
I had an enlightenment moment when I realized that while I was waiting for the next desperate solution to pop out some remote areas of my brain I could just remove all nodes from the load balancer (via the web interface) and then add them back, without actually making any other change. Well it turns out that this was the solution that I was looking for after a day of reckless debugging.
So lesson learned: before hurting yourself, try once again the most simple, obvious and possibly silly answers… and just a second before considering the impossible become possible, try “turning it off and on once again”.
iptables sysadmin
Elasticsearch: Give me object!
I’m currently working on a project where Elasticsearch is used to index copious amounts of data with sometimes deeply nested JSON. A recurring error I’ve experienced is caused by a field not conforming to the type listed in the mapping. Let’s reproduce it on a small scale.
Assuming you have Elasticsearch installed, let’s create an index and mapping:
$ curl -XPUT 'http://localhost:9200/test' -d '
{
"mappings": {
"item": {
"properties": {
"state": {
"properties": {
"name": {"type": "string"}
}
}
}
}
}
}
'
{"ok":true,"acknowledged":true}
Since we’ve defined properties for the “state” field, Elasticsearch will automatically treat it as an object.* Let’s now add some documents:
$ curl -XPUT 'http://localhost:9200/test/item/1' -d '
{
"state": {
"name": "North Carolina"
}
}
'
{"ok":true,"_index":"test","_type":"item","_id":"1", …
elasticsearch json search