Tutorial by Examples: c

The System.Collections.Immutable NuGet package provides immutable collection classes. Creating and adding items var stack = ImmutableStack.Create<int>(); var stack2 = stack.Push(1); // stack is still empty, stack2 contains 1 var stack3 = stack.Push(2); // stack2 still contains only one, st...
Implementation of the Caesar cipher. This implementation performs the shift operation only on upper and lower case alphabets and retains the other characters (such as space as-is). The Caesar cipher is not secure as per current standards. Below example is for illustrative purposes only ! Refer...
The HTML5 file API allows you to restrict which kind of files are accepted by simply setting the accept attribute on a file input, e.g.: <input type="file" accept="image/jpeg"> Specifying multiple MIME types separated by a comma (e.g. image/jpeg,image/png) or using wild...
To create an explosion, the following method signatures may be used: boolean createExplosion(double x, double y, double z, float power); boolean createExplosion(double x, double y, double z, float power, boolean setFire); boolean createExplosion(double x, double y, double z, float power, ...
When working with components, such as vertices or uv points, Maya defaults to returning a colon-separated range rather than individual items: print cmds.ls('pCube1.vtx[*]') # get all the vertices in the cube # [u'pCube1.vtx[0:7]'] You can use ls with the flatten option to force Maya to expan...
Basic reading image from java import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.imgcodecs.Imgcodecs; //Load native library System.loadLibrary(Core.NATIVE_LIBRARY_NAME); //Mat object used to host the image Mat imageArray; //Read image file from vile system ima...
Where we came from Sometimes we can't provide all of the required metadata needed for the XmlSerializer framework in attribute. Suppose we have a base class of serialized objects, and some of the derived classes are unknown to the base class. We can't place an attribute for all of the classes which...
In Production its good practice to secure your data and only allow operations on it to be undertaken via Stored Procedures. This means your application can't directly run CRUD operations on your data and potentially cause problems. Assigning permissions is a time-consuming, fiddly and generally oner...
In normal mode: gg go to top = then G
Full list of options: ls -a list all files including hidden file starting with '.' ls --color colored list [=always/never/auto] ls -d list directories - with ' */' ls -F add one char of */=>@| to enteries ls -i list file's inode index number ls -l list with long form...
To update a specific program: sudo pacman -S <programName> To update entire the system: sudo pacman -Syu
Customer Table IdFirstNameLastName1OzgurOzturk2YoussefMedi3HenryTai Order Table IdCustomerIdAmount12123.502314.80 Get all customers with a least one order SELECT * FROM Customer WHERE EXISTS ( SELECT * FROM Order WHERE Order.CustomerId=Customer.Id ) Result IdFirstNameLastName2YoussefM...
New repository can be created with two different options: 1. Using command line Execute following command. It will create a directory for the repository, but parent path has to be present. i.e. in the following example, /var/svn should already be there, while it will create my_repository directory...
This is just a small hack for those who use self-defined functions often. Type "fun" RStudio IDE and hit TAB. The result will be a skeleton of a new function. name <- function(variables) { } One can easily define their own snippet template, i.e. like the one below ...
If you want to use the shorthand you can make use of conditional logic with the following shorthand. Only the string 'false' will evaluate to true (2.0). #Done in Powershell 2.0 $boolean = $false; $string = "false"; $emptyString = ""; If($boolean){ # this does not ru...
CORS (Cross-origin resource sharing) happens when the JavaScript makes a cross-domain XHR (XMLHttpRequest) call. On Wikipedia stands this image that gives more information about the workflow of CORS. More information about CORS can be found on the Mozilla Developer Network.
Dynamic programming solves problems by combining the solutions to subproblems. It can be analogous to divide-and-conquer method, where problem is partitioned into disjoint subproblems, subproblems are recursively solved and then combined to find the solution of the original problem. In contrast, dyn...
Eloquent relationships are defined as functions on your Eloquent model classes. Since, like Eloquent models themselves, relationships also serve as powerful query builders, defining relationships as functions provides powerful method chaining and querying capabilities. For example, we may chain addi...
XML documentation comments can be used to provide API documentation that can be easily processed by tools: /// <summary> /// A helper class for validating method arguments. /// </summary> public static class Precondition { /// <summary> /// Throws an <see cref...
This is not something you will see in other programming environments. I came across it some years back and I couldn't understand why it was happening, but after working with MATLAB for some time I was able to figure it out. Look at the code snippet below: for x = 1:10 for x = 1:10 fpr...

Page 643 of 826