Free photo storage on google plus

If you are a fan of picasa, flickr and the such, then there is a nice feature on google plus: free storage of pictures.

This is nice when considering a cloud storage of your favorite pictures.

More details can be found at:
http://support.google.com/picasa/bin/answer.py?hl=en&answer=39567
Google+ provides unlimited storage for photos uploaded in Google+, which are automatically resized to 2048 pixels. Videos up to 15 minutes in length are also free.

Have fun while the freebie lasts! :)

Calculating the year using only milliseconds

Nice way to get the current year in Java.

int year = System.currentTimeMillis()/1000/3600/24/365.25 + 1970;

Credits are due to Ewin Makepeace at http://stackoverflow.com/questions/136419/get-integer-value-of-the-current-year-in-java

IFRAME and reloading back the page to the top

I was trying to solve my way around a nuisance.. On web portal that I am working on, there exists the need to use an IFRAME in order to interface two difference platforms.

So, far things were going great but when I was submitting a long form, the new page that came as result would not be visible unless the user would manually wind up the browser window all the way to the top.

Tried out a few things until I finally found a working solution: using the "onload" event triggered by the IFrame and some java script.

So the end result to get neat looking pages is:

<iframe src="http://localhost?display=register" onLoad="window.parent.scroll(0,0);"></iframe>

And this way you get yourself back to the top of the page every time that a new page is requested inside the iframe window. Problem solved.

Take care!

:)

Reboot hosts the official forum for ISOstick

ISOstick is an interesting USB flash drive because it believes (and fools others) that it is an optical DVD drive. Recently received a full sponsoring from kickstarter.com to begin production: http://www.kickstarter.com/projects/elegantinvention/isostick-the-optical-drive-in-a-usb-stick/posts/120874 and should soon be available to everyone.

This a great tool for a any self-claimed rebooter. Allows to switch on-the-fly between multiple ISO images and customize them to his will, so I invited the creator behind this cool product to join our community and we are now the official discussion forum for isostick.

Really cool distinction, really cool person to help and work with. More details about this cooperation can also be read in Elegant Invention's blog at http://blog.elegantinvention.com/?p=161

Take care! :)


30

Regardless of what others might say, I can only see that life gets stranger as you get old.

Wouldn't necessarily say better or worse but simply strange. We learn so much and get wiser, yet one can also get so unsurprised about new things and becomes quite boring per times.

As I grow older, I also start to note some patterns emerging on people around my age gap. And this reflection comes to place since this month is my birthday date. It is a special event for me as I will be celebrating thirty years of existence.

I truly wish that I could have done many things differently across these short decades. There were so many happy thoughts, sad moments and unique emotions that will never be repeated. Perhaps I should (finally) give some credit to the comments from some friends claiming that I am a fatalistic person, looking too often to the past and interpreting my own future has already written.

 However, if the future hasn't been written already, what else can be waiting behind the door?

Oh well.. I just wish that I could smile more often. Wish that I could enjoy life with the same passion as before.

While writing this I see that I'm not so fatalistic after all, I do want to feel life, I don't want to stop feeling amazed when I see new things, I want to keep moving and doing new things that make each day special. Thirty is not the end of the world, it is the beginning of a new chapter.

Let's break the patterns and move forward! :)

Java scripting for the Remedium platform

The latest version of Remedium comes with support for dynamic Java scripting provided by the BeanShell interpreter: http://www.beanshell.org/

If you never heard of it, think of bean shell as the PHP equivalent for Java.

Remedium needed a way of getting away from statically compiled classes onto a scripting language. There were plenty of choices available and I chose beanshell because of its simplicity and close resemblance to the Java language. If you know Java or C, you will instantly figure out how this works.

What's the advantage for Remedium?

As a web based platform, it allows developers to create scripts that take advantage of the platform without needing to setup a full development environment. This also eases the task of customization and updates.

Along with support for bean shell scripts I also added support for displaying pages of raw HTML from the disk. This works nicely to create, for example, HTML forms that call a given bean shell script. This way it is possible to add business logic without any compilation being necessary.


So, now we have a neat standalone application server that is capable of serving and interpreting scripts that output web pages. No need for a JBoss, Tomcat, JSP, Apache or even PHP interpreters.

If you haven't try out BeanShell before, go ahead. It is worth the time to try out.

:)

Making a long name shorter within a range

This is just a small JAVA snippet to reduce a given long name onto a format that fits a max size.

Enjoy.

/**
* Provides a text that will match a desired dimension, reducing
* it if necessary.
*/

public static String shortText(String text, int maxLength){
String result = text;

// if this text portion is bigger than allowed, reduce
if(text.length() > maxLength){
int half = maxLength / 2;
int length = text.length();
result = text.substring(0, half) + ".."
+ text.substring(length - half, length);
}

return result;
}


Foi bom enquanto durou

Ainda me lembro quase como se fosse ontem quando te vi pela primeira vez. Lembro-me das primeiras viagens que fizémos juntos e de todas as aventuras que nos preencheram durante 10 anos. Foi bom, foi muito bom. Tinhamos o mundo pela frente e eu adorava ver-te a sorrir. Nada mais me alegrava tanto como a cara sorridente que fazias quando te levava o pequeno-almoço à cama e me fazias companhia antes de começar mais um dia. Foram bons tempos, muitos bons tempos. Nada mais me marcou tanto como ver o nosso filho pequeno a nascer, não foi um dia fácil mas sorrias, sorrias tanto que eu sorria mais só por te ver sorrir. Tenho saudades desses tempos, dos bons e velhos tempos. Não sei ao certo o que aconteceu.. foi tudo tão rápido: ficámos crescidos, adultos, tristes e cansados. Foi rápido, talvez demasiado rápido mas não arrependo do que fizémos em tanto com tão pouco. Ficámos longe, deixei de escrever, ligar ou falar. Fiquei estranho, à frente do computador, longe de tudo à volta. Mudei muito. Não faço desporto nem nada do que fazia. Deixámos de estar juntos e tenho o que sempre queria mas perdi o que mais me valia: uma amiga, esposa e companheira de viagens. Muito mudámos. Às vezes penso como seria bom voltar atrás, mexer nos computadores só para ver filmes contigo e mais nada.. seriamos felizes? muito felizes se eu não tivesse mudado? Talvez sim.. mas talvez não.. apenas tenho a certeza que estariamos juntos mais tempo e teriamos viajado muito. Muito mais, muito mais tempo, muito mais tempo juntos. Fiquei triste por estarmos agora separados, triste por não ver o rapaz crescer, triste por não nos podermos entender. Pode parecer um cliché, mas eu admito que a culpa seja só minha. Foste paciente, perdoaste parvoeiras por mais tempo que qualquer mulher teria. Por esse motivo mesmo, só um tolo como eu te perdia. Não me portei bem, fiz muita coisa mal. Deixei de te cantar, deixei de te olhar, e deixei de te rimar. Agora para a frente dizem que é um novo dia. Agora lá olho eu para o futuro, mas também olho para os nossos dias: juntos com carinho. Agora já somos crescidos, ou será que voltámos a ser novos? Seja lá o que for, que seja aquilo que deixámos para trás e que possas agora recuperar, que seja aquele brilho nos teus olhos que me faz sorrir tanto, que sejam aquelas noites na cama a olhar para a lua, que sejam aquelas viagens malucas onde tudo corria mal mas acabava sempre bem. Meu amor, tenho tantas saudades desses dias que nem sei o que te ei dizer. Pode parecer que me esqueço, mas levo esses dias comigo, bem guardados para onde quer que vou. Vou continuar andando, mas levo-te comigo e ao nosso rapaz, todos juntos, todos felizes, como um dia que já passou.

Foi bom enquanto durou, foi tão bom, foi.

sqliteforum.com was sold

This week I've placed http://sqliteforum.com for sale and this operation was quickly concluded at the asked price.

My congratulations to the new forum owner, I really hope it meets your expectations and that it grows over the next years.

As for reasons to let go of the site, I'm reducing the number of forum sites where I am not directly involved to focus on the ones I really feel motivated to participate actively. The revenue gathered from this sale allowed to acquire an IP.Content addon for the http://reboot.pro community and still left enough money for other components that we might see of interest to add.

So, this week we also started upgrading the forum software on reboot and solve many of the issues that had been reported over the past 8 months. We are now using the default theme as skin and just adding slight changes on the header to keep it thinner in height.

Mikorist has been a real help to get all this done, wouldn't really be possible without him to carry forward these changes and improve our work conditions.

Many changes, so far for the better as the new version is really neat.

:)

All Quiet on the Western Front

I should be happy.

This month I saw WinBuilder being featured again at one of the most popular PC magazines in Germany. To my surprise, I noticed that at the same time a few other PC magazines were promoting tools such as FiraDisk and Grub4DOS that are also hosted at http://reboot.pro

As we speak, all the roads in the boot field are pointing at reboot.pro in some manner or another and we don't like to disappoint our community.



It is one of those moments in life when you feel some sense of achievement for being part in something that steps outside of the virtual world and produces something of real value to so many people.

It is a sense of achievement that arrives 6 years after I first started my online activities, and yet it feels terribly bitter today.

I miss a lot of things that I had at my reach 6 years ago.

Professional life got better after fights and challenges that would seem lost at the beginning and are now at reach to be conquered.

New software is being developed on the pipelines with promises of unprecedented results and expectations.

Working groups are flourishing, assembled with friends of trust that assure quality and continuation of the research tradition that we like to follow.

So many things that I should really feel proud about seeing right now.. yet, I feel so tired and not really victorious. I miss my family, I miss a stable life, I miss vacations and not working so hard during the weekends.

I understand that no person can have all the things they want. The western front of boot land is ours at last, but my personal life got lost in the process and I'm not happy.

All is quiet on the western front but this is not good enough, let's move.

Remedium was launched

The first beta version of Remedium was launched this week at http://reboot.pro/14801/


It has been a very long year moving this platform from my sketches onto a a real implementation as seen on the screenshot but I am happy with the current result.

Remedium opens the door to a new portofolio of projects based on the Java platform/language.

It is also an opportunity to move from an aging concept of applications restricted to work from a desktop onto applications that take advantage of web browsers and remote management.

So, when accounting the learning curve to program in Java proficiently, the effort to create a new platform from scratch and still account with the research work necessary to implement a new security concept, I would say that our development time required to make this possible since the past year was indeed put to good use.

Wouldn't have made it this far without the help of Professor Benoit Morel from CMU and my close friend José Feiteirinha. The professor helped me keep my feet to ground about the goals to reach and José brought really cool ideas to make this platform a reality.

Unless you had been involved since the start, it is difficult to have an idea of the effort required to implement this work. It required a bit too many rewrites until it resulted in a simple solution.

The first phase has been completed. The remedium client is indexing all files inside a given machine and placing the gathered data inside a set of databases.

Indexing files is not an amazing feature, creating a superb architecture was the real challenge. It provides enterprise functionality such as message queues, web server and component based modules that will allow us and other developers to expand remedium with more features.

The next two phases are equally challenging if not even more. We will start to work in a networked environment and aggregating data from multiple sources along with also feeding multiple points.

In the end, we should have a system capable of allowing users to exchange data and provide feedback on their own, using a perfectly decentralized structure.

A lot of work ahead, but it has been fun so far.

Little pieces.. Little pieces..



Today I am very happy. Solved a challenge that had been a concern for almost a year.

I needed to find a way of keeping two databases (more specifically two tables) in different machines synchronized with each other. It was simple enough to solve this task when designing the system.

As depicted on the image, the proposed concept was clean to understand and perfectly logical on paper. But in implementation this solution was not clean at all.

Maintaining two databases synchronized was not difficult, the difficulty appeared when the pairs of databases to be maintained starting multiplying and the conscience worries of knowing that even more databases would appear in the future.

When designing system architectures, one can imagine in advance several problems that will be encountered. But when building a brand new system, there exists scarce preparation to get things up and running as intended from a blue print. The proposed solution was too complicated for getting data exchanged. Common sense dictates that the more complex a system becomes, the more prone it becomes to errors and difficult to improve in the future.

I wasn’t happy. The implementation looked “ugly” from all possible perspectives, and to my despair it wouldn’t even scale to the exchange of gigabytes between remote machines as necessary.

After five months of frustrating effort to make the designed concept work in a simple manner, it was time to throw the towel and re-think the attitude to solve the problem.



Gathered my notes about what had been learned from past months, locked myself in the house for two days and only stopped when it was finally working: the new solution is simple and functional.

Too many data containers need synchronism, the server part had to manage each one manually and the whole thing grown into a huge puddle of mess.

The new solution is imaginative and breaks away from a rigorous concept of client-server onto a mixed model of peer to peer data exchange.

It is so simple that required only two methods inside a single class to work as intended and scale to whatever size of data in need of being exchanged up to the tens of gigabytes.

In resume, we start with the traditional client-server approach to discover who is authorized to exchange data, after the initial handshake protocol we ask each database container to “talk” with their counterpart database container on the server side.

This method drastically reduced the administration burden. Each client container will update with new information their server container when it becomes available and vice-versa. We maintain a supervising entity of transactions to provide security while allowing each container to ensure that they correctly pass data onto the other side.

So, I no longer need to care about individual instances of containers and if more instances are added to the bulk, they will follow the same rules and patterns as the previous ones.
Breaking the data exchange problem onto little pieces has helped to break the complexity of this problem into a manageable solution.

Simple solutions are nowhere simple to be found. They take a lot of effort, time and concentration to be found. They truly bear a heavy price to achieve.

My advice is that you should make your best to run that extra mile and find them.

In the end, they are worth the effort.


(screenshot image credits to http://goo.gl/1a40b)

Commencement@CMU

It has been a long journey.

Started officially in 2009, but was dreamed, prepared and awaited many years before.

Now we are in 2011. I feel that an important chapter was closed, and that many other interesting chapters in this book called "life" are still waiting to be written.


It was a long journey indeed.

More than a degree, it was the opportunity of being here that made me see the world from a very different perspective.





It was fun. Passing through good times, bad times and unique times. But above all, these were memorable times that made me grow as a person.



A lot of people helped me reach this far and I am forever grateful to all of them. My only expectation is that I can one day give back to others all the support that I received.

Thank you for everything, the MSE changed my life.

Security analysis of java based web forum products

A month ago I received a request from the University of Coimbra to look into the current options of Java based web forum software to provide my opinion on each of them.

To be honest, I am not impressed nor convinced that any of them are suited to power a popular web site that gathers a lot of (malicious) attention.

Regardless of personal preferences, I am sharing my opinions and impressions after evaluating each product that might help other people in the situation of choosing a Java based forum. You find this report at http://goo.gl/TfvKn

My ranking for these products is the following:

1 - JForum
2 - mvnForum
3 - JavaBB
4 - Yazd
5 - JSforum
6 - JGossip

In the forum arena, I should really note that PHP based forum software from groups such as vBulletin, IPB and myBB will really save you a lot of headaches in the future. Plus, it is possible to run PHP inside Java using a framework such as Quercus PHP.


The simple beauty of NoJax

Recently I've needed to figure a simple way of updating a web page at each 4 seconds.

The modern web 2.0 option is using AJAX (Asynchronous JavaScript and XML) and this option sounded fine and dandy. Got myself exploring this path, finding some nice tutorials and simple guides that took away the black magic underneath the Javascript to reach the intended results.

However, I was having a lot of troubles to get it working as intended. On some browsers it would work, on some others it wouldn't. On some browsers I would know how to fix the issues while in some others remained a complete mystery.

This was no longer the simple solution I was hoping to apply and found a nice alternative: Meta tags.

The concept is simple, just add a meta tag requesting for the page to be reloaded within some seconds in the future. Simple, practical and works across all browsers.

Some obvious side effects: it will reload the whole page instead of a silent AJAX-style update. Other than that, it does get the job done in a stable manner.

Credits go to the about.com page that has a nice tutorial: http://webdesign.about.com/od/metataglibraries/a/aa080300a.htm

It is nice to enjoy the simple beauty of NoJax.

:)

The importance of database isolation


This week I've continued to progress on the new project.

One of the worries that has been roaming my head was the isolation of data between different components. On the current concept, components are isolated from each other to some extent but they still share some common resources like the database.

Below is a simple diagram that depicts the difference between shared and isolated approaches to database storage (credits to Mary Taylor @ IBM).


It was a relevant point to ensure that this resource would also stop being shared for the following reasons:
  • One faulty component could wreck the database, causing other components to also fail
  • 10 components can share a single database, could 100 or even 1000 use the same model?
  • No duplicate table names on the database could exist, this issue is aggravated when sharing this resource with other components
  • One single point of failure, if the database goes offline then all others will also fail to recover themselves

And some advantages also surfaced:
  • Each component can define custom login/passwords to access their database
  • Full control over the data that is stored, no other components change the data by accident
  • Provides choice between running their HSQL database based on a disk file for optimum storage or stored in volatile RAM for optimum speed
  • Each component can now individually store up to 16Gb of data using HSQL

I suspected that transitioning from a shared database model onto an isolated model would be somewhat troublesome, but the implementation was (fortunately) completed in a half a day and the effort was surely worthwhile. The end result passed all test cases and works exactly as intended.


Lesson learned:

When designing/implementing an architecture, do take into consideration the importance of keeping these resources isolated from each component as early as possible. In the long run you are improving the robustness of the system that is being designed.



Editing large text files (above 1Gb of size)

Recently I've began working with considerably sized text files that cannot be edited with the regular text editors such as plain notepad or notepad plus.

To keep on working, I found Cream (http://cream.sourceforge.net). This editor is free and handles fairly well files of larger dimension. It is supported across multiple Operative Systems, I could use VIM but I really prefer to use big round buttons and menus to get my work done.

Albeit the cream editor allows you to change big files, it is not a magic bullet and you should be prepared to wait some time until your changes are saved back to the file on disk.

Having said this, I think the tool is really worth to try out.

:)

