Wednesday, April 25, 2012

Citrix Receiver 3.2 – allow for unsecure “accounts” (Windows)

By default the new Citrix Receiver 3.2 doesn’t seem to allow for unsecure PNAgent URLs, but I managed to find this Citrix KB that tells how to change that through the Windows registry.

* * *

Error: Cannot Process Provisioning File – see Resolution 4 section
http://support.citrix.com/article/CTX132169

To allow Citrix Receiver 3.1 add unsecure accounts complete the following procedure in the Windows registry:

Caution! This procedure requires you to edit the registry. Using Registry Editor incorrectly can cause serious problems that might require you to reinstall your operating system. Citrix cannot guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk. Back up the registry before you edit it.
  1. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\AuthManager
    (for 64-bit machines, navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Citrix\AuthManager)
  2. Create a new String value called ConnectionSecurityMode.
  3. Set the value to Any.
  4. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\Dazzle
    (for 64-bit machines, navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Citrix\DazzleB)
  5. Modify the String value called AllowAddStore to A.
* * *
Download - Windows 64bit .reg
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Citrix\AuthManager]
"ConnectionSecurityMode"="Any"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Citrix\Dazzle]
"AllowAddStore"="A"
 



Citrix Receiver 3.2

---------------------------
Citrix Receiver
---------------------------
The account URL must use the https:// prefix. This prefix assures a secure connection.
---------------------------
OK   
---------------------------

Citrix Receiver 4.1

---------------------------
Add Account
---------------------------
Please enter a secure server address that begins with HTTPS.
---------------------------
OK   
---------------------------

Friday, April 20, 2012

Google Public DNS

 What is Google Public DNS?

Google Public DNS is a free, global Domain Name System (DNS) resolution service, that you can use as an alternative to your current DNS provider.

To try it out:

  • Configure your network settings to use the IP addresses 8.8.8.8 and 8.8.4.4 as your DNS servers or
  • Read our configuration instructions.

New! For IPv6 addresses, see our configuration instructions.

If you decide to try Google Public DNS, your client programs will perform all DNS lookups using Google Public DNS.

Wednesday, April 18, 2012

Oracle Configuration Manager

oracle-logo

Among other things I manage this Oracle 11.1.0.6.0 Win32 instance we use for development that I’ve been trying to get it patched for ages – finally getting a hold on the CSI (Customer Support Identifier), getting my account setup at http://support.oracle.com,  I could finally start looking for the patches.

Apparently the old online patching system through the Oracle Enterprise Manager (OEM) might have been scrapped (requires a Metalink account and goes to http://updates.oracle.com) and now they have this Oracle Configuration Manager utility to gather the information from your system and uploading it into your web support account, leaving you with the download and the actual patching.

From what I see in the video tutorial it also keeps track on the configuration changes, so if you’re having problems you can compare points in time and see what has changed meanwhile (that should come in handy), as well as creating support requests right from there (that should be quite useful to Oracle support people having access to all that information about your system).

My installation already had an %ORACLE_HOME%\ccr folder with an older version of the OCM, I just renamed that to .old and extracted the new version in a new ccr folder (apparently the OCM package is actually a zip inside a zip?!). Ran setupCCR.exe and the rest of the stuff to get it up and running (see link below to Managing Oracle blog post, a short version of the OCM installation steps from Oracle documentation). Once that done you will see a new OracleOraDb11g_home1ConfigurationManager Windows service that apparently will look for configuration changes on daily basis and upload them into your Support account.

I could see then the information up on support.oracle.com and easily find the patches for my system, from the Patch Recommendation panel – in my case Patch 8970709: ORACLE 11G 11.1.0.6 PATCH 18 BUG FOR WINDOWS 32 BIT. You can also get recommendations by drilling down to the instance level in a Target Health panel, broken down by severity with detailed information upon selection.

Well, now waiting for the weekend to apply it (and hopefully not breaking too many things :-), I’ll make sure to read the patch README in detail and definitely backup the ORACLE_HOME and the C:\Program Files\Oracle folders – I must confess I don’t like Oracle software very much, I found it quite fiddly and broken down in so many pieces, with looking for details on a problem a bit of a nightmare, far from easy compared say to the likes of Microsoft SQL, but I guess Windows is not really their primary target, nor untrained developers :-)

* * *

eSeminar - Why Use The Configuration Manager In My Oracle Support for IT – detailed video on OCM features and integration with Oracle Support web console
http://ilearning.oracle.com/ilearn/en/learner/jsp/offering_details_home.jsp?classid=673705452

Download Oracle Configuration Manager – access from support.oracle.com account > Collector
https://support.oracle.com/CSP/ui/flash.html#tab=Collector(page=Collector&id=h16si3di())

Managing Oracle blog - Using Oracle Configuration Manager – details on how to install / configure OCM and taking the initial collection
http://managingoracle.blogspot.com/2010/09/using-oracle-configuration-manager.html

Patching using My Oracle Support
http://docs.oracle.com/cd/E11857_01/em.111/e16599/pat_mosem.htm

* * *

Oracle Support - Configuration Manager download

Oracle Support - Patches & Updates

Oracle Support - Patch Recommendations

Oracle Support - Patch Recommendations - Instance

Oracle Support - Patch Recommendations - Instance - Health

Monday, April 16, 2012

Java - String.format(), Formatter.format(), StringUtils performance

I’m re-writing a module I wrote a few years ago to improve performance and meet the customer requirements – we’re talking about up to 200.000 XML messages per day, with 90 messages / sec at peak times, to get an idea about how many times these methods are being called, every bit of wasted time / resources is considerably multiplied.

I’ve already done various things like reducing number of operations and waste in objects being created, but now I’m down to lower level inner parts.

Been using TreeMaps to cache some search data and avoid trips to the database, and the first implementation was using multi-keyed objects (containing multiple string keys) and comparator classes; although it was nice using typed objects as map keys it was on the other hand a bit wasteful and slower. I’ve since changed those to plain “packed” string keys, to reduce the number of objects being created, with the disadvantage of loosing the typing in the process, but it does run faster.

I did mention in the previous post that I’ve used recently VisualVM to sample application activity and spotted that these little pack() methods took somewhat an unusual amount of time - still looking in reducing the number of operations, but I said hey let’s see if they can be improved with little effort.


What the code does is fairly straight forward, takes multiple strings (“a” - “b” - “c”) and packs them all together into a padded, upper-cased string key, keeping the field lengths as in the database. That to ensure the resulting keys can be ordered and searched using get() and subMap() methods.

Although been using Apache Commons Lang packages for years now and if using Maven in Eclipse you can always look at the sources to see how exactly they do things, I chose String.format() as it should be faster, right? Well, apparently I wasn’t right. Started writing a simple performance test to compare with Formatter and then I thought lets add a StringUtils implementation and see how it fares…

First, it just seems that String.format() was the slowest and StringUtils was the fastest! And second, String.format() is not so bad in Java 7 (although it might not seem so as the tests seem to run in different order).

Java HotSpot 6
(1.6.0_31 x64)
Win 2008 R2 SP1 x64
Java HotSpot 7
(1.7.0_03 x64)
Win 2008 R2 SP1 x64
String.format() 110 ms 63 ms
Formatter.format() 47 ms 94 ms
StringUtils 15 ms 16 ms

I repeated the tests a few times and although obviously timings change slightly between runs, but StringUtils is consistently a few times faster. Obviously the test doesn’t measure in any way the garbage collection costs and have no idea how it will fare in the application performance tests just yet, but does promise a slight improvement with little code changes.

Posting the code for review, in case I’m missing something – using junit-4.10.jar and commons-lang-2.6.jar (http://search.maven.org/).
import java.util.Formatter;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.StopWatch;
import org.junit.BeforeClass;
import org.junit.Test;

public class PerfTest {
  /**
   * Constants
   */
  private int MAX_COUNT = 1000;
  
  /**
   * 
   */
  @BeforeClass
  public static void javaInfo() {
      System.out.println(String.format("java version \"%s\"", System.getProperty("java.version")));
      System.out.println(String.format("%s (build %s)",       System.getProperty("java.vm.name"), System.getProperty("java.vm.version")));
      System.out.println();
  }
  
  /**
   * String.format() test
   */
  @Test
  public void test1() {
    StopWatch stopWatch = new StopWatch();
    stopWatch.start();
    
    String result = StringUtils.EMPTY;
    for (int i = 0, n = MAX_COUNT; i < n; i++) {
      result = String.format("|%-5S|%-10S|%-15S|", "a", "bb", "ccc");
    }
    
    stopWatch.stop();
    System.out.println("String.format()    = " + result);
    System.out.println("Execution time     = " + stopWatch.toString());
    System.out.println();
  }
  
  /**
   * Formatter.format() test
   */
  @Test
  public void test2() {
    StopWatch stopWatch = new StopWatch();
    stopWatch.start();
    
    String result = StringUtils.EMPTY;
    for (int i = 0, n = MAX_COUNT; i < n; i++) {
      Formatter formatter = new Formatter();
      result = formatter.format("|%1$-5S|%2$-10S|%3$-15S|", "a", "bb", "ccc").toString();
    }
    stopWatch.stop();
    System.out.println("Formatter.format() = " + result);
    System.out.println("Execution time     = " + stopWatch.toString());
    System.out.println();
  }
  
  /**
   * StringUtils test
   */
  @Test
  public void test3() {
    StopWatch stopWatch = new StopWatch();
    stopWatch.start();
    
    String result = StringUtils.EMPTY;
    for (int i = 0, n = MAX_COUNT; i < n; i++) {
      result = '|' + StringUtils.rightPad(StringUtils.upperCase("a"),    5)
             + '|' + StringUtils.rightPad(StringUtils.upperCase("bb"),  10)
             + '|' + StringUtils.rightPad(StringUtils.upperCase("ccc"), 15)
             + '|';
    }
    stopWatch.stop();
    System.out.println("StringUtils        = " + result);
    System.out.println("Execution time     = " + stopWatch.toString());
    System.out.println();
  }
}

Sunday, April 15, 2012

MySQL – logging SQL statements

mysql-logo

Using recently MySQL (5.5.23) in a project to persist JBoss JMS messages (among other things), I wanted to see if any slow or un-indexed queries were issued, and apparently the database server allows to log those through a simple change in my.ini configuration file.

  • log-slow-queries[=file_name]
    If not specifying a file name, it will create a HOSTNAME-slow.log; in my case (Windows 2008 R2) the log was created in C:\ProgramData\MySQL\MySQL Server 5.5\data
  • long_query_time
    Queries taking longer than specified amount of seconds will get logged.
  • log-queries-not-using-indexes
    Logs queries not using indexes or performing a table / index scan.
my.ini
#
# Slow queries
#
log-slow-queries
long_query_time = 1
log-queries-not-using-indexes

I found a small un-indexed query on JMS_USERS - although a small table of only 5 records, it does get issued repeatedly so I’ve added an index for it.

# User@Host: jboss[jboss] @ localhost [127.0.0.1]
# Query_time: 0.000000  Lock_time: 0.000000 Rows_sent: 0  Rows_examined: 5
SET timestamp=1334525528;
SELECT JMSUSERID, PASSWD, CLIENTID FROM JMS_USERS WHERE CLIENTID='ID:1';

Also found a SELECT COUNT(*) query that was basically scanning the table - I could remove this one by changing mysql-ds.xml from using a <check-valid-connection-sql> statement to using <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>

# User@Host: jboss[jboss] @ localhost [127.0.0.1]
# Query_time: 0.000000  Lock_time: 0.000000 Rows_sent: 1  Rows_examined: 5
SET timestamp=1334525528;
SELECT COUNT(JMSUSERID) FROM JMS_USERS;

If you want to log all queries there’s another parameter for that, placing all queries in HOSTNAME.log, very helpful in improve performance further by simply reducing the amount of operations.

my.ini
#
# All queries
#
general-log = 1

Friday, April 13, 2012

JXplorer - Java LDAP Browser

http://jxplorer.org/

JXplorer is an open source ldap browser originally developed by Computer Associates' eTrust Directory development lab. It is a standards compliant general purpose ldap browser that can be used to read and search any ldap directory, or any X500 directory with an ldap interface. It is available for immediate free download under a standard OSI-style open source licence.




Microsoft Control Spy 2.0

http://www.microsoft.com/download/en/details.aspx?id=4635

Control Spy is a tool to help developers understand common controls, the application of styles to them, and their response to messages and notifications.

Control Spy Exposes the Clandestine Life of Windows Common Controls
http://www.microsoft.com/msj/0798/controlspy.aspx

Microsoft Control Spy

Thursday, April 12, 2012

JBoss 4.2.3 with VisualVM

I have recently been involved in implementing and testing our application in a high volume / high performance customer case, where I thought I might try using VisualVM to see the JVM in action and find potential bottlenecks, like where would most of the CPU usage would go (the module I’m writing is a big CPU hog) as well as maybe latency issues caused by inadequate garbage collector settings.

The screenshots below are taken from a much smaller test environment where I just ran a quick test, but I have been able to use the tool in the customer environment where we were able to identify occasional high CPU usage with garbage collection (the blue line in the CPU area, left) as well as OutOfMemory problems due to the default garbage collection strategies (notice the erratic/irregular shapes in heap usage on the right side) - both can be addressed by adjusting the garbage collector strategy for low pause, concurrency (using -XX:+UseConcMarkSweepGC and -XX:+UseParNewGC parameters, see "before" and "after" screenshots below).

Also we found high CPU usage on certain application threads that now we can focus to optimize the code in those areas, they are not part of these screenshots, but I might post separately on that. Also from the threads graph is visible we have a high number of threads  with a short life span, probably around the JMS connectivity area that we’re still investigating.

I’m nowhere even close to being an expert on these things, I’m still learning the stuff, but since I struggled a bit to get the JMX enabled with JBoss 4.2.3, though I might share the findings others might find useful and why not even got some more qualified suggestions from you, the readers out there.
We’re using the Java Service Wrapper (just to give you another example of how to use the parameters) and these are the settings I used to allow for remote JMX connectivity (the port is your choice really):
wrapper.java.additional.14=-Djavax.management.builder.initial=org.jboss.system.server.jmx.MBeanServerBuilderImpl
wrapper.java.additional.15=-Djboss.platform.mbeanserver
wrapper.java.additional.16=-Dcom.sun.management.jmxremote
wrapper.java.additional.17=-Dcom.sun.management.jmxremote.port=9999
wrapper.java.additional.18=-Dcom.sun.management.jmxremote.ssl=false
wrapper.java.additional.19=-Dcom.sun.management.jmxremote.authenticate=false
Once setup you can just run VisualVM and point it to localhost:9999 if you’re going to do the monitoring locally, although probably for a high performance environment you might want to run VisualVM from another machine, so it doesn’t affect the environment too much. Just as well, with the JMX enabled you can probably use that from a monitoring application and set warning thresholds for things like free JVM memory, high CPU usage etc.

VisualVM seems to be quite a capable tool (not to mention easy on the eye), giving you real time information through the graphs, being able to take memory dumps to analyze offline (with say the likes of Eclipse Memory Analyzer), perform garbage collection, take thread dumps, look at active / dead threads or run a CPU sampler to see the top consumer threads.


Monday, April 9, 2012

How to change Windows network location

Just found that one of my home computers using a static IP address was configured as “Public network” and for that reason not allowing access to shares. Although you can see from the screenshots is running Windows 8, I’m pretty sure the same works for Windows 7 as well.

Solution originally found here:
http://serverfault.com/questions/9376/is-it-possible-to-change-an-unidentified-network-into-a-home-or-work-netwo


Run Local Security Policy editor (secpol.msc) and navigate to Network List Manager Policies and find the network you want to change – for some reason, although the computer is wired, the network tooks the name of the router’s wi-fi SSID.


Double click the entry (Properties) and change location type – you can also change its name in there if you prefer (1st tab).


Refresh (F5) screen and voila, now I can just go and make sure file sharing is enabled for Private networks.


Sunday, April 8, 2012

VMware Player - Windows XP Mode

Trying to convert a Windows XP Mode Virtual PC image to run in VMware Player 4.0.2, the embedded feature failed on me although I do have the VMware vCenter Converter Standalone 5.0 working fine.

The "VMware vCenter Converter Standalone" product is not configured properly for use with VMware Player.


A ProcMon trace didn’t show much, I see it cannot find some registry keys for the product CLSID; found the log file, but not much help.

Using the standalone converter on its own works just fine.


But later when running the VM, it will ask for Windows activation.


From what I understand XP Mode actually works, it uses differential disks on top of the base image, which is supposed to contain an already activated Windows copy.

Apparently the solution is quite simple, maybe something the VM import should have done.
http://communities.vmware.com/message/1458537#1458537

Edit the .vmx file and add this parameter:
xpMode.enabled=TRUE

Wednesday, April 4, 2012

Windows Command: How to get the script path

I had to do this a few times every now and then and I always forget the syntax, but I do remember how to get it: from for /? help.

%~0 is the first parameter, which is the full path of the script; ~dp0 will give you the drive and path without the filename, e.g. echo "%~dp0"

You can obviously also set that into a working environment variable and use it throughout the script.

Windows Command - script path

TortoiseSVN installation: “insufficient privileges”

You are an administrator, you were either asked to elevate or ran the installer “as administrator” yourself, but still getting this error:

The installer has insufficient privileges to access this directory: C:\Program Files\TortoiseSVN\bin.
The installation cannot continue. Log on as administrator or contact your system administrator

TortoiseSVN - insufficient privileges

Well, it might have nothing to do with the privileges, but rather with the fact that the TSVNCache.exe is still running when the installer is trying to replace it with a new version.

TSVNCache - ProcExp

I guess you got two options here:
  1. kill the process and push the retry button, where you might need to logoff and log back in (or restart) to get the process back, or
  2. first change the option in TortoiseSVN Settings > Icon overlays > Status Cache from Default to Shell, in which case it might need to kill your Explorer as part of the installation.
Personally I prefer the first one, haven't seen any problems with it.

TortoiseSVN - Settings - Icon Overlays