Back
[13:02:54] <SWP_Away> hi Ray
[13:03:01] <SWP_Away> SWP_Away is now known as SWPadnos
[13:03:57] <rayh> Hi Steven.
[13:04:40] <SWPadnos> are you pointed at the new website yet?
[13:05:01] <rayh> Yes I got it after about 5 hours yesterday.
[13:05:08] <rayh> How about you?
[13:05:09] <SWPadnos> cool.
[13:05:10] <SWPadnos> yep
[13:05:26] <SWPadnos> I checked it around midnight, and fixed the references to cncgear
[13:05:40] <rayh> Ah good. Thanks.
[13:05:52] <SWPadnos> I may try removing the mapped directory today, as long as alex is online ;)
[13:06:19] <rayh> I posted a note to the board regarding editoral policy for the site.
[13:06:48] <SWPadnos> ok. let me know what you need for logins
[13:06:58] <SWPadnos> (that alex can't provide through joomla)
[13:07:16] <alex_joni> hello
[13:07:17] <rayh> Ah right. I forgot that there are two ways in.
[13:07:22] <rayh> Hi alex.
[13:07:31] <SWPadnos> hi again
[13:07:46] <alex_joni> rayh: I moved most of the historic stuff to Events
[13:07:57] <rayh> Good.
[13:07:58] <alex_joni> http://www.linuxcnc.org/index.php?option=com_content&task=blogcategory&id=15&Itemid=12
[13:08:51] <alex_joni> rayh: I agree with your mail to the board list
[13:08:55] <rayh> Wow, you do nice work.
[13:09:11] <rayh> I nominate alex for publisher.
[13:09:43] <SWPadnos> heh
[13:10:09] <alex_joni> rayh: I can do that ;)
[13:10:38] <alex_joni> as long as I have more days like today (aka free ;)
[13:11:16] <rayh> IMO we ought to search out a dependable "non core" person for this job.
[13:12:08] <alex_joni> rayh: I think doing it as a side job is good enough
[13:12:32] <rayh> someday we should post a note to the lists with a real publisher job description
[13:12:41] <alex_joni> right, that would be ideal
[13:12:53] <rayh> and see if we get any replies.
[13:13:31] <alex_joni> yeah.. I'd doubt it
[13:14:16] <rayh> Might be difficult to find at our rate of pay.
[13:14:37] <alex_joni> this is not a matter of pay ;)
[13:14:42] <alex_joni> it's a matter of interest
[13:14:59] <rayh> It's a calling, a profession, a religion.
[13:15:06] <alex_joni> yup
[13:15:16] <alex_joni> and if you don't got it.. even pay won't help :)
[13:15:33] <alex_joni> darn, I hate beeing sick :(
[13:15:38] <rayh> How true!
[13:15:59] <alex_joni> caught a cold again ..
[13:16:03] <rayh> I was for months this year. Just now beginning to get better.
[13:16:44] <alex_joni> this should be a small thing, I hope
[13:16:45] <rayh> poached eggs on hot milk toast with pools of butter.
[13:16:47] <alex_joni> 2-3 days at most
[13:17:02] <alex_joni> heh, trying to get me fat too?
[13:17:07] <alex_joni> isn't sick enough :D
[13:17:27] <alex_joni> kidding ;), thanks for the advice
[13:17:51] <rayh> It's a personal thing for when you feel the cold letting up.
[13:22:30] <alex_joni> do you know "ColdRex" ?
[13:22:53] <alex_joni> that's what I'm taking now
[13:23:21] <SWPadnos> ok. I just deleted the cncgear/joomla mapping. it should go away within the next few minutes
[13:23:22] <rayh> I don't.
[13:23:52] <alex_joni> rayh: it's a mixture of Paracetamol, Pseudoephedrine, VItamin C, etc
[13:24:00] <alex_joni> you mix it up with hot water, like a tea
[13:24:04] <rayh> I need help with line 251 or there abouts.
[13:24:13] <alex_joni> line 251?
[13:24:14] <rayh> Ah. Sounds good.
[13:24:23] <rayh> in emccalib.tcl
[13:24:34] <alex_joni> the commited one?
[13:24:49] <rayh> Yes. last night.
[13:26:04] <alex_joni> hang on
[13:26:06] <alex_joni> cvs up
[13:26:10] <rayh> MAX_VELOCITY = 1.0 <-- 1.0
[13:26:28] <rayh> What I did was read through the ini for sections.
[13:26:59] <rayh> In save I read each line of a section, if it's not a comment I compare it's varname
[13:27:07] <rayh> With a list I get from HAL.
[13:27:23] <alex_joni> huh, slow down a bit..
[13:27:35] <rayh> k
[13:27:48] <alex_joni> ok, so set browses sections
[13:27:56] <alex_joni> up to nextsectnum
[13:27:58] <rayh> right.
[13:28:10] <alex_joni> err.. ind browses sections
[13:28:31] <rayh> yep
[13:28:35] <alex_joni> ok, if it's a comment, do nothing
[13:28:42] <alex_joni> else {
[13:29:04] <alex_joni> not sure what tmpstr & var & indx do
[13:29:24] <rayh> read the line into a string "tmpstr"
[13:29:35] <alex_joni> ok
[13:29:45] <alex_joni> var takes the leftmost thing?
[13:30:13] <alex_joni> and tmpindx gets set if it's one that's nteresting?
[13:30:23] <alex_joni> from $upvarnames
[13:30:48] <rayh> Right.
[13:31:14] <rayh> Then look for the hal command that returns the value of that variable.
[13:31:32] <rayh> Issue that command and get the value.
[13:32:05] <rayh> We can't compare the hal returned value with the ini stored value.
[13:32:30] <rayh> cause hal returns floats and such and ini makes several assumptions.
[13:32:37] <alex_joni> right
[13:33:01] <rayh> Now back to the earlier line.
[13:33:10] <rayh> MAX_VELOCITY = 1.0 <-- 1.0
[13:33:17] <rayh> phone
[13:37:14] <SWPadnos> so, I'm thinking about access rights for the joomla stuff
[13:42:14] <alex_joni> SWPadnos: right
[13:42:51] <SWPadnos> I think all I need to do is change the permissions on all the files to g+w
[13:43:06] <alex_joni> I see
[13:55:29] <rayh> Wow. That's an awesome post alex.
[13:55:52] <rayh> We need that to be contained in the site someplace.
[13:58:17] <alex_joni> hmm.. replicating joomla documentation is not a very easy job ;) filtering it isn't either
[13:58:22] <rayh> Someplace "How to get involved with linuxcnc.org.
[13:58:58] <rayh> I saw some of that when I tried to find out what a mobot was.
[13:59:07] <alex_joni> mambot ;)
[13:59:23] <rayh> that's it.
[13:59:27] <alex_joni> close enough though :
[13:59:29] <alex_joni> :D
[14:00:39] <rayh> You got a few more minutes for emcconf?
[14:01:05] <alex_joni> sure, although I don't get much of it ;)
[14:01:09] <alex_joni> just looking along..
[14:01:28] <rayh> If you look at. MAX_VELOCITY = 1.0 <-- 1.0
[14:01:52] <rayh> That's the return from puts "$tmpstr <-- $newval "
[14:01:56] <alex_joni> right
[14:02:21] <rayh> for one ind
[14:02:48] <rayh> all before the back arrow is string. After is hal value.
[14:02:59] <SWPadnos> use get instead of show
[14:03:18] <SWPadnos> ah - nevermind
[14:03:20] <rayh> okay.
[14:03:35] <rayh> What does get get?
[14:03:45] <alex_joni> get gets get
[14:03:56] <SWPadnos> get is like show, but returns only the value
[14:04:04] <rayh> oh.
[14:04:08] <rayh> okay.
[14:04:32] <SWPadnos> I think that's what jmk said
[14:04:36] <rayh> What i need to do is stuff the value into the proper place in the string.
[14:04:42] <SWPadnos> but that isn't the issue here
[14:05:02] <SWPadnos> right.
[14:05:06] <rayh> I know how to return the string to the text widget.
[14:05:22] <rayh> and how to save the text to a file.
[14:05:27] <SWPadnos> yep - splitting it up the way you want is harder
[14:05:54] <rayh> but I'll be damned if I can figure a clean way to make the new string look like the old.
[14:06:02] <SWPadnos> yeah
[14:06:19] <SWPadnos> luckily, there's a pretty well-known format for these lines
[14:06:56] <rayh> format stuff is probably my strongest inability.
[14:07:03] <SWPadnos> it's always name (whitespace) = (whitespace) value (whitespace + comment)
[14:07:17] <SWPadnos> with the stuff in parens being optional
[14:07:47] <SWPadnos> one thing you can do is search for the first non-whitespace character after the =
[14:07:51] <SWPadnos> that's where the new value goes
[14:08:24] <rayh> Okay I might be able to figure that command.
[14:08:37] <SWPadnos> I'm not sure how to do that in tcl
[14:08:46] <SWPadnos> (I'm not sure how to do anything in tcl)
[14:08:47] <rayh> string match
[14:08:50] <SWPadnos> yep
[14:09:20] <rayh> but then I get into glob, regexp and I'm lost again.
[14:09:38] <SWPadnos> the regexp for the beginning would be something like .*=[ \t]*
[14:09:40] <rayh> The easy way is to split the string on whitespace
[14:09:52] <rayh> replace #2 with the new val
[14:09:54] <SWPadnos> but you want to keep the whitespace the same - that's the hard part
[14:10:22] <rayh> I DONT want to. But I think folk will want me to.
[14:10:27] <SWPadnos> hmmm - actually, you can probably do two matches. one for the stuff before the value, and one after.
[14:10:34] <SWPadnos> yes, you definitely should ;)
[14:10:57] <rayh> See I tol' ya so.
[14:11:02] <SWPadnos> heh
[14:11:19] <SWPadnos> it's annoying to have a program change the nice formatting I've set up in my files
[14:11:27] <rayh> What happens to whitespace when the value goes from 10 to 10000
[14:11:40] <SWPadnos> that's a different story
[14:11:53] <rayh> or 10 to 100.1234
[14:11:53] <alex_joni> this gets easily done with a printf
[14:11:59] <SWPadnos> I suspect that there aren't many people who have comments on the same line as the PID values
[14:12:05] <SWPadnos> it's still not that easy
[14:12:07] <rayh> I like the sound of easily
[14:12:09] <alex_joni> trailing and ending whitespaces ;)
[14:12:53] <rayh> Now I wouldn't have to do string manipulation here.
[14:13:20] <rayh> The text widget itself has many find and replace procedures.
[14:13:42] <rayh> I just don't know them well enough to be able to handle it.
[14:14:05] <SWPadnos> and whitespace isn't maintained by tcl8
[14:14:26] <SWPadnos> so you could replace tmpstr[3] with the new value, but it won't be formatted correctly
[14:14:58] <SWPadnos> (though that would require spaces around the = sign, which I'm not sure are required otherwise)
[14:16:02] <SWPadnos> a regexp can do this easily, once the hard part of figuring out the regexp is done ;)
[14:24:41] <SWPadnos> I think sed may help here
[14:25:31] <alex_joni> that's sad I think
[14:25:32] <alex_joni> :)
[14:25:40] <rayh> I've got to be away for a while. Perhaps we can work on this later.
[14:26:04] <SWPadnos> ok. I'll experiment with regular expressions a bit
[14:26:12] <rayh> Thanks guys.
[14:29:32] <SWPadnos> woohoo - got it in one try ;)
[14:30:13] <SWPadnos> (except that I forgot the s command)
[14:31:27] <alex_joni> scroll back ?
[14:31:44] <SWPadnos> variable replacement while maintaining whitespace
[14:32:09] <SWPadnos> sed -e 's/\(^.*=[[:blank:]]*\)[[:graph:]]*\(.*\)/\1NewVar\2/'
[14:32:15] <SWPadnos> simple, no?
[14:32:17] <SWPadnos> :)
[14:34:39] <alex_joni> sure seems like it
[14:34:45] <SWPadnos> heh
[14:35:04] <SWPadnos> I'm not sure quite how to get tcl to execute that, but it works
[14:35:33] <alex_joni> exec something
[14:35:46] <alex_joni> [ exec 'sed -e ...' ]
[14:35:47] <alex_joni> I think
[14:35:59] <SWPadnos> yep - it's the escaping that may be a problem
[15:13:34] <jepler> http://emergent.unpy.net/index.cgi-files/sandbox/replace.tcl
[15:14:05] <jepler> this program preserves whitespace on the left and the right of the "=" but not after the value.
[15:15:09] <alex_joni> hi jeff
[15:15:44] <SWPadnos> ok.
[15:15:50] <jepler> hi alex_joni
[15:15:59] <SWPadnos> Hi Jeff :)
[15:16:28] <SWPadnos> is there a reasonably easy way of making the regexp above work in TCL?
[15:16:54] <SWPadnos> proper shell escaping and tcl variable replacement looks like it could be tricky
[15:17:36] <jepler> the re_syntax manpage for tcl mensions :class: support, so it might just work as written. tcl does have a 'regsub' command.
[15:18:33] <SWPadnos> oh, OK. that should work then
[15:19:04] <jepler> shelling out to sed sounds like a "worst idea ever" kind of thing to me.
[15:19:19] <SWPadnos> heh - I agree, but it was
[15:19:31] <SWPadnos> the easiest way to try out the regexps
[15:26:50] <alex_joni> is that really matt?
[15:30:12] <SWPadnos> it's a mattbot
[15:30:47] <alex_joni> yeah, too bad ;)
[17:12:55] <alex_joni> 44ok, then lets do the branch
[17:37:43] <SWPadnos> alex_joni_, are you around?
[17:38:01] <alex_joni> yeah
[17:38:04] <alex_joni> but without the _
[17:38:09] <SWPadnos> ah
[17:38:12] <alex_joni> I can get one if you fancy
[17:38:18] <SWPadnos> I figured that an alert would go to both if I used the _
[17:38:41] <alex_joni> sshh: don't tell anyone, but my alert is on 'alex'
[17:38:47] <alex_joni> so the rest doesn't matter ;)
[17:38:56] <SWPadnos> I have a tcl command that does the variable substitution, preserving whitespace
[17:38:58] <SWPadnos> ah, ok
[17:39:09] <alex_joni> SWPadnos: good for you :D
[17:39:10] <SWPadnos> but I'm not sure how to test it
[17:39:23] <alex_joni> put it in ray's emccalib?
[17:39:27] <alex_joni> * alex_joni is not sure either
[17:39:37] <SWPadnos> I can just commit the change to emccalib.tcl, and see what falls apart
[17:39:46] <alex_joni> probably nothing
[17:39:52] <alex_joni> as emccalib is not used right now
[17:40:01] <alex_joni> and it will only get used by users
[17:40:02] <SWPadnos> I'd like to be able to explain it to Ray, but I need to go do some other stuff
[17:40:10] <alex_joni> so you can't brake anything
[17:40:24] <SWPadnos> that's unlikely ;)
[17:40:40] <SWPadnos> it's an annoyingly simple line:
[17:40:46] <SWPadnos> regsub {(^.*=[ \t]*)[^ \t]*(.*)} $tmpstr "\\1$newval\\2" newvar
[17:41:07] <SWPadnos> jepler told me about regsub, which helped a lot ;)
[17:45:31] <alex_joni> SWPadnos: go ahead, and commit
[17:45:37] <SWPadnos> in process ;)
[17:47:54] <SWPadnos> ok. gotta run now. see you later
[17:48:02] <SWPadnos> SWPadnos is now known as SWP_Away
[17:48:10] <alex_joni> yup, later
[22:18:05] <rayh> logger_devel, bookmark
[22:18:05] <rayh> See
http://solaris.cs.utt.ro/irc/irc.freenode.net:6667/emcdevel/2006-03-28#T22-18-05
[22:28:18] <SWP_Away> hiya Ray
[22:35:00] <rayh> Hi Steven. Thanks for the fix. I believe that's got it.
[22:35:10] <SWP_Away> cooo. I wasn't sure how to check it
[22:35:12] <SWP_Away> cool
[22:35:30] <SWP_Away> do you see how it works?
[22:35:33] <rayh> Testing the scientific notation to see if that survives.
[22:36:02] <rayh> I'm trusting you. I can read it but that's about all.
[22:36:14] <SWP_Away> you can change the regsub to a regexp, and have it extract the current value for you
[22:36:31] <SWP_Away> you'd then need to stick the parts back together
[22:36:37] <SWP_Away> SWP_Away is now known as SWPadnos
[22:38:02] <rayh> I'm a newbee to reg anything. I used it a couple times but...
[22:38:09] <SWPadnos> here
[22:38:21] <SWPadnos> here's the regexp (one sec - want to make it more readable)
[22:38:42] <rayh> I have an extractor emc_ini
[22:39:03] <rayh> but of course that requires emcsh as the wish shell
[22:39:57] <SWPadnos> this would just need a string, so it can be used anywhere you have an ini-style string
[22:40:07] <SWPadnos> regexp {(^.*=[ \t]*)([^ \t]*)(.*)} $tmpstr original varname oldval comment
[22:40:09] <SWPadnos> puts "varname = $varname"
[22:40:11] <SWPadnos> puts "oldval = $oldval"
[22:40:12] <SWPadnos> puts "comment = $comment"
[22:40:14] <SWPadnos> puts "$varname$newval$comment"
[22:41:15] <rayh> Thanks.
[22:41:15] <SWPadnos> you can do whatever you want to figure out the number of decimals and that sort of thing, if it's done before that last puts
[22:41:18] <SWPadnos> sure
[22:42:48] <SWPadnos> I can explain how it works, if you think you might want to change it
[22:44:36] <rayh> Okay try it on me.
[22:45:09] <SWPadnos> ok. first, the braces are just so I don't have to \-escape every other character ;)
[22:45:21] <rayh> Right.
[22:45:40] <SWPadnos> first off, anything in () is a subexpression
[22:46:21] <SWPadnos> so the first is ^ (beginning of line) .* (any number of any character) = [ \t]* (any number of whitespace chars)
[22:46:22] <rayh> so three of them
[22:46:24] <SWPadnos> yep
[22:46:59] <SWPadnos> the regexp command splits the first thing after the regexp into (1) the whole found expression (in this case, the whole line, getting put into orig)
[22:47:21] <SWPadnos> then it puts any matched subexpressions into the remaining vars (varname, oldval, comment)
[22:47:39] <SWPadnos> so the first expression is everything up to the '=', plus whitespace
[22:47:54] <SWPadnos> the second (oops - subexpression) is any non-whitespace chars
[22:48:08] <SWPadnos> the third is everything else on the line (any number of any character)
[22:48:40] <rayh> Okay. I see at least some of that.
[22:48:46] <SWPadnos> easy as pie ;)
[22:48:57] <SWPadnos> (for those who've necer tried to make pie)
[22:48:59] <SWPadnos> never
[22:49:17] <rayh> I did test on output scale which is var = val1 val2
[22:49:25] <SWPadnos> that wouldn't work ;)
[22:49:28] <rayh> And it works fine.
[22:49:44] <SWPadnos> it should only have found the first value, not the offset
[22:50:15] <rayh> Right it replaced only the first val
[22:50:23] <rayh> and left the second intact.
[22:50:28] <SWPadnos> if you want to replace the offset, you're hosed
[22:50:30] <SWPadnos> right
[22:50:48] <rayh> I don't even know what hal does with the offset.
[22:51:02] <rayh> probably ignores it like we always do.
[22:51:05] <SWPadnos> I don't think it's used
[22:51:33] <SWPadnos> in fact, it may cause an error (ignored) in the conversion to float
[22:52:44] <rayh> I've used set newval [expr $newval] to convert sci notation to float.
[22:53:04] <rayh> But it does not work for 1.5e-05
[22:53:14] <SWPadnos> hmmm - it should
[22:54:16] <rayh> I don't really want to see sci notation for deadband.
[22:55:11] <SWPadnos> ok - I thought you were saying the tcl command set newval [expr $newval] didn't work for "1.5e-05"
[22:58:21] <rayh> I'm thinking I need the format command in order to convert to floating point.
[22:58:50] <SWPadnos> format would definitely give you more control
[22:59:17] <SWPadnos> there's probably a way to look at the original value, and choose the number of decimals fromthere
[23:00:32] <SWPadnos> it would be a pain though, and probably not worth it
[23:04:15] <SWPadnos> well, gotta run for a bit. see you later
[23:04:30] <SWPadnos> SWPadnos is now known as SWP_Away
[23:24:45] <jepler> SWP_Away: That regexp you wrote says something about "comment"
[23:25:11] <jepler> SWP_Away: in the inifile format of emc2, it seems that the value exends from the first non-whitespace character after the "=" to the end of the line
[23:25:20] <jepler> SWP_Away: there is no "comment" possible on such a line
[23:26:11] <rayh> There are dual values in the OUTPUT_SCALE variable.
[23:26:21] <rayh> But that seems to be a throwback to emc.
[23:28:31] <jepler> From the viewpoint of the inifile library, all the values are strings
[23:30:04] <jepler> trailing whitespace is trimmed, but neither whitespace nor "#" indicate a comment
[23:30:16] <jepler> [SECTION]
[23:30:17] <jepler> EXAMPLE = 3 # of radishes
[23:30:23] <jepler> echo .$(emc2/bin/inivar -var EXAMPLE -sec SECTION -ini example.ini).
[23:30:23] <jepler> .3 # of radishes.
[23:38:02] <rayh> Okay.
[23:38:28] <rayh> The # has to start a line which then is only a comment.