Playing With R

Posted: November 26th, 2007

I played around a bit with R (wikipedia link). It’s nice. R is a language often used in statistics, data analysis and stuff like that.

The following code estimates pi using the ratio between the area of the square enclosed by the circle (which is Pi). This is part of an assignment a friend of mine has to do for his statistics class in a masters:

est.pi <- function(n=2000) {

x <- runif(n)
y <- runif(n)

aux <- (x[]^2) + (y[]^2)

aux2 <- c()

for (i in 1:length(aux)) {
if (aux[i] < 1)
aux2[i] <- TRUE
else
aux2[i] <- FALSE
}

result <- (sum(aux2) / n) * 4
print(result)
}

This one calculates pi the calculus way (sum of the areas of the rectangles) instead of statistics. I did this just because I couldn’t figure out how to do it using statistics (until I was told the method that is):

calc.pi <- function(n=50000) {
count <- 1
total <- 0
x<-seq(0,1,length=n)

while(count < n) {
lenx <- x[count+1] – x[count]
leny <- sqrt(1 – x[count]^2)
total <- total + lenx*leny
count <- count + 1
}
print(total*4)
}


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


Multiple Monitors in Linux Tip

Posted: November 20th, 2007

When editing your /etc/X11/xorg.conf, keep in mind that order might matter. Example

Section “ServerLayout”
Identifier “Layout0″
Screen 0 “Screen0″ 1600 0
Screen 1 “Screen1″ 3280 0
Screen 2 “Screen2″ 0 0
InputDevice “Keyboard0″ “CoreKeyboard”
InputDevice “Mouse0″ “CorePointer”
EndSection

It’s important that the Screens show in order. The following might not work (at least it didn’t work for me)

Section “ServerLayout”
Identifier “Layout0″
Screen 2 “Screen2″ 0 0
Screen 0 “Screen0″ 1600 0
Screen 1 “Screen1″ 3280 0
InputDevice “Keyboard0″ “CoreKeyboard”
InputDevice “Mouse0″ “CorePointer”
EndSection

because the order is wrong.


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.


UWS Virtual Appliance v1.1

Posted: November 18th, 2007

Just uploaded the Ubuntu Web Server Virtual Appliance v1.1.

Added SSL support (OpenSSL, loaded the Apache module and added demo certificate and commented out configuration).


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.


LAMP, Rails, Django Server Virtual Appliance

Posted: November 12th, 2007

If you’re like me and don’t like having to install all that stuff in every PC you use than this virtual appliance is for you.

Or

If you want to start learning PHP/Ruby on Rails/Django _now_ instead of having to install/configure stuff.

Or

If you’re going to something like Sapo Codebits and want to take the server with you ;)

Hightlights: LAMP (Linux Apache MySQL PHP), Ruby on Rails, Django

UbuntuWebServer Project

Virtual Appliance Market

VMWare Player (Free)


Links 05-11-2007

Posted: November 6th, 2007

Top 15 free SQL Injection Scanners

svn-time-lapse-view

Twitter Guide Part #5 – Twitter Tools | Web Applications

JanusVM – Internet Privacy Appliance


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.