National Savings and Investments – Login Incorrect BWXX0013

I am just signing up for the National Savings and Investments online and phone service.

I got a letter this morning with my temporary password, and attempted to login with that password and my premium bonds holder number, but I kept getting the below error:

It turns out that your NS&I number is a different to your premium bonds holder number. You have to wait for this number to arrive by snail mail, sent separately to your password. A careful reading of the password letter does explain this (“you’ll need to wait until your NS&I number arrives in the post”), but I thought I’d mention this in case it catches anyone else.

Spring XML Configuration of Hibernate Session Properties with JPA

I needed to set the generate_statistics property for Hibernate, with use with the excellent Hibernate JConsole Plugin.

The issue is that I am using Spring and JPA, and I wanted to set this property in my Spring XML configuration file. Most of the Spring JPA examples just show you how to set the properties exposed by the HibernateJpaVendorAdapter, e.g.

<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
 <property name="persistenceUnitName" value="a.b.c.d" />
 <property name="jpaVendorAdapter">
 <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
 <property name="showSql" value="false" />
 <property name="generateDdl" value="false" />
 <property name="databasePlatform" value="SQLServer2008Dialect" />
 </bean>
 </property>
</bean>

So how can we set other Hibernate session properties? It turns out that we can set the jpaPropertyMap property of the parent LocalContainerEntityManagerFactoryBean also:

<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
 <property name="persistenceUnitName" value="a.b.c.d" />
 <property name="jpaVendorAdapter">
 <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
 <property name="showSql" value="false" />
 <property name="generateDdl" value="false" />
 <property name="databasePlatform" value="SQLServer2008Dialect" />
 </bean>
 </property>
 <property name="jpaPropertyMap">
 <map>
 <entry key="hibernate.generate_statistics" value="true"/>
 </map>
 </property>
 </bean>
</bean>

Now we are free to set Hiberate session properties. I found this technique used on the Spring Forums, as part of other solutions, but wanted to emphasis the basic technique for others who were similarly stumped.

Mac-style presentation effects on Windows

I wanted to create a video of a technical architecture presentation. It was created in Visio, but I really wanted to capture Mac-style mouse motions and spotlight effects as I narrated.

After a number of blind allies around mouse display software, I happened upon Impressive, an open source program that runs against PDF files.

Upon reading the Technology paragraph, which mentioned Python, GhostScript and OpenGL, I assumed that I would pay a brief visit to the downloads page, read some phrase about compiling from the C source code, and then move on. How wrong was I? You download the Windows package, unzip it, and you’re good!

Impressive runs from PDF files, so you need to convert your Visio or PowerPoint slide into PDF before you can launch it. Then, you either launch it from from the command line, or create yourself a Windows Shortcut to impressive.exe, and place it in the C:\Documents and Settings\[USERNAME]\SendTo folder. Then you can right mouse click on the PDF file and choose ‘Send To > Impressive’ to start the show.

(I won’t go into the features too much here, but suffice it to say I got the spotlight and highlighting effects I wanted, and my video turned out a treat.)

There are a host of features you can turn on and off if you want to use the command line to achieve finer-grain control over Impressive’s features. In my own case, I knew I wanted to produce a HDV 1080i frame size, and I was able to achieve this with the following command line:

C:\Apps\Impressive\impressive.exe -g 1440x1080 -f "MySlides.pdf"

And the best thing? Impressive is (effectively) a portable application, so you can use it in a locked down environment.

Simply Mail Solutions MS Exchange Classic Review

I recently decided to bite the bullet and migrate domain email for my two main employees to a hosted Exchange provider, so that we could get proper BlackBerry integration, rather than relying on forwarding our domain email to Hotmail (which actually works pretty well, but our clients could see the Hotmail address, which wasn’t very professional).

I rang around various local providers, and the market rate seemed to be around 25 GBP per mailbox PCM, plus 100-200 GBP setup fee. This hardly felt like a bargain, but there wasn’t much variation in the quotes, so I was about to plump for one of these providers when Google took me to Simply Mail Solutions.

