@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32



Comments:

<0> wolverian: Don't over-use <>.
<1> what does scalar(@array) do?
<1> return the size of the array?
<0> Default to {}, as in Perl 5.
<2> it's just so convenient to type, compared to {}
<2> on this keyboard
<0> wolverian: Still, why would you want to resolve it by hand?
<3> jonx, yes, the length of the list stored in the array
<0> wolverian: Just use .value :)
<4> perlmonkey: my $string = 'select * from table'; subname($string);
<0> wolverian: Wanting the keys makes no sense anyway :)
<2> Juerd, I wonder if there's a multi values (Array[Pair] *@foo) { @foo.value }
<4> perlmonkey: and within your sub, you get the string as elements of @_
<1> Pete_I, length of the list stored in the array? oh so so its a list within my array? ( (1,2,3), (4,5,6) ) it would return 3?
<0> wolverian: I hope not.
<2> Juerd, why not?



<5> jpeg: thanks
<0> wolverian: If you have lots of functions like that, it becomes less obvious what a certain piece of code will do.
<0> wolverian: I prefer having simple LEGO blocks, and building things myself, so that I understand other LEGO buildings too.
<2> I suppose so. it's just that in my view, Array[Pair] could coerce to Hash
<2> then again, marking that explicitly in the code would be good
<6> wolverian: (hash) @foo ?
<0> wolverian: If *everything* dwims, the result is that actually nothing does anymore.
<2> (%h.sort:{.value} as Hash).keys
<0> Dwimmery should be forcefully limited.
<1> anyone? i am still confused about the meaning of scalar(@myArray)
<2> eh, but that loses the ordering
<6> wolverian: as?
<2> never mind
<2> f00li5h, I think that's the perl6 coercion operator, yes.
<0> wolverian: Right, coercing to hash, whether explicit or implicit, loses order, so is senseless with sort.
<6> wolverian: really...
<7> Juerd: what's confusing about that?
<7> jonx: sorry
<0> cfedde: It's not confusing yet, at this level.
<7> Juerd: bogus auto complete. I need to wake up before I press enter
<0> cfedde: But saving only one character, or two in ascii, isn't worth adding a new identifier and wasting a few brain cells over.
<1> cfedde, well why would someone do scalar @array when they could just use @array in scalar context and it becomes the size
<0> Oh
<1> scalar(@array) just gives the size of the array
<0> cfedde: My last line was strangely appropriate then :)
<6> jonx: because they want to.
<0> jonx: "size" is unclear. "number of elements" is unambiguously clear.
<0> jonx: "size" could be measured in bytes, characters, or even square inches.
<7> jonx: you'll find that perl has lots of features just because it makes a convenient syntax.
<1> so if i have @myArray = ( (1,2,3), (1,2,3) ) .. then scalar (@myArray) shoudl be two huh?
<6> jonx: 6?
<7> well your exampel flattens
<7> example
<1> oh
<0> jonx: () doesn't create an array
<8> this doesn't really conser perl, but i was wondering if someone could help me do some selecting from a db? - what i need is to select a list of data using a sertain query, but at the same time i need to find a spesific row inside that subset
<0> jonx: () just group. Your example is equal to @myArray = (1, 2, 3, 1, 2, 3);
<8> ... should i do two queries, or just one - and then use perl to find the unique entry inside the subset?
<6> janhaa: do 2 queries
<1> well at the moment i have an array of lists.. and I am just curious how scalar(@array) handles that
<7> janhaa: sounds like a job for union
<6> janhaa: or perhaps do an order by <the condition for the row you want>
<0> jonx: It's impossible to have an array of lists. Having a list of arrays is possible, though.
<8> f00li5h, thanks. i'll do that then :)
<6> janhaa: any time
<0> f00li5h: Perl 6 people read that as 'the', 'condition', 'for', 'the', 'row', 'you', 'want'... :)
<8> cfedde, not really a join issue...
<8> f00li5h, hehe :)
<7> janhaa: note I said union not join.
<1> Juerd, oops sorry.. i have a list of arrays
<4> eval: @ar= qw/1 2 3 4 5/ ; scalar(@ar);
<9> jpeg: Return: 5
<8> cfedde, what 's the difference? :/
<6> Juerd: yeah, that's true... but it's sql, not perl.
<7> janhaa: you need to learn your sql too. :-)
<0> jonx: That's better. Now let's advance to the next level: it's actually a list of *references* to arrays.
<4> eval: @ar= qw/1 2 3 4 5/ ; $#ar;
<9> jpeg: Return: 4
<8> cfedde, probably. but i thought union was to join two tables...



