Rails Rspec integer equals string ("1" == 1)

How, in rspec, do you compare the value of something while ignoring the type? Failure/Error: expect(variable).to eql model.id expected: 1234 got: "1234" (compared using eql?) I've tried eq (which compares using ==) and eql (which comp...
more »

2017-01-13 11:01 (2) Answers

Python3 division issues

I am new to Python3 and facing this particular issue. I want 6/2 to give an answer of 3 instead of 3.0, but at the same time i want 7/2 to give me 3.5 On using '//' it converts all the float values to integer values. ...
more »

2017-01-12 17:01 (1) Answers

Python not enough armugents for format string

I try to open a specific page on google. Like the user types in a search keyword and the specific site (e.g. "2") and then it gives the results. So, the search is generally working. Now I tried to put the specific site in. class Google: @class...
more »

2017-01-12 16:01 (2) Answers

C Trying to validate integer

Trying to validate integer but when wrong value type entered an infinite loop of first printf appears. int main(int argc, char *argv[]) { int input; do{ int starCount; printf("Please enter a number:"); scanf("%d",input); do{ ...
more »

2017-01-12 00:01 (1) Answers

Spinner can't actually not resolve to Double

I'm not new at programming, surely in java (well i thought), but it just happened something strange. In school i've worked on a JavaFX project with Spinners for double values So in my Controller I've that : @FXML private Spinner<Double> widt...
more »

2017-01-11 19:01 (2) Answers

VB 2012: Assign Variables to PictureBox

I'm currently creating a board game using VB 2012. One issue I've found while trying to code the game itself is assigning numerical values to a PictureBox. For context, I need to assign a value to each cardinal point of the Image for use in the gam...
more »

2017-01-11 10:01 (0) Answers

Java Integer VS INT

Sorry Folks. This is Oracle OAF.(OA Frame Work) syntax for calling java.Its ORACLE Provided tool. I am trying to assign a NULL value returned from ORACLE DB into a JAVA Integer Variable. But when I try to assign, it always return 0, not null. publi...
more »

2017-01-09 21:01 (0) Answers

How to convert SI units to number using python

I want to convert the numbers which come with the letters and convert it based on the value each letter specifies. Like a number 1M should be read as 1000000 and a number 1K should be read as 1000. Is there some simple method to get this done? ...
more »

2017-01-09 16:01 (2) Answers

Searching values from 0 to 1 java

I am trying to solve a puzzle by taking following coordinates from a file and finding the way from 0 to 1 by putting these into ArrayList and then starting from int 0 and finding whats it connect with and going to 1. 11 3 2 3 0 3 1 4 5 4 5 7 6 7 7 ...
more »

2017-01-09 12:01 (1) Answers

Android Studio edit text numeric type

I need to store an integer value into database, so I need to convert the value of the textfields into integers and for some reason I'm getting this exception: java.lang.NumberFormatException: Invalid int: "android.widget.EditText{431fbec VFED..CL. ....
more »

2017-01-08 19:01 (2) Answers

Round Floating Decimal Number UP

I am currently rounding numbers with floating decimals in python. I thought that the numbers were being rounded UP to a whole integer but, I am suspicious... What is the best way to ensure a rounding UP to the nearest whole integer? Data for "snw" ...
more »

2017-01-06 16:01 (1) Answers

AppleScript check if list item's value is integer

In AppleScript I'm trying to learn how to check the value of a list's items but when I try to check wether the item is an integer I get inaccurate results. First I referenced Apple's Automation scripting guide under the section Determining if a List...
more »

2017-01-05 16:01 (2) Answers

Int data type storage always 4 bytes?

Quick question does using an INT in MySQL always result in 4 bytes of storage no matter the value, e.g. Does the value of 5 use the same amount of bytes as 2000000? Or is the data type storage a maximum storage? ...
more »

2017-01-05 12:01 (1) Answers

Python 3 code - Rounding integers

I am trying to round numbers up in python 3. In my existing code, the number either round up to the nearest 10 or down. For example, 67 goes to 70 and 64 goes to 60. I would like the number to always round up to the nearest multiple of 10, so that 67...
more »

2017-01-04 23:01 (1) Answers

Cast undefined to 0

Is there a succinct operation in JavaScript (ES2015) that does this: x => x === undefined ? 0 : x I keep running into situations where I want to increment x, but it's initially undefined, so the code becomes: foo.bar = (foo.bar === undefined ?...
more »

2017-01-04 03:01 (2) Answers

Convert a GUID into an integer Powershell?

I have a Webservice which tells me this is the function parameters.. Public Function Create(ByVal Name As String, ByVal templateId As Integer) The issue is the templateid is a GUID. if i pass this into the Function the function wont work as i...
more »

2017-01-03 19:01 (2) Answers

Int into label SpriteKit SKView, hl

I just want to know if is it possible to make a label or anything else who will be a integer and to display it to my gameview. var pvElf = SKLabelNode(fontNamed:"Chalkduster") pvElf.text = "100"; pvElf.fontSize = 45; pvElf.position = CGPoint(x:370, ...
more »

2017-01-03 17:01 (1) Answers