on B-trees and deletion

Από τα πιο ειλικρινή σχόλια που έχω διαβάσει ποτέ:

Deletes are very similar, except that they involve contractions.

This is a piece of fiction that we tell to undergraduates.

Για αυτό υπάρχει και το “Implementing Deletion in B+-trees” του Jannink. Είναι για main memory trees βέβαια, αλλά είναι μια αρχή. Και για όποιον θέλει να ψάξει παραπάνω:

Η Java δεν είναι C…

– Στη Java πατάς την τελεία (.) και σου βγαίνουν οι επιλογές. Δεν είναι σαν τη C που πρέπει να τα γράφεις όλα με το χέρι.

Δεν κατακρίνω αυτόν που το είπε. Αυτοί που τον έμαθαν να σκέφτεται έτσι πρέπει να βρούν τρύπα να κρυφτούν.

The Power of 10: Rules for Developing Safety-Critical Code

Ο Gerard J. Holzmann του NASA/JPL δίνει 10 κανόνες, εύκολους να τους θυμάται κανείς, για τη συγγραφή safety critical code. Παρόλαυτά είναι καλό να τους θυμόμαστε και όταν γράφουμε “κανονικό” κώδικα. Κυρίως γιατί σε αντίθεση με άλλα standard, δεν είναι σελίδες επί σελίδων, άρα μπορούμε να τους θυμόμαστε εύκολα και δεν φτάνουν να κυβερνάνε ακόμα και την αισθητική του κώδικά μας (ή ακόμα και το πόσα “spaces” είναι το [TAB]). Οι 10 κανόνες είναι:

Adhering to a set of 10 verifiable coding rules can make the analysis of critical software components more reliable.

  1. Restrict all code to very simple control flow constructs—do not use goto statements, setjmp or longjmp constructs, or direct or indirect recursion.
  2. Give all loops a fixed upper bound. It must be trivially possible for a checking tool to prove statically that the loop cannot exceed a preset upper bound on the number of iterations. If a tool cannot prove the loop bound statically, the rule is considered violated.
  3. Do not use dynamic memory allocation after initialization.
  4. No function should be longer than what can be printed on a single sheet of paper in a standard format with one line per statement and one line per declaration. Typically, this means no more than about 60 lines of code per function.
  5. The code’s assertion density should average to minimally two assertions per function. Assertions must be used to check for anomalous conditions that should never happen in real-life executions. Assertions must be side-effect free and should be defined as Boolean tests. When an assertion fails, an explicit recovery action must be taken such as returning an error condition to the caller of the function that executes the failing assertion. Any assertion for which a static checking tool can prove that it can never fail or never hold violates this rule.
  6. Declare all data objects at the smallest possible level of scope.
  7. Each calling function must check the return value of nonvoid functions, and each called function must check the validity of all parameters provided by the caller.
  8. The use of the preprocessor must be limited to the inclusion of header files and simple macro definitions. Token pasting, variable argument lists (ellipses), and recursive macro calls are not allowed. All macros must expand into complete syntactic units. The use of conditional compilation directives must be kept to a minimum.
  9. The use of pointers must be restricted. Specifically, no more than one level of dereferencing should be used. Pointer dereference operations may not be hidden in macro definitions or inside typedef declarations. Function pointers are not permitted.
  10. All code must be compiled, from the first day of development, with all compiler warnings enabled at the most pedantic setting available. All code must compile without warnings. All code must also be checked daily with at least one, but preferably more than one, strong static source code analyzer and should pass all analyses with zero warnings.

Όλο το άρθρο παρουσιάζει εξαιρετικό ενδιαφέρον και ειδικότερα η ανάλυση του σκεπτικού πίσω από τους εμπειρικούς αυτούς κανόνες.

[via The Power of 10: Rules for Developing Safety-Critical Code]

I hate Tcl!

(Και την OTcl)

Σχεδόν πάντα όταν κάποιος συζητάει στο comp.compilers για τις ανάγκες που έχει μια domain specific language που σχεδιάζει υποστηρικτικά για κάποια εφαρμογή, εμφανίζεται η Tcl. “Γιατί δεν το κάνεις σε Tcl;”

@!^&#$%

Έχω αγοράσει και διαβάσει τα Tcl and the Tk Toolkit, Tcl/Tk for Real Programmers και Tcl/Tk Programmers’ Reference (σε PDF), είχα κατεβάσει και το draft του βιβλίου του Welch. Διάβαζα και το the tclsh spot (σειρά άρθρων για την Tcl στο ;login:). Έχω δοκιμάσει ακόμα και το tclkit. Αλλά δε μπορώ ακόμα να συνηθίσω μια γλώσσα που τις μισές φορές που αναφέρεσαι στη μεταβλητή της βάζεις $ μπροστά και τις άλλες μισές όχι, ενώ για να της αλλάξεις την τιμή γράφεις μια προσευχή:

set x 3
set x [expr $x * 5]
incr x

Μπλιάχ! Προτιμάω να διαβάζω modem noise…

Arc released!

Μετά από αρκετά χρόνια αναμονής, ο Paul Graham και ο Robert Morris έβγαλαν στην κυκλοφορία το νέο μαργαριτάρι του προγραμματισμού, τη γλώσσα Arc. Από το Arc Forum:

