Wednesday, October 23, 2013

Using Jquery and Update Panels together

Honestly, it's been a while since I've had to mix updatePanels and jQuery together, but a recent project forced me into a situation where I had to modify some existing updatePanel code and also apply some jquery plugins.  In any case, I ran into a situation using datePicker, where I would lose the datePicker on a text box after a partial postback.  I've run into this problem before but I found a great post that explains some very simple ways to address this issue.  Here it is:

Friday, March 22, 2013

Calculating Distance with Google API and C#

Recently I had to use C# to calculate driving mileage between two locations.  Here's a great resource I found but they calculate in metric.

http://briancray.com/posts/calculate-driving-distance-google-maps-api

To convert the distance into miles, make the following modification at the end:


                miles = Math.Round((Double.Parse(distanceNode[0].ChildNodes[0].InnerText) / 1609.344d) * 100) / 100;

That's it! Very useful!

Tuesday, March 12, 2013

Canonical Tags

http://mikael.com/2013/01/seo-canonical-urls-in-sitecore/

If you need to set up canonical tags in sitecore, here's a real quick code snippet that lets you do it.  What are canonical tags?

Read this below:


In summar, canonical tags are used so that crawlers will know that your shortcut isn't copied content, it's just a shortcut.  That's it!

Thursday, February 28, 2013

Future Publishing Date

As I've been doing a lot of Sitecore work lately, I thought I'd begin recording my findings here.

My first Sitecore post is in regards to a question asked, "Is it possible to set a schedule a future publish in Sitecore?"

Here's the simple answer outlined in the article below:
http://blogs.perficient.com/portals/2012/03/09/scheduling-future-item-publishing-in-sitecore/

I thought the code snippet in there could prove to be useful.

*EDIT*
It turns out with Sitecore 6.5, automatic publishing can be set up with a config file.
http://reasoncodeexample.com/2012/03/12/sitecore-automatic-publishing/

Monday, February 11, 2013

Editing Javascript in Visual Studio

The other day I downloaded a javascript library to do some rss feeding. I quickly discovered that I need to add some additional functionality to said javascript, but when I opened the file I realized that like most javascript libraries, there are NO LINE BREAKS.  Of course, this is to minimize the size of the javascript file and supposedly it also provides a performance boost, but for my purposes it did nothing but keep me from being able to read the daggon' javascript.

Well, it turns out there's a quick way to automatically format the javascript in VS.  Just open up the file and go to Edit > Advanced > Format Document.  That's it!