journald *reading* API? - api

journald writes binary log files; and their format is explicitly subject to change.
The Journald Reference Guide tells us, quote:
While it can be useful to get used to journalctl to read logs, it’s by
no means mandatory.
So, how can we read these files? Is there a journald reading API I missed? I couldn't find any yet.

Systemd (and journald) are written in C. They come with sd-journal.h header file and with C-API https://www.freedesktop.org/software/systemd/man/sd_journal_next.html# - sd_journal_open allows you to open logs and then read from them.
Other languages - https://www.freedesktop.org/software/systemd/python-systemd/journal.html#example-polling-for-journal-events https://github.com/nyantec/rust-journald - most probably build on top of the C api.
Moreover, journald is open source - https://github.com/systemd/systemd/blob/968680b23d1629d33deeea98b4f2b5fd106075b5/src/libsystemd/sd-journal/sd-journal.c#L1916 - and the file format is documented - https://www.freedesktop.org/wiki/Software/systemd/journal-files/ . You can re-implement your own API on top of system-specific I/O operations to read journal files.

Related

MediaStreamTrack - set source --W3C Documentation missed reference

While reading trough the documentation i got a hint that it is possible to add source from local media(video/audio) file and stream it using PeerConnection.
But the sentence:
Note that this document describes the use of microphone and camera type sources only, the use of other source types is described in other documents.
So, does does someone has these documents?
Take your pick from https://github.com/w3c/?query=mediacapture
https://w3c.github.io/mediacapture-fromelement/
https://w3c.github.io/mediacapture-depth/
https://w3c.github.io/mediacapture-screen-share/
And of course http://w3c.github.io/webrtc-pc/ can be a source itself.

Sending Data to OpenSplice (DDS)

I'm new to DDS and opensplice, so this may be simple, but I don't understand it.
I am reading about reader caches and writer caches in the opensplice documentation. I understand that data goes into the datawriter cache and is then sent to datareader caches. But how do you push the information you have to the datawriter cache in the first place?
Is there a seperate command for that or does data automatically get sent to the cache when you publish or subscribe a device or application to a topic?
I guess in all, my question is, how does data get into opensplice/ the datawriter cache?
I appreciate any help. Like I said, I've been reading through tutorials and reference guides. I see plenty about what happens when the info is in opensplice, but I can't figure out how you put it there. If possible, could you link to an example too please?
Thanks
Actually .. its as simple as doing a write() or read() for your topic, so its a straightforward API call to provide 'samples' to DDS (i.e. publishing data) or to extract 'samples' from DDS (i.e. reading subscribed data).
As Reinier suggested too, it typically helps to look at some of the bundled examples (you could start with the famous 'HelloWorld") on how to create the publisher/subscriber and reader/writer 'entities' that allow you to interact with DDS from your application (in its 'language of choice')
Note: the examples are located here (for a 32-bit linux installation):
/HDE/x86.linux/examples/dcps/
The source for the Helloworld example (for Java) would then be here:
/HDE/x86.linux/examples/dcps/HelloWorld/java/src

.scr file and APDU

I am using JCard sim, java card version 2.2.2 and I want to know how the .scr file is associated with the .java file. (the java card simulator on NetBeans IDE. I am not using an actual smartcard).
If someone can provide me with some useful links on how these two files are related, I would greatly appreciate it.
I have looked through the following links, but they were not specifically helpful in illustrating how I can modify the .scr file in association with my .java file
C H A P T E R 5 - Converting Java Class Files
How to write a Java Card applet: A developer's guide - JavaWorld
Basically what I am trying to do is create a test applet (without the need of .scr files to send and receive APDUs by my other files)
- I want to be able to read APDU which contains the the parameters for a function in my process method
- That function will then create another APDU as its output, which another function will read as one of it's parameters
As far as I understand, the .scr file is used to send command APDUs that is read by the applet, but there is no way to write to the .scr file.
How can I create my own .java test file that sends and receives APDUs instead of relying on the .scr?
I can provide more details of what my code looks, if absolutely required.
Thanks
You can communicate with the simulator using the method described in the quick start guide of jCardSim. It is also described how to select an Applet using the correct AID in there. The inherited process(APDU) method will receive any APDU send using the methods described in the quick start guide, starting with the SELECT by NAME APDU (INS = A4). After that it is normal APDU processing.

How is file upload handled in HTTP?

I am curious to know how webservers handle file uploads.
Is the entire file sent as a single chunk? Or is it streamed into the webserver - which puts it together and saves it in a temp folder for PHP etc. to use?
It's just a matter of following the encoding rules so that one can easily decode (parse) it. Read on the specification about multipart-form/data encoding (the one which is required in HTML based file uploads using input type="file").
Generally the parsing is done by the server side application itself. The webserver only takes care about streaming the bytes from the one to the other side.
It's streamed to answer that question, but see this RFC 1867 for more information.
RFC 1867 describes the mechanism.

Getting EPG info from DVB-T

I'm interested in grabbing the EPG data from DVB-T streams. Does anyone know of any C libraries or an alternative means of getting the data?
tv_grab_dvb can do this. See the subversion repository for sources.
tv_grab_dvb is made to work with the stream grabbed from the DVB-T card using dvbtools on Linux, but it may be portable to other platforms - I think it just works with the raw data from the stream.
...a new answer to an old question:
I wrote a utility called dvbtee that can be used as a c++ library, a cross-platform command line utility, or a node.js module.
(despite it being a c++ library, one could still link to it from c code)
The command line utility will parse your streams and output the EPG, depending on the arguments you specify, it can generate plain text or a JSON block of data.
dvbtee: a digital television streamer / parser / service information aggregator supporting various interfaces including telnet CLI & http control
The node.js module will emit events containing the PSIP table data (along with EPG info)
node-dvbtee: MPEG2 transport stream parser for Node.js with support for television broadcast PSIP tables