Sunday, March 16, 2008

no beeping for tasktimer

I'm still having issues with having the alarm beeping. The standard Javascript solution has a problem with the <embed> tag. I'll have to find some work around. For now I'll have to be content with the colour change but I'm sure there is a simple solution. Perhaps I'll have to use <fb:mp3 src="beep.mp3" > or something like that. Perhaps my problem is that I'm not following they Facebook style of doing things. I'll going to have to give up on this mini-project and get on to the Java-Facebook combination soon.

On a side note, the XO laptop has been eating up some time. It looks like I've conquered the interface and t-mobile so that I can drink coffee and fiddle with my web pages for my courses. I've disabled the mesh networking so that the slow processor of the XO has less to worry about--it seemed like it would bury the poor thing so that starting new processes would not work. I'll keep this short sine I do not yet have much trust in the XO yet. I'll have to push it a bit more to see how robust it is.

Sunday, February 17, 2008

Update: Round 2

Instead of being distracted, I'll try to make go of the update for tasktimer. After some minor, changes to the back-end database that I proposed last time. (I ended up DROPing and CREATE-ing the tables rather than ALTERing them). Here's what I ended up with:

create table times (taskID int,log datetime,code int,seconds int);
create table tasks (user int not null, taskID serial unique, name varchar(30) not null, description text, alarm int);
create table prefs (user int not null, friend int, taskID int, permission int);

So now all I must do is a front end.... This may be a pain.

Sunday, February 10, 2008

Upgrades in the works

Now that the application give rudimentary services, I can work on making it useful an perhaps fun. The planned upgrades have to do with making taskTimer really Web 2.0. Currently, it's slightly web 2.0 because users access it through facebook. The advantage of using facebook is that it has great distribution and it has user accounts already set up. But essentially, there is no interaction between users and the contribution of users do not in someway contribute to a bigger whole.

Through the process of taskTimer, I was able to better able to understand how to integrate an application in facebook. The upgrades will only be an exercise in php programming (and perhaps some minor facebook variable accessing--to access friend networks for sharing etc). Rather than have one big table that holds all the information. I will introduce multiple tables to handle the expansion in scope.

create table times (taskID int,log datetime,code int,seconds int);

create table tasks (user int not null, taskID serial unique, description text, alarm int);

create table prefs (user int not null, friend int, permission int);

hmmmm....... just a minute.

Monday, February 4, 2008

Ugly for now but working.

Slowly but surely the Facebook page is up and runing. I'll leave the broken bits that I previously mentioned up (since it'll be amusing to ponder later) but taskTimer is up and running. Here's the script that does it. The hacking approach is a bit of a pain but perhaps I'll be better with the machete next time. The key was using someone's ajax script (Matt Burke's) to work around settimeout() (see wiki (Feb 4)). I'm doing it pretty ineffectively currently. Soon I'll clean it up. For now, I now have to do some preps.

OK it's not layout it's Javascript.....

I'm not sure if I'm farther ahead but at least I'm down to one problem. Right now, I just can't get the Javascript clock running. The other problem boiled down to adding in some div tags. Perhaps, I can just read up on Javascript and be ready to go.... hopefully more soon.

Facebook app formating

In my attempts to enrich my Web 2.0 course, I have hit some stumbling blocks. My original goal was to using the Facebook network to help convert my polygon software from essentially applications to easy to use Web 2.0 apps. To do this, I need to convert my system of storing the files for my polygon programs into database entries. Rather than tackle this at one go, I figured I would solve the technical issues with a toy application and then graft my solution onto my polygon programs.

I chose to make a task timer application that would keep a record of times spent on tasks. As with most programming into uncharted territory, I ran into some typical misconceptions and some minor oohs and ahas. Let me outline my approach.
  1. create a mysql database with entries [user, task, timestamp, code, seconds]

  2. create a php script to connect to the database

  3. format the output and make it interactive using the form tag

  4. when the job is running have the elapse time update

  5. connect it up to Facebook

Number 1 and 2 were pretty straight forward. I did have to do a little dusting off of my SQL skills but there were no surprises. I made only a minor mistake in selecting my "code" column to be an int rather than Char[10] or something to make the table more readable. But of course this is just a proof of concept app anyway.

For number 3 and 4, this took perhaps a bit more time (on and off about five+ hours -- not an easy thing to manage teaching five courses). My formating and html skills dated and are pretty much on the need-to-know basis but at least for my web pages I can achieve what I want. So after a bit of stumbling I was able to hack together this page(you will need to have a Facebook account to view it)--here is the php code. Probably the bulk of the time was figuring out how to get the times to update. I did this in Javascript a language I am not very familiar with. It took me a while to unravel the clock applications that I saw kicking around. Part of the problem was that I didn't initially recognize the recursive call.

var startSeconds=Math.round(new Date().getTime()/1000);
function startclock(){
var seconds=Math.round(new Date().getTime()/1000);
document.form0.update.value=convertSec(8232+seconds-
startSeconds - 1202100203+1202137950)+" **";
document.form1.update.value=convertSec(228249+seconds-
startSeconds - 1202132449+1202137950)+" **";
document.form2.update.value=convertSec(6);
document.form3.update.value=convertSec(5);
document.form4.update.value=convertSec(44374);
document.form5.update.value=convertSec(12106);
setTimeout('startclock()',1000);
}

The numbers in above code is generated from the database and for form# are pulled into forms in a table. The first to variables form0 and form1 are current running task so they need to be aware of the current time. The calculation is a bit messy since the client's machine may not have the same time as the server's time.

So numbers 1 through 4 gave me the following:

hello 711501151 (hmmm a name would be nice...)



tasktimeadjust
new task

It's number 5 that is giving me the woes. Although I can get the user data from Facebook, it appears that the formatting and javascript get completely messed up when this attempts to be included in the Facebook frame. Using something like the following...

$facebook->require_frame();

I have also been playing with adding stuff to the profile but I run into similar formatting issues

$facebook->api_client->profile_setFBML($out1, $user);

I'm a little unclear on how to proceed with this format issue. With reading about Facebook and Javascript it seems like I may have some issues with the approach.

So round one goes to Facebook. I may just go straight for a Java solution since it's more my native language anyway.