euglug.org

[작성자:] admin

  • [Eug-lug] Reading data to multiple variables



    Neil ParkerWed Jul 28 22:14:06 PDT 2004

    Garl Grigsby wrote,
    >The way you had it the read would stop just after the Protocol line. It 
    >would never process the Transport, GUID, or the Attached lines. Again, I 
    >have no idea why this is happening. I can't find anything in there that 
    >would cause it to fail but it did. Any way, this works, and works well.
    
    That's probably due to the fact that the files in /proc aren't really files--
    they're magical names that the kernel recognizes as requests to print out
    data.  Some of them are implemented rather crudely--they dump their output
    in big hunks, and expect the reader to read them in equally big hunks, and
    if you try to read in smaller hunks (e.g. one line at a time), you miss
    data.
    
    Not all of the /proc files have this problem, but some do.  This is why
    some Linux HOWTOs recommend commands like "cat /proc/whatever|more"
    instead of "more /proc/whatever".
    
    On my machine (kernel 2.2.23), some of the IDE info files have this
    problem.  For example,
    
         $ cd /proc/ide/ide0/hda
         $ cat geometry
         physical     16383/16/63
         logical      1247/255/63
         $ while read line;do echo $line;done<geometry
         physical 16383/16/63
         $ cat geometry|while read line;do echo $line;done
         physical 16383/16/63
         logical 1247/255/63
         $
    
    The pipe works because "cat" reads its input in large-enough chunks, and feeds
    it to a pipe, which you can read in any size chunks you want without
    missing data.
    
              - Neil Parker
    
  • [Eug-lug] PHP5 looks kind of kicky



    larry priceWed Jul 28 21:40:14 PDT 2004

    It's practically a different language
    see http://www.php.net/manual/en/migration5.oop.php
    
    It looks like it's trying to become Java 
    what with Interfaces, and 
    public|protected|private method declarations
    also they appear to have copied some of the iterator stuff from python
    
    but hey, its at least got an object model that doesn't suck.
    
    I'm upgrading my webserver now.
    
    So i'll poke at it and give a full report (and demo )in a few days
     
    
    
    -- 
    http://Zoneverte.org -- information explained
    Do you know what your IT infrastructure does?
    
  • [Eug-lug] Thursday meeting tomorrow uncertain



    Jason DommaschWed Jul 28 21:09:59 PDT 2004

    Hello all,
    
    Sorry to break the news so late, but I have another get together to attend 
    to a little after 7:30 p.m. tomorrow (Thursday).  I'm currently the key 
    keeper and alarm setter for the meeting space at OPN.
    
    I'm willing to open the meeting at OPN at 6:30 p.m., but I'll have to close 
    it up at 7:30 p.m.  I don't know if it's too late to find another place to 
    meet.  If someone finds another place to meet for tomorrow, I can put a 
    sign up on the OPN door pointing them the right direction.
    
    I'll be able to check my email around noon or so, and after work around 5 p.m.
    
    	Jason Dommasch <jdomm at efn.org>
    
    
  • [Eug-lug] Netraverse Freebie



    Mr OWed Jul 28 18:38:09 PDT 2004

    Would you see if they'll ship a couple copies? It'd be
    interesting to see how my hardware works under Windows in Linux.
    
    
    --- Max Lemieux <max at lunarlogic.com> wrote:
    
    > I'd be willing to give it a shot. I have a copy of Windows
    > 2000 that should be 
    > fun to get up and running under Win4Lin...
    > 
    > If there are no objections, I'll contact Netraverse and obtain
    > the goods... 
    > Installation report to follow.
    > 
    > Cheers,
    > Max
    
    
    
    		
    __________________________________
    Do you Yahoo!?
    Yahoo! Mail Address AutoComplete - You start. We finish.
    http://promotions.yahoo.com/new_mail 
    
  • [Eug-lug] keyboard strangeness



    Mr OWed Jul 28 18:36:48 PDT 2004

    If the end user fails to consult their manual and cost
    themselves their device and/or USB ports on their system then
    there is your problem. Want a nice little tidbit on Dell? Those
    front USB ports on many of their newer systems is tied to the
    power switch before going to the mainboard. Extremely
    proprietary. You fry that little part and it'll cost you $150 to
    replace. 
    
    I'm not saying that you have to to hotplug PS/2 several times.
    Just stating that you *usually* won't fry it on the first try.
    Sort of like cocaine, it may not kill you the first time but it
    could any time after that.
    
    
    --- Allen Brown <allen_brown at agilent.com> wrote:
    
    > If a USB device frys when you hotplug it, it should be
    > returned
    > as defective.  The USB protocol specifies hotplug-ability.  It
    > doesn't make exceptions for part that are already turned on.
    
    > Are you saying that you have to hotplug PS/2 several times
    > into
    > the same motherboard to cause it to fry?  That seems most
    > strange.
    > 
    > By the way, I didn't mean to encourage hotplugging PS/2.  I
    > only
    > passed on the observation of some highschool students I have
    > worked
    > with.
    
    
    
    		
    __________________________________
    Do you Yahoo!?
    Yahoo! Mail - 50x more storage than other providers!
    http://promotions.yahoo.com/new_mail
    
  • [Eug-lug] Reading data to multiple variables



    Garl GrigsbyWed Jul 28 16:23:43 PDT 2004

    Bob Miller wrote:
    
    > You don't need awk for that. You could do something like this if
    >
    >you wanted to process each USB device separately.
    >
    >	for unit in /proc/scsi/usb-storage-*/*
    >	do
    >	    while read name value
    >	    do
    >		case "$name" in
    >		    GUID:)       guid="$value";;
    >		    Attached:)   attached="$value";;
    >		esac
    >	    done < "$unit"
    >	    echo ${unit}: GUID: $guid attached: $attached
    >	    # do something useful for one unit here.
    >	done
    >
    >  
    >
    Bob,
        I owe you a beer. This (above) was almost exactly what I needed. 
    What you showed me above didn't completely work, and why it doesn't work 
    is still a mystery to me, but I made the following modifications and how 
    it does work.
    
    for unit in /proc/scsi/usb-storage-*/*
        do
          cat $unit > /tmp/unit
          while read name value
          do
               case "$name" in
                   GUID:)       guid="$value";;
                   Attached:)   attached="$value";;
               esac
          done < /tmp/unit
          echo ${unit}: GUID: $guid attached: $attached
          # do something useful for one unit here.
        done
    
    The way you had it the read would stop just after the Protocol line. It 
    would never process the Transport, GUID, or the Attached lines. Again, I 
    have no idea why this is happening. I can't find anything in there that 
    would cause it to fail but it did. Any way, this works, and works well.
    
    Thanks again,
    garl
    
  • [Eug-lug] Mike Jackson, are you on this list?



    Ken BarberWed Jul 28 13:34:27 PDT 2004

    If so, please contact me off-list.  I have a question about a position in New 
    Jersey you said you were going to get last winter....
    
    Ken Barber
    
  • [Eug-lug] re: Debugging your email for mandrake



    Alan CrandallWed Jul 28 12:48:00 PDT 2004

     >receives but won't send
    
     >(Alan didn't bring his computer in so we have no idea >what his >computer 
    is actually)
    
     >that the
     >local MTA is not running.
    
     >look for .xsession-errors to see if Kmail is writing
     >opening a shell and typing
     >telnet smtp.comcast.net 25
    
    This is my reply to Larry' post about my problem.This is my first post here 
    and Mandrake 10 community is my first install/taste of Linux.I did find the 
    problem and it was my pre-install config error.All is working with KMail 
    now. I do have some other ?'s/problems that I will bring up at the next 
    meeting.Will bring my box this time.I will also be bring some FREE ram that 
    is no longer of use to me,so if you need-come or e me and will  tell you 
    what type. 
    
    
  • [Eug-lug] keyboard strangeness



    Allen BrownWed Jul 28 12:46:43 PDT 2004

    Mr O wrote:
    > 
    > You're close on that. USB actually provides power to devices as
    > well but is designed for hotplug. Of course the easiest way to
    > fry a USB port is to plug in a device with external power while
    > the device is on. Printers and scanners are often safe to do
    > that with (perhaps because of grounding?) but just for safety
    > sake I usually plug my camera in before turning it on and it has
    > never failed me.
    
    If a USB device frys when you hotplug it, it should be returned
    as defective.  The USB protocol specifies hotplug-ability.  It
    doesn't make exceptions for part that are already turned on.
    
    > As for warranty, it's rare to fry a PS/2 port on just one or two
    > tries. We do tell our customers to plug in everything that comes
    > with the computer before turning it on and NOT to plug in their
    > older devices until drivers are installed. If it is after a set
    > period of time and they fry the port, we can send the board back
    > for warranty which could take weeks or they can buy a USB
    > keyboard which we usually have on hand.
    
    Are you saying that you have to hotplug PS/2 several times into
    the same motherboard to cause it to fry?  That seems most strange.
    
    By the way, I didn't mean to encourage hotplugging PS/2.  I only
    passed on the observation of some highschool students I have worked
    with.
    -- 
    Allen Brown
      work: Agilent Technologies      non-work: http://www.peak.org/~abrown/
            allen_brown at agilent.com	            abrown at peak.org
      I always avoid prophesying beforehand, because it is a much better
      policy to prophesy after the event has already taken place.
      --- Sir Winston Churchill
    
    
    > --- Linux Rocks! <linux at rocksolidnetworks.com> wrote:
    > > Its true, unplugging the keyboard while a system is powered on
    > > will often blow
    > > the keyboard circuit. This is because the keyboard (like a few
    > > other things
    > > plugged into a computer) is powered by the computer. All
    > > things plugged into
    > > the computer are not powred by the computer, one example is
    > > the serial port.
    > > You can plug/unplug your serial mouse all day long without
    > > dammage.
    > >
    > > Im not sure, but I think unplugging the keyboard (ps2, old
    > > style 5 pin din)
    > > may void the warrenty of the motherboard.
    > >
    > > Whats the ComputerBase policy on unplugging running keyboards?
    > >
    > > Jamie
    
  • [Eug-lug] Reading data to multiple variables



    Bob MillerWed Jul 28 12:46:08 PDT 2004

    Garl Grigsby wrote:
    
    > Doesn't this result in all of the data being in a(1)?
    
    No.
    
        jogger-egg ~> cat gdata
        05e307020000000000000000 Yes
        05e307020000000000000000 Yes 05e307020000000000000000 Yes
        jogger-egg ~> cat gscript
        #!/bin/sh
    
    	    while read line
    	    do
    		a=($line)
    		echo line $line
    		echo a[\*] ${a[*]}
    		echo a[0] ${a[0]}
    		echo a[1] ${a[1]}
    		echo a[2] ${a[2]}
    		echo a[3] ${a[3]}
    	    done < gdata
        jogger-egg ~> bash gscript
        line 05e307020000000000000000 Yes
        a[*] 05e307020000000000000000 Yes
        a[0] 05e307020000000000000000
        a[1] Yes
        a[2]
        a[3]
        line 05e307020000000000000000 Yes 05e307020000000000000000 Yes
        a[*] 05e307020000000000000000 Yes 05e307020000000000000000 Yes
        a[0] 05e307020000000000000000
        a[1] Yes
        a[2] 05e307020000000000000000
        a[3] Yes
        jogger-egg ~> 
    
    > What I am trying to do is to check to see which of several USB
    > harddrives is installed. So I am parsing /proc/scsi/usb-storage*/*
    > for (1) the GUID, and (2) the whether that device is attached or
    > not.
    
    You don't need awk for that.  You could do something like this if
    you wanted to process each USB device separately.
    
    	for unit in /proc/scsi/usb-storage-*/*
    	do
    	    while read name value
    	    do
    		case "$name" in
    		    GUID:)       guid="$value";;
    		    Attached:)   attached="$value";;
    		esac
    	    done < "$unit"
    	    echo ${unit}: GUID: $guid attached: $attached
    	    # do something useful for one unit here.
    	done
    
    -- 
    Bob Miller                              K<bob>
    kbobsoft software consulting
    http://kbobsoft.com                     kbob at jogger-egg.com