Tag Archives: programming

Why Monoculture

At some point, I don’t remember exactly when, I told my family that since I didn’t use Windows in a professional capacity and I didn’t use it personally, there was no way I was going to go to the effort of becoming and staying smart about Windows, and if they wanted me to do tech support, well, that was just too bad. I may even have been that much of a jerk in saying it, too. To my surprise, that was pretty well received. As a result, we mostly have Macintosh computers in the house.

Continue reading

Why I Don’t Write Native Apps

Xcode sucks. That’s why.

Seriously.

This evening I thought, “Hmm, maybe for my next project I’ll see about writing an iOS client for my turn based game server.” So I started looking at a Swift tutorial (the language irritates me so far, but that’s just because so far all the syntactic sugar is solving problems I don’t actually have) and it didn’t seem too difficult. So then I went looking for a PGP library that would work with Swift, and I found one.

So then I cloned the project to my Mac and tried to build it. Build failed. Why? Well, it turns out that I needed to install a utility called xcpretty. No idea why, but that was easily solved. Then the build failed again. Why? Because some $@%! Ruby script wouldn’t execute. (Ruby? WTF? I thought this was an Objective C or maybe Swift compiler!) So then I had to get all comfortable looking for what Ruby wanted. Three scenes of Thor: Ragnarok later, I figured out to gem install xcodeproj and now the build goes a bit farther, but now I’ve got another cryptic error message about how the link failed because the linker couldn’t find the OpenPGP ObjectivePGP framework. The framework that the project is supposed to build.

You know what happens if I have a project open in IDEA and it’s missing a dependency? The missing dependency is underlined in red and the IDE will pop open a window where I could locate the missing thing. You know what happens in Eclipse, with the same situation? Same thing. MPW? Xcode? Nah. Apple’s developer tools reckon that it’s enough just to say, “Nah, that didn’t work.” User-hostile and user-abusive interface.

So.

Xcode sucks.

OAuth, twitter4j, and JavaFX

I’ve started developing a text-only client for Twitter. The impulse came from getting fed up with all the auto-playing promoted tweets that were clogging my timeline. I looked around and found a library to handle all the Twitter API calls and started coding. The example code was all a bit bare-bones, but mostly it was straightforward. The one thing so far that I think could use a bit more explanation is the login process, and that’s the point of this post. Continue reading

Once Again, Most Documentation Sucks

I have been having fun, recently, programming a couple of services that run in Google’s App Engine. One thing they do is maintain some data in that cloud’s version of a database, so one of the important aspects of the services is controlling just who, exactly, is allowed to see or modify the data. I’ve actually got a solution in place that means it all works just fine for me.

Continue reading

How to Draw a Line

I became a bit intimidated and frustrated with my simulation framework so I set it aside for a while. I played a lot of video games and I practiced my piping. I’m bored with the video games, though, and last night I came back to the sim. I’ve got some ideas for making the problems tractable or even non-issues, and that’s the benefit of walking away for a bit. Before tackling the big structure, though, I thought I’d take a look at a small fix: how to tell what direction a link is going.

A link between two components is a directional line. It takes messages from the source end and sends them to the destination end. But if I’m drawing the link as just a blue line, how can you tell by looking which end is which? I thought I’d maybe color the line as a gradient. (First I thought maybe I’d draw little arrows on the line, but that seemed too fiddly for almost bedtime.) The documentation and tutorials around using LinearGradient are all about using gradients as fill for shapes, not about lines, so there was some experimentation along the lines of, “What happens when the source endpoint is to the right of the destination endpoint, or what if the source is below the destination?”

Anyway, this works:

Stop[] stops = new Stop[] {new Stop(source.getX() < dest.getX() ? 0 : 1, Color.BLUE),
                           new Stop(source.getX() < dest.getX() ? 1 : 0, Color.RED)};
LinearGradient linkStroke = new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, stops);
ctx.setStroke(linkStroke);

Followup

From the javadoc comments in Math.java: “If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.”

Let me just point out that Java thinks that NaN (Not a Number), positive zero, negative zero, or either positive or negative infinity are different values, and this is not a quirk of Java. The language thinks this because the standard for computer representation of real numbers thinks this; the language is just exposing the constructs so that programmers can handle these different values.

At least nowadays positive zero will test as equal to negative zero. (That wasn’t always true, you know.)

Ars Gratia Artis

So, I came out of retirement to work on a neato project. I’m doing a lot of programming, architecture, release management, project management, and, um, reporting. So, that’s why I’m not doing a whole lot of bagpiping or anything. Because this is fun and important.

But nobody cares about that. The interesting thing here is that when I came on board there was git and not a whole lot else in the way of engineering support. I know how horribly messy a build and release system can get, let alone a development workspace, without some good process and support tools in place. So I started thinking about continuous integration, bug tracking, and an artifact repository.

I then mentioned this in a work context and was reminded that a “team” of only three people probably didn’t need a CI system and an artifact repository, but maybe a bug tracker wasn’t a bad idea. And that made sense. I have worked with enough QA people, though, and people who were serious and thoughtful about configuration management and build/release process, to still feel like having a dedicated build machine is probably a Good Idea. I just feel kind of itchy when I think about distributing software that was built on a programmer’s laptop.

So I checked out Jenkins and Artifactory and became befuddled within an hour of crawling through their documentation. I have associated with CM folks, but I’ve never really figured out their lingo.

Time passed. I wrote a lot of code. Other folks did. We threw some stuff away, we built some stuff, and now we’ve reached a major internal milestone. I’ve released some software internally, and it was built on my laptop. By me. By opening a terminal window and typing `mvn package`. I still kind of cringe to think about that, even though when I go to the trouble of articulating why, it turns out that in this particular case it is okay. I’m distributing an early beta/late alpha dev build.

Anyway, tonight I had a bit of spare time. Did I play video games? Did I veg out to some Netflix? Or did I install Nexus and TeamCity and try them out? Yeah, you guessed it. I still don’t think that we need an artifact repository. Not yet, anyway. We don’t have enough distinct modules to need it (unlike at Netflix, where we had a score or more internally developed libraries). But I found that setting up TeamCity was really easy (well, except for the part where it doesn’t grok my local MySQL installation) and it doesn’t confuse me with a lot of words that don’t mean what I think they mean. I might actually turn our cute itty bitty Mac Mini into our build server. Won’t that be a kick?

You know. For fun.