2007-12-20

Do it, do it. do it well

Even such a small but very useful function saves a lot of time:

procedure assert_equal(expected varchar2, actual varchar2) is
begin
if expected is null and actual is not null then
raise_application_error(-20001,
'Expected is null'||' Actual '||actual);
elsif expected is not null and actual is null then
raise_application_error(-20001,
'Expected '||expected||' Actual is null');
elsif expected <> actual then
raise_application_error(-20001,
'Expected '||expected||' Actual '||actual);
end if;
end;

2007-12-17

Home <--> Work synchronization

What's a pity that major hosters do not offer free version control system. Google, sourceforge - that's all for programming projects.

I'd like to have some simple solution for the synchronization of small notes and todo lists at home and work computers.

I've come across OpenSVN project. The rules contain almost no restrictions on contents. It's slow, but it's quite enough for files <10к. Well, I hope that it will be no more bugs with backups ).

At the work computer with constant connect to Internet I've set up a scheduler, now I'm sure that I Can download everything at the home one, if needed.

2007-12-11

Static vs Dynamic: Holywar in the rubbish chute

From a discussion at Not a kernel guy

The cafe trash bins are in groups of three pieces: for plastic, aluminum cans and the rest of the garbage. There are big icons on them so that no one would throw plastic can to the usual garbage bin. It would be nice but cleaners change bins places from time to time, which causes customer pain and frustration. Each person that has already raised arm to throw, hangs on for ten seconds, trying to understand what happened.

I laughed at the classification of the solutions offered in comments:

Static cast: You should have three bins of different shapes and make a stand with according slots then put them in a different order will be problematic.

Dynamic cast: You should stick the same icons opposite each bin then the cleaner would recognize these stickers and would think about the right order…

Duck typing: You should replace all bins of exactly the same without the icons, but put them on trays with icons (indicating the type of garbage) - ie indication of the type is external to the container =).

2007-12-09

Ubuntu + Pocket PC + Bluetooth = ?

I've learnt a lot of uninteresting stuff.

Now I can not only copy files on PocketPC via Bluetooth under Ubuntu, but also connect to Internet.

No visual configurators, just google and emacs.

The secret was in the magic phone number *99#.

2007-12-03

Unpleasant Jabber

Oh my.. because of the latest problems with icq protocol changes I had to change icq transport to jabber.snc.ru. Well, it works quite good... but I'm constantly getting into small fixes with it - and this is with my small contact list in fifty persons.

Boring stuff...

Contacts that were located on icq server loaded automatically so I had a heap of monstrosity records like XXXXXXXX@picq.jabber.snc.ru. Everything had to be renamed manually. Icq contacts that were located only in jabber just remained at @icq.jabber.snc.ru, I had to move them manually too. After all that I had to confirm authorization for each contact and got the response.

It's stupid.

Also I've found that if I'll want to jump down from the server it will be somewhat problematic. Quick contact list transfer service does not want to work either with my main account at jabber.snc.ru, nor with experimental one at xmpp.org.ru. It works only with abandoned jabber.ru.

2007-11-28

20,000 Lines Under the Sea

I wanted to write a small script for installing/changing pictures for folders containing photos in Nautilus.

I dug into sources, dug out the required Corba interfaces, understood how bonobo and its python wrapper work.

Under old Ubuntu with Gnome 2.16.1 this script works, under the new one with Gnome 2.20 Bonobo.GeneralError with an empty message is thrown.
#!/usr/bin/env python
import bonobo
import Bonobo

bonobo.activate()
obj = bonobo.get_object ('OAFIID:Nautilus_Metafile_Factory', 'Nautilus/MetafileFactory')
print dir(obj)
I do not like it, but I have no choice - I have to edit ~/.nautilus/metadata

Update 03.12.2007 - The presentation slides Guadec2003 - PyOrbit

Update 17.12.2007 - I got evidence that this is a bug. I'm curious, for how long it will remain unnoticed

2007-11-26

In Gates we trust

Sometimes it seems that authors that compile lists of esoteric programming languages underestimate bat files possibilities.

rem The current day of a month
for /f "tokens=2,*" %%i in ('date /T') do (
set dt=%%i
)
set dt=%dt:~0,2%

2007-11-23

Linux on Laptops

While choosing and tuning my notebook I searched the whole Internet about how Linux works on computers from different vendors.

I did not like:

IMHO plain text is not very good for the description of the supported hardware. Why there is not a site where the user is prompted to place a pre-defined set of ticks and to write a comment, if necessary?

Since it's great to see comparative tables for different laptops or distributions.

2007-11-22

Shoot and run story about installing Ubuntu Gusty on Dell 1520.

The two main problems:

Media direct button
1.00002 At this point I worried for nothing, rmbr.exe utility easily works from the console of Vista repair disk, so Windows can be teared down painless. For some reason I had not managed with the placement of media-direct loader at a logical disk, so I placed both grubs at primary partitions, did not install grub in mbr, started rmbr.exe 3 2 and everything works. It is left to think of the place where on boot under the 8th run level autologin will happen, and to choose the media combine - MythTV, Freevo or Elisa.



