mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Programming (https://www.mersenneforum.org/forumdisplay.php?f=29)
-   -   LLR_Peeker - a handy proggie for LLR&NewPGen users (https://www.mersenneforum.org/showthread.php?t=10325)

kuratkull 2008-05-23 21:04

LLR_Peeker - a handy proggie for LLR&NewPGen users
 
Hello,

I have been working on a small program, which I think will surely make my life easier, and hopefully yours too.

So, it's a small GTK app, which resides in the status bar and blinks when you have found a prime. It parses 3 files: the output of NewPGen, the prime output of LLR and the detailed output of LLR.

Stats it provides:
Last output of LLR
Numbers checked(count)
Numbers to check(count)
Primes found
Average time spent on number
ETA remaining for rest of numbers
Total time spent

BE SURE TO READ THE 'INSTALL' FILE BEFORE USING! :)

Screenshot: [URL="http://www.kuratkull.com/screen.png"]www.kuratkull.com/screen.png[/URL]
[U][URL]http://www.kuratkull.com/llr_peeker-0.1.tar.gz[/URL][/U]
Written in pure C (okok, I used POSIX regex) and GTK.

It has several shortcomings(which should not affect 99% of the users) and the code could be a lot better, but I decided to make it public after I was almost finished... I will make it better soon :)

Tell me what you think.

-kuratkull

PS! Bug reports and feature requests are very welcome :)

kuratkull 2008-05-24 17:04

I saw from the logs that ~3 people downloaded it... I would be very happy to hear from them if they think the app is worth a comment :)

Anyone?

PS! I failed to mention in my first post, that it's Linux only and I supplied both the source and a precompiled binary(just in case).

-kuratkull

mdettweiler 2008-05-24 17:28

[quote=kuratkull;134242]I saw from the logs that ~3 people downloaded it... I would be very happy to hear from them if they think the app is worth a comment :)

Anyone?

PS! I failed to mention in my first post, that it's Linux only and I supplied both the source and a precompiled binary(just in case).

-kuratkull[/quote]
I was one of those people--but unfortunately I couldn't get it to work under Ubuntu 8.04. I got an error about "not being able to attach to applet object" or something similarly cryptic when using the binary; when I tried to compile it from source, with the commands "gcc main.c" and when that didn't work, "g++ main.c" (since there was no makefile or ./configure script), I got a load of error messages.

Do you know what might have gone wrong? Or would you need the exact error messages for that? :smile:

Mini-Geek 2008-05-24 17:32

I downloaded it, but it's Linux only, and I'm Windows only, so...yeah...tell me if you make a Windows version, though. :smile:

kuratkull 2008-05-24 18:03

Anonymous, did you read the "correct" gcc command from the INSTALL file? :)

It needs the gtk libs to be linked :) ->
[code]gcc -o peeker main.c `pkg-config --cflags --libs gtk+-2.0` -export-dynamic[/code]You should get similar output on compile:

[code]main.c: In function ‘number_of_lines_file’:
main.c:122: warning: initialization from incompatible pointer type
main.c:132: warning: assignment makes pointer from integer without a cast
main.c: In function ‘create_menu’:
main.c:411: warning: return makes integer from pointer without a cast
main.c: In function ‘main’:
main.c:477: warning: passing argument 3 of ‘g_timeout_add_seconds_full’ from incompatible pointer type[/code]And this on running:
[code]NOTICE: Please set the environment variable 'EDITOR' to your preferred editor.
Using 'nano' for now.
Evil things may happen if 'nano' isn't on your computer!

(demo:21335): Gtk-WARNING **: Can't set a parent on widget which has a parent

/home/kuratkull/.llr_peeker
REFRESHING
/home/kuratkull/Desktop/LLR/39547695.in
/home/kuratkull/Desktop/LLR/39547695.out
/home/kuratkull/Desktop/LLR/lresults.txt
3600
3
Total Primes: 3
Last line: 39547695*2^482195-1 is not prime. LLR Res64: 2451D21ABE7BF0D9 Time : 1756.064 sec.

Total Time: 9006755.829000
Lines in LLR_Long: 5006
Lines in NewPGen outp: 15593
Right clicked[/code]Please be sure to let me know if you still can't get it to run(the error messages would be very welcome too :)).
Thanks!

-kuratkull

PS! I will have to look into automake...and maybe try to port it to windows(haven't done that before, but shouldn't be too hard for a basic app like this).

mdettweiler 2008-05-24 18:10

Okay, thanks, somehow I missed that part of the compile instructions in the INSTALL file. As for the output when it's run, I was getting similar output to that with the binary, but no system tray icon; I'll try compiling it again with the command line you gave, and see how it works. :smile:

mdettweiler 2008-05-24 18:14

