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 Sun 26 Oct 2014, 03:15
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
updated "resize pupsave" in Xdialog
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 2 of 3 Posts_count   Goto page: Previous 1, 2, 3 Next
Author Message
Argolance


Joined: 06 Jan 2008
Posts: 1840
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Wed 12 Sep 2012, 13:02    Post_subject:  

Hello,
All these scripts are very interesting and useful indeed...
The original one was internationalized by rodin.s and it is really a pity that none of them were "gettexted" according to the existing mo files...

Please feel sorry for poor guys who don't speak English: don't forget them!

Cordialement.

_________________

Back to top
View user's profile Send_private_message Visit_website 
ASRI éducation


Joined: 09 May 2009
Posts: 2550
Location: France

PostPosted: Mon 24 Jun 2013, 15:32    Post_subject: resizepfile-0.1.2  

I propose a new version of resizepfile script.
I based the new script on big_bass release (http://www.murga-linux.com/puppy/viewtopic.php?p=501398#501398) and changes proposed by Don570 (http://murga-linux.com/puppy/viewtopic.php?p=640850).

Changes/new features :
- Added two files: 'version-author' and 'settings'. This allows you to change information/preferences without changing the main script.
- Modification/simplification of main script 'resizepfile.sh'.
- Changing the main GUI (and adding a 'Help' GUI).
- Translation: I used Zigbert method to simplify the development of the script. If necessary, we can use files .mo in future versions. Currently, I have only integrated the local 'en', I will add other local when the script has been tested/approved by users and contributors.

To do
- Check/test/improve the current script.
- Check/test/improve translation 'en'.
- Help me solve a small bug (see next post).

Sincerely,
resizepfile-0.1.2_20130624.pet
Description  md5 fb3dd4644175a5be2d4c685b0fa14cd9
pet

 Download 
Filename  resizepfile-0.1.2_20130624.pet 
Filesize  8.29 KB 
Downloaded  309 Time(s) 
resizepfile_help_gui.jpg
 Description   
 Filesize   37.66 KB
 Viewed   668 Time(s)

resizepfile_help_gui.jpg

resizepfile_main_gui.jpg
 Description   
 Filesize   27.47 KB
 Viewed   688 Time(s)

resizepfile_main_gui.jpg

Back to top
View user's profile Send_private_message Visit_website 
ASRI éducation


Joined: 09 May 2009
Posts: 2550
Location: France

PostPosted: Mon 24 Jun 2013, 15:39    Post_subject:  

resizepfile-0.1.2
I added to the main GUI information in GB.
Currently, this simple division gives the result that integers.
I would like to figure a comma (two decimal places).
I tried to add a scale=2. I also tested bc. But I it does not work.
If anyone can help me...
Code:
"$Size01" "$LOC317     ($(($Size01/1024)) $LOC322)" \
Back to top
View user's profile Send_private_message Visit_website 
SFR


Joined: 26 Oct 2011
Posts: 1078

PostPosted: Mon 24 Jun 2013, 16:30    Post_subject:  

Hey ASRI, bc works ok for me:

Code:
# bc <<< "scale=2; 128/1024"
.12
#
# bc -l <<< "128/1024"
.12500000000000000000
#

Also, bc+printf:
Code:
# printf '%.2f\n' $(bc -l <<< "128/1024")
0.12
#

Code:
"$Size01" "$LOC317     ($(printf '%.2f' $(bc -l <<< "$Size01/1024")) $LOC322)" \

HTH
Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send_private_message 
ASRI éducation


Joined: 09 May 2009
Posts: 2550
Location: France

PostPosted: Mon 24 Jun 2013, 16:54    Post_subject:  

Hello SFR and thank you for your help.

I just tried with a base Lucid528
Code:
#### Main GUI
echo "Main GUI"
Xdialog --title "$AppTitle $AppVersion" --left --wrap --help "$HelpMsg"  \
--menu "$LOC250" 0 85 9 \
"$Size01" "$LOC317     ($(printf '%.2f' $(bc -l <<< "$Size01/1024")) $LOC322)" \
"$Size02" "$LOC317     ($(printf '%.2f' $(bc -l <<< "$Size02/1024")) $LOC322)" \
"$Size03" "$LOC317     ($(printf '%.2f' $(bc -l <<< "$Size03/1024")) $LOC322)" \
"$Size04" "$LOC317     ($(printf '%.2f' $(bc -l <<< "$Size04/1024")) $LOC322)" \
"$Size05" "$LOC317     ($(printf '%.2f' $(bc -l <<< "$Size05/1024")) $LOC322)" \
"$Size06" "$LOC317     ($(printf '%.2f' $(bc -l <<< "$Size06/1024")) $LOC322)" \
"$Size07" "$LOC317     ($(printf '%.2f' $(bc -l <<< "$Size07/1024")) $LOC322)" \
"$Size08" "$LOC317     ($(printf '%.2f' $(bc -l <<< "$Size08/1024")) $LOC322)"  2> /tmp/reply2


In terminal :
Code:
Get Language Settings

Check pupmode
Check if undetected pupsave
Definition of variables
HelpMsg
Main GUI
/usr/local/resizepfile/resizepfile.sh: line 95: printf: .06250000000000000000: invalid number
/usr/local/resizepfile/resizepfile.sh: line 95: printf: .12500000000000000000: invalid number
/usr/local/resizepfile/resizepfile.sh: line 95: printf: .25000000000000000000: invalid number
/usr/local/resizepfile/resizepfile.sh: line 95: printf: .50000000000000000000: invalid number
/usr/local/resizepfile/resizepfile.sh: line 95: printf: 1.00000000000000000000: invalid number
/usr/local/resizepfile/resizepfile.sh: line 95: printf: 2.00000000000000000000: invalid number
/usr/local/resizepfile/resizepfile.sh: line 95: printf: 4.00000000000000000000: invalid number
/usr/local/resizepfile/resizepfile.sh: line 95: printf: 8.00000000000000000000: invalid number


invalide number = false information in GUI Sad
If you have an idea...
Very Happy
invalid number.jpg
 Description   
 Filesize   28.71 KB
 Viewed   582 Time(s)

invalid number.jpg

Back to top
View user's profile Send_private_message Visit_website 
SFR


Joined: 26 Oct 2011
Posts: 1078

PostPosted: Mon 24 Jun 2013, 17:29    Post_subject:  

Ah, it's the old problem with decimal separator. Rolling Eyes
And again I forgot about it, sorry. Embarassed
bc uses only dot, but printf (bash builtin) distinguishes between dot and comma, accordingly to country settings.
Try this, /usr/bin/printf seems to behave better:
Code:
"$Size01" "$LOC317     ($(/usr/bin/printf '%.2f' $(bc -l <<< "$Size01/1024")) $LOC322)" \

Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send_private_message 
ASRI éducation


Joined: 09 May 2009
Posts: 2550
Location: France

PostPosted: Mon 24 Jun 2013, 17:53    Post_subject:  

SFR wrote:
Code:
"$Size01" "$LOC317     ($(/usr/bin/printf '%.2f' $(bc -l <<< "$Size01/1024")) $LOC322)" \

Yes !!!
Code:
#### Main GUI
echo "Main GUI"
Xdialog --title "$AppTitle $AppVersion" --left --wrap --help "$HelpMsg"  \
--menu "$LOC250" 0 85 9 \
"$Size01" "$LOC317     ($(/usr/bin/printf '%.2f' $(bc -l <<< "$Size01/1024")) $LOC322)" \
"$Size02" "$LOC317     ($(/usr/bin/printf '%.2f' $(bc -l <<< "$Size02/1024")) $LOC322)" \
"$Size03" "$LOC317     ($(/usr/bin/printf '%.2f' $(bc -l <<< "$Size03/1024")) $LOC322)" \
"$Size04" "$LOC317     ($(/usr/bin/printf '%.2f' $(bc -l <<< "$Size04/1024")) $LOC322)" \
"$Size05" "$LOC317     ($(/usr/bin/printf '%.2f' $(bc -l <<< "$Size05/1024")) $LOC322)" \
"$Size06" "$LOC317     ($(/usr/bin/printf '%.2f' $(bc -l <<< "$Size06/1024")) $LOC322)" \
"$Size07" "$LOC317     ($(/usr/bin/printf '%.2f' $(bc -l <<< "$Size07/1024")) $LOC322)" \
"$Size08" "$LOC317     ($(/usr/bin/printf '%.2f' $(bc -l <<< "$Size08/1024")) $LOC322)"  2> /tmp/reply2

Thank for your help, I will soon be able to offer a version 0.1.3.
Before that, the file location 'en' must be validated.
decimal_ok.jpg
 Description   
 Filesize   28.65 KB
 Viewed   533 Time(s)

decimal_ok.jpg

Back to top
View user's profile Send_private_message Visit_website 
Pelo


Joined: 10 Sep 2011
Posts: 3231
Location: Mer méditerrannée (1 kms°)

PostPosted: Tue 25 Jun 2013, 06:00    Post_subject: ça usine, forte activité sur Puppy cet été !
Sub_title: Taille maximum utilisable
 

Taille maximum utilisable : le système sait combien d'espace disponible reste sur la partition choisie. Si on met plus que ce que l'on a, il serait bien qu'il le dise de suite. Is'nt it ?

Bla bla : sur les clés USBs, il m'est arrivé de créer une sauvegarde trop grosse pour ce qu'il me restait de place. Bien sûr, on devrait vérifier avant, mais on ne pense pas à tout.
Pendant que vous battez le fer, il serait sans doute possible d'y adjoindre un garde-fou, si vous savez faire, ce dont je ne doute point. Merci messieurs.

Je suis content de la voie prise par nos puppistophiles en ce moment.
Back to top
View user's profile Send_private_message YIM 
SFR


Joined: 26 Oct 2011
Posts: 1078

PostPosted: Tue 25 Jun 2013, 15:54    Post_subject:  

ASRI, we got a problem...

I just found out, doing something else, that although /usr/bin/printf works ok in Lupu, but not in Slacko.
The one from Lupu turned out to be a coreutils (full) version, whereas in Slacko it's a part of busybox and it behaves in the same, nasty way as bash builtin.

Perhaps it'd be better to resign from bc and use, for instance, dc, which respects regional settings and therefore always cooperates fine with printf:
Code:
"$Size01" "$LOC317     ($(printf '%.2f' $(dc $Size01 1024 / p)) $LOC322)" \

The above works for me in Slacko & Lupu with both dot & comma as decimal separator.

Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send_private_message 
don570


Joined: 10 Mar 2010
Posts: 3347
Location: Ontario

PostPosted: Tue 25 Jun 2013, 19:53    Post_subject:  

Barry Kauler updated his version of bc about half a year ago.

Did Slacko not do the same??

When I checked bc a couple of years ago I found that
multiplication and division could only be done in a particular way
because of old version of bc.

Check Advanced bash manual for examples.

http://208.109.22.214/puppy/viewtopic.php?t=80501&sid=36530eb7c6a741a0f86b02e532eefe31
Back to top
View user's profile Send_private_message 
SFR


Joined: 26 Oct 2011
Posts: 1078

PostPosted: Wed 26 Jun 2013, 09:34    Post_subject:  

don570 wrote:
Barry Kauler updated his version of bc about half a year ago.

Did Slacko not do the same??

I just checked and both Slacko-5.5 and Precise-5.6 have the very same version of 'bc':
Code:
# bc --version
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.

It seems to be the latest available release: ftp://alpha.gnu.org/gnu/bc/.

Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send_private_message 
ASRI éducation


Joined: 09 May 2009
Posts: 2550
Location: France

PostPosted: Wed 26 Jun 2013, 12:13    Post_subject: Re: ça usine, forte activité sur Puppy cet été !
Sub_title: Taille maximum utilisable
 

Pelo wrote:
Taille maximum utilisable : le système sait combien d'espace disponible reste sur la partition choisie. Si on met plus que ce que l'on a, il serait bien qu'il le dise de suite. Is'nt it ?

Ce sera intégré dans la prochaine version.
Cordialement,
Back to top
View user's profile Send_private_message Visit_website 
ASRI éducation


Joined: 09 May 2009
Posts: 2550
Location: France

PostPosted: Wed 26 Jun 2013, 19:17    Post_subject: resizepfile-0.1.3  

resizepfile-0.1.3
- best display size in GB (SFR)
- added test free space on host partition
- change translation (use gettext method)
resizepfile-0.1.3_20130626.pet
Description  md5 9a284cd4d965693f29b8479176f88ffc
pet

 Download 
Filename  resizepfile-0.1.3_20130626.pet 
Filesize  8.23 KB 
Downloaded  299 Time(s) 
resizepfile_size_error-en.png
 Description   
 Filesize   10.12 KB
 Viewed   370 Time(s)

resizepfile_size_error-en.png

resizepfile_help_gui-en.png
 Description   
 Filesize   23.59 KB
 Viewed   357 Time(s)

resizepfile_help_gui-en.png

resizepfile_main_gui-en.png
 Description   
 Filesize   19.79 KB
 Viewed   347 Time(s)

resizepfile_main_gui-en.png

Back to top
View user's profile Send_private_message Visit_website 
don570


Joined: 10 Mar 2010
Posts: 3347
Location: Ontario

PostPosted: Wed 26 Jun 2013, 19:21    Post_subject:  

line 59 of version 0.1.2 needs to be changed to restrict the width of
Xdialog infobox

change
Code:
--infobox "$LOC200" 0 0 60000


to...
Code:
--infobox "$LOC200" 0 100 60000


___________________________________________
Back to top
View user's profile Send_private_message 
ASRI éducation


Joined: 09 May 2009
Posts: 2550
Location: France

PostPosted: Wed 26 Jun 2013, 19:28    Post_subject:  

don570 wrote:
line 59 of version 0.1.2 needs to be changed to restrict the width of
Xdialog infobox

change
Code:
--infobox "$LOC200" 0 0 60000


to...
Code:
--infobox "$LOC200" 0 100 60000


___________________________________________

Thank you for the info.
This will be done as soon as the next version.
Back to top
View user's profile Send_private_message Visit_website 
Display_posts:   Sort by:   
Page 2 of 3 Posts_count   Goto page: Previous 1, 2, 3 Next
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


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