Pedro Assunção

Trekking goodness

Trekking, what a great way to spend time with friends, enjoy the wilderness, and exercise, all at the same time. I just came back from the hardest one so far. It was 2 days of very real mountain climbing (we managed to move about 1.1km vertically, for a grand total of 30km on the entire trip). Suffice to say I was exhausted when it ended and that yesterday’s dinner was the best meal of my life :)

I’m in the process of uploading the video of the trip and will share it as the conversion process finishes on vimeo.com.

Peace all ;)


OSX: Change time machine auto backup interval

The default time machine backup interval is every hour. Sometimes this can be really annoying so, if you find yourself in need to change this, here’s how:

Navigate to /System/Library/LaunchDaemons and locate the file named com.apple.backupd-auto.plist.

Inside this file you will find the following content:

 <key>StartInterval</key>
 <integer>3600</integer>

3600 means hourly (60 minutes X 60 seconds). If you multiply by 4, for instance, and use that value (14400) you will have automatic backups every 4 hours instead. Or whatever interval you prefer.
Happy backing up :)


NonUniqueObjectException: a different object with the same identifier value was already associated with the session

If you are developing in Swing and using hibernate you might – at some point in time – run into this exception:

org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session

What happened, you might ask? Well, turns out that when you close the session that created a given hibernate-managed object, this object becomes “detached” (meaning hibernate no longer has any control over it). So, when you attempt to save or update it in another session, hibernate will complain with that exception, because it can no longer tell which is the “true” version of the object.

The solution(s)? Look inside your code for places where you might be closing the session and take that out. That’s the solution in the case where you are using a long session (one that spans the entirety of the application’s life). In case you really want to close the session, you might consider using the session’s merge() method, which basically merges the fields in both the attached and non-attached instances of the object, and performs an update.

Hope that saves someone half a day of debugging ;)


Is Bin Laden dead? I’ll believe it when i see it.

Are you kidding me? His body buried in the sea? This is the most wanted person in the history of the world and they don’t bring back the body to prove – without a shadow of a doubt – that he is truly dead? Give me a break.

I’ll believe he is gone when i see a body, no matter what Obama says.


My selection of top iPad 2 apps

After buying my shiny new ipad2 I, like most other tablet enthusiasts, devoted a fair amount of time in search of the coolest and most useful apps to install.

The major problem in most results that google returns is that they all mention the same list: twitter, IMO.im, friendly, dropbox, etc. (for a list of the obvious, follow this link).

After some deeper searches I found the following apps to be extremely interesting to me. I’m hoping they will be to you as well:

Writing

If you write anything, these are the most well spent 79 cents, believe me.
Log your life, with notes, pictures, and music.
Find the perfect word to convey your message :)

Games

Snowboard fun :)
Awesome card game, kinda like Magic the gathering. Warning: Massive time waster :)
Cool top down RPG.

Reading

Read all your google reader subscriptions in this clean RSS reader.
There’s a few marvel comics for free in this app.
The great classics are free in the Kindle store. And the iPad is the perfect e-reader.

News and Magazines

A beautiful way of keeping track of current events worldwide.
A new take on wikipedia articles; everyday a new selection of wonderfully formated articles.
A kind of magazine with a gazillion tips on how to make the most of your shiny new iPad.

Notes and doodles

Keep all your notes in sync across your computers, tablets, and phones. Much better than evernote, in my opinion.
Everyone doodles from time to time :)

Remote desktop and media centre control

Money well invested, if you have a mac mini in your living room and don’t want to spend $100+ on a wireless keyboard + mouse setup. This app allows you to use the iPad as both. And does one hell of a job at it.
To control your XBMC from the iPad.
A remote viewer for your computers (VNC).

Video streaming

The best way i found to stream video and music from my server to the iPad and other computers. It compresses video on the fly, allowing you to stream even through a 3G connection. Priceless.

Graphics

Just in case you need to retouch some pictures on the iPad.

Cooking

If you’re lazy like me, this will come in handy to discover new recipes to cook.

Data

View your Google analytics data from this cool app.

Alarms

And finally, everyone needs an alarm. This one is simple and gets the job done :)

Apple store delivers orders to the past

So apparently my iPad’s smart cover will be delivered on the 6th of April. Today is the 21st…

But i’m not complaining. Not about that, at least. You see, they split up my order in two because the iPad is to be shipped later (25th of April). The problem is that an iPad cover is of no use without an actual iPad :)


Pooping: you’re doing it wrong

Ever found yourself sitting  in the toilet and, when it’s that time to do some pushing, instinctively getting on your toes to help the process? Well, it turns out that there is a reason for that: Humans have an easier time pooping in a crouching position. So when you get on your toes you are just getting closer to that shape.

And – as it turns out – there are 6 other things we might be doing wrong all our lives. Live and learn :)


