Author Archive

July 13, 2011 5

Painless HABTM Validation in CakePHP

By in Uncategorized

Recently I was faced with the task of validating a model with a HABTM relationship. I tried looking around for various solutions but all of them seemed quite complicated and time consuming to implement until I came across this nifty solution. Lets say you have two models – posts and tags with a HABTM relationship. [...]

Tags:

January 20, 2011 3

Parse Twitter & Facebook feeds with jQuery

By in Uncategorized

This post simply demonstrates how to parse Twitter and Facebook feeds using jQuery. I’m utilizing a JavaScript equivalent of C# prototype methods which I had talked about in one of my earlier posts. Also, you’ll note that I’m using two different date/time jQuery plugins to make Twitter and Facebook date parsing a little easier. One [...]

Tags:

December 21, 2010 1

Cross-Domain Communication with IFrames

By in Uncategorized

Recently I encountered a situation where I had to communicate between an iframe located on a different domain and its parent. Due to the “same origin policy”, a security concept for browsers, which only permits scripts running on pages originating from the same site, this was not possible to do right out of the box. [...]

Tags: ,

December 1, 2010 5

Integrating CodeIgniter with WordPress

By in Uncategorized

Recently I was working on a website for a small business client. They wanted a simple system to allow them to easily update a section of their website. Since it was a small website, I wanted to accomplish this without putting too much time but still creating something user-friendly and easy to use that can [...]

Tags: , ,

March 18, 2010 3

How to parse WordPress RSS feed using LINQ

By in Uncategorized

Here’s a code snippet of parsing a typical WordPress RSS feed using LINQ. Note, we have to skip the first image from the media element since that’s usually a gravatar of the author. Everything else is pretty straight forward. private void BindBlogFeed() { XDocument doc = XDocument.Load(“http://blogworkseverytime.wordpress.com/feed/”); XNamespace content = “http://purl.org/rss/1.0/modules/content/”; XNamespace media = “http://search.yahoo.com/mrss/”; [...]

Tags: , ,

January 26, 2010 15

CodeIgniter + Facebook Connect

By 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 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 [...]

Tags: ,

May 6, 2009 35

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

By 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 { [...]

Tags: , ,

February 20, 2009 0

Calculate Shipping Cost Using UPS OnLine Tools

By 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 4

Send Templated Emails Using MailDefinition Object

By 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: ,