Tutorial by Examples

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...
Private Sub this() Dim rs As DAO.Recordset Dim q%: Dim z% Set rs = CurrentDb.OpenRecordset("SELECT * FROM Invoice;") With rs rs.MoveLast q = rs.RecordCount rs.MoveFirst z = rs.Fields.Count End With Dim aRR As Variant...
Shows a very basic schema. Note: by convention elementFormDefault is set to 'qualified', in the really world you will be hard pressed to find a schema that does not set this (so just include it in your schemas!). <?xml version="1.0" encoding="utf-8" ?> <!--Created wit...
By convention elementFormDefault is always set to qualified, but lets look at what it actually does. First with elementFormDefault set to qualified. <?xml version="1.0" encoding="utf-8" ?> <!--Created with Liquid Studio 2017 (https://www.liquid-technologies.com)--&g...
The easiest way to run a local JIRA instance, is to install the SDK and run atlas-run-standalone For further details see Starting a local JIRA test instance Please note that this runs a local test instance and is not meant for production.
One of the simpler ways of implementing an authorization system is using the flask-login extension. The project's website contains a detailed and well-written quickstart, a shorter version of which is available in this example. General idea The extension exposes a set of functions used for: log...
Code, to be saved in „helloworld.nsi“: Name "Hello World" OutFile "helloworld.exe" Section "Hello World" MessageBox MB_OK "Hello World!" SectionEnd Compile it with: <Path to NSIS>\makensis.exe <Path to script>\helloworld.nsi
The builder pattern is an object creation software design pattern. Unlike the abstract factory pattern and the factory method pattern whose intention is to enable polymorphism, the intention of the builder pattern is to find a solution to the telescoping constructor anti-pattern. The telescopi...
Consider the following code to copy one file to another: import java.io.*; public class FileCopy { public static void main(String[] args) throws Exception { try (InputStream is = new FileInputStream(args[0]); OutputStream os = new FileOutputStream(args[1])) { ...
The COMPILER system handle let's you look at information regarding a recent compile. Assuming ok-program.p is a program without any errors or warning: COMPILE ok-program.p SAVE NO-ERROR. DEFINE VARIABLE iError AS INTEGER NO-UNDO. MESSAGE "Errors: " COMPILER:ERROR SKIP ...
//hello.ts export function hello(name: string){ console.log(`Hello ${name}!`); } function helloES(name: string){ console.log(`Hola ${name}!`); } export {helloES}; export default hello; Load using directory index If directory contains file named index.ts it can be loaded using on...
Any declaration (variable, const, function, class, etc.) can be exported from module to be imported in other module. Typescript offer two export types: named and default. Named export // adams.ts export function hello(name: string){ console.log(`Hello ${name}!`); } export const answerToLi...
The only place where you can safely use async void is in event handlers. Consider the following code: private async Task<bool> SomeFuncAsync() { ... await ... } public void button1_Click(object sender, EventArgs e) { var result = SomeFuncAsync().Result; SomeOtherFunc(); } ...
Java SE Version History The following table provides the timeline for the significant major versions of the Java SE platform. Java SE Version1Code NameEnd-of-life (free2)Release DateJava SE 9 (Early Access)Nonefuture2017-07-27 (estimated)Java SE 8Nonefuture2014-03-18Java SE 7Dolphin2015-04-142011-...
Executes a OS-command. OS-COMMAND without any options will start a new shell and not exit it - thus you will on graphical OS:es leave a window "hanging". DEFINE VARIABLE cmd AS CHARACTER NO-UNDO. cmd = "dir". OS-COMMAND VALUE(cmd). There are three options: SILENT, NO...
The OPSYS-function returns what OS the program is running on: MESSAGE OPSYS VIEW-AS ALERT-BOX. Result: It can be used to select what OS-utility to call: IF OPSYS = "LINUX" THEN OS-COMMAND VALUE("ls -l"). ELSE OS-COMMAND VALUE("dir").

Page 1137 of 1336