Emacs Searchin Number of Results [duplicate] - search

This question already has answers here:
"1 of n" result for Emacs search
(4 answers)
Closed 9 years ago.
When doing a search in Emacs (C-s, incremental search), it may be useful to see the number of results. I'm trying to find a way to do that but I cannot seem to find any. Does anyone have any suggestions?

ioccur incrementally lists multiple results for the regex that you provide. They are listed in another buffer, but that allows you to easily jump to each match.

You can run count-matches to get the number of matches. Incremental search is incremental, it searches incrementally.

Related

How to process arrow keys in CLI-based application, in Haskell? [duplicate]

This question already has answers here:
Haskell read raw keyboard input
(6 answers)
Closed 6 years ago.
I'm writing simple console Pomodoro timer (as my Haskell learning exercise):
Until that time menu was based on the prompt line. But now I want to replace it with arrow-based menu, like in Yeoman:
How can I do it in Haskell?
I read about System.Console.Terminfo.Keys and other System.Console packages, but not found solution for my question.
One way to do that would be to use bindings to ncurses library. Infact ncurses shows you an example of handing the key character "Q" in their sample program.
Another nice Haskell solution is vty-ui which has got a nice documentation to it.

What is the best way to mine text on large files (1 GB+) in Python? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have a handful of text files, ranging from 1 to 5 GBs. Content are
simple unique one-liners.
I would like to:
1. mine text (find patterns, word frequency, clustering etc.).
2. compare text patterns to another large file to find similarities
Problem:
Memory runs out. IDE can't cope. Even when using generators.
Question:
What is the best approach to work with such large files?
Batching? Map/reduce? Hadoop? Using database instead of Python? What I
don't want is to write a function to find a pattern and then wait an
hour for processing (there is a lot to write, let alone wait for response). Obviously, conventional way of working with normal sized
files doesn't apply here).
I would recommend Apache Spark which can be used from Python.
Apache Sparkā„¢ is a fast and general engine for large-scale data
processing.
Write applications quickly in Java, Scala or Python.
Spark offers over 80 high-level operators that make it easy to build
parallel apps. And you can use it interactively from the Scala and
Python shells.
file = spark.textFile("hdfs://...")
errors = file.filter(lambda line: "ERROR" in line)
# Count all the errors
errors.count()
# Count errors mentioning MySQL
errors.filter(lambda line: "MySQL" in line).count()
# Fetch the MySQL errors as an array of strings
errors.filter(lambda line: "MySQL" in line).collect()

linux readdir - Are the entries "." and ".." always read first? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Does readdir() guarantee an order?
I'm guessing this isn't the case, and I'd need to manually check the name of each entry instead of just skipping the first couple. Is that correct?
The POSIX standard does not guarantee anything about the order of directory entries whatsoever. As such, if you're interested in filtering out . and .., you do need to compare for them.
No, you should never rely on finding . and .. first (although it almost always happens).
I remember one case when I had problems with such an assuption (on ReiserFS they were not found first, but it was an old version of ReiserFS, now it may be different).
It is not in the standard, but I have never seen them in any other place, but the first two. But, just in case, if you don't realy mind the time that much, I would do the check.

What ncurses frameworks are available for BASH? [duplicate]

This question already has answers here:
Bash script with graphical menus
(2 answers)
Closed 5 years ago.
Are there some more Text User Interface (TUI) frameworks for bash (other than this)? : http://code.google.com/p/bashsimplecurses/
I want to take user input (data entry)
process the entry
If all you need to do is prompt the user for information, take a look at dialog.
http://invisible-island.net/dialog/dialog.html
bashsimplecurses is pretty capable (from the little I've seen), but you might want to try GTK Server. (Have a look at the docs page for tutorial and manual links). It can work with a large number of scripting languages. Other Stack Exchange users (particularly the UNIX/ BSD/ GNU/Linux lot) recommend using ncurses with Python.

Classic string manipulation interview questions? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I am scheduled to have an onsite interview so I am preparing few basic questions. According to the company profile, they are big on string manipulation questions. So far I have manually coded these functions:
String length, copy, concat, remove white space
Reverse
Anagrams
Palindrome
Can someone give me a list of more classic string questions which I can practice before going there?
They might ask you about regular expressions. If they are using Java, they might ask the difference of StringBuffer and StringBuilder.
Reverse words in a sentence, e.g.
"string manip interview question"
becomes
"question interview manip string"
this has a solution that uses only one char worth of temporary space.
Make sure your reversal is in-place. You didn't state, so perhaps it already is.
Asking you to re-implementing strstr() or strtok() might be up their alley too, I guess.
UPDATE: As a bonus, if you do end up re-implementing either of those, remember to not name your functions starting with str, since that namespace is reserved. Having a candidate display that knowledge in an interview would impress me, at least. :)
Fast search like Boyer-Moore and Knuth-Morris-Pratt. Fast strlen by examining more than one byte at a time. Simultaneously finding multiple strings in a large body of text with Rabin-Karp. Finding nearest matches with things like Levenshtein distance. Regular expressions and how they might implement parts of it. Various unicode and other multibyte string encodings and how to convert between them.
Design a regular expression library.
Check this out. Might not fit the description for 'classic', but very interesting.
I'd look up string algorithms in a good algorithm book. For example, the Boyer-Moore algorithm, Tries, Suffix Trees, Minimum Edit Distance, stuff like that.

Resources