From bradley.d.andersen at gmail.com Wed Apr 4 10:20:04 2012 From: bradley.d.andersen at gmail.com (Bradley Andersen) Date: Wed, 4 Apr 2012 13:20:04 -0400 Subject: [Purdue-pm] Why does this work? Message-ID: 1 #!/usr/bin/env perl 2 3 use strict; 4 use warnings; 5 6 use feature 'say'; 7 8 for my $i(1 .. 10) {; 9 say $i; 10 } ?? Why does that work? -------------- next part -------------- An HTML attachment was scrubbed... URL: From westerman at purdue.edu Wed Apr 4 13:28:40 2012 From: westerman at purdue.edu (Rick Westerman) Date: Wed, 4 Apr 2012 16:28:40 -0400 (EDT) Subject: [Purdue-pm] Why does this work? In-Reply-To: <1942813725.84164.1333571284288.JavaMail.root@mailhub016.itcs.purdue.edu> Message-ID: <1874573518.84166.1333571320642.JavaMail.root@mailhub016.itcs.purdue.edu> Why shouldn't it work? I presume you are talking about "why does the null statement after the left brace not interfere with the program?" If so then the answer is simple -- it is a null statement. ----- Original Message ----- > 1 #!/usr/bin/env perl > 2 > 3 use strict; > 4 use warnings; > 5 > 6 use feature 'say'; > 7 > 8 for my $i(1 .. 10) {; > 9 say $i; > 10 } > > > ?? Why does that work? > > > _______________________________________________ > Purdue-pm mailing list > Purdue-pm at pm.org > http://mail.pm.org/mailman/listinfo/purdue-pm -- Rick Westerman westerman at purdue.edu Bioinformatics specialist at the Genomics Facility. Phone: (765) 494-0505 FAX: (765) 496-7255 Department of Horticulture and Landscape Architecture 625 Agriculture Mall Drive West Lafayette, IN 47907-2010 Physically located in room S049, WSLR building From mark at ecn.purdue.edu Wed Apr 4 13:32:51 2012 From: mark at ecn.purdue.edu (Mark Senn) Date: Wed, 04 Apr 2012 16:32:51 -0400 Subject: [Purdue-pm] Why does this work? In-Reply-To: References: Message-ID: <15904.1333571571@pier.ecn.purdue.edu> Bradley Andersen wrote: > #!/usr/bin/env perl > > use strict; > use warnings; > > use feature 'say'; > > for my $i(1 .. 10) {; > say $i; > } > > ?? Why does that work? >From "http://perldoc.perl.org/perlsyn.html": The foreach keyword is actually a synonym for the for keyword, so you can use foreach for readability or for for brevity. The "{;" doesn't cause problems because the statement between "{" and ";" is zero length and zero length statements are allowed. This code works fine ;;;;; say 'hello' ;;;;; -mark From bradley.d.andersen at gmail.com Wed Apr 4 13:33:25 2012 From: bradley.d.andersen at gmail.com (Bradley Andersen) Date: Wed, 4 Apr 2012 16:33:25 -0400 Subject: [Purdue-pm] Why does this work? In-Reply-To: <15904.1333571571@pier.ecn.purdue.edu> References: <15904.1333571571@pier.ecn.purdue.edu> Message-ID: everyone seems to have missed that i replied already that i turned on my brain and figured it out :) On Wed, Apr 4, 2012 at 4:32 PM, Mark Senn wrote: > Bradley Andersen wrote: > > #!/usr/bin/env perl > > > > use strict; > > use warnings; > > > > use feature 'say'; > > > > for my $i(1 .. 10) {; > > say $i; > > } > > > > ?? Why does that work? > > From "http://perldoc.perl.org/perlsyn.html": > The foreach keyword is actually a synonym for the for keyword, > so you can use foreach for readability or for for brevity. > > The "{;" doesn't cause problems because the statement between > "{" and ";" is zero length and zero length statements are allowed. > This code works fine > ;;;;; > say 'hello' > ;;;;; > > -mark > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jacoby at purdue.edu Wed Apr 4 13:35:31 2012 From: jacoby at purdue.edu (Dave Jacoby) Date: Wed, 04 Apr 2012 16:35:31 -0400 Subject: [Purdue-pm] Why does this work? In-Reply-To: References: <15904.1333571571@pier.ecn.purdue.edu> Message-ID: <4F7CB093.2000907@purdue.edu> On 4/4/2012 4:33 PM, Bradley Andersen wrote: > everyone seems to have missed that i replied already that i turned on my > brain and figured it out :) That email hasn't come to me. -- Dave Jacoby Code Maker, Purdue Genomics Core Lab http://web.ics.purdue.edu/~djacoby 733 days until the end of XP support From bradley.d.andersen at gmail.com Wed Apr 4 13:37:43 2012 From: bradley.d.andersen at gmail.com (Bradley Andersen) Date: Wed, 4 Apr 2012 16:37:43 -0400 Subject: [Purdue-pm] Fwd: Why does this work? In-Reply-To: References: Message-ID: ---------- Forwarded message ---------- From: Bradley Andersen Date: Wed, Apr 4, 2012 at 2:02 PM Subject: Re: Why does this work? To: Purdue Perl Mongers I just turned on my brain and I think I know why now, sorry :) (I was referring to line 8) On Wed, Apr 4, 2012 at 1:20 PM, Bradley Andersen < bradley.d.andersen at gmail.com> wrote: > 1 #!/usr/bin/env perl > 2 > 3 use strict; > 4 use warnings; > 5 > 6 use feature 'say'; > 7 > 8 for my $i(1 .. 10) {; > 9 say $i; > 10 } > > > ?? Why does that work? > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bradley.d.andersen at gmail.com Wed Apr 4 11:02:33 2012 From: bradley.d.andersen at gmail.com (Bradley Andersen) Date: Wed, 4 Apr 2012 14:02:33 -0400 Subject: [Purdue-pm] Why does this work? In-Reply-To: References: Message-ID: I just turned on my brain and I think I know why now, sorry :) (I was referring to line 8) On Wed, Apr 4, 2012 at 1:20 PM, Bradley Andersen < bradley.d.andersen at gmail.com> wrote: > 1 #!/usr/bin/env perl > 2 > 3 use strict; > 4 use warnings; > 5 > 6 use feature 'say'; > 7 > 8 for my $i(1 .. 10) {; > 9 say $i; > 10 } > > > ?? Why does that work? > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mark at purdue.edu Sat Apr 7 13:31:57 2012 From: mark at purdue.edu (Mark Senn) Date: Sat, 07 Apr 2012 16:31:57 -0400 Subject: [Purdue-pm] Perl code to use steering wheel on Linux Message-ID: <12305.1333830717@pier.ecn.purdue.edu> Purdue Perl Mongers, I was thinking about giving a talk about this at the next Purdue Perl Mongers meeting but decided it wasn't a broad enough topic. Below is Perl code that reads values from a steering wheel, gas pedal, and brake pedal attached to a Linux computer. (T'm building a 18" long radio controlled six wheel drive car that I plan to drive using a steering wheel on my computer using a web browser. The idea is the can could be used anywhere in the world where a web server would be within radio controlled range of the car. A makerspace/hackerspace is in the process of being formed in Lafayette to work on crazy projects like this. See http://LafayetteMakerspace.org to sign up for the (two messages a month) mailing list if you're interested.) -mark #!/usr/bin/perl # # .index read information from Genious TwinWheel steering wheel # # .revised t.pl 2012-04-07 Mark Senn http://engineering.purdue.edu/~mark # .created t.pl 2012-03-30 Mark Senn http://engineering.purdue.edu/~mark # # .description # .p # This program shows how to use Perl to read information from # a "Genius TwinWheel F1 Vibration Feedback Racing Wheel for # PC ad PS2 games". This program is based on # .verbatim # http://search.cpan.org/~bwatson/Linux-Joystick-0.0.1/Joystick.pm#USAGE # .everbatim # .ep # .p # The configuration of buttons on the Genius TwinWheel F1 is # .verbatim # L2 R2 # L1 R1 # # DV+ NOR # DH- DH+ WES EAS # DV- SOU # # L3 R3 # SE ST # MODE # .everbatim # where # .table # BUTTON DESCRIPTION BUTTON DESCRIPTION # DV+ D-pad Vertical+ NOR NORTH # DH- D-pad Horizontal- WES WEST # DH+ D-pad Horizontal+ EAS EAST # DV- D-pad Vertical- SOU SOUTH # # SE SELECT # ST START # .etable # .ep # .edesciption # # .history # .he 2012-03-30 # .p # Started. # .ep # .ehe # .he 2012-03-31 # .p # Did more work. # .ep # .ehe # .he 2012-04-07 # .p # Improved code and comments. # .ep # .ehe # .ehistory # use strict; use warnings; use feature 'say'; use Linux::Joystick; # Make a steering wheel object. my $sw = new Linux::Joystick; say 'The steerig wheel has:'; say ' ', $sw->axisCount(), ' axes'; say ' ', $sw->buttonCount(), ' buttons'; say 'Pulling right-hand lever towards you is equivalent to pushing the north button.'; say 'Pulling left-hand lever towards you is equivalent to pushing the east button.'; say 'Pressing the "MODE" button does not generate an event.'; # Map button numbers to button names. my %button = ( 0 => 'NORTH', 1 => 'EAST', 2 => 'SOUTH', 3 => 'WEST', 4 => 'R2', 5 => 'L2', 6 => 'L1', 7 => 'R1', 8 => 'SELECT', 9 => 'START', 10 => 'L3', 11 => 'R3', ); # Printf format. my $f = "%-6s %-10s %s\n"; # Use blocking reads to wait for the next event. while (my $e = $sw->nextEvent) { if ($e->isAxis && $e->axis == 0) { printf $f, 'Steer', '', $e->axisValue; next; } if ($e->isAxis && $e->axis == 1) { printf $f, 'Speed', '', $e->axisValue; next; } if ($e->isAxis && $e->axis == 2) { printf $f, 'D-pad', 'HORIZONTAL', $e->axisValue; next; } if ($e->isAxis && $e->axis == 3) { printf $f, 'D-pad', 'VERTICAL', $e->axisValue; next; } if ($e->isButton) { printf $f, 'Button', ($e->buttonDown) ? 'down' : 'up', $button{$e->button}; next; } die 'Unknown event ' . $e->hexDump; } # If the while loop terminates, we have a false (undefined) event. die 'Error reading joystick: ' . $sw->errorString; From jacoby at purdue.edu Thu Apr 12 12:38:38 2012 From: jacoby at purdue.edu (Dave Jacoby) Date: Thu, 12 Apr 2012 15:38:38 -0400 Subject: [Purdue-pm] Perl Mongers Meeting - April 17 Message-ID: <4F872F3E.5040105@purdue.edu> It's that time again: Time to beat the bushes to make sure we have presentations and topics for discussion. Mark has plans to talk about driving a robot car with Linux, but I wonder what other things people are doing with computing, with Linux and preferably with Perl these days. Any other talks out there? -- Dave Jacoby Code Maker, Purdue Genomics Core Lab http://web.ics.purdue.edu/~djacoby 725 days until the end of XP support From mark at purdue.edu Tue Apr 17 04:44:26 2012 From: mark at purdue.edu (Mark Senn) Date: Tue, 17 Apr 2012 07:44:26 -0400 Subject: [Purdue-pm] "Data Algebra" talk Message-ID: <7353.1334663066@pier.ecn.purdue.edu> Purdue Perl Mongers, Thought you might be interested in this "Data Algebra" talk. -mark Subject: Math Club Special Guest Speaker and Final Talk for the Semester 4/19 From: Nathaniel Johnson To: Nathaniel Johnson Hey All! This week we're having another guest speaker coming, Dr. Gary Sherman, the Principal Mathematician for Algebraix Data Corp. He will be talking to us about "Data Algebra" how it's developed. Below is his abstract for his speech. This will be the last talk for the semester and it promises to be a good one; so don't miss out! The talk will be held in a different location this week: MTHW 210 (the really big room in Matthew's); but still at 6pm on Thursday (April 19th). TITLE: What's a data algebra and how do you build one? ABSTRACT: Ask n people the question "What's data?" and the cardinality of the set of responses is better approximated by n than by one. Any self respecting mathematician is puzzled by this --- denizens of data-world, not so much. Indeed, ever since E. F. Codd's 1970 paper, A Relational Model of Data for Large Shared Data Banks (Comm. ACM, Vol. 13, No. 6, pp. 377-387) gave rise to the Relational Data Model (RDM), the data-world's solution to this congenital ambiguity has been to exacerbate it by conflating the data, whatever it is, with some prejudicial visual artifice (tables in the case of the RDM); i.e., by confusing the message with the paper it's written on --- so to speak. What is worse, each new artifice comes equipped with a brief, supposedly-mathematical incantation to justify the trip down a new rabbit hole. This talk discusses Algebraic Data Corporation's approach to knowing data in the context of Zemelo-Frankel set theory, the foundation for all modern mathematics and, therefore, the only legitimate incantation to use when invoking the good name of mathematics. Indeed, our incantation births a rigorous notion of data algebra in plain sight of the RDM and its mongrel spawn, Structured Query Language (SQL). See You There, Nate Johnson Ambassador to the Math Club From djacoby at purdue.edu Tue Apr 17 08:34:02 2012 From: djacoby at purdue.edu (David A Jacoby) Date: Tue, 17 Apr 2012 11:34:02 -0400 (EDT) Subject: [Purdue-pm] Meeting today Message-ID: <4EF719D5-9D7F-47D4-AEEB-B329C78E303A@purdue.edu> Today is the day for Purdue Perl Mongers. The conversation its starting now. WSLR 116. -- Dave Jacoby jacoby at purdue.edu Not at his desk -------------- next part -------------- An HTML attachment was scrubbed... URL: