Why is not there a suffix link between these two nodes in this string's suffix tree? - suffix-tree

I am learning the Ukkonen's algorithm of how to generate a suffix tree from a given string. I tried one string "dedododeodo" in the visualization website http://brenden.github.io/ukkonen-animation/, one thing I do not fully understand is: why is not there any suffix link from node number 8 to node number 3?
My understanding is: the path-label is "od", then it should link to another node "d". Here both node number 8 and node number 3 are internal nodes. I do not understand why there is no suffix link from node 8 to node 3.
I know that the suffix link is generated intra-phase instead of inter-phase. But if you go to the step 17 of 21, then you will soon see the same confusion with me. After the rule-2 extension of character '$', we should follow the suffix link of node 8, which does not exist at all (or points to root you can say).
The visualization website chose to jump to the edge after node 3.
Am I missing something here? I learned one post from this link Ukkonen's suffix tree algorithm in plain English that sometimes suffix link does not exist, so we have to rescan from the root of the tree.
If what the author said is true, then how does it affect the runtime complexity? I mean, the whole idea of Ukkonen algorithm is based on several important tricks, and one of them is suffix link, right?
I have read some article about the linear time complexity proof. The suffix link is very important to guarantee a linear complexity. With suffix link, the node-depth drops by 2 at most, and the tree depth is at most n. With these two constraints, we can say the number of "down-walk" in the suffix tree is capped. With rescanning, the linear time complexity will no longer hold true?
Please help. Thanks. My implementation C++ source code is at here: https://github.com/hdc1112/SuffixTree

I just read the Gusfield G book again, and took a screenshot of one important theorem. The theorem told us that the suffix link can have two cases: 1st, it's from a previously created internal node to a newly created internal node; 2nd, it's from an internal node to another already existing internal node.
The theorem told us that the suffix link ending node can either be created or found.

Related

What is the best way for my rest api uri name to include module name that the ressource belongs to?

I'm wondering what is the best way for my rest api uri name to include the module name that the ressource belongs to? lets clarify this, my rest api should expose the details of Object-A and should also expose the details of Object-B, in this case i can't use the ressource name ipAdresse:port/details because there is two details types.
add to this that i should not use the nesting style like this ipAdresse:port/objectA/:id/details.
So in this case, is it better to do it the following way (include the parent ressource or module name in the url):
ipAdresse:port/objecta/details
or this way (using hyphen):
ipAdresse:port/objectb-details
thanks
There's a small advantage to using path segments, if you have a family of these documents that want to link to each other
/objecta/details
/objecta/comments
/objecta/pricing
These resources can all reference each other using dot segments (ex: ../comments), which means that you don't have to specify the "objecta" part in the links. In other words, you could move the whole family of identifiers to a different location in your hierarchy, and relative resolution would just work.
/objectb-details
/objectb-comments
/objectb-pricing
Each of these paths is a single segment, so dot segments remove the entire path, which you would have to replace (ex: ../objectb-comment), and if you decide to replace the objectb prefix with something else, you also need to update all of the links.
In effect, using / gives you a little bit of future proofing.
That said, if the hyphen-minus is part of the name of the thing, then leave it in the identifier.
/objective-c/comments
If you bring one of these to me in a code review, I'm going to think you've lost the plot:
/objective/c/comments
/objective-c-comments
But of course they will work just as well (the machines don't care) as long as the identifiers match the syntax described by RFC 3986.

How does VARIABLE_*_something works? in Yocto

I'm trying to build my own yocto_meta-layer based on the imx6ulevk and in ./meta-fsl-bsp-release/imx/meta-sdk/conf/distro/include/fsl-imx-preferred-env.inc I found something weird:
PREFERRED_PROVIDER_virtual/kernel_mx6ul = "linux-imx"
PREFERRED_PROVIDER_virtual/kernel_mx6sll = "linux-imx"
PREFERRED_PROVIDER_virtual/kernel_mx7 = "linux-imx"
So i was wondering what does the last *_word (i.e. PREFERRED_PROVIDER_virtual/kernel_*) means?
a) Does it is a way to set a virtual/kernel parser depending on the machine?
b) If [a] is yes, how do i know which name to put? or what part of the machine_name.conf i need to choose?
PREFERRED_PROVIDER_<recipe-name>_<machine-name> means this variable applies to mentioned recipe AND the respective MACHINE only. This is a common sighting in distro layers. In this particular case, the freescale layer is telling bitbake which Linux kernel recipe to choose depending on the MACHINE you either set in local.conf or pass via command line. More info here.
So the answer to a) is yes.
The answer to b) is that you should not bother with changing the PREFERRED_PROVIDER for the Linux kernel unless you really know what you're doing (i.e, writing a kernel recipe from scratch). Even if you have a custom board you're unlikely to change the virtual/kernel provider. You'd likely want to follow the BSP maintainer's recommendation. What you need to do is set a proper MACHINE, and the bitbake will take care of the rest.
For example if your MACHINE is mx6ul, invoking bitbake virtual/kernel is the same as bitbake linux-imx. The former is best practice, as you call that in Yocto regardless of the machine.
I'm afraid reading the docs is the best way to fully grasp Yocto. The good thing is that it's documented really well. You'd probably want to start from the development manual and the bitbake link above, before diving into the mega manual.
The suffix underscore '_' followed by a string means that the variable, PREFERRED_PROVIDER_virtual/kernel in this case is "overridden". bitbake will use this assignment when the OVERRIDES variable contains that particular string, such as "imx6ul".
Many times, if not all, the SoC architecture is set in the MACHINEOVERRIDES variable in the machine.conf, to define what the SoC is on the board. That consequently gets assigned to OVERRIDES in some yocto/bitbake recipe elsewhere.
The Conditional Syntax (Overrides) section in the bitbake manual [1] specifically talks about how this affects the variable expansion.
a.) If we were being strict with the terminology used by Yocto, it would be no. The "machine" per-se correlates to a board, such as "imx6ulevk". The overrides you have there more generally pertain to an SoC architecture (a chip). You may have many boards running the imx6ul for example. In this case it would pertain to all "machines" running that particular SoC (as defined by your machine in MACHINEOVERRIDES).
b.) Anything appearing in the colon delimited OVERRIDES variable is fair game. You can use the machine name because Yocto does in fact append the MACHINE name to it as well. But it doesn't really make sense to do that because you have a dedication machine.conf file for you to make a hard definition such as PREFERRED_PROVIDER_virtual/kernel = "something" if you really want a machine/board specific kernel selection. NXP did this in their distro layer to apply to many machines (aka boards) all at once.
Hint: to see what these variables expand out to, run bitbake -e virtual/kernel
These overrides are one of the most powerful features of bitbake. For example if you want to override the source revision of you linux-imx kernel build you can put something like SRCREV_pn-linux-imx = "something" in your local.conf. See if you can grep the recipe sources to find out how this works!
References:
[1] https://www.yoctoproject.org/docs/1.6/bitbake-user-manual/bitbake-user-manual.html#conditional-syntax-overrides

Convert kaitai-struct .ksy file to "pretty" tree view

I need to write documentation for a parser that was developed in Kaitai. Given a .ksy file, is there any way to produce "pretty" views of the tree?
There is a two year old fork of ksc that supports GraphViz output but the resulting output is pretty hard to work with.
(https://www.reddit.com/r/dataisbeautiful/comments/4zhpvh/binary_data_formats_network_packets_archives/)
I can easily determine what the nodes are but getting their immediate parent would add very useful context.
Thank you.
-David
Please define what exactly do you expect from a "pretty tree".
GraphViz support is available in master and stable releases for a long time (as -t graphviz), and is very well supported — basically every ksy in official repo is accompanied nowadays with a chart: for example, http://formats.kaitai.io/lzh/index.html
If you want to have a tree of values (as opposed to "tree of data types"), we actually have ksdump, which allows you to dump arbitary data file using arbitrary .ksy in a YAML/JSON/XML tree of values. Will it work for you?

Understanding the output of ClearNLP

I am using ClearNLP as a semantic labeler but I have some questions:
Can I change the output to a tree view that shows the semantic dependencies?
What does Sheads="2:A0=PAG" mean? I could not understand the semantic output in a sentence such: I have a new employee. He has studied computer science and has developed a lot of programs; he is qualified to be manager. add him in the appropriate table.
You can copy the output of the clearnlp suite and paste it in this online visualization tool that will draw it: http://www.mathcs.emory.edu/~choi/clearnlp/demo/demo.html
About your second question, A0 refers to the first slot in the SRL of the verb.

Checking PE header integrity

I have created a project on identifying malicious files using an artificial neural network. I am giving some selected features from PE structure as inputs to the neural network, and it is classifying files correctly. But referring to this answer : "https://security.stackexchange.com/questions/37921/windows-pe-file-and-malwares";it said that code can be injected into PE and values in optional header can be changed! I wanted to know if there is any way to know if PE structure has been modified?
One more link about injecting code into PE file: http://www.codeproject.com/Articles/12532/Inject-your-code-to-a-Portable-Executable-file
You can't know if the pe was modified if you don't have the orignal binary but each compiler or packer have a signature (you can look with rdg for example http://www.rdgsoft.net/) you can use it to see if this signature is not here anymore but it possible that the signature is here even if the binary was modified.
Else you can look if the binary have strange section or if some value in the structure is not logical
you can see also if each section have right protection .text -> execute etc.
if you want to learn more about it you look this link
https://github.com/katjahahn/PortEx/tree/master/masterthesis
You can read the difference strategy (appending to the orignal binary or prependeing or divided in multi part) of a malware and how to detect it.
for instance
Which functions you should found in the import table LoadLibrary, GetProcAddress etc.
and his tools to test these methods in practice:
https://github.com/katjahahn/PortEx