@# 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



Comments:

<0> here we go...
<1> pianoboy3333: vi :)
<0> vi?
<2> it's an old text editor
<3> what should I use to talk with two php? pipe, socket or shared mem?
<2> one of the traditional examples in pointless holy wars (generally paired with emacs)
<2> Epilog: depends on the situation.
<2> Epilog: would you be more detailed?
<3> StoneCypher: I need the server php to initialize a ssh connection with a ip
<4> I enabled the cache system with flat files, my hacks says: fopen(/home/hivework/public_html/forum/cache/subSilver/blocks/recent_topics_block.tpl.php):
<3> and then receive commands to send and return the output
<4> ..it errors
<0> StoneCypher: isn't vi also vim?
<2> pianoboy3333: vi is vim's ancestor
<2> much like vim is evim's ancestor
<0> Right...



<0> thus the name
<5> StoneCypher: binary_format() doesn't appear to be a valid function
<2> er
<2> braino
<2> number_format
<0> VI iMproved
<2> pianoboy3333: uh huh. so if you knew that, why did you ask
<4> what do I do with cache system when I have mods?
<0> StoneCypher: I just looked at the program... lol
<6> nice, i just tried out the number_format + str_replace method
<6> works fine for big numbers
<6> thanks
<2> mmm hmm
<2> next time someone helps you, don't pick a fight then call them paranoid
<1> can anyone with freetype support look at their phpinfo output and let me know if a section appears under a freetype heading if it was successfully compiled it please? most other extensions appear to have their own section on the phpinfo page, so i'm wondering if the fact that freetype does not means that it was not successfully compiled into php for some reason
<6> ..the heck? can someone quote me the line where he is getting this?
<5> StoneCypher: for benching, how many numbers do you think i should process? 100,000 or so?
<2> b1n0ry: eh, just some large number, shouldn't much matter
<3> StoneCypher: any suggestion?
<5> StoneCypher: so far, str_replace is faster
<2> Epilog: i don't see that there's any need to worry about which one you use. Just use something which works. Sockets will be easiest.
<2> b1n0ry: which php are you using?
<2> wait
<2> what do you mean so far
<5> StoneCypher: using 1,000 iterations, using 10,000 iterations, using 100,000 iterations. thus far, in every case, str_replace has been faster.
<5> 100,000 iterations takes almost a full second less time
<2> which version of php
<7> Do you think its a good idea to connect to MySQL about 3 times through out a PHP script, using different privleges for each connection, or do you guys think its best to only use one connection, to make the script load much faster?
<2> reZo: shouldn't make much of a difference
<7> This is using PHP5
<2> reZo: use minimum privileges whenever possible
<7> Cool,
<7> Yeah,
<5> StoneCypher: 5.0.4
<2> b1n0ry: huh.
<5> StoneCypher: want to see?
<2> maybe str_replace was significnatly upgraded in 5.
<7> Thats why I'm connecting to MySQL a few times through out the script, so I only use the privleges I need for each connection.
<2> yeah, sure
<5> StoneCypher: http://bianchi.no-ip.net/chris/helpdesk/tryout.php
<7> For instance, so I don't use a account that has priveleges to do anything in a database, I'm restricting the usage / priveleges right down to a account only being able to use certian tables with certain priveleges on that table.
<7> You know,
<5> StoneCypher: if you want the benchmark code, i'll pastebin it to verify that it's fair.
<2> b1n0ry: i trust you, but for the sake of curiosity, please do
<1> reZo: just setup different users
<7> But on the other hand, does it really matter? Because I'll be backing up the database all the time anyways, so if someone gains access, I'll just fix up the flaw, and restore the oldish database.
<7> dools: Yeah, thats how I'm going to do it, :)
<5> StoneCypher: http://pastebin.com/597224
<7> Thanks, just wanted a few good opinions on it :)
<5> StoneCypher: i was even careful enough to make sure that both benchmarks use the same, randomly-generated numbers set.
<2> how odd.
<2> that's virtually identical to the test code i generated for 4.
<7> Also, I'm not a hosting company, its a single website I'm doing it for so yeah.
<2> b1n0ry: okay, learn something new every day.
<5> StoneCypher: i've refreshed the test several times to be sure. pretty conclusive.
<2> b1n0ry: for whatever it's worth, those results should swap (ish) under 4. Maybe 4 just had a bad implementation of str_replace.
<5> perhaps, i don't have a php4 test bed around anymore, though.
<5> so i'm only verifying with 5
<5> StoneCypher: for what it's worth, i'll bet when you said "you can bench it if you want" i'll bet you didn't expect anyone to step to the challenge ;)



<8> What is the or for if blah or blah?
<2> actually i did
<2> i'm a c++ programmer
<5> heh, lol.
<2> profiling is my bread and butter.
<8> lol never nmind
<5> a few weeks ago someone came in and said "i wonder if there's a way to ...." and he was joking because he was looking for some extremely complex way to basically generate a trim() using bit shifting and crap. 30 minutes later, i pastebin'd him the code.
<2> bit shifting?
<2> for trim() ?
<5> StoneCypher: basically, he was joking and wanting to kill some time
<0> is 'or' a keyword in php?
<2> oh.
<2> pianoboy3333: yes. is a manual available to you?
<0> is this valid:
<0> $fh = fopen($ourFileName, 'w') or die("Can't open file");
<2> no
<0> good
<0> what is wrong with it?
<2> that sets $fh to the value of the logical or of the return values from opening a file and dying
<2> which is, how do you say, nonsense
<0> oh...
<0> StoneCypher: so what do I want?
<5> pianoboy3333: parenthesis: ($fh = fopen(ourFileName, 'w')) or die('Can't open file');
<2> the manual
<1> haha
<2> bzzt.
<2> that's the same damned thing
<0> ok
<2> except the ***ignment goes into the void.
<9> hi
<2> if (!($fh = fopen())) { die (); }
<5> StoneCypher: sure about that won't work? i'll try that, too
<0> still not working....
<2> b1n0ry: or is a logical operator, not a stand-in for else.
<5> if the first case evaluates to true, it shouldn't test the second case (the die) yet if the first case comes back false, it should evaluate the die
<5> StoneCypher: mysql_select_db('somedb') or die('unable to select database') works perfectly fine.
<2> PHP makes no guarantee about order of evaluation in short circuiting.
<2> that's a nonsense approach and is begging for futureproofing bugs.
<2> logical or is *not* a branch condition
<0> still not working...
<2> and you *cannot* rely on short circuiting in a language which makes no guarantees about short circuiting
<2> b1n0ry: i've seen void main in C books. What's your point?
<5> StoneCypher: sure, when you don't care to have main return a value.
<10> You sure PHP doesn't guarantee short-circuit evaluation?
<5> i think it does, right to left
<5> er, left to right
<2> b1n0ry: read the C standard. main is required to return int in any hosted implementation, with no exceptions.
<2> Dragnslcr: if it does I haven't seen it.
<5> eh, ansi = american national standards institute. outside of america, doesn't mean crap.
<2> Dragnslcr: I would be interested to see such a clause in a manual, if you can locate it. I've tried and failed in the past.
<2> b1n0ry: sorry, C++ has been ISO for ten years.
<2> b1n0ry: That said, the standard is the standard no matter how you feel about its authoring body.
<5> he, that would explain it. i haven't used c in at least 10 years
<2> well
<2> the language has required return of int main since it was still called BCPL
<2> which is most likely before you were born
<2> the point is, attempting to use short circuit logic to replace if() clauses is silly. And, until I see a guarantee of short circuit behavior, it's also undefined and therefore dangerous.
<0> Umm...
<5> StoneCypher: i'm not disagreeing that it's not the 'proper' way. i'm just saying it works.
<0> got it
<2> b1n0ry: except that until I see that guarantee, you're relying on undefined behavior, and saying it works because you haven't seen it blow up yet.
<2> b1n0ry: Maybe you weren't around for the transition from PHP3 to PHP4
<2> but it was a nightmare
<2> because tons of amateurs made hasty guesses like that
<2> which didn't hold true
<2> and all sorts of stuff fell apart
<2> You can repeat that it works all you want, but the fact of the matter is that if PHP doesn't guarantee short circuit evaluation, it just hasn't blown up *yet*. There's a huge difference.
<10> Doesn't C guarantee short-circuit evaluation?
<2> Dragnslcr: yes, in an extremely specific fashion.
<2> It's one of the few languages in which you can rely on such things.
<2> Dragnslcr: though, it's still a remarkably difficult thing to get correctly in non-trivial instances
<2> and is the reason why several overloaded operators in C++ cannot be made safe
<2> particularly operator |, operator &, operator ^, and operator, .


Name:

Comments:

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






Return to #php
or
Go to some related logs:

#lisp
#css
#fedora
ntplonly
#fluxbox
openkiosk debian packages
#fedora
#linux
#ubuntu
#perl



Home  |  disclaimer  |  contact  |  submit quotes