Load data into controls in asp.net

Usually when working on windows form, I use this to do the work

        DropDownList1.DataSource = new ApplicationTableAdapter().GetDataBySystemID(1);
        DropDownList1.DataTextField = "Name";
        DropDownList1.DataValueField = "ID";

But surprisingly, when switched to ASP.NET, the above code no longer works, at first I thought it was a problem with the paradigm so I tried to store the data as a session variable but that didn’t work either, until I tried this

        DropDownList1.DataSource = new ApplicationTableAdapter().GetDataBySystemID(1);
        DropDownList1.DataTextField = "Name";
        DropDownList1.DataValueField = "ID";

One extra line.

First glance onto distributed computing

A recent post on the computer science blog about distributed database management systems fired up the curiosity in me on distributed computing again.

Even though I have attended the parallel computing course while I was still a student, I have always thought cloud computing as worked by some sort of magic :P. I learned how I can distribute parts of a problem but I don’t understand how a single infrastructure (the cloud), can solve many problems thrown at it and balancing between them but not let them interfere with each other, and all that with no special modification to the hardware in the while.

Also contributed in part to my confusion is perhaps the name of the course, “parallel”, which reflects in my brain as a pair of something going on together. The truth is, parallel means asynchronously, many things can get done at the same time.

Well, there’s no magic after all, it’s our common perception about programming that is bended by our habit. After reading about MapReduce and watching a lecture from Google Code University, I finally get it.


There is no data types, there’s just data!

Similar to what I’ve learned, distributed computing is about “diving and conquer” problems. You’ll have to acquire quantization skills to break down complex problems in to simpler problems with which the two core function can work with:

  • Map (to process and break something in to smaller things). At the core of map, there’s some sort a halt condition to be executed when the problem can’t be broken smaller anymore.

Map is processing green stuff and creates red stuff (illustration courtesy of the University of Washington)

  • Reduce (to combine multiple small things to more usable things).

"Reduce" is combining red stuff and green stuff to produce some result

But these two function alone is not enough. How would different type of data treated when there’s no concept of type? The answer is, you make function that take data and return data but process them in a specific way.

Take the example mentioned in the Google lecture above, to process characters in a string, a bunch of data that represent a string (but is not a string since we have no typing system here) is passed into a function called explode, which will return some data that represent characters. And if the processing is to return a string in the end, a function called implode will be needed. This function do the reverse, take data that represent character and strings and return data that represent strings.

By solving the data typing and transitioning, the above paradigm of distributed computing paved way for cloud computing: while distributed computing systems is built to solve a single, specific problems with steps well-defined when the system is constructed. Cloud computing, on the other hand, is simple a collection of the most primitive functions described above, leaving the decision of how to use them to the developer.

So the good news is, developers will still have much to do creating and maintaining cloud systems, and they should be simpler to maintain. But the bad news is, our perception of data will need to renew itself to prepare for the future.

Under the hood: how your friends might have updated their status via “mobile devices”

Recently I noticed a friend keeps on updating his status which appears to be coming from the most trendy mobile devices on the market right now.

Shiny stuff

He could have borrowed his friend’s devices though, but since he is watching the World Cup alone I guessed there was something abnormal about it, so I decided to look for some sort of application that allow you to change your status with those neat little “via Facebook for iPhone”, “via Facebook for Blackberry” etc.

I found this

Status update service

It worked and I was able to get those appealing statuses, but what bothered me is, this seems all too simple, it seems to utilize some sort of Facebook API but previously, when I referenced the Facebook wiki for Stream writing and link posting, I found no parameters that would allow you to edit the “via…”. And the site above didn’t show how it did that, so I decided to dig in. Time for Ctrl+U (view source).

A bunch of Iframes (notice the capitalization, it's not iFrame :p)

That seemed simple, it’s just a bunch of iframes referencing to some sort of Facebook’s live-chat like service. It does say “event” so I tried to create an event but found no options to create such a widget. I tried to search for Facebook connect instead and found this post.

Step 1 – Create the App in Facebook

First things first. Go here to create the App in Facebook: http://www.facebook.com/developers/createapp.php. Give it a name:


Then, add all the necessary info that you can, including logos, icons, user-facing URLs, etc on the “Basic” tab:


You technically don’t have to fill out really anything except this next part.

Go to the “Connect” Tab on the left and fill out this important information there:


Make sure you get this right!

And that’s it! Make sure you write down (or copy) your Application ID, as you’ll need that next:


Step 2 – Create the iFrame, Style, and Finish!

fbc_cclive_styleHonestly, most of the hard work is done already!

All you have to do is copy some iFrame code into your template or website with the Application ID, adjust some of the width/height to fit correctly, and you’re done!

As you can see, I’m adding the code to the bottom of the page, just above the Footer. I’ve added a “fbc” <div> class to styling to make sure it’s centered correctly, etc.

You don’t have to do any of this, of course, and most people won’t have to do anything with CSS styling.

fbc_cclive_codeAnd here’s what the code looks like in my footer.php file (I’m using WordPress to power this site).

As you can see, I’ve adjusted the width to be 983 pixels wide (matching my div class) and the height is 500 pixels.

You can, of course, change all of this to whatever you’d like! The only important part for you to change is the “app_id” value, which is currently set to 94203137849, which is my application ID.

You don’t need the <div> like that post instructed, it’s just for styling, what you really need is the url inside the <iframe>.

It involves creating a Facebook application, which has evolved since the last time I touched it (to create a voting application). It doesn’t even require you to write a single line of FBML like before, but just point-and-click. The trick leverages the fact that the Facebook applications for devices utilize the same framework, and hence by making your own application, you con edit its name to modify the “via…” part to anything you’d like. Here, I made an application with the name “iPhone 4”. Click here to try it.

Now you know what to do when iPhone 5 prototypes leak out ;))

Buying an iPad is not the only way to impress your folks ;))