Archive

Archive for December, 2017

Connecting to #PostgreSQL via C#

0107.sdt-postgre

As a planned expansion to the Mobile SQL client app (https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=1325541368&mt=8) for iOS, – soon support for Oracle and Postgre will be added.

The back-end to the app is some C# middleware, and the code it uses to connect to Postgre is as follows;

private static DataTable ExecutePostgre(string strDataSource, string databaseName, string strUsername, string strPassword, string strSQL)
{
const string strDsnTemplate = @”Server={0};User Id={1}; Password={2};Database={3};”;
var sqlConnection = string.Format(strDsnTemplate, strDataSource, strUsername, strPassword, databaseName);
var adapter = new NpgsqlDataAdapter(strSQL, sqlConnection) { SelectCommand = { CommandTimeout = 0 } };
var dataSet = new DataSet();
adapter.Fill(dataSet, “sql”);
return dataSet.Tables[“sql”];
}

Where NpgsqlDataAdapter comes from the Nuget Package Npgsql, which is installed using

Install-Package Npgsql

Categories: Uncategorized

Connect to an #Oracle #Database from C#

oracle

Connecting to an Oracle Database in c# is just as easy as MySQL or SQL server, it just requires it’s own library and a different connection string.

First, you need the following Nuget Package

Install-Package Oracle.ManagedDataAccess

Then import it using:

using Oracle.ManagedDataAccess.Client;

Here’s a code example –

public static DataTable PopulateDataTable(string command)
{
var sqlConnection = @”Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=XE)));user id=system;Password=xyz123″;
var adapter = new OracleDataAdapter(command, sqlConnection) { SelectCommand = { CommandTimeout = 0 } };
var dataSet = new DataSet();
adapter.Fill(dataSet, “sql”);
return dataSet.Tables[“sql”];
}

Here, the default service is “XE”, the TNS port is 1521, the  username is system, and password is xyx123 – and the oracle server is on the same PC (localhost)

It’s used as follows;

var strSQL = “select * from someTable”;
var dt = PopulateDataTable(strSQL);
foreach(var dr in dt.Rows.Cast<DataRow>())
{
Console.WriteLine(dr[“someColumn”].ToString());
}

 

Categories: Uncategorized

Query #Microsoft #SQL server from an #iPhone

This slideshow requires JavaScript.

If you use Microsoft SQL server as your production database server, and you keep getting calls when you are out-of-office to make simple updates or check a value in the database, then you no longer have to rush to your PC.

This app, just released yesterday – Called “MsSQL & MySQL Client” is available for download from the app store for 99p at

https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=1325541368&mt=8&at=1000l9tW

As the name suggests, it allows updates to both MySQL and SQL server databases.

 

Categories: Uncategorized

Using #Sass to freshen up an #Ionic v1.3.3 app

sass-detail-04_1024x1024

If you’ve created an app in ionic Creator, then the output is a Ionic 1.3.3. app, which is a little out of date now, and although it looks professional, it does have quite a bland colour scheme. So if you’re doing a B2B app, that’s fine. If you’re doing an app for Kids or Teens, it’s boring.

Although you can edit the ionic/lib/css – you shouldn’t. It’s much much better to edit the ionic/lib/scss (Sass) instead

so, I downloaded the Sass precompiler, and generated a nice palette at coolors.co;

coolours

Then, I headed for _variables.scss and replaced it with the following

 

// Colors
// ——————————-

$light: #FFFCF2 !default;
$stable: #CCC5B9 !default;
$positive: #EB5E28 !default;
$calm: #11c1f3 !default;
$balanced: #33cd5f !default;
$energized: #ffc900 !default;
$assertive: #ef473a !default;
$royal: #886aea !default;
$dark: #444 !default;

 

// Base
// ——————————-

$font-family-sans-serif: ‘-apple-system’, “Helvetica Neue”, “Roboto”, “Segoe UI”, sans-serif !default;

$font-family-light-sans-serif: ‘-apple-system’, “HelveticaNeue-Light”, “Roboto-Light”, “Segoe UI-Light”, sans-serif-light !default;
$font-family-serif: serif !default;
$font-family-monospace: monospace !default;

$font-family-base: $font-family-sans-serif !default;
$font-size-base: 14px !default;
$font-size-large: 18px !default;
$font-size-small: 11px !default;

$line-height-base: 1.428571429 !default; // 20/14
$line-height-computed: floor($font-size-base * $line-height-base) !default; // ~20px
$line-height-large: 1.33 !default;
$line-height-small: 1.5 !default;

$headings-font-family: $font-family-base !default;
$headings-font-weight: 500 !default;
$headings-line-height: 1.2 !default;

$base-background-color: #403D39 !default;
$base-color: #000 !default;

$link-color: $positive !default;
$link-hover-color: darken($link-color, 15%) !default;

$content-padding: 10px !default;

$padding-base-vertical: 6px !default;
$padding-base-horizontal: 12px !default;

$padding-large-vertical: 10px !default;
$padding-large-horizontal: 16px !default;

$padding-small-vertical: 5px !default;
$padding-small-horizontal: 10px !default;

$border-radius-base: 4px !default;
$border-radius-large: 6px !default;
$border-radius-small: 3px !default;

 

// Content
// ——————————-

$scroll-refresh-icon-color: #666666 !default;

 

// Buttons
// ——————————-

$button-color: #222 !default;
$button-block-margin: 10px !default;
$button-clear-padding: 6px !default;
$button-border-radius: 4px !default;
$button-border-width: 1px !default;

$button-font-size: 16px !default;
$button-height: 42px !default;
$button-padding: 12px !default;
$button-icon-size: 24px !default;

$button-large-font-size: 20px !default;
$button-large-height: 54px !default;
$button-large-padding: 16px !default;
$button-large-icon-size: 32px !default;

$button-small-font-size: 12px !default;
$button-small-height: 28px !default;
$button-small-padding: 4px !default;
$button-small-icon-size: 16px !default;

$button-bar-button-font-size: 13px !default;
$button-bar-button-height: 32px !default;
$button-bar-button-padding: 8px !default;
$button-bar-button-icon-size: 20px !default;

$button-default-border: transparent !default;
$button-default-active-border: null !default;

$button-light-bg: $light !default;
$button-light-text: #444 !default;
$button-light-border: #ddd !default;
$button-light-active-bg: #fafafa !default;
$button-light-active-border: #ccc !default;

$button-stable-bg: $stable !default;
$button-stable-text: #444 !default;
$button-stable-border: #b2b2b2 !default;
$button-stable-active-bg: #e5e5e5 !default;
$button-stable-active-border: #a2a2a2 !default;

$button-positive-bg: $positive !default;
$button-positive-text: #fff !default;
$button-positive-border: darken($positive, 10%) !default;
$button-positive-active-bg: darken($positive, 10%) !default;
$button-positive-active-border: darken($positive, 10%) !default;

$button-calm-bg: $calm !default;
$button-calm-text: #fff !default;
$button-calm-border: darken($calm, 10%) !default;
$button-calm-active-bg: darken($calm, 10%) !default;
$button-calm-active-border: darken($calm, 10%) !default;

$button-assertive-bg: $assertive !default;
$button-assertive-text: #fff !default;
$button-assertive-border: darken($assertive, 10%) !default;
$button-assertive-active-bg: darken($assertive, 10%) !default;
$button-assertive-active-border: darken($assertive, 10%) !default;

$button-balanced-bg: $balanced !default;
$button-balanced-text: #fff !default;
$button-balanced-border: darken($balanced, 10%) !default;
$button-balanced-active-bg: darken($balanced, 10%) !default;
$button-balanced-active-border: darken($balanced, 10%) !default;

$button-energized-bg: $energized !default;
$button-energized-text: #fff !default;
$button-energized-border: darken($energized, 5%) !default;
$button-energized-active-bg: darken($energized, 5%) !default;
$button-energized-active-border: darken($energized, 5%) !default;

$button-royal-bg: $royal !default;
$button-royal-text: #fff !default;
$button-royal-border: darken($royal, 8%) !default;
$button-royal-active-bg: darken($royal, 8%) !default;
$button-royal-active-border: darken($royal, 8%) !default;

$button-dark-bg: $dark !default;
$button-dark-text: #fff !default;
$button-dark-border: #111 !default;
$button-dark-active-bg: #262626 !default;
$button-dark-active-border: #000 !default;

$button-default-bg: $button-stable-bg !default;
$button-default-text: $button-stable-text !default;
$button-default-border: $button-stable-border !default;
$button-default-active-bg: $button-stable-active-bg !default;
$button-default-active-border: $button-stable-active-border !default;

 

// Bars
// ——————————-

$bar-height: 44px !default;
$bar-title-font-size: 17px !default;
$bar-padding-portrait: 5px !default;
$bar-padding-landscape: 5px !default;
$bar-transparency: 1 !default;

$bar-footer-height: $bar-height !default;
$bar-subheader-height: $bar-height !default;
$bar-subfooter-height: $bar-height !default;

$bar-light-bg: rgba($button-light-bg, $bar-transparency) !default;
$bar-light-text: $button-light-text !default;
$bar-light-border: $button-light-border !default;
$bar-light-active-bg: $button-light-active-bg !default;
$bar-light-active-border: $button-light-active-border !default;

$bar-stable-bg: rgba($button-stable-bg, $bar-transparency) !default;
$bar-stable-text: $button-stable-text !default;
$bar-stable-border: $button-stable-border !default;
$bar-stable-active-bg: $button-stable-active-bg !default;
$bar-stable-active-border: $button-stable-active-border !default;

$bar-positive-bg: rgba($button-positive-bg, $bar-transparency) !default;
$bar-positive-text: $button-positive-text !default;
$bar-positive-border: $button-positive-border !default;
$bar-positive-active-bg: $button-positive-active-bg !default;
$bar-positive-active-border: $button-positive-active-border !default;

$bar-calm-bg: rgba($button-calm-bg, $bar-transparency) !default;
$bar-calm-text: $button-calm-text !default;
$bar-calm-border: $button-calm-border !default;
$bar-calm-active-bg: $button-calm-active-bg !default;
$bar-calm-active-border: $button-calm-active-border !default;

