Tutorial by Examples: o

task A << { println 'Hello from A' } task B << { println 'Hello from B' } B.mustRunAfter A The B.mustRunAfter A line tells Gradle to run task after task specified as an argument. And the output is: > gradle -q B A Hello from A Hello from B The ordering rule d...
Custom sounds may be provided for notifications generated by your app. When the system displays an alert for a local notification or badges an app icon, it plays this sound (so long as the user has not disabled notification sounds). The default value is nil which means no sound is played for your n...
We're using a toplevel guard in our route config to catch the current user on first page load, and a resolver to store the value of the currentUser, which is our authenticated user from the backend. A simplified version of our implementation looks as follows: Here is our top level route: export c...
This example shows how to advertise a custom payload from a Windows 10 device in the foreground. The payload uses a made up company (identified as 0xFFFE) and advertises the string Hello World in the advertisement. BluetoothLEAdvertisementPublisher publisher = new BluetoothLEAdvertisementPublisher(...
General Listening This example shows how to listen for a specific advertisement. BluetoothLEAdvertisementWatcher watcher = new BluetoothLEAdvertisementWatcher(); // Use active listening if you want to receive Scan Response packets as well // this will have a greater power cost. watcher.Scanni...
CardView provides a default elevation and corner radius so that cards have a consistent appearance across the platforms. You can customize these default values using these attributes in the xml file: card_view:cardElevation attribute add elevation in CardView. card_view:cardBackgroundColor attr...
Considering that most debuggers are not aware of #define macros, but can check enum constants, it may be desirable to do something like this: #if __STDC_VERSION__ < 199900L typedef enum { false, true } bool; /* Modern C code might expect these to be macros. */ # ifndef bool # define bool bo...
class Category(models.Model): name = models.CharField(max_length=20) class Product(models.Model): name = models.CharField(max_length=64) category = models.ForeignKey(Category, on_delete=models.PROTECT) To get the number products for each category: >>> categories = Ca...
Problem By default, Django immediately commits changes to the database. When exceptions occur during a series of commits, this can leave your database in an unwanted state: def create_category(name, products): category = Category.objects.create(name=name) product_api.add_products_to_cate...
01 pointer-var usage POINTER. 01 character-field pic x(80) BASED value "Sample". ALLOCATE 1024 characters returning pointer-var ALLOCATE character-field ALLOCATE character-field INITIALIZED RETURNING pointer-var See http://open-cobol.sourceforge.net/faq/index.html#allo...
Julia code can create, manipulate, and execute command literals, which execute in the OS's system environment. This is powerful but often makes programs less portable. A command literal can be created using the `` literal. Information can be interpolated using the $ interpolation syntax, as with st...
Methods OnTriggerEnter() OnTriggerStay() OnTriggerExit() You can make a Collider into a Trigger in order to use the OnTriggerEnter(), OnTriggerStay() and OnTriggerExit() methods. A Trigger Collider will not physically react to collisions, other GameObjects simply pass through it. They are us...
Sometimes you might have branches lying around that have already had their changes merged into master. This finds all branches that are not master that have no unique commits as compared to master. This is very useful for finding branches that were not deleted after the PR was merged into master. ...
It's important to handle exceptions in your service. When developing the service, you can set the WCF to provide more detailed information, adding this tag to configuration file, usually Web.config: <serviceDebug includeExceptionDetailInFaults="true"/> This tag must be placed w...
You can handle exceptions and throw a most friendly message like 'Unavailable service' throwing a FaultException: try { // your service logic here } catch (Exception ex) { // You can do something here, like log the original exception throw new FaultException("There was a pro...
The FaultException can also includes a FaultCode, that is a string data you can use to pass additional information, so the client can be able to distinguish different exceptions: try { // your service logic here } catch (Exception ex) { throw new FaultException("There was a proble...
Example implementation of a prime factorization algorithm. A prime factorization algorithm will find for a given number n a list of primes, such that if you multiply those primes you get n. The below implementation will add -1 to the list of prime factors in case n < 0. Note that there exists no ...
It took me a while to get this right, so I decided to share a solution because it might save someone else several days of trial and error. The problem: I want to be able to enable/disable WCF tracing in my C# .NET application and choose the trace output filename. I don't want users editing the .con...
-- Create and drop a view in the current database. CREATE VIEW few_rows_from_t1 AS SELECT * FROM t1 LIMIT 10; DROP VIEW few_rows_from_t1; -- Create and drop a view referencing a table in a different database. CREATE VIEW table_from_other_db AS SELECT x FROM db1.foo WHERE x IS NOT NULL; DROP V...
let playerLayoutChangeListener = new android.view.View.OnLayoutChangeListener( { onLayoutChange : function ( v:View, left:number, top:number, right:number, bottom:number, oldLeft:number, oldTop:number, oldRight:number, oldBottom:number):any { if (left != oldLeft || top != oldTop ...

Page 591 of 1038