Okay, here's what I get when I try to compile with that command:[code]Package gtk+-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk+-2.0' found
main.c:27:21: error: gtk/gtk.h: No such file or directory
main.c:61: error: expected ‘)’ before ‘*’ token
main.c: In function ‘number_of_lines_file’:
main.c:122: warning: initialization from incompatible pointer type
main.c:132: warning: assignment makes pointer from integer without a cast
main.c: At top level:
main.c:235: error: expected ‘)’ before ‘*’ token
main.c:253: error: expected ‘)’ before ‘*’ token
main.c: In function ‘about_activated’:
main.c:336: error: ‘GtkWidget’ undeclared (first use in this function)
main.c:336: error: (Each undeclared identifier is reported only once
main.c:336: error: for each function it appears in.)
main.c:336: error: ‘dialog’ undeclared (first use in this function)
main.c:336: error: ‘label’ undeclared (first use in this function)
main.c:342: error: ‘GTK_DIALOG_DESTROY_WITH_PARENT’ undeclared (first use in this function)
main.c:343: error: ‘GTK_STOCK_OK’ undeclared (first use in this function)
main.c:344: error: ‘GTK_RESPONSE_NONE’ undeclared (first use in this function)
main.c:352: error: ‘gtk_widget_destroy’ undeclared (first use in this function)
main.c:357: error: invalid type argument of ‘->’
main.c: At top level:
main.c:363: error: expected ‘)’ before ‘*’ token
main.c:374: error: expected ‘)’ before ‘*’ token
main.c:380: error: expected ‘)’ before ‘*’ token
main.c: In function ‘main’:
main.c:416: error: ‘GtkStatusIcon’ undeclared (first use in this function)
main.c:416: error: ‘status’ undeclared (first use in this function)
main.c:417: error: ‘GtkWidget’ undeclared (first use in this function)
main.c:417: error: ‘menu’ undeclared (first use in this function)
main.c:431: error: ‘tray_icon_on_click’ undeclared (first use in this function)
main.c:435: error: ‘tray_icon_on_right_click’ undeclared (first use in this function)[/code]So then I tried just running the binary (./main) and got this:[code]NOTICE: Please set the environment variable 'EDITOR' to your preferred editor.
Using 'nano' for now.
Evil things may happen if 'nano' isn't on your computer!

(main:19017): Gtk-WARNING **: Can't set a parent on widget which has a parent

/home/max/.llr_peeker
REFRESHING
LLR_prime_output:


0
0
ERROR: Couldn't open: [/code]Then I got dumped back at the console prompt. What did I do wrong?

kuratkull 2008-05-24 18:25

Did you read the first three lines of the binary output? ;)
here is what the proggie did:
1. Tried to see if you you have the bash variable EDITOR set. Seems you don't.
2. Tried to fall back to default, and use the 'nano' editor. Seems you don't have this too.
3. Since the fallback used 'nano', then the command(to edit the config) issued to the system failed, and the program went forward with the config file empty.
4. I set it to exit if it couldn't find/open the files mentioned in the config.(your config is emtpy).

So, the solutions:
1. set the EDITOR variable to some editor
2. install nano
3. edit the config file $HOME/.llr_peeker manually and set the file locations.
4. Run it! :)
[EDIT] I thought about it: You have to edit it manually, since you are thrown into the config file only if it doesn't exist...but it does, the blanks are just not filled. SO you have to open it manually, and fill the ~5 lines. Then it will/should work.[/EDIT]

As for the compilation, seems you do not have the Gtk2 development libs installed :/ Ubuntu repository should have those.

I will look into your other compiler errors a bit later(have to leave my PC for a while...friends and beer and stuff).

Hope you get it to work...if you don't, holler!

-kuratkull

PS! The INSTALL file contains LOTS of useful information, please read it! :)

EDIT2: You are my guineapig(:P), since all the people I know personally, use Windows :/ (Thanks for being interested)

mdettweiler 2008-05-24 18:36

[quote=kuratkull;134262]Did you read the first three lines of the binary output? ;)
here is what the proggie did:
1. Tried to see if you you have the bash variable EDITOR set. Seems you don't.
2. Tried to fall back to default, and use the 'nano' editor. Seems you don't have this too.
3. Since the fallback used 'nano', then the command(to edit the config) issued to the system failed, and the program went forward with the config file empty.
4. I set it to exit if it couldn't find/open the files mentioned in the config.(your config is emtpy).

So, the solutions:
1. set the EDITOR variable to some editor
2. install nano
3. edit the config file $HOME/.llr_peeker manually and set the file locations.
4. Run it! :)[/quote]
Actually, I do have nano installed on my system, in fact it was installed as the default console text editor since I installed the system (I should know, I use it quite a lot myself). Odd that LLR Peeker can't find it though...[quote]
[EDIT] I thought about it: You have to edit it manually, since you are thrown into the config file only if it doesn't exist...but it does, the blanks are just not filled. SO you have to open it manually, and fill the ~5 lines. Then it will/should work.[/EDIT][/quote]
Oh, I see, I had thought previously that ~/.llr_peeker was a [i]directory[/i], not a file, and thus thought it hadn't been created when I couldn't access it through Nautilus. :smile: I've opened the text file in nano, though, and now I'll go and fill in the blanks manually...

[quote]As for the compilation, seems you do not have the Gtk2 development libs installed :/ Ubuntu repository should have those.

I will look into your other compiler errors a bit later(have to leave my PC for a while...friends and beer and stuff).

Hope you get it to work...if you don't, holler!

-kuratkull

PS! The INSTALL file contains LOTS of useful information, please read it! :)[/quote]
Yes, I did read the INSTALL file, but it looks like my problem was that I had assumed GTK2 was installed and thus the error was somethign else (though I should have remembered, I'd need the development libs, not just the regular GTK2 runtime that comes as an integral part of GNOME). :smile: Oh well, I'll try the binary after I edit the config file, and see if it works...if not I'll install the GTK2 development libraries and try compiling. :smile:

mdettweiler 2008-05-24 18:53

It's (mostly) working now! :w00t: I ended up having to create symbolic links in the llr_peeker directory to the real LLR (actually LLRnet in this case) output files because the real files were in a directory that had a space somewhere in the path name, which LLR Peeker didn't like.

I still don't see any icon in the system tray though. Maybe it's being thrown off by my using it with LLRnet instead of real LLR?

kuratkull 2008-05-24 19:27

The icon is the first thing it should initialize, it isn't dependant on the input files. I just tried the binary on a friends Ubuntu system, and it worked... icon and everything. :S


All times are UTC. The time now is 07:59.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.