Robert Rawlins wrote:
I’ve got what seems to me to be a totally illogical math issue here
which I can’t figure out. Take a look at the following code:
/self/.__logger.info(/"%i / %i"/ % (bytes_transfer red,
/self/.__sessions[path].total_bytes))
percentage = bytes_transferr ed /
/self/.__sessions[path].total_bytes * 100
/self/.__logger.info(/"%i"/ % percentage)
Seems fairly straight forward, you would think. It takes two values and
calculates the percentage of one from the other, however, percentage
always comes back as ‘0’ for some reason, look at this log output.
if you divide two integers, you'll get an integer back (in Python 2.X,
at least). quick fix:
percentage = bytes_transferr ed * 100 / total_bytes
</F> 1 1306
On Jul 21, 3:52*am, Fredrik Lundh <fred...@python ware.comwrote:
Robert Rawlins wrote:
I’ve got what seems to me to be a totally illogical math issue here
which I can’t figure out. Take a look at the following code:
* * * * /self/.__logger.info(/"%i / %i"/ % (bytes_transfer red,
/self/.__sessions[path].total_bytes))
* * * * percentage = bytes_transferr ed /
/self/.__sessions[path].total_bytes * 100
* * * * /self/.__logger.info(/"%i"/ % percentage)
Seems fairly straight forward, you would think. It takes two values and
calculates the percentage of one from the other, however, percentage
always comes back as ‘0’ for some reason, look at this log output.
if you divide two integers, you'll get an integer back (in Python 2.X,
at least). *quick fix:
* * * percentage = bytes_transferr ed * 100 / total_bytes
</F>
The most wonderful statement in the Python language is
from __future__ import division This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bhavin Patel |
last post by:
Hi
i have one table
2 user tires to select records from that table.
1st user select some records
2nd tries to select some records .
so second user is not able to see records selected by 1st user.
till operation is not completed by 1st user on selected records.
Can you sugest somthing that solve my problem
|
by: Ugur ASLAN |
last post by:
Hello,
I want to implement a class structure that can take a querystring and the
value of querysting can be called as myClass.getQuery("test").value. I know
that I can do it like myClass.getQuery("test") and get the value of "test"
querystring. But actually, this is an example only. In order to my class
library organized I need a structure like this.
I search internet and documents for ASP and Vbscript, as far as I found is
that in...
|
by: dpulgarin |
last post by:
Hi,
My name is Diego. I am a new member of the Forum and relatively new to IIS v6.0.
I'd like to take this opportunity to post a new message about an issue I've been experiencing lately. Hopefully, you experts would be able to shed some light.
Problem Description: I keep receiving the following error message when I try to connect to or access an IIS Instance from my Windows XP workstation using the "Internet Information Services...
|
by: pintu |
last post by:
Hi Friends.
in my application i am facing problems in maintaining session state. I
am working on asp.net 2.0.
So i didnt checked the session on each page and almost the project is
completed. Now problem is like after 20 minutes the session gets
ended.so session related errors are coming when any operation like
insert or update is performed after that 20 minutes. how can i
redirect that page to login page after session timeout.I hav to...
|
by: Schraalhans Keukenmeester |
last post by:
I suspect the following problem IS hosting provider specific, but they
haven't been able to help me out so far. Perhaps I am doing something
wrong and someone is able to spot the issue... Here goes.
The actual path of the root dir of my account with hosting provider
(H.P.) is:
/usr/local/psa/home/vhosts/mydomain.com/
The webroot is a subdir of the root:
/usr/local/psa/home/vhosts/mydomain.com/httpdocs.
Include files go in:
| |
by: SubhaSundar |
last post by:
Hi,
We are testing a web application developed in Java. There is a web page with a link which takes us to a popup window. In that window, we will be checking a checkbox and there will be only one Close button, which will close that window. Then again we are back to the same old web page with the same link.
If we click the same link, the checkbox is unchecked without retaining the value. But this scenario is working fine in developer's...
|
by: Robert Rawlins |
last post by:
if you divide two integers, you'll get an integer back (in Python 2.X,
Hey </F>
That worked a charm mate, thanks for the info.
</R>
|
by: Fredrik Lundh |
last post by:
sahasranaman wrote:
you mean that
a.0 / 3 * 100
works in your Python version? that's interesting.
(maybe you should at least skim the the thread before you jump in?)
|
by: ValValVal |
last post by:
Please sorry for my dumb question but I cannot find information on how I can change settings so that in NetBeans 6.1 I can edit blue guarded areas.
I read in FAQ NetBeans Wiki: FaqFormEditingGuardedBlocks that I had to change something in Properties->Code ,but I really can't figure out what this should be.
Thanks in advance.
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |