DIY Computer Part 4 Machine Language

A continuation of my participation in the amazing Nand2Tetris course, by Noam Nisan and Shimon Schocken, now running on Coursera. In this course you will build a modern computer system, from the ground up. We’ll take you from constructing elementary logic gates all the way through creating a fully functioning general purpose computer. In the process, you will learn how really computers work, and how they are designed. If interested, see prior posts: ...

May 23, 2016 · 7 min

bash

Bash is a Unix shell written by Brian Fox in 1989 for the GNU Project as a free replacement for the Bourne shell. To this day, Bash remains one of the most powerful and ubiquitous scripting tools on the planet. Contents Useful Shortcuts Initialisation Shell Grammar Variables Local variables Environment variables Positional arguments Expansions Brace expansion Command substitution Arithmetic expansion Double and single quotes Stream Redirection here documents Arrays Conditions if statements case statements Loops For Loops Select Loops While Loops Until Loops Functions Coprocesses Builtins Bash Recipes Top 6 largest things in the current directory Display the 23rd line of /etc/passwd Filter the first column from process status Delete Subversion scrap files Move shell scripts and mark them as executable Pattern matching Scan code base against list of patterns Rename Multiple Files Run a command every time a file is modified Keep a program running after leaving SSH session Simple menu and functions Complete example Resources Kudos to Denys Dovhan and his awesome Bash handbook. The most digestable, and enjoyable method I’ve found to groking bash. <3 ...

May 1, 2016 · 16 min

Classloaders

First some kudos and credits to the below. None of the material in this post is original, and I have documented it for my personal learning. Please refer to the below original (and superior) articles. ZeroTurnaround’s Jevgeni Kabanov awesome and most practical Do You Really Get Classloaders? Oracle’s A Sundararajan Understanding Java class loading All the way from 1996 by Chuck Mcmanis The basics of Java classloaders Hello java.lang.ClassLoader A Java class is loaded (i.e. born into the JVM) by a concrete implementation of java.lang.ClassLoader. If a class must be class loaded, what loads the java.lang.ClassLoader class itself (i.e. who loads the loader)? It turns out that there is a bootstrap classloader wired into the JVM. The bootstrap loader loads java.lang.ClassLoader in additional to many other Java platform classes (e.g. java.lang.*) into memory. The essential API: ...

April 20, 2016 · 11 min

thinkfan

I run Debian on a ThinkPad T420s. ThinkPad’s have a great Linux compatibility story, and the T420s is no exception. The cooling fan situation seemed in need of some attention though, with fans running at high RPM most of the time. Not only was this really noisy, hit the battery quite hard too. Enter thinkfan, a simple fan control program. Works with any linux hwmon driver, especially with thinkpad_acpi. It is designed to eat as little CPU power as possible. ...

March 19, 2016 · 2 min

Struts

Struts, the famous Java MVC web framework of the late 90’s and early 00’s that pioneered well structured server side web logic. Many Java based enterprise applications developed during this era (a metric s#!t ton) still make heavy use of Struts 1.x today. Apache Struts 1 is a discontinued open-source web application framework for developing Java EE web applications. It complements the Servlet API to encourage developers to adopt a model–view–controller (MVC) architecture. It was originally created by Craig McClanahan and donated to the Apache Foundation in May, 2000. ...

March 17, 2016 · 16 min

DIY Computer Part 2 The ALU

A continuation of my participation in the amazing Nand2Tetris course, by Noam Nisan and Shimon Schocken, now running on Coursera. In this course you will build a modern computer system, from the ground up. We’ll take you from constructing elementary logic gates all the way through creating a fully functioning general purpose computer. In the process, you will learn how really computers work, and how they are designed. If interested, see prior related post [DIY Computer Part 1 The NAND Gate]({% post_url 2016-03-06-diy-computer-nands %}). ...

March 12, 2016 · 5 min

DIY Computer Part 1 The NAND Gate

I love computers. When I recently discovered that the Nand2Tetris guys, Noam Nisan and Shimon Schocken, had just packaged their famous course into a neat 12 week Coursera package, I couldn’t resist studying it any longer. In this course you will build a modern computer system, from the ground up. We’ll take you from constructing elementary logic gates all the way through creating a fully functioning general purpose computer. In the process, you will learn how really computers work, and how they are designed. ...

March 6, 2016 · 7 min

wsimport

Thrown into a large, legacy EE code base, I needed to create new SOAP web services, and update some existing ones. To make life interesting, there lacked a repeatable process (e.g. via Ant or Maven) for processing WSDL’s and generating the associated JAXWS and JAXB source code artifacts in a consistent manner. First things first, a repeatable and scriptable procedure. wsimport to the rescue. wsimport has been around so long now, the com.sun.tools.ws.ant.WsImport Ant task is guarenteed to be kicking around in your environment. It’s also a best practice to use the vendor specific wrapper to wsimport, in my case WebSphere. ...

March 2, 2016 · 10 min

awk

After recently getting my hands dirty with the wonderful [sed]({% post_url 2015-09-15-sed %}), the time has come for me to step it up with awk. Incepted in 1977 at Bell Labs, AWK is an interpreted programming language designed for text processing, and is a defacto part of most nix based distributions. The original version of UNIX awk was designed and implemented by Alfred Aho, Peter Weinberger, and Brian Kernighan (notice the first letter of their surnames together) of Bell Laboratories. Brian Kernighan continues to maintain and enhance it. Paul Rubin and Jay Fenlason, of the Free Software Foundation, wrote gawk, to be compatible with the original version of awk distributed in Seventh Edition UNIX. ...

January 17, 2016 · 10 min

Java Prepared Statement Overflow

On the hunt for an sporadic DB2 SQL Error -805, I took a dive into some logs. It had been rearing its ugly head for weeks now, and starting to impact our business area. The call stack pointed straight to the bad patch of code, the Java EE solution contains a programmatic TimerService, responsible for shuffling data from one database to other; a rudimentary replication solution in other words. The specific source database in this case happened to be DB2 running on AIX. No big deal. Except that the code has proven to be flakey under load. That is, the code was transferring ~500,000 records daily, but was choking for ~100,000 records, the lions share of the load and failures seemed to pertain to BLOB data. ...

January 12, 2016 · 4 min