luni, 29 iulie 2013

IrfanView...

is my favourite!

It is:
  • easy to download
  • easy to install
  • easy to use
  • doesn't need much space nor memory
  • converst from *mother* format to *father* format
  • knows to do a lot of things which I find useful

And today it made me soo happy. I was looking for a third party tool to help me print screen and also show the cursor. And Irfanview has it and it took me like 10 seconds to figure it how to use it: Options -> Capture -> I had to configure nothing -> I noticed the hot key: Ctrl + F11 -> pressed Start -> went on page I wanted captured put the cursor over -> Pressed Ctrl + F11 -> there is was my printscreen WITH CURSOR :).

I haven't found a good free xsd navigator yet.

vineri, 10 mai 2013

Enterprise Arhitect Database Shape Component

Oh, hello there, It's only been two years, please do excuse me, but one needs to be in a certain state to be able to share his knowledge.

I got to the point where I needed to make a Component Diagram in Enterprise Arhitect. All good and beautiful using the hyper smart Enterprise Arhitect, 30 Days Trial version. Aaaaand I want to add a component that looks like the agreed database symbol in a diagram. guess what I was so stupid I couldn't find it in Enterprise Arhitect, I still doubt there is any, I can't understand why wouldn't such a well known tool have such a common Symbol.

I any case the solution was to find out how to make sterotypes, how to use them and I just took a provided shape from here (which proves I was not the only one needing it):
  • Go to the Enterprise Arhitect -> Setting -> UML Types... -> Stereotypes Tab
  • Put a Stereotype name: e.g. DatabaseShape
  • Select Base Class all (or other)
  • Select Shape Script radio button
  • Press Asign Button
  • Paste:

  • shape main
    {
    startpath();
    moveto(0,10);
    lineto(0,90);
    arcto(0,80,100,100,0,90,100,90);
    lineto(100,10);
    endpath();
    fillandstrokepath();
    ellipse(0,0,100,20);
    }
    Please remember that I took this code from Sparx System Forum.

To use it:
  • Add a new Component from the toolbox
  • Double click on it
  • In Stereotype Droplist choose the Stereotype name you just created
  • Of course you can resize it

And it should look like this:



Have fun!!!

marți, 3 mai 2011

Websphere JDBC Adapter Conclusions

A few months ago, before changing the project, my team took the decision of using JDBC Adapter for a Bridge application.

The conclusion was that it is not trivial to use and does not have enough documentation for complex cases.

1. the main problem was that the Inboud (from the DB towards application) was not always working, sometimes we had to restart the servers 5-10 time to make it work. The solution was to update the process server to a higher version;

2. We did some tricks to make the relations one child table with two parents work (see previous post);

3. Bottom line is that if you're using Websphere Application Server instead of Websphere Process Server you have more chances to have it run smoothly concerning this topic; don't use this solution unless you have pretty straight forward schema design and you're not goiing to modifiy it too often, because the manual modifications might not cover all the Websphere Integration Development wizard for Adapters generates and you'll end up swearing.

vineri, 7 ianuarie 2011

Websphere JDBC Adapter

The last days I had to check how to save through the JDBC Adapter from Websphere a structure that is like this (see below just a relevant minimum example):

T_ADDRESS
{
ADRESS_ID;
PERSON_FK nullable true;(references t_person on person_id);
COMPANY_FK nullable true;(references t_company on person_id);
STREET_NAME;
...
}

T_PERSON
{
PERSON_ID;
NAME;
...
}

T_COMPANY
{
COMPANY_ID;
CUI;
...
}

So address is used for person type and for company type. From the JDBC Adapter Wizard I was able to configure only one relation parent child, let's say
T_Person is parent and T_Address is child. What about the other relation (T_Company -> T_Address)?

The wizard generated behind the scenes a new entry in the Person.xsd of type Address and in Adress.xsd added for element(column) PERSON_FK a new tag PERSON_ID.

SO I did the same modifications in T_COMPANY (I added a new element of type Address with preserve, KeepRelation and Ownership true) and I added a in Adress.xsd for COMPANY_FK the COMPANY_ID attribute.


Then I tried to save a sdo object of type person like below

Person
person_id = 1;
name = 'Some Name';
...

Address
address_id = 1;
person_fk = 1;
company_fk = null; --(this is an adress for a person not for a company)
street_name = 'New Street';
...


And the Adapter threw a NullPointerException. Why? It seems because the ForeignKey attribute inside forces him to believe that it needs to have a "parent" although the field and column are nullable.

So what did I do? I removed the COMPANY_ID and
PERSONS_ID tags.

miercuri, 25 august 2010

Server launched but failed initialization - WebSphere

I tried the innocent action of starting the WebSphere Application Server on the machine with zOS and I got the following problem:

ADMU0128I: Starting tool with the ProcSrvBG profile
ADMU3100I: Reading configuration for server: server1
ADMU3200I: Server launched. Waiting for initialization status.
ADMU3011E: Server launched but failed initialization. Server log files
> should contain failure information


I wasted almost a day trying to figure out what happened, among the possible reasons and solutions there were:
1. another process is already using the port that the Applcation Server wants to use(see here)
2. reinitializing the configuration by running "osgiCfgInit.bat" from ./profiles/profilename/bin (see here)
3. host name changes

