Tutorial by Examples: c

You can use the following code for going back and forward. if (!function_exists('mb_internal_encoding')) { function mb_internal_encoding($encoding = NULL) { return ($from_encoding === NULL) ? iconv_get_encoding() : iconv_set_encoding($encoding); } } if (!function_exists('mb_c...
When localizing different types of resources are required, each of which has its own home in the android project structure. Following are the different directories that we can place under the \res directory. The resource types placed in each of these directories are explained in the table below: D...
Each resource directory under the res folder (listed in the example above) can have different variations of the contained resources in similarly named directory suffixed with different qualifier-values for each configuration-type. Example of variations of `` directory with different qualifier value...
C and C++ are well known as high-performance languages - largely due to the heavy amount of code customization, allowing a user to specify performance by choice of structure. When optimizing it is important to benchmark relevant code and completely understand how the code will be used. Common opti...
The most straightforward approach to optimizing is by executing less code. This approach usually gives a fixed speed-up without changing the time complexity of the code. Even though this approach gives you a clear speedup, this will only give noticable improvements when the code is called a lot. R...
Optimizing by using the right data structures at the right time can change the time-complexity of the code. // This variant of stableUnique contains a complexity of N log(N) // N > number of elements in v // log(N) > insert complexity of std::set std::vector<std::string> stableUnique...
Save the session variable as a variable. $session = Yii::$app->session; $sess = $session['keys']; Then create or update the array value you want $sess['first'] = 'abc'; And finally save to the session variable $session['keys'] = $sess
Returns true or false, which indicates whether the regexp is matched or not without updating $~ and other related variables. If the second parameter is present, it specifies the position in the string to begin the search. /R.../.match?("Ruby") #=> true /R.../.match?("Ruby&quot...
When storing JSON documents in SQL Server, We need to be able to efficiently filter and sort query results on properties of the JSON documents. CREATE TABLE JsonTable ( id int identity primary key, jsonInfo nvarchar(max), CONSTRAINT [Content should be formatted as JSON] CHECK...
Variadic functions are created using the ... ellipses syntax in the argument list of the function definition. function id(...) return end If you called this function as id(1, 2, 3, 4, 5) then ... (AKA the vararg list) would contain the values 1, 2, 3, 4, 5. Functions can take required arg...
As stated in the basic examples, you can have variable bound arguments and the variable argument list (...). You can use this fact to recursively pull apart a list as you would in other languages (like Haskell). Below is an implementation of foldr() that takes advantage of that. Each recursive call ...
Creating a dictionary: set mydict [dict create a 1 b 2 c 3 d 4] dict get $mydict b ; # returns 2 set key c set myval [dict get $mydict $key] puts $myval # remove a value dict unset mydict b # set a new value dict set mydict e 5 Dictionary keys can be nested. dict set mycars mustang colo...
Use a mutex to synchronise access to a variable which is accessed from multiple threads: counter = 0 counter_mutex = Mutex.new # Start three parallel threads and increment counter 3.times.map do |index| Thread.new do counter_mutex.synchronize { counter += 1 } end end.each(&:joi...
The static keyword is used on a class, method, or field to make them work independently of any instance of the class. Static fields are common to all instances of a class. They do not need an instance to access them. Static methods can be run without an instance of the class they are in. However...
Abstraction is a process of hiding the implementation details and showing only functionality to the user. An abstract class can never be instantiated. If a class is declared as abstract then the sole purpose is for the class to be extended. abstract class Car { abstract void tagLine(); } ...
Synchronized modifier is used to control the access of a particular method or a block by multiple threads. Only one thread can enter into a method or a block which is declared as synchronized. synchronized keyword works on intrinsic lock of an object, in case of a synchronized method current objects...
Java SE 1.2 strictfp modifier is used for floating-point calculations. This modifier makes floating point variable more consistent across multiple platforms and ensure all the floating point calculations are done according to IEEE 754 standards to avoid errors of calculation (round-off errors), ov...
This worked for me to move from Ubuntu 12.04 (Jenkins ver. 1.628) to Ubuntu 16.04 (Jenkins ver. 1.651.2). I first installed Jenkins from the repositories. Stop both Jenkins servers Copy JENKINS_HOME (e.g. /var/lib/jenkins) from the old server to the new one. From a console in the new serve...
Create a new project.json and example Program.cs: dotnet new Restore needed packages: dotnet restore Compile and run the example: dotnet run
Go to the project.json directory and publish: dotnet publish It will print the output directory of the operation, enter the directory and run the published project: dotnet <project output>.dll The default folder will be: <project root>/bin/<configuration>/<target framewo...

Page 375 of 826