Wednesday, September 28, 2011

FireFox Download Scan

http://www.mydigitallife.info/firefox-tips-refresh-firefox-webpage-content-without-clearing-cache-disable-automatic-file-scanning-after-file-download/


In the address bar of FireFox, type about:config
and filter browser.download.manager.scanWhenDone
then double click what it is shown as the filter, which will toggle the setting value





Tip 2: Disable automatic file scanning after file download
When you download a file, Firefox will scan the file automatically once the file is completed downloading. This feature is good to protect your PC from virus attack. However, it may take longer time to download the file if the file size is huge. If you have an up-to-date anti-virus installed, probably you can consider disabling this feature to get faster downloading speed. To disable file scanning, type about:config in address bar then press enter. Click “I will be careful, I promise!” button. On filter bar, type browser.download.manager.scanWhenDone, you will see the Boolean value set as true by default. To change the value to false, just double click on the entry.

FireFox Refresh Problem

I. about:config


(This method works!!!)


http://ticket.betterbuilt.com/KB/a26/how-to-force-firefox-to-reload-the-page-and-ignore-cache.aspx

You can use Ctrl + F5 for a single use basis, or if you want firefox to always reload the page then type this into the address bar:
about:config
type this into the filter:


browser.cache.check_doc_frequency
change the value to: 1

more info:
3 - only check if it seems outdated
2 - always use cached version
1 - always check for newer version
0 - check for newer version once per session

Article ID: 26, Created On: 2009-04-07, Modified: 20



II. Ctrl + F5

(This method sometimes works, but most of the time it fails to fetch newly modified css and javascripts)

http://www.mydigitallife.info/firefox-tips-refresh-firefox-webpage-content-without-clearing-cache-disable-automatic-file-scanning-after-file-download/


After there is a change in a javascript and the reload of the page, FireFox still displays the old content, but not refresh it

It's due to the fact that FireFox uses the content from the cache

To avoid the refresh difficulty, use the shortcut key of Ctrl + F5

Make sure it is not Ctrl + Clicking F5, which will open the current page in a new tab


Tuesday, September 27, 2011

Monitor CPU Usage

http://www.xp-tips.com/cpu-meter.html

You can easily monitor resource use by keeping the CPU meter from Windows Task Manager running in your system tray:
CPU Meter in System Tray

Here's how:

1: Key Control/Alt/Delete to open the Windows Task Manager.

2. Click "Options" and then check "Minimize on Use" and "Hide when Minimized."

3. Click the "minimize" button rather than the "close" button and the little resource meter will stay in your system tray and let you see how hard your processor is working.

The amount of light green in the resource meter gives a quick visual indication of your CPU usage.
CPU Meter Showing Light Green

Hold your mouse over the icon to see the actual percentage of resources being used. Double click the icon for quick access to the Task Manager.

CPU usage will vary significantly depending on what tasks your computer is working on. However, if the CPU meter fills with light green and remains that way for more than a few minutes, it is probably a good idea to free up some CPU resources by closing a few running applications. If closing applications doesn't help, it might be time to reboot your computer. Of course, if your computer is performing a prolonged CPU intensive task such as scanning, high CPU usage is no real cause for concern.

If you no longer want the CPU meter running in your system tray, simply double click the icon to open the task manager and then click the "Close" button. The Windows Task Manager will close and the CPU meter will no longer be displayed.

Keeping an eye on your computer's CPU usage can help you to avoid trouble before it strikes.

*How to let the Task Manager start when the Windows starts
1. Find the path of the program: c:\WINDOWS\system32\taskmgr.exe
2. Make a ShortCut link of it there: taskmgr.lnk
3. Move the ShortCut link to the Start Folder: c:\Documents and Settings\Olympics\시작 메뉴\프로그램\시작프로그램\taskmgr.lnk

Tuesday, September 20, 2011

[CI] firePHP

FireFox의 AddIn으로서
PHP 프로젝트에서 로그를 FireFox의 Console에 나타나도록 한다

1. firephp: FireFox Add-In
FireFox에서 http://firephp.org/ 를 방문하여 설치

2. FirePHP Server Library
http://www.firephp.org/HQ/Install.htm
다운 받은 firePHP core library의 압축을 풀어 줍니다. 그리고 application/libraries 디렉토리에 FirePHP.class.php파일을 복사 해 주고, 파일의 이름을 firephp.php로 바꿔 줍니다.

<>사용법
$this->firephp->log($myvariable) : FireBug console에 $myvarriable 값의 덤프를 보냄.
$this->firephp->warn($myvariable) : FireBug console에 $myvarriable 값의 덤프를 warning으로 분류해서 보냄.
$this->firephp->error($myvariable) : FireBug console에 $myvarriable 값의 덤프를 error으로 분류해서 보냄.

$this->load->library('firephp');
$myvariable = array (
'language' => 'PHP',
'database' => 'MySQL',
'blogging platform' => 'WordPress',
'post' => 'CodeIgniter and FirePHP',
);
$this->firephp->log($myvariable);
?>

<>특정 IP만 가능하게 하기
if($this->input->ip_address() =='1.2.3.4')
{
$this->firephp->setEnabled(TRUE);
}
else
{
$this->firephp->setEnabled(FALSE);
}
?>

[CI] Modular Extensions - HMVC

https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/wiki/Home

1. 리유

CodeIgniter를 Modules 로 전환하도록 함

2. 설치

홈페이지가 bitbucket으로 되어 있음
오른쪽 끝에 있는 get source에서 소스를 받아서

https://github.com/tariqrahiman/hmvc/zipball/master

압축파일 안의 core 디릭토리에 있는 파일 두개는 application/core에
third_party 디렉토리의 MX 디렉토리를 application/third_party로 통째 복사해 넣는다

    application/core/MY_Loader.php
    application/core/MY_Router.php
    application/third_party/MX/


3. 사용

설정을 별도로 하지 않아도 CodeIgniter만 사용할 때와 똑같이 하면 된다

application 디렉토리에 modules를 만들고 그 밑에 새 프로젝트 디렉토리를 만들고, 거기에 controllers, views, models 디렉토리를 만든다

(application/modules/NEW PROJECT/ controllers, views, models)

* Good Features

새로운 프로젝트를 만들 때 modules 밑에 만든 프로젝트 디렉토리를 그대로 옮기면 되어서 간단하고 편하다

[php] date timezone

Whenever there is an error, PHP throws an additional error/warning message on the web browser that the timezone should be set

Here is what I found as I read a PHP tutorial book Beginning PHP 5.3 by Matt Doyle

Set the date/timezone setting to avoid the warning that PHP borrows it from the system

To configure the setting, use phpinfo();

1. Find the location of the ini file: Loaded Configuration File
C:Program FilesPHPphp.ini

2. Look to see if it has already set in the phpinfo(); result
It is around halfway down the page

3. To set the value in the ini file
Open the ini file, and find date.timezone =

4. Go to http://php.net/timezone and select one: Asia/Seoul
and add it after the equal sign

5. Rerun Apache and phpinfo();

CodeIgniter and EclipsePDT

The method explained below is sort of simple and supprizingly the auto_completion is workable

Some more good features can be obtained with this method
1. A lot of web projects can be handled without launching the EclipsePDT again
To do that, make as many Web Directories as needed and copy CodeIgniter files in each directory
And Make a new PHP Project with a different name and connect it with CI_CORE
The result is that only one System Directory of the CodeIgniter is used and each project has its own copy of the application directoy
Even if each Web Directory contains a system directory, they are not used


-----------------------------------------
This method separates the code directory (i.e. Web Directory) from the project directory which happens to be the Eclipse Workspace

1. Create a Web Directory
(Or use an existing directory)
If there are none of the CodeIgniter files, copy them here

2. Create a Workspace Directory
(This one happens to be the project directory in the EclipsePDT)

3. Launch the EclipsePDT

4. Switch Workspace to the Workspace Directory

5. Make a new PHP Project and link it to the System folder in the Web Directory and call it CI_CORE

6. Make a new PHP Project and link it to the application folder in the Web Directory and name it CI_APP

7. Open the properties window of CI_APP by Right clicking it
Go to PHP Include Path => Projects -> Add
Add the CI_CORE

Friday, September 9, 2011

CodeIgniter 시작 [II] - 시험 코딩

CodeIgniter 시험 코딩


CodeIgniter는 MVC를 구현하는 PHP Development Framework이다

기본 코딩은 알고보면 진짜 간단하고 쉽다

먼저 Controller 코딩을 한다
거기서 View와 Model의 파일명을 정한다
거기서 Model을 통하여 넘겨 받을 변수 어레이를 만들어서 View에 사용할 변수 어레이로 만든다

저 세가지가 코딩의 개략이다
그럼 하나씩 보기로 하자

1. Controller를 만든다

    application/controllers 아래에 controller 파일을 하나 만든다
    application/controllers/helloworld.php


<?php
class Helloworld extends CI_Controller
{
  public function index()
  {
  $this->load->model('helloworld_model');
  $data['result'] = $this->helloworld_model->getData();
$data['page_title'] = "CI Hello World App!";
$this->load->view('helloworld_view', $data);
  }
}

    Model 파일명은 helloworld_model.php로,
    View 파일명은 helloworld_view.php로 정했다

    Model을 통해서 Database에서 추출하여 어레이로 만들 변수명을 data로 하였고,
    Model에서 getData()라는 메쏘드를 만들어서 데이터를 추출하도록 하였다

    저렇게 만든 어레이 변수의 내용은 View에서는 "$"만 앞에 붙여서 불러 쓰면 된다

    *2.0 차이점: 다른 것은 extends 다음에 나오는 CI_Controller 처럼 "CI_"를 앞에 붙여야 한다

2. View를 만든다

    Controller에서 정한 파일명으로 View를 만든다

    application/views 아래에 view 파일을 하나 만든다
    application/views/helloworld_view.php

<html>
  <head>
<title><?php echo $page_title; ?></title>
</head>
<body>
  <h1><?php echo $page_title; ?></h1>
  <?php foreach($result as $row):?>
  <h3><?php echo $row->title ?></h3>
  <p><?php echo $row->text ?></p>
  <br />
  <?php endforeach; ?>
</body>
</html>

    Controller에서 만든 어레이변수의 내용에 "$"만 붙여서 쓰면 된다

3. Model을 만든다

    Controller에서 정한 파일명으로 Model을 만든다

    application/models 아래에 model 파일을 하나 만든다
    application/models/helloworld_model.php

<?php
class Helloworld_model extends CI_Model
{
    public function __construct()
  {
  //Call the Model constructor
  parent::__construct();
  }


  function getData()
  {
  $query = $this->db->get('data');

  if ($query->num_rows() > 0)
  {
  return $query->result();
  }
  else
  {
  show_error('Database is empty!');
  }
  }
}

    Controller에서 정한 대로 getData()메쏘드로 데이타를 추출한다

    *2.0 차이점: __construct() 메쏘드를 만들고 parent::__construct();를 부른다

여기까지 한 다음에 http://code를 하면 codeigniter 디렉토리를 자동으로 련결하여 데이터베이스에서 추출한 것을 view를 통하여 보여준다

    *Routes의 default_controller를 helloworld로 하였기 때문에 웹브라우저의 주소에 설치디렉토리만 적어주면 된다

CodeIgniter 시작 [I]

CodeIgniter 설치


PHP Development Framework인 CodeIgniter를 사용하는것을 정리하였다
인터넷에 설명서가 많지만 그 중에서 "신규하 블로그"를 참조하였는데, 그것이 작성될 때는 CodeIgniter의 버전이 1.7 이라, 지금의 2.0하고는 코딩에서 조금 차이가 있어서, 그것들만 고쳤다

1. 설치디렉토리

    CodeIgniter를 얻으면 압축파일로 되어 있고, 그 속에는 해당 버전의 디렉토리가 있다
   그것을 앞으로 CodeIgniter의 디렉토리로 쓸 곳으로 옮긴다

    EX: J:\myblog

    이 디렉토리는 apache에서 document_root 디렉토리이다
    만약 document_root 이하에 subdirectory를 만들고 그곳에 CI를 설치한다면 apache의 httpd-vhosts.conf 파일에서 추가 또는 변경한다

    례를 들면

    document_root directory: J:\www
    CI 설치 디렉토리: J:\www\myblog

    이 경우에 httpd-vhosts.conf 에 다음사항을 기재한다

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


    설치한 디렉토리의 내용은 2.0에서 좀 달라서, 1.7에서는 system 아래에 모든 것이 있었지만 2.0에서는 system 안의 application 디렉토리를 밖으로 끄집어 내어서 그 구조가 다음과 같이 된다 (여기에는 하위 디렉토리의 일부만 적었다)

    system
        core
        database
        helpers
        libraries
    application
        controllers
        config
        views
        models

2. 설치후 사용하기 전에 하는 설정

    Base Site URL, Database, Initial Loading Page, URL Rewrite 등을 먼저 변경해준다

    1) Base Site URL

        application/config/config.php
        $config['base_url'] = ''

        기본으로 아무것도 없이 ''로 되어 있어서, 설치디렉토리가 Base Site URL로 되어 있으므로 고치지 않고 그대로 둔다

        apache의 document root이 J:\www로 되어 있고, CI 설치디렉토리는 J:\www\myblog 이면 base_url을 'myblog'로 변경한다

    2) Database

        앞으로 사용할 Database를 정하여 만들고, Username, Password, Database Name 들을 적는다

        application/config/database.php
        $db['default']['hostname'] = 'localhost';
        $db['default']['username'] = 'xxxxxxxx';
        $db['default']['password'] = 'xxxxxxxx';
        $db['default']['database'] = 'helloworld';
        $db['default']['dbdriver'] = 'mysql';

    3) Database Variable

        CodeIgniter는 Database Class를 기본으로 자동으로 Loading하지 않아서, coding할 때 Database를 연결하여 사용하려면 먼저 Database Library를 연결하여야 한다
        그렇게 하지 않고, 처음부터 자동으로 loading하여 계속 사용하기 위하여 설정을 한다

        application/config/autoload.php
        $autoload['libraries'] = array('database');

    4) Data for Testing

        시험용 데이터를 만든다
        참조한 블로그에 있는 대로 사용하기로 하였다


CREATE TABLE `data`(
  `id` int(11) NOT NULL auto_increment,
  `title` varchar(255) NOT NULL,
  `text` text NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

INSERT INTO `data` (`title`, `text`) VALUES('Hello World!', 'CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. If you''re a developer who lives in the real world of shared hosting accounts and clients with deadlines, and if you''re tired of ponderously large and thoroughly undocumented frameworks');

    5) Initial Loading Page

        CodeIgniter를 설치하자 마자 웹브라우저로 연결하면 Welcome 화면이 뜬다
        이것은 처음 시작하는 페이지를 application/controllers/welcome.php로 정했기 때문이다
        이것을 특정한 페이지로 만들려면 Default_Controller 를 바꾸고 application/controllers/ 에 새 controller를 만든다

        application/config/routes.php
        $route['default_controller'] = "helloworld";

        그리고 application/controllers/에 helloworld.php를 만든다
        (이미 welcome.php가 있으므로 참조해서 만든다)

    6) URL Rewrite

        CodeIgniter를 설치한 다음에 웹브라우저로 보면 default_controller를 부를 것이다
        그 다음에 다른 내용을 연결하려면 URL을 좀 별나게 http://codeigniter/index.php/otherpage.php 와 같이 해야 한다
        그 중간에 있는 index.php를 빼고 싶고, 또 웹 서버로 apache를 사용한다면 apache의 Rewrite 모듈을 사용하고, 또 codeigniter의 config를 설정한다

        먼저 설치디렉토리에 .htaccess 파일을 다음 내용으로 만든다
        J:\codeigniter\.htaccess

RewriteEngine on
RewriteCond $1 !^(index\.php|/img|/js|/css|/robots\.txt|/favicon\.ico)
RewriteRule ^(.*)$ /index.php/$1 [L]


        다음으로 config의 내용을 변경한다
        application/config/config.php


         $config['index_page'] = '';


        index.php로 되어 있는 것을 ''로 만든다


여기까지 하면 설치와 기본설정이 된 것이다
다음에는 간단하게 시헝코딩을 하여 Controller, View, Model을 살펴본다



CPU Temperature on Windows System Tray

CPU 온도를 관찰해야 하는데 온도를 보여주는 프로그램들, 례를 들면 Speccy, 은 다른 작업을 할 때 윈도우가 가려져서 볼 수 없다

그래서 System Tray에서 CPU 온도만 보여주는 프로그램을 알아보다가 CoreTemp를 찾았다

이것을 실행할 때 최소화하도록 (minimized) 하고, 또 가장 뜨거운 것 하나만 보여주도록 선택하여 설정하면 된다

CPU Fan 정지로 인한 CPU 과다발열

컴퓨터 CPU가 너무 뜨거워져서 컴퓨팅이 느려지다가 나중에는 작동중에 셧다운이 발생하게 된다

컴퓨터를 열고 보니까 CPU Fan이 움직이지 않고 있었다

Fan을 연결하는 선이 헐거워져 있는 것 같아서 좀 만져 주고 다시 소켓에 끼우니가 정상작동하게 되었고, CPU 온도도 40도 근처에서 오르내렸고, 심한 작업을 해도 50도를 넘기지 않았다

Monday, September 5, 2011

PC Conditions by Piriform Speccy

한여름부터 컴퓨터가 사용중에 셧다운되고 자동으로 재부팅되다가는 다시 꺼지기를 반복하길래 처음에는 컴퓨터 내부를 청소한 지가 오래 되어서 먼지가 너무 많이 쌓였으니까 CPU와 GPU가 발열을 잘 못해 너무 뜨거워졌기 때문이라고 생각해서 컴퓨터 내부를 말끔히 청소했다

그런 다음에 한 1주일 정도는 사용중에 꺼지는 일이 없다가 또 꺼지는 현상이 발생하기 시작했다

한번 꺼지면 곧바로 또는 조금 있다가 자동 재부팅 하는데, 그러면 꼭 부팅중에 또 다운된다
하지만 시간을 좀 두고 컴퓨터를 키면 셧다운 되지 않고 나중에 잘 때 컴퓨터를 끌 때까지 계속 사용할 수 있었다

그래서 파워서플라이가 약해져서 그런가보다 해서 시간을 내서 용산에 가서 저렴하고 새 것으로 구입하려고 마음먹고 있었다

하지만 오늘은 너무 자주 그러길래, 혹시나 해서 부팅하자마다 셋업화면에 들어 가서 보니까 CPU의 경고 온도가 70도로 되어 있고, 현재 온도는 63도였다

경고온도를 75도 80도 중에서 가장 높은 80도로 바꾸고 시험해 보았는데 아직까지는 셧다운하지는 않는다

CPU 온도를 계속 모니터링하려고 유틸을 찾았지만 마땅한 것이 없던 중에, 마침 전에 시스템 확인 프로그램인 Speccy 를  설치한 것이 생각나서 그걸로 확인 하여 보니까 CPU 가 보통 75도 이상이고, 가끔씩 80도를 넘기면서 빨간색으로 표시되기도 한다

컴퓨터를 사용중에 그래픽뷰어나 웹브라우저 등 다른 프로그램을 가동하면 잠시동안 CPU 온도가 급하게 올라갔다가 금방 보통 온도인 75도 정도로 되돌아 오는 것을 확인할 수 있다

참고로 지금 사용중인 PC 상태를 Speccy 프로그램을 모니터링하는 화면을 잡아챈 화면을 유첨하여, 나중에 컴퓨터가 다운되거나 이상 증세가 생겨서 컴퓨터를 가동하지 못할 때 인터넷에서 컴퓨터 사용 내용을 알려고 할 때 좋을 것 같다