How to add widget to appcelerator application? - appcelerator

I have a project with alloy. (1.8 or later).
So, I want to add a widget (slider menu) at my app. Then, I have download the widget from this link
Slider menu
I have extract the folder and I have copy and paste widgets folder under my application.
So I have this situation on my project:
I have also added a code to my config.json:
{
"global": {},
"env:development": {},
"env:test": {},
"env:production": {},
"os:android": {},
"os:blackberry": {},
"os:ios": {},
"os:mobileweb": {},
"os:windows": {},
"dependencies": {
"com.slider":"1.0"
}
}
But if I try to start my application I have this error message:
[ERROR] : config.json references non-existent widgets: ["com.slider"]
[ERROR] : If you are not using these widgets, remove them from your config.json dependencies.
[ERROR] : If you are using them, add them to your project's widget folder or as NPM package.
[ERROR] : Alloy compiler failed

There are two points you have to take care of:
widgets folder must be in app folder. (you have put it in assets).
In config.json com.slider must be the id of widget which is present in widget.json, or look for widget.json and copy the id from there.
The only issue you are facing is of naming conventions.

Related

Determine projectName for VS Code launch from maven projects

I am working in a complex project structure of bundles and plugins for karaf.
When attaching to the process, I cannot use WATCH as the project cannot be found:
Cannot evaluate because of java.lang.IllegalStateException: Project XY cannot be found..
Is it possible to determine the correct project name from the file the breakpoint is in and the maven file its contained in?
For some reason the content inside XY does not work.
This is the launch config:
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Debug Karaf",
"projectName" : "XY",
"request": "attach",
"hostName" : "localhost",
"port": 5005
}
]
Edit: Breakpoints and step by step debugging do work. Its strange that these two things are different.
The project name XYZ that worked for me was in the pom building the jar file under artifactId: <artifactId>XYZ</artifactId>.
Right-click on a Java file (one without a main() function) and choose "Run Java" and you'll get a prompt with a few options. This prompt will show the project name.
As you can see in this screenshot of this Ant project, sometimes the project name is unpredictable.

Xcode not generating app with latest changes

My latest changes in Ionic app are not reflected on simulator or in ipa file which i am generating with xcode 10.
I tried many solution like removed build folder, remove ios folder from platform and add it again but none of works.
Any one has idea what might be problem is ?
Only use these commands
cordova clean
and
npm run clean
For Xcode 10 you likely will need to force the use of the legacy build system. This is described in this blog post.
Summary: Create a build.json file in the root of your project with the following contents:
{
"ios": {
"debug": {
"buildFlag": [
"-UseModernBuildSystem=0"
]
},
"release": {
"buildFlag": [
"-UseModernBuildSystem=0"
]
}
}
}

How to use yarn in ASP.Net core MVC to install bootstrap in wwwroot folder

recently I started learning ASP.Net core MVC. I always used bower to install packages for my projects in Visual Studio 2017. but now I want to use yarn. since it seems bower is deprecated. but I don't know how to use yarn to install bootstarp in wwwroot folder. for bower i used bower.json and it would install bootstarp automatically. I use "yarn add bootstrap#4.0.0-alpha.6 --dev" but it install it in node_modules in the project folder and I can't see it in the solution explorer,
thanks
It's best to use npm(a package manager) for Asp.net core application,start by searching and adding a package called npm by right clicking on your project name in solution explorer in vs2017 and clicking on "add" => add new item",inside the package,add in your bootstrap as a dependency as showed below,
{
"version": "1.0.0",
"name": "nameofyourapplicationinsmallcaps",
"private": true,
"devDependencies": {
},
"dependencies": {
"bootstrap": "4.1.0"
}
}
Next ==> Create a root folder within your project named middleware,you would be building a custom extension/midleware(these would look into the node module folder to serve up files) in your request pipelines inside of startup.cs ,ensure you place the new extension which can be named app.UseNodeModules() underneath the app.UseStaticFiles() middleware( these serves up files from the wwwroot folder) as showed below,
app.UseStaticFiles();
app.UseNodeModules(env.ContentRootPath);
Inside the middleware folder,add a class which can be named ApplicationBuilderExtensions.cs , you would be creating a app.UseStaticFiles() with its own request path pointing to the npm package,add the below to the class(you wont be using the default app.UseStaticFiles()),
using Microsoft.Extensions.FileProviders;
using System.IO;
namespace Microsoft.AspNetCore.Builder
{
public static class ApplicationBuilderExtensions
{
public static IApplicationBuilder UseNodeModules(this IApplicationBuilder app , string root)
{
var path = Path.Combine(root, "node_modules");
var fileprovider = new PhysicalFileProvider(path);
var options = new StaticFileOptions();
options.RequestPath = "/node_modules";
options.FileProvider = fileprovider;
app.UseStaticFiles(options);
return app;
}
}
}
Next ==> look for an icon inside of your solution explorer in vs2017 named "show all files" and click it,you would see a node_module folder,expand this folder to view bootstrap=>dist=>css, drag the bootstrap.css in between the opening and closing head tag in your _Layout.cshtml.
After doing all these, you can start making use of bootstrap classes to add styling to your project.

Can't find Bower configuration file

The procedure is supposed to be this way:
Right click on the project -> New element -> Select Bower configuration file
The problem is after picking New element I can't find Bower configuration file.
Even when I type "bower" in the search list i get nothing.
Right click your project solution -> Add New Item -> select Web on the
left -> select Bower Configuration File on the list -> Add
Now you can install new bower package by right click your solution ->
manage bower package.
More Information
If above is not working :
Just add bower.json file to root of your project, you will see the Manage bower packages ... in the right click context of your web project. (even an empty file will work)
Open Visual Studio 2019 ---> Search ---> bower configuration file
In my case the file never appeared on the template list so I had to add a simple Text File and named it "bower.json" then add this code:
{
"name": "asp.net",
"private": true,
"dependencies": {
"boostrap": "4.4.1" //This is for my project
}
}
Then add another TextFile and named it ".bowerrc" and add the directory for the packages:
{
"directory": "wwwroot/lib"
}
When I saved the files the Dependencies folder recognized it.

Global.json and running web application

I am trying to create a new web application using OS X and VS Code from scratch without using any scaffolding tool. My starting point is Scott Allen's tutorial on pluralsight:
https://app.pluralsight.com/library/courses/aspdotnet-core-1-0-fundamentals/table-of-contents
My project structure is:
The global.json file contains
{
"projects": [ "src" ],
"sdk": {
"version": "1.0.0-rc1-update2"
}
}
And the project.json currently contains
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": false
},
"dependencies": {
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.AspNet.Hosting": "1.0.0-rc1-final"
},
"frameworks": {
"dnx451": {},
"dnxcore50": {}
},
"commands": {
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://localhost:5000"
},
"exclude": [
"wwwroot",
"node_modules"
]
}
I have run dnu restore to get the packages and now I would like to run the web. I need to go to the web app folder and run dnx web in order to do so and the app starts
Is it possible to run the application directly from the root folder, not from the web app folder? Is the global.json file needed in such setup? And how do I change the hosting environment? I have gone through the documentation, but the hosting environment is only clear when using VS 2015.
You cannot simply run from the root because there could be multiple projects that are "executable". But you can pass the project to dnx using the --project/-p argument.
The environment is set using the ASPNET_ENVIRONMENT environment variable.
The global.json file is useful for two things:
The sdk section is only by VS.
The projects section is used all the time and it's useful if you have the projects in multiple folders (for example src and test). If everything is in a single folder, you don't need it.
So, the bare minimum in order to run an web application is:
A folder for your project
A project.json file
A startup file

Resources