Tuesday, March 20, 2007

How to Undisable the Use of USB Storage Devices

In a managed desktop environment, if a USB device fails to install because XP can't locate the drivers, chances are that The Man has messed with the permissions on USBStor.inf and/or USBStor.pnf

Just reverse whatever has been done from this article (requires admin privileges of course):

How to Disable the Use of USB Storage Devices.
http://support.microsoft.com/kb/823732

Wednesday, March 14, 2007

.Net CLR Performance Counters Don't Appear in Perfmon

This took a while to figure out . . . I needed to use the .Net Memory counters to watch the heap sizes and garbage collections. Unfortunately, none of them appeared in Perfmon under Performance Objects.

I looked up the old standby on "How to Manually Rebuild Performance Counter Library Values"

I wasn't quite willing to do all of the registry pecking and ripping needed to do that rebuild but I checked out the keys mentioned and tried running LODCTR \R on the .Net CLR ini file. That reported that they were already installed. :-

So I checked in on the registry entries under Services . . . HKLM\SYSTEM\CurrentControlSet\Services\.NETFramework\Performance

Imagine my surprise when I saw this value:

Disable Performance Counters = 1

Setting that to 0 brought the counters back as expected.

I blame big brother for this one, but it turns out that windows will make this setting if a counter fails some tests at load time.
Disable Performance Counters

Although you can set Perflib not to disable on fail:
Perflib Configuration Flags

Sunday, March 04, 2007

COM Interop Problem with Type Library CoClass Names Changing

Message

This was a real pain, and google was no help, so here's a post that hopefully helps someone else. 

(By the way, if you want to have some fun with VB developers who are calling your .Net Assemblies, this is hours of good, wholesome, plausibly deniable bug hunting.)   

Background:  A Visual Basic 6 project has been happily consuming a set of C# Serviced Components for some centuries.  One day, some functionality was added to the C# solution.   Suddenly the VB projects wouldn't compile.  

Basic investigation on the VB side revealed that the names of the components had changed from <BusinessObject> to <CompanyAccronym>_<FunctionalArea>_<BusinessObject>.  Basically, the new name of the object had become the namespace with dots replaced by underscores.  

We had enough experts around that we quickly narrowed it down to a naming conflict.  Ripping all the new functionality out of the solution fixed the problem, so it was obviously a conflict with a newly added object.  Renaming anything that might conflict would be the solution.  

The lingering question was exactly what circumstances cause the problem?   

To that end I've created a very simple repro in VS. 

The bottom line is that you can't have two classes with the same name in the same solution, no matter what you do with the namespaces.  As soon as you add the second (conflicting) class, you hose all of your COM clients who call your first class.  


Here's the Repro:

Create a solution. 
Add a class file:

namespace RobTest.TypeLib
{
 public class conflict
 {
  public conflict()
  {
  }
 }
}

Generate the type lib with Tlbexp:
[
  uuid(44EB15C1-7CE0-39D7-9ADB-B0086CE7F6EB),
  version(1.0),
    custom({0F21F359-AB84-41E8-9A78-36D110E6D2F9}, "RobTest.TypeLib.conflict")
]
coclass conflict {
    [default] interface _conflict;
    interface _Object;
};

Looks OK.

Now add another class in a totally different Namespace

namespace RobTest2.TypeLib2
{
 public class conflict
 {
  public conflict()
  {
  }
 }
}

Regenerate the type lib:
[
  uuid(90EDBC47-D360-3545-9786-15FF36E3AF66),
  version(1.0),
    custom({0F21F359-AB84-41E8-9A78-36D110E6D2F9}, "RobTest.TypeLib.conflict")
]
coclass RobTest_TypeLib_conflict {
    [default] interface _RobTest_TypeLib_conflict;
    interface _Object;
};
[
  uuid(A45FCAAA-AC72-31DA-A6FC-DEC2EDE2489F),
  version(1.0),
    custom({0F21F359-AB84-41E8-9A78-36D110E6D2F9}, "RobTest2.TypeLib2.TypeLibProblem2.conflict")
]
coclass RobTest2_TypeLib2_conflict {
    [default] interface _RobTest2_TypeLib2_conflict;
    interface _Object;
};

Not Good! 

The only solution is to rename the conflicting class:

namespace RobTest2.TypeLib2
{
 public class NoConflict
 {
  public NoConflict()
  {
  }
 }
}

