I Don't Know Why I Wrote This
@ 2010-02-14 20:45:01
Filed under: Code Personal Python Tech
More or less a dictionary store on the network with very simple authentication. I don't know what got into me ... I had no intention of writing this ... hopefully it will be of use to someone. It is a little messy, but it works on Python2.6.
digg it
seed it
del.icio.us
ma.gnolia
Comments: 0
Mercurial Is Teh Awesome @ 2009-12-28 11:28:58
Filed under: Code Personal Tech
I'm really digging it. Just for the heck of it, here is my global config.
digg it
seed it
del.icio.us
ma.gnolia
Comments: 0
RDU Airport Security Frustration @ 2009-11-25 05:19:40
Filed under: Frustration Personal
I usually will put up with a decent amount when it comes to travel. Lots of people are trying to get to many places and everyone is afraid they won't make it. I've been frustrated by the security checks at airports before, but today was a bit different. It started while I was waiting to put my stuff on the belt. Two security checkpoint guys were giving the instructions at the same time (though not saying the same thing at the same time) about 5 feet from each other. If I didn't know what to do (say, if I wasn't from the US) I wouldn't have been able to figure out what they were saying. So I get my bags on the belt and walk through the metal detector. Usually that means 'yay, you don't have anything crazy on you.' Not this time. I don't know if this was added in the last few months but I got a pat down to verify I didn't have anything. OK, so maybe it's an added safeguard, I'll go with that, but what happens next really irks me. My stuff 'clears' except for my backpack. I'm asked if I have a laptop in there. I explain that I don't, but there is a Nintendo Wii ... so he opens my bag and takes it out and states it has to be checked. The lady at the xray machine says 'pfff, I can't help what they put in their bags' and checks my Wii for bombs (... I assume). I stand and wait for my stuff to come through and it does after a few other bags. The lady behind the xray machine is pumping out reviews so much so that peoples stuff is getting pushed off the end of the belt. Luckily, I was able to get my stuff before it got to the end, but to do so I had to kick my shoes down the hallway while wearing my backpack, holding my laptop case and holding on to the items that I had to remove from my person/was removed from my bag.
I know there isn't a big screening process to work in airport security. I also know that I should put up with it because they get paid little and have frustrating jobs, but, on the other hand, I spent $550 on a plane ticket that last year at this time was about $200. Taking a train and being able to do work while I travel with less frustration (and, checking out Amtrak tickets online -- MUCH cheaper) seems to be looking better.
digg it
seed it
del.icio.us
ma.gnolia
Comments: 0
The Amazon People Are Coming @ 2009-10-03 23:00:11
Filed under: Comedy Personal
A few weeks ago my mom got really sick and went to the ICU. During her recovery in the ICU she was given ambien so that she would go to sleep. Ambien is known for having some weird side effects and those of us visiting my mother found out how intense they could be first hand.
The players
- Judy Milner (aka Mom)
- Steve Milner (aka Me) - Son
- Rachel Milner - Daughter
- Ashton - One of Rachel's Sons (aka babies)
- Rayel - One of Rachel's Sons (aka babies)
- Jim - Mom's farmer friend
- Amazon People - People from the Amazon
The following is a paraphrased (but highly accurate) conversation that took place between my mother and myself around 3am sometime last week.
Mom: no ... no. NO!
....
Mom: I told you! I told you I can't swim. Well ... they can.
....
Mom: They are going to get Rachel! Hide her babies!
Me: What?
Mom: I told them I can't swim. I accidentally told them you and Rachel can. And her babies. They will take them away
Me: Who is going to take Ashton and Ryel away?
Mom: The amazon people!

Mom: You need to warn her! Hide her babies!
Me: They will be fine mom. Get some sleep.
Mom: No, they will be taken away! You need to warn her!
Me: Go back to bed, mom.
Mom: Listen to me. They will take her babies ...
Me: I've already hidden them. They are safe. Just get some rest.
Mom: You did?
Me: Yes. Everything is OK. Go to sleep so you can heal.
Mom: OK.
...
Mom: Did you tell Jim?

Me: About what?
Mom: You didn't tell Jim about the Amazon people?
Me: No, the babies are hidden remember?
Mom: They will find them! I told them they could swim!
Me: Go back to sleep mom.
Mom: Please, just fax Jim!

Me: Jim is asleep. I'll tell him later OK?
Mom: He needs to know. You need to fax him.
Me: Rachel's babies are fine. I hid them. They are safe. Go to sleep.
Mom: You have to fax Jim. He can protect Rachel's babies.

Mom: Do you hear me? Are you there?
Me: Yeah. Mom, you took something to help you sleep. You just need to go to bed.
Mom: (laughing) I know it sounds crazy, but it's true! You have to fax Jim.
Me: (pondering if it's crazy enough to be true, like something from Lost) Can I bring you through this in a logical fashion?
Mom: OK, but you have to fax Jim as soon as you can.
Me: You are worried because there are people from the Amazon who know that Ashton and Ryel can swim ...
Mom: Yes. I didn't mean to tell them ...
Me: Right, and they are going to come and get Rayel and Ashton, so you want me to fax Jim ASAP?
Mom: Yes! They are coming now!
Me: How are they getting here?
Mom: By boat. There are a lot of them.

Me: Ma, that doesn't make sense.
Mom: Trust me! You have to fax Jim now.
Me: So, they are coming by boat? Do you know how far that is for them to travel?

Me: That will take forever for them to get here. I think you can get some sleep and we can think about it more in the morning.
Mom: They are coming in boats.
Me: It's OK, it will still take a long time. Go to sleep.
Mom: There are a lot of them in the boats.
Me: Get some rest. We will talk about a plan in the morning.
Mom: They will be here by then.
Me: (trying not to laugh) What kind of boats are they in?
Mom: Row boats. There are a lot of them.

Me: That will take even longer. Weeks or months. Go to bed mom.
Mom: But we need to tell Jim!
Me: Can I put this on my blog so other people know about them coming?
Mom: Yes.
....
Mom: Did you fax Jim?
Me: No, go to sleep.
Mom: You need to fax him!
Me: I'll do one better, get some sleep now and I'll make a personal plea to President Obama himself.

Mom: OK (goes to sleep)
digg it
seed it
del.icio.us
ma.gnolia
Comments: 0
Question To Palm Over SDK Agreement @ 2009-07-17 20:41:24
Filed under: Code Personal Philosophy Tech
I am not a lawyer, but when I read the TOS agreement I feel like it is saying that if you use the SDK you can not reimplement any of the tools ...
digg it
seed it
del.icio.us
ma.gnolia
Comments: 0
Filed under: Code Personal Python Tech
More or less a dictionary store on the network with very simple authentication. I don't know what got into me ... I had no intention of writing this ... hopefully it will be of use to someone. It is a little messy, but it works on Python2.6.
# WHY DID I WRITE THIS?!
import os
import yaml
from multiprocessing import Process
from multiprocessing.managers import BaseManager
class WriteableDict(dict):
"""
A dictionary which can write to disk.
"""
def __init__(self, fs_loc, *args, **kwargs):
"""
Create the instance.
:Parameters:
- `fs_loc`: location on disk to write to
- `args`: all other non-keyword arguments
- `kwargs`: all other keyword arguments
"""
dict.__init__(self, *args, **kwargs)
self.__fs_loc = fs_loc
self.__saving = None
def __save_to_disk(self):
"""
Save to disk.
"""
# If we are trying to save while anothe save is happening
# kill the previous save as it's already out of date
try:
if self.__saving.is_alive():
self.__saving.terminate()
self.__saving.join()
except:
pass
def save(write, data):
with open(write, 'w') as fs_file:
fs_file.write(yaml.dump(data.copy()))
self.__saving = False
self.__saving = Process(target=save, args=(self.__fs_loc, self))
self.__saving.daemon = True
self.__saving.start()
def update(self, *args, **kwargs):
"""
Write enabled update.
:Parameters:
- `args`: all other non-keyword arguments
- `kwargs`: all other keyword arguments
"""
dict.update(self, *args, **kwargs)
self.__save_to_disk()
def pop(self, *args, **kwargs):
"""
Write enabled pop.
:Parameters:
- `args`: all other non-keyword arguments
- `kwargs`: all other keyword arguments
"""
dict.pop(self, *args, **kwargs)
self.__save_to_disk()
def popitem(self, *args, **kwargs):
"""
Write enabled popitem.
:Parameters:
- `args`: all other non-keyword arguments
- `kwargs`: all other keyword arguments
"""
dict.popitem(self, *args, **kwargs)
self.__save_to_disk()
def clear(self, *args, **kwargs):
"""
Write enabled clear.
:Parameters:
- `args`: all other non-keyword arguments
- `kwargs`: all other keyword arguments
"""
dict.clear(self, *args, **kwargs)
self.__save_to_disk()
class DataBroker(object):
__data = {}
def __init__(self, data_loc, auth):
"""
Creates an instance of the broker and loads any initial data found.
:Parameters:
- `data_loc`: directory on disk that houses any .data files to load
- `auth`: auth information to use
"""
self.__auth = auth
self.__data_loc = data_loc
for loc in filter(lambda s: s.endswith('.data'), os.listdir(data_loc)):
full_path = os.path.sep.join([data_loc, loc])
name = os.path.basename(loc).replace('.data', '')
with open(full_path, 'r') as f_loc:
self.__data[name] = WriteableDict(
full_path, yaml.load(f_loc.read()))
def __authenticate(self, user, passwd):
"""
Poor mans authentication.
:Parameters:
- `user`: username
- `pasword`: ... password
"""
if user in self.__auth.keys():
if self.__auth[user][0] == passwd:
return True
return False
def get_data(self, user, passwd, name):
"""
Hands over access to the dictionary.
:Parameters:
- `user`: username
- `password`: password
- `name`: name of the dictionary to access
"""
if self.__authenticate(user, passwd):
if name in self.__auth[user][1]:
if name not in self.__data.keys():
self.__data[name] = WriteableDict(self.__data_loc + name + ".data")
return self.__data[name]
raise Exception
class DataManager(BaseManager):
"""
Data Manager.
"""
def __init__(self, *args, **kwargs):
"""
Creates an instance of the manager.
:Parameters:
- `args`: all other non-keyword arguments
- `kwargs`: all other keyword arguments
"""
BaseManager.__init__(self, *args, **kwargs)
self.register('get_data',
callable=lambda u, p, s: broker.get_data(u, p, s))
if __name__ == '__main__':
# Auth information user: (password (dicts, that, they, can, access))
auth = {'test': ('testing', ('something', ))}
# Setup the broker and manager
broker = DataBroker('/tmp/', auth)
manager = DataManager(address=('', 50000), authkey='abracadabra')
# and serve until a ctrl+c
server = manager.get_server()
try:
server.serve_forever()
except KeyboardInterrupt, ki:
server.shutdown()
digg it
seed it
del.icio.us
ma.gnolia
Comments: 0
Mercurial Is Teh Awesome @ 2009-12-28 11:28:58
Filed under: Code Personal Tech
I'm really digging it. Just for the heck of it, here is my global config.
[ui] username = Steve 'Ashcrow' Milner <stevem@EXAMPLE.COMt> editor = vim [extensions] hgext.gpg= hgext.graphlog = color = mq = bookmarks = pager = inotify = rebase = localbranch = ~/.hg-ext/localbranch.py hgext.convert = [pager] pager = less -R [diff] git = True [alias] blame = annotate -uln
digg it
seed it
del.icio.us
ma.gnolia
Comments: 0
RDU Airport Security Frustration @ 2009-11-25 05:19:40
Filed under: Frustration Personal
I usually will put up with a decent amount when it comes to travel. Lots of people are trying to get to many places and everyone is afraid they won't make it. I've been frustrated by the security checks at airports before, but today was a bit different. It started while I was waiting to put my stuff on the belt. Two security checkpoint guys were giving the instructions at the same time (though not saying the same thing at the same time) about 5 feet from each other. If I didn't know what to do (say, if I wasn't from the US) I wouldn't have been able to figure out what they were saying. So I get my bags on the belt and walk through the metal detector. Usually that means 'yay, you don't have anything crazy on you.' Not this time. I don't know if this was added in the last few months but I got a pat down to verify I didn't have anything. OK, so maybe it's an added safeguard, I'll go with that, but what happens next really irks me. My stuff 'clears' except for my backpack. I'm asked if I have a laptop in there. I explain that I don't, but there is a Nintendo Wii ... so he opens my bag and takes it out and states it has to be checked. The lady at the xray machine says 'pfff, I can't help what they put in their bags' and checks my Wii for bombs (... I assume). I stand and wait for my stuff to come through and it does after a few other bags. The lady behind the xray machine is pumping out reviews so much so that peoples stuff is getting pushed off the end of the belt. Luckily, I was able to get my stuff before it got to the end, but to do so I had to kick my shoes down the hallway while wearing my backpack, holding my laptop case and holding on to the items that I had to remove from my person/was removed from my bag.
I know there isn't a big screening process to work in airport security. I also know that I should put up with it because they get paid little and have frustrating jobs, but, on the other hand, I spent $550 on a plane ticket that last year at this time was about $200. Taking a train and being able to do work while I travel with less frustration (and, checking out Amtrak tickets online -- MUCH cheaper) seems to be looking better.
digg it
seed it
del.icio.us
ma.gnolia
Comments: 0
The Amazon People Are Coming @ 2009-10-03 23:00:11
Filed under: Comedy Personal
A few weeks ago my mom got really sick and went to the ICU. During her recovery in the ICU she was given ambien so that she would go to sleep. Ambien is known for having some weird side effects and those of us visiting my mother found out how intense they could be first hand.
The players
- Judy Milner (aka Mom)
- Steve Milner (aka Me) - Son
- Rachel Milner - Daughter
- Ashton - One of Rachel's Sons (aka babies)
- Rayel - One of Rachel's Sons (aka babies)
- Jim - Mom's farmer friend
- Amazon People - People from the Amazon
The following is a paraphrased (but highly accurate) conversation that took place between my mother and myself around 3am sometime last week.
Mom: no ... no. NO!
....
Mom: I told you! I told you I can't swim. Well ... they can.
....
Mom: They are going to get Rachel! Hide her babies!
Me: What?
Mom: I told them I can't swim. I accidentally told them you and Rachel can. And her babies. They will take them away
Me: Who is going to take Ashton and Ryel away?
Mom: The amazon people!

Mom: You need to warn her! Hide her babies!
Me: They will be fine mom. Get some sleep.
Mom: No, they will be taken away! You need to warn her!
Me: Go back to bed, mom.
Mom: Listen to me. They will take her babies ...
Me: I've already hidden them. They are safe. Just get some rest.
Mom: You did?
Me: Yes. Everything is OK. Go to sleep so you can heal.
Mom: OK.
...
Mom: Did you tell Jim?

Me: About what?
Mom: You didn't tell Jim about the Amazon people?
Me: No, the babies are hidden remember?
Mom: They will find them! I told them they could swim!
Me: Go back to sleep mom.
Mom: Please, just fax Jim!

Me: Jim is asleep. I'll tell him later OK?
Mom: He needs to know. You need to fax him.
Me: Rachel's babies are fine. I hid them. They are safe. Go to sleep.
Mom: You have to fax Jim. He can protect Rachel's babies.

Mom: Do you hear me? Are you there?
Me: Yeah. Mom, you took something to help you sleep. You just need to go to bed.
Mom: (laughing) I know it sounds crazy, but it's true! You have to fax Jim.
Me: (pondering if it's crazy enough to be true, like something from Lost) Can I bring you through this in a logical fashion?
Mom: OK, but you have to fax Jim as soon as you can.
Me: You are worried because there are people from the Amazon who know that Ashton and Ryel can swim ...
Mom: Yes. I didn't mean to tell them ...
Me: Right, and they are going to come and get Rayel and Ashton, so you want me to fax Jim ASAP?
Mom: Yes! They are coming now!
Me: How are they getting here?
Mom: By boat. There are a lot of them.

Me: Ma, that doesn't make sense.
Mom: Trust me! You have to fax Jim now.
Me: So, they are coming by boat? Do you know how far that is for them to travel?

Me: That will take forever for them to get here. I think you can get some sleep and we can think about it more in the morning.
Mom: They are coming in boats.
Me: It's OK, it will still take a long time. Go to sleep.
Mom: There are a lot of them in the boats.
Me: Get some rest. We will talk about a plan in the morning.
Mom: They will be here by then.
Me: (trying not to laugh) What kind of boats are they in?
Mom: Row boats. There are a lot of them.

Me: That will take even longer. Weeks or months. Go to bed mom.
Mom: But we need to tell Jim!
Me: Can I put this on my blog so other people know about them coming?
Mom: Yes.
....
Mom: Did you fax Jim?
Me: No, go to sleep.
Mom: You need to fax him!
Me: I'll do one better, get some sleep now and I'll make a personal plea to President Obama himself.

Mom: OK (goes to sleep)
digg it
seed it
del.icio.us
ma.gnolia
Comments: 0
Question To Palm Over SDK Agreement @ 2009-07-17 20:41:24
Filed under: Code Personal Philosophy Tech
I am not a lawyer, but when I read the TOS agreement I feel like it is saying that if you use the SDK you can not reimplement any of the tools ...
From: Steve 'Ashcrow' Milner To: Palm webOSDev Cc: Bcc: Subject: Re: Hello future Palm webOS developers! Reply-To: In-Reply-To: <200907172152.n6HLqDY3000183@mailhost01.palm.com> X-OS: Linux powerhouse 2.6.29.5-191.fc11.x86_64 x86_64 I know this is a general email but I'm going to reply back with my question anyway just in case it's read :-) ... I'm an open source developer (and not a lawyer), and after looking over the terms for using the SDK it *seems* like it states that someone like me could not write an open source implementation of palm-generate or other tools (100% from scratch) if I use the SDK. Is this correct? I'd love to start writing applications for my pre! ... but I also don't want to tie my hands up if I do want to do a free software palm-generate clone. -- Thanks! Steve 'Ashcrow' Milner "I would rather use Java than Perl. And I'd rather be eaten by a crocodile than use Java." -- Trouser
digg it
seed it
del.icio.us
ma.gnolia
Comments: 0