Old school programming


This weekend was intense.

While working on my current project, I've slowly reached the conclusion across the past week that many things were wrong on the adopted architecture and that a simpler solution could be adopted.

Reminding myself of the words from a wise software engineer about efficiency of the good enough I could have kept on moving, but it would pain my soul knowing that things were not optimal. If there was a time to make changes, the time was now.

Couldn't afford more schedule slips as seen for the month of the March. So I've decided to plunge myself into a coding marathon to rearrange the code and do things right.


Started of at Friday after work around 17:00 and stopped around 04:00 Saturday morning to grab a snack and some sleep. Saturday and Sunday followed similar hour addiction for code cranking the intended result. The outcome was fabulous!


Not only the new framework is simpler in terms of architecture, it also looks great. The web user interface provides a neat appearance and makes life a lot easier than creating a Swing based interface for each component of the system.

Many other nice-to-have features were also added this way. People can use browsers or third-party developers can create wrappers that make use of the provided web services.


I know that anything coded during a hackathon weekend will haunt me with defects across the next times. That is a risk. But it is still better than living with an architecture that that would only add layers of unnecessary complexity and my own (human) resources are too limited to cope with them.

As result, there is absolutely no need to adopt a Google web toolkit, hibernate, SEAM, JBoss or ActiveMQ COTS for the moment.

The current result can rightfully be called old school programming (compared to current trends of course). And I say this perfectly aware of all advantages and disadvantages that come from this design decision. But nevertheless all that, there is elegance in simplicity and this is the route that I prefer to follow whenever possible.

And speaking of small, the entire framework when including the database (HSQL), message queue, process manager, web interface and remaining components is still using some whooping 3Mb of disk space.


Below is demonstration screenshot of the current status. The page demonstrates two applications. The first one is a simple file browser and the second demonstrates a simple page with text. Each application can host child applications and these are automatically added on the page tabs.




Tough weekend but happy results.

:)



Last night a findbugs saved my life

Do you know what FindBugs is?

It's a neat tool for Java that helps coders find part of your software that are plain redundant or might even run into "bugs" in the future (I prefer to call them "defects" rather than plain "bugs").

I had already used FindBugs in the Eclipse IDE last year, but only recently started using this tool for the NetBeans IDE and now I really appreciate its value.

To install this tool as an integrated plugin of Netbeans is fairly simple and covered widely across the Internet (here's an example).


When I started applying FindBugs on my current project, I noticed that my code was syntactically correct and ran as intended on the test cases, but FindBugs flagged some relevant concerns.

For example, it would flag a warning when new objects were created in a redundant manner or even when a given result might not be handled properly (null handling).


But what I found to be the most useful feature of them all, is the help for coding systems where multiple concurrent threads share information between them.

I mean, a developer already has some notion of practices necessary to prevent thread starvation and other concurrency errors but there exists a good amount of human effort and possibility of human flaw that frustrate your coding progress.

This is where FindBugs came to the rescue. While coding it was consistently able of reporting to me which methods were required to be synchronized in order to prevent thread locking and inherent locking of the outputs expected by other threads.

I would have been able of solving the synchronization issues on my own but having this tool available to help was a real time saver.

If you're still resistant to the idea of using FindBugs after reading all this, do try it by yourself at least once and then let me know what you think.

Take care!

:)



Simple and fast recursive find files for Java

This week I needed a simple routine to find files inside a given folder and respective sub folders.

There are plenty of solutions around the web, but these solutions typically use a second method or even more, instead of a single recursive method.

Below is the code that I've written, it is not perfect nor fully tested but it is simple and fast on my Toshiba R630 Win7 laptop (indexed 152450 files in 30Gb of data under 12 seconds), so I'm happy and decided to share this code snippet with the rest of the world.

It will output an array list composed of File objects. You only need to define where (the starting folder) and maxDeep (the level of subfolders that you want to crawl).

If you have suggestions for future improvement, please do mention them and I'll update the snippet along with placing your name on the credits. I liked this solution but I'm by no means a coding guru.

Have fun!



You find the snippet at this doc: http://goo.gl/pKq0D



--- update 1 (23th March 2011), the code was made shorter and simpler. Please update.

--- Benchmarks
Testing on drive D: with 30Gb of data took an average 12 seconds for 152 450 files
Testing on drive C: with 92Gb of data and 476 789 files started with 829 seconds on the initial scan and on posterior scans dropped to an average of 140 seconds.

Machine of these testings was a Toshiba R630, equipped with 4Gb of RAM, an i7 core and Windows 7 x64 bits.

:)