Monthly Archives: July 2008

Mix for Students: facebook development on .NET

I did a session on facebook development using the facebook developer toolkit where I also showed how I integrated my Piss Off Silverlight application into a facebook app, which I now call PissBook. I’ve registered the pissbook url but have yet to point it to my app as it seems that facebook isn’t allowing me to save it as “addable” on facebook 🙁  I forgot to put in the post add URL ^_^

 image

What I did was take this silverlight app:

image

And showed how you can make it work with data from facebook (or any other datasource for that matter). If you are using the default page generated by the Silverlight project, you would have something like:

image

on the Page_Load event, you should then be able to add values from your Request variable, in this case the logged in user name, and the friend’s name which i picked up from facebook’s friend-selector component, and pass these as InitParameters to my Silverlight Application.

image
I then needed to do a bit of tweaking in my App.xaml file on the Application_Startup method where I parsed the initialization Parameters and passed it to the constructor on my Page user control, which is basically my Silverlight application.

image

I then created a new constructor for my Page.xaml, which is more or less the same as the original one, except this accepts some parameters and assigns them to the textboxes in my application:

image

image

A simple application but it basically shows you how you can integrate your Silverlight applications with dynamic datasources through its InitParams property.

 

image

Code and slides are here:

* NOTE: for some reason, when you’re not logged in, facebook gives a 404 when i try to access the app directly from http://apps.facebook.com/facebooksession I’ll update this as soon as I find out a resolution.

this is apparently a 6-month old bug 🙁 http://bugs.developers.facebook.com/show_bug.cgi?id=1406 still unresolved.

Embed a font

If you want to embed a font into your Silverlight applications, add the font into your project:

image

Set the Build Action file property to embedded resource:

image

Use the following code snippet to use the font as a font source for your components:

Assembly ass = Assembly.GetExecutingAssembly();
Stream stream =
ass.GetManifestResourceStream("EmbeddedResource.Font.pricedow.ttf");
this.test.FontSource = new FontSource(stream);
this.test.FontFamily = new FontFamily("Pricedown");

XAML looking something like:

<Grid x:Name="LayoutRoot" Background="White">
    <Canvas>
        <TextBlock x:Name="test" FontFamily="annifont.ttf#Annifont" 
         Text="grand theft auto IV" FontSize="30"/>    
    </Canvas>    
</Grid>

And the result:

image

Source:

Guilty as charged…

So I haven’t posted in a while. but I said I WANTED, not that I would 🙂

Lately I have been trying to get a life outside of work, or even technology in general. This week has been a bit more successful than the previous attempts. I had just been feeling so much of the stress lately that I decided I should make a conscious effort to change my lifestyle. Yesterday, I spent the day getting some rest in the morning as I was down with a killer headache the previous day and I hadn’t been able to sleep. In the afternoon, I went over to Bugis to look around. I went to Swee Lee’s at Bras Basah Complex, a store i haven’t been able to visit in the longest time. I was almost tempted to buy a guitar too just because it matched the color of my hair. Good thing I snapped back to reality before I could pull out my wallet. I then wandered to the bookstore inside Bugis Village and grabbed a few books. I went to Starbucks and read the afternoon away. It felt good to read again. I remember why I love it so much. Just like why I love the movies, when I read, I get to travel to different places. Difference with movies is I get to enjoy the book a little bit longer 🙂

i wanted to make it a point to write everyday

Which is why, even though I’m dead tired, I am here :-p

I love writing, it helps me relieve my stress, and stress has been around for a few days now. Today was good though. Some challenges at work but surviving through the day is always good. Today I got to do things that “gave me a kick” as they would say. I also got to do things that I would rather not be doing but because life cannot always be on the up side, things had to be done. But overall, I would say it’s one of the better days. Being able to work with technology is definitely something that makes my day.

Plus I got to eat durian today. THAT gave me a kick!

the omega and the alpha

And as the creature leaped into the abyss, he turned over and sent arrows filled with poison raining into the air. They pierced her skin one after another. She felt the searing pain as each arrowhead ripped her skin, and it seemed almost like she could feel the poison flow through to her veins instantaneously. It was slow and painful, but she knew it was inevitable that soon, if she survived, the poison would replace the blood that gave her life. As seconds passed like years, she saw herself, a creature of the damned, living the legacy about to be left behind by this beast. As certain as his death seemed at that moment, so did her damnation. As quick as hope sparked for the world, it flickered and died and everything was dark.

The Next Thing On My List

I finally finished the book. I was feeling a bit down today, unaccomplished as usual. Maybe it’s the aftermath of the multitude of stuff that needed to get done last week. So I did what I usually do when I’m feeling negative: hit the salon. And yes, today, I finally died.. err.. dyed – my hair. I was going to go all out loud orange but the protests were majority so I decided on a compromise. Not the best looking hair I think, but it’s different from what I am used to looking at so nonetheless I felt better. Also, since it was quite a long treatment, I finally got down to reading the book and actually finishing it this afternoon. Not really fond of the so-called “chic-lit” but I found it quite amusing. I remember when I was young, I used to read a lot. But most my books were Nancy Drews, and occasional Sweet Valley Highs, just because all the other girls were reading that one. But I have to say I had more fun reading the mystery type novels. Reading the list book this afternoon made me think back on a list i conjured up back in grade school, which was supposedly my “things to do before I die”. Now I think about it, it could very well be: “Being Nancy Drew”. Yes, I was that huge a fan. Although unintentional, I think i made a step towards that today when I decided to put a “tinge” of red in my hair today :-p.

But seriously, reading the book did get me thinking more about what I’ve accomplished so far and I guess it refueled my goal to create that “things to do before I’m 21h” list again. I will sit down on it, I’ve put some stuff in already. I should definitely work on it more. Anyway, Tomorrow, or should I say today, is the start of another work week for me. I hope it will be interesting. As the saying goes, today is the first day of the rest of your life. I am hoping to make the most of it.

Evernote

image

I found out about this new application today called Evernote and I am just loving it! I haven’t had a chance to fool around with it too deeply yet but a few cool features that I really like is that you can sync your notes on both your desktop as well as mobile device to an online store. Also, my favorite: todo list. I JUST LOVE IT! It has some intelligent stuff as well like being able to search text in images, web clipping, among other things. Check it out!