Using Oracle SQL’s NVL2() function, you can create a display column which contains one value if a field contains data and another value if a field does not contain data. For example, in an Entity search, turn the presence of a primary e-mail address into a text display column:
NVL2( {email} , 'YES...
Firebase handles notifications differently when the app is in background (killed process) and when in foreground (active).
When your app is in the background, notification messages are displayed in the system tray, and onMessageReceived is not called. For notification messages with a data payload...
// logger middlerware that logs time taken to process each request
func Logger(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
startTime := time.Now()
h.ServeHttp(w,r)
endTime := time.Since(startTime)
log...
If all you need is serializing mongo results into json, it is possible to use the json module, provided you define custom handlers to deal with non-serializable fields types.
One advantage is that you have full power on how you encode specific fields, like the datetime representation.
Here is a ha...
new Vue({
el:"#app",
data:{
foo: "bar"
},
methods:{
// This is wrong! Arrow functions capture "this" lexically
// and "this" will refer to the window.
doSomething: () => this.foo = "baz"
}
})
A simple way to catch unhandled errors (exceptions) in a VFP application is to use the ON ERROR command near the beginning of your main program.
The following ON ERROR command calls a method in the current program called "errorHandler". The values returned by ERROR (the VFP Error Number),...
More information needed.
A cryptographic hash function is a member of a class of functions with three vital properties; consistency, uniqueness, and irreversibility.
Consistency: Given the same data, a hash function will always return the same value. That is, if X = Y, f(x) will always equal f(y) ...
enum ReadResult{
case Successful
case Failed
case Pending
}
struct OutpuData {
var data = Data()
var result: ReadResult
var error: Error?
}
func readData(from url: String, completion: @escaping (OutpuData) -> Void) {
var _data = OutpuData(data: Data(), ...
First, I will place my date into a Macro Variable.
NOTE: I find that
date9. works great with IBM® Netezza® SQL and Transact-SQL. Use whichever format that works for the type of SQL you're executing.
data _null_;
call symput('testDate',COMPRESS(put(today(),date9.)));
;RUN;
%PUT ...
Take note of the email type: Type = 'text/html';
Filename myEmail EMAIL
Subject = "My Email Subject"
From = "[email protected]"
To = '[email protected]'
CC = '[email protected]'
Type = 'text/html';
Data _null_; File my...
Step 1: Create your GitHub account
If you already have a GitHub account, please proceed to Step 2. Otherwise, please follow below:
1.a Go to Github page.
1.b Enter your desired username, your email address and then your desired password. Afterwards, click the Sign up for GitHub button.
Step 2:...
When creating a model for a table that has a composite primary key, additional work is required on the Object for the model Entity to respect those constraints.
The following example SQL table and Entity demonstrates the structure to store a review left by a customer for an item in an online store....
First you add System.Security.Cryptography and System.IO to your project
public string GetSha1Hash(string filePath)
{
using (FileStream fs = File.OpenRead(filePath))
{
SHA1 sha = new SHA1Managed();
return BitConverter.ToString(sha.ComputeHash(fs...
first you add System.Security.Cryptography namespace to your project
public string GetSha1Hash(string filePath)
{
using (FileStream fs = File.OpenRead(filePath))
{
SHA1 sha = new SHA1Managed();
return BitConverter.ToString(sha.ComputeHash(fs));
...
public static string TextToHash(string text)
{
var sh = SHA1.Create();
var hash = new StringBuilder();
byte[] bytes = Encoding.UTF8.GetBytes(text);
byte[] b = sh.ComputeHash(bytes);
foreach (byte a in b)
{
var h = a.ToString(&...
The code example below demonstrate how you can get a lighter and darker shade of a given color, useful in applications having dynamic themes
For Darker Color
+ (UIColor *)darkerColorForColor:(UIColor *)c
{
CGFloat r, g, b, a;
if ([c getRed:&r green:&g blue:&b alpha:&a])
...