2017年10月14日 星期六

GAMEDISK 遊戲編號與測試

遊戲部分列表
G01 猜數字,需要MCI32.OCX
G02 比大小
G03 骰子猜謎
G04 顏色猜謎
G05 萬徑人蹤
G06 挑戰記憶
G07 打字遊戲
G08 反轉方塊
G09 數字拼盤
G10 旋轉方塊
G11 旋轉蜂窩
G12 撿石頭
G13 縱橫計數
G14 井字棋
G15 反圈叉棋
G16 豆腐棋
G17 五角棋
G18 孔明棋
G19 三子棋
G20 四子棋
G21 五子棋
G22 伏羲神算 需要Music目錄
G23 孫武練兵 需要Music目錄
G24 陶侃搬磚
G25 華容道
G26 六角棋
G27 獨人跳棋,需要Msvbvm50.dll


VB五子棋設計回顧

現存原始檔是1998年,2001年時修改的
就是單純採用VB5設計的,原本以為有HiPoint設計,結果發現有原始函數庫,可是主程式並沒有呼叫它。

HiPoint 在筆記本裡是這樣描述的

IF 存在HiPoint THEN
  score =  計算每一個HiPoint的值,選出最高分的
ELSE
  掃描所有存在的空點,如果加入之後會造成4子連線,或者兩個(以上)的三子連線就加入  HiPoint

ENDIF

2017年10月13日 星期五

單位表

我們目前所用的KMGT等都是英文表示方法,分別是Kilo103)、Mega106)、Giga109)、Tera1012)的簡寫,更大的還有Peta1015)、Exa1018)、Bronto1021)等。底下是維基百科中的列表

PrefixBase 1000Base 10Base
2
English wordAdoption
NameSymbolShort scaleLong scale
yottaY 10008 1024
280
 septillion quadrillion1991
zettaZ 10007 1021
270
 sextillion trilliard1991
exaE 10006 1018
260
 quintillion trillion1975
petaP 10005 1015250 quadrillion billiard1975
teraT 10004 1012240 trillion billion1960
gigaG 10003 109230 billion milliard1960
megaM 10002 106
220
 million1873
kiloK 10001 103
210
 thousand1795

 10000 1001 one

millim 1000−1 10−3
2-10
 thousandth1795
microµ 1000−2 10−6
2-20
 millionth1873
nanon 1000−3 10−9
2-30
 billionth milliardth1960
picop 1000−4 10−12
2-40
 trillionth billionth1960
femtof 1000−5 10−15
2-50
 quadrillionth billiardth1964
attoa 1000−6 10−18
2-60
 quintillionth trillionth1964
zeptoz 1000−7 10−21
2-70
 sextillionth trilliardth1991
yoctoy 1000−8 10−24 2-80 septillionth quadrillionth1991

Rich Edit 問答

基礎
來源:MS Rich Textbox Control 5.0
屬性
Appearence 0-rtfFlat 1-rtfThreaD
AutoVerbMenu True False
BackColor
BorderStyle 0-rtfNoBorder 1-rtfFixedSingle
BulletIndent
DataBindings
DataField
DataSource
DisableNoScorll True False

Greasemonkey範例

新增Greasemonkey套件
新使用者腳本
名稱 edit
命名空間 http://wusi.asuscomm.com/news5/
使用 http://wusi.asuscomm.com/*

將底下複製到使用者程式碼區

// ==UserScript==
// @name        edit
// @namespace   http://wusi.asuscomm.com/news5/
// @include     http://wusi.asuscomm.com/news5/
// @version     1
// @grant       none
// ==/UserScript==

function openInNewTab(url) {
  var win = window.open(url, '_blank');
  win.focus();
}
var x = document.getElementsByClassName('logo');
var btn = document.createElement('BUTTON');
var t = document.createTextNode('EDIT');
btn.appendChild(t);
x[0].appendChild(btn);
btn.onclick = function () {
  a = location.href.split('/');
  l = a.length;
  //alert(a[l-1]);
  b = a[l - 1].split('-');
  c = b[0].match(/\d+/g);
  url = 'http://wusi.asuscomm.com/news5/administrator/index.php?option=com_content&task=article.edit&id=' + c;
  openInNewTab(url);
}

2017年10月10日 星期二

免費圖庫



(注意:這個網站的Professional Stock Photos from $1下方圖片是要收費的)

(分類在左邊,中間會有廣告)










X學務系統自訂輸出(使用tinyD或區塊)

tinyD去建立有學校的轉入轉出,底下是轉出的範例


//取得目前的學年學期
$d = explode('-',date('Y-m-d'));
if ($d[1]>=8) {
  $curr_year=$d[0]-1911;
  $curr_seme=1;
} elseif ($d[1]==1) {
  $curr_year=$d[0]-1912; 
  $curr_seme=1;
}else{ 
  $curr_year=$d[0]-1912;
  $curr_seme=2;
}


$curr_link=$_SERVER['PHP_SELF']. '?id='.$_GET['id'].'&gc_year='. $curr_year.'&gc_seme='.$curr_seme;

//取得參數的學年學期
if ($_GET['gc_year'] && $_GET['gc_seme']) {
  $gc_year = $_GET['gc_year'];
  $gc_seme=$_GET['gc_seme'];
} else {
  $gc_year = $curr_year;
  $gc_seme=$curr_seme;
}

if ($gc_seme==2) {
  $last_year = $gc_year;
  $last_seme=1;
} else {
  $last_year=$gc_year-1;
  $last_seme=2;
}

$last_link= $_SERVER['PHP_SELF']. '?id='.$_GET['id'].'&gc_year='. $last_year.'&gc_seme='.$last_seme;


echo '<p align=center>';
if ($gc_year==$curr_year && $gc_seme==$curr_seme) {
// skip
} else {
  echo '<a href='.$curr_link.'>本學期</a> ';
}
echo $gc_year.'學年第'.$gc_seme.'學期轉出一覽表 <a href='.$last_link.'>前一學期</a> </p>';

/**** 建立XOOPS資料庫物件 ****/

$xoopsDB =& Database::getInstance();

/**** 輸出表格開頭 ****/
echo "<table cellSpacing=1 cellPadding=1 align=center bgColor=#ccccff border=1>
<TR>
<TD><Font Color=white>序號</Font></TD>
<TD><Font Color=white>現在年級</Font></TD>
<TD><Font Color=white>現在班級</Font></TD>
<TD><Font Color=white>現在座號</Font></TD>
<TD><Font Color=white>學號</Font></TD>
<TD><Font Color=white>學生姓名</Font></TD>
<TD><Font Color=white>學生生日</Font></TD>
<TD><Font Color=white>證照號碼</Font></TD>
<TD><Font Color=white>異動日期</Font></TD>
<TD><Font Color=white>學校</Font></TD>

</TR>";
$order="order by smb_grad,ABS(smb_class),smb_seat";
$cond="and (stud_study_cond='轉出' or stud_study_cond='出國') ";
$ta = $xoopsDB->prefix("sxs_stud_base");
$tb = $xoopsDB->prefix("sxs_stud_seme_base");
$sql="SELECT smb_sn,smb_grad,smb_class,smb_seat,stud_id,stud_name,stud_birth,stud_person_id from $ta a,$tb b where a.stud_sn=b.stud_sn and smb_year='$gc_year' and smb_seme='$gc_seme' $cond $order";
/**** 執行 SQL語法 ****/
$result = $xoopsDB->query($sql) ;
$sn=0;
while(list($smb_sn,$smb_grad,$smb_class,$smb_seat,$stud_id,$stud_name,$stud_birth,$stud_person_id)=$xoopsDB->fetchRow($result)){

$sql2="select move_y,move_m,move_d,move_school_name from ". $xoopsDB->prefix("sxs_stud_move")." where smb_sn='$smb_sn' order by move_sn desc";

$rs2=$xoopsDB->query($sql2) ;

list($y,$m,$d,$move_school_name)=$xoopsDB->fetchRow($rs2);

$sn++;
echo "<tr bgcolor=white>
<td>{$sn}</td>
<td>{$smb_grad}</td>
<td>{$smb_class}</td>
<td>{$smb_seat}</td>
<td>{$stud_id}</td>
<td>{$stud_name}</td>
<td>{$stud_birth}</td>
<td>{$stud_person_id}</td>
<td>{$y}-{$m}-{$d}</td>
<td>{$move_school_name}</td>

</tr>";
}
echo "</table>";


2017年10月8日 星期日

ITYCX 定位

本來已經不想處理學務系統了

但是有鑑於私立學校還有部分學校要使用,決定再出新版X學務系統的計畫

1. 相容於原來的資料庫,唯一要處理的是Xoop本身

系統需求
Xoops 2.5.8
Mysql 5.0 以上 使用 Mysqli
使用 bootstrap相容樣板
PHP 5.5以上 建議PHP5.6
centOS安裝參考 
  https://webtatic.com/packages/php56/
  https://www.cadch.com/modules/news/article.php?storyid=227

2. 建立一個專用樣板

3. 改善學生資料結構

4. 改用Mysqli

5. 盡量用ajax取代全螢幕的變化

2017年10月7日 星期六

字串轉數值、數值轉字串


字串轉數值

方法一: Number constructor function
var e = '123';
e = Number(e);   // 123

方法二: parseInt() 或 parseFloat()
var e = '123.45abc';
var e1 = parseInt(e, 10);  // 123
var e2 = parseFloat(e);    // 123.45

若無法轉換成數值時,會回傳 NaN (Not A Number)。
var f = 'abc123';
var f1 = Number(f);         // NaN
var f2 = parseInt(f, 10);  // NaN
var f3 = parseFloat(f);    // NaN

數值轉字串

var a=10; a = String(a); alert(typeof a);
var a=10; a = a.toString(); alert (typeof a);

Javascript 參考文

先連結別人的網誌、以後再做自己的

1. 初體驗
2. 變數與常數
3. 基礎資料型態
4. Null undefined
5. parseInt()、parseFloat() 與 Number()
6. 基礎型態轉換
7. 簡單敘述與運算子 、 運算子 (Operator)
8. 邏輯運算子2 、 邏輯運算子1
9. 關係運算子
10. 位元運算子
11. 字串與數字的相乘與相加
12. 字串轉數值、數值轉字串
13. Math ,數學物件 ,數學 (Math)
14. Random
15. 函數 (Function)
16. 事件 (Event)
17. 流程控制 (Flow Control)
18. DOM BOM
19. 視窗 (Window)
20.
21.
22.




範例
1. 利用setTimeout(setInterval)做簡易倒數計時器
2. 手工萬年曆
3. 倒字 flip text
4.
5.
6.
7.
8.
9.
10.





jQuery的載入事件先後


在jQuery中,要做到"等網頁載入後再執行",我們有兩種選擇:
$(document).ready(fn)$(window).load(fn)
二者的差別在於$(document).ready(fn)發生在"網頁本身的HTML"載入後就觸發,而$(window).load(fn)則會等到"網頁HTML標籤中引用的圖檔、內嵌物件(如Flash)、IFrame"等拉哩拉雜的東西都載入後才會觸發。

來源: http://blog.darkthread.net/post-2009-06-05-jquery-ready-vs-load.aspx

瀏覽器物件(5)Location

Location Object Properties

