Rusty's Blog

Thoughts and musings of someone who's not sure what 'normal' is…

Saturday, September 26, 2009

Male, guilty as charged.

There’s a long standing, and in my opinion in very bad taste, joke about men. The punch line goes “Of course he’s wrong. He’s male.”

What is he wrong about? Really it doesn’t matter.

If it were about any other topic, race, religion, or even politics, a declaration like that would be considered inappropriate. In many cases it would be considered hate speach.

In a few year, or decades, or for the pesimist a few centuries, we may get to the point where an individual who is ignorant of the values and expectations of groups or other even individuals they are dealing with can be sat down with and have the problems with what they have said, or done explained in civil terms.

I do say ‘we may.’ It certainly isn’t today.

No, in today’s world it’s far more entertaining to blow up, attack the person for perceived injustices that they didn’t commit.

I freely admit that there are a large variety of different traits that I find attractive in different women. And some traits that I find attractive in some women I don’t find all that attractive in other women. I would be very surprised if a significant percentage of people reading didn’t think I was talking about physical characteristics. Face, hair, breasts, waist, hips, legs, feet, whatever. I know of people who are fascinated with hands, characteristics of eyes, and so on. That’s fair enough in that a large percentage of men are going to be first interested in another person for their physical characteristics. And there are entirely too many men and boys for whom that is the only thing of interest.

When it comes down to it though, my world is not populated by people who would be considered models. Oh there are a few, but the vast majority of the men and women that I interact with, are not likely to be walking the cat walk any time soon, unless it’s to adjust stage lighting. The fantasy of taking a hot model to bed, or wherever we take each other, is pretty much likely to stay just that. A fantasy.

I was born in the mid 60s, grew up in the 70s and early 80s. My second company commander when I was stationed in Germany in the army was a woman, and I saw entirely too much of how men and women in the company often didn’t give the respect to her that they would have given to the previous company commander, though that changed as their experience with her as a commander grew. She was very good, and one thing she didn’t accept was women in her command trying to use their gender to provide excuses.

As I was growing up, my mother helped to establish a chapter of the League fo Women Voters in Houston county, MN. She marched in support of the equal rights ammendment, and left a job she had been working at for several years because her boss hired a male fresh out of school with no experience in the field at a pay rate higher than she had been earning.

Perhaps the wisest negative view on the Feminist movement that I’ve encountered personally was expressed by a professor I had who’s experince included working for McDonald Douglas on the F-101 fighter as a design engineer. Her opinion was that the thing that the feminist movement got wrong was eliminating the stigma that women were brandes with for being free sexually. It was her opinion that instead of eliminating the stigma, the effort should have been to place an equal stigma upon men who did wrong, either by raping women or abandoning women whom they had been having sexual relations with, either because she became pregnant or because she was suddenly ‘inconvienent’ for some reason.

While I don’t entirely agree with her, I do see her point, and would note that my experience of the direction that the military was moving, regulation wise, appears to be consistent with that view. Also the way that laws and cases related to rape and stalking have gone has begun to reflect the public view that there really is no such thing as ‘asking for it’ when it comes to these actions.

A part of me is somewhat stuck in the 70’s and early 80’s. It is now almost the end of the first decade of the 21st century. I know enough at this point to believe that if effective imortality is only 20 years away as has been predicted by Ray Kurzwell and a few others, that we are very likely to be in significant trouble in the next hundred years. There are entirely too many people who will be alive then, for whom the lessons of the past 2 decades have not been learned.

I don’t know if I will be one of them. A part of me seriously dreads the possibility. I think that has to do with the fact that I’ve lived emotionally alone for the past 20 years, and part of me dreads the possibility of living this way for centuries. That’s not all of the reason by any means, just the easiest to explain.

A different part of me looks at the possibility and wants to be there to see humans as a collection go through the changes, and improvements that are possible. I would like to be a part of that. Though I will admit that I suspect that a lot of what I ‘know’ is likely to be stomped on along the way. (Hope would suggest that the better parts of that are re-learned.)

I as an indivicual can be, and in many cases are, wrong. I make mistakes in how I communicate with people, and at times will offend them. Sometimes it’s intentional, but entirely too often it’s a product of my lack of experience in a situation and being too eager to help. Most of the time if you find something I’ve said to be offensive, and you are not someone I would intentionally joke with that way (usually that’s limited to family) I’ve probably meant something else, and a quick note of ‘I find that statement or joke offensive, did you really mean…’ will be responded to with respect and consideration.

Yes I’m male. I also happen to be White, Anglo-Norse, Protistant (at some level, I grew up in a christian, non-Catholic environment) and have a whole bunch of other bagage, geneticly and environmentally. Perfect I ain’t, but the imperfections are part of Me, not who I grew up around, work out with, where I went to various schools or how they were funded, what color my eyes or hair are. I’m pretty sure that my mistakes are not specifically a reflection on my gender either. They all have input into what my makeup is, and undoubtedly have something to do with my past and future, and how my mind works. But singeling out my gender is about as silly as suggesting that ‘women are bad drivers’ or similarly inane platitudes.

We all have to make judgements on how we are going to interact with the people around us. It is a defense mechanism which protects us from cheap con-artists and the like. It’s based on our interactions with others over time. Likewise our expectations are set based on how we understand others have been affected by various people. As a result, initial expectations end up being set. Some people choose to live within those initial expectations. They measure the responses and the interactions they have with others agains those expectations but do not change their expectations as a result. That is what prejudice really is. Appropriate interaction treats each person as their own person. Their actions are their own. There may be cultural and religious or other influences on thos actions, but with the exception of a very few limited situations, you are unlikely to know what those influences are going to be ahead of time.

So yes I am guilty of being male. That doesn’t mean that I get to carry all your bagage about men on my back. I have enough damn bagage of my own that I am fighting with.

posted by Rusty at 4:52 am  

Friday, September 18, 2009

Problems with the ven diagram.

I won’t post it here, but you can find a ven diagram out and about that shows the overlapping ‘areas’ that identify if you are a geek, dork nerd, or something else. (I forget which, but at the same time dont really think it’s important.)

There is a problem with this diagram which is endemic to using ven diagrams in a situation that is not an ‘either/or’ situation.

Let’s take the ‘technologically literate’ option. Are you technologically literate? On what basis does one make that judgment? There was a time when you might look at the living room VCR and you would be able to tell because if the person or household didn’t have a technologically literate person there the clock would be blinking 12:00 or something. Right? Now almost no one has a VCR. TiVos and dvd-players do not have a clock display. Cable boxes might have a clock, but it gets it’s time from the cable company. So, no more worries there.

If you think about it, there are few outward signs as to whether someone is technologically litterate these days. Having a smart-phone is more of a ’status’ symbol or style element than indication of being technologically competent. Especially when you realize that a significant number of people carry them because their boss is paying for it for them.

To know whether someone is technologically competent or not you pretty much need to sit and chat with them to find out face to face. Oh, they might give away incompetence early on, but just because they haven’t doesn’t mean they are. The thing is even when you sit down with them and decide they are technically competent, it then becomes a question of how competent. You’ve just decided that they know how to turn on and off a computer without causing problems. Perhaps they can find a search engine on the web. Does your definition indicate that they can dig into Firefox’s latest release and find and patch bugs? There is a spectrum of ‘competence’ and just because someone is capable of some things does not mean that they are capable of everything.

The ‘difference’ between ‘geek’ and ‘nerd’ is one of social competence. Geeks are (or tend to be) socially competent. Nerds are not. Actually the Nerd end is not just not being competent socially, they don’t know that they are not.

I’m actually somewhere in the middle of this spectrum, and you probably are too. Most of us have encountered situations where our not being aware of a social gaff we have made, or more likely becoming aware of the fact that we have made a social gaff, has left the situation in an Awkward position. The ‘That came out all wrong’ state is hardly unusual.

The thing is that there are very few people who are completely unaware of being social misfits, just as there are very few people who never make mistakes socially, or are perfectly prepared to turn what looks like a gaff into a wonderful experience for all involved.

Most of us have some level of competence socially. We pretty much need some to get a job these days. However we can each point at someone we probably know who either ‘gets it’ more, or less than we do. And there are days when we feel like we ‘get it’ as well as days when that’s furthest from the truth.

Honestly, it’s part of being ‘normal.’ And while it is embarasing at times, it’s also one of those things where at times you just realized that for the moment, you’re on top of the world.

posted by Rusty at 10:52 am  

Sunday, September 13, 2009

Gleaning your IP address.

So you’re out and about. Having fun with your G1 (or other android phone) you’ve taken some pictures and you decide that right now you want to take one of thoe pictures and use it as the wallpaper on your laptop.

Well, you can e-mail it to yourself. Or you could post it on your picasaweb account, or well “neither of those really interest me.” you say? Well, if you had been thinking this morning when you left the house you probably would have packed along a usb cable to like up your computer to your phone, but if you are like most other people, you’ve decided that that really isn’t something you want to carry today, and you can always take care of that tonight. Or perhaps you have one of those micro sd-card to usb adapters on your keychain? No. Bummer.

Wouldn’t it be great if you could just fire up a small web server that points at your photo album? Point your web browser on your laptop at it and download the picture you want?

Actually if you have installed the Android Scripting Engine (ASE) you can.

ASE includes interpreters for Bean Shell, (a Java based shell scripting language) Lau, (found in some Linux distributions) Python, (pretty much everywhere these days) bash, (also pretty common) and more to come. Now I’ll be one of the first to admit that all of these are probably anything but feature complete. If you are thinking ‘Hey I’m going to write a push button app with custom lables using tk!’ sorry, tk is not included. However if you are interested in talking to the network, get information from features of the phone such as the location via gps, or the orientation of the phone (face up/down, on the side, etc) you can do some pretty interesting things. In time the screen may be dot addressable, and you may be able to do gui stuff, but it’s not currently being planned.

I’ve not done anything with Bean Shell, and not all that much with Lau. Both have fans and from what I have seen are likely to be used fairly heavily. However I do like to dabble with Python, so you’ll find most of my blog postings here relating to ASE are going to focus on Python.

But we’ve got that photo to get to the laptop. Right? Lets work on that.

Perhaps you haven’t installed ASE but that might work for you? Poing your browser at http://code.google.com/p/android-scripting/ and you should see a QRcode bar code on the page. If you have the BarcodeScanner application istalled fire it up on your phone, point the camera at the bar code on the screen, and you’ll end up in the application installer looking at the install helper for ASE.There are additional instructions that you will want to follow to add in the actual python interpreter as well as some sample scripts.

Now since the 0.10 alpha release of ASE, not only can you download the application itself via qrcodes, but you can enter small scripts that way as well. Launch ASE, hit ‘Menu’, pick ‘Add Script’ and select ‘Scan Barcode.’ The barcode reader will come up again, point it at the following qrcode based on the script posted by Mrflakey to the ASE-Scripting mail list:

httpd.py

httpd.py

You’ll actually be able to run it immediately, however it’s always a good idea to take a look at the code. It should look something like this:

httpd.py
import SimpleHTTPServer
from os import chdir
chdir('/sdcard/')
SimpleHTTPServer.test()

If all you wan to do is browse your pictures, then you will probably want to change the chdir line to read something a bit more like “chdir(‘/sdcard/dcim/Camera’)”

Now there is only one ‘issue’ left. “How do I get to the server?” Well, to tell the truth, that has been the real reason for this posting.

<hr>

The first time I used the script and downloaded content from my phone, the way I found the IP address for my phone was to open a terminal session on my dhcp server and looked for the message indicating that my phone had just been assigned an address via dhcp. That’s all well and good for when I am at home, but if you are out on the road, you probably don’t have that ‘advantage.’ Last I checked T-Mobile wasn’t exactly giving me access to their system at a level where I could get the IP address that my phone was using from their servers. Not really expecting that any time soon either.

If you dig around, you can find the ip address, but wouldn’t it be nice if you could present it as part of that httpd.py script? Actually, you can. But it’s a bit more work.

<hr>

The Android platform allows you to see the current IP addresses on your phone by using the command netcfg at the command prompt. You already know about 127.0.0.1. If you don’t a brief note, don’t bother to try to download anything from your phone by pointing your web browser on your laptop at 127.0.0.1:8000, it won’t work.

There are 6 different ‘interfaces’ that may have an IP address on your phone.:

$ $netcfg
lo      UP      127.0.0.1       255.0.0.0       0x00000049
dummy0  DOWN    0.0.0.0         0.0.0.0         0x00000082
rmnet0  DOWN    25.96.178.24    255.255.255.252 0x00001002
rmnet1  DOWN    0.0.0.0         0.0.0.0         0x00001002
rmnet2  DOWN    0.0.0.0         0.0.0.0         0x00001002
tiwlan0 UP      192.168.0.2     255.255.255.0   0x00001043

The above is something ‘like’ what is deisplayed on my phone. Presumption being that I’m at an internet cafe with wifi access and I’ve gotten both the cell phone and my laptop on the wifi, I would simply point my web browser at http://192.169.0.2:8000/ after launching httpd.py on my phone and I would be up and running. (caveat the internet cafe or wifi provider has to have enabled the ability of wirelessly connected customers to communicate directly with each other.)

If rmnet0 was UP rather than DOWN, and unless you have a rooted phone or a more recent phone than the G1 you will find tiwlan0 will thus be DOWN, and the internet cafe allows internet browsing, I could point my browser at http://25.96.178.24:8000/ and I would be able to browse the content as well.

On the other hand that’s a couple of extra steps. First you get the IP address of your phone, then you launch the server, then you hope you remember what the IP address was so you can point your laptop at the address. Annoying right?

Well we’re going to add two bits of content to the httpd.py script in a bit, one imports the library we are going to write, the other displays what our IP address is. But in order todo that we need to add a script to the phone. Let’s call the script ‘netip.py’.It’s going to have to do a few things.

  • Get the list of ip addresses and interfaces from the phone. We’ll call the program netcfg to get that.
  • ignore the ‘lo’ interface.
  • return the interface and ip address of the UP interface(s) or
  • return the ip address of the UP interface(s)
  • be able to show that the library functions.

There are some contitions that over the long term you will want to address as well, but I’m not going to for this script. What do you do when you are in a place without cell service or wifi? Currently the script does not address that.

Ok, we are going to import the following libraries.

import os, sys, android, string, time

os and sys allow us to talk to the operating system, android because the script will want to be able to show us things like what IP address we got using the makeToast() android call. The time librarry we are using to allow us to display two or more results with a delay between them. We are going to be using the string library to manipulate the output of the system call to netcfg. but we better get that first:

def colint():
    status = []
    a = os.popen('netcfg','r')
    while 1:
      line = a.readlines()
      if line:
        status.append(line)
      else:
        return status
        break
    return status

Ok, status is set to an empty list. the os.popen() call tells the phone to run the netcfg program and we are going to ‘read’ the results from the system call. Start a while loop. ‘1′ is always ‘true’ so we’ll use that for the test. In the loop we assign ‘line’ to the result of doing a readline on a. Now if the result of that is true, i.e. we got something other then an end of file mark we append the content of line as a new list entry to status. if we don’t get anything from the readline we return the status and break out of the while loop. The final ‘return status’ is not necessarily required, but I would rather have the function return a blank status if the while fails for some reason. Up to you.

Of cours we’re really only interesetd in entries that have a status fo UP right? so let’s get rid of the rest.

def upips(work):
    status = []
    a = 0
    while a < len(work[0]):
      if "UP" in work[0][a]:
        status.append(work[0][a])
      a += 1
    return status

This time we call the function with a list and presumably in that list there are some entries that have the string ‘UP’ in them.

And of course we are not interested in the ‘lo’ interface so we’ll clean that out:

def nolo(work):
# given a list of strings (with embeded '\n') break as needed, return
# list of strings w/o 'lo' in them)
  status = []
  a = 0
  while a < len(work):
    if "lo" in work[a]:
      a += 1
    else:
      status.append(work[a])
      a += 1
  if len(status) == 1:
    rets = status[0]
    statusl = rets.split()
    status = statusl[2]
  return status

