euglug.org

[작성자:] admin

  • [Python] shortcut?



    larry priceSun May 21 23:33:23 PDT 2006

    On 5/21/06, Rob Hudson <rob at euglug.net> wrote:
    > Is there a Python shortcut for the following?
    >
    > if d.has_key(k):
    >         d[k].append(v)
    > else:
    >         d[k] = [v]
    >
    > I'm keeping a dictionary of key:list pairs and I'm writing the above
    > often.  I think I remember seeing a shortcut to something like this but
    > I can't recall what it was.
    
    possibly
    
     |  setdefault(...)
     |      D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
    
    but that looks like something that could be awfully dependent on what
    you've got in the dictionary and what the values are or could be. but
    if you know that all entries are either absent or lists you could do
    
    d.setdefault(k,[])
    d[k].append(v)
    
  • [Python] shortcut?



    Rob HudsonSun May 21 18:37:22 PDT 2006

    Is there a Python shortcut for the following?
    
    if d.has_key(k):
    	d[k].append(v)
    else:
    	d[k] = [v]
    
    I'm keeping a dictionary of key:list pairs and I'm writing the above 
    often.  I think I remember seeing a shortcut to something like this but 
    I can't recall what it was.
    
    Thanks,
    Rob
    
  • [Eug-lug] Soft RAID was solution



    Brian GallagherSun Apr 30 13:05:54 PDT 2006

    Its going to be a workstation: now that I have played around with which
    video card will work with blender on which machine, etc.
    
    I think I'm ok now,
    
    BUT: 160GB HDD showed up as 160GB on Ubuntu raid disk druid, but as 152 GB
    on FC4 raid disk druid?  Hey!  Where's my 8GB?  Allocation Unit size, or
    something like that?
    
    I'm using:
    
    /boot		1004GB	ext3
    /     	150617GB	ext3
    swap		1004GB	swap
    
    Brian
    
    
    -----Original Message-----
    From: euglug-bounces at euglug.org [mailto:euglug-bounces at euglug.org]On
    Behalf Of Mr O
    Sent: Sunday, April 30, 2006 10:41 AM
    To: Eugene Unix and Gnu/Linux User Group
    Subject: Re: [Eug-lug] Soft RAID was solution
    
    
    I may have missed some of the boat on this one but.. Is the box
    being setup as a workstation, fileserver, or other? There are a
    few capable distros designed from the ground up for such needs.
    SMEserver defaults to mirroring the drives. FreeNAS is a cool
    BSD based distro that can boot from a CF card and you can manage
    arrays from it's web interface.
    
    Lo siento if that's no help.
    
    __________________________________________________
    Do You Yahoo!?
    Tired of spam?  Yahoo! Mail has the best spam protection around
    http://mail.yahoo.com
    _______________________________________________
    EUGLUG mailing list
    euglug at euglug.org
    http://www.euglug.org/mailman/listinfo/euglug
    
    
  • [Eug-lug] Soft RAID was solution



    Mr OSun Apr 30 10:40:41 PDT 2006

    I may have missed some of the boat on this one but.. Is the box
    being setup as a workstation, fileserver, or other? There are a
    few capable distros designed from the ground up for such needs.
    SMEserver defaults to mirroring the drives. FreeNAS is a cool
    BSD based distro that can boot from a CF card and you can manage
    arrays from it's web interface.
    
    Lo siento if that's no help.
    
    __________________________________________________
    Do You Yahoo!?
    Tired of spam?  Yahoo! Mail has the best spam protection around 
    http://mail.yahoo.com 
    
  • [Eug-lug] Soft RAID was solution



    Brian GallagherSun Apr 30 07:53:34 PDT 2006

    Avoiding on board RAID chipset and using soft RAID on IDE channels with 
    FC4 works fine, per your advice of  a few weeks ago.
    
    Nothing wrong with the NIC's just a firewall configuration issue.
    
    Brian
    
  • [Eug-lug] PLUG Booth at LinuxFest Northwest



    David MandelFri Apr 28 15:41:04 PDT 2006

    LinuxFund, FreeGeek, and PLUG will be sharing a booth (table) at 
    Linuxfest Northwest 2006 (See: http://linuxfestnorthwest.org/)
    in Bellingham, Wa tomorrow.  I don't have anything to exhibit,
    but got a booth as sort of a gathering point for Oregonians.
    
                                              Sincerely,
                                              David Mandel
                                              Chief Activist
                                              Portland Linux/Unix Group
                                              560 SE Alexander
                                              Corvallis, Oregon 97333
                                              (541) 737-9153 at work (OSU)
                                              (541) 730-5285 cell
    
       ======================================================================
       David Mandel                        http://www.DavidMandel.com
       Portland Linux/Unix Group           http://pdxLinux.org
       LinuxFund                           http://LinuxFund.org
       ======================================================================
    
    
  • [Eug-lug] SQL/postgres help on a “cross join” ?



    Matthew JarvisFri Apr 28 15:13:29 PDT 2006

    larry price wrote:
    > To get what you want from straight SQL
    > 
    > I think you end up doing either a bunch of subqueries (one per dept)
    > or an equally convoluted join.
    > 
    > The syntax bit you are looking for is
    > 
    > select table.column as alias_name
    > 
    
    Hmmmm... not the syntax I had in mind....
    
    How do you translate a table like this:
    
    Matt	1	A
    Matt	2	B
    Matt	3	C
    Larry	2	A
    Joe	1	B
    Joe	3	C
    
    into:
    
    Name		A	B	C
    Matt		1	2	3
    Larry		2
    Joe			1	3
    
    
    
    
    Matthew S. Jarvis
    IT Manager
    Bike Friday - "Performance that Packs."
    www.bikefriday.com
    541/687-0487 x140
    mattj at bikefriday.com
    
  • [Eug-lug] SQL/postgres help on a “cross join” ?



    larry priceFri Apr 28 14:44:24 PDT 2006

    To get what you want from straight SQL
    
    I think you end up doing either a bunch of subqueries (one per dept)
    or an equally convoluted join.
    
    The syntax bit you are looking for is
    
    select table.column as alias_name
    
    On 4/28/06, Matthew Jarvis <mattj at bikefriday.com> wrote:
    > Thanks, but that's not it either.... in fact as far as I can tell it's
    > virtually the same results....
    >
    > Looking for the Dept names from Department table to be columns in the
    > result table.....
    >
    > Am I gonna have to sling some code to get this done?
    >
    >
    > Matthew S. Jarvis
    > IT Manager
    > Bike Friday - "Performance that Packs."
    > www.bikefriday.com
    > 541/687-0487 x140
    > mattj at bikefriday.com
    >
    >
    > M. Bitner wrote:
    > > Something like this maybe?
    > >
    > > select employee.last_name, employee.first_name, department.name, sum(
    > > timeentry.hours) as tot_hrs
    > > from timeentry
    > > join employee on timeentry.emp_id = employee.emp_id
    > > join department on employee.department_id = department.department_id
    > > where date( apply_date) > '2006-04-01'
    > > group by department.name, employee.last_name, employee.first_name
    > > order by employee.last_name, department.name
    > >
    > _______________________________________________
    > EUGLUG mailing list
    > euglug at euglug.org
    > http://www.euglug.org/mailman/listinfo/euglug
    >
    
  • [Eug-lug] SQL/postgres help on a “cross join” ?



    Matthew JarvisFri Apr 28 14:33:25 PDT 2006

    Thanks, but that's not it either.... in fact as far as I can tell it's 
    virtually the same results....
    
    Looking for the Dept names from Department table to be columns in the 
    result table.....
    
    Am I gonna have to sling some code to get this done?
    
    
    Matthew S. Jarvis
    IT Manager
    Bike Friday - "Performance that Packs."
    www.bikefriday.com
    541/687-0487 x140
    mattj at bikefriday.com
    
    
    M. Bitner wrote:
    > Something like this maybe?
    > 
    > select employee.last_name, employee.first_name, department.name, sum(
    > timeentry.hours) as tot_hrs
    > from timeentry
    > join employee on timeentry.emp_id = employee.emp_id
    > join department on employee.department_id = department.department_id
    > where date( apply_date) > '2006-04-01'
    > group by department.name, employee.last_name, employee.first_name
    > order by employee.last_name, department.name
    > 
    
  • [Eug-lug] SQL/postgres help on a “cross join” ?



    M. BitnerFri Apr 28 13:34:49 PDT 2006

    Something like this maybe?
    
    select employee.last_name, employee.first_name, department.name, sum(
    timeentry.hours) as tot_hrs
    from timeentry
    join employee on timeentry.emp_id = employee.emp_id
    join department on employee.department_id = department.department_id
    where date( apply_date) > '2006-04-01'
    group by department.name, employee.last_name, employee.first_name
    order by employee.last_name, department.name
    
    On 4/28/06, Matthew Jarvis <mattj at bikefriday.com> wrote:
    > My lack of SQL theory is showing....  <g>
    >
    > This SQL statement:
    >
    > select timeentry.emp_id, employee.last_name, employee.first_name,
    > timeentry.dept_id, department.name, sum( timeentry.hours) as tot_hrs
    > from timeentry, employee,department  where date( apply_date) >
    > '2006-04-01' and timeentry.emp_id = employee.emp_id and
    > timeentry.dept_id = department.dept_id group by timeentry.emp_id,
    > timeentry.dept_id, department.name, employee.last_name,
    > employee.first_name order by employee.last_name, department.name;
    >
    > Gives me:
    >
    >   emp_id |  last_name  | first_name | dept_id |      name       | tot_hrs
    > --------+-------------+------------+---------+-----------------+---------
    >       74 | Casler      | Chris      |       1 | Production Line |     154
    >       74 | Casler      | Chris      |       5 | Tooling         |    0.75
    >       99 | Cheek       | Mike       |      28 | 5S              |     0.5
    >       99 | Cheek       | Mike       |      21 | 75%Mfg/25%CSvc  |    7.75
    >       99 | Cheek       | Mike       |       3 | Customer Servic |    0.75
    >       99 | Cheek       | Mike       |      27 | Improvements    |    0.75
    >       99 | Cheek       | Mike       |       1 | Production Line |  134.75
    >       99 | Cheek       | Mike       |      26 | X-Training      |    18.5
    >       88 | Coon        | Monty      |       3 | Customer Servic |       2
    >       88 | Coon        | Monty      |      27 | Improvements    |     0.5
    >       88 | Coon        | Monty      |       1 | Production Line |  156.75
    >
    >
    > Where I want to end up is more or less like:
    >
    > last_name | Production Line | Tooling | (all the other depts)| Total  |
    > ----------+-----------------+---------+----------------------+--------+
    > Casler    |     154         |  0.75   |                      | 154.75 |
    > Cheek     |   etc.
    >
    >
    >
    > In other words, make each Dept name a column in the result, with the
    > hours as the column data....
    >
    > I've seen this done before but can't remember how it works...
    >
    > Oh, and I'd prefer to do it all in postgres w/o having to resort to
    > programming it....
    >
    > Oh, and I'm in a hurry....  <g>
    >
    > Any thoughts?
    >
    >
    > --
    > 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
    >