Tuesday 1 April 2014

javascript not working when client side validation used on mvc 4 page in Internet Explorer



The problem is a little bit involved so I'll try summarise.

Back when IE8 was released, a decision was made by Microsoft to default this setting in Compatibility View Settings to checked: "Display intranet sites in Compatibility View" Compatibility view is essentially the IE7 layout engine. This decision was made so that Enterprises with internal websites did not find the sites suddenly broken with the installation of the new browser. Now that we are on IE10 and IE11, Microsoft have stuck with this decision, so by default intranet sites effectively use IE7. Trusted sites are also considered to be on the intranet. The only exceptions to this are localhost or the loopback address (127.0.0.1) as Microsoft decided designers and developers might want to view pages they were developing in the layout engines of the newer browsers.

So, in short, the jQuery code used in the client side validation is not supported by the IE7 layout engine, hence the javascript is crashing. If you view this page on localhost (where the newer layout engine is used) or firefox or chrome it will work.

Two possible solutions for this are:

1) Display intranet sites in Compatibility mode can be unchecked. This can be done on a machine by machine basis or by group policy.

2) Adding these lines to your webconfig:

    <system .webServer>
    <httpProtocol>
      <customHeaders>
        <add name="X-UA-Compatible" value="IE=Edge /">
      </customHeaders>
    </httpProtocol>
  </system .webServer>

Wednesday 4 May 2011

I'll give £100 to the first person who can do this


Way back in October 2009 I blogged about a site I'd been working on, Caesars Arcade, which had a challenge game on. If someone beat the challenge they would get £10 free amazon vouchers. I was sure that someone would beat it, if only by chance, but after over 1000 games started still no-one has beaten the challenge. Well, I'm sure it must be beatable so I'm going to offer to pay not £10 but £100 in amazon vouchers to the first person who can beat the challenge. All you have to do is finish the game with all 64 pieces in your colour. Surely someone must be able to beat it. It's free to try so have a go!

Thursday 18 March 2010

Invading Phase I


The large version of Invading Phase I is now complete and has been released onto an unsuspecting world. Here are some of the places it can be found so far.

Mashooo

SilverLightClub

GameJolt

CaesarsArcade

Go and have a try. Hope you enjoy it.

Thursday 18 February 2010

Invading Phase I mini





A long time ago, I wrote a version of Galaxians in C++ and DirectDraw. I was pleased with it at the time, but looking back, the gameplay wasn't brilliant. Later I revisited the code and converted the game to Java, vastly improved the gameplay, shrank the graphics and got it working on two mobile phones. Again, I was pleased, this time it was a good game. Again, it got put in mothballs. Now I'm using silverlight I thought I would convert it to silverlight (which actually took far longer than I thought it would) and do a big version again, this time for websites. The mini-version is now complete and the big version is also very, very nearly there (just some graphics to go, due in the next few days). The mini-version is quite good in that it can fit on the sides of websites and blogs, adding more interest to the site. I've put it on mine now (as you can see on the right) and I'd be more than happy for anyone else who wants a free game on their site to link in the page with the game on.


Here's some code to do it.

<iframe
src="http://www.caesarsvault.com/CaesarsArcade/InvadingPhaseI.html"
height="176" width="120" marginheight="0" frameborder="0"
marginwidth="0" scrolling="no">
<p>Your browser does not support iframes.</p>
</iframe>



It's 120x160 pixels in size and it's only 88Kb so it's superfast for downloading.

Let me know if you use it, I'd be curious to know where it goes.

Wednesday 11 November 2009

The INSTANCESHAREDWOWDIR command line value is not valid. Please ensure the specified path is valid and different than the INSTANCESHAREDDIR path

Bit of a long title, but it's taken me a while to figure this one out, so I thought I'd make a note of how to work around it in case it's useful to anyone else.

I bought (rented) a dedicated server with SQL Server Express 2005 installed as part of my development process for Caesars Arcade. I figured I'd replace SQL Server Express 2005 with 2008, seeing as it's free and should do fine for what I want.

However, when I tried to install SQL Server Express 2008 through the Microsoft Web Installer by clicking on one of the "install" buttons on the SQL Server Express web page it tried to install and failed. The log stated:

Overall summary:
Final result: SQL Server installation failed. To continue, investigate the reason for the failure, correct the problem, uninstall SQL Server, and then rerun SQL Server Setup.
Exit code (Decimal): -2068578304
Exit facility code: 1204
Exit error code: 0
Exit message: The INSTANCESHAREDWOWDIR command line value is not valid. Please ensure the specified path is valid and different than the INSTANCESHAREDDIR path.

