Warning: mysql_connect() [function.mysql-connect.php]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/waterwav/public_html/weblog/includes/weblog.php on line 44

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/waterwav/public_html/weblog/includes/weblog.php on line 337

Warning: Invalid argument supplied for foreach() in /home/waterwav/public_html/weblog/includes/functions.php on line 66

Warning: Variable passed to each() is not an array or object in /home/waterwav/public_html/weblog/includes/functions.php on line 111
x-log

Thèmes

Liens

License

Creative Commons License

Unless otherwise expressly stated, all original material of whatever nature created by Andreas Jaggi and included in this weblog is licensed under a Creative Commons License.

9.08.2008

Opera 9.25 vs Safari JavaScript syntax error forgiveness

The following definition of an Array works without problems in Safari (and probably Firefox too), but triggers an (legitimate) error in Opera 9.25:

var myArray = [
 1.2,
 2.3,
 3.4,
];

The error is triggered by the superfluous comma after the last element of the Array. It may be argued for both behaviors, but I would prefer all Browsers accepting such an Array definition also since in other languages (C, Python, PHP) such a redundant comma does not cause any trouble.

01:15 | Coding | lien permanente

25.06.2008

helloworld.c

void main(){puts("Hello World.n");}

21:40 | Coding | lien permanente

30.04.2008

Seems people don't read enough books

Coding Horror: Programmers Don't Read Books -- But You Should

14:23 | Coding | lien permanente

23.04.2008

Python (S60) links

00:12 | Coding | lien permanente

15.02.2008

Some Links II

08:53 | Coding | lien permanente

14.02.2008

Python Webserver in 1 or 15 lines

Python Webserver in 1 line:

python -c "import SimpleHTTPServer; SimpleHTTPServer.test()"

Python Webserver in 15 lines:

import BaseHTTPServer

class WebRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
    def do_GET(self):
        if self.path == '/foo':
            self.send_response(200)
            self.do_something()
        else: 
            self.send_error(404)
            
    def do_something(self):
        print 'hello world'
        
server = BaseHTTPServer.HTTPServer(('',80), WebRequestHandler)
server.serve_forever()

via

21:10 | Coding | aucune commentaire

11.02.2008

Some Links

10:00 | Coding | aucune commentaire

2.01.2008

7 Habits For Effective Text Editing 2.0

I really, really should have known the * command earlier.

10:40 | Coding | lien permanente

23.12.2007

Erlang has no locks and no keys.

Erlang processes don't share memory, so there is no need to lock the memory while it is being used. Where there are locks, there are keys that can get lost. What happens when you lose your keys? You panic and don't know what to do. That's what happens in software systems when you lose your keys and your locks go wrong.

Distributed software systems with locks and keys always go wrong.

Erlang has no locks and no keys.

Joe Armstrong, Programming Erlang

23:12 | Coding | lien permanente

19.08.2006

Samstag ist Patchtag

Heute jedenfalls: um meine Linksammlung in Zukunft besser vor Spammern zu schützen, habe ich Scuttle ein bisschen erweitert:

  • Zuerst wurde eine E-Mail-Benachrichtigung eingebaut, wenn sich ein neuer User registriert. So können Spammer nicht mehr tagelang unbemerkt ihr Unwesen treiben. → scuttle-email-notification.diff
  • Dann habe ich einen Filter eingebaut, damit sich Spammer nicht mehr mit freexxx, pornlinks oder texaspoker registrieren können. → scuttle-reasonableusernames.diff
  • Und zum Schluss gibt's noch einen Adminbereich wo Spammer bequem ausgewählt und mitsammt ihrer Links und Tags gelöscht werden können. → scuttle-admin.diff

Um den Adminbereich nutzen zu können muss in der Datenbank noch ein Feld uAdmin vom Typ TINYINT(1) zur Tabelle sc_users hinzugefügt werden. Danach dieses einfach auf 1 setzen um einen Benutzer zum Administrator zu machen.

15:04 | Coding | lien permanente

13.08.2006

httphead.c

Da es mir gestern Abend etwas langweilig war, habe ich mich ein bisschen im C Programmieren geübt, schliesslich sollte ich darin fit sein wenn ich im Herbst mein Semesterprojekt beginne.

Dabei ist ein kleines Programm entstanden, das den HTTP-Header einer Website ausgibt: httphead.c

15:40 | Coding | lien permanente

20.11.2005

Kommentar Spam

Seit gestern haben hier die Spam-Kommentare massiv zugenommmen (sprich 40-50 anstelle von 0-10 pro Tag). Zudem werden sie nicht mehr über den ganzen Tag verteilt abgegeben sondern fast alle innerhalb der gleichen 5-10 Minuten.

Glücklicherweise habe ich schon vor einiger Zeit meinen "naiven" Badword-Filter durch einen Bayes'schen Spamfilter ersetzt, der bisher alle(!) Spam-Kommentare erkannt und markiert hat.
Aber es ist trotzdem ärgerlich immer die als Spam markierten Kommentare zu löschen (momentant habe ich noch nicht genügend Vertrauen in den Filter als dass ich ihn die Spam-Kommentare automatisch löschen lasse).

Da die Anzahl der hier vorhandenen Kommentare nicht gerade enorm ist, habe ich um den Spamfilter zu trainieren auch noch die Seiten meines spamgeplagten Wikis hinzugenommen. Auch dort funktioniert die Spamerkennung nach anfänglichen Schwierigkeiten (False-positives) problemlos.

Dieses "Wundermittel gegen den Spam" habe ich nicht etwa selber entwickelt sondern ich habe einfach die Spam Filter Klasse von PHPClasses.org an meine Bedürfnisse angepasst.
Allen Spamgeplagten kann ich den Einsatz eines Bayes'schen Spamfilters sehr empfehlen!

00:07 | Coding | lien permanente

7.08.2005

Fight Spam

Since this weblog received about 100 spam comments last week, i implemented a simple spam-filter based on a badwords list.
If a comments text contains more than four occurences of the following words, it won't get added and the user is redirected to the mainpage.

Thanks to very specific spam content, it only needs a small list of badwords to detect the spam.

  • texas
  • holdem
  • casino
  • poker

This is just a simple anti-spam mechanism, but for now it works perfect and i hope it remains so for a long time :-)

12:49 | Coding | lien permanente

2.07.2005

Knapsack 0/1 and sorting algorithms

As an exercice for the algorithm test of next monday i implemented some algorithms in C.
There are:

The source code is available under the BSD License:

01:56 | Coding | lien permanente

30.06.2005

rl and rs

rl and rs are two small command-line programs written in C.

  • rl removes starting line(s) from stdin.
  • rs reverses it's input.

The source code is available under the BSD License:

22:01 | Coding | lien permanente