LG R560
Hello, fine folks. I apologize for the line noise. If anybody here owns an "LG r560 WIDEBOOK", I will very much appreciate if he/she will be able to post back the output of: dmidecode lspci -vvnn I am trying to assess the Linux compatibility issues of this model, before purchase. TIA, | Cheers, | Chen. ___ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
Re: OT: Where does it count?
That's a bit off topic cause indeed you refer to greatness in one's profession/occupation/hobby but in any case, i remember the article you mentioned and the whole thesis it talks about. There was at least one Israeli weekend newspapers article, probably about the relevant translated book that talked about this. The name is Malcolm Gladwell and the following link is about the book that talks about that idea: (hebrew) http://simania.co.il/bookdetails.php?item_id=688839 his web site: http://www.gladwell.com/index.html Boaz. Shachar Shemesh wrote: Hetz Ben Hamo wrote: My question is simple: When does the "developer" experience starts ticking? (I'm not talking about any specific language here). Do the years of writing those small programs/scripts count as a "developer years"? or does the clock starts ticking when I'm a full time programmer? Partiality of occupation is hardly a factor, but experience is. I don't have the link, (I think it was on slashdot a while back), but someone once claimed that the difference between a programmer with greatness potential and actual great programmers is X hours of experience (I don't remember what X was, but it translated to about 3 or 5 years of full time job experience). The article claimed that the same X applies to other areas too (the article used the Beatles as a primary example). My point is that in order to realize your potential in any field, you need to invest a huge amount of time practicing it. This is almost impossible to do unless you make it your full time occupation. From personal experience, I think the article's quoted X may even be a little on the low side. So, if you did mostly system tasks, but did about 10% development, you will see how, for practical reasons, that leaves very little of your actual development experience. I should point out that the article talks about greatness. Assuming you have the potential to become a great programmer, this is a requirement for becoming great actually happening. Personally, I pride myself on seeing programmers, in certain cases total novices, and saying to myself "he has the potential". They are not great programmers, but you can see that with enough experience, they will be. That said, even those that do not possess the potential for "greatness" advance significantly with experience. At a guesstimate, about 60% of the population can become acceptable quality programmers given enough experience (of course, initially they will suck) and a supporting environment ("supporting" includes not accepting mediocre). Of course, most of those will quit, because programming is a horrid job to do if you don't like it, but this is just to point you as to why Shachar -- Shachar Shemesh Lingnu Open Source Consulting Ltd. http://www.lingnu.com ___ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il ___ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
Perl question: array member of referenced hash
Hi all, $ref is a reference to a hash. Hash contains a component called "a" which is an array. I would like to iterate all elements of said array. I would like to do something along the lines of: foreach my $elem @%$ref{a} { print "$elem\n"; } Which, I think it clear, does not work. I also tried: foreach my $elem @(%$ref){a} { print "$elem\n"; } which complains about: Bareword "a" not allowed while "strict subs" in use and: foreach my $elem @(%$ref){'a'} { print "$elem\n"; } which complains about: Global symbol "$elem" requires explicit package name at line 3 (i.e. - inside the for). Any help would be appreciated. Thanks, Shachar -- Shachar Shemesh Lingnu Open Source Consulting Ltd. http://www.lingnu.com -- Shachar Shemesh Lingnu Open Source Consulting Ltd. http://www.lingnu.com ___ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
Re: Perl question: array member of referenced hash
Hi Shachar, First you can always use Data::Dumper: use Data::Dumper; print Dumper($ref); To make sure that the data is stored correctly. In regard to your question: my $ref; my %hash = %{$ref}; foreach my $ptrelem (keys %hash) { my @array = @{$ptrelem}; foreach my $item (@array) { print $item; } } From my experience with perl, doing shortcuts don't work too well, and doing it the long way, helps with debugging and finding out what the problem is. 2009/10/24 Shachar Shemesh : > Hi all, > > $ref is a reference to a hash. Hash contains a component called "a" which is > an array. I would like to iterate all elements of said array. > > I would like to do something along the lines of: > foreach my $elem @%$ref{a} > { > print "$elem\n"; > } > > Which, I think it clear, does not work. I also tried: > foreach my $elem @(%$ref){a} > { > print "$elem\n"; > } > > which complains about: > Bareword "a" not allowed while "strict subs" in use > > and: > foreach my $elem @(%$ref){'a'} > { > print "$elem\n"; > } > > which complains about: > Global symbol "$elem" requires explicit package name at line 3 (i.e. - > inside the for). > > Any help would be appreciated. > > Thanks, > Shachar > > -- > Shachar Shemesh > Lingnu Open Source Consulting Ltd. > http://www.lingnu.com > > -- > Shachar Shemesh > Lingnu Open Source Consulting Ltd. > http://www.lingnu.com > > ___ > Linux-il mailing list > Linux-il@cs.huji.ac.il > http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il > > ___ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
Re: Perl question: array member of referenced hash
Sorry a mistake... foreach my $ptrelem (keys %hash) { Should be foreach my $key (keys %hash) { my $ptritem = %hash->{$key}; On Sat, Oct 24, 2009 at 7:55 PM, Noam Rathaus wrote: > Hi Shachar, > > First you can always use Data::Dumper: > use Data::Dumper; > print Dumper($ref); > > To make sure that the data is stored correctly. > > In regard to your question: > > my $ref; > my %hash = %{$ref}; > foreach my $ptrelem (keys %hash) { > my @array = @{$ptrelem}; > foreach my $item (@array) { > print $item; > } > } > > From my experience with perl, doing shortcuts don't work too well, and > doing it the long way, helps with debugging and finding out what the > problem is. > > 2009/10/24 Shachar Shemesh : >> Hi all, >> >> $ref is a reference to a hash. Hash contains a component called "a" which is >> an array. I would like to iterate all elements of said array. >> >> I would like to do something along the lines of: >> foreach my $elem @%$ref{a} >> { >> print "$elem\n"; >> } >> >> Which, I think it clear, does not work. I also tried: >> foreach my $elem @(%$ref){a} >> { >> print "$elem\n"; >> } >> >> which complains about: >> Bareword "a" not allowed while "strict subs" in use >> >> and: >> foreach my $elem @(%$ref){'a'} >> { >> print "$elem\n"; >> } >> >> which complains about: >> Global symbol "$elem" requires explicit package name at line 3 (i.e. - >> inside the for). >> >> Any help would be appreciated. >> >> Thanks, >> Shachar >> >> -- >> Shachar Shemesh >> Lingnu Open Source Consulting Ltd. >> http://www.lingnu.com >> >> -- >> Shachar Shemesh >> Lingnu Open Source Consulting Ltd. >> http://www.lingnu.com >> >> ___ >> Linux-il mailing list >> Linux-il@cs.huji.ac.il >> http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il >> >> > ___ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
Re: Perl question: array member of referenced hash
Noam beat me to it, but here's perl solution without additional variables: #!/usr/bin/perl %hash = (a=>['moo','goo','woo'], foo=>3, baz=>5); $ref = \%hash; foreach my $elem (@{$ref->{a}}) { print "$elem\n"; } Regards, Dov 2009/10/24 Shachar Shemesh > Hi all, > > $ref is a reference to a hash. Hash contains a component called "a" which > is an array. I would like to iterate all elements of said array. > > I would like to do something along the lines of: > foreach my $elem @%$ref{a} > { > print "$elem\n"; > } > > Which, I think it clear, does not work. I also tried: > foreach my $elem @(%$ref){a} > { > print "$elem\n"; > } > > which complains about: > Bareword "a" not allowed while "strict subs" in use > > and: > foreach my $elem @(%$ref){'a'} > { > print "$elem\n"; > } > > which complains about: > Global symbol "$elem" requires explicit package name at line 3 (i.e. - > inside the for). > > Any help would be appreciated. > > Thanks, > Shachar > > -- > Shachar Shemesh > Lingnu Open Source Consulting Ltd.http://www.lingnu.com > > > -- > Shachar Shemesh > Lingnu Open Source Consulting Ltd.http://www.lingnu.com > > > ___ > Linux-il mailing list > Linux-il@cs.huji.ac.il > http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il > > ___ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
Re: Perl question: array member of referenced hash
Dov Grobgeld wrote: Noam beat me to it, but here's perl solution without additional variables: #!/usr/bin/perl %hash = (a=>['moo','goo','woo'], foo=>3, baz=>5); $ref = \%hash; foreach my $elem (@{$ref->{a}}) Hi Dov, Yes, it works. Now can you, please, explain to me why? What is the role of each bracket you used (and its location)? Shachar -- Shachar Shemesh Lingnu Open Source Consulting Ltd. http://www.lingnu.com ___ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
Re: Perl question: array member of referenced hash
Shachar, { } in Perl are casting when they surround a value And the second set of { } around the 'a' mean variable of Hash 2009/10/24 Shachar Shemesh : > Dov Grobgeld wrote: > > Noam beat me to it, but here's perl solution without additional variables: > > #!/usr/bin/perl > > %hash = (a=>['moo','goo','woo'], > foo=>3, > baz=>5); > > $ref = \%hash; > foreach my $elem (@{$ref->{a}}) > > Hi Dov, > > Yes, it works. Now can you, please, explain to me why? What is the role of > each bracket you used (and its location)? > > Shachar > > -- > Shachar Shemesh > Lingnu Open Source Consulting Ltd. > http://www.lingnu.com > > ___ > Linux-il mailing list > Linux-il@cs.huji.ac.il > http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il > > ___ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
Re: Perl question: array member of referenced hash
Noam Rathaus wrote: Shachar, { } in Perl are casting when they surround a value And the second set of { } around the 'a' mean variable of Hash Grumble grumble grumble Okay, I'm sorry for being difficult. I really couldn't find the answer in the Perl documentation. I understand the second set of curly braces. I also, somewhat, understand that the -> replaces the % (i.e. - reference dereferencing). What I'm not so clear is what the first set of curly braces do (what do you mean by "casting" - casting to what? How is that decided?). I'm also not clear on why the surrounding round brackets are needed. I understand they are so this will be a list context, but I don't understand why it's needed once I put a @ to dereference the array. Thanks, Shachar foreach my $elem (@{$ref->{a}}) -- Shachar Shemesh Lingnu Open Source Consulting Ltd. http://www.lingnu.com ___ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
Re: Perl question: array member of referenced hash
2009/10/24 Shachar Shemesh : > Noam Rathaus wrote: > > Shachar, > > { } in Perl are casting when they surround a value > And the second set of { } around the 'a' mean variable of Hash > > > > > Grumble grumble grumble not surprised as this is one of the funky places of Perl 5. > > Okay, I'm sorry for being difficult. I really couldn't find the answer in > the Perl documentation. > > I understand the second set of curly braces. I also, somewhat, understand > that the -> replaces the % (i.e. - reference dereferencing). What I'm not so > clear is what the first set of curly braces do (what do you mean by > "casting" - casting to what? How is that decided?). I'm also not clear on > why the surrounding round brackets are needed. I understand they are so this > will be a list context, but I don't understand why it's needed once I put a > @ to dereference the array. > > Thanks, > Shachar > > foreach my $elem (@{$ref->{a}}) err, I don't think that "casting" is the right word to use here. What {} does here is disambiguates the expression. Here is a table $x - scalar @x - array %x - hash $ra = \...@x reference to array sticking @ infront of the reference to an array dereferences it @x is the same as @$ra (you could also write and @{$ra} but it is not necessary) $x[1] is the same as $$ra[1] (element of array, replace @ by $ and attach the index) but it is ugly so it can also be written as $ra->[1] $rh = \%x reference to hash sticking % infront of the reference to a hash dereferences it %x is the same as %$rh (could be also written as %{$rh} but it is not necessary) $x{foo} is the same as $$fh{foo} which is the same as $fh->{foo} Now what if you have two dimensions: first dimension is a hash second dimension is an array. %h is a hash @something = ('foo'); $h{a} = \...@something; Which means print $h{a}[0];# 'foo'; $ref = \%h; reference to hash %h is the same as %$ref $h{a} is the same as $$ref{a} or as $ref->{a} which is the reference to the array: \...@something sticking @ in front of it would dereference the array which would yield @$h{a} or @$$ref{a} @$ref->{a} which is the same as @something but it is not clear what does either of these mean (looking at the last one, @$ref could mean $ref is a reference to an array and that you are dereferencing @$ref and the resulting thingy is a hash ref) So we wrap the reference in a curly brace to make it clear that is a single variable: @{$h{a}} or @{$$ref{a}} @{$ref->{a}} which is the same as @{something} so the {} is basically around the "name' of the variable. Hope this helps Gabor ___ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
Re: Perl question: array member of referenced hash
Gabor Szabo wrote: err, I don't think that "casting" is the right word to use here. What {} does here is disambiguates the expression. Let me try to summarize what I understood from your excellent explanation: Putting a modifier in front of a reference dereference it to the right type ($ for scalar etc.). Alternatively, putting a '->' (which is a unary operator, not a binary one) also dereferences it, no matter what it is pointing to.(at least for array and hash), so long as there is some reference to its content on the operator's right (the same as it is implemented in C++, only more confusing). The curly braces act as a scoping operator, making the $/@/% relation to parts of the expression unique. All that is left is understanding why the round braces around the whole expression. Many thanks (the explanation was very useful) Shachar -- Shachar Shemesh Lingnu Open Source Consulting Ltd. http://www.lingnu.com ___ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
Re: Perl question: array member of referenced hash
On Sat, Oct 24, 2009 at 11:25 PM, Shachar Shemesh wrote: > Let me try to summarize what I understood from your excellent explanation: if that works for you :-) > > All that is left is understanding why the round braces around the whole > expression. Oh, the syntax of foreach has those parentheses foreach my $iterator (things to iterate over) { } Where the things to iterate over can be a simple list of values, an array or anything that returns a list of values which of course can be any expression. foreach my $iterator (1,2,3,4,5) { } or for the lazy ones foreach my $iterator (1..5) { } or for the really lazy ones: for my $iterator (1..5) { } or foreach my $iterator (@names) { } foreach my $iterator (@$ref) { } foreach my $iterator (function_that_returns_thingies()) { } Gabor http://szabgab.com/blog.html Perl Training Israel http://www.pti.co.il/ ___ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il