July: Manuscript completed, announcing job changes, JCrete and more

July was something between the 7th and 8th month of working on the Spring Boot Buch and by far the most crazy one. I started the first draft of an outline by late November and early December 2016, shortly before reaching out to publishers. After deciding for dpunkt.verlag I did some milestone planing and as of today, I reached them all in time which was quite assuring.

Manuscript for Spring Boot Buch completed

Last week I gave the complete manuscript in for review. I know that there are some real experts having a look at that stuff right now and I’m totally excited and anxious how that will turn out. The review should be completed by the end of August, than there’ll be another round of creative writing, than proofreading, typesetting and if everything works out, the thing will be out in December or January (though I really hope for December, in time with Spring Boot 2.0).

What will be in the package? It’s basically the outline I published in in January, but the part regarding microservices heavily reduced. There’s so much inside Spring and Spring Boot that isn’t about microservices but just about modern software development, that one cannot do justice to both in the same book. Good for the readers I myself have the awesome opportunity to review another book about microservices that will cover exactly that.

My book and the examples are all written agains the latest Spring Boot 2.0 milestones and I’ll make them sure that everything works with 2.0 final. I’ll cover “classic” Web MVC as well as Springs reactive story. You’ll learn a lot about database access as well.


To keep you updated on the progress I set up a website: Spring Boot – Moderne Softwareentwicklung im Spring Ökosystem. It goes hand in hand with the official twitter handle @springbootbuch.

Announcing job changes

After 15 years working for a small, Aachen based company, ENERKO INFORMATIK, I’m heading for new adventures. I’ll start as a senior consultant at innoQ Deutschland in October. My twitter exploded on that day:

Making the change at all and choosing between two great offers hasn’t been a decision made easily. ENERKO INFORMATIK is a good company and I wouldn’t be where I am right now without them, but it was the right decision to make. And trying to be a “consultant” is driven by the interest to get to know more projects, people and especially learn about a variety of topics I really don’t have a clue about. I’m quite sure that innoQ is a fabulous place to learn, discuss and grow. And regarding to naysayers in terms “you won’t be at home anymore” and stuff like that: Do you really think I haven’t thought and discussed through that? I’m already looking forward to a recap next just before next summers break.

Just before I leave before a well deserved summer holiday, one could say I’ve already been on vacation this year:

JCrete 2017: A once in a lifetime experience

In late 2016 I was chatting with @GeertjanW about #JCrete and what I have to do to get there: I’m neither a Java Champion nor has my book already been published. For whatever reason however @HeinzKabutz invited me to the special 2017 edition of JCrete with a bigger number of attendees.

I loved every single minute being part of an amazing unconference and even better, part of that community, but honestly: It wasn’t vacation at all. From early morning to late in the night surrounded by people that have something to say and with whom one can have a great discussion is rewarding but also exhausting. Discussions where really high level.

Those where all sessions conducted and I highlighted the ones I was in:



I have summarized them all at my foto-project site JCrete 2017, which will be available for two more weeks. More content is at JCretes official GitHub repository. Thanks to Rabea for curating all the content.

Misc

I stumbled about a post by Dan Lew: An Introduction to Functional Reactive Programming. If you’re unsure what’s all the fuss so many people are talking about, check it out!

Last week I was in Kassel, not only to meet with my longtime friend Jan, but also to speak yet again about database centric application, this time at the Jug Hessen. It’s great to see such in interest in SQL again. I really think implementing stuff in a way I suggest in my talk is of value in many situations. Not only when someone suddenly shows up and asks for a report, but for example as separate read and write models, too.

To come to an end: August will be more quiet, I have to recharge a lot. Plans for the next 2 months are now: Reviewing a book, taking a that summer holiday and than one more month of cleaning up stuff, doing documentation and so on… I cannot believe that the first half of 2017 is already over. It have been 7 exhausting but tremendously rewarding months so far and I’m looking forward to the next.

| Comments (3) »

30-Jul-17


June Wrap up

June was a very though month. I did quite some traveling and thus had hardly time for biking. Cycling wise worst June ever, below 300km in total.

Spring Boot Buch

Two weeks ago I received several drafts for the cover and I’m quite happy with them and already decided for one.

(By the way, I have banners, too…)

      __...--~~~~~-._   _.-~~~~~--...__
    //               `V'               \\ 
   //                 |                 \\ 
  //__...--~~~~~~-._  |  _.-~~~~~~--...__\\ 
 //__.....----~~~~._\ | /_.~~~~----.....__\\
====================\\|//====================
                    `---`
Spring Boot Buch on 2.0.0.M2.

I finished the whole messaging chapter, wrote some short paragraphs how to use email sender and started working on my examples for the reactive chapter. I think they quite nice and I’m looking forward to describe them. The chapter about reactive programming is the last to finish.

I’m really happy that I was able to estimate the timeframe of that project relatively good. Next month’s gonna be disrupted, though. First there’s JCrete in two weeks (and I hope that AirBerlin stays in business until I’m back) and then there will be some changes in my life I have to organize, so lets see how this will turn out.

Spring Datasource Proxy

On my way to the location of the third topic of this post, I stumbled upon this post by Arnold Galovics.

He uses datasource-proxy for logging statements. That’s nice if you don’t use JPA for example, which can do it on a different layer. In his post Arnold describes a bean post processor to replace Spring Boots auto configured database (or any other for that matter).

In Spring Boot Buch I describe a different way. In this I use the incredible useful Spring Boot class DataSourceProperties. If you have the spring-boot-starter-data-jpa on the path, configuration properties matching the prefix spring.datasource are automatically mapped to an bean instance of this class. It provides a convenient builder method that even takes care of replacing pool specific configuration with Springs values (for example, HikariCP has some different properties than Tomcat pool).

The properties can be used like this in your configuration:

@Bean 
public DataSource dataSource(DataSourceProperties dataSourceProperties) {
    final DataSource originalDataSource = 
        dataSourceProperties.initializeDataSourceBuilder().build();
    return ProxyDataSourceBuilder
        .create(originalDataSource)
        .logQueryBySlf4j(SLF4JLogLevel.INFO)
        .build();
}

And that’s it. Spring Boots auto configuration gives your configuration precedence. So you don’t wait for spring-boot-starter-data-jpa to provide a datasource but use the same mechanism like it does to get a datasource only in the scope of the bean method, proxy it and return the proxy.

This works also with Vlad Mihalceas Flexypool for example.

You’ll find this and many more tipps in the upcoming Spring Boot Buch, planned to be published by the end of the year! Follow the progress at @springbootbuch.

That brings me to:

Another installment of bootiful databases and a premiere

Earlier this year I discovered that you can get to Cluj in Romania for just a few Euros via Wizz Air. I reached out to my friend Vlad.



Vlad does awesome work for Hibernate and wrote a great book about high performance Java persistence. We made plans about speaking together and luckily that worked out at the 59th meet up of the Transylvania JUG. They had a full room in a Hotel just for us. Amazing.

The audience was great, we both got good questions and feedback. Sadly, I forgot to take pictures, but I saw someone with a camera.

The day after, a premiere: Accesa booked me for a Spring Boot Workshop. Apart from my terrible cold that went pretty smooth. That stuff was arranged as a test driven introduction to the different slices of a Spring Boot application and I felt comfortable with it. Sadly, half of the audience already had worked with Boot, but that’s just how it is.

If you’re interested in the topic, here is the repository: ws-20170627-cluj. The last commits are an outlook how to integrate Spring Cloud and easily create docker container for your services. If you have interest in that, we should get into contact.

| Comments (0) »

30-Jun-17


What makes me productive?

Yesterday evening I tweeted about my mouse’ battery being drained which caused a lot of tweets. In the end, Ralf asked, what makes you productive?

General workflow

I know and use a lot of shortcuts, wether being it in an IDE, terminal, browser or whatsoever. I start nearly all non-terminal applications via Spotlight or other means of textual inputs. Most of the window handling that one has to do, I also do with keyboard under macOS, although I must give in that I find the window handling in Windows more intuitive till this very day (I’m on Mac OS X since 2003…). Nevertheless, there are still things I prefer doing with a mouse and that’s fine with me.

On the desktop I tried a lot of them, including all styles of Apples Magic mouse. At the moment I’m using a Logitech MX Master, mainly because it has a sane method for horizontal scrolling which is sadly often needed in apps like iTunes and co. I do have some macOS Mission Control shortcuts on one button which I use regularly.

In my opinion there’s still no better touchpad around than Apples implementation regarding notebooks. We have a lot of Lenovos at work which have a great keyboard and still a sucky touchpad, barely useable. Even the red knob is better.

Hardware

Sitting at a permanent desk, I prefer one single display. The bigger the better, with a resolution fitting the size. In my home office I’m using a 2011 27″ iMac, with 32Gb RAM and nice fusion drive. Still very happy with it.

In my current office I have a 2006 EIZO 24″ monitor hooked to a 13″ 2014 MacBook Pro. The monitor is old but has still a better quality than current low cost LED screens. I have a notebook stand for my MacBook to have it approximately the same height as the screen but I rarely use it for more than E-Mail, IM or Twitter.

What mobile work is concerned: I prefer smaller devices. I loved my 11″ MacBook Air very much and I only changed it because I ran out of disk space and RAM. In short: Small screen with a resolution as high as possible (read: Still readable with -8 Dioptrien on both eyes). I’d move to 12″ screen or lower as soon as one company (preferable Apple) decides to offer a device that small with 32Gb RAM.

Keeping stuff in sync

Stuff I edit on both machines is usually in a Git repository, either on GitHub or a private host. I keep presentations and articles in a Dropbox folder.

Backup

Desktop: Time Machine plus automated backup on a local storage device plus manual full bootable backup on 2 external disks via SuperDuper (one disk in my office, on in my drawer).

Laptop: Time Machine in my office and one manual full backup via SuperDuper.

Software

Being a Mac user for over 10 years I’m really used to some features of macOS. Also: I bought a lot of software over the years which I would miss when moving back to Windows. I’m also a big fan of macOS because most of the time it still works very well in all sorts of environment without sacrificing a Unix subsystem. The move back to Windows seems possible because one can have a Bash respectively a linux subsystem since a few months, which is a requirement for me.

Stuff I use on a daily base: zsh, git, vim, SQL*Plus with rlwrap, NetBeans, TextMate, Tower, Texpad, Paw and VMWare fusion. Oh and I love iTunes for my music collection (Yep, I’m that old, I still have one of those).

Environment

I prefer light and cold environment. Light as in actual light but also in light themes in the software I use. I tried some of the dark themes, but I really have a hard time using those.

Regarding noise: I hardly can work in the office if a lot of chatter is going on, especially some rooms away, when people are talking in a high volume about problems in the same area for example. Headphones and music does not help me in those situations. I only listen to music when I’m in the flow. However, I’m very productive in trains, cafes or something similar. That’s quite a different thing of noise.

I literally hate eating at the desk. People munching their apples or stuff in the same room in front of a screen is driving me nuts, the same way as smelly food is.

If you want to know more, just ask in the comments 🙂

(The picture for this post is from Heather Kennedy.)

| Comments (6) »

18-Jun-17


Add pluggable databases to Oracles Database Docker images

I recently needed a database including a huge schema for demo in a very short notice of time. I know know how to run expd/impd but that brings usually hassle regarding users, schemas and so on.

As some of you might know I’m using Oracles Database Images for Docker for quite some time now (first described here). You can still build them to your own needs from the sources (here) or use the new Oracle Container Registry which works quite nice if you already have an OTN account.

Anyhow. Those are the images I use currently:

oracle/database                          12.1.0.2-ee                acb2002fe54b        53 minutes ago      11.4 GB
oracle/database                          12.2.0.1-se2               211d3ba03cb2        7 weeks ago         14.8 GB

The 12c database consists per default of a container database and one or more pluggable databases and the 12c images adhere to that. So does our main development database.

What I did on the development database was: Stopping and unplugging the database containing the schema and user of our application (luckily, I was clever enough to separate those from other applications the last time i set this up). Then, I copy over the files to my local machine. That took about 15 minutes, including giving my coworkers a short note and was way faster than exporting the whole 40Gb or something.

How to do this? Login as sys user or any user with administrative rights: sqlplus / as sysdba will do just nicely on the database server. Than

ALTER PLUGGABLE DATABASE pdb_awesome_app CLOSE;
ALTER PLUGGABLE DATABASE pdb_awesome_app UNPLUG INTO '/tmp/pdb_awesome_app.xml';
DROP PLUGGABLE DATABASE pdb_awesome_app KEEP DATAFILES;

This closes and unplugs the database and writes all metadata into pdb_awesome_app.xml. Then copy the database files. Those usually by in a folder like /opt/oracle/oradata/NAME_OF_THE_CONTAINER_DB/pdb_awesome_app. Copy the whole directory onto the machine that will run the container. Also copy /tmp/pdb_awesome_app.xml onto your machine.

First it’s time to make your coworkers work again. The last command dropped the pluggable database from your server which is fine, since we still have the database files and the metadata. Still on the server execute

CREATE pluggable DATABASE pdb_awesome_app USING '/tmp/pdb_awesome_app.xml' NOCOPY TEMPFILE REUSE;
ALTER PLUGGABLE DATABASE pdb_awesome_app OPEN;

That will plug the database again and open it for your coworkers to enjoy.

Back to your machine running the docker instance. Start the Oracle Database image that fits the version your server has. I was using 12.1.0.2 here. Also note that the container must have the same database options available as the source. You can still add them inside the container with dbca, it’s part of the docker image. dbca has a -silent option so it doesn’t molest you with the X11 UI.

Start the container using something like

docker run -d -p 1521:1521 -v /some/path/OracleFiles:/opt/oracle/oradata oracle/database:12.1.0.2-ee

Note: You might want to check the charset of your database! The container databases charset should match the pluggable database. Oracles Docker images use AL32UTF8 by default. Luckily you can pass the charset with ORACLE_CHARACTERSET. That charset is used for that instance only. For example, use e ORACLE_CHARACTERSET=WE8MS1252 to start a database with WE8MS1252.

It will map /some/path/OracleFiles into the running container. If this folder contains a database (for example when you already used the container), startup will be fast, otherwise the container takes some time to create the initial container database. It’s important that you map a local folder into this docker container here. Oracle databases are huge and slow to create, so it’s not really an option to keep them inside the docker container. Also, it makes the running docker container even bigger than it already is.

Also, for the purpose of this exercise here, it’s important to take note of /some/path/OracleFiles. While your container is starting, you can already move the pdb_awesome_app folder you copied from the database serve into /some/path/OracleFiles. Also copy pdb_awesome_app.xml into the same folder.

Here is an important step: You may have to fix paths inside the xml file if your server doesn’t have it’s database files under /opt/oracle/oradata. Take your favorite editor and fix each entry in the xml file if necessary.

Then, use Kitematic or docker command line tools to execute a bash inside the running database container. Login to the container database as follows

docker exec -i -t ID_OF_THE_CONTAINER /bin/bash 
export ORACLE_SID=ORCLCDB
oraenv
sqlplus / as sysdba
create pluggable database pdb_awesome_app using '/opt/oracle/oradata/pdb_awesome_app.xml' NOCOPY TEMPFILE REUSE;
ALTER PLUGGABLE DATABASE pdb_awesome_app OPEN;

If the database version and all options match: Congratulations, you just copied a 40Gb schema in 30 minutes instead of several hours. I personally had some time to write this blog post before rushing to a JUG meeting and than to a customer 700km away.

| Comments (0) »

07-Jun-17


Spring Boot Buch: May recap

May has been a busy month for which I had covering Spring Security for the book on my agenda. You already can see the examples of that chapter here github.com/springbootbuch/security. I think there are some really useful configurations inside. As a matter of fact, shortly after I began that chapter, Spring Security 5.0 M1 has been released. Spring Security 5 will not only support Spring 5s reactive programming model from the ground, but it will also make OAuth a first class citizen. I can probably look forward to change my OAuth example. Anyway, I’ll have to revisit the OAuth examples anyway if I have room left for my cloud examples… But I’ll cover that later:

To my great please I met Joe Grandja, Co-Lead of Spring Security at Sergis great Spring I/O in Barcelona and we could chat about some changes in Spring Security. I actually didn’t plan to go to Barcelona again, my agenda was already packed, but one thing came to another and I ended up with a packed room for my “bootiful databases” talk, covering Spring Boot and jOOQ again:

Thanks to everybody who showed up!

Again, many things are not planed long before. As I had written January, I’m gonna visit Cluj and will do a joint talk on databases with Vlad. Turns out the possibility arrived that several people want me to do a Spring Boot workshop: What a nice surprise. I’m really excited and I hope that turns out as good as the recent talks.

While at Spring I/O I met a lot of friends from the Spring team (see featured post image) which is always great. I also met Johannes, who works at Mesosphere and has invited my to Kassel in July. After his talk I had a good idea what Mesos is about and took to freedom to polish his demo application a bit. I really wish that some people around here would welcome my suggestions only half as euphoric as he did:

You may ask why I am “pedantic” about that stuff: I want to have my infrastructure as simple and streamlined as possible. I don’t want to explain to anybody why I did have to override a handful of classes, provide all kinds of infrastructure to do the most simple things.

What I tried to convey in my book is that many programmers can keep their own configuration very simple. It’s often enough to know which properties to change and how one can take advantage from the sophisticated profiles and environment evaluation in Spring Boot. If custom configuration is necessary, keep that to a minimum too. That is: Extend only classes that are meant to be extended.

The last stance is especially true for Spring Security within Spring Boot: Use the hooks provided, read the docs and my book carefully before overwriting or overriding stuff. That being said: The chapter is finished. My last two milestones are Messaging and the reactive programming model coming up in Spring 5. Messaging is about a third done and for reactive programming I had help of one of the best people to get help from in Germany: Thanks Mark for providing the motivation.

I’ll probably write less in June, but I’m still in time. The problem in the end will be more of a space than a time thing: I’m already over the agreed number of pages and I’m not gonna fit in a complete and in-detail explained microservice story. But hey, that’s maybe a thing for a second book.

Apart from the that, the month was batshit crazy. High workload and a so-so atmosphere at max in the office and several important appointments outside. As usual when I’m stressed I cope with more work, but work that actually has a purpose so I provided a jOOQ test-slice for Spring Boot 2. As it has been the case several times now, I learned more than just some Spring internals from Stéphane reviewing my code.

Hell… I forgot the running sushi apocalypse that happened while discussing internal and external configuration with Franz… Thanks, I appreciate your feedback a lot:



| Comments (0) »

31-May-17