Facebook Embed

Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

17 June 2021

Random thought: Fixing Java

If Oracle simply changes Java so that null.toString() returns the string "null" instead of throwing a NullPointerException, they will probably solve the majority of mysterious bugs in Java programs.

18 May 2021

Random thought: False Hope of Extensibility

Common Java anti-pattern is to name some classes as "DefaultFooClass" when there's actually no way to use any other implementation.

I think it should be called the "False Hope of Extensibility" anti-pattern.

25 March 2019

Wooting LEDs from Java


While waiting for things at work, threw together a bit of Java code to tinker with the keyboard LEDs.. Pointless but fun. 😁 Note to self: Should make time to open source it this weekend so that other people can waste their time.
Posted by Antony T Curtis on Wednesday, 20 March 2019

https://github.com/atcurtis/wooting-java
https://www.instagram.com/explore/tags/wooting/
https://www.instagram.com/wootingkb/?hl=en

07 September 2016

Java Rock Stars

Opinion:
The rock stars of the Java world never stay on a project long enough, departing immediately when it starts to need cleanup. That way, they're getting the accolades for their achievements and of the people left behind, managers think "these guys are so much less productive than the rock star; we were lucky to have the rock star to get the project started."
Discuss.

14 August 2016

Java 8 Streams

This code is certainly more terse from using Java 8 streams but is it more readable than it would be otherwise?
public synchronized void unregister(AsciiString uri, ChannelHandler handler) {
  Optional
      .ofNullable(_handlerMap.get(uri))
      .flatMap(l -> Optional.ofNullable(
          l.stream().filter(p -> p.second == handler)
           .filter(l::remove).findAny().isPresent() ? l : null))
      .filter(List::isEmpty)
      .ifPresent(l -> _handlerMap.remove(uri, l));}

21 June 2015

Mucking around with ZooKeeper and Netty 4

ZooKeeper using Netty4 with a common netty worker pool...
Would be trivial to switch it to use the Netty 4 epoll implementation.

Now... To continue what I started hacking on ...

0 [main] INFO org.apache.zookeeper.server.ZooKeeperServer  - Server environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT
...
39 [main] INFO org.apache.zookeeper.server.ZooKeeperServer - Created server with tickTime 3000 minSessionTimeout 6000 maxSessionTimeout 60000 datadir /var/folders/4l/kmd0x0_x0q587n81vrrfjks40000z9/T/org.xiphis.zookeeper.TestZookeeper/zksnap/version-2 snapdir /var/folders/4l/kmd0x0_x0q587n81vrrfjks40000z9/T/org.xiphis.zookeeper.TestZookeeper/zklog/version-2
54 [main] DEBUG io.netty.util.internal.logging.InternalLoggerFactory - Using SLF4J as the default logging framework
60 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Buffer.address: available
61 [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available
61 [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available
62 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Bits.unaligned: true
64 [main] DEBUG io.netty.util.internal.PlatformDependent - Java version: 8
65 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.noUnsafe: false
65 [main] DEBUG io.netty.util.internal.PlatformDependent - sun.misc.Unsafe: available
66 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.noJavassist: false
68 [main] DEBUG io.netty.util.internal.PlatformDependent - Javassist: unavailable
68 [main] DEBUG io.netty.util.internal.PlatformDependent - You don't have Javassist in your class path or you don't have enough permission to load dynamically generated classes. Please check the configuration for better performance.
69 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.tmpdir: /var/folders/4l/kmd0x0_x0q587n81vrrfjks40000z9/T (java.io.tmpdir)
69 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.bitMode: 64 (sun.arch.data.model)
69 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false
111 [main] DEBUG io.netty.channel.MultithreadEventLoopGroup - -Dio.netty.eventLoopThreads: 8
172 [main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.noKeySetOptimization: false
172 [main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.selectorAutoRebuildThreshold: 512
208 [main] INFO org.apache.zookeeper.server.Netty4ServerCnxnFactory - binding to port 0.0.0.0/0.0.0.0:62326
236 [main] DEBUG io.netty.util.internal.ThreadLocalRandom - -Dio.netty.initialSeedUniquifier: 0x1216b72d21d3cb0f (took 13 ms)
278 [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.allocator.type: unpooled
278 [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.threadLocalDirectBufferSize: 65536
282 [main] DEBUG io.netty.util.NetUtil - Loopback interface: lo0 (lo0, 0:0:0:0:0:0:0:1)
282 [main] DEBUG io.netty.util.NetUtil - /proc/sys/net/core/somaxconn: 128 (non-existent)

25 November 2014

Some project foundation classes for Java.

Have been organising and repackaging some of my source code for release as free open source code. The flavour du jour is Java and these are just a few foundation classes which will be built upon in further packages, hopefully released soon (time permitting). #OpenSource #BSD #Java https://github.com/xiphis/xiphis-utils

21 April 2014

I don't care for Gradle.

I could vote for GRADLE-2496 but to be honest, I don't like Gradle enough to create an account just to vote for this issue. Given that the bug was first reported in 2012, few others care enough, too.

11 April 2014

10 second thoughts: Gradle

In my opinion, Gradle is a bad idea, implemented poorly. It should never take dozens of gigabytes of RAM and many tens of minutes, just to load its config files and determine that the command asked was mistyped.