What is the difference between allFile and allMarkdownRemark in gatsby

It always depends on your filesystem and how it is set up. The short answer is that allFile retrieves all kind of files (images, markdowns, JSONs, etc) set in your gatsby-source-filesystem while allMarkdownRemark only fetches the markdown files because a transformer plugin has previously created a specific node to do so. allMarkdownRemark, of course, is more specific and has better performance, … Read more

‘do…while’ vs. ‘while’

If you always want the loop to execute at least once. It’s not common, but I do use it from time to time. One case where you might want to use it is trying to access a resource that could require a retry, e.g.

anaconda – graphviz – can’t import after installation

The graphviz conda package is no Python package. It simply puts the graphviz files into your virtual env’s Library/ directory. Look e.g. for dot.exe in the Library/bin/ directory.To install the `graphviz` **Python package**, you can use `pip`: `conda install pip` and `pip install graphviz`. Always prefer conda packages if they are available over pip packages. Search for the package you need (`conda search pkgxy`) and … Read more

How to parse this string in Java?

If you want to split the String at the / character, the String.split method will work: For example: Output Edit Case with a / in the prefix, and we know what the prefix is: The substring without the prefix “slash/prefix/” is made by the substring method. That String is then run through split. Output: Edit again If this String is actually dealing with file paths, using the File class is probably more preferable than … Read more

Please initialize the log4j system properly. While running web service

Those messages are something tricky, enough so that people created this to make it clearer: https://issues.apache.org/bugzilla/show_bug.cgi?id=25747 What’s tricky about them is that the warnings are written if Log4j can’t find its log4j.properties (or log4j.xml) file, but also if the file is fine and dandy but its content is not complete from a configuration point of view. The following paragraph … Read more

Can jpg images support animation?

No, the JPEG file format has no inherent support for animation. The image you linked is actually an animated GIF disguised with a jpg file extension. (The browser apparently ignores even the MIME type and looks at the file header bytes in such cases.)

Tkinter scrollbar for frame

“Am i doing it right?Is there better/smarter way to achieve the output this code gave me?” Generally speaking, yes, you’re doing it right. Tkinter has no native scrollable container other than the canvas. As you can see, it’s really not that difficult to set up. As your example shows, it only takes 5 or 6 … Read more

How to find the sum of an array of numbers

Recommended (reduce with default value) Array.prototype.reduce can be used to iterate through the array, adding the current element value to the sum of the previous element values.  Run code snippetExpand snippet Without default value You get a TypeError  Run code snippetExpand snippet Prior to ES6’s arrow functions  Run code snippetExpand snippet Non-number inputs If non-numbers are … Read more