Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 05 Mar 2015, 00:07
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » System
freememapplet_tray v2.7.2 - source
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [11 Posts]  
Author Message
gyro

Joined: 28 Oct 2008
Posts: 664
Location: Brisbane, Australia

PostPosted: Sat 17 Jan 2015, 14:34    Post subject:  freememapplet_tray v2.7.2 - source
Subject description: uses 'statfs' function to get file system information
 

I thought I might as well share this code.
It's a rewrite of freememapplet_tray-2.5.tar.bz2.
The gtk stuff has been left as is, but the rest of the code has been replaced.
It contains both 32bit and 64bit binaries.

Edit: Attached an updated version 2.7.1. Just a small change to tidy the code a little bit.

Edit2: Attached an updated version 2.7.2. A 1 line change to the "compile" script so that it works on tahrpup.

gyro
freememapplet-2.7.2.tar.gz
Description  Extract with tar into a directory
gz

 Download 
Filename  freememapplet-2.7.2.tar.gz 
Filesize  12.38 KB 
Downloaded  42 Time(s) 

Last edited by gyro on Mon 19 Jan 2015, 15:49; edited 4 times in total
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 4834
Location: Gatineau (Qc), Canada

PostPosted: Sat 17 Jan 2015, 17:09    Post subject: Re: freememapplet_tray v2.7 - source
Subject description: uses 'statfs' function to get file system information
 

gyro wrote:
I thought I might as well share this code.
It's a rewrite of freememapplet_tray.
The gtk stuff has been left as is, but the rest of the code has been replaced.
It contains both 32bit and 64bit binaries.

gyro


Hi, gyro.

Looks interesting. Can you explain a little more for us mere mortals? Smile What
computer language did you use? What is 'statfs'? Is this one bigger, smaller, faster,
more efficient, etc., than the old one? Were you unhappy with the old one, or was
this for you only an "exercise" that turned out really well?

Thanks in advance.

musher0

_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send private message Visit poster's website 
gyro

Joined: 28 Oct 2008
Posts: 664
Location: Brisbane, Australia

PostPosted: Sat 17 Jan 2015, 20:44    Post subject: Re: freememapplet_tray v2.7 - source
Subject description: uses 'statfs' function to get file system information
 

musher0 wrote:
What computer language did you use?
What is 'statfs'?
Is this one bigger, smaller, faster, more efficient, etc., than the old one?
Were you unhappy with the old one, or was this for you only an "exercise" that turned out really well?
C.
A system function callable from C.
Source smaller, my binary bigger, but might be more efficient, all done "entirely in C code...".
The old one had to be recompiled anyway for "savefolder using symbolic links", and the old one crashes if "df" returns nothing. I expect this version to be more robust, should the environment change again.
Started as "exercise" prompted by the following line in the original:
Code:
    //would prefer to do this entirely in C code..
so, I did.

Note: Even a mere mortal could probably have gleaned much of the above information by downloading and reading the source provided.

gyro
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 4834
Location: Gatineau (Qc), Canada

PostPosted: Sun 18 Jan 2015, 15:25    Post subject:  

Oops. Shocked Sorry if my interview-type questions offended you.
But this mere mortal thanks you anyway! Smile Trying it now.

_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send private message Visit poster's website 
gyro

Joined: 28 Oct 2008
Posts: 664
Location: Brisbane, Australia

PostPosted: Sun 18 Jan 2015, 20:32    Post subject:  

Warning, the "compile" script in the package produces compile errors on tahrpup. Haven't worked out why.
The good news is that a binary compiled on Dpup Squeeze or a binary compiled on Slacko 5.9.3, works fine on tahrpup. (May be able to sucessfully compile on other puppies but these are the 2 I have tried.)

Edit: Actually I think they are link errors on tahrpup.

Sorry about not including this information in the first post. I actually did this stuff a little while ago and had forgotten.

The binary in the package "freememapplet_tray32" was compiled on Dpup Squeeze, seems to run ok on many 32 bit puppies.
The binary in the package "freememapplet_tray64" was compiled on Slacko64, also runs ok on Tahr64.

gyro

Last edited by gyro on Mon 19 Jan 2015, 07:34; edited 3 times in total
Back to top
View user's profile Send private message 
gyro

Joined: 28 Oct 2008
Posts: 664
Location: Brisbane, Australia

PostPosted: Sun 18 Jan 2015, 20:50    Post subject: Update to version 2.7.1  

This is a very small tidy of the C code.
Here is a diff:
Code:
--- freememapplet_tray_prev.c   2015-01-19 05:41:13.627448296 +1000
+++ freememapplet_tray.c   2015-01-19 05:38:56.378659149 +1000
@@ -66,8 +66,8 @@
 gboolean Update(gpointer ptr) {
    
     //read free personal storage...
-   sizetotal = sizefree = 0;
-   getFileSystemData(save_layer_dir);
+   if (getFileSystemData(save_layer_dir) != 0)
+      sizetotal = sizefree = 0;
 
     if (sizefreeprev == sizefree) return; //unchanged.
     sizefreeprev=sizefree;
It doesn't really change what happens, I just think it's a bit more obvious.

Both versions should work exactly the same. So if you just want something that works, the binaries in 2.7 should work just as well as the binaries in 2.7.1.
But if you intend to compile the C code then I would suggest you download version 2.7.1.

It is attached to the first post, download it from there.

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

Joined: 28 Oct 2008
Posts: 664
Location: Brisbane, Australia

PostPosted: Mon 19 Jan 2015, 06:45    Post subject:  

musher0 wrote:
Sorry if my interview-type questions offended you.
But this mere mortal thanks you anyway!
Thankyou.
But I think "offended" is too strong a word, more like "exasperated".
My initial reaction to your first question was: "If this person can't be bothered to even look at it, why should I be bothered to spend some of my 'hobby time' to provide an answer."
gyro
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 4834
Location: Gatineau (Qc), Canada

PostPosted: Mon 19 Jan 2015, 08:37    Post subject:  

gyro wrote:
musher0 wrote:
Sorry if my interview-type questions offended you.
But this mere mortal thanks you anyway!
Thankyou.
But I think "offended" is too strong a word, more like "exasperated".
My initial reaction to your first question was: "If this person can't be bothered to even look at it, why should I be bothered to spend some of my 'hobby time' to provide an answer."
gyro


Hello, gyro.

I just happen to be the type of person who needs a lot of convincing! Very Happy

Speaking of which Smile, I'm not convinced your implementation reacts as fast as the old
one. I'm not a C programmer, mind you, just a bash scripter. I did a major cleanup of
my pupsave yesterday with both freememtrays on, and the older one seemed to react
faster to my deletes than yours.

As well, the numbers in both old and new freememstrays did not seem to agree with
the results provided by the corresponding code in conky (I mean the following conky code).

Code:
${fs_used /mnt/home} / ${fs_size /mnt/home}


freememtray says: 1.2G total minus 990M free. That equals to: 210M occupied in the
pupsave file.

conky says 270M occupied on 1.23G. Which leaves 960M free.

Somebody is off 60M! Smile With so much free space in my poupsave, it's not that I need
an exact figure at the moment, but it's sure confusing! Smile

BFN.

musher0

_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send private message Visit poster's website 
gyro

Joined: 28 Oct 2008
Posts: 664
Location: Brisbane, Australia

PostPosted: Mon 19 Jan 2015, 09:36    Post subject:  

Hi musher0,

Thanks for testing.

I make no claims about the speed of this code. Thought I do think from a C code point of view it is more robust.

Regarding the perceived difference in responsiveness, that is a little unexpected. Neither version controls when it does something, they register a callback routine with gtk, which gtk calls when it decides they need to do something. Perhaps running both at once is clouding your result. (Either way I have no interest in trying to improve the speed of this code.)

Different numbers for the same partition, from different applications:
Some differences could be due to different rounding when converting from Kbytes to Mbytes or Gbytes. This freememapplet_tray does no rounding, so integer values are usually a bit lower than actual, e.g. 57.2 becomes 57, 57.9 becomes 57. This is based on the idea that it's safer to underestimate the amount of free space.
Others differences could be due to different interpretations of what a Mbyte or Gbyte is. For this freememapplet_tray a Kbyte is 1024, a Mbyte is 1024*1024, and a Gbyte is 1024*1024*1024.
The only way to get consistency is to use a standard source for the Kbytes and a standard interpretation of the size of Mbyte and Gbyte.

Note: I don't run freememapplet_tray any more. Since I use 'savefolder' on all my puppies, I'm not paranoid about the free space in "pup_rw" any more.

gyro
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 4834
Location: Gatineau (Qc), Canada

PostPosted: Mon 19 Jan 2015, 09:38    Post subject:  

Many thanks for the clarifications. BFN.
_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send private message Visit poster's website 
gyro

Joined: 28 Oct 2008
Posts: 664
Location: Brisbane, Australia

PostPosted: Mon 19 Jan 2015, 09:50    Post subject: Update to version 2.7.2
Subject description: Compile script now works on tahrpup
 

Sorry about changing things so soon, but hopefully this is the last one.

It's just a 1 line change to the "compile" script:
Code:
--- compile.orig   2012-05-19 20:06:11.000000000 +1000
+++ compile   2015-01-19 22:50:23.822671234 +1000
@@ -3,7 +3,7 @@
 rm -f freememapplet_tray
 rm -f freememapplet_tray.pot
 
-gcc `pkg-config --cflags --libs gtk+-2.0` freememapplet_tray.c -o freememapplet_tray
+gcc freememapplet_tray.c `pkg-config --cflags --libs gtk+-2.0` -o freememapplet_tray
 
 xgettext --keyword="_" freememapplet_tray.c  -o freememapplet_tray.pot
 
Now it works on tahrpup. I suspect the problem was simply a newer version of gcc.
"freememapplet-2.5.tar.bz2" might have a similar problem. If so, this patched "compile" could be used there.

File attached to first post, download from there.

gyro
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [11 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » System
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: 0.0810s ][ Queries: 12 (0.0050s) ][ GZIP on ]