Tutorial by Examples: ed

packed is a variable attribute that is used with structures and unions in order to minimize the memory requirements. #include <stdio.h> struct foo { int a; char c; }; struct __attribute__((__packed__))foo_packed { int a; char c; }; int main() { printf("...
I wrote a simple C code foo.c int main() { int i = 0; int j = 0; for (i = 0; i < 5; i++) { j = i + 1; } return 0; } When compiled with -O0 i.e. by disabling all compiler optimizations $ gcc -o foo.S foo.c -O0 -S I got this: .file "foo.c&...
Option Explicit #If Win64 Then 'Win64 = True, Win32 = False, Win16 = False Private Declare PtrSafe Sub apiCopyMemory Lib "Kernel32" Alias "RtlMoveMemory" (MyDest As Any, MySource As Any, ByVal MySize As Long) Private Declare PtrSafe Sub apiExitProcess Lib "Kern...
#ElseIf Win32 Then 'Win32 = True, Win16 = False Private Declare Sub apiCopyMemory Lib "Kernel32" Alias "RtlMoveMemory" (MyDest As Any, MySource As Any, ByVal MySize As Long) Private Declare Sub apiExitProcess Lib "Kernel32" Alias "ExitProcess" (ByVa...
hello_world.c #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> #define AUTHOR "Bruce Lee" #define DESC "Hello World driver" static int __init init(void) { printk(KERN_DEBUG "Hello World\n"); return 0;...
val map = mapOf("foo" to 1) val foo : String by map println(foo) The example prints 1
val a = arrayOfNulls<Int>(3) // creates an Array<Int?> of [null, null, null] The returned array will always have a nullable type. Arrays of non-nullable items can't be created uninitialized.
If you are unsure which rules to list in your .gitattributes file, or you just want to add generally accepted attributes to your project, you can shoose or generate a .gitattributes file at: https://gitattributes.io/ https://github.com/alexkaratarakis/gitattributes
This following example is created by user Michael Dillon from this answer. Consider the following script: @set @junk=1 /* @echo off cscript //nologo //E:jscript %0 %* goto :eof */ //JScript aka Javascript here This script snippet does: Execute the cscript command which calls itsel...
Valgrind provides you with the lines at which the error occurred at the end of each line in the format (file.c:line_no). Errors in valgrind are summarised in the following way: ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) The most common errors include: Illegal read/write er...
We can use typedef to simplify the usage of function pointers. Imagine we have some functions, all having the same signature, that use their argument to print out something in different ways: #include<stdio.h> void print_to_n(int n) { for (int i = 1; i <= n; ++i) printf(...
Accessing the 3rd element of the first subarray: my_array[1][2]
This is how you can react to exceptions which have not been catched, similar to the system's standard "Application XYZ has crashed" import android.app.Application; import android.util.Log; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.text....
The example below is taken from the full docs, available here (GitHub) or here (NPM). Installation npm install --save activedirectory Usage // Initialize var ActiveDirectory = require('activedirectory'); var config = { url: 'ldap://dc.domain.com', baseDN: 'dc=domain,dc=com' }; va...
from tensorflow.python.client import device_lib print(device_lib.list_local_devices())
<?xml version="1.0"?> <openerp> <data noupdate="1"> <function model="*model_name*" name="_configure_sales"/> </data> </openerp> This simple xml file is calls _configure_sales function from model_name ...
Flow is a static type checker for your JavaScript code. It does a lot of work to make you more productive. Making you code faster, smarter, more confidently, and to a bigger scale. Flow checks your code for errors through static type annotations. These types allow you to tell Flow how you want your...
This the custom VideoView that you need to have it in your package. Custom VideoView Layout: <your.packagename.VideoView android:id="@+id/video_view" android:layout_width="300dp" android:layout_height="300dp" /> Code for custom Optimized VideoV...
Create a New Project on Google Developer Console To integrate Android application with Google Drive, create the credentials of project in the Google Developers Console. So, we need to create a project on Google Developer console. To create a project on Google Developer Console, follow these steps:...

Page 140 of 145