2014年6月19日 星期四

gpedit.msc被群組原則鎖死

為了限制使用者執行不明程式,所以在群組原則(gpedit.msc)設定特定程式,但名單內少了本身,造成無法執行群組原則,以下是不用重新安裝系統的方法,


 解法:將c:\windows\system32\mmc.exe改名為允許可執行的名稱

ps. mmc.exe預設權限不可以改名稱
1.更改擁有者為最高權限, 即可重新命名
2.還原回原擁有者--在"選取使用者或群組"畫面中輸入"NT SERVICE\TrustedInstaller


2014年6月8日 星期日

「翻轉教室」的課程設計

清大彭教授提出對「翻轉教室」課程設計的重要性
http://mhperng.blogspot.tw/2014/06/blog-post_7.html
其中內文提到的文章 節錄於親子天下

感想
過往普遍的教育方式是再次給予知識,而聰明的小孩自然就會讀書朝向菁英學校,(菁英學校一定比較會教?存疑),努力型的小孩只好繼續努力,老天自然會打開一扇窗。

人人都該學「程式設計」的邏輯

程式設計 (Program Coding) 的訓練不再只能以 變數 Variable、運算子  (+,-, *, / )、邏輯運算符號的方式來建構,初瞥見圖形化的程式語言是在2008年時大學專題生的Lego NXT機器人程式設計,時隔數年,2010年時Scratch又再次瞥見。
圖形化的好處在於,讓使用者專注在邏輯設計,也是一個程式能運作成功的關鍵。至於和教育的結合,還需一段時間的反芻,繼續實驗吧。


This video is from TEDxTaipei

2014年3月26日 星期三

2010年10月24日 星期日

檔案大小

-----
[知道檔名]
struct stat statbuf;
int filesize;
stat("copyfile1.txt", &statbuf);
filesize=statbuf.st_size; // bytes
printf("File size=%d bytes\n", filesize);


-----
[FILE *]
long filesize;
fseek(fp, 0L, SEEK_END); //移動到相對END的0L位置 filesize=ftell(fp); //傳回相對開始位置的bytes數 fseek(fp, 0L, SEEK_SET); //移動到絕對位置0L的位置

----
[ps]
fopen(); // If failed, return NULL
open(); // If failed, return -1

2010年10月23日 星期六

無緩衝IO

#include /* Standard input/output definitions */
#include /* String function definitions */
#include /* UNIX standard function definitions */
#include /* File control definitions */
#include /* Error number definitions */
#include /* POSIX terminal control definitions */
#include


#define ENTER 10 /*ASCII code of LF in linux*/
#define MAX 10

int main(void) {
//int fd;
//fd = open("/dev/ttyS0", O_RDWR|O_NOCTTY|O_NDELAY);
int fp, fp2;
char str[MAX],ch;// buffer
int bytes=0;
fp=open("copyfile1.txt", O_RDWR);
fp2=open("output.txt", O_RDWR | O_CREAT, S_IREAD | S_IWRITE);//
if( (fp==-1) || (fp2==-1) )
{
printf("file cannot be opened, fp=%d, fp2=%d\n", fp, fp2);
return 1;
} else {
while( (bytes=read(fp, str, MAX))>0){
write(fp2, str, bytes);//
}
}
close(fp2);//
close(fp);
printf("Copying finish...\n");
return 0;
}