$bar-assertive-bg: rgba($button-assertive-bg, $bar-transparency) !default;
$bar-assertive-text: $button-assertive-text !default;
$bar-assertive-border: $button-assertive-border !default;
$bar-assertive-active-bg: $button-assertive-active-bg !default;
$bar-assertive-active-border: $button-assertive-active-border !default;

$bar-balanced-bg: rgba($button-balanced-bg, $bar-transparency) !default;
$bar-balanced-text: $button-balanced-text !default;
$bar-balanced-border: $button-balanced-border !default;
$bar-balanced-active-bg: $button-balanced-active-bg !default;
$bar-balanced-active-border: $button-balanced-active-border !default;

$bar-energized-bg: rgba($button-energized-bg, $bar-transparency) !default;
$bar-energized-text: $button-energized-text !default;
$bar-energized-border: $button-energized-border !default;
$bar-energized-active-bg: $button-energized-active-bg !default;
$bar-energized-active-border: $button-energized-active-border !default;

$bar-royal-bg: rgba($button-royal-bg, $bar-transparency) !default;
$bar-royal-text: $button-royal-text !default;
$bar-royal-border: $button-royal-border !default;
$bar-royal-active-bg: $button-royal-active-bg !default;
$bar-royal-active-border: $button-royal-active-border !default;

$bar-dark-bg: rgba($button-dark-bg, $bar-transparency) !default;
$bar-dark-text: $button-dark-text !default;
$bar-dark-border: $button-dark-border !default;
$bar-dark-active-bg: $button-dark-active-bg !default;
$bar-dark-active-border: $button-dark-active-border !default;

$bar-default-bg: $bar-light-bg !default;
$bar-default-text: $bar-light-text !default;
$bar-default-border: $bar-light-border !default;
$bar-default-active-bg: $bar-light-active-bg !default;
$bar-default-active-border: $bar-light-active-border !default;

 

// Tabs
// ——————————-

$tabs-height: 49px !default;
$tabs-text-font-size: 14px !default;
$tabs-text-font-size-side-icon: 10px !default;
$tabs-icon-size: 32px !default;
$tabs-badge-padding: 1px 6px !default;
$tabs-badge-font-size: 12px !default;

$tabs-light-bg: $button-light-bg !default;
$tabs-light-border: $button-light-border !default;
$tabs-light-text: $button-light-text !default;

$tabs-stable-bg: $button-stable-bg !default;
$tabs-stable-border: $button-stable-border !default;
$tabs-stable-text: $button-stable-text !default;

$tabs-positive-bg: $button-positive-bg !default;
$tabs-positive-border: $button-positive-border !default;
$tabs-positive-text: $button-positive-text !default;

$tabs-calm-bg: $button-calm-bg !default;
$tabs-calm-border: $button-calm-border !default;
$tabs-calm-text: $button-calm-text !default;

$tabs-assertive-bg: $button-assertive-bg !default;
$tabs-assertive-border: $button-assertive-border !default;
$tabs-assertive-text: $button-assertive-text !default;

$tabs-balanced-bg: $button-balanced-bg !default;
$tabs-balanced-border: $button-balanced-border !default;
$tabs-balanced-text: $button-balanced-text !default;

$tabs-energized-bg: $button-energized-bg !default;
$tabs-energized-border: $button-energized-border !default;
$tabs-energized-text: $button-energized-text !default;

$tabs-royal-bg: $button-royal-bg !default;
$tabs-royal-border: $button-royal-border !default;
$tabs-royal-text: $button-royal-text !default;

$tabs-dark-bg: $button-dark-bg !default;
$tabs-dark-border: $button-dark-border !default;
$tabs-dark-text: $button-dark-text !default;

$tabs-default-bg: $tabs-stable-bg !default;
$tabs-default-border: $tabs-stable-border !default;
$tabs-default-text: $tabs-stable-text !default;

$tab-item-max-width: 150px !default;

$tabs-off-opacity: 0.4 !default;
$tabs-striped-off-opacity: $tabs-off-opacity !default;
$tabs-striped-off-color: #000 !default;
$tabs-striped-border-width: 2px !default;

 

// Items
// ——————————-

$item-font-size: 16px !default;
$item-border-width: 1px !default;
$item-padding: 16px !default;

$item-button-font-size: 18px !default;
$item-button-line-height: 32px !default;
$item-icon-font-size: 32px !default;
$item-icon-fill-font-size: 28px !default;

$item-icon-accessory-color: #ccc !default;
$item-icon-accessory-font-size: 16px !default;

$item-avatar-width: 40px !default;
$item-avatar-height: 40px !default;
$item-avatar-border-radius: 50% !default;

$item-thumbnail-width: 80px !default;
$item-thumbnail-height: 80px !default;
$item-thumbnail-margin: 10px !default;

$item-divider-bg: #f5f5f5 !default;
$item-divider-color: #222 !default;
$item-divider-padding: 5px 15px !default;

$item-light-bg: $button-light-bg !default;
$item-light-border: $button-light-border !default;
$item-light-text: $button-light-text !default;
$item-light-active-bg: $button-light-active-bg !default;
$item-light-active-border: $button-light-active-border !default;

$item-stable-bg: $button-stable-bg !default;
$item-stable-border: $button-stable-border !default;
$item-stable-text: $button-stable-text !default;
$item-stable-active-bg: $button-stable-active-bg !default;
$item-stable-active-border: $button-stable-active-border !default;

$item-positive-bg: $button-positive-bg !default;
$item-positive-border: $button-positive-border !default;
$item-positive-text: $button-positive-text !default;
$item-positive-active-bg: $button-positive-active-bg !default;
$item-positive-active-border: $button-positive-active-border !default;

$item-calm-bg: $button-calm-bg !default;
$item-calm-border: $button-calm-border !default;
$item-calm-text: $button-calm-text !default;
$item-calm-active-bg: $button-calm-active-bg !default;
$item-calm-active-border: $button-calm-active-border !default;

$item-assertive-bg: $button-assertive-bg !default;
$item-assertive-border: $button-assertive-border !default;
$item-assertive-text: $button-assertive-text !default;
$item-assertive-active-bg: $button-assertive-active-bg !default;
$item-assertive-active-border: $button-assertive-active-border !default;

$item-balanced-bg: $button-balanced-bg !default;
$item-balanced-border: $button-balanced-border !default;
$item-balanced-text: $button-balanced-text !default;
$item-balanced-active-bg: $button-balanced-active-bg !default;
$item-balanced-active-border: $button-balanced-active-border !default;

$item-energized-bg: $button-energized-bg !default;
$item-energized-border: $button-energized-border !default;
$item-energized-text: $button-energized-text !default;
$item-energized-active-bg: $button-energized-active-bg !default;
$item-energized-active-border: $button-energized-active-border !default;

$item-royal-bg: $button-royal-bg !default;
$item-royal-border: $button-royal-border !default;
$item-royal-text: $button-royal-text !default;
$item-royal-active-bg: $button-royal-active-bg !default;
$item-royal-active-border: $button-royal-active-border !default;

$item-dark-bg: $button-dark-bg !default;
$item-dark-border: $button-dark-border !default;
$item-dark-text: $button-dark-text !default;
$item-dark-active-bg: $button-dark-active-bg !default;
$item-dark-active-border: $button-dark-active-border !default;

$item-default-bg: $item-light-bg !default;
$item-default-border: $item-light-border !default;
$item-default-text: $item-light-text !default;
$item-default-active-bg: #D9D9D9 !default;
$item-default-active-border: $item-light-active-border !default;

 

// Item Editing
// ——————————-

$item-edit-transition-duration: 250ms !default;
$item-edit-transition-function: ease-in-out !default;

$item-remove-transition-duration: 300ms !default;
$item-remove-transition-function: ease-in !default;
$item-remove-descendents-transition-function: cubic-bezier(.25,.81,.24,1) !default;

$item-left-edit-left: 8px !default; // item’s left side edit’s “left” property

$item-right-edit-open-width: 50px !default;
$item-left-edit-open-width: 50px !default;

$item-delete-icon-size: 24px !default;
$item-delete-icon-color: $assertive !default;

$item-reorder-icon-size: 32px !default;
$item-reorder-icon-color: $dark !default;

 

// Lists
// ——————————-

$list-header-bg: transparent !default;
$list-header-color: #222 !default;
$list-header-padding: 5px 15px !default;
$list-header-margin-top: 20px !default;

 

// Cards
// ——————————-

$card-header-bg: #F5F5F5 !default;
$card-body-bg: #fff !default;
$card-footer-bg: #F5F5F5 !default;

$card-padding: 10px !default;
$card-border-width: 1px !default;

$card-border-color: #ccc !default;
$card-border-radius: 2px !default;
$card-box-shadow: 0 1px 3px rgba(0, 0, 0, .3) !default;

 

// Forms
// ——————————-

$input-height-base: ($line-height-computed + ($padding-base-vertical * 2) + 2) !default;
$input-height-large: (floor($font-size-large * $line-height-large) + ($padding-large-vertical * 2) + 2) !default;
$input-height-small: (floor($font-size-small * $line-height-small) + ($padding-small-vertical * 2) + 2) !default;

$input-bg: $light !default;
$input-bg-disabled: $stable !default;

$input-color: #111 !default;
$input-border: $item-default-border !default;
$input-border-width: $item-border-width !default;
$input-label-color: $dark !default;
$input-color-placeholder: lighten($dark, 40%) !default;

 

// Progress
// ——————————-

$progress-width: 100% !default;
$progress-margin: 15px auto !default;

 

// Toggle
// ——————————-

$toggle-width: 51px !default;
$toggle-height: 31px !default;
$toggle-border-width: 2px !default;
$toggle-border-radius: 20px !default;

$toggle-handle-width: $toggle-height – ($toggle-border-width * 2) !default;
$toggle-handle-height: $toggle-handle-width !default;
$toggle-handle-radius: $toggle-handle-width !default;
$toggle-handle-dragging-bg-color: darken(#fff, 5%) !default;

$toggle-off-bg-color: #fff !default;
$toggle-off-border-color: #e6e6e6 !default;

$toggle-on-light-bg: $button-light-border !default;
$toggle-on-light-border: $toggle-on-light-bg !default;
$toggle-on-stable-bg: $button-stable-border !default;
$toggle-on-stable-border: $toggle-on-stable-bg !default;
$toggle-on-positive-bg: $positive !default;
$toggle-on-positive-border: $toggle-on-positive-bg !default;
$toggle-on-calm-bg: $calm !default;
$toggle-on-calm-border: $toggle-on-calm-bg !default;
$toggle-on-assertive-bg: $assertive !default;
$toggle-on-assertive-border: $toggle-on-assertive-bg !default;
$toggle-on-balanced-bg: $balanced !default;
$toggle-on-balanced-border: $toggle-on-balanced-bg !default;
$toggle-on-energized-bg: $energized !default;
$toggle-on-energized-border: $toggle-on-energized-bg !default;
$toggle-on-royal-bg: $royal !default;
$toggle-on-royal-border: $toggle-on-royal-bg !default;
$toggle-on-dark-bg: $dark !default;
$toggle-on-dark-border: $toggle-on-dark-bg !default;
$toggle-on-default-bg: #4cd964 !default;
$toggle-on-default-border: $toggle-on-default-bg !default;

$toggle-handle-off-bg-color: $light !default;
$toggle-handle-on-bg-color: $toggle-handle-off-bg-color !default;

$toggle-transition-duration: .3s !default;

$toggle-hit-area-expansion: 5px;

 

// Checkbox
// ——————————-

$checkbox-width: 28px !default;
$checkbox-height: 28px !default;
$checkbox-border-radius: $checkbox-width !default;
$checkbox-border-width: 1px !default;

$checkbox-off-bg-color: #fff !default;
$checkbox-off-border-light: $button-light-border !default;
$checkbox-on-bg-light: $button-light-border !default;
$checkbox-off-border-stable: $button-stable-border !default;
$checkbox-on-bg-stable: $button-stable-border !default;
$checkbox-off-border-positive: $positive !default;
$checkbox-on-bg-positive: $positive !default;
$checkbox-off-border-calm: $calm !default;
$checkbox-on-bg-calm: $calm !default;
$checkbox-off-border-assertive: $assertive !default;
$checkbox-on-bg-assertive: $assertive !default;
$checkbox-off-border-balanced: $balanced !default;
$checkbox-on-bg-balanced: $balanced !default;
$checkbox-off-border-energized: $energized !default;
$checkbox-on-bg-energized: $energized !default;
$checkbox-off-border-royal: $royal !default;
$checkbox-on-bg-royal: $royal !default;
$checkbox-off-border-dark: $dark !default;
$checkbox-on-bg-dark: $dark !default;
$checkbox-off-border-default: $button-light-border !default;
$checkbox-on-bg-default: $positive !default;
$checkbox-on-border-default: $positive !default;

$checkbox-check-width: 1px !default;
$checkbox-check-color: #fff !default;

 

// Range
// ——————————-

$range-track-height: 2px !default;
$range-slider-width: 28px !default;
$range-slider-height: 28px !default;
$range-slider-border-radius: 50% !default;
$range-icon-size: 24px !default;
$range-slider-box-shadow: 0 0 2px rgba(0,0,0,.3), 0 3px 5px rgba(0,0,0,0.2) !default;

$range-light-track-bg: $button-light-border !default;
$range-stable-track-bg: $button-stable-border !default;
$range-positive-track-bg: $button-positive-bg !default;
$range-calm-track-bg: $button-calm-bg !default;
$range-balanced-track-bg: $button-balanced-bg !default;
$range-assertive-track-bg: $button-assertive-bg !default;
$range-energized-track-bg: $button-energized-bg !default;
$range-royal-track-bg: $button-royal-bg !default;
$range-dark-track-bg: $button-dark-bg !default;
$range-default-track-bg: #ccc !default;

 

// Menus
// ——————————-

$menu-bg: #fff !default;
$menu-width: 275px !default;
$menu-animation-speed: 200ms !default;

$menu-side-shadow: -1px 0px 2px rgba(0, 0, 0, 0.2), 1px 0px 2px rgba(0,0,0,0.2) !default;

 

// Modals
// ——————————-

$modal-bg-color: #fff !default;
$modal-backdrop-bg-active: #000 !default;
$modal-backdrop-bg-inactive: rgba(0,0,0,0) !default;

$modal-inset-mode-break-point: 680px !default; // @media min-width
$modal-inset-mode-top: 20% !default;
$modal-inset-mode-right: 20% !default;
$modal-inset-mode-bottom: 20% !default;
$modal-inset-mode-left: 20% !default;
$modal-inset-mode-min-height: 240px !default;

 

// Popovers
// ——————————-

$popover-bg-color: $light !default;
$popover-backdrop-bg-active: rgba(0,0,0,0.1) !default;
$popover-backdrop-bg-inactive: rgba(0,0,0,0) !default;
$popover-width: 220px !default;
$popover-height: 280px !default;
$popover-large-break-point: 680px !default;
$popover-large-width: 360px !default;

$popover-box-shadow: 0 1px 3px rgba(0,0,0,0.4) !default;
$popover-border-radius: 2px !default;

$popover-box-shadow-ios: 0 0 40px rgba(0,0,0,0.08) !default;
$popover-border-radius-ios: 10px !default;

$popover-bg-color-android: #fafafa !default;
$popover-box-shadow-android: 0 2px 6px rgba(0,0,0,0.35) !default;

 

// Grids
// ——————————-

$grid-padding-width: 10px !default;
$grid-responsive-sm-break: 567px !default; // smaller than landscape phone
$grid-responsive-md-break: 767px !default; // smaller than portrait tablet
$grid-responsive-lg-break: 1023px !default; // smaller than landscape tablet

 

// Action Sheets
// ——————————-

$sheet-margin: 8px !default;
$sheet-border-radius: 4px !default;

$sheet-options-bg-color: #f1f2f3 !default;
$sheet-options-bg-active-color: #e4e5e7 !default;
$sheet-options-text-color: #007aff !default;
$sheet-options-border-color: #d1d3d6 !default;

 

// Popups
// ——————————-

$popup-width: 250px !default;
$popup-enter-animation: superScaleIn !default;
$popup-enter-animation-duration: 0.2s !default;
$popup-leave-animation-duration: 0.1s !default;

$popup-border-radius: 0px !default;
$popup-background-color: rgba(255,255,255,0.9) !default;

$popup-button-border-radius: 2px !default;
$popup-button-line-height: 20px !default;
$popup-button-min-height: 45px !default;

 

// Loading
// ——————————-

$loading-text-color: #fff !default;
$loading-bg-color: rgba(0,0,0,0.7) !default;
$loading-padding: 20px !default;
$loading-border-radius: 5px !default;
$loading-font-size: 15px !default;

$loading-backdrop-fadein-duration:0.1s !default;
$loading-backdrop-bg-color: rgba(0,0,0,0.4) !default;

 

// Badges
// ——————————-

$badge-font-size: 14px !default;
$badge-line-height: 16px !default;
$badge-font-weight: bold !default;
$badge-border-radius: 10px !default;

$badge-light-bg: $button-light-bg !default;
$badge-light-text: $button-light-text !default;

$badge-stable-bg: $button-stable-bg !default;
$badge-stable-text: $button-stable-text !default;

$badge-positive-bg: $button-positive-bg !default;
$badge-positive-text: $button-positive-text !default;

$badge-calm-bg: $button-calm-bg !default;
$badge-calm-text: $button-calm-text !default;

$badge-balanced-bg: $button-balanced-bg !default;
$badge-balanced-text: $button-balanced-text !default;

$badge-assertive-bg: $button-assertive-bg !default;
$badge-assertive-text: $button-assertive-text !default;

$badge-energized-bg: $button-energized-bg !default;
$badge-energized-text: $button-energized-text !default;

$badge-royal-bg: $button-royal-bg !default;
$badge-royal-text: $button-royal-text !default;

$badge-dark-bg: $button-dark-bg !default;
$badge-dark-text: $button-dark-text !default;

$badge-default-bg: transparent !default;
$badge-default-text: #AAAAAA !default;

 

// Spinners
// ——————————-

$spinner-width: 28px !default;
$spinner-height: 28px !default;

$spinner-light-stroke: $light !default;
$spinner-light-fill: $light !default;

$spinner-stable-stroke: $stable !default;
$spinner-stable-fill: $stable !default;

$spinner-positive-stroke: $positive !default;
$spinner-positive-fill: $positive !default;

$spinner-calm-stroke: $calm !default;
$spinner-calm-fill: $calm !default;

$spinner-balanced-stroke: $balanced !default;
$spinner-balanced-fill: $balanced !default;

$spinner-assertive-stroke: $assertive !default;
$spinner-assertive-fill: $assertive !default;

$spinner-energized-stroke: $energized !default;
$spinner-energized-fill: $energized !default;

$spinner-royal-stroke: $royal !default;
$spinner-royal-fill: $royal !default;

$spinner-dark-stroke: $dark !default;
$spinner-dark-fill: $dark !default;

$spinner-default-stroke: $dark !default;
$spinner-default-fill: $dark !default;

 

// Z-Indexes
// ——————————-

$z-index-bar-title: 0 !default;
$z-index-item-drag: 0 !default;
$z-index-item-edit: 0 !default;
$z-index-menu: 0 !default;
$z-index-badge: 1 !default;
$z-index-bar-button: 1 !default;
$z-index-item-options: 1 !default;
$z-index-pane: 1 !default;
$z-index-slider-pager: 1 !default;
$z-index-view: 1 !default;
$z-index-view-below: 2 !default;
$z-index-item: 2 !default;
$z-index-item-checkbox: 3 !default;
$z-index-item-radio: 3 !default;
$z-index-item-reorder: 3 !default;
$z-index-item-toggle: 3 !default;
$z-index-view-above: 3 !default;
$z-index-tabs: 5 !default;
$z-index-item-reordering: 9 !default;
$z-index-bar: 9 !default;
$z-index-bar-above: 10 !default;
$z-index-menu-scroll-content: 10 !default;
$z-index-modal: 10 !default;
$z-index-popover: 10 !default;
$z-index-action-sheet: 11 !default;
$z-index-backdrop: 11 !default;
$z-index-menu-bar-header: 11 !default;
$z-index-scroll-content-false: 11 !default;
$z-index-popup: 12 !default;
$z-index-loading: 13 !default;
$z-index-scroll-bar: 9999 !default;
$z-index-click-block: 99999 !default;

 

// Platform
// ——————————-

$ios-statusbar-height: 20px !default;

demo

Categories: Uncategorized

Downloadable #VIES VAT data from the #EU

0e42f16e3b63b6180450064cdbceb9d1

If you need to look up a VAT number of a EU company you can always use VIES as the defacto source for this data. But if you want to host the data on-site, to do reverse lookups on it, or statistical queries, then you can now download this data from VatAPI.co.uk – for 13 countries as follows;

 United Kingdom
 Netherlands
 Italy
 Finland
 Malta
 Austria
 Hungary
 Czech Republic
 Portugal
 Luxembourg
 Denmark
 Belgium
 Greece

With more countries coming soon…

Categories: Uncategorized

#Verify an #Email Address with a #DNS #MX lookup in C#

74_Email-Security-MX-Records-800x410

Sending an email to an invalid email address has some bad side effects, the most important being, is that your message is not going through to its intended recipient, and on a larger scale, a bad email counts towards your bounce ratio with your SMTP provider, which in extreme cases can cause legal issues with EU PECR laws.

You can always, verify the format of an email address using a regex, but this has two issues – one, is that new TLD’s like “.museum” or “.家電” might break the regex, and secondly, even if the email is valid. Secondly, some domains are valid, but have no MX record set up to handle email. like “info@testtesttest.com” is going to pass any regex, but “testtesttest.com” has no ability to handle email.

So, here’s a bit of code in C# that verifies the domain part of the email;

public static bool VerifyEmailDomain(string domain)
{
// Install-Package ARSoft.Tools.Net
try
{
var resolver = new DnsStubResolver();
var records = resolver.Resolve<MxRecord>(domain, RecordType.Mx);
return records.Any();
}
catch {
return false;
}
}

Now, unfortunately, it’s not possible to check if bob@gmail.com is valid, even if fred@gmail.com using this technique, however, if it is really important, then you can check gmail accounts against the AvatarAPI.com API – to verify if the Gmail account has a profile attached.

This technique is the basis behind http://www.directtomx.com/ – a email sending API that bypasses intermediary SMTP servers.

 

Categories: Uncategorized

Send a message with #PushBullet using c#

Pushbullet-app-icon

Pushbullet is an iOS / Android and Web based app, that is used for automated messaging. It’s pretty easy to use from within C#, here’s an example;

* curl –header ‘Access-Token: <your_access_token_here>’ \
–header ‘Content-Type: application/json’ \
–data-binary ‘{“body”:”Space Elevator, Mars Hyperloop, Space Model S (Model Space?)”,”title”:”Space Travel Ideas”,”type”:”note”}’ \
–request POST \
https://api.pushbullet.com/v2/pushes
*/

var message = new
{
body = “Space Elevator, Mars Hyperloop, Space Model S (Model Space?)”,
title = “Space Travel Ideas”,
type = “note”
};
WebClient wc = new WebClient();
wc.Headers[“Access-Token”] = “o.xxxxxxxxxxxxxx”;
wc.Headers[“Content-Type”] = “application/json”;
var strPayload = JsonConvert.SerializeObject(message);
var strResponse = wc.UploadString(“https://api.pushbullet.com/v2/pushes&#8221;, strPayload);

/*
{
“active”: true,
“iden”: “xxxxxxx”,
“created”: 1512656152.566,
“modified”: 1512656152.5928,
“type”: “note”,
“dismissed”: false,
“direction”: “self”,
“sender_iden”: “ujvhvGp18iy”,
“sender_email”: “xxxx@hotmail.com”,
“sender_email_normalized”: “xxxx@hotmail.com”,
“sender_name”: “xxxx xxxx”,
“receiver_iden”: “ujvhvGp18iy”,
“receiver_email”: “xxxx@hotmail.com”,
“receiver_email_normalized”: “xxx@hotmail.com”,
“title”: “Space Travel Ideas”,
“body”: “Space Elevator, Mars Hyperloop, Space Model S (Model Space?)”
}
*/

The above code requires the NUNIT package Install-Package Newtonsoft.Json, and you’ll need an access token from pushbullet under your account > Settings

 

Categories: Uncategorized

#Bitcoin clipboard #Virus, and how to avoid it.

725_Ly9jb2ludGVsZWdyYXBoLmNvbS9zdG9yYWdlL3VwbG9hZHMvdmlldy8zZmJmM2YyY2RmNmY4MzdhODQ0OGJmNjIzNTY5Mzg5MC5wbmc=

When checking stats on FreebieBitcoin.com – all of the Bitcoin Millionaires (> USD$ 1M) on the site shared the same Bitcoin wallet 13JF5274VuNthhwKkLrYyZW73smjSYAEen

This turned out to be something very sinister indeed. 

A windows Virus, called Trojan.Coinbitclip – watches your windows clipboard for a Bitcoin wallet address, then when detected, replaces it with the hacker’s account. meaning, if you are about to make a bitcoin payment, you end up giving it to the hacker, rather than the person you intended to pay.

To avoid it, you should always copy and paste into notepad, compare the numbers, and if they are not identical, then run a full virus scan on your computer. Bitcoin addresses are designed not to look visually identical, so it should be easy to spot.

Here is some further reading on the subject:

https://steemit.com/bitcoin/@adnanefs/my-bitcoin-is-gone-sneaky-virus-story

https://bitcointalk.org/index.php?topic=1842977.0

https://www.symantec.com/security_response/writeup.jsp?docid=2016-020216-4204-99&tabid=2

Categories: Uncategorized

Creating a #Facebook #Chatbot using #AWS #Lex and #Lambda

Chatbot

Chatbots are a novel way of interacting with your customers if you don’t have the staff to deal with them personally.

Creating one using Amazon LEX is really easy, and you can do it with no code whatsoever. – Although if you want it to do anything of use, then you’ll need to write a Lambda function.

First, log into AWS, open up LEX, then create a new Bot.

You’ll need to set up an Intent, and add an utterance that will activate this intent. You add slots – which are dynamic data provided by the user that provides you with the information you need to fulfil the user’s request.

You can test it out on the right hand side of the page, but the real kicker is getting the bot to work with Facebook. – So, you head on over to developers.facebook.com and create a new App. Select Products > Add product > Messenger

In Token Generation, select your Facebook Page, and press generate. You’ll need this token later.  – Also grab the app secret key, you’ll need this in a moment.

Head back over to LEX, select Channels, then fill in the form, – Your Verify Token can be anything at all, just remember it for the next step.  Press activate, and you’ll get an Endpoint URL.

Jump back to Facebook, and open up the webhooks tab.  Create a new webhook, and enter the Verify Token, and the Endpoint URL. give permissions for the following: messages, messaging_postbacks, messaging_optins , and then select a page, and press subscribe to events.

Now, if you open Facebook messenger on your phone and start a chat with your business page, your bot should start replying to messages

Of course, to make it do anything useful, you have to write some code, To do this, you create a lambda function in AWS, and link it to the Fulfilment step in LEX. In this example, I am taking the data provided by the user, and building up a URL from it, that the user can click – so that a web-page can finish serving the customer.

I used this code; based on the orderFlowers NodeJs example.

function elicitSlot(sessionAttributes, intentName, slots, slotToElicit, message) {
return {
sessionAttributes,
dialogAction: {
type: ‘ElicitSlot’,
intentName,
slots,
slotToElicit,
message,
},
};
}

function close(sessionAttributes, fulfillmentState, message, responseCard) {
return {
sessionAttributes,
dialogAction: {
type: ‘Close’,
fulfillmentState,
message,
responseCard
},
};
}

function delegate(sessionAttributes, slots) {
return {
sessionAttributes,
dialogAction: {
type: ‘Delegate’,
slots,
},
};
}

function FindFlight(intentRequest, callback) {
const source = intentRequest.invocationSource;
const depart = intentRequest.currentIntent.slots.departure;
const destination = intentRequest.currentIntent.slots.destination;
const departureDate = intentRequest.currentIntent.slots.departureDate;
const returnDate = intentRequest.currentIntent.slots.returnDate;
const Adults = intentRequest.currentIntent.slots.Adults;
const Children = intentRequest.currentIntent.slots.Children;
const infants = intentRequest.currentIntent.slots.infants;

if (source === ‘DialogCodeHook’) {
const outputSessionAttributes = intentRequest.sessionAttributes;
callback(delegate(outputSessionAttributes, intentRequest.currentIntent.slots));
return;
}
callback(close(intentRequest.sessionAttributes, ‘Fulfilled’,
{
contentType: ‘PlainText’,
content: `Click the following link to see our flight offers`
},
{
“version”: 3,
“contentType”: “application/vnd.amazonaws.card.generic”,
“genericAttachments”: [
{
“title”:`${depart} to ${destination}`,
“subTitle”:`${departureDate} – ${returnDate}`,
“attachmentLinkUrl”:`http://www.somewebsite.com/{$depart}/{$destination}/${departureDate}/${returnDate}`,

}
]
}

));
}

/**
* Called when the user specifies an intent for this skill.
*/
function dispatch(intentRequest, callback) {
console.log(`dispatch userId=${intentRequest.userId}, intentName=${intentRequest.currentIntent.name}`);

const intentName = intentRequest.currentIntent.name;

// Dispatch to your skill’s intent handlers
if (intentName === ‘YOUR-INTENT’) {
return FindFlight(intentRequest, callback);
}
throw new Error(`Intent with name ${intentName} not supported`);
}

 

exports.handler = (event, context, callback) => {
// TODO implement
dispatch(event, (response) => callback(null, response));
};

 

Categories: Uncategorized