Jose Sandoval Google
 Resume     Book     Software     Drawings     Home     Subscribe to RSS feed Search Web Search

The holidays in ASCII Art
Monday, December 24, 2007

There are a few internet users out there who remember ASCII art. It's where the smiley was borne. I wouldn't say they were the good old days, but they were interesting times. Almost SPAM free email.

_( " )_
(_ : _)
/ ' \
jgs (_/^\_)

Happy holidays, if you are into that sort of thing.

5:48 PM | 0 comment(s) |

Trucking snow
Thursday, December 20, 2007

I was driving back from the gym tonight and saw 3 large dump trucks and a tractor removing snow from the local mall. They were filling up the dump trucks with snow and driving it somewhere. I'm not sure where you would go dump snow. I mean, it's frozen water and it will eventually melt.

I'm no environmental activist, by any stretch of the imagination, but trucking all that snow is probably very environment-unfriendly and expensive. By my calculation there were 6 guys working at 11:30 PM, probably getting paid overtime, 3 large dump trucks, 1 large snow tractor.

I think, however, that the cheapest and easiest way to get rid of snow is by melting it. Obviously, it isn't (and I haven't done the math). Otherwise, these snow removing companies would just melt it on site. Or maybe it's better to do it old-school and keep the economy going by using our limited amount of black gold.

I just hope we're not damaging the environment too much by overfilling our snow-landfills...Get it? It's snow...It melts...

On a serious note, I can't help to think that large microwave melting truck would be a viable business model for the northern parts of the globe. And what about those super laser canons we hear about? Those should be able to vaporize snow in no time.

11:35 PM | 1 comment(s) |

How many of these do you belong to?

List of social networking sites.

I'm not doing too badly: I only belong to 4, but 2 I never use (I don't even remember my ids/passwords). The most despised, FB :). I'm on it only for the sheeple effect.

On a side note, I predict "sheeple" will make it into the official dictionary next year (2008).

10:49 AM | 0 comment(s) |

A love/hate relationship with spam...
Tuesday, December 18, 2007

Spammer trying to beat spam filters:

    real OO design principles

    Good afternoon. How is it going? Email me at only. I am using my friend's email to write this. I am good looking girl. Hope you like my pictures. he not be on par factors is that no compensation said Gervasio, no powers at my
I have to say this time it half worked: it didn't reach my inbox, but it did make it to my "Possible Junk" Outlook folder. I guess I should retrain my SpamBayes installation. Sadly, there were no pictures to like. I feel cheated Gunvor. Where are my pictures?

By the way, wouldn't it be funny if this spammer's bot harvested his or her own email address and sent him or her this exact same message? Hmmm...Recursive spam...

7:00 PM | 0 comment(s) |

I learn something every day: liquid smoke

  • Liquid Smoke - All that smoky bacon goodness in a bottle. I'm surprised there is no "CK Smoke." I'd imagine the ads to be very creative: meats, smoke. It's a perfect combination.

  • Schizophrenia and Left Handedness - Interesting study.
On a side note relating to left-handedness: yesterday I was looking around the local BestBuy and I was surprised at how many computer mice (mouses) are available, but none specifically for left-handed people. There are big ones, small ones, red ones, green ones; some have 1 button, others looks like they have 20--I stopped counting after 7; the prices range from $5 to more than $120. The selection is quite varied, except if you are left-handed.

I have never specifically looked for a left-handed mouse, as I'm right-handed but out of curiosity I looked for one. Well, maybe I want one; I'm not left-handed, but I trained myself to use my left hand whenever there is a mouse around--something to do with training your brain to do new things. So now I don't like using my right hand to mouse around: it feels unnatural.

Although left-handed people can use the neutral mouse, I can't help to think that the fancy Microsoft or Logitec hardware would feel much better in the sinister hand. I'm sure that if enough people ask for it, someone would make it and would probably be sold at a store similar to Flanders's Lefttorium. In all fairness, there probably is a left handed mouse out there. I'm just too lazy to google for it right now.

9:15 AM | 0 comment(s) |

Crazy Java Swing field validation

Typically, if you store anything to a database using a computer program, you want to ensure that the data is clean. For most applications, you want to validate user's input at the client level, at the business level, and at the database level. It's all about making sure users' mistakes are caught before storing invalid data.

When playing around with floats, doubles, and JTextFields (in swing), there are a couple of quirky things to pay attention to. For example, lets say you are expecting a decimal value (say a currency value), which should look like "100.45." Anything that is not a number should be rejected. As you know, JTextField objects can only give you String objects back when you ask for their content. As in:

JTextField jt = new JTextField("Jose Sandoval");

If you run this snippet of code, you expect "Jose Sandoval" to print to the console. OK, nothing surprising here.

But what about a currency value? Those are funny--at least I think they're funny. Take a look the following code:

JTextField jtCurrency1 = new JTextField("100.50");
JTextField jtCurrency2 = new JTextField("100.5x");
JTextField jtCurrency2 = new JTextField("100.5d");
JTextField jtCurrency3 = new JTextField("100.5f");

try {
double d1 = Double.parseDouble(jtCurrency1.getText());
double d2 = Double.parseDouble(jtCurrency2.getText());
double d3 = Double.parseDouble(jtCurrency3.getText());
double d4 = Double.parseDouble(jtCurrency4.getText());
} catch (NumberFormatException e) {

Which one of those statements (if any) will throw a NumberFormatException?

Double.parseDouble() tries its best to return anything you give it as a double value. So a string that looks like "100.50" will return as the double value of "100.5." Cool, right?

So now that we know what Double.parseDouble() does, which of the variables above will have correct double values? Is it d1, d2, d3, or d4? None of them? Or all of them?

This is not a trick question, but if you are just starting to code in Java, you'd expect only d1 to have the right value of "100.5," as letters in numbers makes it just a string and not a number at all. Note that I don't mean to assume that you don't know Java, but I made the very assumption a while back, when Java was in version 1.0.x.

If you run the code, or know how a double is used in the language, you'll know that the only statement that will throw an exception is:

JTextField jtCurrency2 = new JTextField("100.5x");
double c2 = Double.parseDouble(jtCurrency2.getText());

In the case of c1, the String object looks like a real double value. In the cases for c3 and c4, things work because of how Java handles native values and how these values can be morphed into each other. I won't go into the details, but it has to do with the space required to store each value. When you cast from one type to the next what you are essentially doing is losing or gaining information depending of what you are doing: upcasting or downcasting (this is the same concept of object casting).

Aside from casting, why does it work? It works because in Java a float and a double can be interchanged to a certain extent--there are some caveats.

In code, a double value of "100.5" can be written as "100.5f" or "100.5d." To the user the value is the same, "100.5"; however, to the computer "100.5f" is stored in a space of this size "---------," assuming a dash (-) is a valid storage representation (in reality, they are bits or 0s and 1s, but that is harder to explain); now, the value of "100.5d" is stored in a space this big "------------------------------." Yes, a double requires more storage than a float, and it's obviously more accurate because the mantissa is longer (mantissa is all the number after the period, or what we normal people call decimal places).

Anyway, "100.5f" and "100.5d" are fine representation of a double value for "100.5." Therefore, the statements above are valid input for Double.parseDouble(). They become:

double d1 = 100.5f;
double d2 = 100.5d;

Now, does the other way around work? Yes and no:

float f1 = 100.5f;
float f2 = 100.5d; // <- this is not valid
If you have code like float f2 = 100.5d;, you will get a compiler error. Nonetheless, you can make it work if you implicitly cast that baby down to a float, as in float f2 = (float) 100.5d;.

Having letters as part of a number seems funny at first; however, it makes total sense when you need to distinguish between the precision of a float or a double. By the way, if you need real precision for currency calculation, you should be using BigDecimal instead of float or double.

12:41 AM | 0 comment(s) |

You know you are being overchanged when...
Friday, December 14, 2007

I haven't had a cell phone for quite sometime. I work from home, so I rarely need one. I have had them in the past, however. The last one I had was the "pay as you model," where you buy phone cards whenever you need them. I like this model: I used to buy $10 cards every other month or so. For about 3 months I didn't buy a card, hence my phone number was disconnected. This happened about a year (maybe more) ago, and I haven't bothered getting a new one. Although the BlackBerry Curve looks very cool, and you get spam email on the go.

One of the reasons I don't have a cell phone is that I don't like long term contracts with cell phone companies. Somehow, you know you are being overcharged. For example, what's that $6 dollar monthly charge for access fees? Am I not already paying for the service?

Anyway, getting into bed with the 3 cell companies in Canada is something I dread. I hope competition will bring down prices in a year or so. Note that I'm no Luddite; I think cell phones are a great service and a few industries would suffer without them. I just don't need one right now, but I may in the future. Like I said, we'll see what competition brings into the Canadian market.

And speaking about overcharging: an $85,000 cell phone bill (that's right, eighty-five thousand) would be surprising to anyone. Now imagine "a 22-year old man from Calgary" when he found out his bill was not his usual $120, but just a bit over that. How did he manage to accumulate such debt? He was using his new cellphone as a modem, and in the process downloaded large media files (no word on charges of piracy, yet). I'm sure this doesn't happen everyday, but it's not unheard of overpaying for cell phone charges.

12:00 PM | 0 comment(s) |

Grades found to be positively correlated to the first letter of your name
Wednesday, December 12, 2007

As far as statistical analysis go, this one brings hope or distress depending on which side of the fence you are. Researches have found that the names of some students were positively correlated with the type of grades they were getting in school. In other words, if your name starts with the letter "A," you are more likely to get As for your grades. Similarly, if your name starts with the letter "D" or "F," your grades will be lower. This sounds crazy, but if you have read the book "Freakonomics" it may actually sound plausible. (BTW, some economists may not like me referencing this book as 100% factual, but it is an entertaining read, nonetheless.)

It's an interesting find, but there may be other reasons for the surprising result. For example, maybe the students in the study were more likable and the teachers gave them better grades; or maybe the teachers marked papers/tests in alphabetical order (from A to Z) and had more energy and a better attitude for the first 2 hours of grading; or somehow it's not the students that do better because of their name, but it's the teachers who get overwhelmed by that first magical letter.

Who knows what's going on here. I really don't know what to say: my last name is "Sandoval," but grading letters go up to "F" and I don't recall getting a "P" or an "R" for grades. Furthermore, in the Ontario educational system grades are awarded by number or percentage: a 50 is 50%, and a 100 is 100% (this may vary, but the secondary and post secondary schools I attended awarded grades by percentages). So in this case we should be looking for names that start with the letter "H" for "hundred," as in "Ho-se." Where is my grant money? I need to find out.

Until further, more exhaustive analysis is completed, I will hold changing Gabriel's name to "AAA AAAAA AAAAAA," short name "AA," nickname "A." I'm quite certain he'll be fine with the grade-unfriendly name of Gabriel Salvador Sandoval.

5:11 PM | 0 comment(s) |
Tuesday, December 11, 2007

10:38 PM | 0 comment(s) |

This is just terrible of Rogers ISP

From Dr. Frankenweb's Monster:
    Google has always been known for its clean, lightweight, ad-free search page, but Canada's largest provider of broadband internet is under fire today for messing with it. Toronto-based Rogers has begun testing a controversial technique that allows the media empire to insert its own content into another entity's web page, angering net neutrality proponents.

    According to a tip passed to L.A.-based technology expert Lauren Weinstein, the system being employed is manufactured by the "in-browser marketing" firm PerfTech. So far, Rogers is experimenting with the deep packet inspection process only to insert account status messages at the top of web pages like, but it is easy to see how such a technique could be revamped to provide additional advertising to customers.
I wonder why users take it: there are always other options. Although other options are throttling P2P traffic, I still haven't seen warnings on my browser. When I do, I'll likely switch and will let them know why.

5:12 PM | 0 comment(s) |

Black sentenced to 6.5 years

That has to suck. Moffat (that's Conrad Black's middle name) was sentenced to 6.5 years to a US prison. He could have actually served his time in a Canadian jail, but gave of all us (Canadians) the finger when he renounced his Canadian citizenship to become "Lord Embezzelus of the UK." As a convicted felon, he can't even enter his natal country to visit his Toronto mantion. "We ain't like his kind, around here."

I'm sure his lawyers will take a big chunk of the blame, and his money, for this court failure. There are questions, however, that only Black has the answers to. For example, why would he hire a Canadian lawyer to represent him in a US court? Why not follow on OJ's footsteps? I don't mean the committing of actual crimes (OK, allegedly committed), but the hiring of really good, ultra expensive lawyers to acquit him of any wrong doing. Whether he was guilty or not, it should have been up to his well dressed lawyers to prove and not him.

(Note, however, that if Black were to actually follow on OJ's steps, we can expect his next pedantic volume: "Black, if I had embezzled shareholders' money, this is how I would have done it.")

But enough contempt for the once Canadian, Moffat. It has to be sad for his family that he has to spend any time in any jail. As per his crimes, he has been proven guilty by his peers. In our society, that's all it counts. He maintains his innocence, but I don't think deep inside he believes he is. Moffat has a law degree and he has proven himself to know a thing or two about the world, so knowing when he crosses the line has to come with the territory.

I heard on the radio that he had a 1 hour speech prepared for the court. His lawyers persuaded him to cut it short. In fact, it was so short that it became a 3 minute address. I wonder if while preparing his original speech he pictured himself as the imaginary Hank Rearden, of Rearden Steel, giving his statement at his trial:
    I do not want my attitude to be misunderstood. I shall be glad to state it for the record. I am in full agreement with the facts of everything said about me in the newspapers - with the facts, but not with the evaluation. I work for nothing but my own profit - which I make by selling a product they need to men who are willing and able to buy it. I do not produce it for their benefit at the expense of mine, and they do not buy it for my benefit at the expense of theirs; I do not sacrifice my interests to them nor do they sacrifice theirs to me; we deal as equals by mutual consent to mutual advantage - and I am proud of every penny that I have earned in this manner. I am rich and I am proud of every penny I own. I made my money by my own effort, in free exchange and through the voluntary consent of every man I dealt with - voluntary consent of those who employed me when I started, the voluntary consent of those who work for me now, the voluntary consent of those who buy my product.
I think Rearden's statement applies to modern day industrialists and entrepreneurs, whether imaginary or not. Nevertheless, it seems that Conrad Moffat Black broke one of Rand's main philosophical tenets: he was found guilty of taking advantage of others for his own benefit. For that, shame on you Lord Moffat.

3:35 PM | 0 comment(s) |

LA's jumping car: coolness borne out necessity

I didn't know that lowrider cars, as in the LA lowriders, were borne out of pure necessity. Sometime ago, a law in LA was passed stipulating that the body of a car couldn't go below the top of the wheels by a certain amount. The solution to pass surprise police inspections? Install hydraulics to lift/lower the car when needed. The hoping is just eye candy. Sort of like saying s'appenin'.

12:58 PM | 0 comment(s) |

Java: automatically increment build number
Monday, December 10, 2007

An application build number is one of the most useful debugging tools out there. When something in the field doesn't work, you need to know which version is broken.

There are different ways a version number could be automatically incremented; however, in Java, the easiest way is to use your Ant build file. I'm not going to re-invent the wheel here, so find a very good explanation on how to do it at:I will summarize the solution, though. First, modify your build.xml file as follows:

<target name="jar" depends="compile">
<property name="version.num" value="1.0"/>
<buildnumber file="build.num"/>

<manifest file="MANIFEST.MF">
<attribute name="Main-Class" value="YOUR_CLASS_NAME"/>
<attribute name="Implementation-Version" value="${version.num}.${build.number}"/>

I like to use version numbers of the format: "1.0.1." In your case, you can change the string to whatever convention you need to follow. Note the bold code above. Those should be your new entries in your typical Ant build file.

Second, once you have your "Implementation-Version" set up, you need to display the information from within your Java application. To do that you need code that looks like:


YOUR_CLASS_NAME should be your calling class. And you can obviously make use of the value however you want to. In this snippet of code, I'm just dumping it to the console.

Note that this works if you are packaging your application into an executable jar file. For stand alone applications (single classes), you can still use Ant to read a counter file, and automatically compile a class that increments the value. At the moment, I don't have a need for this solution, but it should be straight forward implementation.

10:07 PM | 0 comment(s) |

Favorite Error Message

Writing warning or error messages for any application is hard work. You never know if the information given will be enough or even understandable. To me, a "Null Pointer Exception" error speaks volumes. To some, it may mean one more reason to hate the maker of the program.

There are many error messages out there, but this is my favorite:


2:46 PM | 0 comment(s) |

Greenback is not an accurate term
Sunday, December 09, 2007

I don't like the term "greenback" when used to refer to the US dollar. Canadian journalists are having a ball repeating the term every chance they get. This only started happening when the Canadian dollar made gains on the US currency. Before, it was called "the US dollar." All of the sudden is greenback this, greenback that. I can't wait until they forget the term, or learn to use it properly.

According to Wikipedia, greenbacks are only US Government issued legal notes, and not every dollar printed by the modern Federal Reserve, which are actually in use now. I don't think greenbacks are in circulation anymore.

9:58 PM | 0 comment(s) |

Falling...Falling...From Grace...
Friday, December 07, 2007

It must be hard to have it all (well, not all), and then quite a lot but be incarcerated. Just ask Conrad Black. He will go to jail, that is for certain. The question is for how long. His fate rests in the hands of a federal judge in the US, who can sentence him to as little as 5 years to a maximum of 30 years. Black is 63, so anything beyond 20 years in prison becomes a life sentence.

I won't lie to you, there is something that doesn't feel right about his whole trial. In the end, of course, if you have shareholders you become their employee and using company money is no longer a matter of asking yourself for raises. But I can see how a sense of entitlement can't be shaken off, as he seemed to have a built a publishing empire on his own. Nonetheless, the rule of law must prevail and he got caught with his hand in the big, big cookie jar. Someone wrote about him as, and I paraphrase, "being a millionaire living the life of a billionaire." How pedestrian of him.

9:19 PM | 0 comment(s) |

P != NP? Why? Dictatorial Democracy?

I don't usually like to post links without my point of view, but these two are the exception today:

12:55 AM | 0 comment(s) |

Is Ronaldinho out of Barcelona?
Thursday, December 06, 2007

If you follow Spanish soccer, you'll know that Ronaldinho (the best player in the world last year) is not his usual self. This means that he doesn't make the difference in any game, and has become just one more player in the squad. This is atypical since he is a very expensive player and is supposed to deliver the magic in every game.

Of course, high pay doesn't mean the best performer in soccer. Some players get injured and still get paid well. A perfect example of this was Beckham in the MLS. The dude played around 180 minutes for the whole season (of course he came in late).

As per Ronaldinho, I think his story in Spain is coming to and end. For one, he became a Spanish citizen and this means he will have to pay citizen's tax (it's very high; on top of that any percentage of millions of Euros is a lot of money). So his future is likely to be the English premier league (very likely Chelsea) or the Italian calcio (very likely Inter). For him anything is better than bench warming at Barcelona, where the 17 year old kid is playing much better than he is.

If he's not out of the club yet, he already has one foot out of Spain.

11:16 AM | 0 comment(s) |

UPS is currently one of the worst delivery companies in business
Monday, December 03, 2007

This is the second time UPS doesn't deliver my package to my apartment. Instead, I end up picking up parcels at their depot. What's the point of paying for shipping and handling, if I'm not getting door to door service?

I'm aware that things can go wrong from time to time, but the same problem twice in a row? Something needs to be done.

The problem, I was told, is that I live in apartment and my buzz code is not in the address field when I buy my items from internet vendors. If you buy anything online, the address field asks for an "address" and never a buzz code. So when I call and ask why my packages are not delivered, customer representatives tell me that a delivery attempt was made but no one was available and ask if "I put the buzz code in my address at the vendor's site." Well, no. I don't. It's not needed. My unit number is "906," and my buzz code is, logically enough, "906." No one has a problem finding me when I tell them I live in unit "906." Everyone presses the correct buzz code, except for UPS drivers. The excuse I get from their customer representatives is that it's not explicitly written in my web orders. This is nonsense. If FedEx and Canada Post don't need a buzz code number when I use them, why does UPS?

Given that we live in a competitive environment, from now on, I'll refuse to buy anything online that uses UPS as their delivery option. On top of that, I will not use UPS to send anything. I will stick to FedEx. If you online vendors use UPS, stop. They are diluting your brand.

Note that this is not some random gripe about an extraneous error. And I get that my evaluation of the "worst delivery company in business" is subjective, as some people may be extremely happy with UPS's service. Like I said, things that can go wrong will go wrong. However, delivering things to may apartment should not be an issue when everyone else doesn't have a problem. For example, the same day--and roughly the same time, apart only by 10 minutes--I bought two different items from two different vendors: one of them uses UPS; the other uses FedEx. My FedEx package came exactly one day after I ordered. I placed my order on Thursday at 12:30 AM (I was up late), and my package arrived on Friday at 11:30 AM. Same price, much faster and door to door service. There is no comparison.

I already called UPS and placed a complaint, which I had a bit of a problem trying to figure out who to call to file my grievances. A customer representative said someone will call me tomorrow. We'll see how their customer recovery process works (this is basic service marketing stuff). Regardless of what they say, I will post a follow-up, in case you are interested.

As for my package, I'm picking it up tomorrow morning. What's my package? It's a 100 GB, 7200 rpm hard drive from my ThinkPad X60s laptop. The sooner I do the upgrade the better; hence, my urgency to get this package.

5:43 PM | 4 comment(s) |

This page is powered by Blogger. Isn't yours?

© Jose Sandoval 2004-2009