The Editor is very similar to the Entry in that it allows users to enter some free-form text. The difference is that the Editor allows for multi-line input whereas the Entry is only used for single line input. The Entry also provides a few more properties than the Editor to allow further customizati...
Take or pick photos and videos from a cross platform API.
Available Nuget : [https://www.nuget.org/packages/Xam.Plugin.Media/][1]
XAML
<StackLayout Spacing="10" Padding="10">
<Button x:Name="takePhoto" Text="Take Photo"/>
<Butto...
With the 2.x versions of typescript, typings are now available from the npm @types repository. These are automatically resolved by the typescript compiler and are much simpler to use.
To install a type definition you simply install it as a dev dependency in your projects package.json
e.g.
npm i -...
To disable synchronization context you should call the ConfigureAwait method:
async Task() Foo()
{
await Task.Run(() => Console.WriteLine("Test"));
}
. . .
Foo().ConfigureAwait(false);
ConfigureAwait provides a means to avoid the default SynchronizationContext capturi...
By utilizing the pre_save we can determine if a save action on our database was about updating an existing object or creating a new one.
In order to achieve this you can check the state of the model object:
@receiver(pre_save, sender=User)
def pre_save_user(sender, instance, **kwargs):
...
We have a DataListComponent that shows a data we pull from a service. DataListComponent also has a PagerComponent as it's child.
PagerComponent creates page number list based on total number of pages it gets from the DataListComponent. PagerComponent also lets the DataListComponent know when user c...
The members of a union share the same space in memory. This means that writing to one member overwrites the data in all other members and that reading from one member results in the same data as reading from all other members. However, because union members can have differing types and sizes, the da...
Viewchild offers one way interaction from parent to child. There is no feedback or output from child when ViewChild is used.
We have a DataListComponent that shows some information. DataListComponent has PagerComponent as it's child. When user makes a search on DataListComponent, it gets a data fro...
public class KnapsackProblem
{
private static int Knapsack(int w, int[] weight, int[] value, int n)
{
int i;
int[,] k = new int[n + 1, w + 1];
for (i = 0; i <= n; i++)
{
int b;
for (b = 0; b <= w; b++)
{
...
Suppose, that we have three users :
The Administrator of the database > admin
The application with a full access for her data > read_write
The read only access > read_only
With below queries, you can set access privileges on objects created in the future in specified schema.
ALTER ...
By default, PHP Curl supports GET and POST requests. It is possible to also send custom requests, such as DELETE, PUT or PATCH (or even non-standard methods) using the CURLOPT_CUSTOMREQUEST parameter.
$method = 'DELETE'; // Create a DELETE request
$ch = curl_init($url);
curl_setopt($ch, CURLOPT...
To install PHP on Ubuntu, first install the Redis server:
sudo apt install redis-server
then install the PHP module:
sudo apt install php-redis
And restart the Apache server:
sudo service apache2 restart
Assuming a default server running on localhost with the default port, the command to connect to that Redis server would be:
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
The Redis PHP module gives access to the same commands as the Redis CLI client so it is quite straightforward to use.
The syntax is as follow:
// Creates two new keys:
$redis->set('mykey-1', 123);
$redis->set('mykey-2', 'abcd');
// Gets one key (prints '123')
var_dump($redis->get('m...
For small functions that get called often, the overhead associated with the function call can be a significant fraction of the total execution time of that function. One way of improving performance, then, is to eliminate the overhead.
In this example we use four functions (plus main()) in three so...
If you enable prettyUrl in your yii2-app, your redirect_uri will be:
http://<base_url>/web/site/auth
And disable pretty url:
http://<base_url>/web/index.php?r=site%2Fauth
Example:
This document explains how to get Google Access tokens and use them to get Google Analytics data to be displayed in our websites.
Example: A live example is available in
https://newtonjoshua.com
note: Use the same gmail account for all the below steps.
STEP 1: Set Up Google Analytics
Foll...
When calling driver.Navigate().GoToUrl(url);, the code execution stops until the page is fully loaded. This is sometimes unnecessary when you just want to extract data.
Note: The code samples below could be considered hacks. There is no "official" way of doing this.
Create a new thread...
Open Visual Studio 2015, navigate to Tools → Extensions → Online and search for Antlr. Download the extension ANTLR Language Support (Created by Sam Harwell) and restart Visual Studio.
Create new Console Application Project. Right click on the Solution → Manage Nuget Packages for Solution → Brows...