EzDevInfo.com

roundup

eliminate bugs and weeds from shell scripts roundup

Roundup in an update sql query

I have a sql column that is set to money, this has four numbers after the decimal point. I am calculating this column in an update query, I would like to roundup this column. example: 2388.6796, should be 2389

Math.Ceiling(0.5);
SqlCommand cmd1 = new SqlCommand("UPDATE Products SET [ThirdPartyRate] = 'Ceiling(" + GridView1.Rows[SelectedIndex].Cells[6].Text.ToString() + "' * [Price]) WHERE [Supplier] like '" + GridView1.Rows[SelectedIndex].Cells[0].Text.ToString() + "' ", con);

Source: (StackOverflow)

Round up decimals to 3 numbers after

I have got this script which multiplies value inputted into input field by dropdown's value assigned through span data-val.

How can I make the script show result rounded up to 3 decimals?

$(document).ready(function () {
    function showTab(name) {
        $('div.fruit').hide();
        var $div = $('#' + name).show();
        var number = parseInt($('.number').val(), 0);
        $('span', $div).each(function () {
            $(this).text($(this).data('val') * number);
        });
    }

    $('#update').click(function() { 
        showTab($('#dropdown').val());
    });

    showTab($('#dropdown').val());
});

Source: (StackOverflow)

Advertisements

How to round time to nearest hour in Excel?

How to round time to nearest hour in Excel, for example:

67:45:00 will be 68:00:00
and
53:14:00 will be 53:00:00

regards


Source: (StackOverflow)

How to round up value in PHP?

I have a value like this:

$value = 2.3333333333;

and I want to round up this value into like this:

$value = 2.35;

I already tried round, ceil and etc but the result is not what I expected.

Please anyone help.

Thanks


Source: (StackOverflow)

Central login for Django, MediaWiki and Roundup without compromising user data?

I am working on a central login system for an application that is written in Django, with a MediaWiki wiki and a Roundup bugtracker. At present, the method I am thinking of going with is to use the AuthDjango extension for Mediawiki (https://bitbucket.org/toml/django-mediawiki-authentication/src) and hack up something similar for Roundup. This method relies on the creation of a SessionProfile model in Django which maps session IDs (taken from cookies) to User instances, and MediaWiki/Roundup accesses the data by directly querying the Django database.

The advantage of this are that login, session and logout processes across all three apps are easily unified. However, the issue I have is that it relies on MediaWiki/Roundup having stored credentials for the Django database, and the requirements to get access to the MediaWiki or Roundup shell accounts are intentionally less stringent than for the main Django app (currently only one person has Django production access). So admins of the MediaWiki/Roundup instance (i.e. with shell access), or anyone who broke in via a remote exploit, would potentially be able to hijack user accounts on the main site.

So my question is: does anyone know of a better way to integrate the login mechanisms of these systems? Or, how would I be able to give MediaWiki/Roundup secure access to the Django database while minimizing the potential for abuse by people with access to the MediaWiki shell?


Source: (StackOverflow)

Is there a Scrum plugin for the Roundup Issue Tracker?

Is there a Scrum plugin for the Roundup Issue Tracker similar to Agilo for Trac? I realize that Roundup is an issue tracking system, whereas Trac is designed to be an integrated project management, SCM, and issue tracker. Therefore, maybe a better question would be—Is anyone aware of a, preferably Python based, Scrum tool to use in conjunction with Roundup? Although, that may be a bit too subjective for this forum.


Source: (StackOverflow)

Configuring Roundup with Apache

I think I just need a bit more guidance than what the documentation gives, and it's quite hard to find anything relating to Roundup and Apache specifically.

All i'm trying to do currently is to have Apache display what the stand-alone server does when running roundup-server support=C:/Roundup/

Running windows XP with apache 2.2 and python 2.5 roundup 1.4.6

I don't really have any further notes of interest, so if anyone has already got this running, could you please show me your configuration and i'll see how i go from there :) I don't expect anyone to analyse the 403 forbidden error I get before I'm sure my httpd.conf file is correct first

Thanks in advance


Source: (StackOverflow)

What would be a good regexp for identifying the "original message" prefix in gmail?

An example signature may be:

On Tue, Mar 20, 2012 at 2:38 PM, Johnny Walker <johnny.talker@gmail.com> wrote:

And then follows the quoted reply. I do have a discrete sensation this is locale specific though which makes me a sad programmer.

The reason I ask for this is because roundup doesn't strip these correctly when replying through gmail to an issue. And I think origmsg_re is the config.ini variable I need to set alongside keep_quoted_text = no to fix this.

Right now it's the default origmsg_re = ^[>|\s]*-----\s?Original Message\s?-----$

Edit: Now I'm using origmsg_re = ^On[^<]+<.+@.+>[ \n]wrote:[\n] which works with some gmail clients that break lines that are too long.


Source: (StackOverflow)

Transpose to excel from JSON how to round up?

i have the excel script and the jason page, to not make this huge im just going to place the important things.

function pull(toonName,toonRealm) {

  if(!toonName || !toonRealm) {
   return ""
  }

  var toonJSON = UrlFetchApp.fetch("us.battle.net/api/wow/character/"+toonRealm+"/"+toonName+"?fields=items,talents,statistics,stats,progression,audit") 
  var toon = JSON.parse(toonJSON.getContentText())

var getStats = function(sta) {
    var crit = sta.crit,
        haste = sta.haste,
        mastery = sta.mastery,
        spirit = sta.spr,
        multi = sta.multistrike,
        vers = sta.versatilityDamageDoneBonus
    return [crit, haste, mastery, spirit, multi, vers]
  }
  var Stats = getStats(toon.stats) 

var toonInfo = new Array(Stats[0], Stats[1], Stats[2], Stats[4], Stats[5], Stats[3]
      )
 return toonInfo;
}

what i got is a number with a lot of decimals for example: 15.154545, 12.566666, 19.97091.

and what i want is to convert that to: 15.15% 12.56% 19.97%

either from the script or from the excel.

The thing is that when i try to convert that from excel selecting the number format of %, it gives me: 1515.45%, 1256.66%, 1997.09%

but if i chose the number format it gives me the 15.15, 12.56 (w/o the "%")

and when i tried to inject that form the script like:

var toonInfo = new Array(Stats[0]+"%", Stats[1]+"%", Stats[2]+"%", Stats[4]+"%", Stats[5]+"%", Stats[3]

excel couldnt edit the numbers.So maby this is a dumb question but i dont know how to do it.


Source: (StackOverflow)

Setup Roundup with WSGI and Apache

I was install Roundup 1.4 by Debian Squeeze official repo and want to run it with my Apache server using mod_wsgi. Host configuration:

<VirtualHost *:80>
    ServerName support.domain.com

    WSGIScriptAlias / /var/roundup/support/apache/roundup.wsgi
    WSGIDaemonProcess support.roundup user=roundup group=roundup threads=25
    WSGIProcessGroup support.roundup

    <Directory /var/roundup/support>
        <Files roundup.wsgi>
            Order allow,deny
            Allow from all
        </Files>
    </Directory>

    # ... some logging configuration
</VirtualHost>

I was install tracker in /var/roundup/support using roundup-admin install, configure it and next initialise using roundup-admin initialise. Then I was created apache/roundup.wsgi:

from roundup.cgi.wsgi_handler import RequestDispatcher
tracker_home = '/var/roundup/support'
application = RequestDispatcher(tracker_home)

When opening my site at http://support.domain.com (ofcourse this url is bit different) I have HTTP response 500 Internal Server Error and log with:

mod_wsgi (pid=17433): Exception occured processing WSGI script '/var/roundup/support/apache/roundup.wsgi'.
RuntimeError: response has not been started

What's going on? How to run roundup with wsgi (not cgi) properly? Or where to look why response has not been started?

EDIT


Roundup's install manual says that wsgi handler would look like this:

from wsgiref.simple_server import make_server

# obtain the WSGI request dispatcher
from roundup.cgi.wsgi_handler import RequestDispatcher
tracker_home = 'demo'
app = RequestDispatcher(tracker_home)

httpd = make_server('', 8917, app)
httpd.serve_forever()

But this make no response. Browser loading it forever without message or server log. I think starting another server from script running by apache module isn't good idea. So I tried another code sample:

from roundup.cgi.wsgi_handler import RequestDispatcher
tracker_home = '/var/roundup/support'
application = RequestDispatcher(tracker_home)

from flup.server.fcgi import WSGIServer
WSGIServer(application).run()

But this throws some errors like:

WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!

There must be a way to run my application from RequestDispatcher...


Source: (StackOverflow)

malloc. How works the algorithm for round up [duplicate]

This question already has an answer here:

Looking the code of the malloc we can see that it performs round up like this:

nunits = (nbytes + sizeof(Header) - 1) / sizeof(Header) + 1;

I understand why we perform

(nbytes + sizeof(Header)) / sizeof(Header)

But the other hand I don't understand why we need to subtract -1 in numerator and +1 in denominator ?


Source: (StackOverflow)

Roundup total and multiply again jquery calculator

I have a few modifications I need for my cost calculator:

  1. Is there a way to add a Math.celi to the no of cans so it rounds up to the nearest whole number, providing the minimum cans needed?

  2. What ever the minimum required cans are, can the cost reflect that by multiplying by 18.23 and giving the real amount?

    $('input').keyup(function () { // run anytime the value changes
    
    
     var firstValue = parseFloat($('#width').val()); // get value of field
     var secondValue = parseFloat($('#height').val());
     var thirdValue = parseFloat($('#per-can').val()); // convert it to a float
     var forthValue = parseFloat($('#cost').val());
     var fithValue = parseFloat($('#size').val());
    
     var canCount = firstValue * secondValue / thirdValue;
    
     $('#added').html((canCount * forthValue).toFixed(2));
     $('#cans').html(canCount.toFixed(2));
    
     if (Math.ceil(canCount) < 2) {
     $('#error').html("Need at least 1!");
     } else {
     $('#error').empty();   
     }
    
     });
    

http://jsfiddle.net/5xzSy/504/ thanks


Source: (StackOverflow)

How can I use Math Ceiling RoundUp How to determine even odd number

I need to print data from a DataGridView on both sides of a preprinted form but:

  1. Each side has different arrangement for that info.
  2. Each side can only hold info from tree rows, so:
  3. 1st, 2nd and 3rd row go on side 1;
  4. 4th, 5th and 6th row go on side 2;
  5. 7th, 8th and 9th row go on side 1;
  6. 10th, 11th and 12th go on side 2; and so on.

I will select which group to print.

I’m planning to do it this way: enter image description here

  1. ((row.Index) +1) / 3,
  2. round it up, with no decimals, to get an integer, (like in the above excel image),
  3. MOD that integer by 2, (like in the above excel image).

If the result of that MOD by 2 is 1, then it will print Side 1 arrangement, if the result of that MOD by 2 is 0, then it will print Side 2 arrangement.

  • How do I do it in C#? I'm using VS2010 Express Edition. Also, I wanted to use System.Math.Ceiling but I get a Namespace, decimal, double-precision and floating-point number warnings or errors.

Source: (StackOverflow)

Always Round UP a value in C#

I want to roundup value according to the 3rd decimal point. It should always take the UP value and round. I used Math.Round, but it is not producing a result as i expected.

Scenario 1

var value1 = 2.526;
var result1 = Math.Round(value1, 2); //Expected: 2.53 //Actual: 2.53

Scenario 2

var value2 = 2.524;
var result2 = Math.Round(value2, 2); //Expected: 2.53 //Actual: 2.52

Scenario 1 is ok. It is producing the result as i expected. In the 2nd scenario I have amount as 2.522. I want to consider 3rd decimal point (which is '4' in that case) and it should round UP. Expected result is 2.53

No matter what the 3rd decimal point is (whether it is less than 5 or greater than 5), it should always round UP.

Can anyone provide me a solution? I don't think Math.Round is helping me here.


Source: (StackOverflow)

Swift Round up / Max the NSDecimalNumber

Let's say we have an NSDecimal constant called total and it contains the value of 3.33333333 divided by 10/3. 10 and 3 are both NSDecimalNumber. We want the total to be 4 as an NSDecimalNumber in Swift.

let total = ten/three

// the ideal total would be rounded up whenever there is a floating 

in the doc. we have

func NSDecimalRound(_ result: UnsafeMutablePointer<NSDecimal>,
                  _ number: UnsafePointer<NSDecimal>,
                  _ scale: Int,
                  _ roundingMode: NSRoundingMode)


maximumDecimalNumber()

Which one is the best fit for calculator with currency style? Please include an example each how to use them if you know so. Thank you .


Source: (StackOverflow)