You are making stuff up and you know it

First, when addressing a subject, you can’t encompass or address the views of every single person, so I’m going to be addressing the majority (call it a stereotype if you want, I prefer ‘main audience’).  For those that are outliers, that’s what the comment section is for I guess.

Religion is not 100% useless, but I contend that we could get the same plus sides that religious people tout, without the down sides.

The good part of religion is usually touted as follows:

  1. Gives Morals
  2. Gives hope
  3. Gives joy/happiness
  4. Gives eternal life
  5. Makes the world a better place

Lets stop making stuff up.  Religion does not give you morals.  If that was true, I, being an atheist, would have no morals.  Christians often say the bible gives morals.  I hope not, because without going in to it, our world would be severely messed up if all morals came from the bible.  They also often say “Well the crazy stuff is old testament/written by man/not written by god/doesn’t count because I say so/still counts because I like stoning people for no reason”.  When you pick and choose, that is really you admitting that you are making stuff up.  “Part A counts because it makes sense and is in line with today’s moral majority, Part B doesn’t count because it is no longer in line with what society thinks”.  So while I will admit that some morals are influenced by religion, I think it is more that they are influenced by the large group of people you associate with, who happen to be your church, or the same religion as you.  But for the most part, your cultural morals are not derived from religion, they get applied to your religious dogma so that everything is all in sync.

Hope is not solely the domain of religion.  You can give people the will to live without promising them that an invisible person loves them and listens to their every thought and prayer even though all evidence is to the contrary.  What if instead of spreading that message, you focused more on camaraderie and making people know that they can come to another human in times of need and they will get help.  For that matter, (and I’m jumping ahead a little to #5) instead of tithing 10% to the church, why not save that to help out a friend in need.  I think that would actually work better than making up stuff about a fake entity that always cares and has people’s best interests at heart (until he kills them based on his will).

Joy/happiness goes along with #2, but I’ll just quickly point out you can get joy and happiness from a lot of things other than religion.  Booze is one that comes to mind.  No that is not the best example, but not a single person out there can honestly say “I’ve gotten drunk and never had a great time”.  Friends, money, helping others, etc.  All these things make me happy without religious overtones.

Religion gives eternal life.  Hmmm.  I’m going to call this one a no contest because until you can show me one ounce of proof that religion gives eternal life, then I don’t need to refute it.  Or we can play that game and I’ll make stuff up too.  Farting in the car with the windows up gives everyone in the car eternal life, try it on your next road trip.

I think if you balance everything out, religion definitely does not make the world a better place.  Religion is prone to corruption, brainwashing, violence, and suppression.  It also ‘helps’ the world by forcing itself on others through missionary work.  Here are a few examples of religion helping people: Priests getting in a position of trust and then molesting small children, then having his superiors just move him to another area so he can do it again.  Religious wars such as the Crusades, the 30 years war, religious based terrorists attacks, etc.  Televangelists, who don’t have to report income because they run ‘churches’, living like millionaires.  Making women subservient and lower class than men.  And so on.

If everyone who donated 10% of their money to a church, and at least 1 hour a week to attending church service, would put that money and time effort into helping society, I think we would achieve a much greater sense of ‘helping the world’ than religion does.

Math applies to life

My last post made me decide to go back to my drafts and either delete or post all of them.  This is the only one close enough for me to finish.

Remember how you took math in school and said “When will I ever use this in my real life, especially since we have calculators?”  I’m pretty sure everyone said that at least once.  Some people said it in 5th grade when they were learning fractions because they wanted to be a writer.  Some people said it in high school geometry because they wanted to be a lawyer.  Some people said it in college linear algebra because they wanted to be a webmaster.  Some people said it in Calc-based Physics 1&2 because they hated that class and almost failed it and thought doing UT online homework was the worst way to be taught physics.  That last one was me and I stand by that assessment.

Well I have been traveling for work quite a bit lately and realized that even 5th grade math applies to life, and it helps keep you from being a douchebag.

If you have flown Southwest airlies in the past few months you realize that they started lining people up by group letter, and then sub-grouping by number.  Lets say you are A10, then you go to line up when he says “A’s line up” and then you look at the big poles that say “1 through 5 to the left” and “6 through 10 to the right”.  Well at least that’s what they say to me, some people don’t under stand the symbols:
<– 1-5   6-10 –>
But assuming you made it that far because you don’t only read roman numerals, then you have a big math decision coming up.  “My ticket is #8 and no one is in the 6-10 grouping yet, where do I stand?”  This is where math applies to your life.  Lets take a space that needs to hold 5 people, and divide it up in our mind so that it can (fractions, be careful).  Yep, thats 5 slots.  Now take those slots and number them from 6-10. 6,7,8,9,10.  Now, lets see which one of those numbers matches our number.  Yep, its #8.  Now lets step in to that slot.  Wow, so what we have just done is roughly put ourself in the middle so that 6 and 7 can stand in front and 9 and 10 can stand behind.

Now lets replay this situation as someone who doesn’t know math.  “My ticket is #10 and no one is standing in the 6-10 grouping yet, where do I stand?”  “Let’s make a big math decis… Fuck it, I’m an important douchebag, let me stand at the front.”

See the difference?  Now I’m an easy going person so I (being #6) will just stand behind Mr. Darrell Bag. because it’s not that important to me to be 6th in line instead of 7th, but if everyone in line was either related to Mr. D. Bag, or got pissed off easily, Southwest would have a brawl on their hands.

So what is the point of this story?  Math applies to life, and being a douchebag means you get to ignore it.  So the next time your Math teacher asks you “What is the cotangent of the given angle?”  Just say “The cotangent is ‘Fuck it I’m an important douchebag and I don’t need to know that ever’”  They will pass you, I promise, my sister is a Math teacher and she told me.

Time Management skills

I have horrible time management skills.  You can ask anyone that knows me (esp. my wife).  I’m trying to figure out the root cause of this, and I think it actually goes beyond just managing my time.

Let’s take for instance theath.  That mofo somehow writes 3 blog entries a week.  I, on the other hand, just saw that my last one was more than a month ago.  However, that’s not really true.  I have probably written 5 or so entries in the mean time, I just don’t ever finish them, then shutdown my computer and lose them (or they are chilling in my drafts folder).  By the time I get back around to finishing it, it’s either not relevant or I’ve changed my mind.

Maybe I can chalk this up to being lazy, or the fact that 1 person reads this blog so my priorities put blogging right below getting a haircut (which I haven’t had in about a month because I can’t find the time).  But I’m pretty sure the real reason is 2 fold.

1)I work too much.  That’s a fact, and obviously contributes to my bad hygiene and low blog post count.  I put work very high in my priority list (probably too high).  I don’t like to see things go undone, and working with people that put work at a lower priority means a lot of things don’t get done.  So I work until they are done.  Then I look up and see it’s 2am and I haven’t eaten dinner and I have to be up at 6:30am.  Then I’m mad at myself, but I’m digressing.

2)I multi-task too much.  I try to keep so much stuff in my brain that I forget about 80% of things not related to my focus (btw I just had to save this draft and go help a guy set up LiveMeeting and Tomcat, but I’m back now).  So this means that in a given day I will have 100 planned tasks ordered by priority, but at any given free moment when I’m trying to decide the next thing to do, I can only think of 20 of them, so I pick the highest priority out of those 20.

I don’t think I really had a point to this story except maybe that I think I have trained my brain to specialize in context switching, and in doing that I have lost the ability to remember things.  All 100 items are in my brain and they all have their context with them, but I only have pointers to 20 of them.  I wonder if I can retrain it, or if I need to change occupations first.

Well, since I made it to the end of this blog I guess this story will actually get posted.

GWT + Extjs + Eclipse + Cypal = Error

For anyone following the tutorial found here, and getting this handy error:

