2013-12-02

Internet of Things challenges according to Vint Cerf

Recently, Michael Cooney reported what were the seven key challenges facing the Internet of Things, according to Vint Cerf. Here is the list:
  • Standardized interfaces - such as IPv6
  • Configuration of massive of amount devices
  • Strong access control and authentication
  • Privacy and safety
  • Instrumentation and feedback
  • Dealing with software errors vulnerabilities and software updates
  • Potential opportunities for third party businesses

Read the full story on Network World.

2013-11-17

MITx and edX update from Prof. Sanjay Sarma

Prof Sanjay Sarma, Director of Digital Learning at MIT, gave a talk on Massive Open Online Courses(MOOCs), at the Indian Institute of Management, Ahmedabad (IIMA) on July 4, 2013.

Here are some of the talk's key points.


2013-10-19

Windows Phone 8 is great!

In the summer I switched to using Windows Phone 8 and Outlook.com using a Lumia 820.
So far I am very satisfied with the phone and the software. Windows Phone provides a great customer experience!

Here is a quick list of positive and negative aspects:

Positive:
- people-centric interface - finally, the contacts are all in one place
- Skype, Facebook, LinkedIn integration
- pin anything to start screen - including the pictures of your friends to keep track of what they're up to
- make notes and share them with PC, Mac and iOS with OneNote with cloud sync
- free Adobe Reader allows PDF comments

Negative:
- interface relies too much on text - a few more icons wouldn't hurt
- too few official apps - Dropbox, etc
- some interface disconnects - for instance, in the SMS menu there is no way to call the person

I recommended the following (paid) apps:

Pocket scanner: Handyscan

RSS Reader: feed me

2013-08-07

The BEST way to learn about the Internet of Things

Today I taught a class about The Internet of Things to the BEST Lisboa students.


Photo credits: Mário Romano

This is the presentation that I made:



This is the pinterest board with some of the cool Internet of Things stuff that I showed in class.

You can find more information about supply chain traceability in the TrakChain PhD project page.

And this is a sneak peek of the great demo that Nuno Correia prepared for the students:


I would also like to thank Link Consulting for sponsoring the demonstration and the people involved, Mário Romano and João Taborda Gonçalves.

Thanks also to Joana, for being there and helping with the people flow! :)

2013-08-02

How to disable Thunderbird mozmsgs

Mozilla Thunderbird has an option to integrate with Mac or Windows email search.
Using this option the emails are no longer stored in the SDB files (many emails in a single file) are stored in multiple and individual files.
This usually results in poor performance, especially if you have many emails.

To disable this option, go to 'Options', 'Advanced', 'General' and unselect the "Allow Windows Search to search message".
You can also unselect the "Enable Global Search and Indexer" option if you do not use the global search.

2013-07-31

How to use Gradle to generate Eclipse files with relative paths to libraries

First, apply the Gradle Eclipse plug-in to your build.gradle file:

apply plugin: 'java'
apply plugin: 'eclipse'

You can now execute the following command to generate the Eclipse configuration files .project and .classpath:

$ gradle eclipse

You can now import and existing project into Eclipse, and enjoy all the correct configurations!

However, in the current Gradle version (1.6), the generated library paths are absolute, for example:

C:/Users/Miguel/.gradle/caches/artifacts-24/filestore/
junit/junit/4.11/source/
28e0ad201304e4a4abf999ca0570b7cffc352c3c/junit-4.11-sources.jar

This leads to problems because if you commit these files in source code control, your specific user settings will be imposed on other developers.

One way to avoid this is to use an Eclipse Classpath Variable and customize the Eclipse plug-in output.

eclipse {
    // find gradle cache location
    def gradleCache = null
    for (o in configurations.compile) {
        if (o.toString().indexOf(".gradle") != -1) {
            final def token = "filestore"
            def s = o.toString()
            def idx = s.indexOf(token)
            if (idx != -1) {
                gradleCache = new File(s.substring(0, idx + token.length()))
                break
            }
        }
    }
    assert gradleCache && gradleCache.exists()
    println "GRADLE_CACHE: " + gradleCache

    // replace absolute paths with classpath variable GRADLE_CACHE
    pathVariables 'GRADLE_CACHE': gradleCache

    // make sure GRADLE_CACHE is defined in 
    // Eclipse, Preferences, Java, Build Path, Classpath Variables

}

Note: an alternative solution could use Eclipse workspace Path variables (referred using the ${...} notation) but without DSL support like the pathVariables statement above.

2013-07-04

Mezuzah

In Israel you can find a Mezuzah in each room entrance.
Inside, you can find a parchment with the following prayer:

Sh'ma Yisrael Adonai Eloheinu Adonai Eḥad - Hear, O Israel: the Lord is our God, the Lord is One



This is a Jewish tradition that intends to direct one's heart towards the presence of the one God in each and every moment of our daily life.
An interesting concept, and an aesthetic one too, as there are many styles of Mezuzah.

2013-06-19

How to produce a Graphviz PDF with smaller margins?

Graphviz is a great tool to generate graph images from a textual description.