<8> cfedde, i'll look it up.
<6> janhaa: argh! no!
<7> janhaa: select ... union select ... just gives you all the elements of both selects.
<6> cfedde: but odds are that you can just do it with an or in the where.
<7> fontp: probably. depends on the rdbms you are using.
<7> f00li5h: .. sheesh I'm not able to drive my autoselect.
<7> maybe I should just go to bed....
<6> cfedde: you're what?
<8> ey! sounds like a good idea :) maybe i could have the unique row as the last row, and then the subset first :)
<8> or something...
<10> janhaa: i still don't get it
<7> janhaa: I might try to craft a result where an artificial column is true for the interesting cases.
<8> guess using sql to do the job will be the fastest anyway - right?
<7> if I wanted to do it in one query.
<8> jink, don't worry - i do now :)
<8> cfedde, yup. will do.
<8> can i do as many UNIONs as i like?
<11> hello
<11> i perform a response flush un my website. and it runs a long time. so if somebody closes the browser, the perl process run's anyway. is it possible to ask if the browser is still listening ?
<7> synie: not in the normal case.
<8> synie, not really. just add a timeout in your script
<11> hmm, okay ...
<7> if you use small transactions, keep alive and server push. But for single long running hits there's no good way except that the socket died.
<11> is there any difference between server-push and '$|=1;' ?
<7> synie: yes
<11> so as i understood u, it is possible to ask for the browser if i'll use server-push ?
<5> what does qq{ mean?
<7> server push is where the same connection is used for several consecutive hits.
<7> perlmonkey: that's the same as "
<7> but it ends when it sees }
<5> oh i see
<5> cfedde: I have a $ which causes an error if I enclose it with " but its fine if I use qq{ };
<7> perlmonkey: that's odd. I'm not sure why that would happen.
<5> strange
<7> what's in the variable?
<5> I will show you...
<12> "perlmonkey" at 82.37.56.210 pasted "$add_form = " $open_form $open" (29 lines, 1.6K) at http://sial.org/pbot/17461
<13> you cannot do multiline strings that way
<7> sure you can
<5> it only works with qq{
<11> but i read a lot of things where people said something like "$|=1; while(1) { print 'x'; }" was server push ...
<5> I'm just wondering why
<13> perlmonkey: thats because you got a $foo{"bar"} in there
<5> oh
<13> the "" string stops at the " before bar
<14> perlmonkey: the Select{"$select"} perhaps?
<7> Select{"$select"}.. oops what whoever said...
<5> I removed it but no change
<13> and i anyhow recommend HERE document style multiple line strings
<13> $foo = <<STUFF
<13> etc
<7> I'm ambivelent about the heardoc form vs the quoted form. As things get this complex I tend to fall over to a templating system
<15> ave! good morning.
<5> phew
<5> good morning integral
<7> but the only problem with multiline quotes is keeping your escapes streight. This is why qq{} is a reasonable approach
<7> straight
<14> """
<7> integral: which is the other reason I start using a template system somewhere along this path.
<7> Or generators.
<15> *nod* I just get irritated by too many small files on small projects
<7> there's no win is there.
<7> 8-)
<15> no, there's only an increasing familiarity with recursive directory listers
<15> (svk ls -R)++
<7> and learning to teach your editor about dealing with them
<15> meh, I don't bother with that
<5> I cannot make sub calls inside a qq{ }; ?
<7> nope you cant
<15> perlmonkey: qq{} is the same as "", so you can use @{} ${} etc
<7> well you can... but...
<7> what integral said
<5> okay


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #perl
or
Go to some related logs:

#perl
#gentoo
fbehemot
sh3l1
easyubutu
#python
Can't locate auto/POSIX
#ubuntu
recipient address rejected user unknown in virtual mailbox table mailscanner
practice-06.pdf



Home  |  disclaimer  |  contact  |  submit quotes