2007年9月25日星期二

HideLinks - Shorten long web addresses and hide bookmarks with a password! favorites-links. export-favorites. add-favorites. favourites-manager.




这个网站可以将某个网页的地址转化为一个较短的加了密URL地址,通过www.hidelinks.com跳转到原来的网页。有什么用呢,这样你就可以将某个网页收藏,而别人却不知道这个网页的真正的地址,除非知道密码,所以你可以收藏很多不想让别人知道的网页地址。

2007年9月23日星期日

Copy File in C/C++

How to copy file in C/C++ or rename a file?
1) Use System command.
system("copy sourcefile.txt destinyfile.txt");

2)
#include
#include

int main() {
std::ifstream infile("src.dat", std::ios_base::binary);
std::ofstream outfile("dest.dat", std::ios_base::binary);
outfile << infile.rdbuf(); }

3)

使用copy函数,file.copy("fromfile.txt","toFile.txt");

4) Simple C/C++ Perfometer: Copying Files (Versions 4.x)
http://groups.google.com/group/perfo/msg/8a74465da4c4e9bb
上面是最详细的使用各种方法进行文件拷贝的介绍,以及速度测试。

2007年9月19日星期三

In Class defined Function are inline function

今天看 《The C++ Programming Language》,提到一个以前没有注意的问题,就是将函数的定义放在类的定义中,没有inline关键字,但是仍然为inline函数,所以只能将短小的经常使用的函数放在类的定义中。

另外,如果inline函数的调用超过上万次,可能会导致编译出来的代码过长,程序体积过大。

2007年9月14日星期五

MoinMoin Wiki 的源代码加亮功能

要像使用{{{#!LanguageName LanguageSource}}}来加亮里面的语法,需要到MoinMoinWiki的网站上下载一些py文件。
http://moinmoin.wikiwikiweb.de/ParserMarket

找到文件后(如找到sql.py, xml.py等等),将这些py文件拷贝到你的wiki目录下的data/plugin/parser
目录下,就可以了。

2007年9月13日星期四

http://www.dynamicdrive.com/


Welcome to Dynamic Drive, the #1 place on the net to obtain free, original DHTML & Javascripts to enhance your web site! Including:
Online Tools
Support Us


http://www.dynamicdrive.com/

uncaught exception: Permission denied to call method XMLHttpRequest.open

使用Ajax进行请求时得到这样的错误,浏览器为Firefox。
这里有一个解释:
http://www.captain.at/howto-ajax-permission-denied-xmlhttprequest.php
If you want to do cross-domain scripting with XMLHttpRequest, e.g. fetching data from a remote location but you're on a local page or local XUL application (file:///), you need to tell Mozilla/Firefox about that, otherwise you get the infamous error:
Error: uncaught exception: Permission denied to call method XMLHttpRequest.open
意思就是说请求外部的一个url的时候,浏览器需要特别的授权。
xmlHttpRequest is not "allowed" to connect to a different website from the one it is running on.

其它的页面也有一些解决方案,就是将浏览器的安全等级降低。
http://blog.monstuff.com/archives/000262.html

但是这个问题实际上无法解决,如果你就是想请求外部的某个连接返回的地址的话。

Compare cURL Features with Other Download Tools

几种下载工具的比较,包括:
curl;snarf ; wget ; pavuk ; fget ; fetch ; lftp ; aria2c;
http://curl.haxx.se/docs/comparison-table.html

The mentioned tools: snarf, wget, pavuk, fget, lftp, aria2c.

curl

Manual -- curl usage explained

Related:
Man Page
FAQ
LATEST VERSION

You always find news about what's going on as well as the latest versions
from the curl web pages, located at:

http://curl.haxx.se

SIMPLE USAGE

Get the main page from Netscape's web-server:

curl http://www.netscape.com/

Get the README file the user's home directory at funet's ftp-server:

curl ftp://ftp.funet.fi/README

Get a web page from a server using port 8000:

curl http://www.weirdserver.com:8000/

Get a list of a directory of an FTP site:

curl ftp://cool.haxx.se/

Get the definition of curl from a dictionary:

curl dict://dict.org/m:curl

Fetch two documents at once:

curl ftp://cool.haxx.se/ http://www.weirdserver.com:8000/

Get a file off an FTPS server:

curl ftps://files.are.secure.com/secrets.txt

or use the more appropriate FTPS way to get the same file:

curl --ftp-ssl ftp://files.are.secure.com/secrets.txt

Get a file from an SSH server using SFTP:

curl -u username sftp://shell.example.com/etc/issue

Get a file from an SSH server using SCP using a private key to authenticate:

curl -u username: --key ~/.ssh/id_dsa --pubkey ~/.ssh/id_dsa.pub \
scp://shell.example.com/~/personal.txt


DOWNLOAD TO A FILE

更多内容请查看官方网站上的
http://curl.haxx.se/docs/manual.html

2007年9月12日星期三

JavaScript Error : form submit is not a function under Firefox

The main reason for this error is that the firefox browser is confused.
There must be an input named "submit":
name="submit" value="1">


so that the browser doesnot know it should action on this button or submit the form.

SOLUTION:
change the input's name into something else.

全角到半角转换的 JavaScript 函数。


function whole2half(text)
{
var txt = "";
for(var i=0; i var c = text.charCodeAt(i);
if (c >= 0xff01 && c <= 0xff5e) // ASCII 0x21 - 0x7e
txt += String.fromCharCode(0x21 + c - 0xff01);
else if(c == 0x3000) //space
txt += " ";
else
txt += text.charAt(i);
}
return txt;
}

2007年9月11日星期二

RSS Reader - RSS 阅读器的编写

需要增加自己的网站内容,如使用ASP编写一个从某个固定位置读取RSS内容的模块,大致就是下载RSS,解析,输出。

在网上搜索了一下,下面是几个链接。
ASP Based RSS Reader
Taken from http://www.weather.gov/alerts/wwarssget.php?zone=NJZ026 mm

Here is an excellent example of simple coding. Added to our intranet to show recent changes to our Open Wiki

http://www.openwiki.com/ow.asp?p=ASP_Based_RSS_Reader&a=print

A MegaTokyo RSS Feed Reader (ASP)
by John Peterson

The other day, one of my favorite online comics, MegaTokyo, finally added an RSS feed. Being the MT junkie that I am, I instantly decided that I needed to put this on my start page.

If you're not familiar with RSS, you might find XML Files's RSS section helpful.

As I've mentioned in the past, because I spend so much of my time in a browser, I've taken the time to build my own customized start page that runs on my local web server. It contains a number of things that I use on a fairly regular basis. These include search forms for my favorite search engines, a page containing dns, ip addresses, and connection details for my servers, links to sites I visit daily, links to my router config screens, etc. So what's the point? The point is that now it's going to contain the latest headlines from MegaTokyo as well.
Why MegaTokyo?

There are RSS feeds for everything these days. So why did it take me this long to write an ASP script to read one? Simple... because I'm lazy and until now there wasn't a feed I wanted on my homepage. Why did I use classic ASP instead of ASP.NET? Two reasons: there are already scripts everywhere to do this in ASP.NET, and my homepage is still running on classic ASP. I know I could easily convert it, but I think the answer to the first question already adequately covers why I haven't.

To be honest, there's nothing special about the code... it'll work with most any RSS feed. I've done a few things specific to MegaTokyo's feed (like replacing
s with
s for XHTML compliance), but there's really no reason you couldn't use this script with any RSS feed. In fact, we use a very similar script on our homepage to pull in the headlines from DevX's .NET feed. (Before you write, asking me to add headlines for your site, please note that DevX is also owned by Jupitermedia).

http://www.asp101.com/articles/john/megatokyo/default.asp
kwRSS: RSS Reader & Writer
The main aim of this project is to allow easy manipulation of RSS (RDF Site Summary) files, both writing and reading them, in 2 version, the widely used version 0.91 (in FullXML, PHP-nuke, etc), and the latest official version 1.0 (based on RDF specifications by W3C).

kwRSS became popular as it seems to be the only free RSS reader/writer for ASP, it has also been mention in the book "The ABC of Seo" by David George (Lulu Press, February 28, 2005).

kwRSS is made up of 2 ASP classes, one for the reader and the other for the writer. Information on how to used them are in the provided example files in the zip file, easy to understand.

The RSS feeds that are generated are RSS/RDF complaint, and a proof is by clicking on the following link to validate the test feed:

http://www.kattanweb.com/webdev/projects/index.asp?ID=7

2007年9月6日星期四

TinyMCE - web based HTML Editor

http://tinymce.moxiecode.com/

TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under LGPL by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances. TinyMCE is very easy to integrate into other Content Management Systems.


这里是一个例子。

GEOCODE 住所・地名 to Lat Lng

位置参照技術を用いたツールとユーティリティ
http://pc035.tkl.iis.u-tokyo.ac.jp/~sagara/geocode/

本サイトは、東京大学空間情報科学研究センターが提供する「CSVアドレスマッチングサービス」および「シンプルジオコーディング実験」の紹介と使い方を説明します。これらのサービス・実験を初めてご利用の際には、必ず一度下の「CSVアドレスマッチングサービスの紹介」および「シンプルジオコーディング実験の紹介」をご一読下さい。

また、右上の「新規登録」からユーザ登録していただくと、サービス停止などのお知らせをメールで受信したり(設定が必要です)、ご自分のサイトなど関連リンクを追加することができます。

街区レベル位置参照情報
http://nlftp.mlit.go.jp/ksj/

国土数値情報
http://nlftp.mlit.go.jp/isj/

2007年9月5日星期三

开源界面库 Open Source Ultimate Toolbox

http://www.codeproject.com/MFC/#Open+Source+Ultimate+Toolbox

We are very happy to announce that we have made the decision to offer our commercial lineup of MFC libraries, including Ultimate Toolbox, Ultimate Grid, and Ultimate TCP/IP to The Code Project community free of charge.

These are the full and complete libraries including source code, documentation, samples and examples.

The Ultimate Toolbox and line of related MFC libraries products have been powering professional MFC applications for more than 10 years. We realize that there is a very large number of users who are still coding new applications in Visual C++ and MFC and who are looking for effective and proven libraries to enhance their applications, as well as those with legacy

Ultimate Toolbox, Ultimate Grid and Ultimate TCP/IP come with full source code, and are compatible with Microsoft Visual Studio versions 6.0 through 2005.

By releasing these long standing MFC libraries to The Code Project community we hope that the libraries will continue to grow, evolve and provide a library of useful controls to the development community through the auspices of The Code Project and its members.

iText.NET - Free PDF Library for .NET Framework

http://www.ujihara.jp/iTextdotNET/en/index.html


What's iText .NET

iText, Java-PDF library, is developed by Mr. Bruno Lowagie, Mr. Paulo Soares and co-workes. This library is available under MPL/LGPL license. iText .NET is iText poring on .NET Framework by J#.

In addition, GNU Classpath, JUnit, and Xerces are ported on the way. Refer iText.NET as an example of transferring Java to .NET.

There are several iText port available. Try iTextSharp and original iText on IKVM along with iText.NET. I recommend you to use iTextSharp for a new .NET project. I'm also using iTextSharp.

2007年9月1日星期六

在ASP中得到网址域名的命令

get host name by asp's visual basic functions.

host=lcase(request.servervariables("HTTP_HOST"))


这样就可以得到HOST名字,例如 www.google.com 或者 localhost:8080

我这样做是为了在网站中的不同二级域名下使用google maps api。
有了上面的函数就可以根据二级域名选择不同的google maps api的key了。

参考网址:http://www.learnasp.com/freebook/asp/server2.aspx