Tutorial by Examples: and

From highest to lowest, this is the precedence table for Ruby. High precedence operations happen before low precedence operations. ╔═══════════════════════╦════════════════════════════════════════╦═════════╗ ║ Operators ║ Operations ║ Method? ║ ╠═══════════...
In order to use libraries in CodeIgniter, you need to create a library. class Pro { function show_hello_world() { return 'Hello World'; } } In this library, which is called is pro.php, this file must be added to the following path. Path: \xampp\htdocs\project\application\librarie...
The package's official wiki has some essential materials: As a new user, you will want to check out the vignettes, FAQ and cheat sheet. Before asking a question -- here on StackOverflow or anywhere else -- please read the support page. For help on individual functions, the syntax is h...
Javascript engines first look for variables within the local scope before extending their search to larger scopes. If the variable is an indexed value in an array, or an attribute in an associative array, it will first look for the parent array before it finds the contents. This has implications wh...
Open index.ios.js or index.android.js and delete everything between the <View> </View>. After that, write <Text> Hello World! </Text> and run the emulator. You should see Hello World! written on the screen! Congrats! You've successfully written your first Hello World!
Basic syntax DT[where, select|update|do, by] syntax is used to work with columns of a data.table. The "where" part is the i argument The "select|update|do" part is the j argument These two arguments are usually passed by position instead of by name. A sequence of steps c...
xml_import_example.info.yml type: module name: XML import example package: Examples description: "This module helps understanding the Batch API and Queue API with an XML import example" core: 8.x xml_import_example.permissions.yml import content from xml: title: 'Import content...
.SD .SD refers to the subset of the data.table for each group, excluding all columns used in by. .SD along with lapply can be used to apply any function to multiple columns by group in a data.table We will continue using the same built-in dataset, mtcars: mtcars = data.table(mtcars) # Let's not ...
Just as the random forest algorithm may be applied to regression and classification tasks, it can also be extended to survival analysis. In the example below a survival model is fit and used for prediction, scoring, and performance analysis using the package randomForestSRC from CRAN. require(rand...
survival is the most commonly used package for survival analysis in R. Using the built-in lung dataset we can get started with Survival Analysis by fitting a regression model with the survreg() function, creating a curve with survfit(), and plotting predicted survival curves by calling the predict m...
zo opens a fold underneath the cursor. zO opens all folds underneath the cursor, recursively. zc closes a fold underneath the cursor. zC closes all folds underneath the cursor, recursively. za toggles a fold under the cursor (a closed fold is opened, an opened fold is closed). zM closes all f...
Functions allow you to specify these types of parameters: positional, named, variable positional, Keyword args (kwargs). Here is a clear and concise use of each type. def unpacking(a, b, c=45, d=60, *args, **kwargs): print(a, b, c, d, args, kwargs) >>> unpacking(1, 2) 1 2 45 60 ()...
import flash.utils.*; var intervalId:uint=setInterval(schroedingerCat,1000); // execute a function once per second and gather interval ID trace("Cat's been closed in the box."); function schroedingerCat():void { if (Math.random()<0.04) { clearInterval(intervalId); // ...
C++14 Those following duration user literals are declared in the namespace std::literals::chrono_literals, where both literals and chrono_literals are inline namespaces. Access to these operators can be gained with using namespace std::literals, using namespace std::chrono_literals, and using names...
We can get facts (ansible_os_family, ansible_pkg_mgr) with Ad-Hoc command of setup module and filter. ansible_os_family: $ ansible all -m setup -a 'filter=ansible_os_family' ra.local | SUCCESS => { "ansible_facts": { "ansible_os_family": "Debi...
import Test.Tasty import Test.Tasty.SmallCheck as SC import Test.Tasty.QuickCheck as QC import Test.Tasty.HUnit main :: IO () main = defaultMain tests tests :: TestTree tests = testGroup "Tests" [smallCheckTests, quickCheckTests, unitTests] smallCheckTests :: TestTree smal...
Profiling string concatanation: In [1]: import string In [2]: %%timeit s=""; long_list=list(string.ascii_letters)*50 ....: for substring in long_list: ....: s+=substring ....: 1000 loops, best of 3: 570 us per loop In [3]: %%timeit long_list=list(string.ascii_letters)*50...
Profiling concatanation of numbers python -m timeit "'-'.join(str(n) for n in range(100))" 10000 loops, best of 3: 29.2 usec per loop python -m timeit "'-'.join(map(str,range(100)))" 100000 loops, best of 3: 19.4 usec per loop
The source code with @profile directive before the function we want to profile: import requests @profile def slow_func(): s = requests.session() html=s.get("https://en.wikipedia.org/").text sum([pow(ord(x),3.1) for x in list(html)]) for i in range(50): s...
This code is to add and remove a value from a flagged enum-instance: [Flags] public enum MyEnum { Flag1 = 1 << 0, Flag2 = 1 << 1, Flag3 = 1 << 2 } var value = MyEnum.Flag1; // set additional value value |= MyEnum.Flag2; //value is now Flag1, Flag2 value...

Page 56 of 153