Recent Notes
Displaying notes 21 - 30
Created by Dr. Xi on February 09, 2010 03:56:11
Last update: February 09, 2010 04:31:07
From Oracle Database JDBC Developer's Guide : The JDBC Thin client is a pure Java, Type IV driver. It is lightweight and easy to install. It provides high performance, comparable to the performance provided by the JDBC Oracle Call Interface (OCI) driver. The JDBC Thin driver is written entirely in Java, and therefore, it is platform-independent. Also, this driver does not require any additional Oracle software on the client-side. From Java Programming with Oracle JDBC : The important thing to notice about the graph is that it's not until about 65 inserts that the PreparedStatement object outperforms the Statement object. 65 inserts! Clearly, the Statement object is more efficient under typical use when using the OCI driver. you'll see that the Thin driver follows the ...
Created by meiu on February 09, 2010 03:26:14
Last update: February 09, 2010 03:26:44
Simple JDBC code for Oracle. import java.sql.*; public class JDBCHelloWorld { public static void main(String args) throws Exception { Connection conn = null; try { // register Oracle JDBC driver with DriverManager Class.forName("oracle.jdbc.driver.OracleDriver"); // get a connection to the database conn = DriverManager.getConnection( "jdbc:oracle:thin:@localhost:1521:XE", "scott", "tiger"); // construct a Statement Statement stmt = conn.createStatement(); // run query ResultSet rs = stmt.executeQuery("SELECT 'Hello World' FROM DUAL;"); // iterate through the result set while (rs.next()) { System.out.println(rs.getString(1)); } } finally { // always close JDBC connection in a finally block! if (conn != null) conn.close(); } } }
Created by voodoo on February 08, 2010 04:57:49
If you don't want to open an extra port for VNC or want extra security with SSH, you can setup an SSH tunnel for VNC. On Windows, you can do this with Putty or openssh . Open a command window, and enter (using Putty as example): C:\local\bin\plink.exe -ssh -2 -L localhost:5901:remote_host:5901 -l username -pw password remote_host -N When connecting with vncviewer , use localhost:5901 as server instead of remote_host:5901 . If you use the setup frequently, it is more convenient to setup the tunnel as a Windows service . Assuming the name of the service is vnc_tunnel , the registry entry would look like: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vnc_tunnel\Parameters] "Application"="C:\\local\\bin\\plink.exe" "AppDirectory"="C:\\local\\bin" "AppParameters"="-ssh -2 -L localhost:5901:remote_host:5901 -l user_name -pw password remote_host -N"
Created by voodoo on February 08, 2010 04:36:31
Last update: February 08, 2010 05:10:57
If you have X server on the client side, you can run remote desktop with XDMCP . But XDMCP is not secure, and it's somewhat tricky to tunnel XDMCP through ssh. So if you are concerned about security, VNC is a much better choice. Plus vncviewer is a lot easier to set up than X server. There are two options to set up VNC server: VNC vino-server Many Linux distros come with remote desktop server installed. On Fedora Core, you can simply set the configuration from the Desktop menu (Desktop -> Preferences -> Remote Desktop), and use vncviewer from the client machine to access the desktop remotely. Install RealVNC or TightVNC and configure it yourself You need to change ~/.vnc/xstartup in order to see the ...
Created by voodoo on February 07, 2010 23:33:23
Last update: February 08, 2010 03:04:47
I installed vncserver on my Fedora box and tried to connect to it with vncviewer from Windows XP. I got this error: What could be the problem? These were the steps I took to diagnose it. I just list them here as a reminder. Is Windows firewall blocking the connection? No. It turned out that, unlike ZoneAlarm , the Windows firewall does not block outgoing traffic. It only blocks incoming requests. Is vncserver listening on the right IP address? Yes. netstat showed it's listening on all NICs. netstat -a | grep 5901 tcp 0 0 *:5901 *:* LISTEN Is VNC port open on the local Fedora box on that IP address? Yes, telnet successfully connected: [jim@fedora ~] telnet 172.30.33.9 5901 Trying 172.30.33.9... Connected to 172.30.33.9 ...
Created by voodoo on February 07, 2010 06:18:47
Last update: February 07, 2010 22:41:38
To start vncserver : # with default screen size of 1024x768 vncserver # start with display #2 vncserver :2 # with increased size of 1280x1024 vncserver -geometry 1280x1024 To stop vncserver (for display #1): vncserver -kill :1 The first time you start vncserver , it asks you to create a password. To change vncserver password : vncpasswd
Created by voodoo on February 07, 2010 06:11:53
Use the F8 key to enter and exit full screen mode for RealVNC vncviewer .
Created by voodoo on February 07, 2010 05:48:55
Error Message: Error activating XKB configuration Probably internal X server problem X server version data: The XFree86 Project, Inc 40300000 You are using XFree 4.3.0 There are known problems with complex XKB configurations. Try using simpler configuration or taking more fresh version of XFree software. If you report this situation as a bug, pleas include: - The result of xprop -root | grep XKB - The result of gconftool-2 -R /desktop/gnome/peripherals/keyboard/xkb Answer from RealVNC : Hi, VNC Free Edition 4.1.2 doesn't provide the XKB extension. The fact that that causes parts of Gnome to crash or report errors seems to be a bug in Gnome - X applications should not in general assume the presence of X extensions unless they are incapable of operating without ...
Created by voodoo on February 07, 2010 04:59:36
Last update: February 07, 2010 05:01:41
From X(7) manual page : Although the layout of windows on a display is controlled by the window manager that the user is running (described below), most X programs accept a command line argument of the form -geometry WIDTHxHEIGHT+XOFF+YOFF (where WIDTH, HEIGHT, XOFF, and YOFF are numbers) for specifying a preferred size and location for this application's main window. The WIDTH and HEIGHT parts of the geometry specification are usually measured in either pixels or characters , depending on the application. The XOFF and YOFF parts are measured in pixels and are used to specify the distance of the window from the left or right and top and bottom edges of the screen, respectively. Both types of offsets are measured from the indicated edge of ...
Created by voodoo on February 06, 2010 17:37:38
While hotmail and Yahoo mail have "traditional" anti-virus scans for attachments, it's a disappoint to find that Gmail blocks attachments by extension! I simply cannot understand how can the genius minds at Google consider this an effective "solution": genuinely good behaving executables are blocked simply because they are honestly named, while rogue agents can pass the inspection by simply changing their file extensions! References: Gmail Help - Zipped Attachments Trick Gmail Antivirus Scanner: Send Any File Type with Gmail. (.exe, .dll, .com, .bat)