Then everything goes happily back to the way it was.  
[
  uuid(D26D7937-EA9B-30B6-BA98-A36614BF7CCE),
  version(1.0),
    custom({0F21F359-AB84-41E8-9A78-36D110E6D2F9}, "RobTest.TypeLib.conflict")
]
coclass conflict {
    [default] interface _conflict;
    interface _Object;
};
[
  uuid(3E9830B2-B787-3FBF-A493-370273AB224F),
  version(1.0),
    custom({0F21F359-AB84-41E8-9A78-36D110E6D2F9}, "RobTest2.TypeLib2.NoConflict")
]
coclass NoConflict {
    [default] interface _NoConflict;
    interface _Object;
};

Thursday, February 22, 2007

Mail-to-Blogger Post Tip Number 1

Use (hash)end at the end of the post content to keep the email auto-footer from posting.

Testing Post from Email

I've developed a backlog of little tiny posts on technical subjects that I've been intending to keep just as a "note to self". 
 
It should be easier just to post these as they come up via emails to blogger.  I'd forgotten that it had that feature. 

Coromandel Weekend

Another part of my birthday present from Kel was a weekend in the Coromandel!

Cathedral Cove KayakingWe started out kayaking in Hahae, off the east coast of the Coromandel peninsula.


Here's Cathedral Cove, we got lucky with the timing there, it had been closed for days earlier while there was filming going on for the next Narnia movie.

Cathedral Cove

Striped MarlinAfter the kayaking we did some driving and hiking to get to the tip of the peninsula. On our way through Whitianga we saw a boat come in with a 114kg Striped Marlin.



That evening we camped at a Dept. of Conservation (DOC) campground at Stony Bay. Check out the geotags on the Flickr photos to see the locations on a map. It was a long winding way on single lane gravel roads.

Hike from Stony Bay to Fletchers BayThe next morning we hiked across the very tip of the peninsula to Fletchers Bay. The scenery was amazing, I highly recommend that hike.

Hike to Fletchers Bay

Dscf0146On the other side, we hit a beach for a quick swim, then we did some biking along the coast.

Dscf0132

Lastly, we stopped in Coromandel town for dinner (and happened to catch the tail end of the Black Caps beating Australia in Cricket). Fabulous weekend!

File Under: New Zealand,

My First New Zealand Earthquake


We had an earthquake last night. Actually, there were three of them, but the first one hit while we were in the car, and the second after we were asleep.



The one we felt was a 4.5 centered just up the road and off shore in Orewa. Down in Albany, it felt like sitting on a sofa in a moving truck while somebody gives it a big shove. Then there were a few rattles following that.

Here's the article from the Herald:

Earthquakes Shake Auckland Region.

File Under: New Zealand,

Saturday, February 03, 2007

Birthday Bungy Jump

This past weekend was my birthday (Jan 25th).

One of my Christmas presents from Kel this year was that we were going to be staying at the Powderhorn Chateau and hiking the Tongariro Crossing over my birthday weekend.

Taupo BungyWhen I opened my other presents on Thursday morning, one of them was a small printed voucher "good for one Birthday Surprise on the 25th".

I thought a lot about what that might be on the drive down to Taupo. I discovered shortly after Kel took over driving when we pulled into Taupo Bungy parking lot!

Taupo Bungy
They were taking a break for a bit when we pulled up, so I didn't get to see anyone else jumping straight away. Kel also recommended that I not look over the edge until after I'd signed up and weighed in, but after that I grabbed some photos from the platform.

When they started up again, I was second in line. It was nice to have one person ahead of me, so I was able to watch and knew basically what to expect. Though the scream that girl gave when she finally jumped wasn't at all what I wanted to hear at that moment. ;-).

When it was my turn they quickly strapped my lower legs into big cuffs, then attached the end of the bungy onto that harness with a big carabiner. Next they had me shuffle to the edge of the platform. That was probably the hardest part, standing on the very edge with my legs tied together, and feeling the weight of the whole bungy cord pulling on them.

View from the Taupo Bungy Platform

Looking at the drop from there, the water looked beautiful and deep. It would have been a perfect cliff jumping spot. If it were about one third the height (Which is 47 meters b.t.w.) I might have been tempted to jump without the bungy. That made it much easier to go when they counted me down.

My Jump

Taupo Bungy Jump

The drop is about what you'd expect. A rush of freefall, just like a cliff jump. Once you get going, the water comes up incredibly fast. But just before you get there, there's this springy sensation building up behind you. Then next thing you know you're flying up to the platform again. That's the second hardest part! There's a bunch more bouncing and dropping before you're done. Overall a great experience, I'm glad Kel did that for me (and even more glad it was a surprise). ;-)

