Event Handlers only firing once in Microsoft Office AddIns

I've just been working on a project where we were to create some AddIns for several versions of Microsoft Office. Now I knew there was a lot of bad blood around Office AddIns but thought they were being overblown as I finished off the 2010 AddIn without so much as a hiccup. The 2007 and 2003 AddIns however showed why Office has the reputation it has.

The problem I ran into was that I had to have several event handlers to catch two events. The opening of a new inspector and a simple button click. So I did what you'd expect to do and registered them in the startup methods.

Initial testing went fine as I started up Outlook and triggered one event, made some changes, restarted it and then tested the other event. It took a while until I tried to test both events following one another at which point I found only one would trigger and then both would even handler hooks would be forgotten and wouldn't rehook in until a restart of the application.

public partial class ThisAddIn
{
    private void ThisAddIn_Startup(object sender, System.EventArgs e)
    {
        Outlook.Explorer explorer = this.Application.ActiveExplorer();
        Outlook.Application app = (Outlook.Application)explorer.Application;

        app.NewInspector += new InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);
    }
}

After much searching I began to come across implications that the garbage collector was removing the references after the first event. I was at a loss at what to do until I came across another discussion where someone was having a similar problem and the response was to save the object in a class level variable to avoid the garbage collector from removing it.

A quick edit and some testing showed this to work reliably. So, if Office is only triggering an event once make sure there object references are stored somewhere the garbage collector won't go. And make sure to assign the object before you register the handler or the garbage collector will still find it.


public partial class ThisAddIn
{
    public Inspectors _appInspectors;

    private void ThisAddIn_Startup(object sender, System.EventArgs e)
    {
        Outlook.Explorer explorer = this.Application.ActiveExplorer();
        Outlook.Application app = (Outlook.Application)explorer.Application;

        _appInspectors = app.Inspectors;
        _appInspectors.NewInspector += new InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);
    }
}

Starcraft II Patch Download Problem

Since getting Starcraft II I have bashed my head against the uselessness of the Blizzard Downloader. As is common knowledge that Blizzard uses the bittorrent protocol to transfer its patches and you might thin that it's pretty damn penny pinching of them to do it instead of just doing direct downloads. Unfortunately their bittorrent sucks from my repeated experience.

On both the 1.0.1 and 1.0.2 patches the downloader stopped part way through the download reporting the error "There were multiple problems saving data." As you can tell it offered up no useful help. A quick Google also turned up very little other than the basic and generic Blizzard Downloader FAQ page. After trying all of the suggestions I had got nowhere except swearing at Blizzard for not putting out a direct download patch.

To keep this short a few days later I tried downloading the patch files into the Updates folder using utorrent instead of the Blizzard downloader and five minutes later all the files had been downloaded. The Updates folder is located in the Starcraft II install folder and is only there when there's a patch needing to be downloaded. Starting up Starcraft II again it detected all the files were present and happily patched itself up.

So if you're having trouble downloading the Starcraft II patches wait a couple of days and try using a different bittorrent client to download the files. You'll find the bittorrent files near the Updates folder in the Starcraft II install folder.

Playing with Regex on OSX

RegExhibit

If you've ever been stuck with the problem of trying to build anything but a simple regular expression you know how painful it can be getting it to match just what you want.

When developing for .NET on Windows I was introduced to a brilliant free tool called Rad Software Regex Designer that gave you the ability to provide an example of the text you wanted to match and an area to slowly build up your regular expression while getting instant feedback on what it was doing. It even has dialogs to add specific regular expression commands in case your proficiency with regular expressions isn't high or you just forgot how to create a non matching group. After moving to OSX for work I went looking for a similar tool for the Mac. And after a while I found it.

RegExhibit is a GUI tool of OSX that uses the Perl regular expression library to help you build regular expressions. This should be fine for any other languages that use a PCRE library but make sure you check before deploying. The core part of the program are two text areas. you place an example of the text you want to match into the lower area and build up your regular expression in the top are. There are even tabs for doing matches and splits but you'll likely find yourself in the match tab for most of time. However it doesn't offer the same built in dialogs like the Rad Software Regex Designer so make sure you've got a regular expression reference handy.

