Microsoft had integrate some new features in Azure Database
when i play with the Azure Database today, I spotted that there a new section called Power platform
the new features will allow the user build reports, PowerApp and workflow against the database.
here is list of flow template for free trial
these new features will definitely increase the productivity in the azure database.
a blog to share Microsoft technologies Azure, DotNet, SharePoint, SQL Server,JavaScript Framework: Node.JS, Angular, React
Friday, January 24, 2020
Wednesday, January 22, 2020
Tricky C# interview question
I had been asked to trace the following code for the output
class Program
{
public delegate void Iterator();
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
List<Iterator> interators = new List<Iterator>();
for (int i = 0; i < 15; i++)
{
interators.Add(delegate { Console.WriteLine(i); });
}
foreach (var interator in interators)
{
interator();
}
Console.Read();
}
}
Do you like to try it?
class Program
{
public delegate void Iterator();
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
List<Iterator> interators = new List<Iterator>();
for (int i = 0; i < 15; i++)
{
interators.Add(delegate { Console.WriteLine(i); });
}
foreach (var interator in interators)
{
interator();
}
Console.Read();
}
}
Do you like to try it?
Monday, January 20, 2020
how to fix "error NG8001: "your selector'' is not a known element" in Angular Development
after i run npm build to compile my angular project
i got the following error
C:\DanAngular\triathlon-app>ng build
ERROR in src/app/results/results/results.component.html:2:1 - error NG8001: 'results-list' is not a known element:
1. If 'results-list' is an Angular component, then verify that it is part of this module.
2. If 'results-list' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
2 <results-list (selected)=showDetails($event)>Loading athelete list ...</results-list>
when i go inside my project and locate the results-list.component.ts
the selector had been defined as app-results-list
<results-list (selected)=showDetails($event)>Loading athelete list ...</results-list>
should use app-results-list as the selector.
<app-results-list (selected)=showDetails($event)>Loading athelete list ...</app-results-list>
i got the following error
C:\DanAngular\triathlon-app>ng build
ERROR in src/app/results/results/results.component.html:2:1 - error NG8001: 'results-list' is not a known element:
1. If 'results-list' is an Angular component, then verify that it is part of this module.
2. If 'results-list' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
2 <results-list (selected)=showDetails($event)>Loading athelete list ...</results-list>
when i go inside my project and locate the results-list.component.ts
the selector had been defined as app-results-list
@Component({
selector: 'app-results-list',
templateUrl: './results-list.component.html',
styleUrls: ['./results-list.component.scss']
})
export class ResultsListComponent implements OnInit {
athletes: Athlete[];
timingPoints: TimingPoint[];
@Output() selected=new EventEmitter<Athlete>();
constructor(private athleteService: AthleteServiceService) { }
<results-list (selected)=showDetails($event)>Loading athelete list ...</results-list>
should use app-results-list as the selector.
<app-results-list (selected)=showDetails($event)>Loading athelete list ...</app-results-list>
how to fix "Property 'map' does not exist on type 'Observable'" in Angular Development
1. first install the latest ReactJS compact package
npm install --save rxjs-compat@6
2. reference to the rxjs/rx
npm install --save rxjs-compat@6
2. reference to the rxjs/rx
import 'rxjs/Rx';
Angular Development Quick Tips 2
1. Import {Http, Response} from '@angular/http' will cause a not error if you do not expressively install the libary.
npm install @angular/http@latest.
for the latest angular/CLI, the library had been moved to @angular/common/http.
we should use the correct path
Import {Http, Response} from '@angular/common/http'
2. how to generate a component inside the specific folder without a folder
npm g c specifiFolder/mycomponent --flat -d
the --flat instructed the npm command to generate a component without a folder.
-d will force a dry run and show you the output in the windows only. you can verify the output before generating them.
Saturday, January 18, 2020
how to fix the tricky component or function 'is not defined react/jsx-no-undef' error in React Development
here is the code for customsection.js
then i have the code from the App.js will have the CustomerSection component
it looks simple and straight, however when i compile the code in the visual studio terminal
npm run-script build
PS C:\DanAngular\dan-react\my-first-react> npm run-script build
> my-first-react@0.1.0 build C:\DanAngular\dan-react\my-first-react
> react-scripts build
Creating an optimized production build...
Failed to compile.
./src/App.js
Line 28:8: 'CustomSection' is not defined react/jsx-no-undef
Search for the keywords to learn more about each error.
the error stems from this line
we must specific the component name in the import. that is very practice, i really like this checking on the compile time. it will enforce the proper component being reference and will be called.
after i fixed this line, then the project compiled and ran,
my first try on the react is good and running
Happy programming, Cheers
import React, { Component } from "react"
class CustomSection extends Component{
render(){
return (
<h1>Hello Custom Section</h1>
);
}
}
export default CustomSection;
then i have the code from the App.js will have the CustomerSection component
import React, { Component } from 'react';
import './CustomSection'
class App extends Component {
render(){
return (
<div>
<h1>Hello World</h1>
<CustomSection />
</div>
);
}
}
export default App;
it looks simple and straight, however when i compile the code in the visual studio terminal
npm run-script build
PS C:\DanAngular\dan-react\my-first-react> npm run-script build
> my-first-react@0.1.0 build C:\DanAngular\dan-react\my-first-react
> react-scripts build
Creating an optimized production build...
Failed to compile.
./src/App.js
Line 28:8: 'CustomSection' is not defined react/jsx-no-undef
Search for the keywords to learn more about each error.
the error stems from this line
import './CustomSection'
we must specific the component name in the import. that is very practice, i really like this checking on the compile time. it will enforce the proper component being reference and will be called.
import CustomSection from './CustomSection'
after i fixed this line, then the project compiled and ran,
my first try on the react is good and running
Happy programming, Cheers
Thursday, January 16, 2020
how to quickly setup a swagger in asp.net core Web API project with visual studio
1. Create a ASP.Net web project with Visual studio
2. Install the Swagger package in the Package Manager window
3. add swagger generator to services collection which is the dependency injection container
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "My API", Version = "v1" });
});
4. setup the swagger in the configure method
// enable the swagger middleware
app.UseSwagger();
// Enable middleware to serve swagger-ui
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
});
5. launch the app and view the swagger ui from the link below, please note the port will be different
https://localhost:{port}/swagger/index.html
for my local development i had the following
https://localhost:44392/swagger/index.html
2. Install the Swagger package in the Package Manager window
Install-Package Swashbuckle.AspNetCore3. add swagger generator to services collection which is the dependency injection container
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "My API", Version = "v1" });
});
4. setup the swagger in the configure method
// enable the swagger middleware
app.UseSwagger();
// Enable middleware to serve swagger-ui
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
});
5. launch the app and view the swagger ui from the link below, please note the port will be different
https://localhost:{port}/swagger/index.html
for my local development i had the following
https://localhost:44392/swagger/index.html
Subscribe to:
Posts (Atom)



