9.09.2008

Google Chrome... One week after.

I've now been using Google Chrome for one week. And here is an update on my first impression.

Chrome is still my default browser, this is good :-) The browser did not crash once in that week. And it is almost always open. I use a laptop and shutdown/log off rarely (standby/hibernate most of the time). So I guess I can say that Google Chrome is very stable (better that Firefox). I did not even got one crash in a tab. I really like the speed and responsiveness of Chrome.

Other things I like :
  • I assigned a shortcut for GMail. It now lives in its own window. What I like, is that when I'm in the GMail window and press Ctrl-T to open a new tab, instead of opening it in the GMail window, the tab is opened in my browser windows. This is how it should work. Great!
  • In the rare cases when I close the browser and reopen it, all my tabs reload quickly without bogging down my system like Firefox did.
  • Google Apps works better in Chrome that in Firefox... especially when the browser reload the tab when it's being opened.

All is not nice and dandy in Chrome though, here are some gripes I have with the browser :
  • Lack of extensions. They say they will address the issue in a later version. In the meantime, bookmarklets are alleviating a bit the lack of extensions,
  • Full page zoom please! The zoom feature of Chrome only increase font size. This is lame. Give me full page zoom like in Firefox 3,
  • Directly open PDF and some other file types. When I download some file and the server set the content-disposition to attachment, Chrome absolutely want to save the file. Please give me the option of just opening the file with the associated application (saving it to a temporary location),
  • They really should encrypt and password protect saved password. They cannot claim better privacy without this. I feel that should have done it from the start,
  • Going to http://askville.amazon.com/ give me a page telling me that I'm not using a supported version of Safari,

  • I encountered some layout issues. Most of them are minor. But when I access my internal time-sheet application (Oracle Applications), Some buttons used to submit the time-sheet are invisible.
  • First week, first security update... Maybe this should go in part in the pros, but there is no notification (if you leave your browser open all the time) unless you go to the Tools | About Google Chrome menu.

None of the cons are really showstopper for me. So I guess I will continue to use Chrome for a while.


9.03.2008

Google Chrome First Impression

Yesterday, Google released their own browser. This release was like a little surprise. While it has been rumoured to be in work for a while, it was announced only the day before.

I don't know how many people downloaded it yesterday, but I'm one of them. I saw the little comic book  explaining how the browser work and wanted to put my hand on the product. After a few hour playing with it, here are y tought on the browser :
  • It's fast! Right when you start it, it really scream... It feels faster that Firefox 3. When you click, it looks like your actions are instantanious. For some reason, I'm even able to watch some higher definition movien in Flash that I were constantly pausing when using Firefox 3 (I don't beleive the browser makes Flash run better, but thats the feeling I get). Switching between tabs is also instantanious.
  • Damn my screen look larger. The minimalist user interface make your browsing surface a bit larger. Granted, you could do that with IE and Firefox in Kiosk mode. But here, you have no choice... Just a big browsing area.
  • Where are my mouse gestures? I was using a mouse gesture extension in Firefox. There seem to be no extensions and no way to write them for Chrome (I'm probably wrong here... I guess the APIs are not realsed yet but they'll be coming in a futher release).
  • Better Privacy. Not so fast. They claim better privacy... But their password manager is not encrypted nor password protected! I don't realsy care about the other privacy features they offer. I don't believe they are much better that the ones in Firefox. I don't feel that the Internet is a dangerous place anyway.
  • Gears bundled in. The Gears API are natively supported in the browser. They even automatically grant www.google.com the necessary rights. They shouldn't do that. However, they don't grant docs.google.com the Gears rights.
  • I already miss extensions.

Overall, I feel this is a solid beta realease. I will keep using Chrome as my default browser for at least a few days. Maybe I'll get back to Firefox to get my extensions back.

8.01.2008

Don't say you've not be warned

I took this grainy video (sorry, my phone is not really good at taking videos) at my local Best Buy. It looks like Best Buy want you to know exactly what will happen to your Xbox 360. Funny... Best Buy has never been known for their truthful advertising!


7.08.2008

iPhone 3G in Canada - Do complain to Fido and/or Rogers



It looks like complaining to Fido (Fido is a subsidiary of Rogers) or Rogers about the iPhone 3G rate plan may lead to some changes...

I'm a current Fido subscriber, after a two week vacation, away from Canadian news, I saw the announced rate plan for the soon to be release iPhone 3G in Canada. While I was not expecting prices lower that AT&T's in the US, I was in complete disbelief when I saw the proposed rates. So as any good customer would do, yesterday I went to their web sites and wrote a complain (I complained about their highly priced rate plans and said that I would not buy the iPhone and consider switching to one of their competitor. I closed my complain telling them that I would write to the CRTC about how they abuse their GSM monopoly in Canada to offer non-competitive pricing).

Just a few minutes ago, I received a call from someone named S. Martin from Fido who wanted me to listen to what he had to say about my complain. The guy is certainly not a classic PR representative with only corporate mambo gumbo going out of his mouth. He seemed to trully care about me not leaving Fido for Bell. He did repeat some of the PR stuff I saw on some news site. The interesting part was that he told me that the proposed rate plans were not definitive, that they may change. He told me not to do anything before the iPhone 3G is launched, that nothing was final until July 11th. They will listen to the market and adjust.

He also told me that the CRTC (the equivalent of the FCC here in Canada) did not rule wireless pricing so it was useless for me to write them a letter. That I would be wasting my time. I guess this really mean that they don't want get the wrath of the CRTC if too many people write about this issue.

The conversation with M. Martin was always cordial and on a gentle tone.

So I guess the only thing to do right now, is to be patient and wait... Do not crumble under the iPhone 3G hype (too soon) and wait a little bit for them to see that we are not interested in their overpriced rate plans. They will have to adjust their pricing model and offer something a lot better than what they are offering right now.

2.27.2008

JNA love NXT

I started working on something to bring some Ruby love to my Lego Mindstorm NXT. I know, there is already one or two projects that aims to do that, but the first one is dormant and the other one is at a fairly early stage.

The first thing that needs to be done before accomplishing anything useful on the NXT, is to connect to it via USB or (preferably) Bluetooth. This can be done in two ways : use the Lego Fantom API or use direct communication via a serial link.

Communicating via a serial link from Ruby involves using the ruby-serialport gem which seems to be no longer maintained. The other options to work with the serial port (besides using platform specific stuff) would be to use JRuby and the Java Communication API. But Java Comm only support Solaris and Linux. There is also RXTX but it is not that simple to get started with. If serial port communication was the only option, I would probably choose ruby-serialport to get things done (which ruby-nxt is using).

However, there is the option of using the Lego Fantom API. This API comes as a shared library that gets installed whenever you install the Lego Mindstorm software. It is available for Windows and Mac OS. This API is used by the Lego Mindstorm software so I assume it is well tested and will be maintained as long as there is a market for the NXT. It has the added benefit to completely abstract the actual communication link between the PC and the NXT. This mean that you no longer have to choose to work with USB or Bluetooth, the same code will work with both. While I would have likes to see the Fantom API available for Linux, this is not a big showstopper for me as I guess that most Mindstorm users use either Windows or Mac OS.

To use the Fantom API from Ruby, I need a way to map shared library functions to Ruby. This can be done using Ruby DLX, Ruby/DL or ruby-dl2. Again, none of these projects seems to be active at the moment. On the other hand, in Java land, there is JNA. Which is currently gathering some buzz and is being actively maintained. JNA allows to map shared library functions to Java interfaces is a really easy and concise way. Even if I want to ultimately use Ruby to talk to my robot, I don't care if my Ruby code must run under JRuby. So JNA is a good fit for me to get quickly started and not care to much about the low level communication stuff needed to connect to the NXT.

It is now time to start playing around and send some commands to my Lego robot.

So the first thing that need to be done, is to create the Java interface that will be used to map the Fantom API. Here is a minimalist version of it (it just contains the API function needed for this example):

Fantom.java

package treelaws.fantom;

import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.ByteByReference;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.win32.StdCallLibrary;
import java.nio.Buffer;

/**
 * Provides access to the Lego Mindstorm Fantom Library
 * @author Emmanuel Pirsch
 */
public interface Fantom extends StdCallLibrary {
    Fantom INSTANCE = (Fantom) Native.loadLibrary("fantom", Fantom.class);
    
    /**
     * 
     * @param searchBluetooth indicate if we also search bluetooth devices.
     * @param bluetoothSearchTimeout the timeout in second when searching bluetooth devices.
     * @param status OUT
     * @return
     */
    Pointer nFANTOM100_createNXTIterator(boolean searchBluetooth, int bluetoothSearchTimeout, Status status);
    /**
     * 
     * @param iNXTIterator
     * @param resourceName length must be at least 256.
     * @param status
     */
    void nFANTOM100_iNXTIterator_getName(Pointer iNXTIterator, byte[] resourceName, Status status);
    void nFANTOM100_iNXTIterator_advance(Pointer iNXTIterator, Status status);
    Pointer nFANTOM100_iNXTIterator_getNXT(Pointer iNXTIterator, Status status);
    void nFANTOM100_destroyNXTIterator(Pointer iNXTIterator, Status status);
    int nFANTOM100_iNXT_sendDirectCommand(Pointer iNXT, boolean requireResponse, Buffer commandBuffer, int commandBufferLength, byte[] responseBuffer, int responseBufferLength, Status status);
}

 

So now, I can easily connect to the NXT using something like :

String name= "T-NXT";

Status status= new Status(); Pointer iNXTIterator= fantom.nFANTOM100_createNXTIterator(true, 30, status); try { while(!Status.Statuses.NO_MORE_ITEMS_FOUND.equals(status.getStatus())) { byte[] resourceName= newResourceName(); fantom.nFANTOM100_iNXTIterator_getName(iNXTIterator, resourceName, status); System.out.println(asString(resourceName)); if (asString(resourceName).contains(name)) { Pointer iNXT= fantom.nFANTOM100_iNXTIterator_getNXT(iNXTIterator, status); if (Status.Statuses.SUCCESS.equals(status.getStatus())) { return iNXT; } else { throw new UnableToCreateNXTException(); } } fantom.nFANTOM100_iNXTIterator_advance(iNXTIterator, status); } } finally { if (iNXTIterator != null) { fantom.nFANTOM100_destroyNXTIterator(iNXTIterator, status); } }

 

And then start a robot program (already uploaded to the NXT) with :

String filename= "scorpion.rxe"
Status status= new Status();
byte[] filenameBytes= filename.getBytes();
ByteBuffer command= ByteBuffer.allocate(filenameBytes.length+1+1);
command.put((byte)0x00);
command.put(filenameBytes);
command.put((byte)0x00);
fantom.nFANTOM100_iNXT_sendDirectCommand(nxtPointer, false, command, command.capacity(), null, 0, status);

 

And this is just the beginning... Over the next few weeks (as time permit), I will add support to the rest of the Fantom API and add some nice Java classes to wrap this functionality and completely hide the Fantom API. Once this is done, I will release this code and start working on the JRuby side of things.

For completion, here are the NXT, Status and FantomUtils classes (The NXT class is the starting point of the Fantom API wrapper):

NXT.java

package treelaws.mindstorm;

import com.sun.jna.Pointer;
import java.nio.ByteBuffer;
import treelaws.fantom.Fantom;
import treelaws.fantom.Status;

import static treelaws.fantom.FantomUtils.*;

/**
 * 
 * @author Emmanuel Pirsch
 */
public class NXT {
    private static Fantom fantom= Fantom.INSTANCE;
    
    private String name;
    private Pointer nxtPointer;

    public NXT(String name) {
        this.name= name;
        this.nxtPointer= connect(name);
    }
    
    public void startProgram(String filename) {
        Status status= new Status();
        byte[] filenameBytes= filename.getBytes();
        ByteBuffer command= ByteBuffer.allocate(filenameBytes.length+1+1);
        command.put((byte)0x00);
        command.put(filenameBytes);
        command.put((byte)0x00);
        fantom.nFANTOM100_iNXT_sendDirectCommand(nxtPointer, false, command, command.capacity(), null, 0, status);
        System.out.println(status.getStatus().toString());
    }
    
    public void stopProgram() {
        ByteBuffer command= ByteBuffer.allocate(1);
        command.put((byte)0x01);
        fantom.nFANTOM100_iNXT_sendDirectCommand(nxtPointer, false, command, 1, null, 0, new Status());
    }

    private Pointer connect(String name) {
        Status status= new Status();
        Pointer iNXTIterator= fantom.nFANTOM100_createNXTIterator(true, 30, status);
        try {
            while(!Status.Statuses.NO_MORE_ITEMS_FOUND.equals(status.getStatus())) {
                byte[] resourceName= newResourceName();
                fantom.nFANTOM100_iNXTIterator_getName(iNXTIterator, resourceName, status);
                System.out.println(asString(resourceName));
                if (asString(resourceName).contains(name)) {
                    Pointer iNXT= fantom.nFANTOM100_iNXTIterator_getNXT(iNXTIterator, status);
                    if (Status.Statuses.SUCCESS.equals(status.getStatus())) {
                        return iNXT;
                    } else {
                        throw new UnableToCreateNXTException();
                    }
                }
                fantom.nFANTOM100_iNXTIterator_advance(iNXTIterator, status);
            }
        } finally {
            if (iNXTIterator != null) {
                fantom.nFANTOM100_destroyNXTIterator(iNXTIterator, status);
            }
        }
        throw new NXTNotFoundException();
    }
}

Status.java

package treelaws.fantom;

import com.sun.jna.Structure;
import java.util.EnumSet;
import java.util.HashMap;

/**
 *
 * @author Emmanuel Pirsch
 */
public class Status extends Structure {
    public int code;
    public byte[] filename= new byte[MAX_FILENAME_LENGTH];
    public int lineNumber;
    
    public Statuses getStatus() {
        return Statuses.fromCode(code);
    }
    
    static int MAX_FILENAME_LENGTH= 101;
    
    public enum Statuses {
        SUCCESS,
        FIRST(0),
        PAIRING_FAILED(5),
        BLUETOOTH_SEARCH_FAILED(6),
        SYSTEM_LIBRARY_NOT_FOUND(7),
        UNPAIRING_FAILED(8),
        INVALID_FILENAME(9),
        INVALID_ITERATOR_DEREFERENCE(10),
        LOCK_OPERATION_FAILED(11),
        SIZE_UNKNOWN(12),
        DUPLICATE_OPEN(13),
        EMPTY_FILE(14),
        FIRMWARE_DOWNLOAD_FAILED(15),
        PORT_NOT_FOUND(16),
        NO_MORE_ITEMS_FOUND(17),
        TOO_MANY_UNCONFIGURED_DEVICES(18),
        COMMAND_MISMATCH(19),
        ILLEGAL_OPERATION(20),
        BLUETOOTH_CACHE_UPDATE_FAILED(21),
        NON_NXT_DEVICE_SELECTED(22),
        RETRY_CONNECTION(23),
        POWER_CYCLE_NXT(24),
        FEATURE_NOT_IMPLEMENTED(99),
        FW_ILLEGAL_HANDLE(189),
        FW_ILLEGAL_FILENAME(190),
        FW_OUT_OF_BOUNT(191),
        FW_MODULE_NOT_FOUND(192),
        FW_FILE_EXISTS(193),
        FW_FILE_IS_FULL(194),
        FW_APPEND_NOT_POSSIBLE(195),
        FW_NO_WRITE_BUFFERS(196),
        FW_FILE_IS_BUSY(197),
        FW_UNDEFINED_ERROR(198),
        NO_LINEAR_SPACE(199),
        FW_HANDLE_ALREADY_CLOSED(200),
        FW_FILE_NOT_FOUND(201),
        FW_NOT_LINEAR_FILE(202),
        FW_END_OF_FILE(203),
        FW_END_OF_FILE_EXPECTED(204),
        FW_NO_MORE_FILES(205),
        FW_NO_SPACE(206),
        FW_NO_MORE_HANDLES(207),
        FW_UNKNOWN_ERROR_CODE(208),
        LAST(999);
        
        private int code;
        private static HashMap<Integer, Statuses> code_map= new HashMap<Integer, Statuses>();
        static {
            for(Statuses s : EnumSet.allOf(Statuses.class)) {
               code_map.put(s.code, s);
            }
        }
        Statuses() {
            this.code = 0;
        }
        Statuses(int code_offset) {
            this.code= -142000 - code_offset;
        }
        
        static Statuses fromCode(int code) {
            return code_map.get(code);
        }
    }
}

 

FantomUtils.java

package treelaws.fantom;

import com.sun.jna.Native;

/**
 *
 * @author Emmanuel Pirsch
 */
public class FantomUtils {
    static int DEFAULT_RESOURCE_NAME_ALLOCATION_SIZE = 256;
    
    public static final byte[] newResourceName() {
        return new byte[DEFAULT_RESOURCE_NAME_ALLOCATION_SIZE];
    }
    
    public static final String asString(byte[] s) {
        return Native.toString(s);
    }
}

AdSense Links