php-general Digest 11 Nov 2010 08:49:03 -0000 Issue 7032

Topics (messages 309432 through 309442):

php running as module or cgi?
        309432 by: Al

Re: Updating a GET variable
        309433 by: Nathan Rixham

Re: Chat
        309434 by: Nathan Rixham

Re: Template engines
        309435 by: Nathan Rixham
        309438 by: Daniel P. Brown
        309440 by: David Robley
        309441 by: Robert Cummings
        309442 by: David Robley

Re: Newbie looking for a project
        309436 by: Nathan Rixham

parse_ini_file() seems to be broken in PHP 5.2.4-2ubuntu5.12
        309437 by: Daevid Vincent

How do I convert the string "E_ALL & ~E_NOTICE" to the decimal equivalent 6135?
        309439 by: Daevid Vincent

Administrivia:

To subscribe to the digest, e-mail:
        [email protected]

To unsubscribe from the digest, e-mail:
        [email protected]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
Briefly, what are the trade offs on a typical shared host?

I've done a little research and can't seem to find anything outstanding either 
way.

Seems like as an Apache module is faster. This argument makes sense.

CGI is more secure, this argument doesn't seem too persuasive to me. Maybe I'm missing something.

Thanks....

--- End Message ---
--- Begin Message ---
Tamara Temple wrote:

On Nov 10, 2010, at 8:58 AM, Marc Guay wrote:

foreach($_GET as $k => $v) $qs[$k] = URLDecode($v);
$qs['lang'] = 'en';
echo '<a href="index.php?'.http_build_query($qa).'">Flip</a>';

Hi Tamara,

Thanks for the tips.  Do you see any advantage of this method over
using a small POST form besides the styling problems I'll run into
trying to make the submit button look like an achor?

The main advantage I see is that you're application doesn't have to become bi-modal, with looking for variables on both the query string and in the post data, then deciding which to use.

All browsers send the Accept-Language header from the users locale settings, like:

  "Accept-Language:en-GB,en-US;q=0.8,en;q=0.6"

So all you need to do, is take a look at $_SERVER['HTTP_ACCEPT_LANGUAGE'] to get a users language preferences.
--- End Message ---
--- Begin Message ---
Dušan Novaković wrote:
Hello there,

I have to make chat for website that has around 10 000 users (small
social network). So before I start, I would like to hear different
opinions. Important thing is to have in mind that in one moment you
can have over 1 000 users using chat.
So, if you have time fill free to write you experience in this field,
suggestions, etc.

(1) flash w/ xmpp server
(2) outsource to a chat server company
(3) node.js serverside w/ web workers
(4) avoid ajax, php and long poll if you want a server left at the end of the exercise.
--- End Message ---
--- Begin Message ---
Daniel P. Brown wrote:
On Mon, Nov 8, 2010 at 16:41, Hansen, Mike <[email protected]> wrote:
I really like the idea of using a templating engine. Which one do you use? Why? 
For those that don't use templating engines, why don't you use them?

    I chose to write two of my own over the years: one procedural, one
OOP.  That said, the most common is likely still to be Smarty, and by
far.


I went back to using a pre hypertext processor, seemed like a really powerful templating engine that was v familiar to use :p
--- End Message ---
--- Begin Message ---
On Wed, Nov 10, 2010 at 20:59, Nathan Rixham <[email protected]> wrote:
>
> I went back to using a pre hypertext processor, seemed like a really
> powerful templating engine that was v familiar to use :p

    Pre-hypertext preprocessor?  Perl?

-- 
</Daniel P. Brown>
Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/

--- End Message ---
--- Begin Message ---
Daniel P. Brown wrote:

> On Wed, Nov 10, 2010 at 20:59, Nathan Rixham <[email protected]> wrote:
>>
>> I went back to using a pre hypertext processor, seemed like a really
>> powerful templating engine that was v familiar to use :p
> 
>     Pre-hypertext preprocessor?  Perl?
> 

Pre Hypertext Processor - the acronym sounds familiar :-)



Cheers
-- 
David Robley

Coming Soon!! Mouse Support for Edlin!!
Today is Setting Orange, the 23rd day of The Aftermath in the YOLD 3176. 


--- End Message ---
--- Begin Message ---
On 10-11-11 02:20 AM, David Robley wrote:
Daniel P. Brown wrote:

On Wed, Nov 10, 2010 at 20:59, Nathan Rixham<[email protected]>  wrote:

I went back to using a pre hypertext processor, seemed like a really
powerful templating engine that was v familiar to use :p

     Pre-hypertext preprocessor?  Perl?


Pre Hypertext Processor - the acronym sounds familiar :-)

I think I saw something about that on someone's Personal Home Page!

Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

