Tutorial by Examples: c

Create index.js as const {app, BrowserWindow, ipcMain} = require('electron') let win = null app.on('ready', () => { win = new BrowserWindow() win.loadURL(`file://${__dirname}/index.html`) win.webContents.openDevTools() win.on('closed', () => { win = null }) }) ipcM...
Exporting using base R Data can be written to a CSV file using write.csv(): write.csv(mtcars, "mtcars.csv") Commonly-specified parameters include row.names = FALSE and na = "". Exporting using packages readr::write_csv is significantly faster than write.csv and does not ...
context.globalCompositeOperation = "source-over" "source-over" compositing [default], places all new drawings over any existing drawings. context.globalCompositeOperation='source-over'; // the default context.drawImage(background,0,0); context.drawImage(parachuter,0,0); ...
context.globalCompositeOperation = "destination-in" "destination-in" compositing clips existing drawings inside a new shape. Note: Any part of the existing drawing that falls outside the new drawing is erased. context.drawImage(picture,0,0); context.globalCompositeOperation...
context.globalCompositeOperation = "source-in"; source-in compositing clips new drawings inside an existing shape. Note: Any part of the new drawing that falls outside the existing drawing is erased. context.drawImage(oval,0,0); context.globalCompositeOperation='source-in'; // pictu...
There are many reasons a write operation may fail. A frequent one is because your security rules reject the operation, for example because you're not authenticated (by default a database can only be accessed by an authenticated user). You can see these security rule violations in the logcat output....
Generate code Alt+Insert Add comment lines Ctrl+Shift+C Remove comment lines Ctrl+/ Format selection Alt+Shift+F Fix all class imports Ctrl-Shift-I Fix selected class's import Alt+Shift+I Shift lines left Alt+Shift+← Shift lines right Alt+Shift+→ Shift lines up Alt+Shift+↑ Shift li...
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...
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(...
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...
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 ...

Page 479 of 826