Stefan Ritt wrote: |
Steve Jones wrote: | This may sound a little strange but I am trying to determine if it is possible to create a series of attributes that may be assigned an integer value via OPTIONS, and then take the selected values and perform some simple math and display the result. |
This item is already on the wishlist, so I added your vote there. But due to my workload, it will certainly not be implemented in the next few weeks. |
Quote: |
Ok, understood. So instead I am trying to use $shell and am running into a problem
##################################################
# Define Risk1
#
Options Risk1 = 10, 20, 30, 40, 50, 60, 70, 80, 90, 100
##################################################
# Define Risk2
#
Options Risk2 = 10, 20, 30, 40, 50, 60, 70, 80, 90, 100
##################################################
# Define Risk2
#
Options Risk3 = 10, 20, 30, 40, 50, 60, 70, 80, 90, 100
##################################################
# Define TotalRisk
#
Subst TotalRisk = $shell(echo $Risk1 + $Risk2 + $Risk3 > /tmp/elog_out)
#Subst TotalRisk = $shell(gawk 'BEGIN{ print $Risk1 + $Risk2 + $Risk3 }' )
#Subst TotalRisk = $shell(uname -a)
What comes out with my simple echo or gawk line is "+ + " so it looks like the attributes are not getting passed into the $shell code? |
1793
|
Wed Apr 5 10:07:59 2006 |
| Stefan Ritt | stefan.ritt@psi.ch | Request | | 2.6.1 | Re: Simple math within an elog form |
Steve Jones wrote: |
Subst TotalRisk = $shell(echo $Risk1 + $Risk2 + $Risk3 > /tmp/elog_out)
What comes out with my simple echo or gawk line is "+ + " so it looks like the attributes are not getting passed into the $shell code? |
The reason is that the substitutions get evaluated from left to right, so first the shell is called with $Risk1, and because the shell by itself does a subsitution and $Risk1 is not defined on the unix system, the shell returns an empty string, leading to "+ +" as the result.
I changed that in the current SVN version, so we have first the attribute substitions, then then shell substitution. The "echo $Risk1..." will of course not work, since it gets substituted by elog as "echo 12 + 23 + 45" (or whatever the numbers are), and the "echo" will just return these numbers without adding them. To make the shell to add things, you would need to define the risks as environment variables for the shell, so I guess the "gawk" method will work better for you. I tried it and it worked fine for me. |
1794
|
Wed Apr 5 13:50:14 2006 |
| Steve Jones | steve.jones@freescale.com | Request | | 2.6.1 | Re: Simple math within an elog form |
Stefan Ritt wrote: |
Steve Jones wrote: |
Subst TotalRisk = $shell(echo $Risk1 + $Risk2 + $Risk3 > /tmp/elog_out)
What comes out with my simple echo or gawk line is "+ + " so it looks like the attributes are not getting passed into the $shell code? |
The reason is that the substitutions get evaluated from left to right, so first the shell is called with $Risk1, and because the shell by itself does a subsitution and $Risk1 is not defined on the unix system, the shell returns an empty string, leading to "+ +" as the result.
I changed that in the current SVN version, so we have first the attribute substitions, then then shell substitution. The "echo $Risk1..." will of course not work, since it gets substituted by elog as "echo 12 + 23 + 45" (or whatever the numbers are), and the "echo" will just return these numbers without adding them. To make the shell to add things, you would need to define the risks as environment variables for the shell, so I guess the "gawk" method will work better for you. I tried it and it worked fine for me. |
Sorry, I waSn't clear about just why I was using "echo". Since elog removes the /tmp/elog_shell temporary file I couldn't "see" what was actually being passed to the shell - gawk was giving me an error and I was flying blind. So I used echo to create my own temporary file.
Yes, gawk should now work -- I'l download and compile the latest and provide feedback.
Thanks! |
1797
|
Wed Apr 5 22:48:49 2006 |
| Steve Jones | steve.jones@freescale.com | Question | All | 2.6.1-1684 | Re: Triggering Re: Triggering $shell question |
Steve Jones wrote: | Should this work? rev1684 now allows $shell to pass attribute contents to the shell command and whenever a new entry is submitted or when one Edits/Replys the Subst is triggered, but I would like to be able to trigger this whenever a new value in the options pulldown is selected (assume Risk2 and Risk3 are identical to Risk1). Being able to trigger a regular Preset works fine (like {1} preset Date = $date ) but I would like to trigger the Subst. Maybe a better question, what actions (Subst, Preset, Change, Execute, etc.) I've tried Subst and Preset but not much luck.
##################################################
# Define Risk1
#
Options Risk1 = 10{30}, 20{31}, 30{32}, 40{33}, 50{34}, 60{35}, 70{36}, 80{37}, 90{38}, 100{39}
{30,31,32,33,34,35,36,37,38,39} Subst TotalRisk = $shell(gawk 'BEGIN{ print $Risk1 + $Risk2 + $Risk3 }' )
|
Hmm, maybe I can answer my own question - until the form is saved with the new value selected the old values still exist. I guess what I really need is to trigger the $shell anytime a save happens or logentry is pulled in for edit. I think I do the latter with Subst on edit/Subst on Reply, but how on any save?
. . . Except that when I change an options field that has a dependencies, doesn't the javascript force a server-side revalidation? |
1800
|
Fri Apr 7 05:07:20 2006 |
| Steve Jones | steve.jones@freescale.com | Bug report | All | 2.6.1-1668 | Re: elogd 2.6.1 program Crash is repeatable under Windows |
Stefan Ritt wrote: |
Steve Jones wrote: | BTW, Stefan, unless you can make the most recent version of a Windows eLog available I cannot test the most recent -- I do not have access to a Windows development environment. Solaris-Yes, Linux-Yes, Windoze-No. |
There is a 2.6.1-4 version for Windows for download, which contains the most recent code. |
Quote: | Ok, I loaded the new Windows version ELOG V2.6.1-1681. The new version has the same behavior and it is entirely related to Top Group. With a simple Top Group setup things appear to work fine until one attempts to either create or delete a new logbook. There are other quirky things - I don't think Top Group is ready for really complex setups. In fact, this URL that is constructed by elog (http://localhost:8080/Engineering%20Compute%20Change%20Logs/Test/?cmd=Config) will cause elog to coredump but only with a very complex configfile. If I simply remove the "Top" from the "Group" directive I get the expected message "Error: logbook "Engineering Compute Change Logs" not defined in elogd.cfg
Please use your browser's back button to go back".
Another interesting point of reference - I went back to 2.5.9-4 (windows) and get the same behavior.
Now, making things really simple I added Top Group support to the demo that comes with the Windows install. This configfile:
[global]
port = 8080
Show top groups = 1
Top Group Demo Groups = demo, test7
[global Demo Groups]
Theme = default
Comment = General linux tips & tricks
Attributes = Author, Type, Category, Subject
Options Type = Routine, Software Installation, Problem Fixed, Configuration, Other
Options Category = General, Hardware, Software, Network, Other
Extendable Options = Category
Required Attributes = Author, Type
Page Title = ELOG - $subject
Reverse sort = 1
Quick filter = Date, Type
[demo]
results in this redisplay after a new logbook create I have included in an attached screenshot. Please note that everything is generally not correct. So, even though eLog does not crash with this simple config it does support my observation that as I render the congfile more complex I corrupt eLog more until it finally crashes. Stefan, I would be interested in seeing how the above config runs on one of your windows systems. |
Attachment 1: elog_2.JPG
|
|
1801
|
Fri Apr 7 10:29:49 2006 |
| Stefan Ritt | stefan.ritt@psi.ch | Question | Linux | 2.6.1-1671 | Re: elog client authentication and attachment comment |
Yoshio Imai wrote: | Until revision 1642, it was possible to submit entries to a password-protected logbook using the elog client without supplying authentication information. With revision 1671 this is no longer possible. In principle this is good. However, many of our run control programs use the elog client (via rsh to the elog server computer) to submit automatic entries, which fails now. In order for this mechanism to work again, we would have to change the command-line call in the sources, including now the password in clear text. Since this can be considered a security issue, we would like to avoid it if at all possible. I guess my request would go in the direction of PAM support, but would it be possible to revert to the old behaviour as an option? (If you tell me where in the code to look, we could probably also comment out the respective lines ourselves so that you don't have extra work...) |
There was a quite strong request to not allow unauthorized access via the elog utility. People were also able to submit entries with the "curl" program without supplying authorization. So I rather would not like to go back to the old version. But I would propose a different scheme: We could save the username/password in a file on the server, which is maybe readable only by the owner. Then one could call elog with
elog ... -u @filename
so that the user name and password gets retrieved from the file on the server. This way the password does not have to be passwd over the network. BTW, you also could use ssh instead of rsh to prevent password being sent over the network in plain text.
Quote: |
The second remark is about attachment comments. When editing a logbook entry, the attachment upload buttons appear again, but without the comment. Shouldn't it be there, too? |
I'll have a look and fix it. |
1803
|
Mon Apr 10 20:08:02 2006 |
| Yoshio Imai | | Question | Linux | 2.6.1-1671 | Re: elog client authentication and attachment comment |
Stefan Ritt wrote: | We could save the username/password in a file on the server, which is maybe readable only by the owner. |
I have discussed it with the others, and it sounds like a good idea. There is only the debate whether it should be readable by the owner or by the root user of the elog server. I can't tell at the moment which is more favourable ... |
1807
|
Thu Apr 13 09:07:24 2006 |
| Stefan Ritt | stefan.ritt@psi.ch | Question | All | | Re: Can a field value be calculated during display? |
Sridhar Anandakrishnan wrote: | I have a logbook which is a Calendar/Appointment book with Attributes: "Appointment DateTime", Place, etc.
I would like another Attribute called "When" whose value is calculated from Today's Date - Appointment date (so for example I could display today's appointments in red...). This calculation has to take place each time the logbook is displayed...
Possible? Useful? |
No.
ELOG is an electronic logbok and should not be used as a full calendar application. There are much better packages for that, like PHP groupware. Better use one of those packages. |
|
ELOG V3.1.5-3fb85fa6 |