Posted by Sébastien Lachance with Comments (0)
{"ExceptionDetail":{"HelpLink":null,"InnerException":null,"Message":"The token '\"' was expected but found '''.","StackTrace":" at
I was getting this error when doing an Ajax call to a WCF service with jQuery.
There could be many reasons for this, but one possible fix is to use double quote instead of single quote. So changing :
data: "{'Id': '12'}"
to
data: '{"Id": "12"}'
will most likely resolve your problem.
Edit: I’m ashamed of myself for letting this post slipped my mind. I have completely forgotten to post it here.
I have been watching some Mix presentation this week and found some of them to be very interesting.
The letter “L”. Really, nothing more.
One of my great resolution of the year is to learn by teaching. Today I watched the Day 9 videos of the 14 days of jQuery. In one of them, Paul Irish talked about $.proxy() and I did not totally understood what was going on.
The jQuery API definition is : Takes a function and returns a new one that will always have a particular scope. Well, I could read this all day long and I am sure It couldn’t be clearer without an example.
Here is the problem the “proxy” function is trying to solve.
var me = { name: "Sebastien", blogging: function () {alert(this.name + " is blogging") } }; $(function () { me.blogging(); //will display : Sebastien is blogging $('#clickMeButton').click(me.blogging); //will display : is blogging });
As we can see, on line 7, the function is called inside me (now that I think of it, this instance name is not perfect). But when called as the button click handler, the this keyword is now representing the button. And as the name property is not set on the button, nothing is displayed. Easily provable with :
$('#clickMeButton')[0].name = "Button"; $('#clickMeButton').click(me.blogging); //will display :Button is blogging
This could be awkward if not the desired behaviour. Let’s see how the jQuery team resolved that problem.
$(function () { me.blogging(); //will display : Sebastien is blogging $('#clickMeButton').click($.proxy(me, "blogging")); //will display :Sebastien is blogging });
By calling the proxy method with the instance and the desired function, the context is now set to that instance. Resolving that particular problem. The method takes the instance and the name of the function as a string or could also be called by using :
$('#clickMeButton').click($.proxy(me.blogging, me));
I hope It helped you understand $.proxy(). I can already see where I can apply this knowledge right now.
I’ve been across a couple of ways that you can increase your search engine visibility. I’m not an SEO expert. I’m merely exposing what I’ve learn in the last months. If you don’t know, I had a drop of 50% of traffic from search engine when moving from Wordpress to BlogEngine.NET. Mostly due because of me. I have now deployed my blog with a lot of improvements on keywords, titles and descriptions. But there is some other ways your site or blog can be affected. Here are some tips I’ve used to optimize my search engine visibility.
Creating a sitemap for Google is like telling Google everything you have on your website. Some page may not be accessible via normal crawling so it’s a way of telling Google everything that should be indexed.
This will help you see your site with another eye. The best online analysers I’ve found are Website Grader web site and SEOmoz. Both are good looking and provide useful tips to increase your web site traffic. If you are using IIS, another tool to check out, is the SEO toolkit.
I’ve taken this advice from the 21 Tactics to Increase Blog Traffic post and it’s not as bad as it seems. I, myself, did fall for this one. Many times I’ve not subscribed to a blog, because of its lack of comments.
Many people think it is not as important as it appears, but I think the h1 tag is utterly important. The h1 tag should be used to put emphasis on the content of the page. I’ve used them primary to contain a relevant title for the page. Use h1 to h6 tags wisely to properly separate the content of the page, like a book. Think about reader without a visual browser (usability).
Removing broken links prove to search engine that you care about your content and their will re-crawl your site. It also means that you care about your readers and it’s a good thing. Other that with the SEO toolkit, you can use the W3C Link Checker to find any broken links.
Probably the greatest advice ever. Your site is nothing if you don’t have great content that is relevant. I’ve found this Blogsessive post to be interesting. And if you need to become a better writer, check out The Day You Became A Better Writer.
Don’t forget to add a description meta tag. Did you ever where the description under a link from the list of results from a Google search came from? Providing accurate description will help ensure that the user won’t be disappointed when visualizing your web page.
To avoid your tile being cropped by search engines, you should have titles that have less than 64 characters including spaces and more than 5 characters. The description should be between 25 and 150 characters according to the SEO toolkit.
Search engines cannot see images. If you want them to know what the image is about, you need to add an ALT attributes to your images. Even better, name your image to reflect what they really are.
HTTP Error 404.3 - Not Found
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.
I got this error when trying to let user download .dwg files in IIS 7.5 but a MIME map was not created. Any uncommon files will get you this error. Fortunately, it’s very easy to do.
Open IIS and navigate to your site. Now click on MIME Type (shown below).
Right click and select Add (or click Add… in the right-side menu). You are now presented with a dialog requesting you to enter your filename extension and the MIME type (list of possible MIME types). This will enable you to associate a file extension with a type of content.
H2R77MC2M35K
Here is the bests screencasts I have watched this week :
Monorail Quickly: A screencast made by Joey Beninghove (joeyDotNet). I have quite enjoyed this one. He has done a template project for quickly starting up a solution for Monorail.
A series of screencasts from colinramsay.co.uk :
A ton of new screencasts about ASP.NET 3.5 Extensions.
And I wish you a merry Christmas!