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



Comments:

<0> Jemt: Look up flock for more info
<1> MarkR: Roger :)
<1> MarkR: Will this work for a XML file being processed by a DOMDocument object?
<1> an*
<0> My understanding is that although win32 conventionally has different semantics, PHP's flock() has the same semantics on win32
<1> Sounds great
<2> is there value returning functions in ?
<2> in php
<0> Jemt: You'll want to read / write the file in PHP and then p*** the data into DOM, leaving the file handle open and locked while you process it, then rewind, truncate and write the file out using the same handle. This ensures that nothing else can do so in between.
<1> MarkR: Sounds difficult
<0> Not really
<1> MarkR: But DOMDocument handles all read/write
<0> Don't use their ones because they won't do any locking
<1> Will I need to override functions on the DOMDocument cl***?
<0> I think you'll want to use LoadXML / saveXML
<3> is there an object-oriented cl*** of some sort that deals with a pure, in-php method of performing sftp?



<1> MarkR: Oh yes, that should do it - ofcause :)
<4> is there a way i can put all rows of data from a result set into an array without a foreach / while?
<5> Jymmm: if i were to send you $10 would it be worth it?
<6> robert_: i think there is an ssh extention in pecl
<0> robert_: You can use ftps, but that's not the same as sftp
<6> robert_: a pure php implementation would be to slow with the cyphers
<1> But I only need to lock the file while is is being saved. But I'll take a closer look at flock. Thanks, MarkR :)
<0> Jemt: No, you need to lock the file before you load it, otherwise another process may access it between when you load / save it
<0> Imagine if two threads A and B do the following in this order: A(load), B(load), A(modify), B(modify), A(save), B(save), then A's modifications will be lost
<2> if i have a function named myFunction that returns a value, and i want to print that value
<1> MarkR: Well, saving the file also includes opening it in my case - checking for a timestamp :)
<2> can i do echo "the value is myFunction()"
<2> how can it distinguish betwen string and function name
<0> Jemt: Whatever method you're using, it won't be free from race conditions.
<5> Geren: no, but you can do echo 'the value is '.myFunction();
<2> oh ok thanks
<2> whats the difference betwen echo
<1> MarkR: Race conditions?
<2> echo "adsfsdf" and echo 'adsfsdf'
<0> Jemt: When you have multiple threads running, them doing things in an order you don't expect
<1> MarkR: Yes, I know :)
<5> err is there a factoid on quotes?
<0> Remember that the same page may be accessed by two clients at once
<7> itrebal: I guess... P3 530 cpu and 700 celeron cpu... PS unk cond, some fans, MAYBE ancient memory
<8> Geren, There is none
<1> MarkR: Yes, I'll keep that in mind :)
<1> MarkR: That's why I want to make this file lock
<0> Jemt: The safe way of doing file locking, is open, lock, read, rewind, truncate, write, close
<5> Jymmm: heh, i could probably sell it to my brother :P sure, but it'll be a few days
<0> Then another process cannot do the same and have a bad interleaving, because the file is locked exclusively between read and write
<2> ok thanks
<9> where can i download php from?
<1> MarkR: Ok, thanks. Don't know what you mean by 'rewind' and 'truncate' - but guess I'll figure it out later
<7> itrebal: Just realize, that I have a ****laod todo now... so it might take a month or two to get it out the door
<8> [Linux], php.net
<5> Jymmm: whatever
<5> Jymmm: i know how that goes
<1> MarkR: AFAIK only tapes are rewinded ;)
<0> Jemt: If you want to change the size of a file, while keeping the handle open, you need to rewind and truncate it.
<1> MarkR: Ah, IC
<9> can i download it as an RPM Package?
<0> No, file handles are rewound too, it's just faster on a disc than a tape :)
<7> itrebal: I think you know by now that I keep folks informed along the way.
<5> Jymmm: sure
<1> MarkR: Oh, I see :)
<6> [Linux]: php comes with most distro's
<6> [Linux]: check your package manager
<9> but mine requires a 5th disc
<0> Jemt: Look at the doc for: fseek(), ftruncate(), rewind() and fopen() - but look at fopen() first - pay attention to the fact that you can use "r+" to open for reading and writing
<9> and i havent got the 5th disc and i dont want to download it
<10> [Linux]: Surely your distro provides a way to install a package over FTP/HTTP.
<9> yes
<9> over YaST
<6> [Linux]: it can't get the packages from a web based repo?
<10> So, there you go.
<6> so do that
<9> i dont know how to do it though
<1> MarkR: Great. I think I got some leads to go for now :)
<6> learn
<1> Thanks :)
<10> That would be a great question for your distro's channel.



