how to run dotnet core's standalone program on mac - json

a rudimentary question, but please let me know.
I want to run the following program which will process and return the result by json when accessed by GET or POST.
FileManagerController.cs
For example, in PHP you just need to place it in the htdocs folder of Apache.
I would like to do the same thing with dot net core mvc.
but I don't know what kind of words to search.
Also, in the near future we would like ruby to work the same way in another project.(In a way that doesn't use a framework such as rails)
So, please tell me how to find out how to run various languages alone on a web server.

You need to make a "project" (file type .csproj) that you can build and run on your machine. Check out the Getting Started with ASP.NET page for instructions to install the SDK and create a new project and run it.
To run your code file above, you can:
$ dotnet new mvc
Copy the above FileManagerController.cs file into the generated Controllers folder.
$ dotnet run
Your app will be running on http://localhost:5000, you can hit your web site using the url /FileManager.

Related

Services and env in manifest file?

I have a web (online calculator for an example) which developed by my fellow tem members. Now they want to deploy in PCF using manifests.
Languages used : python, php and javascipt.
I gone through the docs about pcf with manifest.yml
In that I don't have any idea about services and env.
What is that services and how can I find the services for the above project and also how can I find the environment variables?
And tell whether these fields are mandatory to run the project in PCF.
To your original question:
What is that services and how can I find the services for the above project and also how can I find the environment variables? And tell whether these fields are mandatory to run the project in pcf.
Does your app require any services to run? Services would be things like a database or message queue. If it does not, then you do not need to specify any services in your manifest. They are optional.
Similarly, for environment variables, you would only need to set them if they are required to configure your application. Otherwise, just omit that section of your manifest.
At the end of the day, you should talk with whomever developed the application or read the documentation they produce as that's the only way to know what services or environment variables are required.
In regards to your additional questions:
1)And also I have one more query...like in our application we used python ok! In that we use lots of pacakages say pandas,numpy,scipy and so on...how can I import all the libraries into the PCF ??? Buildpacks will contain version only right?
Correct. The buildpack only includes Python itself. Your dependencies either need to be installed or vendored. To do this for Python, you need to include a requirements.txt file. The buildpack will see this and use pip to install your dependencies.
See the docs for the Python buildpack which explains this in more detail: https://docs.cloudfoundry.org/buildpacks/python/index.html#pushing_apps
2)And also tell me what will be the path for my app name if Java I can enclose jar files
For Java apps, you need to push compiled code. That means, you need to run something like mvn package or gradle assemble to build your executable JAR or WAR file. This should be a self contained file that has everything necessary to run your app, compile class files, config, and all dependent JARs.
You then run cf push -p path/to/my-app.jar (or WAR, whatever you build). The cf cli will take everything in the app and push it up to Cloud Foundry where the Java buildpack will install things like the JVM and possibly Tomcat so you app can run.
what should I do for application devloped using pyhton , JavaScript and php....
You can use multiple buildpacks. See the instructions here.
https://docs.cloudfoundry.org/buildpacks/use-multiple-buildpacks.html
In short, you can have as many buildpacks as you want. The last buildpack in the list is special because that is the buildpack which will set the start command for your application (although you can override this with cf push -c if necessary). The non-final buildpacks will run and simply install dependencies.
3) we were using postgresql how can I use this in pcf with my app
Run cf marketplace and see if there are any Postgres providers in your Marketplace. If there is one, you can just do a cf create-service <provider> <plan> <service name> and the foundation will create a database for you to use. You would then run a cf bind-service <app> <service name> to bind the service you create to your app. This will generate credentials and pass them along to your app when it starts. You app can then read the credentials out of VCAP_SERVICES and use them to make connections to the database.
See here for more details:
https://docs.cloudfoundry.org/devguide/services/application-binding.html
https://docs.cloudfoundry.org/devguide/deploy-apps/environment-variable.html#VCAP-SERVICES

Various ways to run angular 6 with web API project

We know that ng serve command used to run the app.
Also, we would like to know what all other ways to run the app.
ng serve command is used in the development process to check parallel the result. Whatever in the html written can be reflected in the browser.

Visual Studio Team Services Building JSON Scripts

I'm currently building scripts using Selenium Builder (which saves files as JSON) and i'm having a hard time running these scripts on VSTS. My question specifically is, can Visual Studio Team Services build JSON scripts and tie them in with its C.I.? If so, which approach must I take in order to do this / make it possible?
Thanks!
Here is my steps for your reference:
Deploy your own private build agent by following this link.
Configure the required environment on the build agent like Selenium Driver, Firefox so that the testing can be run on the build agent.
Upload the json file generated by Selenium Builder into VSTS Repository.
Create a build definition with two Command Line tasks: The first one runs npm install command to install se-interpreter:
And the second one run se-interpreter command to run the test in json file:
Queue the build, you will see the test been executed during the build:

