Atom editor & Processing - 'processing-java' not recognised - processing

I am trying to use bleikamp's Processing package to run Processing sketches from the Atom editor. The package has installed correctly, but running a sketch produces the below error:
'processing-java' is not recognized as an internal or external command, operable program or batch file.
I have added the path to my Processing directory to the PATH environment variable. Can anyone suggest why this is not working?

The problem is almost certainly to do with your PATH. As you've checked the Processing path is correct, there may be something preventing it from being recognised (there are some known issues, such as the PATH variable being too long or having invalid characters).
Solution 1:
Try using FixPath to fix some of the more common problems.
Solution 2:
Try modifying the processing package itself to point directly to processing-java.exe (it points to the PATH variable by default).
In Atom's Settings > Packages, select the processing package and click on 'View Code'.
Make a backup of \lib\processing.coffee to be safe.
In \lib\processing.coffee, search for the following code (probably near the top):
module.exports = Processing =
config:
'processing-executable':
type:"string",
default:"processing-java"
Modify the value of default to point to the exact Processing directory and processing-java.exe, for example:
module.exports = Processing =
config:
'processing-executable':
type:"string",
default:"c:\\program files\\processing\\processing-java.exe"
As Chris rightly points out in the comments below, backslash \ is an escape character in JavaScript and CoffeeScript, so itself needs to be escaped in the file path (hence the double-backslashes \\).

You have to install processing-java command line tool.
In processing, go to Tools -> Install "processing-java"

Related

Unable to load/require file from Lua running from Atom in Windows

I'm trying to use Atom to run a Lua script. However, when I try to load files via the require() command, it always says it's unable to locate them. The files are all in the same folder. For example, to load utils.lua I have tried
require 'utils'
require 'utils.lua'
require 'D:\Users\Mike\Dropbox\Lua Modeling\utils.lua'
require 'D:\\Users\\Mike\\Dropbox\\Lua Modeling\\utils.lua'
require 'D:/Users/Mike/Dropbox/Lua Modeling/utils.lua'
I get errors like
Lua: D:\Users\Mike\Dropbox\Lua Modeling\main.lua:12: module 'D:\Users\Mike\Dropbox\Lua Modeling\utils.lua' not found:
no field package.preload['D:\Users\Mike\Dropbox\Lua Modeling\utils.lua']
no file '.\D:\Users\Mike\Dropbox\Lua Modeling\utils\lua.lua'
no file 'D:\Program Files (x86)\Lua\5.1\lua\D:\Users\Mike\Dropbox\Lua Modeling\utils\lua.lua'
no file 'D:\Program Files (x86)\Lua\5.1\lua\D:\Users\Mike\Dropbox\Lua Modeling\utils\lua\init.lua'
no file 'D:\Program Files (x86)\Lua\5.1\D:\Users\Mike\Dropbox\Lua Modeling\utils\lua.lua'
The messages says on the first line that 'D:\Users\Mike\Dropbox\Lua Modeling\utils.lua' was not found, even though that is the full path of the file. What am I doing wrong?
Thanks.
The short answer
You should be able to load utils.lua by using the following code:
require("utils")
And by starting your program from the directory that utils.lua is in:
cd "D:\Users\Mike\Dropbox\Lua Modeling"
lua main.lua
The long answer
To understand what is going wrong here, it is helpful to know a little bit about how require works. The first thing that require does is to search for the module in the module path. From Programming in Lua chapter 8.1:
The path used by require is a little different from typical paths. Most programs use paths as a list of directories wherein to search for a given file. However, ANSI C (the abstract platform where Lua runs) does not have the concept of directories. Therefore, the path used by require is a list of patterns, each of them specifying an alternative way to transform a virtual file name (the argument to require) into a real file name. More specifically, each component in the path is a file name containing optional interrogation marks. For each component, require replaces each ? by the virtual file name and checks whether there is a file with that name; if not, it goes to the next component. The components in a path are separated by semicolons (a character seldom used for file names in most operating systems). For instance, if the path is
?;?.lua;c:\windows\?;/usr/local/lua/?/?.lua
then the call require"lili" will try to open the following files:
lili
lili.lua
c:\windows\lili
/usr/local/lua/lili/lili.lua
Judging from your error message, your Lua path seems to be the following:
.\?.lua;D:\Program Files (x86)\Lua\5.1\lua\?.lua;D:\Program Files (x86)\Lua\5.1\lua\?\init.lua;D:\Program Files (x86)\Lua\5.1\?.lua
To make that easier to read, here are each the patterns separated by line breaks:
.\?.lua
D:\Program Files (x86)\Lua\5.1\lua\?.lua
D:\Program Files (x86)\Lua\5.1\lua\?\init.lua
D:\Program Files (x86)\Lua\5.1\?.lua
From this list you can see that when calling require
Lua fills in the .lua extension for you
Lua fills in the rest of the file path for you
In other words, you should just specify the module name, like this:
require("utils")
Now, Lua also needs to know where the utils.lua file is. The easiest way is to run your program from the D:\Users\Mike\Dropbox\Lua Modeling folder. This means that when you run require("utils"), Lua will expand the first pattern .\?.lua into .\utils.lua, and when it checks that path it will find the utils.lua file in the current directory.
In other words, running your program like this should work:
cd "D:\Users\Mike\Dropbox\Lua Modeling"
lua main.lua
An alternative
If you can't (or don't want to) change your working directory to run the program, you can use the LUA_PATH environment variable to add new patterns to the path that require uses to search for modules.
set LUA_PATH=D:\Users\Mike\Dropbox\Lua Modeling\?.lua;%LUA_PATH%;
lua "D:\Users\Mike\Dropbox\Lua Modeling\main.lua"
There is a slight trick to this. If the LUA_PATH environment variable already exists, then this will add your project's folder to the start of it. If LUA_PATH doesn't exist, this will add ;; to the end, which Lua fills in with the default path.

TOMCAT: quote < ' > in CATALINA_HOME environment variable causing load error?

I'm trying to install tomcat as a service using service.bat in the following path :
C:\Program Files\text with' quote\Tomcat
but I keep getting the following error :
java.io.FileNotFoundException: C:\Program Files\text with quote\Tomcat\conf\logging.properties; (The system cannot find the path specified)
as you can see from the error message the ' is being ignored and thus keeping some files from being found/loaded properly.
If I switch to a path without a quote, everything works well. Is there a way around this as I need to include a ' in the path?
Your problem comes from the way Procrun parses its command line parameters. In those parameters which accept lists of values (++DependsOn, ++Environment, ++JvmOptions, ++JvmOptions9, ++StartParams and ++StopParams) single quotes ' are stripped after the parameter value has been split into single values. There is no way to quote them (cf. source code).
Therefore the ++JvmOptions parameter used in service.bat is interpreted as follows (one value per line):
-Dcatalina.home=C:\Scarlett oHara;-Dcatalina.base=C:\Scarlett oHara
-Dignore.endorsed.dirs=C:\Scarlett oHara\endorsed;-Djava.io.tmpdir=C:\Scarlett oHara\temp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=C:\Scarlett oHara\conf\logging.properties;
You might notice that some entries are joined by ;, due to the ' unintentional quoting.
The only way to fix this is to start Prunmgr (the executable renamed as tomcat*w.exe) and fix them in the "Java" tab:
-Dcatalina.home=C:\Scarlett o'Hara
-Dcatalina.base=C:\Scarlett o'Hara
-Dignore.endorsed.dirs=C:\Scarlett o'Hara\endorsed
-Djava.io.tmpdir=C:\Scarlett o'Hara\temp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=C:\Scarlett o'Hara\conf\logging.properties;
or work directly on the HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Apache Software Foundation\Procrun 2.0 registry keys.
See also:
a similar problem due to quoting: Adding multiple values to an environment in registry and retrieving in Java application

Reinstalling packages from a list generated by command: ado dir

