New changes to Nomis I.T website

1 Dec

Hi all,

Spent a little time today trying out some new CSS3 commands to spin some sprite icons as you hover over them and move away again. This mainly involved using the new  webkit-transition and rotateZ CSS commands, have a look at the website home page to see this in action (http://nomisit.com). It’s very simple to get working and creates a great effect if used sparingly and in a subtle way.

Other activities today involved following up our recent email campaign with phone calls. One thing I did learn is that the next big wave of talented and great web developers is most likely going to come from “cousins” and “brother-in-law’s”, as they seem to be the only people who are being consulted on a new or refresh of a small company’s website! Of course, it’s only sour grapes, I’ll be back at it again tomorrow ;)

 

Playing HTML5 audio sound in a game on Safari 4+

27 Aug

Interesting situtation the other day with the new HTML 5 audio tag on the Safari browser. I was testing cross platform compliance for a HTML 5 game that I had written and noticed that on Safari for Windows (7) when a hit test was performed and a sound played, there was jerkiness and a small delay whilst the sound played and then the game continued. This occured on Safari 4.0.3 and after upgrading on version 5.1 as well.

The code used to declare the initial variable to allow sound was as follows:-

var soundClick = new Audio(“audio/click2.mp3″);

When the hit test is carried out and the sound is required to be played, the following code was invoked:-

soundClick .load();
soundClick .play();

This appears to be the correct way to use HTML5 audio within code to play a single sound with no audio tag declared in the HTML markup. Although this worked on IE9 and Chrome (no sound on Firefox – separate matter), didn’t work correctly on Safari. I then tried declaring an audio object in the HTML game markup between a hidden DIV like so with “preload” set to “Auto”:-

<audio id=”click2Sound” src=”audio/click2.mp3″ preload=”auto”></audio>

Commenting out the previous code (declaration and usage in the hit test) I simply inserted the following new code in the hit test instead:-

document.getElementById(“click2Sound”).play();

To my surpirse when playing the game in Safari there is now no jerkiness or delay and IE and Chrome still play fine as well! My disection of what is going on here is that using load() and play() requires the audio file to be loaded each time dynamically, and there seems to be some overhead in Safari when doing this as other browsers don’t seem to exhibit the same problem (caching audio file maybe?). However, when using the declarative audio tag in HTML markup with preload set, it appears that since I am only playing a single sound on that object (with no swapping of src) I get the effects of preload and Safari is happy to play the sound without any jerkiness in the game play. Strange.

All comments gratefully received on this as I would like to understand why this is :)

UPDATE: The problem with the sounds not playing in Firefox using the Audio element is that Firefox 3.6/4.0 doesn’t yet support .mp3 so a WAV fallback will also have to be provided in the Audio element.

Exam 70-547 (MCPD)

23 Mar

Well sat the 3rd exam in the web 2.0 series today and again no real problems posting a score of 975. Quite alot of the questions were easy for anyone who has designed, delivered, maintained and supported asp.net applications for a couple of years or more. This now earns me the coveted title of MCPD (web).

I am going to give it a rest for a while as I would like to get fully up to speed on the .Net 3.5 framework, in particular WCF Data services ADO.NET Entity Framework and Dyamic data as well as pulling in MVC and taking a look at developing with Silverlight. This may take some time to do properly so by the time I get around to doing exams again, .Net 5.0 will more than likely be out!

Training is good, but it doesn’t beat working and paying the bills!

Until next time.

Exam 70-528

23 Nov

Passed exam 70-528 recently with a score of 957/1000. This is the second exam on the Microsoft Web Client development track, the first being the mandatory 70-536 that I passed about 2 years ago.

The exam was relatively straightfoward I thought. I had 42 questions and around 2 hours 15 minutes to complete the test in. Once again I was intent on drawing mainly from my experience with .Net over the last 6 years having used 3 different versions in that time and both C# and VB. I therefore read very little beforehand. Of what I did read  there was the 70-528 Web Client Development Training Kit. This was a good book to cover the basic 7 stopics and to refresh ones memory. The practice tests are OK and bear some resemblance to the actual test. Didn’t bother with anything else this time such as Transcender, etc as didn’t find them that useful last time around.

There is plenty of free information on the Internet to test yourself with so go out and look for it, read it and try using it. It goes without saying, that the more programming you have done and the more you have read MSDN articles and help files over the years the easier the test will be.

Don’t bother trying to buy “guaranteed pass” exam information as you are only fooling yourself and will ruin the learning experience and the value it has on your programming performance. Exactly  how long do you think you will remember a bunch of random answers to some questions and how much good will it do you when you land that job or contract and are thrown in at the deep end?

Peace out.

Revenge of the underscore!

18 Oct

The problem

