Tutorial by Examples: and

{ echo "contents of home directory" ls ~ } > output.txt
import pandas as pd df = pd.DataFrame({'gender': ["male", "female","female"], 'id': [1, 2, 3] }) >>> df gender id 0 male 1 1 female 2 2 female 3 To encode the male to 0 and female to 1: df.loc[df["gender&quot...
The ng-show directive shows or hides the HTML element based on if the expression passed to it is true or false. If the value of the expression is falsy then it will hide. If it is truthy then it will show. The ng-hide directive is similar. However, if the value is falsy it will show the HTML elemen...
Create an interface decorated with a ServiceContract attribute and member functions decorated with the OperationContract attribute. namespace Service { [ServiceContract] interface IExample { [OperationContract] string Echo(string s); } } Create a concrete...
$(window).load() was deprecated in jQuery version 1.8 (and completely removed from jQuery 3.0) and as such should not be used anymore. The reasons for the deprecation are noted on the jQuery page about this event Caveats of the load event when used with images A common challenge developers attem...
An explicit intent is used for starting an activity or service within the same application package. In this case the name of the intended class is explicitly mentioned: Intent intent = new Intent(this, MyComponent.class); startActivity(intent); However, an implicit intent is sent across the sys...
Attach an Event Handler Since version 1.7 jQuery has the event API .on(). This way any standard javascript event or custom event can be bound on the currently selected jQuery element. There are shortcuts such as .click(), but .on() gives you more options. HTML <button id="foo">b...
If IPython (or Jupyter) are installed, the debugger can be invoked using: import ipdb ipdb.set_trace() When reached, the code will exit and print: /home/usr/ook.py(3)<module>() 1 import ipdb 2 ipdb.set_trace() ----> 3 print("Hello world!") ipdb> Clea...
The most important application events are: Application_Start - It is raised when the application/website is started. Application_End - It is raised when the application/website is stopped. Similarly, the most used Session events are: Session_Start - It is raised when a user first requests a page...
Common page and control events are: DataBinding - It is raised when a control binds to a data source. Disposed - It is raised when the page or the control is released. Error - It is a page event, occurs when an unhandled exception is thrown. Init - It is raised when the page or the control is in...
Break and continue statements can be followed by an optional label which works like some kind of a goto statement, resumes execution from the label referenced position for(var i = 0; i < 5; i++){ nextLoop2Iteration: for(var j = 0; j < 5; j++){ if(i == j) break nextLoop2Iteration; ...
AngularJS has digest loop and all your functions in a view and filters are executed every time the digest cycle is run. The digest loop will be executed whenever the model is updated and it can slow down your app (filter can be hit multiple times, before the page is loaded). You should avoid this: ...
NSURL *url = [NSURL URLWithString:@"http://www.example.com/"]; NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; // Configure the session here. NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration]; [[s...
Assuming we want to modify bit n of an integer primitive, i (byte, short, char, int, or long): (i & 1 << n) != 0 // checks bit 'n' i |= 1 << n; // sets bit 'n' to 1 i &= ~(1 << n); // sets bit 'n' to 0 i ^= 1 << n; // toggles the value of bit 'n' Us...
Creating and returning an image object by loading the image data from the file at the specified path. Example: UIImage *image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[cellCountry objectForKey:@"Country_Flag"] ofType:nil]]; Using Array: Example NSM...
This simple example provides an explanation on some functions I found extremely useful since I have started using MATLAB: cellfun, arrayfun. The idea is to take an array or cell class variable, loop through all its elements and apply a dedicated function on each element. An applied function can eith...
Since Matlab R2014b it is easily possible to achieve semi-transparent markers for line and scatter plots using undocumented features introduced by Yair Altman. The basic idea is to get the hidden handle of the markers and apply a value < 1 for the last value in the EdgeColorData to achieve the d...
Information The ABSTRACT and FINAL additions to the METHODS and CLASS statements allow you to define abstract and final methods or classes. An abstract method is defined in an abstract class and cannot be implemented in that class. Instead, it is implemented in a subclass of the class. Abstra...
C# statements executes in either checked or unchecked context. In a checked context, arithmetic overflow raises an exception. In an unchecked context, arithmetic overflow is ignored and the result is truncated. short m = 32767; short n = 32767; int result1 = checked((short)(m + n)); //will ...
First you create a new Cordova project: cordova create HelloWorld my.application.identifier AppName This will create a blank Cordova project in the HelloWorld folder with identifier my.application.identifier (which should be unique for each application) with name AppName. Next you add th...

Page 33 of 153