Earthquake information in Ruby

Here’s a little script to get the latest earthquakes worldwide (1 hour). Sorry, Ruby purists, for not using RSS 2.0 and hpricot for a cleaner extraction of the coordinates, but my xcode installation is messed up and i can’t build any gems ;)

require 'rss/1.0'
require 'rss/2.0'
require 'rss/atom'
require 'open-uri'
require 'cgi'

source = "http://earthquake.usgs.gov/earthquakes/catalogs/1hour-M1.xml" # url or local
filecontent = "" # raw content of rss feed will be loaded here
open(source) do |s| content = s.read end
rss = RSS::Parser.parse(content, false)
rss.items.each do |item|
  data = item.summary.to_s
  # Extract raw info
  data = data.scan( /alt\=\&quot\;([^>]*)W\&quot\;/).last.first
  # Remove html escaping
  data = CGI.unescapeHTML(data).gsub("&#176;N", "").gsub("&#176;", "")
  # Convert into coords
  lat = data.split(' ')[0]
  lon = data.split(' ')[1]
  # Print it
  print item.updated.content, " ", item.title.content, " ", lat, " ", lon, "\n"
end

Next step: Show this on a map :D


The iPad2 – or rethinking my android tablet purchase

So here’s the deal: I had planned to purchase a honeycomb-based tablet as my sabbatical leave of absence going away present to myself. I was carefully considering all the pros and cons of both the Motorola Xoom and the new 10″ Samsung Galaxy Tab.

Between the two of them discovered the latter has a better general body finish, as well as slightly better front camera. Besides, Samsung has had the first tab out there for some time now, which means they have some more experience in regards to what works and what doesn’t, as building tablets goes.

The problem is that I just tried an ipad2 for the first time. And, besides feeling super snappy and slick, it’s so shinny :) . I might have fallen for this thing already.

The price is more appealing as well: 549 euro for the 32GB wifi version. I can’t imagine either the galaxy or the xoom matching this anytime soon. Not before the ipad3 comes out anyway ;)

UPDATE: Alright, i sold my soul to the devil: Ordered an iPad2, arriving at the end of the month :)


The guy that took one picture of himself for 6 years

Remember Noah Kalina, the guy who took a picture of his face for 6 and a half years? Well, he still continues to do it. I’m guessing he wants to have a complete record of what he looked like through all his life.

In his website you can see all the photos, by year. It’s incredible that you can easily tell in which ones he was sick, just judging by his face :)

I really admire his strength of will, to be able to carry on with his project :)


Mitochondria regeneration method found. Wanna live forever?

Scientists have found a compound that creates new Mitochondria structures inside aging cells. This can lead to the reversal of cellular aging, the main reason why you die :)

As we age, our tissues’ mitochondria start to get damaged (you can think of it as the tail of a long chord, that gets ripped progressively as you drag it through the floor). A 90 year old man’s muscle tissue will have around 95% damaged mitochondria, as opposed to no damaged at all in a little kid. If we can stop this process, we might live forever :)

More technical juice in the original article.


Using Dropbox to automatically download torrents

Need to be able to remotely add torrents to your secure machine at home? Don’t want to expose any ports to the world in order to accomplish that?

Solution: Use Dropbox and uTorrent.

How? Setup uTorrent to automatically download any torrent files found in your Dropbox folder (like the picture says). After that, any torrent files that you put in Dropbox – from any computer where you set it up – will begin to be downloaded. Oh, the joy :)


Google Circles… Lycos tried that in 2004.

There’s a lot of hype around the potentially upcoming Google Circles, the fancy new social networking website by the search giant. But – as it turns out – Lycos tried exactly the same back in 2004. Judging by the number of people who know this, they failed.

From their press release at the time:

“Lycos Circles gives users a one-stop shop for sharing things, discussing and staying in touch with their favorite circles of people,” said David Kim, CEO of Lycos. “Lycos Circles helps you be more efficient at socializing and staying connected with family, friends and the groups you care about most.”

So i started thinking about how exactly does an idea become successful. It’s not enough for a product to be useful because, if no one knows about it, it will never take off. It’s also not enough to have hype around it, when it does nothing of what people need it to do. And – of course – timing is very important; we have to keep in mind that when Lycos tried this – in the end of 2004 – was the time when Facebook was starting to ramp up. And no one was worried about privacy issues back then, Facebook was God.

So i guess – in the end – success is a combination of timing, hype/connections, usefulness, and luck :)


Guru meditation error

While reading my morning web comics, i noticed this error in wulffmorgenthaler: Guru meditation error.

Apparently this is the default way the Varnish HTTP cache shows errors and – as it turns out – it comes from the old Commodore Amiga times.

It’s always refreshing to find more developers with a sense of humor :D