<?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/12976" />

	<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>2007-01-21T02:13:40-04:00</updated>

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

		<entry>
		<author><name><![CDATA[theravenz]]></name></author>
		<updated>2007-01-21T02:13:40-04:00</updated>

		<published>2007-01-21T02:13:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69777#p69777</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69777#p69777"/>
		<title type="html"><![CDATA[TCL IRC Output.. Changing Bytes to KB, MB, ect..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69777#p69777"><![CDATA[
cheers man<br><br>Yeah im not really after 100% values <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"> just aprox so its all good. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><br><br>thanks again... champ<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8612">theravenz</a> — Sun Jan 21, 2007 2:13 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2007-01-20T17:46:58-04:00</updated>

		<published>2007-01-20T17:46:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69769#p69769</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69769#p69769"/>
		<title type="html"><![CDATA[TCL IRC Output.. Changing Bytes to KB, MB, ect..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69769#p69769"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>proc ratio {up down} {format %.3f [expr {[format %g $up]/[format %g $down]}]}</code></pre></div>Keep in mind that this (and the previous) proc will not give you the exact answer, but it's the best you can do without loading external libraries.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Sat Jan 20, 2007 5:46 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[theravenz]]></name></author>
		<updated>2007-01-20T13:22:03-04:00</updated>

		<published>2007-01-20T13:22:03-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69763#p69763</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69763#p69763"/>
		<title type="html"><![CDATA[TCL IRC Output.. Changing Bytes to KB, MB, ect..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69763#p69763"><![CDATA[
Okay, i got a new issue..<br><br>I totally dont understand that script you wrote.. hah! my TCL Noobness..<br><br>Anyways im just after a calc for ratio..<br><br>need to divide $upload by $download to give a 1.000 count..<br><br>Say 4 / 2 = 2.000 (to 3 decimal places.)<br><br>What im also after to.. is if they havent downloaded it returns "Inf." and if they havent uploaded it returns "---"<br><br>Im sure i could code that in if i only got the ratio calc...<br><br>If anyone knows how to calc big numbers in this way i would appriciate your help.. I can calc anything up to MB sized numbers in bytes.. but soon as i get up to GB sized numbers in bytes i get that error i was experiencing earlier..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8612">theravenz</a> — Sat Jan 20, 2007 1:22 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[theravenz]]></name></author>
		<updated>2007-01-19T08:52:52-04:00</updated>

		<published>2007-01-19T08:52:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69727#p69727</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69727#p69727"/>
		<title type="html"><![CDATA[TCL IRC Output.. Changing Bytes to KB, MB, ect..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69727#p69727"><![CDATA[
Worked it out.. thanks heaps man!!!<br><br>You're a Champ!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8612">theravenz</a> — Fri Jan 19, 2007 8:52 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[theravenz]]></name></author>
		<updated>2007-01-19T08:40:20-04:00</updated>

		<published>2007-01-19T08:40:20-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69726#p69726</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69726#p69726"/>
		<title type="html"><![CDATA[TCL IRC Output.. Changing Bytes to KB, MB, ect..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69726#p69726"><![CDATA[
So how am i calling this proc?<br><br>do i just do something like<br><br>set uploaded bytesToHumanReadable($upload);<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8612">theravenz</a> — Fri Jan 19, 2007 8:40 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2007-01-19T07:33:45-04:00</updated>

		<published>2007-01-19T07:33:45-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69724#p69724</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69724#p69724"/>
		<title type="html"><![CDATA[TCL IRC Output.. Changing Bytes to KB, MB, ect..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69724#p69724"><![CDATA[
Make sure you try the edited version. The first proc i posted had an error for values &lt; 1kb  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_rolleyes.gif" width="15" height="15" alt=":roll:" title="Rolling Eyes"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Fri Jan 19, 2007 7:33 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[theravenz]]></name></author>
		<updated>2007-01-19T07:25:53-04:00</updated>

		<published>2007-01-19T07:25:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69723#p69723</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69723#p69723"/>
		<title type="html"><![CDATA[TCL IRC Output.. Changing Bytes to KB, MB, ect..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69723#p69723"><![CDATA[
Even with elseif.. -- thought i had tried that before posting it.. and it didnt seem to like elseif.. but oh wells works now...<br><br>Still no go.. comes up with  <br><br>[22:23] &lt;ServBot&gt; [22:22] Tcl error [user_search]: integer value too large to represent<br><br>..<br><br>Could it be that TCL just cant handle calculations with such large numbers???<br>coz thats the only thing i can figure out<br><br>Would anyone know of any other code that might be able to help with this calulation that i could try?<br><br><br>PS, new post while posting this.. ill give it a go dude<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8612">theravenz</a> — Fri Jan 19, 2007 7:25 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2007-01-19T07:29:49-04:00</updated>

		<published>2007-01-19T07:25:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69722#p69722</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69722#p69722"/>
		<title type="html"><![CDATA[TCL IRC Output.. Changing Bytes to KB, MB, ect..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69722#p69722"><![CDATA[
You'll get an overflow for integers &gt;= 1&lt;&lt;31 and that error you mentioned for integers &gt;= 1&lt;&lt;32... Try this proc:<div class="codebox"><p>Code: </p><pre><code>proc bytesToHumanReadable b {set b [format %g $b]foreach {v n} {1.09951e+012 TB 1.07374e+009 GB 1.04858e+006 MB 1024.0 KB 1.0 B} {if {$b&gt;=$v} break}format "%.2f %s" [expr {$b/$v}] $n}</code></pre></div>EDIT: oops <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=2878">user</a> — Fri Jan 19, 2007 7:25 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2007-01-19T06:04:35-04:00</updated>

		<published>2007-01-19T06:04:35-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69720#p69720</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69720#p69720"/>
		<title type="html"><![CDATA[TCL IRC Output.. Changing Bytes to KB, MB, ect..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69720#p69720"><![CDATA[
Why don't you use elseif instead, so that the largest numbers are not being divided by the smallest divisor (I'm assuming that is the problem, since you didn't bother to post the actual '.set errorInfo' debug.. Could be the opposit, smallest number being divided by the largest divisor..)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Fri Jan 19, 2007 6:04 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[theravenz]]></name></author>
		<updated>2007-01-18T21:58:22-04:00</updated>

		<published>2007-01-18T21:58:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69713#p69713</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69713#p69713"/>
		<title type="html"><![CDATA[TCL IRC Output.. Changing Bytes to KB, MB, ect..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69713#p69713"><![CDATA[
Just having some trouble with this coding..<br><br>Searched everywhere for help.. hopfully one of you guys can help me out <br>It'd be much appriciated.<br><div class="codebox"><p>Code: </p><pre><code>  if {[expr $upload / 1024] &gt;= 1} {       set uploaded "[string range "[expr $upload / 1024.0]" 0 [expr [string length "[expr $upload / 1024]"]+ 2] ] KB"};  if {[expr $upload / 1048576] &gt;= 1} {       set uploaded "[string range "[expr $upload / 1048576.0]" 0 [expr [string length "[expr $upload / 1048576]"]+ 2] ] MB"};  if {[expr $upload / 1073741824] &gt;= 1} {       set uploaded "[string range "[expr $upload / 1073741824.0]" 0 [expr [string length "[expr $upload / 1073741824]"]+ 2] ] GB"};  if {[expr $upload / 1099511627776] &gt;= 1} {       set uploaded "[string range "[expr $upload / 1099511627776.0]" 0 [expr [string length "[expr $upload / 1099511627776]"]+ 2] ] TB"};  if {[expr $download / 1024] &gt;= 1} {       set downloaded "[string range "[expr $download / 1024.0]" 0 [expr [string length "[expr $download / 1024]"]+ 2] ] KB"};  if {[expr $download / 1048576] &gt;= 1} {       set downloaded "[string range "[expr $download / 1048576.0]" 0 [expr [string length "[expr $download / 1048576]"]+ 2] ] MB"};  if {[expr $download / 1073741824] &gt;= 1} {       set downloaded "[string range "[expr $download / 1073741824.0]" 0 [expr [string length "[expr $download / 1073741824]"]+ 2] ] GB"};  if {[expr $download / 1099511627776] &gt;= 1} {       set downloaded "[string range "[expr $download / 1099511627776.0]" 0 [expr [string length "[expr $download / 1099511627776]"]+ 2] ] TB"};</code></pre></div>now im not fantastic when it comes to TCL more of a novice..<br><br>When these lines are called.. i get an error like this.. <br><blockquote class="uncited"><div>[12:53] &lt;ServBot&gt; [12:53] Tcl error [user_search]: integer value too large to represent</div></blockquote>I've isolated it to these lines only.. if i comment them out.. it works flawlessly.. cept displayed in bytes <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><br><br>One other thing i noticed is, if i comment out the GB and TB lines and leave KB and MB.. it works for anything under a Gig.. <br>anything over a gig it just returns that error again<br><br>Any help would be nice.. thanks in advance..<br><br>Matt<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8612">theravenz</a> — Thu Jan 18, 2007 9:58 pm</p><hr />
]]></content>
	</entry>
	</feed>
