HTML5 Video and Mozilla

Posted: January 24th, 2010

I’m going to skip the introduction and go right to the point: support Mozilla!

How? Use firefox and promote it.

Why? Because you want the web to be Free (not free as in “free beer” but Free as in Freedom). Because you value Freedom and knowledge!

Read these two blog posts:

HTML5 video and codecs by Mike Shaver, Mozilla VP of Engineering

Video, Freedom And Mozilla by Robert O’Callahan, Mozilla Developer

(originally via Slashdot)

If you use Firefox you are giving it a bigger market share and thus more power with content providers. After all, youtube would be worthless without viewers.

If a tree falls in a forest and no one is around to hear it, does it make a sound?

What if a video site is online but no one can view the videos in it? Is it still a video site? Would it have any traffic at all?

I was planning on switching to chrome – after all, it is open source and firefox is slower, uses more resources and I prefer chrome’s UI in many aspects (but not all). However none of those things is nearly as important to me as keeping the web an open place and I believe in the importance of sites like youtube (we’ve all heard about videos on youtube documenting things like police abuse for example).

I’m no Richard Stallman and I not trying to turn anyone into Stallman but the choice between Firefox and Chrome is a close one to begin with. It’s not like I’m going to start promoting Linux (gNewSense at that) over OSX.


Cibermouse @ RTSS 2008

Posted: December 1st, 2008

Right now I’m still sleep deprived having only slept 3h30 – something that happened by accident. I’m also a bit angry because my entry got arbitrarily bumped out of 3rd place by the competition judges. That sucks. Not just for the cash (100 eur) but mostly because it feels like a slap to face. I worked for 1 week non-stop (close to 20h/day for 5 days) and came all the way to Barcelona. I watched with excitement as my agent did better than most in the competition even if it was partially luck (as was for the 2 teams with better scores). And after all the sacrifice, tears and joy I don’t get to go to the final because of an arbitrary decision of a group of people. FUCK THAT. That’s why I dislike the existence of judges in a competition such as this. “Fixing” scores is cheating – regardless of weather it’s done behind the scenes or in plain view. Sigh. I guess it was too much for the final round to be 2 Portuguese teams, 1 Italian and none from the USA.

And worse, both of the entries from FEUP were from undergrads who only had 1 week to work on this while many of the other teams were from people who had masters and phds and the italian guy that got 2nd place was an associate professor and had 1 month to work on it (and said he thought it wasn’t enough in his presentation).

Oh well. At least the team that won was from FEUP (Team SpeedyGonzales) and I’m happy for them (congratulations again Alvaro, Fabio and Sara). The other team from FEUP (NetSqueak) sorta gave up so they got merged into my team and presented their results during the first part of my team’s presentation even though their agent wasn’t running in the competition.

My presentation sucked! I fell a sleep and didn’t wake up till 5 min after the competition officially started. I managed to arrive on time and do a few slides but I was way too tired to make a decent presentation.

Since I only had one week to prepare for this (from scratch) that meant 1 day to write the paper, 5 days to write code and 1 day to travel. Unfortunately my initial approach which consisted of using neural networks for motor control was a huge fail and I wasted a day with it. Still, in 4 days I managed to get probabilistic mapping, basic communication, and a bunch of behaviors (though many buggy) written. Apart from what I learned about cibermouse and robotics there’s also the experience of having an even more insane deadline than usual. It’s very much like a real time system: if you cant do it in this amount of time, it’s a fail. You have to give up on certain solutions if they don’t work because you can’t predict how much time it’s going to take you to get it to work while it’s a lot easier to estimate how long it’s going to take to implement a different solution (if you’ve done something similar before).

Honestly, a few minutes before the competition I thought I was going to be the worst entry there. There were so many bugs that remained unfixed that I had to disable a lot of my mouse’s intelligence – hell, during the first run, 2 of my agents crashed and I had to further cripple it by disabling the comunication system for the second run or risk losing points again (crashed agents collide with walls). Most of the entries had no intelligence anyway – at least not in practice. I was expecting to see some really intelligent agents but instead, the ones that did better where the ones closer to plain simple reactive. In fact, the robot that won the thing for SpeedyGonzales was a purely reactive agent (they had two wall followers, two explores and 1 simple reactive agent). Building intelligence into robots is a lot more complicated than I believed it to be. Also why the hell did so few of the entries bother to actually use the damn sensors properly to avoid collisions? Makes no sense.

