How do I get docpad server running / generating in Cloud 9 IDE? - cloud9-ide

When I do the "docpad run" command in the Cloud 9 Terminal it gives me a IP address like:
http://127.9.102.129:8080/
but nothing is there. What do I do?

Docpad allows for a .env file to set process.env.STUFF and you can set the port in docpad.coffee (from http://docpad.org/docs/config) but we don't need those tricks to get our docpad running in C9.
Instead we simply setup a "RUN & DEBUG" context for C9 via the RUN & DEBUG tab. The name can be anything. The "File Path:" will be set to be the same as docpad's "main" in it's package.json, which is "./node_modules/docpad/bin/docpad-server". the "Runtime" can be left as "Default" and we don't need any "Cmd Line Args" either. So your docpad Run settings might look like the following:
Name docpad.coffee
File Path ./node_modules/docpad/bin/docpad-server
Runtime Default
Cmd Line Args
Then just you to the green Run button at the top and click the little drop-down arrow on the right of the button and select the Run context you just setup. In our example above it would be "docpad.coffee". Once you click that, the C9 console will popup from below and begin the docpad run command as usual except before it does, it gives you your C9 url where to test/preview your docpad app!
And that's all it takes, your online with docpad and C9.
8)

Related

How can I change the default output folder path of the GO file?

Because I had installed the Avira in my computer, once I run my go file in GoLand, Avira will prompt me a security alert that "BLOCK HEUR/APC(could) ........."
Meanwhile, GoLand also shows that
Error running 'go build test.go': Cannot run program "C:\Users\Simon\AppData\Local\Temp___2go_build_test_go.exe" (in directory "E:\Application software\GO\awesomeProject"): CreateProcess error=5, ACCESS DENIED.
I want to know how can I change the default output path (i.e., build -o "path") to another path; after all, I don't want to close the realtime protection of Avira in each time, and ā€˜Cā€™ disk is also a sensitive area. Should I configure the settings of the GO source or just change some settings in GoLand? B.T.W, unless necessary, I don't want to change the settings of Avira :)
Thanks in advance, I am a beginner of Go language.
You can edit the run configuration via Run | Edit Configurations... and set the Output directory to whatever location you'd like to, see the screenshot below.
If you wish to set this for all new run configurations of the project, then go to Run | Edit Configurations... | Templates | Go Build and then configure the Output directory setting there. All new Go Build configurations will then use that setting.

Golang run on Windows without deal with the Firewall

I'm working on a Rest API with Go, but everytime I try to run my application with
go run main.go
the Windows Firewall tells me that has blocked some features of my app. I would like to know if there's some way to make my executions without have to Accept everytime.
Change
http.ListenAndServe(":3000", r)
to
http.ListenAndServe("127.0.0.1:3000", r)
If you are calling go run main.go following is happening:
your programm is compiled inside a temporary folder
the compiled binary is executed
But the temporary folder is just for one execution. So the next time when you run your programm via go run another folder is used.
The windows firewall does give you always the information which path your server has and if you remember the paths after each time you will see that there is always a different path.
The windows firewall is so configuread that it remembers the path of each programm. So when the path is changing you will always need to comfirm that the new path is allowed to run on that port.
To fix this you should compile your server. Just run go build and exeute the binaries then inside you project folder. Then you will just have to accept just one time.
Hi I had the same problem:
Try that:
Go to Windows Defender Firewall, in Left side menu you saw Inbound Rules click there, then Right Side menu you will see New Rule... click.
Choose Port opened from window -> Next
Select TCP, then define which ports you want I choose 8080 click Next again, Choose Allow the connection Next, Check All Next, Give any Name Goland or anything you want and press Finish. Thats it
based on #apxp answer
in windows cli this works for me
go build main.go && main.exe
this work for me
go build main.go && .\main.exe
and run using makefile
I think #apxp's answer is the complete explanation of the situation; some time after ask this question I found a way to run my application with:
go build -o ejecutable.exe ; if($?) { .\ejecutable.exe }
Just go to your Windows Firewall notification settings:
Control Panel -> Windows Defender Firewall -> Change notification settings
Uncheck the option for Notify me when Windows Defender Firewall blocks a new app to prevent it from showing the popup.
You can use CompileDaemon to auto re-build your project on file changes, because it runs a build anyway, you'll only have to accept once. Plus, your project will re-build automatically!
Install:
go get https://github.com/githubnemo/CompileDaemon
Example usage:
# Assuming your project looks like and you're in your project working dir
# hello/
# hello.go
# Rebuild on .go file edits and run the hello command after
CompileDaemon -command="./hello"
The WSL run under VM, so you have to execute ifconfig
You will see your IP in the section (eth0:) inet x.x.x.x
This x.x.x.x is the IP you have to put in your browser.

Jupyter after installation "Anaconda"