The following tip shows how you can generate a PDF file with smaller margins.
The source file contains:
digraph G {
    margin=0;
    "subject" -> "object" [label="predicate"];
}

Alternatively, the margin can also be set in the command line:
> dot -Tpdf -Gmargin=0 triple.gv > triple.pdf

2013-06-03

Programmable World

For the Programmable World to reach its full potential, we need to pass through three stages.

The first is simply the act of getting more devices onto the network—more sensors, more processors in everyday objects, more wireless hookups to extract data from the processors that already exist.

The second is to make those devices rely on one another, coordinating their actions to carry out simple tasks without any human intervention.

The third and final stage, once connected things become ubiquitous, is to understand them as a system to be programmed, a bona fide platform that can run software in much the same manner that a computer or smartphone can. Once we get there, that system will transform the world of everyday objects into a designable environment, a playground for coders and engineers.

It will change the whole way we think about the division between the virtual and
the physical.

Source: Wired

2013-05-23

Common MySQL / JDBC programming error that causes unexpected syntax errors

What is wrong with this code?

...
    String sql = "INSERT INTO PRODUCT (CODE, DESCRIPTION) VALUES(?,?)";
    PreparedStatement pstmt = connection.prepareStatement(sql);
        
    pstmt.setString(1, "A1");
    pstmt.setString(2, "Soccer ball");
        
    pstmt.executeUpdate(sql);
...

On execution, the execute method returns a com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException.

Why is that? The syntax looks OK...

It's tricky, but since the statement is prepared in advance, the method to call is pstmt.executeUpdate() without parameters.
If the SQL query is provided, the compiler accepts the code, but the '?' produce syntax errors.

PreparedStatement is preferred over Statement because it can give better performance and prevent many SQL Injection attacks.

The correct code is:

...
    String sql = "INSERT INTO PRODUCT (CODE, DESCRIPTION) VALUES(?,?)";
    PreparedStatement pstmt = connection.prepareStatement(sql);
        
    pstmt.setString(1, "A1");
    pstmt.setString(2, "Soccer ball");
        
    pstmt.executeUpdate();
...


Credits: Mark Matthews

2013-04-16

How to copy all files in classpath to a directory using Ant?

Try something like the following target:

...

    <target name=copy-deps">
        <copy todir="." flatten="true">
            <path refid="my-classpath"/>
        </copy>
    </target>

...

To execute (assuming that my-classpath is defined, of course):

ant copy-deps

2013-03-06

Eclipse power shortcuts

Eclipse is a Java Integrated Development Environment (IDE) that has many problems, in my view, but also many good things.

Here are a few time-savers:

Type:
sysout CTRL+space

and Eclipse completes to:
System.out.println()


Type:
throw new NPE CTRL+space

and Eclipse presents a list of Exception classes whose capital letters start with N, P, and E.
In this case, we want to complete to:
throw new NullPointerException()

Again:
throw new IArE CTRL+space

and complete to:
throw new IllegalArgumentException()


Nice! :)

2013-02-28

How to write the end-of-file character in a Java String?

Use the \u001a unicode character.

There is a character called EOF. It's also called control-Z.
If you want to include it in a string, you have to type it as "\u001a" as in:

String iHaveAnEof = "file ends here\u001a";

Credits:

Ed Staub

http://stackoverflow.com/a/7591594/129497

How to avoid Mac temporary files in archives

> tar --exclude "._*" -zcvf template.tgz template
template/
template/.classpath
template/.project
template/build.xml
template/src/
template/src/log4j.properties
template/src/main/
template/src/main/dml/
template/src/main/dml/domain.dml
template/src/main/java/

(VS)

> tar -zcvf template.old.tgz template
template/
template/._.classpath
template/.classpath
template/._.project
template/.project
template/._build.xml
template/build.xml
template/._src
template/src/
template/src/._log4j.properties
template/src/log4j.properties
template/src/._main
template/src/main/
template/src/main/._dml
template/src/main/dml/
template/src/main/dml/._domain.dml
template/src/main/dml/domain.dml
template/src/main/._java
template/src/main/java/

You can also add the following to /etc/profile :
# disable special creation/extraction of ._* files by tar, etc. on Mac OS X
echo "[/etc/profile] disable special creation of ._* files"
COPYFILE_DISABLE=1; 
export COPYFILE_DISABLE

Mac-specific option:
# from man bsdtar
--disable-copyfile
Mac OS X specific.  Disable the use of copyfile(3).

Credits:

Joana

Sources:

http://stackoverflow.com/questions/8766730/tar-command-in-mac-os-x-adding-hidden-files-why

http://superuser.com/questions/61185/why-do-i-get-files-like-foo-in-my-tarball-on-os-x

http://superuser.com/questions/198569/compressing-folders-on-a-mac-without-the-ds-store

2013-02-27

How to change shell in Linux

To find out which shell you are using:
echo $SHELL

To change shell:
chsh


Credits:

Joana

How to define environment variable in Linux?

Define the environment variable in
.bashrc, .zshrc or /etc/bashrc or /etc/zshrc
or in a similar file.

Using a Mac OS X, edit /etc/profile
You might also want to know about MacPorts.

Credits:

Joana