<0> Jemt: Basically, you can't lock a file without having it open; closing the file will implicitly unlock it, so you must leave it open to retain the lock. If you want to read, then update a file, you must seek to the beginning and truncate the file, otherwise you'll end up with junk at the end of the file if the new data are smaller than the old ones
<1> MarkR: Ok, good to know :)
<0> So even if your application requires a huge amount of work between the reading and the writing, and there are other threads waiting to do the same thing, they will be queued by the OS until the first one finishes
<0> But I must add, making small changes in this way to a large XML file is hopelessly inefficient
<11> [Linux]: what distro you use?
<9> SuSE 10.0
<11> and wtf you doing here?
<11> call 1800-suse , ask Doris for the packages deparment
<1> MarkR: Well, the file is not that big
<0> If you want to do frequent minor changes, an XML file requires a lot of unnecessary work
<1> MarkR: I know. But my architecture is build with performance in mind. I do very little reading/writing
<0> It's all a matter of perspective- provided you don't do this m***ively frequently, and the files are small, it shouldn't be a problem
<1> Great :)
<12> is there a way to redirect to a relative page? i.e., not the entire URL, just, say, "index.php"?
<13> macgeek: from php? you might be able to use virtual() or somesuch
<13> macgeek: if you don't really want to redirect, that is
<0> macgeek: You can write a routine which calculates the relative URL, but it's nontrivial for stuff like "./.././../../something.php"
<13> macgeek: otherwise, please describe your problem more clearly
<0> I mean, calculates the absolute URL
<12> Flawless: well say I'm logging the user out, then I want to return to the main page. The problem is, there are 2 URLs to get to this site, and I don't want to use one or the other in case a user can't access one of them
<13> macgeek: that didn't make any sense .)
<12> Flawless: I'm sure it didn't :P
<0> macgeek: I recommend you try to make sure that there is only one URL for the site
<0> It's better for stuff like search engines and cookie problems etc
<13> me too - that other solution sounds very hackish
<12> I have a website at http://farhnware.homelinux.com:5555 which is also accessible via http://farhnware.homelinux.com/hofer . When I log the user in or out, I want to redirect to index.php
<0> Personally - if I have several DNS names for the same site - which is common - I make all except one of them redirect to the remaining one
<13> macgeek: you CAN solve that, but you really shouldn't do it that way. Make one of the sites redirect to the "master" site instead
<12> Flawless: okay
<0> And this includes www.example.com vs. example.com
<13> yes
<0> Choose which one you want to be the "official" site and have the other redirect
<12> okay, that works
<12> thanks
<0> countless times I've seen either cookie problems because several DNS names reach the same site, or an IIS "no web site configured at this address" :)
<0> Because IIS name-based-virtual-hosts don't insist that you have a default site
<10> It's amazing how often that happens.
<10> Or how often an IIS admin fails to point both foo.com and www.foo.com to a website.
<2> how do i add a line break within a form
<12> <br />
<2> i did, doesnt work
<7> !+nl
<14> Newlines are hidden (not normally visible) control characters that distinguish the end-of-a-line of text and are different for each platform as follows: [Windows = \r\n] [*nix & OSX = \n] [Cl***ic Mac = \r] And can be seen as: [LF (linefeed) = \n, 10d, 0x0A, 0001010b] [CR (carriage return) = \r, 13d, 0x0D, 0001101b]
<15> mattmcc, becouse IIS are stupid for god sake they are IIS admins!
<12> Geren: works for me...
<2> do i need to clear the browser or something
<7> IIS admin panel is just a cluster****.
<16> hiya !! can i open a RSS file from another internet location with simplexml_load_file ?? or do i need another commando ?
<17> BieZt: a commando? need to take the file by surprise?
<12> hm.. if I define a variable in a PHP file, then include that file in another PHP file, will I be able to access the variable in the second PHP file?
<13> macgeek: yes,if you use include(_once) or require(_once)
<10> macgeek: Yes, after the include has been done.
<12> well say I do require('config.php'); that will work?
<2> how do i prefill values into a form's text area?
<12> Geren: set the value
<2> macgeek, but my value is a php variable
<13> macgeek: yes
<2> how can i set a php variable to a value
<12> Flawless: thanks
<13> Geren: $foo = "bar";
<12> Geren: value="<?php echo var; ?>"
<17> Geren: echo it with the html
<16> ehmm maybe commando is a dutch word ^^
<11> Geren: $im = "dummie";
<15> lol
<2> ok thanks
<16> but can i parse RSS feeds with simplexml_load_file or do i need to use something else ?
<16> i'm wondering if it maybe only can load files on the server itself :O
<2> it says "unexpected $ on line 33"
<2> but there's no $ on line 33
<2> line 33 is my last line!!!
<17> BieZt: I've never used it, but looking at the description, it will get the xml file and process as an xml file, but it won't do anything as far as it being an RSS feed.
<17> Geren: unexpected end of file. you're probably missing a }
<18> Anyone willing to volunteer their time to help me out with a project based off phpBB?


Name:

Comments:

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






Return to #php
or
Go to some related logs:

ssh + still getting prompted
#ai
#suse
debian usbfs: interface claimed by usbfs while 'scanimage' sets config
#debian
designmode carret
control/locals file
esddsp slow
xubuntu suspend button
#ubuntu



Home  |  disclaimer  |  contact  |  submit quotes