Building a Single Site Browser/RSS Reader with Adobe AIR

Nov
06
2007

Lots of the web applications I build or work on are replacements for desktop (often terminal-based). A few years ago, one of my clients asked if it would be possible to wrap their suite of intranet applications in something other than the standard browser.

They wanted a regular Windows menu with links to the individual pieces, like: Time Entry, Address Book, Order Queue, etc.  Many of those apps were written at different times and that approach gave them an integrated application that had its own place in the Windows menu. For them, we built a C# application that wrapped Internet Explorer to accomplish it and they were pretty happy.

I re-used that wrapper several times, including as a way to give clients a way to test sites that were in progress without having to deliver URL's that were likely to change as well as a custom sidebar to help them go through the site.

Fast forward to more recent days and you'll find me frustrated with how long it was taking Firefox to launch a new tab or switch between them. Shortly after killing the tab containing Google Reader everything became snappy again. The next time Firefox was sluggish, I checked the memory during the problem and killed Google Reader again with the same results.

That's when I flashed back to my browser wrapper as well as several articles I'd bookmarked over the last year or so regarding "single site browsers". Since my RSS reading is usually just a background activity, but is nearly always open, I don't really like taking a performance hit during things like web testing as a result of a background activity.

While I could have resurrected the old application to make a Google Reader-specific app, I have no idea where the code is at this point. I thought this might be a perfect task for trying out Adobe AIR. I'd installed the tools and tried a basic test run back in August. I figured this could also serve as an example of how to build a quick and easy single site browser that runs on Windows and Mac (at this point, with Linux in the works).

Read the rest of this entry »

Better Image Resizing: Seam Carving

Oct
02
2007

