Saturday, September 29, 2007

Ubuntu Gutsy Goes Beta

Ubuntu Gutsy Gibbon has gone beta and is on track for its October 18th Release. So, if you haven't been using it since tribe 2 like me, and want to upgrade from Fiesty Fawn, follow the below steps.

  1. Open a terminal.
  2. Type update-manager -d
  3. Follow the instructions
More information about upgrading can be found here

If you want to upgrade from a cd or do a fresh install, ISOs are available here

Tuesday, September 18, 2007

Rest in Peace Robert Jordan

Alas and woes, one of my favorite authors, Robert Jordan has passed away. RJ is the author of the magnificent The Wheel of Time Series. The series currently had 11 books plus a prequel. Jordan was feverishly working on the 12th and final book entitled A Memory of Light. My old Roommate Kit got me into it and though I had previously tried the series when I was about 10 I didn't get into it, this time around I instantly fell in love with The Eye of the World (first book). I put RJ's work on the same level as Tolkien, who is my all time favorite author. Robert Jordan came to "dominate the world that Tolkien began to reveal to us." One of the words at the bottom of gpowered.net comes from a reference to the main character, Rand.

RJ, you gave me a great world to escape this one into. I will miss you dearly. Rest in Peace and become a Memory of Light.

Saturday, August 18, 2007

New Site

I'm devoting my free dev energies into my new project gPowered.net ( Google Powered ) It's about Google code and services and how to use them on your own site. All my photos and notes etc will be on there. enjoy

Monday, July 30, 2007

Monday, April 09, 2007

Grabbing your Google Bookmarks in Python

Going to be using this to display my bookmarks as links on my site but... This authenticates and pulls the rss of my google booksmarks. Can also be used with Google Search History.

Authenticating to Gdata (ex picasa web) in Python

So until the python gdata library has picasa web support, the following is a way to authenticate with your google account (for say posting pictures to picasa web. This method is not needed for private albums, you can use the album's authkey instead and save yourself an extra http request)

To start off we'll need some libraries, the login credentials, and the url of a private album (for testing)


Next we'll define the function that does the authentication. This has the url to authenticate against and the header information. Most of this function is generic depending on which Google service you are connecting to.



The next part, the request, can differ depending on service. The service for picasa web is "lh2"


Then return if we have successfully authenticated


To use this we must get an httplib2 object and try to authenticate


Then we can test to see if we have authenticated, and grab the private data


Just in case we are fed redirects, we would want to test for these


then we would have the data stored in response. We could also print out an error if we were unable to login




Reference

Tuesday, March 27, 2007

Using Python to display a Picasa Web photo album

I came up with this after the picasa gdata feeds came out last Wednesday. The following is a brief overview of how you can use python to interact with picasa web. I will be using django to handle passing to the functions, but they should be usable in any python code.

Edit: decided to try digg


The two main functions we are going to define are album and photo. The first will generate a list of photos to pick from, and the latter will show the enlarged individual photos.

We'll need to include urllib to get the gdata, and define some variable's we'll need later. I also create a small Photo class to hold the important data to pass to the page (in my case the view in django)



The album method should take the album (name or id, it depends how you build the url request to gdata, I use name. I also store the album information in a database on my site. This holds the authkeys i would need for a hidden album. You can store them however you would like.) We would also like to have previous and next buttons on the thumbnail page. the values of start, next, and prev correspond to the start-index value that we will use on the calls to gdata



Now its time to build the url call to gdata. For this example I am sending the authkey in the url. The other method to get a hidden album (or to write to picasa web) is to authenticate using a google account; check back later on how to do this with regular python as well as with the new gdata python library.



We will use the minidom implementation which is fairly lightweight. For a tutorial on minidom check out this <a href="http://developer.yahoo.com/python/python-xml.html">article</a>



After we have all the photos we loop through them grabbing any info we might need.



After we've looped through we have all the data stored that we need:
rows: # of row's we want
cols: # of cols we want
photo_list: list of all important photo data
per_page: how many thumbnails to use in each page (I send this so theres no calculation in my view)
next/prev: indices to the previous and next sets of gdata
start: the current index of gdata
album_id: the album name (or id) that we are using

Now you have to decide how you want to display the data. One option is building up the html from within python and returning it to the browser. The below example is a view for django. It has the general idea of how to work with the data, just a basic layout using a table and a cell for each thumbnail.

First we'll want to loop through each photo and start adding to the table (along with a link to the full sized photo which we'll build later)



Then we check if we should start a new row, and finish off the table



What would an album be without navigation? this is where the prev and next variables come in. We use them to pass to our album function to get the previous and next sets of gdata:



This concludes the core functionality our gallery will have. But... its a little boring. Want to make the images fade as they load? Yes, yes you do. There are MANY javascript techniques, libraries, modules, etc, for transition and animation effects. I've chosen to go with YUI (yahoo!) because it's examples are really good and it has a strong user base. Yahoo also hosts compressed versions of the script files. We'll need to include yahoo-dom-event and animation. Include these in the head of your page.



