Tutorial by Examples: c

This section is only relevant if you work with the Sass version of Materialize. First, you need to install Sass in your working directory: gem install sass When you have Sass installed on your project and you want to update your output .css file, you need to use the following command: sass sas...
The autocomplete UI control is a search dialog with built-in autocomplete functionality. As a user enters search terms, the control presents a list of predicted places to choose from. When the user makes a selection, a GMSPlace (Place in Xamarin) instance is returned, which your app can then use to ...
This converts valid json strings to MySQL JSON type: SELECT CAST('[1,2,3]' as JSON) ; SELECT CAST('{"opening":"Sicilian","variations":["pelikan","dragon","najdorf"]}' as JSON);
JSON_OBJECT creates JSON Objects: SELECT JSON_OBJECT('key1',col1 , 'key2',col2 , 'key3','col3') as myobj; JSON_ARRAY creates JSON Array as well: SELECT JSON_ARRAY(col1,col2,'col3') as myarray; Note: myobj.key3 and myarray[2] are "col3" as fixed string. Also mixed JSON data: S...
Extract path by -> or ->> Operators, while ->> is UNQUOTED value: SELECT myjson_col->>'$[1]' , myjson_col->'$[1]' , myjson_col->>'$[*].label' , myjson_col->>'$[1].*' , myjson_col->>'$[2].*' FROM tablename ; -- visuall: B, "B...
Out of the box Acumatica allows to create and maintain the list of shipping terms in the system. Shipping terms are used to define the shipping, packaging and handling costs, depending on the shipment amount. In this example I will show how to calculate freight amount for a shipment based on sales ...
ts-node is an npm package which allows the user to run typescript files directly, without the need for precompilation using tsc. It also provides REPL. Install ts-node globally using npm install -g ts-node ts-node does not bundle typescript compiler, so you might need to install it. npm instal...
The following is a full example of using XHTML with JavaScript served by PHP as a single-file. <?php if (isset($_SERVER['HTTP_ACCEPT']) && stristr($_SERVER['HTTP_ACCEPT'],'application/xhtml+xml')) { // Client header isset` and explicitly declares XHTML parser support. header('Conte...
Using XHTML you should avoid methods such as document.write and innerHTML as they treat XML as text and do not properly serialize code; an id attribute in HTML is essentially dumped in to the DOM and the id attribute is not serialized which means when trying to reference to it with something such as...
This example shows a simple global definition of a complexType. The definition is considered global as it is a child of the xs:schema. Globally defined types can be used elsewhere in the schema. This is the most common form for declaring a global xs:complexType, it defines the child elements using ...
In this example we are creating a new xs:complexType (EmployeeType) based on an existing xs:complexType (PersonType). The construction of this is slightly more complicated. Because the base xs:complexType (PersonType) is considered to be complex (more about this below) we add the <xs:complexCon...
This is where things get a little tricky. We are now restricting an existing xs:complexType. Our SolidStateDriveType derives from HardDiskType but removes the spinUpTime attribute and the RotationSpeed element. Notice the approach for dealing with attributes and elements is different. To remove an ...
After installing the SDK, atlas-run-standalone starts a JIRA instance with the latest released version. atlas-run-standalone --product jira The instance is available http://localhost:2990/jira The created instance is for testing only. It provides an other directory structure as production insta...
It is possible to customize the JIRA version, the port or the context path. atlas-run-standalone --product jira --version 6.0 --http-port 1337 --context-path issues The JIRA 6 instance is available under http://localhost:1337/issues There are more parameters that can be set for running atlas-ru...
Let's say we want to use libc's ntohl function. First, we must load libc.so: >>> from ctypes import * >>> libc = cdll.LoadLibrary('libc.so.6') >>> libc <CDLL 'libc.so.6', handle baadf00d at 0xdeadbeef> Then, we get the function object: >>> ntohl = l...
Failing to load a file The first possible error is failing to load the library. In that case an OSError is usually raised. This is either because the file doesn't exists (or can't be found by the OS): >>> cdll.LoadLibrary("foobar.so") Traceback (most recent call last): File &...
The most basic object is an int: >>> obj = ctypes.c_int(12) >>> obj c_long(12) Now, obj refers to a chunk of memory containing the value 12. That value can be accessed directly, and even modified: >>> obj.value 12 >>> obj.value = 13 >>> obj c_...
As any good C programmer knows, a single value won't get you that far. What will really get us going are arrays! >>> c_int * 16 <class '__main__.c_long_Array_16'> This is not an actual array, but it's pretty darn close! We created a class that denotes an array of 16 ints. Now al...
In some cases, a C function accepts a function pointer. As avid ctypes users, we would like to use those functions, and even pass python function as arguments. Let's define a function: >>> def max(x, y): return x if x >= y else y Now, that function takes two arguments and r...
Let's combine all of the examples above into one complex scenario: using libc's lfind function. For more details about the function, read the man page. I urge you to read it before going on. First, we'll define the proper prototypes: >>> compar_proto = CFUNCTYPE(c_int, POINTER(c_int), PO...

Page 706 of 826