Archive | Tech Tips RSS feed for this section

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...

NoWrap in ASP.Net

25. June 2009

Comments Off on NoWrap in ASP.Net

If you want your table column to not wrap in ASP.Net, you can use the NoWrap property in the tag like so: <td nowrap="nowrap"> content </td> This makes the code xhtml compliant and prevents warnings in the source view of designer in Visual Studio. Normally you could just specify a nowrap attribute by itself in […]

Continue reading...