Wednesday, July 29, 2009

Teeth Whitener for 49 cts.

Rush, rush, rush. Don't forget to brush.

I read an online advertisement that says
Don't pay a fortune to whiten your teeth - the price is only $2.49 plus shipping.

I keep wondering why people never bother to use baking soda. The local store's self-branded box is simply 49 cts.

I used to brush my teeth with baking soda at night and tooth paste in the morning. The tooth paste is for the benefits of fluoride for my teeth. Then I started using fruit flavoured fluoridated mouth rinse to moist my tooth brush before dipping the brush into the baking soda.

I had kept up the practice a number of years and I guess people were noticing my teeth were whiter than the usual population's. Then one day, the dental nurse (they call them dental hygienists nowadays) finally succeeded in persuading me that my front tooth chipped when I was a kid should be mended.

So another technician from a dental consultant company had an appointment with me at the dental office. She brought with her a panel of enamel shades to attempt to match my teeth with the enamel shades they have. The consultant's technician had to choose the whitest shade they had. She said with a big smile, you have the whitest teeth in the population. It's the baking soda, I said.

I know, she said - she'd like to use it too but she did not like the taste or the grittiness.

I am a lazy teeth-brusher and it takes only 2 daily minutes of grit and baky taste to keep my teeth healthy.

You should use baking soda on your teeth before you go to sleep for the night or before any few hours when you would not be ingesting any food. Baking soda is pretty nonreactive so the brushing does not actually whiten your teeth. Baking soda does not corrode your teeth. Baking soda is insoluble in water but it needs to react with acid to whiten your teeth. And baking soda is a persistent sticker to surfaces because it takes quite a few wipes to clean a baking soda spill.

Which sets the perfect condition for using baking soda on your teeth before you go to sleep. The remnant sugars stuck between your teeth which brushing won't eliminate turns acidic (by some bacteriologic process, as we have all been told) while you sleep and the acid reacts with the stuck baking soda and voila! - that's your teeth whitener.

As I said, I used to brush my teeth with baking soda. Then one day, I got tired of the dentist reminding me my lack of discipline in flossing my teeth and that I brushed my teeth too much that my gum was receding.

I changed my habit. I stopped brushing my teeth. Actually, I do minimal brushing where flossing wouldn't reach. My dentist and his technicians were happy with the results. Reason being, I started flossing my teeth with baking soda using a toothbrush. I would press the baking soda embedded bristles between my teeth to floss them. I lied to my dentist and his technicians that my healthier gum was the result of their recommended disciplined flossing. They believed me. I hate flossing my teeth with dental floss strings - it's messy and at times bloody and mostly tedious.

At first, I went to the pharmacy section to look for hand held flossing equipment and finally decided that the good old long-bristled toothbrush was the most convenient and cheapest means of flossing my teeth. My last supply of toothbrush I bought for $10 for ten from the local Hispanic supermarket. There are still quite a lot of Hispanic food ingredients that I still cannot find in major supermarkets, not to mention cheap toothbrushes.

May be baking soda is bad for the dental health business, because on subsequent visits, there weren't much plaque for them to clean and I dropped my dental insurance altogether.

Now for the taste part, though I don't mind it. First you should try as I had - moist your tooth brush bristles with fruit flavoured fluoridated mouth rinse before dipping it into the baking soda. If not try the following.

I am planning to experiment mixing a little of my favourite fruit jams with the baking soda on the toothbrush. That would give an excellent taste while flossing my teeth and provide the necessary acid to react with the baking soda while I am asleep. Let's see, my favourites are blueberry, strawberry-raspberry, peanut butter with grape and strawberry, fruity Schnapps ...

You shouldn't brush your teeth. It's bad for the gums. You should use your toothbrush to massage and floss your teeth with baking soda. The massaging action spreads into the gum line without ruining your gums but yet prevents plaque from forming.

OK, Schnapps is not a jam and probably would not provide sufficient acid to react with the baking soda.

