<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/5546" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2003-09-10T18:36:37-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/5546</id>

		<entry>
		<author><name><![CDATA[Sc0rp]]></name></author>
		<updated>2003-09-10T18:36:37-04:00</updated>

		<published>2003-09-10T18:36:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26918#p26918</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26918#p26918"/>
		<title type="html"><![CDATA[Re: Replacing spaces with %20]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26918#p26918"><![CDATA[
<blockquote class="uncited"><div><blockquote class="uncited"><div>Ive written a little tcl script that gets the content of a php page Ive set..<br><br>everything works fine untill the 'thing' (username in this case) I want to retreive has spaces in it..<br>cus then the bot somehow replaces the space with a character which the webserver does not understand..<br>so.. what I want to do is replace a space with %20 which is a space for internet browsers when used in the address.. (duh <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile">)<br>problem is im kinda new at tcl scripting and I dont know how to replace stuff..<br><br>so my question is HOW can I replace a space with %20 <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"></div></blockquote><div class="codebox"><p>Code: </p><pre><code>first reply worked just perfect.. thanks a lot mate :)regsub -all " " $text "%20" text</code></pre></div>or <br><div class="codebox"><p>Code: </p><pre><code>set text [string map {" " "%20"} $text]</code></pre></div>I prefer the first method myself..<br><br>also, a better place to start before asking for commands, is the tcl manpages.</div></blockquote><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3819">Sc0rp</a> — Wed Sep 10, 2003 6:36 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2003-09-10T12:45:48-04:00</updated>

		<published>2003-09-10T12:45:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26892#p26892</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26892#p26892"/>
		<title type="html"><![CDATA[Replacing spaces with %20]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26892#p26892"><![CDATA[
ok, thanx for the info <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Wed Sep 10, 2003 12:45 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[egghead]]></name></author>
		<updated>2003-09-10T12:34:58-04:00</updated>

		<published>2003-09-10T12:34:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26891#p26891</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26891#p26891"/>
		<title type="html"><![CDATA[Replacing spaces with %20]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26891#p26891"><![CDATA[
<blockquote class="uncited"><div>It's not been part of eggdrop for a while. But there's a proc called "time" in scripts/compat.tcl.</div></blockquote>Thats the culprit indeed. Thanks.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=282">egghead</a> — Wed Sep 10, 2003 12:34 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-09-10T12:21:46-04:00</updated>

		<published>2003-09-10T12:21:46-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26890#p26890</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26890#p26890"/>
		<title type="html"><![CDATA[Replacing spaces with %20]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26890#p26890"><![CDATA[
<blockquote class="uncited"><div>so why is it less time to repeat 1050 times than 5 times ?</div></blockquote>The number of microseconds is not entirely accurate (because of other processes using the cpu at the same time) and for such low values the rounding may cause results like that. Let's say your code took about 1.5 microseconds...only a tiny difference in execution time might tip it over.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Wed Sep 10, 2003 12:21 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-09-10T12:18:12-04:00</updated>

		<published>2003-09-10T12:18:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26889#p26889</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26889#p26889"/>
		<title type="html"><![CDATA[Replacing spaces with %20]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26889#p26889"><![CDATA[
<blockquote class="uncited"><div>Good point. It seems eggdrop has its own definition of time. Could not find it in doc/tcl-commands.doc though.</div></blockquote>It's not been part of eggdrop for a while. But there's a proc called "time" in scripts/compat.tcl.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Wed Sep 10, 2003 12:18 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2003-09-10T12:15:59-04:00</updated>

		<published>2003-09-10T12:15:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26888#p26888</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26888#p26888"/>
		<title type="html"><![CDATA[Replacing spaces with %20]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26888#p26888"><![CDATA[
okay thanx egghead <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> I've got it, but may I ask how does the time vary according to how many time a command is repeated.<br><br>because when I do "time {set test "hello"} 5" it returns 4 microseconds per iteration ; and when I do "time {set test "hello"} 1050" it returns 1 microseconds per iteration.<br><br>so why is it less time to repeat 1050 times than 5 times ?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Wed Sep 10, 2003 12:15 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[egghead]]></name></author>
		<updated>2003-09-10T11:59:32-04:00</updated>

		<published>2003-09-10T11:59:32-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26885#p26885</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26885#p26885"/>
		<title type="html"><![CDATA[Replacing spaces with %20]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26885#p26885"><![CDATA[
<blockquote class="uncited"><div>I tried ".tcl time {set test "hello"} 1050" in partyline, it returned: Tcl error: wrong # args: should be "time". what's wrong ?</div></blockquote>Good point. It seems eggdrop has its own definition of time. Could not find it in doc/tcl-commands.doc though.<br><br>In any case, you can start tcl on your shell:<br><blockquote class="uncited"><div>system:/usr/home/egghead # tclsh8.3<br>% time {set test "hello"} 1050<br>1 microseconds per iteration</div></blockquote><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=282">egghead</a> — Wed Sep 10, 2003 11:59 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2003-09-10T11:47:57-04:00</updated>

		<published>2003-09-10T11:47:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26884#p26884</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26884#p26884"/>
		<title type="html"><![CDATA[Replacing spaces with %20]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26884#p26884"><![CDATA[
I tried ".tcl time {set test "hello"} 1050" in partyline, it returned: Tcl error: wrong # args: should be "time". what's wrong ?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Wed Sep 10, 2003 11:47 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-09-10T11:37:09-04:00</updated>

		<published>2003-09-10T11:37:09-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26882#p26882</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26882#p26882"/>
		<title type="html"><![CDATA[Replacing spaces with %20]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26882#p26882"><![CDATA[
Examples have allready been given.<br><div class="codebox"><p>Code: </p><pre><code>time {set test "hello"} 1050</code></pre></div>This will run the code<div class="codebox"><p>Code: </p><pre><code>set test "hello"</code></pre></div>1050 times, and tell you how long on average it took to run the command each time.<br><br>It will display somthing like<br><blockquote class="uncited"><div>2 microseconds per iteration</div></blockquote><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Wed Sep 10, 2003 11:37 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2003-09-10T10:38:02-04:00</updated>

		<published>2003-09-10T10:38:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26881#p26881</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26881#p26881"/>
		<title type="html"><![CDATA[Replacing spaces with %20]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26881#p26881"><![CDATA[
can you give an example please ? using one of the commands above <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Wed Sep 10, 2003 10:38 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-09-10T10:28:43-04:00</updated>

		<published>2003-09-10T10:28:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26880#p26880</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26880#p26880"/>
		<title type="html"><![CDATA[Replacing spaces with %20]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26880#p26880"><![CDATA[
Tcl provides a command called "time".<br><br>This will measure the time in microseconds, it takes to complete a command.<br><br>You also give it a repeat counter. This will loop and call the command X times. The total time is added together, and devided by the loop value, to give an average time.<br><br>Tcl also provides a command line parser, called "tclsh". You can use this to run Tcl script in your everyday tasks, or even as a CGI library. When called on its own, you can use it interactivly.<br><br>Through this, you can perform these tests, though you can't test eggdrop scripts, as many of the required commands are not available.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Wed Sep 10, 2003 10:28 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2003-09-10T08:58:29-04:00</updated>

		<published>2003-09-10T08:58:29-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26876#p26876</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26876#p26876"/>
		<title type="html"><![CDATA[Replacing spaces with %20]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26876#p26876"><![CDATA[
may I ask, how do you do these tests ? on what basis do you get the time results ?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Wed Sep 10, 2003 8:58 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-09-10T05:08:12-04:00</updated>

		<published>2003-09-10T05:08:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26870#p26870</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26870#p26870"/>
		<title type="html"><![CDATA[Replacing spaces with %20]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26870#p26870"><![CDATA[
Both "string map" and the split-join method can also count many many replacments where done.<br><div class="codebox"><p>Code: </p><pre><code>set len [string length $orig]set ph "%20"set new [join [split $orig] $ph]set count [expr ([string length $new] - $len) / [string length $ph]]</code></pre></div>Not as simple or elegant, more CPU intensive.<br><br>As for the battle of time, this will vary on text length and system. The battle between Windows and Linux has allways been odd.<br><br>Windows has shown on occasions to beat the pants of linux in some commands, but lagged in others. Linux shows consistant replies where windows hasn't.<br><br>Note, there was one test missed out.<br><div class="codebox"><p>Code: </p><pre><code>set text [string repeat "ssss " 30]time {set newtext [join [split $text " "] %20]} 1000time {set newtext [string map {" " %20} $text]} 1000time {regsub -all " " $text "%20" newtext} 1000time {set newtext [join [split $text] %20]} 1000</code></pre></div>The results in order (cycles reduced)<div class="codebox"><p>Code: </p><pre><code>92 microseconds per iteration108 microseconds per iteration405 microseconds per iteration (ouch)110 microseconds per iteration</code></pre></div>note how using the default marker for "split" rather than " " causes time to increase.<br><br>Here are the tests again, with the "string repeat" set to 10<br><div class="codebox"><p>Code: </p><pre><code>46 microseconds per iteration47 microseconds per iteration151 microseconds per iteration53 microseconds per iteration</code></pre></div>Tcl 8.3.4 - Linux 2.4.21<br><br>System level optimisations are not important to a coder, generic speed is. Unless they are gonna use a test suite first to determine the best command for the job.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Wed Sep 10, 2003 5:08 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[strikelight]]></name></author>
		<updated>2003-09-09T18:41:48-04:00</updated>

		<published>2003-09-09T18:41:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26851#p26851</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26851#p26851"/>
		<title type="html"><![CDATA[Replacing spaces with %20]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26851#p26851"><![CDATA[
<blockquote class="uncited"><div>Interesting numbers...what tcl version? My tests in 8.3.2 were quite different (string map and split/join about the same, regsub 4-5 times slower)</div></blockquote><div class="codebox"><p>Code: </p><pre><code>% info patchlevel8.4.1% puts "$tcl_platform(os) $tcl_platform(osVersion)"Windows NT 5.0% </code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2005">strikelight</a> — Tue Sep 09, 2003 6:41 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-09-09T18:59:15-04:00</updated>

		<published>2003-09-09T18:16:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26850#p26850</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26850#p26850"/>
		<title type="html"><![CDATA[Replacing spaces with %20]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26850#p26850"><![CDATA[
Interesting numbers...what tcl version? My tests in 8.3.2 were quite different (string map and split/join about the same, regsub 4-5 times slower)<blockquote class="uncited"><div>Are we ever going to stop debating this?  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"></div></blockquote>I hope not <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><br><br>Try to guess what my first edit was.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Tue Sep 09, 2003 6:16 pm</p><hr />
]]></content>
	</entry>
	</feed>
