IRC Networks
Irc Logs Stats
Start date: 2007-09-27 02:48:27
Last update: 2008-10-24 20:19:38
Channels: 41
Logged Lines: 6230436
Size: 1982.49 MB
Powered by
Channel Info
Network: freenodeChannel: #php |
Search in www.irclog.org
Log from #php at freenode 2006-06-24
Pages: 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
33
34
Next >
[00:00]<breey>mantang0: php5-pear
[00:00]<pdznpfds>Does anyone know why I get a "call to a member function on a non-object" error after moving some previously working code into its own function, even though I'm passing the handle to the function as an argument?
[00:01]<drrvrrr0>Bazzi: is that in another repository?
[00:01]<drrvrrr0>Package php5-pear is not available, but is referred to by another package.
[00:01]<2ggfrcg>fireflys: you are calling a function on a non-object
[00:01]<zdzxzzmfdgzx>fireflys: I'm guessing the variable you use in that line is not an object...
[00:01]<2ggfrcg>richardlynch: :P
[00:01]<zdzxzzmfdgzx>fireflys: So what is it? var_dump it.
[00:02]<pzyvxnz>what would be the best function to resize an image? imagecopyresized?
[00:02]<breey>mantang0: maybe your debian is outdated or so.
[00:02]<drrvrrr0>just did an apt-get update
[00:02]<drrvrrr0>weird
[00:02]<zdzxzzmfdgzx>faithre: Depending on your version of GD, and the actual images themselves, imagecopyresampled may be better. Only testing on your images will you know for sure.
[00:03]<gydl_>mantang0: isn't their a libpear or sometihng?
[00:03]<wjlllrws>faither: What do you mean? with GD or ImageMagick?
[00:03]<pdznpfds>Ohh...I think there was another object that I forgot to pass
[00:03]<pdznpfds>back in a moment
[00:03]<pzyvxnz>not sure wolf
[00:03]<breey>mantang0: debian stable is a bit well... not current
[00:03]<breey>if you use that
[00:03]<fzr_>what would be the optimal way to replace a section of text in a txt file? atm, i'm thinking of reading teh file in (maybe 30k tops), finding the chunk, and i'm not sure how to replace just the chunk
[00:03]<pzyvxnz>just want to resize
[00:03]<wjlllrws>str_replace or preg_replace
[00:04]<drrvrrr0>I'm using testing.... i thought... hmm. Perhaps my apt prefs are a little out of whack. I'll go check
[00:04]<wjlllrws>faither: With GD, imagecopyresample... For GD, trad the manuals
[00:04]<pzyvxnz>ok
[00:04]<pzyvxnz>thans wolf
[00:04]<pzyvxnz>thanks*
[00:04]<zdzxzzmfdgzx>faither: Do you need to resize them in "real time" as user uploads them, or just whenever. Do you have shell access and cron job access? How many images? How big are they? The "best" answer among GD, ImageMagick and the functions within them depend on all this and more...
[00:04]<fzr_>Wolfpaws, but the chunk i want to replace may be 5k worth of text
[00:04]<2ggfrcg>lra_: if you don't want to load the whole file, you'll need to scan it in
[00:04]<cxjls`>How would i cycle through an array changing the keys?
[00:05]<wjlllrws>lra_: So?/
[00:05]<drvvdaa>Chops`: Change them how?
[00:05]<2ggfrcg>lra_: does it have an identifying mark at front and back?
[00:05]<cxjls`>make them a differnt value
[00:05]<fzr_>benlake, yeah it will
[00:05]<zdzxzzmfdgzx>Chops`: Give us a tiny example...
[00:05]<ryddygxrgssjg>For those of you who celebrate midsommer, have a nice one.
[00:05]<fud>do u guys have any tip on how to find all dependencies between php files... For example I wanna find out if I have previously created a php file which is not referenced from anywhere else?
[00:05]<cxjls`>I want to cycle through an array with numbers as keys changing the numbers to an md5 sum of the two of the elements inside the array.
[00:06]<fzr_>is it efficient to pass a huge string to be replaced in to str_replace
[00:06]<jufyzg|wjzc>lra_, I would not say that is efficient.
[00:06]<jufyzg|wjzc>But if it needs to be done, what else can you do?
[00:06]<zdzxzzmfdgzx>Chops`: foreach, but make a whole new array for the new keys, as altering an array in the midst of iterating it is dicey.
[00:06]<fud>I think the php manual says that str_replace is more efficient than preg_replace though
[00:06]<fzr_>well, how else can i replace a chunk in a txt file Julian|Work?
[00:07]<2ggfrcg>lra_: I'd scan through the file [fopen while(feof) and such] find the starting point
[00:07]<cxjls`>ok richardlynch
[00:07]<cxjls`>thanks :)
[00:07]<jufyzg|wjzc>lra_, I'm trying to have you answer that question.
[00:07]<jufyzg|wjzc>Have you looked at any alternatives?
[00:07]<jufyzg|wjzc>benlake, the built-in functions will perform faster than rewriting it yourself.
[00:08]<2ggfrcg>lra_: not the file position and start deleteing, scan to that point and plop in the new chunk
[00:08]<jufyzg|wjzc>Unless they're doing some extra work that you don't require-- in the case of str_replace(), I doubt that.
[00:08]<2ggfrcg>Julian|Work: I'm aware of this, unless your stretching their usage
[00:08]<fzr_>well, i was thinking of finding the start and end marker, then replace the chunk inbetween. i was thinking of copying the text before the start into one var, and hte txt afterwards the end marker into one, then sticking all 3 together
[00:09]<2ggfrcg>Julian|Work: depending on the file sizes you work with, reading the entire thing in, isn't that great
[00:09]<jufyzg|wjzc>I didn
[00:09]<fud>lra_: Have u looked into REPLACE function in MySQL if you wanna replace mysql queried strings?
[00:09]<jufyzg|wjzc>'t hear anything about a file, just a string.
[00:09]<2ggfrcg>lra_: well then you're still palying with everything in memory
[00:09]<fzr_>yeah, it's a txt file
[00:09]<pdznpfds>solved, thanks anyway richardlynch
[00:09]<jdddd>!+u
[00:09]<2ggfrcg>Julian|Work: point taken :)
[00:09]<lxl-2jv>Surely you mean 'you', not 'u'? The letter 'u' is not a personal pronoun. Talking like this in ##php may get you silenced. For details, /msg php-bot aolbonics
[00:10]<jufyzg|wjzc>benlake: but sure, you're correct. If you can limit the size of the string without much overhead, a good choice.
[00:10]<jufyzg|wjzc>lra_, bottom line, try out a couple ways. See for yourself.
[00:10]<jufyzg|wjzc>And maybe come back and tell us what worked best.
[00:10]<cxjls`>richardlynch : is this ok?
[00:10]<cxjls`>foreach ( $clans['p'] as $key => $value ) { if ( $key < 10 ) { $clans['p'][md5($value['c'][0].''.$value['c'][1])] = $value; unset($clans['p'][$key]); }
[00:10]<2ggfrcg>Julian|Work: somehow I'm not expecing a big O answer from lra_'s tests
[00:11]<fzr_>?
[00:11]<zdzxzzmfdgzx>Chops`: Altering the contents of an array while iterating through it is "undefined output"
[00:11]<2ggfrcg>Julian|Work: sometimes its better to walk through it mentally to find inefficiencies
[00:11]<cxjls`>ok :(
[00:11]<2ggfrcg>lra_: did we help at all?
[00:12]<fzr_>benlake, gave me some stuff to think about :)
[00:13]<2ggfrcg>lra_: alright then :) my only tip is to ask yourself how much data is in memory
[00:13]<fzr_>surely it'd be more efficient to read it all in, instead of reading it in bit by bit, looking for the start marker?
[00:14]<mzzmgg>hello, what is the right preg macth for "src='\"http://www.debench.com/files/fstage225.jpg\"'" if i'm searching '\"'?
[00:14]<2ggfrcg>lra_: what do you think reading it all in does?
[00:14]<gnzj>lra_, sure- if you have enough memory/fast enough processor..
[00:14]<zdzxzzmfdgzx>lra_: Not if it's so humungous it forces your machine to start swapping it back out to disk because RAM if full up.
[00:15]<2ggfrcg>lra_: you want to read it in the largest chunks possible to identify what you want
[00:15]<pgggdwysg>how can i do something like: $first_time = 1; function() { if ($first_time) { ...; $first_time = 0; } }
[00:15]<2ggfrcg>richardlynch: :)
[00:15]<xzzlzrjg>hi..consider a class X..in its definition there is an array of another class Y which has a properety p..how to access properety p of nth. element of Y within X...$X->Y[n]->p doesnt work
[00:15]<fzr_>so it's faster to read it in bit by bit?
[00:15]<2ggfrcg>lra_: basically, we're all just having you think about memory usage
[00:15]<zdzxzzmfdgzx>yarden: '/\\\\"/
[00:15]<mzzmgg>thanks :)
[00:15]<zjvzz>sweet
[00:15]<zdzxzzmfdgzx>yarden: Tack on a ' at the end. Sorry.
[00:15]<zjvzz>i had to use mod_rewrite, but it works..
[00:16]<2ggfrcg>lra_: it does this anyway :) you only need to look at it line by line or 4096bytes at a times.. but it still has to get the data, bit by bit
[00:16]<fzr_>yeah, i'm trying to go from doing it, to doing it efficiently
[00:16]<pgggdwysg>richard: too many backslashes
[00:16]<pgggdwysg>'/\\\"/'







