2013年6月30日日曜日

Loto6 プログラム

出力はこちらです====================




===================================
javascript を勉強します。はじめに作成したプログラムは 1から43までのランダム
数字を出力します。 数字は重複しないこと、数字をソートすること。
又、1と43は出なければならない。 リフレッシュして、結果が変更されます。バグが
ありましたら、お知らせください。

Loto6ですね。


var loto6 = new Array ();
do{
var x= Math.round(Math.random() *42+1);
document.write(x + ',');
if (loto6.indexOf(x)>-1){
continue;
}
loto6.push(x);
}while(loto6.length<6);
document.write('<br>');
document.write(loto6);
document.write('<br>');

var sortfun = function(a,b){
    if( a < b ) return -1;
        if( a > b ) return 1;
        if( a == b ) return 0;

}


var x=loto6.sort(sortfun);
document.write(x);

2013年6月10日月曜日

IE8のドキュメントモードやブラウザモード

IE8標準モードで表示してほしいなら以下のように書く
<meta http-equiv="X-UA-Compatible" content="IE=IE8" />

2013年6月9日日曜日

ウェブマスターツール

ウェブマスターツール

http://webmaster.live.com/

http://www.google.com/webmasters/tools/?hl=ja

rel="nofollow" Google は、これらのリンクをたどりません

rel="nofollow"

<a href=”http://www.test.com /” rel=”nofollow”>


nofollow が指定されたリンクの Google での処理

通常、Google は、これらのリンクをたどりません。つまり、これらのリンクの PageRank やアンカー テキストを転送しません。nofollow を使用することは、Google のウェブ全体の図式からリンクを除外することになります。ただし、他のサイトが nofollow を使用せずに対象ページにリンクしている場合や、URL がサイトマップで Google に送信されている場合、対象ページがインデックスに表示されることがあります。また、他の検索エンジンでの nofollow の処理が少し異なる場合もあります。
http://support.google.com/webmasters/bin/answer.py?hl=ja&answer=96569

2013年5月26日日曜日

usleep() - マイクロ秒単位で実行を遅延する

usleep() - マイクロ秒単位で実行を遅延する
usleep(500000);    0.5秒

2013年5月12日日曜日

楽天 API 商品検索



class raku{
public $r_url;
public $data;

public function raku($jan){
$r_url='https://app.rakuten.co.jp/services/api/IchibaItem/Search/20120723?';
$para['applicationId']='1*********************';
$para['affiliateId']='1*************************************';
$para['format']='xml';
$para['hits']='30';
$para['sort']='+itemPrice';
$para['keyword']=urlencode($jan);

$r_para=http_build_query($para);
$this->r_url=$r_url.$r_para;

$this->d_xml();
$this->view();
}

public function d_xml(){
$this->r_url;
$this->data=simplexml_load_string(file_get_contents($this->r_url));
}

public function view(){
$alink='<a href="%s"><li>%s</li></a>';
//echo $this->data->hits;
if ($this->data->hits > 0 ){
echo '<ul class="yahoo_info">';
echo '<img src="./pic/rakuten12060-2.png" alt="" title="" />';
foreach ($this->data->Items->Item as $key=>$val){
$link=$val->affiliateUrl;
$temp='&nbsp&nbsp&nbsp&nbsp'.$val->shopName.'&nbsp&nbsp'.'<span>¥'.number_format($val->itemPrice).'</span>';
echo sprintf($alink,$link,$temp);
}
echo '</ul>';
}
}
}


?>

error_reporting — 出力する PHP エラーの種類を設定する


error_reporting()

<?php

// 全てのエラー出力をオフにする
error_reporting(0);

// 単純な実行時エラーを表示する
error_reporting(E_ERROR | E_WARNING | E_PARSE);

// E_NOTICE を表示させるのもおすすめ(初期化されていない
// 変数、変数名のスペルミスなど…)
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

// E_NOTICE 以外の全てのエラーを表示する
// これは php.ini で設定されているデフォルト値
error_reporting(E_ALL ^ E_NOTICE);

// 全ての PHP エラーを表示する (Changelog を参照ください)
error_reporting(E_ALL);

// 全ての PHP エラーを表示する
error_reporting(-1);

// error_reporting(E_ALL); と同じ
ini_set('error_reporting', E_ALL);

?> 



 参考