I had an interesting problem today with EntityFramework. (I'm using the EF 5.x DbContext Generator for my POCOs, but I doubt it matters which POCO generator you use).
I have a SQL view that has some calculated columns, like this.
(X * Y) As MyCol
where both X and Y are decimal types.
I have been using the view for a while just fine, but then today it stopped working.
The error I was getting was:
"The property on ... could not be set to a 'Decimal' value. You must set this property to a non-null value of type 'Double'."
I thought this was odd, seeing as the code is auto-generated.
I subsequently discovered that the underlying data types in the tables used in the view (and the view below it) had been
extended to increase accuracy, from decimal(18,2) to decimal (30,15). It then dawned on me that because the column datatype is not actually specified in the view but rather inferred from a calculated column, the auto-generated code might not really know the correct data type to use, and sure enough it was generating a nullable double not a nullable decimal.
The problem was fixed by going to the view and changing the column output to a known type, i.e.
cast((X * Y) as decimal(30,15)) As MyCol
I then removed everything from the .edmx and re-added it to re-generate the code.
The auto-generated code then picked up the correct data type (decimal instead of double) and all is well.
Wednesday, 14 November 2012
Sunday, 26 February 2012
Setting Modified Date/Time on TrueCrypt files on ReadyNAS shares so they Backup
Further to my last post regarding offsite backups. I've noticed that backup solutions can have a hard time with TrueCrypt containers, as they do not by default change the modified date on the file, which means that the backup program then has to scan a big fat file for byte level differences or a CRC check or some such (and that's assuming your backup program is clever enough to do anything other than a modified date check).
The general solution for this is to change a setting in TrueCrypt - disable "Preserve modification timestamp on file containers".
This probably won't work if your TrueCrypt file is stored on a ReadyNAS network share though - it didn't for me anyway.
A simple solution (on Windows 7) is to run a batch script that uses PowerShell to modify the date/time before your backup runs (either as a step in the backup software itself, or just as a daily scheduled task).
The ChangeTCModifiedDate.bat file would look something like this:
powershell $(get-item \\ReadyNASBox\myfolder\mytruecryptfile.fil).lastwritetime=$(get-date)
Of course, this ReadyNAS problem isn't restricted to just TrueCrypt, see here:
http://forums.truecrypt.org/viewtopic.php?p=99934#99934
The general solution for this is to change a setting in TrueCrypt - disable "Preserve modification timestamp on file containers".
This probably won't work if your TrueCrypt file is stored on a ReadyNAS network share though - it didn't for me anyway.
A simple solution (on Windows 7) is to run a batch script that uses PowerShell to modify the date/time before your backup runs (either as a step in the backup software itself, or just as a daily scheduled task).
The ChangeTCModifiedDate.bat file would look something like this:
powershell $(get-item \\ReadyNASBox\myfolder\mytruecryptfile.fil).lastwritetime=$(get-date)
Of course, this ReadyNAS problem isn't restricted to just TrueCrypt, see here:
http://forums.truecrypt.org/viewtopic.php?p=99934#99934
Online (Offsite) Backup Solutions - A Brief Test
I wanted to do some offsite backups and I have about 85GB to backup. I tested out some of the popular solutions (I'm based in the UK, and of course YMMV):
Carbonite = v.slow uploads ~300kbit/s - price £3.49/month for unlimited storage*
CrashPlan = v.slow uploads ~340kbit/s - price £1.89/month for unlimited storage
SpiderOak = slow uploads ~700kbit/s - price £6.30/month for 100GB
GoDaddy = fast uploads ~5Mbit/s - price £1.59/month for 100GB
Mozy = very fast uploads ~8Mbit/s (uk server) - price £7.99/month for 125GB **
iDrive - fast uploads ~6Mbit/s - price £3.20/month for 150GB
OpenDrive - max file size is only 1GB for cheapest plan, so didn't test it.
* Note that it seemed to mysteriously slow down to 300kbit/sec only after I had exceeded 3GB of storage, before that it was much faster.
** Mozy may actually be faster than that even, as my upload connection maxes out at ~8Mbit/sec.
Prices are obviously subject to change - correct at the time of posting.
Some backup solutions have versioning - but that will just use up your storage space, and you should be doing that with your local backup solution, not your offsite solution.
I found that some of the software was exaggerating/misreporting its real upload speed. So I had to use a "desktop gadget" called Network Meter to monitor activity.
Unsurprisingly, I've gone with GoDaddy for now due to the solid upload speed/price combination. (No I haven't - see update at the bottom!) The downside is that it's not quite as quick as Mozy, and the backup software is very basic.
Generally I have noticed that when it comes to online storage of any kind (backups/photos/ftp/web/email) - the web hosting companies are always some of the cheapest.
Now if I could just find a UK webhost that was cheaper than GoDaddy and and had a better software client. There's always room for improvement.
I should say though, that despite the GoDaddy client being very basic, it puts hardly any stress on the system while I am using it, which is worth a lot to me. The other clients tend to do advanced file-diff comparisons to "save you space" which stress your CPU. In reality, a simple modified date/time check is all most users need, and its not really to save you space as much as save them bandwidth by only uploading file differences at the byte level (or some such). Your CPU time costs nothing to them, but you have to pay the power bill for it. So all round, I'm quite liking the GoDaddy solution atm, but it's early days.
What's interesting about the Mozy client is that it seems to detect if a file you are uploading already exists on their servers in someone else's backup, and if so, it doesn't upload your file, but just creates a reference. This is clever, but... it still counts against your usage allowance!! Cheeky.
UPDATE: since I wrote this, I have discovered that the maximum file upload size for GoDaddy online storage is 1GB (despite the fact that it says file size is Unlimited on their product page!). Some of my files are bigger than that, so I've switched to iDrive, and I've got to say I'm pretty happy with it. I upload several gigs/day to iDrive with no problems.
Carbonite = v.slow uploads ~300kbit/s - price £3.49/month for unlimited storage*
CrashPlan = v.slow uploads ~340kbit/s - price £1.89/month for unlimited storage
SpiderOak = slow uploads ~700kbit/s - price £6.30/month for 100GB
GoDaddy = fast uploads ~5Mbit/s - price £1.59/month for 100GB
Mozy = very fast uploads ~8Mbit/s (uk server) - price £7.99/month for 125GB **
iDrive - fast uploads ~6Mbit/s - price £3.20/month for 150GB
OpenDrive - max file size is only 1GB for cheapest plan, so didn't test it.
* Note that it seemed to mysteriously slow down to 300kbit/sec only after I had exceeded 3GB of storage, before that it was much faster.
** Mozy may actually be faster than that even, as my upload connection maxes out at ~8Mbit/sec.
Prices are obviously subject to change - correct at the time of posting.
Some backup solutions have versioning - but that will just use up your storage space, and you should be doing that with your local backup solution, not your offsite solution.
I found that some of the software was exaggerating/misreporting its real upload speed. So I had to use a "desktop gadget" called Network Meter to monitor activity.
Unsurprisingly, I've gone with GoDaddy for now due to the solid upload speed/price combination. (No I haven't - see update at the bottom!) The downside is that it's not quite as quick as Mozy, and the backup software is very basic.
Generally I have noticed that when it comes to online storage of any kind (backups/photos/ftp/web/email) - the web hosting companies are always some of the cheapest.
Now if I could just find a UK webhost that was cheaper than GoDaddy and and had a better software client. There's always room for improvement.
I should say though, that despite the GoDaddy client being very basic, it puts hardly any stress on the system while I am using it, which is worth a lot to me. The other clients tend to do advanced file-diff comparisons to "save you space" which stress your CPU. In reality, a simple modified date/time check is all most users need, and its not really to save you space as much as save them bandwidth by only uploading file differences at the byte level (or some such). Your CPU time costs nothing to them, but you have to pay the power bill for it. So all round, I'm quite liking the GoDaddy solution atm, but it's early days.
What's interesting about the Mozy client is that it seems to detect if a file you are uploading already exists on their servers in someone else's backup, and if so, it doesn't upload your file, but just creates a reference. This is clever, but... it still counts against your usage allowance!! Cheeky.
UPDATE: since I wrote this, I have discovered that the maximum file upload size for GoDaddy online storage is 1GB (despite the fact that it says file size is Unlimited on their product page!). Some of my files are bigger than that, so I've switched to iDrive, and I've got to say I'm pretty happy with it. I upload several gigs/day to iDrive with no problems.
Wednesday, 27 October 2010
Contractors' Handbook
I've recently got my hands on the "Contractors' Handbook". It's a great book for anyone new to contracting, and even seasoned contractors may learn a thing or two.
Thursday, 14 October 2010
The Case of the Unexplained
I was having a little trouble with a PC today that kept doing it's own thing, rather than what I wanted it to do. So I went to download Process Explorer, and while I was there, I found a link to this little gem - a presentation by Mark Russinovich of Winternals fame:
http://www.msteched.com/2010/NorthAmerica/WCL315
http://www.msteched.com/2010/NorthAmerica/WCL315
Thursday, 7 October 2010
Kindle, Reader, MSDN, iPhone and some VAT too
Being a computer geek, I have a fair few gadgets. Recently I acquired a Kindle (and I already have a Sony Reader). The Kindle and Sony are really very similar, but recently there are a few books/magazines I have not been able to get outside of Kindle format.
What's interesting to me is the different way these devices handle PDFs. Because PDF text is generally too small on these devices, you have to zoom in. The Sony will actually resize the font and re-paginate the text, which is clever, but the carriage returns get messed up and so do the images. The zoom feature on the Kindle literally just zooms and you have to scroll around the screen to read, this seems horrible at first, but the trick is to zoom to 150% and go into landscape mode, then you can just read downwards using the normal page turn buttons. The problem on the Kindle is that it then remembers this mode when you leave the book, which is annoying. The Kindle badly needs to remember zoom settings specific to the book - hopefullly this will be in a future firmware update. I think both devices could really do with a bigger screen, preferably a touch screen (iPad style) to give more screen space and get rid of the buttons, then maybe you wouldn't need to zoom in the first place. They could also both use an accelerometer for portrait/landscape mode and a backlit display that you can turn on and off, but they can't give you everything at once or you wouldn't buy version 3.0 (actually Sony have brought out a backlit model now).
Despite it's naughty proprietary "buy everything from amazon" nature, the Kindle does have 3 things going for it:
i) it's cheap,
ii) you don't have to use the horrible Sony Reader Library software to transfer files (you just use windows explorer), and
iii) it's got wifi (3g on the expensive one).
At any rate, this brings me on to a couple of things:
1. I'm probably very slow on the uptake here, but today I discovered that you can download MSDN Magazine for free in PDF format from here: http://msdn.microsoft.com/en-us/magazine/ee412244.aspx (Some of the older ones are in .chm format though).
2. I really dislike proprietary formats. They are anti-competitive and try to tie you into a device or service. This is why I regret buying an iPhone instead of an Android, and why I will buy as few books as possible in Kindle format. I guess you can convert Kindle format to PDF with some third party tool if you have to, but in most cases if you go to the publisher's website you can buy the PDF/ePub version direct from them (at least in the case of technical books).
In terms of proprietary formats/software, Apple is by far the worst offender. How on earth Apple has managed to get away with so many propietary tie-ins when Microsoft has been consistently dragged through the courts is beyond me. Their spate with Adobe over Flash on iPhones is hilarious too. I'm on Adobe's side on that one, but only because they opened up the PDF format ;c)
I originally bought my iPhone to play with some iPhone development, but the proprietary dev tools and Objective-C language seemed totally archaic compared with the Microsoft development world. On the plus side, they have subsequently relented and allowed other developer tools (http://gizmodo.com/5633721/).
One last thought. Computer books are quite frequently huge (1500+ pages). Books don't attract VAT, but electronic books do. Aside from this strange philosophical approach to tax, the UK government isn't really saving trees on this one is it? Computer books go out of date fast too, so it's not like 20 people will read the same book.
Edit: By strange coincidence, just 5 mins after I was writing this, I got a phonecall from one of my brothers. He told me he had just got an Android phone. I asked him why he had chosen it over the iPhone. He said his IT friends would never have forgiven him for buying such a proprietary device! Oh, he also said that iTunes is one of the worst pieces of software ever written. I'm not sure that's true, but when you consider the money invested in it and the flagship nature of the product, yes, it really is awful to use, especially from a company known for their user-friendly operating system. At the end of the day though, the iPhone is a lovely piece of hardware, nobody buys it for the software. I know plenty of iPod users that stay away from iTunes altogether. Personally, I hate iTunes, so my contacts are sync'd with Google and my music is sync'd with MediaMonkey (which I recommend). So, just because iTunes is horrible isn't a solid reason not to buy an iPhone, you can just avoid using it altogether (except for firmware updates).
What's interesting to me is the different way these devices handle PDFs. Because PDF text is generally too small on these devices, you have to zoom in. The Sony will actually resize the font and re-paginate the text, which is clever, but the carriage returns get messed up and so do the images. The zoom feature on the Kindle literally just zooms and you have to scroll around the screen to read, this seems horrible at first, but the trick is to zoom to 150% and go into landscape mode, then you can just read downwards using the normal page turn buttons. The problem on the Kindle is that it then remembers this mode when you leave the book, which is annoying. The Kindle badly needs to remember zoom settings specific to the book - hopefullly this will be in a future firmware update. I think both devices could really do with a bigger screen, preferably a touch screen (iPad style) to give more screen space and get rid of the buttons, then maybe you wouldn't need to zoom in the first place. They could also both use an accelerometer for portrait/landscape mode and a backlit display that you can turn on and off, but they can't give you everything at once or you wouldn't buy version 3.0 (actually Sony have brought out a backlit model now).
Despite it's naughty proprietary "buy everything from amazon" nature, the Kindle does have 3 things going for it:
i) it's cheap,
ii) you don't have to use the horrible Sony Reader Library software to transfer files (you just use windows explorer), and
iii) it's got wifi (3g on the expensive one).
At any rate, this brings me on to a couple of things:
1. I'm probably very slow on the uptake here, but today I discovered that you can download MSDN Magazine for free in PDF format from here: http://msdn.microsoft.com/en-us/magazine/ee412244.aspx (Some of the older ones are in .chm format though).
2. I really dislike proprietary formats. They are anti-competitive and try to tie you into a device or service. This is why I regret buying an iPhone instead of an Android, and why I will buy as few books as possible in Kindle format. I guess you can convert Kindle format to PDF with some third party tool if you have to, but in most cases if you go to the publisher's website you can buy the PDF/ePub version direct from them (at least in the case of technical books).
In terms of proprietary formats/software, Apple is by far the worst offender. How on earth Apple has managed to get away with so many propietary tie-ins when Microsoft has been consistently dragged through the courts is beyond me. Their spate with Adobe over Flash on iPhones is hilarious too. I'm on Adobe's side on that one, but only because they opened up the PDF format ;c)
I originally bought my iPhone to play with some iPhone development, but the proprietary dev tools and Objective-C language seemed totally archaic compared with the Microsoft development world. On the plus side, they have subsequently relented and allowed other developer tools (http://gizmodo.com/5633721/).
One last thought. Computer books are quite frequently huge (1500+ pages). Books don't attract VAT, but electronic books do. Aside from this strange philosophical approach to tax, the UK government isn't really saving trees on this one is it? Computer books go out of date fast too, so it's not like 20 people will read the same book.
Edit: By strange coincidence, just 5 mins after I was writing this, I got a phonecall from one of my brothers. He told me he had just got an Android phone. I asked him why he had chosen it over the iPhone. He said his IT friends would never have forgiven him for buying such a proprietary device! Oh, he also said that iTunes is one of the worst pieces of software ever written. I'm not sure that's true, but when you consider the money invested in it and the flagship nature of the product, yes, it really is awful to use, especially from a company known for their user-friendly operating system. At the end of the day though, the iPhone is a lovely piece of hardware, nobody buys it for the software. I know plenty of iPod users that stay away from iTunes altogether. Personally, I hate iTunes, so my contacts are sync'd with Google and my music is sync'd with MediaMonkey (which I recommend). So, just because iTunes is horrible isn't a solid reason not to buy an iPhone, you can just avoid using it altogether (except for firmware updates).
Thursday, 30 September 2010
Little Problem Today with a Netbook
I'm not a sysadmin, I'm a developer, but today I was given a netbook (Samsung N110 with XP) for use off-site, and was told it had a slow startup problem. Having established there was no data on the PC that the previous user wanted to keep, I elected to just use the restore function on the notebook to get the machine back to health.
Sure enough it booted like the proverbial lightning after the restore. Good I thought, just stick the windows updates and ms office on there and we're good to go.
The first set of updates (80 or so) went on ok and the system was fine. So I installed office, which resulted in a load more updates on the machine (another 40 or so). After this round of updates, the PC became painfully slow between the welcome screen and the desktop - taking about 3 mins to be usable.
I didn't want to trawl through uninstalling updates, so I resorted to good ole' msconfig. This determined the root of the problem to be something called the Marvell Yukon service (relating to the network card). I disabled this and everything was great again...
So I head on over to the Marvell support site and download their latest XP/x86 software for the card (88E8040), and install it. Then before I reboot, I go in to the services.msc to re-enable the (presumably updated) service...
However, when I look in the services panel, I find that the new software install actually deletes the old service! Well, I guess that's one way for them to fix the problem.
The netbook itself? It's nice, cute, and (now) surprisingly quick. It also has a long battery life (up to 8/9 hours allegedly). However, the keyboard is pretty horrible to use and the backslash key is on the right-hand side of the keyboard, which is a big no-no for a computer professional used to a full size uk keyboard.
Sure enough it booted like the proverbial lightning after the restore. Good I thought, just stick the windows updates and ms office on there and we're good to go.
The first set of updates (80 or so) went on ok and the system was fine. So I installed office, which resulted in a load more updates on the machine (another 40 or so). After this round of updates, the PC became painfully slow between the welcome screen and the desktop - taking about 3 mins to be usable.
I didn't want to trawl through uninstalling updates, so I resorted to good ole' msconfig. This determined the root of the problem to be something called the Marvell Yukon service (relating to the network card). I disabled this and everything was great again...
So I head on over to the Marvell support site and download their latest XP/x86 software for the card (88E8040), and install it. Then before I reboot, I go in to the services.msc to re-enable the (presumably updated) service...
However, when I look in the services panel, I find that the new software install actually deletes the old service! Well, I guess that's one way for them to fix the problem.
The netbook itself? It's nice, cute, and (now) surprisingly quick. It also has a long battery life (up to 8/9 hours allegedly). However, the keyboard is pretty horrible to use and the backslash key is on the right-hand side of the keyboard, which is a big no-no for a computer professional used to a full size uk keyboard.
Subscribe to:
Comments (Atom)