I had put a couple of web sites required for testing and proof of concept onto a newly built web server. The main web site used FORMS authentication to accept the users email address and password. The site required the use of JavaScript and cookies needed to be enabled on the web browser (Internet Explorer 7) and as far as I could see this appeared to be the case.

The main observation in trying to access the main web site using the web servers hostname was that I couldn’t  get past the LOGIN screen. I would be able to login in but then the details would be ignored and the LOGIN screen would be served again. However if I accessed the web site via its IP address it worked fine. I had also been informed that the tech’ chap had been having problems setting up the DNS entry for the server so I was stuck with accessing the web server through its hostname which was xxxxxxxxx_xxweb (name changed for obvious reasons).

First I tried pinging the web server using the server name containing the underscore and this worked fine.

I then tried tracert to the web server and that worked fine too (arrived in 7 hops).

I then employed the services of the web analyser tool (FIDDLER) between client and web server to analyse what was going on with session cookies, custom cookies, forms cookie, etc and the problem appeared to be that when accessing the server by it hostname (containing the underscore), the web server sent back the session cookie to the client browser but it was discarded by the client browser in subsequent requests back to the web server. This is the flow of messages that I saw:-

1. Client issues a GET request on page Login.aspx
2. Server responds with a status 200 message (it worked) and creates and attaches a session cookie used by ASP.NET
3. Client POSTS the form data to Login.aspx but DOES NOT attach the session cookie details (it should attach them)
4. Server authenticates the client and attempts to redirect to the relevant page after login
5. Client issues a GET request on the page being redirectd to but DOES NOT attach any FORMS authentication cookie or session cookie details (again it should do this)
6. Web server cannot now recognise the request as authenticated and so issues a redirect to the LOGIN page

The above sequence works fine if I use the IP address of the web server instead of the web servers host name.

I tried turning off Windows Firewall on the client machine and this made no difference. I also turned off the McAfee Anti-virus scanner and this made no difference (I also did the same on the web server before re-enabling again and no difference).

This for me points to something about the hostname being the problem and the way that the browser interprets responses from that hostname. If cookies were going to be a problem on the client browser they would not work when using the IP address.

I wasn’t at all sure whether there was some sort of group policy thing going on that restricted traffic for certain hostnames but having checked that out, this didn’t seem to be the problem either. So now to the solution.

The solution

OK after trying absolutely everything at the code and browser level I “went a googling” and came across the following :-

http://support.microsoft.com/kb/909264

It basically says that the computer name / hostname within DNS cannot contain an underscore as it is an illegal character. Is this why the tech guy couldn’t insert the relevant DNS entry? Seems likely to me.  The consequence of naming the host with an underscore is that every version of I.E beyond 5.5 automatically blocks cookies from a hostname or DNS name containing underscores but doesn’t tell you, doesn’t issue a privacy report icon or error icon so you have no way whilst browsing to know that it has taken this course of action.

Based on the investigation previously carried out, this fit the problem description perfectly so it would be possible to replace the underscore character with say a hyphen for the computer name (right click My Computer >> Properties >> Change Settings >> Change Name) and the DNS entry was inserted no problems. Voila.

Swapping local reports in ReportViewer

24 Jun

This post is about some of the problems I ran into when I wanted one instance of a ReportViewer control hosted on a web page to render more than one type of report dynamically where the decision about which report to host came from a user selection, a filter or possibly some other method available on the web form.

The code snippet given below is the minimum required to get this working and assumes a datasource is available from a prepopulated dataset…

<snip>…

  Dim reportStream As System.IO.Stream = _
                  New System.IO.FileStream(Server.MapPath("ProjectSummary.rdlc"), _
		IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Read)
  Try
     With ReportViewer1
       .Reset()
       .LocalReport.LoadReportDefinition(reportStream)
       'Set any parameters required
       Dim params(0) As ReportParameter
       params(0) = New ReportParameter("RunParams", paramValue.ToString, False) 'Non visible param
       .LocalReport.SetParameters(params)
       .LocalReport.DataSources.Clear()
       .LocalReport.DataSources.Add(datasource)
       .LocalReport.Refresh()
     End With
  Finally
     reportStream.Close()
  End Try

Some of the key points about the above code are as follows:-

  • To facilitate multiple worker processes having access to the report definition file at the same time it is important to do two things. The first is to set the correct FileAccess and FileShare attributes when opening the report definition and the second thing is to close the stream as soon as it has been used, which in turn should release the file handles by calling Dispose() internally. Experiment and see but this code works well for me!
  • The .Reset method call is required to reset the report viewer internal controls

Hope it helps you out of a snag!

Installing SQL Server 2008 client tools, what a pain!

21 Apr

I am working for a different client now, and so have a different worksation build. Having had a quick poke around the development machine as one does, I noticed Visual Studio 2008 Standard edition, as well as Visual Studio Express Edition (VB) and the Express edition of Web Developer.

