My first encounter of the third kind (2005)
I first learned about X-Plane back in 2005 when a friend of my parents' wanted some help setting up a flight sim on his computer. I had been into PCs and MS Flightsimulator since about 1995 or so. My older brother had installed FS4 on our family 386 we were using at that time. I spend about the next ten years following FS through its incarnations up to "2004 - A Century of Flight". FS was for most of the time the only game installed on my computer with the notable exception of Silent Hunter, a WWII submarine simulation (seems I'm into vehicles that can move in 3 dimensions!).
So for this guy, Fernando, in 2005 it was only natural to ask the computer and flightsim geek kid for help setting up a decent flightsim on his machine. The only problem: he was on a Mac. He ran a little marketing design agency and so it was no wonder he was running exclusively Macintosh. So I did my research on the Internet (2005 was the year youtube was first launched. Internet with 2MBit/s was considered fast.) and found that there was this software called X-Plane 7 that would also run on a Mac. So I instructed him to order a copy of X-Plane at Application Systems Heidelberg, who was the German distributor of X-Plane at that time, and I promised to help him setting it up, though I had absolutely not the faintest idea how that sim worked. Moreover, I had never worked on Mac before. It felt so awkward, the mouse had only one button, and no program had a menu bar, instead there was this ugly menu bar on the top. I couldn't understand how someone would rather use this strange system then the rock-solid windows XP. So I limped my way through the installer and thought the joystick setup, and finally got this thing to fly. Flying the Cessna that came with it was fun and I recall that I was rather impressed by the different "feel" X-Plane provided compared to FS. However, X-Plane still proved to be no alternative for a die-hard FS user like me, with the Flight One ATR being my favorite airplane at that time. By the next year, X-Plane 8 was out and I decided to give it a try, of course I'd run it on windows.
X-Plane 8 (2006)
I got X-Plane 8 for my 19th birthday and started exploring. There was no global scenery as we know it, so the whole X-Plane world was considerably more boring than it is now. I still couldn't be convinced to switch. The Leonardo Maddog 2006 was my favorite aircraft in FS9 then and there was nothing even remotely comparable on X-Plane 8. So I spend probably a couple of hours having fun with X-Plane special aircraft, like the V-22 Osprey, because those things didn't exist in FS9. But it got boring after a few hours, so I de-installed it and never looked at it again.
The vasFMC years (2008-2010)
Since 2005 I'm a regular visitor of the local flightsim usergroup in Frankfurt. Well, it's not a usergroup, but a "Stammtisch", which means guys interested in flight simulation meet once a month to have a beer and talk about flightsim stuff.
It was in December 2007 when a guy I knew from this user group approached me because he knew that I was able to program in Qt. He said he needed a GUI to emulate a 737 MCP, and that software was to run on Mac. See a pattern here? So I agreed to take a look at it since I'd been using Qt on Linux for quite some time, and I assumed a Mac can't be that different from Linux, since it's after all a Unix running underneath it. The guy with the Mac and the MCP was Jörg Hermann, he was an avid X-Plane and VATSIM user. About a week later he said "have you seen this cool software called vasFMC? It's a real FMC and it is written in Qt. Can you make it run on my Mac?". And that's how the whole thing started. We became part of the vasFMC team and started porting it to Mac and Linux. I wrote my first X-Plane plugin to connect vasFMC to X-Plane. The rest is history - I dug myself deeper into plugin programming than few other people before.
Unfortunately, Alex Wemmer, founder and leader of vasFMC, lost interest in the project and shut it down early in 2011.
The CRJ year (2011)
I had first heard about the CRJ back in 2009 when Javier first announced it. I was looking forward to it very much since I wistfully remembered my beloved Leonard Maddog and wanted an aircraft on that level for X-Plane desperately. So I always thought "when this thing comes out, I'll be the first one to buy it!". As we all know now, things turned out differently. While I was finishing up work on vasFMC 2.10, the last version to be released, Javier posted the message on the X-Pilot forum telling everyone the project was scrapped. I was so sad to read about this - I had hoped for a decent aircraft in vain. Now at the same time I thought perhaps I could solve this problem myself. Instead of whining because I can't have a decent aircraft I should just create one myself! With the two years of vasFMC experience behind me I thought I could probably do it. So I teamed up with Javier, in greatest secrecy, almost no one knew about the project not being scrapped but instead being worked on. Boy, that was one hell of a ride! The amount of duct-tape I had to come up with to finish the CRJ and hold all the parts together was insane. In fact, when CRJ 1.0 came out, it was held together by hot glue and duct tape and immediately fell apart when the first user touched it. So came the updates 1.1, 1.2, 1.3, but it wasn't until 1.4 that I had finally replaced all the old duct-taped code with something that actually worked well.
The 777 year (2012)
During CRJ development I had learned a lot. About FMCs, simulating avionics, the quirks of X-Plane, how to integrate my stuff with a designer, how to talk to the X-Plane folks in case I encountered trouble. I think I made myself quite of a name with the rescue of the CRJ, so it was only natural that after CRJ several designers started approaching me with new proposals. Javier decided to make the Jetstream, which doesn't have an FMC or other complicated avionics, so I was free to take up work on another seemingly abandoned project, the 777 by Roman. Roman had contacted me before the 2012 Aerosoft conference and we figured out the details of how we work together during March. Work started on the 777 in April, and with all the CRJ knowledge in the background I was able to come up with some nice features, like a full ARINC 424 compliant navdatabase. The 777 was released in September 2012. And it was not nearly as a disaster bug-feast as CRJ 1.0. The 777 has about 5 times more code running the FMC and autopilot than the CRJ. The only reason it didn't come out with 5 times more bugs was the incredibly intensive beta test we were running behind the scenes in August.
2013 - Laminar and the future
In February 2013 I now started to work for Laminar Research to improve various aspects of X-Plane itself. It is great honor for me to to work on the worlds' best flightsim software myself now. And it is fun to see all the plugin API functions from the other side of the wormhole now, which leads to a better understanding of how plugins work. So I'm not done with X-Plane plugins, I now have an even better way to look at them. Stay tuned for more great things to happen!
This post is about X-Plane in education, about applied mathematics and about the skill of problem solving.
It is about solving problems with the most highly talented and creative people I've ever met, and about creativity superseding knowledge.
Every year in spring, the German "Zentrum für Mathematik" (Center for Mathematics) holds a competition for high school students in the year preceding their graduate. The competition is mostly mathematical puzzles, involving calculus, analytic geometry, probability theory, on a fairly advanced level for regular students. The competition includes problems to be solved in groups (usually every high school sends three to five of their best students) as well as problems they have to solve individually.
About 700 students take part each year in the competition called "Tag der Mathematik" (day of mathematics) and the 30 who score highest in the individual problems are then invited to take part in the event this article is about: The "Modellierungswoche", the week of mathematical modeling. I will stick with the term "Modellierungswoche" for the remainder of this article, as it is shorter than my rough english translation.
I was part of this event seven years ago, when I was in high school myself, and this year I had the opportunity to participate again, this time on "the other side", as a supervisor and posing a problem. It is amazing to see all these young, highly talented people, solving problems in a way I never thought possible. It is refreshing to see how problems can be solved when you know rather few methods, but you are creative at utilizing them.
Mathematical modeling is about translation: Translating a real-world problem described in a non-mathematical language into a set of problems that can be solved with mathematical tools.
The "Modellierungswoche" event takes place in October, the first week of the autumn school holidays. It involves going into retreat for a week of working with the most skilled and most creative people you ever met. And by "going into retreat", I really mean "retreat", because the conference venue is a remote location, away from busy cities, overlooking the Fulda river in central Germany, and with painfully slow to non-existant internet connectivity.
Participants of the Modellierungswoche are, besides the 30 highly talented winners of the spring competition, undergrad students of the University of Darmstadt, who are studying to become math teachers. Four or five high school students and two undergraduates form a group that gets a problem to solve, the undergrads' task is explicitly not solving the mathematical problem, but guiding the group, especially in time management, and for bouncing off ideas.
The problems this year were:
- Designing a roller coaster: A designer states how he wants to feel accelerations when riding the roller coaster, like moments of weightlessness, high g-forces, accelerations to the side, ... and they must construct the track that generates the necessary foces.
- Simulating a slackline: How does balancing on a slackline work? How do you coordinate arms and legs to keep standing on a slackline?
- Earth quake predictions: Given data about earth quakes during 100 years of records, can you state the probability for an event that is out-of-scale of the last 100 years, like Fukushima, and how does this affect the structures you want to build in that area?
- Navigating aircraft with inertial and radio-navigation: In case of GPS inoperability or jamming, what RNP accuracy is still possible with old-style navigation? How does shutting down VOR stations in favor of building a WAAS infrastructure affect this? As you might have guessed, that was the problem I posed.
- LED-Lenses for car headlights: How can you utilize a grid of rectangular LED-elements to create variable-beam headlights that can selectively dip a segment to avoid dazzling other drivers? Can you create a rectangular grid of lenses that evenly distributes the light from the LED on the street in front of you?
- Variations in gas prices: How can the huge ups and downs in gas prices be explained, as they no longer follow variations in crude oil prices? Is there a model that describes the behavior of gas station tenants and car owners that explains the strategies behind setting a price-point?
- Building levees in river deltas: With the predicted rise in sea-level, what is the best strategy to build levees with active components (pumps) that can extract the water from the river into the open sea? How to deploy this strategy in the Netherlands, where large parts of the country are below sea-level already?
- Cutting Leather: Leather being a natural product comes in irregular shapes, with possible "bad spots" inside the shape. What is the best strategy for fitting the needed pieces for a product, e.g. a shoe, into given shapes and can you optimize the fitting so you have to reject less rawhides for dark spots?
Briefly recall that all they had to solve these problems are the mathematical methods you learn in high school. So all these problems are to be tackled with what they learned until half a year before their graduate, and that involves only half a year of calculus, half a year of analytic geometry and half a year of probability theory. Some of them already knew the concept of complex numbers, even fewer knew the concept of differential equations. All of them knew the basics of linear algebra and how to utilize vectors, but only some of them knew how to use matrices.
What they didn't knew, they compensated with creativity, perseverance, and a sheer endless reserve of motivation to draw from. During the week, whenever I visited one of the groups, there were four young people evaluating ideas at a breath-taking pace. Usually, they worked far past midnight on their problems. Not because they get any grades for it. Not because someone told them to. Simply because they wanted to solve a problem. In some groups often the undergrads went to bed around midnight, while those teenagers were still scribbling whiteboards with formulae, or testing their ideas on their computers. Every group had been carefully assembled beforehand to have at least one who knew a programming language. Ever heard of rapid prototyping? Forget what you've seen before, these kids were programming a simulator for arbitrarily shaped lenses in just two days. THAT is rapid prototyping!
Let's take a look at the working groups:
They cracked inertial navigation in one afternoon. They all had an intuitive concept of numerical integration, and they had developed the formulae for the INS using a trapezoid method on the first day. On the next day, they developed Kepler's rule of integration using three points for every step (not knowing that "Kepler's rule" had been invented before).
These kids had never used Python before, but they knew how to program in Delphi. In one afternoon, while two were working on how to utilize numerical integration, the other two familiarized themselves with the programming environment I had prepared to them, consisting of a Python script skeleton that they had to expand.
They learned using Python interface and Dataref Editor within a few hours:
Not only didn't they know that Kepler's rule existed, they also didn't know about the atan2(y,x)-function of most programming languages. So they developed their own function to get the ground track:
Day 2: How do you use a VOR or a DME to find your position? How do you use the DME in 3d-space? Intersecting two spheres perhaps?
After realizing my team was making progress faster than I expected, I was curious what the other teams were up to.
The "gas price" working group was developing a function to describe the behavior of customers switching to another gas station where the pric is a few cents lower, depending on the length of the diversion.
The earth-quake group was looking for a probability distribution to describe the strength of earthquakes, which proved difficult because it is hard to get data for earthquakes weaker than Richter magnitude 3, simply because they go by unnoticed.
The "slacklining" group was working in the greatest creative chaos I witnessed.
Starting with no idea at all, they developed the equations of motion for a rigid body from scratch. Imagine developing the concept of moments of inertial without three-dimensional integration! At last, they got a little help by their supervisor explaining the Steiner-Huygen's theorem to them, and then they seemed to just know how it worked. Amazing. They started with a model of mass distribution in the human body:
And ended up with a flipchart worth of formulae to describe the force feedback of the slackline:
Meanwhile, the "roller coaster" group was also developing great ideas. Their room looked less chaotic than the slackliner's, but they also scribbled ideas on what looked like a square kilometer of paper:
These guys and girls did the most amazing thing I saw during the whole week: They rotated a 3d-coordinate system without knowing matrices. To calculate the forces on the passenger in the roller coaster, they had to rotate the coordinate system of the passenger in the coordinate system of the whole roller coaster.
If you remember briefly that my group had to develop inertial navigation, you will immediately notice that those problems are very similar. But I had allowed my group to take a shortcut and gave them the local accelerations of the plane in the openGL-coordinate space of X-Plane. I briefly thought about giving them the axil, side and normal g-forces in the plane itself, but I rejected the idea because I figured 3-dimensional rotation would be too complicated. I couldn't expect them to know matrix multiplication, much less quaternions, which is how you model 3d-rotations usually.
But the roller coaster working group simply didn't know the concept of quaternions or rotation matrices, instead they developed an approximation themselves from scratch. They made a few assumptions about the rotation difference from each frame to the next to be small enough so they could use both small angle approximation and assume that the order of rotations is negligible. And then they used what they knew of analytic geometry, which was little more than dot product and cross product, to "invent" three dimensional rotations themselves. This was absolutely stunnning:
The "leather cut" working group was meanwhile figuring out the algorithms to find intersections in polygons, so they could use a backtracking algorithm (they invented something not dissimilar of the knapsack-algorithm) to find how to fit polygons in another polygon without overlapping.
By the way, the lecture in each CS student's second semester where they learn about backtracking and graph algorithms is usually the one that causes most drop-outs. This of course couldn't scare them!
The "LED lenses" group had meanwhile spread out across two rooms. In one room, the "formula artists" where working out how to reduce the three-dimensional problem of refraction to a two-dimensional lens
while in the other room the "hackers" where developing a simulator for the two-dimensional lens:
Next day, the work was suspended in the afternoon to explore the proximity of the conference venue by going geo-caching. But before that, all had to line up for the inevitable group shot:
The geo-caching led us to a few beautiful sights of the Fulda river :
The next day, my group had figured out how to use VORs for cross-bearing
and they could explain to me why you'd want to use two DMEs with perpendicular bearings to update your INS position:
Meanwhile, the gas-prize group was reviewing their game-theory model of two gas stations competing for customers with one of the supervisors:
The leather-cut group was seizing the opportunity to work outside. The weather was exceptionally good on this perhaps last nice and warm autumn day of the year:
The roller coaster group was now preparing their most impressive coup: Reinventing openGL in Excel. Well, almost. None of them could really utilize a programming language. So what do you use to visualize points that you calculated? Excel! There's however the small problem of Excel being unable to draw 3d-plots. A problem for everyone else, but not for these highly gifted young guys and girls: They figured out the geometry of a perspective projection (again, without matrices!) and they calculated the 2d-rendering of their 3d-roller coaster in Excel, with sliders where you could adjust the viewpoint, so you could actually view the roller coaster from all sides!
They created a dozen worksheets and used Excel functions I never heard of. And no, they didn't use VB. They simply hacked their superb understanding of geometry into formulae they could utilize in plain Excel.
They didn't stop there. Next, they tied their eyepoint to the position of the car that went along the rails and turned their projection according to the rotations of the car going up and down, through loops and spirals, so you could actually ride the roller coaster in Excel. This was the most freaking awesome piece of Excel-hacking that I've ever seen.
Now there was only one thing left to be done, something that proved to be harder than the mathematics for some of them: Explaining to others what they found out. Each group had to prepare both a twenty-minute presentation to explain their results to the other groups, as well as write a report on their findings, and the aspects of the problem they leave open for further research. Most of the last day was consumed by practicing the presentation and writing down everything they had developed. The last group finished at 5:30am, showing up for breakfast at 8:30am again. Just as a reminder, they were not getting any grade points for that. They did that because they wanted to!
Professor Kiehl from the TU Darmstadt and Tobias Braumann from the Center of Mathematics had also been staying up until about 4:00am. And I doubt Prof. Kiehl gets paid any overtime premium or compensatory holiday for working a week everyday until way past midnight.
My group presented their results, showing how they utilized X-Plane and the tools I provided.
The "levees" group (also nicknamed "Flood the Netherlands"-group) have found an optimization problem for the number of pumps needed to pump water out of river deltas:
And simulate some scenarios in Excel:
The "slackliners" presented their model of the gymnast on the slackline
and showed an amazing little software that can calculate the effect of arms stretched out while bouncing on the slackline. The little man (with Professor Kiehl's head shopped in) falling down from the line caused some good laughs in the audience
The LED-lense could be constructed in 2D first, as proven by 7 pages of analytic geometry by this highly talented guy
The programmers have written a simulator for the car headlight, that shows the distribution of light using two LED elements:
Each participant got a certificate from the center for mathematics, awarded by the chairman Peter Prewitz
After a week of extremely hard work, all were tired but happy to have solved their problems. Of course, none of these problems had a sample solution. For example, I'd worked out a solution for inertial navigation in X-Plane (which I've described in a blog post), but they came up with something different. It is so inspiring to see people who never heard of numerical calculus or multistep-methods to develop such great results themselves, not influenced by anything but their own idea of using the tools they have.
A graduate might have a larger toolbox of methods to solve problems, but these teens are simply the greatest problem-solvers I've ever seen. Present these young people with any kind of problem, and they will bite their way through it, developing their own methods you'd never have thought of, inventing new tools out of their toolbox just with creativity and perseverance.
It's often heard in these times that the only natural resources Germany has is it's people. And these young men and women are the proof. These are the people we have to cultivate, they are problem-solvers of the future. We must be thankful for institutes like the Zentrum für Mathematik who help these people to recognize their skills.
I just hope that they are preserving their skill while they learn more and are not trading too much of their creativity for knowledge, as I think I've done myself. Knowing quaternion multiplication is a very small skill compared to creativity.
I just wish I worked with this kind of people every day.
There are two kinds of computer users: "Closers" and "Tabbers". You can tell them apart by pressing Alt-Tab (Cmd-Tab on Mac) on their keyboard: Closers have only a very limited number of programs running in parallel, and if they need an application to accomplish subtask X, they start the program, do X, and quit it afterwards. Tabbers instead have a long list of running applications, and if they need to do X, they Alt-Tab to the program, do what needs to be done, and then tab back.
(Example of a tabber)
I'm the kind of person who closes programs running in the background. If you Cmd-Tab on my Mac, you usually see three programs: Finder, because thats what runs the Desktop, you can't close it, QtCreator, because that's the tool I work with and Chrome, because I've always 5-10 open tabs of documentation and reference manuals.
On Windows, I used to be a "systray-nazi". No one f*cked with my systray! If you were a program and you installed a "speed launcher" in my systray, you got nuked from my harddrive immediately.
Today, even with 8 Gigabytes of RAM, I still close every process and service that I don't need right now, even if it needs only 640k.
And that's a principle that applies to my whole life, not just to my computer. I'm the kind of person who gets nervous when he owns too many things. Every thing I own is like a background process running in my brain, occupying 640k of memory to remember where I left it.
Using a little kitchen sink psychology, I assume this comes from me losing a lot of things when I was a child. I was always scatterbrained, and every week I would forget something, lose my pencil case when changing classrooms, forget my phone card (no cell phones these days!), forget my lunchbox, lose the gym bag on the bus and forget the writing pad with my homework. The latter was particularly annoying, because I didn't take homework assignments too seriously anyway, so then I had ACTUALLY DONE my homework but forgot the goddamn pad or folder at home. I grew up getting more aware of the things I have to look after, and me coming home with my mother looking at me saying "where did you leave your X?" became more rare an event.
But this came at a considerable waste of computing power in my brain.
Right now, I have kind of a list of all the things I own in my head, and I know where each of these items is. Each item on that list is like a background process, because it occupies a little bit of my brain. Perhaps 640k. And you know what I do with background processes, right?
That's the reason why I hate this list becoming too long.
So I try to not have too many things I don't really need.
Actually, there is exactly only one item that I really, really, really need. And thats the RSA-key for my repository server. I've stored that quadruply redundant on every harddrive and USB-pen that I have. If the whole building burnt down, leaving me with nothing but what I have in my pockets, all I need would be a computer with internet connection, and I could resume work. If and only if my apartment burns down at the same time my hoster goes out of service, I'd be in trouble.
Why am I writing this stuff? Because I today decided to kill one of those brain's background processes of mine, and get rid of a thing that's been getting on my nerves for a long time. I decided to sell my car. Since I've moved to Frankfurt, this thing was parked for two months. Not moved an inch. I live 300 meters from the train station now. Yesterday I was forced to start my car and drive a few kilometers. The goddamn thing runs worse than a cement mixer, because the mass airflow meter is fried. I have no idea why, it worked okay last time I checked. The spare part isn't expensive. Replacing it is so easy, even I could do it. But I don't want to dedicate a single thought anymore to this thing. So I came back home today, parked the car, went up to my apartment, switched on the printer, printed two "FOR SALE" signs, went down to the car and put them in the rear windows.
I however did bother a few minutes to browse the usual used car websites to look up an adequate price. And I realized that this thing has cost me more than 4000€ since I bought it, only for owning it, not driving one kilometer. Not including tax. Not including insurance. Only loss of value. And by the way, gas is currently $8.05/gal (€1.64/ltr) in Germany.
What few people realize, is that the TCO of a car is obscene. And loss of value is the biggest factor. All people talk about this for computers or smartphones, but with cars it's much worse. A car is even worse than a Windows PC in this respect.
Here's the deal: For the money I save by not having a car, I could easily afford a "Bahn Card 100". That's a yearly subscription for the german railroad system. You pay about 3800€ per year and then you don't have to buy a train ticket, you just jump on any train and go wherever you want. Many people think 3800€ is expensive. It's not. It's cheaper than owning a car.
And I don't care about broken mass airflow meters anymore. I don't care about having to change tires. I don't care about having to find a parking spot (a REAL problem in German cities!). I don't care about gas prizes going up and down.
This frees up so much resources in my brain, it's incredible.
Plus, I can read stuff while going somewhere. Try that with a car
Next up on the list of things to ged rid of (2 of n): my new Dell Notebook. It's fast, it's shiny, and I bloody hate it. Because Dell doesn't know how to build a good notebook anymore, but that's for a different blogpost. My old Dell Latitude D620, that's a great notebook. I dropped it to the floor a few times already. I spilled tea on it. It has so many scratches and dents, it looks awful. And it's too slow for X-Plane 10. But I love it. Because: It. Simply. Works.
The CRJ 1.4.5 update is uploading to the publishers now, and you will see it on your machines this week.
The biggest advance is what I call the no-more-pretzels-technology. The CRJ was notorious for doing awkward things when trying to enter a holding pattern. Entering a holding in what was supposed to be a parallel entry looked more like flying a pretzel.
If you are not interested in software development, you can stop reading here. Just believe me it works great now. If you want to know why, read on.
How does no-more-pretzels work?
It is all about treating object-oriented design as type-design. Just like Scott Meyers says in Effective C++ (i take it for granted you all have a copy of this book besides your bed. If not, buy it now!) you're not doing object-oriented design right unless you treat class design as type design.
The key to get the holdings right was to solve the confusion I was having about the four types of "course" there are:
- True Track
- Magnetic Track
- True Heading
- Magnetic Heading
If you are passing around courses as numbers (floats), you are in the constant state of wondering "wait, is this magnetic? And what about wind here anyway? Is the wind direction magnetic or true? Can I add a correction with regard to magnetic wind on this true course?".
Believe me, you will screw that big times. My git log shows I touched the holding and holding entry code a gazillion times correcting such problems.
Now types to the rescue: A true track is not a float! A true track is a type! And a true course is a different type!
So here's how it works: You can't compare a true track to a magnetic heading. Because there is no operator for that. You can't add a magnetic wind correction on a true heading. No operator for that.
Compare this code:
float crs = 315.f; // is this 315 true or magnetic ??? crs += mag_var; // did we just correct from true to mag or the other way? crs += wca; // did we just convert track to heading or heading to track???
with this code:
// MagenticTrack holding_inbd = 315._degm; /* You can do this if your compiler supports C++11 user-defined literals, which for now only a gcc 4.7 pre-release does */ MagenticTrack holding_inbd = MagneticTrack::fromDegrees(315); WindCorrection wca = WindCorrection::fromTrackAndWind(holding_inbd, wind, groundspeed); // operator+ overloading ftw! MagneticHeading crs_to_steer = holding_inbd + wca;
More verbose, certainly, but compile-time checked to make sense.
Compile-time checked to not fly pretzels.
Yesterday we shipped the 1.3 update for the CRJ. It included the much-awaited remote CDU functionality, which is basically a web server running in the plugin, serving the CDU screen in HTML format via Ajax.
The webserver in the plugin is a very basic HTTP server built with boost.asio, an incredibly powerful cross-platform asynchronous network library.
Thinking progressive as I always do, I of course built the webserver with IPv6 support, and configured it to always start in dual-stack mode, that means it serves the CDU both via IPv4 and IPv6.
I thought I could relax on that basis, and not touch this code again until the IPv6 address space is full.
I was so wrong!
Reports from customers kept coming in, that they couldn't start the CRJ any more. A very helpful customer showed me a gdb stacktrace of what was wrong. Guess what: it couldn't open a listening socket on 0::0, the "any" IP address in IPv6.
No, this guy was not using Windows 98. He was using the latest and greatest Ubuntu Linux. SRSLY, WTF?! It is 2011 and Ubuntu 11.10 has IPv6 support disabled by default?
Next customer with this problem was using Windows XP. Still the most popular MS OS these days. Guess what, no IPv6 enabled by default!
After instructing those guys how to enable IPv6 on their machines, I coded a patch for the server, to fallback to IPv4 only when dual-stack is unavailable. This is released as the 1.3.1 hotfix now.
I wonder how this planet is going to make the transition to IPv6 any time soon, when about 25% of my customers just can't use it without browsing through cryptic knowledgebase articles...
Given that XCode 4 on Mac ships with the the clang frontend for LLVM now, I wanted to give this new compiler a try and see if it can replace gcc for me.
To compile the CRJ plugin, I need Qt of course, and given this entry in the Qt blogs I thought it would be fairly easy to get this to work.
I was wrong.
First try: I checked out the Qt 4.8 branch from gitorious, and configured with -platform unsupported/macx-clang but I soon ran into a compile error complaining about an undeclared identifier "SetRect".
Second try: I checked out the specific git revision mentioned in the blog post, and re-configured. Build stops with the same error.
Thrid try: Given that the most recent clang is the 3.0 branch and that Apple ships 2.1, I decided to get myself a more recent clang. I checked out the llvm sources via svn, then the clang sources in the appropriate subdirectory, configured for a release-optimzed build (to boldly go...) and make'd. Some 10 or 20 minutes later I had a clang 3.0. I edited the mkspecs/common/clang.conf to point to my freshly compiled clang in /usr/local/bin and reconfigured Qt (I checked out master/HEAD before). Now the built took longer before it stopped, this time everything of QtCore compiled, but when linking, I got an "undefined symbol for architecture i386: ___eprintf". Oh well.
Fourth try: Google pointed me to this thread which indicated I must built the compiler runtime also. So I did another svn checkout (compiler-rt into llvm/projects/), make clean'd, re-configured and built llvm/clang/compiler-rt again. The built aborted mocking about some missing headers for ARM.
Fifth try: I reconfigured llvm with --enable-architecture=x86 instead of the default --enable-architecture=all, which would built all kinds of backend. The next built took somewhat longer and perhaps 30 minutes later I was ready to try again: with the freshly installed clang I went ahead to compile Qt again. This time it actually linked QtCore, but when compiling QtGui it stopped again with a compiler error:
src/gui/kernel/qt_cocoa_helpers_mac_p.h:218:10: error: cannot initialize return object of type 'NSString *' with an rvalue of type 'const NSString *'
Apparently, clang doesn't like Cocoa.
Sixth try: I make confclean'd and re-configured Qt to build with -carbon. Unfortunately, the next make stopped at exactly the same location, at the Cocoa-helpers. Apparently this header is pulled in every time regardless whether we actually use Cocoa or not.
At this point, I decided to give up on OSX and try my luck on Linux.
I svn co'd llvm, clang and compiler-rt to my Suse, configured for optimzed built and started make. Short time after that *KABOOOM!*. No, not a compile error. GCC crashed. My compiler trapped during compiling. Seriously, WTF? I was first confused by the print output of GCC, that referred to a source file that I wasn't compiling at all, until it occurred to me that the indicated source was a source of GCC, a GCC function that crashed.
Oh the humanity! I went to the #clang channel on irc.freenode.net and luckily some helpful soul indicated what I should do. GCC would break regularly during optimized clang compiles. The way to go would be to build clang with clang
- First, build clang in debug mode without optimizations with gcc
- Then, use the un-optimized clang to build an optimized clang
Luckicly, this guy was spot on. I had encountered this error that prevents GCC 4.5.0 to build clang with -ftree-vectorize. So the non-optimized built succeeded, and then I was able to bootstrap the optimized clang from it.
Configuring Qt-Creator 2.3 to recognize clang as compiler and display its warnings was straightforward.
Now I took a deep breath and compiled my airnav library on -Wall, which is a lot more pedantic than the -Wall of gcc. And bingo!!
The -Wall -Wextra compile however showed some minor warnings that I've never seen with gcc - it complained about an explicit template instantiation outside the namespace of the template. This was fixed changing two lines of code, and after that I got it through -Werror -Wall -Wextra. W00t!
- clang is not yet ready to be used on a regular day-to-day basis and still requires lots of fiddling
- Qt's codebase is relatively clean, as it compiles with clang with relatively few warnings
- the Cocoa headers of the 10.7 SDK however are not
- It is great to have yet another reference compiler to check for code-cleanliness
So I reached at least one of my goals: I have another reference compiler I can test my code against: I regularly compile my whole codebase with Visual C++ 10 and gcc 4. Now I have another testing point that reveals more potential issues (portability, unsafe assumptions).
I won't ship clang-compiled plugins to end-users soon, but I will definitely use clang-build plugins myself now for testing purposes.
There are two types of tech support guys:
-the kind, well-behaved, polite and zealous guy who has absolutely no clue and is following his script
-the grumpy, impolite, nearly-autistic nerd who lacks basic communication skills but knows his stuff
I prefer being handled by the latter. Because he is the only one who can actually solve my problem.
To achieve this, I usually start each call or mail to tech-support by such a mass of geek-level detail that I get escalated to the "puke department" a.k.a. "second level support" fast.
So I considered myself safe when filling out the bug report form for X-Plane with a well-crafted stacktrace from the GNU Debugger, showing the source of a memory error in a Freetype component on OSX, showing up at every X-Plane startup.
I would be the happiest person on earth if I had only ONE customer being capable of using a debugger!
But what happened instead, is that I was trapped for the exchange of FOUR(!!!) additional emails before this apparently got passed on to someone who can actually read debugger output (Austin or Ben one presumes).
Tech supporters of the world:
Please, stop wasting your (and MY!!!) time. If you get a mail from a nerd, pass it to a nerd. AND STOP BEING POLITE TO ME! I want a puke to talk to!
With the .1 update out, I considered it safe to make the move to Lion.
Upgrade itself was smooth and uneventful, but I have a few complaints:
- I downloaded from the AppStore 3 days after 10.7.1 was out, but it installed 10.7. I had to get the 10.7.1 update separately. Don't they update the installer at all?
- Why the **** did they make the Dashboard a separate space? Luckily you can change this in the "Mission Control" settings.
- It is sloooooow. Going fullscreen is not smooth. Switching spaces is not smooth. Snow Leopard feels fast as hell. The Lion feels more like a Lion on Valium. Or like this one.
Other than that, transition was great. XCode 4 was installed in no time, preserving my old XCode3 installation, however I doubt I will ever start the IDE. I only use the command line tools, in combination with QtCreator.
I recompiled all my stuff with llvm-gcc and I look forward to exploring clang. Using the XCode4 tools however means dropping the support for the 10.5 SDK, which means the next CRJ will only run on 10.6+.
As a developer who sells his product on both platforms, I want to give other devs insight on the pros and cons of each platform. Don't expect a definite "winner" or a special recommendation for you, I'm just sharing my personal experience and thoughts here.
Own website vs established shop
First, let's talk about using one of these platforms in the first place. As a newcomer, using a renowned shop platform is a must. You may think your product is good enough to be sold through your personal website only, you can do marketing and advertisement yourself, and you are trustworthy enough so people send you money.
Trust me, you are most certainly wrong!
Buying immaterial things like software online relies on trust, perhaps even more than buying things in real life.
For the customer, buying on your personal website with Paypal button is like buying a used car from "Honest Achmed" in a shabby backyard, whereas buying on X-Aviation or X-Plane.org is more like going into a big Mercedes-Benz showroom and being served by a besuited official.
Sure, people like Peter Hager may be successful selling their planes through their own website, but few people in our community have earned the trust that every product of theirs is top-notch quality.
So, unless you have a track record like Peter, you should rely on the trust that people have in the big online shops, with the thousands of customers already, various payment methods, buzzing support forums, and the strong feeling that you actually get something for your money.
Now that we have decided we must sell through an established selling platform, being X-Plane developers, our choice boils down to the above mentioned "Big Two".
First, the similarities: Both offer a top-notch e-commerce system with product categories, preview pages, shopping cart/checkout, customer database, the whole enchilada. Both offer your customers the option to checkout either with credit card or Paypal.
Considering the overall visual appearance, the X-Aviation shop website wins. It looks tidier and more "Web 2.0"-like with the customer reviews built in. Also the graphics look sleek and modern, the animation is smooth and unobtrusive.
X-Plane.org on the other hand is more like Amazon or the classic GMail. Rather basic in the visual appearance, but well structured and clear. The icons look a bit 1999 though.
Also, both offer hosting the support forum for your product - here X-Plane.org is the clear winner. The "Invision Power" forum software they use is simply great. The moderation options are very intuitive to use. Posting multiple attachments and graphics is done easily. The search function is a bit strange though, as you have to be proficient in using the advanced search options to get good results. The quick search tries to be smart but fails often. Another big plus of the IPBoard software is the mobile version. Browsing the X-Plane.org forums on your IPhone or Android is a great experience and feels like a native app.
Browsing the X-Pilot.com forums on a mobile device is a pain, as you are constantly scrolling right and left.
The X-Aviation support forum (X-Pilot.com) is a rather simple forum software that is also less intuitive to moderate.
I messed up more than one support thread when trying to split parallel discussions in a topic apart and literally spent half an hour getting a thread back together.
A big plus for X-Aviation though is that given their smaller portfolio they are able to provide support themselves, as they know all the products they sell a lot better than it would be possible for X-Plane.org with a total of 435 products at the time of writing.
I have complete confidence that when I'm unable to check the forum myself for a few days, Cameron will take care of all the obvious newbie questions, answer all installation-related issues and leave only the really hard-core questions for me to answer. That is something I can't and won't expect from the X-Plane.org store.
So much for the visible, the "customer" side. On the developer side there are huge differences.
Distribution System and Reporting Software
To put it in one sentence: X-Aviation offers a whole distribution system, X-Plane.org offers only a shop.
Part of the excellent distribution system of X-Aviation is a GTK-based wrapper/installer that works the same on Windows, Linux and Mac. It is very user-friendly and goes hand-in-hand with the activation/copy-protection system. I know very little about the technical details, but I know for sure that this system has an unprecedented track record - I have not been able to find a working copy of one of the X-Aviation bestsellers on any of the usual suspect websites. Sure, every system can be broken, but I think X-Aviation set the bar very high on this. If anything can be improved in the installer, then it would be a detection for the folder the user selected. If it tested for the presence of X-Plane.app or X-Plane.exe to make sure the user selected the X-Plane main folder, it would score 100% on my personal scale. So it's only 99%.
Getting all this to work requieres you only to link a ludicrously small static library to your plugin code. This static library is available for all platforms with the gcc compiler, and now -because of my demand- for Windows also with the MS Visual C++ 9.0 compiler.
When sales begin, you can watch them live on the X-Aviation reporting system. The reporting screen is very intuitive and clear, you get the overview over the total sales and earnings on each day, summaries for each month, and a fancy little graph plotting your sales over time, which is extremely helpful if you want to see the impact of marketing like a paper advert. X-Aviation pays out every two weeks, and you may choose to be wired the money to your bank account or to use PayPal.
Compared to that, the X-Plane.org store is rather basic. It's more or less a way you can sell files. They don't provide an installer, a distribution system, or any means of activation or copy-protection. For many X-Plane products this is sufficient, as the typical X-Plane aircraft consists of a single folder you drop into one of the Aircraft/ subdirectories, and you're done. But as soon as you have to distribute other stuff, like the AIRAC data or additional frameworks your plugin requires, giving only a .zip-file to your customers is no longer an option. I resorted to using InnoSetup on Windows and InstallJammer on Linux. Both are very good solutions, easy to configure and the installers look instantly familiar to Windows users. The InstallJammer wizard panes are based on Tcl/Tk and try to resemble Windows Installer, which looks a bit awkward on Linux. For Mac I use Apple Package Maker, which is a huge pain in the ### to configure. Dear Apple, aren't you the company claiming to have the most intuitive UIs? Then go back to the drawing boards with Package Maker, will you?!
Also, it is left up to you, the developer, to think of a way to protect your software against piracy. The X-Plane.org shop offers a system to distribute serial numbers with each purchase though. You can provide a list of pre-computed serial numbers to the shop, that are sequentially issued with the purchases.
The reporting system of the X-Plane.org store also offers a live view and a month-summary, but it lacks many of the nice computations the X-Aviation system does for you, like the earnings-per-month and the neat graph.
You may also choose to be notified of each single order via e-mail. Which I diverted to a separate account, because it totally clutters up my workflow. Payout is at the beginning of each month, preferred payout method is also PayPal.
User base and marketing
Now on to marketing. First thing to note is that X-Plane.org has a HUGE user base. Based on the registered users, the X-Plane.org newsletter is read by nearly ten times the people who read the X-Aviation newsletter. A single marketing action on X-Plane.org can have huge impact. Also, X-Plane.org often has special offers bundling two or three products to be sold at a discounted price. With more than 170.000 registered users, announcements on the X-Plane.org forums reach a lot more readers than on X-Aviation.
All things considered, I have to conclude that you can reach more potential customers when selling on X-Plane.org.
X-Aviation in turn is more like a place where they sell hand-picked jewelry. Less users, less potential customers. But customers that are used to very high quality standard. Probably more potent customers, looking for top-notch software. Your product has to be good to be sold on X-Aviation. If the quality of the X-Aviation users makes up for the lack of quantity I don't know yet.
X-Aviation: Top-notch, state-of-the-art distribution system
X-Plane.org: MASSIVE user base
No, there's no final recommendation. I'm happy to have my product sold on both platforms. I like Cameron as a business partner as much as I like Nicolas, and I don't care that they don't like each other. Perhaps it's "the mercy of late birth", as a former German chancellor put it, that I never engaged in the turf war between them, because the split happened long before I had my first encounter with X-Plane.
So I encourage any author of X-Plane software to find his/hers matching business partner and continue creating and selling great software!
PS: Unlike to my other posts, I allow comments on this. But when spamming gets too worse, I will eventually close them.
Yesterday was the first time I saw a Kernel Panic on Mac OSX.
I wanted to play "The Rise and Fall of Ruby Woo" which I had ripped from a CD to my Notebook a long time ago and now transferred from my backup HD.
So I selected the 12 tracks in the folder and double-clicked to open, expecting it would launch iTunes and create a Playlist, or something like that. What I didn't realize was that the tracks were .ogg files, not mp3s (I had ripped them with Rythmbox). Apparently, Google Chrome is the application of choice to play ogg files on my system.
So Chrome popped up, opening 12 new tabs, in each one starting a track, all at the same time.
When closing the tabs, suddenly all the chaotic sound got stuck in a loop and a grey window appeared that I never saw before:
Reboot was uneventful and my uptime was already gone with the 10.6.8 update yesterday. I had DiskUtility check for errors though. Luckily, no problems.