Post #275,506
12/11/06 6:48:22 PM
|
Go ahead
Write the lisp code the parse out particular tags. And explain it to him.
NOT YOU SCOTT!
|
Post #275,510
12/11/06 7:37:23 PM
|
get vi'ed :-) I dont use that shite
Any opinions expressed by me are mine alone, posted from my home computer, on my own time as a free american and do not reflect the opinions of any person or company that I have had professional relations with in the past 51 years. meep
reach me at [link|mailto:bill.oxley@cox.net|mailto:bill.oxley@cox.net]
|
Post #275,515
12/11/06 9:02:37 PM
|
Who the fsck writes LISP to use Emacs?
Regards,
-scott anderson
"Welcome to Rivendell, Mr. Anderson..."
|
Post #275,516
12/11/06 9:21:40 PM
|
Ok, fine.
Please show your solution in emacs.
|
Post #275,534
12/12/06 12:16:44 AM
|
I need more of the problem specifics
But it would be something along the lines of this keyboard macro:
^( ^s <name_of_tag ^f ^space ^s </name_of_tag> alt-b alt-b alt-b ^b ^b esc-x capitalize-region ^)
Then run the keyboard macro as many times as you need to. Basically it says, "find the next instance of the tag, mark everything in between the tag and the close tag as the region, then capitalize it".
It's a lot quicker to actually make the macro than it is to type it out, since you just do the editing commands you want to record. Probably 10-20 seconds to make the macro, then however long it takes to process the file.
Regards,
-scott anderson
"Welcome to Rivendell, Mr. Anderson..."
|
Post #275,541
12/12/06 6:54:49 AM
|
Hope it's a single file
Initial post a "a file full of shtuff" so no need to load and save a bunch.
|
Post #275,553
12/12/06 10:21:34 AM
|
As always, use the right tool for the job.
For the majority of my text munging needs, emacs keyboard macros are capable, fast and easy.
Regards,
-scott anderson
"Welcome to Rivendell, Mr. Anderson..."
|
Post #275,565
12/12/06 1:47:49 PM
|
Bunch of text mungers
its xml - thus a serialized object model.
Easier and more reliable to work on the dom I think.
But go ahead and live in your flat little world.
[link|http://www.blackbagops.net|Black Bag Operations Log]
[link|http://www.objectiveclips.com|Artificial Intelligence]
[link|http://www.badpage.info/seaside/html|Scrutinizer]
|
Post #275,569
12/12/06 2:25:35 PM
|
Er, come again?
20 seconds of work to do a one-off, vs. thinking and writing a program to do it the "correct" way. And what's the point of creating an object graph for the entire thing when he wants to change one tag's contents only?
I get work done. I don't worry too much about how I get it done unless it actually matters.
"flat little world"... Man, talk about your insults out of nowhere.
Regards,
-scott anderson
"Welcome to Rivendell, Mr. Anderson..."
|
Post #275,586
12/12/06 6:26:07 PM
|
thats our todd, no point manipulating some text
when you can write a hello world example only using 11MB's of libraries and manipulating some text. thanx, bill
Any opinions expressed by me are mine alone, posted from my home computer, on my own time as a free american and do not reflect the opinions of any person or company that I have had professional relations with in the past 51 years. meep
reach me at [link|mailto:bill.oxley@cox.net|mailto:bill.oxley@cox.net]
|
Post #275,609
12/12/06 10:18:52 PM
|
Probably smaller than emacs, though :-P
Regards,
-scott anderson
"Welcome to Rivendell, Mr. Anderson..."
|
Post #275,596
12/12/06 9:08:52 PM
12/12/06 9:15:23 PM
|
Eh? I did it in 3 lines.
Anyhow, I find it easier to modify data structures than to fiddle text- which is error prone. When the text represents a data structure, like source code or xml, modifying the parse tree is more reliable and, I think, easier.
Anyhow, you're taking me way too seriously. :-)
[link|http://www.blackbagops.net|Black Bag Operations Log]
[link|http://www.objectiveclips.com|Artificial Intelligence]
[link|http://www.badpage.info/seaside/html|Scrutinizer]
|
Post #275,624
12/12/06 11:12:08 PM
|
Re: Eh? I did it in 3 lines.
If I were going to do it more than once, sure. Otherwise it's a waste of time. Writing a keyboard macro is simple and quick, much quicker than even your 3 lines of code.
Regards,
-scott anderson
"Welcome to Rivendell, Mr. Anderson..."
|
Post #275,585
12/12/06 6:24:36 PM
|
emacs is xml?
Any opinions expressed by me are mine alone, posted from my home computer, on my own time as a free american and do not reflect the opinions of any person or company that I have had professional relations with in the past 51 years. meep
reach me at [link|mailto:bill.oxley@cox.net|mailto:bill.oxley@cox.net]
|
Post #275,535
12/12/06 12:24:14 AM
|
Re: Ok, fine.
The following macro:
;; Keyboard Macro Editor. Press C-c C-c to finish; press C-x k RET to cancel. ;; Original keys: C-s <attr 2*M-f 2*C-f C-SPC C-s </att 5*C-b ESC xcapital TAB reg TAB RET
Command: last-kbd-macro Key: none
Macro:
C-s\t\t\t;; isearch-forward <attr\t\t\t;; self-insert-command * 5 2*M-f\t\t\t;; forward-word 2*C-f\t\t\t;; forward-char C-SPC\t\t\t;; set-mark-command C-s\t\t\t;; isearch-forward </att\t\t\t;; self-insert-command * 5 5*C-b\t\t\t;; backward-char ESC xcapital\t\t;; self-insert-command * 4 TAB\t\t\t;; lisp-indent-line reg\t\t\t;; self-insert-command * 3 TAB\t\t\t;; lisp-indent-line RET\t\t\t;; newline
Used on the following:
asdsgas<attr ibute="foo">DINGLE_BERRIES</attr>jlj;lj;l <attr ibute="foo">DINGLE_BERRIES</attr><moo>on you</moo> <attr ibute="foo">DINGLE_BERRIES</attr><barry>likes herrings</barry> <attr ibute="foo">DINGLE_BERRIES</attr>
Produces:
asdsgas<attr ibute="foo">Dingle_Berries</attr> jlj;lj;l<attr ibute="foo">Dingle_Berries</attr><moo>on you</moo> <attr ibute="foo">Dingle_Berries</attr> <barry>likes herrings</barry> <attr ibute="foo">Dingle_Berries</attr>
Like I said, the exact form of the macro is going to depend on the specific data.
The macro above is suitable for pasting into ^x^k^xe, incidentally. ;-)
Regards,
-scott anderson
"Welcome to Rivendell, Mr. Anderson..."
|