I know what it’s like to try to build a following on Twitter. Each site I created came with a plea to “Follow me on Twitter.” The problem is, once the user clicks on my link, I have no control over what they saw and didn’t know if they even converted into a follower. Then, once they clicked follow, there was nothing more I could ask the person to do. I was blind and at best I’d only get one follower, one conversion. There had to be a better way.
Programming
I’m currently working on a website that needs a URL shortener. In order to have a good shortened URL I must make the most of the path after the domain. The common way to do this, as Bit.ly and others already do, is to have a mix of alphanumeric characters that increment each time a new URL has been created. I’m using Asp.Net and since there’s no built in function or an already published one, I created my own.
This function works by accepting a list of characters to use in the counting process. Each time a new value is needed the function increments the count by going to the next character in the array. I hope to have a lot of traffic so it’s important to be efficient and fast. The resulting code can run thousands of times in just a fraction of a second.
Read the full article →
If you’ve looked at the HTML source of an ASP.NET page you know there’s a ton of extra white space that isn’t necessary. If you’re concerned about page load speed and bandwidth you’ll want to remove all that extra space. Here’s some code you can use to reduce page size by an average of over 10%. I put this in my MasterPage file. Read the full article →
While creating a form for a project I wanted to give the user the option of either creating a new entry or selecting from an existing one. The standard way to do it is to give the user a textbox on one line and a dropdown on another. As with most forms, I wanted to limit the space used so the user wont get overwhelmed by the amount of data he needs to enter. My solution was to join the two objects as you can see in the following screen shot.
The most common way to scroll a page is to link the user to a URL with #AnchorId at the end. This method allows the browser to handle everything and there is no code needed. For times when you need a solution using code I’m going to demonstrate two other methods with Javascript. Read the full article →
Retrieves the left and top offset of an object using Javascript. I got this from Peter-Paul Koch. His description is more extensive. Read the full article →
HTML of a Dropdown list with all the time zones already added. Read the full article →
Detecting DST should be a basic function that’s included in Javascript. Sadly, along with many other basic functions, this one isn’t. For all my Google searches I wasn’t able to find a clear cut bullet proof DST detector. Many only worked in one hemisphere or specific timezones. I wrote this function to be bullet proof. It will detect the correct time zone no matter what. Read the full article →
When I needed a way to detect the browser time zone all I found were posts using getTimezoneOffset. The problem with that was it never took into account Daylight Saving Time (DST). If the user was currently in DST the function returns the time zone plus 60 minutes. Those extra minutes pushed the user into the next time zone incorrectly. There was no way to know if getTimezoneOffset included DST or not.
My solution was to go through each month of the current year and find its offset. Since DST adds an hour to the offset I just needed to keep the lowest offset of the year. Read the full article →
