Sunday, July 08, 2012

Leaving IEEE

I was a member of the Institute for Electrical and Electronics Engineers for ten years, joining as a student member in my early days at the University of Waterloo. I enjoyed my days as a student member, taking advantage of student paper nights, and getting involved with the local student society. During my Masters degree, I was lucky enough to attend a few IEEE conferences, and even published in a few of them. Overall, I felt that

However, after several years in industry, it's not quite as useful. I'm not publishing, nor attending (IEEE) conferences. The very concept of magazines and journals seems dated in an era of RSS, Reddit, and open access. Combine that with a very underwater mortgage, a family to support, and much higher membership fees, and the membership value proposition becomes hard to justify.

But what killed me more than anything - the spam. Neverending spam. I think the most offensive was the IEEE-affiliate life insurance - clearly not even tangentially related to the IEEE, yet I'm getting shredder food every month. Next on my list, the IEEE Communications Society. I don't do communications. I'll probably never do communications. I haven't the slightest interest in the topic, nor have I ever expressed such an interest. Still, they sending me every last call for papers, nag me regularly to subscribe to their content, and steadfastly refuse to honor my unsubscribes.

Finally, I had enough, and let my membership lapse at the end of 2011. This was just the beginning of the spam, with nearly a dozen different offers, warnings, requests and complaints trying to encourage me to renew. Not entirely unexpected, but what really got me was when they opened a support incident at "my request" in their support system, simply to further spam me through their ticket system. Every new email further reinforces how right I was to disassociate with this organization.

IEEE, you are supposed to be the premier professional organization for modern engineers, not an affiliate marketing business. Shame on you.


Sunday, June 03, 2012

Good old Games?

Recently I've been availing myself of GOG.com - a site that sells old PC video games at bargain prices, most often $6, though with regular $3 weekend sales that can be hard to resist. Most of the games are packaged to run under the DOSbox emulator, and so far every one has run perfectly.

In an era of multi-million pixel displays, 3D audio, and multi-gigabyte drives, are these ancient games really worthwhile? Some definitely have withstood the test of time. So far, my favorite has been Lands of Lore. There's something about that MIDI soundtrack and the gameplay that seamlessly mixes combat and puzzles that is just as addictive now as it was in my teenage years.

Still, playing many of these classic games have reminded me just how much things have evolved in game design; simple concepts that took the industry surprisingly long to catch on to, that you can't help but miss when going back to those old games.

Control Mapping
Back before the mouse was a basic requirement of every game, it was popular to use the arrow keys for navigation, rather than the now-popular WASD. This allowed the dominant (right) hand of most players to be used for  precise movement. Games eventually adopted the mouse for look, and thus stole the right hand from the arrow keys. Try using the arrow keys with your left hand, while using the mouse with your right. It cramps. Quickly.

But even more fundamental than the arrows-WASD debate, is that most modern games will let you set whatever controls you want. As long as you're willing to spend a few minutes in an option screen, you can set up whatever control scheme you can imagine. In the old games, the controls are the controls, and you live with them or play something else.

New games even let you adjust whether to use inverted or regular mouse look. Yes Magic Carpet, I'm tired of inverted mouse.

Checkpoints
I think I first saw this in Halo - the idea that without significant player intervention, the game would save your progress, so that if you died, you could recover at the start of the most recent section of the map. Now, we take it for granted that in most games your progress will be saved, and a death can only cost you a finite amount of progress. Having to repeat more than five minutes of play is considered poor style in a modern game.

Not so in old games. When you die, it's GAME OVER. Exit to DOS, or start a new game. You can reload from the last point you saved. If you saved three days ago... well sucks to be you. This is particularly relevant with old games, because they're hard! You'll be dying. A lot. It took me the better part of a day replaying Gladstone in Lands of Lore to get back into the step-step-save habit.

Tutorials and Tooltips
Game manuals are a thing of the past. I think the Starcraft 2 manual was more lore than instructions. Many Xbox games don't even come with manuals anymore. With digital download games, it's practically a requirement that the games teach their own gameplay. Even in complex games like high-end MMORPGs, you can learn almost everything you need to know from nothing but tooltips.

