Posts

Showing posts from June, 2008

Shopping list problem

Image
Definitely this has been the most challenging problem I've found on the Code Jam practice site. It asks you to determine the optimal selection of what to buy where. With a couple of twists: the cost of going from one place to another is factored in; plus a rule that forces you to drive back home whenever you're buying perishable goods.

The approach that worked for me was to first consider the different combinations of articles from different shops, just to obtain the list of shops to visit for each instance. Each one of list of shops to visit is a traveling salesman problem (perishable rule just changes the cost of some of the links).

Combine both costs, the article's prices at selected shops and the transportation costs to determine how much each realization will amount. The minimum case is the answer you're looking for.

The main problem I faced with the large set is that unless the code is quite efficient (and mine was not) it will take a long long time to finish the ca…

Google Code Jam '08

Image
I've just got a notice about the new edition of Google Code Jam. I guess if you like challenges it is a place to go. I've spent part of the evening solving the "Alien Numbers" problem just to discover how rusted I am. It was fun though, and it was satisfying to make it right (though not very fast I would say).

Single data packet TCP

Image
For Ethernet enabled devices I've used in the past (and I was happy with) the cores from Rabbit Semiconductor. They offer a lot of data and program memory and a royalty-free TCP/IP stack.

Not in the same league but still surprisingly useful is the Ethernet shield I've bought from Nuelectronics (a UK-based company). The shield plugs-in nicely on an Arduino board and it can easily allow you to create a simple network appliance.

In the picture I have my sample system that using a DS18B20 digital temperature sensor offers the temperature reading as a web page.

All the code used is the sample code and TCP/IP library provided by Nuelectronics. I had some minor trouble with my setup as I am using the so-called parasitic power on the temperature sensor and a few lines of code where added to the original code to make it work. The symptom of the problem is that I was getting +85.00 C no matter what the temperature was. The cause was that the sensor did not get enough power from the 1-wir…

Kudos to Canon

Image
I dumped my old Epson color printer, an Epson Stylus Photo Color 830, after playing any trick to get a decent printing performance for quite a while (I failed). As we needed a new printer at home I searched and browsed around and I settled with Canon's IP4300 that also had good Linux support.

Unfortunately that model was no longer available (I learned this at the computer shop) so it was not an option. I guessed the next model, Canon's IP4500 won't be that different. It was cool as it could do duplex printing automatically.

I was wrong: While the printer worked like a charm ("New" is the best printer brand!) I was disappointed to discover there was not Linux driver. And when I tried the IP4300's driver it did not work at all.

Time to go to the Ubuntu forums: There I was referred to a Canon's portal. In there I downloaded and install a couple of .deb files and next I restarted cups. I connected the printer's USB cable to my computer and it was automagical…

Another format for arduino

Image
I've just bought another arduino board for a project. My main complaint with arduino standard board is that it is not prototype board friendly. I am afraid this was a 'feature' and not an error: This way people would have to buy special prototype boards for arduino. This was a design error that later on has survived to maintain compatibility with existing shields (thanks for shedding some light on this, David)

There are other solutions like Modern Device BBB, but the new iDuino does include the USB adapter that may power and interface to a PC your project. And iDuino kit costs less than $18 so it seems quite cost effective. The main con is that the kit includes a resonator instead of crystal.

I haven't used it yet but it seems another development to have a look at. If you plan to buy one I think you better use Fundamental Logic website instead of eBay.