Note that you cannot overload a function based on its return type. For example:
// WRONG CODE
std::string getValue()
{
return "hello";
}
int getValue()
{
return 0;
}
int x = getValue();
This will cause a compilation error as the compiler will not be able to work out wh...
Filters can either be defined in a method and then added to Jinja's filters dictionary, or defined in a method decorated with Flask.template_filter.
Defining and registering later:
def format_datetime(value, format="%d %b %Y %I:%M %p"):
"""Format a date time to (Defau...
TRUNCATE TABLE Employee;
Using truncate table is often better then using DELETE TABLE as it ignores all the indexes and triggers and just removes everything.
Delete table is a row based operation this means that each row is deleted. Truncate table is a data page operation the entire data page is...
This code selects data out of a table and displays it in the query tool (usually SSMS)
SELECT Column1, Column2, Column3 FROM MySourceTable;
This code inserts that data into a table:
INSERT INTO MyTargetTable (Column1, Column2, Column3)
SELECT Column1, Column2, Column3 FROM MySourceTable;
This code selects data out of a table:
SELECT Column1, Column2, Column3 FROM MySourceTable;
This code creates a new table called MyNewTable and puts that data into it
SELECT Column1, Column2, Column3
INTO MyNewTable
FROM MySourceTable;
Since C# 6.0 exceptions can be filtered using the when operator.
This is similar to using a simple if but does not unwind the stack if the condition inside the when is not met.
Example
try
{
// ...
}
catch (Exception e) when (e.InnerException != null) // Any condition can go in here.
{
...
You can access SharedPreferences in several ways:
Get the default SharedPreferences file:
import android.preference.PreferenceManager;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
Get a specific SharedPreferences file:
public static final String PREF_FILE_NAM...
The shift operators allow programmers to adjust an integer by shifting all of its bits to the left or the right. The following diagram shows the affect of shifting a value to the left by one digit.
Left-Shift
uint value = 15; // 00001111
uint doubled = value << 1; // Resu...
You can use the CONVERT function to cast a datetime datatype to a formatted string.
SELECT GETDATE() AS [Result] -- 2016-07-21 07:56:10.927
You can also use some built-in codes to convert into a specific format. Here are the options built into SQL Server:
DECLARE @convert_code INT = 100 -- See ...
SRXMPPDemo
Download the example and all the classes here - https://github.com/SahebRoy92/SRXMPPDemo
A demo on XMPP in Objective C, with various simple and complex features implemented in it. All the features of XMPP is done by "in band" xmpp functions.
Few features this project contains...
A shell script is a very versatile way to extend your build to basically anything you can think of.
As an exmaple, here is a simple script to compile protobuf files and add the result java files to the source directory for further compilation:
def compilePb() {
exec {
// NOTICE: grad...
With the rgdal package it is possible to import and export shapfiles with R.
The function readOGR can be used to imports shapfiles. If you want to import a file from e.g. ArcGIS the first argument dsn is the path to the folder which contains the shapefile. layer is the name of the shapefile without...
The packages foreign and haven can be used to import and export files from a variety of other statistical packages like Stata, SPSS and SAS and related software. There is a read function for each of the supported data types to import the files.
# loading the packages
library(foreign)
library(have...
DELETE FROM table_name ;
This will delete everything, all rows from the table. It is the most basic example of the syntax. It also shows that DELETE statements should really be used with extra care as they may empty a table, if the WHERE clause is omitted.
4.0.3
Using a CustomTabsIntent, it is now possible to configure Chrome custom tabs in order to customize key UI components in the browser that is opened from your app.
This is a good alternative to using a WebView for some cases. It allows loading of a web page with an Intent, with the added abil...
Private inheritance is useful when it is required to restrict the public interface of the class:
class A {
public:
int move();
int turn();
};
class B : private A {
public:
using A::turn;
};
B b;
b.move(); // compile error
b.turn(); // OK
This approach efficiently pr...
Predefined macros are those that the compiler defines (in contrast to those user defines in the source file). Those macros must not be re-defined or undefined by user.
The following macros are predefined by the C++ standard:
__LINE__ contains the line number of the line this macro is used on, an...