Namek Dev
a developer's log
NamekDev

Serializing Java: inspecting data structure

May 12, 2017
Serializing Java: inspecting data structure

Every deserializer needs information about types - the data structure. In my serialization the deserializer can work behind network connection so it can’t count on Reflection mechanism. That’s why the serializer has to discover and serialize data structure that could be sent over the network and understood by deserializer.

This is Serializing Java - emerging series about writing your own serializer in case you didn’t like other serializers.

→ Continue reading Artemis Entity Tracker, Daj Się Poznać, Get Noticed 2017, java, Serializing Java

Java: enforce a single instance of an app

May 16, 2016

The Console is an app which typical usecase fits within running a single instance. That’s by design. However, we sometimes forget to check whether some the app is waiting for us in the background and try to launch them. That’s when disaster happens. Two consoles placed on top of window and reacting to same hotkey? Cannot be!

Here’s a short story about preventing from having multiple instances of same app made in Java. There’s a note about communication, too.

→ Continue reading The Console, Daj Się Poznać, java

The Console: script management

March 22, 2016

The biggest feature of my console software is ability to code own “commands” - scripts. It’s supposed to be easy and quick for programmers. I’m not trying to design my own DSL language or make users install some weird packages into system. JavaScript and console API is all you need to know to code your custom scripts.

If one of goals of The Console project is to make easy custom scripting then it’s logical that you need some way to manage your scripts. Putting all scripts in one file or even all scripts in one folder would be a mess. So, how to manage those files? How The Console deals with it?

→ Continue reading The Console, Daj Się Poznać, java

JavaFX: comparison of rich text components

March 8, 2016

Rich text component is a user interface component that displays text by styling various parts of it differently. Very often Rich Text components are used for editors. An example may be any code editor that supports highlighting. I needed such UI component for my latest application - The Console so now I’ll shortly discuss a comparison between few options:

  • e(fx)clipse Runtime StyledTextArea
  • RichTextFX
  • JavaFX built-in TextFlow
  • JavaFX built-in WebView
→ Continue reading The Console, Daj Się Poznać, java

JavaFX: taskbar-less undecorated window

March 5, 2016

Applications that are launched in Windows OS are by default listed on taskbar. For a utility software like The Console it is not the case. It shouldn’t pollute our task bar or even tray. It should be available under hotkey and that’s it.

Problem is, JavaFX won’t allow us. Previously presented line stage.initStyle(StageStyle.UNDECORATED)  gives us undecorated window but collides with stage.initStyle(StageStyle.UTILITY) which makes window’s task not visible in taskbar but window itself is then decorated.

Between workarounds I’ve found a solution. TL;DR initialize window using Swing.

→ Continue reading The Console, Daj Się Poznać, xtend, java

Retake on The Console

February 28, 2016

Some time ago I made this project https://github.com/Namek/TheConsole_POC for Windows OS. It’s usage goes like this: hit CTRL+TILDE and on the top of the screen will open a Quake 3 Arena thingie that’ll enable you to type in some commands. Commands are JavaScript’able and that’s the power of the tool. I did some hacks here and there so I decided to change some techs and remake whole beauty to improve efficiency of use.

→ Continue reading The Console, Daj Się Poznać, the-console, java

Immutability of Java's Integer

July 6, 2012

As Wiki states

In object-oriented […], an immutable object is an object whose state cannot be modified after it is created.

That totally applies to Java’s Integer. Let’s take a look at the code to talk about:

Integer a = 5;
Integer b = a;
b = b+1;
System.out.println("a = " + a);  // a = 5
System.out.println("b = " + b);  // b = 6

Integer is a class then why variables a and b have different values?

→ Continue reading Java, Languages