On the SQL side there is SQL tools for connecting to SQL Server 2005 and a link to the SQL Server 2008 Installation Center where SQL Server 2008 tools probably once were but are no longer. What I wanted to do was install SQL Server 2008 Client tools (Management Studio primarily) to allow me to connect to the SQL Server 2008 Database engine on a different server without having to physically log onto that server as I had been doing up until that point.

Figuring this was a simple enough task to do in half an hour, I got hold of the SQL Server 2008 Standard edition installation media and proceeded to install client tools. This went well up until the point I hit a rule error:-

Rule “Previous releases of Microsoft Visual Studio 2008″ failed

If you request further details for the error you soon realise that the error is referring to the version(s) of Visual Studio being RTM versions and not the minimum Service Pack 1 required by the SQL Server 2008 installer. I immediately sought to clarify this with installation documentation and on MSDN and it turns out that if you are installing any of:-

  • BIDS
  • Management tools (Basic or Full version)
  • Integration Services

then SQL Server 2008 requires that ANY existing versions of Visual Studio 2008 be first upgraded to SP1 BEFORE attempting the client tools install. The order for doing this is also key, so start with the RTM version, SP1 for this is available here.

Next, if you have “Express” versions of Visual Studio 2008 installed on the same machine you can either Remove them using “Add/Remove Programs” in Control panel (this is what I did), or you can wait a very long time to download each SP1 for Visual Basic, Visual C++, Visual C# and the Express edition of web developer hereNOTE: if Express editions are installed on your machine they WILL ALL NEED to be upgraded to SP1 BEFORE the SQL Server 2008 client tools will install!

When all SP1 upgrades have been done, restart the computer and repeat the SQL Server 2008 client tools install (using the standalone option (or add new features) within the SQL Server 2008 installer).

Hope that saves some time. Having just written this out, I also came across a useful link from the SQL Server team available here.

Happy programming!

Default namespace usage for OPENXML in SQL Server 2005

9 Jan

A little different this time but came across a problem the other day where I had a block of XML as text in SQL Server and I wanted to shred it using OPENXML. The document contained a default namespace, as per the sample given below:-

<launchparam xmlns=”uk.co.alliance-leicester.mortgages”>
   <dipconv>
       <callvisitid>2</callvisitid>
       <options>trigger=1</options>
   </dipconv>
</launchparam>’
 
I had not particularly noticed that “sp_xml_preparedocument” had a third parameter for namespaces and even when I did, various combinations I tried to no avail. The final combination that worked involved defining the namespace in “sp_xml_preparedocument” but also remembering to include the namespace tag prefix in the OPENXML command and the associated WITH portion as per the example below. Pay particular attention to all the places where the xml namespave tag prefix(“tag” in this case”) is used to get the query to work properly.

DECLARE @hdoc INT
DECLARE 
@xmlText NVARCHAR(4000)
SET @xmlText = ‘<launchparam xmlns=”uk.co.alliance-leicester.mortgages”>
<dipconv><callvisitid>2</callvisitid><triggeroption>trigger=1</triggeroption></dipconv></launchparam>’

 EXEC sp_xml_preparedocument @hdoc OUT, @xmltext, ‘<launchparam xmlns:tag=”uk.co.alliance-leicester.mortgages” />’

SELECT * FROM OPENXML(@hdoc, ‘/tag:launchparam/tag:dipconv’,2)
WITH ([tag:callvisitid] INT, [tag:triggeroption] NVARCHAR(100))

EXEC 
sp_xml_removedocument @hdoc

tag:callvisitid tag:triggeroption
—————— —————————————————————————————————-
2                            trigger=1

 

(1 row(s) affected)

Tags:

Happy Hallowe’en from Melton Mowbray, Leicestershire, England

1 Nov

Here is a selection of callers to the headquarters of NOMIS I.T Ltd this evening….enjoy and happy Hallowe’en!

Adding IIS to Windows Vista Business and Ultimate (and making it stick!)

21 Aug

The other day I had cause to install IIS on Windows Vista Business as I needed it for SQL Server Reporting Services. So I installed IIS through “Programs and Features / Turn Windows Features on or off” in the usual way.

Several reboots later, up pops a message reporting an “error wth the configuration” and IIS is rolled back. I tried several different settings within IIS thinking that somehow I had selected a “bad combination” of settings but to no avail.

In the end it was pretty simple to resolve this issue. At times like this I usually ask myself “Am I as up to date as I can be with my software?” The answer turned out to be NO as I had disabled Windows Update previously whilst troubleshooting another problem and hadn’t re-enabled it again so hadn’t taken SP1.

I downloaded SP1 for Windows Vista and once applied I repeated the IIS installation and all was well. The moral of the story, take a stable service pack when it’s available as it saves times trying to troubleshoot weird problems!

Tags: ,

Follow

Get every new post delivered to your Inbox.