Talks | Rob 's presentations , in tasty hacker friendly form
kandi X-RAY | Talks Summary
kandi X-RAY | Talks Summary
Rob's presentations, in tasty hacker friendly form.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Talks
Talks Key Features
Talks Examples and Code Snippets
Community Discussions
Trending Discussions on Talks
QUESTION
I actually acomplished what I wanted to do: hiding some webkit pseudo-elements from the page when I want to print it, the code looks like below.
The problem is that I didnt learn anything from my research to do tha and I couldn't find any documentation about it, and every answer I saw about this topic only shows the code, without any further explanation.
...ANSWER
Answered 2022-Feb-24 at 15:24The best way to know which pseudo-elements you can work with is by reading specifications (like W3C standards) and realiable docs and resources (like MDN). If you can't find a particular pseudo-element there (or if it's only referred with a vendor prefix), you should probably avoid using it.
It seems ::-webkit-calendar-picker-indicator
is supported by Blink and WebKit (follow the links for little pieces of information), but since it's poorly documented and also non-standard I would refrain from adopting it at all.
QUESTION
As I just find out, SET
's behavior is different for .bat
and for .cmd
. My experiment shows that, SET
's behavior is determined by the startup batch file's extension(.bat or .cmd), NOT by the file extension that SET
statement resides in.
This is such a vague corner of Windows NT CMD batch script engine, Ben Hoffstein talks about it a bit. And I'd like to know, whether my conclusion is correct? Or, does Microsoft docs formally talks about this somewhere?
I'd also like to know, is there way to check, or even change, current mode?bat mode or cmd mode? If neither, I have to accept the fact that we batch script authors(especially when writing batch as functions) can make no assumptions.
My experiment belowRun from Windows 7 SP1.
showerr.bat ...ANSWER
Answered 2022-Mar-15 at 05:08I'd suggest that running .bat
, the set
is leaving errorlevel
unchanged, but this has been "corrected" for .cmd
to setting errorlevel
to 0 as the set
succeeded.
QUESTION
Is the Shannon-Fano coding as described in Fano's paper The Transmission of Information (1952) really ambiguous?
In Detail:3 papers
Claude E. Shannon published his famous paper A Mathematical Theory of Communication in July 1948. In this paper he invented the term bit as we know it today and he also defined what we call Shannon entropy today. And he also proposed an entropy based data compression algorithm in this paper. But Shannon's algorithm was so weak, that under certain circumstances the "compressed" messages could be even longer than in fix length coding. A few month later (March 1949) Robert M. Fano published an improved version of Shannons algorithm in the paper The Transmission of Information. 3 years after Fano (in September 1952) his student David A. Huffman published an even better version in his paper A Method for the Construction of Minimum-Redundancy Codes. Hoffman Coding is more efficient than its two predecessors and it is still used today. But my question is about the algorithm published by Fano which usually is called Shannon-Fano-Coding.
The algorithm
This description is based on the description from Wikipedia. Sorry, I did not fully read Fano's paper. I only browsed through it. It is 37 pages long and I really tried hard to find a passage where he talks about the topic of my question, but I could not find it. So, here is how Shannon-Fano encoding works:
- Count how often each character appears in the message.
- Sort all characters by frequency, characters with highest frequency on top of the list
- Divide the list into two parts, such that the sums of frequencies in both parts are as equal as possible. Add the bit
0
to one part and the bit1
to the other part. - Repeat step 3 on each part that contains 2 or more characters until all parts consist of only 1 character.
- Concatenate all bits from all rounds. This is the Shannon-Fano-code of that character.
An example
Let's execute this on a really tiny example (I think it's the smallest message where the problem appears). Here is the message to encode:
ANSWER
Answered 2022-Mar-08 at 19:00To directly answer your question, without further elaboration about how to break ties, two different implementations of Shannon-Fano could produce different codes of different lengths for the same inputs.
As @MattTimmermans noted in the comments, Shannon-Fano does not always produce optimal prefix-free codings the way that, say, Huffman coding does. It might therefore be helpful to think of it less as an algorithm and more of a heuristic - something that likely will produce a good code but isn't guaranteed to give an optimal solution. Many heuristics suffer from similar issues, where minor tweaks in the input or how ties are broken could result in different results. A good example of this is the greedy coloring algorithm for finding vertex colorings of graphs. The linked Wikipedia article includes an example in which changing the order in which nodes are visited by the same basic algorithm yields wildly different results.
Even algorithms that produce optimal results, however, can sometimes produce different optimal results based on tiebreaks. Take Huffman coding, for example, which works by repeatedly finding the two lowest-weight trees assembled so far and merging them together. In the event that there are three or more trees at some intermediary step that are all tied for the same weight, different implementations of Huffman coding could produce different prefix-free codes based on which two they join together. The resulting trees would all be equally "good," though, in that they'd all produce outputs of the same length. (That's largely because, unlike Shannon-Fano, Huffman coding is guaranteed to produce an optimal encoding.)
That being said, it's easy to adjust Shannon-Fano so that it always produces a consistent result. For example, you could say "in the event of a tie, choose the partition that puts fewer items into the top group," at which point you would always consistently produce the same coding. It wouldn't necessarily be an optimal encoding, but, then again, since Shannon-Fano was never guaranteed to do so, this is probably not a major concern.
If, on the other hand, you're interested in the question of "when Shannon-Fano has to break a tie, how do I decide how to break the tie to produce the optimal solution?," then I'm not sure of a way to do this other than recursively trying both options and seeing which one is better, which in the worst case leads to exponentially-slow runtimes. But perhaps someone else here can find a way to do that>
QUESTION
Is there an R equivalent to Python's range function?
In Python I can do this:
...ANSWER
Answered 2022-Feb-14 at 12:11There is no exact equivalent. As noted, seq
doesn't work because the by
argument is automatically set with the correct sign, and generates an error if you try to explicitly pass a positive sign when to < from
. Just create a very simple wrapper if you need to have the exact match.
QUESTION
ive started making a HTML/CSS/Vanilla JS web component library, and so far everything is going great. im using the typical ::part and all that, but i stumbled accros ::theme selector aswell, which is supposed to give quick access to styling without a creator having to set up more than necesarry.
problem is, i - whatever ive tried - can't seem to the get the ::theme selector work, is there anyone who can help me out ?
screendump is from https://meowni.ca/posts/part-theme-explainer/, tried following but i dont know if this selector is still experimental ?, it would really make styling my components alot easier if it worked !
...ANSWER
Answered 2021-Dec-01 at 14:44After a lot of digging, I've found the ::theme selector was a proposal which didn't get implemented
Although mentioned here https://developer.mozilla.org/en-US/docs/Web/CSS/::part at the bottom under "See also".
I then found this explainer issue that was closed, confirming that the ::theme did not make the cut https://github.com/fergald/docs/issues/4
The ::theme selector is therefor also not in the docs of CSS Shadow parts as of the CSS W3C Editors draft from 15th September 2020, see it below:
https://drafts.csswg.org/css-shadow-parts/
I don't know if anyone will pick up the torch and implement this pseudo selector, but i surely do hope so, as i would see it frequently used, at least in my needs.
Hope this question and answer will help someone else out and not spend tons of time going down this rabbit-hole :)
QUESTION
I'm trying to make sure that at least 4 alphanumeric characters are included in the input, and that underscores are also allowed.
The regular-expressions tutorial is a bit over my head because it talks about assertions and success/failure if there is a match.
...ANSWER
Answered 2021-Sep-29 at 19:22I suggest using atomic groups (?>...)
, please see regex tutorial for details
QUESTION
I have read through different articles which talks about why we cannot create generic array in java, but still I don't quite understand why.
For example, it this post, it assumed if generic array initialisation is possible, there will be casting issue after erasure. You can find the details in section 2. Considerations When Using Generic Arrays. In simplest term, the generic array becomes an Object Array after erasure, and if the generic type is String, java will fail to cast Object[] to String[].
However, I created a generic class with a simple function,
...ANSWER
Answered 2021-Sep-25 at 13:28After erasure, the getStringArr should return Object[], and it is able to cast to String[] without any problem.
Return type of the getStrArr
, after type erasure, would be Object[]
but, in your code, it is returning arr
which is of type String[]
. That is why there is not ClassCastException
in your code.
Consider the following method (suppose generic arrays were allowed):
QUESTION
The section in the Rust documentation that talks about patching explains how to implement a patch, but all of the examples it uses are for "testing" and short term fixing. What I want to do is make a patch for one of the crates I depend on that bumps its sub-dependencies, and then I would then like to publish my crate with its patched dependencies on crates.io
. However, when you create a patch you have to list a path dependency, as in the example:
ANSWER
Answered 2021-Sep-19 at 00:02Note: crates.io does not allow packages to be published with path dependencies (path dev-dependencies are ignored). See the Multiple locations section for a fallback alternative.
It is possible to specify both a registry version and a git or path location. The git or path dependency will be used locally (in which case the version is checked against the local copy), and when published to a registry like crates.io, it will use the registry version. Other combinations are not allowed.
You will need to have the dependency uploaded to crates.io.
QUESTION
I want to make sure I properly understand the constraint normalization process since cppreference is slightly fuzzy on this topic.
It seems that during the normalization, anything that is inside of a requires
expression is always considered an atom, no matter how specific/complex.
This seems to be supported by the different handling of:
...ANSWER
Answered 2021-Sep-14 at 22:06The rules of constraint expression normalization act recursively top-down. If an expression is not a conjunction/disjunction of two expressions, is not a parenthesized expression, and is not a concept name, then it is an atomic constraint expression. A requires
expression is not one of those exceptions, so it is an atomic constraint expression.
QUESTION
Git's fsck
doc talks about "dangling" objects, while the gc
doc talks only about "loose objects". There's a strict split.
But while skimming a few related SO posts, the terms seem to be used interchangeably. In the Git Book v2 and Git's source code as well:
...ANSWER
Answered 2021-Sep-10 at 05:12- Loose objects - are those that aren't packed. Git can compress many loose objects into a single pack file.
- Dangling object - is the one that's not referenced by anything (e.g. an orphan commit which has no branch/tag pointing to it). It's garbage that will at some point be collected by GC.
- "Unreachable" object (see comment by @torek). If commit A is a parent of B, then A is not dangling even if B is. Instead A is "unreachable". It's also part of garbage.
Loose object can be dangling, packs can contain dangling objects. So these concepts are orthogonal. But you can create a reference (branch, tag) which will reference a dangling commit and it will stop "dangle".
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Talks
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page