php-general Digest 7 May 2010 00:02:41 -0000 Issue 6730
Topics (messages 304939 through 304968):
Re: Getting source from remote file
304939 by: Peter Lind
304942 by: Michiel Sikma
304951 by: Auto-Deppe C. Hänsel
304952 by: Peter Lind
Re: In need of CVS/SVN checkout script for Production servers [solved]
304940 by: David Otton
304961 by: tedd
Re: Really impressive work
304941 by: Per Jessen
304959 by: tedd
Converting floats to ints with intval
304943 by: Paul Waring
304944 by: Ashley Sheridan
304945 by: Paul Waring
304946 by: Ashley Sheridan
304947 by: Paul Waring
304948 by: Pete Ford
304949 by: David Otton
304950 by: Paul Waring
304953 by: David McGlone
304954 by: Bob McConnell
304955 by: Paul Waring
304956 by: David McGlone
304957 by: Robert Cummings
304958 by: Fernando
Re: Two color rows in table inside while iteration [X-PHP]
304960 by: tedd
304967 by: Michiel Sikma
any major benefit in larger fread() blocks when reading STDIN?
304962 by: Robert P. J. Day
¡°Îå-Á¬-¹á¡±¹É|Ȩ-¼¤|Àø-·¨
304963 by: fx
304965 by: Dan Joseph
Re: âäº-è¿-è´¯âè¡|æ-æ¿|å±-æ³
304964 by: Ashley Sheridan
Using array_intersect with an unknown number of arrays
304966 by: robert mena
simplexml choking on apparently valid XML
304968 by: Brian Dunning
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
On 6 May 2010 10:47, Auto-Deppe C. Hänsel <c.haen...@auto-deppe.de> wrote:
> Hi guys and girls,
>
> okay, this is a dumbnut question I wouldn't bother asking.... but I really
> did hit a spot now where I am totally wedged up in my head and can't think
> straight anymore... so the, I bet easy, answer to my question escapes me.
>
> What I am trying to do is the following:
>
> Read the contents of a remote file via file()
>
> So I do
>
> $content = file($url);
>
> Now $content holds the HTML source of the page.
>
> Now this page has some DIVs in it with a class "myclass123" (just for this
> purpose)
>
> Now I want to get the content of these divs into a variable / some
> variables. No more, no less.
>
> Can anybody please direct me towards the answer? Damn, I must sleep more at
> night, so I can think straight at work....
>
> Any help is very much appreciated! Thanks!
>
> Chris
>
You could parse the document with the DOM classes. Load as a
DOMDocument, then grab what's needed with the relevant methods (you
can use xpath to single out your divs with the right classes).
http://dk2.php.net/domdocument
--
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
</hype>
--- End Message ---
--- Begin Message ---
On 6 May 2010 10:55, Peter Lind <peter.e.l...@gmail.com> wrote:
>
>
> You could parse the document with the DOM classes. Load as a
> DOMDocument, then grab what's needed with the relevant methods (you
> can use xpath to single out your divs with the right classes).
> http://dk2.php.net/domdocument
>
>
>
Xpath is indeed the way to go. For example...
/* .. your code.. */
$data = file_get_contents($url);
$inDoc = new DOMDocument();$inDoc->preserveWhiteSpace =
false;@$inDoc->loadHTML($data);
$xpath = new DOMXPath($inDoc);$xlinks =
$xpath->query('//d...@class="b"]/a');for ($a = 0, $z =
$xlinks->length; $a < $z; ++$a) {
$link = $xlinks->item($a);
$href = $xlink->attributes->getNamedItem('href')->value;
}
To be safe, you should use an ID instead of a class, though.
Michiel
--- End Message ---
--- Begin Message ---
> On 6 May 2010 10:55, Peter Lind <peter.e.l...@gmail.com> wrote:
>
> You could parse the document with the DOM classes. Load as a
> DOMDocument, then grab what's needed with the relevant methods (you
> can use xpath to single out your divs with the right classes).
> http://dk2.php.net/domdocument
>
>
> Xpath is indeed the way to go. For example...
>
>
> /* .. your code.. */
>
> $data = file_get_contents($url);
>
> $inDoc = new DOMDocument();
> $inDoc->preserveWhiteSpace = false;
> @$inDoc->loadHTML($data);
>
> $xpath = new DOMXPath($inDoc);
> $xlinks = $xpath->query('//d...@class="b"]/a');
> for ($a = 0, $z = $xlinks->length; $a < $z; ++$a) {
> $link = $xlinks->item($a);
> $href = $xlink->attributes->getNamedItem('href')->value;
>
> }
>
> To be safe, you should use an ID instead of a class, though.
>
> Michiel
Hi all, and thanks a lot for your suggestions. It works well now.
The only problem I do have are german "Umlaute" [äöü] when receiving the
content of the remote page.
It#s formatted in iso-8859-1 and I'd rather have it in UTF-8. But
utf8_de/encode won't help me there, I'm afraid.
Anyhow, thanks a lot for your help!
Chris
--- End Message ---
--- Begin Message ---
On 6 May 2010 14:20, Auto-Deppe C. Hänsel <c.haen...@auto-deppe.de> wrote:
>
> Hi all, and thanks a lot for your suggestions. It works well now.
> The only problem I do have are german "Umlaute" [äöü] when receiving the
> content of the remote page.
> It#s formatted in iso-8859-1 and I'd rather have it in UTF-8. But
> utf8_de/encode won't help me there, I'm afraid.
>
http://dk2.php.net/manual/en/function.mb-convert-encoding.php might be of help.
Regards
Peter
--
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
</hype>
--- End Message ---
--- Begin Message ---
On 6 May 2010 04:14, Adam Richardson <simples...@gmail.com> wrote:
> Daevid asked the list for a an app that facilitated SVN/CVS, and when nobody
> provided options, he crafted a solution of his own and then offered it back
> to the list.
Er... I suggested Phing. Phing/Ant/Gradle/Maven/Capistrano... a build
tool is the standard solution here, and there are about a million of
them (http://en.wikipedia.org/wiki/List_of_build_automation_software).
I can't believe people are seriously discussing rolling your own when
all those mature tools are sitting right there.
Did my post not get through or something?
--- End Message ---
--- Begin Message ---
At 5:43 PM -0700 5/5/10, Daevid Vincent wrote:
> -----Original Message-----
> From: tedd [mailto:tedd.sperl...@gmail.com]
> Sent: Wednesday, May 05, 2010 8:19 AM
> To: Daevid Vincent; php-gene...@lists.php.net
> Subject: RE: [PHP] In need of CVS/SVN checkout script for
>-snip- stuff which fell on deaf ears
>
> tedd
*sigh* once again you people focus on something SOOOO off topic compared to
the meat of the thread -- which is a production repository checkout script.
Let me get this right -- you created a repository for people to
check-out/deposit scripts, but then deny some people access because
of their choice of browser? That seems counter productive. Do your
scripts only work for certain browsers?
---------------
As for my site.
[*] I really don't care about the fringe browsers...
That obvious. But what happens when your client's do care?
---------------
Give me a break man. I've got more important things to do.
Let me get this right -- it's more important to do something else
than to fix something you did wrong? If you're gong to take the time
to do something, then why not do it right? Remember, this is an
example of *your* work.
I spend a lot of my time making my code as good as I can get it, not
because of clients, or what others might think, but because of me.
It's a personal choice of mine to always learn and improve. If you
allow "I've got more important things to do" altitude to excuse bad
code, then you are only hurting yourself in the long run. I think you
know that.
---------------
[*] Honestly, I also dislike Apple. I think it's stupid for them to make a
browser. I think they make crappy products.
LOL!
So you think that M$ makes better stuff, like IE6? Even Apple's worst
browser was better than that!
---------------
As for CSS, inline styles, separation of logic, and all that other stuff
you ASSUME I don't use -- you are very wrong. I just happen to use a lot of
PHP to dynamically create various parts.
I'm not ASSUMING anything -- it's a fact the site you provided
doesn't follow said practices.
Additionally, you seem to be blaming PHP for the bad code but the
fact is you're just being lazy. Many of my sites are dynamically
created via PHP but still generate good code. One doesn't exclude the
other.
The point is that you want us to go to your site to check-out/provide
scripts, but the site you provided reeks of bad code. That's a bit
like a dinner saying "Don't mind the dirty silverware, just eat the
food."
---------------
In some cases I inline styles where they are used one time or used
in a PHP function.
Okay, then why not learn how to do it right? Using a validator can
help you improve your code. Standards are not just for an elite group
of people but rather to improve overall coding practices. What's
wrong with that? Validation is giving you the opportunity to
critically review your code.
---------------
If I had to choose between my
daevid.com site and one of the three you (presumably) illustrate as beacons
of "the way to do it" (http://sperling.com http://ancientstones.com
http://earthstones.com), then I would take my site any day of the week.
Go ahead -- but many people won't -- as shown by your site's NULL
Google PageRank.
At least my sites have traffic. For example, according to today's
Google Analyitics report during the last 30 days my sperling.com site
has received 5970 unique visitors -- I'll take *that* any day of the
week over shutting people out.
Daevid -- after all is said and done, I know you are better than
this. I'm not sure why you are arguing the point.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
tedd wrote:
> Now, I realize that this company did not take 15 factorial pictures
> of this single piece of jewelry to present all these different
> combinations but instead placed smaller images of each of the stones
> at specific coordinates on the larger image of the jewelry.
>
> I imagine that each piece of jewelry must have the coordinates of
> each setting in a database so that they can "on-the-fly" assemble the
> finished product as per user's direction.
>
> For example, let's take the image of the basket pendant showing three
> stones. Each of the stone locations would have a specific pixel
> placement (i.e., x,y). As such, the database would have a field for
> the image and three location fields for stones 1, 2, and 3.
>
> Now, we also have smaller images of 12 different stones (in heads)
> that are all the same size. Thus, as the user picks the stones and
> positions they want and the image is assembled "on the fly".
>
> Is that the way you see this?
Yes - each picture is basically a base + a number of overlays. Quickly
done with e.g. libgd or some such.
--
Per Jessen, Zürich (8.9°C)
--- End Message ---
--- Begin Message ---
At 9:43 PM -0400 5/5/10, Robert Cummings wrote:
Nathan Rixham wrote:
tedd wrote:
Hi gang:
I found something that really impressed me -- please review this:
http://palomarjewelry.com/product/id/19/collectionId/1/typeId/3
-snip-
I would use PNGs with alpha transparencies. You have X images with
the appropriate positions and then you just overlay an alpha
transparency PNG in the correct spot via CSS. Pretty simple
actually. Relative position the ring, absolute position the stone
relative to the ring. Even IE6 will support this with pngfix.js.
Viewing the page media in Firefox though shows they are generating
it server side though.
Cheers,
Rob.
Rob:
Yes, that's what I observed as well. The only way I could think they
did it was to pull the positions for the overlays from a database. My
inquiry was only to check if something new had emerged.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
I've got the following script which demonstrates a problem I'm having
with floating point numbers and intval:
$times100 = (-37.12 * 100);
print $times100 . "\n";
$intval100 = intval($times100);
print $intval100 . "\n";
print ($intval100 / 100) . "\n";
I expect the output to be:
-3712
-3712
-37.12
However, the actual output I'm getting (on several systems, so it's not
just my machine) is:
-3712
-3711
-37.11
Is there a reason for this, and a better way I should be doing it?
Basically I need to add up a list of floats, representing currency
values, and see if they're equal to another float, but I need to convert
them to ints first because I can't guarantee than there won't be
something after the second decimal place.
Thanks,
Paul
--
Paul Waring
http://www.pwaring.com
--- End Message ---
--- Begin Message ---
On Thu, 2010-05-06 at 11:24 +0100, Paul Waring wrote:
> I've got the following script which demonstrates a problem I'm having
> with floating point numbers and intval:
>
> $times100 = (-37.12 * 100);
> print $times100 . "\n";
>
> $intval100 = intval($times100);
> print $intval100 . "\n";
>
> print ($intval100 / 100) . "\n";
>
> I expect the output to be:
> -3712
> -3712
> -37.12
>
> However, the actual output I'm getting (on several systems, so it's not
> just my machine) is:
> -3712
> -3711
> -37.11
>
> Is there a reason for this, and a better way I should be doing it?
> Basically I need to add up a list of floats, representing currency
> values, and see if they're equal to another float, but I need to convert
> them to ints first because I can't guarantee than there won't be
> something after the second decimal place.
>
> Thanks,
>
> Paul
>
> --
> Paul Waring
> http://www.pwaring.com
>
It's part of the rounding problem you get with most languages out there.
Why can't you compare the floating point values though? Currency should
only have one decimal place anyway.
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
Ashley Sheridan wrote:
It's part of the rounding problem you get with most languages out there.
Why can't you compare the floating point values though? Currency should
only have one decimal place anyway.
You can't compare floating point values because if you have, for
example, a user-entered value of '37.12' and add that to '0.18' it won't
necessarily be equal to '37.30'.
Currency must have two decimal places, otherwise how would you represent
five pounds and sixteen pence (£5.16) for example?
--
Paul Waring
http://www.pwaring.com
--- End Message ---
--- Begin Message ---
On Thu, 2010-05-06 at 11:40 +0100, Paul Waring wrote:
> Ashley Sheridan wrote:
> > It's part of the rounding problem you get with most languages out there.
> > Why can't you compare the floating point values though? Currency should
> > only have one decimal place anyway.
>
> You can't compare floating point values because if you have, for
> example, a user-entered value of '37.12' and add that to '0.18' it won't
> necessarily be equal to '37.30'.
>
> Currency must have two decimal places, otherwise how would you represent
> five pounds and sixteen pence (£5.16) for example?
>
> --
> Paul Waring
> http://www.pwaring.com
>
Sorry, I misread that as decimal point!
Why don't you store them as integer values and add in the decimal point
with something like sprintf() afterwards? Store the values as pence and
then you won't have any rounding problems.
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
Ashley Sheridan wrote:
Why don't you store them as integer values and add in the decimal point
with something like sprintf() afterwards? Store the values as pence and
then you won't have any rounding problems.
If I was designing the system from scratch, that's what I'd do.
Unfortunately this is an add-on to a legacy system where currency values
are already stored as strings in the database (yes, not ideal I know,
but you have to work with what you've got).
--
Paul Waring
http://www.pwaring.com
--- End Message ---
--- Begin Message ---
On 06/05/10 11:52, Paul Waring wrote:
Ashley Sheridan wrote:
Why don't you store them as integer values and add in the decimal point
with something like sprintf() afterwards? Store the values as pence and
then you won't have any rounding problems.
If I was designing the system from scratch, that's what I'd do.
Unfortunately this is an add-on to a legacy system where currency values
are already stored as strings in the database (yes, not ideal I know,
but you have to work with what you've got).
Can you not just add up the floating point numbers and the round them with
round() (http://www.php.net/manual/en/function.round.php)
Certainlay for consistent calculations I'd always use the float values for as
long as possible...
Otherwise, why not multiply by 1000 before taking the intval, then at least you
preserve the next decimal place.
--- End Message ---
--- Begin Message ---
On 6 May 2010 11:52, Paul Waring <p...@xk7.net> wrote:
> If I was designing the system from scratch, that's what I'd do.
> Unfortunately this is an add-on to a legacy system where currency values are
> already stored as strings in the database (yes, not ideal I know, but you
> have to work with what you've got).
I don't know much about your situation, but it does sound like you
need to fix the root problem. I'd use a decimal type, and lean on the
database to do the maths.
http://dev.mysql.com/doc/refman/5.1/en/numeric-types.html
You many also find money_format() useful:
http://php.net/manual/en/function.money-format.php
--- End Message ---
--- Begin Message ---
David Otton wrote:
On 6 May 2010 11:52, Paul Waring <p...@xk7.net> wrote:
If I was designing the system from scratch, that's what I'd do.
Unfortunately this is an add-on to a legacy system where currency values are
already stored as strings in the database (yes, not ideal I know, but you
have to work with what you've got).
I don't know much about your situation, but it does sound like you
need to fix the root problem. I'd use a decimal type, and lean on the
database to do the maths.
As I said, unfortunately it's a legacy system, so I can't just change
the database to use a different type (there are dozens of columns set up
like this, with thousands of values already set).
--
Paul Waring
http://www.pwaring.com
--- End Message ---
--- Begin Message ---
On Thursday 06 May 2010 07:19:48 Paul Waring wrote:
> David Otton wrote:
> > On 6 May 2010 11:52, Paul Waring <p...@xk7.net> wrote:
> >> If I was designing the system from scratch, that's what I'd do.
> >> Unfortunately this is an add-on to a legacy system where currency values
> >> are already stored as strings in the database (yes, not ideal I know,
> >> but you have to work with what you've got).
> >
> > I don't know much about your situation, but it does sound like you
> > need to fix the root problem. I'd use a decimal type, and lean on the
> > database to do the maths.
>
> As I said, unfortunately it's a legacy system, so I can't just change
> the database to use a different type (there are dozens of columns set up
> like this, with thousands of values already set).
Would It be possible to write a script to extract everything from that
database and insert it into a database with the correct columns and values,
then all you would need to do is change the db connection information.
--
Blessings,
David M.
--- End Message ---
--- Begin Message ---
From: David McGlone
>On Thursday 06 May 2010 07:19:48 Paul Waring wrote:
>> David Otton wrote:
>> > On 6 May 2010 11:52, Paul Waring <p...@xk7.net> wrote:
>> >> If I was designing the system from scratch, that's what I'd do.
>> >> Unfortunately this is an add-on to a legacy system where currency
values
>> >> are already stored as strings in the database (yes, not ideal I
know,
>> >> but you have to work with what you've got).
>> >
>> > I don't know much about your situation, but it does sound like you
>> > need to fix the root problem. I'd use a decimal type, and lean on
the
>> > database to do the maths.
>>
>> As I said, unfortunately it's a legacy system, so I can't just change
>> the database to use a different type (there are dozens of columns set
up
>> like this, with thousands of values already set).
>
> Would It be possible to write a script to extract everything from that
> database and insert it into a database with the correct columns and
values,
> then all you would need to do is change the db connection information.
If the data is really stored in strings, you need to break it down into
substrings around the decimal and then convert both sides into integers
and combine them into an integer value. It is the conversion into float
that introduces the error because of the imprecise representation of
fractional decimal values in binary.
Bob McConnell
--- End Message ---
--- Begin Message ---
David McGlone wrote:
On Thursday 06 May 2010 07:19:48 Paul Waring wrote:
David Otton wrote:
On 6 May 2010 11:52, Paul Waring <p...@xk7.net> wrote:
If I was designing the system from scratch, that's what I'd do.
Unfortunately this is an add-on to a legacy system where currency values
are already stored as strings in the database (yes, not ideal I know,
but you have to work with what you've got).
I don't know much about your situation, but it does sound like you
need to fix the root problem. I'd use a decimal type, and lean on the
database to do the maths.
As I said, unfortunately it's a legacy system, so I can't just change
the database to use a different type (there are dozens of columns set up
like this, with thousands of values already set).
Would It be possible to write a script to extract everything from that
database and insert it into a database with the correct columns and values,
then all you would need to do is change the db connection information.
Possible, yes. Practical, no. :)
--
Paul Waring
http://www.pwaring.com
--- End Message ---
--- Begin Message ---
On Thursday 06 May 2010 08:39:03 Bob McConnell wrote:
> From: David McGlone
>
> >On Thursday 06 May 2010 07:19:48 Paul Waring wrote:
> >> David Otton wrote:
> >> > On 6 May 2010 11:52, Paul Waring <p...@xk7.net> wrote:
> >> >> If I was designing the system from scratch, that's what I'd do.
> >> >> Unfortunately this is an add-on to a legacy system where currency
>
> values
>
> >> >> are already stored as strings in the database (yes, not ideal I
>
> know,
>
> >> >> but you have to work with what you've got).
> >> >
> >> > I don't know much about your situation, but it does sound like you
> >> > need to fix the root problem. I'd use a decimal type, and lean on
>
> the
>
> >> > database to do the maths.
> >>
> >> As I said, unfortunately it's a legacy system, so I can't just change
> >> the database to use a different type (there are dozens of columns set
>
> up
>
> >> like this, with thousands of values already set).
> >
> > Would It be possible to write a script to extract everything from that
> >
> > database and insert it into a database with the correct columns and
>
> values,
>
> > then all you would need to do is change the db connection information.
>
> If the data is really stored in strings, you need to break it down into
> substrings around the decimal and then convert both sides into integers
> and combine them into an integer value. It is the conversion into float
> that introduces the error because of the imprecise representation of
> fractional decimal values in binary.
I see.
--
Blessings,
David M.
--- End Message ---
--- Begin Message ---
Paul Waring wrote:
I've got the following script which demonstrates a problem I'm having
with floating point numbers and intval:
$times100 = (-37.12 * 100);
print $times100 . "\n";
$intval100 = intval($times100);
print $intval100 . "\n";
print ($intval100 / 100) . "\n";
I expect the output to be:
-3712
-3712
-37.12
However, the actual output I'm getting (on several systems, so it's not
just my machine) is:
-3712
-3711
-37.11
Is there a reason for this, and a better way I should be doing it?
Basically I need to add up a list of floats, representing currency
values, and see if they're equal to another float, but I need to convert
them to ints first because I can't guarantee than there won't be
something after the second decimal place.
This is a very well known problem in computer science:
http://en.wikipedia.org/wiki/Floating_point
To illustrate your example run the following:
<?php
$value = -37.12;
echo "Value: ".sprintf( '%f', $value )." (what you think you have)\n";
echo "Value: ".sprintf( '%f', $value )." (what the computer thinks you
have)\n\n";
$value *= 100;
echo "Value: ".sprintf( '%f', $value )." (after multiply by 100)\n";
echo "Value: ".sprintf( '%.20f', $value )." (what the computer thinks
you have)\n\n";
$value = intval( $value );
echo "Value: ".sprintf( '%d', $value )." (after type conversion to int)\n";
echo "Value: ".sprintf( '%d', $value )." (what the computer thinks you
have)\n\n";
$value /= 100;
echo "Value: ".sprintf( '%f', $value )." (after divide by 100)\n";
echo "Value: ".sprintf( '%.20f', $value )." (what the computer thinks
you have)\n\n";
?>
As you can see the values are tripped up at the multiplication stage
where the computer can't perfectly store the value -3712.0 and then this
is excerbated by the truncation of the value to an integer using
intval(). If you want to avoid this, then you should avoid the
conversion to int and use rounding for the final result.
<?php
$value = -37.12;
$value *= 100;
$value /= 100;
echo "Value: ".sprintf( '%f', $value )." (after divide by 100)\n";
echo "Value: ".sprintf( '%.20f', $value )." (what the computer thinks
you have)\n";
echo "Value: ".sprintf( '%.2f', $value )." (formatted with rounding)\n";
?>
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--- End Message ---
--- Begin Message ---
I think Bob has a good idea here, split the string values and the
concatenate them to make the whole value.
If the data is really stored in strings, you need to break it down into
substrings around the decimal and then convert both sides into integers
and combine them into an integer value. It is the conversion into float
that introduces the error because of the imprecise representation of
fractional decimal values in binary.
Bob McConnell
--- End Message ---
--- Begin Message ---
At 12:07 AM +0200 5/6/10, Michiel Sikma wrote:
On 2 May 2010 19:11, tedd
<<mailto:tedd.sperl...@gmail.com>tedd.sperl...@gmail.com> wrote:
<government rant>
-snip-
Yes, it would be nice if the people who work for the government also
had to live under the same rules as the rest of us. As it is, they
live in a state of privilege enjoying salaries that are typically
175 percent above that of the private sector with benefits to match.
They do this without advancing the quality of life for anyone --
they have no purpose other than to push papers, collect *their*
wages, enjoy *their* health insurance, and wait for *their* lavish
retirement. Of course, they claim they have purpose, but most of us
know better. The sooner we reduce the size and importance of
government, the better off we all will be.
</government rant>
Cheers,
tedd
Hello,
I'm not a moderator of this list, but I would like to ask you to
please not use the PHP list for such confronting political
diatribes. This is a very well known talking point that can easily
elicit a lengthy off-topic discussion, and I don't think anybody is
really interested in that.
Again, this is just my opinion, but while it's okay to talk about
things other than PHP on occasion, I don't really see what use this
has other than provoking a response from someone.
Please be considerate is all I'm asking.
Michiel
Michiel:
Considerate? Being Inconsiderate is what the government does for a living.
Additionally, what you said above is *your* opinion -- as *you*
presented in a public forum. Who's opinion is more appropriate for
this list is subject to debate.
As for me, I'll say whatever I want as the topic permits. If you will
review this thread you will see that I was offering my code free to
everyone except government. That's not an opinion but rather a
statement of requirement for the code I'm providing. My second post
to this thread contained the reason WHY the requirement.
If you don't like my requirements, and reasons for them, then please
forward my postings to the trash and don't use my code.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
On 6 May 2010 17:47, tedd <tedd.sperl...@gmail.com> wrote:
>
>
> Michiel:
>
> Considerate? Being Inconsiderate is what the government does for a living.
>
> Additionally, what you said above is *your* opinion -- as *you* presented
> in a public forum. Who's opinion is more appropriate for this list is
> subject to debate.
>
> As for me, I'll say whatever I want as the topic permits. If you will
> review this thread you will see that I was offering my code free to everyone
> except government. That's not an opinion but rather a statement of
> requirement for the code I'm providing. My second post to this thread
> contained the reason WHY the requirement.
>
> If you don't like my requirements, and reasons for them, then please
> forward my postings to the trash and don't use my code.
>
>
> Cheers,
>
> tedd
>
>
It appears as though I struck a wrong chord. I honestly did not mean to
upset you. :) My point was that we should not be overtly confrontational
towards one another, but it seems that only exacerbated the situation. My
sincerest apologies.
Regards,
Michiel
--- End Message ---
--- Begin Message ---
i'm looking at some existing code that (obviously) reads from stdin:
$fd = fopen("php://stdin", "r");
$source = "";
while (!feof($fd)) {
$source .= fread($fd, 1024);
}
fclose($fd);
it works fine, but is there any reason the original author would have
chosen 1024 as the individual read unit size? from the PHP page for
fread here:
http://ca.php.net/manual/en/function.fread.php
i read that reading with fread() stops after (among other things),
"8192 bytes have been read (after opening userspace stream)." does
that mean that 8192 is the maximum read size you can specify? and
would there be any drawback or value in changing 1024 to 8192? or
would it make so little difference that it doesn't matter? thanks.
rday
--- End Message ---
--- Begin Message ---
php-gene...@lists.php.net
《 “五步连贯”股权激励法--留驻核心人才 》
时 间:2010年5月29-30日(深 圳)
时 间:2010年6月04-05日(上 海)
(股权激励第一人薛中行博士主讲)---- 为企业建立最完善的股权激励方案
------------------------------------------------------------------------
◆课程对象:企业总裁、董事长、总经理、决策者、人力资源总监、财务总监及薪
资福利经理、中高层管理人员、HR管理从业人员等。
◆课--程--背--景:
* 如何让新员工入职后就有归属感?
* 如何让老员工永具激情和创造力?
* 如何让核心员工与企业同心同德?
* 如何让公司高管与你不离不去?
* 如何合理设计股权激励方案?◆如何能让激励达到长期有效?
* 如何优化企业股权?
* 如何在股权被稀释的同时保持控制权和经营权的统一?
* 如何既保持企业股权激励的功能发挥,又能将其操作与法律风险控制到一个防火
墙内?…… 薛中行教授将在课上一一为您揭晓答案,手把手教您设计适合自身企业
的股权激励方案。 为您的企业打造“金手铐”,有效留住核心人才,增强企业凝聚
力;
为您的企业打造“金钥匙”,彻底激发员工潜能,加速企业实现目标、发展壮大;
为您的企业打造“金色降落伞”,圆满解决元老退出各大难题;
……目前,员工持股、年底分红等“股权激励”问题是众多企业最为关注的核心问题
,薛博士“手把手”教您运用股权期权这一独特的“创富机器”,为您的企业量身打
造一幅诱人的
“金手铐”,开启人才价值的“金钥匙”。
◆课--程--收--益:
咨询式培训--课程采取小班制授课方式,这样可以更好的保证授课效果,方便现场
咨询与互动,让学员真正的能够学到、悟到、得到进而可以做到。创新性与唯一性-
-国内首家系统性的股权激励培训,先后创造了业内五个第一。系统性与全面性--课
程从人力资本提升的角度出发结合当前的法律、法规、财务、税务等各方面内容从方
案设计到激励实施都进行系统而全面的阐述。真实性与实用性---课程中所讲的股权
设计模式都是薛博士在近十年来他亲自参与的各大中型企业的实际顾问案例中总结提
炼出来的,完全都能转化运用在学员企业上.并且分享。
股权激励方面的众多经典案例,具有极高的学习和参考价值。个性化与专业性---
由薛博士亲自与学员在workshop中进行一对一的辅导与交流,运用其深厚专业的学术
知识与丰富的实战经验为学员“量体裁衣”,制定最佳方案。
◆课--程--大--纲:
◇模块一 五步连贯股权激励法
(一)股权激励“前奏曲”
1、股权、股份与股票
2、实股、期股与期权
3、短期、中期与长期
4、赠与、购买与赊账
5、有形、无形与计量
思考:财聚人聚VS财散人聚?朝三暮四vs朝四暮三?
(二)股----“好的模式是成功的一半”
1、期权模式
2、限制性股票模式
3、股票增值权模式
4、虚拟股票模式
研讨:如何根据自身情况,选择合适的股权激励模式组合?
动态股权制的建构
(三)人----“重在人力资本投资”
1、对"岗"还是对"人"?
2、从精英到员工,多大范围股权激励才合适?
3、工作性质与股权激励:高管、核心技术人员,还是营销骨干?
4、定人三段论
5、股权激励留人的核心在哪里?
思考:《劳动合同法》下如何巧用股权激励达到激励和约束知识员工的目的?
(四)价----“人力资本可计量”
1、如何给企业合理估值定价?上市公司的期权定价模型
2、如何给人员合理估值定价?
3、技术管理要素如何合理入股?
4、如何合理设计激励杠杆?
思考1:内部市场价格VS 外部评估价格?
思考2:唐骏的十亿身价与紫金矿业的高溢价发行有无联系?
(五)量----“过犹不及、与时俱进”
1、你的蛋糕有多大?
2、从1%到10%
3、六十年后看你的企业
思考:如何合理分配股份、期权额度和数量?
既不缺乏激励力度,又避免过度激励,稀释股权。 股权激励的相对数论。
(六)时----“嵌套与循环”
1、 生命周期vs行业特点
2、 股权激励的长周期与短周期
3、 延期支付与股权激励
4、 8年限制期
思考:如何选择“对的时间”来完成对的事?
研讨:金手铐是如何铸就的?
◇模块二 股权激励方案设计技巧
(一)股权激励成功的七个关键要素
1、如何评价一个股权激励的成功?
2、股权激励7要素
(二)股权激励争议案例深度剖析
1、TCL的股权激励:从赞许到失望
2、光明乳业:股权激励四人行
3、海尔高管为何辞职?
(三)股权激励的设计环节与流程
1、 股权激励整体设计流程
2、 股权激励三阶段论
3、 如何循序渐进发展股权激励
4、股权期权的会计处理及有关问题
四、我们该如何设计股权激励方案?
◇模块三 股权激励相关法律问题
1、案例分析:股权激励四大争议案例
2、证监会关于股权激励的有关规定
3、上市公司股权激励案例分析
4、财政部 国税总局等有关股权激励的规定
5、会计准则中的股份支付
思考:如何在股权激励的同时设计限制性条款?
◇模块四 股本设计股权治理技巧
1、如何合理设计股权
2、影子股票、信托股票与虚拟股票的对比。
重点研讨:如何有效设计法律防火墙,避免股权纠纷,规避为上市造成障碍
◇模块五 股权激励实战案例讨论会
与薛中行博士深入探讨自身企业设计与实施股权激励方案涉及的种种实际问题。
------------------------------------------------------------------------
◆讲--师--介--绍:
薛中行博士:股权激励第一人;毕业于中国著名高等学府复旦大学,在复旦大学
经济管理学院接受现代经济学的培养,并多次应邀访学于英美等著名高等学府。同
时出于对中国优秀古典文化的热爱,中行博士亦潜心钻研《周易》二十余载,具有
现代商业经济与中国古典哲学的双重思维方式和文化底蕴。
◇中国证监会登记结算股权激励课题组组长
◇经济学博士、资深投资银行专家
◇中国股权激励第一人,国内实战派股权激励专家
◇企业“股权激励”领域的拓荒者、权威专家
◇担任近百家企业的首席咨询顾问
◇擅长讲授人力资源与资本运作各模块的课程,尤其是股权激励课程
◇中大、浙大等多家著名院校客座教授,主讲股权激励课程,满意度高达95%
◇先后创造了业内众多个第一:
第一家系统总结了各种股权激励案例,并在此基础上提炼出国内唯一成熟可行的“
五步连贯股权激励法”;
第一家采用“股权释兵权”,为浙江一福布斯上榜企业成功解决了“元老退出”难题;
第一家将“博弈论”的分析工具引入到中国企业咨询实际,帮助企业在战略制定、股
权分配、岗位评估、企业文化方面进行独特的应用;
第一家提出“人力资源股权化”、“人力资源证券化”概念,帮助大量企业解决员工
激励难题,实现了人力资源的资本化运作;
第一家帮助双家族企业解决了公司治理难题。
薛博士有近20年的从业经验,组织并成功实施过众多著名企业公司的咨询项目,
其中包括海尔集团、宝钢集团、中石化、中外运、交通银行、华泰证券、泰阳证券、
汉王科技、海南航空、天津电力、北仑电厂、苏源集团、苏通房地产、亿达集团、长
甲集团、圣马纸业、苏常柴、民丰特纸、江苏交科院、临淄信用社、鄞州银行等,在
业界具有相当知名度。早年中行博士曾经任职于上海实业、华泰证券、联合证券等企
业,具有丰富的企业管理、企业上市、重组并购,的实战经验;熟悉ESOP(员工持股
计划)、限制性股权、业绩股票、分红权、虚拟股权、增值权等长期激励机制,在绩
效评估,平衡积分卡,薪资体系方面有着成功的案例,先后为多家福布斯上榜企业提
供咨询。
●导师授课风格
◇具有一流的讲师风格,亲和力强,是位极具人格魅力的讲师。
◇在中山大学、浙江大学等EMAB主讲的股权激励课程授课满意度连续4年排名第1。
◇深厚的理论功底和10多年近100家企业首席咨询顾问的实操经验,使其讲授的课程理
论联系实际、深入浅出,与学员产生强烈共鸣;有实例、有工具,操作性极强。
◇倡导快乐学习。授课语言风趣幽默、注重互动、鼓励参与,深受客户和学员的欢迎。
-------------------------------------------------------------------------
◆主-办-单-位:中--培--信--息--网
◆标-准-费-用: ¥4500元/人(含指定内部教材、午餐、茶点费等)
◆报-名-咨-询:T E L: (0755) 6128 0152(深 圳)
◆报-名-咨-询:T E L: (0 2 1) 5108 3290(上 海)
-------------------------------------------------------------------------
[报 名 回 执 表]
F A X:(07 55) 6128 0153 或 (0 2 1) 5108 3296
我单位共____人报名参加2010年___月____日在□深圳、□上海举办的:“五步连贯”
股权激励法--留驻核心人才;
单位名称:_______________________________ 参会人数:_________人
联系人:___________ 电 话:______________ 传 真:________________
参会费用:¥:______________元 邮 件:_________________
参 会 人:_______________________________________________________
付款方式:□1、现金 □2、转帐
预订项目:□是、□否 住宿(请选择打“√”)
备注:请您把报名回执回传我司,��确保您报名无误,请您再次电话确认!
--- End Message ---
--- Begin Message ---
2010/5/6 Ashley Sheridan <a...@ashleysheridan.co.uk>
> [/snip]
>
> If only I could speak Chinese and was gullible I'd love to take them up
> on the offer for whatever it is.
>
>
>
> I wonder if we're missing out on the billion $ prize...
--
-Dan Joseph
www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month. Promo
Code "NEWTHINGS" for 10% off initial order
http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry
--- End Message ---
--- Begin Message ---
[/snip]
If only I could speak Chinese and was gullible I'd love to take them up
on the offer for whatever it is.
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
Hi,
I have a result set coming from a database that can be of the form below
$lines = array(0 => array('idA' => 1, 'idU' => 1),
1 => array('idA' => 1, 'idU' => 2),
2 => array('idA' => 2, 'idU' => 1),
3 => array('idA' => 2, 'idU' => 2),
4 => array('idA' => 3, 'idU' => 1),
5 => array('idA' => 3, 'idU' => 2));
I used the code to generate arrays based on the idA, i.e, one array
containing all the idU from each idA
foreach ($lines as $r)
{
if(!isset($list[$r['idA']]))
{
$list[$r['idA']] = array();
}
array_push($list[$r['idA']], $r['idU']);
}
Now need just the idU that occurs in all.
In my example I could simply
$x = array_intersect($list[1], $list[2], $list[3]);
This works but the problem is that I do not know in advance how many (and
which) indexes I will get from that foreach since the results will differ
from the database.
Is there a way around this ?
--- End Message ---
--- Begin Message ---
Hey all -
I'm using simplexml-load-string just to validation a string of XML, and
libxml-get-errors to return any errors. It's always worked before, but today
it's choking on this line in the XML:
<client_orderitem_number>Basketball Personalized Notebook -
Jeff's</client_orderitem_number>
It's returning "Premature end of data in tag client_orderitem_number line 90"
but as far as I can tell, Jeff's is properly XML encoded. I can't debug
this. Any suggestions?
I have run the XML through a couple of online validators and it does come back
as valid with no errors found.
--- End Message ---