Procces of recursion in Tibco - tibco

I need to list all the files in specific directory(for e.g D:\TestFolder*) and let's say that TestFolder has three subfolders and those three subfolders have another three subfolders and files(png,jpg,txt),and another descendants...and then send them all in email with Send mail ativity.
I tryed with ListFiles activity but i only get the first subfolders/files...how can i retrieve all descendants from the specific file?
I know that this is related with procces of recursion but i don't know how to solve this in tibco.

The ListFiles returns the type for each element found (if selected directories or files+directories). If you designed your main process to work on a single directory you can add a iterate loop calling it with all elements[type = "directory"] as iteration statement. This will result in a recursive iteration (depth-first is done synchronously, breadth-first if spawned).

Tibco Designer is not allowing you to select the sub process with same name as main process in tibco designer but you always can type the process name manually in "call process" activity for simple recursion implementation.
here is the code for printing all the files and folders names recursively
https://github.com/dowid/tibco/tree/master/RecursionTest

Related

How to retrieve EVERY mail message (including Deleted, Archived, and Recoverable items) for an O365 user with Graph API?

We are working on an application in the compliance/monitoring space where we are monitoring the activity of an individual. Because of this, we want to pull EVERYTHING in a user's Office 365 mailbox - if it has text the user wrote or received, we want it if it is there, even if it was deleted, purged, etc.
We are using the Graph API and have an existing implementation that uses the standard "messages" GET command:
GET https://graph.microsoft.com/v1.0/me/messages
We are making use of the GraphApiClient (Microsoft.Graph v1.9.0), so the code actually looks like this:
IUserMessagesCollectionPage pageOfMessages = _graphClient.Users[userId].Messages.Request(options).Top(batchSize).Expand("attachments").GetAsync().Result;
However, at the very least this does not return any items from any of the RecoverableItems folders. After looking into it, I am now suspicious that there might be other folders that are not returned by this command either. There is quite the list of Well-known folder names and I'm not sure what others might not be included in a generic Messages request.
Based on this post, I know you can request the messages in the missing folders by WellKnownFolderName one at a time like this:
GET https://graph.microsoft.com/v1.0/me/MailFolders/RecoverableItemsDeletions/messages
It even works with the GraphApiClient:
IMailFolderMessagesCollectionPage pageOfMessages = _graphClient.Users[userId].MailFolders["RecoverableItemsDeletions"].Messages.Request(options).Top(batchSize).Expand("attachments").GetAsync().Result;
The problems with this are:
I don't know how to build a comprehensive list of every folder that has messages for the user
Some of the folders (like RecoverableItemsDeletions and ArchiveRecoverableItemsDeletions, for example) can contain duplicates so I would need to use a dictionary to get rid of the duplicates
It would be a lot more expensive to first build a list of relevant folders and then request their contents and their childrens' contents one request at a time.
At scale, a folder-by-folder implementation could be subject to throttling (if we are monitoring enough users with big enough mailboxes)
Does anyone know the best way to do this? Thanks!

Get created/modified/deleted files by a specific process from an event tracing (ETW) session

