Search Results

Search found 1785 results on 72 pages for 'round'.

Page 3/72 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How to integer-divide round negative numbers *down*?

    - by Conrad Albrecht
    Seems like whenever I divide a negative int by a positive int, I need it to round down (toward -inf), not toward 0. But both C# and C++ round toward 0. So I guess I need a DivideDownward() method. I can write it in a few lines with a test for negative and so on, but my ideas seem klugey. So I'm wondering if I'm missing something and if you have an "elegant" way to round negative division downward.

    Read the article

  • Monitoring Your Servers

    - by Grant Fritchey
    If you are the DBA in a large scale enterprise, you’re probably already monitoring your servers for up-time and performance. But if you work for a medium-sized business, a small shop, or even a one-man operation, chances are pretty good that you’re not doing that sort of monitoring. You know that you’re supposed to be doing it, but other things, more important at-the-moment things, keep getting in the way. After all, which is more important, some monitoring or backup testing?  Backup testing, of course. Monitoring is frequently one of those things that you do when can get around to it.  Well, as you can see at the right, I have your round tuit ready to go. What if I told you that you could get monitoring on your servers for up-time, job completion, performance, all the standard stuff? And what if I told you that you wouldn’t need to install and configure another server in your environment to get it done? And what if I told you that you’d be able to set up and customize your alerts so you could know if your server was offline or a drive was full? Almost nothing for you to do, and you’ll have a full-blown monitoring process. Sounds to good to be true doesn’t it? Well, it’s coming. We’re creating an online, remote, monitoring system here at Red Gate. You’ll be able to use our SQL Monitor tool (which you can see here, monitoring SQL Server Central in real time) to keep track of your systems, but without having to set up a server and a database for storing the information collected. Instead, we’re taking advantage of services available through the internet to enable collection and storage of this information remotely, off your systems. All you have to do is install a piece of software that will communicate between our service and your servers and you’ll be off and running. It’s that easy. Before you get too excited, let me break the news that this is the near future I’m talking about. We’re setting up the program and there’s a sign-up you can use to get in on the initial tests.

    Read the article

  • Javascript functions Math.round(num) vs num.toFixed(0) and browser inconsistencies

    - by eft
    Edit: To clarify, the problem is how to round a number to the nearest integer. i.e. 0.5 should round to 1 and 2.5 shoud round to 3. Consider the following code: <html><head></head><body style="font-family:courier"> <script> for (var i=0;i<3;i++){ var num = i + 0.50; var output = num + " " + Math.round(num) + " " + num.toFixed(0); var node = document.createTextNode(output); var pElement = document.createElement("p"); pElement.appendChild(node); document.body.appendChild(pElement); } </script> </body></html> In Opera 9.63 I get: 0.5 1 0 1.5 2 2 2.5 3 2 In FF 3.03 I get: 0.5 1 1 1.5 2 2 2.5 3 3 In IE 7 I get: 0.5 1 0 1.5 2 2 2.5 3 3 Note the bolded results. Does this mean that toFixed(0) should be avoided?

    Read the article

  • DNS Round-robin failover and load balancing

    - by Tom O'Connor
    Having read all of the questions and answers (1 2 3 and so on) on here relating to DNS load balancing, and Round-robin DNS, there's still a number of unanswered questions.. Large companies, and I'm looking at Google, Facebook and Twitter here, do present multiple A records. 1) If DNS loadbalancing/failover is so dodgy, why do large organisations do it? There seems to be very little mention of "DNS Pinning", despite this (PDF) paper about it. 2) Why is DNS Pinning so seldom mentioned? 3) Are there any concrete examples of which ISPs and so on actually do rewrite DNS TTLs? That said, I'm not entirely backing the side for using DNS for failover or any form of load balancing. For most networks, BGP diverse routing still seems to be a better fit. DNS rears it's ugly head again. :(

    Read the article

  • Using awstats with a round-robin DNS configuration

    - by Shaun
    I have a website with multiple web servers whose access is controlled via a round-robin DNS. We currently use Google Analytics for site traffic monitoring but were looking to move to awstats due to concerns of inaccuracy with Google Analytics and using third-party trackers in general. I have a little experience with awstats and I know it gets its information from parsing server logs. How would this work when you have multiple web servers logging independently to separate locations? Is this supported with awstats? Is there an alternative I could use to track traffic activity directly on my servers?

    Read the article

  • Round robin DNS for dynamic website

    - by Uwe
    We want to setup multiple servers hosting the same site. Each server (iis6 or iis7) is on its own. Meaning it does not sjare any information with the others. They are not even in the same country. The problem we encounter is that if we setup a round-robin DNS (multiple IDs under one Domainname) is that the client (browser) switches the servers so that the asp.net session gets lost. The question is how do we set this up, so the clients are randomly send to one of the servers and if one fails the users go to the next one. But if a user is using one of the it should stay there. Thank you!

    Read the article

  • Round-twice error in .NET's Double.ToString method

    - by Jeppe Stig Nielsen
    Mathematically, consider for this question the rational number 8725724278030350 / 2**48 where ** in the denominator denotes exponentiation, i.e. the denominator is 2 to the 48th power. (The fraction is not in lowest terms, reducible by 2.) This number is exactly representable as a System.Double. Its decimal expansion is 31.0000000000000'49'73799150320701301097869873046875 (exact) where the apostrophes do not represent missing digits but merely mark the boudaries where rounding to 15 resp. 17 digits is to be performed. Note the following: If this number is rounded to 15 digits, the result will be 31 (followed by thirteen 0s) because the next digits (49...) begin with a 4 (meaning round down). But if the number is first rounded to 17 digits and then rounded to 15 digits, the result could be 31.0000000000001. This is because the first rounding rounds up by increasing the 49... digits to 50 (terminates) (next digits were 73...), and the second rounding might then round up again (when the midpoint-rounding rule says "round away from zero"). (There are many more numbers with the above characteristics, of course.) Now, it turns out that .NET's standard string representation of this number is "31.0000000000001". The question: Isn't this a bug? By standard string representation we mean the String produced by the parameterles Double.ToString() instance method which is of course identical to what is produced by ToString("G"). An interesting thing to note is that if you cast the above number to System.Decimal then you get a decimal that is 31 exactly! See this Stack Overflow question for a discussion of the surprising fact that casting a Double to Decimal involves first rounding to 15 digits. This means that casting to Decimal makes a correct round to 15 digits, whereas calling ToSting() makes an incorrect one. To sum up, we have a floating-point number that, when output to the user, is 31.0000000000001, but when converted to Decimal (where 29 digits are available), becomes 31 exactly. This is unfortunate. Here's some C# code for you to verify the problem: static void Main() { const double evil = 31.0000000000000497; string exactString = DoubleConverter.ToExactString(evil); // Jon Skeet, http://csharpindepth.com/Articles/General/FloatingPoint.aspx Console.WriteLine("Exact value (Jon Skeet): {0}", exactString); // writes 31.00000000000004973799150320701301097869873046875 Console.WriteLine("General format (G): {0}", evil); // writes 31.0000000000001 Console.WriteLine("Round-trip format (R): {0:R}", evil); // writes 31.00000000000005 Console.WriteLine(); Console.WriteLine("Binary repr.: {0}", String.Join(", ", BitConverter.GetBytes(evil).Select(b => "0x" + b.ToString("X2")))); Console.WriteLine(); decimal converted = (decimal)evil; Console.WriteLine("Decimal version: {0}", converted); // writes 31 decimal preciseDecimal = decimal.Parse(exactString, CultureInfo.InvariantCulture); Console.WriteLine("Better decimal: {0}", preciseDecimal); // writes 31.000000000000049737991503207 } The above code uses Skeet's ToExactString method. If you don't want to use his stuff (can be found through the URL), just delete the code lines above dependent on exactString. You can still see how the Double in question (evil) is rounded and cast.

    Read the article

  • How to replace round bracket tag in javascript string

    - by tomaszs
    I have trouble with changing round bracket tag in Javascript. I try to do this: var K = 1; var Text = "This a value for letter K: {ValueOfLetterK}"; Text = Text.replace("{ValueOfLetterK}", K); and after that I get: Text = "This a value for letter K: {ValueOfLetterK}" What can be done to make this work? When I remove round brackets it works fine.

    Read the article

  • How do I selectively round UITableViewCell corners?

    - by Michael Yang
    I'm trying to recreate the feel of the upper part of the iPhone Stocks application. Using cornerRadius I have been able to round all the corners of the UITableView, but when the user drags too far down or up the rectangular edges of the first and last cells show. How can I round only the top or bottom part of the UITableViewCell?

    Read the article

  • postfix concurrency limit with round robin dns

    - by goose
    Take the following internal round robin dns setup mymta.com. IN A 172.31.1.1 mymta.com. IN A 172.31.1.2 mymta.com. IN A 172.31.1.3 mymta.com. IN A 172.31.1.4 mymta.com. IN A 172.31.1.5 mymta.com. IN A 172.31.1.6 mymta.com. IN A 172.31.1.7 mymta.com. IN A 172.31.1.8 mymta.com. IN A 172.31.1.9 mymta.com. IN A 172.31.1.10 Now assume the following postfix setup (assume these are the only tweaks from defaults in debian package) main.cf: smtp_connection_cache_destinations = mymta.com smtp_connection_cache_reuse_limit = 750 smtp_destination_concurrency_limit = 75 transport * :[mymta.com] I would expect 75 concurrent connections spread across the 10 A records I've set in DNS. However I'm seeing more than a few hundred connections to mymta.com and I'm wondering if Postfix is "smart" enough to set up 75 concurrent connections for each IP address. Thoughts?

    Read the article

  • Adding up fractions in PHP

    - by Gamemorize
    I would like to create a loop that keeps adding a set fraction, here in my example 1/3, and which later I can check against for matches with integer values. Obviously when php adds 1/3 + 1/3 + 1/3 the result is 0.9999999, so i thought I could use the occasional round to help me, but this isn't working either. The idea that I had would be that .333 + .333 becomes .666 and that if rounded that would become .667, then + .333 and the result is 1. However round only seems to work, for me, if the number of digits actually decreases. so round (0.666, 3) remains 0.666 <?php $denom = 3; $frac = 1/$denom; $frac = round($frac,3); $value = 0; $max =24; for($f = 1; $f <= $max; $f++){ echo "old value is now at ".$value.".<br/>"; $value = $value+$frac; echo "value is now at ".$value.".<br/>"; $value = round($value,3); echo "rounded value is now at ".$value.".<br/>"; $valueArray[$f] = $value; //and here for ease of testing.... if (($value==1)OR ($value==2)OR ($value==3)OR ($value==4)OR ($value==5)OR ($value==6)OR ($value==7)OR ($value==8)){ echo "match!<br/>"; }else{ echo "no match!<br/>"; } } ?> Am I going about this in a totally stupid way? Accuracy when the value is not an integer is not needed, just that it can == with integers.

    Read the article

  • How to round CGFloat

    - by Johannes Jensen
    I made this method + (CGFloat) round: (CGFloat)f { int a = f; CGFloat b = a; return b; } It works as expected but it only rounds down. And if it's a negative number it still rounds down. This was just a quick method I made, it isn't very important that it rounds correctly, I just made it to round the camera's x and y values for my game. Is this method okay? Is it fast? Or is there a better solution?

    Read the article

  • How to make a Round Robin? or Is there an easier way other than Round Robin?

    - by candies
    The problem that I face is in what way if there is issue like the example below: Codes 1000, 2000, 3000, 4000, 5000 ID 1, 2, 3 ======================================== This: ID number 1 has codes 1000, 2000, 3000, 4000 ID number 2 has codes 2000, 4000, 3000 ID number 3 has codes 3000, 4000, 5000 ======================================== When all the fields are connected, each ID has found the same codes. From the example above, I want to produce fair result and adjusted to the code that it had before on each ID as below: ======================================== To be: ID number 1 has codes 1000, 2000 (1000 must be on number 1 cause only it has than other) ID number 2 has codes 3000, 4000 ID number 3 has codes 5000 (5000 must be on number 3 cause only it has than other) ======================================== Some say using Round Robin, but I never heard Round Robin before and I don't have idea how to use it, such a blank mind. Is there another easier way like to use PHP may be? I'm lost. Thanks.

    Read the article

  • Android Round Button and Spinner inside Activity Group

    - by vaishali
    I have a Spinner and 2 buttons in an Activity Group. I want to apply rounded corner to the buttons. I have created shape xml resource file for round button in Android. I have assigned this resource file as background to the button while creating the button in Layout. But the change is not reflected after executing the application. I have set the ContentView for that screen as : setContentView(LayoutInflater.from(getParent()).inflate(R.layout.textmessage,null)); This has to be done to make spinner work in an Activity Group. How can I make the Button as round corner in an Activity Group having Spinner? Any help would be appreciated. Thanks in Advance.

    Read the article

  • Does RabbitMq do round-robin from the exchange to the queues

    - by Lancelot
    Hi, I am currently evaluating message queue systems and RabbitMq seems like a good candidate, so I'm digging a little more into it. To give a little context I'm looking to have something like one exchange load balancing the message publishing to multiple queues. I don't want to replicate the messages, so a fanout exchange is not an option. Also the reason I'm thinking of having multiple queues vs one queue handling the round-robin w/ the consumers, is that I don't want our single point of failure to be at the queue level. Sounds like I could add some logic on the publisher side to simulate that behavior by editing the routing key and having the appropriate bindings in place. But that's kind of a passive approach that wouldn't take the pace of the message consumption on each queue into account, potentially leading to fill up one queue if the consumer applications for that queue are dead. I was looking for a more pro-active way from the exchange entity side, that would decide where to send the next message based on each queue size or something of that nature. I read about Alice and the available RESTful APIs but that seems kind of a heavy duty solution to implement fast routing decisions. Anyone knows if round-robin between the exchange the queues is feasible w/ RabbitMQ then? Thanks.

    Read the article

  • System.Math.Round bug?

    - by Jeevan
    Hi All, I was writing a function for rounding a number to two places. And I found a bug when I was trying to round specific values. So, I ran the code: class Program { static void Main(string[] args) { int limit = 100; for (int number = 0; number <= limit; number++) { Console.WriteLine((System.Math.Round((double)(number+0.995),2,MidpointRounding.AwayFromZero))); } } } And I found that: 8.99 9.99 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 32.99 33.99 34.99 35.99 36.99 37.99 38.99 39.99 numbers are not rounded to their next value. When I run the same code till 1500: I get the numbers: 8.99 9.99 32.99 33.99 34.99 35.99 36.99 37.99 38.99 39.99 1024.99 1025.99 1026.99 1027.99 1028.99 1029.99 1030.99 1031.99 1032.99 1033.99 1034.99 1035.99 1036.99 1037.99 1038.99 1039.99 1040.99 1041.99 1042.99 1043.99 1044.99 1045.99 1046.99 1047.99 1048.99 1049.99 1050.99 1051.99 1052.99 1053.99 1054.99 1055.99 1056.99 1057.99 1058.99 1059.99 1060.99 1061.99 1062.99 1063.99 1064.99 1065.99 1066.99 1067.99 1068.99 1069.99 1070.99 1071.99 1072.99 1073.99 1074.99 1075.99 1076.99 1077.99 1078.99 1079.99 1080.99 1081.99 1082.99 1083.99 1084.99 1085.99 1086.99 1087.99 1088.99 1089.99 1090.99 1091.99 1092.99 1093.99 1094.99 1095.99 1096.99 1097.99 1098.99 1099.99 1100.99 1101.99 1102.99 1103.99 1104.99 1105.99 1106.99 1107.99 1108.99 1109.99 1110.99 1111.99 1112.99 1113.99 1114.99 1115.99 1116.99 1117.99 1118.99 1119.99 1120.99 1121.99 1122.99 1123.99 1124.99 1125.99 1126.99 1127.99 1128.99 1129.99 1130.99 1131.99 1132.99 1133.99 1134.99 1135.99 1136.99 1137.99 1138.99 1139.99 1140.99 1141.99 1142.99 1143.99 1144.99 1145.99 1146.99 1147.99 1148.99 1149.99 1150.99 1151.99 1152.99 1153.99 1154.99 1155.99 1156.99 1157.99 1158.99 1159.99 1160.99 1161.99 1162.99 1163.99 1164.99 1165.99 1166.99 1167.99 1168.99 1169.99 1170.99 1171.99 1172.99 1173.99 1174.99 1175.99 1176.99 1177.99 1178.99 1179.99 1180.99 1181.99 1182.99 1183.99 1184.99 1185.99 1186.99 1187.99 1188.99 1189.99 1190.99 1191.99 1192.99 1193.99 1194.99 1195.99 1196.99 1197.99 1198.99 1199.99 1200.99 1201.99 1202.99 1203.99 1204.99 1205.99 1206.99 1207.99 1208.99 1209.99 1210.99 1211.99 1212.99 1213.99 1214.99 1215.99 1216.99 1217.99 1218.99 1219.99 1220.99 1221.99 1222.99 1223.99 1224.99 1225.99 1226.99 1227.99 1228.99 1229.99 1230.99 1231.99 1232.99 1233.99 1234.99 1235.99 1236.99 1237.99 1238.99 1239.99 1240.99 1241.99 1242.99 1243.99 1244.99 1245.99 1246.99 1247.99 1248.99 1249.99 1250.99 1251.99 1252.99 1253.99 1254.99 1255.99 1256.99 1257.99 1258.99 1259.99 1260.99 1261.99 1262.99 1263.99 1264.99 1265.99 1266.99 1267.99 1268.99 1269.99 1270.99 1271.99 1272.99 1273.99 1274.99 1275.99 1276.99 1277.99 1278.99 1279.99 1280.99 1281.99 1282.99 1283.99 1284.99 1285.99 1286.99 1287.99 1288.99 1289.99 1290.99 1291.99 1292.99 1293.99 1294.99 1295.99 1296.99 1297.99 1298.99 1299.99 1300.99 1301.99 1302.99 1303.99 1304.99 1305.99 1306.99 1307.99 1308.99 1309.99 which are not rounded to next number! Has anyone any idea about why its happening for these specific numbers!

    Read the article

  • Math.Round(decimal) Problem

    - by gtas
    Ok this is new, Math.Round(1.5) returns 2, i need 1. How to handle this? [EDITED] I know its the elementary default way, i need the opposite. Wrong typing meaning. Any Suggestions?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >