php-general Digest 24 Jul 2007 11:13:02 -0000 Issue 4921

Topics (messages 259400 through 259415):

Re: Better way to store data in memory?
        259400 by: Kevin Waterson
        259407 by: Dan
        259411 by: Nathan Nobbe

Re: Strategy when working with designer(s)?
        259401 by: Larry Garfield

header( 'refresh' ), form data, and IE
        259402 by: Daniel Kasak
        259406 by: Dan
        259408 by: Daniel Kasak

Re: Pirate PHP books online?
        259403 by: Larry Garfield
        259413 by: Dotan Cohen

Re: PHP/MYSQL/XML Conversion
        259404 by: Nathan Nobbe
        259405 by: Chris

Re: problem with install php 5.2.3 on apache 2.2.4 in windows xp sp2
        259409 by: Ryan Lao

Re: Problem compile 5.2.3 souce under SUSE 10.1
        259410 by: Chris

Èçãîòîâèì ëþáûå ðåçèíîòåõíè÷åñêèå èçäåëèÿ íà çàêàç.
        259412 by: php

Object instance and session
        259414 by: Stefano Esposito

Smarty template for parent-child form
        259415 by: Man-wai Chang

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 ---
This one time, at band camp, Richard Davey <[EMAIL PROTECTED]> wrote:


> Afraid not, I'm performing deformation on the data that requires a
> temporary location before rendering to the final image.

you could use the pixel iterator in imagack extension

Kevin


-- 
"Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote."

--- End Message ---
--- Begin Message --- Is there nothing like streams or a data type that's meant to hold lots of binary data in PHP?

- Dan

"Richard Davey" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
Hi php-general collective,

I'm building up some image data in my PHP script (ready for output to
the browser). Having to do some complex per pixel manipulation, which
is fine - but I'm just wondering is there a quicker / more efficient
way of storing the pixel data than in an array?

At the moment I hold it in $array[$x][$y], which makes the drawing
loop painless, but it's creating an array with 307,200 elements which
is proving to be quite slow. As I'm only storing fixed width byte
values is there an alternative method? For example the ability to
read/write to a chunk of memory instead? (so I can read out whole
strips of data rather than one by one?)

I was looking at the Shared Memory functions, but that isn't exactly
what I need (I don't want it shared, I want it process specific)

Cheers,

Rich
--
Zend Certified Engineer
http://www.corephp.co.uk

"Never trust a computer you can't throw out of a window"

--- End Message ---
--- Begin Message ---
On 7/23/07, Dan <[EMAIL PROTECTED]> wrote:
Is there nothing like streams or a data type that's meant to hold lots of
binary data in PHP?

introduced back in php4; every time you call include, youre invoking an
underlying stream functions <http://www.php.net/manual/en/ref.stream.php>.

the big feature is you can define custom wrappers and filters.  also various
streams can be chained together
to process data.  i havent worked with them directly, but these functions
are supposedly considered optimal
when dealing with large files because the data can be buffered.
also, you should check out the functions
pack <http://www.php.net/manual/en/function.pack.php>
unpack <http://www.php.net/manual/en/function.unpack.php>
these are designed for direct manipulation of binary data.  i have never
worked with modification of image
files within code except to resize them w/ gd, so this is getting out of my
experience, but im pretty confident
these tools may be of some help.

-nathan

On 7/23/07, Dan <[EMAIL PROTECTED]> wrote:

Is there nothing like streams or a data type that's meant to hold lots of
binary data in PHP?

- Dan

"Richard Davey" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi php-general collective,
>
> I'm building up some image data in my PHP script (ready for output to
> the browser). Having to do some complex per pixel manipulation, which
> is fine - but I'm just wondering is there a quicker / more efficient
> way of storing the pixel data than in an array?
>
> At the moment I hold it in $array[$x][$y], which makes the drawing
> loop painless, but it's creating an array with 307,200 elements which
> is proving to be quite slow. As I'm only storing fixed width byte
> values is there an alternative method? For example the ability to
> read/write to a chunk of memory instead? (so I can read out whole
> strips of data rather than one by one?)
>
> I was looking at the Shared Memory functions, but that isn't exactly
> what I need (I don't want it shared, I want it process specific)
>
> Cheers,
>
> Rich
> --
> Zend Certified Engineer
> http://www.corephp.co.uk
>
> "Never trust a computer you can't throw out of a window"

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--- End Message ---
--- Begin Message ---
On Monday 23 July 2007, Simon wrote:

> I recommend:
>  1) Designer does his whole job and shows the design when finished and
> approved 2) Integrator works on making the pages and html without func.
>  3) Programmer makes the whole thing work.
> This gives the best feeling to all people involved.
>
> All IMO!
>
> Simon

That's our usual routine, too, except that the designer is outsourced and then 
we have our "Developer" (HTML/CSS guru) and "Programmer" (PHP/Javascript 
guru) both function as integrators of sorts.  

However, always make sure that the programmer is there and involved from day 
0.  The designers we work with frequently need to be told "that 3 second 
feature you just suggested just added 300 hours to the project and destroyed 
508 compliance", usually multiple times.  That *must* happen before the 
client sees it, or you're screwed.  It's never too early to get the 
programmer involved in the project, even if no coding happens until far 
later.

-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

--- End Message ---
--- Begin Message ---
Greetings.

I have a data entry form that checks for valid input. If something's
wrong, it should refresh back to the data entry form, and pass the
existing fields back to this form, so the user doesn't have to enter
everything again.

This is working perfectly in Firefox. It doesn't work at all in Internet
Explorer ( 6 ).

I can do *simple* refresh operations, such as:

header( 'REFRESH: 1; URL=http://www.google.com' );

If I do more complex things, such as append the form data to the URL, it
breaks when a field is blank. For example:

header( 'REFRESH: 1; URL=http://www.somesite.com/action.php'
   . '?description=' . $_POST['description']
   . '&categoryid=' . $_POST['categoryid']
);

In the above, categoryid is always OK, because it comes from a combo
( select, whatever ), and at the least it has a default value of 0.

However if nothing was entered in the 'description' field, I get a URL:

http://www.somesite.com/action.php?description=&categoryid=2

Firefox can handle the above perfectly. IE doesn't like the NULL
description bit.

What's the best way around this?

--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: [EMAIL PROTECTED]
website: http://www.nusconsulting.com.au

--- End Message ---
--- Begin Message ---
Then validate the field obviously!
$description = "";
$categoryid = "";

if(isset($_POST['description']))
$description = "?description=$_POST['description']";

if(isset($_POST['categoryid']))
{
if($description != "") $categoryid = "&"; else $categoryid = "?"; // if a description has been entered you'll need an & symbol otherwise a ? $category .= "categoryid=$_POST['categoryid']"; // append category to itself with the posted info
}

header('REFRESH: 1; URL=http://www.somesite.com/action.php' . $description . $categoryid);

I didn't test this it's just off the top of my head, also you should sanitize the input before you do anythign with it really, but that's another issue. Also this is really something that you should be doing with ajax rather than having the page reloading, and passing variables back, etc. This is the EXACT purpose that Ajax as made for, validation of info. Check out XAJAX it's very simple to use but powerfull when you need it.

- Dan

"Daniel Kasak" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
Greetings.

I have a data entry form that checks for valid input. If something's
wrong, it should refresh back to the data entry form, and pass the
existing fields back to this form, so the user doesn't have to enter
everything again.

This is working perfectly in Firefox. It doesn't work at all in Internet
Explorer ( 6 ).

I can do *simple* refresh operations, such as:

header( 'REFRESH: 1; URL=http://www.google.com' );

If I do more complex things, such as append the form data to the URL, it
breaks when a field is blank. For example:

header( 'REFRESH: 1; URL=http://www.somesite.com/action.php'
  . '?description=' . $_POST['description']
  . '&categoryid=' . $_POST['categoryid']
);

In the above, categoryid is always OK, because it comes from a combo
( select, whatever ), and at the least it has a default value of 0.

However if nothing was entered in the 'description' field, I get a URL:

http://www.somesite.com/action.php?description=&categoryid=2

Firefox can handle the above perfectly. IE doesn't like the NULL
description bit.

What's the best way around this?

--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: [EMAIL PROTECTED]
website: http://www.nusconsulting.com.au

