Skip to content

Year: 2008

OpenSolaris Vending Machine

Takadonobaba Vending Machines, Creative Commons Photo by Abuckingham, Flickr user
Vending Machines, Creative Commons photo by Abuckingham

Those days I was walking in a college to a tech demo and saw a lot of vending machines for soft drinks, coffees and snacks. So I thought “For a college student can be easier get a soda than a free software copy, like opensolaris”. Wouldn’t be nice if we have an OpenSolaris vending machine?

I sketched this idea:

OpenSolaris Vending Machine
OSVM, Open Solaris Vending MachineBut notice that is not just an CD/DVD vending machine. The OSVM could deliver the newest version of the OpenSolaris distributions to places where internet connections aren’t easy or cheap enough to download entire DVD images. A way to deliver open software to people who would have otherwise not been able to acquire it! Just choose, pay and get your free software.Press button, Receive bacon OpenSolaris.

Conceptual sketch of the opensolaris vending machine

Inside the machine:

  1. Switch
  2. External Internet connection
  3. Touch screen monitor
  4. Coolers
  5. Coolers
  6. Uninterruptible power supply
  7. External power source
  8. DVDs supply
  9. Money chest
  10. Paper money recognition device
  11. DVD Recorder
  12. OpenSolaris computer

Main challenges:

  • It’s necessary an broad internet connection (item 2) so the vending machine can have allways the last builds of each distribution (Indiana, Nevada, Nexenta, Solaris Express, etc). In places where this connection is not available someone should periodically supply the vending machine with more iso images.
  • The idea of using an touch screen monitor (item 3) is having a very usable and rich user interface.
  • The user should pay for using a paper money recognition device (item 10). I don’t know much about those devices but I guess you just buy an money recognition box that do this for you. After payed the money goes to some kind of chest (item 9).
  • The media should come from the supply (item 8 ) to the recorder (item 10) and so be delivered for the user. But how?
  • An technology such LightScribe would just fits perfectly in this machine.
  • The OpenSolaris computer (item 12) should be capable to store and manage all dvd iso images from each distributions. A reliable filesystem like ZFS would help.
  • A software to manage the downloading of each distribution periodically.
  • A software to provide a rich user interface, easy and nice to use. JavaFX should fits well.

Haven’t I see this before?

Someho, yes, some similar idea. IBM did a similar project some year ago and there’s too the cool Freedom Toaster that is similar in some points.

What is all about?

Is just a open idea. You can comment, suggest and I’d love to see that implemented.

Update 20.Out.2008: Thanks for those who are helping this idea and giving more ideas. Specially thanks for Everton Rodrigues. Maybe in some time we have an prototype.

Some useful links

Ruby: A Simple Example of Meta Programming

A really cool piece of code I read today in the book Ruby on Rails: Up and Running.

class Talker
  def method_missing(method)
     if method.to_s =~ /say_/
       puts $'
     end
  end
end

t = Talker.new

t.say_hello
t.say_something
t.say_goodbye

And running

$ ruby Talker.rb
hello
something
goodbye

But why do that when we have parameters? Because you can do some methods really dynamic with a clear semantic, just looking for them you know are they are doing.

Java assertion to prevent time travelers

cc broken pocket watches
Creative Commons photo by jekemp

public class PreventTimeTravelers {
    public static void main(String args[]){
        long startTime = System.currentTimeMillis();
        long endTime = System.currentTimeMillis();
        assert endTime >= startTime: "We came back in time!";
    }
}

Please do not execute this code in a time machine.

NumberFormatException Example

NumberFormatException: Thrown to indicate that the application has attempted to convert a string to one of the numeric types, but that the string does not have the appropriate format.

An simple example:

public class SummationExample {
    public static void main(String args[]){
        int sum = 0;
        for(String arg: args){
            System.out.println("+" + arg);
            sum += Integer.parseInt(arg);
        }
        System.out.println("= " + sum);
    }
}

$ javac SummationExample.java
$ java SummationExample 1 2 3 4 5
+1
+2
+3
+4
+5
= 15

but

$ java SummationExample 1 2 3 4 five
+1
+2
+3
+4
+five
Exception in thread “main” java.lang.NumberFormatException: For input string: “five”
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:447)
at java.lang.Integer.parseInt(Integer.java:497)
at SummationExample.main(SummationExample.java:6)

So

public class SummationExample {
    public static void main(String args[]){
        int sum = 0;
        for(String arg: args){
            try {
                sum += Integer.parseInt(arg);
                System.out.println("+" + arg);
            } catch (NumberFormatException e) {
                // nothing
            }
        }
        System.out.println("= " + sum);
    }
}

now

$ javac BetterSummationExample.java
$ java BetterSummationExample 1 2 3 4 5
+1
+2
+3
+4
+5
= 15

and also

$ java BetterSummationExample 1 2 3 4 five
+1
+2
+3
+4
= 10

Java Duke animated gif waving

JRuby simple example

JRuby is a Java implementation of the Ruby interpreter, with an tightly integrated with Java. In this examples you will call swing components.

On Ubuntu you can get it installing the package jruby (a meta package for jruby1.0 or jruby0.9 packages).

To test it save this code as test.rb and invocate it with the jruby interpreter:

require 'java'

frame = javax.swing.JFrame.new()
frame.getContentPane().add(javax.swing.JLabel.new('Hello, JRuby World!'))
frame.setDefaultCloseOperation(javax.swing.JFrame::EXIT_ON_CLOSE)
frame.pack()
frame.set_visible(true)

$ jruby1.0 test.rb

Hello JRuby World

ps: We did not define a close method, so to close this windows you’ll need to kill its process or press Ctrl+C in your terminal.

List of popular programming book acronyms

I found cool this list on reddit.

  • AIMA Artificial Intelligence a Modern Approach by Stuart Russell and Peter Norvig
  • AMOP The Art of the Meta Object Protocol by Gregor Kiczales
  • ATTAPL Advanced Topics in Types and Programming Languages by Benjamin C. Pierce
  • AWDWR Agile Web Development with Rails by by Dave Thomas and David Heinemeier Hansson
  • EOPL Essentials of Programming Languages by Daniel P. Friedman, Mitchell Wand, and Christopher T. Haynes
  • CLR Introduction to Algorithms by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest
  • CLRS Introduction to Algorithms, 2nd Edition by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Cliff Stein
  • CLtL Common Lisp the Language by Guy L. Steele Jr.
  • CTM Concepts, Techniques, and Models of Computer Programming by Peter Van Roy and Seif Haridi
  • GOF Design Patterns by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides (the Gang of Four)
  • HOP Higher-Order Perl by Mark Jason Dominus
  • HTDP How To Design Programs by Matthias Felleisen, Robert Bruce Findler, Matthew Flatt and Shriram Krishnamurthi
  • K&R The C Programming Language by Brian Kernighan and Dennis Ritchie
  • LiSP Lisp In Small Pieces by Christian Queinnec
  • LL Lessons Learned in Software Testing by Cem Kaner, James Bach and Bret Pettichord
  • PAIP Paradigms of Artificial Intelligence Programming by Peter Norvig
  • PCL Practical Common Lisp by Peter Seibel
  • PLP Programming Language Pragmatics by Michael L. Scott
  • SICP Structure and Interpretation of Computer Programs by Hal Abelson and Gerald J. Sussman, with Julie Sussman
  • TAOCP The Art Of Computer Programming by Donald E. Knuth
  • TAPL Types And Programming Languages by Benjamin C. Pierce
  • TCPL The C++ Programming Language by Bjarne Stroustrup
  • TCS Testing Computer Software by Cem Kaner, Jack Falk, and Hung Quoc Nguyen
  • TLS The Little Schemer by Daniel P. Friedman and Matthias Felleisen
  • TSPL The Scheme Programming Language by R. Kent Dybvig
  • TSS The Seasoned Schemer by Daniel P. Friedman and Matthias Felleisen
  • TRS The Reasoned Schemer by Daniel P. Friedman, William E. Byrd and Oleg Kiselyov
  • WELC Working Effectively with Legacy Code by Michael Feathers

Introdução ao Solaris e opensolaris.org

Você lembra que eu falei sobre Cursos de Java de Graça para Estudantes?

Opensolaris Logo

O Sun Student Courses abriu mais um curso (Introduction to Solaris and opensolaris.org), agora sobre Solaris e opensolaris.org no mesmo estilo do curso anterior (Real World Technologies: NetBeans GUI Builder, JRuby, JavaFX, and JavaME).

Sun Students Courses

São 5 tópicos:

  1. Introduction to the course and opensolaris
  2. Java Desktop System
  3. SMF – Service Management Framework

  4. Solaris Containers, OS level virtualization for Solaris

  5. Introduction to ZFS
  6. DTrace – Dynamic instrumentation of system and applications

E só para lembrar:

  • É de graça!
  • No momento os cursos só estão disponíveis em inglês.
  • Cada tópico tem uma parte em texto, uma em slides e um questionário no final. Quando você responder corretamente todos os questionários você pode pegar um certificado de conclusão de curso.
  • Não perca essa ótima chance de estar em contato com tecnologias de ponta como ZFS e Dtrace. 😉

Graduation Party

Silveira Neto, Heraldo Carneiro and Cassiano Carvalho
Me, Heraldo Carneiro and Cassiano Fontenele.

Gorila (me) and Deborah
I’m the furry one with my girlfriend.

This year I’ll be graduated in Computer Science by UFC. We anticipate the party so we all can come. Was really a wonderful party. Thanks all made this celebration possible.

Below some photos from my graduation party.

You can see all photos on it’s album.

Concurso de Blogagem NetBeans IDE 6.1 Beta

Typewriter
Creative Commons Image
Está cada vez mais fácil colaborar com projetos livres.Quem diria que você poderia blogar sobre um projeto livre e ainda ganhar dinheiro e brindes? Esse é o Concurso de Blogagem do Netbeans IDE 6.1 Beta. Blogando você disputa:

  • 10 chances de ganhar um vale-compras American Express no valor de U$ 500,00.
  • 100 chances de ganhar camisetas do Netbeans.

Tudo que você tem que fazer é:

  1. Baixar o Netbeans 6.1 Beta (ou o último release) e experimentar.
  2. Blogue sobre isso.
  3. Envie a URL do seu blog e post.
  4. Faça isso antes de 18 de Abril de 2008!

Os posts enviados seram julgados e serão escolhidos 10 vencedores para ganhar os vale-compras. Os 100 melhores posts ganham camisetas do Netbeans.

Basicamente é isso mas há informações mais detalhadas na página de regras do concurso. Se você estiver com preguiça de ler eu fiz esse perguntas e respostas.

Perguntas e Respostas

O que é esse Netbeans 6.1 Beta?

Netbeans é uma IDE (ambiente de desenvolvimento integrado), um programa que lhe ajuda a construir programas. É multiplataforma (você pode usar no Linux, Windows, Opensolaris, etc), tem suporte há várias linguagens (Java, C/C++, Ruby, PHP etc), disponível em diversos idiomas (a comunidade de tradução para português é uma das mais ativas) e livre (disponível em licenças GPL e CDDL). Para saber mais dê uma olhada na página de características do Netbeans.

Eu posso fazer um post em português?

Sim. Você também pode postar em inglês, espanhol, russo, francês, chinês simplificado, japonês e polonês.

É sorteio?

Não. Os melhores posts serão julgados e classificados. Se seu post estiver entre os 100 melhores você ganha uma camiseta do Netbeans, se estiver entre os 10 melhores, quinhentas doletas. 😉

E eu vou falar do que nesse post?

Teste o Netbeans 6.1 Beta, procure as novidades em relação ao Netbeans 6.0.1, mostre como fazer certas coisas, tire screenshots. Enfim, seja criativo!

Você pode dar uma olhada na lista de características e novidades no Netbeans e se inspirar.

Mas eu não tenho um blog?

Já pensou em criar seu próprio blog? Eu sugiro que dê uma olhada no wordpress.com onde você pode hospedar seu blog de graça usando um ótimo motor de blogs.

Eu posso pegar o post bacana de alguém e submeter dizendo que é meu?

O que é que você acha? ¬_¬
Não, não pode.

E se eu pegar um post bacana de alguém, em outra lingua e submeter dizendo que é um post original meu? Pode?

Não. Claro que não. Você vai ser desclassificado se fizer isso.

Boa blogagem pra você.