I am recovering Stata following a Windows upgrade. I have a list of my packages generated from ado dir in the following format:
[1] package mdesc from http://fmwww.bc.edu/RePEc/bocode/m
'MDESC': module to tabulate prevalence of missing values
[2] package univar from http://fmwww.bc.edu/RePEc/bocode/u
'UNIVAR': module to generate univariate summary with box-and-whiskers plot
[3] package tabmiss from http://www.ats.ucla.edu/stat/stata/ado/analysis
tabmiss. Shows tabulation of number of missing and non-missing values
I have many packages and would like to reinstall them without having to designate each directory/url via net cd. While using net cd along with net install or ssc install along with package names in a loop is trivial (as below), it would seem that an automated method for this task might be available.
net cd http://www.ats.ucla.edu/stat/stata/ado/analysis
local ucla tabmiss csgof powerlog ldfbeta
foreach x of local ucla {
net install `x'
}
To my knowledge, there is no built-in or automated method of tracking and managing your installed packages outside of what is available through ado or net.
I would also tend to agree with #Nick Cox that this task seems strange and I can't imagine how a new Stata install or reinstall could know what was installed previously, but I find the question interesting for other reasons.
The main reason being for users who have Stata installed on multiple machines who need the same packages on both machines. I faced a similar issue when I purchased a new computer and installed Stata but wanted all of the packages I use to be available as well. Outside of moving the ado directory or selected contents I'm not aware of any quick solution.
Here it would be possible to use the output of ado dir on one machine to determine what you need to install on a second machine with a new Stata install.
The method you propose using a foreach loop could save you time from having to type in or copy/paste a lot of packages and URLs. At the same time however, this is only beneficial if you have many packages from only a few repositories because you will need to net cd to the URL each time as you show in your example.
An alternative solution is the programmatic solution. As you know, ado dir will list each installed package, the URL and a short description of the package. Using this, a log file, and the built in I/O functionality, a short program could be written to automate the process and dynamically build a do file that contains the commands to install the already installed packages.
The code below generates a do file containing commands (in this case, net describe package, from(url)) for each package I have installed on my computer.
clear *
tempfile log1
log using "`log1'", text name(mylog)
ado dir
log close mylog
tempname logfile
file open `logfile' using "`log1'", read
file read `logfile' line
file open dfh using "path/to/your/dofile.do", write replace
local pckage "package"
while r(eof) == 0 {
if `: list pckage in line' {
local packageName : word 3 of `line'
local dirName : word 5 of `line'
di "`packageName' `dirName'"
file write dfh "net describe `packageName', from(`dirName')"
file write dfh _newline
}
file read `logfile' line
}
file close `logfile'
file close dfh
In the above code, I create a temp file to write a .txt log file to and store the contents of ado dir in that file.
Then, I open the log file using file open and read it line by line in the while loop.
Above the loop, I'm creating a do file at /path/to/your/dofile.do to hold the output of the loop - the dynamically created commands relating to the installed packages on my machine.
The loop will iterate so long as r(eof) = 0, where r(eof) is an end of file marker. I use an if statement to sort out lines of the log file which contain the word package, as I'm only interested in those lines with the package name and URL in them.
Inside of the if block, I parse the local macro line to pull the package name and the URL/directory name.
this is important: this section of code assumes that the 3rd and 5th words in the macro will always be the package name and URL respectively - Confirm this from the output of ado dir before executing.
You will also need to change the command that is being written to the file handle dfh inside of the loop to what you want (net install, etc) when you are ready to execute.
For more help on using file, locals, and tempfiles execute any of the following in Stata:
help file
help extended_fcn
help macrolists
There may be nicer ways to parse the contents of ado dir but this has worked for me. And of course I'd always advise that you take the time to understand what the code is doing so that you can make any necessary tweaks to fit your particular situation.

MIT-Scheme for SublimeREPL windows

Getting the error WindowsError(2, 'The system cannot find the file specified.')
I've tried tinkering with the Main.sublime-menu, but kinda uncertain what path I should be putting so i used variations of C:\Program Files (x86)\MIT-GNU Scheme\bin\mit-scheme.exe, including without mit-scheme.exe and using "\\\" (double) instead of just "\" (since that's what was being accepted by sublime which was what i used to edit the file), and also unsure at what point in the Main.sublime-menu I should be altering.
I've read similar solutions, but they're usually in mac where you can easily type which scheme onto the console to get the file path of scheme, so I'm thinking it has to do with me not knowing my correct file path or something? Any ideas?
Add these two env variables to your machine:
MITSCHEME_BIN_PATH=C:\Program Files (x86)\MIT-GNU Scheme\bin
MITSCHEME_LIBRARY_PATH=C:\Program Files (x86)\MIT-GNU Scheme\lib
Config this Main.sublime-menu file like this:
Then it should work. Enjoy it!

MSDOS - "The system could not find the file specified"

I am trying to copy the contents of a log file to another log file using this command:
type \\server\f$\Test path\Test.log >> \\server2\f$\Logs\Testpath\Test.log
This has always worked in the path, but recently I have changed the location (path) to Test.log. The path is slightly longer. I now get an error:
The system could not find the file specified
I have googled this statement and the common responses are: 1) check the filename exists, 2) check the filename is not corrupt 3) Check the server is online.
I have done all of this. Is there a restriction on the number of characters a path can have? If there is then is there a workaround?
UPDATE 12/07/2012 09:49 GMT
Adding quotes around the path seems to resolve the problem. Why does adding quotes resolve the problem?
The problem was that the source path had a space in it. Adding quotes around the path resolved the problem.
Type is to examine a file, not to copy.
Also, if server is an actual server and not a folder, then you should be using two slashes (\server\share)
Example:
copy \\server\f$\Sourcepath\Test.log \\server2\f$\Logs\Destpath\Test.log /y
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspx?mfr=true

Resources