Im Buch „angepasst & ausgebrannt“ von Thomas Leif (Thomas Leif, „Angepasst und ausgebrannt“, München 2010) berichtet die Journalistin Tina Groll von ihrem „Selbstversuch“, der Bremer CDU beizutreten (Veröffentlichung auf sueddeutsche.de). Dabei trifft sie auf Malte Engelmann, den damaligen stellvertretenden Vorsitzenden der Jungen Union und kommt mit ihn in engeren Kontakt.

Die Karriereplanung des Jungpolitikers ist langfristig:

Mit knapp 18 in die Partei, jetzt ist er 29 – mehr als elf Jahre Politausbildung liegen hinter ihm. Elf Jahre sind eine lange Zeit – und bis er auch als Abgeordneter in die Bremische Bürgerschaft einziehen kann, können noch ein paar mehr Jahre vergehen.

Immerhin stellvertretender Vorsitzender der JU, aber schon mehr als 10 Jahre in der Politik und immer noch kein Abgeordneter. Wenn ich z.B. die etwa gleichaltrige Jana Schimke von der Brandenburger CDU ansehe: 2003 in die CDU eingetreten, seit 2013 Bundestagsabgeordnete.

Aber irgendwas muss schon rausspringen, wenn man soviel Zeit investiert:

Malte hat zudem viele Schulungen bei der Konrad-Adenauer-Stiftung gemacht, das sei nun mal wichtig für eine politische Laufbahn. Und irgendwann wolle man etwas davon haben. „Es kommt einfach der Punkt, an dem man sich fragt: Warum tue ich das? Ich glaube, so viel Idealismus hat niemand, sich all das abzuverlangen und dann nicht mehr zu wollen.“

Noch während Grolls „Selbstversuchs“ rückt er auf zum Vorsitzenden der Jungen Union in Bremen.

Was ist heute aus Malte Engelmanns Karriere geworden? Sitzt er inzwischen in der Bremer Bürgerschaft?

Nein. Ein satirisch gemeinter Blog-Post mit Nazi-Bezug reichte, um die Karriere zu beenden.

Was ist passiert? Die CDU-Bremen veranstaltete 2011 ein Iftar-Mahl (Fastenbrechen) mit Muslimen. Es gab Kritik seitens CDU-Mitgliedern. Die taz fasst zusammen:

Engelmann fand [die Kritik] vollkommen daneben. Und schrieb in seinem Blog – eine Glosse. „Jetzt sagt die Tante Siegrid: Heiko [Strohmann, Fraktionsvize], das hat 3.000 € gekostet, das geht so nicht“, heißt es darin, „nicht für den Islam“. Nicht allein etwas plumpe Ironie-Marker wie die Benennung „Tante Siegrid“ machen den satirischen Charakter des Textes nahezu penetrant. Aber offenkundig ist der Verfasser an genau diesem Bemühen um Deutlichkeit gescheitert – beim Titel. Der lautet „Deutsche kauft nicht beim Juden!!! Äh, ich mein: Heiko!!! Koch nicht für den Muselmann!!!“ Als Transformation des historischen antisemitischen Hetzappells war der ironische Aufruf an den Parteifreund also deutlich kenntlich gemacht.

Doch Malte Engelmann wurde von der Presse zum Vorwurf gemacht, Nazi-Parolen zu verbreiten, die Ironie komplett ignorierend. Die CDU reagiert „entsetzt“, er trat zurück.

Ein einzelner, missverständlicher Blog-Post reicht also und die Karriere ist dahin. Hier noch ein Interview mit dem Zurückgetretenen. Trotz allem will er in der CDU bleiben.

Update: Laut Pressemitteilung des Bezirksamtes wurde die Brücke am 28.11.2014 eröffnet.

Wer derzeit mit der S- bzw. Regional-Bahn von Grünau in Richtung Eichwalde (oder anders herum) fährt, dem werden Bauarbeiten auf Höhe der Ost-Anbindung des Flughafen BER an die Görlitzer Bahn  beidseits der Gleise auffallen. Ich habe mich schon einige Zeit gewundert, was da mitten im Forst gebaut wird.
Baustelle Querung Görlitzer Bahn im Grünauer ForstErklärung: eine Brücke für Radfahrer und Fussgänger, damit man von Bohnsdorf nach Eichwalde gelangen kann.

Baustellenschild

Die aktuellen Satellitenbilder auf Google Maps zeigen, dass die Querung der Ost-Anbindung von Grünau zum BBI bereits existiert:

Hier ein Bild auf den Weg die Brücke hinauf:
Querung Ostanbindung BER Bohnsdorfer Forst

Und von der Brücke auf die Strecke:
Blick von der Fahrradbrücke über der Ostanbindung BER

Hintergrund ist die Anbindung der offizielle Berliner Fahrradroute „RR 10“ in Bohnsdorf an den Alten Radelander Weg in Eichwalde mit Anschluss an die Fahrradroute 5. Die Deutsche Bahn wurde zur Errichtung verdonnert, da half auch eine Klage nicht.

Zum Fertigstellungstermin schreibt das BA Treptow-Köpenick am 05.05.2014 auf eine Kleine Anfrage:

Die Brücke ist nun im Bau und wird voraussichtlich Anfang 2015 für Fußgänger und Radfahrer zwischen Bohnsdorf und der Dahme barriere frei nutzbar sein. Entstehen wird ein geschwungener Steg auf V-förmigen Stahlstützen, welche auf Einzelfundamenten gegründet sind.

Damit wird eine lange bestehende Forderung der BVV und der Bohnsdorfer Bürger umgesetzt.

Siehe auch das Radwegekonzept Treptow-Köpenick 2010, Abschnitt „4.3 Querung S-Bahn und Görlitzer Bahn im Grünauer Forst“:

Die Querung ist erforderlich, um den Verlauf des RR 10 über den Sandbacher Weg zu verlängern und durch den Grünauer Forst über die Görlitzer Bahn zum Alten Radelander Weg zu führen. Über den Alten Radelander Weg führt die Hauptroute nach Eichwalde und schließt dort in der Bahnhofstraße an das Netz der AG Süd an (Route 5, Fließe- und Hügelroute). Von dem wieder herzustellenden Bahnübergang aus führt eine Nebenroute geradeaus zur „Bammelecke“ am Langen See. Diese Route hat für den Freizeitverkehr eine hohe Bedeutung, weil sie die kürzeste Verbindung zwischen Bohnsdorf und dem Langen See darstellt und frei von Kfz-Verkehr ist.

I recently felt the need for accessing the metrics / statistics of a JDBC Data Source from within an application that is deployed on a Oracle Weblogic Server. I did not succeed right away, so I document it here.

Basically we just need some calls to JMX. Using the Weblogic RuntimeServiceMBean we navigate from ServerRuntime and JDBCServiceRuntime to JDBCDataSourceRuntimeMBeans. From there we get ObjectNames for each JDBC Data Source that we can access from our application. Using these object names we can retreive the metrics.

First we get the MBeanServer via JNDI:

  1. MBeanServer getMBeanServer() throws NamingException {
  2.   InitialContext ctx = new InitialContext();
  3.   MBeanServer server = (MBeanServer) ctx.lookup("java:comp/env/jmx/runtime");
  4.   return server;
  5. }

Then we navigate as described before:

  1. ObjectName[] getJdbcDataSourceRuntimeMBeans(MBeanServer server)
  2.       throws MalformedObjectNameException, AttributeNotFoundException, MBeanException,
  3.       InstanceNotFoundException, ReflectionException {
  4.     ObjectName service = new ObjectName(
  5. "com.bea:Name=RuntimeService,Type=weblogic.management.mbeanservers.runtime.RuntimeServiceMBean");
  6.     ObjectName serverRT = (ObjectName) server.getAttribute(service, "ServerRuntime");
  7.     ObjectName jdbcRT = (ObjectName) server.getAttribute(serverRT, "JDBCServiceRuntime");
  8.     ObjectName[] dsRTs = (ObjectName[]) server.getAttribute(jdbcRT, "JDBCDataSourceRuntimeMBeans");
  9.     return dsRTs;
  10.   }

To get the current number of active connections and the current capacity of the connection pool, we access the attributes ActiveConnectionsCurrentCount and CurrCapacity:

  1. MBeanServer server = getMBeanServer();
  2.       ObjectName[] dsRTs = getJdbcDataSourceRuntimeMBeans(server);
  3.       for (ObjectName dsRT : dsRTs) {
  4.         String name = (String) server.getAttribute(dsRT, "Name");
  5.         Integer activeConnectionsCurrentCount =
  6.             (Integer) server.getAttribute(dsRT, "ActiveConnectionsCurrentCount");
  7.         Integer currCapacity =
  8.             (Integer) server.getAttribute(dsRT, "CurrCapacity");
  9.     // do something with these metrics
  10.       }

There are a bunch of metrics. Here is a list. You can enumerate them using MBeanAttrbuteInfo:

  1. /**
  2.    * Returns MBean-Attribute Infos such as Name, Type and Description
  3.    */
  4.   public MBeanAttributeInfo[] getMetricsAttributeInfos() {
  5.     try {
  6.       MBeanServer server = getMBeanServer();
  7.       ObjectName[] dsRTs = getJdbcDataSourceRuntimeMBeans(server);
  8.       if (dsRTs.length>0) {
  9.         return server.getMBeanInfo(dsRTs[0]).getAttributes();
  10.       }
  11.     } catch (Exception e) {
  12.       // your favourite error logging mechanism here...
  13.     }
  14.     return new MBeanAttributeInfo[]{};
  15.    
  16.   }

every MBeanAttributeInfo contains name, type and description of the attribute.

Note: I am using Weblogic Server 11g here. I have not tried this on WLS 12c.

I love to use Emacs, mostly for org-mode. I also use Notepad++ as an text editor (when using MS Windows), although I would like to use Emacs more. I noticed I choose Notepad++ when I quickly need an editor buffer to paste some text to because Notepad++ has this „New“ icon in its toolbar that creates a new buffer quickly.

Emacs is easily extendible, so how about creating a „quick new buffer“ function myself? It is really easy.

To create a new buffer you use Ctrl-x b (for function switch-to-buffer) and type a buffer name. But even typing in a name is too much for me. Automatically name the buffer „New“ and add a unique number to it! There is a function called rename-uniquely which does what it says. Now we can create a function make-new-buffer:

  1. (defun make-new-buffer ()
  2.   "makes a new buffer, uniquely named"
  3.   (interactive)
  4.   (switch-to-buffer "New")
  5.   (rename-uniquely))

Super easy: it creates a buffer named „New“ and renames it so that it has a unique name. Bind this to a key, I use F5:

  1. (global-set-key (kbd "<f5>") 'make-new-buffer)

Put this code in your .emacs or whatever.

When you have a bunch of buffers called „New<2>“, „New<3>“ etc., take a look at buffer-menu. You get a list of all buffers. Now you can operate on them. For instance, mark a buffer for deletion with d, repeat for other buffers and execute the command with x. Now you have killed a bunch of buffers quickly and easily.

If you are new to customizing keybindings and writing custom functions, Sacha Chua wrote a nice article „Read Lisp Tweak Emacs (Beginner 3/4): How can I make things more convenient?

Update: Xah Lee over at ErgoEmacs has published a similar article. He came up with the following, slightly more complex function:

  1. (defun xah-new-empty-buffer ()
  2.   "Open a new empty buffer."
  3.   (interactive)
  4.   (let ((buf (generate-new-buffer "untitled")))
  5.     (switch-to-buffer buf)
  6.     (funcall (and initial-major-mode))
  7.     (setq buffer-offer-save t)))

What is the difference? It uses generate-new-buffer to generate a new buffer and make sure it has a unique name (line 4). Then it switches to that buffer (line 5). It sets the major mode of the new buffer to the one declared in variable initial-major-mode, if any (line 6). Setting buffer-offer-save to t let Emacs ask you for saving that buffer before exiting Emacs (line 7).

This entry is part 7 of 7 in the series OOP 2014 Report

At OOP 2014, Martin Fowler gave the final keynote, broadly called „Software Design in the 21st Century“. He delivered his keynote in two parts, „Workflows of Refactoring“ and „Not just code monkeys“. An infodeck for the first part is available online, so I won’t cover it here.

Frustration with Agile

Martin Fowler expressed his frustration with Agile. He observes that often programmers are dropped user stories onto them to turn them into code. But the Agile Manifesto talks about conversational stories, that Users/Analysts and Coders have conversations about what to build. He demands developers building domain knowledge (and I agree with him), with a reference to „Observed Requirement„.

Responsibility

Being part of those conversations brings responsibility to developers. As an example, Fowler referred to darkpatterns.org:

A Dark Pattern is a type of user interface that appears to have been carefully crafted to trick users into doing things, such as buying insurance with their purchase or signing up for recurring bills.

Someone have build those user interfaces. So Martin asked devs for „impact judgement“: question „which impact has the software on the users, which impact have the users to the world?“.

Not just code monkeys

Martin Fowler identified two areas of our impact as a developer:

  1. Privacy
  2. Alienating Athmosphere

There is a video on youtube that shows the rest of the keynote. I encourage you to watch it (it’s about 6 minutes).

Martin  Fowler ended with strong words:

Change the world and make it better

I was really surprised by this strong statement and I think most of the audience was. It made a strong impression on me.

Here is another account on the keynote (in German).

This entry is part 6 of 7 in the series OOP 2014 Report

Ich habe die Notizen und Anmerkungen zu den Vorträgen, die ich an meinem zweiten Tag auf der OOP 2014 besucht habe, bereits in eigenen Blog-Posts verarbeitet:

  1. Software-Evolution mit aim42 – Architecture Improvement Method
  2. How to improve Estimates for Software: The #NoEstimates view
  3. Imposing Rule-Based Architecture on Legacy Systems
  4. Gehirnwäsche für Führungskräfte

Zu den Vorträgen am dritten Tag:

Value Validated Architecture: Discover Your Architecture sans BDUF (Steve Holyer)

Steve Hoyler fragt, ob der Build/Measure/Learn Zyklus auch für Architektur funktionieren kann. Er stellt ein Vorgehen vor, dass versucht, die Architektur bzw. Architekturentscheidungen mit business value zu untersetzen.

Der Anfang klang ganz vielversprechend: brainstorming darüber, was überhaupt zur Architektur gehört. Dies erzeugt einen offenen Dialog und ein geteiltes Verständnis der Beteiligten. Er sprach über Constraints vs. Options und die Frage, welche Constraints Commitments und welche Options sind.

Dann verlor sich Steve etwas in seinem Vortrag. Das muss er noch ausbauen. Insofern am Schluß etwas enttäuschend. Folien gibt es online.

Architekt zu werden scheint nicht schwer, Architekt zu sein dagegen sehr (Michael Stal)

Hier ging es vornehmlich um eine Art Ausbildung zum Software-Architekten mit Beispielen von der Firma Siemens, die da anscheinden sehr viel Zeit und Kapital investieren.

Wie sieht der Weg aus?

  1. Profiling: welches Wissen brauche ich?
  2. Reflection: welche Lücken habe ich?
  3. Doing: Lücken schließen

Architecture 201x (Stefan Tilkov)

Mit dem Untertitel „Lessons learned from modern web-based systems for Enterprise IT“ (Slides).

Stefan Tilkov hinterfragt alte Annahmen und stellt drei Thesen für eine Architecture 201x auf:

  1. Dinge klein schneiden
    • kleine, fokussierte Apps, siehe auch z.B. 12factor app
    • Isolation + Unabhängigkeit
    • Polyglote Programmierung möglich
  2. Teile integrieren, um ein Ganzes zu formen
    • Robuste System auf unzuverlässigen Netzwerken
    • Referenz auf „Circuit Braker„-Pattern aus dem „Release It!“ Buch mit Hinweis Hysterix und Finagle-Frameworks
  3. Effizienter Betrieb
    • Virtualisiertes OS als Container
    • automatisches Deployment
    • „You build it, you run it“

Wie immer von Stefan Tilkov ein guter Vortrag.

Keynote: Software Design in the 21st Century (Martin Fowler)

Siehe separaten Beitrag.

Komplexität oder Unffähigkeit (Gunter Dueck)

Ich kannte Dueck noch nicht. Ex-Querdenker bei IBM, jetzt im Ruhestand und Vortragsredner. Einfach mal auf Youtube schauen. Zum Beispiel das hier, ab ca. Stunde 1. (den Vortrag von der OOP2014 gibts anscheinend nicht online, war recht lustig).

The outstanding Emacs Org-mode enables you to include source code blocks our text. Org-Babel then enables you to execute that code.
Yesterday I came across the Orgmode cookbook. In a section it shows how to write a SQL statement and execute it agains a postgresql database. Very nice I thought, but what about Oracle DB? Because that what I use at work.

No official support

Oracle DB is not supported as of now. There is a proposed patch. It adds the call to sqlplus, Oracle DBs command line client. But on the mailing list there was no discussion about it. 🙁 One trick it applies is to add the „.sql“ suffix to the input file to sqlplus.

  1. (in-file (org-babel-temp-file "sql-in-" ".sql"))

So now I got the following code that is an additional branch in the org-babel-execute:sql function:

  1. ('oracle (format
  2.                               "sqlplus -s %s"
  3.                   (cond ( (and dbuser dbhost dbpassword)
  4.                       (format "%s/%s@%s @%s > %s"
  5.                           dbuser dbpassword dbhost
  6.                           (org-babel-process-file-name in-file)
  7.                           (org-babel-process-file-name out-file)
  8.                           )
  9.                       )
  10.                     ;; user specified dbuser, dbpassword, & dbhost
  11.                     ( (or dbuser dbhost dbpassword)
  12.                       (error (format "Must specify dbuser/dbpassword@dbhost, missing %s %s %s"
  13.                              (if dbuser "" ":dbuser")
  14.                              (if dbpassword "" ":dbpassword")
  15.                              (if dbhost "" ":dbhost")
  16.                              )
  17.                          )
  18.                       ) ;; if one specified, they all must be
  19.                     ( t
  20.                       (format "%s @%s > %s"
  21.                           (or cmdline "")
  22.                           (org-babel-process-file-name in-file)
  23.                           (org-babel-process-file-name out-file)
  24.                           )
  25.                       ))))

Formating the result

Now I got the SQL executing against my db. The output was a bit weired. I experimented with sqlplus formatting with mixed results.

I consulted the elisp source. The result is converted into an orgmode table using TAB as a delimiter. In an example that had two rather long columns with short column names, sqlplus used several tabs between the two column names and so screwed the output quite a bit.

I don’t have a good solution for that. My workaround is to use comma as a column seperator (set colsep ',') and let orgmode guess that. For that I had to touch one line:

  1. (org-table-import out-file (if (eq (intern engine) 'oracle) nil '(16)))

Also I deleted the first empty line using an oracle-branch in org-babel-result-cond/with-temp-buffer:

  1. ((eq (intern engine) 'oracle)
  2.        (with-temp-buffer
  3.            (insert-file-contents out-file)
  4.            (goto-char (point-min))
  5.            (kill-line)
  6.            (write-file out-file)))

Conclusion

In principle, it works. How nice formatted the output it is, depends on your query. When just documenting a query, as an alternative to orgmode I use SQL-Mode and format the result myself.

At work our application reads email from a number of POP3 servers using JavaMail. If you trigger the POP3 server’s timeout the session is closed silently und JavaMail does not complain on session.close. In the result, the message is not deleted and will be processed again on the next turn of the background processing task. To fix this, you need to check the state of the POP3 folder after processing each message. Read on for more details on this issue.

Problem

Some of the mails our application is getting are not only „messages“ meant to be read by humans but contain structured information that is processed. This means DB operations. Processing takes not more than a few seconds – unless the Oracle DB optimizer chooses to take a bad SQL execution plan. At least this is what happened to us last week: the processing of a structured message took like 20 minutes.

The symptom then was that after the application was finished processing the email, it did not deleted the message from the server. It then started processing the mail in the next turn. As we found out the POP3 server (qpopper) has configured a timeout of five minutes. After that it answers with an „-ERR“ status code to the next client command. The code we used to process the mail was roughly this:

  1. try {
  2.   mail = pop3Folder.getMessage(mailIndex + 1);
  3.   // ... do something with mail ...
  4. } finally {
  5.   mail.setFlag(Flags.Flag.DELETED, true);
  6. }
  7. folder.close();

When setting the delete flag, JavaMail sends the DELE command. That was answered with „-ERR“ (from POP3 protocol exchange):

C: STAT
S: +OK 1 1866
C: RETR 1
S: ...
C: DELE 1
S: -ERR POP timeout from some.host
C: QUIT
S: +OK Pop server at some.host signing off.

and the session is gone. Using session.close did not complain. So no exception occured. In fact, if an exception had occured we already had an compensation mechanism that would have prevented processing the same mail again. Also it would have pointed us to the problem more directly.

Solution

The solution is to check the protocol state using folder.isOpen after processing a mail.

If that folder is not open, the mails you have so far processed have not been deleted because in POP3, mails are deleted when closing a folder. So open the folder again and delete all messages (messageRead) that you have processed before. Then carry on, i.e. close the folder.

  1. boolean isOpen = folder.isOpen();
  2. if (!isOpen) {
  3.   folder.open(Folder.READ_WRITE);
  4.   final int mailCount = folder.getMessageCount();
  5.   for(int i = 1; i &lt;= Math.min(messageRead, mailCount); i++) {
  6.     Message mail = folder.getMessage(i);
  7.     mail.setFlag(Flags.Flag.DELETED, true);
  8.   }
  9. }
  10. // folder.close in "normal" code flow

The folder.isOpen sends a NOOP command and evaluates the response, so the „-ERR“ server code is not gone unnoticed.

Doing it right

POP3 was designed to download mails rather quickly. A better solution is to fetch emails from POP3, store it somewhere and only then process them („offline“).