Search Results

Search found 2896 results on 116 pages for 'comparison operators'.

Page 20/116 | < Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >

  • N-gram split function for string similarity comparison

    - by Michael
    As part of excersise to better understand F# which I am currently learning , I wrote function to split given string into n-grams. 1) I would like to receive feedback about my function : can this be written simpler or in more efficient way? 2) My overall goal is to write function that returns string similarity (on 0.0 .. 1.0 scale) based on n-gram similarity; Does this approach works well for short strings comparisons , or can this method reliably be used to compare large strings (like articles for example). 3) I am aware of the fact that n-gram comparisons ignore context of two strings. What method would you suggest to accomplish my goal? //s:string - target string to split into n-grams //n:int - n-gram size to split string into let ngram_split (s:string, n:int) = let ngram_count = s.Length - (s.Length % n) let ngram_list = List.init ngram_count (fun i -> if( i + n >= s.Length ) then s.Substring(i,s.Length - i) + String.init ((i + n) - s.Length) (fun i -> "#") else s.Substring(i,n) ) let ngram_array_unique = ngram_list |> Seq.ofList |> Seq.distinct |> Array.ofSeq //produce tuples of ngrams (ngram string,how much occurrences in original string) Seq.init ngram_array_unique.Length (fun i -> (ngram_array_unique.[i], ngram_list |> List.filter(fun item -> item = ngram_array_unique.[i]) |> List.length) )

    Read the article

  • Date comparison Iphone

    - by rakesh-bhatt99
    i have a range of weekly dates like example 1-5-2010 to 7-5-2010 i want the only records which are between two dates how can i compare dates? and how can i get current week dates.. from current dates...? thnx in advance..

    Read the article

  • Comparison of free open source ecommerce solutions

    - by nute
    I want to launch a small online shop. I've heard of several open source ecommerce solutions out there. Is there a website, page, or something that could help me choose the right one? I've heard of osCommerce, magento, joomla+ecommerce ... I'm looking for a free solution, preferably in PHP so I can tweak it if needed. Thanks!

    Read the article

  • Date Comparison using Java

    - by Lakshman
    I have two dates: toDate (user input in MM/dd/yyyy format) currentDate (obtained by new Date()) I need to compare the currentDate with toDate. I have to display a report only when the toDate is equal to or more than currentDate. How can I do that?

    Read the article

  • Why is this Java Calendar comparison bad?

    - by joe7pak
    Hello folks. I'm having an inexplicable problem with the Java Calendar class when I'm trying to compare to dates. I'm trying to compare to Calendars and determine if their difference is than 1 day, and do things bases on that difference or not. But it doesn't work. If I do this with the two dates: String currDate = aCurrentUTCCalendar.getTime().toString(); String localDate = aLocalCalendar.getTime().toString(); I get these results: currDate = "Thu Jan 06 05:58:00 MST 2010" localDate = "Tue Jan 05 00:02:00 MST 2010" This is correct. But if I do this: long curr = aCurrentUTCCalendar.getTime().getTime(); long local = aLocalCalendar.getTime().getTime(); I get these results: ( in milliseconds since the epoch ) curr = -125566110120000 local = 1262674920000 Since there is only about a 30 hour different between the two, the magnitudes are vastly different, not to mention that annoying negative sign. This causes problems if I do this: long day = 60 * 60 * 24 * 1000; // 86400000 millis, one day if( local - curr > day ) { // do something } What's wrong? Why are the getTime().toString() calls correct, but the getTime().getTime() calls are vastly different? I'm using jdk 1.6_06 on WinXP. I can't upgrade the JDK for various reasons.

    Read the article

  • help, stuck with logic variable comparison loop, javascript

    - by Jamex
    I have an input text box for search of input, the id of the text box is: id="search". if a user enters 'cat' at first and hit search. In the function, I get the value 'cat' by using the syntax: var input = document.getElementById("search").value; After that, the user enter 'dog' in the search box and hit search using the same function. The function would assign 'dog' to the input variable. How would I compare the current value (dog) to the previously entered value (cat)? I have tried to assign the original input with a statement, something like var orig = input; but that would only overwrite the original input with the new input. What is the logical approach to this problem.

    Read the article

  • What are these values representative of in C bitwise operations?

    - by ajax81
    Hi All, I'm trying to reverse the order of bits in C (homework question, subject: bitwise operators). I found this solution, but I'm a little confused by the hex values (?) used -- 0x01 and 0x80. unsigned char reverse(unsigned char c) { int shift; unsigned char result = 0; for (shift = 0; shift < CHAR_BITS; shift++) { if (c & (0x01 << shift)) result |= (0x80 >> shift); } return result; } The book I'm working out of hasn't discussed these kinds of values, so I'm not really sure what to make of them. Can somebody shed some light on this solution? Thank you!

    Read the article

  • Hashbytes comparison in stored proceduring not matching record

    - by Michael Itzoe
    The password field in my user table (SQL Server 2008) is encrypted using HASHBYTES on insertion. I have a stored procedure with parameters for the username and plain-text password which does a SELECT using that username and the password sent through HASHBYTES, then returns the user record if it finds a match. The SP is always returning an empty recordset, but if I copy and paste just the SELECT from the SP to a new query window, it returns the matched record. There're no other statements in the SP. I'm missing something here; what is it?

    Read the article

  • Console App Mouse-Click X Y Coordinate Detection/Comparison

    - by Bloodyaugust
    I have a game that I am working on in a C# console application, purely as practice before going on to better methods. As opposed to using something such as a Windows Forms App, which has button functionality built in, I am endeavoring to grab the cursor position (which I know how to do) and compare it to a number of area's inside a console application as defined by perhaps pixel location, but I also do not know if there is some sort of built in unit of space other than pixels (this last bit is the part I am unable to figure). P.S. I know this is in general terms, with no code already provided, but I do not feel that it is needed as all I am asking for is a brief explanation of how to grab X Y coordinates inside a console application, and stick them in int variables. Many Thanks in advance! :D

    Read the article

  • Bug Tracker - Feature set - Comparison

    - by Blankman
    Hi, I have installed and played around with a few bug tracking apps, and just wanted to get some feedback and features that a typical (or not so typical) bug tracking software has. I want to make sure I am not overlooking a feature that might come in handy. So the biggest idea is around a bug, which is associated with: Bugs - product - product version - component (specific component of the product) - status - priority - assigned to - expected time to finish - time spent on it so far - created by - historical log of bug Forums Wiki I guess the above functionality is common to all, so what exactly differentiates them? Is it simply the UI and filtering/searching that you base a decision on? (I am comparing something like Jira with FogBugz)

    Read the article

  • How do I indicate that a class doesn't support certain operators?

    - by romeovs
    I'm writing a class that represents an ordinal scale, but has no logical zero-point (eg time). This scale should permit addition and substraction (operator+, operator+=, ...) but not multiplication. Yet, I always felt it to be a good practice that when one overloads one operator of a certain group (in this case the math operators), one should also overload all the others that belong to that group. In this case that would mean I should need to overload the multiplication and division operators also, because if a user can use A+B he would probable expect to be able the other operators. Is there a method that I can use to throw an error for this at compiler time? The easiest method would be just no to overload the operators operator*, ... yet it would seem appropriate to add a bit more explaination than operator* is not know for class "time". Or is this something that I really should not care about (RTFM user)?

    Read the article

  • Javascript date comparison

    - by Art
    Why does equality operator return false in the first case? var a = new Date(2010, 10, 10); var b = new Date(2010, 10, 10); alert(a == b); // <- returns false alert(a.getTime() == b.getTime()); // returns true Why?

    Read the article

  • Excel PivotTable : Calculated Field / Item for Period Comparison

    - by dino76
    HI All, If I have a PivotTable in Excel 2007 with a date field. I understand that I can group the date by day, month or even year using Group Field (Years & Months). If I combine with product perspective, the PivotTable may look like this Sum of Sales_Total | Column Labels Row Labels | PRODUCT-001 | PRODUCT-002 | Grand Total - 2006 | 2000 | 1500 | 3500 Jan | 1700 | 800 | 2500 Feb | 300 | 700 | 1000 - 2007 | 1000 | 1500 | 2500 Jan | 700 | 800 | 1500 Feb | 300 | 700 | 1000 - 2008 | 600 | 700 | 1300 Jan | 600 | 700 | 1300 Now, what I want to do is to compare Jan 2008 - Jan 2006 and Jan 2007 - Jan 2006. Something like this : | Column Labels | PRODUCT-001 | | ... Row Labels | Sum of Sales | Sum of Last Sales | - 2006 | 2000 | | Jan | 1700 | | Feb | 300 | | - 2007 | 1000 | 2000 | Jan | 700 | 1700 | Feb | 300 | 300 | - 2008 | 600 | 1000 | Jan | 600 | 700 | Is it possible ? If so, how to do that ? Thanks, D. Chopins

    Read the article

  • C++ Boolean problem (comparison between two arrays)

    - by Martin
    Hello! I have a problem to do. I already did some part of it, however I stuck and don't know exactly what to do next. The question: " You are given two arrays of ints, named A and B. One contains AMAXELEMENTS and the other contains BMAXELEMENTS. Write a Boolean-valued function that returns true if there is at least one point in A that is the same as a point in B, and false if there is no match between two arrays. " The two arrays are made up by me, I think if I know how to compare two arrays I will be fine, and I will be able to finish my problem. This is what I have so far (I changed AMAXELEMENTS to AMAX, and BMAXELEMENTS to BMAX): #include <iostream> using namespace std; int main(){ const int AMAX=5, BMAX=6; int i; bool c1=true,c2=false; int A[AMAX]={2,4,1,5,9}; int B[BMAX]={9,12,32,43,23,11}; for(i=0;i<BMAX;i++) if (B[i]==A[i]) // <---- I think this part has to look different, but I can't figure it out. cout<<c1<<endl; else cout<< c2<<endl; return 0; }

    Read the article

  • MySQL DATE_FORMAT comparison to CURDATE() query...

    - by Crazy Serb
    Hey guys, I am just trying to pull all the records from my database who have a rec_date (varchar) stored as m/d/Y and are expired (as in, less than curdate()), and this call isn't giving me what I want: SELECT member_id, status, DATE_FORMAT(STR_TO_DATE(rec_date, '%m/%d/%Y'), '%Y-%m-%d') AS rec FROM members WHERE rec_date CURDATE() AND status = '1' I'm obviously doing something wrong, so can you help? Thanks.

    Read the article

  • Authentication mechanism comparison

    - by Heavy Bytes
    I have to start a new project where user authentication/management will be required. A lot of websites use existing authentication mechanisms like facebook/twitter/openID/google/etc (even SO). While I might understand that they are used to simplify some parts of this workflow can someone enumerate the pluses and minuses of using one of these authentication mechanisms vs. an usual user creation and what should I look for when I do this? Thanks in advance!

    Read the article

  • Comparison question string vs int

    - by Mike
    Can someone explain to me why these comparisons work they way the do. I had a bug in one of my scripts that took me a little bit to work through. I was using read-host and typing a number. It was storing it as a string. Write-Host "(`'2`' -gt 9 ) = " ('2' -gt 9 ) Write-Host "(2 -gt 9 ) = " (2 -gt 9 ) Write-Host "(`'2`' -gt 10 ) = " ('2' -gt 10 ) If you are comparing a string to an Int does it use the Ascii value? If so why does the first one show $false, it should be $true. Then how is it when you chage it to an int of 10 it because $true.

    Read the article

  • PHP: Three item validation comparison

    - by DavidYell
    I have 3 featured product panels on the homepage, and I'm writing a CMS page for it. I'm trying to validate the items. They are selected via three <select> elements, featured1, featured2 and featured3. The default is <option value="0" selected>Select an element</option> I need to validate the $_POST to ensure that the user hasn't selected the same product for more than one of the panels. I have worked out that each $_POST needs to be $_POST['featuredN'] > 0 but I can't seem to find a logical way of processing the 7 potential outcomes. Using a logic table, where 1 is a set value. 1 2 3 ------- 0 0 0 1 1 1 1 0 0 0 1 0 0 0 1 1 1 0 0 1 1 If an item is 0, then I will not update it, but I want the user to be able to update a single item if needs be. I cannot find a logical way to see if the item is not 0, and then compare it to another item if that also is not 0. So far my colleague suggested, adding up the values. Which works to see if condition 1 0 0 0 is not met. I have a vague feeling that some form of recursive function might be in order, but I can't quite get my brain to help me on this one! So to the collective brain! :)

    Read the article

  • Scientific Data processing(Graph comparison and interpretation)

    - by pinkynobrain
    Hi stackoverflow friends, I'm trying to write a program to automate one of my more boring and repetative work tasks. I have some programming experience but none with processing or interpreting large volumes of data so i am seeking your advice(both suggestions of techneques to try and also things to read to learn more about doing this stuff). I have a piece of equipment that monitors an experiment by taking repeated samples and displays the readings on its screen as a graph. The input of experiment can be altered and one of these changes should produce a change in a section of the graph which i currently identify by eye and is what im looking for in the experiment. I want to automate it so that a computer looks at a set of results and spots the experiment input that causes the change. I can already extract the results from the machine. Currently they results for a run are in the form of an integer array with the index being the sample number and the corresponding value being the measurement. The overall shape of the graph will be similar for each experiment run. The change im looking for will be roughly the same and will occur in approximatly the same place every time for the correct experiment input. Unfortunatly there are a few gotcha's that make this problem more difficult. There is some noise in the measuring process which mean there is some random variation in the measured values between different runs. Although the overall shape of the graph remains the same. The time the experiment takes varies slightly each run causing two effects. First, the a whole graph may be shifted slightly on the x axis relative to another runs graph. Second, individual features may appear slightly wider or narrower in different runs. In both these cases the variation isn't particularly large and you can assume that the only non random variation is caused by the correct input being found. Thank you for your time, Pinky

    Read the article

  • NULL pointer comparison fails

    - by Ilya
    Hello, I'm initializing in a class a pointer to be NULL. Afterwards I check if it is NULL in the same class. But it's not always 0x0. Sometimes it's 0x8 or 0xfeffffff or 0x3f800000 or 0x80 or other strange stuff. In most case the pointer is 0x0 but sometimes it gets altered somehow. I'm sure that I'm not changing it anywhere in my code. Is there a way it gets changed by "itself"? Here's my code: MeshObject::MeshObject() { mesh.vertexColors = NULL; } MeshObject::MeshObject(const MeshObject &_copyFromMe) { SimpleLog("vertexColors pointer: %p", _copyFromMe.mesh.vertexColors); if (_copyFromMe.mesh.vertexColors != NULL) { SimpleLog("vertexColors"); this->mesh.vertexColors = new tColor4i[_copyFromMe.mesh.vertexCount]; memcpy(this->mesh.vertexColors, _copyFromMe.mesh.vertexColors, _copyFromMe.mesh.vertexCount * sizeof(tColor4i) ); } } My application crashes, because vertexColors wasn't initialized and is being copied. However it is NULL and shouldn't be copied. Thanks.

    Read the article

  • NOT LIKE not working on comparison to a column

    - by rodling
    Data is fairly large and takes few minutes to run it every time, so its taking a lot of time debugging this problem. When I run like concat('%',T.item,'%') on smaller data it seems to identify items properly. However, when I run it on the main DB (the code shown), it still shows many(maybe even all) of the exceptions. EDIT: it seems when i add NOT it stops identifying items select distinct T.comment from (select comment, source, item from data, non_informative where ticker != "O" and source != 7 and source != 6) as T where T.comment not like concat('%',T.item,'%') order by T.comment; comment and source are in data, item is in non_informative Some items from T.item: 'Stock Analysis -', '#InsideTrades', 'IIROC Trade' Example comment which should be removed '#InsideTrades #4 | MACNAB CRAIG (Director,Officer,Chief Executive Officer): Filed Form 4 for $NNN (NATIONAL RETA' Can't seem to figure out it why shows all the items

    Read the article

  • iPhone time comparison

    - by Rob
    I am trying to figure out how to create an 'if' statement that uses a time value as a condition. For example: if (time <= 10:00) { score = 3; } else if (time <= 20:00) { score = 5; } else { score = 9; } I know that a string of "5:23" cannot be compared this way but I don't think I can just turn a string value like that directly into an integer. Any thoughts?

    Read the article

< Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >