Wednesday, November 27, 2013

SWARM

Last week was quite demanding, starting at 03:00 AM, followed by a normal work day, then starting again at 02:00, sleeping one hour and followup with three 12 hours night shifts.. it was quite exhaustive and very rewarding.

Sometimes during the night shifts, between the ground stations reporting and the occasional moments of complete silence I could feel the link to space, the distance and the adventure that it is to control three robots at 400 kilometers altitude.

It was this feeling and my responsibility towards helping make it happen that gave me the focus and energy I needed. Day and night it was a challenge to everyone in that room, and I feel we all made part of something great.


A mind that is stretched by a new experience can never go back to its old dimensions.
- Oliver Wendell Holmes, Jr. 




Monday, October 21, 2013

Save AIRBNB in New York


I've used AIRBNB only once so far, but it was suitably in a trip to New York.  Earlier this year I went there with my wife on our first wedding anniversary.

While there people commented about some complaints from local hospitality industry complaining that the website was removing profit from them.

Honestly I doubt that is true, in fact I would never have gone to NYC if it had not been for the competing prices of this website. When we were there, we effectively brought money in, not only by the local attractions but also by the restaurants, souvenirs and some shows we attended.

On top of all that we had a great opportunity to spend some time with our hosts get some insights and casual conversations not usually available to the traditional tourists.

All in all, I just wanted to leave here my support and appeal to help keep AIRBNB in NYC and in the US. It will definitely increase the likelihood of us going back to the US on holiday.

If you agree with this, you can sign a petition online, here:

Sunday, July 28, 2013

SDK contained folders

If you're like me and can easily find yourself struggling with Eclipse's multiple plugins and too many unrelated projects, then maybe you want to know how I do it.

Eclipse's own solution is working sets, however I still struggle with plugins, sometimes it just seems overkill to have Android, Java, C, Ruby and others all together in one huge immutable installation.

In the end I decided to simply have multiple Eclipse installations.

One folder for each project and dependencies. One clean, movable folder. Other projects have different folders, and occasionally - when they share code - subversion/git do the trick and one project can be on multiple eclipses.

I find this works for me the best, but let me know what you think.

Thursday, July 18, 2013

BigStructure 0.5 released

This latest commit includes the expected changes plus plenty of "beautification". Groovy clients are now simpler and clearer to read, check it out: https://code.google.com/p/bigstructure/

"BigSTRUCTURE is a scalable backend infrastructure where Processing Power is detached but guaranteed, we enable applications that can seamlessly run in 1 or 1000 machines."

Sample of code using core services.
DemoClient.groovy:
import org.feiteira.bigstructure.client.BigSClient
import org.feiteira.bigstructure.core.EchoRequest
import org.feiteira.bigstructure.client.EPUimport org.feiteira.bigstructure.core.EchoResponse
class DemoClient extends BigSClient {
        @Override
        public void Main() {

            requestEPUBlocking("/echo");// ensures that the host node /<id>/echo exists (or takes the current one if available)  
                                
            //takes some arguments
            int count = arguments[1].toInteger()
            String value = arguments[2]
                
            EPU echo = epu("/echo");

            EchoResponse out;
            while(count>0){
                 echo.request(new EchoRequest(value));
                 out = echo.getResponse();            
                 printf "[%d]ECHO: %s\n" , [count,out.getValue()] as Object[]
                 count--;
                 sleep 1000
            }                       
        }
}
Command line: java -jar BigSTRUCTURE-0.5.jar Client DemoClient.groovy 10 Test!
Note: don't forget to run java -jar BigSTRUCTURE-0.5.jar Server on another shell on the side
Output:
[10]ECHO: Test!Test!
[9]ECHO: Test!Test!
[8]ECHO: Test!Test!
[7]ECHO: Test!Test!
[6]ECHO: Test!Test!
[5]ECHO: Test!Test!
[4]ECHO: Test!Test!
[3]ECHO: Test!Test!
[2]ECHO: Test!Test!
[1]ECHO: Test!Test!

Friday, July 5, 2013

Cartel definition and Internet access in Portugal

cartel is a formal (explicit) "agreement" among competing firms. It is a formal organization of producers and manufacturers that agree to fix prices, marketing, and production.[1] (...) The aim of suchcollusion (also called the cartel agreement) is to increase individual members' profits by reducing competition.
(...)
Competition laws often forbid private cartels. Identifying and breaking up cartels is an important part of the competition policy in most countries, although proving the existence of a cartel is rarely easy, as firms are usually not so careless as to put collusion agreements on paper.[2][3]
Let's look at the data:


 All of the above competing companies offer 4 months at 50% discount and exact same prices (within a margin of Eur 0,01)

See also (Portuguese legislation forbidding collusion):

CAPÍTULO II

Práticas restritivas da concorrência
 

SECÇÃO I

Tipos de práticas restritivas
 

Artigo 9.º

Acordos, práticas concertadas e decisões
de associações de empresas

1 - São proibidos os acordos entre empresas, as práticas concertadas entre empresas e as decisões de associações de empresas que tenham por objeto ou como efeito impedir, falsear ou restringir de forma sensível a concorrência no todo ou em parte do mercado nacional, nomeadamente os que consistam em:
a) Fixar, de forma direta ou indireta, os preços de compra ou de venda ou quaisquer outras condições de transação;

Disclaimer:
All contents on this post were collected on the 5th July 2013. 

There is absolutely no original thought here, only:
- a clear exhibition of the publicly available information from the companies 
- a definition exert from Wikipedia.
- a quotation of the legislation

Tuesday, April 30, 2013

Reading Groovy objects from Java

Loading a Groovy object in Java is not as easy at it seems, but doesn't have to be hard.

The problem with Groovy dynamic classes is that the default class loader is not aware of them. Using the GroovyClassLoader should be as simple as:
GroovyClassLoader gcl = new GroovyClassLoader(); 
Thread.currentThread().setContextClassLoader(gcl); 

Doesn't do the trick and a call to the ObjectInputStream will raise the devil's ClassNotFoundException.

After many attempts refining my Google search from "reading Groovy objects" down to "ObjectInputStream ClassLoader" I finally found this link and was able to solve the problem.
The trick was overriding the resolveClass method from the ObjectInputStream, which apparently always uses the default class loader.

Full code example below.

TestObjectInputStream.java:
public class TestObjectInputStream extends ObjectInputStream { 

    @Override 
    public Class resolveClass(ObjectStreamClass desc) throws IOException,
            ClassNotFoundException { 

        ClassLoader currentTccl = null
        try { 
            currentTccl = Thread.currentThread().getContextClassLoader();
            return currentTccl.loadClass(desc.getName()); 

        } catch (Exception e) { 
        } 

        return super.resolveClass(desc); 
    } 

    public TestObjectInputStream(InputStream in) throws IOException { 
        super(in); 
    } 

}

TestSave.java:
public class TestSave { 
   public static void main(String[] args) throws CompilationFailedException, 
            IOException, InstantiationException, IllegalAccessException, 
            ClassNotFoundException, IllegalArgumentException, 
            SecurityException, InvocationTargetException, NoSuchMethodException { 
        GroovyClassLoader gcl = new GroovyClassLoader(); 
        Thread.currentThread().setContextClassLoader(gcl); 
                                                             
        String fileName = "scripts/SimpleData.groovy"
     
        Class clazz = gcl.parseClass(new File(fileName)); 

         
        Object instance = clazz.newInstance(); 

        System.out.println("WRITING OBJECT FROM CLASS: " + instance.getClass());

        // write 
        File outFile = new File("file.bin"); 
        FileOutputStream fos = new FileOutputStream(outFile); 
        ObjectOutputStream oos = new ObjectOutputStream(fos); 
        oos.writeObject(instance); 

        // read 
        File inFile = new File("file.bin"); 
        FileInputStream fis = new FileInputStream(inFile); 
        TestObjectInputStream ois = new TestObjectInputStream(fis); 

        Object obj = ois.readObject(); 

        System.out.println("Class: " + obj.getClass()); 

        System.out.println("Object: " + obj.toString()); 
        System.out.println("Object: " + obj.toString()); 
        System.out.println("Object: " + obj.toString()); 

        Serializable seriobj = (Serializable) obj; 

        System.out.println("Serializable Object: " + seriobj); 
    } 
SimpleData.groovy:
class SimpleData implements Serializable { 
    public int value = 1; 

    public SimpleData(){ 
    } 

    public String toString(){ 
        return "Value: " + (value ++); 
    } 

And the console's output:
WRITING OBJECT FROM CLASS: class SimpleData
Class: class SimpleData
Object: Value: 1
Object: Value: 2
Object: Value: 3
Serializable Object: Value: 4




Thursday, April 18, 2013

Reality will change

A VR road-map

early 2013 - early adopters
Oculus Rift developer version comes out, lot's of flaws but it's a clear improvement on what was previously available.
Some issues are: Lack of positional tracking, Low screen resolution


2013 - the hacker scene
Hackers will do everything you can imagine.

*Oculus Rift streaming Two cameras on the other side of the world? Will be done this year
Imagine looking around and seeing 3d.. on the other side of the globe!

*Oculus Rift with mounted MS Kinect? This year
This will be the first real shot at augmented reality. 
Yes... It will be an interface to much (you'll have cameras in front of your face that will send data to your computer that will forward it to each eye....)

But with the depth perception from Kinect, you'll be able to do just about anything with reality.

late 2013 - Project Glass
In it's current model, I suspect that if Glass sells is because either they can sell it as a status symbol or it's so cheap it's worth to buy it just to have an handsfree camera. 
Don't take me wrong, I love the idea, but after having watched parts of the developer conference I believe it's not there yet... Imagine Android 1.0.

2014 - a new market is born
Oculus Rift consumer version, low screen resolution has been mostly fixed. Positional head-tracking can be done with 3rd party hardware. Some games already offer support (think Razor Hydra, Kinect, ...)
Lots of new startups showing up around OR. 
- Some will target real-life simulations, think surgeries, think fobias, war, telepresence..
- Some will target entertainment in all fronts. Games will be the first, but titles such as "Virtual Vacations" will show-up. Adult entertainment also.

late 2014 - big players arrive
Samsung and Sony both release their new VR headsets (MS will follow in early 2015).

Project glass will grow in users but will remain pretty much the same. Think Android 2.0


early 2015 - tech teasers

Samsung makes some demos at CES showing for the first time VR headsets with incorporated Kinect like functionality and transparent screens/lens. These are bulky but they've removed the need for projecting reality onto the headset.


2016 - maturity
Nothing relevant will happen. Lot's of hype on new products but basically technology will mature. Singularity sceptics will forget the last 3 years.

2017 - Augmented VR
Samsung, Google or other, including Palmer Luckey - millionaire, releases the first wearable augmented reality kit. 
This will be the first "normal" glasses that will include 3d mapping of the real-world and lenses that will work as a reality overlay.
2018 - The merge
Real and Virtual reality will merge. There will be new words to distinguish between "Real-Reality" and the "Other realities"

Virtual worlds such as second life will stop being considered "virtual". People will say things like "Last night I was in Saturn-53, we should meet there I'll give you the link."


2019
You tell me :-)






Tuesday, April 9, 2013

nio-threaded-tools

Introduction

I was trying to find a non-blocking multi-threaded socket server in Java and could not find anything awesome. The best I could find was this hack on stackoverflow (http://stackoverflow.com/questions/5862971/java-readobject-with-nio).
I took the hack and basically used it as inspiration for this tools. Enjoy.

Quick start

This will allow you to seamlessly use non-blocking NIO sockets in a thread pool.

Server

Starting the server: SeriServer server = new SeriServer(6001); // port 6001, uses the default 10 threads
Starting the server in single thread: SeriServer server = new SeriServer(6001,1);// 1 thread
Reading data from the server: SeriDataPackage objectFromClient = server.read()
Accessing data read from server: System.out.println(objectFromClient.getObject().toString());
Sending data back to the client: server.reply(objectFromClient, message); // message must be serializable

Client

Starting a client: client = new SeriClient("localhost", 6001);
Sending data to server: client.send(message); // message must be serializable
Reading message from server: SeriDataPackage objectFromServer = client.read();
Accessing data read from server: System.out.println(objectFromServer.getObject().toString());

Server processing

You can also do automatic processing from the server threads, via the SeriSeriver.setProcessor:
final SeriServer server = new SeriServer(5003, 3);
server.setProcessor(new SeriProcessor() {
        public void process(SeriDataPackage pack) {
                try {                                   
                        server.reply(pack, "*" + pack.getObject().toString() + "*");
                } catch (IOException e) {
                }                               
                }
        });
                                
SeriClient client = new SeriClient("localhost", 5003);
client.send("TEST");
SeriDataPackage response = client.read();
System.out.println(response.getObject());
This will output: *TEST*






Saturday, March 30, 2013

Flash Memory Combines Graphene and Molybdenite

A while ago I posted "Newcomer: 2d sheet of MoS2 puts Graphene transistors in a corner, watch-out Silicon!"

Now:

"EPFL scientists have combined two materials with advantageous electronic properties -- graphene and molybdenite -- into a flash memory prototype that is very promising in terms of performance, size, flexibility and energy consumption."

"Combining these two materials enabled us to make great progress in miniaturization, and also using these transistors we can make flexible nanoelectronic devices," explains Kis. The prototype stores a bit of memory, just a like a traditional cell. But according to the scientist, because molybdenite is thinner than silicon and thus more sensitive to charge, it offers great potential for more efficient data storage.

Sunday, March 17, 2013

My development environment

Being stranded home recovering from knee surgery should be a great opportunity to watch pending movies play games and generally laze out.. But fortunately I'm a geek.  :-D

So since last week I've started my on my new project :) and I'm loving every moment of it. 

But this post is not about the project, instead about the development environment. 

First time I used an Integrated Development Environment, was back in 1996. I was using Turbo Pascal. Back syntax highlighting was all you needed and (for me) Object Oriented Programming was just a way to put procedures (methods) inside structures.

I started using Java in 99 in my first year at University of Coimbra. The editor of choice was Kawa and OMG it was SLOW! :-)

JBuilder was the first real IDE I've ever used, at that time Borland was king. That was ofcourse until Eclipse gained momentum (sorry, but for me Netbeans or other were never a real choice).

I've used Eclipse for a long time and was happy with it. But I was always disabling that annoying "Tasks" view on the right.. until I learned how wonderful it was!

I still have a very simple IDE, but now with Mylyn I feel super-human. If you don't know yet what Mylyn is, please check this out:

It's worth it, I promise! 

Additionally to Eclipse & Mylyn, another big part of my IDE is my phone (or Phablet if you prefer). Buying a Galaxy Note 2 was not an cheapeasy decision, but it is probably the best investment in technology and productivity I've ever done.

I use an app called Papyrus which I find much more valuable than the default S-Note from Samsung.

So now I can take notes and make the most creative tasks  such architecture sketches on the go (which right now means either in Bed or on the Couch) translate those notes into actions using Mylyn+Bugzilla's(I use the free provider www.bugheaven.com). And implement the actions at "speed of thought" using Mylyn's contexts.
Another relevant tool is Google Drive, which empowers me to seamlessly move files between Phone and PC, like the one I drafted below while writing this post:


So yes, while Java is still only Java, I can see how technology helps itself out in a synergy that not only makes me more powerful but allows for newer, fast development of even more tech. Aren't exponential times the best?


Friday, March 15, 2013

How to share?

I just found a very interesting article, so interesting that I would like to share it with my friends.

I pressed the tweet button, but the title was truncated. 
Better, I'll share it on Facebook. Well.. Facebook may be overkill,  only some may be interested. 
I shall use Google+'s relevant circle. 
But.. I may want to read it later, so I'll put this on my Blog.

minutes later...

Is it just me? Somehow it feels like everyone is asking me to share this, share that, promote (like) this, promote that.. and oddest of all, I feel obliged  to do it. 

When I read or watch something really interesting then I immediately feel this urge that won't go away until it's discharged via a Like or a +1, or  a tweet, or whatever they throw at me. Am I alone? 

Is this normal? Would I feel the same if I did not had the Like/+1/tweet/... option?

Also, is this retribution or self-advertising? Do I want to post as a thanks to the writer or associate myself to the writing by sharing it?

I don't know. If you're reading this, please let me know your thoughts. If and how you share articles, videos,.. Also, how do you select what to share? Or you never share anything?

Oh, and don't forget to press the +Facebook+ button.

btw, this was the article: Google, destroyer of ecosystems

Monday, March 11, 2013

Rocha Birnen :-)


Very that happy my wife found this on our local super market here in Germany. They taste like home :-)

Sunday, March 3, 2013

Wireless rechargeable brain sensor relaying real-time broadband signals from up to 100 neurons in freely moving subjects

“This device is a billion times more valuable per constant dollar than the computer I used as a student at MIT in the late ’60s. In 25 years, it will be the size of a blood cell. And it will be a billion times more powerful.” - Ray Kurzweil holding an iPhone - 2011 (link)




Brown unveils novel wireless brain sensor (Fev 2013)


In a significant advance for brain-machine interfaces, engineers at Brown University have developed a novel wireless, broadband, rechargeable, fully implantable brain sensor that has performed well in animal models for more than a year. They describe the result in the Journal of Neural Engineering and at a conference this week.

(...)In the device, a pill-sized chip of electrodes implanted on the cortex sends signals through uniquely designed electrical connections into the device’s laser-welded, hermetically sealed titanium “can.” The can measures 2.2 inches (56 mm) long, 1.65 inches (42 mm) wide, and 0.35 inches (9 mm) thick. That small volume houses an entire signal processing system: a lithium ion battery, ultralow-power integrated circuits designed at Brown for signal processing and conversion, wireless radio and infrared transmitters, and a copper coil for recharging — a “brain radio.” All the wireless and charging signals pass through an electromagnetically transparent sapphire window.
(continue to website)
Other related news...


Brain-to-brain interface lets rats share information via internet

(...) "These experiments showed that we have established a sophisticated, direct communication linkage between brains," Nicolelis said in a statement. "Basically, we are creating what I call an organic computer."
(...)
The rats were trained to press a lever when a light went on above it. When they performed the task correctly, they got a drink of water. To test the animals' ability to share brain information, they put the rats in two separate compartments. Only one compartment had a light that came on above the lever. When the rat pressed the lever, an electronic version of its brain activity was sent directly to the other rat's brain. In trials, the second rat responded correctly to the imported brain signals 70% of the time by pressing the lever.
(continue to website