Skip to content

How to embed video into an ASPX page

Someone on ASP.NET forums if you can embed HTML5 videos into an ASP.NET ASPX page. 

The simple answer I gave is yes as long as IIS supports the correct file type for HTML5 videos.

See my answer below: - 

Its most probably that IIS has not been configured with the correct MIME types like OGG.

See this page for details on how to configure IIS to allow these MIME types.

On the local host you also need the MIME types are set up in your .htaccess file. You may need to add the following to enable .ogv

AddType video/ogg .ogv

Gradient not working in Safari Browser

The other day my colleague discovered that some of the gradients applied to a JQuery Mobile button were not working on the Safari Web Browser at all. After researching this, according to the official Apple Developer web page it states: –

Note: Recent drafts of the W3C proposal have simplified the syntax. This chapter describes the most recent implementation shipping in Safari. You should expect Safari’s syntax for gradients to continue to change as the W3C standard evolves. While new syntax is expected, the existing syntax—and prior syntax—should still work.

The -webkit-linear-gradient and webkit-radial-gradient properties require iOS 5.0 or later, or Safari 5.1 or later on the desktop. If you need to support earlier releases of iOS or Safari, see “Prior Syntax (-webkit-gradient).”


To fix this for my CSS styling, you just need to add the following to apply the gradients to the JQuery Mobile button like so: –

.ui-page-theme-a .ui-bar-inherit.ui-header {
background: #084596;
background-image: -webkit-linear-gradient(top, #084596, #3165CA);
background-image: -moz-linear-gradient(top, #084596, #3165CA);
background-image: -o-linear-gradient(top, #084596, #3165CA);
background-image: linear-gradient(to bottom, #084596, #3165CA);

See the first line of background-image, this should fix the problem for Safari. Never was a fan of Safari!

Request format is unrecognized for URL unexpectedly ending in …

If you receive the following error when calling a web service you created as followsRequest format is unrecognized for URL unexpectedly ending in” , the likely reason is that you have configured the web service to work in AJAX/JSON but not for the traditional http post and get, so to amend this, you simply add the following tags in the web.config file.

            <add name="HttpGet"/>
            <add name="HttpPost"/>

Converting a DateTime Field in SQL to NVARCHAR

Because MS SQL doesn’t automatically convert a DateTime field in a useful format in CSV. A useful solution to get around this is to use this function SELECT CONVERT(VARCHAR(20), GETDATE(), 100). It converts a datetime field in the format  Mon DD YYYY 1
HH:MIAM (or PM) e.g. Jan 1 2005 1:29PM 1

1 To make the month name in upper case, simply use the UPPER string function.

You can do this for a data column like so SELECT CONVERT(VARCHAR(20), [ColumnName], 100)

Hope that helps!


How to export comma delimited data to csv including commas in the data

I have been meaning to write this post for a long while so here is a very good short tip on how to do this.

If you wanted an automated script to export data from a database onto a CSV file, you can easily do this with the built in SQL Server Command – sqlcmd in the command prompt. I usually write the export as follows : -

SQLCMD -S DB-SERVER -E -Q "set nocount on; set ansi_warnings off; SELECT [Column1] As TextHere, [Column2] As NormalColumn FROM [Database].[dbo].[Table]" /o output.tmp /s "," -W

The second command converts the tmp file to csv

type output.tmp | findstr /V \-\,\- > output.csv

However, the problem lies in that if you have a comma (,) in any of the columns in the data, the sqlcmd will still take into account that comma as a delimiter and would split that data into two, for example if the address column had a column, it would split the address into two columns! Not exactly what we want. After reading StackOverflow on a few forum discussiosn, the solution was to convert the column containing the comma to varchar(MAX) – as a string with inverted comma quotes surrounding the outside. My thinking is to easily append those either side of the string and cast it as a nvarchar(MAX). The results were that it worked perfectly! Here is the solution: –

SQLCMD -S DB-SERVER -E -Q "set nocount on; set ansi_warnings off; SELECT '""' + cast ([Column1] as nvarchar(max)) + '""' As TextHere, [Column2] As NormalColumn FROM [Database].[dbo].[Table]" /o output.tmp /s "," -W

The key thing is that /s "," sets the column seperator to ,


Changing the System Volume In Windows Phone 8

Firstly, a Happy New Year to all, I will continue to post .NET questions and answers here even though my main focus is looking at new Javascript frameworks and mashups on my other blog, feel free to visit.

Secondly I decided to look at StackOverflow once more, and someone on there asked the following question: -

“Up until now I thought that changing the system volume from your app is impossible, until recently a new app called Quite Hours ( actually did just that in a very neat way.

Does anyone please know how to do that programmatically? I tried using the MediaElement or the xna MediaPlayer and the backgroundAudioPlayer and nothing worked. Any help would be appreciated! Thank you!”

The answer is technically NO, there is no current API for this for controlling the system volume in Windows Phone 8. You can however control the volume in the elements of your application (via the classes MediaElement, BackgroundAudioAgent). You can also control the volume on sound effects of your application using XNA API. See

2013 in review

The stats helper monkeys prepared a 2013 annual report for this blog.

Here’s an excerpt:

The concert hall at the Sydney Opera House holds 2,700 people. This blog was viewed about 12,000 times in 2013. If it were a concert at Sydney Opera House, it would take about 4 sold-out performances for that many people to see it.

Click here to see the complete report.

Many thanks for reading guys! Be sure to check out my website and the blog in the coming months. Happy New Year!!


Get every new post delivered to your Inbox.

Join 417 other followers