I've been searching for a solution to get all created/modified and deleted files by a specific process from an event trace (ETW) session (I will process data from an etl file not from a real-time session).
Apparently the simplest solution to get this done was to get the FileCreate and FileDelete events from FileIo_Name class and map them to the corresponding DiskIo_TypeGroup1 events. However, this solution isn't working for me since I don't receive any DiskIo_TypeGroup1 events for the corresponding FileDelete events, so I can not get the process ID. Also not all FileCreate events have an associated DiskIo_TypeGroup1 event (I think this happens for the empty created files or only for the opened files).
Note: I need DiskIo_TypeGroup1 mapping because FileIo_Name events don't have the ThreadId and ProcessId members populated - they are set to (ULONG)-1. Also, I can not decide which files where just opened or modified without knowing the "file write size". DiskIo_TypeGroup1 also don't have the ThreadId and ProcessId (in event header, on newer OS's) members populated, but it has the IssuingThreadId structure member from which I can obtain the ProcessId mapping to Thread_TypeGroup1 class events.
So I investigated how the FileIo_Create class can help me, and remarked that I can get the CreateOptions member which can have the following flags: (FILE_SUPERSEDE, FILE_CREATE, FILE_OPEN, FILE_OPEN_IF, FILE_OVERWRITE, FILE_OVERWRITE_IF). But the initial problem still persists. How can I check if a file was created from scratch instead of being just opened (e.g. in case of FILE_SUPERSEDE)?
Maybe I can use the FileIo_ReadWrite class to get Write event. Like using the DiskIo_TypeGroup1 class. So, if something was written to a file, then can I suppose that the file was either created or modified?
To find the deleted files I think that the FileIo_Info class and Delete event are the solution. Guess that I can receive Delete events and map them to FileIo_Name to get the file names.
Note: The FileIo_Create, FileIo_Info, FileIo_ReadWrite contain information about process id.
Are my suppositions right? What will be the best solution for my problem?
I will share my implemented solution as follow :
Created Files:
I have stored all FileIo_Create events as a pending create operation and waited to receive associated FileIo_OpEnd to decide if the file was opened, created, overwritten, or superseded from the ExtraInfo structure member.
Modified Files:
I marked files as dirty for every Write event from FileIo_ReadWrite and every SetInfo event with InfoClass->FileEndOfFileInformation and InfoClass->FileValidDataLengthInformation from FileIo_Info. Finally on Cleanup event from FileIo_SimpleOp verify if the file was marked as dirty and store as modified.
Deleted files:
I marked the files as deleted if was opened with the CreateOptions->FILE_DELETE_ON_CLOSE flag from FileIo_Create or if a Delete event from FileIo_Info appears. Finally on Cleanup event from FileIo_SimpleOp stored the file as deleted.
Also the process id and file name was obtained from the FileIo_Create events, more precisely from OpenPath structure member and ProcessId event header member.

Delphi - delay processing if user still typing

I have an application which has an Edit Field. The user will type a search phrase in this field. I am trying to show in real time the hits against the user's text. After entering three characters, I do my first search, and then after every character or backspace the search is performed again.
The problem is that as my search algorithm is getting more advanced, it takes longer to do the search. The user can type faster than the results are before generated/displayed. As a result, the app is feeling sluggish/slow. I have a couple options:
(1). Wait until the user hits enter (2). Put the search in a different thread and do it asynchronously. Kinda hesitant here since I have never worked with threads before (3). Implement some type of delay so that if the user is still typing, I wait for the user to stop.
I am leaning towards option 3, but how do I detect if the user is still typing? Do I have to keep a timestamp associated with every keystroke?
If I were you I would stick with the threading solution.
It is faster, does not lag and - if written properly - will not introduce additional problems, and is a great opportunity to learn threading by a not so risky or difficult problem. If you choose this solution you will have to perform four easy steps:
Create an OnSearchFinished() event handler on your form and assign it to a message code (like WM_USER + 1). This message will be sent by your thread when it has finished producing search results.
Create a TThread descendant with your search code in its .Execute() method that will perform the search. It has to have a field with the search term. (The .Execute() will not be called directly so it can't handle parameters. You execute TThread descendents by .Resume()ing them.) The instance of this class can be created in the constructor of your form and needs to be created in suspended state.
Assuming your search code has a main cycle, you will have to check if your main program called .Terminate() over your object. If it has, you have to exit your cycle.
In the .OnChange() or .OnKeyDown() where you handle your search, you should (first) .Terminate() your thread (to stop an already running search if there is any), then set the field to your new search term and .Resume() it.

Exist db triggers: after-create-document event does not fire when a document is stored as a result of another trigger

With Exist DB I am able to get triggers working. For example, in my setup adding a file to a collection A triggers an XQuery which reads this particular file and generates several new files based on the content of this file (to another collection B - sibling of A).
Next, I would like to set a trigger on collection B, which starts an XQuery for every file that's written into it.
If the file is written by / on behalve of the first trigger, this seems to be impossible. I can see that the files are written into collection B by the trigger on collection A, but then the after-create-document event does not fire. However, if I manually place a file into B with webdav, the event is fired.
Is this a fundamental limitation or is there a better way to do this
This sounds like a bug to me, can you file an issue on the GitHub issue tracker for the project: https://github.com/exist-db/exist/issues

Rails 3 - is possible to run an action after ending the first?

I am interesting about an option to run an action in a moment, when is ending the currently action.
More specifically, I want to run an action for download files from my page and after downloading all files this action is ending (usually behavior - this action is running by CRON).
And now I would like to automatically run the second action. This action will be checking the downloaded files...
Exist any way, how to do?
Thank you a lot,
M.
You cannot render multiple times in one request. HTTP requests can only have one response, so if you did, you would end up with the output concatenated, which would probably not be useful.
If you have controller logic from another action that you want to invoke (which does not include rendering), you can do this by simply calling the other action method, or by factoring the logic you need into a separate method on the controller. If you were trying to share logic among separate controllers, you would need to move this method to your ApplicationController.

Resources