I used to work with Anaconda for sometime, now i am trying to install it and facing some issues with Jupyter.eatch time i try to launch Jupyter i get
http://localhost:8892/undefined/tree
And is there a way to change the default browser from Internet Explorer to Google Crome ?
launching from command line
You can type jupyter-notebook.exe --help to get the command line options. The one you are interested in is shown below:
--browser=<Unicode> (NotebookApp.browser)
Default: ''
Specify what command to use to invoke a web browser when opening the
notebook. If not specified, the default browser will be determined by the
`webbrowser` standard library module, which allows setting of the BROWSER
environment variable to override it.
So jupyter-notebook.exe --browser='chrome' should work. You could incorporate this command into a Windows shortcut or consider the alternative below.
changing your config
From the command line type jupyter-notebook.exe --generate-config which will create a config file called jupyter_notebook_config.py located in your C:\Users\<user>\.jupyter directory. Open this file and uncomment the line containing c.NotebookApp.browser. Then set its value to be 'chrome'.

IIS Express directory browsing

I know this question has been already asked but it didn't work for me.
When I run the command:
appcmd set config /section:system.webServer/directoryBrowse /enabled:true
I have the following error:
The command appcmd was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default.
At his point I don't know what to do. How can I run the command?
I would try it at the site level first, Run with elevated permission i.e. Run as Administrator
Enable directory browsing at the site level
cd "C:\Program Files (x86)\IIS Express\"
run this appcmd.exe set config "Contoso Some SITE NAME" -section:system.webServer/directoryBrowse /enabled:"True" /showFlags:"Date, Time, Size, Extension"
check to turn off encryption and read only in folder options
Note: Run with elevated permission
GUI version from Microsoft site for other versions:
On the Start screen, move the pointer all the way to the lower left
corner, right-click the Start button, and then click Control Panel.
In Control Panel, click Programs and Features, and then click Turn
Windows features on or off.
Expand Internet Information Services,
expand World Wide Web Services, expand Common HTTP Features, and
then select Directory Browsing.
Click OK.
Click Close.
If it still does not work, then try & delete all the IIS cache and repeat the above
I previously answered this, and it works well here for the majority of people
Open CMD prompt & Navigate to IIS express - by typing the following
cd "C:\Program Files (x86)\IIS Express\"
run this appcmd.exe list site /xml | appcmd delete site /in
This will delete all the sites, enjoy!

appcfg.py is not running with cmd prompt (Windows 7)

I am having strange problem. I used to run appcfg.py to update my app to appengine but now its not working anymore. When I run this command
C:\Program Files <x86>\Google\google_appengine>appcfg.py update E:\path\myApp\
Its not giving me anything, no error no feedback. Its just back to this line
C:\Program Files <x86>\Google\google_appengine>
Any idea about this issue!
P.S. I'm using Python 2.7. My code is updating through google app launcher but I need to run it from cmd prompt as I will be downloading/uploading appengine stuff which launcher doesn't allow me to do!
Thanks
I still had a little trouble with the instructions. Here's the steps I used to create a batch file to use the Google App Engine download_app with Windows 7.
In my example,
I'll use drive, C:
Default python path will be, C:\Python27\python.exe
GAE path (include "), "C:\Program Files (x86)\Google\google_appengine\appcfg.py"
App ID {your_app_id} will be just your app-id name
{your_app_version} is the "Version:" number in your GAE app.yaml file
I'll create a folder on my Windows 7 desktop and call it GAE_App
The desktop folder path will be C:\Users\{username}\Desktop\GAE_App
{your email} will be the Gmail account connected to your GAE
Right-click on the desktop and select New->Text Document. Open the newly created text document and add the following line of code modified for your setup to the blank text document,
C:\Python27\python.exe "C:\Program Files (x86)\Google\google_appengine\appcfg.py" download_app -A {your_app_id} -V {your_app_version} --email={your email} C:\Users\{username}\Desktop\GAE_App
Save the text document and change the file name to GAE_Download.bat
It's important that the extension now says ".bat" instead of ".txt"
Once finished, click on the batch to execute it. You'll be asked for a password and then the files should download into the GAE_App folder on your desktop. Now, whenever you need to download your files, just click on the batch file.
Not sure why Google didn't simply include this feature with their GAE for Windows software.
I faced the same issue. Here is a simple solution.
Just do this following Steps:
Go to program file where google app engine is installed. Generally It is named as Google.
click on appcfg.py and select open with.. Select "Choose Default Programs".
Select Python from programs and select "Always Use the selected program to open this kind of file" .
Now run the command you should get the results on command line.
For reference click here
Fixed by accessing python lib like that
C:\Python27>python appcfg.py update E:\path\myApp\
Here's a solution that worked for me:
"google_appengine/appcfg.py" update "C:\PATH TO APP
The appcfg.bat that should be used is located **C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\appengine-java-sdk\bin** and not the empty appcfg.bat that for some unknown reason also was here C:\Program Files\Google\Cloud SDK\
Good practice is to add this path to the system variable PATH
This worked for me
Basis
<PATH_TO_PYTHON>python <PATH_TO_APPCFG.PY>appcfg.py -A <PROJECT_INSTANCE_NAME> update app.yaml
Example
X:\Software\Python2.7\python Q:\SOFTWARE\GoogleAppEngineSDK\appcfg.py -A great-1337 update app.yaml

Resources