Blog
Thoughts on programming, systems, robotics, and everything in between, sharing what I learn and build.

Install Mac OS X Yosemite using Clover
Clover is a new and exciting open source EFI bootloader. Developed over the past 3 years by a group of developers at Project OS X led by Slice, Clover aims to solve problems inherent in existing OS X installation methods and legacy bootloaders: Boots troublesome desktop and laptop BIOS/UEFI Uses native OS X installation media Ability to patch DSDT/kernel/kexts at boot time Creates OS X Recovery partition No boot0 error with 4K Advanced Format drives Solves multi-boot issues with Linux and Windows 7/8 Solves traditional bootloader NVRAM issues related to iMessage/FaceTime Clover has a completely different system of configuration with a decidedly steep learning curve. It can be confusing for those who have only ever used the more traditional Chameleon or Chimera.
Java Collections Framework
Almost all collections in Java are derived from the java.util.Collection interface. Collection defines the basic parts of all collections. The interface states the add() and remove() methods for adding to and removing from a collection respectively. Also required is the toArray() method, which converts the collection into a simple array of all the elements in the collection. Finally, the contains() method checks if a specified element is in the collection. The Collection interface is a subinterface of java.lang.Iterable, so any Collection may be the target of a for-each statement. (The Iterable interface provides the iterator() method used by for-each statements.) Additionally, Collection is a generic, so any collection can be written to store any class. For example, a Collection<String> can hold strings, and the elements can be used as strings without any casting required.
Spring AOP Example Using Annotation
Spring Framework is developed on two core concepts – Dependency Injection and Aspect-Oriented Programming (AOP). Today we will look into the core concepts of Aspect-Oriented Programming and how we can implement it using Spring Framework. Note: This post has been updated for Spring Framework 7.0. The original 2014 version targeted Spring 4.1 with AspectJ 1.8 and the aspectjrt + aspectjtools dependencies; it now uses aspectjweaver 1.9.25 on the current Spring 7.0 GA line. Because Spring 7 builds on Jakarta EE, the servlet types in the examples now come from jakarta.servlet.* rather than javax.servlet.*. The AOP concepts and @AspectJ annotations themselves are unchanged.
Consistent Hash Ring
Consistent hashing is a special kind of hashing such that when a hash table is resized and consistent hashing is used, only K/n keys need to be remapped on average, where K is the number of keys, and n is the number of slots. In contrast, in most traditional hash tables, a change in the number of array slots causes nearly all keys to be remapped. Consistent hashing achieves the same goals as Rendezvous hashing (also called HRW Hashing). The two techniques use different algorithms and were devised independently and contemporaneously.
Sending Email with Zend Framework 2 Using Template
Sending a templated HTML email is a one-liner in some frameworks, but Zend Framework 2 ships no such helper, so you have to wire up the view renderer, the MIME message, and the transport yourself. This post walks through that setup. Note: Zend Framework 2 has reached end of life. In 2019 the project moved to the Linux Foundation and was renamed Laminas; the Zend\* classes shown below now live under Laminas\* (e.g. Laminas\Mail, Laminas\View). The technique is unchanged, so this post still applies once you swap the namespaces.
The String Constant Pool
The String Constant Pool is a JVM-wide cache of string literals: when different parts of your code reference a string with the same content, they can share a single String object instead of allocating a new one each time. This is possible only because String is immutable in Java, combined with the String interning mechanism. In other words, the pool is an application of the Flyweight design pattern. String Pool Examples String s1 = "Hello"; String s2 = "Hello"; String s3 = "Hel" + "lo"; String s4 = "Hel" + new String("lo"); String s5 = new String("Hello"); String s6 = s5.intern(); System.out.println(s1 == s2); // true System.out.println(s1 == s3); // true System.out.println(s1 == s4); // false System.out.println(s4 == s5); // false System.out.println(s1 == s6); // true Explanation The references of s1, s2, s3, and s6 all point to the same pooled object, while s4 and s5 do not. Here is why:
The 23 Gang of Three Design Patterns
Design patterns represent the best practices used by experienced object-oriented software developers. Design patterns are solutions to general problems that software developers faced during software development. These solutions were obtained by trial and error by numerous software developers over quite a substantial period of time. This tutorial will take you through step by step approach and examples using Java while learning Design Pattern concepts. Three Types of Design Patterns Design patterns are divided into three fundamental groups: Behavioral Patterns, Creational Patterns, and Structural Patterns.
Difference between Process and Thread
Processes and threads are both units of execution managed by the operating system, and they are easy to mix up. The short version: a process is a running instance of a program with its own memory, while a thread is a lighter-weight unit of execution that lives inside a process and shares that memory with its siblings. This post looks at each in turn, then summarizes how the two differ.