Mar 19 2012

Retweet February 2012

From time to time I just blast tweets about software development, project planning, team dynamics, or whatever else comes to mind. Here is a synopsis of recent tweets and rants. If you want to follow the conversation follow me at techknow and/or juixe.

Software Development

  • Kids lunch snacks sound like Java interfaces, Uncrustables and Lunchables.
  • 99% of software is hardcoded defaults.
  • Software will shape the future.
  • I don’t count lines of code.
  • Code less, debug even less.
  • Every few years JavaScript goes through a renewed renaissance.
  • Sometimes life does not compute. #dividebyzeroerror

Team Leadership

  • Success is a dish best served with champagne.
  • Don’t let circumstance beyond your control control you.
  • Just because it’s widely accepted that Steve Jobs was difficult to work with and a genius doesnt mean you have to be difficult to work with.
  • Negativity is like cholesterol, to much of it can kill you.
  • Most important lesson in my life: Learn to appreciate what you have and do not agonize about what you don’t.
  • Corporate titles mean nothing, that is why I put Chief Creative Business Developer Principal Program Scientist on my business card.
  • The biggest lesson one can learn is to listen.
  • The universe doesn’t hate you, it doesn’t even know you exist.
  • Try harder. Do better. Go further. Think Bigger.
  • Forget stopping to smell the flowers, I stop to reach for the stars.

Product Placement

  • I’m going to start a search engine for ego searches and call it egoogle.
  • Google is a giant keyword router in the cloud.
  • Android uses food related codenames for its different versions, such as ice cream sandwhich. I hear next release will be named leftovers.
  • Why is Gingerbread still the most popular/common version of Android In new phones? It’s like two releases behind latest version.
  • I think it is safe to say that G+ is a successful flop. I would compare it more to MySpace than Facebook.
  • Missing Feature: I wouldn’t be surprised if the Kindle reader would allow you to tweet a quote right from an eBook.
  • If Apple would design single family homes it would cost over $1 million and only be 800 sq/ft but I would want one really bad.
  • iPhone or iMole: whatever data or contact or image you have on your iPhone some hacker, service, API, law enforcement, or app will access.
  • In today’s day and age, no person should be executed for tweeting and no person should have to go to jail for downloading a song.
  • Blue Ivy Carter sounds more like a brand name of vodka or energy drink put out by Jay-Z than the name of his kid.

Cash Angels

  • Who needs $3 million to run a WordPress-powered tech blog? At these valuations my blog is definitely worth $10 million.
  • Silicon Valley entrepreneurs are modern day alchemists turning virtual goods into real cold hard cash, IPOs into billions.
  • A frothy market is a tasty market.
  • The future is in crowd financing.
  • It’s raining stock options in Silicon Valley. #makeitrain
  • All the people of Palo Alto rejoice at news of Facebook IPO, in a few months their rents will go up 30%.
  • To much Facebook IPO analysis on my feed. If you aren’t a preferred investor you ain’t making money.
  • 1. _________. 2. $#%#%$*(&. 3. ?????? 4. Profit.

Question

  • Can software refactor the world?
  • How can people wave their constitutional rights be agreeing to a terms of service they didn’t read or understand?
  • Breyer’s or Dreyer’s?
  • Who will be the Bill Gates and Steve Jobs of 3D printing?
  • Forget “where’s the beef,” where’s the 100 Mbps broadband?
  • Who is Waldo?
  • If corporations are people does it mean a man can marry a corporation?

Equations

  • Principles > Politics
  • Generous > Gorgeous
  • Cheddar > Chatter
  • Worrier < Warrior
  • Sex On Fire > Heart On Fire

Jan 18 2012

Create Universally Unique ID in Java

For the longest time I’ve used java.rmi.server.UID to create a unique ID in a application. We enhanced the UID class to fit our needs and to format the ID to the standard format but unfortunately we found that within a process, we were generating duplicate IDs if we created more than a certain amount. It didn’t take much to remedy the problem since Java introduced java.util.UUID in Java 1.5.

To create a universally unique ID in Java 1.5 or greater just call the static randomUUID method on the UUID class.

UUID.randomUUID().toString()

UUID has a wider range of possible values that I’m not concern of duplicate values or collisions for my application.


Jan 3 2012

Year In Review 2011

It is that time of year where we reflect on the accomplishments of the passing year and look forward to the one to come. Here is a window into the past year in technology through this year’s popular posts on TechKnow Juixe.

Code and Design

Reviews and Rants

Retweet 2011

Year in Review


Oct 30 2011

Retweet September 2011

From time to time I just blast tweets about software development, project planning, team dynamics, or whatever else comes to mind. Here is a synopsis of recent tweets and rants. If you want to follow the conversation follow me at techknow and/or juixe.

Software Development

  • Code. Money. Respect.
  • Software bugs don’t take anything personally.
  • Code more, sleep less.
  • DONT THREAD ON ME

Thought Leadership

  • Just having a goal is often times more important than the goal itself.
  • Word programming, i.e. writing TPS reports.
  • Code Complete = Tests + Implementation.

Product Placement

  • Google is the casino, or better yet the Goldman Sachs, of online identity, ads, and search. You don’t bet against the house.
  • What is cloud-accelerated web browser? Learning about Amazon Silk, the web browser in Amazon’s Kindle Fire.
  • The project code name for the iPhone’s auto correct is auto cucumber.
  • Spike TV should rename itself to Star Wars TV and the History Channel to Ancient Aliens Channel.

Money Angels

  • Dr Evil is starting a venture fund.
  • If Dr. Evil would have taken his Evil Corp. Public he would have made $1 billion on an IPO. And maybe Google would have bought his company.

Question

  • How many uses can you think of for a paper clip?
  • Where in the food pyramid is candy corn?
  • Is Meg Whitman the new Carol Bartz?
  • Are you changing the world or is the world changing you?
  • What is the person equivalent to having your car lifted up in the air and balancing its tires?

Randumb

  • The Internet made me do it.
  • It’s easy to earn money while you sleep, if you sleep on the job.
  • You are more likely to die due to medical error than a car accident. So if you are in a car accident, don’t go to the hospital, just walk it off.
  • If I could get a nickel every time someone gives me their two cents I would arbitrage people’s opinions.
  • Living the Internet lifestyle.
  • If you don’t want your naked picture hacked from your phone don’t take naked picture of yourself on your phone.
  • There are proposed bills that will make activities such as posting a lip sync video on YouTube a federal crime punishable with jail time.
  • Forget the war on drugs, in the future there will be a war on content.
  • History is not made, it is written, edited, scripted, and appropriated by Hollywood as a blockbuster movie about mutant super heroes.
  • I predict the past.
  • Beauty is in the eye of the beholder, behold yourself.
  • This is not Sparta!
  • Love me, hate me, but you thinking of me.
  • Love it or hate it, take it or leave it.
  • I love love and hate hate.

Overheard

  • OH: When you frown you look like a Klingon.
  • OH: Is everyone in the call on mute?
  • OH: My dress code is to try not to show my butt cheeks.

In Da Future

  • In the future, everyone will be a product guy.
  • In the future, Facebook will be your permanent record.
  • In the future, the revolution will start with a single tweet.
  • In the future, when people say they are going outside the grid, they will mean they aren’t logged into Facebook.
  • In the future, Android developers will need to program using the Android SDK and the phone maker’s proprietary SDK, and the carriers’s SDK.

Million Idea

  • Million Dollar Idea: A treadmill with a weight scale.
  • Million Dollar idea: there is so much artificial flavoring, color, and seasoning in food. Patent dinosaur meat flavoring.
  • Million Dollar Idea: Car alarm system that steams video of the surroundings of your car and scans for perps faces.
  • Million Dollar idea: wasabi guacamole
  • Million Dollar Idea: Carfax for people, including driving record, background check, work history, etc.
  • Million Dollar idea: pepperoni pizza flavored breath mints.

Oct 19 2011

Fix Common Java Exceptions

