Pschedule 1.1.6 - Task on time

Window managers, icon programs, widgets, etc.
Message
Author
User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

edit bug

#61 Post by don570 »

Pschedule.9

I came across this odd bug while using luci 238

I wanted to put some of the job info into the clipboard.

I selected the command , then clicked on Edit button.

It was easy to put the info into the clipboard,

But I found that the next button that you click is important.

If I click 'Cancel' to get rid of edit window everything is alright,

but if I click 'OK' this prevents me from transfering text to the clipboard again.

That's because the edit window has empty fields as shown in
image (click to enlarge)
Image

I assume this is a bug.

_____________________________________________

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#62 Post by zigbert »

don570
I have read your post 4 times, and still not understanding the bug. Please keep in mind, - I am just a silly Norwegian with very limited global understanding. I have never been one of those smart guys, so maybe a couple of images would help.


Sigmund

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#63 Post by vovchik »

Dear zigbert,

Would this be of any use to you: http://www.murga-linux.com/puppy/viewto ... 615#470615?

With kind regards,
vovchik

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

bug explained

#64 Post by don570 »

I'll explain how to reproduce the bug step by step.

1) click on a task (or job) on the list. That selects it.
2) Click on edit. That produces the edit window.
3) Copy some command info to clipboard.
4) Now click on OK button
5) Click on edit button a second time and command field is now empty.
It shouldn't be empty.

I'll try to reproduce it again and report back this weekend.
I should have tried another puppy variant.

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

discovered problem with ampersand

#65 Post by don570 »

There is problem with ampersand.
try command
touch test&&.txt
and go thru steps in previous post.


and try commands of my previous post of month ago

maybe other symbols as well

Edit:

try a better example

Code: Select all

touch test1  &&  touch test2
Last edited by don570 on Sat 27 Nov 2010, 21:15, edited 2 times in total.

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#66 Post by zigbert »

vovchik wrote:Dear zigbert,

Would this be of any use to you: http://www.murga-linux.com/puppy/viewto ... 615#470615?

With kind regards,
vovchik
Thanks for sharing, - I'll keep it in mind :wink:


Sigmund

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#67 Post by zigbert »

Don570
will look at your trouble a bit later.......


Sigmund

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#68 Post by zigbert »

Version 0.9-2
See main post

Changelog
- Bugfix: Accept & in command (thanks to don570)
- Bugfix: Wrong Title in error-box.

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

Re: bug explained

#69 Post by zigbert »

don570 wrote:I'll explain how to reproduce the bug step by step.

1) click on a task (or job) on the list. That selects it.
2) Click on edit. That produces the edit window.
3) Copy some command info to clipboard.
4) Now click on OK button
5) Click on edit button a second time and command field is now empty.
It shouldn't be empty.

I'll try to reproduce it again and report back this weekend.
I should have tried another puppy variant.
I could still not reproduce this in Puppy 5.1.1. In case this is related to the &-bug, please tray 0.9-2


Thanks
Sigmund

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

bug with ampersand

#70 Post by don570 »

The only bug I had was with the ampersand.
I'll test the fix and report.

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

explanation of ampersand bug

#71 Post by don570 »

I didn't explain the ampersand bug very clearly.
It doesn't refer to a variable name having an
ampersand character.

What I was doing was to connect two commands with a double
ampersand &&

This is a method that I like
to use to complete one command completely then start another command.

The example I used was

Code: Select all

cd /mnt/sda5 && arecord -d 7200 -f cd -D hw  out2.wav
This worked well in previous versions of pschedule, but then I
got ambitious and tried to see if I could edit the line in pschedule.
So here is what I did.

1) click on the task (or job) on the list. That selects it.
2) Click on edit button ---> That produces the edit window.
3) Copy some of command line to clipboard.
4) Now click on OK button
5) Click on edit button a second time and command field is now empty.
It shouldn't be empty.

I concluded that the ampersand character is causing pschedule
to become confused.

What I suggest is that when the edit button is clicked , a check for
the double ampersand is made and when the OK button is clicked,
reconstruct the two commands back together so that there is
some sense to the line of code again.

If that's too hard to do then you'd better go back to previous version.

I'm sorry for the confusion.

___________________________________________________

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

design to handle double ampersand

#72 Post by don570 »

I quickly drew up a design to show how to handle the double ampersand.

When the edit button is clicked , there would be a search for the double
ampersand in the task and if it was found, this window would appear.
Each command could be edited separately. Then click on the OK button
when the editing is concluded.


Image


Once the edit window closes the two commands can be recombined
into one line of code and the regular window used.
____________________________________________________

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#73 Post by zigbert »

don570
I have made some more testing, I find the latest (0.9-2) to work as expected. Please be aware of
- it adds a \ in front of the &. This prints the text-string (with &) correct, and you can edit the cron-task without corrupting the command.
- Adding a & to the command to run in background seems to me not logical, since cron itself continues after execution.
- To execute several commands in one cron-task, you should use the separator ';'


Sigmund

User avatar
RetroTechGuy
Posts: 2947
Joined: Tue 15 Dec 2009, 17:20
Location: USA

Re: explanation of ampersand bug

#74 Post by RetroTechGuy »

don570 wrote:I didn't explain the ampersand bug very clearly.
It doesn't refer to a variable name having an
ampersand character.

What I was doing was to connect two commands with a double
ampersand &&

This is a method that I like
to use to complete one command completely then start another command.

The example I used was

Code: Select all

cd /mnt/sda5 && arecord -d 7200 -f cd -D hw  out2.wav
I thought that the standard Linux method to chain commands was the semi-colon ";"

So your command becomes:

Code: Select all

