readline

Rails 3.0 console won't run

bash-3.2# rails console /opt/local/lib/ruby1.9/1.9.1/irb/completion.rb:9:in `require': dlopen(/opt/local/lib/ruby1.9/1.9.1/i386-darwin10/readline.bundle, 9): Library not loaded: /opt/local/lib/libncurses.5.dylib (LoadError) Referenced from: /opt/local/lib/ruby1.9/1.9.1/i386-darwin10/readline.bundle Reason: no suitable image found. Di...

C# FileStream position is off after calling ReadLine()

I'm trying to read a (small-ish) file in chunks of a few lines at a time, and I need to return to the beginning of particular chunks. The problem is, after the very first call to streamReader.ReadLine(); the streamReader.BaseStream.Position property is set to the end of the file! Now I assume some caching is done in the backstage, ...

How do I count the number of bytes read by TextReader.ReadLine()?

I am parsing a very large file of records (one per line, each of varying length), and I'd like to keep track of the number of bytes I've read in the file so that I may recover in the event of a failure. I wrote the following: using (TextReader myTextReader = CreateTextReader()) { string record = myTextReader.ReadLine(); bytesRe...

Missing 'read' prompt in bash when using ssh?

Please tell me I'm missing something really obvious here: $ cat ~/bashplay/f #!/bin/bash read -p 'RDY> ' x echo $x $ ~/bashplay/f RDY> direct execution direct execution $ ssh somehost ~/bashplay/f indirect via ssh indirect via ssh Note the missing "RDY>" prompt when using ssh. I see the same thing in python when using the "readline"...

Is it possible to use readline instead of libedit in Python's raw_input under OS X?

From the readline module documentation, it mentions: On MacOS X the readline module can be implemented using the libedit library instead of GNU readline. The configuration file for libedit is different from that of GNU readline. Is it possible to use the readline library in /usr/lib/libreadline.dylib for example, or even compiled w...

Can't build readline when trying to install Python 2.6.5 in Debian 4.3.2

I am trying to install Python 2.6.5 on my web server running Debian 4.3.2.1-1. I unpacked the tarball, ran "./configure --prefix /usr/", then ran "make". I saw this message. Failed to find the necessary bits to build these modules: _bsddb _hashlib _ssl _tkinter bsddb185 bz2 ...

Programmatically interrupting raw_input

Is there a way to programmatically interrupt Python's raw_input? Specifically, I would like to present a prompt to the user, but also listen on a socket descriptor (using select, for instance) and interrupt the prompt, output something, and redisplay the prompt if data comes in on the socket. The reason for using raw_input rather than s...

How to read a local (res/raw) file line by line?

I have a text file in my res/raw directory. I want to read the file line by line, but FileReader and BufferedReader fail, because of Android's security restriction. How else can I do it? ...

Recompiling Python to fix arrow keys in interactive mode issue

I am working in python 2.6 (installed alongside Python2.4.3 required for CentOS) and I am having issues with the arrow keys and backspace etc. I compiled from source and I imagine the solution is to recompile after installing readline-devel as outlined in: http://stackoverflow.com/questions/893053/python-shell-arrow-keys-do-not-work-on...

Installing Heroku on Ubuntu Lucid Lynx is broken

I am trying to get a Ruby on Rails app hosted free somewhere, and Heroku is looking like my last resource. It is supposed to work on Linux, and the gem installs with no errors, but whenever I run any Heroku command it spits out several errors, all connected, and talking about a failed 'require.' I looked it up in the code, and it says: ...

Crossplatform method for inserting text into raw_input (to avoid readine) in Python

I have an application (CLI) which includes the feature of editing account information. It does this by asking a question and putting in the old value in the answer so that it is editable. Currently I'm using the readline module to do this. I'd like another way of doing the same thing that avoids this module (I want to allow the app to ru...

Can I rebind EOF in bash/Readline?

I'd like to unbind C-d from sending EOF in bash, and set it to another key. The idea is to keep C-d as EOF in my .bashrc, but to rebind it in my .bash_profile, so that hitting C-d repeatedly with pull me out of any subshells I'm in, but leave me in my login shell. Is this possible? C-d seems to be bound to delete-char, which it perfor...

how does BufferedReader keep track of what line has been read?

I'm reading lines from a file, and I believe that once I've read all the lines, I get an exception because of my while loop condition. Exception in thread "main" java.lang.NullPointerException at liarliar.main(liarliar.java:79) ... the code... // read the first line of the file iNumMembers = Integer.parseInt(br.readLine().trim()...

IOException in Android application

I have just started with Android development, and facing one issue in the android application. When application tries to read the data from file (raw resources), it throws IOException on readLine() function. code is as below: final Resources resources = m_ApplicationContext.getResources(); InputStream inputStream = resources.openRawRes...

Why does StreamReader.ReadLine() return a value for a one line file with no newline?

I want to append two text files together. I have one file with a carriage return line feed at the end. Observe file A which is 28 bytes. this is a line in the file\n then I have another file which is the same thing without the new line. Observe file B which is 26 bytes. this is a line in the file I want to append the sam...

Vbscript - Read ini or text file for specific section

Hi, I know I'v done stuff like this before, but I'm trying to find the most efficient way of doing this. Basically, I want to store some addresses in a text file and then read specific portions of the file, based on group membership. I've done all of the group membership stuff so I don't need any help for that. But I'm not sure if I ...

Groovy tcp readline

I recently created a tcp server in groovy and am wondering how to get it to behave similar to telnet. For example, I run my tcp server and pull up the cmd prompt to telnet the port of the script and send it commands that its looking for. Most of the commands send back one line/word of information. However there are a few that send back ...

How can I get Haskell readline installing under Cygwin?

Here's the message I get when trying to install in via cabal-install: $ cabal install --extra-include-dirs="C:\no_spaces\cygwin\usr\include" --extra-lib-dirs="C:\no_spaces\cygwin\lib" readline Resolving dependencies... Configuring readline-1.0.1.0... checking for gcc... gcc checking for C compiler default output file name... a.exe check...

Run the last X commands from IRB's command history?

I'm developing a ruby app with Vim in one screen, and in another I'm using irb to test the code I'm writing in Vim. For the sake of this example, we'll say there are only 2 irb commands to test the code that I've written, a load and a method call. Generally, it's more than 2 commands - if its just 2 I would tap the up arrow twice and hit...

Read text file (Unicode) in 'C' using native Win32

I have a line-oriented text file (Unicode) that was created using CreateFile() and WriteFile(). Reading that file as a binary stream using ReadFile() is straightforward, but extra low-level processing is needed to break it into lines. Is there a Win32 function that does this for me? Again, please note that it's in 'C' (not C++) and I ...