Rondom Thoughts

Random bits of things that pop into my head from time to time:
  • If you can wonder if you're alive you're alive.
  • Every sunset is someone else's sunrise.
  • Hell is this world but without love. (as sappy as that sounds it feels right)
  • I care about people more than I care about what they think (because what they think changes all the time, but who they are tends not to change so much and if it does then they probably don't know who they are either).
  • Music is emotion you can hear; music that you like is emotion you can relate to (in the moment).
  • Music is more important than lyrics.
  • Never think about what you're going to say for so long that the opportunity to say it is lost.
  • Zen tries to convince us all that reality doesn't exist because Zen has no idea what reality is. :)
  • Buddha was a kewl dude - but he was still just a dude.
  • Israel probably wouldn't exist if Christianity wasn't so popular.
  • The need for religion in people may stem from two different motivations - the need of a child for a parent figure and the need for a person to not feel all alone (even when they are).
  • If a Diety is all powerful what does it need angels for? (I hope my friends who feel strongly about religion will let me think my own thoughts without judgment... )
  • "Do unto others as you would have them do unto you" is a universal rule of fairness; to do otherwise is hypocrisy; most parents are hypocrites...
  • Misery is easier alone; comfort is easier with others.
  • Fortune cookies should not be taken seriously - they are as personal as the bowl your rice came in.
Perhaps life is just 1 moment which we're constantly experiencing.

Our life experience (sans certain blank spots of un- or altered- consciousness) is continuous and ever changing, but not randomly so - every experienced-moment (e-m) is a minor variation of the previous e-m. In fact you could define "consciousness" as being aware of the series of e-ms. unconsciousness is certainly a lack of e-ms (from a certain point of view - unconsciousness is mostly relative to the observer - do unconscious people think they're unconscious?) :) altered consciousness is experiencing personal e-ms that seem to be contrary with the shared physical environment (which normally produces similar e-ms for everyone in the same area) - if you're experiencing something no one else around you is experiencing that doesn't make it less "real" - it just makes it unshared and, from a less flexible POV, something "bad", "scary", or "crazy". to each their own...

To deal with this constant flow of e-ms we really only need a context (the first e-m of the day) and a series of changes (diffs) from which we can maintain a personal reality-model. Certainly dealing with a sequence of e-m diffs is easier than dealing with a full snap-shot of reality at any point in time. the diffs do have to be in sequence, tho - otherwise we loose context and have to start with a new "root" e-m from which to build our personal model of reality.

In meditation one goal can be to stop the flow of diffs - to hold the "now" e-m for as long as possible so that we can concentrate on it fully, viewing it either subjectively (from our own POV) or objectively (tho viewing something without any POV at all might be impossible - even out-of-body experiences have a POV - it's just not the in-body POV).

or perhaps in meditation we want to loose the root e-m and release all the diffs since then and reach a context-less point of "nothing" - basically existing out of a time-context - the closest one could be to being alone with one's true self.

Clocks and calendars are tools for us to put our "now" e-m into a time context. Does it really matter that it's November 29th 2009 7:27pm in this timezone? It certainly doesn't change the e-m - only how it relates to the time-context so that it can be placed relative to other elements on the same time-context (both large - calendar, and small - clock).

Thanks for reading - hope you don't feel this was a wasted series of e-ms. :)

Life, in a nutshell.

This was sent to me by my Uncle Walter and was so profound in its way that I wanted to share and keep (nice that one can do both nowadays)... 

 A boat docked in a tiny village. A tourist complimented a local fisherman on the quality of his fish and asked how long it took him to catch them. "Not very long," answered the fisherman.

"But then, why didn't you stay out longer and catch more?" asked the tourist. The fisherman explained that his small catch was sufficient to meet his needs and those of his family.

The tourist asked, "But what do you do with the rest of your time?"

"I sleep late, fish a little, play with my children, and take a nap with my wife. In the evenings I go into the village to see my friends, have a few drinks, play the guitar, sing a few songs..."

The tourist interrupted, "I have an MBA from Harvard and I can help you! You should start by fishing longer every day. You can then sell the extra fish you catch. With the extra revenue, you can buy a bigger boat."

"And after that?" asked the fisherman.

"With the extra money the larger boat will bring, you can buy a second one and a third one and so on until you have an entire fleet of trawlers. Instead of selling your fish to a middle man, you can then negotiate directly with the processing plants and maybe even open your own plant. You can then leave this little village and move to a big city! From there you can direct your huge new enterprise." 

"How long would that take?" asked the fisherman.

"Twenty, perhaps twenty-five years," replied the tourist.

"And after that?"

"After that? Well my friend, that's when it gets really interesting," answered the tourist, laughing. "When your business gets really big, you can start buying and selling stocks and make millions!" 

"Millions? Really? And after that?" asked the fisherman.

"After that you'll be able to retire, live in a tiny village near the coast, sleep late, play with your children, catch a few fish, take a nap with your wife and spend your evenings drinking and enjoying your friends."

And the moral of this story is: Know where you're going in life - you may already be there. :)


Language vs Concepts

Been thinking a lot about ideas (would that make these meta-ideas?). :) Ideas are a mental construct which exists solely in the mind (probably, if you froze time, as a specific orientation of electrical impulses and chemical distribution). These constructs (models) must be stored in some serialized form (it seems unlikely that it's electrical impulses at that point, but it seems only slightly less likely that the brain is orienting chemicals in such a way that when read they reproduce the model) which will remain currently undefined. In order to think about a previously constructed idea the model must be retrieved from storage and brought into the working (conscious) area. (most of these words are approximations of the ideas i'm trying to convey). If an idea is to be shared we must chose and apply a translator (which has been constructed through the process of learning a language) which translates the idea into a series of datum which are then passed to our output channel of choice - typing, speaking, sign-language, tap-dancing, whatever. When a idea contains elements for which the translator doesn't have a mapping we chose (and this choice becomes part of the translator with repetition and reinforcement (via feedback)) an approximation (which must be measurable) for the idea. The measure of this approximation is what is "lost in translation". Some languages have single words for macro-level concepts (a nap taken in the afternoon = "siesta", but in English a "nap" can be at any time so we have to qualify it if we're talking about a particular type of nap whereas other languages have already created mappings for those more macro-level concepts; most of which evolve based on cultural norms and patterns). Question - can a culture contain multiple spoken languages? For instance in Chinese culture there are many languages but in that case have we not over-generalized the word "culture"? How could many languages evolve if there were not many cultures? And what's the finest granularity of a culture? A single household would seem to always have a common language, moral sense, and belief, tho those tend to break down on generational boundaries (when the younger generation must question the morals and beliefs taken as unassailable by the older generation; and i suppose this is with language as well since slang evolves, for the most part, in younger generations who find their concepts of the world don't have one-to-one mappings with the current language they were raised with and thus create new words for these concepts, but is this a new language or just an expanded vocabulary? which i guess raises the question of what is a language? alphabet; grammatical structure; sequencing and translation rules for words to add concepts of tense, gender, cardinality (singular vs plural), and so forth; vocabulary? is a language which is a near super-set of another language the same language? but i digress... so the idea is mapped through a translator to a series of impulses which are then sent through an output stream to some external device. the receiver (if any) of this series of impulses (if we assume the output device properly translated the impulses - we didn't mispronounce or misspell a word so badly that the receiver can't recover the original impulse) is then translated into impulses in the receiver which goes through their own language-specific translator (which was developed entirely within the context of their own experiences with that language) into a stream of ideas in their conscious working space. and what are the odds that the collection of ideas in the receiver are identical to the collection of ideas in the transmitter? if you're talking about two humans which were not raised in nearly-identical cultures at nearly-identical times and the ideas are not wholly mapped into the cultural model for ideas i would say the chances are quite slim that they are identical. that is not to say they are not very similar (as they must be in most cases since, for the most part, humans are able to successfully communicate about a great many things). but when a concept is novel is must be related in terms of existing accepted concepts between transmitter and receiver and via discussion and conversation the two exchange the concept repeatedly, providing the feedback needed to train the translator (tho we seem to generate different translators for different receivers - explaining programming to a computer-using adult is (typically) easier than explaining it to a child, for whom you must choose different mappings for the same concept even tho you're talking to each in the same spoken language. when the receiver is a computer the translation must be exact because the computer is not allowed to have a translator which allows for generalization (if i tell the computer that "x = x + 3" it is not allowed to generalize that into any other result but that the value of x afterwards is 3 greater than the value before. and it is because of this constant need for exact communication with computers that programmers are, typically, rather exacting in their communication in general. the same is more or less true (tho perhaps for different reasons) for other types of engineers - being precise in communication is vital for bridges to not fall down, electrical circuits to not burst into flames, and x-ray machines to not cook the patient they are imaging. unfortunately it tends to drive the rest of the population to frustration since they tend to (seem to) prefer the more vague and abstract way of communicating full of opinions and feelings and other such unquantifiable variables. and what is the point of all this rambling? i have no idea; but i'm not about to waste the time i spent writing it without wasting the times of others who happen to chose to read it. :)


yesterday Laura and i watched "Julie and Julia" and it reminded me of this blog. lots of things have happened since 2008; much of it sad, most of it good. about 3 years ago my life as a married person ended; about 7 months ago my life a single person ended. about 3 years ago also i started riding motorcycles; and about 1 month ago i had my 3rd accident and have since started driving my truck regularly again. about 4 months ago i started rock-climbing; see aforementioned motorcycle accident as to why i haven't been "back on the wall" in a month. :-/ still working at the same company; still working on much the same systems; not working with many of the same people - funny thing when you work in tech for 8 years at the same place (18 years overall so far) - faces change but the story remains more or less the same - everything's fine, we're growing, set-backs were expected, now we're leaner so we can go faster, now we're growing, soon we'll be profitable, etc. light bright lights eventually this all becomes ignorable background. life goes on. :) so now that i'm back to this blog thing what to write about? what matters in this life that ANYBODY who doesn't know me (i.e., is a FaceBook friend) would care to waste time reading. honestly i have no idea...


OutOfMemoryErrors and ObjectOutputStream

Ran into an interesting problem today - turns out if you use an ObjectOutputStream to write out lots of data the data doesn't go away after OOS.write() returns - instead it gets cached in a handles map within the OOS itself so that should it be told to write that object instance again it can instead write a handle reference (thus saving on space in the stream and avoiding circular references). Kewl, huh? Well, not entirely...

The downside to this approach is that if you're writing LOTS of objects (say 250,000) then even tho you've designed your code to avoid holding all those objects in memory every one of them will be held in memory until you finish with the OOS entirely because of that handle cache! (This explains why my simple little app eats up over 2GB of RAM even tho it's supposed to be processing data objects one object at a time). The fix?

Two came up and I'm not 100% certain which is better all the time so I'll discuss them both (in the order in which I thought of them). :)

Solution #1 - Unshared Externalizable/Serializable

There's a new interface in town, java.io.Externalizable, which is the cousin of java.io.Serializable, but with a few new quirks:

  1. First, unlike Serializable, Externalizable has methods (imagine that! methods in an interface!) - readExternal(ObjectInput) and writeExternal(ObjectOutput), typically the args are Object(Input|Output)Streams, which implement Object(Input|Output).

  2. The second (and rather weird) quirk is that your Externalizable object must have a PUBLIC no-arg constructor. Now, considering that the ctor is gotten via reflection I'm a little puzzled why it has to be public but... whatever.

So first you make your DAO implement Externalizable rather than Serializable (which is a parent of Externalizable) and then you replace all your ObjectOutputStream.writeObject() calls with writeUnshared() (and on the read side OIS.readUnshared()) which tells the streams to just ignore that whole handle map thing.

Now you might think just making your DAO unshared is enough but NO! (unless your DAO is the data itself, which is nearly impossible since all DAOs are, at some level, composed of primitives, primitive-wrappers, arrays or collections of primitive/primitive-wrappers). So while your DAO might be unshared (not cached) its parts are probably shared (cached). That's why you have to implement Externalizable or Serializable - after a bit of testing i'd just go with Serializable - no funky public ctor and no casting of ObjectInput to ObjectInputStream and so forth. Six of one, half a baker's dozen of the other... :)

Solution #2 - ObjectOutputStream with amnesia

There is a method on OOS called reset() which clears the handle cache and reduces memory use to nearly nothing (other than what you were using without the OOS). It also injects a TC_RESET marker into the output stream which, in my DAO's case, increased the output file size by 50% (e.g., what was a 4.9M file became a 7.2M file). basically if you look in the serialized file you will see your DAO's and component fields' class names between every single instance (normally they're declared once at the top). So if size of your serialized data is an issue this might not be a great fix. But if RAM usage is a concern this approach is huge - my app which used to max out at over 400M (in testing) with regular serialization dropped to 100M with unshared but then dropped all the way to less than 1M java heap with reset() between each writeUnshared() (hard to say exactly 'cause there were so few Full-GCs but i'd guess it was about 400-500K). THAT's amazing (to me).