I spent the past few hours at the hardrock cafe which is pretty much next door (like 30s walk) to the hotel I’m staying at. I liked it, the only other I had been to was the one in Oslo and that one was a HUGE FAIL – when I went there, it didn’t have Rock (they were wacthing football) or “Cafe” (coffee), the machine was broken or something. I was told the one in Lisbon was Bigger & Better (TM) than this one so I’ll have to check it out next time I’m in Lisbon. In the meantime I’m tempted to purchase a tshirt or something.

For the next 2 days I’ll get to see Barcelona (so far I’ve been stuck at the hotel working). So I


Codebits 2008

Posted: November 18th, 2008

After the awesomeness that was codebits 07 I actually expeect 08 to be a lot better. It wasn’t imo. It still ranks as Legendary on the my personal scale. Food was a major let down tough ;)

The talks I went too were a disappointment. Even Jack Motif’s XMPP talk was way too introductory for the audience (at least for me). More code less talk? Seriously looking at XML I could read in the damn specification was not fun. But I did get to ask a few questions and talk to Jack Motif and Pedro Melo a bit after the talk which made it worth it. Jack Motif told me to look at Wokkel and said he had written a lot of example code for it. I’ll definitivelly look at it sometime in the near future. And this was the best talk I went. Sadly on the second day I chose to sleep late so I missed Pedro Melo’s and Celso Pinto’s presentations. Both of which I’m told were “teh awesome 4tw” or something like that.

What was suprising is that this year, even though the talks @MAIN looked great on paper, most people went to the talks on the other stages. And judging from my experience they did the right thing – however I have no interest whatsoever in server-side js or web cartooning which seem to have been among the most popular).

Another fail was the super loud Rock Band playing while some of us were trying to code but people seem to have enjoyed it.

82 projects? Holly….! Sadly things run late (fail!) and I had to leave before people finished showing their projects – I’ll have to look at the videos later. A lot of people were doing some pretty cool stuff but sadly didn’t finish in time. As for my stuff, I’ll put it online sometime in the near future when I don’t have better things to do (like study for tomorrow’s exam – pratical code thingy whatever you want to call it… crap by any other name would smell just as bad)

I got to talk a bit with the usual suspects from Lisboa (ended up with an handivi sticker on my macbook) and Porto and also met a bunch of new people from all around (Lisboa, Porto, Aveiro, Coimbra, Faro, …) – some from FEUP! And ofc I learned a few things. I regret not having ended up joining some team and working on some project with more people but I did get to play (literally) with pygame and with django. Both of which I’ve been meaning to actually play with (more than just doing tutorial examples) for like 1yr.

Btw think putting the RFID stuff@codebits for everyone to hack was a brilliant idea. Congrats @ whoever had it. And congrats to the sapo.pt team behind this event. It’s the only one of its kind (and level of quality) here in Portugal. Granted that may not mean a lot but it is a great-omg-you-really-cant-miss-it event imho.

Oh! Got to play around with an EeePC 1000H (or something) and I liked it (thanks dude, whoever you were, I forgot cuz my memory is bad and it works worse without sleep). On coming back, word from relax is that everything (or close enough) on his 901 is now supported by Ubuntu. I dunno if I want one because I really need it or just because it’s a cool gadget and I’m rationalizing my lust. Whatever. I can’t afford it anyway. Not with the ginormous ammounts of money I’m wasting travelling around… this semester I’ll actually spend more time outside Porto than @ the uni… hell yeah! Which brings me to my need to work on my cibermouse stuff both for the Robotics course and for the competition at RTSS08 in Barcelona (yay).

I’m sure I left out a lot of stuff but I’m short on time and patience and this is better than nothing imo.


BarcampPT 2008 – Conclusion

Posted: September 8th, 2008

Here’s my presentation:

Introduction To MySQL Performance Optimization (PDF)

People I met:

Joao Neves

Pedro Melo

Also, Celso Pinto showed me handivi working. It’s awesome.


El Caminito del Rey

Posted: September 4th, 2008