PropertyDescription
hashSets or returns the anchor part (#) of a URL
hostSets or returns the hostname and port number of a URL
hostnameSets or returns the hostname of a URL
hrefSets or returns the entire URL
originReturns the protocol, hostname and port number of a URL
pathnameSets or returns the path name of a URL
portSets or returns the port number of a URL
protocolSets or returns the protocol of a URL
searchSets or returns the querystring part of a URL

Location Object Methods

MethodDescription
assign()Loads a new document
reload()Reloads the current document
replace()Replaces the current document with a new one

瀏覽器物件(4)History

History Object Properties

PropertyDescription
lengthReturns the number of URLs in the history list

History Object Methods

MethodDescription
back()Loads the previous URL in the history list
forward()Loads the next URL in the history list
go()Loads a specific URL from the history list

瀏覽器物件(3)Screen

Screen Object Properties

PropertyDescription
availHeightReturns the height of the screen (excluding the Windows Taskbar)
availWidthReturns the width of the screen (excluding the Windows Taskbar)
colorDepthReturns the bit depth of the color palette for displaying images
heightReturns the total height of the screen
pixelDepthReturns the color resolution (in bits per pixel) of the screen
widthReturns the total width of the screen

2017年10月6日 星期五

瀏覽器物件(2)Navigator

Navigator Object Properties

PropertyDescription
appCodeNameReturns the code name of the browser
appNameReturns the name of the browser
appVersionReturns the version information of the browser
cookieEnabledDetermines whether cookies are enabled in the browser
geolocationReturns a Geolocation object that can be used to locate the user's position
languageReturns the language of the browser
onLineDetermines whether the browser is online
platformReturns for which platform the browser is compiled
productReturns the engine name of the browser
userAgentReturns the user-agent header sent by the browser to the server





瀏覽器物件(1) Window

Window Object Properties

PropertyDescription
closedReturns a Boolean value indicating whether a window has been closed or not
defaultStatusSets or returns the default text in the statusbar of a window
documentReturns the Document object for the window (See Document object)
frameElementReturns the <iframe> element in which the current window is inserted
framesReturns all <iframe> elements in the current window
historyReturns the History object for the window (See History object)
innerHeightReturns the inner height of a window's content area
innerWidthReturns the inner width of a window's content area
lengthReturns the number of <iframe> elements in the current window
localStorageAllows to save key/value pairs in a web browser. Stores the data with no expiration date
locationReturns the Location object for the window (See Location object)
nameSets or returns the name of a window
navigatorReturns the Navigator object for the window (See Navigator object)
openerReturns a reference to the window that created the window
outerHeightReturns the outer height of a window, including toolbars/scrollbars
outerWidthReturns the outer width of a window, including toolbars/scrollbars
pageXOffsetReturns the pixels the current document has been scrolled (horizontally) from the upper left corner of the window
pageYOffsetReturns the pixels the current document has been scrolled (vertically) from the upper left corner of the window
parentReturns the parent window of the current window
screenReturns the Screen object for the window (See Screen object)
screenLeftReturns the horizontal coordinate of the window relative to the screen
screenTopReturns the vertical coordinate of the window relative to the screen
screenXReturns the horizontal coordinate of the window relative to the screen
screenYReturns the vertical coordinate of the window relative to the screen
sessionStorageAllows to save key/value pairs in a web browser. Stores the data for one session
scrollXAn alias of pageXOffset
scrollYAn alias of pageYOffset
selfReturns the current window
statusSets or returns the text in the statusbar of a window
topReturns the topmost browser window


Window Method
MethodDescription
alert()Displays an alert box with a message and an OK button
atob()Decodes a base-64 encoded string
blur()Removes focus from the current window
btoa()Encodes a string in base-64
clearInterval()Clears a timer set with setInterval()
clearTimeout()Clears a timer set with setTimeout()
close()Closes the current window
confirm()Displays a dialog box with a message and an OK and a Cancel button
focus()Sets focus to the current window
getComputedStyle()Gets the current computed CSS styles applied to an element
getSelection()Returns a Selection object representing the range of text selected by the user
matchMedia()Returns a MediaQueryList object representing the specified CSS media query string
moveBy()Moves a window relative to its current position
moveTo()Moves a window to the specified position
open()Opens a new browser window
print()Prints the content of the current window
prompt()Displays a dialog box that prompts the visitor for input
resizeBy()Resizes the window by the specified pixels
resizeTo()Resizes the window to the specified width and height
scroll()Deprecated. This method has been replaced by the scrollTo() method.
scrollBy()Scrolls the document by the specified number of pixels
scrollTo()Scrolls the document to the specified coordinates
setInterval()Calls a function or evaluates an expression at specified intervals (in milliseconds)
setTimeout()Calls a function or evaluates an expression after a specified number of milliseconds
stop()Stops the window from loading