Windows Update Finally Working

When I got my iPhone 6 months ago, I had to upgrade vile and hated iTunes to activate it. After the iTunes upgrade, it wanted me to restart the computer. When the system booted back up (and on every subsequent reboot), there was a crash in userinit.exe. Unable to find any trace of a surgical solution on the web, I resorted to the blunt solution: reinstall Windows (in place).

After reinstalling, the userinit.exe crash went away, but then a new problem surfaced that has plagued me constantly until today: Windows Update fails on all updates. Back when the problem first occurred, I could find no solution that mentioned the particular problem, which surfaced as error 80246002 or “AUClnt FATAL: Error: 0×80004002. wuauclt handler: failed to spawn COM server” in C:\WINDOWS\WindowsUpdate.log. At long last, thanks to this page, I found the solution, KB943144, posted October 26, 2007. The short answer:

net stop wuauserv
regsvr32 %windir%\system32\wups2.dll
net start wuauserv

myFairTunes

I’m very excited to find that it’s not difficult at all to remove iTunes DRM from songs purchased from the iTunes Music Store. myFairTunes will convert all your purchased music from M4P to M4A in place, add it back to your iTunes library, and optionally back up the M4P files to another folder and remove them from iTunes. Since my primary music computer has trouble syncing my iPhone, it’s very helpful to be able to move the music to another computer that doesn’t have as much sync trouble.

myFairTunes7 on Project Hymn

C++ Functors

People have asked me several times what I think of “functors” in C++, so I decided to form an opinion (and write it down somewhere that myself and others can refer to). I’ve also always meant to include more technical content in this blog…

My reference material on the subject was an article Chuck provided, Callbacks in C++ Using Template Functors. I felt that while it’s true that all of the functor alternatives shown in the article are obviously undesirable according to the criteria listed (and perhaps other more basic criteria, such as code readability), it doesn’t really seem to show an example of the interface-oriented (i.e. pure virtual class) model, which I believe is the purest way to solve the problem. (By pure, I mean satisfying criteria such as being object-oriented, type-safe, and non-coupled, yet not relying on void* casts and template wizardry.) Here is the example that I feel was omitted:

class Notifiable
{
public:
    virtual void notify() = 0;
}

class Button
{
public:
    void click() { if (m_pnOnClick) m_pnOnClick->notify(); }
    void onClick(Notifiable* pn) { m_pnOnClick = pn; }
private:
    Notifiable* m_pnOnClick;
}

class CDPlayer
{
public:
    void play();
    void stop();
}

class CDPlayNotifiable : public Notifiable
{
public:
    CDPlayNotifiable(CDPlayer* cdp) : m_cdp(cdp) { }
    virtual void notify() { m_cdp->play(); }
private:
    CDPlayer* m_cdp;
}

class CDStopNotifiable : public Notifiable
{
public:
    CDStopNotifiable(CDPlayer* cdp) : m_cdp(cdp) { }
    virtual void notify() { m_cdp->stop(); }
private:
    CDPlayer* m_cdp;
}

void main()
{
    CDPlayer cdp;
    CDPlayNotifiable pn(&cdp);
    CDStopNotifiable sn(&cdp);
    Button playButton;
    playButton.onClick(&pn);
    Button stopButton;
    stopButton.onClick(&sn);
    // ...
}

I believe this satisfies all but one of the “Criteria for a Good Callback Mechanism” mentioned in the article: object-oriented, type-safe, non-coupling, non-type-intrusive, and flexible. The remaining criterion, being “generic”, is of questionable validity. Obviously it’s desirable not to require the user to write repetitive support code, but I think there’s some value to explicitly defining interfaces and being able to write custom binding code. Consider, for instance, how most UI frameworks include an argument on their events that identifies the sending object. If the functor of the Button class in the article included this argument, you could no longer directly bind it directly to CDPlayer::play().

However, the code above sucks in C++ for two reasons: 1) There’s no shorthand way to provide implementations of Notifiable. (Anonymous classes in Java are great for this.) 2) Managing the lifetime of the Notifiable objects is difficult. (Again, with GC in Java, this is not an issue.) In my example, I used pointers, which necessitates ensuring that the Notifiable objects exist at least as long as the Buttons referencing them. In the functor article, this is accomplished by the functors being held by value. This makes sense for functors, which are known to be small and non-polymorphic and to implement a default constructor and operator=(). Objects implementing Notifiable may or may not be small, but more importantly, they are polymorphic and therefore cannot be held by value.

Given these difficulties, functors do seem to be a reasonable mechanism for handling callbacks in C++. I’m curious whether the memcpy() on the pointer-to-member-function in FunctorBase is kosher with regard to the C++ standard, but even if it’s not, it’s the sort of thing that always tends to work anyway.

BTW, in Java, the above code directly translates to this, which seems pretty much ideal to me:

interface Notifiable
{
    void notify();
}

class Button
{
    public void click() { if (m_onClick != null) m_onClick.notify(); }
    public void onClick(Notifiable n) { m_onClick = n; }

    private Notifiable m_onClick;
}

class CDPlayer
{
    public void play();
    public void stop();
}

