Category: Software

Adding Tides to Wave Chart

Will I ever be able to rest on my laurels? I was barely finished with my wave chart that I decided it would be even more awesome if it showed me the tides. Of course, the tides for the past are not all too exciting, but if you want to know when to go, today’s tides are mighty fine.

So, to adjust the chart, I needed to find a library that handles tide. There are probably more than just one, but this one seemed to do the job just fine, so I used it. Figuring it out was not hard, thanks to examples provided, and adding the functionality to the chart was mostly trivial. Here is the 411.

The library I used is called pytides. You can simply install it by running

sudo pip install pytides

It will run off after you provide it with your password and gather all dependencies and then install them onto your system. If you already installed matplotlib, then you have numpy already on your system. If not, pip will install numpy along with pytides, which can take forever. If you are on a Debian/Ubuntu system, you are better off installing numpy first, and then using the line above.

The changes to the code are in several places:

(more…)

Python, Matplotlib, and Surf Reports

waveplot-r6290.pyIt took me a long while to fall in love with Python (the language). It was mostly because the features I ended up liking were hidden behind the giant flaw in the foreground: mandatory matching white space. That means that, unlike in most other programming languages, Python decides that two lines belong together if they are preceded by exactly the same white space. If the white space doesn’t match, Python complains.

I won’t go into details here. Suffice to say that I ended up loving what lies beyond that fatal flaw. The Python developers created an environment where things are easy, and expected. Python tries to do what’s intuitive most of the time, and that makes it so much easier to work with.

So I decided to use it instead of my old staple, Tcl. Tcl was really marvelous in certain aspects, but it had gotten little love lately. Tk, its GUI, was once the gold standard of graphical user interface scripting, but it looks dated and weird now. So I started porting all my old scripts from Tcl to Python, to see how much time it would take and if they’d get longer or shorter.

What do you know, programming was a breeze. Python has libraries for pretty much anything you could wish, sometimes it’s a bewildering amount of choices. So all my scripts ended up being significantly shorter, faster, and easier to read.

Once I was done with my scripts, I started looking for a new challenge. I came up with the idea of taking the NOAA chart for the Torrey Pines buoy and making it look better and more informative.

plot wave.phpHere is the original chart. Notice how wave heights are simply plotted without averaging out anything. That’s very confusing and doesn’t give a good picture of the current waves – especially because the data is accurate only to 10 cm and the jump from one level to the next is quite high.

So I thought I could do better. I decided I would create a graph with configurable memory that would average waves out, so that I’d get a smoother picture of what’s happening. To do so, I’d have to figure out how to get the data, and what kind of data visualization was offered in the Pythonic world.

(more…)

Switching Back From Chrome to Firefox

It was a while back that I started using Chrome. Firefox had the major problem that it all ran in one process, which means that if one tab froze, the entire browser did. To compound the problem, there was no easy way to start Firefox standalone – whenever I started a new browser instance, it would just detect that Firefox was already running, and piggy-back on the running product.

Chrome worked well for me – still does. I started out running only the more troublesome web sites in it, but relied on it more and more, especially after it became clear that running both browsers required so much memory, my system would slow down as a whole.

Lately, though, I started noticing a troubling trend again: Chrome was slowing down. Dramatically. Worse: my system would slow down. Dramatically. If I ran my usual amount of research tabs (for the new novel), added a bit of fun tabs (cat videos and autocorrects), and the usual staples (email, Surfline, etc.) I wouldn’t be able to do much more. No loading Eclipse or KDevelop, for instance. I needed a whole computer just for browsing.

Looking at the reasons, I started up top. It was apparent that much of the time some background process in the browser was freezing up the system. That was easily fixed. But most of the time, there was no load on the system, just incredible amounts of memory usage. 

(more…)

Habla Espanol? Chat Translation in Pidgin

logo.pidginI have a new surfing buddy in Mexico. He doesn’t speak much English, I am struggling with Spanish. It works fine in the water, because we just nod and congratulate when we hit a good wave – the expression of joy doesn’t need translation. Organizing a trip, though, was a nightmare until recently.

I figured out that instant messaging was a good solution. I could type something in English into Google Translate, which is good enough for communication (although at times hilarious). I would then copy and paste the translation into the client. He would read and reply, usually doing as I did.

The process works, but is slow. So I started looking at something that would automate the copy/paste part. I needed a tool that would take what I typed, translated it into the target language, and then translated the reply back to me. In essence, I would have a conversation in English, and my friend would have a conversation in Spanish, and the tool in-between would be the interpreter.

Guess what, i found the solution. It’s the purple-translation plugin for Pidgin. It works like a charm, and aside from getting occasional snide comments about the fact that “you don’t say it that way,” the other end frequently forgets that I speak none of their language. And I tested that with a friend in Russia, one in France, and one in India.

(more…)

Calibre and the Kindle Fire 2

Quick Summary: All you need for Calibre to detect and connect with the Kindle Fire 2 is an updated libmtp.so that has the correct vendor/product for this eReader. That’s all you need for Linux, but an updated DLL will do the same on Windows, and I presume the same is true for OS X.

Calibre is great. I’ve used it since I got my first Kindle, many years ago, to backup my eReader, to push Gutenberg library files to it,  and to download RSS feeds. It’s been working great and is real easy to use (with a few exceptions).

The other day I decided to buy a Kindle Fire at the discounted price of $129. It’s not the Fire HD, just the regular Fire with the crappy (2012 standard) screen. But I had seen it in a store and really liked it, and I thought I could use it as a development platform for my books.

(more…)

Adding Google Maps behavior to Weight Table

I woke up this morning and checked a bug report on the Tcl weight table utility I wrote. I have now several years of (admittedly intermittent) weight data, so now the utility loads a little slowly, and then you have to grab the scrollbar to move around the many years.

As you quickly learn, idioms and paradigms move on the Internet. I remember the day I picked up a mouse in a computer store in Germany, not knowing what to do with it, in a scene reminiscent of Scotty in Star Trek IV. Nowadays we are so used to a mouse, we don't even know how to use a computer without it (nor is there a realistic way to use X or Windows or Mac OS X without one, thanks to keyboard-hating developers).

Once, maps were an image with scroll buttons on the sides. That's how 411.com worked (later sold to Yahoo!, I believe), then MapQuest. That paradigm led the way for a long time: it is understandable, requires no prior knowledge, and doesn't force you to reload a lot. The downside? It's atrociously slow and doesn't really give you the map you want. 

(more…)

Trying out StepMania

I remember the first time I saw a bunch of kids hanging around a Dance Dance Revolution (DDR) arcade game. It was at the Metreon in San Francisco, and I was just waiting for the movie to start. 

There I am, watching twelve-year-olds jumping like maniacs, realizing that was a variation of dance that combined arcade game qualities with physical exercise. It sounded like a dream combination: you appeal to the kids' competitive nature to make them work out more. And the whole jumping and twisting looked cool, not at all like the stupid exercises to the tune of video games. I remember the dorky treadmill that had a runner in front of you – my, this was to that what Dragon's Lair was to Pong

Now, a while ago I discovered stepmania, a game that for all intents and purposes is a remake of DDR under the GPL. It runs on a bunch of different platforms, so I tried downloading and running the Linux version – what do you know, it worked just fine, and it allowed me to play the dorky themes from the download page.

(more…)