Progress 4GL - Is there any way to find out .p 's calling triggers(.t)? - openedge

Is there any other way to find out what all the triggers (.t) files getting called while running. r ?. I am struggling to find out correct trigger files used for particular programs.
Please help me on this

The easiest way to see what a black box is doing is to use -clientlogging with -logentrytype 4GLTrace.
Turns on logging for the execution of internal procedures, user-defined functions, persistent user-interface triggers, and named events (generated by the RUN, FUNCTION, PUBLISH, and SUBSCRIBE statements, respectively). It also logs the instantiation and use of classes, including execution of constructors (invoked by the NEW phrase and also by the SUPER and THIS-OBJECT statements), the execution of methods defined within classes (including those invoked using the SUPER system reference), the execution of property accessor methods (invoked by accessing a property of a class), and the execution of destructors (invoked by executing the DELETE OBJECT statement).

If you cannot change the client startup parameters look for Stefan's answer with LOG-MANAGER.
How to see .w trigger is working for my query?
Alternatively, you can write the code yourself. A write trigger fires at end of record scope or at the end of a transaction, whichever comes first. This can lead to tricky situations. My proposal does not display the trigger program file name, only the table name.
Try:
/*test.p*/
for each _file no-lock where _tbl-type = "T":
run write.p persistent _file-name.
end.
find first customer.
update name.
It runs write.p for each table in your database. If you have multiple databases connected just repeat the for each for each connected database.
on write of {1} do:
def var i as int.
i = 1.
do while program-name(i) <> ? with down col 10 overlay row 4:
display "{1}" program-name(i) format "x(35)".
i = i + 1.
end.
end.
The results do not give you the trigger program file name, but it provides the table name.
┌────────────────────┐
│Name │
│────────────────────│
│Etienne ┌────────────────────────────────────────────┐
└────────│Customer WRITE-TRIGGER write.p │
│Customer /home/ebegin/p71715_test.ped │
│Customer adecomm/_runcode.p │
│Customer ExecuteRun adeedit/_proedit.p │
│Customer RunFile adeedit/_proedit.p │
│Customer USER-INTERFACE-TRIGGER adeedit/_pro│
│Customer adeedit/_proedit.p │
│Customer _edit.p │
Another approach is to use the PROFILER system handle. The profiler provides processing time and call-tree information.
There is profiler integration in PDSOE if you use that software.

Related

Naming convention of events in redux js

Redux will be dispatching actions for state change. What are naming conventions of action types in redux?
There are a few conventions around the community, I'll list the ones I know of and think are useful here:
The most common convention is to keep the action types ("event types") in CONSTANT_CASE.
This avoids spelling errors, where the action has a type of my_type, but the reducer expects a type of my-type or My_Type.
Another very common convention is to save the action types in a separate file as constants, e.g. var MY_ACTION_TYPE = 'MY_ACTION_TYPE';, and to use them from there.
This also avoids spelling errors, so you don't expect an action to have a type of MY_ACTION_TYP. If the variable doesn't exist, you'll get an error immediately, especially if you're linting.
A not quite as common, but imho very useful, convention is to scope the actions to a project and a domain. This approach was popularized by Erik Rasmussen in his "Ducks" proposal, which specifies that action types have to be in this shape: var MY_ACTION_TYPE = 'appname/domain/MY_ACTIONTYPE'.
This avoids the case of two action constants having the same value. E.g. imagine you have a admin area and user facing area, and both have forms dispatching a 'CHANGE_USERNAME' action type. This will make two reducers pick up the same action, where one shouldn't pick the other one up. This can happen on accident, and is very annoying to track down. By prefixing them with the app- and domain name, one avoids this issue: 'appname/admin/CHANGE_USERNAME' is different from 'appname/user/CHANGE_USERNAME'!
That's all the conventions I know of and use, but I'm sure somebody else has more – what have you used and found useful in your projects?
There are also some conventions around naming asynchronous action types. If you have a set of actions to represent an api call to get a user, you can split them up into something like:
FETCH_USER_REQUEST - for when you first send the api call
FETCH_USER_SUCCESS - for when the api call is done and successfully returned data
FETCH_USER_FAIL - for when the api call failed and responded with an error,
FETCH_USER_COMPLETE - sometimes used at the end of the call regardless of status
There is a new pattern that addresses this, redux-auto.
It takes the ideas of reducer composition one step further. Where instead of having a file that represents your reducer and creating individual actions functions.
redux-auto's approaches to have folders with individual JS files representing each action/transformation on the state and dynamically exposing this as functions
example
└── store/
├──user/
│ └── index.js
│ └── changeName.js
└──posts/
└── index.js
└── delete.js
Now from anyway in your app you can write
import actions from 'redux-auto'
...
actions.user.changeName({name:"bob"})
store/user/changeName.js
export default function (user, payload) {
return Object.assign({},user,{ name : payload.name });
}
Thats is!
If you want to listen for redux actions in third-party reducers. You can use as loose quality check against the function.
action.type == actions.user.changeName // "USER/CHANGENAME"
For something more advanced you can even see if an action is owned by a specific reducer
// Returns true if it's an action specifically for user
if(action.type in actions.user)
You can read more on the project page
See Redux official styleguide: https://redux.js.org/style-guide/style-guide/#model-actions-as-events-not-setters
Model Actions as Events, Not Setters
Write Meaningful Action Names

Creating many batches (SysOperation Framework) very quickly doing similar processes - "Cannot edit a record in LastValue (SysLastValue)"?

I have a SysOperation Framework process that creates a ReliableAsynchronous batch to post packing slips and several get created at a time.
Depending on how quickly I click to create them, I get:
Cannot edit a record in LastValue (SysLastValue).
An update conflict occurred due to another user process deleting the record or changing one or more fields in the record.
And
Cannot create a record in LastValue (SysLastValue). User ID: t edit a, Class.
The record already exists.
On a couple of them in the BatchHistory. I have this.parmLoadFromSysLastValue(false); set. I'm not sure how to prevent writing to SysLastValue table.
Any idea what could be going on?
I get this exception a lot too, so I've created the habit of catching DuplicateKeyException in my service operation. When it is thrown, catch it and retry (for a default of 5x).
The error occurs when a lot of processes run simultaneously, like you are doing now.
DupplicateKeyException can be caught inside a transaction so you could improve by putting a try/catch around the code that does the insert in the SysLastValue table if you can find the code.
As far as I can see these are the only to occurrences where a record is inserted in this table (except maybe in kernel):
InventUnusedDimCleanUp.serialize()
SysAutoSemaphore.autoSemaphore()
Put a breakpoint there and see if that code is executed. If so you can add a try/catch with retry and see if that "fixes" it.
You could also use the tracing cockpit and the trace parser to figure out where that record is inserted if it's not one of those two.
My theory about LoadFromSysLastValue: I believe setting this.parmLoadFromSysLastValue(false) does not work since it is only taken into account when the dialog is started, not when your operation is executed. When in batch, no SysLastValue will be used to initialize your data contract as you want it to use the exact parameters you have supplied in your data contract .
It's because of the code calling SysOperationController.savelast() while in batch, my solution is to set loadFromSysLastValue to false in SysOperationController.loadFromSysLastValue() as part of the in batch check:
if (!this.isInBatch())
{
.....
}
//Begin
else
{
loadFromSysLastValue = false;
}
//End

EJB 2.1 and container managed persistence in websphere 8: Single object finder returned 2 objects

We are using EJB 2.1 with container managed persistence in IBM Websphere 8 and have the following problem: A single Object finder sometimes return 2 elements even though there is only one element the database for this search criteria. This happens only while many threads are accessing the same database entry.
We are using wsOptimisticUpdate as Access Intent. Inside the transaction the element is first searched using the business key (this the single object finder, which sometimes finds 2 elements and therefore throws an exception) and then updated.
If many threads are doing this for the same business key, then this error occours.
Using a breakpoint for this exception and checking with uncommitted read on the database, it can be seen that there is only one element in database. So it looks like the CMP implementation is not really thread safe. Has anyone encountered such a problem before?
Caused by: javax.ejb.FinderException: Single object finder returned 2 objects.
at
com.ibm.ws.ejbpersistence.beanextensions.ConcreteBeanStatefulInstanceExtensionImpl.executeFind(ConcreteBeanStatefulInstanceExtensionImpl.java:1579)
at
I'm no expert on CMP finders, but it may be due to the EJB QL predefined query not including a DISTINCT keyword in your SELECT clause. i.e.
SELECT **DISTINCT** OBJECT(o) FROM YourEntity AS o WHERE o.id = ?1;
(without the astericks)