My recommendation is definitely do the water touch thing, and don't bother wearing a shirt. ;-)

This one isn't me but it's a great shot Kel caught while I was walking back up the hill after my jump:

Bungy Jump


File Under: New Zealand,

Friday, November 24, 2006

Visiting the States



In late October, Kel and I came over to the states for a week and a half. We spent a few days in Minnesota catching up with family and friends.


Claire and Kel



Next we headed over to New York City to meet up with Kel's friend Claire from London. While we were there we caught a Rangers Hockey game at Madison Square Garden and the musical Wicked on Broadway.




We spent the last few days in upstate New York at a surprise birthday party for my friend Jon.
Jeff, Alex, and Jon at the Altamont

It was great to see everyone again, even if only for a few hours each. That's the only bummer about living in New Zealand, we're so damn far from everywhere.

Hopefully we'll be back again for Christmas next year. In the meantime, I'm working on convincing as many people as possible to come down to visit. I'll post some stuff on Rich and Peter's visit next.

Jen and Jon's Neighborhood

Thursday, November 16, 2006

Catching Up

As I was pulling pictures off my cameras the other night, it occurred to me that I'm way behind on personal news on this blog. So here go the headlines:

August
I went to my first Allblacks game! (That's New Zealand's national rugby team for those of you back home). Not only that, but it was NZ vs Australia! (Think Vikings vs Packers). We had fantastic seats and the Allblacks won 34-27.




I wish I'd known that they didn't mind cameras in the stadium, I'd have brought my SLR. Instead, I've got some cameraphone pics.

September
For Kel's birthday, we went to see INXS. The new INXS with the lead singer they picked out in their Reality TV show (J.D. Fortune). Really great show. We were in th e superfan section, everyone in front of us jumped up and started dancing from the very first song. J.D. had some kind of problem with the zipper on his pants, despite some roadie assistance, his fly was open the whole show.

October
Kel and I were in the states for a week or so. We stopped in Minnesota to vist friends and family, then headed on to New York City to meet up with her friend Claire from London. After a couple days there we headed on to upstate New York for my friend Jon's surprise (super early) birthday party. I'll post some stuff on this set of trips once I get all the relevant photos up to Flickr.

November
My friends Peter and Rich have come over to New Zealand to visit. I took a few days off work to hang out with them while they've been here on the North Island. Definitely more on this coming up.

Right, that's all for now, one monkey off my back. Gotta run.

Sunday, November 12, 2006

Synching GMail with Mobile Phones

Cool, I've been looking for something like this for a while. This plugin lets you pull an iCal into Outlook. Then your mobile phone software, (like Nokia PCSuite) should be able to do the rest. I'll post the results (along with lots of catch-up stuff) later.

Incorporate Google Calendar into Outlook.

File Under: Technology,

Sunday, October 29, 2006

Auckland Marathon

I ran the Auckland Marathon yesterday.

It turned out to be a great day for it: overcast, and not too hot. It eventually started raining, but not until just after I finished.

The course is great, no major hills (the harbor bridge isn't as tough as it looks). It's completely flat along the waterfront for the last half. My only complaint is that the outward portion of the out-and-back along the waterfront felt like it would never end. That said, once we hit the turnaround, the trip back seemed to fly.

I'm quite happy with my time, considering my lack of training (again). I'd picked up a 4:30 pace band, but once I started running, I was thinking about pushing as close to 4:00 as I could. That lasted until just after 30k. Just before that, the split button jammed on my watch, so I have no split times for the last 1/4 of the race.

I did notice that I was just a few seconds over 3:00 at 30k. At 7min per k for the next 10k, my 40k split should have been about 4:10, adding 14 min for the last 2.2k would be 4:24. So the lack of training once again shows up in the last few miles. My actual finishing time was 4:28:16.

It was nice having the markers every kilometer, that's providing pace feedback almost twice as often as the mile markers I'm used to.

Physical damage was amazingly low. One tiny blister and legs that won't bend, but I'll probably be walking normally by Wednesday, maybe running again next week!

Here are the raw splits:


1 6:19
2 (5:42)
3 (5:42)11:24
4 5:29
5 (5:36)
6 (5:37)11:13
7 5:12
8 5:32
9 5:46
10 5:31 **Elapsed 56:28**
11 5:50
12 5:32
13 (6:22)
14 (6:22)
15 (6:22)
16 (6:22)
17 (6:21)31:49
18 (5:48)
19 (5:48)
20 (5:48)17:24 **Elapsed 1:57:05**
21 5:40
21 5:49
23 6:37
24 6:07
25 6:06
26 5:52
27 (6:28)
28 (6:27)12:55 **Elapsed 2:46:15**

**Button Stuck on Watch**
**Approximately 7:00 k's from here out**

Finish 4:28:16


Note to self:
Buy new running watch. ;-)

