php-general Digest 22 Nov 2008 03:10:45 -0000 Issue 5803

Topics (messages 283632 through 283644):

Re: Anyway to simulate pcntl_fork() on Windows?
        283632 by: Yeti

Re: store class zithin session
        283633 by: Alain Roger

Re: reading XML
        283634 by: Carlos Medina

Displaying information from table graphically
        283635 by: dzenan.causevic.wise-t.com
        283637 by: Stut
        283638 by: Afan Pasalic
        283639 by: Maciek Sokolewicz
        283642 by: Ashley Sheridan

Re: Model Web Site
        283636 by: bruce

Re: phpDesigner 2008?
        283640 by: Waynn Lue

Re: in_array breaks down for 0 as value
        283641 by: Ashley Sheridan

gethostbyaddr and IPv6
        283643 by: Glen C
        283644 by: Lars Torben Wilson

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 ---
check this out ...
http://in.php.net/manual/en/ref.pcntl.php#37369

--- End Message ---
--- Begin Message ---
Hi Stut,

On Thu, Nov 20, 2008 at 12:25 PM, Stut <[EMAIL PROTECTED]> wrote:

>  On 20 Nov 2008, at 11:01, Alain Roger wrote:
>
>> i have a class and i would like to store it zithin session.
>> i was thinking to use serialize/unserialize but it does not work.
>>
>> any idea how to do it ?
>>
>
> Alain, you've been on this list long enough to know that "it does not work"
> is not enough information for people to be able to help you.
>

 You're right and i feel sorry. i thought i paste my code just after the
sentence.
ok, anyway i solved my problem somehow :-)


>
> Firstly there is no need to serialise anything going into the session.
> Secondly I assume you want to store objects not classes.

yes.


> Thirdly there is no reason why it should not work, but there are some
> caveats you need to be aware of...
>
> * The class definition must have been loaded before session_start() is
> called, otherwise you'll end up with an object of type stdClass rather than
> your class.

this was my mistake...i mean to not call the class file before starting the
session :-(


A.

--- End Message ---
--- Begin Message ---
Hi Angelo,
try this:
http://pear.php.net/manual/en/package.structures.structures-datagrid.structures-datagrid-datasource.xml.php

regards

Carlos

--- End Message ---
--- Begin Message ---
I have a PHP application that accesses data from MySQL. There is table
called "rooms", and table called "beds". There is another table called
"patients". Patients are being placed into beds, and beds are in the
rooms. PHP application currently displays all information in textual mode
via regular HTML tags. But I would like to have that information displayed
in graphical mode instead of textual mode.

Is there a way to display this information from the database graphically.
Graphic would represent a room, and it would contain beds inside. You
would be able to see visually which beds are occupied and which are free
by looking at the graphics.

User of the system wants pictures instead of text displayed via HTML
tables as a list of entries.

Anyone knows anything like this?
Thanks,
Dzenan



--- End Message ---
--- Begin Message ---
On 21 Nov 2008, at 17:55, [EMAIL PROTECTED] wrote:
I have a PHP application that accesses data from MySQL. There is table
called "rooms", and table called "beds". There is another table called
"patients". Patients are being placed into beds, and beds are in the
rooms. PHP application currently displays all information in textual mode via regular HTML tags. But I would like to have that information displayed
in graphical mode instead of textual mode.

Is there a way to display this information from the database graphically.
Graphic would represent a room, and it would contain beds inside. You
would be able to see visually which beds are occupied and which are free
by looking at the graphics.

User of the system wants pictures instead of text displayed via HTML
tables as a list of entries.

There's a couple of ways you can do this with differing qualities.

1) Use GD or ImageMagick to composite images together to represent the room. This would allow you to create the best looking images. You can either store images for rooms with 1, 2, 3, 4, ..., n beds and overlay markers to indicate occupied beds, or you could composite the whole thing.

2) Slice images up such that you can build a room using positioned divs. This would be a lot easier but you'd be limited in what type of textures and looks you can give the rooms. On the other hand this could turn out to be more flexible as you could arrange it to allow rooms of any dimensions with any number of beds.

Personally I'd opt for 2 based on the KISS principle, but you could potentially run into browser compatibility issues depending on your target platforms.

-Stut

--
http://stut.net/

--- End Message ---
--- Begin Message ---

[EMAIL PROTECTED] wrote:
I have a PHP application that accesses data from MySQL. There is table
called "rooms", and table called "beds". There is another table called
"patients". Patients are being placed into beds, and beds are in the
rooms. PHP application currently displays all information in textual mode
via regular HTML tags. But I would like to have that information displayed
in graphical mode instead of textual mode.

Is there a way to display this information from the database graphically.
Graphic would represent a room, and it would contain beds inside. You
would be able to see visually which beds are occupied and which are free
by looking at the graphics.

User of the system wants pictures instead of text displayed via HTML
tables as a list of entries.

