Questions tagged [operation]
734 questions
12
votes
7 answers
Java - How to check if a division is an integer or a float?
Couldnt think of a better title.
Well the problem is:
I have the "int i", it can be any value. my goal is to transform the "int i" to the closest number divisible by 16.
For example, I got i = 33. Then i will be turned to 32 (16x2).But if I get i =…

user1541106
- 241
- 1
- 6
- 12
11
votes
4 answers
floating-point operations with bash
how can I transform the string "620/100" into "6.2" in a bash script
The context of my question is about image processing. EXIF data are coding the focal length in fractional format, while I need the corresponding decimal string.
Thanks for helping,…

quickbug
- 4,708
- 5
- 17
- 21
11
votes
4 answers
How to select odd or even items from a row in SQL?
I need only even or odd items, so I find modulus operation and this doesn't works
SELECT * FROM table ORDER BY id WHERE MOD (num, 2) = 1 ASC;
Please help me, I'm noob in sql, as I haven't done much in it.

Ronalds Mazītis
- 323
- 2
- 5
- 18
10
votes
1 answer
MongoDB - $addToSet on a list of Embedded Document
I have a list of (mongodb) Embedded Documents within one Document and I am interested in adding a new embedded document to the list of the existing ones.
As far as I have researched, I can use $addToSet, what I can't figure out is how does MongoDB…

Clara
- 2,935
- 6
- 34
- 49
9
votes
3 answers
Stop current operation in Visual Studio
When using Visual Studio I often encounter situations when the IDE freezes while performing some operation. For instance, this frequently happens when I move next statement pointer (yellow arrow) during the debug session, when I unintentionally…

Sergiy Belozorov
- 5,856
- 7
- 40
- 73
9
votes
3 answers
Dot Product in Python without NumPy
Is there a way that you can preform a dot product of two lists that contain values without using NumPy or the Operation module in Python? So that the code is as simple as it could get?
For example:
V_1=[1,2,3]
V_2=[4,5,6]
Dot(V_1,V_2)
Answer: 32

Michael Minkoff
- 121
- 1
- 1
- 5
8
votes
8 answers
How to create a file using javascript in Mozilla Firefox
I want to write a function in javascript which creates a file and write some content to it, iam working with firefox, can anybody help me in this case.
Thanks...

minu
- 91
- 1
- 1
- 2
8
votes
3 answers
behavior vs operation in UML
To the best of my knowledge,
the operation is resides in the second compartment of class at class diagram.
The following is Behavior definition from UML specification(August 2011 ,page 445)
13.3.2 Behavior (from BasicBehaviors)
Behavior is a…

user2019510
- 1,460
- 5
- 16
- 29
8
votes
3 answers
java Bit operations >>> shift
Why if
int x = -1 // binary: 11111111111111111111111111111111
x = x >>> 31;
we have 00000000000000000000000000000001
but if
int x = -1
x = x >>> 32;
we have 11111111111111111111111111111111 (again -1)
but not 00000000000000000000000000000000 ?

ses
- 13,174
- 31
- 123
- 226
8
votes
4 answers
Force method call on null variable to throw a NullPointerException
Possible Duplicate:
How come invoking a (static) method on a null reference doesn’t throw NullPointerException?
Static fields on a null reference in Java
I tried the code from this old video:
class Impossible {
public static void…
user1849186
7
votes
1 answer
Swift - Application crash when using two different OperationQueues with KVO
I'm getting two type of information with JSON and I'm adding "operations" to 2 different Operation Queues Classes with addObserver(forKeyPath:"operations"...).
In the function observeValue I'm checking if operationQueue1.operations.isEmpty and then…

Bogdan Bogdanov
- 882
- 11
- 36
- 79
7
votes
1 answer
Why can't I use Set:union() instead of Set.union?
I am learning Lua and I would rather use the colon (:) for methods. Unfortunately, it's not working everywhere. See my code:
Set= {}
local mt= {}
function Set:new(m)
local set= {}
setmetatable(set,mt)
for a,b in pairs (m) do
…

Thomas
- 179
- 2
- 3
- 9
7
votes
3 answers
In Extjs4.1, how to add additional params before one store sync?
In store, there is an event beforeload:
beforeload( Ext.data.Store store, Ext.data.Operation operation, Object eOpts )
by listening to this event, i can add my additional param to operation when i do query action, like this:
store.on('beforeload',…

txx
- 81
- 1
- 4
7
votes
2 answers
Basic Numpy array value assignment
As a small exercise before i start playing with numeric code in python I am trying to make an LDLT algorithm. Just to "get the feet wet".
However I seem to be lacking a fundamental understanding of the numpy array. See the following example:
def…

Daniel
- 385
- 1
- 4
- 12
7
votes
2 answers
Can I convert a string to a math operation in java?
can I convert a string like "3*3+3" to math operation in java??

Mohamed Magdy Hassan
- 105
- 2
- 6