Monday 28 August 2017

Send Custom Values in MQ Message Header

Scenario

You want to send custom name-value data with your IBM MQ message. This will allow you to pass application state information. This is useful when you want to change the behaviour of your application without affecting other domain-specific data  for example can be picked up by another for application or another flow in your application.

Solution 


You can use the MQRFH2 header to send your information. In this example, I've added the variable SAPInterface which has the value 'STCKORDERS'.

 SET OutputRoot.MQRFH2.usr.SAPInterface='STCKORDERS';   

NB: The order in which you build your messages is important!

 The XMLNSC value can only be added after the MQMD Header and the MQRFH2 Header part. Getting the order wrong will cause your flow to throw exceptions (sample shown at the bottom of this post).

Below is some sample code where I create test messages that belong to a message group, and the MQRFH2, and MQMD headers are in the correct order.

 CREATE COMPUTE MODULE CreateMessages_Create_Message  
      CREATE FUNCTION Main() RETURNS BOOLEAN  
      BEGIN  
           DECLARE MSGNUM INT 0;  
           DECLARE MSGTOTAL INT 1;  
           WHILE MSGNUM < MSGTOTAL DO  
                SET MSGNUM = MSGNUM + 1;  
                CALL CopyMessageHeaders();  
                -- Manually set the groupId since we cant ask the queue manager to generate one.  
                -- the UUIDASBLOB function could be used here to generate one, but this must be done  
                -- outside the loop to keep the same groupId throughout!  
                     SET OutputRoot.MQRFH2.usr.SAPInterface='STCKEVCH';  
                SET OutputRoot.MQMD.GroupId = X'000000000000000000000000000000000000000000000001';  
                SET OutputRoot.MQMD.MsgSeqNumber = MSGNUM;  
                SET OutputRoot.MQMD.MsgFlags = MQMF_MSG_IN_GROUP;  
                IF (MSGNUM = MSGTOTAL) THEN  
                     SET OutputRoot.MQMD.MsgFlags = MQMF_LAST_MSG_IN_GROUP;  
                END IF;  
                     -- SET OutputRoot.XML.TestCase = MSGNUM;  
                SET OutputRoot.XMLNSC.value='**Message ' || CAST( MSGNUM AS CHARACTER);  
                LOG USER TRACE VALUES(2950,OutputRoot.XMLNSC.value );  
                PROPAGATE;  
           END WHILE;  
           RETURN FALSE;  
      END;  


Observed Preferred Order


The Order of the elements in your message should be

  1. MQMD
  2. MQRFH2
  3. XMLNSC
 (there are other segments that aren't shown, I'm just jotting down what I have. Please comment and I will improve this list.

Incorrect Order Exception 


You will see and error like below if you build your messages in the incorrect order.

"Exception. BIP2230E: Error detected whilst processing a message in node 'test.CreateMessages.Create Message'. : /build/S1000_slot1/S1000_P/src/DataFlowEngine/SQLNodeLibrary/ImbComputeNode.cpp: 515: ImbComputeNode::evaluate: ComIbmComputeNode: test/CreateMessages#FCMComposite_1_2 BIP2488E: ('test.CreateMessages_Create_Message.Main', '30.4') Error detected whilst executing the SQL statement ''PROPAGATE FINALIZE DEFAULT DELETE DEFAULT;''. : /build/S1000_slot1/S1000_P/src/DataFlowEngine/ImbRdl/ImbRdlStatementGroup.cpp: 792: SqlStatementGroup::execute: : BIP2230E: Error detected whilst processing a message in node 'test.CreateMessages.Send to Queue'. : /build/S1000_slot1/S1000_P/src/DataFlowEngine/TemplateNodes/ImbOutputTemplateNode.cpp: 303: ImbOutputTemplateNode::processMessageAssemblyToFailure: ComIbmMQOutputNode: test/CreateMessages#FCMComposite_1_4 BIP4694E: The message received at output node 'test.CreateMessages.Send to Queue' contains an MQMD at index '2' which is the wrong position; the MQMD should be at index '1'. : /build/S1000_slot1/S1000_P/src/DataFlowEngine/Connectors/lib/ImbOutputNode.cpp: 941: ImbOutputNode::checkForMQMDinHeaderChain: ComIbmMQOutputNode: test/CreateMessages#FCMComposite_1_4 "

Monday 6 March 2017

Annotations of JAXB classes using Annox for Polymorphism


Introduction

I'm using a version 1.99 version of Jackson, which is a JSON binding framework that comes with JBOSS EAP server. I have come across this use cases that I have JSON Rest services for which I want to use PolyMorphism. By default, this isn't possible with JSON. You need to annotate your generated classes to get Polymorphism. For my project, we are using JAXB databindings, and luckily, Jackson can consume JAXB annotations as well.

Scope

I will demonstrate how I got Polymorphism to work with JAXB and JACKSON.

Schema


 <?xml version="1.0" encoding="UTF-8"?>  
 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"  
      targetNamespace="http://www.example.org/NewXMLSchema" xmlns:tns="http://www.example.org/NewXMLSchema"  
      xmlns:annox="http://annox.dev.java.net" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"  
      elementFormDefault="qualified" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"  
      jaxb:version="1.0" jaxb:extensionBindingPrefixes="xjc annox">  
      <xs:element name="Holder">  
           <xs:complexType>  
                <xs:sequence>  
                     <xs:element ref="tns:myParent" minOccurs="0" maxOccurs="unbounded">  
                     </xs:element>  
                </xs:sequence>  
           </xs:complexType>  
      </xs:element>  
      <xs:element name="myParent" type="tns:Parent">  
      </xs:element>  
      <xs:complexType name="Parent" abstract="true">  
           <xs:sequence>  
                <xs:element name="surname" type="xs:string"></xs:element>  
           </xs:sequence>  
      </xs:complexType>  
      <xs:element name="Child">  
           <xs:complexType>  
                <xs:complexContent>  
                     <xs:extension base="tns:Parent">  
                          <xs:sequence>  
                               <xs:element name="Firstname"></xs:element>  
                          </xs:sequence>  
                     </xs:extension>  
                </xs:complexContent>  
           </xs:complexType>  
      </xs:element>  
      <xs:element name="Child2">  
           <xs:complexType>  
                <xs:complexContent>  
                     <xs:extension base="tns:Parent">  
                          <xs:sequence>  
                               <xs:element name="secondChild"></xs:element>  
                          </xs:sequence>  
                     </xs:extension>  
                </xs:complexContent>  
           </xs:complexType>  
      </xs:element>  
 </xs:schema>   


Saturday 26 March 2016

Configuring Log4j for JBOSS EAP 6 (and probably 7) and using log4j.MDC


This tutorial covers 2 items:
  • Jboss application-specific log4j configuration
  • Using MDC parameters to make reading logs easier

Background


Reading the logs from a multi-user server application is quite difficult, especially when many users are using it and traffic volumes are high.

As a support person looking after production environments, one woud like to have a way of easily viewing the logs for a particular transaction while the server is live. Also as a development aid,  a developer would like to get easy to read logs from the support person who's logged a production defect.

Having this ability will help you trouble-shoot issues faster, and make your life a lot easier. Obviously, before you can get to this stage, you need to correctly configure your logging.

JBoss Log4j configuration


Generally you could just ship your JEE application with its own log4j file, and after configuring it to use its own class-loader, it should be good enough for production use (if you don't intend changing your log levels frequently). How this is done is described here.

However, what happens if you want to change the log level or reconfigure the logging method for example? You would need to change you log4j config file, which means the rebuild and deploy cycle needs to happen.

In addition you would lose the ability to manage the logging from the JBOSS Server's Administration Web console, which is definitely handy in a production environment. As I will show you below, configuring the logging on the server is pretty straightforward, and you should be up and running within 10 minutes.

Log4j MDC Usage

My application has an RestEasy interceptor which checks the request for a sessionId parameter in the HTTP header. If its not there I generate a UUID which will uniquely identify the transaction. Using this value, I set a parameter called “sessionId” in the log4j MDC hashmap; this information can be made to  appear on every logging line for that transaction. This will make it much easier to read the logs in a multi-threaded environment as shown later. You can use any parameter you want to in the MDC, e.g. subscriber number, account number etc and as many parameters as you wish in any combination.

Tested Platforms

This was tested on Jboss EAP 6.3+ and 6.4

Log4j Configuration Steps

This configuration is done via the jboss command-line.



1.  Log into the admin console



[kiren@saraswati:bin]cd /home/kiren/app/jboss/EAP-6.4.6/bin
[kiren@saraswati:bin]./jboss-cli.sh
    You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
[disconnected /] connect
[standalone@localhost:9999 /] 

2.  Run the following 2 commands to create the SCP logger handler.



/subsystem=logging/periodic-rotating-file-handler=MY_SUPER_APP:add(file={"path"=>"mySuperApp.log", "relative-to"=>"jboss.server.log.dir"}, suffix=".yyyy.MM.dd")
/subsystem=logging/periodic-rotating-file-handler=MY_SUPER_APP:write-attribute(name="formatter",value="%d{HH:mm:ss,SSS} (%t) {%X{sessionId}} %-5p [%c{1}] %s%E %n")



This adds the following to the standalone.xml file:

 <periodic-rotating-file-handler name="MY_SUPER_APP">  
    <formatter>  
      <pattern-formatter pattern="%d{HH:mm:ss,SSS} (%t) {%X{sessionId}} %-5p [%c{1}] %s%E %n"/>  
    </formatter>  
    <file relative-to="jboss.server.log.dir" path="mySuperApp.log"/>  
    <suffix value=".yyyy.MM.dd"/>  
 </periodic-rotating-file-handler>  
Then run the following 4 commands:
/subsystem=logging/logger=com.supercoder.superApp:add
/subsystem=logging/logger=com.supercoder.superApp:write-attribute(name="level",value="DEBUG")
/subsystem=logging/logger=com.supercoder.superApp:write-attribute(name="use-parent-handlers", value="true")
/subsystem=logging/logger=com.supercoder.superApp:assign-handler(name="MY_SUPER_APP")

The following will be added to standalone.xml:
 <periodic-rotating-file-handler name="MY_SUPER_APP">  
    <formatter>  
      <pattern-formatter pattern="%d{HH:mm:ss,SSS} (%t) {%X{sessionId}} %-5p [%c{1}] %s%E %n"/>  
    </formatter>  
    <file relative-to="jboss.server.log.dir" path="mySuperApp.log"/>  
    <suffix value=".yyyy.MM.dd"/>  
 </periodic-rotating-file-handler>  
3. All your application logging for package com.supercoder.superApp will appear in the mySuperApp.log file.
4. Here's an extract from the file



    13:23:20,276 (http-localhost/127.0.0.1:7080-1) {ceef921d-a256-454b-bac3-534994909fc7} DEBUG [UserService] Querying LDAP for username:account10554
    13:23:20,318 (http-localhost/127.0.0.1:7080-1) {ceef921d-a256-454b-bac3-534994909fc7} DEBUG [LdapDao] Searching online10554
    13:23:20,361 (http-localhost/127.0.0.1:7080-1) {ceef921d-a256-454b-bac3-534994909fc7} DEBUG [ConfigDao] ldap.ad.search.base:dc=mydev,dc=opt
    13:23:20,382 (http-localhost/127.0.0.1:7080-1) {ceef921d-a256-454b-bac3-534994909fc7} DEBUG [LdapDao] Entries found 0


Where
  • (http-localhost/127.0.0.1:7080-1) is the thread name 
  • {ceef921d-a256-454b-bac3-534994909fc7} is the unique sessionId. 
  • Note that the classname is without the package, this is achieved by specifying the depth of 1 in the pattern [%c{1}]
6. NB: You need to restart the server for the changes to take effect.
7. If you know the sessionId/transactionId of the request you're looking for, you would just use:
tail -f ../log/mySuperApp.log | grep ceef921d-a256-454b-bac3-534994909fc7


MDC Interceptor Code


This is an extract of the interceptor code in my REST application. You would need to write the appropriate interceptor for your application of course:)


 @Provider  
 @ServerInterceptor  
 public class LogInterceptor implements PreProcessInterceptor,  
 PostProcessInterceptor {  
 Logger logger = Logger.getLogger(LogInterceptor.class);  
 .  
 @Context  
 private HttpServletRequest servletRequest;  
 .  
 .  
 public ServerResponse preProcess(HttpRequest request,  
 ResourceMethod resourceMethod) throws Failure,  
 WebApplicationException {  
 String sessionId = extractSessionInHeader(request);  
 MDC.put("sessionId", sessionId);  
 servletRequest.setAttribute(REQUEST_START_TIME,  
 System.currentTimeMillis());  
 return null;  
 }  
 /**  
 * Retrieves the Session Id from the Header.  
 * If not, generates a UUID  
 * @param request  
 * @return  
 */  
 private String extractSessionInHeader(HttpRequest request) {  
 String sessionId;  
 List requestHeader = request.getHttpHeaders().getRequestHeader(  
 "sessionId");  
 if (requestHeader!=null && requestHeader.size() >= 1)  
 sessionId = requestHeader.get(0);  
 else  
 sessionId = UUID.randomUUID().toString();  
 return sessionId;  
 }  
Of course, how, and with which variables you populate the MDC hashmap is up to you. Remember also that the MDC is thread-local, so its safe to use in a multi-threaded server environment.

Management Console


The above configuration will result in the following views on the management console.

Periodic Rotating File Appender

 Here is the Rolling file appender.



Log Categories

Our category of  com.supercode.superApp is present in this view. The current log level is set at DEBUG.

 Log Level Modification


The log levels an be changed here to effect logging at a different level. There are more levels than log4j has, I'm assuming its mapped to the log4j equivalents.


As can be seen, these items could be created from the console, but I find using the CLI is the quickest and easiest.

Conclusion


Hopefully this helps you configure you log4j with JBOSS easily. Also the MDC usage will definitely help you get the most out of your logging.

Happy Coding!

Final Logging Subsystem XML


 <subsystem xmlns="urn:jboss:domain:logging:1.4">  
 <console-handler name="CONSOLE">  
 <level name="INFO" />  
 <formatter>  
 <named-formatter name="COLOR-PATTERN" />  
 </formatter>  
 </console-handler>  
 <periodic-rotating-file-handler name="FILE"  
 autoflush="true">  
 <formatter>  
 <named-formatter name="PATTERN" />  
 </formatter>  
 <file relative-to="jboss.server.log.dir" path="server.log" />  
 <suffix value=".yyyy-MM-dd" />  
 <append value="true" />  
 </periodic-rotating-file-handler>  
 <periodic-rotating-file-handler name="MY_SUPER_APP">  
 <formatter>  
 <pattern-formatter  
 pattern="%d{HH:mm:ss,SSS} (%t) {%X{sessionId}} %-5p [%c{1}] %s%E %n" />  
 </formatter>  
 <file relative-to="jboss.server.log.dir" path="MY_SUPER_APP.log" />  
 <suffix value=".yyyy.MM.dd" />  
 </periodic-rotating-file-handler>  
 <logger category="com.arjuna">  
 <level name="WARN" />  
 </logger>  
 <logger category="org.apache.tomcat.util.modeler">  
 <level name="WARN" />  
 </logger>  
 <logger category="org.jboss.as.config">  
 <level name="DEBUG" />  
 </logger>  
 <logger category="sun.rmi">  
 <level name="WARN" />  
 </logger>  
 <logger category="jacorb">  
 <level name="WARN" />  
 </logger>  
 <logger category="jacorb.config">  
 <level name="ERROR" />  
 </logger>  
 <logger category="org.switchyard">  
 <level name="INFO" />  
 </logger>  
 <logger category="org.picketlink">  
 <level name="TRACE" />  
 </logger>  
 <logger category="org.jboss.as.quickstarts">  
 <level name="DEBUG" />  
 </logger>  
 <logger category="org.jboss.weld.ClassLoading">  
 <level name="DEBUG" />  
 </logger>  
 <logger category="org.apache.deltaspike.core.api.provider.BeanManagerProvider">  
 <level name="ERROR" />  
 </logger>  
 <logger category="com.supercoder.superApp" use-parent-handlers="true">  
 <level name="DEBUG" />  
 <handlers>  
 <handler name="MY_SUPER_APP" />  
 </handlers>  
 </logger>  
 <root-logger>  
 <level name="INFO" />  
 <handlers>  
 <handler name="CONSOLE" />  
 <handler name="FILE" />  
 </handlers>  
 </root-logger>  
 <formatter name="PATTERN">  
 <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n" />  
 </formatter>  
 <formatter name="COLOR-PATTERN">  
 <pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n" />  
 </formatter>  
 </subsystem>  

Friday 13 November 2015

Painful Eclipse Gotchas

1. Validation on Startup

Validation happens on startup. With a lot of xml files in the project like ours, this can take minutes as it downloads Schema etc.

It would be better if this was disabled by default.

2. Update SVN Cache

Interestingly, this is a painful one where the eclipse locks up when opening up an existing workspace. If it doesn't crash it sits there at 99% forever (reports say it comes back after 30min)

The workaround is the delete the .project file of your Servers project. You will have to recreate your server however this is much less pain than waiting for it to finish.

3. Maven import doesn't create Java Projects

The Maven import imports the project but the classpath doesn't get set. What seemed to fix this is make the maven-compiler-plugin and maven-jar-plugin the same version (at least I think this is was solved the issue)

4. Server Deployment Location

Normally I set up the TCServer (tomcat) on my local machine and have multiple instances etc. The problem is I like to deploy to my server location rather than the .metadata folder. Imagine traversing to the location in the metadata folder, its difficult to remember (okay a right-click "Open Deployment Location" may work).  I think this should be a default, especially if one works in multiple workspaces.




Tuesday 17 March 2015

Slow Network Connection Setup on Linux

Background

This is really a last resort article, when you've tried everything else, try this.

I'm running Fedora Linux 20 on my dev machine, and experienced slow JDBC connection setup from my application as well as from my Eclipse IDE. Applications like JBoss started up unusually slow. My colleagues running Windows did not have the same problem, so I was assuming it was a Linux issue. It turns out it was just a small configuration issue.

Symptoms


1. Connection to an HP Tandem SQLMX database was slow.
2. JBOSS Startup was very slow, it used to hang at something like "15:10:00,555 INFO  [Server] Core system initialized" and I used to wait for about 20 seconds before it continued.
3. My Corba application which also made use of these connections was painfully slow at startup.

Attempted Solutions


I tried switching off the IPV6 stack but this didn't help.
Decreased the number of connections in my application's connection pool, which did help but stuff was still slow.


 Solution

 Eventually it turned out that the localhost entry in my /etc/hosts entry was incomplete.

Before

              127.0.0.1    localhost                                  

After

127.0.0.1    localhost.localdomain localhost

The localhost.localdomain is the fully-qualified domain name (FQDN). It looks like this is supposedly prevent DNS lookups. On a production server, I would think that this is an important setting to have as well.

Conclusion


After adding this, my system was back to normal! This may seem a trivial fix, however this took a lot of time to find the solution, which isn't that obvious.

Friday 4 July 2014

Eclipse Hover Color in Gnome

The default colour for eclipse tooltips is pretty unreadable (light-green on grey). As mentioned in this post, you can edit the css or you can just use the gnome-color-chooser tool. Here's how you do it:


1. Install the gnome-color-chooser tool

   sudo apt-get-install gnome-color-chooser

2. Run gnome-color-chooser
3. Under the Specific tab you can select your preferred colours for tooltips as shown below.


4. After changing the values, the tooltips are now more legible and a pleasure to use again:)



Question: Why isn't the gnome-color-chooser app installed by default?

Thursday 26 July 2012

SVN Merge Tree Conflict Resolution

I've been trying to merge our code into our feature branches and have experienced mysterious conflicts  Thought I'd record what I'm doing, maybe it will be useful to someone else out there. I think the svn book doesn't treat this functionality thoroughly enough with examples (that being said, our use of svn hasn't been the ideal, so its most likely you won't experience these conflicts in your environment).


A - local missing, incoming edit upon merge

Why does this happen?

 The 'local missing vs. incoming edit' conflicts  can
happen if:

"
 - You delete a file which existed in the common ancestor of both
   branches, and the file is later modified on trunk and you merge
   this modification. in this case you probably want to keep the file
   deleted (or you might decide to resurrect it, in which case the
   best approach would be to first revert the entire working copy,
   undo the file's deletion on the local branch and commit (see
   http://svnbook.red-bean.com/en/1.7/svn.branchmerge.basicmerging.html#svn.branchmerge.basicmerging.undo), and then repeat the first merge (which
   should now not conflict anymore).

 - After your branch is created, a new file is created on trunk in
   revision A and later modified in revision B. You only merge revision
   B which means the file is not created on your branch before the
   merge tries to apply the modification. In this case you should
   probably also merge revision A. A normal sync merge of the
   'svn merge ^/trunk' variety will always do this."

*Excerpt from email conversation with Stefan Sperling  from the subversion user's mailing list.

 So lets see how we resolve this:

1.  svn status pointed to a tree conflict:

!     C core/ppfe_dao/src/main/java/za/co/acme/ppfe/data/sub/SubscriberPIDMatrixDTO.java
      >   local missing, incoming edit upon merge

I'm guessing the "!" means it doesn't exist in the local copy.

2.  First step, I perform an svn info, which tells me what revisions are conflicting. What is strange is that the revision that's conflicting is a very old one from a different branch, I'm not sure why its ending up here. (will update once I have an answer from the forum).

 svn info core/ppfe_dao/src/main/java/za/co/acme/ppfe/data/sub/SubscriberPIDMatrixDTO.java

Path: core/ppfe_dao/src/main/java/za/co/acme/ppfe/data/sub/SubscriberPIDMatrixDTO.java
Name: SubscriberPIDMatrixDTO.java
Node Kind: none
Tree conflict: local missing, incoming edit upon merge
  Source  left: (file) svn://bcx-svn/acme.za/pams/server/branches/V1-1-1-preprod/core/ppfe_dao/src/main/java/za/co/acme/ppfe/data/sub/SubscriberPIDMatrixDTO.java@6896
  Source right: (file) svn://bcx-svn/acme.za/pams/server/trunk/core/ppfe_dao/src/main/java/za/co/acme/ppfe/data/sub/SubscriberPIDMatrixDTO.java@9841

2. So I tried my luck and hoped svn would bring the file in automatically.

svn resolve --accept=working svn://bcx-svn/acme.za/pams/server/trunk/core/ppfe_dao/src/main/java/za/co/acme/ppfe/data/sub/SubscriberPIDMatrixDTO.java@9841
svn: warning: 'svn://bcx-svn/acme.za/pams/server/trunk/core/ppfe_dao/src/main/java/za/co/acme/ppfe/data/sub' is not a working copy

This is the correct response, because the file doesn't exist in my local copy:)



3. I do an svn copy to copy the file from the trunk into my local repo.

svn cp svn://bcx-svn/acme.za/pams/server/trunk/core/ppfe_dao/src/main/java/za/co/acme/ppfe/data/sub/SubscriberPIDMatrixDTO.java@9841 core/ppfe_dao/src/main/java/za/co/acme/ppfe/data/sub

A         core/ppfe_dao/src/main/java/za/co/acme/ppfe/data/sub/SubscriberPIDMatrixDTO.java

Yay, its been added. 

4. svn status

svn status core/ppfe_dao/src/main/java/za/co/acme/ppfe/data/sub/SubscriberPIDMatrixDTO.java

A  +  C core/ppfe_dao/src/main/java/za/co/acme/ppfe/data/sub/SubscriberPIDMatrixDTO.java
      >   local missing, incoming edit upon merge

I've added the file I want, but its still in the conflicted state.

5. Mark the conflict as resolved

svn resolve --accept=working core/ppfe_dao/src/main/java/za/co/acme/ppfe/data/sub/SubscriberPIDMatrixDTO.java

6. svn status now shows the file as being resolved.

svn status core/ppfe_dao/src/main/java/za/co/acme/ppfe/data/sub/SubscriberPIDMatrixDTO.java
A  +    core/ppfe_dao/src/main/java/za/co/acme/ppfe/data/sub/SubscriberPIDMatrixDTO.java

Tree conflict resolved!

 

B - local add, incoming add upon merge


Okay, now for another tree conflict:"local add, incoming add upon merge".
I'm not sure what this means, I think that the files been added locally, but the message to me means I added a file locally and the incoming merge

 1. svn status

svn status  business_services/main_servlet/src/main/resources/testconfigs/pams.properties
      C business_services/main_servlet/src/main/resources/testconfigs/pams.properties
      C business_services/main_servlet/src/main/resources/testconfigs/pams.properties
      >   local add, incoming add upon merge


2.  svn info business_services/main_servlet/src/main/resources/testconfigs/pams.properties
Path: business_services/main_servlet/src/main/resources/testconfigs/pams.properties
Name: pams.properties
URL: svn://bcx-svn/acme.za/pams/server/branches/v1-4-3-AM-CR3159-BatchActivations/business_services/main_servlet/src/main/resources/testconfigs/pams.properties
Repository Root: svn://bcx-svn/acme.za
Repository UUID: 5545304e-a938-48f1-8c5a-7cf7c6df13d1
Revision: 9841
Node Kind: file
Schedule: normal
Last Changed Author: kiren
Last Changed Rev: 9673
Last Changed Date: 2012-06-26 10:47:45 +0200 (Tue, 26 Jun 2012)
Text Last Updated: 2012-07-25 17:42:47 +0200 (Wed, 25 Jul 2012)
Checksum: 0c70c81698528185a3a80d704f423c3f
Tree conflict: local add, incoming add upon merge
  Source  left: (file) svn://bcx-svn/acme.za/pams/server/branches/V1-1-1-preprod/business_services/main_servlet/src/main/resources/testconfigs/pams.properties@6896
  Source right: (file) svn://bcx-svn/acme.za/pams/server/trunk/business_services/main_servlet/src/main/resources/testconfigs/pams.properties@9841

 3. Does the file exist in the local revision?

 svn info svn://bcx-svn/acme.za/pams/server/branches/V1-1-1-preprod/business_services/main_servlet/src/main/resources/testconfigs/pams.properties@6896
svn://bcx-svn/acme.za/pams/server/branches/V1-1-1-preprod/business_services/main_servlet/src/main/resources/testconfigs/pams.properties@6896:  (Not a valid URL)

svn: A problem occurred; see other errors for details

Nope, as expected.

4. The trunk version?

 svn status svn://bcx-svn/acme.za/pams/server/trunk/business_services/main_servlet/src/main/resources/testconfigs/pams.properties@9841
svn: warning: 'svn://bcx-svn/acme.za/pams/server/trunk/business_services/main_servlet/src/main/resources/testconfigs/pams.properties' is not a working copy

Apparently not.

5. Let me check my working copy.
 ls -la business_services/main_servlet/src/main/resources/testconfigs/pams.properties
-rw-rw-r-- 1 kiren kiren 137 Jul 25 17:42 business_services/main_servlet/src/main/resources/testconfigs/pams.properties

Damn, it's there? How is this possible? (will check later, its probably that conflict with an older revision).

6. I don't want this file here anyway, so I'm going to delete it.
 
 svn delete business_services/main_servlet/src/main/resources/testconfigs/pams.properties
D         business_services/main_servlet/src/main/resources/testconfigs/pams.properties

7. Check status, should still be in conflicted state

 svn status business_services/main_servlet/src/main/resources/testconfigs/pams.properties
D     C business_services/main_servlet/src/main/resources/testconfigs/pams.properties
      >   local add, incoming add upon merge



8. Resolve the conflict

svn resolve --accept=working business_services/main_servlet/src/main/resources/testconfigs/pams.properties
Resolved conflicted state of 'business_services/main_servlet/src/main/resources/testconfigs/pams.properties'


9. File should be in a deleted state.

 svn status business_services/main_servlet/src/main/resources/testconfigs/pams.properties
D       business_services/main_servlet/src/main/resources/testconfigs/pams.properties

10. Wonder if the file still exists on the file-system?
 ls -la business_services/main_servlet/src/main/resources/testconfigs/pams.properties
ls: cannot access business_services/main_servlet/src/main/resources/testconfigs/pams.properties: No such file or directory

Aah, nice. Next commit should be rid of it. Tree conflict resolved!


C- local delete, incoming delete upon merge

 Okay, here's another one:

1.
 svn status core/pams-pams-dao/src/main/resources/META-INF/spring/pams-dao-beans_pamsdbonly.xml.not.used 
!     C core/pams-pams-dao/src/main/resources/META-INF/spring/pams-dao-beans_pamsdbonly.xml.not.used
      >   local delete, incoming delete upon merge



2. Again, the ! means it doesn't exist in the working copy, let's confirm:

ls -la core/pams-pams-dao/src/main/resources/META-INF/spring/pams-dao-beans_pamsdbonly.xml.not.usedls: cannot access core/pams-pams-dao/src/main/resources/META-INF/spring/pams-dao-beans_pamsdbonly.xml.not.used: No such file or directory

 Cool, the file needs to be deleted, its one of those annoying files that hangs around and people are afraid to ask :)  (I'm not going to svn info as I'm not really interested in this file.)