Now in order to have access to the thumbnails we must give them an ID. I've wrapped them in a div below. The id should be unique so they can fade in on their own as they load. I've used a built in django property forloop.counter that does the equivalent of looping through a for loop and keeping track of 'i'. My div's will have an id of thumb1, thumb2, thumb3, etc



And finally some javascript at the bottom of the page. There are two parts to this. The first, sets the opacity of all the images to 0. The second is called when the image finishes loading and fades in the image.



And now the thumbnail page is done. On to the full sized images!

The photo function is done in a similar manner to the album function. It uses the same gdata call. There is a separate call you can make that is specifically for dealing with a single image. I chose to use this call because I was already keeping track of the indices within the album gdata feed. In this function call, album_id is the same, start is still where the gdata call for the page that the photo is on came from, inc is the difference between the start and the current image's index. (calculated during the for loop in the view (so start + inc = photo's index in the gdata stream).

So the first step is to grab the gdata



Then we load the gdata into a minidom object



The next step depends on how big you want to show the photo. If you want to show them at a width of 800 like I do, then you have to change the URL a little. Google doesn't seem to like direct linking to photos from other domains, but if you dig into the urls that the 'add to blog' widget uses, you can manipulate the url you have in the gdata. We need to insert the folder 's800' near the end of the url:



Then throw in some logic for the prev / next links to cycle between full sized photos



And we have all the info we need to display: url of full sized image, prev next buttons, the album id, and a way to link back to the page the thumbnail was on


To the view!

We will again be using YUI to fade in the image so we can include the javascript files from the start. Then the image itself:



And last but not least, the navigation for this page:



And the same javascript from before



We also could have included more info on the photo, this was just a start.

I hope this helps people use picasa web before a module for it gets added to the new python gdata library.
Edit: Example

Wednesday, January 24, 2007

The Dead Bunny Animation on YouTube

I've been meaning to do this myself but Eli beat me to it! Our Advanced Projects in 3D animation from senior year at RPI has been posted at YouTube. Eli is trying to get a job in this industry so everyone go take a look at the animation!

http://www.youtube.com/watch?v=mOkSQNqE68Q

A cute bunny!!! getting.... well.... just watch ;-)

Sunday, October 29, 2006

Went up to RPI this weekend for the Head of the Fish. Was a lot of fun. Also gave me an excuse to try out picassa web albums and flickr. :: new post coming ::

Monday, October 09, 2006

Google buys YouTube for $1.65 billion

I so want to be one of them right now.... SAN FRANCISCO - Google Inc. is snapping up YouTube Inc. for $1.65 billion in a deal that catapults the Internet search leader to a starring role in the online video revolution.

The all-stock deal announced Monday unites one of the Internet’s marquee companies with one of its rapidly rising stars. It came just hours after YouTube unveiled three agreements with media companies in an apparent bid to escape the threat of copyright-infringement lawsuits.

The price makes YouTube, a still-unprofitable startup, by far the most expensive purchase made by Google during its eight-year history.

[link]

Wednesday, October 04, 2006

"the brodermobile has been soooooooooold"

Wolfy2985: oh yeah??? to Jon??? lol

HolaRico421: nooooooooooooo!
HolaRico421: it can't be sold
Sephroth2k: hahaha
HolaRico421: did you sell it for a good amount
Sephroth2k: **
HolaRico421: damn
HolaRico421: i would've bought it for that
Sephroth2k: haha

pseudofunk: NOOOOOOOOOOOOOOOOOOOOOOOOO


DoM iNa TiN g17: NO!
Sephroth2k: haha
DoM iNa TiN g17: how could you DO that?

c r e pnd e t h9: omg! lol

GodHatesMe84: nooooooooooooo

MobileLALAJI: hahahaha

lizardman45: ?
lizardman45: i don't remember the brodermobile
Sephroth2k: the one keri rammed into
lizardman45: oh, yeah, haha

Sean: I.... am...... genuinly upset....

Wednesday, September 27, 2006

Top 10 Web 2.0 sites

Well, if i come across some fun links I'm going to post them here. This takes a look at 10 popular Web 2.0 sites. A pretty good read.... http://wisdump.com/web/top-10-web-20-winners/

Sunday, September 24, 2006

PHP / Java Bridge + Blogger API

So I've been meaning to play around with a PHP / Java Bridge as well as the Blogger API, so I figured why not to both at the same time. I have briefly used the phpatomapi, which getting to use with the blogger beta is next on my list of things to do (also while i work on blog comments using this bridge). Also to add to this is being able to display/edit/add comments to the posts displayed.

Below is my proof of concept version I am currently adding more functionality to it.

The Java version of the code is: (.java)

String username = "";
String userpass = "#";
String feed = "http://beta.blogger.com/feeds/33817521/posts/full";

//long start = System.currentTimeMillis();
try{
URL feedUrl = new URL(feed);
GoogleService myService = new GoogleService("blogger", "bpr");

//Set up authentication (optional for beta Blogger, required for current Blogger):
myService.setUserCredentials(username, userpass);

//Send the request and receive the response:
Feed myFeed = myService.getFeed(feedUrl, Feed.class);
//String feedID = myFeed

System.out.println(myFeed.getTitle().getPlainText());
LinkedList entries = (LinkedList)myFeed.getEntries();
int itemsPerPage = myFeed.getItemsPerPage();
Entry entry;
for(int i=0; i<itemsPerPage; i++){
entry = (Entry)entries.get(i);
System.out.println(entry.getId());
System.out.println(entry.getTitle().getPlainText());
System.out.println(entry.getPublished().toUiString());
System.out.println(entry.getUpdated().toUiString());
TextContent tc = (TextContent)entry.getContent();
HtmlTextConstruct ptc = (HtmlTextConstruct)tc.getContent();
System.out.println(ptc.getHtml());
//Feed Comm

}
}
catch(Exception e){
e.printStackTrace();
}


The PHP / Java bridge part: (.php)

class Blogger implements Blog{
private $feed;
private $itemsPerPage;
private $entries;
private $entry;
private $content;
private $contentHTML;

public function __construct($username, $userpass, $feedURL){
try{
$url = new JAVA("java.net.URL", $feedURL);
$service = new JAVA("com.google.gdata.client.GoogleService", "blogger", "bpr");
$service->setUserCredentials($username, $userpass);

$this->feed = $service->getFeed($url, new JavaClass("com.google.gdata.data.Feed"));
$this->itemsPerPage = $this->feed->getItemsPerPage();
$this->entries = new JAVA("java.util.LinkedList", $this->feed->getEntries());

//set up vars
$this->entry = new JAVA("com.google.gdata.data.Entry");
$this->content = new JAVA("com.google.gdata.data.TextContent");
$this->contentHTML = new JAVA("com.google.gdata.data.HtmlTextConstruct");
}
catch (JavaException $e) {
$exStr = java_cast($e, "string");
echo "Exception occured; mixed trace: $exStr\n";
$trace = new java("java.io.ByteArrayOutputStream");
$e->printStackTrace(new java("java.io.PrintStream", $trace));
print "java stack trace: $trace\n";
}
}

public function getFeedTitle(){
return java_values($this->feed->getTitle()->getPlainText());
}

public function getItemsPerPage(){
return $this->itemsPerPage;
}

public function getEntryTitle($i){
$this->entry = $this->entries->get((int)$i);
return java_values($this->entry->getTitle()->getPlainText());
}

public function getEntryPublishedDate($i){
try{
$this->entry = $this->entries->get((int)$i);
return java_cast($this->entry->getPublished()->toUiString(), "string");
}
catch (JavaException $e) {
$exStr = java_cast($e, "string");
echo "Exception occured; mixed trace: $exStr\n";
$trace = new java("java.io.ByteArrayOutputStream");
$e->printStackTrace(new java("java.io.PrintStream", $trace));
echo "java stack trace: $trace\n";
return null;
}
}

public function getEntryHTML($i){
//$content = $entry->getContent();
//$contentHTML = $content->getContent();
//echo java_values($contentHTML->getHtml()) . "<br>";
$this->entry = $this->entries->get((int)$i);
$this->content = $this->entry->getContent();
$this->contentHTML = $this->content->getContent();
return java_values($this->contentHTML->getHtml());

}

public function getEntryUpdatedDate($i){
try{
$this->entry = $this->entries->get((int)$i);
return java_cast($this->entry->getUpdated()->toUiString(), "string");
}
catch (JavaException $e) {
$exStr = java_cast($e, "string");
echo "Exception occured; mixed trace: $exStr\n";
$trace = new java("java.io.ByteArrayOutputStream");
$e->printStackTrace(new java("java.io.PrintStream", $trace));
echo "java stack trace: $trace\n";
return null;
}
}

}

And the calling part: (.php)

$bpr = new BPR();
$blogger = $bpr->getBlogger("", "#", "http://beta.blogger.com/feeds/33817521/posts/full");
echo "Blog Title: " . $blogger->getFeedTitle() . "<br>";

$itemsPerPage = $blogger->getItemsPerPage();
for($i=0; $i<$itemsPerPage; $i++){
echo $blogger->getEntryTitle($i) . " (" . $blogger->getEntryPublishedDate($i) . " | " . $blogger->getEntryUpdatedDate($i) . ")<br>";
echo $blogger->getEntryHTML($i) . "<br>";
echo "<br>";
}

Once I have more data in my blog i can run some timing tests

Sunday, September 03, 2006

New blog

So I had an older blog on blogspot a while back under SEPHROTH64 but I can't remember the login for it. I sent a request for my password so when i get that i will move the posts over to this one. My desktop is now running gentoo (AMD64) and currently with KDE. Im working on getting XGL to work. For those of you who don't know what XGL is check out this video