Cleverweb

Webdev, Apache, Linux and Wordpress.
jQuery Ajax call tutorial

jQuery Ajax call tutorial

jquery

Somehow I got a lot of questions about jQuery and Ajax, which is quite easy to understand.
I’ll show you how to create an ajax call using jQuery and update the page without reloading.

I assume you have knowledge of HTML, CSS and basic HTTP techniques.

Session status in PHP 5.4

Session status in PHP 5.4

php-logo

With the current PHP versions we need to check if a session exists by something like:

PHP 5.3 session example

//
// PHP 5.3 example 
//
session_start();
 
if(isset($_SESSION)) {
	//There is a session
	//One might check for values 
}
else {
	// There isn't a session
}
PHP 5.4 built-in webserver

PHP 5.4 built-in webserver

php-logo

This article will show you how to install PHP 5.4RC and use its built-in webserver.
The built-in webserver is a great way to rapid test your applications.

How to optimize all tables in a MySQL database

How to optimize all tables in a MySQL database

mysql-logo

If you need to optimize all your MySQL tables, and you are, use the following PHP commandline script. The script will write a file called “optimize.sql” so you need write privileges to do this.

The generated sql file can be imported in your favorite mysql client / admin tool.

List all controllers in Cakephp 2

List all controllers in Cakephp 2

cake

I needed to list all the Controllers of an Cakephp 2 application. I searched the webz and found an old article that got me started. The original article with code is here: http://cakebaker.42dh.com/2006/07/21/how-to-list-all-controllers/.

Here is the (rewritten) code for a CakePHP 2 Component:

Cakephp 2.0 default hash type

Cakephp 2.0 default hash type

cake

The default hash type of Cakephp 2.0 is sha1. But when you have set a Security.Salt in the core.php this will be added before your password and before the encryption is done.

To generate a password with Salt you can either create an User::add method in Cakephp and use the Authcomponent or create some your own. I needed it for fast checking user accounts with a javascript frontend (no views are used).

// Your salt from core.php
// Configure::write('Security.salt', 'e4ac429040b9d4552bc425b677b64aca104c5f84f');
$salt = 'e4ac429040b9d4552bc425b677b64aca104c5f84f';
$yourpassword = 'mysecret';
 
$password = sha1($salt.$yourpassword);
// The password to use in Cakephp with the Authcomponent
print $password;

Thats all, you use that password in your mysql admin tool to create users on the fly.

Extjs4 Combobox set selected value

Extjs4 Combobox set selected value

extjs

An Extjs Combobox can be a real horror when using dynamic stores and setting a selectedValue or dislayValue.
Simple tasks as setValue() or displayValue() seem to be impossible.

PHP and MySQL LOAD_FILE solution

PHP and MySQL LOAD_FILE solution

mysql-rage

Are you near your boiling point when using the MySQL LOAD_FILE function fromĀ  a PHP script, here is the solution.
You already debugged the file uploads, file movements, renaming and so on, nothing worked.

Clever Tweet 2.0.0 released today

Clever Tweet 2.0.0 released today

clevertweet2

Today I released a new version of Clever Tweet. It has been a while, but hey it’s there now isn’t it?

New features:

  • Load more tweets but show only a few at once, this creates a really nice rotating effect.
  • Added a date timestamp to the tweets.

Bugfixes

  • Fixed a rare issue that produced some random code to the end of links.
  • Added option for overall inline element stability.

Download here or within the WP-admin plugins page.

iPhoneTracker with Google Maps

iPhoneTracker with Google Maps

gmaps

You sure heard about all the fuss of the iPhone saving your location wherever you are. This is discovered by the gentlemen at iPhoneTracker