--- End Message ---
--- Begin Message ---
On Thu, 11 Nov 2010, Robert Cummings wrote:
> On 10-11-11 02:20 AM, David Robley wrote:
> > Daniel P. Brown wrote:
> >> On Wed, Nov 10, 2010 at 20:59, Nathan Rixham<[email protected]>  
wrote:
> >>> I went back to using a pre hypertext processor, seemed like a
> >>> really powerful templating engine that was v familiar to use :p
> >>
> >>      Pre-hypertext preprocessor?  Perl?
> >
> > Pre Hypertext Processor - the acronym sounds familiar :-)
>
> I think I saw something about that on someone's Personal Home Page!
>
> Cheers,
> Rob.

Perchance they were talking about a Form Interpreter ? 



Cheers
-- 
David Robley

"Here's someone who can't speak!" exclaimed Tom dumbfoundedly.
Today is Setting Orange, the 23rd day of The Aftermath in the YOLD 3176. 

--- End Message ---
--- Begin Message ---
tedd wrote:
At 12:34 PM -0500 11/8/10, Daniel P. Brown wrote:
On Mon, Nov 8, 2010 at 06:29, Ashim Kapoor <[email protected]> wrote:

 Writing apps on my own is fun but it's fruit is only for me to benefit
 from,but yes if nothing else I should do that.

    Not at all, many others can benefit from it as well.  Tedd's
examples have been referenced on this list many times, and you can see
them yourself:

        http://www.php1.net/

    Just because you're developing the code to learn for yourself
doesn't mean you can't put it in the public domain for others to do
the same.

Thanks for the plug, but let me add this.

When you develop a demo for yourself, you can take liberties. However, when you release a demo for public/peer review, you had better know what you are doing and that makes you a better programmer.

My advice, spend your time learning and helping others -- it will educate both.

That's better advice than you may ever know Ashim ^

--- End Message ---
--- Begin Message ---
http://php.net/manual/en/function.parse-ini-file.php

Why doesn't PHP parse the 'null', 'true', 'false', etc into their proper
equivalents? What's worse is that it does this mangling of my RAW values to
be strings and sets them to "1" !!! WTF good does that do me?!


Here is my test.ini file:
---------------------------------------------------------------------------
---------------------------
[examples]                                  ; this is a section
                                            ; this is a comment line
log_level = E_ALL & ~E_NOTICE 
1 = intkey                                  ; this is a int key
nullvalue = null                            ; this is NULL
truebool = true                             ; this is boolean (TRUE)
falsebool = false                           ; this is boolean (FALSE)
intvalue = -1                               ; this is a integer (-1)
floatvalue = +1.4E-3                        ; this is a float (0.0014)
stringvalue = Hello World                   ; this is a unquoted string
quoted = "Hello World"                      ; this is a quoted string
apostrophed = 'Hello World'                 ; this is a apostrophed string
quoted escaped = "it work's \"fine\"!"      ; this is a quoted string with
escaped quotes
apostrophed escaped = 'it work\'s "fine"!'  ; this is a apostrophed string
with escaped apostrophes
---------------------------------------------------------------------------
---------------------------

Here is my test.php page:
---------------------------------------------------------------------------
---------------------------
<?php
        var_dump(parse_ini_file('./test.ini', true));
?>
---------------------------------------------------------------------------
---------------------------

Here is the output:
---------------------------------------------------------------------------
---------------------------
array
  'examples' => 
    array
      'log_level' => string '6135' (length=4)
      1 => string 'intkey' (length=6)
      'nullvalue' => string '' (length=0)
      'truebool' => string '1' (length=1)
      'falsebool' => string '' (length=0)
      'intvalue' => string '-1' (length=2)
      'floatvalue' => string '+1.4E-3' (length=7)
      'stringvalue' => string 'Hello World' (length=11)
      'quoted' => string 'Hello World' (length=11)
      'apostrophed' => string ''Hello World'' (length=13)
      'quoted escaped' => string 'it work's \fine\!' (length=17)
      'apostrophed escaped' => string ''it work\'sfine' (length=15)
---------------------------------------------------------------------------
---------------------------



develo...@mypse:~$ php -v
PHP 5.2.4-2ubuntu5.12 with Suhosin-Patch 0.9.6.2 (cli) (built: Sep 20 2010
13:18:10)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
    with Xdebug v2.0.5, Copyright (c) 2002-2008, by Derick Rethans


--- End Message ---
--- Begin Message ---
We're trying to move all of our configuration files for our DEV/TEST/PROD
and various python scripts and such that all need the same DB connection
parameters and pathing information to a common and simple config.ini file
they all can share across languages.

One snag I ran into is this:

[dart]
relative_url    = /dart2
absolute_path   = /home/www/dart2
log_level               = E_ALL & ~E_NOTICE

But when I read it in from the file, it's a string (of course)

$log_level_string = "E_ALL & ~E_NOTICE";
echo 'log level string = '.eval($log_level_string.';').'<br>';

This gives me nothing!:

        log level string =

Wheras this one gives the proper values:

echo 'log bit level = '.(E_ALL & ~E_NOTICE).'<br>';

Output is:

        log bit level = 6135

But that defeats the purpose of a config file.


--- End Message ---

Reply via email to