Sometimes we need to change words position from one place to another or reduce size of the words and change the color of words automatically to improve the attraction of our website or web apps. JQuery helps a lot with this concept using fadeIn(), hide(), slideDown() but its functionality are limite...
CREATE TABLE all_datetime_types(
c_date date,
c_timestamp timestamp
);
Minimum and maximum data values:
insert into all_datetime_types values ('0001-01-01','0001-01-01 00:00:00.000000001');
insert into all_datetime_types values ('9999-12-31','9999-12-31 23:59:59.999999999');
CREATE TABLE all_floating_numeric_types(
c_float float,
c_double double
);
Minimum and maximum data values:
insert into all_floating_numeric_types values (-3.4028235E38,-1.7976931348623157E308);
insert into all_floating_numeric_types values (-1.4E-45,-4.9E-324);
insert into all_floatin...
The New-Object cmdlet is used to create an object.
# Create a DateTime object and stores the object in variable "$var"
$var = New-Object System.DateTime
# calling constructor with parameters
$sr = New-Object System.IO.StreamReader -ArgumentList "file path"
In many instan...
To check for location services we need real device but for testing purpose we can also use simulator and add our own location by following below steps:
add new GPX file into your project.
in GPX file add waypoints like
<?xml version="1.0"?>
<gpx version="1.1" cre...
private List<FooBar> _fooBars;
public List<FooBar> FooBars
{
get { return _fooBars ?? (_fooBars = new List<FooBar>()); }
}
The first time the property .FooBars is accessed the _fooBars variable will evaluate as null, thus falling through to the assignment statement ass...
In order to call a function through a function pointer, the function pointer's type must exactly match the function's type. Otherwise, the behaviour is undefined. Example:
int f();
void (*p)() = reinterpret_cast<void(*)()>(f);
p(); // undefined
To build up an expression like _ => _.Field == "VALUE" at runtime.
Given a predicate _ => _.Field and a string value "VALUE", create an expression that tests whether or not the predicate is true.
The expression is suitable for:
IQueryable<T>, IEnumerable<T>...
To get the time at which your app was installed or updated, you should query Android's package manager.
try {
// Reference to Android's package manager
PackageManager packageManager = this.getPackageManager();
// Getting package info of this application
PackageInfo info = pack...
Since Yii2 version 2.0.4 there is the EachValidator used to validate each item in an array.
[
// ... other rules
['userIDs', 'each', 'rule' => ['integer']],
]
The ['integer'] part can be every other validator object that Yii2 offers and can hold the specific arguments for the valid...
Prior to Json.NET 4.5 dates were written using the Microsoft format: "/Date(1198908717056)/". If your server sends date in this format you can use the below code to serialize it to NSDate:
Objective-C
(NSDate*) getDateFromJSON:(NSString *)dateString
{
// Expect date in this format ...
This can be used in various chat applications, rss feeds, and social apps where you need to have latest feeds with timestamps:
Objective-C
- (NSString *)getHistoricTimeText:(NSDate *)since
{
NSString *str;
NSTimeInterval interval = [[NSDate date] timeIntervalSinceDate:since];
if(in...
Using a file
Swift
let data = NSData(contentsOfFile: filePath) //assuming filePath is a valid path
Objective-C
NSData *data = [NSData dataWithContentsOfFile:filePath]; //assuming filePath is a valid path
Using a String object
Swift
let data = (string as NSString).dataUsingEncoding(NSUTF8S...
To String
Swift
let string = String(NSString(data: data, encoding: NSUTF8StringEncoding)) //assuming data is a valid NSData object
Objective-C
NSString *string = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; //assuming data is a valid NSData object
[string release];
T...
Add the I18N nuget package to your MVC project.
In web.config, add the i18n.LocalizingModule to your <httpModules> or <modules> section.
<!-- IIS 6 -->
<httpModules>
<add name="i18n.LocalizingModule" type="i18n.LocalizingModule, i18n" />
&...
Connection factories are the managed objects that allows application to connect to provider by creating Connection object. javax.jms.ConnectionFactory is an interface that encapsulates configuration parameters defined by an administrator.
For using ConnectionFactory client must execute JNDI lookup ...
The @switch annotation tells the compiler that the match statement can be replaced with a single tableswitch instruction at the bytecode level. This is a minor optimization that can remove unnecessary comparisons and variable loads during runtime.
The @switch annotation works only for matches again...
A function is a block of organised, reusable code that is used to perform a single, related action. Functions usually "take in" data, process it, and "return" a result.
User defined function
A function defined by user.
Example in PHP
//Function definition
function a...