3. Everything is good as it is, just need to resolve it now.

svn resolve --accept=working core/pams-pams-dao/src/main/resources/META-INF/spring/pams-dao-beans_pamsdbonly.xml.not.used
Resolved conflicted state of 'core/pams-pams-dao/src/main/resources/META-INF/spring/pams-dao-beans_pamsdbonly.xml.not.used'

4. Check the status

svn status core/pams-pams-dao/src/main/resources/META-INF/spring/pams-dao-beans_pamsdbonly.xml.not.used'

No output. Perfect!

Conclusion


While there seems to be some problem with our source tree in terms of the version V1-1-1-preprod, I think showing the steps I used to resolve the problem may help people working with tree conflict issues.

  1. It looks like our decision not to use --reintegrate merges may have cause problems.
  2. Also, mixed revisions when merging can cause a problem later on with merging, so avoid merging mixed revisions.  
  3. A tip from Stefan on the user forum is that svn copies should be done with URL to URL to avoid mixed revisions issue. 

Update

Subversion 1.6 onwards does not allow merging into mixed revision working copies.










Thursday 22 March 2012

Ubuntu 11.10 - 1 step forward, 2 steps back?

I was just beginning to think that Ubuntu was ready to take on Windows with the release of 11.04, I was enjoying Gnome 2 and feeling really comfortable with it. Then 11.10 came along and this release was the worst Ubuntu release I've seen (I've been using Ubuntu from 10.04).

Things they shouldn't have done:


1. Unity interface - This is meant more for Tablets and touch screens. Granted its becoming a bigger market, but as a desktop user, do I really want this? Lots of apps where buggy because of Unity (e.g. eclipse). Maybe they should have come out with a tablet edition of Ubuntu (by the way, I wonder what % of tablets/touch devices are using Ubuntu?).

Also, because the Menu is now always at the top bar of the screen, the amount of mouse travel to select an option has increased. On a portable device this isn't an issue.

PS: I am using GNOME3 and its so much more usable.


2. Network Proxy Manager - This is one of the most useful features for me. It allows you to have a separate profile for each proxy server setting.

I am a roaming consultant and I normally work in three environments:
  1. Home
  2. Office
  3. Client's Office.

With this manager, I could set up a profile and basically enable it in from one location on my system.

This was removed in 11.10, and is replaced with a new network proxy application.  Also this proxy doesn't have an ignored hosts list (really a core requirement for any proxy settings IMO,  a real loss in my books.
I remember my friend saying this was one thing Windows was missin.

3. (Ok I resolved the shutdown icon issue. Hit ALT and click on the preferences and you'll see the shutdown button :)

Check this cheat-sheet out.


" Shutdown not possible as a logged-in user. 
 
Now you have to logout from your session first, then click on the shutdown icon to switch off the machine, then click 'shutdown' if you really want to shutdown.

This is annoying since generally you're the  only user on your machine, do you really want to wait to do this?



4. Shutdown times are dreadful - I know, I may have some bad apps installed, but my machine takes up to a minute to shut down! I know rely on my ext4 journal to keep my data safe and force the machine off with the power button (5secs). Not the best idea, but really this is crazy.

My new install of 12.04 has fixed this.

5. Its still very difficult to add a custom launcher to the tool-bar. I'd like to go Right-click->add application. (Gnome3 also has this issue)

6. ATI proprietary driver - damn, when are AMD going to opensource their drivers? Currently, this driver is not compatible with the latest version of X (or was it the Linux 3 kernel). Not nice knowing this when you've forked out a pretty penny for your super duper ATI card and now be told you can't use its full features. (In the words of many unknown South Africans - eish (pronounced ay-sh)...painful.

I'm not sure whats better, according to Linus Torvalds nVidia is really bad too.
(check the rant from Linux here)

Things I like


1. GNOME3 - I know people have been complaining that they hate it, but once I got the icon to close a window working, its actually a very pleasant experience! I like the mini task bar on the bottom right that shows open applications.

Sliding to mouse to the top left corner will bring up a high-level view of your windows, so far the most useful way for me to select a window. You can even close a window from this context - Nice!

2. Apt-get (enough said)

Release Management

I wonder how the release management happens. Do the Ubuntu release managers decide the versions of the kernel, X etc before hand. If so, do they communicate it to the downstream vendors so that they can prepare for the next release to ensure that compatibility is maintained?
 

Conclusion


I'm sure there's a process being followed where features are voted in and out. It just feels like when there are gains in moving the OS forward, there is likely to be a major change that throws them all away.

There should be governing body that decides what path to take, rather than having one person decide this. Okay, thanks to Mr. Shuttleworth for Ubuntu, its really an amazing distro in terms of ease-of-use compared to certain others, but this Unity move was too radical in my opinion.

In the case of voting polls for features, I guess the guys with the biggest vote won. Democracy won for some (not me).

Linux doesn't have a Steve Jobs to drive usability or prettiness or simple ease of use (or does it??). Sometimes group-think can be a good thing, sometimes bad. I wouldn't mind follow a distro who's direction is based on a single person who has ease-of-use and aesthetics at the top of his priority list.

The beauty is that in Linux you have that choice! (I downloaded Mint, hopefully its as fresh as they say it is!)
I install 13 Mate, and wasn't too impressed. I changed to Gnome3 and am loving it!