September 4th, 2008
If you are getting (like me) the “The application failed to initialize properly (0xc0000005)” error when trying to start Google chrome try to use -no-sandbox option as pointed out in Google Chrome : The application failed to initialize properly (0xc0000005) « me & PHP.
Tags: google chrome failed
Posted in windows | No Comments »
September 4th, 2008
It seems that Visio has some kind of incompability with Bluetooth drivers.
http://www.tech-archive.net/Archive/Visio/microsoft.public.visio.general/2008-06/msg00239.html.
I notice this problem when editing Visio objects embedded into Microsoft Word documents. In my case after I enabled Bluetooth (via my Compaq nw8440 special keyboard button) this problem went away.
Tags: visio stopped working closing bluetooth driver incompatibility, word microsoft
Posted in windows | No Comments »
August 31st, 2008
I received a couple of Arduinos Diecimilla that I bought from Libelium.
My first project with Arduino has been interfacing with DS1620 digital temperature sensor.

It was really easy it just a matter of connecting pin 3, 4 and 5 on the Arduino to RST, CLK and DQ on the DS1620. The source code in this post will read the temperature from the DS1620 using the 3 wire interface and it will output the result to the serial interface in the Arduino.

I mostly use the information of PC Parallel Port Interfacing with DS1620 Digital Thermometer / Thermostat page to learn how to interface to this thermometer and the information on the SerialPortExample page to learn how to output to the serial port.
The DS1620 measures temperatures from -55°C to +125°C
in 0.5°C increments. As you can see in the code reading a DS1620 sensor is way more complicated than reading an analog LM35 temperature sensor (and the LM35 gives you more precision and also takes one pin instead of three) so probably is a LM35 is a better option if you want an easy way to get the temperature in your arduino project.
Source code:
/*
DS160 example
Reading temperature from DS1620 digital temperature sensor
and showing the result via serial interface.
Arduino DS1620
pin 3 -> RST
pin 4 -> CLK
pin 5 -> DQ
by Ruben Laguna
based on examples from Tom Tigoe <http://www.arduino.cc/en/Reference/SoftwareSerialExample>
and phanderson <http://www.phanderson.com/printer/ds1620/ds1620.html>
written: 30 Aug 2008
*/
// include the SoftwareSerial library so you can use its functions:
#include <SoftwareSerial.h>
#define rxPin 0
#define txPin 1
#define ledPin 13
#define buttonPin 2
#define rstPin 3
#define clkPin 4
#define dqPin 5
// set up a new serial port
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);
byte pinState = 0;
void setup() {
// define pin modes for tx, rx, led pins:
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
pinMode(buttonPin, INPUT);
pinMode(ledPin, OUTPUT);
pinMode(rstPin, OUTPUT);
pinMode(clkPin, OUTPUT);
pinMode(dqPin, OUTPUT);
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
}
void loop() {
int val = digitalRead(buttonPin);
rst_low();
clk_high();
rst_high(); //all data transfer are initiated by driving RST high
write_command(0x0c); // write config command
write_command(0x02); // cpu mode
rst_low();
delay(200); //wait until the configuration register is written
clk_high();
rst_high();
write_command(0xEE); //start conversion
rst_low();
delay(200);
clk_high();
rst_high();
write_command(0xAA);
int raw_data = read_raw_data();
rst_low();
mySerial.print("temperature:");
mySerial.print(raw_data/2);
mySerial.println(" C");
delay(100);
// toggle an LED just so you see the thing's alive.
toggle(13);
}
void toggle(int pinNum) {
// set the LED pin using the pinState variable:
digitalWrite(pinNum, pinState);
// if pinState = 0, set it to 1, and vice versa:
pinState = !pinState;
}
void write_command(int command)
/* sends 8 bit command on DQ output, least sig bit first */
{
int n, bit;
for(n=0;n<8;n++)
{
bit = ((command >> n) & (0x01));
out_bit(bit);
}
}
int read_raw_data(void)
{
int bit,n;
int raw_data=0;
pinMode(dqPin,INPUT);
/* jam the dq lead high to use as input */
for(n=0;n<9;n++)
{
clk_low();
bit=(digitalRead(dqPin));
clk_high();
raw_data = raw_data | (bit << n);
}
pinMode(dqPin, OUTPUT);
return(raw_data);
}
void out_bit(int bit)
{
digitalWrite(dqPin, bit); /* set up the data */
clk_low(); /* and then provide a clock pulse */
clk_high();
}
void clk_high(void)
{
digitalWrite(clkPin,HIGH);
}
void clk_low(void)
{
digitalWrite(clkPin,LOW);
}
void rst_high(void)
{
digitalWrite(rstPin,HIGH);
}
void rst_low(void)
{
digitalWrite(rstPin,LOW);
}
Tags: arduino ds1620 digital temp temperature sensor
Posted in electronics | No Comments »
August 7th, 2008
If you are getting javax.jnlp.UnavailableServiceException from javax.jnlp.ServiceManager.lookup() or if javax.jnlp.ServiceManager.getServicesNames returns null you must be aware that those call only return useful thing when you run your code fromt the Java Web Start environment.
It´s not enough to include the jnlp.jar or javaws.jar in the classpath.
For example to make it work from Netbeans you must enable WebStart in the project and Set Configuration to WebStart.


Tags: java jnlp netbeans webstart
Posted in java | No Comments »
July 18th, 2008
I’ve been trying to find power meters for home. My criteria is that it has to support several sensors (because I want to know how much energy my computer and home cinema is spending) and it has to be wireless (because it more convinient this way). After researching a couple of hours, it doesn’t lok good. The number of choices is very small. The Voltcraft option is in doubt because all the information I can find is in german. And the only other working option that I found is Plogg.

Plogg looks easier to interface with. It seems that it’s a serial interface (AT-command) over Bluetooth or Zigbee. Or if you get the PloggZgb EAP you will be able to access the sensors via TCP/IP in your Ethernet LAN.
Quoting from the plogg webpage:
Supported Com Port Redirector (CPR) software maps virtual COM ports on a PC platform and redirects application data destined to an attached device. Rather than going out of the local COM port, the data is transmitted across the Ethernet network to/from the Lantronics XPort Direct using TCP/IP.
But it’s not clear the model with the European power socket is orderable.
But at least it gave me the clue to look for Zigbee sensors as it seems that this technology is aimed at this type of devices. Although it went down that road and I didn’t find any real product there. I’ll post about it later.
By the way, if you are looking for power meters and you don’t need wireless or multiple sensors there are a lot of choices. Here’s a small sample:
- Volcraft Energy Check 3000
- Wattson 01
- The Owl
- Efergy
- Eco-eye / Mini-eye
Check the comparison chart between those.
Tags: power meter energy watt zigbee wireless sensor monitor
Posted in Uncategorized | No Comments »
July 18th, 2008


An article on the Elektor magazine on home power meters caught my attention, particularly the wireless one. In the article they mention the Voltcraft Energy Control 3000, that is able to receive data (about energy consumption) from several sensor and can be connected to the pc via usb. The only problem is that the software that comes with it is in german only. The price is ok, 100€ + 35€ per sensor. But I cannot find any information on the actual format of the data that the Voltcraft Energy Control 3000 provides. I also impossible to tell whether or not special USB drivers are needed. It could be that it presents itselft as a hard drive and expose the date as a file. That would be the easiest way to interface with it and use my own tools to process the data. That would also make possible to connect to my MacBook Pro.
If anybody finds any information (in english) please leave a comment here.
Tags: voltcraft energy consumption power meter watt monitor
Posted in Uncategorized | 1 Comment »
July 11th, 2008
It seems that is imposible to type the ˜ symbol (named also tilde,squiggle,twiddle,not,approx,wiggle,swung,dash,enyay,sqiggle) in Netbeans with a Swedish keyboard at least. It seems that it’s a long known java bug (bug 6353098, bug 6253172). At least I can use the Alt+126 code to type it.
Tags: bug, java, keyboard, netbeans, nonus, swedish, symbol, tilde
Posted in Uncategorized | No Comments »
July 11th, 2008
It´s done. I was suffering constant problems with BlinkList and I decided to move to del.icio.us. I also decided to rescue the old powermarks 3.5 bookmarks from the oblivion and import them to del.icio.us too.
BlinkList gives you the option of exporting your bookmarks in JSON format via the Options ->Export links. (here is the link)

So grab the json file and save it somewhere in your disk.
Then you have to use the script below to load the bookmars into del.icio.us but first make sure that you have ruby or jruby, rubygems, json-jruby or json-ruby, jruby-openssl and rubilicious installed.
If you use jruby you can install everything in the following way:
jruby -S gem install json-jruby jruby-openssl rubilicious-0.2.0.gem
Then use the following script to load all the bookmarks in the json file to del.icio.us. Just change the filename and username and password to suit your needs.
#!/usr/bin/ruby
require "rubygems"
require "rubilicious"
require "json"
require "date"
require "time"
def getTime(item)
dateadd = item['dateadd']
return Time.at(dateadd) unless dateadd == false
return Time.now
end
def getIsPrivate(item)
isprivate = item['private']
return "checked"==isprivate
end
def getTags(item)
item['tag'].gsub(' ', '_').gsub(',',' ')
end
json_string = File.new("blinklist20080710.json").read
result = JSON.parse(json_string)
r = Rubilicious.new('your_delicious_username','your_delicious_password')
i=0
for item in result do
i += 1
puts "#{i}: #{item['url']}"
#next if i < 3229
r.add(item['url'],item['name'],item['description'], getTags(item), getTime(item), true, getIsPrivate(item))
end
puts "ended"
If the script fails in the middle of the import don´t worry. just uncomment the “#next if i < 3229″ and change the 3229 to the last bookmark id that was loaded. Rerun the script and it will skip all bookmarks up to the one you write there.
Loading the old powermark file into del.icio.us is a little more complex. You will need two files:
1) state_pattern.rb (from maurice codik’s blog). I´m copying it here for completeness sake
#!/usr/bin/ruby
# Copyright (C) 2006 Maurice Codik - maurice.codik@gmail.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
# associated documentation files (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge, publish, distribute,
# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial
# portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
# LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# an example:
#
# class Connection
# include StatePattern
# state :initial do # you always need a state named initial. this is where you begin.
# def connect
# puts "connected"
# # move to state :connected. all other args to transition_to are passed to the new state's constructor
# transition_to :connected, "hello from initial state"
# end
# def disconnect
# puts "not connected yet"
# end
# end
# state :connected do
# def initialize(msg)
# puts "initialize got msg: #{msg}"
# end
# def connect
# puts "already connected"
# end
# def disconnect
# puts "disconnecting"
# transition_to :initial
# end
# end
# def reset
# puts "reseting outside a state"
# # you can also change the state from outside of the state objects
# transition_to :initial
# end
# end
# how's it work:
# Each call to state defines a new subclass of Connection that is stored in a hash.
# Then, a call to transition_to instantiates one of these subclasses and sets it to the be the active state.
# Method calls to Connection are delegated to the active state object via method_missing.
module StatePattern
class UnknownStateException < Exception
end
def StatePattern.included(mod)
mod.extend StatePattern::ClassMethods
end
module ClassMethods
attr_reader :state_classes
def state(state_name, &block)
@state_classes ||= {}
new_klass = Class.new(self, &block)
new_klass.class_eval do
alias_method :__old_init, :initialize
def initialize(context, *args, &block)
@context = context
__old_init(*args, &block)
end
end
@state_classes[state_name] = new_klass
end
end
attr_accessor :current_state, :current_state_obj
def transition_to(state_name, *args, &block)
new_context = @context || self
klass = new_context.class.state_classes[state_name]
if klass
new_context.current_state = state_name
new_context.current_state_obj = klass.new(new_context, *args, &block)
else
raise UnknownStateException, "tried to transition to unknown state, #{state_name}"
end
end
def method_missing(method, *args, &block)
unless @current_state_obj
transition_to :initial
end
if @current_state_obj
@current_state_obj.send(method, *args, &block)
else
super
end
end
end
2) The script that parses the powermarks file and load it to del.icio.us
#!/usr/bin/ruby
require "rubygems"
require "rubilicious"
require "json"
require "date"
require "time"
require "state_pattern"
class Parser
include StatePattern
attr_accessor :name, :url,:desc,:tags ,:date , :r
state :initial do
def parse(line)
#puts "initial: #{line}"
if line =~ /<a href="(.*)">(.*)<\/a>/
@context.name = $2
@context.url = $1
transition_to :read_keywords
end
end
end
state :read_keywords do
def parse(line)
if line =~ /<!--keywords-->(.*)$/
@context.tags = $1.chomp
transition_to :read_keywords2
end
end
end
state :read_keywords2 do
def parse(line)
#puts "read_keywords2: #{line}"
if line =~ /<!--/
if line =~ /^<!--desc-->/
transition_to :read_desc
@context.current_state_obj.parse(line)
end
if line =~ /^<!--mdata/
transition_to :read_metadata
@context.current_state_obj.parse(line)
end
return
end
@context.tags += " " + line.chomp
end
end
state :read_desc do
def parse(line)
if line =~ /<!--/
if line =~ /<!--desc-->(.*)/
@context.desc = $1.chomp
else
#puts "not desc"
if line =~ /<!--mdata/
transition_to :read_metadata
@context.current_state_obj.parse(line)
else
raise "don´t know how to parse this in this state #{line}"
end
return
end
else
@context.desc += " " + line.chomp
end
end
end
state :read_metadata do
def parse(line)
@context.date = $1.hex if line =~ /<!--mdata=\[\w+\]\[([0-9A-F]+)\]\[([0-9A-F]+)\]\[([0-9A-F]+)\]/
@context.date = Time.now.to_i if @context.date < 0
puts "=============================="
puts "name: #{@context.name}"
puts "url: #{@context.url}"
puts "tags: #{@context.tags}"
puts "date: #{Time.at(@context.date)}"
puts "desc: #{@context.desc}" unless @context.desc.nil?
puts "=============================="
@context.r.add(@context.url,@context.name,@context.desc, @context.tags, Time.at(@context.date), false, true)
@context.name = @context.url = @context.tags = @context.date = @context.desc = nil
transition_to :initial
end
end
end
r = Rubilicious.new('your_delicious_username','your_password')
p = Parser.new
p.r = r;
i = 0
File.new("pm3520070703.htm").each { |line|
puts i;
i += 1
#next unless i >2261
p.parse(line);
}
puts "ended"
(This script will add all the links as private. If you don´t want that behaviour just modify the last parameter in “@context.r.add(@context.url,@context.name,@context.desc, @context.tags, Time.at(@context.date), false, true)” to “false”.)
Again, if the script fails in the middle of the import don´t worry. just uncomment the “#next unless i > 2261″ and change the 2261 to the line number where you want to resume parsing the powermarks file. Rerun the script and it will skip all previous lines.
Hope it helps anybody that it´s trying to escape from Blinklist and/or Powermarks. I successfully imported 3299 blinklist bookmarks and 4000 powermarks bookmarks (a lot of dupes though). By the way, the first script will replace any previous bookmark with the same url and the second script will not. That´s the way I wanted it but of course you can change it. The parameter before the last one in the call to add is the one that control the “replace”. (see add documentation).
Tags: blinklist, bookmarks, delicious, export, exporting, import, importing, jruby, json, kaylon, migrating, migration, parsing, powermarks, ruby, script
Posted in Uncategorized | 3 Comments »
June 16th, 2008
There is no easy way to create tables in an Evernote table the best way I found is to use blocknote freeware WYSIWYG html editor to create the table and then paste it into the Evernote note.


Tags: evernote, tables
Posted in Uncategorized | No Comments »
June 16th, 2008
I just received my new MacBook Pro. I got this crash on the first day :-(. I put it to sleep and when I tried to restore… look what showed up on the screen.

Tags: apple, crash, macbook, sleep
Posted in Uncategorized | No Comments »