Setting up sublime text 2 with activeperl? - perl

New to using sublime text 2 and I'm wondering how to get it to point to the activeperl.exe (on win7).
I'm testing out the compiler to make sure it works with something simple like:
$x = 1;
$print "$x";
But it gives me guff about how $x isn't a recognized syntax. I did point ST2 to my python executable, but I forgot which file in the labyrinth I was supposed to edit the path to.

This worked for me, taken from: http://www.perlmonks.org/?node_id=935014
Click "Preferences -> Browse Packages"
Navigate to the "Perl" subfolder
Create a file called "Perl.sublime-build" with the following content:
{
"cmd": ["perl", "-w", "$file"],
"file_regex": ".* at (.*) line ([0-9]*)",
"selector": "source.perl"
}
Manually set the build system by clicking "Tools -> Build System -> Perl"
You can now run your Perl script by mashing Ctrl+B
I am running this version of ActiveState Perl:
C:\>perl --version
Binary build 1402 [295342] provided by ActiveState http://www.ActiveState.com
Built Oct 7 2011 15:49:44

I use the version 3 of Sublime Text and to run perl programs in this editor, you should:
Click "Preferences -> Browse Packages"
Navigate to the "Sublime Text" subfolder library "Lib"
Create a file called Perl.sublime-build with the following content:
{
"cmd": ["perl", "-w", "$file"],
"file_regex": ".* at (.) line ([0-9])",
"selector": "source.perl"
}
Manually set the build system by clicking "Tools -> Build System -> Perl"
You can now run your Perl script by pressing Ctrl+B.
Attention: the file Perl.sublime-build should be created in this root diretory: \Sublime Text 3\Lib.

Related

Empty output after clicking 'run'

I do not see the result after I click the "Run" button
"C:\Program Files\Edument Central Europe\Comma Community Edition
2020.01\bin\runnerw64.exe" C:\rakudo\bin\perl6.bat -Ilib C:\Users\quest\CommaProjects\monkey\monkey.p6
Process finished with exit code 0
#!/usr/bin/env perl6
sub MAIN() {
say 'Hello, Monkey';
}
I deleted the old version of the program, then installed the new version, without saving the settings from the previous version. Then File -> Project Structure -> set Project SDK

How to build Scala applications in Sublime Text 3?

