How to edit your views in CouchDB Futon? - couchdb

I am using CouchDB Futon to edit the views and shows. But I find it hard to edit the JavaScript code because of converting the newline to "\n". Also, it is hard to do all the escaping work.
What do you use to edit your views?

Maybe you want to have a look at the CouchApp framework. It allows you to have your map, reduce, show, list etc. functions in text files you can edit with the editor of your choice. A simple command pushes them to your design documents. It is intended for building CouchApps, but might as well be useful if you only need to edit your views.
http://couchapp.org
http://github.com/couchapp/couchapp

You can edit view code by browsing to it in Futon, and then expanding the source code area. You can then save/undo, etc.
For the other functions, and views too, you can always use LoveSeat.
Cheers.

Related

Exclude comments from search results in IntelliJ global search?

I found the grammar error "it's" as a possessive on one page of a large project. I'm trying to search for any other usages of this on pages to correct it, but I'm getting results containing hundreds of comments. I just want to filter for the important user-facing portions of the project. Is there a way to exclude comments from the results of a global search?
In more recent versions, at least in PyCharm 2018 (similar to IntelliJ), there is a filter option "Except comments," as shown here:
(Click the small filter icon to show the dropdown.)
Note: The selected filter option persists during a session, and the active filter option is not immediately apparent unless you open the dropdown. To prevent accidentally limiting subsequent searches, it may be a good idea to switch back to "Anywhere" afterward.
Another approach would be to enable the "Regular expression" (or "Regex") checkbox in the search dialog, then use some kind of negative lookaround to exclude comments.
In one case, I needed to exclude lines with single-line comments (e.g. # this is a comment) from a search, but not lines with inline comments (e.g. a=b+1 # this is an inline comment). The following did the trick, searching for something (for Python comments, starting with #):
^((?!#).)*something.*$
Please note I'm not a regex-expert, so this regex pattern can probably be improved upon greatly, but it illustrates the idea. You can play around with this on regex101. Any comments to improve the pattern are most welcome, of course.
Note sure if this approach could be extended to multiline comments though. (as in """ several lines here """).
It's difficult to suggest something without really looking at the code, but since it seems like a one-off thing, I would use global search just in comments to temporary replace "it's" with some #temporary-token#, then use global search everywhere, you should everything what's left. Then rollback temporary token for comments. Should be easy to try with VCS. Just an idea.
As you can see, with "Comments only" option, only one #token is found.

Search through scripts of (multiple) cimplicity screens

We are using Cimplicity to operate some installations at our plant. The frontend consists of a lot of .cim files, which are the screens presented to the operator. These files are built with 'cimedit', which is basically a graphical click and drag program with which you can assemble the screens. Each object you drag onto the screen has the option to run a script, which brings me to my problem.
Because each screen contains a lot of small scripts and functions it is hard to keep track of what does what. For example I'm trying to figure out where a certain table from my database is being accessed or updated. Since the files all seem to be compressed (or so) I can't use a regular 'search the contents of this file' search.
Things I've tried so far are searching using windows, with the content option enabled and also tried the compression option. This had no success. It makes sense because like I said, the files seem to be compressed, so the actual script is not stored in plain text.
So, my question in short:
How do I search all the scripts of (preferably multiple) cimplicity screens?
Any tips on how to search compressed files are also very much appreciated.
I stumbled upon another stackoverflow post while searching for a better windows search tool and ended up finding this post: https://superuser.com/questions/26593/best-way-to-confidently-search-files-and-contents-in-windows-without-using-an
This posts recommends Agent Ransack and it is actually possible to search through the .cim files with this tool.

Lucene: how can I find query hit positions in original contents?

Suppose I have a document collection that I have indexed in Lucene. I submit a query and get hits. Now what I want is to find where in a particular document hit(s) occur(s). I know that I can use the Lucene Highlighting classes to obtain relevant fragments. But how can I find out where exactly these fragments appear in the original contents?
A related question is how to make sure the found fragments are actually very close to the original query? I noticed in my experiments with highlighting that often I would have a multi-word query and it would return fragments that would have only some of these words. But what if I want to make sure I get hits with all the words?
Thanks!
Not an actual answer, just a few links to a solution to a similar problem.
First of all, here you can see the actual results of the highlighting (note that were is highlighted though am was in the query. Stemming is an additional feature of this implementation):
http://hunglish.hu/search?huSentence=&enSentence=I%20am%20highlighted&size=20&page=2&doc.genre=-10
Here's the source. Look for these methods: highlightField, highlightBisen
http://code.google.com/p/hunglish-webapp/source/browse/trunk/src/main/java/hu/mokk/hunglish/lucene/Searcher.java
Disclaimer: I wrote this a while ago, it is not very nice code, and it is buggy in special cases: there is an open issue relating to highlighting. Furthermore, it uses version 3.2.0 of the lucene-highlighter, which is possibly not the newest.
Anyway, I hope if you look at how it works, it helps you write a better one, or at least something that works as expected.

Bulk rename/delete on many wiki pages in trac, how?

does trac web interface provide a way to delete, rename, etc. a lot of wiki pages as a whole, without having to do the tedious task one by one and manually? Something like a checkbox for each page, followed by a Delete button.
Thanks
You can do this through the trac-admin command-line utility. Use the syntax
trac-admin /path/to/project/env wiki remove WikiPageName
to remove a wiki page. You should be able to write a simple script that runs this command for every page in a list. You can use the wiki list command to retrieve a list of all wiki pages, which might be useful if you are wanting to delete wiki pages whose names follow a particular pattern (also useful for deleting a page and all of its sub-pages).
update use bta's answer instead of this.
There is no trac interface I am aware of, but you might be able to do this by manually editing the database. For example SQLite Database Browser is able to open the db/trac.db file and might be a little bit less tedious than manually using the trac interface. But make a backup before you try....
You have to edit the name field in the wiki table.

displaying functions in c using vi

Is there a way to display all functions in a C source file using vim. This feature is available with the brief editor. And this would help me a lot.
Note: This is not a programming question.
I think the Taglist plugin is what you are looking for. It shows functions, classes etc. in a sidebar and is designed to make source code browsing a lot easier.
I use this one. 0scan
You can make incremental search on all functions in the current file using tag search mechanism.
0scan is designed to perform lots of different searches. And here you can find how to search for a functions and objects in the current file.

Resources