[youtube=http://www.youtube.com/watch?v=PaeQykTZRHw]

Need to go there one of these days..


Barcamp Portugal 2008 and my proposed talk

Posted: August 22nd, 2008

Link

When: September, 6 & 7
Where: Coimbra, Portugal
Dep. de Engenharia Informática
da Universidade de Coimbra

I’ve proposed talking about the basics of MySQL performance & optimization. A draft topic list is available here.

I would appreciate your comments:

- Is it boring/useless or something like that?
- Should some of the topics in the draft be left out? (I’m inclined to totally remove the section currently entitled “Pointers”)
- Is there something important I’m missing?
- Any other comments


Kickboxing Cup – K1 Rules – Coliseu do Porto

Posted: March 27th, 2008

 Kickboxing Cup - K1 Rules

21h00, Saturday, March 29

Duration: 2h30min
Prices:
Plateia  – 30,00€
Tribuna – 25,00€
Camarotes 1a – 25,00€
Frisas  – 22,50€
Galeria/Geral  – 15,0

More Info @ Coliseu do Porto
www.kickboxingcup.com.pt


Out of WordPress.com and Into Evernote.com

Posted: March 24th, 2008

I mentioned in a previous post that I was using a private WordPress blog to keep my notes. Not anymore. I migrated to Evernote.

Thanks to Maria Joao Valente for sending me the invite to evernote.

Evernote is a note organizers, similar to Journler which I used a while back.

Check out the About Evernote and their screencast. My highlights:
* Web client
* Desktop client
* Works with Mobile Devices
* Painless, automatic synchronization (think gmail + IMAP but better)
* Notes can be found by searching and filtering for text within images
* Clip (via bookmarklet) or email entire webpages into your account
* Can import html files (you’ll see why this was important for me)

See also: Wired Review and TUAW Review.

Migrating between applications has never been an easy task. In this case I need to migrate from a WordPress blog to evernote. I could manually click “Clip to Evernote” for each post on that blog or I could’ve written a simple AppleScript to do it or I could probably have found a way to do it in Javascript or I could’ve taken advantage of the “clip” thing in another way. But off course I choose the hardest way possible – I wrote a python script to convert the WordPress XML Export File to multiple HTML notes and then dragged those files to evernote. At least it was fun if a colossal waste of time…

Anyway here’s the python script in case you ever want to convert a wordpress blog (or more accurately a WordPress XML Export File) to html files.

wpdepress.py

# Copyright (c) 2008 Luis Rei
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# Notes:
# - currently does not handle images, attachments or comments
# - was only tested on MacOS X (10.5)
# - not "carefully" developed e.g. poor exception handling, little testing, ...
# - see also http://wordpress.com/blog/2006/06/12/xml-import-export/
import string, os, sys, getopt
from xml.dom import minidom
__author__ = 'Luis Rei (luis.rei@gmail.com)'
__homepage__ = 'http://luisrei.com'
__version__ = '1.0'
__date__ = '2008/03/23'
def convert(infile, outdir, authorDirs, categoryDirs):
    """Convert WordPress Export File to multiple html files.
    Keyword arguments:
    infile -- the location of the WordPress Export File
    outdir -- the directory where the files will be created
    authorDirs -- if true, create different directories for each author
    categoryDirs -- if true, create directories for each category
    """
    # First we parse the XML file into a list of posts.
    # Each post is a dictionary
    dom = minidom.parse(infile)
    blog = [] # list that will contain all posts
    for node in dom.getElementsByTagName('item'):
    	post = dict()
    	post["title"] = node.getElementsByTagName('title')[0].firstChild.data
    	post["date"] = node.getElementsByTagName('pubDate')[0].firstChild.data
    	post["author"] = node.getElementsByTagName(
    	                'dc:creator')[0].firstChild.data
    	post["id"] = node.getElementsByTagName('wp:post_id')[0].firstChild.data
    	if node.getElementsByTagName('content:encoded')[0].firstChild != None:
    	    post["text"] = node.getElementsByTagName(
    	                    'content:encoded')[0].firstChild.data
    	else:
    	    post["text"] = ""
    	# wp:attachment_url could be use to download attachments
    	# Get the categories
    	tempCategories = []
    	for subnode in node.getElementsByTagName('category'):
    		 tempCategories.append(subnode.getAttribute('nicename'))
    	categories = [x for x in tempCategories if x != '']
    	post["categories"] = categories
    	# Add post to the list of all posts
    	blog.append(post)
    # Then we create the directories and HTML files from the list of posts.
    # The "base" directory
    outdir += "/wordpress/"
    if os.path.exists(outdir) == False:
        os.makedirs(outdir)
    os.chdir(outdir)
    for post in blog:
        # The "category" directories
        path = ""
        if authorDirs == True:
            path += post["author"].encode('utf-8') + "/"
        # This creates a path for the file in the format
        # category1/category2/category3/file. Note that the category list was
        # sorted.
        if categoryDirs == True:
            if (post["categories"] != None):
                path += string.join(post["categories"],"/")
        if os.path.exists(path) == False and path != "":
            os.makedirs(path)
        # And finally the file itself
        path = outdir + path
        title = post["title"].encode('utf-8')
        filename = path + "/" + post["id"] + ' - ' + title \
                    + '.html'
        # Add a meta tag to specify charset (UTF-8) in the HTML file
        meta = """"""
        f = open(filename, 'w')
        f.write(meta+"\n")
        # Add "HTML header"
        start = "\n\n\n\n\n"
        f.write(start)
        # Convert the unicode object to a string that can be written to a file
        # with the proper encoding (UTF-8)
        text = post["text"].encode('utf-8')
        # Replace simple newlines with
 + newline so that the HTML file
        # represents the original post more accuratelly
        text = text.replace("\n", "
\n")
        f.write(text)
        # Finalize HTML
        end = "\n\n"
        f.write(end)
        f.close()
def usage(pname):
    """Displays usage information
    keyword arguments:
    pname -- program name (e.g. obtained as argv[0])
    """
    print """python %s [-hac] [-o outdir] infile
    Converts a WordPress Export File to multiple html files.
    Options:
        -h,--help\tDisplays this information.
        -a,--authors\tCreate different directories for each author.
        -c,--categories\tCreate directory structure from post categories.
        -o,--outdir\tSpecify a directory for the output.
    Example:
    python %s -c -o ~/TEMP ~/wordpress.2008-03-20.xml
        """ % (pname, pname)
def main(argv):
    outdir = ""
    authors = False
    categories = False
    try:
		opts, args = getopt.getopt(
		    argv[1:], "ha:o:c", ["help", "authors", "outdir", "categories"])
    except getopt.GetoptError, err:
		print str(err)
		usage(argv[0])
		sys.exit(2)
    for opt, arg in opts:
		if opt in ("-h", "--help"):
			usage(argv[0])
			sys.exit()
		elif opt in ("-a", "--authors"):
			authors = True
		elif opt in ("-c", "--categories"):
		    categories = True
		elif opt in ("-o", "--outdir"):
		    outdir = arg
    infile = "".join(args)
    if infile == "":
	    print "Error: Missing Argument: missing wordpress export file."
	    usage(argv[0])
	    sys.exit(3)
    if outdir == "":
	    # Use the current directory
	    outdir = os.getcwd()
    convert(infile, outdir, authors, categories)
if __name__ == "__main__":
	main(sys.argv)

New TV – LG50PC51

Posted: March 13th, 2008

Bought a 50″ plasma TV. It’s been 5+ yrs since I last had one. I’m happy :)


Sympathy For The Devil

Posted: February 22nd, 2008

The Rolling Stones – Sympathy For The Devil

[youtube=http://www.youtube.com/watch?v=nNHkOryXosI&rel=1]


Top 5 Favorite Movies

Posted: November 24th, 2007

In no particular order:

Gladiator

Gladiator
Star Wars: Episode III – Revenge of The Sith

Episode III - Revenge Of The Sith
It’s completely unfair to put this movie on the list because it owes much of it’s greatness to all the other movies in the two trilogies but I can’t not mention Star Wars and this was the best of the six movies.

The Matrix

The Matrix

The Chronicles of Riddick

The Chronicles of Riddick

The only movie DVD I’ve ever bought – and that was after having watched it in the bigscreen twice. It’s probably my favorite movie possibly second only to the Star Wars Trilogy.

Derailed

Derailed

Being very different from the style of movies I usually watch the plot caught me completely off guard and thus made a huge impression on me. Very few movies can surprise me (positively that is), this is the only one I remember that did it.

I didn’t exactly think carefully but this should list should be close enough.

UPDATE: Than Again I totally forgot

The Usual Suspects

The Usual Suspects


Sapo Codebits 2007 – The Summary Part 1

Posted: November 19th, 2007

The Talks/Workshops

* Amazon WebServices Architecture by Mike Culver – I learned more about S3 and I knew nothing about EC2 which is actually very interesting.

* IronPython and Dynamic Languages on .NET by Mahesh Prakriya – I missed it but a lot of people said it was brilliant.

* Building platforms by Fred Oliveira – I got to learn more about microformats, APIs and web scraping.

* Creating a game in 60 minutes (Criar jogo em 60 minutos) by Paulo Laureano – this one was inspirational :) the concept was mixing sample code using to create a game quickly. While actually creating a game took me between 6 and 8h that can be attributed to the lack of sample code to do certain things I wanted to do.

The Contest

For the first 6-8h or so I worked with Celso Pinto and Armando Alves on an idea by Samuel Martins – Sapo Boa Vida. Andreia Gaita helped me a bit with some peculiarities of DOM. My code fetched the information from Sapo GIS.

Later my code was converted to PHP by Celso and I went on to work on my game project (the one inspired by Paulo Laureano’s workshop) while Samuel started with the PHP and Celso went home. I only interrupted my work on my game project, Kill All Squares, to help Samuel with PHP’s DOM – Celso’s conversion of my code was a bit too literal and as Joao from the Sapo Team found out, PHP’s DOM is a bit more peculiar (strict) requiring the NS to be specified.

Sapo Boa Vida eventually won one of the prizes (the prize for the best Mashup).

People

I met a lot of people – many from prt.sc and from the Sapo Team but also others. Some caused a very good impression. I got a lot of good tips, advice and even help in the contest (from the people I already mentioned).
I probably would’ve had more time for the contest and would’ve been able to work on a 3rd project (there were other ideas) but one of the big points in going to this kind of events is talking to other people.


Sapo Codebits AKA Free Food

Posted: November 13th, 2007

Sapo Codebits (blog, wiki) starts tomorrow. I wonder how many people will show up and how many teams will enter in the contest… doesn’t really matter as long as I win ;) :D nah seriously, the more the better of course. There are quite a few people going from prt.sc so I won’t be alone :)

