Sebastian Thomschke
IT Freelancer – Java, J2EE, IBM WebSphere Portal, Lotus Notes/Domino-
Determine the user who logged on via SSH
Today we had the need to determine the initial id of a user who logged onto a Linux box via SSH and executed the su command. When the su command is issued the effective user is changed and whoami or id commands will report that new user id instead.
For anyone who is interested, that is what we came up to put the initial user id into a variable named ${LOGIN_USER}
LOGIN_USER=`who -m`; LOGIN_USER=${LOGIN_USER%% *}or alternatively
LOGIN_USER=`who -m | cut -d' ' -f1`
-
Lotus Notes’ [Send only] and [Send and File] buttons for Outlook 2003
You can say what you want about Lotus Notes, if you have used it for a while and switched e.g. to Outlook, you’ll find yourself missing one or the other nifty Notes function.
Already two of my customers “forced” me to use MS Outlook 2003 and since this isn’t likely to change in the near future, I implemented two of these handy Notes functions for Outlook 2003:
- The button [Send only] sends e-mails without storing a copy of it in the local mailbox.
- The button [Send and File...] prompts you for the folder where to store the e-mail being send.
Installation:
- Download the Visual Basic module in the favored language.
Send Mail Macros for MS Outlook 2003 (EN) (4.9 KiB, 675 hits)
Send Mail Macros for MS Outlook 2003 (DE) (5.1 KiB, 381 hits)
- In Outlook open the Visual Basic editor.

- Import the Visual Basic module.
- Save the project.
- Install the buttons in the toolbar.
- When composing a new e-mail the additional buttons should appear in the toolbar.
- When clicking “Send and File…” the folder dialog is displayed before the e-mail is send.

-
getpass for Jython
In my current project I am developing some Jython based command line tools and had the need for masking passwords entered in the command shell. Python provides the getpass module for this purpose. Unfortunately this module has not been made available for Jython.
Here comes a module I wrote to provide this kind of functionality. It uses the mechanism described here http://java.sun.com/developer/technicalArticles/Security/pwordmask/ to mask characters entered at the command prompt. Additionally if Java 6 or higher is running Jython the module will instead use the new Console.readPassword() method. In case the module is running in an environment where the getpass module is available it will delegate to the corresponding methods of this module instead of using its own implementations.
# ext_getpass.py # @author Sebastian Thomschke, http://sebthom.de/ import thread, sys, time, os # exposed methods: __all__ = ["getpass","getuser"] def __doMasking(stream): __doMasking.stop = 0 while not __doMasking.stop: stream.write("b*") stream.flush() time.sleep(0.01) def generic_getpass(prompt="Password: ", stream=None): if not stream: stream = sys.stderr prompt = str(prompt) if prompt: stream.write(prompt) stream.flush() thread.start_new_thread(__doMasking, (stream,)) password = raw_input() __doMasking.stop = 1 return password def generic_getuser(): for name in ('LOGNAME', 'USER', 'LNAME', 'USERNAME'): usr = os.environ.get(name) if usr: return usr def java6_getpass(prompt="Password: ", stream=None): if not stream: stream = sys.stderr prompt = str(prompt) if prompt: stream.write(prompt) stream.flush() from java.lang import System console = System.console() if console == None: return generic_getpass(prompt, stream) else: return "".join(console.readPassword()) try: # trying to use Python's getpass implementation import getpass getpass = getpass.getpass getuser = getpass.getuser except ImportError, e: getuser = generic_getuser # trying to use Java 6's Console.readPassword() implementation try: from java.io import Console getpass = java6_getpass except ImportError, e: # use the generic getpass implementation getpass = generic_getpassHere is an usage example:
import ext_getpass as getpass pw = getpass.getpass("Please enter your password:") print "The entered password was: " + pw -
WebSphere Portal 6.1.0.0 does not support installation on a managed node
With WebSphere Portal 5.1 a new deployment option was introduced that allowed the installation of WP onto an existing node managed by a deployment manager. AFAIK the main reason for this new option was to simplify the cluster setup procedure.
Both options, installing WP standalone and federating it into a cell afterwards as well as installing it on an already managed node have different pros and cons each. In WP 6.0 the installation onto a managed node was even mandatory to enable WebSphere Process Server integration.
Surprisingly WP6.1.0.0 does not support the installation on a managed node anymore. All nodes of a cluster need to be installed as standalone systems first and then be federated into a WebSphere cell.
For WP 6.0 the installation procedure is described here. The 6.1 info center does not mention this procedure anymore and it no, it was not dropped accidentally.
-
[Solved] Blank Pages with Wordpress 2.6.x
After upgrading to Wordpress 2.6 it occasionally happend that an empty page was displayed in the browser when navigating through the blog or working in the admin area. Refreshing the browser using CTRL+F5 usually helped in that case. Today I upgraded to Wordpress 2.6.2 and I was not able to access the plug-ins page of the admin area anymore. No matter how often I refreshed the page in the browser it stayed blank.
First I searched the web for possible solutions. I found quite a number of discussions giving tips about this widely known problem but unfortunately none of these solutions helped in my case.
So I again started debugging the Wordpress code and finally found the lines of code causing the trouble. The problem are (object) casts in the wp-includes/taxonomy.php file that transform an array into an object:$wp_taxonomies['category'] = (object) array('name' => 'category', 'object_type' => 'post', 'hierarchical' => true, 'update_count_callback' => '_update_post_term_count'); $wp_taxonomies['post_tag'] = (object) array('name' => 'post_tag', 'object_type' => 'post', 'hierarchical' => false, 'update_count_callback' => '_update_post_term_count'); $wp_taxonomies['link_category'] = (object) array('name' => 'link_category', 'object_type' => 'link', 'hierarchical' => false);Since I don’t get any error messages neither on the screen nor in the log files I have no idea why these casts fail. The PHP version used to serve the site is the latest stable 5.x release from php.net.
As a workaround I introduced a function that does also transforms an array into an object but does not rely on the casting mechanism.function arr2obj($arr) { foreach ($arr as $k => $v) $obj -> {$k} = $v; return $obj; } $wp_taxonomies['category'] = arr2obj(array('name' => 'category', 'object_type' => 'post', 'hierarchical' => true, 'update_count_callback' => '_update_post_term_count')); $wp_taxonomies['post_tag'] = arr2obj(array('name' => 'post_tag', 'object_type' => 'post', 'hierarchical' => false, 'update_count_callback' => '_update_post_term_count')); $wp_taxonomies['link_category'] = arr2obj(array('name' => 'link_category', 'object_type' => 'link', 'hierarchical' => false)); -
Peter Nalitch – Guitar
Some weeks ago we had two IT consultants from Russia on-site. Unfortunately one of them introduced me to a – to me so far – hidden part Russian culture: the song Guitar from Peter Nalitch. The consultant said that the song eats his brain … Well, I could not have said it better. I too can’t get it out of my mind anymore.
If you have not heard it before, you can enjoy it now:
The original version


Looking for a high performer for your next IT project?



English
Deutsch
Recent Comments