Wednesday, 16 April 2014

Spam

I have a strange fascination with Spam, its something that really intrigues me. I felt like I just had to post the following bit of spam I received. It didn't ask me to click to verify my bank account details, there was no attachment (with a virus) and it doesn't seem to be trying to sell me anything. It appears to be a combination of random sentences taken from Wikipedia.

It makes so little sense that it actually made me smile.

"After we wrote it, we thought it sounds just like a Blake Shelton song. Also Puerto Cabello was at that time under Dutch control. It is simply a short length of material worn around the thighs rather like a sarong."

Tuesday, 15 April 2014

MySQL migration to MSSQL

I use a mix of database servers depending on what application / project I am working on, normally it will be either SQL Server (inc Express) or MySQL.

I find working with SQL statements in SQL Server Management Studio to be much easier than creating statements on the fly, so its useful to have a copy of the MySQL databases on my MSSQL server, previously I have manually created a new database with the tables / structure that I need to create my SQL statements.

That all changed when I came across Intelligent Converters (http://www.convert-in.com/)  They have a great bit of software that will copy databases from just about anything to anything, in this case MySQL to MSSQL (http://www.convert-in.com/sql2mss.htm) The trial version of the software is limited to copying only 5 records per table, that's perfect if you just want the structure of the tables, for $49 you can have the full version of the software and for $99 you can get the MySQL Migration Toolkit which will convert any data source to or from MySQL.

SQL Backup And FTP

Since moving to SQL Server 2005/2008 (including SQL Express at home) I've been using SQL Server Management Studio to create a daily database backup. In my home environment my databases are very small (mostly development projects) so I place these backups into a folder than is configured to synchronize with the cloud. I'm not too worried about full server backups as the database server has minimal configuration done to it. In my business environments I have daily backups that backup the full system (including my SQL backup files). 

Despite using the Management Studio for nearly 9 years now I know very little about it, so perhaps it has the functionality built within it and I just don't process the knowledge (nor did my search results) on how to backup SQL databases to a network location, I also wasn't really in the mood to go fiddling with scripts etc.

I came across a great bit of software called SQL Backup And FTP (http://sqlbackupandftp.com/) 

The most basic (free) version of the software has a lot of functionality and setting up a job is easy.  

Friday, 11 April 2014

Add Header logo / image to blogger

Not sure how I missed this when I created this new blog but adding an image to your blog header is a lot easier than I first thought. I searched for how to do it and a number of people suggested adding a image widget but it turns out Blogger has already provided the functionality to do this.

1) Select Layout
2) On the header click Edit
3) Select your header image and options

Thursday, 10 April 2014

GoDaddy PHPMailer Relay problems

This has been very frustrating, if you search for GoDaddy and PHPMailer you'll find loads of posts about how PHPMailer needs to be configured in order to work with GoDaddy's hosting.

I tried using some of the configuration information I found online but I wasn’t having any luck. I kept getting “Error: The following From address failed:” despite trying several different addresses (including valid addresses that I had setup on GoDaddy’s cPanel)

I finally came across Aravind is Online blog which nudged me in the right direction (http://aravindisonline.blogspot.co.uk/2012/01/phpmailer-with-godaddy-smtp-email.html)

For completeness.
You cannot use an external host to relay email messages. You must use the following host: relay-hosting.secureserver.net  

I setup a mail user specifically for PHPMailer (I am hosting a subdomain so all my email services are elsewhere)

Use PORT 25 (numerous guides suggest 465)


Set SMTP Auth to true, Aravind’s guide suggests to set this to false, however this didn’t work for me.

Wednesday, 9 April 2014

US / UK Date format reverse in Excel

This problem has been bugging me for 3 days now; I am retrieving a date time from SQL. I have verified that the date is in my required format dd-mm-yy, and I have tried a few different ways of selecting the date just to be sure DATEPART(day, fieldname) , DATEPART(month, fieldname), I have even tried dd-MMM-yy.

If I display the date on a form or in a messagebox it displays fine, the moment I put the date value into an Excel cell it flips the day and month around. Originally I was going to work around the issue by prefixing all my dates with a single quote ‘ so that Excel treats them as being strings, however the end user wants to sort on some of the date values and it won’t work quite right as a string.


After banging my head against the wall for 3 days I finally came across the DateValue(date) function! Figured I’d share the solution to this frustrating little problem.

Wednesday, 2 April 2014

Excel 2010 .xlsm File hangs when opening

I've been writing some VBA macros to improve an Excel workbooks functionality. I was modifying a Sub Routine and just in case I made a mistake and need to revert back to it I made a copy and appended _backup to its name. As it happens I decided I preferred the original way the sub routine worked so I restored it (deleted the original routine) and then renamed the _backup. Turns out I had accidentally copied the routine twice (VBA didn't warn me of this). Thinking everything was fine I saved and closed my workbook, when I came back to it a few hours later I was unable to open it, Excel 2010 just sat at 100% without allow me into the workbook.

I found a few suggestions online to fix this and none worked, so here's what I did to get mine working.

Change the extension of the file from .xlsm to .xls and then open the file. I got prompted that there was a file type mismatch (or something similar) and it also gave me a complication error, something along the lines of problem with sub routine. As soon as I saw the sub routine error I knew where my coding problem was, corrected it and then saved the file back as .xlsm.

I hope this helps someone out, had me in a panic for a few moments.