(OLD) (ARCHIVED) Puppy Linux Discussion Forum Forum Index (OLD) (ARCHIVED) Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info

This forum can also be accessed as http://oldforum.puppylinux.com
It is now read-only and serves only as archives.

Please register over the NEW forum
https://forum.puppylinux.com
and continue your work there. Thank you.

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups    
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 22 Jan 2021, 21:19
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Building MMview, a universal file viewer
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. View previous topic :: View next topic
Page 22 of 24 [348 Posts]   Goto page: Previous 1, 2, 3, ..., 20, 21, 22, 23, 24 Next
Author Message
dancytron

Joined: 18 Jul 2012
Posts: 1555

PostPosted: Sat 22 Feb 2020, 16:47    Post subject:  

MochiMoppel wrote:
Thanks for the encouragement to continue this project. There is still work to do. Probably by the next update you will see an improved Find function with a very fast text search across directories. To my knowledge this doesn't yet exist in any Puppy. There is one in zigbert's pFind but there the focus is on finding files while mine will focus on finding (and of course displaying) text. If there is any other program I missed, please let me know.

The "Special desktop edition" got its obligatory update.

Beware that colored glasses are not a reliable indicator for a running instance nor are they an indicator for increased intelligence . Glasses stay colored if MMview is killed or run from a console that has been killed. A restart will fix that.


Please continue it. It is a great piece of work.

I wish I used it more...
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 2084
Location: Japan

PostPosted: Sun 23 Feb 2020, 03:49    Post subject:  

dancytron wrote:
I wish I used it more...
Who or what keeps you from using it ? Laughing
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 2084
Location: Japan

PostPosted: Fri 10 Apr 2020, 07:18    Post subject:  

Update 2020-04-10 ( version 0.29 ) (see also initial post)
This update adds the ability to search for text in (multiple) files. It is one of the features that I couldn't find in any Puppy, so I decided to build and include it. It is very fast and - may I say this? - very useful (e.g. see here )

Search text in files
Included in the Find dialog (Ctrl+F). Which files will be searched I tried to explain in the tooltip.
Several options allow fine-tuning. Search will be fastes without any option selected. "Use inline markers" has practical no effect on speed while "Match any case" can slow down search considerably if the search string is long (grep has to try all possible case combinations!).

Though generally very fast some sophisticated (regex) searches may take longer than a minute to produce results. That's why MMview will - after 1-2 seconds - show a panic button ("Abort") which allows to end the search prematurely. Any results that were already found until this point appear in the viewer pane.

If matches were found, the count is displayed in the statusbar. The statusbar will also include the grep command that was used to achieve the result. This command can be copied to a console and executed. It should produce the same result, though not the same format.

Searches can be repeated for different directories via the "Find again" function (F3). No need to bring up the Find dialog again. Entries and option choices are saved and will survive a shutdown of MMview but not a reboot.

Location box
A text search normally produces matches in multiple files. The output is formatted so that file paths are listed on separate lines. How to access these files quickly? An easy way is to copy the filepath into the "Location" box and then choose any of MMview's functions, e.g. push the "Open text file" button to load the file into an editor. This Location box has precedence over any file that may currently be selected in MMview's file list, provided that the Location box has focus (= text cursor is in box).

Other changes
Fixed: "Text to hex" function fails to convert '*' character
Fixed: Menu item 'Run Command' (shortcut F4) may not be enabled despite visible command box
Changed: Dialogs for Find, Rename, Delete etc. do not require wmctrl anymore for their "always-on-top" status
mmview_find_text.jpg
 Description   
 Filesize   140.83 KB
 Viewed   494 Time(s)

mmview_find_text.jpg

Back to top
View user's profile Send private message 
rockedge


Joined: 11 Apr 2012
Posts: 1874
Location: Connecticut, United States

PostPosted: Fri 10 Apr 2020, 10:35    Post subject:  

Hello MochiMoppel!!

Totally agree!!! this search function is super useful! So pleased you added this function I am going to bake a pie later today.

A minor request...can this be added into mm_viewme as well?

excellent progress on this powerful tool.
Back to top
View user's profile Send private message Visit poster's website 
MochiMoppel


Joined: 26 Jan 2011
Posts: 2084
Location: Japan

PostPosted: Fri 10 Apr 2020, 23:22    Post subject:  

rockedge wrote:
A minor request...can this be added into mm_viewme as well?
You can do it yourself. Open your mm_viewme with an editor and find all comments containing the character ☗ . There are 4 of them and they mark the line(s) that need to be added to the official mm_view to turn it into an unofficial mm_viewme. I know you can do it because you are reading programming posts Laughing
Let me know if it works.
Back to top
View user's profile Send private message 
rockedge


