Skip to content

Bake every table in CakePHP?

The database I’m working on has more than 100 tables, so I’m not going to sit here baking a model and controller for each one individually. I would like to bake all of the tables at the same time with something like the .xml files in Hibernate that tells it the limitations on fields so that I don&…

Dynamically output the page title with php

I am trying to output the page title dynamically. I am using induces and this script is withing the header.php the goal is to output the header dynamically using a case/switch statement. here is my code: I am getting a error telling me my variable $title is not defined? What i am doing wrong? Answer In your f…

php is converting base 16 to base 2 incorrectly

Why am I getting this output from my function? echo $var = hash_hmac(‘ripemd160’, ‘http://www.weburlhere.org’, 0, 0); echo “rn”; echo $converted = base_convert($var, 16, 2); echo “rn”; Outputs: …

Nested PHP ternary operator precedence

Yes, I know this is very bad code, but I’d still like to understand it: If $a is 11, then the result of the 1st line is “option 2”, but in the 2nd line, the result is “option 1” – what effect is the pair of brackets having? Answer The first line is parsed like so: Which is …

Generating cryptographically secure tokens

In order to generate a 32 character token for access to our API we currently use: I have read that this method is not cryptographically secure as it’s based on the system clock, and that openssl_random_pseudo_bytes would be a better solution as it would be harder to predict. If this is the case, what wo…

Add class to link in wp_list_pages

I’m trying to create a hover-effect on a list-item within the wp_list_pages() function. I’m creating a theme for WordPress, but can’t seem to get the hover effect working. I’m pretty new at this, so …

How to fix Error while reading greeting packet?

I am trying to connect to server in NetBeans. I write the code as below: Running of this code return this erreurs: Answer MySQL can be configured to not accept external connections, for security reasons. By saying the full domain name, you are using the public IP and therefore you are an external connection. …