Performance Impact

Didn't see any performance impact in calling reset() between each writeUnshard(); in fact i'd say the reset() version works faster because it avoids all those Full-GCs.

Hope this helps folks as much as learning it helped me. :)


Home Alone - and what it taught me

today was the last day of the first stretch of family-free time i've had since, well, since i started my own family back in '98. granted, kid #1 didn't arrive until 2001, so it's fair to say that was the last time the house was empty for more than a few hours. but on Thursday my wife and 2 kids went to visit her relatives and i chose, despite the points it cost me, to stay behind. and i must say it was worth it.

Day 0 (Thursday, 8/14/08)
~0900 - the very first thing i did after waving family and nanny off to the airport was to turn off everything non-essential in the house. my family has allergies and also a habit of leaving lights and TVs on so as soon as the house was mine i turned it all off - air filters, air conditioners, TVs, even the night lights in the hallway. the utility meter never had such a holiday since we moved in. only fridge, computer, and everything between it and the Internet stayed on.
~0930 - the next thing was to find a good book ("The Watchmen" in this case) and go sit on "the throne" with the door wide open. ah, the freedom of an open bathroom door - how strange it is to miss something so simple. :)
1000 - (all times are approximate anyway) - took shower and then walked around the house a la natural. yet another simple pleasure i never realized i had lost.
1030 - off to work (i have an understanding employer - they understand because i do tons of hours from home when i'm not at work).
1700 - left work and came straight home. this is unbelievably early for me to leave work - normally (i.e., when the family is home) i stay at work till 1800+. not something i'm proud of, but it does give me some sense of balance between my paying job and my Daddy job.
1710 - i seem to remember playing a lot of Rockband (i love the drums, tho i wish they were more flexible in the layout - can you imagine Neil Peart having all his drums laid out on the same level side-by-side? but still, it's fun) :)

Day #1 - Friday - didn't go to work!!!! (this is unheard of in remembered history - for me to not go to work unless deathly ill or in some other way incapacitated or unable) instead i went around the house fixing things, hanging pictures, repairing the cable in the master bedroom, etc. and best of all i didn't have to keep a weathered eye on my tools at all times to watch for mischievous little hands looking to snatch away an unattended hammer or screw driver. oh, the joy of knowing your tools won't run away or you won't be called on to do this, that, or whatever, while you're trying to finish something else which is important to you, even if others don't think that what you're doing is important. Finished the day with more Rockband and working out. Ate surprisingly little - just didn't think about it. :-/

Day #2 - Saturday - more running around the house fixing things, watering plants outside (it's been hot in WA lately), trip to Fred Meyer with a list of only my own things (typically my shopping lists are written in my wife's hand and often i have to look it over and ask a number of clarifying questions before i head out. but this time every item made sense and was clearly legible and this, too, was a simple pleasure i had forgotten from way back when). i think it was about this time i started talking to myself... i also was becoming quite used to how hot the house is without the AC running. after a while it felt comfortable to feel sweaty all the time - weird, but true.

Day #3 - Sunday (today, or more accurately yesterday) - until 0930 this morning there was a chance they would stay in AZ a few more days, but my wife informed me that things had transpired with the family which guaranteed their return today). at that point i went into high gear (until then i had actually considered if i could miss work Monday as well) because there were various things i hadn't finished and i knew once they arrived my productivity would drop like the Market on Black Monday. Helter skelter for 6 hours (the last 2 of which i started worrying like i did in the old days - day-mares of crashed planes, car accidents, all sorts of highly unlikely events that would bring my world crashing down). Luckily tho, as had been in the old days, all my worrying was unfounded and my (and their) vacations ended. And from it i learned a number of interesting facts:

1. i eat a lot less when i eat by my own schedule (i.e., alone and only when i'm hungry)
2. i can go days without working (or even using a computer) if i'm left to do other things (like Rockband) that i enjoy
3. your true nature, even if repressed for 10 years, is still your true nature when given the opportunity to express itself
4. i don't mind the heat anywhere near as much as my family does
5. a house (and my brain) is much quieter without all the background noise (mostly fans - of which i can hear 3 right now, including the fan on my computer).

oh yes, and i think i figured out something about blogs too - writing blogs is for people who want to have a diary to record thoughts but realize that keeping those records secret is a waste of effort - otherwise you should just spend the time talking to yourself. but a blog - it's like a diary that people can read - people you don't even know (and hopefully don't know you - in particular i'm hoping my family never finds my blog - otherwise i'm never going to write another thing on here). but as fun as this was i'm sure i'll forget to worry about it eventually and hopefully write something someone would find worth reading (no refunds tho - time wasted reading my drivel is time lost for good). :) now to fix those spelling errors...

oh, two good quotes i thought of today:
- "The most important thing I learned after school was that much of what I had learned in school was worthless."
- "Those who forget history are doomed to repeat it; but, then again, so are those who remember it."



i've finally taken the first step - created a blog.  fortunately, yet unfortunately, that was the easy part.  what does one put in a blog?  what to share and how much is too much?  wow.  talk about (self-induced) pressure!  when i created my website i was able to keep it simple - a shared bookmark and useful forms page.  but this is something different - something more dynamic, organic, and personal.  i'm certain many learned folks have written books about writing blogs (as ironic as that seems) but it seems wrong somehow to read up on how to write one of these things...

well, there it is - step #0.  when i'll risk the next step who can say?