Joined: 11 Apr 2012
Posts: 1874
Location: Connecticut, United States

PostPosted: Fri 10 Apr 2020, 23:54    Post subject:  

hello MochiMoppel,

I swapped the lines in and the new mm_viewme is working.

I only found 3 characters ☗. 1,3,4 so I took the function and the other two single lines and placed them into the correct positions. Thanks for the tip!


there is a bug though maybe from the missing ☗#2. If I open more than one instance of mm_viewme the icon changes color for each and the icon color would reverse as the instances were closed and only turn gray when all mm_viewme processes are quit.
Now this version 0.29 the icon changes color for each open instance but now when one of those instances is closed the icon turns grey and remains so even with other processes of mm_viewme are still open and running.

Not really a big deal but the previous version did display and icon color until all processes are quit and closed. What did I miss?

screenshot is mm_view 0.29 converted to mm_viewme 0.29 running on WeeDogLinux64 (Void)

**
2020-04-11-000221_1280x1024_scrot.png
 Description   
 Filesize   125.21 KB
 Viewed   415 Time(s)

2020-04-11-000221_1280x1024_scrot.png


Last edited by rockedge on Sat 11 Apr 2020, 00:18; edited 3 times in total
Back to top
View user's profile Send private message Visit poster's website 
MochiMoppel


Joined: 26 Jan 2011
Posts: 2084
Location: Japan

PostPosted: Sat 11 Apr 2020, 00:14    Post subject:  

rockedge wrote:
I only found 3 characters ☗. 1,3,4
You''ll find 4 if you use MMviews Find function and search for ☗ Wink
No.2 is in line 166. Creates the standard gray glassed icon. If you have that already in your .config directory your version will work but users building mm_viewme for the first time will need it.

Quote:
there is a bug
Indeed, there is Shocked
In function lastrites_cleanup the line
[[ $(busybox pidof "$WINTITLE$APP_VERS") = *' '* ]] && return #stop here if another instance running
should read
[[ $(busybox pidof "$WINTITLE") = *' '* ]] && return #stop here if another instance running
If you correct the line only the last closed instance will change the icon to standard gray.
I'll reupload ASAP. Thanks for the bug report.

Last edited by MochiMoppel on Sat 11 Apr 2020, 02:30; edited 1 time in total
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 5834
Location: Republic of Novo Zelande

PostPosted: Sat 11 Apr 2020, 02:29    Post subject:  

MochiMoppel wrote:
Update 2020-04-10 ( version 0.29 ) (see also initial post)
This update adds the ability to search for text in (multiple) files. It is one of the features that I couldn't find in any Puppy, so I decided to build and include it.
Wow - thank you! I have multiple text files that contain diary and technical data from all my customer service calls over the last two years and have been wondering how I could tabulate data relative to specific customers.

I thought about finding a way to transfer them to a fields.awk database or similar so that I could search on customer names (or part number etc) but now there's no need for me to do so.

This will be incredibly helpful! Thanks Mochi!
SearchComplete.jpg
 Description   
 Filesize   78.5 KB
 Viewed   396 Time(s)

SearchComplete.jpg

Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 5834
Location: Republic of Novo Zelande

PostPosted: Sat 11 Apr 2020, 02:40    Post subject:  

I see that the order of search items returned does not seem to be ordered according to the alphabetical file name. The dates seem mixed up. Not a problem but is there a reason for this? Is it something I did?
SearchDatesOrder.jpg
 Description   
 Filesize   43.32 KB
 Viewed   389 Time(s)

SearchDatesOrder.jpg

Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 2084
Location: Japan

PostPosted: Sat 11 Apr 2020, 03:17    Post subject:  

greengeek wrote:
I see that the order of search items returned does not seem to be ordered according to the alphabetical file name. The dates seem mixed up. Not a problem but is there a reason for this?
There is a reason for everything.
You selected a directory, which triggers a grep recursive search. Apparently grep searches by file modification date. Newest first. Check your file dates.

You should get an alpabetically ordered list when you select a file. In your example when you open your PreviousToDo directory and select any of the ToDoblabla.txt files you should get the list sorted by file name. In this case the file order is determinded by bash and not by grep.
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 5834
Location: Republic of Novo Zelande

PostPosted: Sat 11 Apr 2020, 03:33    Post subject:  

MochiMoppel wrote:
You should get an alpabetically ordered list when you select a file. In your example when you open your PreviousToDo directory and select any of the ToDoblabla.txt files you should get the list sorted by file name.
Aahhh yes, indeed I do. Many thanks! This is a fantastic feature.
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 2084
Location: Japan

PostPosted: Sat 11 Apr 2020, 03:46    Post subject:  

greengeek wrote:
This is a fantastic feature.
Which one?
I'm wondering if it would be preferable to make it consistent, i.e. also sort alphabetically when searching a directory.
For this lines 991 and 992 would have to be changed.
From
truetrueD) grep $GREP_OPTIONS "$FIND" "$PWD" 2>/dev/null | sed ...
falsetrueD) grep $GREP_OPTIONS "$FIND" "$PWD" 2>/dev/null | awk .
..
to
truetrueD) grep $GREP_OPTIONS "$FIND" "$PWD" 2>/dev/null | sort | sed ...
falsetrueD) grep $GREP_OPTIONS "$FIND" "$PWD" 2>/dev/null | sort | awk ...


I wrote:
I'll reupload ASAP. Thanks for the bug report.
Done. Haven't changed version no. or anything else as this is a minor fix and does not affect users of the official version.
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 5834
Location: Republic of Novo Zelande

PostPosted: Sat 11 Apr 2020, 04:45    Post subject:  

MochiMoppel wrote:
Which one?
The ability to search within files. (regardless of whether alphabetical or by date).
Quote:
I'm wondering if it would be preferable to make it consistent, i.e. also sort alphabetically when searching a directory.
I think it might be handy to have both options available just as it is (user can select either file or directory to get the different result sort). But do you think there is a way to offer the choice of either alphabetical or by date in both cases? I can see both options being useful for different requirements.

I think I would generally prefer to have the files displayed in alphabetical order - but there will also be times when it will be important to have the files displayed in date order as I may have I have some idea of the likely date when the data I am searching for was recorded (eg: "I recall delivering that product just before last christmas") and search results displayed by file date would help me find the needed data more easily - especially if I have made an error with the name of the file (eg accidentally changed format of date like 20March rather than March20)

Regardless if the results are displayed by date order or in alphabetical order (or especially if user can choose either display mode) this is a really fantastic feature from my point of view.
(EDITED to better explain what I meant)
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 2084
Location: Japan

PostPosted: Tue 14 Apr 2020, 23:10    Post subject:  

greengeek wrote:
do you think there is a way to offer the choice of either alphabetical or by date in both cases?
Alphabetical should be possible, by date would be extremely difficult. I'll think about it but it's not my priority.
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 2084
Location: Japan

PostPosted: Sun 19 Apr 2020, 04:55    Post subject:  

The new text search function can produce funny results. Either there is a bug in GNU awk or - more likely - I don't understand the logic behind awk.
Searching in directories /usr or /usr/share for "GetHelpSourceDialog" my Puppy produces only 4 matching lines of file /usr/share/geany/python.tags.
The display is supposed to show the lines containing "GetHelpSourceDialog", but only line 577 shows a match. And are these really whole lines?

Taking a closer look at /usr/share/geany/python.tags reveals that this file is ISO-8859-1 encoded, containing extended ASCII characters.

I traced the problem back to awk, parsing the grep output in function find_again

To demonstrate the problem I created 3 very simplified test commands:
    grep "GetHelpSourceDialog" /usr/share/geany/python.tags
    grep "GetHelpSourceDialog" /usr/share/geany/python.tags | awk '{print $0}'
    grep "GetHelpSourceDialog" /usr/share/geany/python.tags | awk '{print substr($0,1)}'

All 3 commands should produce the same output, but only the first 2 do so as expected (note the capital letters I with acutes and circumflexes):
    GetHelpSourceDialogÌ1Í(Toplevel)
    MenuOkÌ128ÍselfÎGetHelpSourceDialog
    PathOkÌ128ÍselfÎGetHelpSourceDialog
    browseFileÌ128ÍselfÎGetHelpSourceDialog

The 3rd code is what I use in MMview and what produces the output
    GetHelpSourceDialog
    MenuOk
    PathOk
    browseFile

This means that awk's substr function reads $0 (= the whole line) and though supposed to render a substring of $0 starting with the first character, it does so only as long as it finds ASCII characters. Extraction stops as soon as it encounters a non-ASCII character. I find this odd, wrong and can't explain it. Anyone can?
The code would work with a preceding LC_ALL=C, which I find even more odd. Isn't LC_ALL=C supposed to ignore extended ASCII?
Find_GetHelpSourceDialog.jpg
 Description   
 Filesize   52.69 KB
 Viewed   236 Time(s)

Find_GetHelpSourceDialog.jpg

Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 22 of 24 [348 Posts]   Goto page: Previous 1, 2, 3, ..., 20, 21, 22, 23, 24 Next
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 4.0967s ][ Queries: 13 (3.3323s) ][ GZIP on ]