Our demo app consists of a scoreboard. The score model is an immutable record. The scoreboard events are contained in a Union Type.
namespace Score.Model
type Score = { ScoreA: int ; ScoreB: int }
type ScoringEvent = IncA | DecA | IncB | DecB | NewGame
Changes are propagated by listening...
The core types in the Gjallarhorn library implement IObservable<'a>, which will make the implementation look familiar (remember the EventStream property from the FSharp.ViewModule example). The only real change to our model is the order of the arguments of the update function. Also, we now use...
SET @searchTerm= 'Database Programming';
SELECT MATCH (Title) AGAINST (@searchTerm IN NATURAL LANGUAGE MODE) Score,
ISBN, Author, Title
FROM book
WHERE MATCH (Title) AGAINST (@searchTerm IN NATURAL LANGUAGE MODE)
ORDER BY MATCH (Title) AGAINST (@searchTerm IN NATURAL LANGUA...
SET @searchTerm= 'Database Programming -Java';
SELECT MATCH (Title) AGAINST (@searchTerm IN BOOLEAN MODE) Score,
ISBN, Author, Title
FROM book
WHERE MATCH (Title) AGAINST (@searchTerm IN BOOLEAN MODE)
ORDER BY MATCH (Title) AGAINST (@searchTerm IN BOOLEAN MODE) DESC;
Giv...
SET @searchTerm= 'Date Database Programming';
SELECT MATCH (Title, Author) AGAINST (@searchTerm IN NATURAL LANGUAGE MODE) Score,
ISBN, Author, Title
FROM book
WHERE MATCH (Title, Author) AGAINST (@searchTerm IN NATURAL LANGUAGE MODE)
ORDER BY MATCH (Title, Author) AGAINST (...
You cannot have more than one delimiter: if you specify something like -d ",;:", some implementations will use only the first character as a delimiter (in this case, the comma.) Other implementations (e.g. GNU cut) will give you an error message.
$ cut -d ",;:" -f2 <<<&...
$ 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.
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
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...
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...