Archive for the 'tutorial' Category

how to let qtwebkit open https page

After downloaded and installed Qt SDK for Windows 4.6.2, the first time, I tried the famous example, fancybrowser, it is no problem to open http://www.google.com/ncr, but when I clicked the Gmail link on the Google home page, I got the following error message,
QSslSocket: cannot call unresolved function SSLv3_client_method
QSslSocket: cannot call unresolved function SSL_CTX_new
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function ERR_get_error
QSslSocket: cannot call unresolved function ERR_error_string

After a quick search, I noticed OpenSSL is not installed, so needs an OpenSSL for Windows. I tried Win32 OpenSSL and GnuWin OpenSSL for Windows, both works.
For Win32 OpenSSL, just download Win32 OpenSSL v1.0.0 Light or Win32 OpenSSL v0.9.8n Light(both need Visual C++ 2008 Redistributables), install it(i used Universal Extractor unpack them then copy libeay32.dll and ssleay32.dll to windows system folder). For GnuWin OpenSSL for Windows, just download openssl-0.9.8h-1-bin.zip then extract libeay32.dll and libssl32.dll to windows system folder or mingw bin folder (installed with qt).

P.S.
The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well as a full-strength general purpose cryptography library.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • ThisNext
  • MisterWong
  • Wists
  • BlinkList
  • blogmarks
  • blogtercimlap
  • connotea
  • DotNetKicks
  • Fark
  • Fleck
  • Gwar
  • Haohao
  • IndianPad
  • Internetmedia
  • LinkaGoGo
  • MyShare
  • Netscape
  • NewsVine
  • Rec6
  • Reddit
  • Scoopeo
  • Slashdot
  • StumbleUpon
  • Technorati
  • Webride

How to install HP Color LaserJet 2605dn driver under 64bit Windows 7

This week my boss bought a new PC for me with the Intel Core i3 processor and 4G memory, and it is the first time I have chance to use 64bit Windows 7. Windows 7 recognizes most hardware drivers, so I have no trouble to install driver until today.
Today when I wanted to print the Western Union Quick Cash from Google Adsense, I found I have not installed the printer driver, HP Color LaserJet 2605dn PCL6(installed on Windows 2003 32 bit server), I do the same steps as Windows XP, but failed, no driver to use. After a quick search, I got HP Universal Print Driver for Windows PCL6 x64. I can successfully installed it as local printer driver, but still failed to install it from network.
Continued to search, and have no answer, then I though how about for Vista 64-bit? then I got HP Color LaserJet 2605 PCL6 Plug and Play package, and it really works.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • ThisNext
  • MisterWong
  • Wists
  • BlinkList
  • blogmarks
  • blogtercimlap
  • connotea
  • DotNetKicks
  • Fark
  • Fleck
  • Gwar
  • Haohao
  • IndianPad
  • Internetmedia
  • LinkaGoGo
  • MyShare
  • Netscape
  • NewsVine
  • Rec6
  • Reddit
  • Scoopeo
  • Slashdot
  • StumbleUpon
  • Technorati
  • Webride

How to Use Google App Engine UrlFetch API to download the files over 1M

Nick Johnson said,

Currently, API calls are limited to 1MB, but requests and responses are limited to 10M. If you want to permit larger files, you could split them up into chunks and store them in the datastore. The 30 second request limit applies only to the time your code spends processing the request, not time sent receiving the request or sending the response.
A large file API is on our roadmap, which will make handling large files from users much easier.

I offer the UrlFetch function in my PDF Password Remover Online application, but I do not want to let it only manipulate no more 1M PDF, after some study, I got the solution, let UrlFetch API download no more 1M data each time, but repeat many times until all data downloaded, of course, there still a limit, 30 second request limit.

public static byte[] download(String url) throws IOException, InterruptedException {

ArrayList al=new ArrayList();

HttpURLConnection httpConn = null;
int seg=1024*1000;
int startPosition=0;

try {
URL u = new URL(url);

for(;;)
{
int endPosition=startPosition+seg;

httpConn = (HttpURLConnection) u.openConnection();
httpConn.setRequestMethod("GET");
httpConn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14");
httpConn.setRequestProperty("Range", "bytes=" + startPosition + "-"+endPosition);
httpConn.connect();

InputStream in = httpConn.getInputStream();
byte[] b=Util.toByteArray(in);//IOUtils.toByteArray(in);
al.add(b);
startPosition+=b.length;
if(b.length break;
}
ArrayList temp = new ArrayList();
for(byte[] b : al)
{
for (int i = 0; i temp.add(b[i]);
}
}
return Util.saveBytesArrayListTobytesArray(temp);
} finally {
httpConn.disconnect();
}
}

Share and Enjoy:
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • ThisNext
  • MisterWong
  • Wists
  • BlinkList
  • blogmarks
  • blogtercimlap
  • connotea
  • DotNetKicks
  • Fark
  • Fleck
  • Gwar
  • Haohao
  • IndianPad
  • Internetmedia
  • LinkaGoGo
  • MyShare
  • Netscape
  • NewsVine
  • Rec6
  • Reddit
  • Scoopeo
  • Slashdot
  • StumbleUpon
  • Technorati
  • Webride