Saturday, September 28, 2013

After iOS 7.0.2 Update, Podcast App Failing

I updated my iPhone 4S to iOS7.0.2 and it immediately put the phone in recovery mode.  The phone was dead.  Fortunately, iTunes had it backed up on my Windows XP (no smirks please, it's historical) and was able to restore the phone, mostly.
The Podcasts app would open and then die immediately.
It took a while to find the fix.  I went to "App Store" on the phone and found an update for the "Podcasts" app.  After applying the update it was all working again.

Wednesday, September 18, 2013

Convert Sql Server DateTime to Milliseconds Since 1970

watch
Photo by Rich Masso
While noodling around with HighCharts, I needed to convert dates from Sql Server's DateTime to what HighCharts needs, which is milliseconds since 1970.



My first attempt to convert the current UTC time was not successful:
 
 
select Datediff(s, '1970-01-01', GETUTCDATE())*1000
Msg 8115, Level 16, State 2, Line 1
Arithmetic overflow error converting expression to data type int.

Since the number of milliseconds is greater than the precision of int, we have to bring up the big guns: "bigint".
 
select cast(Datediff(s, '1970-01-01', GETUTCDATE()) AS bigint)*1000

This worked great. A good site to check the values is www.epochconverter.com.

Monday, September 16, 2013

How to unzip files in Windows 7 and Windows 2008 natively

Photo by: Klafubra

Unix systems have had native unzipping programs for the last few decades that are easily accessible from scripts.  Now Microsoft has darkened the door of the party.
Instead of downloading 7zip or WinZip, you can now natively unzip files provided your server has the latest software.  You need .Net 4.5 and PowerShell 3.0, and then everything is unicorns and rainbows.
In PowerShell scripts to unzip file "$zipFile" into directory "$targetFolder" you can do this:
[System.Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem')
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipFile, $targetFolder)