So it is 10:51 on June 26th and of course I am waiting around to go see Wanted at midnight. Being the responsible consumer I am, I purchased 3 tickets for the showing 2 hours ago so as to make sure my friends and I had tickets before taking a single REM-cycle nap so I do not die getting up for 8 AM work tomorrow. And, like the trusty computer nerd I am, as I fell out of bed and stumbled to my computer in the dark, I refreshed my Facebook home page to see a popup from Fandango asking if I wanted to display that I bought tickets for Wanted. And, like a rational, typical American consumer that thinks after he acts and then realizes what he has done, I said sure, tell the world that I bought tickets to Wanted - hell it’s going to be an awesome movie, and then I realized DAMN I forgot to even take a screenshot or click on the “Preferences” link. And now I sit here I am wondering, what in the world was that? As far as I know Facebook Beacon has been dead for nearly a year and a quick search on Google for Facebook and Fandango only pulled up articles from November of last year.
Unlike most of the posts from last November, I am not enraged at some sort of loss of privacy, not even annoyed that is on my Facebook Mini-Feed; it’s kind of cool actually in light of the new commenting features. However, I am still at a loss of how Fandango was able to do this. As far as I’ve seen in the standard Facebook API, to at all interact with Facebook at least requires the user’s approval of the application or website before the data is sent. Also, Facebook Connect is not out yet (unless that was Beta testing). And, although Facebook Beacon can still be found on the developer’s website, there is no way to use it other than send Facebook an e-mail and hope for a response (which I did a few months ago to no avail). So, I am still a bit at a loss as to how Fandango has this privileged access into Facebook and more importantly - when can everyone else use it?
On a side note since I am posting this a day late - Wanted was awesome.
Tags: Programming · Web Development
A good while ago I heard about Adobe acquiring Buzzword, which was quite exciting since it definitely seemed like the most clean of the up and coming online document editing software. Finally, just last week Adobe released a public beta of a suite of Buzzword, Share, and other online editing tools to go along with their release of Adobe Acrobat 9. So, of course, I signed up, played around a bit before going to work in the morning and took a quick peek at the Share API. Well to jump to the point, I am excited at the possibilities but disappointed in Adobe. For a company that is usually solid in their product releases, this is very beta. As I read in another blog post, there is no continuity to the suite. As a matter of fact, why is it even a suite? The multiple features available at Acrobat.com should be implemented together. And, rather than worrying so much about their value, open the features up more. 5 PDFs per month? Really? Anybody that can use Google can find infinite other ways to convert their documents to PDF. My final complaint is that the flash viewer used to share the documents is atrocious. It is impossible to actually read any documents with it. Adobe has beautiful flash paper and again by trying to retain value will just kill itself off in the face of newer compartively open formats like Scribd's iPaper (just a hack of Flashpaper but at least more accessible conversion).
Anyway, regardless of the poor GUI congruity, I would like to discuss the API. The site has a few public libraries at first appearance, and I must hand it to Adobe that their Java library looks extremely clean and easy to use. But the Python library - not even a library, although probably the easiest reading of all of their online documentation. The writer of the blog even states that he has given up and decided to use the Java library - encouraging. Anyway, disappointed in not even an attempt at a PHP implementation, I decided to give it a shot. I essentially went as far as the writer of the Python blog post: authenticate, get sessionid, and get a list of files you have on your account. (Note this requires PEAR's HTTP_Request package.) Also, I know this is very ugly code and I'm possitive could and should be done much cleaner. However, it works if your just trying to take the first steps and get some output. If anyone wants to clean it up or continue on with a PHP implementation, feel free and let me know how it goes. However, until they open up the platform to worthwhile features, it is sadly not worth my time. Hopefully Adobe soon realizes the mistake of being so possessive and thinks a little more creatively about how to monetize their technology. Anyway, here is the code; enjoy:
PHP:
-
<?php
-
$acrobat_api_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
-
$acrobat_shared_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
-
$acrobat_base_url = "https://api.share.acrobat.com/webservices/api/v1/";
-
$acrobat_username = "your_username@somecompany.com";
-
$acrobat_password = "your_acrobat.com_password";
-
-
function getAuthToken()
-
{
-
global $acrobat_api_key,
$acrobat_shared_secret,
$acrobat_base_url,
$acrobat_password,
$acrobat_username;
-
$a = new HTTP_Request();
-
$a->setURL($acrobat_base_url."auth/");
-
$a->setMethod("POST");
-
-
$data = "POST https://api.share.acrobat.com/webservices/api/v1/auth/ ".$time;
-
$md5 =
md5($data.
$acrobat_shared_secret);
-
$auth = "AdobeAuth apikey=\"".$acrobat_api_key."\",data=\"".$data."\",sig=\"".$md5."\"";
-
$request_body = "<request>\n<username>".$acrobat_username."</username>\n<password>".$acrobat_password."</password>\n</request>";
-
$a->addHeader("Authorization", $auth);
-
$a->setBody($request_body);
-
$a->sendRequest();
-
$xml = $a->getResponseBody();
-
$regex = "<authtoken>[a-zA-Z0-9]+</authtoken>";
-
$i =
ereg($regex,
$xml,
$matches);
-
-
-
-
return $vals[0]['value'];
-
}
-
function getSession($auth_token)
-
{
-
global $acrobat_api_key,
$acrobat_shared_secret,
$acrobat_base_url;
-
$a = new HTTP_Request();
-
$a->setURL($acrobat_base_url."sessions/");
-
$a->setMethod("POST");
-
-
$data = "POST https://api.share.acrobat.com/webservices/api/v1/sessions/ ".$time;
-
$md5 =
md5($data.
$acrobat_shared_secret);
-
$auth = "AdobeAuth apikey=\"".$acrobat_api_key."\",data=\"".$data."\",sig=\"".$md5."\"";
-
$request_body = "<request>\n<authtoken>".$auth_token."</authtoken>\n</request>";
-
$a->addHeader("Authorization", $auth);
-
$a->setBody($request_body);
-
$a->sendRequest();
-
$xml = $a->getResponseBody();
-
-
$regex = "<sessionid>[a-zA-Z0-9]+</sessionid>";
-
$i =
ereg($regex,
$xml,
$matches);
-
-
-
-
-
$regex = "<secret>[a-zA-Z0-9]+</secret>";
-
$i =
ereg($regex,
$xml,
$matches2);
-
-
-
-
-
$response[0] = $vals[0]['value'];
-
$response[1] = $vals2[0]['value'];
-
-
return $response;
-
}
-
function getList($session, $secret)
-
{
-
global $acrobat_api_key,
$acrobat_shared_secret,
$acrobat_base_url;
-
$a = new HTTP_Request();
-
$a->setMethod("GET");
-
-
$data = "GET /webservices/api/v1/dc/ apikey=".$acrobat_api_key." calltime=".$time." sessionid=".$session;
-
$md5 =
md5($data.
$secret);
-
$url = $acrobat_base_url."dc/?apikey=".$acrobat_api_key."&calltime=".$time."&sessionid=".$session."&sig=".$md5;
-
$a->setURL($url);
-
$a->sendRequest();
-
$xml = $a->getResponseBody();
-
return $xml;
-
}
-
$auth = getAuthToken();
-
$response = getSession($auth);
-
$session = $response[0];
-
$secret = $response[1];
-
echo getList
($session,
$secret);
-
?>
Tags: PHP · Programming · Web Development
So, in my recent frustration of both Facebook Chat suddenly not working on Firefox 3 RC1 and also many of my developer add-ons for Firefox not working in the new Firefox, I decided to try to run both Firefox 2 and 3 simultaneously. This can of course be done with the two separate profiles and the command -no-remote as outlined in http://blog.codefront.net/2007/08/20/how-to-have-firefox-3-and-firefox-2-running-at-the-same-time After this I wanted to turn this into an AppleScript to run from Quicksilver. Using the command do shell script allows for the Terminal command to be run. However, running the basic command as outline in the link above causes ScriptEditor or Quicksilver (whichever is running the script) to hang. To fix this, we need to run the application in the background. The normal way of doing this in Unix is to add an ampersand to the end of the command. However, this is not enough for AppleScipt. Finally, after looking at this page I saw that the proper full script would be:
APPLESCRIPT:
-
do shell script ("/Applications/Firefox.app/Contents/MacOS/firefox -P \"Default User\" -no-remote &> /dev/null &")
Of course you can make two scripts for the two different applications and two different profiles as outline in the above link. However, make sure to add the "&> /dev/null &" to the end so as to write the PID to a null file /dev/null and then to keep the process running in the background. I hope this helps, and, as always, let me know if you have any tips. Thanks.
Tags: AppleScript · Programming
So recently Adium has been annoying me because it seems to not pay attention to if I am actually connected to the internet. It says I'm online when I lose my connection and as a result I lose full connections. As a result I have been switching back and forth and sometimes using both iChat and Adium. As a result, I had to modify my AppleScript from the previous post. I also this time used some code from here. Anyway the update checks to see if I am using either Adium or iChat, and does the appropriate action for each. The updated Away file is as follows:
APPLESCRIPT:
-
using terms from application "Quicksilver"
-
on process text ThisClipping
-
if appIsRunning("Adium") then
-
tell application "Adium"
-
set the status type of the first account to away
-
set the status message of the first account to ThisClipping
-
end tell
-
end if
-
if appIsRunning("iChat") then
-
tell application "iChat"
-
set status message to ThisClipping
-
set status to away
-
end tell
-
end if
-
-
end process text
-
end using terms from
-
-
on appIsRunning(appName)
-
tell application "System Events" to (name of processes) contains appName
-
end appIsRunning
-
And the updated Available file is:
-
<pre lang="AppleScript">
-
if appIsRunning("iChat") then
-
tell application "iChat"
-
set status to available
-
set status message to ""
-
end tell
-
end if
-
if appIsRunning("Adium") then
-
tell application "Adium" to go available
-
end if
-
-
on appIsRunning(appName)
-
tell application "System Events" to (name of processes) contains appName
-
end appIsRunning
Enjoy and please leave comments.
Tags: AppleScript · Programming
January 20th, 2008 · 3 Comments
I searched around yesterday for a plugin or script to use Quicksilver to set my Adium status, and while there were numerous results, all were outdated and did not work with newer versions of both pieces of software. So I decided to edit some of the ones I had found online. The original code that I was working off of came from here
As you can read in the directions on that page, first you must open ScriptEditor and copy in the following code:
APPLESCRIPT:
-
using terms from application "Quicksilver"
-
on process text ThisClipping
-
-
tell application "Adium"
-
set the status type of the first account to away
-
set the status message of the first account to ThisClipping
-
end tell
-
-
end process text
-
end using terms from
This code will set your away message and the following code will set you back to available.
APPLESCRIPT:
-
tell application "Adium" to go available
With each script as an individual file, save the file to ~/Library/Application Support/Quicksilver/Actions/
After each script is saved, restart Quicksilver and enter in the name of the script (whatever you saved it as) and press enter.
Tags: AppleScript · Programming