The solution seems to be this:
Just below the table on the SQL Server Express web page that contains the "install" buttons is a statement, "If you have Express already installed, are looking to embed SQL Server Express into an application, or need guidance on whether you should perform a custom install, click here."

Click on the "click here" which takes you to a Microsoft blog with a table under the title "Customize". Select the version of SQL Server you want and download it to your computer. When it is downloaded, double click it. It will extract lots of files and, after a short time, open a window titled "SQL Server Installation Center".



Normally, you would click on an option in this window to start the installation, but DON'T. Instead, leave this window open (closing it will delete all the files we just extracted and we need those to run our installation) and do a search for "setup.exe". It should be in a temporary directory somewhere, in my case it put it into D:/random_digits/ where random digits is a long list of letters and numbers. It's a different generated directory everytime you run the extractor.

In this directory, create a shortcut to the setup.exe file and add these switches to the "target" command (arrowed in the below diagram):

/action=Install /INSTALLSHAREDWOWDIR="C:\Program Files (x86)\Microsoft SQL Server (x86)" /INSTALLSHAREDDIR="C:\Program Files (x86)\Microsoft SQL Server"

so that you have something like:
D:/eafd3324ee23/setup.exe /action=Install /INSTALLSHAREDWOWDIR="C:\Program Files (x86)\Microsoft SQL Server (x86)" /INSTALLSHAREDDIR="C:\Program Files (x86)\Microsoft SQL Server"



Now double click the shortcut to run the installer program, still leaving the "SQL Server Installation Window" open so that the files don't disappear.

Go through all the steps and when you get to your feature selection page it should look like this the image below. When you go past this page, it shouldn't stop you with the warning about the directories.



Once you've put all your options in, you should just be able to sit back and wait (for a long time) while it installs SQL Server Express.

One final point. I don't know if it's important, but I uninstalled SQL Server Express 2005 before going through the installation of SQL Server Express 2008.

Friday 30 October 2009

Caesars Arcade


I've been working hard this week. Helping out on a site called Caesars Arcade. It's an online games site based on Microsofts silverlight platform. It's got some good, pick up and play games on there and also they're trialing a "skill with prizes" game, if you're good enough at playing it, you can win Amazon vouchers. So far, no one's beaten it, but I'm sure it's just a matter of time.....

Friday 2 January 2009

If lack of RAM isn't the reason the PC is slow

In my last post I discussed how to check to see if your computer is running low on memory (RAM), causing it to use the harddrive (Virtual Memory) and slow down. If you have established that your computer has plenty of RAM, but the computer is still slow, then the next step is to find out what is taking up your processing power.

I've come across a few things that can make computers slow down. Here are some examples and a hint to figure out what is going on with your own computer.


Firstly, Anti-Virus and Anti-spam. I run AVG for anti-virus and Windows Defender for anti-spam on my computer. On start up, one or both performs some kind of test that slows everything down. This is only temporary. Sometimes, the anti-virus or anti-spam is set to do a test of the files on your harddrive. This will slow down the computer while it proceeds as the computer is busy reading files from the harddrive and checking them for malicious code. Depending on the settings of the anti-virus or anti-spyware and the power of your computer, this can be more of a problem on some systems than others. Everything returns to normal once the test is complete. If you intend to play a 3D game on your computer, it is sometimes a good idea to make sure no automatic test of this kind is likely to begin. Playing a game on some computers when the anti-virus kicks in can cause a sudden drop in frame rates while the two battle for system resources.

Harddrive defragmentation program and other house keeping software is another possible cause of slow down. I did some work on an Acer once, that was preinstalled to do a defrag of the harddrive on every startup. This made the computer pretty sluggish for the first five minutes. The option was to turn the defrag program off, or simply to leave the computer for the first five minutes after startup to do the housekeeping. As the computer was just for home use, the owner opted to leave it as it was.

If your not sure what is causing your computer to go slow, here is a suggestion for getting a hint. Start the task manager program by clicking the "start" button (on Windows XP) and click on "Run...". Type "taskmgr.exe" in the box that opens and click "okay". In the task manager window that opens click on the "Processes" tab. Click on the letters "CPU" at the top of the third column. This will order the processes (programs) that are running by the amount of processing time they are taking up (as a percentage). Clicking on "CPU" again will order them in the opposite direction.




















If you're not doing much, "System Idle Process" should happily be taking up most of the CPUs time. If something else is at the top of the list, it might be worth having a google to see what that process belongs to. Unfortunately, a certain amount of experience can be needed to diagnose a problem from this result, but at least it gives you a place to start.