php-general Digest 6 May 2008 05:09:34 -0000 Issue 5443

Topics (messages 273918 through 273930):

Re: Recommended book on PHP/SOAP
        273918 by: Dan Joseph
        273919 by: Todd Cary
        273922 by: Eric Gorr

Re: Where to start!
        273920 by: Richard Heyes
        273921 by: Tony Marston

using explode
        273923 by: Jason Pruim
        273924 by: Zoltán Németh
        273925 by: Stut

Regex to catch <p>s
        273926 by: Ryan S
        273927 by: Eric Butera
        273929 by: Ryan S

Re: Assigning functions
        273928 by: Philip Thompson

Re: Phpstop.com project - wanna be a writer?
        273930 by: Chris Haensel

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 ---
On Mon, May 5, 2008 at 12:29 PM, Todd Cary <[EMAIL PROTECTED]> wrote:

> I would like a book on implementing SOAP geared for someone with no SOAP
> experience.  Hopefully SOAP can be used with PHP 4?!?
>
> Many thanks...
>
>
>
I'm not sure of a book, but for PHP4 you'll want to grab NuSOAP.  Its
actually a pretty nice SOAP library.  You can ifnd it on google.  I was able
to work with it by searching for examples just fine.  You may not even need
a book.

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month. Reseller plans and
Dedicated servers available.

"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."

--- End Message ---
--- Begin Message ---
Dan Joseph wrote:
On Mon, May 5, 2008 at 12:29 PM, Todd Cary <[EMAIL PROTECTED]> wrote:

I would like a book on implementing SOAP geared for someone with no SOAP
experience.  Hopefully SOAP can be used with PHP 4?!?

Many thanks...



I'm not sure of a book, but for PHP4 you'll want to grab NuSOAP.  Its
actually a pretty nice SOAP library.  You can ifnd it on google.  I was able
to work with it by searching for examples just fine.  You may not even need
a book.

Thank you Dan.

--- End Message ---
--- Begin Message ---
On May 5, 2008, at 12:29 PM, Todd Cary wrote:

I would like a book on implementing SOAP geared for someone with no SOAP experience.

A book I like is:

Pro PHP XML and Web Services
# ISBN-10: 1590596331
# ISBN-13: 978-1590596333

This book requires PHP 5.

Hopefully SOAP can be used with PHP 4?!?


Of course...it is after all still just text transported via the HTTP protocol and PHP does a good job at parsing text, so, at a minimum, you could write your own support for SOAP in PHP 4.

Why are you looking at PHP4? After August of this year, PHP 4 will no longer be supported and I don't believe it had any built-in support for SOAP as PHP 5 does. Although, I believe there is some third-party support for SOAP in PHP 4. I believe this is one example:

http://pear.php.net/package/SOAP/
http://www.evolt.org/article/The_PEAR_SOAP_Implementation/21/49993/



--- End Message ---
--- Begin Message ---
Then surely "designed well" would include a normalised database?

Not necessarily. You could for example have a database that accommodates future needs without being completely normalised.

--
Richard Heyes

+----------------------------------------+
| Access SSH with a Windows mapped drive |
|    http://www.phpguru.org/sftpdrive    |
+----------------------------------------+

--- End Message ---
--- Begin Message ---
"Richard Heyes" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>> Then surely "designed well" would include a normalised database?
>
> Not necessarily. You could for example have a database that accommodates 
> future needs without being completely normalised.

That depends on your definition of "completely normalised". Up to 3NF is 
normally sufficient, whereas up to 6NF might be excessive. But any degree of 
normalisation is better than not having any normalisation at all.

The point I am trying to make is that a totally unnormalised database is 
something which a competent designer will tend to avoid like the plague. 
Only a complete novice will throw together a database which has 0NF.

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org

> -- 
> Richard Heyes
>
> +----------------------------------------+
> | Access SSH with a Windows mapped drive |
> |    http://www.phpguru.org/sftpdrive    |
> +----------------------------------------+ 



--- End Message ---
--- Begin Message ---
Hi everyone,

I am wondering if I can write this cleaner?
        $weightExplode = explode(".", $totalWeight);
        $explodetest = ".";
        $explodetest .= $weightExplode[1];
        $explodetest = $explodetest*16;


I'm hoping I've missed something... Basically I just need to include the "." in $weightExplode[1] before I multiply it by 16. That's the only part that is confusing me right now...

Any ideas?

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]




--- End Message ---
--- Begin Message ---
Jason Pruim írta:
Hi everyone,

I am wondering if I can write this cleaner?
    $weightExplode = explode(".", $totalWeight);
    $explodetest = ".";
    $explodetest .= $weightExplode[1];
    $explodetest = $explodetest*16;


I'm hoping I've missed something... Basically I just need to include the "." in $weightExplode[1] before I multiply it by 16. That's the only part that is confusing me right now...

Any ideas?

I can't write it cleaner, though I can write it shorter:

$weightExplode = explode('.', $totalWeight);
$explodetest = ((float)('.' . $weightExplode[1])) * 16;

(the (float) casting is maybe not required, but I think it's good practice)

greets,
Zoltán Németh


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]






--- End Message ---
--- Begin Message ---
On 5 May 2008, at 20:04, Jason Pruim wrote:
I am wondering if I can write this cleaner?
        $weightExplode = explode(".", $totalWeight);
        $explodetest = ".";
        $explodetest .= $weightExplode[1];
        $explodetest = $explodetest*16;


