Author Archives: daniel

SQL Server paranoia mode

This post is for Tony!

Worried about accidentally overwriting critical data with a typo in your database commands?

SQL Server Management Studio has an option for that: SET IMPLICIT TRANSACTIONS, which you’ll find (in 2008 / 2008 R2 at least) under Tools / Options / Query Execution / SQL Server / ANSI.

SQL Server implicit transactions option

Anything you do (from the next query window you open) will automatically be in a transaction, so you can ROLLBACK if you realise you’ve done the wrong thing.

Be warned, you’ll need to get into the habit of manually COMMITting everything. Don’t be tempted to just add the COMMIT at the bottom of your query… that would defeat the purpose.

It’ll prompt you do to so if you close a query window without having done a ROLLBACK or COMMIT. It can get a little irritating, but knowing you can’t accidentally trash all your data may give you piece of mind in return.

FOP and ZXing compatibility

From the I’ve been trying to get this to work — this tip may save you some time department:

Apache FOP is for doing graphics with XML and XSLT.

FOP version 0.95 came out in August 2008. 1.0 in July 2010. 1.1 in October 2012.

ZXing is for doing QR codes.

ZXing 0.1.2 was released in March 2012, and seems to no longer be in active development.

The important bit: As far as I can see, ZXing works fine with FOP 0.95 (which was current when it was released), but not with later versions.

I kept getting these errors:

SEVERE: Image not available. URI: (instream-object). Reason: org.apache.xmlgraphics.image.loader.ImageException: The file format is not supported. No ImagePreloader found for null (No context info available)
org.apache.xmlgraphics.image.loader.ImageException: The file format is not supported. No ImagePreloader found for null

With any amount of fiddling, I couldn’t get it to work on Windows and Java 1.7. Nobody online appears to have noted this issue. You might have more luck…

Or maybe there is no solution to it. If so, I hope this saves you some time.

(Barcode4J, which we also use, seems to work with all currently available versions of FOP. It also has QR functionality, provided via ZXing, but this is only available in the unreleased code, which presumably has alpha status, and you have to build yourself. Barcode4J also hasn’t been updated in some years, last released in December 2010.)

Upgrading to Android 5

My Google Nexus 5 finally received the Android 5 update… well, the notification for it at least.

Eventually I decided to upgrade it.

Good stuff

Easy upgrade.

It seems pretty speedy on the Nexus 5.

Some good, useful functionality, like priority contacts (who it looks like can be set to ring when nobody else does — something I’ve used an app called Auto Ring for in the past, which still seems to work). Beware though, “Priority” apparently means low battery alerts are allowed to make sounds. Didn’t appreciate being woken up by that.

Better links from contacts to recent activity such as calls and texts.

Torch. Wasn’t there before.

Google Fit… it turns out this is compatible with Android 4. I hadn’t seen it, but it added itself with the upgrade. Quite neat, I’ve been tracking my steps.

Android 5 upgrade  Android Device Administrator

Bad stuff

The new look may take some getting used to. I don’t understand why they’ve got rid of most of the lines between things. The keyboard is now one big lump, with no distinguishing lines between the virtual keys.

Gmail now handles the stuff that used to go through the email app, such as Exchange ActiveSync. I find that a bit painful, as I liked to keep my work/Exchange email separate from my Gmail.

Worse, it now enforces Exchange’s device restrictions (did Android 4 do this? I don’t recall that it did). This includes scary things like the ability to wipe your device if you get your password wrong too many times. Given how apps sometimes go crazy polling the server when the password changes, I’m not sure I trust it with this power.

I ended up deleting the Exchange account from Gmail. It wasn’t easy — you can’t simply remove the account. It turned out the way to do it was via Settings / Security / Device Administrators. Turning that back off forces the accounts relying on it to be removed.

I might need to find a new Exchange app. Touchdown looks good — They do a good job of hiding much it costs (appears to be US$20 after a month’s trial), but it looks like a good Exchange app that limits security restrictions to itself, not the whole phone. CloudMagic also appears to work okay, but has a completely free option, as well a paid (US$4.99/month) option.

More as I explore the new version.

I’m really liking Google Fit. Sure, it doesn’t track very much information, but I gather the Nexus 5 has a pedometer built in, so it’s nice to be able to see some results from it.

Google Fit

Response times seem to be a little bit slower, going onto the home screen, but nothing worth worrying about (yet).

Pointless choices

This seems to be common on store finder applications on the web: After entering the postcode, you’re asked to enter the suburb as well.

coles

It makes zero difference what you choose, because the suburbs aren’t huge. The Store Locator shows you stores within at least 5 kilometres, but the suburbs are much smaller than that.

In fact it’s worse in the case of the Coles Catalogue, because it ends up giving you a catalogue which is clearly marked “Vic Metro” – which applies to the entirety of scores of postcodes.

Is there anywhere in the country that has suburbs big enough that it would matter? I haven’t found any.

Making people make this choice is pointless. It’s just another barrier to them getting to your information.

More help is available

From the “Do you understand why people hate you, Microsoft?” department:

D:\>net stop xyz
The service name is invalid.

More help is available by typing NET HELPMSG 2185.

D:\>net helpmsg 2185

The service name is invalid.

D:\>

Yes. Very bloody helpful.

I don’t expect miracles in the command line, but I do expect that if I’m told more help is available, that more help is actually available.

Chrome starts blocking web sites using HTTPS over SSL3

It would seem some organisations still haven’t got the message on SSL vulnerabilities, even one with a publicity-friendly name like Poodle.

For instance, Swinburne University of Technology, which is actually one of Australia’s better universities to learn computer science, has its student portal still trying to use SSL 3.

MySwinburne SSL error

My son was trying to figure out why he couldn’t connect with Chrome. Only by clicking for details do you get the slightly cryptic error: “ERR_SSL_FALLBACK_BEYOND_MINIMUM_VERSION”

It turns out Chrome has disabled fallback to SSL3. For now you can override it (though it’s easier for now just to use another browser), but soon it’ll be disabled completely. Site owners will need to make sure their servers support TLS instead.

They’ve also started giving a warning on SHA-1 certificates — no more green logo; it’s gone yellow, with a warning: “This site is using outdated security settings that may prevent future versions of Chrome from being able to safely access it.” Again, it’s up to site owners to resolve this, by updating their certificates.

Why can’t you resize Remote Desktop windows?

RDP optionsIf you can spontaneously change the resolution of Windows in a Virtual Machine, how come you can’t do it in a Remote Desktop session?

I’m forever opening up RDP sessions in the wrong resolution, because the RDP client seems to have a funny way of selectively remembering (or forgetting) the preference.

Sometimes if focussing entirely on the remote session, I’d like it to be full-sized. At other times I’d like it smaller so I can more easily jump between things.

Is there something complicated that stops RDP windows being resized after connection has been made? If it is possible in a VM, presumably it can’t be too hard in RDP?

It looks like in Windows 8 and later you can easily turn on “smart resizing”, and in earlier versions this can be configured in the .rdp file. But this scales the window at the original resolution, rather than changing resolution.

It’d be nice if proper resizing of the window was possible.

badges.del.icio.us malware

Interesting warning from Google when displaying some pages on this geekrant.org:

Malware warning

In response I’ve disabled the Socialize plug-in which was serving them. Hopefully that makes the warning go away — I’ll look for another way to display social media buttons.

myTax – pleasantly surprisingly pain-free

I’m sometimes wary of online services, especially those provided by government. (Heck, look at the Myki web site… it’s clunky and still looks like it was written last decade — which of course it was, and it’s never had more than a minor update.)

But having tried the Windows-based eTax for the first time last year (when the Australian Taxation Office pretty much forced everyone off the paper Tax Packs by not making them generally available), this year I tried out MyTax, which is the cut-down simplified web-based tax return system. It means I can avoid having to download and install eTax.

It has to be linked to a MyGov account, which is Big Brother’s logon system that includes (at your option) services provided by the ATO, Medicare, Centrelink and others.

MyGov

Signing up and submitting the tax return all seemed to go fairly smoothly, and the simplified design (it can’t handle more complex tax affairs) means the process of entering all the information is much quicker than using a Tax Pack or eTax.

A big criticism of eTax has been that it only works under Windows. Given MyTax is also cross-platform, I wonder how long it’ll be before it is enhanced and replaces eTax completely.

The only criticism I have with it is that once you’ve submitted, it says there’s only one chance to Save and/or Print what you’re submitting. That’s a bit weird. And it doesn’t actually allow you to Save, only to Print. I cheated and Saved by copy/pasting the HTML into Word, and saving that.

iTunes free U2 album: How to make it appear

So you don’t want to splash out on a new iWatch or iPhone, but you do want that new U2 album that’s free on iTunes until 14th October?

The instructions (for Mac or PC itunes) say:

On your Mac or PC, open iTunes, then select the Albums tab. Select Songs of Innocence. Select a track to listen or click the iCloud icon to download.

What they don’t tell you is what to do if it’s not showing there. In my case, it wasn’t. It also wasn’t in Purchased, and although I could see it in the iTunes Store (and play previews), the iCloud icon wasn’t appearing.

Screen Shot 2014-09-10 at 10.58.33 am

The answer is you need to switch on the option to see iCloud purchases:

Preferences / Store / Show iTunes in the Cloud purchases

Then it should appear in the Albums tab.

With thanks to Sam Wilkinson on Twitter

Update 2014-09-16: For those who aren’t as keen on U2, Apple has now published an article on how to remove the album from your iTunes:

Remove iTunes gift album “Songs of Innocence” from your iTunes music library and purchases

Upgrade of web site from .Net 2 to 4.5 breaks asmx web services

Despite my best Googling, nobody seems to have had quite this problem (and written about it).

I’m migrating a .Net 2 web site to .Net 4.5 (well, 4.5.1 to be precise). Everything seemed to work except browsing to the .asmx (web service) pages, which threw a System.BadImageFormatException: Invalid token error:

Error Stack:System.InvalidOperationException: Failed to handle request. —> System.InvalidOperationException: Unable to handle request. —> System.Configuration.ConfigurationErrorsException: Invalid token. —> System.BadImageFormatException: Invalid token.
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
— End of inner exception stack trace —
at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
at System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()
at System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)
at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)
at System.Web.Compilation.WebDirectoryBatchCompiler..ctor(VirtualDirectory vdir)
at System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(VirtualDirectory vdir, Boolean ignoreErrors)
at System.Web.Compilation.BuildManager.BatchCompileWebDirectory(VirtualDirectory vdir, VirtualPath virtualDir, Boolean ignoreErrors)
at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean ensureIsUpToDate)
at System.Web.UI.PageParser.GetCompiledPageInstance(VirtualPath virtualPath, String inputFile, HttpContext context)
at System.Web.UI.PageParser.GetCompiledPageInstance(String virtualPath, String inputFile, HttpContext context)
at System.Web.Services.Protocols.DocumentationServerProtocol.GetCompiledPageInstance(String virtualPath, String inputFile, HttpContext context)
at System.Web.Services.Protocols.DocumentationServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
— End of inner exception stack trace —
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
at System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response)
— End of inner exception stack trace —
at System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response)
at System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath)
at System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated)
at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)| Global.asax:Application_Error()

I tried adjusting the .Net version — turns out it would work fine in 3.5 or lower, but broke in 4 or higher.

My machine itself was okay — creating a new 4.5 web site with just a web service in it worked fine.

In the end the solution was to create a new web site and add the individual pages back into it, leaving out the Bin directory. I rebuilt that by adding references to the various DLLs back one by one. Something in the old Bin directory apparently was throwing it out.

BASIC turns 50

The BASIC programming language turned 50 on Thursday.

This Time article is a great read — and notes the importance of the language on getting school students programming.

What’s the equivalent today? The Raspberry Pi is helping make hardware affordable. Some might dabble in Visual Basic or C# via Visual Studio Express, or the many of the other freely available languages such as Python, PHP, Javascript… or here’s another way of looking at it, from Jeff Atwood: