Friday, March 21, 2008

Language Mismatch

Al Sweigart found my rant about Python, and responded almost instantly (the same work day...)

I was impressed, and thankful for the time and attention that resulted from the serendipitous intersection of my venting frustration, and his proactive preparation for advocating Python at work. I was impressed by the community that suddenly showed up at my first public sign of angst.

Now that I've had time to calm down, and consider the advice given... I'm still disappointed in Python... but it doesn't suck anymore. Al is right when he says
Your Ignorance Does Not Make a Programming Language Suck

I'm surprised by immutable strings in Python. It was frustrating hitting an unexpected roadblock in what otherwise seems to be a cool programming language that I'm just getting into.

I can do what I want, but not in the way I had intended. I have to use a kludge to work around the immutable strings in Python, or just give up and find another way. Needless to say, it's frustrating when a language just doesn't match your expectations... it's an impedance mismatch.

I've read PEP 3137 - Immutable Bytes and Mutable Buffer, and at first I was hopeful that change was in the air, and I could really LIKE python again... but alas... the immutable string is here to stay.

Python has so many cool features, it's really strange that they can't handle the idea of strings that are variables, or variable parameters, like Pascal. Even a namespace hack to allow access one level up would be better than nothing.

I'm finding it really hard to let go of string variables, and I guess that's just a mismatch for me to be aware of in the future.

Perhaps I'll have to implement a sourcebuffer class, with functions like expect, getchar, getstring, getnumber, getfloat, etc.

I've managed to sidestep the issue for now by using split and some other tricks.

I do like the trick given in the comments:
a,c = s[:1], s[1:]
Of course, it would be nice not to have to keep putting the string back into itself... which I think is really my main objection to immutable strings. Why should I have to keep manually putting data back into the place it just came from? Doesn't that increase the risk of putting back into the wrong place?

Oh well... it's interesting having my 15 minutes of fame over a programming issue.

Thanks to everyone for your time and attention.
--Mike--

Virtual Focus - An Introduction




This is my first try at demoing virtual focus, to explain a bit about what you actually see when you're looking at one of the photos.

I took 40 photos, moving a about 3 foot to the left after each one. I then used the latest Windows beta of Hugin to align them. I then average the photos to generate the final image, which is then cropped to taste.

Tuesday, March 18, 2008

Python rocks!

Ok... it still sucks that I can't do something as simple as make a PullChar function the way I want... but at least I can do a hack thanks to Albert Sweigart and his quick reply to my earlier post today.

I always end up implementing the same library of things when I want to handle text... and this won't be an exception.

I've got a weird set of text (.pto files from Hugin) that I want to play with... they don't follow the normal python conventions for data because the program is written in C++ (I think)...

I need functions that can PULL text off of a buffer... and it looks like I'll be using the workaround to get the job done. My other alternative is something like writing a class to handle strings... which seems very weird to me, considering strings are built in.

Oh well... there's lots to like about python... but lack of variable parameters is something I'm really going to miss.

Credit Cards - still retarded

Here we go again... yet another company has data copied, and we're supposed to worry about it:

http://online.wsj.com/article/SB120578480456942847.html?mod=googlenews_wsj


Why should this matter? If the credit card companies operated like adults, this wouldn't be an issue, because the purchases would have generated cryptographic one time use receipts all around, and would be completely worthless for anything at any other store.

There is no reason on G-d's green earth that knowning a 16 digit number, name and zip code should allow someone to rip me off. It should be much harder than that... the technology has been around for years... yet we still allow this shit to pass for acceptable. WTF?

Python sucks!

All I want to do is to take a string, and pull the first character off of it in a function....

like this:

def pullchar(s):
"""pull a single character from the front of a string"""
c = s[0]
s = s[1::]
return c



Can python do this? Not really...

Why? Because there doesn't seem to be any way to pass a variable to a function...

WTF?

Monday, March 10, 2008

Fundamental Tribes

I heard an author on NPR over the weekend talking about how 9/11 caused him to rethink his identity, and he said something that really sums it all up

"I saw the end game of tribalism -- it ends up with people flying planes into buildings."


He pointed out that our immediate response to 9/11 was tribal.. the whole "You're either with us, or against us" theme is also tribal.

I'm sick of it... it's counterproductive, and it's killing my country. My identity has many aspects, being a Citizen of the United States is only one of them. I'm a father, husband, son, brother, friend, and many more things. Thus I belong to many tribes.

I'm a photographer... with many more photos than most humans have ever taken in their entire lives... so many that I can't fit them all in my laptop. There are so many things to see, learn about, and remember... those little clicks help.

I'm a husband... and father... two roles I'd not imagined myself ever filling.... yet outrageously happy in both of them.

I'm a son and a brother, roles I've had as long as I can remember.

I'm sometimes a teacher, and always a student of the world. I've got the curiosity that Feynman and others talk about... I always want to know how and why things work the way they do.

I'm a Citizen, awakened out of my slumber by the massive failure of government on 9/11.

I'm a person, amazed by the beauty of nature, the complexity of the universe, the human soul, and the world around us every day.

I'm one of six billion souls on this world, clinging to the thin crust of rock floating on a molten pool of rock 7000 miles in diameter, breathing a wisp of air trapped here by gravity.

I'm middle aged... half way to the end of my life... so far I've been very fortunate that I've learned to appreciate my good fortune. 8)

I'm a blogger... with a few readers, and the occaisional hit... the 21st century equivalent of a diarist. You could also call me a journalist, but I don't have pretensions of objectivity.

I'm a Hoosier... but I don't know the words to the Banks of the Wabash, and I do know that pi isn't ever 3.2. ;-)

So... there are a lot of tribes I belong to... and more to join every day.

When you say I'm either with you, or against you, you're using the wrong word.

I'm with you... AND against you.

You get to choose if you want to focus on our shared identities, or to make an enemy.

Wise men seek to strengthen bonds, and not to break them.

Saturday, March 01, 2008

What comes after blogs?

I post here on a bunch of different themes related to my many roles in life... Person, Husband, Father, IT Guy, Scientist, Photographer, Citizen, etc... and they all end up here. So how do I keep posting, yet not bore everyone with the stuff they don't care about?

Doc Searls addresses it on the reader side by using Google to find blogs, instead of using a set of favorites like I do.

How do you find things to read? Am I typical, with my set of blogs, or not?

What comes next?

Money in the bank??

The current H3 report from the Federal Reserve shows the Feb 27 shows

42,939 million in total reserves

- -17,295 million in "non-borrowed" reserves… (subtract the negative amount)..

---------------------------------------------------

60,234 is the amount borrowed - almost exactly the amount in the term auction credit

This means that banks have borrowed (60234 / 42939 ) of their reserves…

In other words the current reserves held by the banks are %140 borrowed money!


Now the purpose of reserves is to keep banks honest, and to make sure they can pay you when you want some of your money back.

I could be wrong.. but this seems to imply that for every dollar in the bank you have... they've borrowed 14 cents to keep even with the 10 cents they are supposed to have.

Am I the only one who thinks that's a problem?