Grails: How to log within static methods

Posted on August 20th, 2008 by Reiner.
Categories: Grails, English.

Grails injects a log object for each artifact, but these loggers are not accessible within static methods.

Here’s a quick-and-dirty code snippet sample that demonstrates how to log from a static method within domain class Account. The trick is to get the Logger by invoking org.apache.commons.logging.LogFactory.getLog(this):

import org.apache.commons.logging.LogFactory

static Account createOrFindByImei(String imei)
{
    Account result = Account.findByImei(imei)
    return result ? result  :
    saved(new Account(
            imei:imei,
            email:Login.getCurrentLogin().email,
            name:"* New Account ($imei) created at " + new Date()))
}

private static Account saved(Account account)
{
    if(account.save())
    {
        return account
    }
    LogFactory.getLog(this)
      .error("!saved: $account.errors", new Throwable("*STACKTRACE*"))
}

4 comments.

Google Talk Chatback

Posted on August 14th, 2008 by Reiner.
Categories: English, Computers.

Half an hour ago I wanted to chat with a colleague of mine. I’m not that much into chatting, but into moving all and everything to Google Apps, so I’m on Google Talk (on my mobile as well), but my colleague is registered with Skype and MSN.

Bad luck, maybe hours of installation work ahead (I’m using a Thin Client which normally reverts to its clean boot settings on each power-up - keeping out stray viruses), tedious efforts to bar SuperChat applications from damaging the VOIP client built into my Nokia E90, forgotten passwords and other chores ahead :-(

For immediate anonymous chats, there’s a quick solution: Just add Google Chatback to your website. Chats are anonymous, but they’re not public, i.e. I’ll receive a separate window for each user. So they’re quite safe, unless someone successfully pretends to be my daughter, inquiring about my credit card details.

This one uses iframes, but the badge comes in customizable flavors that don’t require iframes. Provided your mailer program sends html you can even include the chatback badge in your mails. Sadly enough, Google Mail does not allow html in your signature, so you’d have to cut-and-paste each time again.

:-)

1 comment.

Datenkrake APIS schlaegt auch bei Ferienfluegen nach Spanien zu

Posted on July 3rd, 2008 by Reiner.
Categories: Deutsch, ThisNThat, La Palma.

Nicht schlecht gestaunt - ein Freund bucht fuer mich bei Air Berlin gerade Urlaubsfluege nach La Palma (Kanarische Inseln, Spanien) und fragt mich inquisitorisch nach den Daten meines Personalausweises, die bei der Buchung auf Grund des Advance Passenger Information Systems erhoben werden.

Es hat den Anschein, als seien neben den USA inzwischen auch viele weitere Staaten verkrakt, wie z.B. die Volksrepublik China oder hier Spanien. Also: Keep your ID cards ready!!!!

0 comments.

How to Successfully Tap Your (SIP) VOIP Phone Line for Free

Posted on May 4th, 2008 by Reiner.
Categories: English, Computers.

I’d like to present a free solution for Windows XP that reliably records incoming and outgoing SIP phone calls. I’m currently using it to record traditional conference calls for a team of software developers.

What you need

What you’ll get

  • A .wav file for each outgoing or incoming VOIP call.
  • There are additional components available from OrecX (some of which are being sold and thus are not for free), e.g. for saving phone calls within a database for later retrieval. I neither used nor needed those, as my primary concern was just to record daily stand-up telephone meetings.

How to Install

  • From Oreka: Download the files for your system environment
  • Install the Oreka audio capture server

Fine Tuning Capture Formats

By default, Oreka will produce .WAV-files using GSM compression. GSM is widely used for mobile phones, thus files are very small (about 100kBytes/minute), but sound quality is a little bit on the dull side and older applications might fail to understand GSM encoding. If space is of lesser concern, I’d recommend the plain old uncompressed pcmwav format (about 1MByte/minute) that can be read by virtually any program, or the ulaw (best in USA + Japan) or alaw (best in Europe and for international calls) encodings (about 500kBytes/minute) that are commonly used for SIP voice data and can be read by most programs.

With Oreka, audio file storage format can be set up within Oreka’s config.xml (Caution: do not choose native):
   <!– Audio file storage format: choose from: native, gsm, ulaw, alaw, pcmwav –>
   <StorageAudioFormat>pcmwav</StorageAudioFormat>

Converting to MP3

When publishing recordings, I’d suggest to produce .mp3-files. Oreka can’t do this on its own (at least the free version). I’m using WavePad to do the job: Drag your .wav file to WavePad, then click Effects, Dynamic Wave Compressor…, Threshold -24dB, Ratio 5:1, Limit 4dB, OK, then Save File As…, MP3, Constant Bitrate, 16kbps, Mono. You’ll end up with tiny files whose quality is superior to the one produced by commercial conference recording systems. 

Using an External Hardware SIP Phone

When using an external SIP phone (my favorite is the Thomson Speedtouch ST2030), for Oreka to successfully record your phone calls, it is required that Oreka “hears” all the data being sent from and to your SIP phone. That’s quite easy when using a soft phone on the very same PC that Oreka is running on, but will be more complicated when using an external hardware SIP phone. Current computer network equipment uses network switches to interconnect devices. Switches are smart. They know how to direct network data packets, so that reach their intended receivers - and only those. Let’s assume you’ve connected three devices to your switch (the switch itself possibly having been integrated within your DSL router):

  1. Your DSL router
  2. Your SIP phone
  3. Your PC (with Oreka installed and trying to eavesdrop your phone calls) 

Now, when you place a phone call, your switch will forward voice data from the internet to your phone (and vice versa). Your PC however will not receive any data sent from or received by your phone, effectively deafening Oreka. Although Oreka has instructed the network card within your PC to listen for any traffic (including the traffic that’s not destined for your PC), you won’t be able to record any phone call at all.

So are we stuck yet? Depends. If you are using a VOIP-DSL router where you have plugged your analog phone(s) into, the answer is yes. Read no further. Either look for conferencing services (e.g. Basement Ventures Free Conference Call Services) or analog taps that go in between the cable from your phone and to its handset (e.g. the Radio Shack Mini Recorder Model 43-1237 or the JK Audio THAT-1). However, if you are using a VOIP phone (one that uses Ethernet and does the SIP itself), you’ll get away by replacing your switch with a hub.

Provided you are using a SIP VOIP phone, you’ll either need a switch that features port mirroring (quite expensive) or a network hub, which forwards any data received on one of its ports to all other ports. As far as I know, hubs are no longer being manufactured at all, so you’ll either have to snatch one from a museum or get a used one from eBay. I’ve successfully tested the Netgear FE 10x and DS 10x hubs, both readily available and very inexpensive.

Credits

Tom Keating’s article VoIP Call Recording within his VoIP & Gadgets Blog has provided a plethora of invaluable information and thus served as an ideal starting point - a must have!

2 comments.

Woher kommen die Bilder - ohne Staatsanwalt?

Posted on March 16th, 2008 by Reiner.
Categories: Deutsch, ThisNThat, Uncategorized.

 

Black cat & Gold fish © Sebastian Duda #3826346
Ein Artikel ohne Bilder ist wie ein Redner ohne Stimme - langweilig bis lästig.
 

Aber woher nehmen und nicht stehlen?

   

  

Über 3 Millionen legale Bilder zu bezahlbaren Preisen gibt es z.B. von http://www.fotolia.com/. In dieser (kleinsten) Auflösung (z.B. 412×292) für nur 83¢.

    

Black cat & Gold fish © Sebastian Duda #3826137

0 comments.

Debuggen von Java Anwendungen - auf der Überholspur!

Posted on March 15th, 2008 by Reiner.
Categories: Deutsch, Computers.

English article at  Bad Habits Die Hard - How to Prepare Java Apps for Full Speed Debugging.

Beim Instrumentieren einer Java Anwendung für (auch Remote) Debugging werden oftmals VM-Parameter verwendet, die die Anwendung spürbar verlangsamen, da sie den Just-In-Time Compiler der Java VM ausschalten, z.B.:

-Xdebug
-Xnoagent
-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n
-Djava.compiler=NONE

Ab Java 1.4 ist es weder erforderlich noch per se ratsam, den Java Just-In-Time Compiler auszuschalten.

Die Anweisung -Djava.compiler=NONE sollte einfach entfallen:

-Xdebug
-Xnoagent
-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n

So kann eine Anwendung für das Debuggen vorbereitet werden, ohne dass ihre Performance darunter leidet, solange sie nicht aktiv debugged wird. Und selbst während des Debuggens wird die Anwendung durch den Just-in-Time Compiler beschleunigt. Dies ist in Test- (oder sogar Produktions-) Umgebungen sehr willkommen, die sowohl performant ausgeführt werden sollen, als auch eine bei Bedarf zu öffnenende Hintertür enthalten sollen, durch die Probleme untersucht werden können.

Sogar in aktuellen Posts wird das -Djava.compiler=NONE Antipattern verbreitet, wie z.B. bei ImageJ Plugins in Eclipse entwickeln.

Und das böse -Djava.compiler=NONE versteckt sich nicht nur in vielen Konfigurationsdateien und Werkzeugen, sondern hat es sogar geschafft, bis in Java 6 selbst vorzudringen. Siehe -Djava.compiler=NONE and -Xdebug anachronisms unanachronistically disable full-speed debugging in Suns Bug Database.

0 comments.

Bad Habits Die Hard - How to Prepare Java Apps for Full Speed Debugging

Posted on March 15th, 2008 by Reiner.
Categories: English, Computers.

Deutsche Fassung bei Debuggen von Java Anwendungen - auf der Überholspur! 

When instrumenting your Java application for remote debugging, a commonly used set of VM parameters brings your application to a crawl, as it disables just-in-time compiliation and enforces interpeter-only mode, e.g.:

-Xdebug
-Xnoagent
-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n
-Djava.compiler=NONE 

Starting with Java 1.4, it is neither required nor advisable to disable the Java just-in-time compiler,

so just remove the -Djava.compiler=NONE:

-Xdebug
-Xnoagent
-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n

Thus, you are able to prepare your application (e.g. JBoss) for debugging, and there will be no perceivable overhead unless you actually connect your debugger to the debuggee (using remote debugging). And even while debugging, the Java just-in-time compiler will speed up your application. That may be handy for test (or even production) environments that are supposed to both deliver full speed and still supply a back door for debugging once the need arises.

Even recent posts still promote the -Djava.compiler=NONE  antipattern, as in See how maven works inside - remote debugging plugins or Debugging your Maven Project in Eclipse.

And the bad -Djava.compiler=NONE habit may still be hidden within numerous configuration files or tools, as it even made its way into Sun’s Java 6 itself.  See -Djava.compiler=NONE and -Xdebug anachronisms unanachronistically disable full-speed debugging at Sun’s Bug Database.

0 comments.

Deckrackling the Acoustic Energy WIFI Internet Radio - 10% Effort - 90% Less Noise

Posted on March 15th, 2008 by Reiner.
Categories: English, at Home, Computers.

The Acoustic Energy WIFI Internet Radio

The Acoustic Energy 100 Internet RadioThe AE 100 was one of the first devices that, in a stand-alone unit, receives radio broadcasts from all around the world using Reciva technology and firmware.

AE 100 users are well aware of a common pitfall of this unit. When the volume is low your listening experience is impaired by frequent crackling noises.

Where do those crackling sounds come from?

Inside the AE 100 there is a WIFI USB stick, that implements the connection to your wireless LAN. The RF energy of its transmitter leaks into the wires which connect the loadspeakers to the analog amplifier circuit, where it is rectified and causes transmission packets to be heard. Well, it’s not a Sony :-(

How to avoid them?

There are some work-arounds for this bug, notably the one provided at AE 100 crackle problem : yet another fix. Philippe gives detailed instructions on how to dismantle the unit and how to shield the loadspeaker wires using shielding foil from STP computer cabling.

My no materials approach: Just twist them wires

Losely following Philippe’s instructions (I put the unit flat on its side, so I would not need three hands to handle the housing parts), I opened the case and unplugged the loudspeaker wires. Then I twisted them gently, so that they looked similar to the ones found in UTP cabling. I then reconnected the wires and reassembled the unit, trying to put as much of the wires near the loadspeakers as possible.

Less noise in almost no time at all

The crackles can still be heard with the volume set to 1 bar and your ear next to the front grid, but they are no longer perceivable at all during normal use :-)

The actual noise level may be more or less random depending on the position the wires will take when closing the unit.

Twisted Wires 2

Twisted Wires 1

4 comments.

Abhilfe für Internet Explorer platzt bei Anmeldung mit Fehler bei simyo.de - Mein simyo

Posted on March 1st, 2008 by Reiner.
Categories: Deutsch, ThisNThat, Computers.

Weil einfach einfach zu einfach wäre um einfach immer wirklich wirklich immer einfach zu sein…

Eben hatte ich an zwei verschiedenen PCs versucht, mit Internet Explorer 6 und 7 bei http://www.simyo.de/ über Mein simyo meine neue Kreditkarte einzutragen. Aber bereits bei der Anmeldung verschwand der Internet Explorer plötzlich und fragte artig, ob er Microsoft benachrichtigen sollte.

Auch mein Versuch, von meinem Nokia E61 aus auf Simyos Website zuzugreifen, wurde von Simyo dadurch sabotiert, dass Simyo mir auf meinem E61 nur eine sehr eingeschränkte Auswahl von Funktionen anbot, in denen vor allem die gesamte Verwaltung zur Zeit noch nicht enthalten war. Und das, obwohl das E61 einen vollwertigen Web-Browser enthält.

Ursache 

Ich vermute, dass das von simyo.de gesendete JavaScript inkompatibel mit einigen Installationen von Internet Explorer 6 + 7 ist. Wie kann ich den Fehler verhindern? JavaScript ausschalten! Der einfachste (und zugleich sicherste)Weg ist, *.simyo.de den Eingeschränkten Sites hinzuzufügen. Im Gegensatz zu vielen anderen Websites funktioniert Simyo auch ohne JavaScript.

Abhilfe

Fügen Sie *.simyo.de in den Internetoptionen Ihres Internet Explorers den Eingeschränkten Sites hinzu:

  1. Menüauswahlen Extras, Internetoptionen…
  2. Karteireiter Sicherheit anklicken
  3. Eingeschränkte Sites markieren
  4. Schaltfläche Sites… anklicken
  5. *.simyo.de eintragen
  6. Schaltfläche Hinzufügen anklicken
  7. Schaltfläche OK anklicken
  8. Schaltfläche OK anklicken

Ansonsten bin ich mit Simyo sehr zufrieden. Anmelden, Rufnummernmitnahme (besser: Mitbringe), Einrichten des Handies und die Nutzung sind problemlos. Und die Preise und Optionen (z.B. autom. Aufladen) sind sehr attraktiv.

0 comments.

Habe eben mein Grandstream GXP-2000 entsorgt

Posted on February 17th, 2008 by Reiner.
Categories: Deutsch, at Home.

Eigentlich wollte ich es bei eBay verticken, aber was mache ich, wenn der Käufer größer und kräftiger ist, als ich selbst? Aus rechtlichen Erwägungen heraus enthalte ich mich hier jeglicher weiterer Statements und verweise statt dessen auf http://www.voip-info.org/wiki/view/GXP-2000.

Ich bin seit etwa einem Jahr absolut zufriedener Benutzer des Thomson SpeedTouch ST2030 und nutze es als mein “Festnetztelefon” über sipgate.de. Im Gegensatz zu dem nun entsorgten und zwei weiteren verschiedenen mobilen VOIP-Telefonen verschiedener Hersteller (einer davon sehr renomiert), von denen ich eines nur durch vorsätzliches und kräftiges Fußauflegen wirksam von weiterer Sabotage (z.B. Reboot genau dann, wenn man auf Annehmen drückt) abhalten konnte, funktioniert das SpeedTouch einfach nur.

Genau, wie beschrieben, immer, und das recht komfortabel, z.B. Mailbox-Anzeige (MWI) und sogar Rückruf bei besetzt, aber hier und mit sipgate.de nur mit einigen Netzen, wie z.B. Telekom.

Das ST2030 hat m.E. nur zwei wirkliche Schwachpunkte, mit denen ich aber gut leben kann:

  1. Die Einrichtung ist nix für Oma Schmidt. Nicht dass es besonders schwierig wäre, aber Zielgruppe des ST2030 sind (Groß-) Unternehmen, die eben Mitarbeiter haben, die willens und in der Lage sind, die eher technik-lastigen Dokumentationen zu suchen, zu finden und zu verstehen.
  2. Nachts ist dunkel. Am Arbeitsplatz im Großraumbüro (Zielgruppe des ST2030) eher unwichtig, aber zuhause würde man sich zu nächtlicher Zeit schon manchmal wünschen, dass man erkennen könnte, was auf dem unbeleuchteten Display steht.

1 comment.