"Cannot access a property or method of a null object reference." without any meaningfull stack trace

Regularly during my application run, I get
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at mx.managers::SystemManager/stageEventHandler()[C:\autobuild\3.4.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:5649]
This is the full stack trace. Obviously, I guess there is something wrong, but I can't understand what.
Is there any way for me to find the origin of that bad behaviour ?
EDIT
Having added my SDK sources to my debugger, I can now say precisely which line it is :
private function stageEventHandler(event:Event):void
{
if (event.target is Stage)
mouseCatcher.dispatchEvent(event); // This is line 5649
}
mouseCatcher is indeed null. The current event target is indeed a Stage object, and event type contains the "deactivate" String. As event occurs at application startup (before I try to do any kind of user interaction), I guess it's a kind of initialization bug, but where ? and why ?
Look at the source code, this is always your best option. The 3.4 SDK is open source (datavisualization and the flash player itself aside) and you probably already have the source for it in your FlashBuilder/FlexBuilder install/sdks folder. Use grep or windows grep to find the file in question (or find, whatever floats your boat). Open the SystemManager file and check what's happening at that line, check for calls to the method (if it's public use grep again, if it's private you just need to look within the SystemManager). Try to understand why it gets to this point, as pointed out by some others it's likely a timing related issue where you're trying to access something before it has been assigned, in this case the SystemManager, you probably need to defer whatever action you're taking that is causing the error to a later part of the life-cycle (if you're using initialize event or pre-initialize try on creationComplete instead since that will be dispatched after the createChildren method is called).
Note: Mine is located here
C:\CleanFS\SDKs\flex\3.4.0.9271\frameworks\projects\framework\src\mx\managers
In my copy of SystemManager with the version of the SDK I have that line number doesn't make any sense since it's a block closure not an executable line so you'll have to look at your specific version.
It looks like you are using the Flex 3.4 SDK. Are you listening for the ADDED_TO_STAGE event when the application loads? Or doing anything with the Stage object on load? If so, you might be hitting a bug specific to the 3.4 SDK:
http://bugs.adobe.com/jira/browse/SDK-23332
The most obvious solution is to swap out the 3.4 SDK for a later version (3.4A, 3.5 or 3.6). You can do that here: http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+3
All of your code should be backwards compatable with the newer Flex 3 SDKs.

How to get a LPITEMIDLIST pointer according to the path of a folder?

I want to get the system icon of a specified folder, but maybe the only way to retrieve the icon is to use SHGetFileInfo() method. The first parameter of SHGetFileInfo() method is a pointer of LPITEMIDLIST.
If I only have the absolute path of the folder, how can I get the pointer according to the path?
SHParseDisplayName().
Welcome to the wonderful world of PIDLs.
You can read more at Introduction to the Shell Namespace, but basically a PIDL is a Pointer to an item ID List. You can think of it as a linked list in contiguous memory, but instead of each node having a pointer to the next node, you instead have the cb member which is the Count of Bytes that are contained the item, so you can add that to the base address to get the next item. IDLists are terminated with an item with { cb = 0, abID = NULL }.
So, what's in these magic lits? Basically you don't care and can't know. Any IShellFolder implementation can create a new type of ID to represent its type of item in the shell namespace. The basic file system view that the Shell implements just stores the parts of the path in these lists, so you have something like "c:\" in the first one "Users\" in the next one, etc. In reality they are serialized structs (or classes) that may contain more data. But they can also represent printers, network shares, database searches (for search folders, stacks, etc).
All you really need to know is you can ask IShellFolders to give you a PIDL that represents the items they contain, and later on you can give that PIDL back to them, and other various Shell functions and interfaces, and they know how to deal with them. What SHParseDisplayName() basically does (I think) is go through the registry looking for all registered IShellFolder implementations and asks them if they know what to do with the string you pass in, and the first one to handle it makes the PIDL and gives it back.

Resources