Tutorial by Examples: er

const namedMember1 = ... const namedMember2 = ... const namedMember3 = ... export { namedMember1, namedMember2, namedMember3 }
Until recently, using android.support.v4.app.FragmentPagerAdapter would prevent the usage of a PreferenceFragment as one of the Fragments used in the FragmentPagerAdapter. The latest versions of the support v7 library now include the PreferenceFragmentCompat class, which will work with a ViewPager ...
docker run --name="test-app" --entrypoint="/bin/bash" example-app This command will override the ENTRYPOINT directive of the example-app image when the container test-app is created. The CMD directive of the image will remain unchanged unless otherwise specified: docker run -...
docker run --add-host="app-backend:10.15.1.24" awesome-app This command adds an entry to the container's /etc/hosts file, which follows the format --add-host <name>:<address>. In this example, the name app-backend will resolve to 10.15.1.24. This is particularly useful for t...
0.170.18.0 At the time of writing (July 2016) elm-reactor has been temporarily stripped of its time traveling functionality. It's possible to get it, though, using the jinjor/elm-time-travel package. It's usage mirrors Html.App or Navigation modules' program* functions, for example instead of: im...
Note: this is not very efficient due to the nature of List (see Remarks below). It will be better to construct the list the "right" way from the beginning than to construct it and then reverse it. > List.reverse [1,3,5,7,9] [9,7,5,3,1] : List number
By default List.sort sorts in ascending order, with the compare function. There are two ways to sort in descending order: one efficient and one inefficient. The efficient way: List.sortWith and a descending comparison function. descending a b = case compare a b of LT -> GT ...
List.sortBy allows to use a function on the elements and use its result for the comparison. > List.sortBy String.length ["longest","short","medium"] ["short","medium","longest"] : List String -- because the lengths are: [7,5,6] It ...
C++14 Those following duration user literals are declared in the namespace std::literals::chrono_literals, where both literals and chrono_literals are inline namespaces. Access to these operators can be gained with using namespace std::literals, using namespace std::chrono_literals, and using names...
Paramorphisms model primitive recursion. At each iteration of the fold, the folding function receives the subtree for further processing. para :: Functor f => (f (Fix f, a) -> a) -> Fix f -> a para f = f . fmap (\x -> (x, para f x)) . unFix The Prelude's tails can be modelled as ...
The source code with @profile directive before the function we want to profile: import requests @profile def slow_func(): s = requests.session() html=s.get("https://en.wikipedia.org/").text sum([pow(ord(x),3.1) for x in list(html)]) for i in range(50): s...
Elm Reactor is the essential tool for prototyping your application. Please note, that you will not be able to compile Main.elm with Elm Reactor, if you are using Http.App.programWithFlags or Ports Running elm-reactor in a projects directory will start a web server with a project explorer, that all...
C++14 Those following string user literals are declared in the namespace std::literals::string_literals, where both literals and string_literals are inline namespaces. Access to these operators can be gained with using namespace std::literals, using namespace std::string_literals, and using namespa...
Assertations mean that a condition should be checked and if it's false, it's an error. For static_assert(), this is done compile-time. template<typename T> T mul10(const T t) { static_assert( std::is_integral<T>::value, "mul10() only works for integral types" ); re...
See below for a simple example of how to use a BackgroundWorker object to perform time-intensive operations in a background thread. You need to: Define a worker method that does the time-intensive work and call it from an event handler for the DoWork event of a BackgroundWorker. Start the execu...
In PCRE, matched groups used for backreferences before a recursion are kept in the recursion. But after the recursion they all reset to what they were before entering it. In other words, matched groups in the recursion are all forgotten. For example: (?J)(?(DEFINE)(\g{a}(?<a>b)\g{a}))(?<a...
Prerequisite steps: Install Java at your machine Visit neo4j website and click the link "Download Community Edition" or visit directly the download link. Unzip the .tar downloaded file in your home directory Start Neo4j from console (headless, without web server) Visit the sub-d...
C++14 Those following complex user literals are declared in the namespace std::literals::complex_literals, where both literals and complex_literals are inline namespaces. Access to these operators can be gained with using namespace std::literals, using namespace std::complex_literals, and using nam...
Quite often you have a file which was edited within DOS or Windows and you are viewing it under UNIX. This can look like the following when you view the file with vi. First line of file^M Next Line^M And another^M If you wish to remove the ^M, it can be that you delete each ^M by hand. Alter...
Timers are used to perform tasks at specific intervals of time (Do X every Y seconds) Below is an example of creating a new instance of a Timer. NOTE: This applies to Timers using WinForms. If using WPF, you may want to look into DispatcherTimer using System.Windows.Forms; //Timers use the Wi...

Page 162 of 417