Here are the photos from the official race photographers:

www.marathon-photos.com - 533


and the official results:

www.enteronline.co.nz



No. First Surname Grade Group Overall Net Time
533 Robert ENGBERG M0134 255 771 4:28:16




Next up: Rotorua Marathon, Saturday April 28th 2007!
With decent training this time. :-)

File Under: Training,

Thursday, September 07, 2006

Reinventing the Wheel . . . Makes Hulk Angry

Aaaaaaagh!

Every time I join a new ASP.Net project I get bitten by these two things, and every time I end up working them out again. This time I'm writing them down. :-)


Joining a project configured as a web project(s) by opening the solution file:

  • If practical configure your local web server with the project on the same path.

  • If not, open the SLN file and fix everything that looks like a URL (you won't be able to fix it from VS.Net)

  • Presumably, making a new solution will solve it too. As I was getting pretty close to turning green and digging out the purple pants, I didn't pursue that path to its smoking, pulverized computer end

  • Don't even get me started on VS.Net 2003 VSS integration.




Adding a Strong Name Key Pair to a Local Key Container

  • If there's a line like this in the Assemblyinfo.cs
    [assembly: AssemblyKeyName("containerName")]

  • Or you get "Cryptographic Failure" errors on the first compile of the project

  • Find the .snk file and run this command line:
    sn -i keyfile.snk containerName



File Under: Technology,

Wednesday, August 30, 2006

Cool New Flickr Mapping Feature

Flickr has just added some fantastic new features for adding geographic data to photos. Including a new map interface in the Organizr that lets you drag and drop photos onto a map. Check it out:


Once you've pinned a photo to the map, a new link appears on the photo page that says "Taken in (map)". Clicking the map link opens up a little map with the thumbnail photo pin. That map gives you the option to view all photos on a user specific map, or view all photos taken nearby. Way cool, I've been looking for something like this for a while. The only drawback is that it's Yahoo maps, not Google maps (Google has much better New Zealand data).

Here's the Flickr Blog writeup:
Flickr Blog: Great shot - where'd you take that?

I've also been messing around with a couple of websites which integrate with the new Google maps API. None of them have exactly everything I want, but they're getting close. The one I like best is called Platial. It lets you create maps, pin locations, describe and tag locations, and associate photos with locations. It does integrate with Flickr, but it's a bit difficult to locate specific photos (it does a search on all photos marked with a Creative Commons license, so you need some distinguishing text in your photo page to find your own stuff).

In any case, I've been using Platial to gradually assemble a map of things to do on the North Island if any of my friends or family come to visit. Take a look:

Platial Map: Stuff to do in a Week on the North Island


File Under: Technology,

Tuesday, August 29, 2006

XNA Game Studio

Hmmm . . . this looks interesting:

http://msdn.microsoft.com/directx/xna/gamestudio/

The Framework looks like a replacement for Managed DirectX 2.0. Might be fun.

File Under: Technology,

Friday, August 18, 2006

VS.Net 2003 to 2005 Web Project Conversion Problems

This one is a bit obscure, and the solution may be a bit obvious, but it might just turn up in Google and save someone a couple hours of detective work.

So . . . while attempting to load a VS.Net 2003 web project into VS.Net 2005, I was continually blocked by this error:


"The project file must be opened in the Visual Studio IDE and converted to the latest version before it can be built by MSBuild"


Hmm . . . I thought I just did open it in the IDE.

Our next strategy was to create a new 2005 web project and import all the files from the previous project.

Oddly, there was no option available to create a new web project. It turns out that the previous owner of my dev environment had never installed the Visual Web Developer feature.

Once that feature was installed it ripped right into the conversion.


File Under: Technology,

Tuesday, August 15, 2006

Cold Snap

I've had frost on my windshield the last couple of mornings. It's been about 3°C at 7am or so. That's left just enough frost to need to blast the heat and run the wipers for a few minutes.

That's made me think: Winter is almost over down here, and that's all there is to it . . . we won't even see a real frost, the kind that leaves you running late, so you have to chip a hole through the ice and go, hunched over and peering out like a tank driver.

What's really a bummer is thinking of "winter" going by without one of these!

Snowblower

I'm not sure when I'll get a dose of snow and cold this year. It's not looking good for a trip to the South Island or Mount Ruapehu anytime soon.

On the bright side, I will definitely be back in Minnesota for my favorite time of year!

Red

File Under: New Zealand,

Wednesday, August 02, 2006

My TechEd NZ Schedule



Sunday, August 20
2:00 PM - 9:00 PM

Registration and Hands on Labs Open SkyCity


Monday, August 21
8:30 AM - 10:00 AM

Keynote New Zealand Rooms, SkyCity

10:30 AM - 11:45 AM

CON301 (.NET 3.0) Introduction to the .NET Framework 3.0

11:55 AM - 1:10 PM

CON203 (.NET 3.0) Windows Workflow Foundation: Introduction

1:10 PM - 2:00 PM

Lunch

1:20 PM - 1:50 PM
2:00 PM - 3:15 PM

OFC304 Securing and Deploying Visual Studio 2005 Tools for Microsoft Office (VSTO) Solutions + what's Coming in version 3.0:

3:35 PM - 4:50 PM

ARC209 Patterns and Anti-Patterns for Service-Oriented Architectures

5:00 PM - 6:15 PM

MGT304 PowerShell: Next Generation Command Line Scripting

6:00 PM - 8:00 PM

Ask the Experts Evening MarketPlace, SkyCity


Tuesday, August 22
9:00 AM - 10:15 AM

ARC205 Putting the User Back in to SOA

10:45 AM - 12:00 PM

CON308 (.NET 3.0) Windows Communication Foundation: Building Secure Services

12:10 PM - 1:25 PM

CON311 (.NET 3.0) Windows Workflow Foundation: Building Rules-Based Workflows

1:25 PM - 2:20 PM

Lunch

1:35 PM - 2:05 PM
2:20 PM - 3:35 PM

ARC207 Guerilla SOA

3:45 PM - 5:00 PM

WEB211 Developing Data-Driven Web Applications with .NET Language Integrated Query

5:10 PM - 6:25 PM

WEB310 ASP.NET: Creating High-Performance, Enterprise-Scale Web Applications Using Visual Studio 2005 Team System

6:30 PM - 11:30 PM

TechFest St James Theatre, Queen St


Wednesday, August 23
9:00 AM - 10:15 AM

WEB312 ASP.NET 2.0 Tips and Tricks

10:45 AM - 12:00 PM

CON319 .NET 2.0 to .NET 3.0: How WCF will change the way you’re developing Service Oriented solutions

12:10 PM - 1:25 PM

CON316 (BTS) "And I thought I knew everything about BizTalk"

1:25 PM - 2:20 PM

Lunch

1:35 PM - 2:05 PM
2:20 PM - 3:35 PM

CLI311 Developing a Windows Presentation Foundation Application

3:45 PM - 5:00 PM

CON204 (BTS) Planning and Designing Enterprise Class BizTalk Server Solutions

5:00 PM - 6:30 PM

Farewell Drinks MarketPlace, SkyCity




File Under: Technology,

Tuesday, August 01, 2006

Returning a Recordset from an Oracle Stored Procedure to a .Net Caller

You wouldn't think this would be difficult, but every example I googled up was either incomplete, excessive, or needlessly confusing. So for my own future reference as much as anything, here it goes. . .

The minimalist implementation of a Stored Procedure that returns a recordset:

Oracle side:

CREATE OR REPLACE PROCEDURE RobCursorTestProc
(
my_cursor IN OUT SYS_REFCURSOR
)
AS
BEGIN
OPEN my_cursor FOR
SELECT TABLE_NAME,
OWNER
FROM ALL_TABLES;
END;
SHOW ERRORS;


.Net Side


using Oracle.DataAccess.Client;

OracleConnection OraConn = new OracleConnection();
OraConn.ConnectionString =
"Data Source=DBName;User Id=MyUser;Password=MyPW;";
OraConn.Open();
OracleCommand OraComm = new OracleCommand("RobCursorTestProc", OraConn);
OraComm.CommandType = CommandType.StoredProcedure;
OraComm.Parameters.Add
("Cursor", OracleDbType.RefCursor, ParameterDirection.Output );
OracleDataReader OraDR = OraComm.ExecuteReader();
if (OraDR.Read())
{
MessageBox.Show(OraDR.GetName(0));
MessageBox.Show(OraDR.GetValue(0).ToString());
}


Here's a bit more user friendly view:
http://snipplr.com/users/rengber/

File Under: Technology,

Tech Ed NZ


Oh Yeah!


File Under: Technology,