jsのクリックイベントの謎??

2019.06.22

Logging

javaScriptとjqueryのクリックイベントの挙動が違うのは
わかったのですが・・・。
これは結構奥が深い気がします。

See the Pen jsのクリックイベントの謎?? by taoka (@taoka-toshiaki) on CodePen.0

タグ

0, 265, BY, codepen, default, embed, gt, hash, Height, href, html, ID, io, javascript, jquery, JS, lt, ON, Pen, QXprJX, result, See, slug, tab, taoka, taoka-toshiaki, The, theme, user, イベント, クリック, これ, , 挙動, , ,

単純なコードで背景色にグラデーション。

2019.06.15

Logging

単純なコードで背景色にグラデーションつける。
このコード自体は単純なコードです、ですが・・・。
気に食わないので何度も初期の色コードを設定を変えてみたのですが
鮮やかさがでません。ちょっとドス黒いグラデーションのまま。
コードを貼り付けておきます。
一時間ぐらい色を変えて遊んでました:D

See the Pen 単純なコードで背景色にグラデーション。 by taoka (@taoka-toshiaki) on CodePen.0


 

タグ

0, 265, BY, codepen, default, embed, gt, hash, Height, href, ID, io, JQGLoO, JS, lt, Pen, result, See, slug, tab, taoka, taoka-toshiaki, The, theme, user, グラデーション, コード, ドス, まま, , 何度, 初期, 単純, 背景色, 自体, , 設定,

文字の置き換え と コールバック

2019.06.08

Logging

お蔵入りしたコードです。文字の置き換えとコールバック関数です。
置換する際に、それぞれ違う文字に置き換えて表示したいなどに
使用すると便利かなと思います。

See the Pen 文字の置き換え と コールバック by taoka (@taoka-toshiaki) on CodePen.0

タグ

0, 265, BeXapO, BY, codepen, default, embed, gt, hash, Height, href, html, ID, io, lt, ON, Pen, result, See, slug, tab, taoka, taoka-toshiaki, The, theme, user, お蔵入り, コード, コール, それぞれ, バック, 使用, 便利, 文字, 置換, 表示, 関数, ,

ajaxはクロスドメインを許していないのでこうするしかない?わけではないけれど(提供会社による)

2019.05.11

Logging

ライブドアが提供している天気予報APIをJSだけで
なんとか出来ないかと思ったので試してみたけれど無理でしたので、
一回、PHPで読み込んでその情報を取得するという事で解決。
昔はYahooがそういう事を提供してたみたいですが
提供終了してました。

<div style="display: table;">
        <div style="display: table-cell;">
            今日の天気::<br>
            <img id="weather_0" src="">
        </div>
        <div style="display: table-cell;">
            明日の天気<br>
            <img id="weather_1" src="">
        </div>
    </div>

 

<script>
$(function(){
    $.ajax({
        type: 'GET',
        //'http://weather.livedoor.com/forecast/webservice/json/v1?city=390010',
        url: 'https://zip358.com/weather/',
        data:null,
        dataType: 'json'
    }).done(function(data){
        $("#weather_0").attr("src",data.forecasts["0"].image.url);
        $("#weather_1").attr("src",data.forecasts["1"].image.url);
    });
});
</script>

タグ

'src', 0, ajax, API, br, display, div, gt, ID, img, JS, lt, php, style, TABLE, table-cell, weather, Yahoo, クロス, ドメイン, ライブドア, わけ, , 予報, , 今日, 取得, 天気, 情報, 提供, 明日, , 終了, 解決,

MYSQL8以降ウィンドウ関数対応=>ランキング。

2019.05.06

Logging

MYSQLでもランキング機能(rank())が使えるようになったとさ。日本国内のレンタルサーバーは最新の技術というより
一歩遅れた技術で運営している理由はリスクを取らないためにそうしているのだろうなとヒシヒシと感じます。

### support mysql>8.0.2 ウィンドウ関数
```sql
select id,namae, rank() over(order by code_total asc)as code_rank from code_data;
```
### code_data
|id|namae|code_total|
|---|---|---|
|1|kaonashi|15|
|2|mononoke|75|
|3|asitaka|52|
|4|san|87|
|5|theta|99|

タグ

```, ---, , 15, 2, , 4, 5, 52, 75, 8, 8.0.2, 87, 99, as, asc, asitaka, BY, Code, data, from, gt, ID, kaonashi, mononoke, MYSQL, namae, order, over, rank, san, select, SQL, support, theta, total, ウィンドウ, サーバー, ため, ランキング, リスク, レンタル, , 国内, 対応, 技術, 日本, 最新, 機能, 理由, 運営, 関数,

同一TABLEを参照しアップデートする。

2019.04.27

Logging

同一TABLEを参照しアップデートする。
これでアップデートできる事を昨日知りました。

UPDATE demo1,(select chk from demo1 where id=1) as demo2 SET
demo = "2" where id = 1 and chk = demo2.chk;
--------------
--------------
/*
同一TABLEを参照しアップデートする。
table demo1
id,chk
1,123
*/
--------------

タグ

, 2, and, as, chk, demo, from, ID, select, set, TABLE, UPDATE, where, アップデート, これ, , 参照, 同一, 昨日,

自然結合というものがある、基礎だけど知らない人もいる。

2019.04.20

Logging

自然結合というものがある、基礎だけど知らない人もいる。
結合するTABLEのフィールド名が同じでなくてはならないので
設計する人に一任されるのでほぼ使うことはないと思います?

select * from demo1 natural join demo2;
-- table demo1
-- id,pass
-- table demo2
-- id,name,tel,email
--idで自動で結合してくれる(自然結合)

 

タグ

--, , 2, demo, email, from, ID, join, name, natural, nbsp, pass, select, TABLE, tel, こと, フィールド, もの, 一任, , 基礎, 結合, 自動, 自然, 設計,

Canvasで円がぐるぐる回る。

2019.03.09

Logging

<!DOCTYPE html>
<html>
    <head>
    </head>
<body>
    <canvas id="ctx" ></canvas>
    <script>
            "use strict";
            let x = 0,y = 0;
            let xs = 300,ys = 300;
            let xc = 1,yc = 1;
            let ctx = document.querySelector("#ctx");
            let canvas;
            ctx.width = window.screen.width;
            ctx.height = window.screen.height;
            if(ctx.getContext)
            {
               canvas = ctx.getContext("2d");
               setInterval(draw,77);
            }
            function draw(){
               canvas.beginPath();
               canvas.fillStyle = "#3399ff";
               canvas.arc(x,y,35,0,Math.PI*2,true);
               canvas.globalCompositeOperation = "xor";
               canvas.fill();
                x =((Math.sin (xc) * xs)) + 500;
                y =(Math.cos(yc) * ys) + 500;
                console.log(x + ":" + ctx.width);
                console.log(y + ":" + ctx.height);
                if(x < 0 || x > ctx.width)
                {
                   xs*=-1;
                }
                if(y < 0 || y > ctx.height)
                {
                    ys*=-1;
                }
                if(x<0)
                {
                    x=0;
                }
                if(y<0)
                {
                    y=0;
                }
                if(x > ctx.width)
                {
                    x=ctx.width;
                }
                if( y > ctx.height)
                {
                    y=ctx.height;
                }
                xc+=1
                if(xc>360)
                {
                    xc=0;
                }
                yc+=1
                if(yc>360)
                {
                    yc=0;
                }
            }
        </script>
</body>
</html>

Canvasでぐるぐる円を廻す。
ガラクタコードが少しあります、最初違うコードを書いていたので
これを可変していろいろお試しください。
https://zip358.com/tool/demo5/js/index-3.html

タグ

0, , 300, body, Canvas, ctx, DOCTYPE, document, gt, head, Height, html, ID, let, lt, querySelector, screen, script, strict, use, Width, win, window, xc, xs, yc, YS, ,

プロセス残してSSHログアウトする方法。

2018.11.11

Logging

screenっていうコマンドを使用するとプロセス残してSSHログアウトする事ができます。ちなみにscreenというコマンドは仮想ウィンドが立ち上げる機能です。
まずscreenをインストールし、実行したいコマンドを実行します。
実行すると仮想ウィンドが立ち上がります。
立ち上がっている画面の確認はlsで確認することが可能。
その画面を読み込むときは-r を使用します。
lsで表示されているプロセスID(PID)を記入してコマンドを実行することで再接続することが可能となります。
追記:こんな方法もあります。
Linuxでプロセス残すなら!

yum -y install screen
screen php test.php
screen -ls
screen -r PID

タグ

-r, -y, ID, install, Linux, ls, php, PID, screen, SSH, test, yum, インストール, ウィンド, こと, コマンド, とき, プロセス, ログアウト, , 仮想, 使用, 可能, 実行, 接続, 方法, 機能, 画面, 確認, 表示, 記入, 追記,