Archive | June, 2009

Specify Username and Password in URL

30. June 2009

Comments Off on Specify Username and Password in URL

Here is the format to specify a username and password in a URL or ftp address: ftp://username:password@mysite.com/ or just the username: ftp://username@mysite.com/ It is not very secure to place the username and password in the URL however if you need to do testing or troubleshooting, it can come in handy. Most web browsers today do […]

Continue reading...

Rounding Numbers in C#

29. June 2009

Comments Off on Rounding Numbers in C#

A quick overview on rounding numbers in C# with examples: // To Round 3.1415 to nearest integer -> 3 decimal result1 = Math.Round(3.1415m); // To Round 3.1415 to the third decimal place -> 3.142 decimal result2 = Math.Round(3.1415m, 3); // To Round 18.5m Up -> 19 decimal result3 = Math.Round(18.5m, 0, MidpointRounding.AwayFromZero); // The default […]

Continue reading...

Parsing URLs in Javascript

28. June 2009

Comments Off on Parsing URLs in Javascript

Javascript does not have a built in method for parsing a url (to get the individual parts that make up a url). Here is a link to a great little function that does all you need, called parseURI. It uses regex to quickly break apart a url into source, protocol, authority, userInfo, user , password, […]

Continue reading...

Full Page Refresh in Firefox

27. June 2009

Comments Off on Full Page Refresh in Firefox

Hold down Control Key, Click Refresh Button or Control-F5 The keyboard shortcut is a bit of a hand stretch so I stick with the control key and mouse click. How does this help? Doing a full page refresh will go back to the web server to get the latest version of the page you are […]

Continue reading...

Navigating a JSON object in Javascript

26. June 2009

Comments Off on Navigating a JSON object in Javascript

The Scenario: You are working with a web service that returns JSON. You’ve used your javascript library to convert the string into a JSON object. Now you need to access the data in the object using javascript. Here are some examples: JSON Property Types The properties of a JSON object are going to be of […]

Continue reading...