Daniel0
Staff Alumni-
Posts
11,885 -
Joined
-
Last visited
Everything posted by Daniel0
-
Why don't you just check the source code? It sounds like an idiotic idea, like Diggbar which is also stupid.
-
The Web Freaks, which is owned by a guy called Eric Rosebrock, owns PHP Freaks.
-
Alternately like this for an arbitrary amount of arrays: function permutations(array $array) { switch (count($array)) { case 1: return $array[0]; break; case 0: throw new InvalidArgumentException('Requires at least one array'); break; } $a = array_shift($array); $b = permutations($array); $return = array(); foreach ($a as $v) { foreach ($b as $v2) { $return[] = array_merge(array($v), (array) $v2); } } return $return; } $arr = array( array("tee shirt","golf clubs","bread"), array("blue", "black", "brown"), array("large", "medium","small"), ); print_r(permutations($arr)); And in Haskell, just for fun: [ (item, color, size) | item <- ["tee shirt","golf clubs","bread"], color <- ["blue", "black", "brown"], size <- ["large", "medium","small"] ] or generally: perm [] = [[]] perm (x:xs) = [ x':xs' | x' <- x, xs' <- perm xs ]
-
[SOLVED] Question about speed mysql storing vs php array storing
Daniel0 replied to pkedpker's topic in PHP Coding Help
Ever heard of JOINs? http://dev.mysql.com/doc/refman/5.1/en/join.html -
Because you're modifying the file, that won't work for plain text files: daniel@daniel0:~$ cat > test.php <?php echo 'Hello World' . PHP_EOL; daniel@daniel0:~$ php test.php Hello World daniel@daniel0:~$ dd if=/dev/zero ibs=1 count=1 >> test.php 1+0 records in 0+1 records out 1 byte (1 B) copied, 2,1655e-05 s, 46,2 kB/s daniel@daniel0:~$ php test.php Warning: Unexpected character in input: ' in /home/daniel/test.php on line 3 Hello World daniel@daniel0:~$ You modify it by editing the file. You could probably append a newline, that shouldn't give any problems. Do note that it's technically speaking not the same file anymore though, hence the reason why you'll get a different hash.
-
"I give you rep points, you give me rep points" kind of mutual agreements between members. We already have a system which is used for determining post quality, though it's manual and operated by the phpfreaks team. Surely you've noticed people running around with green and yellow badges.
-
True. *Goes off to demote corbin*
-
Either way, you're not supposed to see the public folder in any directory listing through Apache. It's supposed to be your DocumentRoot.
-
Okay, seriously, check this out: C:\windows\system32\drivers\etc\hosts: 127.0.0.1 dev.yourproject C:\path\to\your\httpd.conf: <VirtualHost *:80> ServerName dev.yourproject DocumentRoot C:\path\to\your\zfproject\public <Directory C:\path\to\your\zfproject\public> Order deny,allow Deny from all Allow from 127.0.0.1 AllowOverride All </Directory> </VirtualHost> Restart Apache, go to http://dev.yourproject If that doesn't work, something is seriously wrong with your setup.
-
sunwukung is not the OP though. He jumped in later.
-
Does the public folder not show up in the filesystem either?
-
You must be doing something wrong. When running it I get what I've attached here. [attachment deleted by admin]
-
You have a constraint on inbox.artist_id to artist.id. This means that the value you use for a row in inbox.artist_id must correspond to a row in artist that has the same value in id.
-
Could you post the output of these queries? SHOW CREATE TABLE inbox; SHOW CREATE TABLE artist;
-
You also need to fix this:
-
Well, maybe try to read your query: INSERT INTO inbox ('id', 'artist_id', 'date_in, content', 'preview', 'picture') VALUES ('$aname', '$amessage', '$bmessage', '$fname') First I notice you're doing like 'id', that is not the same as `id` or id. The last two are identifiers, the first one is a string. It's like $test vs. 'test' in PHP if that helps you understand it. Then I notice this: 'date_in, content'. See anything wrong there (besides the incorrect quote character)? I also notice that you have 5 (or 6 if you fix the above) identifiers, but only 4 values.
-
Maybe you could share that error message with us? We aren't psychic. Also, see: mysql_real_escape_string
-
I've never heard about a host that doesn't support logging. Maybe find a better host, it doesn't sound like they know what they're doing.
-
[SOLVED] Question about speed mysql storing vs php array storing
Daniel0 replied to pkedpker's topic in PHP Coding Help
It doesn't use more memory loading it at compile time rather than at runtime. If you always need all of them and they aren't going to change, store them as an array in PHP. Otherwise use a database. -
RC is free for testing purposes. Once the final version is released there is no need for testing, hence the reason why you're no longer allowed to use it, though they give you time to upgrade your system to the final version.
-
Why would you run an RC version when the final version is out anyway?
-
Why were you searching for penis images in the first place?
-
corbin, you need to learn proper OO design The decorator pattern is much better for this: <?php interface IPenisDecorator { public function getSize(); public function isErect(); public function getDecoratedObject(); } class Penis implements IPenisDecorator { /** * Size of penis i cm * * @var float */ private $_size; /** * @var boolean */ private $_erect = false; public function __construct($size) { $this->_size = (float) $size; } public function getSize() { return $this->_size; } public function isErect() { return $this->_erect; } public function getDecoratedObject() { return $this; } // other methods } class PenisEnlarger implements IPenisDecorator { /** * @var IPenisDecorator; */ private $_decorated; public function __construct(IPenisDecorator $decorated) { $this->_decorated = $decorated; } public function getSize() { return $this->_decorated->getSize() * 1.2; } public function isErect() { return $this->_decorated->isErect(); } public function getDecoratedObject() { return $this->_decorated; } } class Viagra implements IPenisDecorator { /** * Duration time in seconds * * @var integer */ static protected $_durationTime = 7200; /** * @var IPenisDecorator; */ private $_decorated; private $_creationTime; public function __construct(IPenisDecorator $decorated) { $this->_decorated = $decorated; $this->_creationTime = time(); } public function getSize() { return $this->_decorated->getSize(); } public function isErect() { if (time() - self::$_durationTime > $this->_creationTime) { return true; } else { return $this->_decorated->isErect(); } } public function getDecoratedObject() { return $this->_decorated; } } $penis = new PenisEnlarger(new Penis(15)); echo $penis->getSize(); // 18
-
Well, I was just saying that if someone posted a link to their online "pharmacy" where people can buy viagra, you know for the convenience of other people so they don't have to search themselves, he likely wouldn't hesitate to call it advertising (or spam). Switching out "viagra" with "PHP classes" doesn't mean it's no longer advertising, but it just changes the advertised product.