--- End Message ---
--- Begin Message ---
Thanks for the response Dan. Us Dans have to stick together :)

On Mon, 2007-07-23 at 17:37 -0700, Dan wrote:

> Then validate the field obviously!
> $description = "";
> $categoryid = "";
> 
> if(isset($_POST['description']))
> $description = "?description=$_POST['description']";
> 
> if(isset($_POST['categoryid']))
> {
> if($description != "") $categoryid = "&"; else $categoryid = "?";  // if a 
> description has been entered you'll need an & symbol otherwise a ?
> $category .= "categoryid=$_POST['categoryid']";  // append category to 
> itself with the posted info
> }

Hmmmm. Yeah I thought it would come to that. I was hoping for a quick &
nasty fix.

> I didn't test this it's just off the top of my head, also you should 
> sanitize the input before you do anythign with it really, but that's another 
> issue.  Also this is really something that you should be doing with ajax 
> rather than having the page reloading, and passing variables back, etc. 
> This is the EXACT purpose that Ajax as made for, validation of info.  Check 
> out XAJAX it's very simple to use but powerfull when you need it.

I will try to make some time for investigating ajax. I'm mostly
developing in Perl, and doing nice GUI stuff ( ie no web stuff - this is
a once-off maintenance thing ), so I'll a little out of my comfort
zone ...

Thanks again for your help.

--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: [EMAIL PROTECTED]
website: http://www.nusconsulting.com.au

--- End Message ---
--- Begin Message ---
On Monday 23 July 2007, tedd wrote:
> At 4:21 PM +0100 7/23/07, Richard Davey wrote:
> >Hi Crayon,
> >
> >Monday, July 23, 2007, 4:09:57 PM, you wrote:
> >>  On Monday 23 July 2007 22:26, Larry Garfield wrote:
> >>>  So when does "Rasmus Lerdorf and the Deathly Hallows" open in
> >>> theaters?
> >>
> >>  They've got to make "Rasmus Lerdorf and the Order of the PHP" first.
> >
> >Or even "Rasmus Lerdorf and the Order of Function Arguments" :)
>
> How about "Rasmus Lerdorf, Lord of the Code"
>
> I think we could go on and on with this.

"Rasmus Lerdorf and the Half-Assed Coder"? :-)

(This is almost as much fun now as the brain teasers thread.)

-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

--- End Message ---
--- Begin Message ---
On 24/07/07, tedd <[EMAIL PROTECTED]> wrote:

How about "Rasmus Lerdorf, Lord of the Code"

I think we could go on and on with this.


Php Fiction? Rasmus's List? Codin' in the Rain?

Dotan Cohen

http://lyricslist.com/
http://what-is-what.com/

--- End Message ---
--- Begin Message ---
certainly it is better to use the database, as it is designed for such a
purpose.

-nathan

On 7/23/07, Kelvin Park <[EMAIL PROTECTED]> wrote:

I'm trying to convert joined multiple database table to one xml file. Is
it more efficient to initially, join multiple (more that 4 tables)
together to produce XML file, or convert every table in to XML file and
use those XML files to relate data?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--- End Message ---
--- Begin Message ---
Kelvin Park wrote:
I'm trying to convert joined multiple database table to one xml file. Is it more efficient to initially, join multiple (more that 4 tables) together to produce XML file, or convert every table in to XML file and use those XML files to relate data?

I'd make the database do all the work.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
Arvin,

You inserted the codes <?php phpinfo(); ?> to your index.html file?


""arvin lee"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> system: windows xp sp 2
> apache: apache_2.2.4-win32-x86-no_ssl
> PHP:     php-5.2.3-win32-installer.msi
>
> i try to install php on my computer so that i can finish my homework, but
> after download these files nightmare begins. Install apache with default
> settings, install php with default settings. Restart apache server .While 
> I
> modify index.html  add <?php phpinfo(); ?> , open 127.0.0.1 , apache 
> server
> default page pops up with no change.  Creat a new file named as
> phpinfo.php, modify
> httpd.conf , add line AddType application/x-httpd-php .php  then restart
> apache. open broswer  key in address 127.0.0.1/phpinfo.php ,it show me
> nothing. is there anyone can help ?
> PS. I have reinstall my windows system, nothing change.( Now I am using
> Appserv to finish my homewhere.)
> one thing, after install php 5.2.3 on apache server, when I stop apache
> server ,windows system show my two error message.
> 

--- End Message ---
--- Begin Message ---
Jeff Lanzarotta wrote:
Hello,

I am not sure if this is the right mailing list or not, but here goes...

I am attempting to compile php 5.2.3 from source under SUSE 10.1. The compile 
is fine, it is the 'make test' that is failing...

When I run 'make test' I am getting:

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
double to string conversion tests [Zend/tests/double_to_string.phpt]
Bug #16069 (ICONV transliteration failure) [ext/iconv/tests/bug16069.phpt]
iconv stream filter [ext/iconv/tests/iconv_stream_filter.phpt]
strripos() offset integer overflow 
[ext/standard/tests/strings/strripos_offset.phpt]
=====================================================================

Post it to the -installs list, see what people there suggest.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
rfiyoaq  mkgr  aosj  jihy

--- End Message ---
--- Begin Message ---
Hi all,

i've a self-defined class describing an user. In the login page i create an 
instance of the user object and store it in $_SESSION['user']. When accessing 
$_SESSION['user'] from other pages (of course I do require('user.php'); and 
session_start();) i got this errors:



Warning: mysqli::query() [function.mysqli-query]: Couldn't fetch mysqli in 
/home/httpd/html/uss_tyco3/user.php on line 390

Warning: user::get_unita_row() [function.user-get-unita-row]: Couldn't fetch 
mysqli in /home/httpd/html/uss_tyco3/user.php on line 391

Fatal error: Call to a member function fetch_assoc() on a non-object in 
/home/httpd/html/uss_tyco3/user.php on line 396

The constructor is:

function __construct ($nick, $pwd)
{
        $conn = new mysqli ("localhost", "****", "*************", "tyco");
        $this->conn = $conn;
        $query = "SELECT * FROM `users` WHERE `nick`='$nick'";
        $res = $conn->query($query);
        if (!$res->num_rows)
        {
                /* The nick isn't registered */
                $this->log("Nick inesistente: $nick");
                return 1;
        }
        $row = $res->fetch_assoc();
        $res->free_result();
        if ($row['password'] != $pwd)
        {
                /* Wrong password */
                $this->log("Password errata, nick: $nick");
                return 2;
        }
        $query = "INSERT INTO `online` (`user`) VALUES ('$nick') ON ";
        $query .= "DUPLICATE KEY UPDATE `time`='".time()."'";
        $conn->query ($query);
        if ($conn->error)
        {
                /* Error in mysql query */
                $this->log($conn->error);
                return FALSE;
        }

        $this->nick = $nick;
        $this->pwd = $pwd;
        $this->admin = (bool)$row['admin'];
        $this->master = (bool)$row['master'];
        $this->log("Login: $nick");
}




The method i'm calling when getting those errors is:

function get_unita_row ()
{
        $query = "SELECT * FROM `unita` WHERE `id`='$this->unita'";
        $res = $this->conn->query($query);
        if ($this->conn->error)
        {
                $this->log($this->conn->error);
                return FALSE;
        }
        $row = $res->fetch_assoc();
        $res->free_result();
        return $row;
}




Any hint?

Thanks,
Stefano
 
 
 --
 Email.it, the professional e-mail, gratis per te: http://www.email.it/f
 
 Sponsor:
 250 biglietti da visita Gratis + 42 modelli e Etichette per Indirizzo Gratis + 
Porta biglietti Gratis -Offerta limitata!
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=6782&d=24-7

--- End Message ---
--- Begin Message ---
Is there a template that presents a parent-child
forms, for example, an invoice object which has a header(invoice no,
date, customer code, invoice total) and multiple items (item no, item
name, quantity, price, amount)?


-- 
  @~@   Might, Courage, Vision, SINCERITY.
 / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Xubuntu 7.04)  Linux 2.6.22.1
  ^ ^   19:12:01 up 12 days 21:16 1 user load average: 0.06 0.06 0.02
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

--- End Message ---

Reply via email to