print_r($pages);
print max($pages);
print min($pages);
shows me
Array ( [0] => 1 [1] => 2 [2] => 3 ) 1 2
While I was expecting the last two numbers to be 3 and 1. How come?
I would like to test if an instance variable lies in a range of numbers. I solved the problem by using assert_in_delta but would like to know if there is a formal assertion for this.
#part of the tested class
def initialize(value = 70 + rand(30))
@value = value
end
#test_value.rb
class ValueTestCase < Test::Unit::TestCase
def test_if_value_in_range
assert_in_delta(85, p.value, 15)
end
end
I have a file which is as follows:
15:03:21 II 0.88 0.64
15:03:31 II 0.88 0.64
15:03:42 II 0.40 0.40
etc.
after loading the file in matlab, I want to be able to read the first column (which corresponds to time) and interpret them as numerical values. At the moment, they are interpreted as a string of ascii characters and i can't perform any mathematical operations on them. Does anyone have any suggestions as to how i can read the time as numbers instead of a string of ascii characters?
Im trying to build a calculator with PyQt4 and connecting the 'clicked()' signals from the buttons doesn't as expected.
Im creating my buttons for the numbers inside a for loop where i try to connect them afterwards.
def __init__(self):
for i in range(0,10):
self._numberButtons += [QPushButton(str(i), self)]
self.connect(self._numberButtons[i], SIGNAL('clicked()'),
lambda : self._number(i))
def _number(self, x):
print(x)
When I click on the buttons all of them print out '9'.
Why is that so and how can i fix this?
When I run apache bench I get results like:
Command: abs.exe -v 3 -n 10 -c 1 https://mysite
Connection Times (ms)
min mean[+/-sd] median max
Connect: 203 213 8.1 219 219
Processing: 78 177 88.1 172 359
Waiting: 78 169 84.6 156 344
Total: 281 389 86.7 391 563
I can't seem to find the definition of Connect, Processing and Waiting. What do those numbers mean?
How to add additional font in android environment? I need to make a font like LCD with pale background numbers like this:
http://www.androidfreeware.net/img2/gps_speedometer_android_1.png
I want to hash/encode a unique integer (database ID) to create a similarly unique string.
It needs to meet the following requirements:
Must start with a letter or number, and can contain only letters and numbers.
All letters in a container name must be lowercase.
Must be from 3 through 63 characters long (although the shorter the better)
The result does not need to be reversible, just repeatable - so a 1-way hash would be fine.
i need to work with a binary number
i just write :
const x = 00010000 ;
& it doesn't work
i know that i can use an hexadecimal number that have the same value as 00010000 but for more knowledge i want to know if there is a type in C++ for binary numbers & if there isn't ,is there another solution for my Problem ?
thanks
I get output files from very old Fortran programs, which look like:
0.81667E+00 -0.12650E+01 -0.69389E-03
0.94381E+00 -0.11985E+01 -0.11502E+00
0.96064E+00 -0.11333E+01 -0.17616E+00
0.10202E+01 -0.12435E+01 -0.93917E-01
0.10026E+01 -0.10904E+01 -0.15108E+00
0.90516E+00 -0.11030E+01 -0.19139E+00
0.98624E+00 -0.11598E+01 -0.22970E+00
Is it possible to read this in Python and convert the numbers to "normal" floats?
Here's my script. I want some square-shaped draggable objects (in this case just td boxes with numbers in them) to be able to snap to some empty table cells and snap to the center of those cells (empty td boxes), not the top or bottom of those cells, which is what is seems to do by default.
<script type="text/javascript">
$(document).ready(function () {
$(".inputs div").draggable( {
snap: ".spaces"
}
);
});
</script>
In our project we use plugin for jQuery - Galleriffic (http://www.twospy.com/galleriffic/), it allows you to do slideshow with photo set.
How to hide buttons prev/next in "pagination" block?
In the navigation ("pagination" block) should be only the page numbers without buttons prev/next.
I am trying to save the value "6.714285714285714" into a DOUBLE datatype field.
Unfortunately it does not fit at all and is cutted by one char. Storing larger numbers becomes less precise.
Already searched in the mysql manual and it seems to be that double is the most precise data type available. Anyone knows a practicable workaround?
Sorry for my bad english and thx a lot!
users table:
id-user-other columns
scores table:
id-user_id-score-other columns
They're are more than one rows for each user, but there's only two scores you can have. (0 or 1, == win or loss). So I want to output all the users ordered by the number of wins, and all the users ordered by the numbers of losses.
I know how to do this by looping through each user, but I was wondering how to do it with one query. Any help is appreciated!
I have been able to read an excel cell value with xlrd using column and row numbers as inputs. Now I need to access the same cell values in some spreadsheets that were saved in .ods format.
So for example, how would I read the value stored in cell E10 from a .ods file from python?
Given a array of random integers, sort the odd elements in descending order and even numbers in ascending order.
e.g. for input (1,4,5,2,3,6,7)
Output = (7,5,3,1,2,4,6)
Optimize for time complexity.
Say I have a file of this format
12:04:21 .3
12:10:21 1.3
12:13:21 1.4
12:14:21 1.3
..and so on
I want to find repeated numbers in the second column for, say, 10 consequent timestamps, thereby finding staleness.
and I want to output the beginning and and end of the stale timestamp range
Can someone help me come up with it?
You can use awk, bash
Thanks
Is there a short way to check/get for least significant bit in a 32-bit integer, in MIPS? It is obviously set for the odd numbers and an algorithm which checks for the whole number is odd or even can decide for this. But I just wonder is there a better way to do this...
A project I'm on requires Visual Studio 2005. One annoyance is that when a website project in the solution, any compile errors from .aspx or .ascx files show up like:
(0,0): warning CS0168: The variable 'ex' is declared but never used
(0,0): warning CS0162: Unreachable code detected
(0,0): warning CS0168: The variable 'ex' is declared but never used
(0,0): warning CS0168: The variable 'ex' is declared but never used
How can I track these down? Is there an option I'm missing that gives me filename and line numbers?
It is possible to write a code that specifying the rows and column of spread sheet in terms of NUMBERS and NOT LIKE (B2:D6)
Example:
excelSheet.Range("B2:D6").Interior.Color = RGB(100, 100, 255)
instead of B2 and D6 I want to write 5 rows and 3 column..
It is posible to write in vb.net 2003 code?
I have an List<int> which contains 1,2,4,7,9 for example.
I have a range from 0 to 10.
Is there a way to determine what numbers are missing in that sequence?
I thought LINQ might provide an option but I can't see one
In the real world my List could contain 100,000 items so performance is key
For example, in this simple function where fun1 takes as input two numbers, adds them together and passes them to function 2 for printing the output. var1_in is local to each function, so is it OK to use the name var1_in in both functions, or is it better practice to call them different things?
fun1 <- function (var1_in, var2_in) {
var3 = var1_in + var2_in
fun2(var3)
}
fun2 <- function (var1_in) {
var4 = var1_in
print(var4)
}
Hi,
I want to do something like this...
try
{
# Something in this function throws an exception
Backup-Server ...
}catch
{
# Capture stack trace of where the error was thrown from
Log-Error $error
}
Ideally I'd like to capture arguments to the function and line numbers etc. (like you see in get-pscallstack)
Any ideas how to achieve this?
Dave
Here's my code:
qplot(data=sites, x, y, main="Site 349")
(p <- qplot(data = sites, x, y, xlab = "", ylab = ""))
(p1 <- p + geom_smooth(method = "loess",span=0.5, size = 1.5))
p1 + theme_bw() + opts(title = "Site 349")
Some of the LOESS lines and confidence intervals go below zero, but I would like to restrict the graphics to 0 and positive numbers (because negative do not make sense). How can I do this?
Sorry for this not being a "real" question, but Sometime back i remember seeing a post here about randomizing a randomizer randomly to generate truly random numbers, not just pseudo random. I dont see it if i search for it.
Does anybody know about that article?
Any suggestions on the best way to display this table on an Android platform? The formatting is not necessary but I am looking for a flexible way to do this because there are numerous tables with different numbers of rows and columns.