The U-Verse Gateway…To Hell

I just spent the last couple of hours discovering that my U-Verse gateway’s DNS server (serving the internal network) decided, for fun, to persist old IP addresses for some of my computers. The end result of this was that, while their external/NATted access was fine, local network services that were reliant on DNS would fail (since those machines had been allocated new IP addresses). So, for example, Windows file sharing would still work, but pinging or trying to use P4 would fail.

I did find the awesomely named post, “The ATT U-verse 2Wire 3800 HGV-B. I am not a fan…” detailing other problems with it. Needless to say, I am not a fan of it either. I got this resolved (by simply locking those machines to the “incorrect” IP reported by DNS — my will to live was figuratively destroyed by this point), but the next time I run into a problem with it, I’m just going to shove another TomatoUSB-powered router behind it (to replace it as a wireless access point, basically), stick it in DMZPlus mode (more info here), and be done with it.

My Reflections on Apple

I’m pretty sure this will be one of a million “stories about Apple” that will be going up tonight, prompted by the death today of one of its founders, Steve Jobs. Like many of my peers, the Apple IIe was one of the first computers I ever used, and one that I spent a huge amount of time with in my childhood — mostly playing games, of course, but also some programming and doing other practical things. The Macintosh that my dad later bought, in turn, also saw a lot of usage by me, although curiously my use of it was tilted more towards the practical and less games and programming. (Games because they simply didn’t exist, for the most part, on the Mac. And programming environments were pretty rudimentary for awhile — the development situation on the Mac at the time was definitely not friendly towards, or accessible by, 9-year-old kids.)

Of those two platforms, I would say that their influences were quite different on me. The incredible breadth and depth of games available on the Apple II platform really fanned the flames of my interest in gaming, which I would later go into as a professional career. The Mac, apart from the obvious innovations in user interfaces, introduced me to concepts like hard drives, laser printing (via PostScript), local area networking, WYSIWYG, and desktop publishing (an innovation that has become so ubiquitous that the term isn’t even used any more).

As a game developer, and someone who did some development on pre-OS X Macs, I wound up bearing a bit of a grudge against Apple. Their development environment, lacking protected memory, was incredibly unforgiving in many ways, and killed productivity. And Apple’s haphazard, ramshackle attempts at courting game developers were for the most part insulting, incomplete, and lacked support. I generally stayed away from purchasing Apple products and MacOS for a long time, ending only recently in the iPhone (which is a pretty decent phone).

So, in total, Apple is a company whose products have been incredibly influential not only in the world at large, but to me personally. And when one of its founders kicks the can, I feel obligated to eulogize just a little bit. In parting, I’ll relate an Apple II gaming anecdote that I haven’t written about before:

When we were kids, my brother and I used to love playing a game called Micro League Baseball, on our Apple IIe. It was a baseball simulation game, with somewhat rudimentary graphics, but a wide roster of teams, and the ability to play head-to-head. The multi-player mode was hot-seat — for each pitch, the player whose team was batting would select an option, and then the player whose team was in the field would select an option. Since the options could include baseball trickery like stealing a base, or pitching out, the person who was not entering their option would look away from the screen and keyboard and cover their eyes. This was to prevent the gaming equivalent of stealing signs.

Our rivalry was quite intense, and it was quite a big deal to us to triumph in these games. (We didn’t really consider the relative strengths of teams we were using, apart from the ’27 Yankees being mega-powerful.) So I wound up doing something that was both smart and dumb. The smart part: I realized that the hollow case and keyboard design of the Apple IIe was such that key presses had distinct timbres to them — ones that could be distinguished quite easily, with a little practice. I quickly learned that I could steal signs and know exactly what my brother was doing, even though my hands were covering my eyes in adherence to the “rules.” If he pressed ‘3’ to steal a base, or ‘4’ to hit-and-run, I would know about it in advance. The key noises were so distinct that there was basically zero chance of making a mistake.

The dumb part: I took too frequent advantage of this, and he got suspicious after about the sixth time that I called for a pitchout and happened to catch him stealing bases. I had to ‘fess up to my little trick.

I can’t remember if covering our ears, too, became part of playing the game, or if the other person had to leave the room, to ensure fairness and a level playing field.

Home Wireless Networking…