None of these worked in my case. The reason was there was not enough space on disk. An it was that bad, that we couldn't even start the servers even worse it could not be logged anymore and the only thing that could be found was some output in native_stderr.log under ./websphere_location/profiles/profilename/logs/servername/native_stderr.log:

An exception occurred while writing to the platform log:
java.io.IOException: There is not enough space in the file system.
at java.io.FileOutputStream.write(FileOutputStream.java:290)
at sun.nio.cs.StreamEncoder$ConverterSE.implFlushBuffer(StreamEncoder.java:285)
at sun.nio.cs.StreamEncoder$ConverterSE.implFlush(StreamEncoder.java:291)
at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:202)
at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:236)
at java.io.BufferedWriter.flush(BufferedWriter.java:257)
at org.eclipse.core.runtime.adaptor.EclipseLog.log(EclipseLog.java:309)
at org.eclipse.core.runtime.adaptor.EclipseLog.log(EclipseLog.java:295)
at org.eclipse.osgi.internal.baseadaptor.BaseStorage.saveBundleDatas(BaseStorage.java:520)
at org.eclipse.osgi.internal.baseadaptor.BaseStorage.saveAllData(BaseStorage.java:372)
at org.eclipse.osgi.internal.baseadaptor.BaseStorage.access$1(BaseStorage.java:362)
at org.eclipse.osgi.internal.baseadaptor.BaseStorage$StateSaver.run(BaseStorage.java:1081)
at java.lang.Thread.run(Thread.java:811)
Logging to the console instead.

!ENTRY system.bundle 4 0 2010-08-25 14:54:16.265
!MESSAGE FrameworkEvent.ERROR
!STACK 0

java.io.IOException: There is not enough spa


(Please notice how abrupt he error message had to end - it might not look funny to you but when I saw it I laughed for 10 minutes...in the bathroom).


While trying to figure out the problem I got to the conclusion that I don't like the netstat command under zOS at least - just a personal attitude.

miercuri, 2 iunie 2010

SQL query for finding duplicates

I've noticed this problem among persons who seemed to have some experience on querying data bases.
Detect duplicates in a table. For example we have he table TABLE1 with columns C1, C2, C3 and we need all the entries that have duplicate C1 value or duplicate combination C1,C2.

One of the solution is this:

select * from TABLE1 t where 1>(select count(*) from TABLE1 t1 where t.C1 = t1.C1);

select * from TABLE1 t where 1>(select count(*) from TABLE1 t1 where t.C1 = t1.C1 and t.C2 = t1.C2);

Same syntax is used for DB2, Informix, Oracle.

marți, 1 iunie 2010

Business Process Choreographer Process Instances

You can manipulate the business process templates and instances from BPC Explorer but, of course, you felt like doing it from Java or from Jhyton (or from somewhere else I can't help you with :).

So if you need to do things with your BPC process instances in IBM Websphere you might find this article useful.

First if you want to get to a process instance you want to locate the Business Flow Manager (because it is an EJB) and use the obtained object to delete, terminate and do whatever action you need with a process, check BusinessFlowManager's API here. And by getting the Process Instance itself (see API here), a ProcessInstanceData object needs to be obtained, for example by id: bfm.getProcessInstance(PIID id) or bfm.getProcessInstance(String identifier);

ok, just to make it more clear:

In Java
:

...
//initialize context and lookup the home interface
InitialContext context= new InitialContext();
Object object = context.lookup("com/ibm/bpe/api/BusinessFlowManagerHome");

//typecast (narrow down) the object to BusinessFlowManagerHome
BusinessFlowManagerHome bfmHome =
(BusinessFlowManagerHome)javax.rmi.PortableRemoteObject.narrow(object,
BusinessFlowManagerHome.class);

//Access the remote interface for the BusinessFlowManager bean
BusinessFlowManager bfm = bfmHome.create();

String id= "_PI:90030128.f2ab6a6e.bc87e953.d13606e2");

ProcessInstaceData pd = fm.getProcessInstance(id);
if (ProcessInstaceData.STATE_FAILEDSTATE_RUNNING.equals(pd.getExecutionState())) {
bfm.delete();
}


...

In Jhyton:

from javax.naming import InitialContext
from java.util import Hashtable

env = Hashtable()
env.put("java.naming.factory.initial","com.ibm.websphere.naming.WsnInitialContextFactory")
//server's ip and bootstrap port (found in the admin console application servers->ports)
env.put("java.naming.provider.url","corbaloc:iiop:112.24.120.11:1111")


context = InitialContext(env)

home = context.lookup("com/ibm/bpe/api/BusinessFlowManagerHome")
bfm = home.create()

processInstance = bfm.getProcessInstance(piid)
execState = processInstance.getExecutionState()
if execState == processInstance.STATE_FAILED :
print "failed"
bfm.delete(piid)
elif execState == processInstance.STATE_RUNNING :
print "running"
bfm.forceTerminate(piid)
bfm.delete(piid)


You can refer the examples for Java and documentation for Jhyton.