[旧]メモり。メモる。(お引越ししました→http://hatone.hateblo.jp/)

2010-02-14

[][]13問目

#include<iostream>
using namespace std;

int main(){

  int num[100][50];
  int buf[50];
  int mod[50];
  int ans[50];
  char c;
  
  for(int i=0;i<100;i++)
    {
      for(int p=0;p<50;p++)
	{
	  cin>>c;
	  num[i][p]=c-'0';

	  buf[p]=0;
	  mod[p]=0;
	  ans[p]=0;
	}
    }

  for(int i=0;i<50;i++)
    {
      for(int p=0;p<100;p++)
	{
	  mod[49-i]+=num[p][49-i];
	}

      mod[49-i]+=buf[49-i];
      ans[49-i]=mod[49-i]%10;
      buf[48-i]=mod[49-i]/10;
    }
  
  cout<<"ans"<<mod[0]<<endl;

  for(int i=1;i<50;i++)
    {
      cout<<i<<":"<<ans[i]<<endl;
    }
  
 


  return 0;


}

2009-07-07 ブラウザ依存なんて大嫌い。

[]二進数時計

igoogleガジェットとして、二進数時計を公開しました。

実際、自分でも瞬時には時刻を読めません。

2009-05-14

[]ubuntuでOpenGLプログラミング

インストール。

#sudo apt-get install freeglut3-dev freeglut3-dbg libxmu-dev libxi-dev build-essential


コンパイルを楽にしたいので、下記のようにシェルを作ります。

glg

#!/bin/sh

/usr/bin/gcc -o "$1" "$2" -lglut -lGLU -lGL

% chmod +x glg

2008-02-20 tracをインストール

[]debian etchにtracをインストールしてみました。

http://なんちゃら/svnでリポジトリにアクセスしたかったので、材料はapache2+subversion+tracです。

まずは、日本語化されたtracを配布しているサイトからダウンロードして解凍。

そしてインストール。

$ wget http://www.i-act.co.jp/project/products/downloads/trac-0.10.4-ja-1.zip

$ unzip trac-0.10.4-ja-1.zip

$ cd trac-0.10.4-ja-1

$ ./setup.py install

ついでに、subversionもろもろインストール。

$ apt-get install -y subversion libapache2-svn

リポジトリを作成して、権限を変更。

$ mkdir /home/project/svn/myproject

$ svnadmin create /home/project/svn/myproject

$ chown -R www-data:www-data /home/project/svn/myproject

http://なんちゃら/svnでリポジトリへアクセスできるように、/etc/apache2/conf.d/svnを作成。

$ vim /etc/apache2/conf.d/svn

<Location /svn>

DAV svn

SVNPath /home/project/svn/myproject

</Location>

環境が整ったので、trac-adminでプロジェクトを管理するページを作る。

$ trac-admin /home/project/trac/myproject initenv

Creating a new Trac environment at /home/project/trac/myproject

Trac will first ask a few questions about your environment

in order to initalize and prepare the project database.

Please enter the name of your project.

This name will be used in page titles and descriptions.

Project Name [My Project]> myproject

Please specify the connection string for the database to use.

By default, a local SQLite database is created in the environment

directory. It is also possible to use an already existing

PostgreSQL database (check the Trac documentation for the exact

connection string syntax).

Database connection string [sqlite:db/trac.db]>

Please specify the type of version control system,

By default, it will be svn.

If you don't want to use Trac with version control integration,

choose the default here and don't specify a repository directory.

in the next question.

Repository type [svn]>

Please specify the absolute path to the version control

repository, or leave it blank to use Trac without a repository.

You can also set the repository location later.

Path to repository [/path/to/repos]>

Please enter location of Trac page templates.

Default is the location of the site-wide templates installed with Trac.

Templates directory [/usr/share/trac/templates]>

Creating and Initializing Project

Installing default wiki pages

/usr/share/trac/wiki-default/CamelCase => CamelCase

/usr/share/trac/wiki-default/SandBox => SandBox

/usr/share/trac/wiki-default/TracLinks => TracLinks

/usr/share/trac/wiki-default/TracSupport => TracSupport

/usr/share/trac/wiki-default/TracTimeline => TracTimeline

/usr/share/trac/wiki-default/TracLogging => TracLogging

/usr/share/trac/wiki-default/WikiMacros => WikiMacros

/usr/share/trac/wiki-default/TracCgi => TracCgi

/usr/share/trac/wiki-default/TracInterfaceCustomization => TracInterfaceCustomization

/usr/share/trac/wiki-default/TracTickets => TracTickets

/usr/share/trac/wiki-default/checkwiki.py => checkwiki.py

/usr/share/trac/wiki-default/InterMapTxt => InterMapTxt

/usr/share/trac/wiki-default/TracQuery => TracQuery

/usr/share/trac/wiki-default/TracWiki => TracWiki

/usr/share/trac/wiki-default/InterTrac => InterTrac

/usr/share/trac/wiki-default/WikiHtml => WikiHtml

/usr/share/trac/wiki-default/WikiStart => WikiStart

/usr/share/trac/wiki-default/TracUpgrade => TracUpgrade

/usr/share/trac/wiki-default/TracRss => TracRss

/usr/share/trac/wiki-default/TracAdmin => TracAdmin

/usr/share/trac/wiki-default/WikiPageNames => WikiPageNames

/usr/share/trac/wiki-default/WikiFormatting => WikiFormatting

/usr/share/trac/wiki-default/TracRoadmap => TracRoadmap

/usr/share/trac/wiki-default/TracModPython => TracModPython

/usr/share/trac/wiki-default/InterWiki => InterWiki

/usr/share/trac/wiki-default/TracBackup => TracBackup

/usr/share/trac/wiki-default/TracGuide => TracGuide

/usr/share/trac/wiki-default/TracBrowser => TracBrowser

/usr/share/trac/wiki-default/TracUnicode => TracUnicode

/usr/share/trac/wiki-default/WikiRestructuredTextLinks => WikiRestructuredTextLinks

/usr/share/trac/wiki-default/TitleIndex => TitleIndex

/usr/share/trac/wiki-default/TracIni => TracIni

/usr/share/trac/wiki-default/TracReports => TracReports

/usr/share/trac/wiki-default/WikiProcessors => WikiProcessors

/usr/share/trac/wiki-default/TracNotification => TracNotification

/usr/share/trac/wiki-default/TracChangeset => TracChangeset

/usr/share/trac/wiki-default/TracJa => TracJa

/usr/share/trac/wiki-default/TracSyntaxColoring => TracSyntaxColoring

/usr/share/trac/wiki-default/TracTermsJa => TracTermsJa

/usr/share/trac/wiki-default/WikiDeletePage => WikiDeletePage

/usr/share/trac/wiki-default/TracPermissions => TracPermissions

/usr/share/trac/wiki-default/TracAccessibility => TracAccessibility

/usr/share/trac/wiki-default/TracEnvironment => TracEnvironment

/usr/share/trac/wiki-default/WikiNewPage => WikiNewPage

/usr/share/trac/wiki-default/TracFastCgi => TracFastCgi

/usr/share/trac/wiki-default/TracImport => TracImport

/usr/share/trac/wiki-default/TracPlugins => TracPlugins

/usr/share/trac/wiki-default/RecentChanges => RecentChanges

/usr/share/trac/wiki-default/TracTicketsCustomFields => TracTicketsCustomFields

/usr/share/trac/wiki-default/TracStandalone => TracStandalone

/usr/share/trac/wiki-default/TracRevisionLog => TracRevisionLog

/usr/share/trac/wiki-default/WikiRestructuredText => WikiRestructuredText

/usr/share/trac/wiki-default/TracSearch => TracSearch

/usr/share/trac/wiki-default/TracInstall => TracInstall

---------------------------------------------------------------------

Project environment for 'myproject' created.

You may now configure the environment by editing the file:

/home/project/trac/myproject/conf/trac.ini

If you'd like to take this new project environment for a test drive,

try running the Trac standalone web server `tracd`:

tracd --port 8000 /home/project/trac/myproject

Then point your browser to http://localhost:8000/myproject.

There you can also browse the documentation for your installed

version of Trac, including information on further setup (such as

deploying Trac to a real web server).

The latest documentation can also always be found on the project

website:

http://trac.edgewall.org/

Congratulations!


とりあえず、こんな感じで動くようになりました。

2007-09-07

[]CakePHP導入編

なんとなくCakePHPをやりたくなったので導入。

Cakeチュートリアルをやっていきます。

http://www.cakephp.jp/doc/blog_tutorial.html


材料

・xampp

http://www.apachefriends.org/jp/xampp-windows.html

・CakePHP

1.XAMPPをインストールする

そうすると、サーバー環境が一発で揃います。

2.Apacheの設定

httpd.confの

#LoadModule rewrite_module modules/mod_rewrite.so

→LoadModule rewrite_module modules/mod_rewrite.so

にしてリスタート

3.MySQLでデータベースをつくる

まずパスワードの設定

C:Program Filesxamppmysqlbin>mysqladmin -u root password パスワード

データベース作る

C:Program Filesxamppmysqlbin>mysql -u root -p

Enter password: *******

mysql> create database mysql;

データベースいじくるユーザーを作る

mysql> grant select, update, insert, delete on mysql.* to

-> blog@localhost IDENTIFIED BY 'パスワード';

4./app/config/database.phpの設定

var $default = array('driver' => 'mysql',

'connect' => 'mysql_pconnect',

'host' => 'localhost',

'login' => 'blog',

'password' => 'パスワード',

'database' => 'mysql',

'prefix' => '');


http://localhost/cake/でちゃんと表示されてるかチェック。

とりあえず今日はここまで。