I’m not going to be doing any live blogging (or at least I don’t plan to) but I do plan to keep my twitter updated – “going to talk X”, “talk Y was cool”, “doing this/that” style updates and at the end of the day, if I’m not too tired I’ll provide a summary. Chances are lots of other bloggers will be blogging live/end of day summaries so if you’re not going because you can’t, at least you’ll get a pretty good idea of what you missed.

I’ll also try to take some photos and keep my flickr updated too.

Security

Just went over the small checklist I blogged about previously. Told the firewall to block all incoming connections and started using OpenDNS again -I first used it in Norway as a way to fix Fon‘s DNS problems at the time (screwy youtube).

As for the VPN, I really haven’t tested my own VPN – I’m counting on FEUP’s VPN to work, which admittedly is far from a sure thing. Not that I expect anything below WPA2-Enterprise (TLS) from the APs available.

My emails/IMs sometimes have one of my ultra secret recipes for CAKE so I’m usually careful with them.

Need to not forget to backup everything on my macbook later tonight (via Time Machine).

Camera

I’m still wondering if I should take my camera’s cables with me. 144 pictures (the capacity of my 512MB Memory Sick – need to buy a new one) should be more than enough for just 3 days. So I guess that’s a no.

Ipod/Portable HD

Borrowing my mother’s Ipod again ;) after taking it to Norway I became a huge fan. I was going to download stuff earlier today but Miro crashed (possibly leopard related). I updated and it’s working now so I’m currently downloading a few talks from Google Tech Talks, TED talks and Channel 9.

I loaded a bunch of movies and episodes into my portable HD but I don’t think I’ll have the dead time to watch any of them except maybe on the trips (via Alfa Pendular Porto->Lisbon in approximately 2h30-3h) but that’s when I plan to watch the talks. Then again I’ll probably sleep on the train tomorrow.


The blue cough gene please

Posted: November 5th, 2007

After reading this BBC article about genetically modified mice running faster for longer periods of time, the concept of “viagra gene” popped into my mind.


Twitter Again

Posted: October 16th, 2007

I’m giving twitter another try. Aside from the social aspect, it could be interesting as a way for me to keep track of what I do, and when.

My twitter feed gets displayed in the sidebar on my webpage too.

I’m using twitterrific to both follow twitters and post to twitter.