July 02, 2009

David's Computer Stuff Journal

ruby-oci8 and libao

Not of concern to most people reading this via a feed, but it's one of those things I think is nice to write up as a public service, should anyone else encounter the same error. I'm stuck doing some Rails work with Oracle, and so I needed to get ruby-oci8 working:

http://ruby-oci8.rubyforge.org/en/InstallForInstantClient.html

These instructions are pretty good. I followed them, the gem said it had been installed correctly.... and yet:

ERROR: ActiveRecord oracle_enhanced adapter could not load ruby-oci8 library. Please install ruby-oci8 library or gem.
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in
`establish_connection':RuntimeError: Please install the oracle_enhanced adapter:
`gem install activerecord-oracle_enhanced-adapter` (LoadError)

Argh! After some straceing, I finally figured out what was missing: the libaio1 package. You need to have it or things will fail like this. It's very odd that the installation doesn't complain about it.

by David N. Welton at July 02, 2009 09:38 PM

July 01, 2009

David's Computer Stuff Journal

Custom Twitter Sites, BikeChatter.com Updates

I've been hacking away at http://www.bikechatter.com, adding a few things like votes and tags so that you can choose which broad categories you want to follow. The first will let people vote for the most interesting tidbits that come through twitter, whereas the second will let me add more people without overloading those who are, say, not interested in reading what coaches have to say, or are only interested in professional women racers, etc... I don't think I'll bother with individuals - if you want that, just add them to twitter yourself! At most I might see about putting in an 'exclude list'... but we'll see; I'd prefer to keep things simple.

Since I love cycling so much, adding stuff to this site has always just been kind of a fun side project, something to relax with in the evenings, rather than something I thought about in monetary terms. However, the basic idea seems to be popular, and as luck would have it, I've been approached by someone looking to buy the code behind BikeChatter to drive their own custom twitter site. If someone has gone to the trouble of writing me, there must be other people interested too, so I thought I'd publicly state that I'd be willing to do similar deals with people interested in having their own custom twitter site. Interested? Write me at davidw@dedasys.com . I'd be happy to tell you what the code can and cannot do, and discuss any ideas you may have, in order to let you know if it's a good fit, or if you'd have to do a lot of work.

The code is pretty straightforward Ruby on Rails. I use Postgres as a database, but others should work fine too. As is obvious, I'm not much of a design guy, but it shouldn't be too hard to plug in your own look and feel.

by David N. Welton at July 01, 2009 10:37 PM

June 25, 2009

Directed Edge News

Think Vitamin on beyond relational databases

There’s a new article up on Think Vitamin titled, “Should You Go Beyond Relational Databases” discussing the emergence of a crop of non-relational databases.  It’s one of the better introductions that I’ve seen to the landscape of document-oriented databases, graph databases and key-value stores that I’ve run across.  There’s a brief mention of Directed Edge in the graph database section:

There is less choice in graph databases than there is in document databases: Neo4j, AllegroGraphand Sesame (which typically uses MySQL or PostgreSQL as storage back-end) are ones to look at.  FreeBase and DirectedEdge have developed graph databases for their internal use.

Graph databases are often associated with the semantic web and RDF datastores, which is one of the applications they are used for. I actually believe that many other applications’ data would also be well represented in graphs. However, as before, don’t try to force data into a graph if it fits better in tables or documents.

Our own database is quirky hybrid of a graph-database, key-value store and column oriented database — the graph is a collection of interconnected items, which can have arbitrary meta-data associated with them, with column-oriented physical organization.  In fact, rolled into the next batch of updates that we’re testing at the moment are some more groovy features for enhanced item meta data like images and stuff.  We hope to go live real soon with that and The Other Cool New Features.

by Scott Wheeler at June 25, 2009 02:48 AM

June 23, 2009

Mike Coyle's Weblog

My Review of the Slacker G2 Personal Radio

I pulled the trigger on a Slacker G2 Personal Radio Player over the weekend.

For those unfamiliar with Slacker (as was I until about 2 days ago), they are a streaming internet "radio" service, not unlike Pandora or last.fm.  

Slacker has over 100 stations covering most popular musical genres, and a couple of comedy stations.  The programming of these stations is handled by former terrestrial and satellite radio folks.  In addition to the professionally-programmed stations, users can create their own stations: You specify an artist, and the service will build a station around similar music.  Stations can be shared with other Slacker users, and there are many Slacker stations that have been created to emulate current and former XM and Sirius stations.

Both standard and user-generated stations can be tweaked to the tastes and preferences of the individual listener.  For example, you can ban particular artists or songs from a station, request specific songs, and fine tune the selection of songs (hits vs. deep cuts, current vs. older tunes, etc.) that are selected for inclusion in each station.  They have over 2 million tunes in their catalog, from Chet Atkins to Frank Zappa.

The web-based streaming music player is ad-supported, and you can skip 6 songs per hour within a given station.  For $48/yr., you can upgrade to their Radio Plus package that gets rid of the ads, and allows unlimited skips. 

However, Slacker has an additional listening option:  You can  buy a portable unit (the Slacker G2) that looks like an mp3 player and caches several hours of audio for listening offline, thereby allowing Slacker to compete with Sirius/XM.  In fact, Best Buy merchandises the Slacker alongside the satellite radios, on the opposite side of the store from the iPods and other MP3 players.  The 4GB unit can store up to 25 stations, or approximately 2500 songs.  

The portable G2 keeps its content refreshed by connecting to the slacker.com servers over Wi-Fi from your home network (incl. WEP/WPA), or via a public Wi-Fi hotspot.  Protected public hotspots are accessed by the G2 via Slacker's partnership with Devicescape, allowing you to refresh your music content at the airport/Starbucks/McDonalds/etc.

There are a bunch of very mixed reviews regarding the G2 hardware, but my first 24 hours with it have been extremely positive.  The Wi-Fi setup just worked, as did an automated firmware upgrade and the initial download of a half-dozen stations that I set up on my local account. 

My take on the G2: It feels like the offspring of an iPod and a Zippo lighter, and the packaging is such that it would feel at home at the Hard Rock Hotel gift shop.  The controls are intuitive, and the inclusion of album art, artist bios, and album reviews add to the experience, especially when discovering new artists.  I'm also very pleased with the audio quality of the device.

Of interest to Mac users:  While Slacker's desktop software is Windows-only, please note that you never need to connect the G2 to your laptop, assuming that you have a Wi-Fi connection available.

In closing, Slacker is a technology that works best if you buy into their abstraction and think of G2 like a radio, albeit a magical personalized one.  

I know it's only rock and roll cached AAC+v2 files, but I like it.


by Mike Coyle at June 23, 2009 06:19 AM

June 18, 2009

David's Computer Stuff Journal

The Erlang Paradox

There has been a nice series of interviews with the creators of various programming languages. In this one, it's Joe Armstrong's turn. The creator of Erlang, he's a very bright guy and well worth reading. One thing that has always struck me as interesting about Erlang, as compared to most of the "open source" style languages I've tended to use, is how it was incubated for a long time within Ericsson. It spent years there, and millions of lines of code were put into production use, prior to being open sourced, and certainly before the world at large took much notice of it.

This has been both good and bad for the language. The obvious upside is that a lot of smart people were paid to work on and improve it. Many new languages don't really get that opportunity, unless they come out of an academic environment. Rather than being a spare time project, or something that slowly builds up speed over the years, Erlang, as far as the rest of the world was concerned, burst forth from Joe's forehead, fully formed. This is not something like Ruby, where the early adapters were small companies like 37 signals, willing to live on the edge and not follow the pack. Quite the contrary, Erlang was backed by a huge, established player in the telecom market, focused particularly on applications where reliability is paramount. Certainly not a language you can call a 'toy'!

The downside to all this, though, is that, esentially, they can't really change the language much without being very, very careful. Here's what Joe says about what he might have done differently:

Looking back, is there anything you would change in the language's development?

Removing stuff turns out to be painfully difficult. It's really easy to add features to a language, but almost impossibly difficult to remove things. In the early days we would happily add things to the language and remove them if they were a bad idea. Now removing things is almost impossible.

The main problem here is testing, we have systems with literally millions of lines of code and testing them takes a long time, so we can only make backwards compatible changes.

Some things we added to the language were with hindsight not so brilliant. I'd happily remove macros, include files, and the way we handle records. I'd also add mechanism to allow the language itself to evolve.

Which is an interesting contrast to more "traditional" open source languages like Ruby and Python, which, over the years, have from time to time bitten the bullet and unloaded stuff they don't like. On the other hand, Erlang is solid code that you can count on if you do need to write systems with little to no downtime.

What do you think of the two approaches?

by David N. Welton at June 18, 2009 08:24 PM

June 17, 2009

Gabriel Weinberg's Blog

Things about Web Images I Just Learned

I thought I knew everything you needed to know about Web images.  But, of course, I didn't. Here's what I just learned when launching the new icon bar on the homepage of Duck Duck Go. We wanted the it to function sort of like the Apple dashboard (and on the Web like Schmedley's bottom bar).

  • img{-ms-interpolation-mode:bicubic}. Short version: if you resize images dynamically, they will look bad on IE unless you put this in your CSS.

    Longer version:  We ended up using the YUI Animation Library to do the animation.  But no matter how we did it using 1 image, it always looked terrible on IE.  Even if we used an image exactly as big as the big size, and did the smaller image exactly half of the bigger size (which should be easy to resize), it still looked bad.

    So then we tried using two images, which sort-of worked, but had its own issues.  Sometimes it would slow down the animation. It used almost double the image size and requests (a big no-no), and the actual resizing still looked bad (as opposed to the endpoints)!

    This was unacceptable, so I decided to dig deeper on the Web about this issue.  It turns out modern browsers use Bicubic interpolation to resize images and make them look good in the process. For whatever reason, IE7+ has decided to turn it off by default. I'm guessing this is because it takes some processing power, but it renders resized images looking terrible so I personally don't think this is a good trade off.  Anyway, if you add that above CSS to your page, IE7+ will use this method and your images will look good. I suppose I never hit this before because usually you shouldn't be resizing images dynamically. But there are cases where you want to do it...

    Unfortunately, it still doesn't work for IE6, on which you need to use the good ol' AlphaImageLoader (sizingMethod='scale') if you want to support that browser.

  • Photoshop/Illustrator's 'Save for Web...' does not fully optimize. Perhaps my versions of Photoshop and Illustrator are too old, but I suspect this is still the case with the newer versions. I pretty much used these blind, assuming they were optimizing correctly. And don't get me wrong, it does a decent job, but its just not the best. Instead, run your images through Yahoo!'s smush.it site.

  • If you really do not need PNG-24, use PNG-8. PNG-8 is really a better GIF. But it is limited in color palette and transparency with respect to PNG-24. That being said, often you don't need the difference, especially for things like icons. When you can, use PNG-8 because you'll get much smaller file sizes.

    That being said, you might think you need PNG-24 when you really don't. I did. I had these icons made that had full transparency. I knew, however, they were going to be on a white background, so I really didn't need all the transparency. Yet when I tried to save it as PNG-8, it just looked bad. The colors were all off. So it made me think that I needed PNG-24, but in reality it was Photoshop's optimization stuff that was being poor. In their defense, I wasn't helping them out by setting the white background ahead of time, which leads me to:

  • If you want to save a PNG-24 image as PNG-8, put in the background first. Once I made a white background layer, Photoshop then did a great job of saving it as PNG-8. And in fact, I could reduced the file size even more by using even less than 256 colors. Of course, I still had to run it through smush.it.

  • CSS sprites may reduce your page load (and image size further). CSS sprites are a way to group your images into one big file and then split them into separate files via CSS. There is a useful Web site to help you make them at csssprites.com. I couldn't figure out how to use it with my resizing requirements, but in the general case it should be at least tried, especially for icons where the color palette for your icons are similar. You get a win in image size. But you get a bigger win in reducing HTTP requests.

  • Custom icons are not that expensive. We got $40 custom icons and $10 recolored icons from iconshock.com. We talked to other icon designer firms as well, and prices were similar. Full disclosure: we created more than 3 icons (7), so we got a bit of a bulk discount. I did have a bad experience with iconeden.com, however. So I'd stay away from them.
For more image optimization tips, check out Yahoo!'s presentation.

Update: additional comments can be found here.

by Gabriel Weinberg at June 17, 2009 12:39 AM

June 15, 2009

David's Computer Stuff Journal

Swap Desktops

This weekend's hacking efforts:

What it does:

I like to have my "workspace" in virtual desktop 1, where I have 3 emacs windows, and 4 urxvt windows (bash shells). Sometimes, however, it's a bit of a pain to swap back and forth between client work and DedaSys work. One obvious approach is to replicate the window setup in a different virtual desktop. However, I'm used to having everything "just so", so that I can quickly move to the desktop south of the main one to have my browser, east to get to the shells that connect to host things run on, and so on. And if I put my 'local' workspace on a different virtual desktop, it would screw all that up, so I wrote the above code. It utilizes the wmctl program to swap virtual desktop N with virtual desktop M, meaning it takes all windows from N, and puts them on M, and all the windows from M and puts them on N. If I have a bit more time, perhaps I'll take a stab at the C code in wmctl and add a new option to swap virtual desktops.

by David N. Welton at June 15, 2009 08:20 PM

June 12, 2009

Social Strategist

Real Estate BarCamp Boston

Real Estate BarCamp Boston 2009 LogoToday I’m at Real Estate BarCamp Boston, connecting with industry techies, vendors, and agents. One presentation, one interview, and many introductions later, I’m done with the scheduled sessions and off to enjoy some pizza and networking. If video of the presentation or interview become available, I’ll link to it here. Thanks to everyone I met for great conversations; please check out my real estate marketing website service, EasyImpress.

by Jay Neely at June 12, 2009 10:16 PM

June 11, 2009

Social Strategist

3 Ways to Find Anything Online [1]

Friends and colleagues have given me a lot of praise for seemingly knowing about everything web-related. And while I can answer a good number of “How can I…”, “What are the…”, and “What’s the best…” questions off the top of my head, the biggest lesson I’ve learned about providing value to others is that it’s not about knowing everything, it’s about knowing how to find almost anything. Below are my top 3 resources for being able to find almost anything.

1) Delicious Bookmarks


The “biggest collection of bookmarks in the universe” is searchable & tag-browsable, making it an invaluable tool for taking the simplest phrasing of what you’re looking for and getting great results. One of the particularly nice tricks I’ve discovered is that when browsing tags, you can chain them to find items marked with multiple tags. (e.g. http://delicious.com/tag/marketing+tips+basics). Being able to view tags and users who’ve bookmarked items is great for turning on good result into several more by finding people/tags covering similar items.

2) Specialized Directories


Sometimes I just want a nice, long list. Directories are anytime I’m looking for something containing keywords that are ambiguous, or used in many different contexts. Anytime someone asks me for a web service that does X, if I don’t know offhand of one, I Go to Web 2.0. Other directories I use often are:

3) Specialized Search Engines


You can be okay at everything or you can be great at a few things. The jack of all trades rule applies to search engines as much as it does people, which is why Google has spent so much time creating specialized search engines (Blog Search, News, Scholar, Books, etc.). AltSearchEngines is a good source for every specialization under the sun, but the five I find myself using the most often are:
  • BoardReader – This forum search engine lets me choose if I’m searching for individual posts, whole threads/topics, or entire forums about a keyword.
  • Twitter Search – Anytime I want to find out about something happening now, Twitter search is the place to go. Links in people’s tweets help me find content faster than Google can index it.
  • SearchYC – Search engine for startup incubator YCombinator’s Hacker News community.
  • Yahoo! Site Explorer – Entering a URL in this tool allows me to find every site linking to it. SEOMoz’s LinkScape tool is similar, and includes anchor text information.
  • Google’s Keyword Tool – Allows me to enter keywords and find out how often they are searched for. Extremely useful not only for market research, but for finding out which phrasings of similar keyword sets are more common.

I hope these resources help you. Let me know your favorites!

by Jay Neely at June 11, 2009 11:59 PM

June 10, 2009

David's Computer Stuff Journal

Android Scripting

This is cool to see, even though it will doubtless take away some market share from Hecl:

http://google-opensource.blogspot.com/2009/06/introducing-android-scripting.html

Importantly, I think it helps to establish that Android is the phone OS for those who want to be able to hack on stuff. With the Apple phones, you're not supposed to even run interpreters on them. Yuck.

In any case, I think that it still leaves some space for Hecl:

  • Their system uses natively compiled languages that use a JSON RPC system to talk. This makes managing them a bit trickier - Hecl is written entirely in Java and compiled as a 'native' Android application.

  • Hecl is very easy to embed, and doesn't carry around a lot of baggage.

  • Hecl is small - apparently this system clocks in at something like 12 megs! Hecl is something like 500K.

Another cool thing is that this is, like most everything that Google has done with Android, open source under the Apache license (the same one as Hecl), which means that if I get a free moment, I'll try grabbing some of their console code and integrating it to make a nice Hecl console for Android.

by David N. Welton at June 10, 2009 08:18 AM

June 07, 2009

Gabriel Weinberg's Blog

A Harsh CSS Environment for Testing Widgets

Embedded widgets can face harsh CSS environments, but usually not this harsh:

#harsh * {
border: thin dotted #00FF00 !important;
display: block !important;
margin: 20 !important;
outline: 1px dotted red !important;
padding: 20 !important;

background: #00ff00 !important;
cursor: move !important;

clear: both !important;
float: left !important;
height: 0 !important;
max-height: 0 !important;
max-width: 0 !important;
min-height: 100px !important;
min-width: 100px !important;
visibility: hidden !important;
width: 0 !important;

bottom: 100px !important;
clip: rect(100px, 50px, 100px, 50px) !important;
left: 100px !important;
overflow: visible !important;
position: absolute !important;
right: 100px !important;
top: 100px !important;
vertical-align: sub !important;
z-index: 100 !important;

color: red !important;
direction: rtl !important;
font: oblique small-caps 900 20px/50px arial !important;
font-size-adjust: .01 !important;
font-stretch: ultra-expanded !important;
letter-spacing: 20px !important;
list-style: decimal inside !important;
text-align: right !important;
text-decoration: blink !important;
text-indent: 100px !important;
text-shadow: #000 30px !important;
text-transform: uppercase !important;
unicode-bidi: embed;
white-space: pre !important;
word-spacing: 20px !important;

border-collapse: separate !important;
border-spacing: 30px !important;
caption-side: bottom !important;
empty-cells: show !important;
table-layout: fixed !important;
}

If your widget looks OK inside <div id="harsh"></div>, then it will probably look OK anywhere.  I made this HTML example (view source) for easy testing.

Why does this matter? Suppose a site has a black background and white text, but your widget has a white background but no text color set--none of your text would show.

To deal with a harsh environment, you need some armor:

<style type="text/css">
#armor, #armor * {
border: none !important;
display: block !important;
margin: 0 !important;
outline: none !important;
padding: 0 !important;

background: #fff !important;
cursor: auto !important;

clear: none !important;
float: none !important;
height: auto !important;
max-height: none !important;
max-width: none !important;
min-height: 0 !important;
min-width: 0 !important;
visibility: visible !important;
width: auto !important;

bottom: auto !important;
clip: auto !important;
left: auto !important;
overflow: auto !important;
position: relative !important;
right: auto !important;
top: auto !important;
vertical-align: top !important;
z-index: 1 !important;

color: #000 !important;
direction: ltr !important;
font: normal normal normal 11px/14px tahoma,sans-serif !important;
font-size-adjust: none !important;
font-stretch: normal !important;
letter-spacing: normal !important;
list-style: none !important;
text-align: left !important;
text-decoration: none !important;
text-indent: 0 !important;
text-shadow: none !important;
text-transform: none !important;
unicode-bidi: normal;
white-space: normal !important;
word-spacing: normal !important;

border-collapse: collapse !important;
border-spacing: 0 !important;
caption-side: left !important;
empty-cells: hide !important;
table-layout: auto !important;
}

If you wrap your widget in <div id="armor"></div>, it should work OK. I made another HTML example (view source) for testing this armor.

I tested #armor cross browser using my test systems and browsershots.org. Of course, there are most likely still bugs, so please tell me about them!

To develop #harsh, I used the w3schools CSS Reference, which you can also use to figure out if you want to change the properties in #armor, or apply more thereafter. 

To apply additional styling after #armor, use ids instead of classes, e.g. id=""/# and not class=""/. because a particularly harsh use of #id * will override your classes. Of course, if you aren't that paranoid, you could back off the * in #armor and use classes instead.

You could also just use inline styling, i.e. style="". There may also be a better way to do it that I just haven't thought of yet. If you know of one, do tell...

by Gabriel Weinberg at June 07, 2009 07:09 PM

June 04, 2009

Directed Edge News

PHP bindings are starting to shape up.

By popular demand we’ve been banging out some PHP bindings that mirror the Ruby bindings that appeared along with our last web services update and the new developer site.

The API is basically the same adjusted for PHP conventions. They’re still a work in progress and subject to change, but we’d love feedback from folks more steeped in the world of PHP than us.

So, up on ye olde Github, our PHP bindings!

by Scott Wheeler at June 04, 2009 11:23 PM

Björn Günzel

Creating “Twitter This” Links

To jump to the link generator directly, scroll down or click here

Nicole Simon has brought to my attention that creating “Twitter This” links is not as trivial as it might seem. I hope to remedy the situation by providing a simple tool for creating such links.

What is a “Twitter This” link? Simply, a link that brings the user to the Twitter page with a prepared status text field. All the user has to do to tweet your prepared text is to click the “Update” button. For example, if you click this link, you should be transferred to Twitter with the prepared status message

A handy form for generating “Twitter This” links, created by @Fractality : http://bit.ly/twitterthislinks

(Following this link does NOT tweet the text, you still have to press “Update”. Why don’t you go ahead and just tweet it - thanks! :-)). It even works if you are not currently logged in to Twitter. After you login, you should also see the prepared status update form. Alas, it does not (yet) work if the user has no Twitter account yet and decides to sign up on the spot. After the signup process, the text is lost (but if the user clicks on your link again, it will then work).

In my opinion, this is the preferred way to encourage users to tweet about you. Many Twitter applications ask for the user’s login credentials instead and then proceed to post in the user’s name. Admittedly, sometimes that might seem more effective because users might not even realize it is happening at first - so they will tweet about you even if they never intended to do so. But I consider it a slightly dirty trick, which might alienate users in the long run. Also, personally I have never given my login credentials to a Twitter app (OK, maybe once or twice, but I regret that now), and many users might feel the same.

How does one create such links? It is rather simple: add a parameter named “status” to the Twitter URL, like this: http://twitter.com?status=your_message, where your_message is your message. The minor issue is that your_message has to be URL encoded. That means certain characters in the message have to be escaped, for example “<” becomes “%3C”. Most programming languages have utility methods to do this. For example you could simple paste the following snippet into your browser’s URL field and press return:

javascript: encodeURI('a text that needs encoding');

(except you have to be careful about ‘ and “, so that approach is not 100% failsafe).

To make it easier for you, I have created a simple form for creating such URLs. Enter the text you want to be tweeted in the “Text To Tweet” field. In “Link Text” you can enter a text that should appear as the name of the link. If you then press “Create Links”, the “Twitter This URL” field should contain the “Tweet This” link. For your convenience the “HTML Link Code” field contains a full HTML link element you can Copy+Paste into your web site (make sure you copy all of it, I recommend right clicking into the field and choosing “select all”). “Link Preview” shows you how the link should look on your web site.

Finally, if you liked this post and/or find the link generator useful, please twitter this. Also follow me on Twitter @Fractality.

 
 


“Twitter This” Link Generator
Link Preview:  


by Björn at June 04, 2009 10:18 PM