This is a great tool that has saved my sanity several times already and I do recommend to anyone that has to play with regular expressions and is developing on the Mac.

Should we remember all of those that have fought for our freedoms?

Well today was ANZAC day in New Zealand and Australia and if you don't know it's our remembrance/veterans day.

One of the things that's always brought up as a reason for paying respects to the servicemen and women is for their actions in giving us our current freedoms. Now I've always had a small issue with this as this does not recognize everyone who has put effort in to gain and maintain the freedoms and rights we have and to improve our country. Things like universal suffrage, healthcare, the welfare state, representative democracy, police and government oversight, the freedom to disagree with those in power without fearing retribution. All of these things are just as important to improving our country as well as the military is in showing other powers in the world that we can and will put our money where our mouth is.

I'm not trying to trivialize the efforts of the men and women in uniform. I'm just trying to expand on the belief we pay our respects to those who have given their blood, sweat, tears, and lives to improve our lives.

So, do you think we should start to make efforts to recognize these other groups who have fought just as hard to improve the countries we live in at the same time we recognize and pay our respects to those who have fought with bullets and bombs?

You Can Die in the Tutorial

Well I've now finished the Military career mission arc. Pretty solid introduction to PvE'ing touching on resists, aiming, firing, moving, etc. It finishes up with a mission that you will be destroyed in unless you were paying attention. It's nice to know some of the true nature of EVE makes it into the tutorial stuff. Also got a new frigate gifted as part of one of the missions. I am now flying a Tristan. Depending on what happens in the near future I may ditch it and get myself a Catalyst.

Now I'm off to a Sisters of Eve agent for what I believe is the start of the beginner epic arc. Never done an Epic arc so this should be quite interesting.

EVE Has a Tutorial?

Well here I am in the tutorial every new player gets dropped into.

This is already a vast improvement over the tutorial I got when I started. You get dropped into what I understand is a deadspace complex with a few asteroids and a single rat which orbits around. This is good because it gets people right into the game without being shocked by the menus and everything else you get when docked in a station. This part of the tutorial takes you through the core movement and combat skills. After that's done it gets you to dock up at the only station in system. This is interesting as they get you to use the dock order which warps you to zero automatically instead of getting you to warp to zero first and then dock. I can understand using just the dock as it leaves the explicit warp-to instruction till later. As a 0.0 veteran I'm more used to warping to zero before doing any action so the straight up dock seems a bit odd.

Another interesting addition to the tutorial is this big white box that floats around when the tutorial wants you to do something with the UI. I think this is awesome as it gives new players this big "LOOK HERE" thing to speed up their initial learning instead of the hunting for the 10px x 10px that might have been flashing back when I started. Another really nice feature of this is that if you have a window over the button or item then the overlapping window will become transparent so you can see the button or item the big white box is pointing to.

The way the tutorial only spawns items as you need them for a specific step in the tutorial is nice. Instead of flooding the new user with a million items you start off with nothing but a Civilian Damage Control and the first ship you destroy has the classic 1 piece of Trit waiting for you as loot.

The tutorial also links to EVElopedia pages on subjects that the space and time of the tut doesn't really allow.

The explicit tutorial steps for joining a player corp are great compared to when I started. Mainly because the tutorial now covers them.

The career missions are an interesting addition. I went and bought a combat frig before finding out that the next mission gave you one as a reward. So I'm going to follow the mission arc until finished so I don't jump ahead and waste any more ISK. Especially as I'm not going to help myself to my main's stash.

Well that was an interesting evening. Will continue to work at this and see what happens.

The Experienced EVE Noob

It's been awhile since I last played EVE so I've been looking back and trying to figure out why. Was it burnout or just boredom or something else? The conclusion I came to was a combination of burnout of trying to keep up with all the 0.0 and corpie happenings and just getting a bit bored of the ISK grind but I still love the idea and most of the execution of the game.

So the other day an idea popped into my head. Start from scratch.

Now like almost all long time EVE players I have one alt to go along with my main. But that alt was pretty much speed trained right into a role that I wanted at the time. She never had to mission, grind or anything because of her sugar daddy main. But it has been so long since I was that noob we all were sitting in that Moa fitted with missiles and small hybrids that I though it would be interesting to do it all over again but with the advantage of knowing what I'm doing.

