[PHP] SimpleXML output encoding
Hi, is there any way how to set output encoding for SimpleXML? It will load XML document in any encoding, but internally, it converts the document to UTF-8 and outputs it in this encoding. I would like to have output encoding set to ISO-8859-2, is it possible? thanks. -- Ondrej Kulaty -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SimpleXML output encoding
Because i am working on an old system which is in ISO, i cant use unicode. -- Ondrej Kulaty tedd tedd.sperl...@gmail.com píse v diskusním príspevku news:p06240802c625f6b4e...@[192.168.1.101]... At 2:40 PM +0200 5/5/09, Ondrej Kulaty wrote: Hi, is there any way how to set output encoding for SimpleXML? It will load XML document in any encoding, but internally, it converts the document to UTF-8 and outputs it in this encoding. I would like to have output encoding set to ISO-8859-2, is it possible? thanks. -- Ondrej Kulaty Why? http://www.cl.cam.ac.uk/~mgk25/unicode.html tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Browser timeout
40 seconds is not very long execution time for timeout, if you have some loop in the script, try to output a dot character, for example, on every iteration, with flush() immediately after echo (or whatever command you use for sending output). ? danondan...@gmail.com pí¹e v diskusním pøíspìvku news:907722000902270633j559478cdi1ff0f1c7fc07...@mail.gmail.com... Hello, I am running a script that process the user's request, which usually takes about 40 seconds. The problem is that on Internet Explorer 6, it timeouts - probably because no response was sent. How do I solve this problem? Since I tried some things and header() messages, nothing worked. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A puzzler (well, for me at least)
Your answer is neither relevant nor funny. :-| -- Robert Cummings rob...@interjinn.com pí¹e v diskusním pøíspìvku news:1235653678.13128.32.ca...@localhost... On Thu, 2009-02-26 at 12:47 +, Richard Heyes wrote: Hi, I've been recently wondering (musing if you will) about timings, and roughly how long, in a very real sense, it takes on a modern computer for a single line of PHP, or Javascript (or interpreted code in general) to execute. Nanoseconds? Quicker? It depends on the processor and the line of instructions. You could say I have too much time on my hands... You could try washing them ;) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A puzzler (well, for me at least)
Sorry i've missed the first sentence, i thought the answer was only the very last sentence. my fault. -- S pozdravem Ondrej Kulatý - Winternet s.r.o. odd. vývoje aplikací tel. 585 209 132 www.winternet.cz Richard Heyes rich...@php.net píse v diskusním príspevku news:af8726440902260659u3c8f0fa4pe3aa7b526192a...@mail.gmail.com... Your answer is neither relevant nor funny. :-| Someone didn't get any last night... -- Richard Heyes HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari: http://www.rgraph.org (Updated February 14th) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Stupid is as Stupid does
Use var_dump() to see contents of a variable. It will print something even if variable is empty or undefined. Michael A. Peters mpet...@mac.com píse v diskusním príspevku news:49a79416.6060...@mac.com... As my web app is coming to completion, I added a means to search records (different from site search). This involves reading post input and is many cases converting it to an integer. Damn I feel dumb. The search app wasn't working, so I did what I often do when troubleshooting crap - I put a die($variable) at various points to see if the variable is what it is suppose to be. I kept getting blank returns from die after the conversion from a post string to an integer. I looked in the apache logs, system logs, I even tried rebooting - I couldn't figure why the smurf the variable wasn't converting to integer. I even turned off eaccelerator in case that was causing it, though it never has given me issue before (except once when I was doing something in a really shoddy way - cleaned up my method and it behaved) After several hours contemplating if I had bad RAM, an issue with the CPU, verifying my RPMs were good, wondering why I wasn't getting anything in the logs, it dawned on me. If variable is an integer, die($var) returns nothing and is suppose to return nothing, it takes a string as an argument to echo on death - die($var) is what I wanted. I need sleep. I did finally find the error and fix the record search problem. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP OOP
I don't think that PHP is good language for teaching OOP as many folks above said. I have never programmed in OOP style but i plan to learn it. I started in PHP but i was little confused and i am used to program in procedural way in PHP, so i've decided to learn some pure OOP language. I am reading a book OOP Demystified, there are examples in both C++ and Java. And imo Java code is much more readable and understandable. So i think that Java is the best for learning OOP. I am also considering learning C#, if you dont mind that it's closely related to windows, it might be also a good choice. -- tedd t...@sperling.com píse v diskusním príspevku news:p0624080dc5b5fff1c...@[192.168.1.101]... Hi gang: At the college where I teach, they are considering teaching OOP, but they don't want to settle on a specific language. My thoughts are it's difficult to teach OOP without a language -- while the general concepts of OOP are interesting, people need to see how concepts are applied to understand how they work -- thus I think a specific language is required I lean toward C++ because I wrote in it for a few years AND C++ appears to be the most common, widespread, and popular OOP language. However, while I don't know PHP OOP, I am open to considering it because of the proliferation of web based applications. My personal opinion is that's where all programming is headed anyway, but that's just my opinion. With that said, what's the differences and advantages/disadvantages between C++ and PHP OOP? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Throwing an exception seems to defeat output buffering
Output buffer is flushed at the end of script. When you throw that exception in try block, this command: exit( 'Contents: ' . ob_get_clean()); never executes and it continues to catch block where you are outputing exception message, and it is added to the buffer, then the script ends and buffer flushes. === Leif Wickland leifwickl...@gmail.com pí¹e v diskusním pøíspìvku news:c5b9ee2c0902022202v6e2a071emfb062aa868ed7...@mail.gmail.com... I would expect that if I turn on output buffering, echo something, throw an exception, and catch the exception, nothing will have been actually output. That doesn't seem to be the case. Throwing an exception seems to defeat output buffering. In the following code, I would not expect to see the h1, but I do. ? try { ob_start(); echo 'h1You should not see this!/h1'; throw new Exception('h2This should be the first output./h2'); exit( 'Contents: ' . ob_get_clean()); } catch (Exception $ex) { exit('h2Exception:/h2' . $ex-getMessage()); } I'm exercising that code on PHP 5.2.4 and 5.2.8. Does anybody know why throwing an exception seems to override ob_start(), flushing the buffered output? Is there a workaround? Thank you, Leif Wickland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Programming general question
Depends on what for you want to use that. Array is simple data structure, it holds data, like variable, but objects has methods and properties, it acts as someting which can do some sort of task and you access it via it's interface (you call it's methods). You can use array for example to hold result from database and than iterate it with for or foreach cycle. On the other hand, object can be used for exaplme to send mail, you put into it text body, mail adresses and so on and then call it's method send() which causes mail to be send. The process of transforming data, generating headers etc is completely done by the object and it's internal methods, you access it only via it's well defined interface (it's methods you can call). Objects are mainly used in OOP programming, where they cooperate together. Good way to learn OOP is to learn something about design patterns... -- Terion Miller webdev.ter...@gmail.com píse v diskusním príspevku news:37405f850901271518r21f5f73j44841e864de5c...@mail.gmail.com... I googled this and didn't find an answer my question is how do you know when to use an object or array would an object just be 1 instance, and array is several things together ( I know infantile coder language I use..but I'm a baby still in this) Can someone explain objects and arrays in plain speak for me? Thanks Happy Coding -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: CLI in background on windows
What about to try run it as service? I don't know exactly how to do that but service programs run in background on my Win XP Fanda d...@sidak.net pí¹e v diskusním pøíspìvku news:7d.3d.09584.c2f7a...@pb1.pair.com... Hi, I am looking for some method, how to run php cli script on background in windows. It should be started by windows task manager. Do you have any idea? Thans, Fanda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Create unique non-autoincrement key for 700,000records?
I think he knows how to use it, he didn't show us a certain example where and how he wants to use it, i just posted the way how i do generate an unique identifier, if he use the first mentioned way - AutoIncID+unix_timestamp - there can be a collision, when two users will attempt to perform this task on the same id at the same time. yes, it's not very probable but if you have system with many users it can happen Robert Cummings rob...@interjinn.com pí¹e v diskusním pøíspìvku news:1229410766.9173.41.ca...@localhost... On Tue, 2008-12-16 at 07:35 +0100, Ondrej Kulaty wrote: I use md5(microtime()); I applaud the use of PHP on the PHP list... but I think the OP wants an SQL query :) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Create unique non-autoincrement key for700,000records?
Sorry you are right. He said he wants each row to have an unique ID so AutoIncId+timestamp will satisfy it, But still i think that adding microseconds timestamp is better because it will be harder for potential hacker to guess. -- S pozdravem Ondøej Kulatý - Winternet s.r.o. odd. vývoje aplikací tel. 585 209 132 www.winternet.cz Robert Cummings rob...@interjinn.com pí¹e v diskusním pøíspìvku news:1229416450.9173.46.ca...@localhost... On Tue, 2008-12-16 at 09:21 +0100, Ondrej Kulaty wrote: I think he knows how to use it, he didn't show us a certain example where and how he wants to use it, i just posted the way how i do generate an unique identifier, if he use the first mentioned way - AutoIncID+unix_timestamp - there can be a collision, when two users will attempt to perform this task on the same id at the same time. yes, it's not very probable but if you have system with many users it can happen No it's impossible. Auto increment guarantees a unique auto incremented ID. Adding the value returned by unix_timestamp() to this unique ID can only create unique sums since both the auto increment ID and the time are increasing. There cannot be a collision. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Create unique non-autoincrement key for 700,000 records?
I use md5(microtime()); -- Ondrej Kulaty Rob Gould gould...@mac.com píse v diskusním príspevku news:1492934866135048840337272044147195196-webm...@me.com... I have a mySQL database with 700,000 records in it, which are presently keyed with an auto-increment field. What I'd like to do is create another field with a field where each and every record number has a unique keyvalue. Example: su5e23vlskd for records 1, and 34fdfdsglkdj4 for record 2. All that matters is that it's unique, and isn't a number that can be guessed or an autoincrement number, where a hacker can just figure out the keyvalue by incrementing numbers. It doesn't matter to me if each keyvalue field is just numbers, or a number/letter combination - - - all that matters is that each keyvalue field is unique. Is there an automatic way that mySQL could do that, or would I need to write a php script to somehow go through each record and create this unique value? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php