This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Clojure REPL readline like support
I am a clojure newbie. Today i installed it on my Arch box.
%pacman -Q|grep -i jdk
openjdk6 6.b22_1.10.3-1
%pacman -Q|grep -i clojure
clojure 1.2.1-2
clojure-contrib 1.2.0-3
then i run clj:
%clj
Clojure 1.2.1
user=> (+ 1 2)
3
All seems ok however i feel it is VERY difficult to use the clj interactive environment, where i cannot use
arrow key and so on.
What i really want to know is how i can config the clj interactive environment ?
Don't use repl via the command line, install any one of the ide plugins, emacs vim eclipse etc. they all come with integrated repl that way you can directly send statements from your source files to the repl. Plus all of them supports arrow keys history etc. (emacs does)
You already got two nice answers in comments, but this seems like a good chance to plug one of my projects, ClojureX:
https://github.com/citizen428/ClojureX
While developed for conveniently using Clojure on MacOS X, it also works well on Linux and even Windows with Cygwin. It will use rlwrap if it finds it installed and will fall back on the included JLine otherwise.
Related
I downloaded the Clojure jar. Its version is 1.6.0.
When I run Clojure in console I press arrow keys but they don't move the cursor but produce these characters "[[D^[[C.
I start Clojure using this command:
java -cp clojure-1.6.0.jar clojure.main
using Java 1.7.0_55 64 bit on Ubuntu 14.04 LTS 64 bit.
How can I get back normal arrow keys behaviour ?
The repl bundled with Clojure is pretty terrible. But that's okay, because you want to install Leiningen anyway, and its repl is much better, including the various readline stuff you're used to.
But in general, if there's some app that does a terrible job of being a repl, you can always use rlwrap to wrap the app in readline.
You are following hopelessly outdated instructions/tutorials. The generally accepted way to interact with all things clojure is through Leiningen. Then start Clojure by running:
lein repl
You can create a new web project by running:
lein new compojure my-project-name
or a new general project by running:
lein new my-project-name
This question already has answers here:
pygame installation issue in mac os
(5 answers)
Closed 2 years ago.
I'm using Python 2.7 32 bit and have a few questions about pygame on mac.
Where do the files go when you install it? I'm not given a choice for the file path when I install it.
When I import pygame in IDLE everything works fine (except it's a bit slow to load sometimes), but when I import pygame and run Python using Sublime Text (what would this be called, the key board short-cut is command-b for build), it can not find pygame. I'm assuming I have to find the library and move it to a different place but I can't find it.
When I run a file that imports pygame in the terminal everything works out fine too. Maybe there's a better text editor to use?
I'm new to programming and I'm realizing that its probably a good idea to get more acquainted with how my mac works/ is organized. Any good resources for this?
Just go to Tools->Build System->New Build System and make sure the json file that pops up looks exactly like this:
{
"shell_cmd": "python2.7-32"
}
Save it as "python2_32.sublime-build" or something that lets you know what it is, then you can go to tools->Build System and select your new build directive. Now when you Command-B, your code should run fine.
This essentially lets sublime text know that you want to run this script using the 32 bit version of python (which supports pygame). It's like a shebang for sublime.
Good luck!
I'm just beginning to learn programming (on C++ and Python), and by beginning I mean total beginning ("hello world" beginning...). Not wanting to use multiple IDE's, I would like to be able to code and build–simple–programs with my text editor, Sublime Text 2. Could someone indicate me, with a step-by-step tutorial, how to implement C++ and Python compiling and executing capabilities in Sublime Text.
I've searched Sublime Text build systems on the site, but the answers are very specific and can't help a rookie like me (but they'll probably help me later).
Thanks
Sublime Text 2 already comes with scripts for building and running Python and C++ programs.
Simply press Cmd+B (or Ctrl+B on Windows & Linux) when a .py or .cpp file is open. The Python file will automatically execute and show the result in the built in console.
For C++, you need to press Cmd+Shift+B (Ctrl+Shift+B on Windows & Linux) to run it after building.
You need to have Python installed (get it here for Windows), and also a C++ compiler. The build system for C++ tries to call g++ by default (get it here for Windows. Remember to select the C++ compiler when installing!).
You will need to add the directories to path (c:\python32\ or similar for python, c:\mingw\bin or similar for the C++ compiler).
On windows, you may experience problems running the C++ programs (it tries to use bash). But Ctrl+B builds the program, and you can then use a command line to run it. Python works flawlessly on Windows.
windows(install minigw, python2.7 and added to the system path)
cpp:
build: ctrl+b
run: ctrl+shift+b
python:
build and run: ctrl+b
you may try to learn the the .sublime-build files in your Tools -> Build system -> New build system
So, you don't want to use an IDE but then you want IDE features from a text editor? :)
Most people who use a text editor for writing code use terminal to build and run the code.
So, for C++, the instructions are:
make (or gcc myprogram.c)
./myprogram
for a Python program, it's even simpler:
python ./myprogram.py
If you're not comfortable with terminal, then you probably need an IDE.
for c++ I actually made sublime to produce colorful error messages which are easier to read and you can also click on the errors which takes you to the file with the error.
You can look at how I modified the build to do what I wanted in here
I installed clojure and clojure contrib manually, through homebrew and mac ports all of them gives me this error.
I can get other parts to work.
What gives?
edit
this question seems similar
Can not get clojure-contrib to load - FileNotFoundException
However i can load some parts, and i install through ports/brew so the versions should be in sync
It's better to use clojure & clojure-contrib not directly, but through some project, for example, managed by leiningen - it will fetch correct versions of clojure & clojure-contrib, plus some other dependencies that you're specify. You can also look onto my Lein introduction article on this topic
Well I couldn't make it work through fiddling with jars or using macport or homebrew.
But leiningen solved the problem for me.
To see the solution i came up with see:
https://github.com/khebbie/PET
also this article helped a lot:
http://pragprog.com/magazines/2011-07/create-unix-services-with-clojure
Primarily I've done basic (novice level) software development on a Windows machine, but I've always had MS Visual Studio to help me step through the process of debugging.
Now, however, it looks like I will be on Linux, so in order to get ready for the jump I want to make sure I have a tool/tools lined up to help me step through the code and debug.
Unfortunately when I've verbally asked folks how they go about debugging on Linux, I typically get the following answer, "Oh, I just put a bunch of print statements." OMG! No way you say, but yes that is their answer.
Since it is on Linux, and will be working with C++ code on the CentOS 32-bit OS, I am hoping here is a preferred OpenSource solution. So, I guess I asking for the preferred OpenSource IDE for C++ code on CentOS Linux.
Thanks for any insight and suggestions.
Good question, of course, but its been
done before:
https://stackoverflow.com/questions/408418/what-editor-ide-do-you-use-for-c-programming-on-linux-and-why-closed
https://stackoverflow.com/questions/86676/is-there-a-good-and-free-ide-for-c-c-in-linux
https://stackoverflow.com/questions/149321/what-ide-would-be-good-for-linux-kernel-driver-development
Lightweight IDE for Linux
Simple GUI IDE?
(from: https://stackoverflow.com/questions/579219/best-unix-linux-c-debuger-ide-closed)
A few years ago I made the move from VS to an emacs/make type environment and I have never looked back.
The idea is to use a makefile to handle the project management side of an IDE and I use emacs+gdb for editing and debugging. It will take you a while to get used to emacs but if you stick at it it's well worth the effort. Once you've started emacs, press "Ctrl+H" followed by "t" and this will bring you to the tutorial page.
After you've mastered the basics, you can debug a program in a similar way to any IDE/debugger interface. I must admit that even after all this time, I still use a set of VS key mappings that I setup when I first moved to emacs!
(global-set-key [f7] 'compile) ;; Run the compile command
(global-set-key [f4] 'next-error) ;; The next compile error
(global-set-key [S-f4] 'previous-error) ;; The previous compile error
(global-set-key [f5] 'gdb) ;; Start the debugger
The following sets the "VS" key mappings to the different GDB commands which you might use:
(add-hook 'gud-mode-hook
'(lambda ()
(define-key (current-local-map)
[f10]
'gud-next)
(define-key (current-local-map)
[f11]
'gud-step)
(define-key (current-local-map)
[\S-f11]
'gud-finish)
(define-key (current-local-map)
[f5]
'gud-cont)
))
With the above keymappings, I press 'f5' which prompts me to run gdb (and to this command I add the binary I wish to debug). Once gdb is loaded, you press 'f5' to continue, 'f10' to step-over, 'f11' to step-into and 'shirt+f11' to step-out.
Finally, every time you start 'gdb', it will read a file called '.gdbinit' in your home directory. A different StackOverflow question had this answer which brought stl-views to my attention. stl-views is a set of helper functions for gdb that show you the contents of the different types of STL containers. The instructions for how to use it can be found at the top of the link.
I would suggest using Eclipse
Eclipse is a mature IDE with plenty of support available.
There is also Code::Blocks if you want to try something different
Eclipse
NetBeans
KDevelop
There is always GDB. XCode for OSX uses GDB internally for debugging.
Valgrind, its your friend and may save you from having to suffer though GDB.
Mostly, for an IDE similar (?) to VS - use Eclipse.
See moving Microsoft VS projects to Eclipse C/C++ Development Toolkit - a brief step-by-step procedure for migrating Microsoft Visual Studio C/C++ (MSVC) projects to Eclipse. It compares and contrasts the benefits of MSVC and Eclipse CDT.
Anjuta is a really great IDE for GNOME. For debugging it uses GDB internally.
If you just want a good debugger, check out DDD.
I use a combination of gdb and cscope when debugging on linux.