$ cut -d, -f1,3 <<<"a,,b,c,d,e"
a,b
is rather obvious, but with space-delimited strings it might be less obvious to some
$ cut -d ' ' -f1,3 <<<"a b c d e"
a b
cut cannot be used to parse arguments as the shell and other programs do.
There is no way to protect the delimiter. Spreadsheets and similar CSV-handling software usually can recognize a text-quoting character which makes it possible to define strings containing a delimiter. With cut you cannot.
$ cut -d, -f3 <<<'John,Smith,"1, Main Street"'
"1
...
You can only extract portions of lines, not reorder or repeat fields.
$ cut -d, -f2,1 <<<'John,Smith,USA' ## Just like -f1,2
John,Smith
$ cut -d, -f2,2 <<<'John,Smith,USA' ## Just like -f2
Smith
The EntityDamage event is thrown when an Entity is damaged.
EntityDamageEvent
@EventHandler
public void onEntityDamage(EntityDamageEvent e) {
DamageCause cause = e.getCause(); //Get the event DamageCause
double rawDamage = e.getDamage(); //Returns the damage before any calculation...
One of the main advantage of std::array as compared to C style array is that we can check the size of the array using size() member function
int main() {
std::array<int, 3> arr = { 1, 2, 3 };
cout << arr.size() << endl;
}
std::array being a STL container, can use range-based for loop similar to other containers like vector
int main() {
std::array<int, 3> arr = { 1, 2, 3 };
for (auto i : arr)
cout << i << '\n';
}
The member function fill() can be used on std::array for changing the values at once post initialization
int main() {
std::array<int, 3> arr = { 1, 2, 3 };
// change all elements of the array to 100
arr.fill(100);
}
To configure robolectric add @Config annotation to test class or method.
Run with custom Application class
@RunWith(RobolectricTestRunner.class)
@Config(application = MyApplication.class)
public final class MyTest {
}
Set target SDK
@RunWith(RobolectricTestRunner.class)
@Config(sdk = Build...
SWIFT:
Step 1:
In your Info.plist add the following attribute:
View controller-based status bar appearance
and set its value to
NO
as described in the image below:
Step 2:
In your AppDelegate.swift file, in didFinishLaunchingWithOptions method, add this code:
UIApplication.shared.st...
In order to create an use a custome tag,we need to follow couple of steps:
Create a tag file,defining the attributes used by it and any variables which will be used by the tag
a. The attributes need to have a name,their type and and required field with a boolean value
b. The variables will be...
Sometimes it is useful to print a current binding directly from markup. A neat trick which allows that is to use an additional DOM element with a non-existing binding (KO < 3.0), custom binding or a binding that is not relevant such as uniqueName.
Consider this example:
<tbody data-bind=&quo...
In previous versions, setting up provisioning profiles was done manually. You generate distribution profile, download it and then distribute your app. This had to be done for every development machine which was extremely time consuming. However, in most situations nowadays, Xcode 8 will do most of t...
Once the provisioning profiles are all set, next step in the process of submitting the app is to archive your code. From the dropdown of devices and simulators select option "Generic iOS device". Then, under "Product" menu select option "Archive".
In case where the s...
Once it's done, you can find your archive in the Xcode organizer. This is where all your previous versions and archive builds are saved and organized in case you do not delete them. You will immediately notice a large blue button saying "Upload to App Store..." however in 9/10 cases this w...
Once the IPA file is generated, open Xcode, navigate to developer tools and open Application Loader.
If you have multiple accounts in your Xcode, you will be asked to choose. Naturally pick the one you used for code signing in the first step. Pick "Deliver your app" and upload the code....
Structs may be used to implement code in an object oriented manner. A struct is similar to a class, but is missing the functions which normally also form part of a class, we can add these as function pointer member variables. To stay with our coordinates example:
/* coordinates.h */
typedef stru...
//create a new ExcelPackage
using (ExcelPackage excelPackage = new ExcelPackage())
{
//create 2 WorkSheets. One for the source data and one for the Pivot table
ExcelWorksheet worksheetPivot = excelPackage.Workbook.Worksheets.Add("Pivot");
ExcelWorksheet worksheetData = exc...
One to Many
Lets say that each Post may have one or many comments and each comment belongs to just a single Post.
so the comments table will be having post_id. In this case the relationships will be as follows.
Post Model
public function comments()
{
return $this->belongsTo(Post::class...