“Arc is designed above all for exploratory programming: the kind where you decide what to write by writing it.
:
It’s not for everyone. In fact, Arc embodies just about every form of political incorrectness possible in a programming language.
:
Exploratory programming is the fun end of programming, and we hope that will be the guiding principle of the Arc community.”
arc.jpg

Image courtesy of oreillymaker.com

Η τρέχουσα έκδοση της Arc τρέχει πάνω από την MzScheme*. Παράδειγμα χρήσης της γλώσσας είναι το Hacker News, το οποίο είναι γραμμένο όλο σε Arc, ακόμα και ο HTTP server, πράγμα που τους επιτρέπει να αλλάζουν τον κώδικα του server on-the-fly+.

(Note to self: Να βρω λίγο χρόνο για δοκιμές…)

[via LtU]

Update: ArcCrossReference, an unofficial wiki site of the reference document of the language Arc. The main purpose is to understand the differences between Arc and other Lisp dialects.


[*] – Προς το παρόν με τη version 352 μόνο.

[+] – 10 χρόνια πριν συζήταγα με τον Παναγιώτη την δυνατότητα υλοποίησης ενός web server σε Haskell (με το Hugs ακριβέστερα) για τον ίδιο λόγο. *sniff* *sniff*

1o Συνέδριο Κοινοτήτων Ελεύθερου / Ανοικτού Λογισμικού (ΕΛΛΑΚ)

Από το http://www.fosscomm.gr/

fosscomm-1_banner_6.jpg
“Έχουμε τη χαρά να σας προσκαλέσουμε στο 1ο Συνέδριο Κοινοτήτων ΕΛΛΑΚ (Ελεύθερο Λογισμικό / Λογισμικό Ανοικτού Κώδικα) που θα διεξαχθεί στις 21 και 22 Μαρτίου του 2008, στο Εθνικό Μετσόβιο Πολυτεχνείο, στην Αθήνα.”

(read more)

Από ότι βλέπω συμμετοχή έχουν δηλώσει μέχρι στιγμής:

* Κοινότητα Ελεύθερου Λογισμικού ΕΜΠ
* Ελληνική κοινότητα Debian
* Ομάδα Χρηστών Linux Ιωαννίνων (I.L.U.G.)
* Ελληνική Διανομή της έκδοσης Slackel
* Ενωση Χρηστών και Φίλων Λίνουξ Ελλάδος (Hel.L.U.G)
* Ελληνική κοινότητα Drupal (Νεκτάριος Συλλιγαρδάκης)
* Τμήμα Πληροφορικής, Νέων Τεχνολογιών και Διαδικτύου ΠΑΣΟΚ (Αθανάσιος Πρίφτης)
* Eλληνικό openoffice.org (Δημήτρης Κορμπέτης)
* Ελληνική κοινότητα υποστήριξης του Joomla (Γιώργος Φάκας)
* JBoss/Redhat / Java Hellenic User Group (Δημήτρης Ανδρεάδης)
* Εργαστήριο HEP – NTUA (Φώτης Γεωργάτος)

Καταληκτική ημερομηνία δήλωσης συμμετοχής είναι η 18η Φεβρουαρίου 2008

[via]

Using Prolog in Windows NT Network Configuration

(Αυτό είναι στο όρια της ψηφιακής αρχαιολογίας)

Μίλαγα χτες με ένα φίλο που προσπαθούσε να λύσει ένα πρόβλημα με Prolog και έψαξα κανά δίωρο για να βρω μια καλή υλοποίηση που να ταιριάζει στο πρόβλημά του. Στην πορεία θυμήθηκα πως χρόνια πριν, είχα διαβάσει για τη Small Prolog η οποία είχε χρησιμοποιηθεί στον Windows NT kernel. Θυμόμουν πως είχα ξανακάνει αυτή την “άσκηση”, αλλά δε θυμόμουν περισσότερα @(%#*&$%^!

Mε λίγη τύχη, λίγη ώρα και χάρη στο Web Archive: Using Prolog in Windows NT Network Configuration του David Hovel.

Update: Περισσότερα μπορεί να δει κανείς στο “Is Prolog really used in Windows NT?”

Yes.

For more information, see

  1. Dennis Merritt, “Extending C with Prolog“, Dr Dobb’s Journal, August 1994, pages 78-82 and 102, 104.
  2. D. Hovel, “Small Prolog and Windows NT Networking“, Dr Dobb’s Journal, August 1994, page 80.

Having fun with the MNIST database

The MNIST database of handwritten digits, available from this page, has a training set of 60,000 examples, and a test set of 10,000 examples. It is a subset of a larger set available from NIST.

It consists of four files that store data in a simple file format (idx format) which is documented in the MNIST database homepage. I wrote this C program to be able to extract the descriptions of handwritten digits of a certain value separately (eg. only the 0s or only the 1s). The text output is pretty simple and closely resembles the format of a PGM file. It is describes the grayscale pixel values of the image in decimal ASCII. Pixel values range from 0 to 255.

As a bonus, there is the opportunity to extract the images in portable graymap file format (PGM) image files.

This program was written with these guys mostly in mind.

[download mnist.c]