You may have already seen this video (it's from mid-August) on resizing images in a more content-aware way: called "seam carving". If not, take a look.

I've shown that video to a few people over the last couple of weeks and nearly every one of them asked where they could get software to do that. The package that everyone points to is the GIMP plugin "liquid resize".

The only problem with pointing people over to that plugin is that it's not exactly obvious that it shows up under the "Layer" menu in GIMP. Similarly non-obvious is exactly how to use it to get the best results.

If you just fire away, you don't get the benefits of preserving people's faces, for example. Instead, you get a distorted image that's little better than if you had just resized it and ignored the proportions.

Fortunately, a tutorial for using the liquid resize plugin landed in my RSS reader this morning and I thought I'd share.

Oh, and, for the record, while GIMP is typically run on Linux, you CAN run it on Windows as well. Just make sure you run the GTK installer before the GIMP installer (both on the site).

If you don't like the results that the GIMP plugin gives you, take a look at this other implementation of the idea or wait for Photoshop to integrate it (they hired the guy from the video).

Easy Downloading of CDBaby Sample MP3's

Apr
29
2007

A couple of days ago, Garrick asked a good question that I've wondered about myself: where can you find downloadable music from the upper midwest? I like finding new music and always get an extra bit of warm fuzzy when the artist is from Minnesota or nearby.

While the question raised some ideas about future projects, I did suggest CD Baby's state-specific listings: Minnesota, Iowa, Wisconsin, South Dakota, etc. While the interface that they provide isn't great, it does underscore just how much great music is out there from EVERY area of the world.

CD Baby is a great idea. Make a place for artists to sell their CD's without having to go through labels. Many of the discs are way cheaper than the $15-18 in most stores and I've bought a couple for well under the $10 that iTunes charges as well. Of course, since pretty much anyone can sell a CD there, pretty much anyone *does*, which makes the preview tracks a good idea (and just plain a good source of MP3's).

The tracks are all individual or by M3U playlist for streaming. The problem is that my searching for music is pretty much completely separated from my evaluation of it. I tend to find a list of artists/albums/tracks I might like, download them and listen to them later. I pretty much NEVER listen to the potentially interesting music when I find it.

All of that meant that to get the most out of the CD Baby sample tracks, I wanted a quick way to queue up the downloading of the tracks on a playlist. First, note that the playlist URL for an album changes (daily it looks like), so this is pretty much about downloading in the background while you're browsing the catalog, not trying to spider their entire site. What I am doing works today, but could always change.

At any rate, with a command prompt open (Linux, Windows or Mac doesn't matter) and a copy of wget on your system path, you can make quick work of grabbing the contents of a playlist.

See, an M3U playlist is pretty simple, coming down to pretty much a text file of URL's to MP3 files. That just happens to be the exact thing wget is made to handle. So, the general "workflow" works like this:

  1. Find an album you like.
  2. Right click on the "Play All Songs" link above the track list and copy the link address.
  3. Go to the command prompt and type "wget" followed by a space and then the URL. On Linux, it can be pasted by CTRL+SHIFT+V. Hit ENTER.
  4. Note the filename of the M3U that it downloads.
  5. Run "wget -i playlistname.m3u" and let it run.

It will then download them all one at a time. It all works fairly well. I've got them all downloading to a specific directory called, simply enough "cdbaby". I'm keeping them all under there so that I know where to go to buy the albums I like. However, I do want them organized by artist and album. It's just how I roll.

Fortunately, I wrote code to move and rename MP3's by ID3 tag a while back. Add the folder to iTunes and make another smart playlist and I can evaluate more music easily. And, with as much as I've been working the last couple of weeks, more music is a really good thing.

Powershell Finally Gives Windows Some Power on the Commandline

Feb
14
2007

I love utility programming: simple software that does something specific to keep you moving on a bigger task. I have a pretty simple rule that I'm always looking for a better and faster way to get any repeated process done. If I have to do something manually twice, you can bet I'm looking for a way to automate all of it or part of it.

Of course, you've got to optimize your time so that you don't spend 2 days automating something that could have been done manually, albeit irritatingly repetitively, in 20 minutes.

Much of the stuff that gets written under the banner of utility programming is done at the command prompt. On UNIX-like systems, bash shell scripting, perl and company are used to pipe text through grep, awk, content is grabbed from the web with wget and log files are rotated, analyzed and munged about with reckless abandon.

On Windows, there has been much weeping and shame over the poor commandline environment that is cmd.exe. Sure, we've had tools like Autohotkey as well as VBScript via WSH, and Cygwin if you were willing to go through the effort, but if you spend your days working on a Windows workstation, you were pretty much set up to get commandline sand kicked in your face at the geek beach (a really scary place, FYI).

Even with those tools, they often felt tacked on. For instance, Cygwin's version of bash has to go through a virtual mounted drive at /cygwin/c to get to your c: drive. It's really not much different than a complete Linux virtual machine sitting on Windows.

Fortunately, cmd.exe has been replaced and the new shell (Powershell) for Windows is a huge improvement not only for those who consider Windows their "home", but for those who find themselves on Windows more as a foreigner in a strange land. If you have spent much time switching between Linux and Windows, you've no doubt typed ls on Windows only to be greeted with an error message and forced to run dir instead. Well, on Powershell, you can do either one and they both do the same thing.

In fact, most of your basic commands from the UNIX world are aliased to their equivalents in Powershell. However, if Powershell was just bash ported to Windows, I wouldn't bother writing about it. Back when it first came out, that's exactly what I thought it was. I even installed it and used it every once in a while. However, only when, a couple of weeks ago I decided to make it my primary shell and really dedicated myself to exploring it, did I start getting excited about it.

Every day that I use this thing, I find more to like about it. And, last Friday, when I had it run a basic program I wrote against Oracle to dump schemas for tables into XML, pipe that XML into an XSLT processor, dump that output into HTML files, combine the HTML files into one, convert it to Word and generate a PDF, all in one command, I knew it was here to stay in my toolkit. I now have a simple script that gives me a PDF documenting the schema of any Oracle database I want (sorry, I can't share as it was done on company time).

To get started, you need to make sure that .NET 2.0 and Service Pack 2 are installed and then install Powershell 1.0.

I'd also recommend installing Console and setting it to use powershell.exe as its shell. Console is a slick front end to Windows command prompts, giving you a tabbed interface, which is really handy when you've got 5-6 shell windows open at once. Console also supports color schemes (which I like) and alpha transparency (which I don't). Of course, I also shut everything "eye candy" related off in Windows except the font smoothing, so what do I know.

Anyway, After installing, you either do a Start->Run->powershell or you start up Console and you'll get your Powershell prompt.

Mess around with it, try out tab completion. Notice how if you're doing a "cd" and hit TAB, it only cycles through directories and not all files (take *that* bash). Notice how it can handle not getting the capitalization right? Get to know it the way you're used to working with cmd.

I'll be back with more on unlocking the power buried inside this plain black and white wrapper (though mostly because this article is growing too large to be put out in one piece).

Suffering The Spam War's Collateral Damage

Feb
13
2007

For the 2nd time in the last few weeks, I'm the victim of serious collateral damage in what has become a major underground digital war. It's being fought most by computers and most of them on autopilot. The spam war has escalated, much of it invisible to the average computer user.

Sure, you get lots of spam. We all do. Several hundred a day is fairly common. However, when you really get caught in the crossfire of what's going on, you realize the true magnitude of this war. Several hundred spam messages per domain is only a tiny fraction of what is really going back and forth.

Yesterday afternoon/evening, this server went down as it got overloaded trying to process tens of thousands of messages, all from a single company (Belgacom, a Belgian ISP). They all stemmed from the same incident and show what kind of damage automated systems can do when they go haywire.

Here's what happened:

  1. Some virus-infected computers spewed out spam messages with virus-infected attachments to what are probably several million recipients.
  2. All of those emails contained forged "FROM" and "REPLY-TO" headers. Some of *those* messages used the auto-responder email address for my unfinished novel, Inheritance. That email address (which I'm not putting in here for obvious reasons) sends out a copy of the manuscript to anyone who requests it.
  3. Belgacom received a bunch of those virus-infected messages and replied with notification indicating that fact.
  4. Those notifications contained a full copy of the manuscript (95K) and a series of cascading waves was set off as the 2 servers volleyed messages back and forth in 10,000 message regiments.

Due to the sheer size of these messages and the fact that a Belgian *telecom* company was sending them out from pretty beefy hardware, it basically ended up being a denial of service attack with my server clearly out-gunned.

First the mail server portion of the server went down and eventually the machine itself crashed. In the end, about 15,000 of the messages ended up getting through and stored in the inbox, leaving me with a fun task last night to clean them up. Because of the size and number of messages, most IMAP-based tools timed-out when trying to clean out the mailbox and I ended up having to do it right on the commandline manually.

The last time this happened, it was Absa, a South African bank. Same issue, but with more "normal" messages, so more like 35,000 got through and the server managed to stay up.

However, this whole thing comes down to these companies that are, to be sure, receiving a HUGE amount of spam, but causing bigger problems. I *know* that spam's a big problem for companies, ISP's, etc. That said, when they send out a response to each and every one of these virus-infected messages or Viagra ads, they are actually doubling the amount of spam out there. And, as these recent incidents indicate, those outbound messages tend not to get spewed across the internet evenly, but dumped on specific locations that had nothing to do with the original messages except to be the unfortunate victims of forged email headers.

Quite simply, if you are bouncing virus or spam messages back to the sender, it's VERY unlikely that you're actually sending the message to anyone who was involved in its sending. Rather, you're probably bombarding some poor sucker who's had a domain up for a few years or had their email address in the address book of an infected computer.

We've got to quit bouncing these messages because it's just making the problem worse. Just think of all of those poor little servers getting crushed by all of this email. Won't someone think of the servers? So many of these new little servers may get crushed, never to grow up to fulfill their purpose.

« Older Entries  

J Wynia

For better or worse, I'm the guy who runs things here. I'm a web consultant, software developer, writer and geek from Minneapolis, MN. This site is a fairly wide cross-section of the things I'm interested in and enjoy writing about.

Oh, and if you happen to be looking for hosting for your Subversion repositories or just web hosting in general, take a look at Dreamhost. It's what I use for Subversion and your signup helps me out.

Latest Microposts

jwynia: @geniodiabolico I'm using Mosso for my hosting going forward. I've still got sites on a dedicated server, but it's Mosso from here on out.
jwynia: is eating way too much of the salsa he made for lunch. It's so much better when it's fresh instead of from a jar.
jwynia: @MNHeadhunter I've seen the Recruiters/Geeks passing in the night and missing each other quite a bit. Seems strange.
jwynia: @Cavorter let me know what kind of Windows server setup you need. I might be able to help you out.
jwynia: is back from the rained out Saints game.
Follow Microposts on Twitter | Subscribe to Microposts

My Attendance At the Gym

Feeds and Links


www.flickr.com
This is a Flickr badge showing public photos from J Wynia. Make your own badge here.

Search


Pages

Archives

© 2007 J Wynia. All original content is licensed under the terms of the Creative Commons Attribution license unless otherwise noted. Content from other sources is licensed under its original terms.