void main()
{
    final CDPlayer cdp = new CDPlayer();
    Button playButton = new Button();
    playButton.onClick(new Notifiable() { public void notify() { cdp.play(); } });
    Button stopButton = new Button();
    stopButton.onClick(new Notifiable() { public void notify() { cdp.stop(); } });
    // ...
}

Jove in EE Times

EE Times printed an article today about Jove. It has several quotes from me, gathered from our 45 minute interview, though as you might expect, they really zeroed in on the few somewhat inflammatory ones:

“It really didn’t seem like Vera was justified as a separate language,” Robinson said. “It had no tools and no libraries, it had a lot of bugs, and it ran pretty slow.” Another issue was limited reporting capabilities for functional coverage. “What took us a couple of weeks in Vera took a day in Java,” Robinson said.

Oh well, I guess that is how I feel about Vera.

Europeans Of The Year

Unless you’re totally xenophobic, you should consider voting for the Europeans of the Year, organized by the European Voice magazine, which “casts a spotlight on 50 individuals who have most influenced the European legislative and political agenda during the preceding year”. (They have to be European, but you don’t.)

I took interest in this poll because one of the nominees, Florian Müller, is the founder of NoSoftwarePatents.com, which is a cause very important to me. In addition to recognizing his efforts, a win for Müller would also do much to promote the cause. Because the poll requires voting in all 10 different areas, I found the NoSoftwarePatents.com voting guide helpful.

Jove Released!

Yesterday saw the culmination of several years of hard work (and corporate arm twisting): Jove was finally released on SourceForge. This was the official announcement:

Newisys is pleased to announce the release of Jove: The Open Verification Environment for the Java (TM) Platform. Jove is a set of Java APIs and tools to enable Verilog hardware design verification of ASICs and FPGAs using the Java programming language. It contains components that accomplish the following:

  • Verilog simulator interaction (via PLI 2.0 aka VPI)
  • Standalone behavioral simulation (i.e. a discrete event simulator)
  • Thread and event synchronization
  • Design Verification abstractions (e.g. clock-relative signal access, mailboxes, semaphores)
  • Constraint-based randomization
  • Dynamic Verilog shell generation

Jove has been tested extensively with Synopsys VCS and to a lesser extent with the GPL version of cver by Pragmatic C Software.

Information regarding the state of the project as well as the motivations behind it is available in the FAQ.

Binary and source code distributions are available at http://jove.sf.net/.

Jove is licensed under the Open Software License 2.0.

Java is a registered trademark of Sun Microsystems, Inc. in the U.S. or other countries.

Jove

I Hate Automake

Sometimes people wonder whether my blog is purely political and recreational, since I don’t often engage in technical matters with the same zeal as those other issues. Well, to these people, I proudly say: Fuck Automake! Fuck it, fuck the horse it rode in on, and fuck its little dog Libtool too! I’m not first to reach this conclusion either, in exactly those terms no less! Oh, and the same goes for putrid little Autoconf as well. Technical enough?

The whole steaming Automake/Autoconf/Libtool pile of GNU is anathema to end user-friendly binary compatibility and portable software in general. It’s a mess, a kludge, a hack. It gives the illusion of convenience and portability for small open-source projects, but all the while it’s sucking you deeper into maintenance and support hell. Want to write powerful, robust system level code? Not without a ton of impossible to maintain #ifdef’s you won’t. Curious what your system library dependencies are? Good luck! Want to be able to recreate a particular build to reproduce a bug? Hope you can find the machine it was built on!

In case you’re curious about how this highly elegant system works, here’s the most simplistic diagram possible:

Automake Diagram

So, in conclusion, I think Automake is great… for me to poop on!

Java ClassLoaders

I just read an interesting article about Java ClassLoaders: Find a way out of the ClassLoader maze. It’s a couple of years old, but still completely relevant. If you’ve ever had to reference a ClassLoader, you’ll want to read it.

Consumating

Aubi and I stumbled across an amusing quasi-personals site called Consumating. It started as a dating site spoof, but seems to have taken off. The tagline, “Hot nerdy girls and indie rock boys! With glasses!”, was enough to grab my attention. The unique thing about the site is that it uses tags and random “Question of the Week” contests to allow people to describe themselves rather than boring old singles profiles. Also, don’t ask me how, but the photos seem uniformly bigger and more attractive than other such sites.

From a technical/business standpoint, I found two things interesting about the site:

  • The use of the Ajax approach to design the site. Basically, it uses techniques similar to Google Maps and Flickr to enrich the end-user experience and improve responsiveness.
  • The Question of the Week pages, which allow users to vote on the cheekiest answer to each of the oddball questions, feature Google AdSense ads. I imagine this is a great source of targetted ad revenue. For example, the ‘What’s your plot twist in, “George W. Bush: The Movie?”’ question features various ads for (anti-)Bush merchandise. Lots of specific ads + lots of impressions -> lots of ad clicks -> lots of $$$. All for the cost of posting a stupid question.

GemStone Facets

I just read a really interesting whitepaper about an object database for Java called GemStone Facets. It’s basically like virtual memory for persistent Java objects; objects are faulted into local memory from a shared transactional cache. The downside is that it requires a custom JVM, currently based on the Sun JDK 1.4.2 codebase. Supposedly, they’ve released a free Linux version, but the license does not appear to be easily accessible. (The download is a 111MB install script.) Still, it’s an interesting idea.