Search Results

Search found 1210 results on 49 pages for 'positive'.

Page 3/49 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Weird Objective-C Mod Behavior

    - by coneybeare
    So I thought that negative numbers, when mod'ed should be put into positive space... I cant get this to happen in objective-c I expect this: -1 % 3 = 2 0 % 3 = 0 1 % 3 = 1 2 % 3 = 2 But get this -1 % 3 = -1 0 % 3 = 0 1 % 3 = 1 2 % 3 = 2 Why is this and is there a workaround?

    Read the article

  • When reversing a Google Analytics e-commerce transaction is the per-unit price positive or negative?

    - by Michael Glenn
    Google's own instructions for reversing an e-commerce transaction seem to contradict themselves regarding the unit price. In the instructions it states The item field has a positive per-unit price and a negative quantity. yet, the code sample has a negative per-unit price and negative quantity. _gaq.push(['_addItem', '1234', // order ID - necessary to associate item with transaction 'DD44', // SKU/code - required 'T-Shirt', // product name 'Olive Medium', // category or variation '-11.99', // unit price - required '-1' // quantity - required ]); Which is correct?

    Read the article

  • A TDD Journey: 4-Tests as Documentation; False Positive Results; Component Isolation

    In Test-Driven Development (TDD) , The writing of a unit test is done more to design and to document than to verifiy. By writing a unit test you close a number of feedback loops, and verifying the functionality of the code is just a minor one. everything you need to know about your class under test is embodied in a simple list of the names of the tests. Michael Sorens continues his introduction to TDD that is more of a journey in six parts, by discussing Tests as Documentation, False Positive Results and Component Isolation.

    Read the article

  • Prevent my program from being flagged as malware

    - by user120242
    I know that this kind of behavior should be avoided in a publicly deployed program, but it's necessary. I do some hooking of process creation and file/registry I/O, and unpacking. I still trip a heuristic here and there, and I'm worried about future detections. Could I just contact as many AV vendors as I can, submit my program, and provide a link to my program being served publicly? Would it be possible to convince AV vendors to "whitelist" it? Does anyone perhaps have a list of places to submit false positives? Another problem I have is with people who don't update their malware scanners. There seems to be many people who just have old malware defintions and never bother to update. Is there anything that can be done about this? Or, if not, a way to check older definitions so I can locate what is being tripped, so I can try to avoid using that code?

    Read the article

  • Accidentally created a virus?

    - by Workshop Alex
    I've seen it happen reasonabley often: I write an application in Delphi and when I compile it, the virus-scanner tells me that I've created a virus and thus immediately deletes the executable again. It's annoying but reasonable easy to fix by doing a full rebuild, deleting the *.dcu files first and sometimes by simply waiting. It happens with Delphi 6, 7, 2005 and 2007, as far as I know. And Symantec, Kaspersky, McAfee and NOD32 have all been guilty of reporting these false positives. I know it's because Delphi adds timestamps to its DCU files and these timestamps end up in the final executable and apparently appear to be part of some random virus signature. I don't want to disable the virus-scanner, not even for a single folder or file. And I'm not really for a solution, but am wondering about the following: Do these false positives also occur with other compilers? Does it also happen with .NET executables? Do others also notice similar problems with Delphi?

    Read the article

  • Preoblem with Precision floating point operation in C

    - by Microkernel
    Hi Guys, For one of my course project I started implementing "Naive Bayesian classifier" in C. My project is to implement a document classifier application (especially Spam) using huge training data. Now I have problem implementing the algorithm because of the limitations in the C's datatype. ( Algorithm I am using is given here, http://en.wikipedia.org/wiki/Bayesian_spam_filtering ) PROBLEM STATEMENT: The algorithm involves taking each word in a document and calculating probability of it being spam word. If p1, p2 p3 .... pn are probabilities of word-1, 2, 3 ... n. The probability of doc being spam or not is calculated using Here, probability value can be very easily around 0.01. So even if I use datatype "double" my calculation will go for a toss. To confirm this I wrote a sample code given below. #define PROBABILITY_OF_UNLIKELY_SPAM_WORD (0.01) #define PROBABILITY_OF_MOSTLY_SPAM_WORD (0.99) int main() { int index; long double numerator = 1.0; long double denom1 = 1.0, denom2 = 1.0; long double doc_spam_prob; /* Simulating FEW unlikely spam words */ for(index = 0; index < 162; index++) { numerator = numerator*(long double)PROBABILITY_OF_UNLIKELY_SPAM_WORD; denom2 = denom2*(long double)PROBABILITY_OF_UNLIKELY_SPAM_WORD; denom1 = denom1*(long double)(1 - PROBABILITY_OF_UNLIKELY_SPAM_WORD); } /* Simulating lot of mostly definite spam words */ for (index = 0; index < 1000; index++) { numerator = numerator*(long double)PROBABILITY_OF_MOSTLY_SPAM_WORD; denom2 = denom2*(long double)PROBABILITY_OF_MOSTLY_SPAM_WORD; denom1 = denom1*(long double)(1- PROBABILITY_OF_MOSTLY_SPAM_WORD); } doc_spam_prob= (numerator/(denom1+denom2)); return 0; } I tried Float, double and even long double datatypes but still same problem. Hence, say in a 100K words document I am analyzing, if just 162 words are having 1% spam probability and remaining 99838 are conspicuously spam words, then still my app will say it as Not Spam doc because of Precision error (as numerator easily goes to ZERO)!!!. This is the first time I am hitting such issue. So how exactly should this problem be tackled?

    Read the article

  • Problem with Precision floating point operation in C

    - by Microkernel
    Hi Guys, For one of my course project I started implementing "Naive Bayesian classifier" in C. My project is to implement a document classifier application (especially Spam) using huge training data. Now I have problem implementing the algorithm because of the limitations in the C's datatype. ( Algorithm I am using is given here, http://en.wikipedia.org/wiki/Bayesian_spam_filtering ) PROBLEM STATEMENT: The algorithm involves taking each word in a document and calculating probability of it being spam word. If p1, p2 p3 .... pn are probabilities of word-1, 2, 3 ... n. The probability of doc being spam or not is calculated using Here, probability value can be very easily around 0.01. So even if I use datatype "double" my calculation will go for a toss. To confirm this I wrote a sample code given below. #define PROBABILITY_OF_UNLIKELY_SPAM_WORD (0.01) #define PROBABILITY_OF_MOSTLY_SPAM_WORD (0.99) int main() { int index; long double numerator = 1.0; long double denom1 = 1.0, denom2 = 1.0; long double doc_spam_prob; /* Simulating FEW unlikely spam words */ for(index = 0; index < 162; index++) { numerator = numerator*(long double)PROBABILITY_OF_UNLIKELY_SPAM_WORD; denom2 = denom2*(long double)PROBABILITY_OF_UNLIKELY_SPAM_WORD; denom1 = denom1*(long double)(1 - PROBABILITY_OF_UNLIKELY_SPAM_WORD); } /* Simulating lot of mostly definite spam words */ for (index = 0; index < 1000; index++) { numerator = numerator*(long double)PROBABILITY_OF_MOSTLY_SPAM_WORD; denom2 = denom2*(long double)PROBABILITY_OF_MOSTLY_SPAM_WORD; denom1 = denom1*(long double)(1- PROBABILITY_OF_MOSTLY_SPAM_WORD); } doc_spam_prob= (numerator/(denom1+denom2)); return 0; } I tried Float, double and even long double datatypes but still same problem. Hence, say in a 100K words document I am analyzing, if just 162 words are having 1% spam probability and remaining 99838 are conspicuously spam words, then still my app will say it as Not Spam doc because of Precision error (as numerator easily goes to ZERO)!!!. This is the first time I am hitting such issue. So how exactly should this problem be tackled?

    Read the article

  • How to calculate both positive and negative angle between two lines?

    - by Jaanus
    There is a very handy set of 2d geometry utilities here. The angleBetweenLines has a problem, though. The result is always positive. I need to detect both positive and negative angles, so if one line is 15 degrees "above" or "below" the other line, the shape obviously looks different. The configuration I have is that one line remains stationary, while the other line rotates, and I need to understand what direction it is rotating in, by comparing it with the stationary line. EDIT: in response to swestrup's comment below, the situation is actually that I have a single line, and I record its starting position. The line then rotates from its starting position, and I need to calculate the angle from its starting position to current position. E.g if it has rotated clockwise, it is positive rotation; if counterclockwise, then negative. (Or vice versa.) How to improve the algorithm so it returns the angle as both positive or negative depending on how the lines are positioned?

    Read the article

  • How do you get positive criticism on your code?

    - by burnt1ce
    My team rarely does code review, mainly because we don't have enough time and people lack the energy and will to do so. But I would really like to know what people think about my code when they read it. This way, I have a better understanding how other people think and tailor my code accordingly so it's easier to read. So my question is, how do I get positive criticism on my code? My intent is to understand how people think so I can write more readable code.

    Read the article

  • Positive result, negative result and current balance. How do you make starting balance show current result?

    - by Tine
    I have 3 columns. Column A shows positive result and if the result is negative then it is in a column B. Column B shows negative result and if the result is positive then it is in a column A. (meaning that either columns can have 0.00 in the cell (empty zero cells)). Column C has starting assets and it also shows the current balance that while result A or B are adding up and current balance is showing the current result. What is the proper formula for this I hope I was clear with my problem. Please help. Thanks in advance!

    Read the article

  • Mutable Records in F#

    - by MarkPearl
    I’m loving my expert F# book – today I thought I would give a post on using mutable records as covered in Chapter 4 of Expert F#. So as they explain the simplest mutable data structures in F# are mutable records. The whole concept of things by default being immutable is a new one for me from my C# background. Anyhow… lets look at some C# code first. using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MutableRecords { public class DiscreteEventCounter { public int Total { get; set; } public int Positive { get; set; } public string Name { get; private set; } public DiscreteEventCounter(string name) { Name = name; } } class Program { private static void recordEvent(DiscreteEventCounter s, bool isPositive) { s.Total += 1; if (isPositive) s.Positive += 1; } private static void reportStatus (DiscreteEventCounter s) { Console.WriteLine("We have {0} {1} out of {2}", s.Positive, s.Name, s.Total); } static void Main(string[] args) { var longCounter = new DiscreteEventCounter("My Discrete Counter"); recordEvent(longCounter, true); recordEvent(longCounter, true); reportStatus(longCounter); Console.ReadLine(); } } } Quite simple, we have a class that has a few values. We instantiate an instance of the class and perform increments etc on the instance. Now lets look at an equivalent F# sample. namespace EncapsulationNS module Module1 = open System type DiscreteEventCounter = { mutable Total : int mutable Positive : int Name : string } let recordEvent (s: DiscreteEventCounter) isPositive = s.Total <- s.Total+1 if isPositive then s.Positive <- s.Positive+1 let reportStatus (s: DiscreteEventCounter) = printfn "We have %d %s out of %d" s.Positive s.Name s.Total let newCounter nm = { Total = 0; Positive = 0; Name = nm } // // Using it... // let longCounter = newCounter "My Discrete Counter" recordEvent longCounter (true) recordEvent longCounter (true) reportStatus longCounter System.Console.ReadLine() Notice in the type declaration of the DiscreteEventCounter we had to explicitly declare that the total and positive value holders were mutable. And that’s it – a very simple example of mutable types.

    Read the article

  • Adding negative and positive numbers in java without BigInt.

    - by liamg
    Hi, i'm trying to write a small java class. I have an object called BigNumber. I wrote method that add two positive numbers, and other method that subract two also positive numbers. Now i want them to handle negative numbers. So the i wrote couple of 'if' statements eg. if (this.sign == 1 /* means '+' */) { if (sn1.sign == 1) { if (this.compare(sn1) == -1 /* means this < sn1 */ ) return sn1.add(this); else return this.add(sn1); } etc. Unfortunately the code looks just ugly. Like a bush of if's and elses. Is there a better way to write that kind of code? Edit i can't just do this.add(sn1) beacuse sometimes i want to add positive number to negative one or negitve to negative. But add can handle only positive numbers. So i have to use basic math and for example: instead of add negative number to negative number i add this.abs() (absolute value of number) to sn1.abs() and return the result with opposite sign. Drew: this lines are from method _add. I use this method to decide what to do with numbers it receive. Send them to add method? Or send them to subract method but with different order (sn1.subtract(this))? And so on.. if (this.sign == 1) { if (sn1.sign == 1) { if (this.compare(sn1) == -1) return sn1.add(this); else return this.add(sn1); } else if (wl1.sign == 0) return this; else { if (this.compare(sn1.abs()) == 1) return this.subtract(sn1.abs()); else if (this.compare(sn1.abs()) == 0) return new BigNumber(0); else return sn1.abs().subtract(this).negate(); // return the number with opposite sign; } } else if (this.sign == 0) return sn1; else { if (wl1.sign == 1) { if (this.abs().compare(sn1) == -1) return sn1.subtract(this.abs()); else if (this.abs().compare(sn1) == 0) return new BigNumber(0); else return this.abs().subtract(sn1).negate(); } else if (sn1.sign == 0) return this; else return (this.abs().add(wl1.abs())).negate(); } As you can see - this code looks horrible..

    Read the article

  • Google Maps pour iOS aurait une influence positive sur l'adoption d'iOS 6 mais les avis sont partagés, l'appli numéro 1 sur l'AppStore

    Apple pourrait refuser d'intégrer l'application Google Maps dans l'AppStore D'après Google, qui se dit « peu optimiste » Selon The Guardian, ce n'est pas de sitôt que l'application Google Maps fera son retour sur iOS. C'est en tout cas ce qu'aurait laissé entendre une source du journal britannique, un employé de Google proche de la division qui travaille sur ce projet. Cette source affirme que Google n'est « pas optimiste » sur l'attitude que va avoir Apple lors de la prochaine soumission de l'application sur l'AppStore. Pour mémoire, une des « nouveautés » d'iOS 6 a été ...

    Read the article

  • Strange Matlab error: "??? Subscript indices must either be real positive integers or logicals"

    - by Roee Adler
    I have a function func that returns a vector a. I usually plot a and then perform further analysis on it. I have a certain scenario when once I try to plot a, I get a "??? Subscript indices must either be real positive integers or logicals" error. Take a look at the following piece of code to see the vector's behavior: K>> a a = 5.7047 6.3529 6.4826 5.5750 4.1488 5.8343 5.3157 5.4454 K>> plot(a) ??? Subscript indices must either be real positive integers or logicals. K>> for i=1:length(a); b(i) = a(i); end; K>> b b = 5.7047 6.3529 6.4826 5.5750 4.1488 5.8343 5.3157 5.4454 K>> plot(b) ??? Subscript indices must either be real positive integers or logicals. The scenario where this happens is when I call function func from within another function (call it outer_func), and return the result directly as outer_func's result. When debugging inside outer_func, I can plot a properly, but outside the scope of outer_func, its result has the above behavior. What can cause this? Where do I start from?

    Read the article

  • Hijack.StartMenu Malwarebytes Anti-Malware is a false positive?

    - by Senseful
    I just ran the Malwarebytes Anti-Malware quick scan for the first time and it found: Registry Data Items Infected: HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_ShowSearch (Hijack.StartMenu) - Bad: (0) Good: (1) - No action taken. I just wanted to double check (and provide a top Google result for people in the future that might have the same issue) that this was a false positive and can be safely right-click ignored.

    Read the article

  • Define a positive number to be isolated if none of the digits in its square are in its cube [closed]

    - by proglaxmi
    Define a positive number to be isolated if none of the digits in its square are in its cube. For example 163 is n isolated number because 69*69 = 26569 and 69*69*69 = 4330747 and the square does not contain any of the digits 0, 3, 4 and 7 which are the digits used in the cube. On the other hand 162 is not an isolated number because 162*162=26244 and 162*162*162 = 4251528 and the digits 2 and 4 which appear in the square are also in the cube. Write a function named isIsolated that returns 1 if its argument is an isolated number, it returns 0 if its not an isolated number and it returns -1 if it cannot determine whether it is isolated or not (see the note below). The function signature is: int isIsolated(long n) Note that the type of the input parameter is long. The maximum positive number that can be represented as a long is 63 bits long. This allows us to test numbers up to 2,097,151 because the cube of 2,097,151 can be represented as a long. However, the cube of 2,097,152 requires more than 63 bits to represent it and hence cannot be computed without extra effort. Therefore, your function should test if n is larger than 2,097,151 and return -1 if it is. If n is less than 1 your function should also return -1. Hint: n % 10 is the rightmost digit of n, n = n/10 shifts the digits of n one place to the right. The first 10 isolated numbers are N n*n n*n*n 2 4 8 3 9 27 8 64 512 9 81 729 14 196 2744 24 576 13824 28 784 21952 34 1156 39304 58 3364 195112 63 3969 250047

    Read the article

  • Random MongoDb Syntax: Updates

    - by Liam McLennan
    I have a MongoDb collection called tweets. Each document has a property system_classification. If the value of system_classification is ‘+’ I want to change it to ‘positive’. For a regular relational database the query would be: update tweets set system_classification = 'positive' where system_classification = '+' the MongoDb equivalent is: db.tweets.update({system_classification: '+'}, {$set: {system_classification:'positive'}}, false, true) Parameter Description { system_classification: '+' } the first parameter identifies the documents to select { $set: { system_classification: 'positive' } } the second parameter is an operation ($set) and the parameter to that operation {system_classification: ‘positive’} false the third parameter indicates if this is a regular update or an upsert (true for upsert) true the final parameter indicates if the operation should be applied to all selected documents (or just the first)

    Read the article

  • Finding the maximum weight subsequence of an array of positive integers?

    - by BeeBand
    I'm tring to find the maximum weight subsequence of an array of positive integers - the catch is that no adjacent members are allowed in the final subsequence. The exact same question was asked here, and a recursive solution was given by MarkusQ. He provides an explanation, but can anyone help me understand how he has expanded the function? How does this solution take into consideration non-adjacent members?

    Read the article

  • How can I set the order of the positive and negative buttons in AlertDialog?

    - by Micah Hainline
    Why I want to do this is another discussion entirely, but I need to figure out the best way to make all my alert dialogs have the positive button on the right side. Note that in version 3.0 and below the buttons normally appear as OK / Cancel and in 4.0 and above it is Cancel / OK. I want to force my application to use Cancel / OK in the simplest way possible. I have a lot of AlertDialogs in the application.

    Read the article

  • C#. Whats the fastest way to make an integer positive

    - by maxima120
    I asked wrong question previously and was swamped with negative votes... Let me try again... What is absolutely fastest way to make an int positive (given 50/50 distribution of pos/neg over time). To be nominated for an answer I will require MSIL analysis and not a guess or measuring of time with granny's watch... P.S. as one of variations I proposed i * i not because I wanted to do Sqrt(i * i) afterwards but because i will be used only once to be compared to a const. And if i * i will win competition I simply multiply the const.. Hence the following solution is valid: int trigger = realTrigger * realTrigger; i = SomeCalcs(); i = i * i; if(i < trigger) DoSomething(); P.P.S. pointless rant is not acceptable.. like: why do you need this, its BS! C# cannot tolerate developers like you!

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >