Posts

Showing posts from April, 2009

Send Escape Keystroke To Telnet With Java

I had a very hard time trying to figure out how to send "CTRL+A" to a Telent session through Java. (for an AS/400 telnet session). First obstacle was finding what the key mapping was. I found this on midrange.com. "CTRL+A maps to "Escape, A". [ link ] Using TelnetWrapper library here: [ link ] I found the Escape Key value here: [ link ] What confused me at first was the use of the word "Escape" in the Telnet specification. There are special escaped keys that would normally use the TelnetProtocolHandler's sendTelnetControl(byte code) function. This is not the case. Here's how I did it: TelnetWrapper t = new TelnetWrapper(); t.connect(hst, prt); t.waitfor("User . . . . . . . . . . . . . ."); t.send(user + "\t" + pwd); byte[] b = new byte[] {'\033', 'a'}; t.write(b); System.out.println(t.waitfor(" ")); -Tres

Swap Alt + Command Key Ubuntu

For Gnome Users: System --> Preferences --> Keyboard Layouts Tab --> Layout Options Alt/Win Key Behavior --> Left Alt is swapped with Left Win For KDE 4.x Users: System Settings --> Regional and Language Keyboard Layout --> Layout Tab --> Enable Keyboard Layouts Advanced Tab --> Alt/Win key behavior --> Left Alt is swapped with Left Win This will swap your ALT key with the WINDOWS key (also called "Super", "Apple" or "Command"). This is useful for a person who Alt+Tab's on a PC but has since switched to macintosh hardware and is not accustomed to the Macintosh keyboard layout. If you are not using a macintosh keyboard, this *should* have the opposite effect and make a PC keyboard ALT+TAB like a Mac. I never thought to look in the locale settings for KDE, so this took me quite a while to find. Hope it helps others. This works on Ubuntu 8.10, Ubuntu 9.04, Kubuntu 9.04. (Intrepid, Jaunty). This should work for both K...

5 Silk Icons

Image
I've used FamFamFam's CreativeCommons Silk icon set for a while and I've made a few of my own. Here they are for others to share, hosted on Blogger/Picasa and mirrored on ImageShack. [ mirror ] Lotus Domino Server Silk Icon ( server_lotus.png ) [ mirror ] Windows Active Directory Server Silk Icon ( server_windows.png ) [ mirror ] iSeries As/400 Server Silk Icon ( server_as400.png ) [ mirror ] Microsoft Office Visio Silk Icon ( page_white_visio.png ) [ mirror ] Microsoft Office InfoPath Silk Icon ( page_white_infopath.png ) -Tres -Tres

NetBeans CellRenderer JTable

I am trying to assign a setDefaultCellRenderer(..., ...) to my NetBeans projects and all of the answers keep steering me back to "Table Contents --> Columns --> Renderer" and then I am stuck. I was working from this guide and quickly noticed it had no effect on my NetBeans JTable!!! I've been using this guide in non-NetBeans projects with success, but now using the NetBeans IDE it fails. Am I doing something wrong? First of all, there's quite a few people asking this same question: http://forums.netbeans.org/post-871.html http://www.netbeansforum.com/viewtopic.php?f=4&t=26 http://www.nabble.com/JTable-With-ComboBox-(list)-td15324201.html http://www.nabble.com/Cell-renderer-editor-in-Netbeans--td18043645.html http://www.nabble.com/TableCellRenderer-in-netbeans.-td8238826.html#a8240804 http://www.coderanch.com/t/345011/Swing-AWT-SWT-JFace/java/Customize-JTable-NetBeans-GUI-Builder This quick article shed some light on the class types, but chaning my setDef...

Descriptor index not valid

"java.sql.SQLException: Descriptor index not valid." If you are running an SQL query (in this case with Java) against an AS/400 and get the above message, try replacing the code in your resultset loop. Find the line that looks like this: rs.getString(0) And replace with lines like this: rs.getString("PFNMCN"); Notice, the records is being retrieved by name instead of by index. Alternately, you can try: rs.getString(1); The underlying problem is resultset indexes start at [1] instead of [0]. This is confusing as most Java indexes start counting at 0. Hope this helps. What the message should probably say is "resultset index is out of bounds for the returned set". But jt400 is a free driver, so we can live with that message. :) Also note, that if you do "SELECT PFNMCN AS FIRSTNAME...", then your code should read: rs.getString("FIRSTNAME"); This java error message can be confusing at first, but it is a very quick fix! Edit: If you u...