Tuesday, July 28, 2009

Cuckoo Berra quotes

Cuckoo Berra quotes
  1. We ain't sober till we're sober.
  2. I didn't write half the applications that I wrote.
  3. When you come to a fork(), wake it.
  4. What's the datetime()? Do you mean now()?
  5. Programming is 90% mental, the other half is philosophical.
  6. I want to thank you for making this application necessary.
  7. If you don't know what you're coding, you'll end up with something else.
  8. The application encountered the wrong error.
  9. Nobody visits that site anymore, it's too popular.
  10. Applications slow down quickly out there - on Vista.
  11. If users don't want to use the application, you can't stop them.
  12. He must have wrote that (software) before he died.
  13. If you can't copy the code, don't paste it.
  14. Think?! How the heck are you gonna think and code at the same time?
  15. There are two hours when I'm most productive, it's from nine to twelve in the morning.
  16. An integer isn't worth a char these days - on differences between c and java.
  17. You can code a lot by just typing.
  18. In design there is no difference between design and implementation, but in implementation there is.
  19. Have you seen my secs manuals? - when frantically searching through amazed female colleagues' cubicles for the $600 set of semiconductor equipment communications standard (secs) manuals.
  20. We should instead put some firm codes down and stop waltzing around that crappy matilda.
  21. Middle management sucks especially when they treat you like another set of routines to be executed.
  22. The difference between a virus and a trojan horse is a virus behaves like a virus and a trojan horse works like a trojan horse.
  23. We should all ban cell phones at work because their use is discouraging the use of blackberries.
  24. You know a project is going to be a failure when people spend time drumming up their achievements during scrumming sessions.
  25. Make no mistake, that the mistake we had made was a mistake indeed.
  26. Mission Accomplished is an attitude from people who have no idea what continuous improvement means.
  27. I am pro choice-buttons because I don't like the idea of a process aborting due to lack of options.
  28. The difference between arguments and parameters is that an argument is a functional parameter, whereas a parameter is a parametric argument.
  29. When there is too much logic involved, it can become illogical.
  30. Is this a bug or an undocumented feature?
  31. If I sat on the old gum tree, would you marry me?
  32. Tele-ban is terrorising your users by informing them their loss of privileges through the telephone.

Saturday, July 18, 2009

Referencing a Text JSP Custom Tag Defined in Another Page

You could define the contents of a Text tag in a page

RunFirst.jsp

<h2g2j:text id="sesquery" scope="session">
SELECT NAME, ADDRESS, JOBID
FROM EMPLOYEE E, JOBS J
WHERE E.EID = J.EID AND
E.STATE = '<%=state%>' AND
current_date - E.STARTDATE > <%=minExp%>
AND J.DESC = '<%=jobDesc%>'
</h2g2j:text>



You could then in other subsequent pages use that StringBuffered pool of text by referencing it:
RunNext.jsp

<h2g2j:text ref="sesquery" scope="session"/>


<%
jdbcConnection.submit(query);
%>



RunFirst.jsp must be run once before any other page that would reference the session buffered text "sesquery". The ref invocation is necessary as it is an instruction to search for the session attribute "sesquery", whose object would be hooked up with the page variable "sesquery" by the servlet container's session handler.

Therefore, if you have a few voluminous query texts that tend to be reused frequently across the pages throughout a session, you could have an initial JSP that loads those texts into session buffer once. Rather than redefining common blocks of texts at every JSP.

JSP Text Custom Tag

Which is the more proper (i.e. acceptable to Sun, now Oracle's new division)
  • JSP Text Custom Tag, or
  • Text JSP Custom Tag?
The source is at
http://code.google.com/p/synthfuljava/source/browse/#svn/trunk/jsp/org/synthful/jsp/tags/Text.

The TLD is at
http://code.google.com/p/synthfuljava/source/browse/#svn/trunk/jsp/org/resources/WEB-INF.

Anyway, this is a custom tag I wrote because during ancient times I programmed in Perl and when I moved to Java I had to do this Java

String query =
"SELECT NAME, ADDRESS, JOBID " +
"FROM EMPLOYEE E, JOBS J " +
"WHERE E.EID = J.EID AND" +
"E.STATE = '" + state + "' AND " +
"current_date - E.STARTDATE > " + minexp;


instead of, which Perl allows me,

query =
SELECT NAME, ADDRESS, JOBID
FROM EMPLOYEE E, JOBS J
WHERE E.EID = J.EID AND
E.STATE = \'$state\' AND
current_date - E.STARTDATE > $minexp
;



With the Text JSP Custom Tag, I have been doing this

<h2g2j:text id="query" scope="session">
SELECT NAME, ADDRESS, JOBID
FROM EMPLOYEE E, JOBS J
WHERE E.EID = J.EID AND
E.STATE = '<%=state%>' AND
current_date - E.STARTDATE > <%=minExp%>
</h2g2j:text>

  • The contents of the body of the tag is stored in a StringBuffer.
  • The ID="query" attribute associates the StringBuffer to Java variable "query".
  • Specifying the ID attribute clears the StringBuffer before storing the tag's contents into the StringBuffer.
  • Instead of using the ID attribute, the REF attribute should be used to invoke the tag identified by "query" without clearing the StringBuffer.

<h2g2j:text ref="query" scope="session"/>


There isn't actually much you could do reinvoking a text tag, unless you wish to append to the StringBuffer.


<h2g2j:text ref="query" scope="session">
AND J.DESC = '<%=jobDesc%>'
</h2g2j:text>



Which would be equivalent to doing

<h2g2j:text id="query" scope="session">
SELECT NAME, ADDRESS, JOBID
FROM EMPLOYEE E, JOBS J
WHERE E.EID = J.EID AND
E.STATE = '<%=state%>' AND
current_date - E.STARTDATE > <%=minExp%>
AND J.DESC = '<%=jobDesc%>'
</h2g2j:text>


Since the StringBuffer of the tag is associated with the java variable "query", you would invoke the StringBuffer with that variable:

<%
jdbcConnection.submit(query);
%>

Sunday, July 12, 2009

The Future of Personal Computing

Getting Personal
A professor from Rennsalaer Polytech (cannot recall who) once said,
The personal computer is getting too personal.

Meaning - personal computing devices (Macs included), despite all their networking features have so far been incapable of accommodating natural human mode communication and cooperation.

In the future, personal computers will be obsolete. Not because the practice and processes of computing would become obsolete but computing will be a minority requirement in the realms of machine-aided-human-activities. The near future devices will be capable of computing nonetheless but whose role involves millions of perfunctory activities and only one of which is computing.

The future is in the cloud.

A device can virtually create as many virtual CPUs as the number of tasks running on it require. Dynamically and spontaneously increasing or reducing the number of virtual machines running. Vice-versa, a virtual super-device can be created over the network, whose resources the participating devices could tap into. Devices could subscribe to clouds as we currently subscribe to Youtube, Wordpress or Tweeter - pulling in and out at will with no detriment to the subscription system.

Instead of a hard-wired super-environment, we subscribe to clouds. We will have evaporation and condensation of virtual machines and processes. That is the power and efficiency of authenticated subscription.

Before anyone spouts any anti-666 big-brother-is-watching-you tower-of-babel ridiculousness, you have to realise that cooperative activities is a requirement of human existence. There is nothing big-brother about the clouds. It's like walking into a wet market, getting noticed, getting your chores done and then walk out. Nowhere anything near 666 here (i.e., if you believe in such a thing as 666) . Do whatever you want. You don't have to visit the large cities. You don't have to live in the large cities. You could keep your machines to your own small village, subscribe among your own fellow-believers, to your own little communes and qibuts. There will be millions of clouds rather than one single tower of babel.

There will be clouds whose existence is to sanitize communication to help other clouds maintain privacy and confidentiality. Virtual clouds make multiplying a few fish into feeding five thousand possible.

Cloudification
At this moment, Google seems to be the party that is paying the most attention to the cloud. Oh no, the cloud is more than Amazon's web services or Zoho or Microsoft's miserable attempts at cloudifying themselves. And just like missing the internet boat, Microsoft will again miss the cloud because they are carrying a huge baggage that induce them to be unwilling to provide an operating system that is small and compact and that does not run Windows. Before it's too late, Microsoft needs to shift their attention away from .NET towards .CLOUD.

Have you been cloudified, yet?

Saturday, July 11, 2009

Google ChromeOS: My Wish List

Open letter to Google,
request for features of ChromeOS.

I am anticipating ChromeOS because I work mostly on the Web and on Java and therefore, I would like to throw out all the Vista baggage that is slogging down my PC. My whole professional life revolves around Google - Apps, Docs, GAE, Blogger, GData, Sites, etc.

I also write in .NET C# quite a lot but I can do that on another machine or another session of a dual boot. Perhaps, the advent of ChromeOS would make my .NET skills obsolete. I hope so.

  • I need ChromeOS to be dual-bootable between itself and Vista(or any future version of Windows). As I would need to share data between my Windows and ChromeOS sessions, I would need ChromeOS to recognise NTFS.

  • I want Google to provide me a convenient migration path from Windows to ChromeOS, so that for the initial 18 months I would be vacillating between Windows (or MacOS) and ChromeOS but thereafter, ChromeOS features should be so persuasive that I abandon Windows (or MacOS) altogether.

  • I have dual-core 64 bit Intel CPUs. Would ChromeOS be able to exploit 64 bit and give me an advantage over 32 bit machines? I hope so. Would it be able to exploit multi-CPUs? I hope so. Will it be able to exploit the power-saving variable speed of the CPUs? I hope so.

  • I use Eclipse or Netbeans. Mostly Eclipse. It must run Eclipse.

  • Of course, it would have to run the beloved Java Platform, and if it wouldn't, I would be so extremely dismayed and surprised.

  • Perhaps it could run Mono, just in case it comes in handy with .NET applications and I don't have to run off to another machine, but please, please, please, put Mono inclusion in the lowest priority because if I wanted to .NET, as I said earlier, I'll do it elsewhere. But it would not hurt if it runs Mono.

  • Should it run flash? I am sure it has to run flash because everything with a movie on the web runs on Flash, especially Youtube. And CNN, Yahoo, etc.

    As a programmer, I am hoping some other technology would be in advent to replace Flash because I find writing actionscripts really tedious and unreliable and barely debuggable. I use OpenLaszlo on Tomcat because I do not wish to afford the $10K Adobe enterprise Flash authoring system.

    JavaFX is an extreme disappointment because it runs on a JVM and therefore is about 9 or 10 times slower than Flash. Then, Silverlight runs only on .NET.

  • Perhaps, further down the milestones on the roadmap of ChromeOS, Google could come up with a JVM that violates the JVM specification by improving on the JVM virtual CPU a little bit, like their Android DVM, so that we could run JavaFX at the speed of Flash. Sun would be unhappy? Who cares about Sun? May be they should just use DVM without the Linux underneath.

    How about a multi-virtualCPU DVM, where two or more DVMs could run concurrently on the same task. A JVM/DVM is like a virtual CPU - so a multi-VMCPU VM. In fact, why don't you just base ChromeOS on your own version of DVM - where we could configure a system to create as many virtual DVMCPUs as desired and depending on loading, we could configure the system to spontaneously dynamically reduce or increase the number of DVMCPUs running on the system?

    Would Sun be unhappy? Perhaps, they would, but you don't have to talk to them now because they don't exist anymore. I have the impression that Oracle, a more business oriented and practical entity, would cooperate with you readily, especially when it helps their mostly Java-based admin utilities run faster and friendlier.

    I think you should rope in IBM to define this multi-VMCPU VM thing, because IBM is a very powerful (and enthusiastic) force in the Java world. They've had quite a few skirmishes with Sun over Java. I have been fantasizing a Java-oriented OS since the birth of Java.

    And how about a virtual coprocessing VMCPU whose instruction-set is dedicated to handling graphics IO - so that graphics IO is not bottle-necked by system processes, vice versa. Perhaps, we should call it a VVM for Video Virtual Machine.

    Also, how about a DVM optionally capable of 64 bit processing?

    With all this multi-VMCPU VM in place, nothing would prevent me from knitting a few lowly ChromeOS lap, book or palm tops together to run as a single VPS (virtual processing space) super-computer. With the appropriate permission/privilege processes in place, ChromeOS based on a renewed Java multi-virtual architecture would make this scenario possible, where a teacher in a classroom of 24 kids says, "Hey kids, I'm borrowing your JVMs over the wireless for a minute" to crunch the solution to a set of equations.

  • And people are asking why Google is trying to compete with Apple and Microsoft in the PC arena. Well, Google, you are not - because neither Apple nor Microsoft has come up with a framework that would allow me to create a supercomputer over the wireless of a classroom of 24 students and a teacher. Those two have too much baggage and Google has none. Moreover, internet-based cooperative computing is Google's expertise and Google is merely expanding their expertise to the cooperative-intranet arena where neither Apple nor Microsoft has the focus or expertise to provide for this much needed arena.
Therefore, if following my recommended road map, Google is not competing with them, Google would merely be conquering outer space where barely anyone (except for some quaint academic esoteric systems) has ever been before.

Cat Psychiatrist Needed

Maine Coon cats are the most lovable and loving of any domestic cat breeds. This morning, and on other occasions, our cat lay down in watch at the bedroom door and waited for me to wake up. I kept wondering what it wanted from me. I checked she had water and food. Then when I started making a piece of bread with strawberry jam and peanut butter for myself, she started to eat her food.

I am rather mystified and deeply impressed by this behaviour. She needed my breakfast companionship. I am thinking if there are such professions as cat psychiatrist or psychologist, who could explain our cat's mentality to me. Most times, I simply forget that she wants me there to eat with her.

By the way ...

If you have a Maine Coon cat, what would you hope to do with all the fluffy down it sheds. Do you have a depleted goose or duck down jacket and have you thought of using the Maine Coon down to replenish your depleted jacket?

Thursday, July 9, 2009

GWT: Useable Closeable Scrollable DialogBox

The GWT DialogBox is barely useable beyond demonstration-level GWT examples. It does not have a close button at the corner of its caption bar.

A usable, closeable and scrollable dialog box is available from
http://code.google.com/p/synthfuljava/ .

ScrolledDialogBox Patch
This class ScrolledDialogBox is found as
http://code.google.com/p/synthfuljava/source/browse/trunk/gwt/widgets/com/google/gwt/user/client/ui/ScrolledDialogBox.java .

Being a patch, it retains the com.google.gwt.user.client.ui namespace.

DialogBox over-rides the onBrowserEvent method and replaces it with a block of obtuse logic - to prevent the text in the caption bar from being selected while the mouse is grabbing the caption to move the DialogBox around the window. A prevention scheme that does not work very well on the hosted browser, evidently. This obtuse logic is the very reason why buttons placed on the caption bar will not react appropriately to mouse click events - consequently, you cannot hide/close the DialogBox through any button placed on the caption bar.

Therefore, either we delve into the convoluted GWT event firing scheme or invent our own mini event scheme and insert it into onBrowserEvent method of DialogBox. The scheme is defined by the interface CloserEventHandler, where only three mouse events are recognised
  • onClick - to close the dialog by clicking on the close button
  • onMouseOver - to change the colour of the close button
  • onMouseOut - to change the close button back to its original colour.
In ScrolledDialogBox.java is declared an ArrayList CloserEventHandlers. This ArrayList is to allow CloserEventHandler instances to be stacked using its add() method.

And CloserHandler embedded class implements CloserEventHandler, which is added onto the CloserEventHandlers event stack, which the new onBrowserEvent paces through to execute each registered handler.

Subclassing rather than Patching
The initial tendency to solve the problem, besides waiting for Google to release a better DialogBox (waiting and looking over the wall till your neck stretches as long as a giraffe's), is to subclass DialogBox to provide the desired effect of having a closer button at the caption bar. As in
http://code.google.com/p/synthfuljava/source/browse/trunk/gwt/widgets/org/synthful/gwt/widgets/client/ui/UnusableScrollableDialogBox.java .

However, this class has a disclaimer - it is not useable, as explained within the javadoc sections, but retained as an example why over-riding this way would not work, because DialogBox's caption acknowledges DialogBox as a parent, but DialogBox does not acknowledge its caption as a child:
  1. In DialogBox, the caption bar comprises one widget alone - an HTML widget implementing the DialogBox.Caption interface.
  2. We need to replace the caption bar with a HorizontalPanel. On the HorizontalPanel, we should place the caption widget and on the right, the closer button.
  3. We should extract the caption widget and reuse it by pulling it out of the caption bar and reinserting it as the first widget of the HorizontalPanel.
  4. However DialogBox did not add caption widget as a widget but rather by adopting (using the adopt() method) it as an element. The consequence is, caption registers DialogBox as a parent but, DialogBox does not register caption widget as a child widget.
  5. To yank caption widget out of DialogBox, we would use caption.removeParent() method. However, Widget removeParent() method first detours to let the parent check if it has the widget as a child widget - if not, the parent's failure to relate to the widget as a child causes the remove operation to abort without the widget having a chance to nullify the dead-beat parent from its private parent variable. Since a widget's parent is stored as a private variable, we muggles would not be able to access it to nullify it.
  6. Well, since the caption widget still acknowledges its dead-beat parent as a parent, the add operation would not work. That is HorizontalPanel cannot add caption widget as its child widget because add() method would first check if the widget still has a parent.
  7. Therefore the caption widget is a victim of a widget's unrequited loyalty to its dead-beat parent.

Therefore the solution is to
  • Orphan the original caption widget.
  • Instantiate an HTML widget as the new caption widget.
  • Over-ride the get/set Text, Caption & Html methods. Unfortunately, the getCaption() method is final and cannot be over-riden.
  • Instantiate a HorizontalPanel and set it as the new caption panel.
  • Add the new caption widget as first child widget of HorizontalPanel.
  • Instantiate a Button and add it to HorizontalPanel as its second widget.
  • Conjure the mini event scheme.
This exercise can be aided by merging some codes for ScrolledDialogBox into ScrollableDialogBox. At the end of the exercise, you would discover that you had replaced three quarters of the super class's code - might as well write a patch rather than a subclass.

The subclassing code is found as
http://code.google.com/p/synthfuljava/source/browse/trunk/gwt/widgets/org/synthful/gwt/widgets/client/ui/ScrollableDialogBox.java .

Disclaimer: The ScrolledDialogBox and ScrollableDialogBox classes need further refinement.
  • The position of the X button needs to be properly calculated
  • The event scheme of the X button accounts only for onClick, onMouseOver and onMouseOut.


The Emperor of Pop

By the way ...

I think that while Elvis might have been the king, Sinatra the don and Springsteen's the boss, Michael Jackson is the emperor of pop.

I read that there are a lot of people who dislike Madonna by commenting that she's a lousy singer. But, I think Madonna has a very rich and powerful voice, far better than Elaine Page's. In fact, I am unable to find a better and more powerful rendition of Evita - Don't Cry for Me Argentina than Madonna's.

One shouldn't mix your disagreement with their lifestyle and music expressiveness with your judgment on the quality of their music. You don't have to agree with their life-style while acknowledging that they are the best.