• All Blogs
  • fumanchu
  • RTS
  • Lydie
  • Jonathan?
  • phunt
  • Susan
  • diacrisis

AMinus.org - All Blogs


  • Home
  • Contact
  • Log in

San Gorgonio Wilderness

November 21st, 2006








.

Posted in MindMash | 3 feedbacks »

Let's start the bidding...

November 20th, 2006

The auction for Inga's painting has begun! You can find the auction here:

http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=260054748905

Check it out!

.

Posted in MindMash | Send feedback »

100,000 Visits, WOOHOO

November 17th, 2006

Aesthetic-Mindset reached 100,000 hits sometime earlier today. The site has been up since February 6th of this year. Congratulations are in order for Justin and I!

Posted in MindMash | Send feedback »

Internal Redirect WSGI middleware

November 13th, 2006

I played around with this as a potential hack for CherryPy 3. It's WSGI middleware for adding almost-transparent "internal redirect" capabilities to any WSGI application.

My operating theory was that anyone writing a WSGI app that does not already have an internal-redirect feature was probably using HTTP redirects (302, 303, or 307) to do nearly the same thing. This middleware simply waits for a 307 response status and performs the redirection itself within the same request, without informing the user-agent.

This should be OK because 307 isn't normally cacheable anyway, and some versions of IE don't bother to ask the user as the spec requires already, so it just duplicates an existing browser bug. I could have used a custom HTTP code like 399, but if that ever leaked out to the UA (because someone forgot to enable the middleware) then the UA should fall back to "300 Multiple Choices", which didn't seem like a good fit. At least by using 307, the fallback should be appropriate, if not graceful.

Here's the code, which could probably use some improvements:

"""WSGI middleware which performs "internal" redirection."""

import StringIO


class _Redirector(object):

    def __init__(self, nextapp, recursive=False):
        self.nextapp = nextapp
        self.recursive = recursive

        self.location = None
        self.write_proxy = None
        self.status = None
        self.headers = None
        self.exc_info = None

        self.seen_paths = []

    def start_response(self, status, headers, exc_info):
        if status[:3] == "307":
            for name, value in headers:
                if name.lower() == "location":
                    self.location = value
                    break
        self.status = status
        self.headers = headers
        self.exc_info = exc_info
        return self.write

    def write(self, data):
        # This is only here for silly apps which call write.
        if self.write_proxy is None:
            self.write_proxy = self.sr(self.status, self.headers, self.exc_info)
        self.write_proxy(data)

    def __call__(self, environ, start_response):
        self.sr = start_response

        nextenv = environ.copy()
        curpath = nextenv['PATH_INFO']
        if nextenv.get('QUERY_STRING'):
            curpath = curpath + "?" + nextenv['QUERY_STRING']
        self.seen_paths.append(curpath)

        while True:
            # Consume the response (in case it's a generator).
            response = [x for x in self.nextapp(nextenv, self.start_response)]

            if self.location is None:
                # No redirection required; complete the response normally.
                self.sr(self.status, self.headers, self.exc_info)
                return response

            # Start with a fresh copy of the environ and start altering it.
            nextenv = environ.copy()
            nextenv['REQUEST_METHOD'] = 'GET'
            nextenv['CONTENT_LENGTH'] = '0'
            nextenv['wsgi.input'] = StringIO.StringIO()
            nextenv['redirector.history'] = self.seen_paths[:]

            # "The [Location response-header] field value
            # consists of a single absolute URI."
            (nextenv["wsgi.url_scheme"],
             nextenv["SERVER_NAME"],
             path, params,
             nextenv["QUERY_STRING"], frag) = urlparse(self.location)

            if frag:
                raise ValueError("Illegal #fragment in Location response "
                                 "header %r" % self.location)

            if params:
                path = path + ";" + params

            # Assume 'path' is already unquoted according to
            # <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.2">http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.2</a>
            if path.lower().startswith(environ['SCRIPT_NAME'].lower()):
                nextenv["PATH_INFO"] = path[len(environ['SCRIPT_NAME']):]
            else:
                raise ValueError("Location response header %r does not "
                                 "match current SCRIPT_NAME %r"
                                 % (self.location, environ['SCRIPT_NAME']))

            # Update self.seen_paths and check for recursive calls.
            curpath = nextenv['PATH_INFO']
            if nextenv.get('QUERY_STRING'):
                curpath = curpath + "?" + nextenv['QUERY_STRING']
            if curpath in self.seen_paths:
                raise RuntimeError("redirector visited the same URL twice: %r"
                                   % curpath)
            else:
                self.seen_paths.append(curpath)

            # Reset self for the next iteration
            self.location = None
            self.write_proxy = None
            self.status = None
            self.headers = None
            self.exc_info = None


def redirector(nextapp, recursive=False):
    """WSGI middleware which performs "internal" redirection.

    Whenever the next application sets a response status of 307 and
    provides a Location response header, this component will not pass
    that response on to the user-agent; instead, it parses the URI
    provided in the Location response header and calls the same
    application again using that URI. The following entries in the
    WSGI environ dict may be modified when redirecting: wsgi.url_scheme,
    SERVER_NAME, PATH_INFO, QUERY_STRING. REQUEST_METHOD is always
    set to 'GET', so any desired parameters must be supplied as
    query string arguments in the Location response header.
    The wsgi.input entry will always be reset to an empty StringIO,
    and CONTENT_LENGTH will be set to 0.

    If 'recursive' is False (the default), each new target URI will be
    checked to see if it has already been visited in the same request;
    if so, a RuntimeError is raised. If 'recursive' is True, no check
    is made and therefore no such errors are raised.
    """
    def redirect_wrapper(environ, start_response):
        ir = _Redirector(nextapp, recursive)
        return ir(environ, start_response)
    return redirect_wrapper

Posted in Python, CherryPy, WSGI | 4 feedbacks »

Good Morning, Momma Bear

November 12th, 2006
It's amazing how fast the brain can function when put into certain situations.

I have spent the past 4 days with a couple friends in the San Gorgonio Wilderness, which is part of the San Bernadino National Forrest. The first three days were really nice, a great strenuos hike into our campsite, and then we pretty much just lounged around for the rest of time taking short day hikes from there. I have a more detailed "play by play" journal of my time that I will post later after I get a chance to transcript it from the paper into the computer, but for now I want to share the most exciting part of my trip.

The first couple nights I spent sleeping inside a tent with Bob, I don't sleep very well or very late and the tent itself wasn't really designed for someone in the 6'3ish range as I am. I decided last night to sleep outside the tent in just my sleeping bag on top of my thermarest. My 20 degree bag was sufficient for the mid 30s nighttime temps that we were having up at the 7500' elevation camp. Also there were almost no bugs whatsoever during our trip, so I wasn't worried about getting eaten alive by mosquitos, which is usually my main reason for not sleeping outside the tent and under the stars. Along with myself I convinced Chris to sleep outside with me. I don't think she has ever slept directly in the elements before so she seemed geniunely excited about charting new territory. We both tossed and turned most of the night, every once in a while giving up and having short conversations, then falling back to sleep.

Sometime during twilight I was softly woken up by a strange moaning/cooing noise which seemed to be coming from the brush probably 20 yards away. It sounded almost like a quail or pigeon and I thought nothing of it. At this time I was laying on my back with only my head outside the sleeping bag. Chris was next to me on her sleeping pad completely inside her bag with the opening cinched shut. The weird noise persisted and I was just sitting there enoying what I thought was a bird doing it's wake up call, with the soothing sound of the stream behind me. Far off in the distance, probably 1/2 a mile I heard a dog barking. This was odd because the whole time were were out there in the wilderness we'd only seen one person, and he was on a day hike the day before. It seemed a bit early for anyone to be coming up the trail and I decided for some reason to look up. I tilted my head forward to see that there was full grown black bear about 2' away from the end of my sleeping bag. WOW, ok, WOW, ok, HOLY CRAP WOW.

This is where the speedy brain functioning comes into play. As soon as I saw the bear, I immediately lowered my head back into it's previous spot and here's what flushed through my brain, in the this order:
--There is a bear.
--The bear is less than a meter away from me.
--It is full grown.
--It is moving towards me.
--IT IS A BLACK BEAR.
--Black bears are generally non aggressive and will run away unless they are cornered or have cubs with them.
--Chris is stuck in her sleeping bag next to me.
--If I play dead then I think the bear will probably crawl on top of me and start sniffing my face.
--If the bear crawls on top of me it will probably wake Chris up.
--If Chris wakes up and hears something (not me) breathing heavily next to her she will probably rustle over to take a peak out of her bag.
--If Chris moves around and peaks out of her bag and sees a bear on top of me less than a foot away from her she will FREAK!
--If Chris freaks it will probably, in turn, freak out the bear.
--If the Bear freaks out while on top of me and next to her it will probably feel threatened and this may get really ugly.
--Don't play dead, it's not a good option.
--Maybe you should just yell at the Bear before it get any closer to you.
--If this pisses the bear off, jump out of the sleeping bag as quick as possible and get away from Chris.
--This is a good plan.


This entire internal conversation happened in less than a second! The human mind is amazing.!

Then I titled my head forward again and looked directly at the bear, who was more or less sniffing the end of the sleeping bag. "GET THE HECK AWAY FROM ME!!!" I yelled at the bear. This scared the crap out of the bear and it bolted away from me. After about 10 yards the bear stopped, turned around and looked at me, again I yelled "GET OUT OF HERE NOW!!". At this point I saw a little cub about 10 yards ahead of the bear hightailing himself out of there, and the momma bear followed it into the bushes. Somewhere between the first and second time I yelled at the bear I pushed Chris and said "Get out of your bag NOW". The bear was already in retreat and I just wanted Chris to have a chance to see the beautiful creature before it disappeared completely into the bushes. My tone of voice, probably due to being hyped up on adrenaline, didn't seem to convey my intended "look at the bear" message, but instead, gave off more of a "There is bear attacking us" message. Chris, noticing she couldn't get out of the bag easily or quickly, went stiff and played dead. By the time I convinced her it was alright, the bear was gone, she might have seen the bear's butt?

For the next 30 minutes I sat there telling her the whole story over and over again, totally shaky and hyped up on adrenaline. All I can say now is that this incident that happened less than 12 hours ago is one of the coolest things to ever happen to me. I doubt I will ever be that close to a wild bear again, unless I'm getting attacked!

.

Posted in MindMash | 16 feedbacks »

Wow

November 8th, 2006

Ok, I was just reading my Mom's blog and she used the word "blogosphere". I'm not sure if I should be impressed or scared.

Posted in MindMash | 4 feedbacks »

Miami Vegan

November 7th, 2006

Link: http://www.ambrosiaempire.com/vegan/2006/11/today-is-painting-day.html

My friend Inga of Miami Vegan has decided to do a painting of one of my photographs. She started today and will be publishing her progress along the way from the charcoal schetching to the finishing touches.

I've never had anyone reproduce my art like this and I am really excited to see it at his happens. If you're interested you might want to peak over at her blog every couple of days as she works on the piece.

.

Posted in MindMash | 1 feedback »

Alternative costs of Health Care

November 6th, 2006

I had a pretty gnarly arrhythmia today about an hour ago. No big deal, it was a "perfectly normal" thing that happens to me from time to time. It got me thinking though about a few things though. I started thinking about the whole DNR (Do Not Resuscitate) issue that I've pondered for a few years. Don't freak out, I'm currently still in the "Do Resuscitate" group. Along with that I started pondering the fact that I haven't had a medical bracelet for over a decade, and that I should probably get a new one in case I am unconscious when the inevitable happens.

So I looked around a bit for a pendant that wasn't too dumb or whatever and finally found one that I wouldn't mind wearing for another decade or so. Then...HOLY CRAP THESE THINGS ARE RIDICULOUSLY EXPENSIVE!!! I know they have cheap ones for under $10, but I don't like the cheap ones and if I'm gonna have to wear the stupid thing I might as well get one I like. However, the one I like is $55! And that is before the engraving fees. Shitaki Mushroom!

The damn thing does not need to be made out of platinum! Sheesh (ok, it was actually made from silver, but stainless steel would have been FINE with me).

So in my ever-pondering everything ways, my mind abandoned that nicer looking pendant and now I'm considering just getting the stupid info tattooed on my chest. And if you think I'm being facetious, well, then you don't know me very well. Also, this way if I finally make up my mind about the DNR thing, I can just have the tattoo amended with that info as well as all my other stuff. Hmmm.

.

Posted in MindMash | 3 feedbacks »

Goals

November 6th, 2006

My entire goal in life right now is to locate and consume a 20oz bottle of Mountain Dew. ugh.

Posted in MindMash | 4 feedbacks »

Get well NOW!

November 2nd, 2006

One of my closest friends had a health scare last night and ended up in the ER, then to be admitted to the hospital overnight. Out of respect to privacy I don't feel a need to give a name or what happened. Friend is feeling much better this morning, and I thank God for that. Friend still has some tests and such, but I'm guessing that friend will be released from the hospital this afternoon sometime.

It's sobering how an incident like this can make all the other "big" problems going on seem so juvenile and petty. One thing was important last night: making sure that my friend was as safe as possible. One thing is important today: making sure my friend is as safe as possible. Everything else melts into the "whatever" category.

If you're reading this and you believe in prayer, please send a couple up for my friend. First thank God for everything getting better so far, and ask God for total healing so there aren't any further complications. Thanks

I love you, my friend.

.

Posted in MindMash | 4 feedbacks »

<< 1 ... 4 5 6 7 8 9 10 11 12 13 14 ... 56 >>
  • September 2010
    Sun Mon Tue Wed Thu Fri Sat
     << <   > >>
          1 2 3 4
    5 6 7 8 9 10 11
    12 13 14 15 16 17 18
    19 20 21 22 23 24 25
    26 27 28 29 30    
  • AMinus.org - All Blogs

  • All blogs at Aminus.org get aggregated here, so you can read about everything that's happening from one place!

    If you're more interested in one or two authors, you can select their individual blogs from the list.

    We highly recommend that you get a newsreader (like Sage for Firefox, or an online service like Bloglines) and subscribe to our feeds! Much easier than remembering to check back here all the time. ;)

    • Recently
    • Archives
    • Categories
    • Latest comments
  • Search




  • Categories

    The Hand of FuManChu

    • By By Design
    • General
    • IT
      • Linnaeus Award
      • Python
        • Cation
        • CherryPy
        • Dejavu
        • WHELPS
        • WSGI
      • Robotics and Engineering
    • Photography

    www.ryangwillim.com

    • MindMash
    • _Disc Golf
    • _Photography
      • UrbanArtistry
    • _Spiritual Muse

    Geppeto's Workshop in Mexico...Building Dreams

    • Alternative gifts & Donations to Mexico
      • Creative ideas of giving
    • Children's Ministry
      • Outreach opportunites
      • Puppet Ministry
        • Tito's Fan Club
    • General
    • Journal of a Missionary
    • Mexican Pastors
      • News from Baja and Beyond
      • prayer list
        • prayer requests answered
    • Mexico Missions
      • Creating lasting memories - Mexican families

    Jon Wilson

    • Stories?
    • The J-O-B
    • What?

    Mass Transit

    • Computers
      • CherryPy
      • Subway
    • General
    • Music

    Jon's links

    • a trancientfulnessocity
    • Music

    Subaru Swamp

    • General
  • The requested Blog doesn't exist any more!
  • XML Feeds

    • RSS 2.0: Posts, Comments
    • Atom: Posts, Comments
    What is RSS?
powered by b2evolution

©2010 by admin | Contact | Design by Michael | Credits: multiblog | hosting companies