php-general Digest 23 Dec 2009 14:20:21 -0000 Issue 6502

Topics (messages 300639 through 300645):

Re: TCPDF line breaks
        300639 by: Paul M Foster

DailyWTF - Maybe I Needing Later
        300640 by: Daevid Vincent

Re: TCPDF line breaks [SOLVED]
        300641 by: Dave M G

Re: __construct() and "extend"
        300642 by: Allen McCabe

Application Help Provider for my website
        300643 by: Ali Asghar Toraby Parizy

Re: Checking for internet connection.
        300644 by: Bob McConnell
        300645 by: Kim Madsen

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 Wed, Dec 23, 2009 at 10:40:51AM +0900, Dave M G wrote:

> PHP Users,
> 
> Anyone using TCPDF? I find that their own forums are near dead.
> 
> I want to accomplish something simple, but their documentation is far
> from easy.
> 
> I have a PDF where I place text in various places around the page, like so:
> 
> $pdf->SetXY(50, 187);
> $pdf->Write(0, "hello world");
> 
> However, in the case of really long text, the text spreads out to the
> width of the page, which can break the formatting.
> 
> All I want to do is be able to constrain the width of the text being
> written, ideally by number of characters, so that it will have line
> breaks and form a column of text no wider than I want.
> 
> Is that possible with TCPDF?
> 
> Any advice would be much appreciated.

In FPDF, I find I have to do $pdf->MultiCell() to accomplish this,
rather simply $pdf->Write() (it's kinda like a textarea in HTML).
There's probably something comparable in TCPDF.

Paul

-- 
Paul M. Foster

--- End Message ---
--- Begin Message ---
http://thedailywtf.com/Articles/Maybe-I-Needing-Later.aspx
 
You get what you pay for. Ondra M didn't use those exact words, but that's
effectively what told his friend and colleague, Derrick. "There's a reason
it costs one tenth as much to build in Kerbleckistan," were Ondra's exact
words, "there's not only the language barrier, but time zone differences,
cultural diff-"

"It's just code, which is just a bunch a bytes!" Derrick shot back, "who
cares if it's built here, there, or on the moon. I'll just take the cost
savings and put them towards advertising. "

Ondra didn't push the point any further. After all, over the years he had
come to learn that Derrick knows best, no matter what reality says.
Besides, it was Derrick's money, Derrick's idea, and Derrick's baby. The
only involvement Ondra had in the project was to lend some unused rack
space.

It was the least he could for his friend who had, once again, come up with
the Best Idea Ever. And this one was truly the best. It was some sort of
Web 2.0 site that involved freemium, collaboration, engagement, and all
sorts of other buzzword concepts that Ondra was clearly behind on
understanding. Either way, Ondra set up a server, gave Derrick the details,
and wished him the best of luck.


Not Enough Luck in the World


After over six months of parroting "the project's going great!", Derrick
finally changed his tune."Let me level with you," Derrick painfully
admitted, "I'm in a serious bind, Ondra, and I need your help. I think I
could lose everything."

Ondra held in a much-deserved told-ya-so and let his friend explain what
really happened over the past half year. After interviewing a slew of
candidates from Kerbleckistan, Derrick settled on one who had "many year
experience building web" and could complete the project in "two month,
three maybe." Derrick's arranged to pay this contractor a monthly fee and,
in turn, the contractor would meet pre-established weekly goals and push
his code changes to the server every week.

As the weeks passed, the goals slipped by and the excuses started to grow.
"It does working on my machine," "I have missing your email," and "this is
first time problem" were becoming all-too-common. At one point, the
development just stopped: no new changes were uploaded and the database
remained untouched. After nearly a month of no progress, Derrick fired the
Kerbleckistanian, disabled his server account, and told him not to expect a
check for the past few weeks of "work". And that's where the problems
started.

"This is not fair," the contractor wrote in an email, "I was about to
uploading files. It is good codes, ready for you. I programming this, so
then you pay me and I sending you files."

Derrick stuck to his guns and refused to pay the contractor another dime.

"If you don't paying, then I delete files that I send you," he responded,
"I don't want deleting your web, but it is not fair for me. I know you
changing my password and I can't logging on, but I don't needing SQL or
server password to delete."

It was that last part that was the most troubling to Derrick: could he
actually delete files without FTP access? Derrick fired up his shell access
and executed a simple command to see if unlink
<http://php.net/manual/en/function.unlink.php>  (PHP's function for
deletling a file) was used.

cat *.php | grep unlink

The first and only page that showed up was in db_connect.php, which was
included by all pages.

// maybe I needing later

if ($_GET['page'] == "delete_all_files"){

   echo "del"; 

   mysql_query("DROP TABLE *"); 

   unlink("index.php"); 

   unlink("apps.php"); 

   unlink("resources");

   ... snip all files ...

}

That's right - it was a back door that deleted all database tables and
files. All the original programmer (or, anyone else) would have to do is
access any URL and enter ?page=delete_all_files in the URL.

Fortunately, Ondra was able to remove the backdoor before the
Kerbleckistanian could access it. Well, maybe not fortunately; the rest of
the code was pretty awful and was probably better off being deleted. But at
least it was one-tenth the cost of doing it right!


--- End Message ---
--- Begin Message ---
Paul,

Thank you for replying.

> I find I have to do $pdf->MultiCell() to accomplish this

This turned out to be the command I needed.

I used:

$pdf->MultiCell(130,30,$text,0);

130 is the width, 30 the height, and the zero at the end means no border
(1 is a thin black border).

I've never been sure what units TCPDF works in, so I got the right
numbers by experimenting and dialling it in.

Thanks for the support!

-- 
Dave M G


--- End Message ---
--- Begin Message ---
Extended classes may have their own constructors which are implicitly
called, and as Jonathan mentioned, the constructor of any ancestors (ie. the
parent) must explicitly be called.

If the child (extended) class does NOT have it's own constructor method
defined, the parent's constructor is called.

Manual: http://php.net/manual/en/language.oop5.decon.php


On Tue, Dec 22, 2009 at 2:45 PM, APseudoUtopia <apseudouto...@gmail.com>wrote:

> Hey list,
>
> I'm writing my own class which extends upon the Memcached class
> (php.net/memcached).
>
> I'm a bit confused as to how the constructor works when extending a class.
>
> class caching extends Memcached {
> function __construct() {
> echo "Caching Class Construct!";
> }
> }
>
> For something like the above code, is the Memcached constructor
> called? Or do I have to explicitly call it via parent::__construct()
> within the caching class?
>
> Thanks.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
I'm looking for any Application help provider that created by php. Is any
php application help provider written, so far?

--- End Message ---
--- Begin Message ---
From: Andy Shellam

>> And I was pointing out that this would not be a valid
>> test when there is a caching DNS on the LAN.

> I also pointed out how to avoid caching issues - the
> comment was aimed at the author of the message before mine.
> 
>> Too much of the conversation and most of the attribution
>> was stripped too early for this to be coherent.
> 
> Why the negativity?  A question was asked and several
> possible solutions were provided based on that original
> question.  All the "conversation" was relevant IMO.

But long before it was done it was impossible to tell who had asked
which questions, who had provided which answers and who had countered
those answers. In several instances, replies appeared to be directed to
the wrong individuals.

Some people here tend to go way too far when trimming context from
replies. Yes, I know it gets difficult to read when there are more than
ten or twelve levels of attribution, but stripping all but the last
layer is even worse. Removing the participants names from the top should
be a hanging offense. I don't keep copies of every message in any of the
dozens of mailing lists and news groups I follow, so there is no simple
way to go back through the conversation to figure out where it all came
from.

Bob McConnell

--- End Message ---
--- Begin Message ---
Hi Bob

Bob McConnell wrote on 23/12/2009 14:35:
From: Andy Shellam

And I was pointing out that this would not be a valid
test when there is a caching DNS on the LAN.

I also pointed out how to avoid caching issues - the
comment was aimed at the author of the message before mine.

Too much of the conversation and most of the attribution
was stripped too early for this to be coherent.
Why the negativity?  A question was asked and several
possible solutions were provided based on that original
question.  All the "conversation" was relevant IMO.

But long before it was done it was impossible to tell who had asked
which questions, who had provided which answers and who had countered
those answers. In several instances, replies appeared to be directed to
the wrong individuals.

Leaving the above for a reason. I find your answer to Andy rude and offensive! Remind me not to try to help you next time.

Some people here tend to go way too far when trimming context from
replies. Yes, I know it gets difficult to read when there are more than
ten or twelve levels of attribution, but stripping all but the last
layer is even worse.

No, that's called netetiquette, have a look at: http://www.the-eggman.com/writings/etiquitte_1.html

Quote: "When responding to E-Mail, don't quote the entire original message in your reply. Only quote the relevant parts, and only to the extent that they will help orient the recipient on your reply."

(and this mail is not to start a flame war)

Removing the participants names from the top should
be a hanging offense. I don't keep copies of every message in any of the
dozens of mailing lists and news groups I follow, so there is no simple
way to go back through the conversation to figure out where it all came
from.

Well, because _you_ don't wanna follow proper netetiquette doesn't mean everyone else should violate those rules, does it? :-)

And a merry christmas to you.

--
Kind regards
Kim Emax - masterminds.dk

--- End Message ---

Reply via email to