May 31, 2007

i'm learning java..

Everyone who reads this for my fitness or ramblings or whatever, please indulge me for a second while I do this..

any java programmers out there?

The assignment, from Thinking in Java by Bruce Eckel:
A vampire number has an even number of digits and is formed by multiplying a pair of numbers containing half the number of digits as the results. The digits are taken from the original number in any order. Pairs of trailing zeros are not allowed. Examples include:
1260=21*60
1827=21*87
2187=27*81
Write a program that finds all the 4-digit vampire numbers."


so I wrote this from scratch. It works, and produces the correct result, but I'm sure there is a more elegant way of doing it- especially with getArrayOfDigits(). I don't know if there are any java developers who read my blog, but if there are, a little criticism would be appreciated.

import static net.mindview.util.Print.*;
// the print() method is identical to System.out.println().

public class Exercise10 {

public static void main(String[] args) {

for (int i=1000; i<10000;i++ )
{
if(i%100==0) continue; //weed out the numbers with two trailing zeros
int[] result = isVampire(i);
if(result != null) {
print(result[0] + "*" + result[1] + "=" + i + ". It's a vampire number");
}
}
}


private static int[] getArrayOfDigits(int i) {
//I am sure this can be done better
int[] a = {0,0,0,0};

a[0] = ((int)i/1000);
i=i-a[0]*1000;
a[1] = ((int)i/100);
i=i-a[1]*100;
a[2] = ((int)i/10);
a[3]=i-a[2]*10;

return a;

}


private static int[] isVampire(int i) {

int[] arr = getArrayOfDigits(i);

for(int a=0; a<=3;a++) {

for (int b=0;b<=3 ;b++ ) {
if(a==b) continue;

for (int c=0;c<=3 ;c++ ) {
if(a==c) continue;
if(b==c) continue;

for (int d=0;d<=3 ;d++ ) {
if(a==d) continue;
if(b==d) continue;
if(c==d) continue; //this series of continues can probably be done better, too.

if(GetTestNumber(arr[a],arr[b]) * GetTestNumber(arr[c],arr[d]) == i) {
int[] done={GetTestNumber(arr[a],arr[b]), GetTestNumber(arr[c],arr[d])};
return done;
}
}
}
}
}

return null;

}


private static int GetTestNumber(int a, int b) {
return ((a*10)+b);
}

}


thanks..
-steve

May 29, 2007

big, dumb bicycle moron coming to a street near you!

on may 25th:

spent 30 minutes repairing a flat today that i got for riding too far over the shoulder of the road. who knew that i was supposed to ride in the traffic lane?



actually, i spent 10 minutes repairing the flat (caused by a staple, which i saved), and 20 minutes trying to re-inflate the tire. i couldn't seem to get a good seal on the valve - which had a presta to schrader adapter on it, because the tubes i bought had stems that were too short..



when i finally got the thing inflated, i couldn't remove the pump from the valve. imagine my frustration when i watched 20 minutes of effort hiss out of the tire as i pulled on the valve like a wild crazy mad man. yet my screams of frustration were only drowned out by the 55mph traffic headed north out of the city for memorial day weekend.



so i did what any self-respecting man in my situation would do. i called my wife. to come get me and the bike. in the minivan.



in the 15 minute interim, i did mange to get the pump off the valve. actually, i managed to snap the valve off the stem (oops), ruining the tube, before getting the pump off the valve with a gentle tap on the guardrail. figures.



i have one more spare tube with the short stem, but i think that's going straight into the garbage. I put a long-stem tube on the wheel when i got home. Now all i have to do is inflate it. yay.



when it comes to bicycles, there's something about me and mental retardation.


Then, yesterday:

so..



i figured out the clipless pedal thing fine. read enough online accounts to know that i should practice snapping out of them while moving. it wasn't exactly brain surgery, and i managed to not fall down the first time. and for a whole week, i was golden and really getting the hang of it.



then, not one hour ago, i was riding north on franlkin turnpike about 3 miles from home when i came to a traffic light. i clipped out of my right pedal, no problem. then, to my horror, as soon as i stopped, my center of gravity was apparently to the left of the bike. i was still clipped in on the left side. 5 cars in line at the light saw the whole thing.



awesome.


oh, and by the way, i've signed up for a 100-mile bike ride THIS SATURDAY. i've never ridden a bike more than 25 miles in my life, and that was two years ago. one week ago, my bike was still locked up in the basement, tires flat because it hasn't been moved in almost two years.



at least the 100-mile tour is flat and scenic - from babylon to montauk. the weather is supposed to be nice, too.

May 23, 2007

errata..

popular science bit directered me to http://www.decluttered.com/, which was my inspiration for spending four hours on monday doing this:


(note the hinged bottom - i can swing the whole thing down and access the back!)


back on the diet, 1000 calories or so per day. as of this morning i'm already just 3 lbs away from where i was 4 weeks ago (when i left for california and experienced excessive gluttony.)


other stuff:
lenny dykstra washed my father's car


and he changed the oil, too


It's pretty surreal when the LA Times does features on a guy you used to hang out with.
http://www.latimes.com/features/magazine/west/la-tm-flash19may13,0,4021008.story

A Pat Cooper promotional video:
http://vids.myspace.com/index.cfm?fuseaction=vids.individual&videoid=2030779097

supporting photos for my claim to the TSA about the missing iPod.
http://tursi.com/ipod

gnarly-looking thunderstorm, taken from 36,000 feet:


that was a big train set:


my brother works at starbucks. so does my sister. my son does not.


the mountain that almost killed me.. i had my first beer in 2007 when i got down. the report is halfway done.


that's all for today.

May 21, 2007

birthday blog

a couple of quick updates:

1. i turn 31 today!
2. on saturday, i returned from 3½ weeks in california
3. damage from california includes just over 7 lbs of gained weight, mostly from carne asada burritos.
4. some fucking fuck douchenozzle asshole bureaucrat piece of shit from the TSA stole my ipod out of the checked luggage!
5. trip reports from humphrey's peak (state highpoint#28) and yosemite are coming.

May 18, 2007

state highpoint #28

Arizona..


This one was pretty scary. Thunderstorms above treeline. I'll write more later.

My highpointing web site

-steve

May 9, 2007

paaaart 4 - gas stations and ghost towns

(gee, i really oughta proofread these before posting them)

we're still in day 2 (green)




I was surprised to hear from a friend that the best food in the eastern sierras was at a mobile gas station in Lee Vining, next to Lake Mono. I believed him, but was astounded. It was immediately a "must-stop" location.


Unbelievably, it lived up to expectations. we wanted more, but decided to check out some scenery instead.


This picture is looking back on the gas station and Mono Lake from the road going to Tioga Pass. It is the southernmost sierra pass north of bakersfield, some 200-250 miles to the south. It is closed every winter, and of all the sierra passes, tioga is the latest to open in every spring. It was still closed. In fact, since Sonora pass (the next pass north) was closed the week we were there for construction, there was no way to cross the sierra's between bakersfield and lake tahoe.


Driving up the pass to where the road closed, we were treated with some spectacular scenery in lee vining canyon.


looks like some fun BC lines..


But we didn't ski any BC lines. We instead went to Bodie, California.


Located on a windswept, barren, dry plateau at 8000 feet, Bodie is one of the best-preserved ghost towns in the country.


The official status of the town, assigned by the state of california, is that it's in "arrested decay" - that is, they try to keep it in whatever state of decay it was in when they made a park out of it. Only about 5% of the buildings remain. at one point, the town had as many as 10,000 people living in it.


For a $3 admission fee (and $100 in gas to get there), you can be treated with the opportunity to peer into decades-old windows


... and see stores with shelves still stocked,


... restaurant kitchens with all their equipment intact,


... electric transformer stations with their equipment (which was a technological breakthrough at the time) preserved,


... schoolhouses with books and papers still on the tables,


... bars with their final patron's beer bottles sitting out,


... dusty dishes, tables and chairs in the residences,


... even an undertaker with his equipment intact,


... not to mention the evidence of how the residents entertained themselves,


all in "arrested decay."


all of this makes it a favorite spot for photographers to try to make these colorful images the highlights of their still-life portfolios.


it was a really cool place. definitely worth spending at least a few hours there.


afterwards, we headed out up to the tahoe area so we could get west of the sierras before dark.
Tomorrow, yosemite.

May 8, 2007

roadtrip part 3

more pictures from the roadtrip we took last week..




we opted not to buy gas in death valley.


by accident, we happened to drive the entire route of the badwater ultramarathon, one of the most intense endurance events in the world.


the 135-mile course traverses three mountain ranges (this pic is looking back on the first range, from the second range), in july, when he temperatures are always at least 120º in the valley.


after starting in badwater, the lowest point in the western hemisphere, the third mountain range is the mighty sierra nevada - the race finally ends in high-elevation pine forests at the trailhead to mt whitney, the highest point in the contiguous US. So as if running 135 miles, starting in death valley, in the middle of summer, isn't bad enough, the course also includes about 13,000 feet of vertical gain, and 4700' of loss. nasty.


we both have had enough of the desert, so the next day we headed up the eastern sierras, making our first stop at the long valley caldera.


32 kilometers long and 17 km wide, it is one of the largest collapsed volcanoes in the world.


the area is geologically very interesting, especially since there is a lot of evidence at the surface of the volcanic activity going on thousands of meters below. these are hot springs - the water emerging from the ground right here is about 120ºF.


There are also faults (pictured here) and fumerols emitting sulfur gas that stinks like rotten eggs.

May 6, 2007

lowpoints & yasso 800s

here is an interesting article about yasso 800s:
http://www.thefinalsprint.com/2007/05/yasso-800s-training-tool-or-test/

different subject--

i talk so much about highpoints.. but many highpointers like to talk about "lowpoints." personally, i don't see the point of visiting the lowest point of every state, since most states have lowpoints like "the jersey shore" or "the south shore of long island" or "the southernmost point of the shoreline of the mississippi river." but there are exceptions - lowpoints that are actually interesting - and california's is one of them:



badwater, in death valley, is actually the lowest (dry) point in the western hemisphere. interesting place.



and, as the name implies, there actually is water there - not much - in fact, little more than a salty puddle fed from the area's water table..



10,000 years ago, the entire area was filled with an enourmous lake - called "manly", which was created by melting glaciers, mostly from the sierras, two mountain ranges to the west.



anticipating your next question, it topped out at about 110º the day we were there.



My camera's zoom was set to maximum in this photograph. fun representation of sea level, 282 feet above us.


and.. if pictures of death valley bore you to death, maybe you'll find this picture, taken in (relatively) nearby pahrump, nevada, interesting:



tomorrow - pictures from bodie. and maybe some yosemite pictures, too.

May 3, 2007

that was a big tree



more photos coming soon..