Get all files in Directory
var FileSearchRes = Directory.GetFiles(@Path, "*.*", SearchOption.AllDirectories);
Returns an array of FileInfo, representing all the files in the specified directory.
Get Files with specific extension
var FileSearchRes = Directory.GetFiles(@Path, "*...
By going to Settings >> Keymap A window will popup showing All the Editor Actions with the their name and shortcuts. Some of the Editor Actions do not have shortcuts. So right click on that and add a new shortcut to that.
Check the image below
Problem:
If after the AsyncTask starts there is a screen rotation the owning activity is destroyed and recreated.
When the AsyncTask finishes it wants to update the UI that may not valid anymore.
Solution:
Using Loaders, one can easily overcome the activity destruction/recreation.
Example:
...
There is no format specifier to print boolean type using NSLog. One way to print boolean value is to convert it to a string.
BOOL boolValue = YES;
NSLog(@"Bool value %@", boolValue ? @"YES" : @"NO");
Output:
2016-07-30 22:53:18.269 Test[4445:64129] Bool value YES
...
Pressing C-h a will run the emacs function apropos-command which makes emacs prompt for words (or a regexp) to search for. It will then show a buffer containing a list of names and descriptions related to that topic, including key bindings for each of the functions available via keystrokes.
Pressin...
Vectors can be map'd and fold'd,filter'd andzip`'d:
Prelude Data.Vector> Data.Vector.map (^2) y
fromList [0,1,4,9,16,25,36,49,64,81,100,121] :: Data.Vector.Vector
Reduce to a single value:
Prelude Data.Vector> Data.Vector.foldl (+) 0 y
66
A Haskell project can either use the system wide packages or use a sandbox. A sandbox is an isolated package database and can prevent dependency conflicts, e. g. if multiple Haskell projects use different versions of a package.
To initialize a sandbox for a Haskell package go to its directory and r...
Here is a quick reference for advanced insertion, formatting, and filtering commands/shortcuts.
Command/ShortcutResultg + ? + mPerform rot13 encoding, on movement mn + ctrl + a+n to number under cursorn + ctrl + x-n to number under cursorg + q+ mFormat lines of movement m to fixed width:rce wCenter...
A SIGABRT or an EXC_BAD_INSTRUCTION usually means the app crashed itself intentionally because some check failed. These should log a message to the debugger console with more information; check there for more information.
Many SIGABRTs are caused by uncaught Objective-C exceptions. There are a lo...
If you either have apps generated with pre-android support or just did that on purpose, you can always add android project to your app.
$ react-native android
This will generate android folder and index.android.js inside your app.
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# I want 7 days of 24 hours with 60 minutes each
periods = 7 * 24 * 60
tidx = pd.date_range('2016-07-01', periods=periods, freq='T')
# ^ ^
# | ...
Firstly you have to add Xamarin.Android.Support.V7.AppCompat library for NuGet:
https://www.nuget.org/packages/Xamarin.Android.Support.v7.AppCompat/
In the "values" folder under "Resources" add new xml file called "styles.xml":
"styles.xml" file should co...
Java release naming is a little confusing. There are actually two systems of naming and numbering, as shown in this table:
JDK versionMarketing namejdk-1.0JDK 1.0jdk-1.1JDK 1.1jdk-1.2J2SE 1.2......jdk-1.5J2SE 1.5 rebranded Java SE 5jdk-1.6Java SE 6jdk-1.7Java SE 7jdk-1.8Java SE 8jdk-91Java SE 9 (n...
I won't explain what Any and FirstOrDefault does because there are already two good example about them. See Any and First, FirstOrDefault, Last, LastOrDefault, Single, and SingleOrDefault for more information.
A pattern I often see in code which should be avoided is
if (myEnumerable.Any(t=>t.Fo...
Binaries in elixir are created using the Kernel.SpecialForms construct <<>>.
They are a powerful tool which makes Elixir very useful for working with binary protocols and encodings.
Binaries and bitstrings are specified using a comma delimited list of integers or variable values, booke...
First of all you need Uri and temp Folders and request codes :
public final int REQUEST_SELECT_PICTURE = 0x01;
public final int REQUEST_CODE_TAKE_PICTURE = 0x2;
public static String TEMP_PHOTO_FILE_NAME ="photo_";
Uri mImageCaptureUri;
File mFileTemp;
Then init mFileTemp :
public ...
Enums contains only constants and can be compared directly with ==. So, only reference check is needed, no need to use .equals method. Moreover, if .equals used incorrectly, may raise the NullPointerException while that's not the case with == check.
enum Day {
GOOD, AVERAGE, WORST;
}
publi...
Installation
Volley JCenter Gradle Import
//in your project's app level build.gradle
compile 'com.android.volley:volley:1.0.0'
Create a subclass of Application
public class AppController extends Application {
public static final String TAG = AppController.class
.getSimpleN...
Consider this example function to check if a host is up:
is_alive() {
ping -c1 "$1" &> /dev/null
}
This function sends a single ping to the host specified by the first function parameter.
The output and error output of ping are both redirected to /dev/null,
so the functi...