Our new apartment has a nice layout, but with regards to home wi-fi, there are a few key differences from our old place:

  • There are many more neighbors here who are also using wireless networks. They’re also closer to us than in our old place.
  • The construction of the building itself may be contributing to the reception problem.
  • The signal from our main access point is passing through a few walls. In our old place, it just had to go through a ceiling to get to our PCs.

The end result of all of this is that, in our home office, the wi-fi reception has been a bit dicey ever since we moved in. It would work, but the signal would occasionally drop out, or the response time would not be as good as I would like. With Battlefield 3‘s beta starting soon, I didn’t want to take any chances with a problematic network connection. I finally had a chance to do some tinkering and try and find a good solution to this problem, using components and parts that I already had laying around.

The first thing I tried was to set up a WDS (Wireless Distribution System), with a wireless router (my old Buffalo WBR2-G54) connecting wirelessly to my Asus RT-N16, which was situated in a hallway. The RT-N16 had better, unobstructed line of sight to the computers in the home office. The WBR2-G54 was running Tomato, and the RT-N16 was running Tomato USB. The conventional wisdom is basically that for WDS to work reliably/at all, the same hardware (or same wireless chipsets) must be used on all nodes. I can now report that the conventional wisdom seems to be true — I was able to connect using WDS, but not reliably. One minute, the network would be working very well, with strong reception between my office PC and the access point in the hallway, and good transfer rates. The next, it would be completely kaput, with a reboot of the router seemingly necessary to get it to respond at all.

The next thing I tried was to flash both of my routers with DD-WRT, and then try out its repeater bridge mode. This would purportedly allow me to have two separate access points, with the one in the hallway set to use the other one as its gateway, and with all machines on both sides of the network on the same subnet. This sounds nice in theory — however, I wasn’t able to get it to work, and the tools and documentation available for troubleshooting in DD-WRT are somewhat minimal. I double-checked all of the setup instructions on the DD-WRT Wiki, but didn’t have much success — I could connect to each access point separately, but the bridging didn’t seem like it was working reliably.

At this point, I was seriously considering just running some cable from the main access point in the living room to the hallway, and hooking the RT-N16 up there. It might be a bit ugly, but it would definitely work, and the interference problems would go away since the line of sight from PC to the access point would be much more direct and unobstructed. Some new Cat-6 and some cable covers, and everything would be golden…

Finally, I decided to try the basic repeater mode in DD-WRT. I also shelved the idea of using both the Buffalo and Asus wireless routers in this — I just set up the RT-N16 to repeat the signal of the main access point in my place. I also moved the Asus from the hallway to inside the office, in a place that may have clearer line of sight and less interference to the main access point in the living room. (The Asus is sitting near a window, which is across from a single exterior wall, behind which lies the main access point.) Once I straightened out all the little differences in setup (ensuring that the Asus was set to mixed B/G mode instead of B/G/N, due to the limitations of the main access point, ensuring that the wireless security settings matched, etc.), it all just started working. Devices in my living room can talk with those in my office, and the connection seems reliable and steady.

I could probably go back to using Tomato USB instead of DD-WRT, but at this point, now that it’s working well enough, I don’t want to mess with it for awhile. Maybe later down the line I will add another wireless-N router near my main (802.11g) access point, and see if repeating that signal will improve performance, but for right now I’m just happy to have nice reliable wireless networking going for my main PCs once again.

Memory Card Bugs (and a note about static analysis)

I was watching John Carmack’s QuakeCon 2011 keynote, and he mentioned that Rage was currently in the stage where they are creating cert builds, and just fixing bugs like (paraphrased) “getting a multiplayer invite and pulling your memory card out.” Memory card bugs are one of those things that tend to be a big annoyance for game programmers, because of the number of asynchronous use cases that need to be handled and the need to tie what are essentially supposed to be serial operations to a game that may be doing many other things in parallel. (Memory card support was optional on the original Xbox, due to the guaranteed presence of the internal hard drive. Accordingly, hardly any games actually support managing memory cards directly in-game.)

Carmack’s mention of memory card bugs reminded me of a funny story from Obsidian. For the Onyx Engine, one of my coworkers was working on writing the save/load code and then fixing bugs in the system, including memory card bugs on Xbox 360. Many of these bugs were timing-specific, so he would remove and reinsert his test memory card to try and reproduce the bug. Eventually, though, the first memory card slot on his development kit broke from the repeated (and potentially forceful, because of the need to try and reproduce specific timings) insertions and removals of the memory card. He had to switch over to the second slot on the kit — which, thankfully, survived until the project was over.

Another thing that came up in Carmack’s keynote is the use of static code analysis. He mentioned that id have drunk the proverbial Kool-Aid as far as static code analysis goes, and mentioned that turning on the “/analyze” switch for Xbox 360 builds (a flag that the XDK compiler supports — normally I think you need the Ultimate version of Visual Studio) brought to light many issues with their codebase. I can also vouch for this — I used to do this semi-regularly at Obsidian, and every time I ran it there were several subtle bugs that were sniffed out. It’s really worth using if you have it available.

A Musing on Sirius Radio

On Sirius, why is Lithium (the ’90s rock channel) so terrible in comparison to the excellent First Wave channel? I listen to both regularly, and I’m still hearing unusual or rarely-heard tracks on First Wave. It’s great. On the other hand, on Lithium, I’m guaranteed to hear a steady diet of the same Soundgarden, Alice in Chains, and RHCP songs, over and over. I’m sick and tired of the lack of variety and lack of actual DJs on that channel — it’s amazing how much they add to First Wave and other channels (namely Sirius XMU).

The Kindle is really picky about USB cables…

I decided to try setting up Calibre on my machine to manage my e-books, and rather than use the e-mail sync functionality with my Kindle, I figured I would just sync it via USB. I attached it through another micro-USB cable that I happened to have attached to my computer, but I had weird issues where any file I/O would cause the Kindle USB drive to become unmounted and then remount. This was extremely strange, so I tried removing all software from my computer that might be related to the problem: Virtual CloneDrive, VirtualBox, etc. This didn’t fix it. I updated the USB drivers for my motherboard, to no avail.

Finally, after a bit more Googling, I saw that some people mentioned that they tried plugging the Kindle into a different USB port on their machine. That didn’t work for me, but changing out my cable for the official Kindle cable made it magically work. Very strange!

So for anyone who’s having problems syncing their Kindle via USB, make sure you’re using the official cable (or a high-quality cable, at least). I initially thought it might be a 64-bit Windows 7/Vista problem, because I saw some other reports of problems with it, but at least in my case it turns out that it was the USB cable I was using.

Windows 7 Mobile Device Center not recognizing my phone over USB

I had some issues setting up my increasingly old and decrepit phone with my new machine – I installed the Windows Mobile Device Center, but it refused to recognize my phone when connected by USB. I seemed to be having some other issues at the time, and had an aborted attempt to install the proper USB drivers for my motherboard’s controller. I went through the following steps:

  • uninstall Windows Mobile Device Center
  • uninstall the unidentified devices in the Device Manager
  • reboot
  • install my motherboard’s “proper” USB driver (NEC)
  • reinstall Windows Mobile Device Center
  • Try connecting via USB again – it still failed, as before.
  • Slap in my Bluetooth adapter and connect via Bluetooth. When I did this, it seemed to install the mobile device.
  • I also had to delete my two existing PC partnerships before setting up the new one. Now it all syncs correctly.

Annoyingly, I still cannot sync via USB, but at least the Bluetooth works. I could have probably skipped to that, but I’m so used to syncing via USB that I wanted to get that working. I guess I could probably start sifting through the RNDIS driver error logs and see if I can find anything there, but considering that this whole epic saga started because I needed to sync someone’s address to my phone so I could mail them a package, I don’t want to get sidetracked too much more…

A Gross Overgeneralization

From David Chisnall:

If you find yourself optimizing your code, then it means that the author of your compiler has failed.

This is just very, very untrue. Even if you strike algorithmic optimization from the picture, code optimization is still a very important and useful skill to have no matter what sort of programming you’re doing. Knowing your target platform, knowing the behavior of your compiler or interpreter, and knowing your data (hat tip again to Mike Acton for driving this point home to me) can provide you with ideas on how to transform your code and realize massive performance gains.

If you’re writing performance-critical code, no compiler is going to do everything for you – the best optimizer is still between your ears. The idea that poorly-performing code can be blamed on the compiler is simply naïve and defeatist.