Tutorial by Examples

Signals can have a default handler. All you need to do is to give it a body when you declare it. public class Emitter : Object { public signal void my_signal () { print ("Hello from the default handler!\n"); } } This handler will always be called after the connected...
You can declare a UIFont as follows: var font: UIFont! UIFont has more init() methods: UIFont.init(descriptor: UIFontDescriptor, size: CGFloat) UIFont.init(name: String, size: CGFloat) Therefore, you can initialize a UIFont like this: let font = UIFont(name: "Helvetica Neue", s...
To change a label's text font, you need to access its font property: label.font = UIFont(name:"Helvetica Neue", size: 15) The code above will change the font of the label to Helvetica Neue, size 15. Beware that you must spell the font name correctly, otherwise it will throw this error,...
Coercion happens with data types in R, often implicitly, so that the data can accommodate all the values. For example, x = 1:3 x [1] 1 2 3 typeof(x) #[1] "integer" x[2] = "hi" x #[1] "1" "hi" "3" typeof(x) #[1] "character" ...
The Builder Pattern decouples the creation of the object from the object itself. The main idea behind is that an object does not have to be responsible for its own creation. The correct and valid assembly of a complex object may be a complicated task in itself, so this task can be delegated to anoth...
Used for the RAII style acquiring of try locks, timed try locks and recursive locks. std::unique_lock allows for exclusive ownership of mutexes. std::shared_lock allows for shared ownership of mutexes. Several threads can hold std::shared_locks on a std::shared_mutex. Available from C++ 14. std:...
A shared_lock can be used in conjunction with a unique lock to allow multiple readers and exclusive writers. #include <unordered_map> #include <mutex> #include <shared_mutex> #include <thread> #include <string> #include <iostream> class PhoneBook { ...
std::call_once ensures execution of a function exactly once by competing threads. It throws std::system_error in case it cannot complete its task. Used in conjunction with std::once_flag. #include <mutex> #include <iostream> std::once_flag flag; void do_something(){ std::ca...
Renaming the server.php to index.php Copy the .htaccess from public folder to root folder Changing .htaccess a bit as follows for statics: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/$ /$1 [L,R=301] RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|ro...
Kernel manages operating system resources. User program can only access to those resources by making system calls to the kernel. System call is similar to an API of kernel, which in term, runs kernel tasks your program needs. str = "something" // run on user space x = x + 1 // run on use...
Use top command to exam CPU time allocation between user space and kernel space. Explanation: 24.8 us (user space): 24.8% of CPU time is spent on user process. 0.5 sy (system): 0.5% of CPU time is spent on kernel space. ni (niceness): the ratio of CPU time spent on low priority processes. i...
Use time command. time ./perl-timeout-example 100.100.100 We could not ping the desired address! real 0m5.0013s user 0m0.004s sys 0m0.008s Real: Total time from start to finish of the call, including the CPU time spent on other processes. User: The amount of CPU time spent i...
using UnityEngine; using UnityEngine.Advertisements; public class Example : MonoBehaviour { #if !UNITY_ADS // If the Ads service is not enabled public string gameId; // Set this value from the inspector public bool enableTestMode = true; // Enable this during development #en...
Steps to copy heroku database to local database: 1. Run copy process in terminal: heroku pg:pull DATABASE_URL change_to_your_data_base_name --app change_to_your_app_name 2. Change db owner using this query: GRANT ALL PRIVILEGES ON DATABASE change_to_your_data_base_name to change_to_your_user; A...
We also need to set correct permissions for storage files in the server. So, we need to give a write permission in the storage directory as follows: $ chmod -R 777 ./storage ./bootstrap or you may use $ sudo chmod -R 777 ./storage ./bootstrap For windows Make sure you are an admin user on t...
Disabling calculation of the worksheet can decrease running time of the macro significantly. Moreover, disabling events, screen updating and page breaks would be beneficial. Following Sub can be used in any macro for this purpose. Sub OptimizeVBA(isOn As Boolean) Application.Calculation = IIf(...
Different procedures can give out the same result, but they would use different processing time. In order to check out which one is faster, a code like this can be used: time1 = Timer For Each iCell In MyRange iCell = "text" Next iCell time2 = Timer For i = 1 To 30 MyRan...
Using with blocks can accelerate the process of running a macro. Instead writing a range, chart name, worksheet, etc. you can use with-blocks like below; With ActiveChart .Parent.Width = 400 .Parent.Height = 145 .Parent.Top = 77.5 + 165 * step - replacer * 15 .Parent.Left = 5 E...
$service = new NetSuiteService(); $search = new TransactionSearchAdvanced(); $internalId = '123';//transaction internalId $search->criteria->basic->internalIdNumber->searchValue = $internalId; $search->criteria->basic->internalIdNumber->operator = "equalTo"; ...
$service = new NetSuiteService(); $search = new TransactionSearchAdvanced(); $internalId = '123';//transaction internalId $search->criteria->basic->internalIdNumber->searchValue = $internalId; $search->criteria->basic->internalIdNumber->operator = "equalTo"; ...

Page 1229 of 1336