Nativescript UI templates - nativescript

Are there any readily available UI templates that I can use for {N}+ Angular mobile app asides the nativescript-ui?

You can create basic angular application using
tns create myApp --ng
or
tns create myApp --template ng
Both options will take this template and will create basic Angular structure (master-detail like)
That said, you can now create your own template following the structure of the one above and re-use it for creating new projects with
tns create myApp --template <path-to-template>
Where the path can be local path, GitHub repository path or path to packed tgz.

Related

Azure bot framework Composer publish with own json data files

I am using json files to store data that is loaded by an LG function. I have the json files within a custom directory under the dialog folder e.g.
mybot/
dialogs/
mydialog/
knowledge-base
language-generation
language-understanding
myfolder/
myfile1.json
myfile2.json
The path I use is relative to the dialog folder e.g.
# MyTemplate(name)
- ${json(fromFile(concat("../../myfolder/",name)))}
Works when testing locally, fails when deployed to Azure webapp
mydialog.en-us.lg:Could not find a part of the path ‘D:\home\site\wwwroot\ComposerDialogs\dialogs\mydialog\myfolder\myfile1.json'
Anyone know what the correct path name should be?
I've tried several different locations for "myfolder" - none work.
I suspect the question should be "How do I tell Composer to include this folder when it builds and deploys the bot?".

Checking a remote url depending upon config

I am a new NativeScript user and I am trying to understand how to have my app make a GET call to a remote server, depending upon environment. In Java world we pass in an environment variable, but I have not found an example (that I understand) demonstrating how my NativeScript mobile app will know which environment it is running in, and how to get values based upon that.
I am presuming that I will have a config/ with files such as
prod.conf.js and dev.conf.js - and there is where I will put in my urls and other config values.
How do I get my NativeScript (which I will eventually build into iOS) to reach those values to use in an http request upon startup. Any example to direction to documentation would be greatly appreciated.
Answer:
I finally got the problem solved by using Manoj suggestion of nativescript-dev-appconfig. For any newbie looking for help, try this:
{PROJECT_ROOT}/config - create the environment files as {env}.json. These files are just json, with name-value pairs of the values you want. In may case that is
When you do your build: tns build ios --bundle --env.config {dev | test | prod }
This will take the contents of the selected env.config file (ie -env.config dev and copy it as - {PROJECT_ROOT}/app/config.json .
To use it within your code,
import config from "../config.json";
axios.get(config.MY_URL).then(result => {...}
Unfortunately using environment based config files are not officially supported but there is a plugin hook you could try.
We also have webpack based environment variable support, read more about that in the docs.

.Net Core: what is the best version to use? SDK 2.1.301 or Runtime 2.1.1

what is the best one to work in .net core? SDK 2.1.301 or Runtime 2.1.1?
I am trying to create a webapi with dotnet, I run dotnet and set http://localhost:5000/api/values/get?Id=1 and fails telling me page not found
I don't know if it is the version of dotnet I installed, I used SDK.
The URL is wrong. It should be http://localhost:5000/api/values/1. That's specified in the controller method itself with a routing attribute :
The SDK inlcudes the runtime so there's no reason to worry about order of installation.
The SDK contains the tools and libraries needed to create and build a project, like dotnet new and dotnet build. It runs on top of the runtime, it doesn't provide its own.
// GET api/values/5
[HttpGet("{id}")]
public ActionResult<string> Get(int id)
{
return "value";
}
This means that the Get action will be called in response to the GET verb and the id parameter will be retrieved from the URL itself.
The runtime contains only the parts that run a program.
UPDATE
The URL just works with the default Web API template. To verify :
Create a new folder
Run dotnet new webapi to create a new Web API project
Run dotnet build to build it and then dotnet run
Paste http://localhost:5000/api/values/1 in any browser.
The response will be
value
UPDATE 2
Postman also works, once SSL certificate verification in Settings > General is disabled.
The Web API template comes with HTTPS preconfigured and works with a self-signed certificate. Calls to http://localhost:5000 will be redirected to https://localhost:5001.
In terms of the framework, there is no difference if you use SDK or runtime. The first one is designed for development, while the latter one for production environments.
Issue comes out from your project, routing for e.g., but difficult to say once you need to share more details. Mentioned framework variants are irrelevant here.

Asp.Net Core MVC - Can I move Identity and DataAccess to class library

I have created an ASP.NET Core MVC Web application with Individual User Account authentication (Identity).
The template has created one Web project, with a whole bunch of folders, including a "Data" folder which has the migrations for the Identity schema, and ApplicationDbContext.
Now, I have some other projects alongside the web app which will need to consume the data. I don't want them to reference the web project for obvious reasons.
And ideally I don't want my web project to depend directly on EF.
Can I move the data access into a separate class library? And if so, how!?
Create a class library projects.
Move the content from corewebproject/data to class library projects.
Add following from nuget:
Entity Framework
AspNetCore.Identity
AspNetCore.Identity.EntityFramework
Microsoft.entityframeworkcore.SqlServer
Microsoft.entityframeworkcore.Tools
Microsoft.entityframeworkcore.Tools.Dotnet
Build class library projects.
Add as reference to your web project.
Change reference in startup contextdb file location.
If you want to change you sql server from localdb change defaultconnection in appsettings.
Add reference related files.
Build solutions.
Go to nuget package manager console and select your project.
Run next commands:
'Remove-Migration'. it will remove some file including snapmodel file
Add-Migrations "Name"
update database
Check you database: you can see upadated db with aspnetcore individual account related tables.
!!! Enjoy !!!!
Sure, check out the Dev branch on https://github.com/MachUpskillingFY17/JabbR-Core we just moved all data into a separate library including identity. Its still quite a work in progress, but it absolutely works.

What is the correct way to add js libraries to mean.io applications?

I am trying to add underscore to my mean.io application. I'm not sure where to link the js library to the page as it doesn't have a main html page like the Angular generator does.
I manually added it via the config/assets.json file and it works however the dev server keeps crashing saying _ is undefined (even though the web app uses the _ function ok and returns the data just before the dev server stops).
I asume I must be doing this wrong.
What is the correct way to add custom js libraries to a mean.io project?
In your package app.js file add
<your package>.aggregateAsset('js', '../<path_to_js_lib in "public/assets" folder>',{
absolute: false
});

Resources