How to deny creating empty log file with be.file in Pantheios? - pantheios

1)be.file backend has a feature - messages added before _be_file_set_filename() are not lost and will be appended to log later.
2)_be_file_set_filename opens file immediately => if no entries was added, emty file will be created
Question: how to suppress creating empty file (create file only when first log entry appended) and save feature 1) ?

Use the flag PANTHEIOS_BE_FILE_F_DELETE_IF_EMPTY, described here.
My guess is that the file is created synchronously to avoid the less-desirable situation where a log file cannot be created while a process is running. If you really want that, maybe add the functionality and supply back to the project?

I've solved this problem by writing custom backend - wrapper over be.file

Related

Is it possible to edit Logic app file system or SFTP trigger conditions to fire a logic app based on filename or extension?

I would like to trigger my logic app which is reading files from SFTP only if files with a certain name or extension are uploaded/modified. I want to avoid using multiple actions to check file name. Is there any possible way to edit File System/SFTP trigger conditions to check file name and accordingly trigger the logic app?
Yes you could. If you want to use trigger condition to check the file name, you have to use When a file is added or modified (properties only).
I test the one without properties only, I check the output is there any property to get the file name, and then I use #equals('47.txt',trigger()['outputs']['headers']['x-ms-file-name']) as trigger condition, however I get this error message.
So this trigger could not meet your requirement. Then I test with properties only, this output body has a property Displayname to get the file name. So I changed the codition to #equals('47.txt',trigger()['outputs']['body']['DisplayName']), with this codition, if the filename doesn't equal, it will be triggered, however it won't fired it.
Hope this could help you.

can we drop a file to a folder location automatically using camel,or at a set period of time(not intervals)?

Iam trying to automate the testing of a java bundle,Which will process once a file is dropped in a particular folder.
can we drop a file to a folder location automatically using camel,or at a set period of time(not intervals)?
is this possible purely by camel or should we incorporate other frameworks?
sure, you can use the camel-file component to produce (create files somewhere) and consume (read/process files from somewhere) and optionally control the initial/polling delays easily with attributes...
here is a simple example of consuming->processing->producing
from("file://inputdir").process(<dosomething>).to("file://outputdir")
alternatively, you could periodically produce a file and drop it somewhere
from("timer://foo?fixedRate=true&period=60000").process(<createFileContent>").to("file://inputdir");
Although camel could do this by creating a timer endpoint, then setting the file content and writing to a file endpoint, my answer would be to simply use a bash script. No camel needed here.
Pseudo bash script:
while [ true ]
do
cp filefrom fileto
pauze 10s
done

Create log file with custom name

How to create log file with custom file name in cakephp 2.5.1.
I am written following code
$this->log("Data : ".print_r($this->data,true),'debug');
It create's debug.log file in tmp/log folder but when I write custom name like
$this->log("Data : ".print_r($this->data,true),'data');
This code do not create any log file. My Question is how to create log file with custom name?
Same answer as for the other question: Start reading the manual. A huge part of the profession is to read documentation.
Changed in version 2.5.
CakeLog does not auto-configure itself anymore. As a result log files
will not be auto-created anymore if no stream is listening. Make sure
you got at least one default stream set up, if you want to listen to
all types and levels. Usually, you can just set the core FileLog class
to output into app/tmp/logs/:

Difficulty with filename and filemime when using Migrate module

I am using the Drupal 7 Migrate module to create a series of nodes from JPG and EPS files. I can get them to import just fine. But I notice that when I am done importing them if I look at the nodes it creates, none of the attached filefield and thumbnail files contain filename information.
Upon inspecting the file_managed table I see that both the filename and filemime fields are empty for ONLY the files that I attached via the migrate module. This also creates an issue with downloading the files.
Now I think the problem has to do with the fact that I am using "file_link" instead of "file_copy" as the file operation I specify. The problem is I am importing around 2TB (thats Terabytes) of image files. We had to put in a special request with Rackspace just to get access to that much disk space on our server. So I can't go around copying from one directory to the next because of space issues. So "file_link" seems like the obvious choice.
Now you probably want to see how I am doing this exactly, so here is the code snippet:
$jpg_arguments = MigrateFileFieldHandler::arguments(NULL,
'file_link', FILE_EXISTS_RENAME, 'en', array('source_field' => 'jpg_name'),
array('source_field' => 'jpg_filename'), array('source_field' => 'jpg_filename'));
$this->addFieldMapping('field_image', 'jpg_uri')
->arguments($jpg_arguments);
As you can see I am specifying no base path (just like the beer.inc example file does). I have set file_link, the language, and the source fields for the description, title, and alt.
It is able to generate thumbnails from the JPGs. But still missing those columns of data in the db table. I traced through the functions the best I could but I don't see what is causing this. I tried running the uri in the table through the functions that generate the filename and the filemime and they output just fine. It is like something is removing just those segments of data.
Does anyone have any idea what this could be? I am using the Drupal 7 Migrate module version 2.2. It is running on Drupal 7.8.
Thanks,
Patrick
Ok, so I have found the answer to yet another question of mine. This is actually an issue with the migrate module itself. The issue is documented here. I will be repealing this bounty (as soon as I figure out how).

How to start the associated program when selecting more than one files?

I have set .jpg file associated to my own program. I want to add the context menu to .jpg files, so I set the entry of HKCR.jpg\shell\open\command to "myProg.exe %1". After associating, there will be an item on the top of the context menu saying "Open image with myprog". This works right when I select a single .jpg file, but when I selected more than one file and click the top item of the context menu, nothing happended. How can I solve the problem?
Thank you very much
Each selected file will be sent to a new instance of your application. Your application should check if a previous version exists, or not. If a previous instance exists, it should sent its parameters to it (e.g. using Windows Messages) and then terminate.
Another approach is to use DDE (Dynamic Data Exchange), an old method used by Shell to send all files to one instance of your program.
You might need double quotes around the "%1".
Read this article for much more detailed information about how all this works.
http://msdn.microsoft.com/en-us/library/bb776883.aspx
Also, this blog entry talks about what you need to do specifically for multi-select command execution: http://blogs.msdn.com/pix/archive/2006/06/30/652889.aspx

Resources