Tutorial by Examples: ect

Given a local directory with the following contents: └── dir1 ├── subdir1 └── subdir2 We want to create the same subdir1, subdir2 under a new directory dir2, which does not exist yet. import os os.makedirs("./dir2/subdir1") os.makedirs("./dir2/subdir2") R...
It is possible to easily catch the exception without any try catch block. public class ListTest { private final List<Object> list = new ArrayList<>(); @Test(expected = IndexOutOfBoundsException.class) public void testIndexOutOfBoundsException() { list.get(0); } } ...
Classes without dependencies can easily be created by dagger. public class Engine { @Inject // <-- Annotate your constructor. public Engine() { } } This class can be provided by any component. It has no dependencies itself and is not scoped. There is no further code necessar...
Windows : for %f in (C:\your_app_path\*.apk) do adb install "%f" Linux : for f in *.apk ; do adb install "$f" ; done
Sometimes gotoAndStop() is called in the middle of the code that refers some frame-based properties. But, right after the frame is changed all links to properties that existed on the current frame are invalidated, so any processing that involves them should be immediately terminated. There are two ...
import pandas as pd generate random DF df = pd.DataFrame(np.random.randint(0,10,size=(10, 3)), columns=list('ABC')) In [16]: print(df) A B C 0 4 1 4 1 0 2 0 2 7 8 8 3 2 1 9 4 7 3 8 5 4 0 7 6 1 5 5 7 6 7 8 8 6 7 3 9 6 4 5 select rows where value...
Example A var i,a,b,len; a = {x:0,y:0} function test(){ // return object created each call return {x:0,y:0}; } function test1(a){ // return object supplied a.x=0; a.y=0; return a; } for(i = 0; i < 100; i ++){ // Loop A b = test(); } for(i = 0; i < 100; ...
It is also possible to pass your custom object to other activities using the Bundle class. There are two ways: Serializable interface—for Java and Android Parcelable interface—memory efficient, only for Android (recommended) Parcelable Parcelable processing is much faster than serializable....
This example intend to be a gentle introduction to the Excel Object Model for beginners. Open the Visual Basic Editor (VBE) Click View --> Immediate Window to open the Immediate Window (or ctrl + G): You should see the following Immediate Window at the bottom on VBE: This wi...
gradlew tasks -- show all tasks Android tasks ------------- androidDependencies - Displays the Android dependencies of the project. signingReport - Displays the signing info for each variant. sourceSets - Prints out all the source sets defined in this project. Build tasks -----------...
Suppose we have a JSON string: ["first","second","third"] We can parse this JSON string into a String array : Gson gson = new Gson(); String jsonArray = "[\"first\",\"second\",\"third\"]"; String[] strings = gson.fromJson(j...
annotate, blame: show changeset information by line for each file bisect: subdivision search of changesets cat: output the current or given revision of files diff: diff repository (or selected files) grep: search for a pattern in specified files and revisions log, history: show revision histo...
If you try to submit tasks to a shutdown Executor or the queue is saturated (only possible with bounded ones) and maximum number of Threads has been reached, RejectedExecutionHandler.rejectedExecution(Runnable, ThreadPoolExecutor) will be called. The default behavior is that you'll get a Rej...
To make a new directory from a File instance you would need to use one of two methods: mkdirs() or mkdir(). mkdir() - Creates the directory named by this abstract pathname. (source) mkdirs() - Creates the directory named by this abstract pathname, including any necessary but nonexistent parent d...
This example is not tied to any concrete GUI toolkit, like reactive-banana-wx does, for instance. Instead it shows how to inject arbitary IO actions into FRP machinery. The Control.Event.Handler module provides an addHandler function which creates a pair of AddHandler a and a -> IO () values. Th...
Environment variables are also available to the server via the process.env object. if (Meteor.isServer) { Meteor.startup(function () { // detect environment by getting the root url of the application console.log(JSON.stringify(process.env.ROOT_URL)); // or by getting the port ...
To detect the environment on the server, we have to create a helper method on the server, as the server will determine which environment it is in, and then call the helper method from the client. Basically, we just relay the environment info from the server to the client. //------------------------...
As of Meteor 1.3, Meteor now exposes the NODE_ENV variable on the client by default. if (Meteor.isClient) { Meteor.startup(function () { if(process.env.NODE_ENV === "testing"){ console.log("In testing..."); } if(process.env.NODE_ENV === "production&...
Redirect to within application (another action of specific controller). return $this->redirect([ 'controller' => 'myController', 'action' => 'myAction' ]); Redirect to referrer page return $this->redirect($this->referer()); Redirect to outside of application or spec...
Passing Variable in URL as a method's parameter return $this->redirect([ 'controller' => 'users', 'action' => 'profile', $id ]); Url should be looks like this http://your_app_url/users/profile/{id} in UsersController.php file in profile() method class UsersController e...

Page 42 of 99