write a version number when deliver in RTC - versioning

I want to have an API, in my server, that return the version of the code running on it.
To do so, I want to have the version number on a file, and I want it to be updated each time I deliver code into the stream in RTC.
Is there a plugin I can use, or some other way to achieve this?

RTC has no version number. A component is made by a succession of change-sets which can contains more than one file. A single file history is given by the change-sets that begin with file creation and continue to last modification. But as RTC provides streams to organize logic environment you can have streams with different history for the same file. In this context "version" has no sense. In order to work with RTC you have to think with change-set and not by single file changes.

I solved this issue with signing the manifest.mf file in every build using mvn and jenkins.
I wrote a short artical about my solution, hope someone will find it useful.

Related

How to get generated content in Apache module and save it to file

I have been playing around with Apache module development and got the module working. However, I ran into the issue of where to hook properly to get all the data I need.
I am making a simple caching module that needs to hook at the beginning of the request and check if the file for this URL exists on disk and if it does then serve that file and stop content generation of Apache.
Currently, the module still continues to go into content generation mode. Let's say I have a long-running PHP script that takes 5s to generate. I would to omit calling the script altogether and just serve the static file from disk.
Furthermore, if the local file does not exist, I would like Apache to execute content generation (actually executes the PHP script) and before sending that data to the client I would like to have a proper hook that somehow gets this data and saves it to a local file.
I have tried ap_hook_fixups, ap_hook_handler and APR_HOOK_LAST, APR_HOOK_LAST and all the variations but no luck.
It always executes at the start of the request.
I also do not want to use any existing Apache modules. I want this to be a self-contained module.
Is there a way to do this kind of thing?
Based on the information you have provided, it sounds like you want your module to execute First and not last.
From what I understand of your issue, you want to make sure the file that would potentially be generated is already on disk or not, and if it is, serve that file, instead of allowing your php script to serve it.
In this case, you'll want to use APR_HOOK_FIRST or APR_HOOK_REALLY_FIRST
Then, assuming your file is on disk, you serve your file, and at the end of your module's work do a return OK;
If the file does not exist, do a return DECLINED
The DECLINED tells Apache that your module should not be the handler for this request and will continue down the list of modules till it finds something that will.
The goal here is to get your module to run before the php module does, to prevent your generation code from running, and fall back onto the php module if the requested file was not found.
Note:
The APR_HOOK_? priorities are just numbers -10 to 30
You should be able to fine tune this if you find your module executing a little too soon, like before mod_ssl for example.
Also, I am terrible at following documents, but the official Apache module development docs are amazingly assembled. Please try to use them, if you have,
I have spent the last 6 months messing around with Apache module development, working on a telegram bot.
I have had to do this song and dace a few times now.

Data loss on concurrent file write in camel

I am using camel technology for my file operation. My system is cluster environment.
Let say, I have 4 instances
Instance A
Instance B
Instance C
Instance D
Folders Structure
Input Folder: C:/app/input
Output Folder: C:/app/output
All the four instances will be pointing to Input folder location. As per, my business 8 files will be placed in the input folder and output will be consolidated file. here camel losing data when concurrently writing to output file.
Route:
from("file://C:/app/input")
.setHeader(Exchange.File_Name,simple("output.txt"))
.to("file://C:/app/output?fileExist=Append")
.end();
Kindly help me to resolve this issue. is there any thing like write lock in camel? to avoid concurrent file writer. Thanks in advance
You can use the doneFile option of the file component, see http://camel.apache.org/file2.html for more information.
Avoid reading files currently being written by another application
Beware the JDK File IO API is a bit limited in detecting whether another application is currently writing/copying a file. And the implementation can be different depending on OS platform as well. This could lead to that Camel thinks the file is not locked by another process and start consuming it. Therefore you have to do you own investigation what suites your environment. To help with this Camel provides different readLock options and doneFileName option that you can use. See also the section Consuming files from folders where others drop files directly.

Trying to find information on how to build a simple file version controll system