I called the main number, and the lady explained that the price I had been quoted was for pre-Exchange 2010, and that things had actually moved on from a technical point of view. Blackberry and Microsoft had now spoken to each other, and there was a kind of halfway house which meant you could get BlackBerry Enterprise Server functionality without actually needing the full system. And the cost: 6 GBP PCM per mailbox!

So sold on price. But there were a number of technical hurdles which I threw up in the way, which were surely to test the patience of any support operation:
1. Could I only forward certain domain mailboxes to SMS, and retain control of MX records for the domain?
2. Could I get this working on a Mac?
3. Could I get the Blackberry Enterprise Activation app to work on my colleague’s older BlackBerry?

To cut a long story short, the answer to all of these questions was ‘yes.’ I must have raised five support calls during the migration, and the response from support was always quick, friendly and comprehensive. Finally, did I mention that SMS also include an OEM version of Outlook 2010 and 2011 in the price?

Conclusion

So, great price, and excellent service from these guys. Heartily recommended!

5 things they don’t tell you about upgrading your Mac

It’s always roses, roses, roses with my Mac-loving friends. But for some reason I don’t have the knack, and would like to remind myself of the following facts when I am next planning an upgrade.

1. Upgrading the OS or hard drive on your Mac *will* take you all weekend
2. You *will* try three different back-up methods before finding one that works
3. You *will* have to reformat one of your NTFS USB drives to Mac format so that your Mac can write to it
4. You *will* find that although the OS upgrade media is beautifully packaged, and designed by Apple in California, it will not actually work, and will require baroque instructions to save to disk followed by boot from new partition
5. Your jaw *will* drop when your Mac-loving friends blithely accept that they need to buy a new laptop / memory system / hard drive just to get a point release in OS

Reckon I’m happy to get back to my decade-old XP OS, that I can still install any software I’ve purchase in the last decade on.

Regenerating DBML Designer when your database changes

Here’s how to regenerate your DBML code in Visual Studio 2010 when one of your database objects changes:
1. Remove the table
2. Close the DBML designer and save
3. Re-open the DBML designer
4. Re-add the object by dragging from Server Explorer
5. Close the DBML designer and save

In finding this solution, I did find some wailing and gnashing of teeth on-line, with people expecting the DBML code to have some kind of refresh feature for automatically doing this when the database changed.

I must admit I don’t share their chagrin. I am:
* Pathetically grateful for anything that saves me not having to write a hundred lines of property let/get statements
* Impressed by the way projects that reference these objects automatically re-test for compilation as soon as you save the DBML code

Windows Batch File Current Date Formatting

Often you will create a windows batch file that runs on a periodic basis, and ideally you’d like it to reflect the current date when it does things like create files and folders.

I’ve seen some fairly arcane methods of retrieving and storing this information in variables through the years, but I think I’ve just found the most elegant solution.

To store today’s date in a variable with format yyyymmdd:
SET VAR=%DATE:~6,4%%DATE:~3,2%%DATE:~0,2%

That’s it! This is pretty hard to find online. It seems to be usually part of the more complete expositions on variable expansion, and is described as String Substitutions or Substrings. Obviously you can change the offsets above to change your format, and also note the character position pointer is zero-based.

Fix SQL Server Express memory growth

Here’s a simple batch script to restart SQL Server Express – I find memory used grows to at least 300 MB over time, although I do tend to leave Management Studio open for a lot of that period.

REM Simple batch script to restart SQL Express
REM BRD: 20110928
REM http://www.brdalby.co.uk/
net stop MSSQL$SQLEXPRESS
net start MSSQL$SQLEXPRESS
pause

Recovering Visual SourceSafe (VSS) Admin Password

We were given a legacy VSS repository, with passwords unknown. It turns out that not42 have created a very nice utility which wraps the hacking you have to do on um.dat to reset admin password to blank.

You can retrieve it right here:
http://not42.com/2005/06/16/visual-source-safe-admin-password-reset/

Verified as working for me with Visual SourceSafe 6.0d (Build 9848), running XP Professional SP3.