euglug.org

[작성자:] admin

  • [Python] Python subtleties



    Bob MillerThu Sep 21 18:48:55 PDT 2006

    Rob Hudson wrote:
    
    > In Python, what's the difference between these two:
    > 
    > 1) var = ('val')
    > 2) var = ('val',)
    
    For any expression e, the expression (e,) means create a one-tuple
    whose element is the value of e.
    
    In statement 1, the parentheses are simply used to group, and the
    string 'val' is assigned to var.  In statement 2, the magic rule I
    just described is invoked, so var is assigned the tuple whose only
    element is the string 'val'.
    
    > Knowing that, is there a difference between these two?
    > 
    > 3) var = ('val1', 'val2')
    > 4) var = ('val1', 'val2',)
    
    They are the same.
    
    The trailing comma in a tuple or arg list is ignored.  It makes it
    easier for humans or programs to write in this format.
    
        var = (
               'val1',
               'val2',
               'val3',
               'val4',
               'val5',
    	  )
    
    The code below would produce the code above.  Code that left out the
    last comma would be more involved.
    
        print 'var = ('
        for i in range(1, 6):
            print "           'val%d'," % i
        print '      )'
    
    -- 
    Bob Miller                              K<bob>
                                            kbob at jogger-egg.com
    
  • [Python] Python subtleties



    Martin KellyThu Sep 21 17:34:31 PDT 2006

    I was actually wondering about that the other day... python's "magic" 
    screwed me up trying to do that such that I short-cut it by putting a 
    list inside a tuple instead.
    
    John Heasly wrote:
    > 1) is a string, 2), 3) and 4) are tuples.
    > 
    > Python has "magic" for making one-item tuples. See 
    > http://www.python.org/doc/current/tut/node7.html#SECTION007300000000000000000: 
    > 
    > 
    > " ... A special problem is the construction of tuples containing 0 or 1 
    > items: the syntax has some extra quirks to accommodate these. Empty 
    > tuples are constructed by an empty pair of parentheses; a tuple with one 
    > item is constructed by following a value with a comma (it is not 
    > sufficient to enclose a single value in parentheses). ... "
    > 
    > Cheers,
    > John
    > 
    > On Sep 21, 2006, at 4:41 PM, Rob Hudson wrote:
    > 
    >> In Python, what's the difference between these two:
    >>
    >> 1) var = ('val')
    >> 2) var = ('val',)
    >>
    >> Knowing that, is there a difference between these two?
    >>
    >> 3) var = ('val1', 'val2')
    >> 4) var = ('val1', 'val2',)
    >>
    >> -Rob
    >> _______________________________________________
    >> Python mailing list
    >> Python at euglug.org
    >> http://www.euglug.org/mailman/listinfo/python
    > 
    > _______________________________________________
    > Python mailing list
    > Python at euglug.org
    > http://www.euglug.org/mailman/listinfo/python
    > 
    
  • [Python] Python subtleties



    John HeaslyThu Sep 21 16:53:13 PDT 2006

    1) is a string, 2), 3) and 4) are tuples.
    
    Python has "magic" for making one-item tuples. See http:// 
    www.python.org/doc/current/tut/node7.html#SECTION007300000000000000000:
    
    " ... A special problem is the construction of tuples containing 0 or  
    1 items: the syntax has some extra quirks to accommodate these. Empty  
    tuples are constructed by an empty pair of parentheses; a tuple with  
    one item is constructed by following a value with a comma (it is not  
    sufficient to enclose a single value in parentheses). ... "
    
    Cheers,
    John
    
    On Sep 21, 2006, at 4:41 PM, Rob Hudson wrote:
    
    > In Python, what's the difference between these two:
    >
    > 1) var = ('val')
    > 2) var = ('val',)
    >
    > Knowing that, is there a difference between these two?
    >
    > 3) var = ('val1', 'val2')
    > 4) var = ('val1', 'val2',)
    >
    > -Rob
    > _______________________________________________
    > Python mailing list
    > Python at euglug.org
    > http://www.euglug.org/mailman/listinfo/python
    
    
  • [Python] Python subtleties



    Rob HudsonThu Sep 21 16:41:48 PDT 2006

    In Python, what's the difference between these two:
    
    1) var = ('val')
    2) var = ('val',)
    
    Knowing that, is there a difference between these two?
    
    3) var = ('val1', 'val2')
    4) var = ('val1', 'val2',)
    
    -Rob
    
  • [Eug-lug] Webcams in the office…



    Darren HayesThu Sep 21 12:38:08 PDT 2006

    ----- Original Message ----- 
    <stircrazyben at gmail.com>  wrote:
    
    > Harbor Freight also has FAKE cameras, a very cheap
    > deterrent with minimal maintenance needs :)
    
    That reminds about the time when a friend of mine managed a local grocery.
    He was all too often finding half full six-packs, not three bottles of each
    six-pack missing, but rather half empties.
    
    So he found several old used, non working security cameras, drilled a hole
    in the camera housings, and stuck a can't be missed flashing LED in each,
    and mounted inside the cooler so the LED's would be noticed. That did the
    trick. Not sure how the LED's were powered. I would suspect the LED could
    run down batteries more often than desirable. Might be best to connect up to
    a motion sensor.
    
    Awhile back I set up a friend with two early model D-Link DSC wireless cams.
    The CMOS vid capture quality was pretty good during the day but not at night
    (lens LUX too high). Using VLC (running on W2K) and bundled Java based
    software (which was flaky), set-up low bit-rate high compression streaming
    and remote control over the net (including pan, tilt, zoom). But wasn't
    satisfied with the wireless range, even after adding the add-on antenna.
    This was almost two years ago so would expect the technology has improved
    since. Maybe pre-N cams are available now? But betting no cams yet support
    power over wireless ;-)
    
    There's a new retail security equipment company out W.11th whose focus is
    retailing and installing video surveillance systems and hardware. Can't
    recall company name at the moment.
    
    
    
    
    On 9/21/06, Quentin Hartman <qhartman at gmail.com> wrote:
    >
    > Down at SLSD they got some cheap-o network attached cameras to
    > dissuade vandalism and theft in one of the engineering tech rooms.
    > They worked really well, did recording out of the box, and the whole
    > kit with a couple cameras was only a few hundred dollars. I think they
    > got them from Tiger Direct. I'll contact the teacher who was directly
    > involvded in it and if he can recall more details I'll send them along
    > to you.
    >
    > On 9/20/06, Matthew Jarvis <mattj at bikefriday.com> wrote:
    > > Just got a 'request' that I put in cameras in 4 areas of our office, the
    > > first priority is so that our receptionist can find people to receive
    > > phone calls, the 2nd priority for security.
    > >
    > > I'm thinking that I can get away with those cheapo webcams, run the 4 of
    > > them into a usb hub and into a computer for viewing. (?)
    > >
    > > It would probably be good to just have a monitor dedicated to showing
    > > the output of the 4 cameras.
    > >
    > > Recording all this video can come later...
    > >
    > > Can I do this on the cheap like this or am I gonna have to pony up some
    > > real $$$ to make it happen?
    > >
    > > --
    > > Matthew S. Jarvis
    > > IT Manager
    > > Bike Friday - "Performance that Packs."
    > > www.bikefriday.com
    > > 541/687-0487 x140
    > > mattj at bikefriday.com
    > > _______________________________________________
    > > EUGLUG mailing list
    > > euglug at euglug.org
    > > http://www.euglug.org/mailman/listinfo/euglug
    > >
    >
    >
    > --
    > -Regards-
    >
    > -Quentin Hartman-
    > _______________________________________________
    > EUGLUG mailing list
    > euglug at euglug.org
    > http://www.euglug.org/mailman/listinfo/euglug
    >
    
    
    
    ----------------------------------------------------------------------------
    ----
    
    
    _______________________________________________
    EUGLUG mailing list
    euglug at euglug.org
    http://www.euglug.org/mailman/listinfo/euglug
    
    
  • [Eug-lug] Webcams in the office…



    Ben BarrettThu Sep 21 08:26:30 PDT 2006

    Harbor Freight also has FAKE cameras, a very cheap deterrent with minimal
    maintenance needs :)
    
    On 9/21/06, Quentin Hartman <qhartman at gmail.com> wrote:
    >
    > Down at SLSD they got some cheap-o network attached cameras to
    > dissuade vandalism and theft in one of the engineering tech rooms.
    > They worked really well, did recording out of the box, and the whole
    > kit with a couple cameras was only a few hundred dollars. I think they
    > got them from Tiger Direct. I'll contact the teacher who was directly
    > involvded in it and if he can recall more details I'll send them along
    > to you.
    >
    > On 9/20/06, Matthew Jarvis <mattj at bikefriday.com> wrote:
    > > Just got a 'request' that I put in cameras in 4 areas of our office, the
    > > first priority is so that our receptionist can find people to receive
    > > phone calls, the 2nd priority for security.
    > >
    > > I'm thinking that I can get away with those cheapo webcams, run the 4 of
    > > them into a usb hub and into a computer for viewing. (?)
    > >
    > > It would probably be good to just have a monitor dedicated to showing
    > > the output of the 4 cameras.
    > >
    > > Recording all this video can come later...
    > >
    > > Can I do this on the cheap like this or am I gonna have to pony up some
    > > real $$$ to make it happen?
    > >
    > > --
    > > Matthew S. Jarvis
    > > IT Manager
    > > Bike Friday - "Performance that Packs."
    > > www.bikefriday.com
    > > 541/687-0487 x140
    > > mattj at bikefriday.com
    > > _______________________________________________
    > > EUGLUG mailing list
    > > euglug at euglug.org
    > > http://www.euglug.org/mailman/listinfo/euglug
    > >
    >
    >
    > --
    > -Regards-
    >
    > -Quentin Hartman-
    > _______________________________________________
    > EUGLUG mailing list
    > euglug at euglug.org
    > http://www.euglug.org/mailman/listinfo/euglug
    >
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://euglug.org/pipermail/euglug/attachments/20060921/7b13b2d9/attac=
    hment-0001.htm
    
  • [Eug-lug] Webcams in the office…



    Quentin HartmanThu Sep 21 08:14:39 PDT 2006

    Down at SLSD they got some cheap-o network attached cameras to
    dissuade vandalism and theft in one of the engineering tech rooms.
    They worked really well, did recording out of the box, and the whole
    kit with a couple cameras was only a few hundred dollars. I think they
    got them from Tiger Direct. I'll contact the teacher who was directly
    involvded in it and if he can recall more details I'll send them along
    to you.
    
    On 9/20/06, Matthew Jarvis <mattj at bikefriday.com> wrote:
    > Just got a 'request' that I put in cameras in 4 areas of our office, the
    > first priority is so that our receptionist can find people to receive
    > phone calls, the 2nd priority for security.
    >
    > I'm thinking that I can get away with those cheapo webcams, run the 4 of
    > them into a usb hub and into a computer for viewing. (?)
    >
    > It would probably be good to just have a monitor dedicated to showing
    > the output of the 4 cameras.
    >
    > Recording all this video can come later...
    >
    > Can I do this on the cheap like this or am I gonna have to pony up some
    > real $$$ to make it happen?
    >
    > --
    > Matthew S. Jarvis
    > IT Manager
    > Bike Friday - "Performance that Packs."
    > www.bikefriday.com
    > 541/687-0487 x140
    > mattj at bikefriday.com
    > _______________________________________________
    > EUGLUG mailing list
    > euglug at euglug.org
    > http://www.euglug.org/mailman/listinfo/euglug
    >
    
    
    -- 
    -Regards-
    
    -Quentin Hartman-
    
  • [Eug-lug] Webcams in the office…



    Ben BarrettThu Sep 21 08:02:41 PDT 2006

    Yeah, if you get good enough quality video of the budding artists, you can
    get rich making a documentary about them later (when they're totally
    notorious for either good or evil reasons)... :)
    
    On 9/21/06, Alan <euglug at thebucks.net> wrote:
    >
    > ...
    > Do you plan to stick one outside to catch the graffiti punks? They seem
    > to love the back of your building.
    >
    >
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://euglug.org/pipermail/euglug/attachments/20060921/e798247b/attac=
    hment.htm
    
  • [Eug-lug] Webcams in the office…



    AlanThu Sep 21 00:47:42 PDT 2006

    Matthew Jarvis wrote:
    > 
    > I'm thinking that I can get away with those cheapo webcams, run the 4 of 
    > them into a usb hub and into a computer for viewing. (?)
    > 
    ...
    
    > 
    > Can I do this on the cheap like this or am I gonna have to pony up some 
    > real $$$ to make it happen?
    > 
    
    Yes.
    You could easily do this with a bunch of USB cams and a few instances of 
    VLC.
    Keep in mind the distance limitations of USB though.
    
    I myself (sticking with the philosophy of "Do it right the first time") 
    would grab some Axis or Panasonic netcams and a copy of zoneminder.
    However, if the budget isn't there for that, you can run USB cams with 
    zoneminder. The advantage being that if the budget does materialize for 
    netcams, you don't have to re-setup the system, just plug them into 
    zoneminder and away you go.
    The downside being that zoneminder can be somewhat complex to configure 
    (though there is a liveCD now).
    
    Do you plan to stick one outside to catch the graffiti punks? They seem 
    to love the back of your building.
    
    -ajb
    
  • [Eug-lug] Webcams in the office…



    Ben BarrettWed Sep 20 15:00:33 PDT 2006

    A couple well-placed rounded mirrors (similar to what is used for accute
    driveways) might be a nice middle path :)
    Very little job security in a non-digital solution, though :(
    
        Ben
    
    
    On 9/20/06, Allen Brown <abrown at peak.org> wrote:
    >
    > Matthew Jarvis wrote:
    > > Just got a 'request' that I put in cameras in 4 areas of our office,
    > > the first priority is so that our receptionist can find people
    > > to receive  phone calls, the 2nd priority for security.
    >
    > Are the employees who would be watched OK with this?  This is the
    > sort of thing which triggers high attrition.  Or vandalism at the
    > cameras.
    > --
    > Allen Brown  abrown at peak.org  http://www.peak.org/~abrown/
    >    "The guy sure looks like plant food to me." Little Shop of Horror
    > _______________________________________________
    > EUGLUG mailing list
    > euglug at euglug.org
    > http://www.euglug.org/mailman/listinfo/euglug
    >
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://euglug.org/pipermail/euglug/attachments/20060920/3b36135d/attac=
    hment.htm