Easy change power shell opacity.

Did you know that you can easily change the opacity of the power shell window using CTRL-SHIFT-mouse-wheel?

Advertisements

Create Windows 10 Install USB Drive

How to create a bootable Windows 10 USB drive from the command line.

You’ll need the .ISO file for Windows 10.

Open the command prompt as the administrator, type “diskpart” without the quotes, and hit enter.

Plug in your USB drive. Type “list disk” without the quotes and hit enter. Take a look at the Size column and figure out which disk number your USB drive is.

Ours is number 1, so we’re going to type “select disk 1” without the quotes and hit enter. Adjust your disk number accordingly.

Now wipe the drive by typing in “clean” without the quotes and hitting enter.

Type “create partition primary” without the quotes and hit enter.

Then type “select partition 1” without the quotes and hit enter.

Next type “active” without the quotes and hit enter.

Finally, type “format fs=fat32” without quotes and hit enter.

When that’s done, type “assign” without the quotes and hit enter.

Mount the .ISO.

Close diskpart and open up cmd again. Type “xcopy g:*.* /s/e/f h:” without the quotes, where “g:” is the drive letter for your mounted .iso file and “h:” is the drive letter for your USB flash drive. Don’t worry if install.wim takes a while to copy: It’s easily the biggest file on the disc.

Type “exit” without the quotes and hit enter. You’re done. You can now install Windows 10 from your USB drive, either by booting from it or from within an existing installation of Windows.

Consume Volusion eStore API Using Meteor JS

The \server\main.js in this example performs an API call to your Volusion eStore, converts the response to JSON and inserts to MongoDB.

The \client\main.js makes the call and displays the data from MongoDB.

meteor create volusionapi

cd volusionapi

meteor add http peerlibrary:xml2js

Copy these files https://github.com/cjfleischhacker/MeteorVolusionAPI.git or create these files:

\client\main.html

<head>
<title>volusion</title>
</head>
<body>
<h1>Welcome to Meteor!</h1>
{{> vapi}}
</body>
<template name="vapi">
<h3>List Courses</h3>
<p style="color: #ff0000; margin: 10px 0 10px 0;">
{{errMessage}}
</p>
<table class="table table-hover">
<thead>
<tr>
<th>ID</th>
<th>Code</th>
<th>Name</th>
</tr>
</thead>
<tbody>
{{#each courses}}
<tr>
<td>{{ProductID}}</td>
<td>{{ProductCode}}</td>
<td>{{ProductName}}</td>
</tr>
{{/each}}
</tbody>
</table>
</template>

\client\main.js

import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import './main.html';
Courses = new Mongo.Collection('courses');

Meteor.call(‘getJSONFromAPI’, function (err, res) {
if (err) {
console.log(err);
} else {
console.log(res.xmldata.Products);
}
});

Template.vapi.onCreated(function helloOnCreated() {
console.log(‘oncreate…’);
});

Template.vapi.helpers({
courses: function () {
return Courses.find();
}
});

\server\main.js

import { Meteor } from 'meteor/meteor';
import { xml2js } from 'meteor/peerlibrary:xml2js';
Courses = new Mongo.Collection('courses');

Meteor.methods({
‘getJSONFromAPI’: function () {
this.unblock();
var apiUrl = ‘http://store.volusion.com/net/WebService.aspx?Login=email@mystore.com&EncryptedPassword=YourVolusionAPIEncryptedPassword&EDI_Name=Generic\\Products&SELECT_Columns=p.ProductCode,p.ProductName,pd.ProductDescription’

;
var response = Meteor.wrapAsync(apiCall)(apiUrl);
const result = xml2js.parseStringSync(response, { explicitArray: false, emptyTag: undefined });
for (var i = 0; i < result.xmldata.Products.length; i++) {
Courses.insert(result.xmldata.Products[i]);
}
return result;
}
});

var apiCall = function (apiUrl, callback) {
// try…catch allows you to handle errors
try {
var response = HTTP.get(apiUrl).content;
// A successful API call returns no error
callback(null, response);
} catch (error) {
// If the API responded with an error message and a payload
if (error.response) {
var errorCode = error.response.data.code;
var errorMessage = error.response.data.message;
// Otherwise use a generic error message
} else {
var errorCode = 500;
var errorMessage = ‘Cannot access the API’;
}
// Create an Error object and return it via callback
var myError = new Meteor.Error(errorCode, errorMessage);
callback(myError, null);
}
}

meteor

C# ASP.Net MVC API Web App Using Advanced DB Master as a Data Source

Been wondering how to build a C#, ASP.Net, MVC, API web app using ADBM (Advanced DB Master) data source on the back end?  You’re welcome.

Demo source on GitHub.

Install Advanced DB Master (ADBM) from http://maconsys.com then open the Sample database, ADBMSamp, and exit ADBM.

ADBM added a System DSN ODBC datasource called adbmsamp to your OS.

SystemDSN.PNG

In Visual Studio, create a C# ASP.Net Framework or Core Web Application.

VisualStudioProject.PNG

And select Web API, leaving the MVC and Web API boxes checked.

WebAPI.PNG

Optionally, you can add the data source as a database connection and work with it that way if you prefer, but that’s not necessary.

DatabaseConnection.PNG

For our needs we’ll just need a connection string in the web.config:

<connectionStrings>
<add name=”csADBMSamp” connectionString=”DSN=adbmsamp” />
</connectionStrings>

Insert XML into SQL Table

set ANSI_NULLS ON

set QUOTED_IDENTIFIER ON

GO

alter procedure [dbo].[xmlToTable]

(@xmlstr ntext)

as

begin

declare @hDoc int

exec sp_xml_preparedocument @hDoc OUTPUT,@xmlstr

insert into tblCustomers(

CustomerID,

FirstName,

LastName,

Email,

Phone)

select

xml.CustomerID,

xml.FirstName,

xml.LastName,

xml.EmailAddress,

xml.PhoneNumber

from OPENXML(@hDoc,’/Customers’,2) –node text not attribute

with(

CustomerId int,

FirstName nvarchar(100),

LastName nvarchar(200),

EmailAddress nvarchar(200),

PhoneNumber nvarchar(100)

)xml

exec sp_xml_removedocument @hDoc

end