ClassCastException – The most common reason for getting a ClassCastException is because the code in question is accessing an object from a List or Map and casting to an particular class, but the List or Map may have different types of classes. If you are not using generics and allow your List to contain any Object, instead of a specific class type, you’ll get a ClassCastException when you force a cast to one type but the object doesn’t descend from that class. A common fix is use Java generics or to check the type of a class before you force the case using the instanceof operator.

InvalidClassVersion – I’ve seen this exception often when working in a client-server environment. This exception is throw when you have two version of the same class in an environment. For example, maybe you made a large change and recompiled a particular class but only updated the server, the client still has a copy of an much older copy of the class. If objects of this class are serialized and shared between the client and the server you’ll an InvalidClassVersion exception. If a server sends a instance of a class to the client, the client who has an older copy of the class, will throw an InvalidClassVersion error because it’s version of the class may not have the newer methods, method signatures, fields, etc. The client version of the class is simply not compatible with the one in the server. To fix this, make sure that same version of any class is always used.

UnsupportedClassVersionError (Unsupported major.minor version 49.0) – This can happen when you compile an application in a higher version of Java then the version of the Java Virtual Machine in which you run the application. For example, if you compile your application for Java 6 but run the application using Java 1.4.2 you will get an UnsupportedClassVersionError.

NoSuchFieldException – A friend from school just sent me a message as to how to fix a NoSuchFieldException. I thought, just double check the library version, that JavaDocs, the source code, and anything else you can to verify that the field does exist in the class. This exception is thrown because he might be using reflection or some dynamic scripting language such as Groovy or JRuby and has misspelled the name of the field he is trying to invoke. The fix is to double check the API.

NoSuchMethodException – This exception is similar to NoSuchFieldException. You’ll see this exception when working with a dynamic language or when using reflection. When you use Java in a dynamic fashion, such as with Groovy or Java reflection, you don’t get the benefits of static compiled language features. You’ll get errors like NoSuchMethodException at run time instead of catching the error at compile time. It is often caused because you mistyped the name of a function that you want to use.

ClassNotFoundException – This exception can happen because you trying to run a class that references another class that is not in the classpath. Check the classpath and make sure that you have the classes and jars you need for you application to run. ClassNotFoundException often happens when you use third party libraries than themselves require other libraries or jars that you are unaware of.

NullPointerException – A typical Java NullPointerExeption is generally easy to fix with a stack trace of the exception. There is only one case where it is difficult to spot the source of a NullPointerException. The only NullPointerException that will have you baffled is those caused by auto-boxing, such as when you auto-box an Integer object to a primitive int variable. If the Integer object is null and you auto-box it to a primitive int when passing the object to a method whose parameter is an int, you’ll get NullPointerException. But if you look at the line where the exception is thrown, you’ll see that it takes an int and int primitives don’t throw exceptions, so you’ll be scratching your head in confusion until you realize that the calling method used an null value Integer object.


Oct 18 2011

Common Causes for Memory Leaks

You’ll always have to deal with memory issues, no matter the programming language. Even with the Java programming language, if the right precautions are not taken, you will have some sort of memory leaks, memory issue, out of memory exception, or heap size problem. I’ve seen two common types of memory issues in every application I’ve worked on.

A common source of memory leaks is global static singleton god object that collects or manages a lot of data, maybe a system cache, object lookup table, service locator, etc. This type of singleton pattern will require other objects to register with it, add themselves to the global pool of objects, but if they are not properly removed, unregistered, when they are no longer needed you will see your memory usage increase over time. I’ve seen this issue when using the callback or listener pattern and the listener object itself holds a lot of other data. This sort of problem is usually relatively easy to identify with a profiler, it will usually be one of the largest objects in your system.

The other, more difficult memory leak to identify, is when you have hundreds of thousands of objects each taking up a reasonable amount of memory. In this case, a single object instance will not take a lot of memory but collectedly the hundreds of thousands of objects can eat up a lot of memory. Here are a few things you can think about when dealing with a small class that spawns thousand of objects…

If you have int types, see if you can change them to short or byte types. Try subclassing if you have any number of properties that most often than not set or are null. Think about lazy loading arrays, lists, and other objects references. If there are many object instances of this class, and any portion of these instances are logically equivalent, think of using the flyweight pattern.