Outputting/Testing of Code within Google Cloud Shell Editor - node.js

Hopefully you are safe and well.
During this lockdown my company moved to Slack. As a bit of a WFH hobby, about a week ago I started to learn how to code basic Slack apps within Google Cloud. The reason for this message is to ask a novice question, so please forgive me. Is there a way to test/ output/ compile code within Google Cloud without having to go through the steps to send it to Slack and test within that eco-system. I imagine not, as I've looked through the platform and help files.
Many thanks for any help with this question.
Best wishes,
David

Cloud Shell runs a docker container, with many language SDK's already installed.
Developers will enjoy access to all their favorite
development tools pre-configured. You’ll find Java, Go, Python,
Node.js, PHP, and Ruby development and deployment tools. Run your web
applications inside the Cloud Shell instance and preview them from the
browser. Then commit it back to your repo with the pre-configured git
and Mercurial clients.
So yes, you can actually test/output/compile all your Java, Go, Python, Node.js, PHP, and Ruby code.
For example it comes out of the box with:
Maven for Java.
NPM for NodeJS.
PIP for Python.
And many others.
If you are using NodeJS to code Slack apps, you can even run Visual Studio Code in Google Cloud Shell:
export VERSION=`curl -s https://api.github.com/repos/cdr/code-server/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")'`
wget https://github.com/cdr/code-server/releases/download/$VERSION/code-server-$VERSION-linux-x86_64.tar.gz
tar -xvzf code-server-$VERSION-linux-x86_64.tar.gz
cd code-server-$VERSION-linux-x86_64
./code-server --no-auth --port 8080
For reference the code and image for VS Code were taken from this medium post.
Please check the official docs for the most up-to-date list of supported languages.

Related

IBM Natural Language Processing Projects (Beginner getting started question)

I've been digging into the IBM Cloud Services, Watson and NLP. Just installed the CLI and tried with Node SDKs, and a starterkit, unfortunately I did not succeed by trying to get a sample code by default to understand how it works.
After that, I did some research get a better open minded approach to how actually I could use some of their free services to get started, but there's actually to vague information, even though the IBM Docs are pretty extensive and well written, it can get very confusing.
I would appreciate any open source repo, or working/live project that you are willing to share to make a better image in my mind about it IBM cloud services.
A few days ago I wrote a sample application using the Natural Language Understanding service. Check the source code here: https://github.com/watson-developer-cloud/natural-language-understanding-code-pattern
The README has instructions on how to get the apikey which is the way you will use to authenticate your API calls.
Since you are using Node.js you can start with the sample above and also look at this page: https://cloud.ibm.com/apidocs/natural-language-understanding/natural-language-understanding?code=node which includes examples for all the features in Node.js using the node-sdk: https://github.com/watson-developer-cloud/node-sdk/

Is the App Engine Launcher still part of the GCloud SDK's App Engine?

I followed the official guide on using the google cloud sdk with python 3, and I was able to install the latest sdk (273.0.0) with the google app engine and python components. Now I'd like to use the launcher instead of the cli commands in the guide to run my project but I cannot find it anywhere.
The README file in my current installation of the app engine in my AppData/local folder says that the App Engine Launcher should have a desktop shortcut and an executable at C:\Program Files\Google\google_appengine\launcher\GoogleAppEngineLauncher.exe but neither shortcut nor executable path exist. I also looked through the AppData folder and didn't find it.
Was the launcher never present/removed from the app engine version I installed? Was it in the README by mistake? Or could the installation be incomplete?
I actually didn't know that this tool existed, quite interesting.
Many people seemed to have liked this feature and used it extensively in order to have easier deployments and not have to go to the CLI but I think it might be deprecated.
I found relevant information in this Google Groups thread where people we're discussing the usability of this function and the transition of it when App Engine SDK joined the Cloud SDK.
You can see that appcfg was deprecated in July this year and the shutdown date is set for July 2020.
You might be able to still install it and use it with Python 2 until shutdown but I do not think there is a new version available for Python 3.
Hope this helps.
Yes, many years ago, to deploy GAE, Google provided an installable desktop app called GoogleAeppEngineLauncher. I'm quite certain that it is no longer available and would not even function if you were somehow able to obtain a copy.
You now must use the gcloud commands to deploy your app.

What is Python Anywhere used for?

I recently opened an account with PythonAnywhere and learnt it is an online IDE and web hosting service but as a beginner in python 3.4, what exactly can i do with it?
PythonAnywhere dev here,
You can use PythonAnywhere to do most of the things you can do on your own computer with Python
start a Python interactive console (from the "Consoles" tab)
edit a python file and run it (from the "Files" tab)
The exception is that, if you want to do things with graphics, like use pygame, that won't work on PythonAnywhere. But most text-based console things will work.
You can also do some more funky things, like host a web application ("Web"), and schedule tasks to run at regular intervals ("Schedule"). If you upgrade to a premium account, you can also run "Jupyter Notebooks", which are popular in the scientific commmunity.
If you need help with anything, drop us a line to support#pythonanywhere.com
Pythonanywhere is a cloud PAAS, what that means is you can just worry about coding and leave the headache of hosting, platform, DB and PAAS considerations on pythonanywhere. Anyone who has tried to deploy a website prior to the cloud days can attest to how many more things developers had to worry about
A good example to get started
https://technovechno.com/free-website-creation-hosting-publishing-in-the-cloud-using-pythonanywhere/

Resources to start building my own mozilla

I am trying to learn and build my own version of mozilla with customizations. But I have no idea where to start and how to proceed. Can someone enlighten me in the following aspects:
1.Where to clone the latest open source code for mozilla
2.Where to learn the browser architecture and file structure(For linux/Ubuntu) So that I can customize the codes and add my own custom
addons.
3.How to debug and build the browser for Linux.
I heard its purely HTML,CSS and javascript. I have a low level expertise in all of this but no idea where to put together all of these. Please enlighten me with any resources. Basically I need a kickstart. Googling didn't gives me any such basic tutorials. I hope someone here would have tried these things before :) Any help is much appreciated.
There's a very handy guide on how to build Mozilla Firefox on MDN. Here's an outline of the steps:
Install the build prerequisite for Linux as described here - wget -q https://hg.mozilla.org/mozilla-central/raw-file/default/python/mozboot/bin/bootstrap.py -O bootstrap.py && python bootstrap.py
Clone the repository locally using mercurial - hg clone https://hg.mozilla.org/mozilla-central
Change the current working directory to mozilla-central and then issue the ./mach build command. This will produce a vanilla version of Firefox, unbranded (aka developer build).
Once building is complete, you can run your copy using ./mach build or package it using ./mach package.
In order to customize your build, you need to both change the code and the building options. The latter can be done by creating a .mozconfig file in the mozilla-central directory and adding the desired build options there.
Where to learn the browser architecture and file structure(For
linux/Ubuntu) So that I can customize the codes and add my own custom
addons.
To understand a bit more about the structure of the Firefox source code, you can have a look at this nice overview. Basically, each top directory represents a component of the browser (e.g. dom, browser, toolkit, ...). Depending on what you need, you have to change the code in the related directory. When you're lost and trying to find what to change, DXR can come to the rescue: it's the official Mozilla code search engine.
You mentioned addons: I'm not sure what's your objective, but if you just need to develop an addon, then you don't really need to build Firefox from scratch. There's a lot of documentation about how to create addons, if needed.
How to debug and build the browser for Linux.
The first part of this answers explains how to build. In order to debug, once you've built Firefox, simply run it with the command ./mach run --debugger. This will allow you to debug the C++ core of Firefox. However, for most of the front end code (which lives in browser/*), that's not needed: you can simply run Firefox and use the Browser Toolbox.

Some questions on node.js development environment and deployment strategy

I'm new to node and reading some books about it. Now I think it's time to do some dev stuff with it. I'm planning to implement a little project which I want to deploy in the cloud (AWS, Heroku, ...).
What I still haven't figured out are following points (I have a MacBook Pro with OS X 10.7):
which dev environment should I use? I thought about Aptana Studio (no node support as far as I've seen) and transferring the files via ssh to a local VirtualBox CentOS 6.3 machine which has node.js and some modules installed on it
is there any good deployment strategy for hosting my app in the cloud? For example, if I'm developing with Aptana Studio, I don't think there is a plugin which let's you deploy your code on some virtual server in the AWS or Heroku cloud, isn't it?
Thanks in advance!
I don't use an IDE per-se. I get by with just Sublime Text for my editor.
The deployment process will depend on where you host your site. I am not sure about Heroku, but with Nodejitsu it's just as simple as running "jitsu deploy" from the terminal and that's it.
If you host the site on your own on a Linux box (i.e. without Heroku or Nodejitsu) you need to account for how to make sure the site restarts after the machine reboots, or after a crash. I wrote about this on my blog. It's doable but somewhat of a chore: http://hectorcorrea.com/blog/running-a-node-js-web-site-in-production-a-beginners-guide
You can and should develop and run your application locally on your mac. Dealing with 2 machines, 2 OSes, and constant file transfers is a nuisance in development and offers no benefit. It also cripples nice things like fsevents for watching files and good text editor integration.
If you are into the whole IDE thing, perhaps consider https://c9.io/
There are several cloud Platform as a Service companies you could consider
http://nodejitsu.com/
https://devcenter.heroku.com/articles/nodejs
https://www.dotcloud.com/
http://www.cloudfoundry.com/
http://www.windowsazure.com/en-us/develop/nodejs/tutorials/getting-started/
Here's some blog posts reviewing some of these PaaS offerings
http://mrdanadams.com/2012/node-js-paas-hosting-services/
http://ocdevel.com/blog/nodejs-paas-comparison
In terms of deployment, most of these PaaS companies are going to integrate with npm and github, so deployment is going to take no more than a handful of commands at most.
Thanks for your help!
After doing a lot of research on the topics you've posted, I just wanted to let you know what my setup for developing node applications now looks like:
Sublime Text 2 Text-Editor with Package Manager and following plugins: git, nodejs, SublimeLinter (BTW: are there some other "essential" plugins you can not live without?)
iTerm 2 Terminal for all console work (execute node-inspector, ssh to server etc.)
node.js, npm and additional modules which I want to use for my app
Running everything local on my MacBook Pro. As far as I could test this solution, it seems that it runs very smoothly but most notably: FAST :-)
Regarding node deployment, I take Heroku and nodejitsu into account due to low costs, few administration efforts and features like auto-scaling etc. The only drawback of Heroku is the missing websocket support, which I intend to use natively in my app.
Best regards!

Resources