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.

SmartThings and the Recirculating Pump

A couple of years ago, we got a recirculating pump to run the hot water line from the master bathroom back to the water heater so we could get actual hot showers. The pump came with a built-in timer so that we could schedule times for it to run. That’s swell if you live by the clock. But what if you take a shower at different times of day, or at times that are unpredictable? What you really want is a button or a switch in the bathroom (at one end of the house) that will turn on the pump (at the other end of the house) for long enough to get hot water (say, five minutes or so) and then turn it off. Continue reading

License and Registration?

If you read a book about software development or start a repository on github or bitbucket or launchpad, you’ll confront the question of software licensing very early on — likely, before you even get to the question of what development environment you’re going to use. I’ve come to decide that this is not really helpful.

When I worked at startups, the code we wrote in-house was proprietary. We didn’t open source it, although occasionally we would contribute back to some projects. The point of the software team at those companies was to encode the business into bits that customers would pay hard cash in order to execute. We didn’t even think about licensing the software until it was time to think about how we were planning to sell it – a question which depended a great deal on the marketing department and the business in question.

Now, I’m writing software for my own entertainment. If one thinks hard about it, one might come up with ways to make money off of that, but that’s a hell of a lot of work and I’ve got bagpipes to play and tunes to learn and, let’s be real, dishes to wash and goofing off to be doing. My wife is doing amazing things and that’s enough startupness in the house at one time. When I started working on this turn based game server, I thought the way it would go would be to provide the server for cheap (or free) and then the money would get made by developing games that would run on top of the server. Now I’m looking at the software and its possibilities and thinking that the system itself has value to some entities (schools and researchers) and maybe I should think harder about selling it that way.

This decision is kind of important. Right now, I’ve got all the source code sitting in private repositories. It’s copyrighted by me, and it’s not licensed, period. If I were to open source it, that would make selling the server software impractical. The only way to sell open source software is to provide some kind of value-added service on top of it, and that kind of work really cuts into bagpiping. Also, and this may shock some folks, I’m not really very good with people. A service job isn’t one I’m going to succeed in.

If I’d gone with an open source license up at the beginning of this project, there’s not really any way to undo that. So, note to other software developers who like to fool around with code and write stuff just for fun: private repositories are your friend. Write your code, fool around with stuff, refactor and publish to your heart’s content. Then, when you finally get to some point where the license actually matters, then fire up your IDE’s copyright plugin and have it stick whatever boilerplate you decide on at the top of all your files.