IntelliJ Bad Font Rendering on Linux

Font rendering in IntelliJ on Linux looks horrid. Any Java based application does for that matter. I can’t take it anymore. I just burnt 30 minutes looking into solutions. Fastest option, run it on the Linux optimised JVM tuxjdk. tuxjdk is a series of patched to OpenJDK to enhance user experience with Java-based and Swing-based tools (NetBeans, Idea, Android Studio, etc) Instructions (for me) next time this happens: Download tuxjdk and unpack it in /usr/lib/jvm, e.g. /usr/lib/jvm/jdk-8u25-tuxjdk-b01 Run IntelliJ like this; export IDEA_JDK=/usr/lib/jvm/jdk-8u25-tuxjdk-b01/ & ./idea.sh ...

December 5, 2015 · 1 min

GNU Stream Editor (sed)

sed has rocked my world. sed (stream editor) isn’t an interactive text editor. Instead, it is used to filter text, i.e., it takes text input, performs some operation (or set of operations) on it, and outputs the modified text. sed is typically used for extracting part of a file using pattern matching or substituting multiple occurrences of a string within a file. Contents Basic Syntax How sed works Substitution Append, Insert and Delete Multiple expressions Remote with ssh Substitution grouping Numerical grouping Executing Commands sed with Vim Commands Basic syntax sed ' [RANGE] COMMANDS ' [INPUTFILE] If no INPUTFILE is specified, sed filters the contents of standard input. ...

September 15, 2015 · 18 min

Eclipse brain damage

In my current project we use IBM’s version of Eclipse. On a Windows 7 VM. The VM crashes weekly. Not only has this made me paranoid about loosing my work (I stash my changes in version control like a demon), it seems to corrupt my RAD/Eclipse instance. Starting RAD produces the useful “An error has occured” error message: !SESSION 2015-09-02 10:53:50.331 ----------------------------------------------- eclipse.buildId=unknown java.fullversion=JRE 1.7.0 IBM J9 2.6 Windows 7 amd64-64 Compressed References 20140313_192258 (JIT enabled, AOT enabled) J9VM - R26_Java726_SR6_20140313_1318_B192258 JIT - r11.b05_20131003_47443.02 GC - R26_Java726_SR6_20140313_1318_B192258_CMPRSS J9CL - 20140313_192258 BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_AU Framework arguments: -product com.ibm.rational.rad.product.v80.ide Command-line arguments: -os win32 -ws win32 -arch x86_64 -product com.ibm.rational.rad.product.v80.ide !ENTRY org.eclipse.equinox.app 0 0 2015-09-02 10:53:52.658 !MESSAGE Product com.ibm.rational.rad.product.v80.ide could not be found. !ENTRY org.eclipse.osgi 4 0 2015-09-02 10:53:54.131 !MESSAGE Application error !STACK 1 java.lang.RuntimeException: No application id has been found. at org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:242) at org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:29) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55) at java.lang.reflect.Method.invoke(Method.java:618) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584) at org.eclipse.equinox.launcher.Main.run(Main.java:1438) at org.eclipse.equinox.launcher.Main.main(Main.java:1414) The error log isn’t much help. Something somewhere is corrupt. Asking Eclipse to clean itself seems to fix things: ...

September 2, 2015 · 1 min

JAX-WS SOAP Logger

Hot tip, logging helps understand how a piece of software works, long after it has left the cosy confines of the debugger. Logging SOAP message bodies can be really handy, when the thing that is interacting with your software is out of your control (i.e. a vendor or trading partner). And if you’re using web services, the likehood of this is high. Running JAX-WS web services in our servlet container, needed a quick and easy way to acheive this. Welcome to the wonderful world of SOAPHandler’s. ...

September 1, 2015 · 4 min

Cherished GCC flags

A (work in progress) compilation of useful GCC configuration, focused on C. -W warnings. -Wall is a must. -Werror to treat warnings as errors. -l instructs the linker it has some work to do (i.e. link a library please). -lm is shorthand for -libm and in turn -libm.a is a static library is selected. -L hint to the linker where to locate libraries. -L/opt/gdbm-1.10/src in combination with -lgdbm tells the linker exactly where to find the gdbm libraries. Multiple -L can be specified. Alternatively use the LIBRARY_PATH environment variable like so: ...

August 22, 2015 · 2 min

Logback Boilerplate

A useful starting place logback setup. I needed a way to roll logs not only by date, but also by size, to prevent behemoth log files from being generated. The marvellousSizeAndTimeBasedFNATP triggering policy (which comes out of the box) will gzip roll logs based on date, and then size too. So your logs directory ends up looking something like this: fooapp.log fooapp_2015-08-22.0.log.zip fooapp_2015-08-22.1.log.zip fooapp_2015-08-22.2.log.zip fooapp_2015-08-23.0.log.zip fooapp_2015-08-24.0.log.zip ... Here’s a sample logback.xml configuration that: ...

August 22, 2015 · 2 min

JDBC blob extractor

I was dealing with an application that stores image binary data in DB2. DB2 tooling (e.g. IBM Data Studio) didn’t seem to offer a convenient way of extracting images out of the box. I wasn’t suprised. It turns out dragging them out via JDBC was the path of least resistance. Ensure that you give your JDBC driver enough hints about the heavy nature of the result set that is coming back. For DB2 ResultSet.TYPE_FORWARD_ONLY and ResultSet.CONCUR_READ_ONLY worked well. ...

August 21, 2015 · 2 min

JVMVRFY012 Stack Shape Inconsistent

Following the routine restart of a WebSphere app server earlier this week, our application refused to start back up. This was an annoying suprise, as the environments are normally incredibly stable. The logs highlighted that a darker force was at play: [15/07/15 13:38:00:581 EST] 000000a9 StandaloneEJB I StandaloneEJBLifeCycle startApplication OpenWebBeans Container is starting... [15/07/15 13:38:00:589 EST] 000000a9 ObserverMetho I ObserverMethodImpl notify Cannot send event to bean in non-active context : [-43735604,Name:null,WebBeans Type:EXTENSION,APITypes:[java.lang.Object,org.apache.webbeans.jsf.scopes.Jsf2ScopesExtension,javax.enterprise.inject.spi.Extension],Qualifiers:[javax.enterprise.inject.Default]] [15/07/15 13:38:00:958 EST] 000000a9 ApplicationMg E WSVR0101W: An error occurred starting, ZizzledApp [15/07/15 13:38:00:959 EST] 000000a9 ApplicationMg A WSVR0217I: Stopping application: ZizzledApp [15/07/15 13:38:00:972 EST] 000000a9 WSEJBIntercep E CWOWB0102E: A JCDI error has occurred: <null> [15/07/15 13:38:00:977 EST] 000000a9 WSEJBIntercep E CWOWB0102E: A JCDI error has occurred: <null> [15/07/15 13:38:01:003 EST] 000000a9 ServletWrappe I com.ibm.ws.webcontainer.servlet.ServletWrapper doDestroy SRVE0253I: [ZizzledApp] [/ZizzledAppService/v1] [ZizzledAppServiceImpl]: Destroy successful. [15/07/15 13:38:01:039 EST] 000000a9 SharedEJBRunt I WSVR0041I: Stopping EJB jar: ZizzledAppEJB.jar [15/07/15 13:38:01:099 EST] 000000a9 SharedEJBRunt I WSVR0059I: EJB jar stopped: ZizzledAppEJB.jar [15/07/15 13:38:01:137 EST] 000000a9 ApplicationMg A WSVR0220I: Application stopped: ZizzledApp [15/07/15 13:38:01:208 EST] 000000a9 CompositionUn E WSVR0194E: Composition unit WebSphere:cuname=ZizzledApp in BLA WebSphere:blaname=ZizzledApp failed to start. [15/07/15 13:38:01:234 EST] 000000a9 FfdcProviderW com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident emitted on /var/logs/WebSphere8/ffdc/bencode02_9315bb77_15.07.15_13.38.01.2112090578995796253353.txt com.ibm.ws.runtime.component.CompositionUnitMgrImpl 679 [15/07/15 13:38:01:269 EST] 000000a9 DMAdapter I com.ibm.ws.ffdc.impl.DMAdapter getAnalysisEngine FFDC1009I: Analysis Engine using data base: /usr/WebSphere8/AppServer/properties/logbr/ffdc/adv/ffdcdb.xml [15/07/15 13:38:01:338 EST] 000000a9 FfdcProviderW com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident emitted on /var/logs/WebSphere8/ffdc/bencode02_9315bb77_15.07.15_13.38.01.235306456357083187192.txt com.ibm.ws.management.AdminServiceImpl.invoke 679 Wanting more details than an error occurred starting, tried my luck with the FFDC logs listed toward the end of the log: ...

July 25, 2015 · 3 min

Marketing Strategy and Branding

Building Strong Brands Marketing’s most basic premise: An exchange occurs between a buyer and a seller. 3 principles of marketing Customer value. What motivates the customer to want your product/service. Differentiation. What makes you stand out from the competition? Segmentation, targeting and positioning. Disecting your market horizon. 4 P’s of Marketing (Marketing Mix) The fundamental ingredients of the “exchange”. Each of the P’s can altered independently from each other in very interesting ways. ...

June 7, 2015 · 9 min

Spring Context Specific Configuration Files

Spring can be configured in lots of different ways and using context specific XML configuration is one of the preferred approaches. Context specific configuration in other words is simply a chunk of XML specific to a single concern (e.g. servlet config, jpa config, and whatever else you need). A classic example of this is the servlet-config.xml that the Dispatcher Servlet binds against: {% highlight xml %} fitTrackerServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/config/servlet-config.xml {% endhighlight %} Other Context specific configuration files can be registered by hacking your web.xml. Here’s an example for defining a place to stick JPA related cruft: ...

May 31, 2015 · 1 min