Search found 11002 matches

by Chris Corbyn
Sat Jul 14, 2012 7:07 am
Forum: PHP - Theory and Design
Topic: OOP and Reusability
Replies: 17
Views: 22786

Re: OOP and Reusability

This thread has gone way off-topic now, but I just wanted to chime in with my thoughts regarding TDD/BDD. As somebody who actively uses TDD on all code on a daily basis, I find it ludicrous that another TDD'er could suggest that using TDD alone eradicates *all* bugs. That is just frankly absurd. Eve...
by Chris Corbyn
Sat Jun 23, 2012 2:10 am
Forum: General Discussion
Topic: Who's using git? I've got questions
Replies: 6
Views: 3103

Re: Who's using git? I've got questions

Not running a web server "locally" isn't actually that bad. I don't run a web server on my host machine (OS X). I have a Virtual Machine set up that runs linux, as close to the same configuration as in production as is reasonably possible. If you're on a UNIX-like system, you can work on a...
by Chris Corbyn
Fri Jun 22, 2012 5:53 am
Forum: General Discussion
Topic: Who's using git? I've got questions
Replies: 6
Views: 3103

Re: Who's using git? I've got questions

It's pretty serious reading, but I heartily recommend reading Git From the Bottom Up: http://ftp.newartisans.com/pub/git.from.bottom.up.pdf, which makes you realize how wonderfully simple git is, by understanding how it works internally.
by Chris Corbyn
Fri Jun 22, 2012 5:50 am
Forum: General Discussion
Topic: Who's using git? I've got questions
Replies: 6
Views: 3103

Re: Who's using git? I've got questions

Git is a fine choice for a VCS. Many say that Mercurial is good too, though I have not used it myself. 1) I understand that each "project" should have it's own repository. Since I develop on my desktop or laptop and commit to the server, the server should always have a reasonably current c...
by Chris Corbyn
Thu Jun 21, 2012 7:24 am
Forum: Javascript
Topic: is prtotype an object or a method?
Replies: 4
Views: 2881

Re: is prtotype an object or a method?

It is an object. You cannot invoke it. Methods are functions attached to an object. You can invoke them as such. Objects are just containers for data. JavaScript's prototype object is an object that knows how to construct the object it belongs to. You can add new methods to a "class" by ad...
by Chris Corbyn
Thu Jun 21, 2012 6:34 am
Forum: PHP - Theory and Design
Topic: thread in PHP
Replies: 3
Views: 6761

Re: thread in PHP

If you are running this code on a POSIX server (i.e. not Windows) then you probably want to use a combination of pcntl_fork() and pcntl_signal(). I believe it's useful to learn to use these UNIX concepts in any case, but they are quite difficult to get to grips with, especially if you need to share ...
by Chris Corbyn
Thu Jun 21, 2012 6:22 am
Forum: PHP - Theory and Design
Topic: function (object) literal
Replies: 13
Views: 14785

Re: function (object) literal

Anonymous functions are useful when you want to pass them around as arguments to other functions (higher order functions). To PHP they are relatively new, even if they should probably have existed long before. Let's implement something like reduce in PHP. Reduce calls a function for each element in ...
by Chris Corbyn
Thu Jun 21, 2012 5:33 am
Forum: General Discussion
Topic: PHP alert?
Replies: 21
Views: 12070

Re: PHP alert?

Or you could create a function that writes to a log. You could also set up a script that outputs the log, the last 200 entries in reverse chronological order or whatever floats your boat, and keep that open in another tab in your browser. Mix in a little JS magic and it could even refresh itself pe...
by Chris Corbyn
Fri Jun 08, 2012 8:19 am
Forum: Coding Critique
Topic: small script to check your site for file changes
Replies: 3
Views: 23952

Re: small script to check your site for file changes

I haven't read your code, which is quite dense and procedural, but you may be able to greatly simplify it with http://www.php.net/manual/en/book.fam.php... this would be a long-running script, rather than a run-every-so-often script. From a quick overview of the structure of your code, I'd say that ...
by Chris Corbyn
Fri Jun 08, 2012 7:49 am
Forum: PHP - Code
Topic: Calculate date (over a month)
Replies: 4
Views: 1116

Re: Calculate date (over a month)

I think your underlying logic is flawed. What your code says, to put it into plain English is: Give me the day of the month 1 week ago Give me the day of the month 2 weeks ago Tell me if the day of the month when the user last logged in is between the day of the month 2 weeks ago and the day of the ...
by Chris Corbyn
Wed Jun 06, 2012 8:02 am
Forum: PHP - Code
Topic: What Is Differences Between Objects And Classes In Php?
Replies: 3
Views: 1484

Re: What Is Differences Between Objects And Classes In Php?

This concept applies to all OO languages, not just PHP. A class is basically a description for what an object contains and does. To make the object (instance of the class) behave differently, you edit the code in the class.
by Chris Corbyn
Thu Apr 22, 2010 9:25 pm
Forum: Installation and Configuration
Topic: Can't figure out why RewriteCond with !-f doesn't work
Replies: 5
Views: 2608

Re: Can't figure out why RewriteCond with !-f doesn't work

It may just be your setup? I've never had to use anything but REQUEST_FILENAME either. FYI - my .htaccess uses -s and -d rather than -f. Yeah I think there's something weird with my Apache setup. It's just whatever the default Mac OS X (Snow Leopard) install is. I'm not too fussed now; I've learnt ...
by Chris Corbyn
Thu Apr 22, 2010 9:59 am
Forum: PHP - Theory and Design
Topic: MySQL or Flat Files
Replies: 8
Views: 2215

Re: MySQL or Flat Files

I'd definitely use a database then, but also take a look at memcached.
by Chris Corbyn
Thu Apr 22, 2010 3:50 am
Forum: PHP - Theory and Design
Topic: opinions: one program or many smaller programs?
Replies: 3
Views: 1194

Re: opinions: one program or many smaller programs?

If you can split your program infrastructure into "services" then you can go ahead and break those out into separate applications. The benefit being that you can maintain and upgrade each one independently of the other, or share certain "services" between applications. A good exa...