cd /mnt/sda5 ; arecord -d 7200 -f cd -D hw  out2.wav
I'm somewhat wary of "&" since that's the standard "background this process" command.

Thus, something like this:

Code: Select all

./go_run_this_tedious_code_and_dont_bother_me_until_you_are_done -f go_away.dat &
would go into the running processes, leaving your command prompt available for further commands.

Some other useful commands:

When a process is running from your command prompt: ^z = (control-z) suspend current process
To "background" that process: bg
To bring that backgrounded process back to the command prompt ("foreground"): fg

and so forth...
[url=http://murga-linux.com/puppy/viewtopic.php?t=58615]Add swapfile[/url]
[url=http://wellminded.net63.net/]WellMinded Search[/url]
[url=http://puppylinux.us/psearch.html]PuppyLinux.US Search[/url]

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

double ampersand

#75 Post by don570 »

I think I learned about the double ampersand when
I read a book about Unix a couple of years ago.
Linux does things different obviously.
When in Rome do as the Romans do.

_________________________________________

User avatar
RetroTechGuy
Posts: 2947
Joined: Tue 15 Dec 2009, 17:20
Location: USA

Re: double ampersand

#76 Post by RetroTechGuy »

don570 wrote:I think I learned about the double ampersand when
I read a book about Unix a couple of years ago.
Linux does things different obviously.
I think I learned that under SunOS (erm...a couple decades ago)... Which also worked under Slackware, Debian, etc...
When in Rome do as the Romans do.
When incognito, do as the cognito do... :lol:
[url=http://murga-linux.com/puppy/viewtopic.php?t=58615]Add swapfile[/url]
[url=http://wellminded.net63.net/]WellMinded Search[/url]
[url=http://puppylinux.us/psearch.html]PuppyLinux.US Search[/url]

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

double ampersand

#77 Post by don570 »

I remember now . I was installing netbsd unix
on an old mac computer and I started
reading about unix.

Here's the reference

Visual Quickstart Guide
Unix Third Edition

by Deborah S. Ray and Eric J. Ray

Code: Select all

If you use && to combine commands,
the system will run both in sequence but
run the second only if the first succeeds.
For example, you could use 

mv  todolist  todolist.done  &&  touch todolist 

to move your to-do list to a different file and
create a new to-do list.  If the first command 
fails  (for example, because you don't have 
permission to create a new file),  the second 
command won't run.
With Puppy linux there isn't many permissions issues,
so nobody uses the double ampersand.
Now I understand the confusion.
_______________________________________

User avatar
RetroTechGuy
Posts: 2947
Joined: Tue 15 Dec 2009, 17:20
Location: USA

Re: double ampersand

#78 Post by RetroTechGuy »

don570 wrote:I remember now . I was installing netbsd unix
on an old mac computer and I started
reading about unix.

Here's the reference

Visual Quickstart Guide
Unix Third Edition

by Deborah S. Ray and Eric J. Ray

Code: Select all

If you use && to combine commands,
the system will run both in sequence but
run the second only if the first succeeds.
For example, you could use 

mv  todolist  todolist.done  &&  touch todolist 

to move your to-do list to a different file and
create a new to-do list.  If the first command 
fails  (for example, because you don't have 
permission to create a new file),  the second 
command won't run.
Aha! That's a valid reason to have such a command, in addition to ";" (which runs regardless)

I learned something new today! Thanks Don!
With Puppy linux there isn't many permissions issues,
so nobody uses the double ampersand.
Now I understand the confusion.
Well, most people don't even use the command line any more, so...

I guess that I was aware that "&&" also worked, but because "&" is a "special character", I avoided it. From the error standpoint, I find that ";" is more well behaved -- and when it doesn't work, it doesn't do exceptionally strange things -- like backgrounding jobs... :wink:

BTW, it rather looked like part of the problem was that characters we being "quoted" rather than being operators...

There's that whole goofy list of special characters, such as: "&" versus "\&" and what's the really goofy one..."\\" which quotes "" as a character (I _think_)? ("" being the special character used for quoting, is difficult to "quote", so you have to "quote" it again...or is it twice more?)

Urgh!!!...
[url=http://murga-linux.com/puppy/viewtopic.php?t=58615]Add swapfile[/url]
[url=http://wellminded.net63.net/]WellMinded Search[/url]
[url=http://puppylinux.us/psearch.html]PuppyLinux.US Search[/url]

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

Re: double ampersand

#79 Post by jpeps »

RetroTechGuy wrote:
don570 wrote:I remember now . I was installing netbsd unix
on an old mac computer and I started
reading about unix.

Here's the reference

Visual Quickstart Guide
Unix Third Edition

by Deborah S. Ray and Eric J. Ray

Code: Select all

If you use && to combine commands,
the system will run both in sequence but
run the second only if the first succeeds.
For example, you could use 

mv  todolist  todolist.done  &&  touch todolist 

to move your to-do list to a different file and
create a new to-do list.  If the first command 
fails  (for example, because you don't have 
permission to create a new file),  the second 
command won't run.
Aha! That's a valid reason to have such a command, in addition to ";" (which runs regardless)

I learned something new today! Thanks Don!
With Puppy linux there isn't many permissions issues,
so nobody uses the double ampersand.
Now I understand the confusion.
Mostly I see "&&" used after after tests. If using ";" it's just a new line of code....quite different.

Code: Select all

[ "$1" = "" ] && echo "no arguments here" && exit 

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#80 Post by zigbert »

Version 0.9-3
See main post

Changelog
- New parameters to manage Pschedule from external apps
--> -e : edit a already defined command
--> -s : run silent. Do not show main window.

This makes it possible to use the Pschedule editor in other apps. Will be used by Pmusic 1.6.0

Post Reply