Tutorial by Examples: c

git difftool -t meld --dir-diff will show the working directory changes. Alternatively, git difftool -t meld --dir-diff [COMMIT_A] [COMMIT_B] will show the differences between 2 specific commits.
Using the Android API 23 or higher, very often such situation can be seen: This situation is caused by the structural change of the Android API regarding getting the resources. Now the function: public int getColor(@ColorRes int id, @Nullable Theme theme) throws NotFoundException should...
Define a menu in res/menu <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/first_...
git diff myfile.txt Shows the changes between the previous commit of the specified file (myfile.txt) and the locally-modified version that has not yet been staged. This also works for directories: git diff documentation The above shows the changes between the previous commit of all files in ...
Suppose you have a Dockerfile ending with ENTRYPOINT [ "nethogs"] CMD ["wlan0"] if you build this image with a docker built -t inspector . launch the image built with such a Dockerfile with a command such as docker run -it --net=host --rm inspector ,nethogs will monitor the...
If someone else wrote the code you are committing, you can give them credit with the --author option: git commit -m "msg" --author "John Smith <[email protected]>" You can also provide a pattern, which Git will use to search for previous authors: git commit -m &quo...
Python makes it very simple to check whether an item is in a list. Simply use the in operator. lst = ['test', 'twest', 'tweast', 'treast'] 'test' in lst # Out: True 'toast' in lst # Out: False Note: the in operator on sets is asymptotically faster than on lists. If you need to use it ...
To execute operations in a container, use the docker exec command. Sometimes this is called "entering the container" as all commands are executed inside the container. docker exec -it container_id bash or docker exec -it container_id /bin/sh And now you have a shell in your running...
To temporarily mark a file as ignored (pass file as parameter to alias) - type: unwatch = update-index --assume-unchanged To start tracking file again - type: watch = update-index --no-assume-unchanged To list all files that has been temporarily ignored - type: unwatched = "!git ls-fil...
There are two ways to achieve that, the first and most known is the following: docker attach --sig-proxy=false <container> This one literally attaches your bash to the container bash, meaning that if you have a running script, you will see the result. To detach, just type: Ctl-P Ctl-Q Bu...
Users of homebrew can install gradle by running brew install gradle
We plot a simple scatter plot using the builtin iris data set as follows: library(ggplot2) ggplot(iris, aes(x = Petal.Width, y = Petal.Length, color = Species)) + geom_point() This gives:
There are different cases where you must Explicitly specify the type parameters for a generic method. In both of the below cases, the compiler is not able to infer all of the type parameters from the specified method parameters. One case is when there are no parameters: public void SomeMethod<T...
Pattern matching can be useful to handle Options: let result = Some("Hello World") match result with | Some(message) -> printfn message | None -> printfn "Not feeling talkative huh?"
To get all the information for a container you can run: docker inspect <container>
You can get an specific information from a container by running: docker inspect -f '<format>' <container> For instance, you can get the Network Settings by running: docker inspect -f '{{ .NetworkSettings }}' <container> You can also get just the IP address: docker inspect ...
Sometimes, you need to work with an array while ensuring you don't modify the original. Instead of a clone method, arrays have a slice method that lets you perform a shallow copy of any part of an array. Keep in mind that this only clones the first level. This works well with primitive types, like n...
Before the C compiler starts compiling a source code file, the file is processed in a preprocessing phase. This phase can be done by a separate program or be completely integrated in one executable. In any case, it is invoked automatically by the compiler before compilation proper begins. The prepro...
After the C pre-processor has included all the header files and expanded all macros, the compiler can compile the program. It does this by turning the C source code into an object code file, which is a file ending in .o which contains the binary version of the source code. Object code is not directl...
Sometimes it's necessary to convert a Discriminated Union to and from a string: module UnionConversion open Microsoft.FSharp.Reflection let toString (x: 'a) = match FSharpValue.GetUnionFields(x, typeof<'a>) with | case, _ -> case.Name let fromStri...

Page 101 of 826