[PHP] ServInt feedback

2009-04-10 Thread la...@garfieldtech.com
Hi folks. A while back I inquired about managed VPS hosting services. I have since gotten a recommendation for ServInt.net, which seems to offer an actual managed VPS or something very close to it. Does anyone else have experience with them, good or bad? Are they decently responsible

Re: [PHP] Class Problems

2009-08-11 Thread la...@garfieldtech.com
The private keyword was added in PHP 5. PHP 4 doesn't have visibility identifiers. In PHP 4 you have to use var, which is then always public. Or you could just use PHP 5 instead of a dead language. :-) Ashley Sheridan wrote: Hey all, Is there any reason why this shouldn't work correctly on

Re: [PHP] Class Problems

2009-08-11 Thread la...@garfieldtech.com
Ashley Sheridan wrote: On Tue, 2009-08-11 at 17:57 +0200, Aschwin Wesselius wrote: Ashley Sheridan wrote: And I really would use a PHP 5 server given the choice. I've tried speaking to the hosting company a few times, but they brush me off! Hi Ashley, And how is their SLA then? Do you

Re: [PHP] Re: Memory investigation

2010-03-03 Thread la...@garfieldtech.com
Yep, I'm familiar with XDebug and KCacheGrind. As you say, though, it doens't (as far as I am aware) offer the particular data that I'm after. We've already got cachegrind gurus working on the code who know how to use it better than I do. :-) What I'm looking for is see this big cache

Re: [PHP] Re: Memory investigation

2010-03-03 Thread la...@garfieldtech.com
That's not really what I'm after. Let me try an example: function foo($id) { static $foos = array(); if (empty($foos[$id]) { $foos[$id] = load_foo($id); } return $foos[$id]; } When load_foo() is slow (e.g., lots of DB traffic or remote-server calls or whatever), such caching can

Re: [PHP] Re: Memory investigation

2010-03-03 Thread la...@garfieldtech.com
questions Larry is this application composed of classes or straight up no holes barred procedural code? la...@garfieldtech.com wrote: That's not really what I'm after. Let me try an example: function foo($id) { static $foos = array(); if (empty($foos[$id]) { $foos[$id] = load_foo($id

Re: [PHP] CodeBubbles -- the coolest IDE innovation since since syntax highlighting and intellisense

2010-03-12 Thread la...@garfieldtech.com
I'd settle for Intellisense/code completion working consistently and reliably in Eclipse PDT in the first place. I don't remember the last time it did. --Larry Garfield On 3/12/10 2:43 PM, Daevid Vincent wrote: Wow. Maybe the coolest IDE innovation I've seen since syntax highlighting and

Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread la...@garfieldtech.com
Add me to the list of people recommending PDO. It's much nicer to work with than the ext/mysql API, and frankly more secure since you get prepared statements. It won't get you complete database independence for a number of reasons (mostly due to databases being too unstandardized because

Re: [PHP] another question on setting include paths for a project

2010-03-22 Thread la...@garfieldtech.com
On 3/22/10 10:25 AM, Paul M Foster wrote: That's the key. You can do anything you want inside __autoload(). If you must consult something in the environment, there are a couple of ways to do it. First, set a variable in the $_SESSION array, and consult it in __autoload(). Second, use a

Re: [PHP] Will PHP ever grow up and have threading?

2010-03-23 Thread la...@garfieldtech.com
On 3/23/10 6:04 PM, Tommy Pham wrote: If throwing hardware at it won't work because of the above mentioned, then you would change the design right? How long would that take? What if PHP has threads, how long would it take you implement threads with minor changes versus and overhaul of

Re: [PHP] Properly handling multiple constructors.

2010-03-24 Thread la...@garfieldtech.com
On 3/24/10 11:06 AM, Richard Quadling wrote: On 24 March 2010 15:51, Robert Cummingsrob...@interjinn.com wrote: Yes you can do that also, you seemed to want constructors though :) As for misused... variable parameters with mixed types is common enough that I wouldn't call it misuse. It's

Re: [PHP] Will PHP ever grow up and have threading?

2010-03-24 Thread la...@garfieldtech.com
On 3/24/10 2:33 PM, Rene Veerman wrote: It's a debate. The dev team consider proposals and weigh in on the merits. I was a proponent for goto support during the development of PHP 5. We now have it. If you arguments are valid and there's no technical issue preventing it, and there's someone

Re: [PHP] Standard built-in functions source code

2010-05-19 Thread la...@garfieldtech.com
http://www.php.net/svn.php Everything is in SVN, although anything built-in is written in C code, not in PHP. --Larry Garfield On 5/19/10 3:41 PM, Leandro de Oliveira wrote: Hi, I'd like to know where is the source code of built-in functions if it's freely available. I'm interested in

[PHP] Method documentation

2010-05-27 Thread la...@garfieldtech.com
Hi folks. OK, so here's the deal. I am trying to figure out the right way to document methods in OO code that includes method overriding in child classes. Simple, right? Unfortunately, it seems the tools out there are making this much more complicated than it should be. Example: class

Re: [PHP] Method documentation

2010-05-27 Thread la...@garfieldtech.com
On 5/27/10 10:43 AM, Peter Lind wrote: You're overriding the function. IDEs should *not* show the parent documentation, because the parent function does *not* get called. It only gets called if you do a specific parent::hello($a, $b); *snip* So it seems like no matter what I do, someone

Re: [PHP] Method documentation

2010-05-27 Thread la...@garfieldtech.com
On 5/27/10 11:13 AM, Peter Lind wrote: I'm overriding the method because I want to change the *implementation*. The *interface* of it, which is documented in the docblock, should not change and it's a bug (and possibly compile error) if it does change. You cannot, for instance, change what

Re: [PHP] Method documentation

2010-05-27 Thread la...@garfieldtech.com
On 5/27/10 11:30 AM, Peter Lind wrote: Sure, but @param, @access and possibly @return are but a part. I stand by my words: document the parent as a stub and provide actual documentation for the real implementations. Otherwise you're trying to be *clever* and will see the age-old result: you'll

Re: [PHP] Method documentation

2010-05-27 Thread la...@garfieldtech.com
On 5/27/10 12:10 PM, Adam Richardson wrote: Larry, I've thought about this very issue before (java developers sometimes lament this issue, too), and I error on the side of duplication if I'm using inheritance. However, I'd say I rarely use inheritance for anything in my development, and I'm

Re: [PHP] Method documentation

2010-05-27 Thread la...@garfieldtech.com
On 5/27/10 3:15 PM, Adam Richardson wrote: On Thu, May 27, 2010 at 3:59 PM, Waynn Luewaynn...@gmail.com wrote: I've seen @inheritDoc used in Java before, though I'm not sure about the php support. Waynn You're absolutely right, Waynn, Phpdocumentor has this, too:

Re: [PHP] CakePHP, alternatives?

2010-06-03 Thread la...@garfieldtech.com
First spend time working with straight up PHP, writing your own stuff, throwing it away, and writing it again. What you'll learn that way is immeasurable. Then pick a framework (Cake, Drupal, Symfony, Zend, PEAR, whatever) and learn it, maybe two. Try working with it and extending it.

Re: [PHP] fetching DB entries

2010-06-21 Thread la...@garfieldtech.com
Performance-wise, SELECT * is slower than specifying fields (marginally). If you just want a single field then mysql_result() will be faster, but if you want multiple fields mysql_fetch_* is your best bet. As far as the PHP goes, if you know there will be only a single record I'd suggest

Re: [PHP] the state of the PHP community

2010-07-29 Thread la...@garfieldtech.com
On 7/29/10 2:32 AM, Nathan Rixham wrote: What's your previous language/tech trail? Started with QBasic and realized it was crap. Moved on to Java, realized object rock but J2EE doesn't. Moved to PHP / Java. QBasic was crap lol, that was my first language after playing with .bat files! Oh

Re: [PHP] a quick question about array keys

2010-08-31 Thread la...@garfieldtech.com
The fastest way is going to be array_values(): http://www.php.net/array_values --Larry Garfield On 8/31/10 10:43 AM, Tontonq Tontonq wrote: a quick question lets say i have an array like that Array ( [300] = 300 [301] = 301 [302] = 302 [303] = 303 [304] = 304 [305] = 305 [306] = 306

[PHP] Queuing servers

2010-12-02 Thread la...@garfieldtech.com
Hi folks. I have a project coming up where I will need to process a bazillion (OK, a few million) records, possibly with multiple steps. (In this case I'm reading data from one data archive into an Apache Solr server.) This is a natural use case for a queue server, I believe, and while the

Re: [PHP] PDO: good, popular?

2010-12-14 Thread la...@garfieldtech.com
I'm the DB maintainer for Drupal 7, and we rebuilt our entire DB layer on top of PDO. It's a rather nice API, although as others have noted it does not abstract away SQL entirely; it abstracts the API calls you need to use to get to SQL. We then built a layer on top of that which does

Re: [PHP] Problems w/ goto

2010-12-17 Thread la...@garfieldtech.com
On 12/17/10 11:57 AM, Steve Staples wrote: I had to show the people in my office, and we all got a chuckle from teh XKCD comic in the PHP documentation for GOTO http://ca2.php.net/goto Steve I was one of the people that argued in favour of GOTO on the Internals list a few years ago. GOTO has

[PHP] Command line PHP

2011-01-07 Thread la...@garfieldtech.com
Hi folks. I have a project coming up that will involve writing a non-trivial command line PHP application. Most of it will be nice and abstracted and standalone and all of that jazz, but it will need to do command line interation. I'm not sure yet if it will be interactive or if I just need

Re: [PHP] Command line PHP

2011-01-07 Thread la...@garfieldtech.com
On 1/7/11 11:08 AM, Nicholas Kell wrote: On Jan 7, 2011, at 11:01 AM, Joshua Kehn wrote: On Jan 7, 2011, at 11:55 AM, la...@garfieldtech.com wrote: Hi folks. I have a project coming up that will involve writing a non-trivial command line PHP application. Most of it will be nice

Re: [PHP] Bare Strings, are they deprecated?

2011-01-14 Thread la...@garfieldtech.com
Assuming that by bare strings you mean: $foo[bar] = 'baz'; as opposed to: $foo['bar'] = 'baz'; That is generally considered very bad form in PHP. That throws an E_NOTICE error level, and therefore slows down your code (if only by a small amount) for the error handling. Of course, if you

Re: [PHP] Class and interface location

2011-01-19 Thread la...@garfieldtech.com
On 1/19/11 10:09 AM, Adam Richardson wrote: On Wed, Jan 19, 2011 at 8:21 AM, Richard Quadlingrquadl...@gmail.comwrote: On 19 January 2011 07:46, Adam Richardsonsimples...@gmail.com wrote: On Wed, Jan 19, 2011 at 2:07 AM, Larry Garfieldla...@garfieldtech.com wrote: 3) Static analysis.

Re: [PHP] Class and interface location

2011-01-19 Thread la...@garfieldtech.com
On 1/19/11 11:16 AM, Adam Richardson wrote: As long as the static analysis tool builds a composite of class hierarchy established in all the files (project wide, at least in terms of the plugin), you wouldn't have to double declare interfaces so they could be detected. Adam That is

Re: [PHP] Class and interface location

2011-01-19 Thread la...@garfieldtech.com
On 1/19/11 10:52 AM, Richard Quadling wrote: There is a pecl extension called inclued [1][2] which could be used I think. It can be used to produce a list of all the relationships between included files, so a one off pass of all the class files (simply include them) and then retrieve the

Re: [PHP] Class and interface location

2011-01-19 Thread la...@garfieldtech.com
On 1/19/11 3:44 PM, David Harkness wrote: What about creating your own docblock tag such as @plugin-interface? While it still requires each plugin to explicitly define the interface(s) it implements, it won't be in the class declaration. This would be very easy to nab for a tree of files using

Re: [PHP] How to write code: how wrong am I?

2011-02-22 Thread la...@garfieldtech.com
On 2/22/11 12:04 PM, Alexis wrote: On 22/02/11 09:40, Dotan Cohen wrote: On Tue, Feb 22, 2011 at 16:15, Robert Cummingsrob...@interjinn.com wrote: If you switch to vertically aligned braces you will have an easier time matching up open and close braces... if (something) { // Code here }

Re: [PHP] Double method access (Hi everyone! :))

2011-03-04 Thread la...@garfieldtech.com
That's called method chaining. -getColumns() will get called on the object returned by -getTable(). That is, getTable() returns an object (presumably representing an SQL table, I guess), and that object has a getColumns() method, which you call. This is an extremely common style in

Re: [PHP] Returning a recordset to a desktop app

2011-03-04 Thread la...@garfieldtech.com
Assuming you mean that the PHP script is on a web server somewhere and the desktop app is hitting it over HTTP, it's no different than any other response. Anything you print will be sent back to the client, in this case your desktop a.. So if you want to send XML back, you'd build a string