Author Archive

January 26, 2010 10

CodeIgniter + Facebook Connect

By J in Uncategorized

In this post I will talk about how to create a Facebook Connect site using the CodeIgniter framework.
So first of all, before you being, download the Facebook Platform client library from here. Extract the files and copy everything inside /php folder (including the ‘jsonwrapper’ folder) to the /system/plugins folder of your CI application. Once [...]

Tags: , ,

June 20, 2009 7

How To Setup Pretty Premalinks for Wordpress on IIS7

By J in Uncategorized

If you’re running Wordpress on IIS7 like this blog and if you want clean URLs without the “index.php” you can do the following.
Although before you get started you need to make sure you have FastCGI and URL Rewrite Module installed on your IIS7.
If you’re missing one of those things, you can check out these [...]

Tags: ,

May 6, 2009 4

How to Parse Twitter Usernames, Hashtags and URLs in C# 3.0

By J in Uncategorized

Lately I’ve been working on my pet project called Twime. So as part of that project, I wanted to add the ability to parse URLs, usernames and hashtags from the user’s Twitter timeline. Here’s how I went about doing that:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text.RegularExpressions;

public static class HTMLParser
{
public static string Link(this [...]

Tags: , ,

February 20, 2009 0

Calculate Shipping Cost Using UPS OnLine Tools

By J in Uncategorized

Before using this code, all you need to do is register for an UPS OnLine Tools account and then apply for a XML Access key using your developer key which you will receive after creating an account. After you get your access key, just plug your username, password and the key into the highlighted line [...]

Tags: , ,

October 25, 2008 1

Send Templated Emails Using MailDefinition Object

By J in Uncategorized

Recently I discovered a better way to format my email messages in ASP.NET using the MailDefinition object. It lets you to use an email template and define tokens which you want to replace in it. This helps keep the presentation and business layers clean & seperate and lets the designers go in and edit the [...]

Tags: ,

October 10, 2008 0

Create PDF Forms using iTextSharp

By J in Uncategorized

Generating PDF forms in .NET has always been somewhat messy and complicated. I’ve seen people convert raw HTML to PDF or adding and formatting form elements to a PDF doc in code behind, etc. All those methods are highly time consuming and tricky. Easiest way to create PDF Forms is by using iTextSharp (open source) [...]

Tags: ,

October 4, 2008 0

ADO.NET Data Access Template

By J in Uncategorized

Here’s a basic ADO.NET data access template with a SqlCacheDependency. Just wanted to post this for my future reference.

public static DataSet GetData(long itemID)
{
DataSet ds = new DataSet();
string cacheKey = Helpers.GetCacheKey(itemID); //Get a cache key unique to this method.

if (HttpContext.Current.Cache[cacheKey] != null)
[...]

Tags: ,

September 26, 2008 0

Code Blocks Inside Master Pages

By J in Uncategorized

Some time ago I kept getting this error in one of the projects I was working on:
The Controls collection cannot be modified because the control contains code blocks (i.e. ).
I spent quite some time trying to figure it out. Finally after hours of searching I found out that Code Blocks Inside Master Pages Cause Trouble.
I [...]

Tags: , ,

September 12, 2008 0

How to setup an asp.net website on localhost

By J in Uncategorized

First lets start by setting up the site in IIS…
1.Open IIS by double-clicking on Control Panel->Administrative Tools->Internet Information Services
2.Right Click on Web Sites->Default Web Site
3.Click on Properties->Home Directory and choose the location of your website

Now lets give the ASPNET account the appropriate permissions to access that directory…
4. Using My Computer or the Windows [...]

Tags: ,

September 1, 2008 0

How To Clear All Items From Cache

By J in Uncategorized

if (Cache.Count > 0)
{
string currentKey = string.Empty;
System.Collections.IDictionaryEnumerator cacheContents =
System.Web.HttpContext.Current.Cache.GetEnumerator();

Response.Write(string.Format(“Following {0} cache keys were cleared:”, Cache.Count));

while (cacheContents.MoveNext())
{
currentKey = cacheContents.Key.ToString();
Response.Write(currentKey + “”);
System.Web.HttpContext.Current.Cache.Remove(currentKey);
}
}
else
{
Response.Write(“Nothing to clear. Cache is empty.”);
}

Tags: ,