Anyone knows anything like this?
Thanks,
Dzenan

general idea:

in mysql you have marked beds with 0 not occupied and 1 occupied.
then you have two images: bed_occupied_0.gif and bed_occupied_1.gif and, depending on record from mysql different image should be shown.

same with number of beds in room.
for example. there is 4 beds maximum per room.
you have 5
images no_of_beds_0.gif (actually, this is a transparent 1x1 gif)
images no_of_beds_1.gif
images no_of_beds_2.gif
images no_of_beds_3.gif
images no_of_beds_4.gif

$query = mysql_qurey("select no_of_beds from beds where room=123";
$result = mysql_fetch_assoc($query);
echo "<img src="images/no_of_beds_".$result['no_of_beds'].".gif" border=0 />";

something like that.

-afan



--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
I have a PHP application that accesses data from MySQL. There is table
called "rooms", and table called "beds". There is another table called
"patients". Patients are being placed into beds, and beds are in the
rooms. PHP application currently displays all information in textual mode
via regular HTML tags. But I would like to have that information displayed
in graphical mode instead of textual mode.

Is there a way to display this information from the database graphically.
Graphic would represent a room, and it would contain beds inside. You
would be able to see visually which beds are occupied and which are free
by looking at the graphics.

User of the system wants pictures instead of text displayed via HTML
tables as a list of entries.

Anyone knows anything like this?
Thanks,
Dzenan


Sure, you just need to make PHP draw the graphics. You can do that using the GD library[1], imagemagick[2], or in some cases even do it manually (eg. SVG, but that's not supported at all by IE).


[1] http://www.php.net/manual/en/book.image.php
[2] http://www.php.net/manual/en/book.imagick.php

--- End Message ---
--- Begin Message ---
On Fri, 2008-11-21 at 16:55 -0100, [EMAIL PROTECTED] wrote:
> I have a PHP application that accesses data from MySQL. There is table
> called "rooms", and table called "beds". There is another table called
> "patients". Patients are being placed into beds, and beds are in the
> rooms. PHP application currently displays all information in textual mode
> via regular HTML tags. But I would like to have that information displayed
> in graphical mode instead of textual mode.
> 
> Is there a way to display this information from the database graphically.
> Graphic would represent a room, and it would contain beds inside. You
> would be able to see visually which beds are occupied and which are free
> by looking at the graphics.
> 
> User of the system wants pictures instead of text displayed via HTML
> tables as a list of entries.
> 
> Anyone knows anything like this?
> Thanks,
> Dzenan
> 
> 
> 
This sounds a lot like a school/college/uni project that you're too lazy
to research... Correct me if I'm wrong.

The other guys who have answered are all spot on when they say you need
to look at the GD library.


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
hi...

for what it's worth. the best approach might be to find a few sites that
have the functionality/layout you like. there are probably a few of them
that you'll run across that meet what you have in mind. use these as your
basic guides. add additional features that you'd like.

you now have (roughly speaking) the requirements/functions that you want
your final site to have. from here, you can figure out which "scripts" you
want to apply, and what you're still going to have to provide. keep in mind
that you can't simply throw scripts together, but you can use them to get a
sense of the underlying logic. you can also use them to see how to develop
your look/feel of your site.

looking at various scripts also gives you a chance to think about how you
want to implement your security/setup, as well as the underlying database
schema..

you can find plenty of apps/scripts on freshmeat.net/sourceforge.net as
well.

have fun!


-----Original Message-----
From: Stephen [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 20, 2008 2:17 PM
To: PHP-General
Subject: [PHP] Model Web Site


My prime hobby is photography and the next is web site building.

So now I have a young model (18+) asking me about getting a web site.

The idea is members can see content, that will include, photos, her blog
and a discussion forum.

I like the idea of building it, but it includes a lot of things I have
no experience in.

Can someone point me to documentation/tutorials/scripts or anything that
might help.

I don't want a turnkey solution. I want to learn how to do this.

Thank you!
Stephen

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


--- End Message ---
--- Begin Message ---
All in one--is the other better?

On 11/18/08, Nathan Rixham <[EMAIL PROTECTED]> wrote:
> Waynn Lue wrote:
>> I know the IDE wars spring up occasionally, but looking through the
>> archives, I haven't seen any discussions pro or con for phpDesigner 2008 (
>> http://www.mpsoftware.dk/phpdesigner.php).  Anyone had a chance to use it
>> and think it's good or not?
>>
>> I just installed PDT + Eclipse today, and I'm still getting used to the
>> integration.  I'm used to Eclipse + Java, so it somewhat throws me for a
>> loop in trying to figure out what works in what scope.  I do wish I could
>> have it do some kind of analysis of my files plus dependencies so any
>> problems could be discovered at compile time, rather than run time.
>>
>> Thanks,
>> Waynn
>>
>
> php isn't pre-compiled though..
>
> did you go for ganymede with pdt 2 or the all in one?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
On Fri, 2008-11-21 at 09:11 +0000, Stut wrote:
> On 20 Nov 2008, at 23:09, Ashley Sheridan wrote:
> > On Thu, 2008-11-20 at 09:25 +0000, Stut wrote:
> >> On 20 Nov 2008, at 06:55, Yashesh Bhatia wrote:
> >>> I wanted to use in_array to verify the results of a form submission
> >>> for a checkbox and found an interesting
> >>> behaviour.
> >>>
> >>> $ php -v
> >>> PHP 5.2.5 (cli) (built: Jan 12 2008 14:54:37)
> >>> $
> >>>
> >>> $ cat in_array2.php
> >>> <?php
> >>> $node_review_types = array(
> >>>                          'page'       => 'page',
> >>>                          'story'      => 'story',
> >>>                          'nodereview' => 'abc',
> >>>                          );
> >>>
> >>> if (in_array('page', $node_review_types)) {
> >>> print "page found in node_review_types\n";
> >>> }
> >>> if (in_array('nodereview', $node_review_types)) {
> >>> print "nodereview found in node_review_types\n";
> >>> }
> >>>
> >>> ?>
> >>> $ php in_array2.php
> >>> page found in node_review_types
> >>> $
> >>>
> >>> This  works fine. but if i change the value of the key  
> >>> 'nodereview' to
> >>> 0 it breaks down.
> >>>
> >>> $ diff in_array2.php in_array3.php
> >>> 6c6
> >>> <                            'nodereview' => 'abc',
> >>> ---
> >>>>                          'nodereview' => 0,
> >>> $
> >>>
> >>> $ php in_array3.php
> >>> page found in node_review_types
> >>> nodereview found in node_review_types
> >>> $
> >>>
> >>> Any reason why in_array is returning TRUE when one has a 0 value on
> >>> the array ?
> >>
> >> That's weird, 5.2.6 does the same thing. There's actually a comment
> >> about this on the in_array manual page from james dot ellis at gmail
> >> dot com...
> >>
> >> <quote>
> >>
> >> Be aware of oddities when dealing with 0 (zero) values in an array...
> >>
> >> This script:
> >> <?php
> >> $array = array('testing',0,'name');
> >> var_dump($array);
> >> //this will return true
> >> var_dump(in_array('foo', $array));
> >> //this will return false
> >> var_dump(in_array('foo', $array, TRUE));
> >> ?>
> >>
> >> It seems in non strict mode, the 0 value in the array is evaluating  
> >> to
> >> boolean FALSE and in_array returns TRUE. Use strict mode to work
> >> around this peculiarity.
> >> This only seems to occur when there is an integer 0 in the array. A
> >> string '0' will return FALSE for the first test above (at least in
> >> 5.2.6).
> >>
> >> </quote>
> >>
> >> So use strict mode and this problem will go away. Oh, and please read
> >> the manual before asking a question in future.
> >>
> >> -Stut
> >>
> >> -- 
> >> http://stut.net/
> >>
> > What about using the === and !== comparisons to compare and make sure
> > that 0 is not giving a false false.
> 
> That's effectively what using strict mode does. RTFM please.
> 
> -Stut
> 
Hey, chill. If you offer advice, don't be so offensive to everyone.


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
Hello,

Does gethostbyaddr actually work for anyone while looking up an IPv6 address? I can't seem to get it to work. For example:

echo gethostbyaddr ( '2001:470:0:64::2' );

should return "ipv6.he.net" but instead I get the following error:

[21-Nov-2008 22:43:37] PHP Warning:  gethostbyaddr()
 [<a href='function.gethostbyaddr'>function.gethostbyaddr</a>]:
 Address is not in a.b.c.d form in C:\www\tests\saved\host.php on line 7

Google has not been my friend in this matter...

Any insight?
Thanks,
Glen

--- End Message ---
--- Begin Message ---
2008/11/21 Glen C <[EMAIL PROTECTED]>:
> Hello,
>
> Does gethostbyaddr actually work for anyone while looking up an IPv6
> address?  I can't seem to get it to work.  For example:
>
> echo gethostbyaddr ( '2001:470:0:64::2' );
>
> should return "ipv6.he.net" but instead I get the following error:
>
> [21-Nov-2008 22:43:37] PHP Warning:  gethostbyaddr()
>  [<a href='function.gethostbyaddr'>function.gethostbyaddr</a>]:
>  Address is not in a.b.c.d form in C:\www\tests\saved\host.php on line 7
>
> Google has not been my friend in this matter...
>
> Any insight?
> Thanks,
> Glen

Hi Glen,

Works for me. IPv6 support was added in 2001. You didn't say what
version of PHP you are having this problem with, so it's hard to say
why yours doesn't have support for it. Perhaps it was configured with
--disable-ipv6 for some reason, or compiled on a system without the
necessary libraries installed (which would be somewhat surprising).


Torben

--- End Message ---

Reply via email to