Tutorial by Examples: al

Download and install Visual Studio Community 2015 Open Visual Studio Community Click File -> New -> Project Click Templates -> Visual C++ -> Win32 Console Application and then name the project MyFirstProgram. Click Ok Click Next in the following window. Check the Empty proj...
To set a value in NSUserDefaults, you can use the following functions: Swift < 3 setBool(_:forKey:) setFloat(_:forKey:) setInteger(_:forKey:) setObject(_:forKey:) setDouble(_:forKey:) setURL(_:forKey:) Swift 3 In Swift 3 the names of function is changed to set insted of set folloed by ...
To get a value in NSUserDefaults you can use the following functions: Swift arrayForKey(_:) boolForKey(_:) dataForKey(_:) dictionaryForKey(_:) floatForKey(_:) integerForKey(_:) objectForKey(_:) stringArrayForKey(_:) stringForKey(_:) doubleForKey(_:) URLForKey(_:) Objective-C -(nullab...
var A var is a reference variable, similar to variables in languages like Java. Different objects can be freely assigned to a var, so long as the given object has the same type that the var was declared with: scala> var x = 1 x: Int = 1 scala> x = 2 x: Int = 2 scala> x = "foo...
Method 1 Gson gson = new Gson(); String json = "[ \"Adam\", \"John\", \"Mary\" ]"; Type type = new TypeToken<List<String>>(){}.getType(); List<String> members = gson.fromJson(json, type); Log.v("Members", members.toString());...
In javascript, assigning a non-primitive value (Such as Object, Array, Function, and many more), keeps a reference (an address in the memory) to the assigned value. Assigning a primitive value (String, Number, Boolean, or Symbol) to two different variables, and changing one, won't change both: var...
_.map is useful for changing a list into a different list in a purely declarative way. Rather than using imperative techniques like a while or for loop in javascript, you can just specify how you want to manipulate an element of a list and Use _.map to make a new list transformed by the functio...
In medical imaging, spectroscopy, image processing, cryptography and other areas of science and engineering it is often the case that one wishes to compute multidimensional Fourier transforms of images. This is quite straightforward in Matlab: (multidimensional) images are just n-dimensional matrice...
The method compareTo should be used to compare BigDecimals: BigDecimal a = new BigDecimal(5); a.compareTo(new BigDecimal(0)); // a is greater, returns 1 a.compareTo(new BigDecimal(5)); // a is equal, returns 0 a.compareTo(new BigDecimal(10)); // a is less, returns -1 Commonly you shou...
A powerful alternative to virtualenv is Anaconda - a cross-platform, pip-like package manager bundled with features for quickly making and removing virtual environments. After installing Anaconda, here are some commands to get started: Create an environment conda create --name <envname> pyth...
WITH cte AS ( SELECT ProjectID, ROW_NUMBER() OVER (PARTITION BY ProjectID ORDER BY InsertDate DESC) AS rn FROM ProjectNotes ) DELETE FROM cte WHERE rn > 1;
The method Kernel#autoload registers filename to be loaded (using Kernel::require) the first time that module (which may be a String or a symbol) is accessed. autoload :MyModule, '/usr/local/lib/modules/my_module.rb' The method Kernel#autoload? returns filename to be loaded if name is registere...
When files are not available, the require family will throw a LoadError. This is an example which illustrates loading optional modules only if they exist. module TidBits @@unavailableModules = [] [ { name: 'CoreExtend', file: 'core_extend/lib/core_extend' } \ , { name: 'Fs' ...
You can use any ruby technique to dynamically create a list of files to load. Illustration of globbing for files starting with test, loaded in alphabetical order. Dir[ "#{ __dir__ }**/test*.rb" ) ].sort.each do |source| require_relative source end
Requirements: Docker can be installed on any Linux with a kernel of at least version 3.10. Docker is supported on the following 64-bit versions of Ubuntu Linux: Ubuntu Xenial 16.04 (LTS) Ubuntu Wily 15.10 Ubuntu Trusty 14.04 (LTS) Ubuntu Precise 12.04 (LTS) Easy Installation Note: Installi...
Visual Studio Code is an open-source and feature-rich code editor from Microsoft. To set it up it for NativeScript development, open the Command Palette (F1 or ⌘+Shift+P) and type ext install NativeScript. Once the NativeScript extension is installed, the debugger should allow you to set breakpoint...
Autoboxing can come at a substantial memory overhead. For example: Map<Integer, Integer> square = new HashMap<Integer, Integer>(); for(int i = 256; i < 1024; i++) { square.put(i, i * i); // Autoboxing of large integers } will typically consume substantial amount of memory (...
Swift //Swift let viewController = UIViewController() let navigationController = UINavigationController(rootViewController: viewController) //Objective-C UIViewController *viewController = [[UIViewController alloc] init]; UINavigationController *navigationController = [[UINavigationControlle...
As we know that we should use synchronized keyword to make execution of a method or block exclusive. But few of us may not be aware of one more important aspect of using synchronized and volatile keyword: apart from making a unit of code atomic, it also provides read / write barrier. What is this re...
lazy val is a language feature where the initialization of a val is delayed until it is accessed for the first time. After that point, it acts just like a regular val. To use it add the lazy keyword before val. For example, using the REPL: scala> lazy val foo = { | println("Initial...

Page 83 of 269