Tutorial by Examples: code

Overview In order to debug Java classes that are called during MATLAB execution, it is necessary to perform two steps: Run MATLAB in JVM debugging mode. Attach a Java debugger to the MATLAB process. When MATLAB is started in JVM debugging mode, the following message appears in the command wi...
With IronPython you can access any .net assembly which is compiled using the same or a lower version than the IronPython core. Example: Importing a a .net assembly and class from System import Math Example: Using an imported class: from System import Math print Math.Abs(-123) You can also lo...
Say you want to perform in action (in this case, logging "Foo"), while doing something else (logging "Bar"). Normally, if you don't use concurrency, one of these actions is going to be fully executed, and the other run will run only after it's completely finished. But with concur...
static class Program { static void Main() { dynamic dynamicObject = new ExpandoObject(); string awesomeString = "Awesome"; // Prints True Console.WriteLine(awesomeString.IsThisAwesome()); dynamicObject.StringValue = awesomeStrin...
Given the following history, imagine you make a change that you want to squash into the commit bbb2222 A second commit: $ git log --oneline --decorate ccc3333 (HEAD -> master) A third commit bbb2222 A second commit aaa1111 A first commit 9999999 Initial commit Once you've made your change...
Macros return code. Since code in Lisp consists of lists, one can use the regular list manipulation functions to generate it. ;; A pointless macro (defmacro echo (form) (list 'progn (list 'format t "Form: ~a~%" (list 'quote form)) form)) This is often very hard to...
This error appears while trying to update or delete records without including the WHERE clause that uses the KEY column. To execute the delete or update anyway - type: SET SQL_SAFE_UPDATES = 0; To enable the safe mode again - type: SET SQL_SAFE_UPDATES = 1;
An extension that allows you to use Unicode characters in lieu of certain built-in operators and names. ASCIIUnicodeUse(s)::∷has type->→function types, lambdas, case branches, etc.=>⇒class constraintsforall∀explicit polymorphism<-←do notation*★the type (or kind) of types (e.g., Int :: ★)&g...
Rcpp features two functions that enable code compilation inline and exportation directly into R: cppFunction() and evalCpp(). A third function called sourceCpp() exists to read in C++ code in a separate file though can be used akin to cppFunction(). Below is an example of compiling a C++ function w...
Executing code after 1.5 seconds: Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { //The code you want to run after the time is up } }, 1500); //the time you want to delay in milliseconds Executing code repeatedly every...
To add a method to a button, first create an action method: Objective-C -(void)someButtonAction:(id)sender { // sender is the object that was tapped, in this case its the button. NSLog(@"Button is tapped"); } Swift func someButtonAction() { print("Button is tapped...
Function DisableShift() 'This function disable the shift at startup. This action causes 'the Autoexec macro and Startup properties to always be executed. On Error GoTo errDisableShift Dim db As DAO.Database Dim prop As DAO.Property Const conPropNotFound = 3270 Set db = C...
Function EnableShift() 'This function enables the SHIFT key at startup. This action causes 'the Autoexec macro and the Startup properties to be bypassed 'if the user holds down the SHIFT key when the user opens the database. On Error GoTo errEnableShift Dim db As DAO.Database Dim p...
All JavaScript strings are unicode! var s = "some ∆≈ƒ unicode ¡™£¢¢¢"; s.charCodeAt(5); // 8710 There are no raw byte or binary strings in JavaScript. To effectively handle binary data, use Typed Arrays.
To share your code you create a repository on a remote server to which you will copy your local repository. To minimize the use of space on the remote server you create a bare repository: one which has only the .git objects and doesn't create a working copy in the filesystem. As a bonus you set thi...
If there are sections of code that you are considering removing or want to temporarily disable, you can comment it out with a block comment. /* Block comment around whole function to keep it from getting used. * What's even the purpose of this function? int myUnusedFunction(void) { int i =...
Summary This goal is to reorganize all of your scattered commits into more meaningful commits for easier code reviews. If there are too many layers of changes across too many files at once, it is harder to do a code review. If you can reorganize your chronologically created commits into topical com...
Sometimes, you may want something to occur regardless of whatever exception happened, for example, if you have to clean up some resources. The finally block of a try clause will happen regardless of whether any exceptions were raised. resource = allocate_some_expensive_resource() try: do_stu...
The nodemon package makes it possible to automatically reload your program when you modify any file in the source code. Installing nodemon globally npm install -g nodemon (or npm i -g nodemon) Installing nodemon locally In case you don't want to install it globally npm install --save-dev nodemo...

Page 2 of 21