Tuesday, 13 March 2012

Jquery ajax call to WCF stops working when upgrading to jquery 1.7.1

This had me puzzled for ages. When upgrading the version of jquery we use from 1.5 to 1.7.1 so that we could use Bootstrap popovers, any calls to our WCF .NET service would fail with a blank error message returned.


What I found was that within out Ajax call we had set:


jsonp: "callback", dataType: "json"

In 1.5 this worked fine, however in 1.7.1 it had noticed that the response type was supposed to be jsonp (JSON with padding) and thus bombing out with a mismatch.


Changing this to the correct format of:


jsonp: "callback", dataType: "jsonp" 

Fixed the problem.

Tuesday, 22 November 2011

Wordpress php.ini settings to load external url

A friend of mine had an issue with a vanilla wordpress install that he had that was using a premium theme.

Upon loading the theme, the page showed many errors relating to servers security setting would not allow the loading of data from external urls.

The information we were given was to set the php.ini in the directory of the calling page, so that the setting could be overridden - so we did, no change.

The solution is that the php.ini file in the wp-admin folder needs setting, not in the calling page, because the calling page in this case is a settings page itself that is being imported into the wp-admin/index.php file.

The settings in php.ini are then:

allow_url_fopen = 1
allow_url_include = 1

Wednesday, 4 May 2011

PHP .htaccess redirect

I have been helping a neighbour of mine who is an Optician in Spalding, and he was trying to make sure that when people were searching for "Opticians in Spalding" they would make sure that the old pages on his website that were already listed in Google, would still link through to his new site that he's spent ages on.

Being a windows server man, I know how to do this in IIS, but as his new website is hosted on a linux server, it needed to be compatible with that. So anyway, I found out that you can do 301 redirects on Apache using a .htaccess file.

In this case, it was real simple, create a blank file called .htaccess and the place an entry for each for each file that needs redirecting, i.e:

Redirect 301 /HTML/Consultations.htm http://www.molsom.co.uk/eye-tests.htm

Excellent, and I now know that visitors to my local Optician in Spalding will still get there from any old bookmarks!

Tuesday, 1 March 2011

EventType clr20r3 system.io.filenotfoundexception

I had this error today when trying to launch a .net application on a remote host machine. The file io exception threw me somewhat as it made me think that the issue was with loading a config file.

In fact the culprit of this error was not the config files, it was in fact missing dlls that are normally referenced from the GAC.

As I had no idea which dll it didn't know about, I just set each dlls reference to say copy to local = true, and then deployed the whole contents.

Wednesday, 22 December 2010

List.Sort() alphabetically

I was faced with the challenge today of sorting a list of objects, where one of the properties was a string. My objects were lists of keywords, and I wanted to sort the keywords alphabetically.

I came across some example of lambda expressions, and found that rather than having to write complicated sort methods for my class, I could just do the following:

keywords.Sort((a,b) => String.Compare(a.keyword, b.keyword)):

Awesome, works a treat!

Wednesday, 24 November 2010

SQL Server could not spawn FRunCM thread. Check the SQL Server error log and the Windows event logs for information about possible related problems.

I encountered this error this morning when my SQL Server instance wouldn't start after I made some connection changes yesterday. I had to make the changes because a needed an ODBC connection, and that would only seem to work if I configured it to use named pipes.

After checking the logs, I received the error "SQL Server could not spawn FRunCM thread. Check the SQL Server error log and the Windows event logs for information about possible related problems.".

So, I went back to undo each change I had made, and noticed that the last change I made was to enable VIA as a protocol for my SQL Server instance. Disabled that, and hey presto, SQL Server now starts fine.

The strange thing is that enabling VIA in my SQL Express instance didn't seem to cause the same issue on that server though.

Tuesday, 27 April 2010

asp.net checkbox modalpopupextender checkbox doesn't check or uncheck

There is an apparent bug in asp.net that when you have a checkbox inside a panel that is acting as a modal popup with the modalpopupextender, that when you try to check or uncheck it, it doesn't work!

I found the following thread, and it seems that quite a few people have had this very same problem.

From reading many posts, it seems that this happens if you do not set the TargetControlID property of the extender correctly.

However, this becomes an issue if you have multiple links, all that show the same extender. To get round this, you can simply create a fake button: