If you’re working with React Native you might have seen this:

Why is that? The React Native datepicker accepts a JS Date object as input which is maybe not the best idea. A JS Date marks a specific point in time. What a datepicker displays is a date without time and timezone.

What happens if you pass a Date object to the picker? React Native uses Calendar.getInstance() so it uses the local timezone of your device. When you construct a JS Date with less then two parameters JavaScript uses UTC. new Date('1978-08-07').toISOString() results in 1978-08-07T00:00:00.000Z with the timestamp 271296000000. …

Lately a user was complaining that he sees a wrong birthdate in our app. I asked our business guy to verify if it differs by one day just to ensure that we don’t have a timezone bug here. Actually this wasn’t the problem but my business guy went mad. “How can it happen that we’re even talking about bugs like these?”

Of course he’s absolutely right but date and time problems are not as simple as they might seem to be: Imagine you were born on 9 June 2006 18:00 in Munich (that’s 6pm if you are using a 12-hour…

React Native displays a red screen when an error occurs in debug mode:

The great thing here is that you can jump to the source file by clicking the relevant line of the stack trace. This is incredible helpful if the error is located in your dependencies. The node_modules folder of my current project counts 731 subdirectories. Searching manually is absolutely frustrating.

In my case the source file was always opened in Visual Studio Code while I’m developing with Intellij IDEA. I never knew how to configure this until I noticed this hint:

When you see Red Box with stack…

The German QWERTZ keyboard layout was not made for developers. Often needed keys like brackets and braces are unnecessarily hard to type. The layout is also not ideal for some applications or often used character combinations. Ever wondered why the creators of vi chose slash and question mark for forward/backward searching? Just take a look on a English QWERTY layout. You may also find motivations for using a slash to close html tags or using the combination of dot and slash for the unix filesystem.

EN International Apple keyboard

You could have more fun and increase productivity with modern keyboard layouts like Dvorak or…

I just started my first Ionic 2 application and struggled with adding Lodash as dependency. Since TypeScript 2 adding npm dependencies should be that easy:

npm install --save @types/lodash

You don’t have to deal with other tools like typings anymore. However the next build failed with this transpile error:

[12:06:18] transpile started …
[12:06:44] typescript: node_modules/@types/lodash/index.d.ts, line: 11444
‘]’ expected.

The problem is that the current version of the declaration file expects TypeScript 2.1 whereas Ionic 2 is using TypeScript 2.0. You need to search for a matching version and install the correct one:

npm view @types/lodash # check the dist-tags
npm install --save --save-exact @types/lodash@ts2.0

Don’t forget the save-exact flag. Otherwise your coworkers will run in the same problem after fetching.

RESTEasy logs every thrown WebApplicationException with it’s full stacktrace:

This may be helpful in case of a status 500 Internal Server Error. In case of a client error like 404 Not Found it just bloats your logfile and doesn’t provide helpful information. RESTEasy provides a NoLogWebApplicationException to avoid this but then you won’t find any information about these errors in your application logfile. You can easily improve this by implementing your own ExceptionMapper:

Of course you should always provide a helpful error message when throwing a WebApplicationException:

After almost one year of silence Oracle presented an update to the Java EE 8 roadmap at JavaOne: Java EE 8 by the end of 2017 and EE 9 one year later. As far as I know they didn’t explain why they stopped their work for so long or why they left the community in the dark about that. OK, but at least some progress now.

The new roadmap introduces two new JSRs (Health Checking and Configuration) and also proposes to drop Management 2.0, JMS 2.1 and MVC 1.0.

Especially the plan to drop MVC triggered controversial discussions. The statement…

When you’re implementing a file upload you most probably want to limit the size of the upload. But how do you know the size? Reading the Content-Length header should be obvious but can you really trust it?
No, the client can send whatever he wants, correct?
There are a lot of creative ways to be really sure for instance (using JAX-RS and Commons IO):

byte[] data = IOUtils.toByteArray(inputStream);
if (data.length > MAX_UPLOAD_SIZE) {
return Response.status(413).build();

Don’t do this. You’re loading the whole stream into your servers memory. The memory of your server is limited. It will crash if there’s…

When I started to work on janedoe (random data as a service) I did not want to host any of the required tools on my own. Why? It really hurts to maintain tools for a project on which you don’t work constantly. The need for an urgent patch always arises when it is least expected and most inconvenient.
Why Continuous {Integration|Deployment|Delivery}? I think that the borders between these three things are fluent and many people are using them without a clear definition of what they are really doing.

What I wanted is:

  • Of course a hosted version control system and…

YAML parsers usually do a good job in recognizing the correct types you are using. Parsing following YAML with for instance SnakeYAML will result in a Map containing the String “localhost” and the Integer 8080:

host: localhost
port: 8080

This is also working with mixed types in an Array:

config: [localhost, 8080]

Here we’ll get a List with a String and an Integer. While this is great for this case it may be not great for all cases. A common pitfall is to unintentionally mix types:

hexChars: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C…

Florian Hirsch

developer at finanzguru.de

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store