Monday, December 31, 2012

FuelPHP 3. Using Auth Package

Auth


1. Config


    Add auth to always_load array

        return array(

            'default_timezone'   => 'Asia/Seoul',

            'always_load'  => array(
                    'packages'  => array(
                     'orm',
                     'auth',
                  ),
            ),
        );

2. DB Table Name

    Notice the table name should be 'users' by looking at the file J:/fuel/packages/auth/config/simpleauth.php


/**
     * DB table name for the user table
     */
'table_name' => 'users',

3. Create DB Table by using oil

        php oil g model user username:string password:string group:int email:string last_login:string login_hash:string profile_fields:string

    Those fields are as shown in the simpleauth.php

    And then perform migration

        php oil r migrate


4. Create a controller

    php oil g controller users login logout register




Sunday, December 30, 2012

FuelPHP 2. Start after Installation

Start

I followd this tutorial http://ucf.github.com/fuelphp-crash-course/

1. Create a database


    uncomment the orm package in the app/config/config.php




return array(

'default_timezone'   => 'Asia/Seoul',

'always_load'  => array(
'packages'  => array(
'orm',
),
),
);



    create a database with any name, say fuel_dev

        mysql> create database fuel_dev;

    update the app/config/development/db.php

        return array(
            'default' => array(
                'connection'  => array(
                    'dsn'        => 'mysql:host=localhost;dbname=fuel_dev',
                    'username'   => 'xyz',
                    'password'   => '12345',
                ),
            ),
        );

2. Scaffolding

    Use oil to generate a scaffolding which fills the database with a table and creates some fuel runnable codes

        J:/vhosts/words> php oil generate scaffold messages name:string message:text

    Here, string is varchar(255)
    Some fields are automatically added
    Those added fields are id(int, 11, auto_increment), created_at(int, 11), and updated_at(int, 11)

    It does not create a real table in the database, but just a schema as a file

3. Migration


    To create a real database table, do migration

        J:/vhosts/words> php oil refine migrate

    That will create a real table named messages
    And another table is created named migration


FuelPHP 1. Installation

Installation

1. Download

    http://fuelphp.com

    version 1.4 (as of 1st January 2013)

2. Environment of Apache

    My document_root of Apache is actually J:/www
    But the virutal localhost is J:/vhosts which is configured in httpd-vhosts.conf


    <Directory j:/vhosts>
Order Deny,Allow
Allow from all
    </Directory>

    <VirtualHost *:80>
        DocumentRoot "j:/vhosts"
        ServerName localhost
    </VirtualHost>

    <VirtualHost *:80>
        DocumentRoot "j:/vhosts/words"
        ServerName words
    </VirtualHost>

3. Installation

    I've made 2 directories, one in the document_root (J:/vhosts) and the other in outside the document_root (J:/) and moved the files there

    1. public files: J:/vhosts/words/(assets, htaccess, index.php)

        (Move oil to this directory)


    2. fuel files: J:/fuel/(app, core, packages, htaccess, LICENSE)


4. Edit firephp/index.php

    This index.php is actually found in public/index.php from the downloaded archive
    But now in J:/vhosts/words/index.php

    The links to the installed programs are modified

    /**
     * Path to the application directory.
     */
    define('APPPATH', realpath(__DIR__.'/../../fuel/app/').DIRECTORY_SEPARATOR);

    /**
     * Path to the default packages directory.
     */
    define('PKGPATH', realpath(__DIR__.'/../../fuel/packages/').DIRECTORY_SEPARATOR);

    /**
     * The path to the framework core.
     */
    define('COREPATH', realpath(__DIR__.'/../../fuel/core/').DIRECTORY_SEPARATOR);


    * modify oil the same as index.php

    visit http://localhost/words to see the installed welcome page


5. Set TimeZone


    Modify app/config/config.php


return array( 'default_timezone' => 'Asia/Seoul', );


    Test the timezone by touching J:/fuel/app/views/welcome/index.php

    <h1>Welcome!</h1>
    <?php echo date("Y-m-d H:i:s"); ?>

    visit http://localhost/words to see the localized date time


6. Visit HOME

    http://localhost/words/

    This will visit the fuelphp located under the document_root
    And is routed to the fuelphp application pages as indicated by the words/index.php

    The chain of links to the welcome page is as follows

    http://localhost/words/
    ==> J:/vhosts/words/index.php
    ==> J:/fuel/app/bootstrap.php
    ==> J:/fuel/app/classes/controller/welcome.php
    ==> action_index() in controller/welcome.php
    ==> J:/fuel/app/views/welcome/index.php

    if you add hello to the above url, you will see another demo page

    http://localhost/words/hello

    which calls one method called function action_hello() in welcome.php

7. Change the Default Page


    It is possible to change the route of the first page which is automatically directed when the url has nothing but the base_url like http://www.world.com/

    Edit the config file named routes.php in app/config


    return array(
    '_root_'  => 'main/index',  // The default route
    '_404_'   => 'main/404',    // The main 404 route

    'hello(/:name)?' => array('main/hello', 'name' => 'hello'),
    );

 

8. Test oil

    To execute php, add the path to php.exe to the environment variable in the computer system

        c:\wamp\bin\php\php5.3.5;

    Then go to the oil directory (now in J:/vhosts/words), and run windows cmd utility

    And run oil as

        J:\vhosts\words> php oil








Saturday, December 29, 2012

Apache Virtual Host


Virtual Host


There are two files that need to be touched


  1. First edit those files, and then rerun the services of apache and mysqld and others if necessary
  2. And visit http://localhost/[virtual host name]  ex. http://localhost/words


1. windows/system32/drivers/etc/hosts/

127.0.0.1       localhost
127.0.0.1 books
127.0.0.1 code
127.0.0.1 joy
127.0.0.1 orange
127.0.0.1 test
127.0.0.1 words


2. apache/conf/extra/

<VirtualHost *:80>

    DocumentRoot "j:/vhosts"
    ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "j:/vhosts/www/books"
    ServerName books
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "j:/vhosts/codeigniter"
    ServerName code
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "j:/vhosts/dreamweaver"
    ServerName dw
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin arbago@gmail.com
    DocumentRoot "j:/vhosts/www/orange"
    ServerName orange
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "j:/vhosts/test"
    ServerName test
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "j:/vhosts/words"
    ServerName words
</VirtualHost>




Monday, November 12, 2012

is vs has

is, have + 완료된 것

I am a boy
I am going to the station

I have a book
I have won the game


Wednesday, November 7, 2012

박근혜여 영원하라!

오늘은 2010년 11월 7일 수요일이다

대한민국은 현재 대통령선거로 렬기가 뜨겁다

어제는 안철수와 문재인이 만나서 단일하겠다고 했다

안철수는 세간의 평대로 진정 사기꾼인가

올 초인가 아니면 작년 후반기인가 그가 대통령선거에 나올 걸로 예측되기 시작된게 언제인지 하도 오래되어서 기억도 가물가물하다

출마한다 안한다로 오랫동안 시간을 끌더니 가을에 출마한다고 짖었다

그러더니 전국이 또 한번 시끌버끌했다 그것도 지겹도록 오래도록

안철수하고 문재인이 야권후보 단일담판을 할 거다 아니다

결국 어제 만나서 하기로 했단다


지겨운 놈


사기꾼


처음에 안철수가 이슈일 때부터 안철수와 민주당후보가 단일화할 거란 의견이 대세였다

출마를 지지리 끌더니 인기영합으로 지지율만 올리고 결국 출마

이거 다 예상했던건데

근데 왜 이렇게 전국을 의심의 땅으로 몰아 넣었던 거야 결국 출마할 거면서

또 매일 테레비만 켜면 단일 이슈이던데 결국 단일 회담

이거 다 예상했던건데

근데 왜 그렇게 전국을 의심의 땅으로 몰아 넣었던 거야


출마한다 안한다

단일한다 안한다


뭐야 이놈은

전형으로 사기꾼 방식을 사용하고 있네

처음부터 각본을 다 짜 놓고 전국을 의심의 덩어리로 만들어서 흥행만 시켜놓고
결국은 처음각본 그대로 가잖아

이런 놈은 불의의 습격을 살짝만 찔러도 금방 휘청거리게 되어 있는데

새누리당에서 이렇게 쉬운 전략을 아는 분이 계실라나....


박근혜, 그래도 당신만이 진정한 대한의 대통령입니다



Sunday, November 4, 2012

determine vs decide

determine: 어떤 일의 끝을 확정하다
decide: 여러 의견들 중에서 다 잘라내고 하나를 택하다

determine은 어떤 하나의 일에 대해 방법을 강구하다가 끝을 맺는 것

Wednesday, October 3, 2012

안철수, 교수 맞아?

서울에 있는 대학의 교수인 안 철수

론문이 딸랑 3 개 (그중 한 개는 영작만 했다는 것 같기도 하고?, 석박사꺼 합해야 5 개?): 도저히 믿지 못할 지경

아파트 다운 계약서: 관행이라 괘안타? 남이 하면 부도덕성, 지가 하면 관행이라 OK Good??

V3 안티 바이러스 프로그램: 무료로 배포했다고 잘도 포장해서 이미지 제고
우리나라 살람이 만든 거라 써 보려고 몇 번이나 무지 애썼지만 번번이 깔자 마자 지우게 된 프로그램. 은행을 통해 강제로 깔리는 것을 처음에는 은행에 전화해서 항의도 했지만 결국은  울며 겨자먹기로 깔려 버린다. 제발 은행은 안랩 꺼좀 깔지 않고 사용할 수 있게 해라!!!

나머지 안랩 주식 관련은 경제에 대해 잘 모르므로 또 안랩과 안철수에 관심도 없으므로 ...

이정도가 안철수 검증이니까 얼마나 깨끗하냐고?

그정도 밖에 검증할 거리가 안되니까, 또 안주거리로 씹을 게 없으니까 대통령 깜이 아닌 것이다

도대체 뭘 한 거냐 지금꺼정, 론문 3편이 고작이라니, 그게 대단한 연구결과를 담은 론문이라도 되는지. 난 안철수가 멋진 연구결과를 담은 론문을 발표했다는 소식을 여지껏 들은 적이 없다.

안철수가 그랬단다 (내가 방송이나 다른 매체에서 직접 듣거나 본 것은 아니다) "빨갱이가 어디 있냐고"

그러니까 요즘 젊은이들은 (50대 포함) 이 땅에 간첩이 어디 있냐고 한다

세상에나

우리 대한민국은 엄연히 휴전상태이다... 휴   전


Tuesday, July 31, 2012

Friday, January 27, 2012

Radio Me la Sudas

Quite a bunch of not-so-easy-to-get classical (sometimes non-classical) music albums are allowed to be downloaded free

http://radiomelasudas-beaumarchais.blogspot.com/