[ERROR] Failure to load module ‘foo.bar.Bar’
java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.CompilationResult.getErrors()[Lorg/
eclipse/jdt/core/compiler/IProblem;

I get this error whenever I add the nocache.js to the html page.

I have a solution.  Go in to your project properties and remove unused libraries (especially any that refer to Tomcat). Project -> Properties -> Java Build Path -> Libraries tab -> Remove

I removed Apache Tomact 5.5 Server Runtime and I removed the EAR libraries.  Tada, all fixed.  Here are my versions:

Eclipse 3.3.2, Ubuntu 7.10, Java 1.6, GWT 1.4.62, ext 2.0.2, Cypal RC4

Hope this helps.

p.s. these technologies are pretty neat, you should at least check them out.

Dear Google, smarter plz

I say google because it happens to be the only search engine I use.  I guess this applies to all of them, if for some weird reason you use yahoo or ask or msn.

When I search for something like “java spring static method”, often times google will return results from mailing lists or blogs or similar things that have multiple unrelated blurbs on one page.

For example, perhaps a single web page shows the 3 most recent blogs on it.  Blog 1 is about java threading, blog 2 is about spring coil matresses and static cling, and blog 3 is about the scientific method.  Apparently it’s terrbear.org’s blog, thus the non sequitur.

Google returns me this page proudly saying “I have matched all of your words, I’m a super genious”.  I follow up with “Son of a B, I’ll never find an example of how to use java’s spring framework to call a static setter method for dependency injection!”  Solution?  There are several.

  1. The owner of the web page could tell search engines not to index his home page, just index his pages that show blog’s individually.  This is putting a lot of responsibility in terrbear’s hands.  I don’t think he’ll do it, and even if he takes the time to figure out how to give the search engines these hints, no rules says they will all follow it.
  2. Search engines could develop more sophisticated semantic parsing to realize that although these words are on the same page, they are really discussing 3 different topics.  That would be great but I would prefer a solution that is more in the range of my lifetime.
  3. Semantic web.  Digg is doing itYahoo is parsing it.  It is basically using a standard called RDF to give your html a semantic context, like subject, object, predicate.  From there you can turn a simple post into something more meaningful to search engines (any software really) so that google no longer thinks static cling has anything to do with dependency injection.

Not that I think any of these things are around the corner, but I think #3 has the most potential.  Not only does it make it easier to maintain (automatically generate or annotate your posts with RDFa) but it has a wider range of uses.  Not only would search engines use it, your browser could use it to show relevant bookmarks, google could use it to give more relevant ads, skynet could teach itself from the internet, etc.

Memcached vs. Ehcache (for Java)

First, lets look at simplicity to get up and running.  I’ll assume you already have a java environment up and running using an IDE or text editor of your choice (eclipse plus viPlugin ftw) because you are a java developer and you need that.  I’m also assuming you are starting out wanting to test both and have no idea other than heard from a friend of a friend:

Memcached steps (takes about 10 minutes or less depending on your internet connection):

  • google memcached
  • sudo apt-get install memcached; sudo /etc/init.d/memcached start
  • google memcached java, download java client, read howTo
  • add jar to classpath, copy paste client code example, modify for your needs
  • build, run

Ehcache steps (takes from 10 minutes to 4 hours depending on your project and java framework skillz):

  • google ehcache
  • download,  tar -xzf, add jars to classpath, or join 20th century, use your dep management software to add ehcache to your project (maven: add this group/artifactid/version to your project’s pom file)
  • google ehcache example, realize you should use spring, google ehcache spring example
  • get spring (or add it to your pom, hint google maven2 spring) and make your project use it, or realize you already have spring in your project and rejoice that you made a good decision.
  • copy and modify ehcache example, realize that the example shows you how to use ehcache and to easily use AOP to cache any method call, yell “JACKPOT”.
  • build, run, realize ehcache is using a ‘failsafe’ config which doesn’t sound good, but works for testing
  • see the ehcahe.xml in your exploded tar.gz, modify it and add it to the classpath cause you like things running without warnings

Winner: memcached. Unless you already know maven and spring and have them running in your project, you are looking at a significant time and/or learning curve to get these things set up (although both are optional).  Memcached was super easy, a junior dev could add it to the project.  Ehcache was not too hard, but you wouldn’t want a junior dev adding spring and maven to your project.

Next lets look at performance and features.  Remember we are using java, so we have a couple of things to think about.  First, our JVM will run out of memory so we have to have a caching solution that can use secondary storage outside of the JVM.  Second, we are using caching more sophisticated than in memory maps, so our project may eventually need to be clustered/distributed for scaling, so our cache must do that too.  Next, It would be nice to be able to do extra fancy stuff like expire things, monitor the lifecycle of cached objects, and monitor cache effectiveness based on hits and misses. Finally, the whole point of a cache is to speed things up, our cache needs to be speedy.

Memcached:

  • Only uses secondary storage.  Runs more like client/server so, never uses JVM memory, always goes over an HTTP connection (more on that later).
  • Because its client/server, it scales very easily, it also is very simple to configure multiple servers for failover, distributed load, etc.  Its actually as easy as staring it on another machine and adding that machine to your client config.
  • Memcached may or may not do some fancy things, but all our client can do is basic put, get, remove, clear, and get a map of stats.
  • Remember how memcached is client/server?  That adds overhead for serialization and your transport protocol.  This makes it slower.  Some say as slow as querying mysql

Ehcache:

  • Uses JVM memory, then overflows to secondary storage based on config.  configurable out the wazzoo for how it handles that.
  • Scaling through distributed caches and replication has been added for several versions now.  Its not as straight forward to set up (read: lots of xml editing and documentation), but can automatically find new nodes in the cluster through multicast, etc.
  • The E H in Ehcache stands for Extremely <something that starts with H and means feature rich>.  It can set expiry time based on last accessed, evict based on policies (LRU, FIFO, custom), register listeners for tracking objects’ lifecycle through the cache, and gives tons of metrics for effectiveness like # of hits each object gets.  It even has a way for monitoring remote caches.  But all of these features come with a configuration cost and headache.
  • Because it uses jvm memory, objects don’t have to be serialized, which means its very fast.  Overflow to secondary (disk) storage can be asynchronously batched so the hit is negligible.

Winner: Ehcache.  Ehache easily wins this category.  we aren’t talking about ease of use, we are talking about pure abilities.  Its faster and more feature rich.

So its a tie.  Awesome.  Everyone loves a competition that ends in a tie.  But that isn’t really the case.  Depending on your application, there is a clear winner.  If you need something that is easy to set up and use, will give you performance increase and scalability without hassle, and will probably wash your dishes, go with memcached.  If performance is of utmost importance and you have complex caching needs that go beyond get/put, and especially if you are already using spring, and possibly hibernate’s 2nd level cache, you need to use Ehcache.  However, to keep this post from totally copping out at the end, I will go so far as to say this: Someone with experience using ehcache will be able to overcome any slight disadvantage it has because of complexity and configuration.  Its like riding a bicycle, once you can start and turn left, turning right isn’t hard, you just change things a little.

Therefore…..

OVERALL WINNER: Ehache.  Hire smart, experienced devs, give them a decent timeline and let them use the better Java caching solution.

Note: RoR fanboys, please don’t cry.  This post is talking about JAVA caching.  Rails doesn’t have Ehcache.  Use memcached and rails and get your website up in 28 minutes, that’s fine with me.

Sustainable Pace (Tortoise and the Hare style)

This isn’t something new I just made up, and it applies almost everywhere,  but for some reason people all too often think it doesn’t apply it to software development.  Let’s look at 3 different projects, one using a paradigm of sustainable pace (SP), and one using a naive approach we will call frantic pace (FP), and one using an uber-conservative approach we will call granny pace (GP).

Beginning of Project:

SP: Make a realistic project plan with estimates based on past performance, or padded by a reasonable factor if this is our first go round.  We base it off of current resources, or if we are planning on adding new resources for this project, we count them as less than 75% based on their skill/experience level for a ramp up period.  If this estimate comes out to longer than the client/business expects, we eliminate features or potentially add a few more resources if the project type and funding exists accordingly.  Come up with a date of X.

FP:  Make a project plan expecting 100% output or 100%+ (nights, weekends) of all resources, including expected future hires.  Shorten testing time and assume somehow this pace will produce fewer bugs “because it just has to, we have to meet the deadline no matter what”.  Eliminate little to no features because this project needs to be the biggest and best immediately.  Come up with a date of X/2.

GP: Make a project plan that adds an arbitrary and large factor of time to every step.  Plan a waterfall approach that eliminates all shorter iterations of requirements -> coding -> testing -> user acceptance.  Assume no resource can be productive more than 75% of the time.  Come up with a date of 2X.

Middle of Project:

SP: Things are going fairly smoothly.  A few dates on tasks or milestones have been missed, but others have come ahead of schedule and you are overall on track.  Developers have frequent deliverables so they are not procrastinating, but the timelines are reasonable so they are developing good code and refactoring as necessary.  Testing has just enough time to be thorough and because the devs aren’t rushed, less bugs are found in the first place.  A few features may even be complete.

FP: Because of the approaching deadlines, sales and marketing guys are already starting to plan their demo’s and need screenshots and customer specific data set up.  Anything that is not far enough along WILL be embellished during presentations, setting customer expectation too high.  Code is sloppy as devs struggle to meet deadlines at any costs in quality.  Testing is too short and bugs are missed, if happy path works, we move on.  Functionaly, the product may seem to work, but just wait until later.  Devs are getting tired, sick, and grumpy because they are working crazy hours.  Everyone is putting pressure on anyone below them.  Nobody is happy.

GP: Something has finally made it to a point where the end user gets to see it.  At this point the company direction may have changed and that feature is no longer needed/relevant.  Best case scenario is that no requirements have changed, even though maybe they should have,  and you have a product that is on schedule.  Devs are used to the lax timelines so they slack off and rush something out at the end.  Testing finds errors and they redo it, still hitting deadlines.  The code gets bloated and is overall of below-average quality.

End of Project:

SP: The product comes out pretty close to on time.  Any differences in estimated and actual timing are noted and used for input into the next project.  The features may not all be there, but we have something ready for market that is still viable.  It will allow us to have another iteration of this product if its warranted.  You are able to deliver 1 full working release of the product in X time.  By 2X you have the 2nd version out with added functionality and increased customer base.

FP: The happy path is the only thing that works.  You have missed all deadlines.  Any significant load brings the application down or to a halt.  Unexpected results in testing are still getting last second patches and bandaids by the dev team.  Your best developer(s) has quit because he got burned out.  There goes all the domain knowledge because no documentation was able to be made.  You are so late your first version took twice as long as planned and releases in X time anyway.  Out of your potential customer base, only a fraction buy the product because it is not what the salesmen described.  The customers unfortunate enough to get stuck with it hate it for the lack of performance and stability.  Your company has run out of money or will run out of money if leadership isn’t changed.  To get the product to an actual usable state takes another release and major refactoring.  By 2X you have a simple but mostly working product.

GP: The product comes out on time.  It cost you a lot of money, and therefore costs a lot of money to buy.  The marketplace may not really even want it anymore, and someone has put out something better for cheaper.  You delivered a non-cutting-edge product with a huge budget in 2X.  You are ready for the second version to try and catch up to the current market, that will take until 4X.

While this was a bit of a contrived example, most people can relate to at lesat one of those scenarios.  From this we can see several conclusions.  With SP your software will come out close to on time, and actually closer and closer with each new iteration.  No one is burned out, and projects can continue at this exact pace, allowing the process to get more refined and accurate.  SP requires intelligent developers who are commited to not taking shortcuts.  Any slackers will be easy to spot and need to be corrected or fired quickly.  Sub-par performance can’t be accepted.  With FP you promise too much, fail often, waste a lot of money, and burn out any developer you would want to keep.  Bad people stay and multiply because 1 crappy person with minimal domain knowledge is better than 0 on a project with looming deadlines.  The code will never be good quality.  With GP unskilled workers can thrive and blend in.  The project may be ‘on time’ but in this day and age, the product will miss its timing in the marketplace.  At best, you will always be a step behind.

sweet, scientology

I bet scientology is cool until they ask you to sign a billion year contract, tell you about Xenu, and make you pay $30K to tell all your dark secrets while holding an ohmmeter so they can blackmail you.  But up until then, I bet its awesome.

That being said, I bet you could say something similarly sarcastic about any religion, take catholocism for example:

I bet catholocism is cool until they ask you to pledge yourself for all eternity, tell you about a 3-in-1 invisible person whose blood and body you eat each week, and make you pay 10% of your salary to tell all your dark secrets to a guy who may try and molest you.  But at least they help people by forcing their ideas upon everyone without proof.

Maybe this means that christians shouldn’t talk badly about scientologists unless all they have to say is “Hi Kettle, you are black.”