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



Comments:

<0> if the caller of my cl*** p***es a reference to a result set ($rs) to my cl*** constructor, and then my cl*** p***es that around, all that gets copied from function to function (or method to method if you like) is a cheap reference to the actual result set. Correct?
<1> BigA: http://us3.php.net/manual/en/function.phpversion.php
<2> eleftherios: thats my understanding of it and the way that i currently implement this
<0> if the caller of my cl*** p***es expilictly a copy of a result set ($rs), then my cl*** each time it p***es this around from function to function (or method to method) will be making a new copy of the $rs.
<0> therefore if $rs is huge I will have the overhead of making N copies of it
<2> now thats the bit where i have just got confused. my thinking 5 minutes ago was yes this would copy every time you p***ed it around. however BazziR suggests that it only copies if you change the data in $rs.
<0> hm, I see
<2> i think it would be best to test with 1mb of data and p*** it around 10 times and see if the memory climbs to say 10mb or just over 1mb.
<3> hi, what is the easiest way to check if a usesysid is in pg_group(grolist)
<4> explicitly calling by reference is the right thing to do (tm) of course
<4> and upgrading to php5 of course :)
<3> BazziR :you mean me?
<4> no, sorry
<4> I mean eleftherios
<3> BazziR :no proble
<0> BazziR, in the example I have mentioned you agree that i should leave the p*** by reference to the caller (and that the caller is doing the right thing (TM) if he p***es the $rs by reference)



<4> p*** by reference must be specified by compile time
<4> so there's little choice
<0> BazziR, compile time?
<3> if i grep the data with pg_fetch_array() i get back {1,2} and array[0] is { array[1] is 1 and so on, how can i check the size of that array? count($array) or count($array[0]) doenst work
<4> or say "function/method definition time"
<2> does anyone have any expericene of using imagettfbbox() and getting the height of the text? my problem is that the height of character a is smaller than character b which is correct with the function. However when drawing the text to the screen seperately it becomes difficult to know where the bottom of the line should be as a character y will be below. any ideas?
<0> BazziR, does that mean that I must explicitly declare my constructor function to take references?
<4> yes
<2> no
<0> hm
<2> new cl***(&$rs)
<2> to p*** by ref
<4> there is backwards compaitibility if you don't
<4> tamath: thats wrong since like php 4.3
<2> yes but he is using php 4
<0> I am using PHP 4.3.10
<4> but its already wrong in 4.3 :p
<2> then BazziR has the correct method ;)
<0> I see
<0> hm
<0> One last clarification please. If I declare my constructor function (or method if you like), to take the $rs variable by reference (by means of &$rs), then I can p*** this around my cl*** using plain ($rs), in the sense that I don't have to declare the rest of the internal functions to take refences to $rs as all I will have will be a reference anyway...Correct?
<2> you will have to decalre the rest of the internal functions to take references otherwise you will be copying.
<0> cl*** MyCl*** { function MyCl***(&$rs) { foo($rs); }; function foo($rs) {//do something with $rs, such as print the rows};}
<0> tamath, yes but I will be copying a reference since all my cl*** will have will be merely a reference...
<0> or so I think
<2> cl*** MyCl*** { function MyCl***(&$rs) { foo($rs); }; function foo(&$rs) {//do something with $rs, such as print the rows};}
<0> BazziR, what's your take on this?
<5> "Copy a reference"? What is it that you think that even means?
<6> hm what would be faster, doing mysql_num_rows or doing SELECT COUNT(*) and retreiving result?
<0> TML, does it not mean anything in PHP lingo?
<5> damir: If you've already fetched a result set, it's easier to count the tuples in the result set than to run another query.
<5> eleftherios: No.
<4> eleftherios what tamath said
<6> i didnt...
<0> I see
<7> tuples in php? since when?
<0> tuples in PHP?
<1> tuples as in arrays ;)
<6> mysql_fetch_row(mysql_query("some query")); will return array right? how do i make it return first element of array?
<6> mysql_fetch_row(mysql_query("some query"))[0] ?
<0> TML, BazziR, tamath thank you
<8> is there a way to check the default time limit?
<9> hello
<6> anyone?
<2> eleftherios, your welcome
<1> BigA: What is a default time limit?
<10> Frixon: I guess he means the max run time
<8> yeap
<1> Have a look at the php.ini
<2> BigA default time limit is usually 60 seconds and you can set this with set_time_limit(x) where x is seconds
<9> $query="SELECT * FROM Employee WHERE $search_field='$value'"; <-- the $value contains characters such as "@" (such as in emails) ... How can I change the quotes so the statement will be valid?
<3> how can i count a multidimensional array, where i wanna count only $array[0] ?
<1> thunder00: mysql_real_escape_string
<1> hyksos: count($array[0]);
<3> Frixon :doesnt work
<1> hyksos: It doesn't
<3> Frixon :it returns 1, but it got 5 members
<1> so try $foo = $array[0]; count($foo);
<8> how can i check what libraries are included (i have to mention that i am running on a free hosting service in safe mode)
<3> Frixon :same result, curios? what do i wrong



<11> is it possible to replace </p> to </li> only in this scheme <li>text</p> using preg_match ?
<1> hyksos: Show me your code please-.
<1> hyksos: Normally count($a[0]); works
<1> kapishonas: You want preg_replace
<11> Frixon, i know, but there are <p>text</p> tags and i don't want to replace those </p> which goes after <p>
<9> Frixon: it didn't work--> $query="SELECT * FROM Employee WHERE $search_field=mysql_real_escape_string($value)";
<1> kapishonas: Where is the problem?
<1> thunder00: Argl...you do know the PHP syntax, do you?
<3> Frixon : http://pastebin.com/649171 line 48
<9> yes.. but not that expert
<11> Frixon, i can't figure out how to change only those </p> which goes only after <li>
<1> hyksos: do a var_dump of $mandant[1] please
<3> Frixon :i am newbie, how do i do that? var_dump($mandant[1]) ?
<1> kapishonas: something like that '#<li>.+</p>#U', '<li>\1</li>', $str
<1> hyksos: Yes
<3> ok
<3> string(5) "{4,3}"
<1> hyksos: Does that look like an array?
<1> thunder00: mysql_query(sprintf("SELECT foo, bar FROM table WHERE searchField = '%s'", mysql_real_escape_string($value)); is a good solution
<3> Frixon :like i said, php-newbie, but i can access all signs, include { , and } with mandant[1][?]
<3> but i cannot count it
<1> hyksos: That's nothing special.
<3> Frixon :that i cannot count it?
<1> You can count the length of the string.
<1> strlen($str);
<9> Frixon: thanks
<1> In PHP you can access every character of the string like an array
<3> Frixon :curious, i try
<1> thunder00: You should have a look at what sprintf does.
<3> that works
<1> hyksos: Sure it does. It's meant for strings :)
<1> hyksos: But your code looks strange...
<1> What are you trying to do?
<1> Have an array filled with HTML codes fo checkboxes?
<11> Frixon, doesn't work
<1> kapishonas: What did you do with the code?
<11> yours?
<1> Erm...yes?
<11> $tekstas=preg_replace('#<li value=7>.+</p>#U', '<li>\1</li>', $tekstas);
<1> hyksos: $html_strings = array(); while($row = pg_fetch_***oc($query)) { $html_queries[] = $row['field']; } something like that would be better
<1> kapishonas: Do you know basic regex?
<12> Can there be a function call in a string like this: echo "{<function_call>}"; ?
<11> Frixon, only which i heave read in http://weblogtoolscollection.com/regex/regex.php
<11> have*
<13> can i get a hand with an update string that isnt updating
<13> http://pastebin.com/649187
<1> kapishonas: The .+ has to be wrapped in () to make it a subpattern
<13> its driving me nuts
<1> Mitja: Why would you want to do that?
<12> Frixon, I have a dynamic echo in that function
<1> http://us3.php.net/call_user_func could be what you are looking for
<11> Frixon, still doesn't work
<1> kapishonas: How does your input string und your regex look like now?
<12> Frixon, I want to call a function inside a string, just like you can refer to variables.
<1> doesn't work is a really bas error description
<1> Mitja: Forget about it
<12> Frixon, is it possible?
<1> No
<1> Use call_user_func
<12> ok, thanks
<1> Mitja: Well, there is a possibility I didn't want to tell you about
<12> Frixon, why not?
<1> Mitja: php.net/eval - but I don't recommend to use it
<1> It can be a hell of a security hole
<11> Frixon, let's say it looks like http://pastebin.com/649202
<14> $func = 'function'; $func(); is fine, Mitja
<1> kapishonas: You didn't do what I told you to do
<1> kapishonas: Except from that, your HTML is crappy
<15> Yo.
<12> aidan, honestly, I don't know how to use that
<1> kapishonas: http://rafb.net/paste/results/8EeVjD72.html - have a look at this
<11> Frixon, you said i have to wrap .+ in (), i did, but then my script isn't working at all, plus html isn't mine, you know ms word?
<14> Mitja: what part is confusing you? it's incredibly simple
<1> kapishonas: Yes, it said to wrap .+ in (), not to wrap . in ()


Name:

Comments:

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






Return to #php
or
Go to some related logs:

sql set commant
azureus wrong ELF class
#python
lnihlen
#css
ssh cipher none
page change after 5 sec javascript
dictionary discumbobulated
hwinfo redhat DIMM
You have an error in your SQL syntax. Check the manual that corresponds to your



Home  |  disclaimer  |  contact  |  submit quotes