I'd like to be able to build Scala applications in Sublime Text 3 on Mac 10.9.3. I have Scala 2.11.1 and sbt 0.13.5 installed and they all work fine. I installed them by homebrew.
However, I can't seem to find how to create a build system for Scala projects. For example, this one doesn't work:
{
"cmd": ["sbt", "test"],
"selector": "source.scala",
"working_dir": "${project_path}"
}
I found a couple of different ones as well but they didn't work for me, either. Your thoughts?
UPDATE:
[Errno 2] No such file or directory: 'sbt'
[cmd: ['sbt', 'test']]
[dir: /Users/alex/Documents/projects/scala/dir1]
[path: /usr/bin:/bin:/usr/sbin:/sbin]
[Finished]
UPDATE2:
{
"cmd": ["/usr/local/bin/sbt", "test"],
"selector": "source.scala",
"working_dir": "${project_path}"
}
An app:
class MainTest extends App {
println("Hellowa!")
}
The output:
[0m[[0minfo[0m] [0mSet current project to scala (in build file:/Users/alex/Documents/projects/scala/)[0m
[0m[[0minfo[0m] [0mCompiling 1 Scala source to /Users/alex/Documents/projects/scala/target/scala-2.10/classes...[0m
[0m[[32msuccess[0m] [0mTotal time: 4 s, completed Jun 16, 2014 4:51:38 PM[0m
[Finished in 7.2s]
Homebrew installs executables in /usr/local/bin, but the error text you have now provided shows that that directory isn't in your path.
Two ways you could fix it:
1) Change "cmd": ["sbt", "test"], to "cmd": ["/usr/local/bin/sbt", "test"],
2) Add /usr/local/bin to your PATH environment variable. Note that you'll need to do this in such a way that GUI apps like Sublime Text notice the change; see e.g. Setting environment variables in OS X? for details
Could SublimeSBT that's "Scala SBT build tool integration for Sublime Text 2 and Sublime Text 3." be a solution?
Why wouldn't you :D I am using SublimeSBT for quite some time, and the only complexity it's invoking cmd+shift+p followed by sbt start continuous testing. I would advice you to give SBTSublime a try before baking your own build system.
Personally I use SublimeREPL that support SBT. SublimeREPL allows you to launch SBT from Sublime. This avoided me to download another package, cause I already used SublimeSBT for python. I wanted a minimal configuration to code in scala, because my IDE was to slow. I first try to use my on build system but end up using SBT. The SBT offers great advantages in comparaison to other way of building your project.
First it compiles only files that need to (those who have been modified, and those who depend on them).
Second it's very handy for importing library. One line into your build.sbt file allows you to import library from github (usually this line is explicited on the github main page).
And third you can compile on every save, with the command "~compile", or "~; compile; runMain 'mainclass' "
I find the later pretty useful as it is often long to compile with scala. I often start to add a simple function, save, and while it's compiling I improve my first draw.
The main constraint is you have to put your code in src/main/scala or src/main/java if you have some Java files too, and you have to open the whole root directory with sublime.
Windows only!
If you already add the bin folder to the PATH variable:
{
"cmd": ["sbt.bat", "test"],
"selector": "source.scala",
"working_dir": "${project_path}"
}

How can I get Compass to work in Visual Studio via NuGet?

My developer friend who has the luxury of developing in a non-Windows environment has been raving about Compass. I finally decided I wanted to give it a try. I'm tired of trying to keep up with all of the intricacies of cross-browser CSS.
So, I found it on NuGet, and installed it.
I installs to my solutions root directory in the packages directory:
$(SolutionDir)packages\Ruby.Compass.0.12.2.3\
It comes with a Readme that states the following message:
Ruby Compass v. 0.12.2
Compass is installed in its own NuGet package dir, and available by
'compass' command in "packages\Ruby.Compass.0.12.2.3" folder.
To compile Compass files during build, add the next line to the
project pre-build events:
"$(SolutionDir)packages\Ruby.Compass.0.12.2.3\compass" compile
"$(ProjectDir)."
So, I placed the line in my pre-build events, saved, and tried to build my project. However, I get an error as follows:
The command
""$(SolutionDir)packages\Ruby.Compass.0.12.2.3\compass" compile "$(ProjectDir)."" exited with code 1.
Notice: It actually shows the full path to the ProjectDir and SolutionDir as it's supposed too in the error message. I replaced them with the tokens to keep the project name unanimous.
Let me mention that I tried variations of the suggestion pre-build line:
"$(SolutionDir)packages\Ruby.Compass.0.12.2.3\compass" compile "$(ProjectDir)"
"$(SolutionDir)packages\Ruby.Compass.0.12.2.3\compass" compile "$(ProjectDir)css"
"$(SolutionDir)packages\Ruby.Compass.0.12.2.3\compass" compile "$(ProjectDir)css\test.scss"
The first one just removed that trailing .. The second one pointed it to the directory where all my css files are stored. The third one pointed it to the exact file I was trying to compile was located.
I opened up compass.cmd which is the file it is calling, and it looks like the following:
#echo off
"%~dp0ruby\bin\compass" %*
I'm assuming this calls the compass file in the ruby/bin folder, which looks like this:
#!C:/downloads/ruby-2.0.0-p247-x64-mingw32/ruby-2.0.0-p247-x64-mingw32/bin/ruby.exe
#
# This file was generated by RubyGems.
#
# The application 'compass' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'
version = ">= 0"
if ARGV.first
str = ARGV.first
str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
if str =~ /\A_(.*)_\z/
version = $1
ARGV.shift
end
end
gem 'compass', version
load Gem.bin_path('compass', 'compass', version)
From there, I'm not sure what is going on. I'm not a Ruby person.
Is there an issue that I'm overlooking here?
Has anyone else been able to install Ruby.Compass via NuGet?
How can I get this working in Visual Studio without having to fight with Ruby?
From: http://codewith.us/automating-css-generation-in-visual-studio-using-sasscompass/
"Note that, if there are issues with your SCSS files, you will receive some variation of the error below.
Error 36 The command "del "C:Projectspubliccss*.css" /S
compass compile "C:Projectspublic" --force" exited with code 1.
Open your Output window (click View -> Output or press Ctrl+W, O), and select “Build” in the “Show output from:” menu. Scroll up until you find your command in the log and you should get a little more insight into what portion of the command failed."

JDK problems - Unable to load class files

Ok, so. I ordered a book on Java (Sams teach yourself java in 21 days) a week ago, and it came in just yesterday. I am working on the first example code, and I keep getting this error when I try to compile the main code:
C:\VolcanoApplication.java:5: error: cannot find symbol
VolcanoRobot dante = new VolcanoRobot();
^
symbol: class VolcanoRobot
location: class VolcanoApplication
C:\VolcanoApplication.java:5: error: cannot find symbol
VolcanoRobot dante = new VolcanoRobot();
^
symbol: class VolcanoRobot
location: class VolcanoApplication
And the main code Im trying to compile is:
public class VolcanoApplication
{
public static void main(String[] arguments)
{
VolcanoRobot dante = new VolcanoRobot();
dante.status = "exploring";
dante.speed = 2;
dante.temperature = 510;
dante.showAttributes();
System.out.println("Increasting speed to 3.");
dante.speed = 3;
dante.showAttributes();
System.out.println("Changing temperature to 670.");
dante.temperature = 670;
dante.showAttributes();
System.out.println("Checking the temperature.");
dante.checkTemperature();
dante.showAttributes();
}
}
and the VolcanoRobot.java file:
public class VolcanoRobot
{
String status;
int speed;
float temperature;
void checkTemperature()
{
if(temperature > 660)
{
status = "returning home";
speed = 5;
}
}
void showAttributes()
{
System.out.println("Status: " + status);
System.out.println("Speed: " + speed);
System.out.println("Temperature: " + temperature);
}
}
I am unable to get javac to run anywhere in command prompt (I'm running xp) so I navigate to where my javac.exe is (C:\Program Files\Java\jdk1.7.0_03\bin) and compile VolcanoApplication from there (VolcanoApplication is found on the root of C:)
When I just type Java anywhere I get the menu, but not javac. I declared the path and classpath variables, and yet it doesn't work. any suggestions?
Your best bet is to make javac work from any directory by going into the environment variables and changing your PATH so it includes C:\Program Files\jdk1.7.0_03\bin.
Once you've done that, in a command prompt typing javac anywhere should work.
The reason javac isn't finding the VolcanoRobot.java file is that it's not in the path that javac searches for source files. By default, that path includes the current directory, so if you cd to the directory containing VolcanoApplication.java and VolcanoRobot.java, then
javac VolcanoRobot.java VolcanoApplication.java
...should do it. If it doesn't, add -cp .:
javac -cp . VolcanoRobot.java VolcanoApplication.java
You should then be able to run it via
java VolcanoApplication
...or
java -cp . VolcanoApplication
Update: Since my main workstation is Linux-based, I hadn't done this under Windows 7 (used to do it all the time with Windows XP) and so I got to wondering whether there was something special about it. Doesn't look like there is. I installed the JDK on my Windows 7 box and didn't have any trouble using it. Here's exactly what I did:
Opened a command prompt and typed javac and pressed Enter, just to make sure I didn't have one installed I didn't remember. I got the usual "...is not recognized as an internal or external command" error.
Downloaded the JDK installer from Oracle.
Ran it, letting it install to its default location.
Opened the Control Panel.
Typed "environ" into the search box (because I'm lazy and don't bother to keep track of where they've moved it to this week).
Clicked the "Edit system environment variables" choice and clicked Yes on the admin permissions pop-up question. This opened a "System Properties" dialog with the "Advanced" tab open.
Clicked the "Environment Variables..." button on that tab.
In the "System variables" box at the bottom, scrolled down to Path.
With that highlighted, clicked the "Edit..." button, which opened the "Edit System Variable" box.
In Windows Explorer, navigated to the JDK's bin directory, which was at C:\Program Files\Java\jdk1.7.0_03\bin.
Clicked in the address bar, selected all, and copied that path to the clipboard.
Back in the "Edit System Variable" box, I put the cursor at the end of the path, typed a semicolon (;) (note: not a colon, and with no spaces around it), and then pasted the path from the clipboard.
Clicked the OK button on that box, the OK button on the "Environment Variables" box, and the OK button on the "System Properties" box.
Opened a new commmand prompt.
Typed javac and pressed Enter. I got the javac help listing.
Created the two volcano source files and put them in a directory (in my case, C:\tmp\j).
Changed into that directory.
Typed:
javac VolcanoRobot.java VolcanoApplication.java
...and pressed Enter. I got no errors.
Typed:
java VolcanoApplication
...and pressed Enter. It worked just fine, I got the output I'd expect from looking at the source files.
So there's no problem doing this on Windows 7. Perhaps what I did above will be helpful to you.
If the C:\Program Files\Java\jdk1.7.0_03\bin folder is entered into your system path environment variable, you might need to reopen cmd.exe, as it will not load these environment variables on the fly.
You then need to run javac from the root of your application.

Eclipse Indigo CDT: Function could not be resolved

This feels silly, but its been 2 days...somewhere after upgrading from Ubuntu 10.04 to 10.11 and from Eclipse Helios to Eclipse Indigo, I got stuck with the following problem:
Problem Description:
I'm trying to use a function in math.h called isinf(), but the problem also occurs with things like isnan(). The program compiles fine on the command line using make and fine in eclipse using build. But if I open the program file in eclipse it reports that it cannot reolve the isinf() function call. If I just insert the program contents into a new project and new source file, the error appears immediately. This problem did not occur under 11.04 with Eclipse Helios CDT
Questions:
Why are these errors only reported when the program file is opened and not on when the program is compiled; why are the errors not detected make is run from the command line? Is there a solution/workaround available?
Version Info
Linux Ubuntu 10.11 64-bit
Eclipse CDT Indigo, Service Release 1, Build id: 20110916-0149
(Also using Eclipse EE Indigo – if that makes a difference)
GNU Make 3.81
gcc 4.6.1-9Ubuntu3
To Duplicate:
Please find the two files you'll need to replicate below:
Step 0. Verify that everything is fine outside of Eclipse
Copy the attached source file and make file
create a directory e.g. Mkdir FunTest
Save the source file a 'Test.cpp' and the makefile as 'makefile'
Open a command prompt and navigate to the directory e.g. FunTest
Enter 'make'
Enter ./TestOut
Program responds “is not infinite”
Step 1. Create the project in Eclipse
Open Eclipse
Select File|New|MakeFile Project with Existing Code
Click Browse – navigate to the directory (FunTest) and click ok
Select 'Linux GCC' from the Toolchain selector
Click Finish
Step 2. Find the Error
Click Build All (Ctrl-B) – project builds without errors
Open the project in the project explorer to display the file in the directory
Double click on the file “Test.cpp”
Note the error icon next to line testing for infinity
Note the 2 error messages:
Semantic error: Function _isinff could not be resolved
Semantic error: Function _isinfl could not be resolved
Test.cpp:
include <math.h>
int main(int argc, char **argv)
{
int TestNum = 10;
if (isinf(TestNum) == 0)
printf("Not infinite\n");
return 0;
}
makefile:
# Specify the compiler
CC = g++
# Specify the compiler flags
CFLAGS += -c
# Specify the files making up the application
SOURCES = Test.cpp
OBJECTS = $(SOURCES:.cpp=.o)
EXECUTABLE = TestOut
all: $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) $(LDLIBS) -o $#
.cpp.o:
$(CC) $(CPPFLAGS) $(CFLAGS) $< -o $#
install:
#echo "Build complete!"
I have experienced similar problems of the CDT reporting errors even though the code compiled fine within Eclipse Indigo.
Project > Properties > Settings > Binary Parsers > "GNU Elf Parser"
helped in my case. I had the "Elf Parser" checked.
That looks like a problem that many others have had with eclipse CDT before. Sometimes shutting eclipse down and then starting it back up again is enough to help. If that isn't the case, take a look at what I have below:
Compilation ok, but eclipse content assist having problems
Check your includes: if you're using include<math.h> change it to include<cmath>. The same for stdio.h and stdlib.h, you should replace by cstdio and cstdlib. Another option may be change you project to a C project instead of a C++.
You are missing -lm option in your build preferences.
Project->Properties->Settings->Miscleanous->Other (linker) flags[]
For me, it was solved by adding a specific ‘Source Location’ folder, and removing the default. In Luna, it is under:
Project > Properties > C/C++ General > Paths and Symbols > Source
Location