How can I test my locally stored webpages?

I have my HTML pages locally stored on my Mac. I already bought the domain and the hosting service. There's a way with which I can test these local webpages so that I can see how they render on different devices? I have heard about local server for testing or using devices via USB attached to the PC. Is there not a more standard and unified way to testing them? It can be everything (software, online services, ...) I'm not interested in emulators/simulators.
If you have only html and/or Javascript code:
Open it with your browser, it will be enough
If you have PHP code:
Install a local web-server (Ex: Apache)
If you have MySQL code:
Install a MySQL server
Usually, installing Mamp (or an equivalent for Android/iOS) is enough to do every basic things. It will provide you SQL and PHP server
Hope it helped you
Creating a local server: Node.js and BrowserSync
I've found a very simple way to test webpages (in my case, HTML5 pages) that are saved in PCs memory so that we could test them directly into all the different devices available, without using simulators/emulators.
The solution is creating a local server using two great totally free tools: Node.js and BrowserSync. Before writing this answer, I tried this solution on my own, and I was completely satisfied of the result! You can find the source for this answer at JavaScript Kit.
Here you are the main steps:
Install Node.js (verify if Node.js is correctly installed with the node- v command from the terminal);
Install BrowserSync using npm install -g browser-sync directly from the terminal. Be careful you need root permissions (I simply used sudo npm install -g browser-sync);
Run BrowserSync:
Navigate to your target directory (the one which contain the static files used to create the website, that's the HTML (and CSS) files) using the command line (to make an example, it could be cd folderA/folderB);
Create a local server inside that directory, with browser-sync start --server.
These are the main steps, but you can directly read the solution from the original source I linked some lines before.

MySQL C API libraries for iPhone

Does anybody know where to get a MySQL libraries compiled for the arm iPhone architecture?
Or how to cross-compile MySQL for arm?
Thanx
Here's how I did it:
1) Download the source code version of Connector/C from MySQL
2) Download cmake (if you have macports installed, type "sudo port install cmake")
3) Get toolchain files from http://sites.google.com/site/michaelsafyan/coding/resources/how-to-guides/cross-compile-for-the-iphone/how-to-cross-compile-for-the-iphone-using-cmake
4) In the toolchain file for the simulator, remove one architecture from the line containing CMAKE_OSX_ARCHITECTURES
5) If you want to build for the simulator, copy the missing headers in /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/usr/include/netinet/ (ip.h and in_system.h) from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.2.sdk/usr/include/netinet
6) Create a directory called "compiled_library" somewhere, eg on your Desktop
7) Call cmake like this:
cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/iphone-toolchain-file -DCMAKE_INSTALL_PREFIX=/path/to/compiled_library -DHAVE_FDATASYNC:INTERNAL=0
8) Note that if you want to run cmake a 2nd time, you might have to delete the cache file first
9) type make install
10) Now you have the compiled library in /path/to/compiled_library. Copy the header file directory and libmysql.a to your xcode project via "Add existing files...". The library should be automtically added to the linker stage.
11) WOOHOO. Use the mysql C API.
12) If this is too much work, I'm currently writing a MySQL wrapper framework for the iPhone. I will publish it sometime in the next ten years and put a link here.
EDIT:
Someone else created an Objective C Wrapper for the MySQL client library: http://www.karlkraft.com/index.php/2010/09/17/mysql-for-iphone-and-osx/
do you need client or server libraries? Anyway, since OS X supports unix scripts you should at least try build using "regular Unix" approach:
client:
http://dev.mysql.com/doc/refman/5.1/en/connector-c-building.html
server:
http://dev.mysql.com/doc/refman/5.1/en/installing-source.html
You can use Kumulos 'Hookup' http://www.kumulos.com/2011/07/06/introducing-hookup/ feature to build a suite of web services for your MySQL database.
Basically you define your different web services in the online control panel, then it builds all the Objective-C code and server side code.
I believe this is the easiest way to achieve your goals, and probably a lot better than using a direct Objective-C MySQL library.
This worked for me:
https://github.com/thrivesmart/just-mysql-example-mac-app-objective-c-xcode/issues/1
No compilation needed
Just use that LIB and replace the lib with the other repo!
I don't believe you can run MySQL on the iPhone. As Ben pointed out SQLite is built into the iPhone and you can use Core Data to manage structured data.