Thursday, 13 September 2012

Virgin mobile UK settings for MMS on Pre3

Struggled with getting MMS on my Pre3. Virgin Mobile helpline unhelpful :(

Anyways, by distilling the info from several sites, I sussed it out. Here it is:

  • Open phone app
  • Preferences & Accounts
  • Scroll down to Network
  • Switch Manual Settings on
  • Tap Edit Network Settings
  • Tap MMS APN
  • Set MMS APN to goto.virginmobile.uk
  • Set USERNAME to completely blank
  • Set PASSWORD to completely blank
  • Under MMS PROPERTIES 
    • Set MMSC to http://mms.virginmobile.co.uk:8002
    • Set MMS PROXY to 193.30.166.2:8080
    • Leave MAX SIZE at 300
  • Tap Change Settings
And that should be it!

Monday, 13 August 2012

SSIS expression to generate date usable in file names

I finally cracked how to generate the date in an SSIS package in the ISO format of YYYYMMDDHHMM. By including this in file names, e.g. when archiving, it keeps them in logical order when sorted.

Here's the magic expression part:

SUBSTRING( REPLACE( REPLACE( REPLACE( (DT_WSTR, 30)GETDATE(), "-", ""), ":", ""), " ", ""), 1, 12 )

This will produce 201208131830 at 18:30 on 13/Aug/2012. The final 12 in the expression is used to chop it down to the minute. Use 14 if you need it down to the second.

SSIS SMTP Connection Manager setup

After fighting with setting up an SMTP Connection Manager  connection, testing various domain names in the SMTP Server property, it suddenly dawned on me:

localhost

is all you need! Plus ticking the Use Windows Authentication in my case.

Wednesday, 27 June 2012

MS Sql Server Queries: Grouping with ROLLUP or CUBE

Working on a GROUP BY query I decided I needed ROLLUP. That bit is pretty easy:
SELECT X, Y, COUNT(*) AS vol 
FROM Tbl 
GROUP BY X, Y WITH ROLLUP
The sub-total lines contain NULL in the X and Y columns. This all applies to CUBE as well.

However, in this case, X and Y contained NULLs, and that makes the output confusing. I remembered there was a way to change the X and Y values in the sub-total lines and had to google for it. Here is the syntax as a reminder to self!

SELECT   CASE WHEN (GROUPING(X) = 1) THEN 'ALL' ELSE X END AS X,
         CASE WHEN (GROUPING(Y) = 1) THEN 'ALL' ELSE Y END AS Y,
         COUNT(*) AS vol
FROM     Tbl
GROUP BY X, Y WITH ROLLUP

The GROUPING(colname) function returns 1 when on a sub-total line and 0 when on a data line.

One little caveat! Where I have put the value 'ALL' - that needs to be the same datatype as the column you are testing. Alternatively, convert/cast the column as a string.

A more standards-compliant syntax for the GROUP BY ... ROLLUP clause, which is supported by later versions of MS SQL Server, is:
GROUP BY ROLLUP(X, Y)

Reminder:
ROLLUP gives you sub-totals and a grand-total based on the GROUP BY hierarchy.
CUBE gives you sub-totals and a grand-total based on every possible combination in the GROUP BY list.

Wednesday, 30 May 2012

Ubuntu apt-get - packages not found

We had a problem when installing a bespoke Ubuntu 10.04 Server LTS setup via shell scripts we had written. Some of the packages were not found. This mainly occurred on virtual dedicated servers. We had previously installed on more than 20 normal dedicated server ok.

Turns out that the /etc/apt/sources.list had only a very limited list on the ones that didn't work. I copied the file from a normal server that was ok, and re-tried our scripts. That solved the problem.

Not too sure if you could build up other problems doing this, so always save a copy of the original file somewhere safe before changing.

Examples follow after the break...

Friday, 23 March 2012

MySql Replication - Error 1045

Fighting with a simple test-bed MySql replication between 2 Ubuntu 10.04 LTS servers.

It turned out you need to use the domain name, not the IP address when specifying the MASTER_HOST in the following MySql command on the Slave:

CHANGE MASTER TO MASTER_HOST='192.168.0.100', MASTER_USER='[username]', MASTER_PASSWORD='[password]', MASTER_LOG_FILE='mysql-bin.NNNNNN', MASTER_LOG_POS=N;

Friday, 9 March 2012

VWD + ASP.NET + MySql + parameterized queries

As you'll know, MS-SQL-Server uses parameter names beginning with '@' in parameterized queries, whilst MySql uses a single '?' for each parameter.

Whilst struggling to get Visual Web Designer 2010 Express to recognise parameterized MySql queries, I hit on the following technique:

VWD 2010 Express + MySql Connector/Net

Anyone trying to link the MySql Connector/Net connector into an ASP.NET site using the (free) Visual Web Developer 2010 Express?

Well, I found out the hard way that it is not compatible. Installed the Connector/ODBC version, and I was able to connect successfully.

From dev.mysql.com: "Note that MySQL Connector/Net does not currently support Express versions of Microsoft products, including Microsoft Visual Web Developer."

Tuesday, 6 March 2012