With old games, manuals are often essential. First, to learn the controls themselves, which as previously mentioned, can't be discovered or remapped. In some games like Magic Carpet, even the objective of the game can be unclear without some tips. Syndicate's manual is over fifty pages, and even reading that, I only barely understand the game.

Thursday, March 22, 2012

C++ interface multiple inheritance

Warning: if you're not a programmer, stop reading now.


Earlier this week I was thinking about multiple inheritance in C++. This practice is often discouraged due to challenges like the diamond problem, demanding solutions so complex that it starts to outweigh the benefits of the multiple inheritance in the first place. However, everyone says that multiple inheritance of interfaces (base classes with only virtual methods) is not only okay, but encouraged. This concept has been rolled into languages like Java and C# which otherwise don't have multiple inheritance!

But this bothered me - in C++, virtual methods are generally implemented by a virtual function table, with a pointer in each implementing class. But how does that work with multiple inheritance? How does the holder of an interface pointer know how to find the virtual functions that matter to their interface as opposed to the other interfaces? Does it even work, or will my code start breaking if I try this? I spent way too much time Bing-ing about looking for the answer with no success. Finally I decided to find out myself.

My test setup is a native C++ Win32 console application, compiled with Microsoft Visual Studio 2010. My output is 32-bit (sizeof(void*)==4).

1. How do we find the right vtable?

class IFoo {
    virtual void Foo() = 0;
};
class IBar {
    virtual void Bar() = 0;
};
class CImpl : public IFoo, public IBar
{
    void Foo() { printf("Foo"); }
    void Bar() { printf{"Bar"); }
};



int _tmain(int argc, _TCHAR* argv[])
{
    CImpl *pImpl = new CImpl;
    IFoo *pFoo = pImpl;
    IBar *pBar = pImpl;
    printf("Ptrs: pImpl = %p, pFoo = %p, pBar = %p", pImpl, pFoo, pBar);
}

Ptrs: pImpl = 000C6F98, pFoo = 000C6F98, pBar = 000C6F9C 

Well that answers that. When we try to take a pointer to the second interface, C++ will adjust your pointer, such that it points to the expected vtable inside the class.

2. But what about the "this" pointer?

So, IBar isn't actually pointing to the object. How does "this" work... is it corrupt when we call it from the offsetted pointer?

class CImpl : public IFoo, public IBar
{
    void Foo() { printf("Foo this: %p\n", this); }
    void Bar() { printf{"Bar this: %p\n", this); }
};



int _tmain(int argc, _TCHAR* argv[])
{
    CImpl *pImpl = new CImpl;
    IFoo *pFoo = pImpl;
    IBar *pBar = pImpl;
    printf("Ptrs: pImpl = %p, pFoo = %p, pBar = %p", pImpl, pFoo, pBar);
    pFoo->Foo(); pBar->Bar();
    pImpl->Foo(); pImpl->Bar();
}

Ptrs: pImpl = 000C6F98, pFoo = 000C6F98, pBar = 000C6F9C 
Foo This: 000C6F98     Bar This: 000C6F98
Foo This: 000C6F98     Bar This: 000C6F98 

Huh. They're both the same, and match pImpl. How did that happen? We just showed that the pointers are different! To answer this, I looked to the assembly. On x86, classes use the "thiscall" convention, which puts the "this" pointer in ECX. Lets see what happens.


When calling via the patched pBar pointer, we set this = pBar. This implies that CImpl::Bar implementation must internally patch the pointer back from IBar to CImpl. But, that wouldn't work when calling from CImpl directly. The compiler, knowing that CImpl::Bar() is meant to look like IBar::Bar(), actually sets this = pImpl + 4.

Oh, you're clever, VC++.

3. What about the same method defined in multiple interfaces?

A fun thing you can do with interfaces, is that different interfaces can define the same method. Since it's just a name (well, a signature), an implementer providing a suitable method can simultaneously satisfy both interfaces.

class IFoo {
    virtual void Foo() = 0;

    virtual void Omg() = 0;

};
class IBar {
    virtual void Bar() = 0;

    virtual void Omg() = 0;

};
class CImpl : public IFoo, public IBar
{
    void Foo() { printf("Foo"); }
    void Bar() { printf{"Bar"); }
    void Omg() { printf{"Omg"); }
};

But how would this work? After all, we just discovered that CImpl::Bar() expects "this" to look like IBar. What does CImpl::Omg() make "this" look like - IFoo or IBar? It can't be both - they point to different locations. But, looking at the vtable in the debugger quickly shows the trick.


Aha, VC++ is more clever than I give them credit for. pFoo directs Omg() straight to CImpl::Omg(), while pBar directs Omg() to Omg`adjustor{4}'. I'd bet the intent of this function is to adjust the "this" pointer to match IFoo - then CImpl::Omg() can assume all callers are referencing it as IFoo::Omg(), and "this" is interpreted appropriately.

Conclusion

You can use "interface-like" classes in C++ just like you would in C# or Java, including multiple inheritance, and the compiler will magically take care of making it work. It accomplishes this through manipulation of your interface pointers and your "this" pointers when using the objects, and through thunk methods where there is ambiguity.

Trust your compiler. Program with interfaces. Win!

Sunday, March 04, 2012

Hawaii Vacation–by Microsoft Flight

Amber and I will be taking a vacation soon to Hawaii, specifically “Hilton Hawaiian Village Waikiki Beach Resort”. A last chance to relax before Elora’s arrival.

But I couldn’t wait… I decided to go right now, with the new Microsoft Flight, specifically the Hawaiian Adventure Pack to get access to the high-res terrain for Oahu.

According to the Internet:

(credit: http://www.smarthawaiitour.com/)

 

According to Microsoft Flight:

2012-3-4_16-19-59-547

Flying Icon A5, chase view, from the West

 

Apparently the lagoon is NOT long enough for a water landing in the Icon A5.

 

2012-3-4_16-12-1-443

The underside did not enjoy the beach landing.

Wednesday, February 15, 2012

Lendio.com = Fail

They purport to "make small business loans simple." But their actual functionality consists solely providing an embarrassingly small list of vendors, with almost no relevant information, and largely ignoring most of the requirements they had collected in a drawn-out interview process.

... and then selling the detailed information to five times as many random small financial institutions, who then proceeded to cold-call me all week.

I think my favorite was the one who insisted that if I didn't want information from his institution that I must have been a victim of identity fraud, then hung up. Then emailed me, which SPF failed. Quality partner right there.

So, don't give Lendio any of your information, because it won't be yours for long.


Sunday, January 29, 2012

Dear Facebook Application Authors…

If your app says it needs my email address to function, I’m going to block it.

Seriously. What could your *Ville-of-the-week1 possibly need my email address for? I’ll click through just about anything, but when broken down to a two-line prompt with a picture that essentially says “The author of this app is going to spam the crap out of you”, what do you really expect me to say?

[1. Zynga is just one of many offenders. Did I call them out specifically due to recent shadiness? Maybe…]

Saturday, January 07, 2012

Assassin’s Creed: Revelations

Dear Ubisoft,

Please note the following list of completely redundant, unnecessary, and annoying features in your recent Assassin’s Creed titles.

  • City renovations.
  • Buying artwork / books / outfits.
  • Den defense.
  • 2D puzzles.
  • 3D puzzles.
  • Uplay.
  • Crafting.
  • Unskippable cutscenes.
  • Continent-conquering menu system.
  • Insta-win buttons.
  • Reusing world models.
  • Precursor civilizations.

I encourage you to consider redistributing the resources from the above areas into the following gameplay elements.

  • Moar assassinating.
  • A difficulty curve.

Sincerely,
  - Lownewulf

PS. Fix your clipping. Or at least reset me to checkpoint when I fall through the world.

WP_000309

Tuesday, December 20, 2011

Passwords and 1Password

In a way, us computer security people allowed it to happen. We allowed credit card databases to get hacked, phishing emails to fool users, and magstripe ATMs to get skimmed. However, our greatest mistake was that we stayed quiet when PHBs decided that, rather than fixing the actual security problems, instead decided on a false sense of security by forcing users to create ridiculously complex passwords, then forcing users to change passwords almost constantly.

The frequently-changing gibberish passwords with numbers and symbols actually made things far worse. XKCD explains the information theory behind why crazy number and punctuation rules actually make for weaker passwords. Forcing users to change the password frequently just makes said gibberish passwords even harder to remember, ensuring the users will have to commit the cardinal security sin of writing their passwords down. Even worse, with so many services requiring passwords, you either need to maintain a whole list of passwords, or use the same password (or pattern of password) across multiple sites. This can lead to the nightmare of one of your passwords getting exposed (especially if you wrote it down), then having to go through and chaotically change the password to almost every service you use.

I am hoping that the increasing ubiquity of mobile computing will help solve the problem, since it makes two-factor authentication essentially free. The idea being that having two separate levels of security (a simple password, plus a physical item you possess), when done right can be far more secure than any password. Blizzard has already demonstrated this with the Battle.NET Authenticator devices and apps, and I can only hope others go this route. Google is finally trying this too, though still has a lot to learn.

Sadly, until the world catches up, we’re stuck with passwords.

I found a piece of software that I’m actually really liking to help manage the insanity. 1Password is an application for Windows, Mac, Windows Phone, iPhone, and Android; currently $30 for the Windows version. It stores an encrypted list of all your passwords, locked by one “master password”. This means you can have unique, complex, and changing passwords for each service, but only need to remember one strong password. While I’m not often one to pay premium prices for software from random small vendors off the Internet, I’ve found this software to actually be quite worth the investment.

When on the road, you can look up a specific password (or even other data such as a passport number) from a mobile app synced to your desktop. Even if you lose your device (and don’t have remote erase capability), the data is encrypted with your best password.

While on the desktop, 1Password integrates with your browser. After typing your master password, it can automatically log you into most websites. If creating a new password, it can generate a strong (high entropy) password – such a password is almost impossible to remember, but you don’t need to ever remember (or even type) it.

Across computers (or to certain mobile devices like Windows Phone), the list of passwords is shared via the Dropbox cloud file replication service. Admittedly, I had never used Dropbox before using 1Password, but I’ve grown to like it. Plus, it’s free for the first 2GB of space. There’s not much security risk here – even if you don’t trust Dropbox’s security, they only ever handle the encrypted version of your passwords, and never have access to your master password.

Admittedly, from a security standpoint, password repositories can be dangerous, as the repository and master password is a single point of attack. Realistically though (and I’m sure all the security experts are cringing as I say this), anyone capable of capturing your master password is just as capable of capturing a bunch of separate passwords. So, given an equivalent level of risk, why not take increased convenience and improved password habits?

Update; FiOS TV DVR

Awhile back, I raved at the great improvement of FiOS TV. I’m still quite happy overall, but I’d like to retract my statements about the Frontier DVR. Frontier’s software still isn’t as buggy as Comcast’s on the same hardware, but it still has its share of bugs and other usability issues.

  • Series recordings seem to be spotty – some series record reliably, but others seem to never find new episodes. I am missing way too much Mythbusters!
  • When moving through recorded content, sometimes the video stream will fail to restart – frozen video stream, but audio will keep playing. You have to FF/RW to a different stopping point to get things moving again.
  • Pause/resume has some significant lag. When you ask to pause, it plays a few more seconds, pauses, then rewinds to the point you actually wanted to pause.
  • Favorites are good, but why on earth can’t you set favorites from the guide?

Certainly tolerable, but definitely not what I’d call a polished experience.

Thursday, September 29, 2011

Windows Phone: Mango

Phone updates are like Christmas – you wait months, and it feels like it will never come, but then you wake up one morning and have a bunch of presents waiting for you. Well, today I got my Mango Christmas, and it was quite a haul!
Really, the one feature Mango is missing is a tour of all the cool new stuff it can do. I’ve been finding out bits and pieces through news articles. There are literally hundreds of changes. Below are a few functional additions I’ve enjoyed so far.

New Bing search options: music (ie. Shazam), barcodes and tags (ie. Tag Reader, ShopSavvy), and automatic text recognition (OCR) plus translation. The “Scout” feature shows nearby restaurants, attractions, and shopping (ie. replace the rather bad WP7 Yelp app). Overall, this equals a much needed boost to the usefulness of the capacitive “Search” button.

Map improvements. Most notably turn-by-turn directions with text-to-speech. Also, favorite places. On the down side, no transit directions

Bluetooth audio improvements. Now with track data and elapsed time, more control of play modes.

Custom ringtones. On one hand, the lack of any tools to create, edit or manage ringtones is annoying, and the excuse of “Apps will do it” is a shameful cop-out. But still, one has to appreciate the elegance of the solution from a technical standpoint. Just edit any song < 1 minute to genre “Ringtone”, and it’s a ringtone. Trimming an existing song down to an appropriate length takes some third-part tools, but the genre can be edited right in Zune. Unlike Apple, there’s no attempt to monetize or otherwise prevent you from legitimately building your own ringtones.

Voice commands – speech to text, and text to speech. The experience seems heavily optimized to text messages, with some incredibly accurate dictation of outgoing messages and reading of incoming messages. There’s a few places where you can activate specific speech-to-text, but you can hold down the capacitive “Windows” button to trigger voice commands. Sadly, the selection of voice commands seems limited. Plenty of commands to control phone calls or text messages, to do Bing searches, and “open” to launch apps, but I’ve yet to find other voice commands. One noteworthy absence is the ability to control the media player, which is a pretty big downside compared to iPhone.

Other interesting notes.
  • No visual voicemail yet, but apparently that’s a carrier issue instead of a software issue, and “Coming Soon” once AT&T turns it on for us.
  • Task switching available by holding “Back” capacitive button. None of my third-party apps support running in the background yet. It appears that the “Windows” button leaves a capable app running, while tapping “Back” from a main screen will actually exit an app outright. Still waiting for the Glympse app to support background execution.
  • Cut and paste is there. I still don’t care.
  • Apparently businesses can now make “private” apps that you can access through links but don’t show up in app store searches. Useful for Microsoft internal apps at least.
  • Set Facebook status updates and check-ins direct from contacts screen.
  • Still no separate volume per audio output. Grrr.

Saturday, August 27, 2011

Comcast Free, all hail Frontier!

It was a painful victory when we first rid ourselves of Comcast Internet – while we welcomed the impressive new FTTP connection, it was hollow in that we had to continue to pay Comcast excessive rates for unreliable budget-grade TV service. But finally, we said a very unemotional goodbye to Comcast, and welcomed our new FiOS TV service.

It took some time to finally be rid of them. First, the lack of a “franchise agreement” (essentially a state-enforced TV monopoly) with the county blocked us from getting service. Once we were annexed into Kirkland, that was no longer an issue. But then, Frontier insisted that we get service from their close partner, DirecTV. To be fair, I’ve heard nothing but good things about DirecTV, but large trees to the South of our home makes that a non-starter. Finally, in a victory for the Internet generation, I was able to reach a district manager through Twitter, who talked to the right people and got us scheduled for hook-up right away.

First impressions are incredible. Just a few of the improvements compared to Comcast:

  • Reliable signal. We’ve yet to see a single pixel out of place since we turned on the service. With Comcast, we’d lose half our channels for hours at a time almost every day. Their techs were never able to really correct the issue, plus the fact that they try to charge you service fees for the privilege.
  • High quality signal. The HD is HD, and even the SD (what little of it we use now, given our “extreme” package) is crystal clear. The Comcast SD channels - which, on our overpriced basic plan meant most of them – were brutally over-compressed. My TV isn’t that big – I shouldn’t have to tolerate compression artifacts.
  • Great DVR. Despite almost identical hardware, FiOS has great software on their devices, compared to the buggy crap software Comcast pushed on us. No longer am I playing the “rewind an hour because the DVR lost our place” game.
  • No jerking around on price. A fair fixed price for years at a time. None of this “introductory rate” scam, where the price skyrockets after a few months. While many people have observed that you can threaten to leave Comcast to get back on promo rates, I much prefer just paying a fair price consistently without any games.

Now, we have a wonderful bundle. Reliable 25/25 Mbps unlimited internet (yes, symmetric broadband and no data cap, I can feel the jealousy radiating from Canada already). Combined with the “Extreme” HD package – including a 24/7 HD NHL channel, a few movie channels, and more HD specialty channels than I know what to do with. All for less money than we ever paid Comcast.

Admittedly, I’m not much of a TV watcher anyways – Netflix covers most of my needs. But if I’m going to pay for TV, I expect to get the best, and Frontier really delivers.

Wednesday, August 17, 2011

Spiral Knights

I fought Nomae so hard on it. No way was I playing some new online game, especially an MMORPG. But it was free, and I was bored enough to try it.

Spiral Knights is four-player Zelda. Imagine all the fun you had in A Link to the Past, but with friend! Sure, it’s the future, and there’s no Princesses, but you’re still running around with a sword, shield, bow gun, and bombs, hacking up the local monsters for fun and profit.

The freemium concept of SK is clever – you buy ‘energy’, which you use to play levels and for crafting. You naturally regenerate up to 100 energy a day, meaning you can play up to 10 levels without paying anything.

However, they are rather devious in how they latch onto your wallet. The first of three tiers of levels can be completed with gear purchased from vendors. Access to the second tier requires gear that can be crafted for less than the 100 energy you gain naturally a day. But the crafting energy costs shoot up dramatically, with the next gear upgrades requiring 200 energy each (and rising exponentially from there). Since you can only acquire 100 energy naturally, this mandates buying energy, right around the point where you’ve played enough to really build a taste for the game.

This additional energy can only enter the system through real money purchases, meaning you either have to pay real money yourself, or grind enough of the in-game currency to buy it from other players at market rates. Ultimately, you’re left with the choice of paying real money to progress as fast as your natural pace, or refusing to sink real money and being forced to alternate between skipping days of play and grinding money to build up the energy to craft to gear requirements.

So far, I’ve kept the purse-string closed. I’d have quit by now, but admittedly the multiplayer aspect drew me back in, and I’m still having fun.

Humble Indie Bundle

Recently picked up the Humble Indie Bundle #3. An interesting concept – five indie games, DRM-free, and you can pay as much or as little as you like, distributing your payment as you like between the five developers and two charities. Plus a bunch of free games – the entire Humble Indie Bundle 2 plus two “bonus” games.

I’m all for indie games, rejecting DRM, and even charities, but I’m not convinced that the bundle was a good idea. On one hand, some of the games have such critical acclaim that they never needed a bundle to bring them any more publicity (ie. Braid). While on the other hand, some of the games are worse than your average school Flash project.

Highlights:

  • Cogs. It’s slider puzzles.That’s it. But with so many interesting puzzle mechanics integrated (pipes and gears to name a few), that it can keep you going for hours. A professional-grade engine keeps the game polished.
  • Crayon Physics Deluxe. An enhancement to the iPhone classic – solve simple 2D physics puzzles by drawing any machines you want. So simple, yet so many possibilities.
  • Atom Zombie Smasher. One of the “bonus games”. The main gameplay is almost insultingly low-tech – rescuing 'people (yellow pixels) from zombies (purple pixels) in a top-down city view (rectangles). It’s not even all that well balanced. Yet it’s scarily addictive, and I’ve lost many nights to it already.

Lowlights:

  • VVVVVV. Side-scrollers may be retro, but when your graphics makes the XNA example code look like high-tech, you’ve better have the world’s best gameplay to make up for it. This game does not. After about 5 seconds, you get bored of the single novel gameplay mechanic, about 10 seconds later the insane difficulty has you uninstalling.
  • Hammerflight. Way to take a really interesting 2D air combat gameplay mechanic, and wreck it by forcing a ridiculously bad story on you. Then repeating it every time you die (which is a lot).

Also, I find a bit of irony in the fact that I’m playing the HIB games, DRM-free, through Steam.