Posts

Showing posts from July, 2008

Defeated by Ugly Numbers

Now I am out of Code Jam 2008. Though I did the Text Messaging Outrage quite easily I've bet my solution to the use of the 'bc' command as a helper in Ugly Numbers for computing strings like "12123+324234+232342-234234". For these numbers it does not seem to be any need, but to be able to solve the large data set of the same problem arbitrary (or at least 40 digits) precision was a requirement. 'bc' can work with these, but unfortunately the computing speed I've got was not up to the task. I was piping each line to 'bc' and reading the proper answer. Unfortunately it took more than half an hour on my laptop to finish calculation. I run out of time and I failed both small and large datasets. Later on, once the contest was over and the problems were in practice mode I uploaded my solution file for the small problem and it was Correct! (too late). Still my routing for checking ugly numbers was only dealing with Java longs (n<2^63) so it was n

My laptop's Gutsy meets vodafone

Sunday morning I'd like to be able to join CodeJam round 1. But I'm attending a wedding out of town. I asked for some help and I've borrowed a Huawi e220 UTMS modem from my university. Just pluging it in did not do the trick though. Ubuntu showed a CD-ROM-like icon on my desktop that contained the device's Windows drivers. I was told to do some dark magic that did the trick for Spanish Vodafone prepaid service: umount /dev/sr0 rmmod usb-storage rmmod usbserial modprobe usbserial vendor=0x12d1 product=0x1003 #now disconnect the modem and reconnect it again #wait a few seconds ls -la /dev/ttyUSB* # three devices should show up # now fire wvdial I've created this wvdial.conf file: [Dialer Defaults] Init2 = ATZ Init3 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 Stupid Mode = 1 Modem Type = Analog Modem ISDN = 0 Phone = *99***1# Modem = /dev/ttyUSB0 Username = user Dial Command = ATDT Password = pass Baud = 460800 Init4 = AT+CGDCONT=1,"IP","ac.vodafone.es&q

CodeJam Qualification Round

It took place yesterday. It was made of three interesting problems. Not too difficult I would say, but 24h were not long enough for me to finish on time. I did the first too problems: Saving the world and Train Timetable, but I failed the third one: Fly Swatter (I chose Montecarlo approach and I did not get accurate enough results). I think being familiar with the contest site helped and every time the site was responsive. Being behind of several thousands of more talented guys is good to keep you humble. I loved the mental exercise and it felt great every time you get a Correct! answer. Still this morning I've been discussing with my colleagues how to get the Fly Swatter right and I have an idea to test, that hopefully will work: Calculate the area of the openings but modifying the value of g so now g is min(0,g-f) . One minus the quotient of this area and the circle area should be the answer to the problem (or so I think till I test it).

Arduino talk

Image
I am giving a talk at an Arduino workshop next Saturday 17:00. There is no attendance fee and people will be able to try their own code on the available Arduinos. Contact was made through the Arduino Forum and Vicent Ferrer proved to be quite an entrepreneurial person. Presentation will be held in Spanish and hopefully it will include a lot of Q&A and user experimentation. If you bring your own laptop you will be sure you'll get the development environment installed.

Photoshop degrees

We have some international programs at our university. Besides European students, many students from Spanish-speaking countries from South America are attending too. I am sure there is a good amount of paperwork (yes, in the paperless era it is when paper usage is skyrocketing) to go through the admission process. The twist is that now some people are thinking this international programs can be used as an excuse to get a visa to enter the country. Some doctored documents are sent in the hope they will go undetected, but while the Photoshop work is good, the background checks on the side of the fraudsters are not: They have created fake titles of real world universities, but they have selected degrees that have never been taught at those universities. You know that the Euro currency is now used in many (but not all) European countries (Denmark, Sweden and Norway come to my mind now) but if you are handed over an Euro from, let's say, Brazil, you are sure it is forged note. Fraudster

New tricks to an old dog

Image
Some time ago I developed a small project that put together a few software pieces to create a monitoring system. I've used for development a great graphics library built in PHP called JpGraph . It did the work but I realized that the software license required payment of $600 for each website that use it commercially. As my system was like an Internet appliance and each customer had a different unit (and address) it seemed that I would need to add $600 to the price tag of the system to be compliant with JpGraph license. It was time to look for an alternative, as there was no way the product price could support that extra cost. So I found libchart library that worked nicely with PHP5 (provided you already have GD support built-in). The end result looks ok too, though libchart lacks many of the features of JpGraph, it is still good enough for my application. Libchart author licenses the software with GPL3 and while the software is free, he's accepting donations.