Im want to build a file system for non-tecks( dont care about old versions of the file so no merging or svn/git). The thougt is that a user should be able to download a file, in the same instance the file should be locked for other users. When the first user is done editing the, the file should then automaticaly upload to the server. When he closes the file, the lock should den be opend.
Is this even possible? Im thingking a sort of browser plugin, but I cant find anywone that has done the same thing. (besides microsoft, but who want to go down that road)
That would be: Sharepoint, Alfresco, (almost every WIKI), ...
Actually that is a basic feature of most document management systems. Even SVN has that already and IIRC you can set that up with mod_dav_svn without a line of code (considering configuration is not code).
Also the interesting question is, IMHO, not TheHappyCase where the described unit of work goes well but what about this*:
I Checkout 50 random documents you need
(get some popcorn and wait for your stresslevel to go up)
?????
I get bored and forget about it (everything still being checked out)
*: Points (1) and (2) may change order

How to use Sphinx3 in an application

I used Sphinx4 for some time which really fits my needs. I load a recognizer, pass the audio data to it and use the recognized String in my application.
Right now I'm working on a C application (C++ is unfortunately not an option) where I need something similar and thought that I could use Sphinx3 which is written in C.
The problem is that I don't really know how it is used inside an application and there is no "Hello World"-example as Sphinx4 provides it.
I already compiled and installed sphinxbase and sphinx3 and now I can include the sphinx header files in my application.
Now to my questions:
Is there a "simple" and well documented example application that uses sphinx3 from a C environment?
How can I load up the sphinx3 engine and call a recognizer with my binary audio data?
OR: Do I need to start an application like "sphinx3_decode" and call it from my own application? If so, is there an example application for that?
Thank you in advance!
Best regards,
Robert
It's not recommended to use Sphinx3. From the website:
Sphinx-3 is CMU’s large vocabulary speech recognition system. It’s
older C based decoder that we continue to maintain. It’s planned to
make it obsolete in the future, it’s still most accurate decoder for
large vocabulary tasks. We are using it as a baseline to check the
recognizer accuracy. This decoder is only intended for researchers who
want to evaluate bleeding edge methods in ASR like tree search method.
If you need to use a decoder you should use pocketsphinx. You can find the tutorial and the API documentation on the website
http://cmusphinx.sourceforge.net/wiki/tutorialpocketsphinx
http://cmusphinx.sourceforge.net/api/pocketsphinx/pocketsphinx_8h.html
I Recently worked on an Intregated Project on Punjabi Language.
Here are some steps that we used...
First we recorded the punjabi audio data in a vaccumed room in 16000 hz sample rate.
Then we took the recorded data and segmented it using Praat Software into small wav and raw files of 2 to 30 sec and saved them in a folder named train.
Then we took a system having Linux ie. Ubuntu and installed the required plug in like autoconfig, automake etc and untarred Sphinx 3 along with 4 packages that are cmuclmtk, pocketsphinx, sphinxbase, sphinxtrain.
Then according to the small wav files we made many files like transcription, dic, phone, filler, file id, ccs etc.
Then we opened the terminal and typed –"sphinx_fe” to check the whether the sphinx is functional or not.
Then we created an folder named “man” and then in terminal wrote its path.
Then we run the command- “sphinxtrain –t man setup”. By running this command an folder named “etc” will be formed in “man” folder containing files “feat_paramas” & ”config”.
Changes were made in the in the config file according to our data.
Then we moved all the files that we created before ie. transcription, dic in the etc folder in that is located in man folder.
Then we placed ‘lang1.sh” script in etc folder and remaining 4 scripts in man folder.
Then we opened the path for etc folder in terminal and run command- “lang1.sh”
Then we run series of commands in terminal – “mfcgen2.sh” then “verify3.sh” then “hmm4.sh” and at last “end-test.sh” to get the final result.
Rest if you have worked on Sphinx 4 then you may know about the files that are mentioned above in the steps. I hope this helps you.

Creating a log file with current time

I am trying to do something similar to Appending current time to a new log file each time log4j is initialized.
I am using log4c for logging. I would like to be able to create a new log file with each execution of the application. Is it possible to do this, by only modifying the log4crc config file.
All help will be greatly appreciated
ps: The tag I wanted to used is log4c, but it isn't there in SO
Doesn't seem to be possible via any config file. I had to modify the appender used to name the log file based on the current time. I used the functions time(), localtime() and strftime() to create the file name
I had a similar problem. It is now fixed in the current release, but Ubuntu for example still ships an older version without this facility.
See How to change log4c's default timezone?

Resources