Search found 104 matches

by Zyxist
Wed Jun 29, 2011 7:47 am
Forum: PHP - Theory and Design
Topic: Object vs Functional Processing Time
Replies: 9
Views: 5829

Re: Object vs Functional Processing Time

Object method calls are a bit slower than function calls. May I know why you are using this old XML extension instead of XMLReader, which uses Libxml directly, instead of a compatibility layer?

http://docs.php.net/xmlreader
by Zyxist
Tue Jun 28, 2011 1:06 am
Forum: Databases
Topic: PDO problem with database connection?
Replies: 5
Views: 1354

Re: PDO problem with database connection?

I think that this was a database issue, not PHP. Generally speaking, closeCursor() should ALWAYS be called. I've been using it since I remember and migration to PHP 5.3 caused absolutely no problems.
by Zyxist
Sun Jun 26, 2011 4:16 am
Forum: Linux
Topic: What is the best Linux distribution?
Replies: 14
Views: 44545

Re: What is the best Linux distribution?

There is no such thing, as "the best distro". It depends on your needs. For example, Ubuntu devs do a really good job and I appreciate their product, but personally, I use Arch Linux and I can't imagine chaning it to anything else. And for servers, I'd choose yet another distro.
by Zyxist
Sun Jun 26, 2011 4:12 am
Forum: Databases
Topic: PDO problem with database connection?
Replies: 5
Views: 1354

Re: PDO problem with database connection?

PDO::prepare() returns false, if there is a problem with a query, and you have exceptions turned off. Set the PDO error handling to exceptions, and you will get a nice, and quite exact message, what is wrong with the query and where. I suppose that the problem lies in the semicolon at the end of th...
by Zyxist
Sun Jun 26, 2011 2:05 am
Forum: Databases
Topic: PDO problem with database connection?
Replies: 5
Views: 1354

Re: PDO problem with database connection?

If you need some help, you should explain what you mean by "not working". Does it throw any exceptions? Any errors? Maybe you should point some places?
by Zyxist
Sun Jun 26, 2011 2:02 am
Forum: Code Snippets
Topic: Malware_Scanner class, to scan and repair infected files.
Replies: 1
Views: 19547

Re: Malware_Scanner class, to scan and repair infected files

I think you should also provide some real signatures. Furthermore, remove the ending ?>, add the visibility modifiers to the methods. The signature loading code should not be a part of the class - what if someone would like to add something new? Use interfaces and object composition instead.
by Zyxist
Fri Jun 24, 2011 10:43 am
Forum: Installation and Configuration
Topic: Installing on linux server
Replies: 3
Views: 3826

Re: Installing on linux server

Microsoft IIS and Linux server... don't you see a contradiction here? If you want to install PHP on a Linux server, I assume that you have already heard about package managers and that the Linux distros have a PHP installation already packaged to you. Refer to your distro manual or wiki - there must...
by Zyxist
Fri Jun 24, 2011 10:37 am
Forum: PHP - Theory and Design
Topic: Developing a PHP5 only app
Replies: 14
Views: 6420

Re: Developing a PHP5 only app

There is one more problem with singletons and such functions - automated testing. Unit tests are hard to write for singleton-based code. For function-based singletons with static variables I don't even think it is possible unless we use some process isolation (how to reset the reference?). Note that...
by Zyxist
Thu Jun 23, 2011 3:22 am
Forum: PHP - Theory and Design
Topic: Developing a PHP5 only app
Replies: 14
Views: 6420

Re: Developing a PHP5 only app

Since PHP introduced more transparent loading techniques. Imagine that I have an application, where I'm using autoloaders to load the files and I want to use your code that uses require_once . Now, especially for that I must introduce yet another way to load files, and I must learn the structure of ...
by Zyxist
Mon Jun 20, 2011 12:56 am
Forum: PHP - Frameworks
Topic: Learning Priorities
Replies: 10
Views: 6638

Re: Learning Priorities

To clarify: I haven't written that ZF is a crap. From the existing frameworks, it is definitely one of the best, if not the best one. But it does not mean that it is well-designed and everything is fine about it. It means that other frameworks suffer from even greater problems, and if there is an al...
by Zyxist
Mon Jun 20, 2011 12:49 am
Forum: PHP - Theory and Design
Topic: Developing a PHP5 only app
Replies: 14
Views: 6420

Re: Developing a PHP5 only app

Functions cannot be autoloaded. Using exotic file loading techniques will cause you trouble, when you want to integrate your code with some third party library. Dependency injection is just passing the necessary dependencies via constructors and setters. Nobody forces you to use dependency injection...
by Zyxist
Sun Jun 19, 2011 7:15 am
Forum: PHP - Frameworks
Topic: Learning Priorities
Replies: 10
Views: 6638

Re: Learning Priorities

Well, take a look at Symfony 2. I haven't tested it yet in practice (although I plan to do so), but I was looking at the source code and the overall architecture - it is certainly designed better than the "existing" frameworks, especially Zend Framework, and probably the first one from the...
by Zyxist
Fri Jun 17, 2011 2:35 am
Forum: PHP - Theory and Design
Topic: Developing a PHP5 only app
Replies: 14
Views: 6420

Re: Developing a PHP5 only app

In PHP5, you should not use references for objects, because object variables are already references. Furthermore, I guarantee you that you will have trouble in the future, if you keep using such inventions, like load_class() or app() . Your style has very little to do with object-oriented programmin...
by Zyxist
Sun Mar 20, 2011 2:20 am
Forum: Databases
Topic: how to check exclude empty mysql field
Replies: 3
Views: 1137

Re: how to check exclude empty mysql field

Then maybe they do not have a NULLvalue, but just an empty string? And empty strings are not considered as NULL-s.
by Zyxist
Sun Mar 20, 2011 2:19 am
Forum: PHP - Code
Topic: INSERTING INFORMATION INTO XML FILE
Replies: 2
Views: 187

Re: INSERTING INFORMATION INTO XML FILE

Then don't add the new node directly into the <playlist>, but go a level deeper and find <tracklist>. Here's the code where you pick up the wrong node:

Code: Select all

$xml = simplexml_load_file($filename);
$sxe = new SimpleXMLElement($xml->asXML());