Of course I'm making it harder for myself to keep it interesting. I'll be moving into deep lowsec and try to live there. The stomping grounds of loners and pirates. It should be interesting. I plan to post the occaisional update on what it's like to be an EVE noob through the eyes of an experienced player.

Adding Attachments with ActionMailer

Well recently I had the fun task of using Ruby on Rails' ActionMailer to create some automated emails to send out to users. At some point it was decided to attach the original email we received from the user to the notification email we were sending out to the user.

Now you would think that using the attachments method provided by ActionMailer would make it a easy as just giving it the file you wanted to add. Turns out it's like that for Ruby on Rails 3, not for 2.

The most infuriating thing was that if you use the attachments method then the method you called attachments from will not render the default view template it would normally. This means you have to explicitly call the render method.

Instead of putting it out all nicely I'll just link to a blog post from ELCtech.com that explains it well. http://www.elctech.com/ -- [ActionMailer] Multipart emails with attachments

A New Point Release on Life

Well after over 23 years living under the roof provided by my parents I have moved out into a flat. It's been an interesting experience so far and I'm flatting with good people so I haven't been stressing out too much. I've also been hired by the company that I was interning for over the summer so I am now a fully paid up member of society. ;)

 

And I finally got an ISP sorted out so I'm back on the internet after a weeklong non-work use vacation.

DC++ "Could Not Open Target File" Error

I was at a LAN the other week and to make sharing files easier we use a program called DC++. Shortly after trying to download the first few files I got a confusing error. "could not open target file: the system cannot find the path specified" After spending much time looking around the web and asking friends at the LAN we finally figured out what it meant.

In the Settings window and under the Downloads section you designate two directories, one is a default download directory and the other is an unfinished donloads directory. I had these two options set to directories that did not exist, a quick change however did not quite work as while the folders exist they were under an account the active account could not access, a final change pointed these options to two directories that existed and the account could acces. This fixed the problem right up.

So here's a little picture to show the two offending text boxes. Set these to folders your account can access, folders on your desktop for example, and that error should disappear.

My Borderlands Troubles

Being a Good Consumer

Last week I purchased the Borderlands DLC, Zombie Island of Dr Ned, for my PC Retail version of Borderlands. After purchasing it I was informed I would also have to install the 1.1 update so that was downloaded as well.

We've Got a Problem

My first attempt to update Borderlands resulted in a catch-all error dialog informing me that the update had failed. After looking on the Gearbox forums I got pointed at running the update from the command prompt using the "msiexec" program. http://gbxforums.gearboxsoftware.com/showthread.php?t=87233 - (FIX) Fatal Error:Installation ended prematurely because of an error. This resulted in the patch doing the same "Gathering information about your computer" routine as the original patch attempt and silently exiting without doing anything. A quick check on the "msiexec" program's help dialog showed a logging flag which I set and posted the output of that and the dxdiag output on the Gearbox forums. http://gbxforums.gearboxsoftware.com/showthread.php?p=1721935 - Unable to Install Patch or Zombie DLC - Windows 7 - Error 1603

You Didn't. Did You?

This is when things got interesting. Soon after I read a new post of someone having a similar problem as me and posted a suggestion to run the "msiexec" program with the logging flag set. A reply post by another member to mine said that would be pointless as "we know where the patch is try to write to" This gave me an idea which prompted me to look through the "msiexec" log to try and answer. A quick search for the drive that I installed Borderlands to (E:) found nothing. A search for the 32 and 64 bit Program Files directories on the C drive found both. Now my question was a pretty simple one, did the patch and DLC require that the game be installed in the Program Files directory on the C drive? A question in the FIX thread brought no answer after several days so I decided to give it a go and reinstalled Borderlands to my "C:\Program Files(x86)\" folder.

You Did

And guess what, the patch and DLC installed without a hitch.

For a game developer to not allow the patch to be installed to wherever the program has been installed is just unacceptable when every other game I have patched has never required it.

Ancient Medical Technique Now Supported by Science

One of the common refrains I hear often from Alternative Medicine proponents is that mainstream medicine ignores them because of some conspiracy. The Science Based Medicine blog has an excellent post on another traditional symptom treatment that works and is supported by scientific evidence.

ScienceBasedMedicine --- Neti pots – Ancient Ayurvedic Treatment Validated by Scientific Evidence

CCP CAPSLOCK AND THE PATCH NOTES

Well CCP have released the patch notes for the upcoming Dominion expansion and as usual I've taken a look at them for the interesting, useful and sometimes just funny notes. So without futher ado, here's my review of the patch notes for the Dominion expansion of EVE Online.

 

  • It is now possible to enable warning sounds for when your shield/armor/hull drop below a certain threshold.
  • Damage notification plays a warning sound whenever your shield / hull / armor drops below a certain threshold.
  • Threshold for damage notification is customizable from the HUD settings.

I hadn't heard anything about this in the past so it came as a bit of a surprise. This could be quite useful during battle, especially when entering structure or low armor. Will be giving it a try.

 

  • The jukebox now uses MP3 format for its music. Additionally, custom playlists may be specified.

Does this mean that all the ingame musiv will be available to pull out and play seperately? I hope so as I quite enjoy the EVE music while programming or doing something else that requires a bit of serious concentration.

 

  • A new "Loot Logging" optional mode has been added for fleets. This works for taking from cans and wrecks as well as for salvaging and mining. Everyone in the fleet will be notified of all these events. You can then export the logs as a text file.

This could prove interesting, especially in the larger fights where it isn't really possible to keep track of things.

 

  • You will now autojoin your fleet again if you connect within 2 minutes of being disconnected. You will not enter your old position within the fleet however.

Now if this applies to intentionally quitting and relogging during a super laggy battle then this will be very useful.

 

  • You can now report players as 'ISK Spammer' from the right click menu of a character in chat. This will remove all their messages from that channel and report it to the GM's

Well that will make the buyers and sellers in the trade hubs happier and should help CCP by making it easier. I'm also sure CCP will be cracking down on anyone who abuses this feature so only use it where appropriate.

 

  • Hacking has the following prerequisites: Science level 3(down from level 5), Electronics Upgrades level 3(down from level 5), Electronics level 1 (down from level 2), Engineering level 1 (down from level 2)
  • Archaeology has the following prerequisites: Science level 3(down from level 5), Survey level 3 (down from level 5), Electronics level 1
  • Salvaging has the following prerequisites: Mechanic level 3, Survey at level 3 and Engineering at level 1
  • Cloaking has the following prerequisites Electronics level 4 ( was 5)

Well as someone who has gone through all the time to train up these skills I'm a bit unhappy. But it should open up the little mini professions to more people which could be useful, especially for the newer players.

 

  • Trial accounts can no longer request missions from agents of level 3 and above.

I'll admit I didn't know this was a problem but I guess if you have a character running level 4's or 5's and get the trial account to fleet up, you could get their standings high enough and fast enough to make it profitable for the macroers.

 

  • You can now right click on a courier package and select "Deliver Courier Package" instead of having to find the contract.

That'll make the logistic monkeys happy. And happy logistic monkeys make happy PvP mokeys.

 

  • You can now add corp/alliances as buddies.

I'm interested to see how this will work.

I'm guessing that it will work by adding that corp or alliance to your buddy list as a single entry that you can use to quickly access their info window. This would mean that you couldn't just add all the memebers of a corp or alliance during a war to know exactly how many and who is online in the other corp or alliance.


  • A trial account does not start until the person logs into EVE for the first time, not when the trial is created or activated.

That's a nice little thing that will give trial members more time to get an idea of what EVE is.

 

  • Player owned wrecks can now be marked as "available for all", which allows everybody to take from them without causing aggression.

Well the only case I can see this being useful in is when flying with an alt or allies but generally you wouldn't be shooting them anyway, even if they do have aggro. So odd but nothing harmful.

 

  • Drones would sometimes refuse to attack certain structures; they've been given a stern talking-to and will now obey orders with more diligence.
  • Fighter drones will respond faster to return commands, instead of idling around the space coffee machine.

Is it required for drone fixes regarding their following of orders to be in every patch notes? At least they're funny though I still expect drones to randomly attack fleet members and split up without warning. ;)

 

  • The UI is now flatter and squarer.

Ahh CCP. What would we do without this short, descriptive and utterly useless patch note. I'm guessing it's a little easter egg for those of us crazy enough to read the entire patch notes.

 

  • You can no longer create more than 5 tabs when importing an overview XML file.

It was annouced a while ago but as a corp that uses the extra tabs it will mean a rejigging of the corp standard tab layout.

 

  • The items filter is no longer ignoring things with only capital letters for a name. CCP CAPSLOCK approves.

Never seen CCP CAPSLOCK but I approve of his name.

 

So that's it for the notes I found interesting. It was interesting to see that even with all the dev blogs about all the changes there were a few new ones that I hadn't seen mentioned. If you want to read the entire patch notes yourself then take a look over here.

 

All in all I think Dominion is shaping up to be a very interesting expansion. Especially as I'm a 0.0 person. Bring on the pewpew!

Thoughts on FLOSS Weekly Episode 91: Boycott Novell

Last week I listened to the most recent episode of the TWiT podcast, FLOSS Weekly and their guest was the current person behind the Boycott Novell group Roy Schestowitz. Now beyond the name I have no real idea what the purpose of the site is and during the interview, Roy's responses made it seem like it was just "Microsoft is evil." with plenty of talk about him being personally insulted and slandered. At no point did he come out and say, "This is what our issues are: A, B, C. And this is what we want to happen: A, B, C."

Jono's focus on the issue of spammers being something that Roy should be dealing with all the time confused me and detracted from the interview. Really all Roy should have to do is have a disclaimer page and when he finds out a community is being infested by one of these spammers then he can contact those that run it and ask them to publicise the disclaimer that these people are not to be listened to. However it seems that

I spent the next couple of days browsing the site and sitting in the chat room. Within a couple of hours of loggin in Jono appears to this welcome.

twitter Hi, jono.
twitter I saw where you called me a spammer.  
twitter Fuck you.

http://boycottnovell.com/wp-content/uploads/2009/10/irc-log-19102009.html

When Roy came on an hour and a half later there was no rebuke but instead complaints about people pretending to be him and general apologistic I can't control what other people do stuff. He should have kicked him and told him off, even better would be an apology but not required.

So from someone who started off as pretty apathatic to the BoycottNovell idea I've moved to they're a bunch of muppets point of view due to their actions as a community.

 

Earthquakes

Well that was cool. I'm sitting at my computer looking at some stuff and feel this tiny ground tremor. I thought it was a small earthquake until three secs later when we got a good jolt. Always fun, earthquakes. Especially the thought of "THE GROUND SHOULD NOT DO THAT!" turns out it was a 4.8 only about 20km NW of us.

 

http://www.geonet.org.nz/earthquake/quakes/3165869g-shaking.html

So that's what happend to the Macroers

Another DevBlog from CCP came out today and it answers one of the biggest questions I've been hearing recently. What happend to the macroers? A little back story for those that don't know. A couple of months ago the systems that were infested with macroers suddenly emptied and no atter the number of threads and questions aimed at CCP no answer was forthcoming. Which lead to much guessing. Eventually the consensus seemed to land on they were banned. Now we know for sure. On June 22nd during DT CCP banned 6200 accounts of RMT's and their macroers. There are some interesting graphs in the DevBlog covering both an example system Ingunn and the server load.

It's nice to see that CCP is willing to take on this issue even when it means they're going to be seeing less income.

I Can Has Flu Vaccine?

Well today I let myself be fooled by big pharma and government and got the Flu vaccine for this year. It's the first time I've got a Flu vaccine and to be honest it was less work than even doing a blood donation. The needle was smaller that's for certain.

Now I know that it isn't going to protect me from Swine Flu which to be honest no one was expecting so how could they have made a vaccine for it. But it will protect me from the expected three major flu strains expected for this year. Also the NZ government had made this year's Flu vaccine free to everyone as opposed to the at risk groups.