Author Archives: Josh

TV Guides: mine, mine, mine!

Joshua Gans asks: Who owns TV guide data? Apparently Packer is suing the pants off ICE-TV who provide a TV guide service to users of MythTV, amongst others. Gans reckons its a defensive move to protect Channel Nine’s ad broadcast revenue.

I dunno, it seems to me that this is going to fall on its head. Having a TV listing is copyrighted? Perhaps a particular one is, but recreating the simple facts of one, I don’t see how that violates copyright.

The 3210 is dead, long live the 5110

Last week, my Nokia 5110 started acting funny – switching itself off, and so forth. The backup phone, a Nokia 3210 was pressed into service. Gotta love those old Nokias, charger compatability is a lovely thing, even if the battery form-factors aren’t the same.

Anyway, I figured out that the dodgy LiI battery I’d upgraded the 5110 with was the cause of the problems, what with the housing seperating into two pieces and all. I figured I’d get around to fixing it and then the 5110 would then be the backup phone.

Owen proceeded to prove that the 3210 wasn’t as well made as the 5110. The 5110 has suffered hundreds of falls during its service life, due to a clumsy owner. The 3210 was destroyed by a 12 month old child dropping it in the carpark of Bunnings. LCD screen cracked, as well as the protective plastic over the screen. And yes, it was in a protective leatherette case.

With zero operational mobile phones left, I discovered I could repair the dodgy battery for a 5110 by filling it with PVA glue and clamping it for 36 hours.

As good as new. But now I don’t have a spare phone.

QueryInterface for interface xxx.yyy failed

My .NET web service – which wraps some legacy COM objects – wasn’t working. Development under VS2003 using .NET 1.1 worked fine in my dev environment, but in test env it just kept whinging:

InvalidCastException: QueryInterface for interface xxx.yyy failed

That’s a pretty basic failure – it couldn’t even obtain a xxx.yyy interface from the COM object. I figured it was a IIS security problem: a .NET desktop app using the same set of COM libraries worked fine.

The thing was, when I set the user account to operate annoymous web users under to local Administrator, it still didn’t help. Perhaps, I thought, this isn’t a permissions problem. Web users are now, after all, Gods.

Perhaps, Glen suggested, I was running .NET 2.0 and .NET 1.1 simultaneously?

No.

It turns out missing part was the

<identity impersonate="true" />

line out of the web.config file in the directory in which my webservice lived. Also, the lack of a web.config file in the directory in which my webservice lived caused a little bit of a problem. I didn’t realise that at the time, but found out that the impersonate setting can also go in one’s machine.config file also – but that has global implications. So I stepped back to putting it in my web service’s own web.config file.

Why does the Web Setup Project fail to include important little files, like my .asmx and web.config files? What is the point in having a wizard that just makes a installer that doesn’t install a working system? And the dependancies tree! God, just let me specify – or figure it out for yourself – the order in which to register the COM objects.

But guess what? All of that is unnecessary, if only your Installer derieved MyEventLogInstaller is set up thusly:

	[RunInstallerAttribute(true)]
	public class MyEventLogInstaller : Installer
	{
		private EventLogInstaller myEventLogInstaller;
		public MyEventLogInstaller()
		{
			//Create Instance of EventLogInstaller
			myEventLogInstaller = new EventLogInstaller();
			// Set the Source of Event Log, to be created.
			myEventLogInstaller.Source = "Josh's Web Service";
			// Set the Log that source is created in
			myEventLogInstaller.Log = "Application";
			// Add myEventLogInstaller to the Installers Collection.
			Installers.Add(myEventLogInstaller);
		}
	}


– with the RunInstallerAttribute being the super important part. Or perhaps it should read RunInstaller. But don’t worry, neither of them actually cause the installer to run them. As such, all you need do is issue the command

installutil "MyStupidWebService.dll"

after the installation program is done and you’ll be cooking with gas.

Simple, huh? No need for that nasty web.config file after all! Especially with it impersonating a dud security context.

Oh! And remember to issue a regsvr32 comcomponent.dll command also!

A dead giveaway that you haven’t run installutil is if you get an exception like this:

System.TypeInitializationException: The type initializer for "MyStupidWebService.Global" threw an exception. ---> 
System.InvalidOperationException: Cannot open log for source {0}. You may not have write access. ---> 
System.ComponentModel.Win32Exception: Access is denied
   --- End of inner exception stack trace ---
   at System.Diagnostics.EventLog.OpenForWrite()
   at System.Diagnostics.EventLog.WriteEvent(Int32 eventID, Int16 category, EventLogEntryType type, String[] strings, Byte[] rawData)
   at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
   at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category)
   at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID)
   at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type)


because installutil will create an entry for Event Logging, if you’ve developed the appropriate installer. And because the person running installutil has decent privileges, it will actually work, as opposed to your web service trying to do it when it’s running in a securely locked down account.

C# module entry point

I’ve made a C# Web Service. Now I need a deployment project for my Web Service. After installing, it turns out that my Web Service needs to set the security on a registry key to allow the ASPNET user Full Control. Fine. I’ll need some sort of hand-written code to do that, because security is something the installer doesn’t cover. Stumbling around the help and web, I find I need to View | Editor | Custom Actions to create a Custom Action (right-click On the Install event/action, select Primary Output from JoshsPrimaryOutput; on the properties of this new Custom Action set InstallerClass to false and set EntryPoint to JoshsEntryPointFunction). Build.

I get the error:

Unspecified module entry point for custom action ‘<name>’ in JoshsPrimaryOutput.dll

Which the help… helpfully tells me to fix it I need to

…specify a valid entry point within the DLL.

Fine, makes sense. I’m not stoopid, I’ve been a C++/Windows programmer for a very long time. I know DLLs, I know entry points, this holds no fear for me. C# has DLLimport. It seems to be missing DLLexport. I’ve just spent several hours searching online help and the web for an answer, so now I turn to you, our esteemed readers.

How do I specify a module entry point in C#?

Scott Meyers’ five top fives – EVER

I’ve been waiting for the full set to be published, before dumping ’em here:

HSBC.co.uk Security Sistem

From: HSBC Bank PLC
To: josh_parris@leakeddomain.com
Cc:
Subject: HSBC.co.uk Security Sistem

Dear HSBC Member,

We have reason to suspect that your HSBC account may be in use by an unauthorized party.

….

I think I should click on the link to check out this sicurety pblum. What do you think?

Phones are too complex

Mobile phone companies have a problem: price competition is causing dropping call revenue. Solution: push phones that do data services.

Thing is, I use my phone to make phone calls. Oh, and as an alarm clock. Seems that lots of other people are only interested in mobile phones as telephones too. These people are destroying civilisation by being unprofitable consumers.