Dave Heavy Industries Dave Heavy Industries – blog

25Oct/110

ASP Classic – Escape string for JS

for those that know me... ASP Classic is a pain I have to deal with every day... the simplest things that you've come to accept from every other language is just painful in ASP Classic. Every time I have to do something that I shouldn't have to do, I try to help as many people as possible not have to work it out for themselves. Here is a function to escape a string for use in JS. Enjoy.

29Apr/110

Unable to post link to facebook

Strange one this morning. Our e-comm guys reported they were unable to post any links to their page, their own wall, other peoples walls... anywhere on facebook really. only "The message could not be posted to this Wall." was presented to them as an error.. useful??!?? I think not. After a bit of investigation, I found that it was some pages but not others. The home page for example worked, but a product would not. A content page would, but a category page would not. Ugh.

They all use the same template so I thought surely the html would be very similar... and it was. I ran the pages through the w3c validator, and made a bunch of unecessary changes to do with short-tags and pulled my hair out some more.

A few more coffees and some tweeting and googling brought to my attention that the error "The message could not be posted to this Wall." could be due to facebook blocking that url due to abuse... maybe one of our competitors complained to upset our social strategy? no - then all of the urls would be broken (only lost an hour here :| )

I went back to the HTML, removed anything fancy and it still didn't work. I decided not to let this get the better of me, and I went through the html line by line looking for anything out of the ordinary... and there it was.

Canonical link was missing a slash. <link rel="canonical" href="https:/somedomain.com" />. Now this was set by our e-commerce system, not by the template or development, and none of that has changed for a really long time, meaning that something at facebooks end has tightened up the validation. Anyway, not pointing fingers, commented it out and Posts are now sharing as expected. ugh.

 

 

28Apr/110

Decoding Windows Script Encoder encoded scripts

Decoding Windows Script Encoder encoded scripts

isn't that a mouthful? Microsoft released this in 2001 - http://www.microsoft.com/downloads/en/details.aspx?FamilyID=e7877f67-c447-4873-b1b0-21f0626a6329 which is a way of obscurifying vbscript (like ASP) scripts so that people can't change or copy your code. Great, right? well, as with most script encoding  (zend encoder aside, others I'm sure), it doesn't do a very good job of it, and more makes it annoying to debug asp pages when the developers encode their includes.