2006-09-20

Python 2.5 released

Python 2.5 has been released into the wild, now with more features! One of those new features are conditional expressions, similar to the ternary ?: -operator in C/C++ and some other languages. And to show a bad example of how useful a feature it is, here's a small snippet returning a float range generator utilizing anonymous generators, conditional expressions and lambda functions:

frange=lambda start, stop=0.0, step=1.0, include_stop=False:
(
(min if step > 0 else max)((start, stop)) + index*step
for index in xrange(int(abs(start - stop) / abs(step) + 1))
if index*step < (abs(start-stop) + (step if include_stop else 0))
)


Like the xrange() and range() functions, the generated sequence does not include the stop-value. However, since inclusive ranges are quite useful with floats, the default behaviour can be overridden by setting the include_stop argument to True. In this case the stop-value is included in the range if it is a multiple of steps from start.

2006-08-31

Waiting for a better day

I've started to get comment-spam recently more than I care, so until I've upgraded the blog-engine from the ancient MT2.6 to something better, I've disabled comments, as they've not been so often used a feature anyway (partly because I haven't updated my blog in ages).

2006-06-18

Rannoilla Saimaan


Valoisat yöt Saimaan rannalla ovat innoittaneet monia Suomen runoilijoita. Hikiset päivät samaisen rannan läheisyydessä ovat puolestaan jättäneet jälkensä Suomen kansallismaisemaan.

2006-05-09

terassikausi avattu


Kauan sitä saikin odottaa, ennenkuin ehti tänäkeväänä terassille. Aurinkokaan ei oikein enää paista, mutta ei se mitään.

2006-04-08

Kyllä kestää


Muutaman mäntytukin kuoriminen oli hauskaa vaihtelua. Lisäksi lopussa tuli kerättyä viimeisten tukkien päältä pari muovipussillista pettutarpeita talteen. Jalaksen turvakengät tosin eivät kestäneet operaatiota täysin vaurioitta. Onneksi kengän ja sukan väliin mahtui mukavasti muovipussi (ei ne, joihin kerättiin pettua) pitämään jalat suunnilleen kuivina, vaikka lopussa risut tökkivätkin kengän edesmenneen pohjan läpi muutamia reikiä.

2006-03-17

Putty for Symbian OS

There was one thing I didn't like about in s2putty: it didn't take advantage of the full resolution available on the device, but used traditional resolution that was scaled up. The result was a bit fuzzy, and nearly gave me a headache.

I downloaded the latest beta source, as it is supposed to support S60 3rd Ed and the double resolution. A quick browse thru the sources revealed that it should support double resolution on N90 as well, if it provided the proper flag for the OS. Reading the 2nd Ed FP 3 C++ SDK docs I realized all I have to do is recompile the project with the correct SDK, and the ELayoutAwareAppFlag is turned on. The other choice would've been to find the CAknAppUi::BaseConstructL() method and give it the flag, but since this required no source changes it was the way to try out first...

Workes like a charm, the text is crisp and clear, with the 5x7 font it gives a 70x53 terminal window in fullscreen mode.

If you don't want to compile the project your self, you can download s2putty 1.4.1 beta 1 for S60 2nd Edition FP 3 (PGP Signature) and install it on your device, if you trust me enough :-)

Update: it does have a small problem with fullscreen setting, if you store fullscreen mode as default. It won't activate fullscreen UI mode at startup, although the internal state is set to believe it is in fullscreen mode. You have to toggle fullscreen mode twice (off-on) to actually use it in fullscreen mode.

2006-02-13

Panoramic photography explained

Articles by Doug Kerr

When doing panoramic photography with a conventional camera, multiple, slightly-overlapping shots of the overall scene are taken by pivoting the camera in steps, and the images are joined to make a single large-scope image. In order to be able to properly join the images, we must avoid parallax shift between them. To do so, the camera must be pivoted about the camera's center of perspective, which turns out to be the center of the entrance pupil of the lens.


I finally found a good and easy to understand article about rotating (pan and tilt) the camera for panoramic photography. Many guides talk about "nodal point", and they are usually dismissed as being misguided, yet no accurate explanation is given. Sometimes somebody mentions "entrance pupil" as a side note, but offers no explanation as to what it really is.

A recommended read for all.

And btw, I have finally made one panorama available from vacation: Cueva de los Verdes in Lanzarote. It has two rows, with 12 shots each, taken on my home-brew panoramic mount on a ballhead and tripod.

2006-01-21

Panorama structure



I was trying to figure out the math for covering a spherical panorama with a minimal amount of shots providing sufficient overlap, and realized that I had a tool nearly perfectly made for this: Povray.

The sphericalpano.zip contains three files for povray, but you only need to edit the panostructure.inc that defines the lens focal length, camera sensor dimensions and how you are planning to shoot the panorama. The panosim.ini contains povray settings for input, output and quality, and panosim.pov contains the scene construction. To run, just execute povray panosim.ini and look at the results. If you can see any black or if the overlaps are very small, increase number of shots. The center column has colored frames to help you analyze the results.

2006-01-01

Marketroids gone wild

I stumbled upon an article of canned champagne, which - they claim - is loved by young women. It comes in a red soda-can, with a straw attached to the side, and in 4-packs. I definitely love this part of the article:

KR Washington Bureau | 12/29/2005 | On New Year's Eve, pop the top: It's champagne in a can



Enter canned Sofia, aka the Sofia Mini.

Although drinkers call it champagne, technically it's not: Only sparkling wines produced in the French province of Champagne can call themselves that. It also calls itself Blanc de Blancs, but that label traditionally denotes a sparkling wine made entirely of Chardonnay grapes, while Sofia's a blend of pinot blanc, sauvignon blanc and muscat canelli.


That pretty much sums it up. If you can market something without repercussions while misleading the customer on all your claims, and people still claim to love it, it makes me wonder. On the other hand, this article could be just an article written by their PR-department, as is often the case in the US.

koko kansan esilaulaja


Terveiset tuomiokirkon portailta, vielä puolisen tuntia ennen perinteistä ja virallista uuden vuoden toivotusta Helsingistä