Wednesday, May 28, 2014

PHP: NotORM tutorial

fatfree: error routing about in tutorial

following this tutorial : http://fatfreeframework.com/routing-engine, after adding

$f3->route('GET /about','WebPage->display');

the url localhost/myproject/ works fine, but localhost/myproject/about doesnt work.

To solve the problem, follow these steps:

1. create a file name .htaccess with the following content:

# Enable rewrite engine and route requests to framework
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L,QSA]

# Disable ETags
<IfModule mod_headers.c>
Header Unset ETag
FileETag none
</IfModule>

# Default expires header if none specified (stay in browser cache for 7 days)
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A604800
</IfModule>

2. put the .htaccess file in the root of wour project, ie {apacheserverdir}\htdocs\pyproject\.htaccess

The error happens because is missing the .htaccess file in the right place:

\htdocs\myproject
\htdocs\myproject\.htaccess -- add htaccess file here
\htdocs\myproject\index.php
\htdocs\myproject\libs
\htdocs\myproject\libs\fatfree-master
......
\htdocs\myproject\libs\fatfree-master\.htaccess -- here is a htaccess file that is not used at all
......
\htdocs\myproject\libs\fatfree-master\lib
\htdocs\myproject\libs\fatfree-master\lib\audit.php
\htdocs\myproject\libs\fatfree-master\lib\auth.php
\htdocs\myproject\libs\fatfree-master\lib\base.php
......
......
.....

Resource:
https://github.com/bcosca/fatfree/blob/archive/f3-2.1.0-blog.example.zip

Tuesday, May 27, 2014

Java: Convert octal into Decimal number

Here is a simple and elegant way to convert an octal number to the decimal numeric system:

http://www.mycoding.net/2011/03/java-program-to-to-convert-octal-number-into-decimal-number/

Java: convert from decimal to octal

Here is a simple and elegant way to convert a decimal number to the octal numeric system:

http://www.javaforschool.com/332702-program-on-decimal-to-octal-number-conversion/

MySQL Top (N) By Group

Here is a great link what explains how to get top N elements by group in MySQL :  http://www.erikhaselhofer.com/?p=1793

Friday, May 2, 2014

Mysql Replication: Fatal error: The slave I/O thread stops because master and slave have equal MySQL server UUIDs; these UUIDs must be different for replication to work.

if you get this error:

Fatal error: The slave I/O thread stops because master and slave have equal MySQL server UUIDs; these UUIDs must be different for replication to work.

Go to the installlation/source folder of mysql and change the guid in the file ./data/auto.cnf. Generate another guid with http://www.famkruithof.net/uuid/uuidgen, copy the generated guid and replace the existing guid:

from:

[auto]
server-uuid=e80f7b10-d242-11e3-9c1a-0800200c9a66

to:

[auto]
server-uuid=839567f0-d245-11e3-9c1a-0800200c9a66

Resource:
http://planet.mysql.com/entry/?id=103096