2009-01-01から1年間の記事一覧

Crawling web site

I wrote script to crawl web site by perl. It would collect A tag of html and repeat access in site to move another web site. But I can not understand reflexive, so it is inefficient. I have the second time to write perl script. This script…

Installed ProFTPD Configuring

I installed ProFTPD on home server which runs ubuntu. It will not remember, because I write in this article. For somebody else who want to install it. It is easy to install it, and only rewrite default configuration file. First step, To in…

XML → JSON script

I wrote program which XML change to JSON. Your work what change XML format to JSON format will easy! Example, there is this XML about several shop data. <shopdata> <info> <shopname>おいしい肉屋</shopname> <yomi>おいしいにくや</yomi> <address>市内</address> <business_hours>10…</business_hours></info></shopdata>

Python tree

When this season was coming for every year, Someone write this code. for i in range(1,11): if i == 10: for j in range(1,11): print " "*(i-j)+"**"*j if j == 2: print " "*(i-j)+"+*"*j if j == 4: print " "*(i-j)+"*+"*j if j == 6: print " "*(i…

Today's C

c

I forgot anything about c, because I do not write recently. Today's program is almost copy answer, that problems for c beginner. c is difficult for me. #include <stdio.h> #define NINZU 5 #define KAMOKU 4 int main(void){ int no[NINZU] = {1001,1002,1</stdio.h>…

One of how to write closure

js

JavaScript is very flexible language. It is possible to write in this manner. this code is function make_counter receives one argument, and return function which has no name receives one argument. At the end, it is return total of two argu…

How to connect sqlite3 from python

I could not use sqlite3 module by python. After later I had found how to do it. I gave it up use sqlite3 module. Looking for another modules, pysqlite module it is. I referred to following URL.

Sort and reserve algorithm

I thought some algorithm what it dose not use built in function. It is sort and reserve algorithm. These are very easy algorithm, Nobody thinks purposely. Moreover, I can not program well and all program language is self learning what I wr…

Python2.6.2 could not use sqlite3 module!!

I wanna use sqlite by python. But python commandline displayed "No module it". Why? I had known sqlite module is official module from python2.5. Apparently, To need install "sqlite-devel" to use sqlite module by python2.6, Next then rebuil…

Today's C

c

#include <stdio.h> #include <ctype.h> int main(void){ int i; for(i=0;i<127;i++){ if(isprint(i)!=0){ if(isalnum(i)){ printf("%c",i); }else{ printf("[%c]",i); } } } return 0; } #include <stdio.h> #include <string.h> int main(void){ char a[21]; char b[11]; int i; do{ printf("aの</string.h></stdio.h></ctype.h></stdio.h>…

Ten minutes cording

I challenged Ten minutes cording. This site,10分でコーディング|プログラミングに自信があるやつこい!!"If you had exceeded ten minutes to write it. You can not program very"But, I had taken about fifty minutes... I feel to need it what m…

mixiの今後

mixi内の広告 mixiトップの草原に座り込む女性画像の広告の質がずっと安っぽいままなのはネット広告は儲からないってことの証明だと思う。 でもって画面右側の広告枠もmixiアプリの広告やセクシュアリティ満開のバイク王の広告、ダイエット関連のやつなどmix…

Today's C

c

#include <stdio.h> int main(void){ int i; printf("1-3の整数値を入力"); while(scanf("%d",&i) !=EOF){ switch(i){ case 1: printf("apple\n"); break; case 2: printf("banana\n"); break; case 3: printf("cherry\n"); break; default: printf("???\n"); break; </stdio.h>…

Some of function in javascript

js

Apply shares defined variable in functions. Second arguments is first arguments in object functions. function Person( name,ateru) { this.name = name; this.ateru = ateru; } function sayHello( s ) { alert( s + this.name+ '!'+this.ateru); } v…

solve problem2

It was hard to me. I could not understand Algorithm what to solve Fibonacci sequence and could not to reading English because I am Japanese. Especially, this sequence "even-valued terms". What mean it in Japanese? I had asked teacher(googl…

Send mail from gmail

I tested to send mail from gmail by python. It will send to mail what Livedoor Weather Web Service information. I tried to get weather informations of kyoto city. If you want to change city,please change city number and day parameter.

Analyzes urchin logs

I wrote perl for the first time. This is analyze logs of urchin if you input IP address what would know user action Result is url, it was seen pages and all of pages which user has seen it. Perl is useful when I have to spot job. Please yo…

Today's C

If variable data will be 32767, Break infinity loop. To use long type by printf is write like this %ld. To much interest in type data of c, I learn restart about it. #include <stdio.h> int main(void){ long data = 1; int cnt = 1; while(1){ data = da</stdio.h>…

Today's C

c

I wrote today, Self learning C. Because I often mistake syntax what scanf needs "&" but forgetting it. compiler display message of warning. I have to careful it. I remember things today what how to give scanf two arguments. It is written l…

solve problem1

I wrote python. I am interested in Algorithm now, would begin solve problems from today when if I have some time. a = [] h = 0 for i in range(0,1000): if i % 3 == 0: a.append(i) elif i % 5 == 0: a.append(i) for j in range(0,len(a)): h = h …

Learning c

c

Now learning c, I wrote three programs today. Any program is easy for me because it is for beginner. I am learning to refers "初心者のためのポイント学習C言語", my target is to understand about c and I wanna be engineer looks like graduate…

Character string comparison

c

This program compares character strings. You input two character strings when "Please input two strings". If you do so, It runs and return result what you input value. This program accesses character strings sequentially from first number …

割合の出し方とか

いつも忘れるのでメモ。増加率の求め方(今回-前回)/前回*100割合の内訳(割合*0.01)*合計数

self learn c language

c

Display asterisk from one to nine. Add one thing #include <stdio.h> int main(void){ int n = 0; for(n;n<10;n++){ int i = 0; for(i;i<=n;i++){ printf("*"); } printf("\n"); } return 0; } Addition from one to one hundred. #include <stdio.h> int main(void){ int w</stdio.h></stdio.h>…

Count up and multiplied by 2

c

#include <stdio.h> int main(void){ int i; int data1[10],data2[10]; for(i = 0;i<10;i++){ data1[i] = i; printf("\n"); data2[i] = data1[i] * 2; printf("%d",data2[i]); } return 0; } #include <stdio.h> int main(void){ char a[] = "a[]="; printf("%s",a); int i = 0</stdio.h></stdio.h>…

How to open file of lzh on ubuntu

If you want to open file what it was preserved by lzh. You have to use lha. It is decompression software. First, start shell and enter apt command, apt-get install lha It will begin install automatically. If you are not root be change root…

Mystery action of php

php

I found what is mystery action of php. look this program, a = "a"; return $this->a; } function b() { $b = $this->a; var_dump($b); } } $w = new Test(); $w->b(); ?>

Mod_rewrite is able to rewrite url easily

I am examining now about to change dynamic url to static url.example,http://www.example.php?lunch=chinese&area=riverside ↓ http://www.example.php/chinese/riversideIt is called URL Regularization.If you wanna change url that and then you ha…

Session Technique of PHP programs

php

Session is useful to build web applications what needs login.example SNS,Shopping cart and Closed applications is used by a few users. It gives unique id for users, They use that. Usually effective things is repetition login and protect fr…

Writing unit tests code

This is the tests use the unittest module. I use it for the first time. example... # -*- coding: utf-8 -*- import unittest class Mytest(unittest.TestCase): def testCom(self): self.m= 34 self.assert_(self.m == 34) def kake(self,a,b): return…