Sleep
More with Google than with my own brains I came to the magic row for /etc/defaults/acpi-support, ater it suspend and hibernate began to work middling well.


MODULES="uvcvideo bcm43xx ehci_hcd uhci_hcd"

And for nvidia drivers is required

POST_VIDEO=false
POST_VIDEO=false

Hibernate hangs up if mixer applet or ekiga are running, they do not let to upload snd_hda_intel(sound) and uvcvideо (web camera).


Update 23.11.2007: Here is the description of what I managed to do and what I did not

2007-11-13

Shattleworth strikes back

dscn3730 While Ballmer is trying to impose Windows to Nigerian schoolchildren by foul means, Ubuntu is slowly and steadily spreading in the whole world.

Returning home with a freshly bought Dell Inspion 1520 under my arm, I found in the mailbox a package with two Ubuntu discs. As they say - it's a destiny )

I wanted to spend some time under Vista, get used to baubles, but evidently now I will set up Linux, just at weekends. The keeping of two OSes is a kind of schizophrenia - something you do here, something - there, the constantly shortcuts confusing, and you bite your elbows when you have to reboot for the sake of something.

I'm planning the following:
From LiveCD to sort out the sound and a problem with the hard drive. If everything will be ok, Windows can be teared down.
Update 14.10.2007: I booted from LiveCD and installed irqbalance_0.55-2_amd64.deb and linux-backports-modules-2.6.22-14-generic_2.6.22-14.9_amd64.deb. Could invent nothing more sensible, uploaded all snd_ modules manually and executed modprobe snd_hda_intel. Now sound works.

To remove Recovery and Media Direct partitions, create tiny(5-10м) Media Direct partition at the end of disk. To install Grub there. To set up under Windows Media Direct button for the working with this partition. If everything will be ok, I'll move further.
Update 16.11.2007: I could not place MediaDirect part with grub on logical disk for some reason. But with /dev/sda4 it works.
dscn3747 The further I get the more discoveries I have. Three operating systems pre-installed by dell to the new computer - it's cool. Moreover, initially I thought that bios menu item Diagnostic starts diagnostic programm from the first hidden partition of the hard disk. Not by any means. If to arm with grub and boot from (hd0, 0) then DOS but very pretty testing programm is started. It's the 7th year of the twenty-first century, on my new computer the mouse is working under DOS again ).
And from BIOS tests with the text-mode interface are run. Maybe it is embedded in BIOS? Then maybe, the first hidden partition is not needed at all?

Instead of Vista I've installed Ubuntu with the second grub, and the first grub is set to start ubuntu with some 8 run level, which will boot the absolute minimum, just for mplayer starting ).

Yes, one more thing: after the instalattion I'll have to fix splash screen, but it seems to be very easy.

Link Dump: What is MediaDirect 3? Inside the Dell Utility Partition

Update 26.11.2007: And my little sister received Ubuntu disks just on her birthday. That's marketing ))

2007-11-07

Valid time tables

I do not get it, seems like everything should be quite the contrary.


Quoting the same Dave Ensor and Jan Stevenson. "Oracle Design"


















producte_codeDATE_FROMDATE_TOPrice
113.01.200701.02.20071.12
102.02.200731.10.20072.24
101.11.200701.01.30005.47


select price from prices
where sysdate between date_from and date_to

It seems to be efficient to use index for the columns (PRODUCT_CODE, DATE_TO) since search parameter is located near the upper index bounds. However, note that on query processing still each line which has DATE_TO value grater than SYSDATE will be read. In other words, the optimizer will continue lines reading after we found the required string.

Maximum efficiency is achieved witр recent prices selecting, if column DATE_TO is indexed, and with oldest prices selecting, if DATE_FROM is indexed

2007-10-26

Under pressure.

Recently I very often come across posts shouting about the degradation of the programmer profession.

Let me join to these lamentations of Jaroslav's daughter.

Here is a part of a file with payment documents:
<payment id="14525" date="2007-10-24 00:00:00"
agent="4" rkc="1" operator="1"
total="8251" operduty="7407.32"
agentduty="539.171" sysduty="304.509"
bankduty="0"/>

Can you see the error?

Here is more evident sample:

<payment id="14795" date="2007-10-24 00:00:00"
agent="145" rkc="1" operator="1"
total="358010" operduty="325789.10000001"
agentduty="28640.799999998" sysduty="3580.0999999998"
bankduty="0"/>

Here even the total sum does not match the sum of the parts.
But we always glad to divide millionth of kopeks Ж)

Gosh...

2007-10-25

Corporative

Why in usual mail clients the avatar support is missing?

IMHO it is quite natural to paste ones small photo in the end of the letter, together with the signature, next to the standard - Sincerely yours, forever yours, kiss your heels SO-AND-SO.

Point is that in a steady increase in the number of employees and the growing number of additional offices, you can regularly exchange letters with a person for a long time, but do not recognize him(her) on meeteng.

It's not evident but usual Lotus Notes support the possibility of the automatically photo attachement.

Share the know-how:

lotus_html me_on_lotus It turned out that if to set html file containing a link to a local picture as a signature then this picture will be sent in e-mail as a usual attachment and will be correctly displayed in the end of the letter, near the signature.




The about contents of the html file:

<br>
<table>
<tr>
<td width="60px">
<img src="D:\Welcome\me.jpg"/>
</td>
<td>
<i><p>Sincerelly,<br>
</i>
</td>
</tr>
</table>


P.S. Yes, yes... I litter server backups with redundant pictures... but humanity is first of all :). It would be no need of redundant pictures if such an implementation would exist at Lotus level.

2007-10-22

Find your mind

I've met it here
Задача: Let it be A(x, y) = K(x2 + y2). Express A(r, φ).
Phisicist answer: A(r, φ) = Kr2.
Mathematician answer: A(r, φ) = K(r2 + φ2).

By the way, may be the problems described in the article Problem Solving and the Use of Math in Physics Courses are not the problems at all?


Very often complicated stuff come home to me in the three stages. The skill of using does not come simultaneously with the understanding of what the matter is.

Another issue is that for many University exams passing was enough to pass the first stage.

2007-10-18

Why are Shortcuts Files?

It's a regular joke: guys either e-mail a shortcut to a local file or get angry that at 4 Gb USB devise taken to 3 hour journey for a purpose only a tiny shortcut is placed.

It turned out it was initially planned so:
It had to be possible to copy a shortcut to a floppy disk or send it to a colleague as an e-mail attachment...

2007-10-15

The naked object

Consider a forest with birds singing in the trees and flowers covering its floor. We caneasily walk
along its paths or you can be adventurous an make your own paths. We can
select any aspect of its complex
ecosystem and study it for your doctoral thesis. There is
unlimited complexity, yet any human can
master it to suit his or her purposes. There is no
reason why a computer system should be more
complex than a forest. I believe that the
current complexity is man-made, and that we can
resolve it by changing our approach to
software development. We merely need to get our priorities right and create
the appropriate
tools. If we decide to build systems for people, then we will get systems tha can be mastered by people.
Trygve Reenskaug In the foreword to Naked objects R. Pawson Phd Thesis


An approach offered by creators of Naked objects framework looks very interesting, at least for the quick prototyping. Refuse, auto generation of UI, return to the OO basis - full-fledged objects with considerable behavior.

A big advantage is that the interaction with user happens by the most usual noun-verb script. IMHO, only Raskin zoom interface is required to be absolutelly happy. And for the convenient navigation on great number of open objects something like Leap is needed.

In web implementation from the outside it's very similar to like Django admin interface interface, in full-fledged GUI clients interface is much more interesting.

Update 18.10.2007: Naked objects discussing at ltu
Update 29.10.2007: Martin Fowler's article with the critique of objects without behavior and a critical response to it in some blog.

2007-10-05

Push or pull

An interesting solution of the problem of the eternal doors push or pull confusion has appeared in comments to a blog "In search of usability".

Indeed, if physically alter a door so that it would seems not fully closed when in fact it is closed, then no mistake can occur in principle.

I believe

With simple, consistent code, change analysis is a breeze. A simple trace through the layers of code with a text-search tool will generally reveal exactly what needs to be changed, and where. A solid test plan will identify what changes broke the system and how, and allow developers to respond appropriately.

No, it’s not fun and not challenging. It’s just good software


http://de.worsethanfailure.com/Articles/The-Mythical-Business-Layer.aspx

2007-09-25

Links: Functional programming ebooks

In a subscribe Spb Haskell User Group I've met several interesting links to files garbage with books on the functional programming.

I've dig out Introduction to Functional Programming by Mike Gordon. Judge by the first chapter a lot of text and samples but less mathematics is expecting further. Such a real programmers book.

I do not understand somehow what do they want...

Find an example to show that if V1=V2 then even if V2 is not free in E1 it is not necessarily the case that
(\V1 V2.E)E1E2 = E[E1/V1][E2/V2]

2007-09-17

Who needs this weather?

I look at gismeteo and do not understand if I live till weekend without a coat or not. Day, evening, morning, wind, rain... a lot of numbers.

I'd like to have a plain and simple site of one page displaying boy or girl dressed according to current weather. Probably, with umbrellas, or in rubbers. Probably, with smiling faces in the sunshine or with wrinkled faces in the wind.

But so that I have a look - and understand how I should dress in the morning.

That's all.

Update 21.09.2007: Thnks to . There is such a service!
Update 07.02.2008: And here is onemore - Predict the weather at cumul.us