公告版位
新版Blog peichengnote

目前分類:CODE (61)

瀏覽方式: 標題列表 簡短摘要

Lab 14 - Git Immersion - Brought to you by EdgeCase
http://gitimmersion.googol.im/lab_14.html#main_content

Git一步一步學習~



peicheng 發表在 痞客邦 留言(0) 人氣()

How to change App ID in Inline Translator - miya.pe.kr
http://miya.pe.kr/2012/01/23/how-to-change-app-id-in-inline-translator/



peicheng 發表在 痞客邦 留言(0) 人氣()

IE下Select InnerHTML的问题 | 实践.最佳 - 行.思.悟
http://fwso.cn/notes/ie%E4%B8%8Bselect-innerhtml%E7%9A%84%E9%97%AE%E9%A2%98/



peicheng 發表在 痞客邦 留言(0) 人氣()

Dennis Ritchie: 1941-2011 C語言之父
http://www.muppetlabs.com/~breadbox/rip-dmr.html


#include <stdio.h>

int main()
{
printf("goodbye, dad\n");
文章標籤

peicheng 發表在 痞客邦 留言(0) 人氣()

line 10: Function eregi() is deprecated

use perg_match

preg_match("/^[[:alpha:].' -]{2,15}$/i",$str);




peicheng 發表在 痞客邦 留言(0) 人氣()

fopen update use r+ mode

"r+" Open a file for update both reading and writing. The file must exist.


fopen - C++ Reference
http://www.cplusplus.com/reference/clibrary/cstdio/fopen/



peicheng 發表在 痞客邦 留言(0) 人氣()

PCNewPixnet Expand PIXNET album
昨天晚上趁著無名從兩點開始維修到早上十點,
想了好幾天,終於趁這個時候。
改了一下 Expand PIXNET album extension
在firefox 跟chrome上都能使用。

而且會自動調成看大圖的張數跟大小。

Expand PIXNET album

peicheng 發表在 痞客邦 留言(0) 人氣()


首先這是期末考一個很容易Google到的題目,但是還是很多人沒做,甚至是課本都有的東西了。


#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#define PERMS 0666


peicheng 發表在 痞客邦 留言(0) 人氣()

>>> ['%d-%02d' % (i/12, (i%12)+1) for i in xrange(2008*12+8-1, 2011*12+6)]

['2008-08', '2008-09', '2008-10', '2008-11', '2008-12', '2009-01', '2009-02', '2009-03', '2009-04', '2009-05', '2009-06', '2009-07', '2009-08', '2009-09', '2009-10', '2009-11', '2009-12', '2010-01', '2010-02', '2010-03', '2010-04', '2010-05', '2010-06', '2010-07', '2010-08', '2010-09', '2010-10', '2010-11', '2010-12', '2011-01', '2011-02', '2011-03', '2011-04', '2011-05', '2011-06']



文章標籤

peicheng 發表在 痞客邦 留言(0) 人氣()


之前有幫通識中心弄一次性的相簿,
後來使用JetPhoto 來產生但是免費版的只有能5次。

想一想只好自己土砲一下,
先用XnView縮圖成應該放的資料夾,
套用JetPhoto的那些JS,
所以只要改index.html內的

<div><p><a rel="lightbox[jetphoto]"  href="1024x768/DSC_0019.JPG" title=""><img src="128x128/DSC_0019.JPG" /></a></p></div>

文章標籤

peicheng 發表在 痞客邦 留言(0) 人氣()

剛好在pycn的mail list看到Flash Message,
查了一點資料,
原來就是,做完一些動作,會存在session內,
然後顯示出來做了什麼的動作。

類似,
"已經成功插入了1筆資料"

Django中的flash message - maplye - ITeye技术网站
http://maplye.iteye.com/blog/419966

peicheng 發表在 痞客邦 留言(0) 人氣()

Writing/Saving an Image (The Java™ Tutorials > 2D Graphics > Working with Images)
http://download.oracle.com/javase/tutorial/2d/images/saveimage.html

FLASHC: [java]getRGB()
http://flashc.blogspot.com/2009/05/javagetrgb.html

[java]getRGB()

getRGB()返回默认 sRGB ColorModel 中表示颜色的 RGB 值。(24-31 位表示 alpha,16-23 位表示红色,8-15 位表示绿色,0-7 位表示蓝色)。

peicheng 發表在 痞客邦 留言(0) 人氣()

这是 RealWorldPython for learnner~大蟒本色 — RWPy4learner v11.3.30 documentation
http://shellexy.info/books/obp.rwpy4learner/html/index.html



peicheng 發表在 痞客邦 留言(0) 人氣()

在GAE上使用服务器推(Channel API)+聊天室示例
http://www.keakon.net/2010/12/03/%E5%9C%A8GAE%E4%B8%8A%E4%BD%BF%E7%94%A8%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%8E%A8%EF%BC%88ChannelAPI%EF%BC%89+%E8%81%8A%E5%A4%A9%E5%AE%A4%E7%A4%BA%E4%BE%8B



peicheng 發表在 痞客邦 留言(0) 人氣()

 

The raise statement allows the programmer to force a specified exception to occur. For example:

>>> raise NameError('HiThere')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
NameError: HiThere

 

The sole argument to raise indicates the exception to be raised. This must be either an exception instance or an exception class (a class that derives from Exception).

8. Errors and Exceptions — Python v2.7.1 documentation
http://docs.python.org/tutorial/errors.html#raising-exceptions


peicheng 發表在 痞客邦 留言(0) 人氣()

星期三早上,
順手寫了一個。
在blog側邊欄加上了一個靜思語。

每一次開blog都可以看一句新的靜思語,
並且把他收集起來。




peicheng 發表在 痞客邦 留言(0) 人氣()

因為要grep binary file某個欄位不能grep

所以寫了小python script

 


file1=open('rr010','r');

line=file1.readline()
#for lineA in file1.readline():
while line:
    #print line,
    if line.startswith('@H:'):
        print line,

    line=file1.readline()


peicheng 發表在 痞客邦 留言(0) 人氣()

binary search 折半查找

#include<stdlib.h>
#include<stdio.h>
#define NELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
int numarray[] = {123, 145, 512, 627, 800, 933};
int numeric (const int *p1, const int *p2){
    return(*p1 - *p2);
}

int lookup(int key){
    int *itemptr;
    /* The cast of (int(*)(const void *,const void*))
       is needed to avoid a type mismatch error at
       compile time */
    itemptr = (int *)bsearch (&key, numarray, NELEMS(numarray),
            sizeof(int), (int(*)(const void *,const void *))numeric);
    return (itemptr != NULL);
}


int main(void){
    if (lookup(512)){
        printf("512 is in the table.\n");
    }
    else{
        printf("512 isn't in the table.\n");
    }
    return 0;
}

peicheng 發表在 痞客邦 留言(0) 人氣()

發現自己要寫的很長程式,用vim寫還沒有這麼熟悉。
使用一下好用的IDE才能好debug。

在win下配置NetBeans

安装和配置 C/C++ 支持 - NetBeans IDE 6.0 教程
http://netbeans.org/community/releases/60/cpp-setup-instructions_zh_CN.html

如果已在 Windows 系统中安装了 Cygwin GNU 编译器、GNU make 和 gdb 调试器,并且在 Path 变量中正确设置了可以找到它们的路径,请确保使用的是正确版本。如果安装了正确版本,则无需再进行设置。

peicheng 發表在 痞客邦 留言(0) 人氣()

[Linker error] undefined reference to `__dyn_tls_init_callback'

出現這個錯誤,
原來是之前有裝MinGW把他更名之後就好了。



peicheng 發表在 痞客邦 留言(0) 人氣()