For being hacker proof, its very important you dont store anything
clearly in the exe file.
That goes for the variables too.
When u read into memory, make sure its not easy to locate
and read. ( in mem)
so do not store passwords or user names as clean text inside program.
all must be encrypted.
That will only keep noob hackers out.
Anyone pro, will most likely be able to get access if
unlimited access to app and data.
Since you seem to have some problems with QRegularExpression (Read the documentation! It's the best I have ever seen!), I will give you a small example. I happen to be using something like this in a program I am working on:
The ?<name>-blocks are there to provide named captures in the matches. The first one is called junk - it is allowed to contain anything but the "src"-attribute (.*? matches any sign in a "lazy" manner). junk2 behaves equivalently; if you don't need to capture (i.e. store for later access) these groups, you could simplify the expression a bit.
path will be storing the download-link for the image. \\S will match every non-whitespace character, +? means that there has to be at least one character like that. You will have to adapt to path including "-signs, depends on your specific case.
Here a bit of code I copied and slightly modified from the documentation for QRegularExpression:
Hand in your html-file instead of s, take care of some minute details (path enclosed in " or not? Maybe no space before junk2? etc.), and then you should be able to do whatever you want with your links.
I hope that gets you started.
What I suggested is not compression per se, but a way to encode (meaning represent) base pair data more efficiently. As I noted, this is no way a complete solution, but I think it should give you a starting point. Since adenine is complementary to thymine the first could be encoded as a bit sequence 00 and the other as 11, while cytosine and guanine could be encoded as 01 and 10 respectively. This way you can get the complementary base by only inverting bits. Suppose you have encoded half the strain of DNA, then the complementary strain you get simply by inverting all the bits. Since the base data is only 2 bits fixed size you can use offsets to calculate where that data is exactly located in a long base pair sequence. Suppose you have a sequence of alleles and you know that some gene contains 3 alleles and starts with the 35th allele of the base-pair sequence, then you can access the gene sequence very easily. The gene should start at (35 - 1) * 3 = 102th base pair (or 102 * 2 = 204th bit) and the size is simply 9 base pairs or 18 bits. I just hope my biology is not failing me with the calculations. So if you had the whole sequence mapped in a binary file, to read up the gene you seek out the correct position directly by those offsets:
; //< You know the drill with handling errors
file.seek(25); //< Go to the 25-th byte (200th bit)
QByteArray geneSequenceData = file.read(3); //< Read 3 bytes (up to bit 224)
// So in the byte array we've read we have the gene we're interested in, and it starts at the 4-th bit and ends at bit 22
// The total number of bits read is 24
The whole point of having a structured binary file is to be able to seek around it without actually reading things. Obviously my example is pretty superficial and it's much better to have special class that represent a base pair sequence, class representing gene offsets and other data you might want to handle. Additionally, you probably'd need some meta-information written in that file (offsets of sequences, genes or other things) so you could locate what you need. This is not possible with text files, especially in a platform independent fashion. Moreover a sequence of 4 base pairs you encode in 4 bytes when you use text files, with the proposed encoding scheme you only need a single byte!
Check the documentation for QMediaObject class: http://doc.qt.io/qt-5/qmediaobject.html
QVariant QMediaObject::metaData(const QString & key) const
You probably will need to use QAudioDecoder class which is derived from QMediaObject.
Bah, in my rush before I forgot a vital detail: the structs will also be accompanied by blobs of binary data, in the realm of 32kB or more. Not something you'd normally pass on the stack, although I realise that signal data is marshalled and queued internally. Is this a "sensible" thing to use signals/slots for, or is 32kB+ the point at which I should be looking at more serious data sharing strategies?
It is possible, although I advise you to implement implicit sharing. It's done quite easily through the QSharedDataPointer and QSharedData classes. Many of the Qt classes use those two to minimize actual data copying (including but not limited to all containers, images and the like). There are examples in the documentation how you can implement your own implicitly shared class, so I'll not make a point of it here. With sharing you could easily (and most importantly lightly) copy objects around that have payloads of megabytes without actually duplicating the data.
Also, I'm assuming that if one thread emits a series of identical signals via the default connection type (which acts like a QueuedConnection across thread boundaries), they will be received in the same order. Is this correct?
Yes, you are correct. The slot invocations are in actuality events in the event queue (for queued connections) of the thread, so they will be performed in the order of their arrival (the order in which signals had been emitted).
Just for an iteration the code reads line by line. As long as the search text is found, it will provide the remainder of the line. There is real dependency to the content as long as it is displayble (probably also some non-displayable characters). There are some special characters marking the end of lines (line feed (LF) and carriage return (CR) are those at least).
I understand your advice. 1 app access the file and the other app communicate directly to the first app. However, I aimed to use a memory-mapped-file just because I read some articles where it said this is one of the best practice to communicate two process without lossing information. Is this correct?
I am really interested in your advices, so I present my case:
GUI <-> MainAPP <-> SPortAPP
GUI can be anything made for anybody with the only requirement of implementing a protocol/API to communicate to MainAPP. (e.g. sockets)
MainAPP is my application who implement mathematics, logic, etc and defines the behaviour of my system. It cannot lose any information so I thought I might save it on a file.
SPortAPP is a propietary protocol implementation whereby external systems read/write information to the database of MainAPP . This app shouldn't interact directly to MainAPP
So, Such information must be available to read and write by both MainAPP and SPortAPP.
what is your opinion about it? Do you reccomend any other type of implementation?
Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.