I'm hoping I've missed something... Basically I just need to include the "." in $weightExplode[1] before I multiply it by 16. That's the only part that is confusing me right now...

$explodetest = ($totalWeight - intval($totalWeight)) * 16;

Untested but should have the same effect as your code.

-Stut

--
http://stut.net/

--- End Message ---
--- Begin Message ---
 Hey all!

To say I suck at regex is an understatement so really need any help I can get 
on this, I have a page of text with different html tags in them, but each 
"block" of text has a <p> or a < class="something"> tag... anybody have any 
regex that will catch each of these paragraphs and put then into an array
example:
array[0]="<p> first block </p>";
array[1]="<p class="blah">  block X</p>";

Thanks!
R




      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

--- End Message ---
--- Begin Message ---
On Mon, May 5, 2008 at 9:59 PM, Ryan S <[EMAIL PROTECTED]> wrote:
>  To say I suck at regex is an understatement so really need any help I can 
> get on this, I have a page of text with different html tags in them, but each 
> "block" of text has a <p> or a < class="something"> tag... anybody have any 
> regex that will catch each of these paragraphs and put then into an array


If you're using php5 you can use DOM's getElementsByTagName.

If you still think you need to do some sort of regex it is possible
but it will be buggy at best.

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

<clip>
>  To say I suck at regex is an understatement so really need any help I can 
> get on this, I have a page of text with different html tags in them, but each 
> "block" of text has a <p> or a < class="something"> tag... anybody have any 
> regex that will catch each of these paragraphs and put then into an array


If you're using php5 you can use DOM's getElementsByTagName.

If you still think you need to do some sort of regex it is possible
but it will be buggy at best.


</clip>

Nope, need a regex... guess I have no choice, either chancy regex or nothing... 
I know for a fact that the first paragraph tag wont contain a class, and for 
the <p> tags that contain a class="blah" does it matter that i know exactly 
what the classname is?



      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

--- End Message ---
--- Begin Message ---
On May 2, 2008, at 2:42 PM, Craige Leeder wrote:

Hello Philip

First thing first: design patterns are your friend. A good reference
for which, is:

http://www.fluffycat.com/PHP-Design-Patterns/

Second of all. What is the situation in which you are trying to do
this? I can't really think of one where you would do such a thing.

- Craige

Sorry I haven't responded earlier... was away from my computer since Friday!

First, thanks for the link. Second, because of the way our application is setup, I am interested in doing this functionality. However, someone pointed out a very good point - basically abstraction and classes not needing to know about other classes. So, 'A' knowing about 'C' is "not a good thing" (TM). After thinking twice about it, I won't take this approach.

However, the reason this came up is because the application is split up logically between the database layer, security layer, view layer, logic layer, etc... There is a core class which has generic functions in it which is called on every request. In this class, other classes are instantiated and used throughout the app. Kinda like this...

<?php
class Core {
    $this->site = new Site ();
}

class Site {
    $this->render = new Render ();
}

class Render {
    function translate ($template, $arr) {
        $content = str_replace (
            array_keys($arr),
            array_values($arr),
            "$template.tpl.php"
        );
        return $content;
    }

    function stroke () { }
}

// Somewhere in the app...
$content = $core->site->render->translate('someTemplate', $replace);
?>

Obviously, these are VERY dumbed-down versions of the classes, but this is the general idea. It all comes down to separation of business logic from the view from the database, and so on.

Hopefully that's as clear as mud now.

~Philip


On Fri, May 2, 2008 at 3:09 PM, Philip Thompson <[EMAIL PROTECTED] > wrote:
Hi all. I have several classes. Within each class, a new class is called. Is there a way to assign a function in a *deeper* class to be called in the
first class? Example to follow......

<?php
class A {
   function __construct () {
       $this->b = new B ();
       // I want to do the following. This does not work, of course.
       $this->doSomething = $this->b->c->doSomething;
   }
}

class B {
   function __construct () {
       $this->c = new C ();
   }
}

class C {
   function __construct () { }
   function doSomething () { echo "¡Hi!"; }
}

$a = new A ();
// Instead of doing this,
$a->b->c->doSomething();

// I want to do this.
$a->doSomething(); // ¡Hi!
?>

Basically, it's just to shorten the line to access a particular function.
But, is it possible?!

Thanks,
~Philip

--- End Message ---
--- Begin Message ---
-----Original Message-----
From: tedd [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 05, 2008 3:59 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Phpstop.com project - wanna be a writer?

At 3:12 PM +0200 5/5/08, Chris Haensel wrote:
>ROFL!
>
>I can not believe Mr Tedd THE Sperling has been thinking bout the same
>thing.
>
>Well, you are going to do it webbased, aren't ya? I was thinking to have it
>in PDF magazine style.
>
>Maybe I can have you as a writer? ;o) And maybe 2 or 3 more of this
list....
>The "big names", ya know *g*

I'm not sure as to how you meant that -- I hope it was in a good way.

I expressed my thoughts because we might find some common ground, or 
not -- just an idea.

I don't go by the name Tedd anymore -- non sum qualis eram.

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

Hi Tedd,

I absolutely meant that in a good way! You are one of the guys I see VERY
active on this list, and I really get a lot from the help you're giving
others. I really like the way you put things, so: yeah, I meant it in a good
way :o) And I was a bit stunned when you wrote that you've had an almost
similar idea. Maybe my english skills aren't good enough yet to show when I
am trying to make a bit of a joke *gg*

Maybe we can find some common gorund, as you said. I sure love the idea :o)

All the best!

Chris


--- End Message ---

Reply via email to