If there is only one interface with an up status (other than lo) we also break up the string and only return the IP address. That’s done by calling the ’split’ string function and assigning the resulting list to ’status1′ then status will get the third entry (first is at 0 and is the interface name, ‘lo’, ‘tiwlan0′, etc. the second at 1 will be the up/down state.) Otherwise if it looks like there are multiple interfaces up besides the lo interface we will return a list of the entire strings.

The rest of this can either be considered ‘test’ code, or you can call the next to functions directly. The labels are a bit misleading. At an early stage in development these functions actually displayed the IP addresses. I decided later on that I really just wanted them to return them to the calling function. At some point you may be interested in binding to the up interface. The two functions are displayUp() and displayNoLo() which returns all up interfaces, or all but the lo interface. You will probably be most interested in the displayNoLo() function, but who knows.

def displayUp():
  nets = colint()
  nets = upips(nets)
  return nets
def displayNoLo():
  nets = colint()
  nets = upips(nets)
  nets = nolo(nets)
  return nets

Now then it’s always a good idea to include in a script some code to run to make sure that it all works. Since each of the two functions above will call the earlier functions we really only need to call those two functions. However we are going to make use of the makeToast() android call so we need ot initialize android. Also makeToast() displays a popup for about 2 seconds so let’s give it a chance to complete between calls to it, and exiting the program.

if __name__ == '__main__':
  droid = android.Android()
  droid.makeToast(displayUp())
  time.sleep(5)
  droid.makeToast(displayNoLo())
  time.sleep(5)
  droid.exit()

The ‘if’ conditional at the top is the first line that will be run if you execute the program directly. I personally recommend including all of this. At the very least you will be able to look at how various functions can be called later on.

Ok, if you have a clean camera lens, you may be able to load the entire program via qrcode. Again launch ASE, ‘Add Script’ from the Menu button, and ‘From Barcode’ Once that is up, point the camer at the screen and see if it will read the following bar code:

netip.py

netip.py

And a modified httpd that uses the code is at:

httpd2.py

httpd2.py

If you would rather, the full text of the scripts are at http://www.beresourceful.net/~rusty/android/netip.py and http://www.beresourceful.net/~rusty/android/httpd2.py

Now if you have an available network connection and access to the internet, you should never be unable to get documents off your sdcard for your Android based cell phone.

Once you run a program that imports a python library you will end up with both a .py and a .pyc of that file in your list of scripts. The .pyc edition can be run the same as the .py, but is a ‘compiled’ version of the program that speeds up execution of library system calls in the future.

You may wish to create a ’shared’ folder on your sdcard that you point httpd2.py at instead of pointing at the entire card. Or as noted earlier just point at your /sdcard/dcim/Camera/ folder for images only. The reason for that is that there are no restrictions on who can download content from your phone while httpd2.py is running, except for the limitation that it is in a subdirectory of the current directory. You may also want to change the print out to read more like ‘print “connect to http://”, netip.displayNoLo(), “:8000/”‘ to give you a reminder that it is on port 8000 and that you use a web browser.  If 8000 is entirely too likely for someone to connect to, you can point SimpleHTTPServer.test() at a different port. I’ll leave learning how to do that to you. If you don’t have a rooted phone, you can’t point at anything below 1023, but you could point it at 58080 if that works better for your mental image.

Enjoy, and play around.

posted by Rusty at 3:30 am  

Tuesday, September 8, 2009

Prize winner…

I certainly wasn’t expecting it, but tonight I won my choice of one of three radios, or a 32″ TV. Considering the fact that I don’t watch all that much TV, that really means that I have my choich of the three radios.

The odd part is that I don’t currently have a lot of opportunity to make much use of even that. I won’t go into the issues involved, suffice it to say that getting an antenna in the air.

In a way it pushes a bit towards me looking at getting some land in an out of the way place, which has been a thought in my head for some time anyway.

Well research to do tonight, and thoughts to consider for the months to come.

posted by Rusty at 10:29 pm  

Powered by WordPress