Tutorial by Examples: c

Below is an example of an object pool that allows renting and returning of a given object type. To create the object pool a Func for the create function and an Action to destroy the object are required to give the user flexibility. On requesting an object when the pool is empty a new object will be ...
This is a bare minimum setup for MySQL servers using InnoDB tables. Using InnoDB, query cache is not required. Reclaim disk space when a table or database is DROPed. If you're using SSDs, flushing is a redundant operation (SDDs are not sequential). default_storage_engine = InnoDB query_cache_type ...
The default encryption aes-128-ecb uses Electronic Codebook (ECB) mode, which is insecure and should never be used. Instead, add the following to your configuration file: block_encryption_mode = aes-256-cbc
Using PostgreSQLnpm module. install dependency from npm npm install pg --save Now you have to create a PostgreSQL connection, which you can later query. Assume you Database_Name = students, Host = localhost and DB_User= postgres var pg = require("pg") var connectionString = &q...
PS> console_app.exe PS> & console_app.exe PS> Start-Process console_app.exe
PS> gui_app.exe (1) PS> & gui_app.exe (2) PS> & gui_app.exe | Out-Null (3) PS> Start-Process gui_app.exe (4) PS> Start-Process gui_app.exe -Wait (5) GUI applications launch in a different process, and will immediately return control to the PowerShell host. Sometimes you...
PS> $ErrorActionPreference = "Continue" (1) PS> & console_app.exe *>&1 | % { $_ } (2) PS> & console_app.exe *>&1 | ? { $_ -is [System.Management.Automation.ErrorRecord] } (3) PS> & console_app.exe *>&1 | ? { $_ -is [System.Management.Automati...
PS> $LastExitCode PS> $? PS> $Error[0] These are built-in PowerShell variables that provide additional information about the most recent error. $LastExitCode is the final exit code of the last native application that was executed. $? and $Error[0] is the last error record that was gene...
If you want to use connection object for query database you can use this sample code. var queryString = "SELECT name, age FROM students " ; var query = client.query(queryString); query.on("row", (row, result)=> { result.addRow(row); }); query.on("end", func...
The Lru Cache will store all the added resources (values) for fast access until it reaches a memory limit, in which case it will drop the less used resource (value) to store the new one. To initialise the Lru cache you need to provide a maximum memory value. This value depends on your application r...
To add a resource to the cache you must provide a key and the resource. First make sure that the value is not in the cache already public void addResourceToMemoryCache(String key, Bitmap resource) { if (memoryCache.get(key) == null) memoryCache.put(key, resource); }
To get a resource from the cache simply pass the key of your resource (String in this example) public Bitmap getResourceFromMemoryCache(String key) { memoryCache.get(key); }
Extended version of http://www.riptutorial.com/python/example/25282/argparse--default-help-formatter- that fixed help output. import argparse import sys class CustomHelpFormatter(argparse.HelpFormatter): def _format_action(self, action): if type(action) == argparse._SubParsersActi...
Step 1: Create an empty project via File -> New Project. Step 2: Right click the project solution and select Build Dependencies->Build Customizations. Step 3: Check the checkbox ".masm". Step 4: Press the button "ok". Step 5: Create your assembly file and type in th...
lib.currentURL= TEXT lib.currentURL.data = getIndpEnv:TYPO3_REQUEST_URL
When viewing an execution plan, you may see that SQL Server decided to do a Seek or a Scan. A Seek occurs when SQL Server knows where it needs to go and only grab specific items. This typically occurs when good filters on put in a query, such as where name = 'Foo'. A Scan is when SQL Server doesn...
Some WMI Classes expose Methods that allow you to do something with that object. For example, the Win32_Printer class has 11 methods for interacting with a printer, one of which is the PrintTestPage method. The following code demonstrates how to select a specific printer and print a test page. 'Spe...
This tslint.json example contains a set of configuration to enforce more typings, catch common errors or otherwise confusing constructs that are prone to producing bugs and following more the Coding Guidelines for TypeScript Contributors. To enforce this rules, include tslint in your build process ...
Many, pure python, packages are not yet available on the Python Package Index as wheels but still install fine. However, some packages on Windows give the dreaded vcvarsall.bat not found error. The problem is that the package that you are trying to install contains a C or C++ extension and is not c...
There are important changes in how we use and declare default props and their types. React.createClass In this version, the propTypes property is an Object in which we can declare the type for each prop. The getDefaultProps property is a function that returns an Object to create the initial props....

Page 632 of 826