If you want to open a large file in Linux
You can try it
Add those flag into your Makefile
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
Modify you fseek and ftell to fseeko and ftello
Finish
2010年8月25日 星期三
2010年8月10日 星期二
IP的轉換
1、htonl ()和ntohl( )
u_long PASCAL FAR ntohl (u_long netlong);
u_short PASCAL FAR ntohs (u_short netshort);
ntohl( )-----網路順序轉換成主機順序
u_long PASCAL FAR htonl (u_long hostlong);
u_short PASCAL FAR htons (u_short hostshort);
htonl ()-----主機順序轉換成網路順序
2、inet_addr( )和inet_ntoa ( )
unsigned long PASCAL FAR inet_addr (const char FAR * cp);
char FAR * PASCAL FAR inet_ntoa (struct in_addr in);
inet_addr函數需要一個字串作為其參數,該字串指定了以點分十進位格式表示的IP位址(例如:192.168.0.16)。而且inet_addr函數會返回一個適合分配給S_addr的u_long類型的數值。
Inet_ntoa函數會完成相反的轉換,它接受一個in_addr結構體類型的參數並返回一個以點分十進位格式表示的IP位址字串。
u_long PASCAL FAR ntohl (u_long netlong);
u_short PASCAL FAR ntohs (u_short netshort);
ntohl( )-----網路順序轉換成主機順序
u_long PASCAL FAR htonl (u_long hostlong);
u_short PASCAL FAR htons (u_short hostshort);
htonl ()-----主機順序轉換成網路順序
2、inet_addr( )和inet_ntoa ( )
unsigned long PASCAL FAR inet_addr (const char FAR * cp);
char FAR * PASCAL FAR inet_ntoa (struct in_addr in);
inet_addr函數需要一個字串作為其參數,該字串指定了以點分十進位格式表示的IP位址(例如:192.168.0.16)。而且inet_addr函數會返回一個適合分配給S_addr的u_long類型的數值。
Inet_ntoa函數會完成相反的轉換,它接受一個in_addr結構體類型的參數並返回一個以點分十進位格式表示的IP位址字串。
2010年4月7日 星期三
Linux下查詢UTC時間,UTC秒、日期轉換
查詢當下UTC秒
[Shell]date +%s
1270542114
UTC秒轉日期
[Shell]date -d "1970-01-01 UTC 1270538720 seconds"
Tue Apr 6 15:25:20 CST 2010
1270538720 是要轉換的秒
日期轉UTC秒
[Shell]date -d "20100101 00:00:01" +%s
1262275201
紅色部分是要轉換的時間
[Shell]date +%s
1270542114
UTC秒轉日期
[Shell]date -d "1970-01-01 UTC 1270538720 seconds"
Tue Apr 6 15:25:20 CST 2010
1270538720 是要轉換的秒
日期轉UTC秒
[Shell]date -d "20100101 00:00:01" +%s
1262275201
紅色部分是要轉換的時間
2010年3月4日 星期四
2010年2月18日 星期四
JAR Library: Export and Import
- Export Library
- Prepare source code
- Create an Android project
- Create source code, and fix all bug
- Remove res/*
- Remove unused source files
- Edit AndroidManifest.xml to remove the statements that referes to resource, such as android:icon="@drwable/icon", android:label="@string/app_name"
- Export library
- On Package Explorer Panel of Eclipse, right-click the project, and select Export
- Select Jave -> JAR file, then press "Next". At this time a dialog pops up.
- On the right panel of "Select the resources to export:" group, unselect all items (such as .classpath, .project, AndroidManifest.xlm, default.properties), then press "Next"
- Press "Next"
- Press "Finish"
Then the library is created.
(Reference: Eclipse export jar files http://hi.baidu.com/etrigger/blog/item/e1fed134468b2fb2d0a2d3ad.html)
- Prepare source code
- Import Library
You can use a third party JAR in your application by adding it to your Eclipse project as follows:- In the Package Explorer panel, right-click on your project and select Properties.
- Select Java Build Path, then the tab Libraries.
- Press the Add External JARs... button and select the JAR file
Alternatively, if you want to include third party JARs with your package, create a new directory for them within your project and select Add Library... instead.
It is not necessary to put external JARs in the assets folder.
(Reference: http://code.google.com/intl/zh-CN/android/kb/commontasks.html)
2010年1月3日 星期日
Apache2 開啟 .htaccess 功能 & CodeIgniter 移除 index.php
1.一般都是使用.htaccess但是可以設定要依照別的檔案名稱
/etc/apache2/apache2.conf
內的
AccessFileName .htaccess
2.在httpd.conf可以設定要作用的路徑
Options FollowSymLinks
AllowOverride All
/var/www/admin
就是要作用的資料夾
3.載入mod_rewrite以啟用RewriteEngine模組
sudo a2enmod rewrite
4.設定完重開apache2
sudo /etc/init.d/apache2 restart
5.在資料夾放入.htaccess檔案
設定轉換路徑
EX:
RewriteEngine On
RewriteBase /admin
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
上面的/admin對應之前的/var/www/admin
不過他是網路上的第一層資料夾
ex:http://localhost/admin
將.htaccess放到/var/www/admin/
下就好了
以下給CodeIgniter使用
=======================================
如果要把網址後面的index.php取消
上面的步驟照作之外
下面在設定一些東西
config.php
$config['index_page'] = "";
$config['uri_protocol'] = "REQUEST_URI";
大概就這樣吧....
/etc/apache2/apache2.conf
內的
AccessFileName .htaccess
2.在httpd.conf可以設定要作用的路徑
Options FollowSymLinks
AllowOverride All
/var/www/admin
就是要作用的資料夾
3.載入mod_rewrite以啟用RewriteEngine模組
sudo a2enmod rewrite
4.設定完重開apache2
sudo /etc/init.d/apache2 restart
5.在資料夾放入.htaccess檔案
設定轉換路徑
EX:
RewriteEngine On
RewriteBase /admin
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
上面的/admin對應之前的/var/www/admin
不過他是網路上的第一層資料夾
ex:http://localhost/admin
將.htaccess放到/var/www/admin/
下就好了
以下給CodeIgniter使用
=======================================
如果要把網址後面的index.php取消
上面的步驟照作之外
下面在設定一些東西
config.php
$config['index_page'] = "";
$config['uri_protocol'] = "REQUEST_URI";
大概就這樣吧....
2009年1月16日 星期五
網頁禁選取和複製的破解方法
以下方法在IE及Chrome有效 FF我不熟 不能確定
網頁中的滑鼠右鍵鎖定是基於javascript的基礎實作的!以下有個很方便的方法就可以破解它!
在網址中輸入:javascript:void(document.body.oncontextmenu=null)
按一下右鍵,看看是不是可以打開了!
同樣的原理也可以破解掉頁面的“防複製”,“防選取”等限制!以下是代碼:
選取:javascript:void(document.body.onselectstart=null)
複製:javascript:void(document.body.oncopy=null)
貼上:javascript:void(document.body.onpaste=null)
補充:打入:
javascript:void(document.body.oncontextmenu=function(){returnfalse;})
就可以重新鎖定右鍵了!
網頁中的滑鼠右鍵鎖定是基於javascript的基礎實作的!以下有個很方便的方法就可以破解它!
在網址中輸入:javascript:void(document.body.oncontextmenu=null)
按一下右鍵,看看是不是可以打開了!
同樣的原理也可以破解掉頁面的“防複製”,“防選取”等限制!以下是代碼:
選取:javascript:void(document.body.onselectstart=null)
複製:javascript:void(document.body.oncopy=null)
貼上:javascript:void(document.body.onpaste=null)
補充:打入:
javascript:void(document.body.oncontextmenu=function(){returnfalse;})
就可以重新鎖定右鍵了!
訂閱:
文章 (Atom)