Tutorial by Examples

When a query goes wrong, it is important to fetch the error message(s) returned by the driver to identify the cause of the problem. The syntax is: sqlsrv_errors([int $errorsOrWarnings]); This returns an array with: KeyDescriptionSQLSTATEThe state that the SQL Server / OBDC Driver is incodeThe S...
Create this class : public class InputFilterMinMax implements InputFilter { private int min, max; public InputFilterMinMax(int min, int max) { this.min = min; this.max = max; } public InputFilterMinMax(String min, String max) { this.min = Integer...
You have to create a different strings.xml file for every new language. Right-click on the res folder Choose New → Values resource file Select a locale from the available qualifiers Click on the Next button (>>) Select a language Name the file strings.xml strings.xml <resources&...
When first introduced, AsyncTasks were executed serially on a single background thread. Starting with DONUT, this was changed to a pool of threads allowing multiple tasks to operate in parallel. Starting with HONEYCOMB, tasks are executed on a single thread to avoid common application errors caused ...
Intro An array is a container object that holds a number of values. In the following image you can see an array with size 10, the first element indexed 1 and the last element 10. Autohotkey offers a few ways of defining and creating arrays. Array := [] Array := Array() Creating and initia...
if(A_TimeIdlePhysical > 60000) { ; 60,000 milliseconds WinClose, ahk_class Chrome_WidgetWin_1 MsgBox, Google Chrome was closed due to user inactivity. } This check could be done periodically, e.g. using SetTimer.
This example inserts/sends the current day of the week's full name (e.g. Sunday) whenever Ctrl + Alt + D is pressed: ^!d::Send, %A_DDDD%
myDebt := 9000 index := RegExMatch("You owe me $42", "\$(\d+)", dollars) if(index > 0) { ; indices are usually 1-based in AHK myDebt += dollars1 MsgBox, Current debt: %myDebt% } Result: Current debt: 9042
myString := " hello, Trim()! " trimmed := Trim(myString) FileAppend, % trimmed "`n", TrimmedStrings.txt Note that Trim() will not manipulate the original string, but return a new one which should be stored or output somewhere.
Comments in Tcl are best thought of as another command. A comment consists of a # followed by any number of characters up to the next newline. A comment can appear wherever a command can be placed. # this is a valid comment proc hello { } { # the next comment needs the ; before it to indicat...
Due to the way the Tcl language parser works, braces in the code must be properly matched. This includes the braces in comments. proc hw {} { # this { code will fail puts {hello world} } A missing close-brace: possible unbalanced brace in comment error will be thrown. proc hw {} { ...
The CharField is used for storing defined lengths of text. In the example below up to 128 characters of text can be stored in the field. Entering a string longer than this will result in a validation error being raised. from django.db import models class MyModel(models.Model): name = models...
Introduction Binary Search is a Divide and Conquer search algorithm. It uses O(log n) time to find the location of an element in a search space where n is the size of the search space. Binary Search works by halving the search space at each iteration after comparing the target value to the middle ...
The unsafe keyword can be used in type or method declarations or to declare an inline block. The purpose of this keyword is to enable the use of the unsafe subset of C# for the block in question. The unsafe subset includes features like pointers, stack allocation, C-like arrays, and so on. Unsafe ...
You can use the following code for going back and forward. if (!function_exists('codepoint_encode')) { function codepoint_encode($str) { return substr(json_encode($str), 1, -1); } } if (!function_exists('codepoint_decode')) { function codepoint_decode($str) { re...
You can use the following code for going back and forward. if (!function_exists('mb_internal_encoding')) { function mb_internal_encoding($encoding = NULL) { return ($from_encoding === NULL) ? iconv_get_encoding() : iconv_set_encoding($encoding); } } if (!function_exists('mb_c...
When localizing different types of resources are required, each of which has its own home in the android project structure. Following are the different directories that we can place under the \res directory. The resource types placed in each of these directories are explained in the table below: D...
Each resource directory under the res folder (listed in the example above) can have different variations of the contained resources in similarly named directory suffixed with different qualifier-values for each configuration-type. Example of variations of `` directory with different qualifier value...
C and C++ are well known as high-performance languages - largely due to the heavy amount of code customization, allowing a user to specify performance by choice of structure. When optimizing it is important to benchmark relevant code and completely understand how the code will be used. Common opti...
The most straightforward approach to optimizing is by executing less code. This approach usually gives a fixed speed-up without changing the time complexity of the code. Even though this approach gives you a clear speedup, this will only give noticable improvements when the code is called a lot. R...

Page 603 of 1336