Jump to content

cwarn23

Members
  • Posts

    110
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

cwarn23's Achievements

Member

Member (2/5)

0

Reputation

  1. The easiest way to do it is to have a loop which loops through an array of nodes and keep on appending to the array as more nodes are found. Simple concept but probably not the most efficient one.
  2. I just happen to be writing an algorithm which follows similar concepts and the main thing you need to do is record what you have seen as you have gone along. It is actually quite easy when you get your mind around the loop and is only a matter of a decent database structure. For example, this is the database structure I chose: Using that database design you can simply insert newly discovered links into linkdata with backlinks being 1 upon insertion unless the link occurs multiple times in that page. So basically to track the backlinks or the number of depths you simply add the the backlinks variable if another instance of that link has been found along the track in the linkdata table.
  3. Hi, I have just created an algorithm and could this be the greatest algorithm invented for calculating square roots? Perhaps the answer is yes with 100% accuracy unlike some algorithms that round the last digit up. Below is the algorithm I have created and I used php. Also this algorithm can easily be imported into any language with any bitrate and is very scalable unlike some of the standard built in square root algorithms for some interpreters (all of the ones tested so far). Now below is the code with it in both the form of a class and the form of a function. You may notice that the function name is funny but it is tatically named that way so that the string length of the function name is the same as the sqrt() function so you don't get qwerky results when comparing the two. <?php class sqrt { public $value; function __construct($in) { $tmp = (int) $in; $tmpp = ($tmp/2); for ($i=1;($i*$i)<=$tmp;$i*=2) {} $i/=2; for (;($i*$i)<=$tmp;$i++) {} $i--; $k=$i; $i++; if (($i*$i)>$tmp || ($i*$i)<$tmp) { for ($j=1;($i*$i)>=$tmp;$j/=2,$i=($j+$k)) {} $v=strlen((string)$j); $m=1/pow(10,$v); for (;($i*$i)<=$tmp;$j+=$m,$i=($j+$k)) {} $j-=($m); $i=$j+$k; if (($i*$i)>$tmp || ($i*$i)<$tmp) { //$w = (strlen((string)pow(2,32))+1); //$w = same number as below $w = 11; //32 bit $q=$m; for ($n=$v+1;$n<$w;$n++) { $m=1/pow(10,$n); $p=pow(10,(($n-$v)+1)); for ($o=0;$o<$p && ($i*$i)<=$tmp;$j+=$m,$i=($j+$k),$o++) {} $j-=$m; $i=($j+$k); } } } echo $i; $this->value = $i; return $this->value; } } function mysq($in) { $tmp = (int) $in; $tmpp = ($tmp/2); for ($i=1;($i*$i)<=$tmp;$i*=2) {} $i/=2; for (;($i*$i)<=$tmp;$i++) {} $i--; $k=$i; $i++; if (($i*$i)>$tmp || ($i*$i)<$tmp) { for ($j=1;($i*$i)>=$tmp;$j/=2,$i=($j+$k)) {} $v=strlen((string)$j); $m=1/pow(10,$v); for (;($i*$i)<=$tmp;$j+=$m,$i=($j+$k)) {} $j-=($m); $i=$j+$k; if (($i*$i)>$tmp || ($i*$i)<$tmp) { //$w = (strlen((string)pow(2,32))+1); //$w = same number as below $w = 11; //32 bit $q=$m; for ($n=$v+1;$n<$w;$n++) { $m=1/pow(10,$n); $p=pow(10,(($n-$v)+1)); for ($o=0;$o<$p && ($i*$i)<=$tmp;$j+=$m,$i=($j+$k),$o++) {} $j-=$m; $i=($j+$k); } } } return $i; } $s = microtime(true); mysq(128); $e = microtime(true); $a=($e-$s); unset($e,$s); sleep(1); $s = microtime(true); sqrt(128); $e = microtime(true); echo 'mysq time &#160;&#160;='.$a.'<br>'; echo 'mysq result='.mysq(128).'<br>'; echo 'sqrt time&#160;&#160;='.($e-$s).'<br>'; echo 'sqrt result='.sqrt(128).'<br>'; echo 'The mysq function is '.bcdiv(substr(($e-$s),0,11),$a,0).' times faster for this calculation.<br>';
  4. Is it possible to setup all of my add-on domains without 5 different nameservers for 5 domains? I would preferably like to just have 2 nameservers (ns1.cwarn23.info & ns2.cwarn23.info) then be able to point all domains to that. So how would I arrange the dns records for that?
  5. That would mean the dns record in my first post would be correct wouldn't it? If that's right then why didn't cwarn23.info as the namserver work instead of ns1.cwarn23.info?
  6. My nameserver is ns1.cwarn23.info to let you know. Also below is my current dns record $ttl 38400 @ IN SOA ns1.cwarn23.info. root.chatbac.net. ( 1271417905 10800 3600 604800 38400 ) @ IN NS ns1.cwarn23.info. chatbac.net. IN A 110.44.25.66 www.chatbac.net. IN A 110.44.25.66 ftp.chatbac.net. IN A 110.44.25.66 m.chatbac.net. IN A 110.44.25.66 localhost.chatbac.net. IN A 127.0.0.1 webmail.chatbac.net. IN A 110.44.25.66 admin.chatbac.net. IN A 110.44.25.66 mail.chatbac.net. IN A 110.44.25.66 chatbac.net. IN MX 5 mail.chatbac.net. chatbac.net. IN TXT "v=spf1 a mx a:chatbac.net ip4:110.44.25.66 ?all" I used ipconfig /dnsflush on my computer to make sure the new dns loads but still it doesn't work. Do you know what's wrong? Thanks.
  7. I have waited for around 18 hours and my domain still isn't working. Does anybody know what this could be as it is really annoying me.
  8. I tried replacing it with the following but still it doesn't work @ IN NS ns1.cwarn23.info. Also when I go to apply zone I seem to get this error NDC command failed : rndc: connect failed: 127.0.0.1#953: connection refused
  9. I just tried adjusting the second line and still it is not working. Any ideas?
  10. Hi, I have a vps and soon a dedicated with 3.2GHz quad but now the devil has come back to haunt me (DNS). On my current vps I can get the domain cwarn23.info to work but all of my addon and parked domains don't work (eg. chatbac.net). They simply can't resolve the host name. I know there is probably some obvious simple solution that I can't find and below is the dns record for chatbac.net $ttl 38400 @ IN SOA cwarn23.info. root.cwarn23.info. ( 1271417901 10800 3600 604800 38400 ) @ IN NS cwarn23.info. chatbac.net. IN A 110.44.25.66 www.chatbac.net. IN A 110.44.25.66 ftp.chatbac.net. IN A 110.44.25.66 m.chatbac.net. IN A 110.44.25.66 localhost.chatbac.net. IN A 127.0.0.1 webmail.chatbac.net. IN A 110.44.25.66 admin.chatbac.net. IN A 110.44.25.66 mail.chatbac.net. IN A 110.44.25.66 chatbac.net. IN MX 5 mail.chatbac.net. chatbac.net. IN TXT "v=spf1 a mx a:chatbac.net ip4:110.44.25.66 ?all" Now does that look right because I am not sure about where it mentions cwarn23.info or whether it should be chatbac.net instead since it's the chatbac.net record. Any ideas or could somebody post a correction and if further details are required for the host name to resolve correctly then please let me know as I'm stuck in the middle of a rock and a hard place. Thanks a million to whoever can solve this.
  11. It'll annoy people, and then alot of people won't bother using the service if they can't get any help? If people expect ANYTHING in terms of reliability from a FREE service, they're fooling themselves. It's an illusion. Gmail can turn off tomorrow, delete all of your e-mail, not tell you, and it's your fault, not theirs. Well if Gmail did close tomorrow they would be up for a lot of legal costs as part of the gmail contract is that they will provide 99.5% uptime and if they break that contract a lot of people would sue google. As it is people almost sued google when did went down for a few hours but google argued because it only effected 25% of the customers therefore they could be down 4 times the time mentioned on the contract. Lucky <blank> Also what is with the IRC. I can't seem to access the IRC. Was this a result of the same server crash that took down the phpfreaks website because IRC isn't working even the web client just shows a 404? Sorry if I hijacked a post but I believe it is part of the same problem.
  12. Hi, long time no post although I've been on the irc for a while. Anyways my question is I have the following two virtual hosts but I can't seem to get the obvioussiteisobvious.co.cc to work. Apache shows no errors and the DNS lookup fails where hostname cannot be found. So the apache configruation for obvioussiteisobvious.co.cc is. <VirtualHost 110.44.25.66:80> SuexecUserGroup "#1008" "#1003" ServerName obvioussiteisobvious.co.cc ServerAlias www.obvioussiteisobvious.co.cc ServerAlias webmail.obvioussiteisobvious.co.cc ServerAlias admin.obvioussiteisobvious.co.cc DocumentRoot /home/ash47/public_html/obvioussiteisobvious ErrorLog /var/log/virtualmin/obvioussiteisobvious.co.cc_error_log CustomLog /var/log/virtualmin/obvioussiteisobvious.co.cc_access_log combined ScriptAlias /cgi-bin /home/ash47/public_html/obvioussiteisobvious/cgi-bin/ DirectoryIndex index.html index.htm index.php index.php4 index.php5 <Directory /home/ash47/public_html/obvioussiteisobvious> Options -Indexes +IncludesNOEXEC +FollowSymLinks allow from all AllowOverride All </Directory> <Directory /home/ash47/public_html/obvioussiteisobvious/cgi-bin> allow from all </Directory> RewriteEngine on RewriteCond %{HTTP_HOST} =webmail.obvioussiteisobvious.co.cc RewriteRule ^(.*) https://obvioussiteisobvious.co.cc:20000/ [R] RewriteCond %{HTTP_HOST} =admin.obvioussiteisobvious.co.cc RewriteRule ^(.*) https://obvioussiteisobvious.co.cc:10000/ [R] </VirtualHost> Also this points to the nameservers ns1.cwarn23.info and ns2.cwarn23.info. Most of the other domains which point to cwarn23.info nameservers do work with the exception of two domains including this one. Can anybody see what is happening here because I'm lost deep in dark woods with no way out. Thanks, cwarn23.
  13. Basically I need to find the value of $c and $c is the same as what $tmp will be in two loops time. So I need to predict what $tmp will be in two loops time and assign it to $c. Does anyone know how to do that as it would solve not only this problem but part of a bigger problem I am dealing with. Surly something as simple as this can be solved.
  14. Just an update, I saw that code has an infinit loop so it is as follows. <?php $a=1; $b=47; $c=88; $tmp=23; for($i=0;$i<80;$i++) { $random_number=floor(mt_rand(0,1000)); echo $random_number.'<br>'; $tmp=($tmp+$c+$random_number)*0.5; $c=$b; $b=$a; $a=$tmp; } //Now to reverse echo '<hr>'; $tmp=$a; for ($i=0;$i<80;$i++) { $a=$b; $b=$c; //$c=(unknown); //$random_number=(($tmp-$c)-$a)*2; //$tmp=($tmp-(($random_number*0.5)+$c+$a))*2; //echo $random_number.'<br>'; } ?> And why isn't anyone replying.
  15. Hi, I am trying to reverse a loop but am having some troubles. Below is an example of my problem but I need to find the value of $c in each round of the second loop. Does anybody know how to find the value of $c in the second loop because I'm stuck in the middle of thick woods. <?php $a=1; $b=47; $c=88; $tmp=23; for($i=0;$i<80;$i++) { $random_number=floor(mt_rand(0,1000)); echo $random_number.'<br>'; $tmp=($tmp+$c+$random_number)*0.5; $c=$b; $b=$a; $a=$tmp; } //Now to reverse echo '<hr>'; $tmp=$a; for ($i=0;$i<80;$i--) { $a=$b; $b=$c; //$c=(unknown); //$random_number=(($tmp-$c)-$a)*2; //$tmp=($tmp-(($random_number*0.5)+$c+$a))*2; //echo $random_number.'<br>'; } ?> Also the objective in this script is to find $random_number for each loop round by appending new code instead of altering the original. Thanks.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.