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.

Advertisements

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

SQL List Tables, Columns and Types

SELECT col.TABLE_CATALOG AS [Database]
, col.TABLE_SCHEMA AS Owner
, col.TABLE_NAME AS TableName
, col.COLUMN_NAME AS ColumnName
, col.ORDINAL_POSITION AS OrdinalPosition
, col.COLUMN_DEFAULT AS DefaultSetting
, col.DATA_TYPE AS DataType
, col.CHARACTER_MAXIMUM_LENGTH AS MaxLength
, col.DATETIME_PRECISION AS DatePrecision
, CAST(CASE col.IS_NULLABLE
WHEN ‘NO’ THEN 0
ELSE 1
END AS bit)AS IsNullable
, COLUMNPROPERTY(OBJECT_ID(‘[‘ + col.TABLE_SCHEMA + ‘].[‘ + col.TABLE_NAME + ‘]’), col.COLUMN_NAME, ‘IsIdentity’)AS IsIdentity
, COLUMNPROPERTY(OBJECT_ID(‘[‘ + col.TABLE_SCHEMA + ‘].[‘ + col.TABLE_NAME + ‘]’), col.COLUMN_NAME, ‘IsComputed’)AS IsComputed
, CAST(ISNULL(pk.is_primary_key, 0)AS bit)AS IsPrimaryKey
FROM INFORMATION_SCHEMA.COLUMNS AS col
LEFT JOIN(SELECT SCHEMA_NAME(o.schema_id)AS TABLE_SCHEMA
, o.name AS TABLE_NAME
, c.name AS COLUMN_NAME
, i.is_primary_key
FROM sys.indexes AS i JOIN sys.index_columns AS ic ON i.object_id = ic.object_id
AND i.index_id = ic.index_id
JOIN sys.objects AS o ON i.object_id = o.object_id
LEFT JOIN sys.columns AS c ON ic.object_id = c.object_id
AND c.column_id = ic.column_id
WHERE i.is_primary_key = 1)AS pk ON col.TABLE_NAME = pk.TABLE_NAME
AND col.TABLE_SCHEMA = pk.TABLE_SCHEMA
AND col.COLUMN_NAME = pk.COLUMN_NAME
–WHERE col.TABLE_NAME = ‘tblclients’
— AND col.TABLE_SCHEMA = ‘dbo’
ORDER BY col.TABLE_NAME, col.ORDINAL_POSITION;