Questions tagged [find-occurrences]

435 questions
1
vote
1 answer

Postgresql: only keep unique values from integer array

Let's say I have an array of integers 1 6 6 3 3 8 4 4 It will be always of the form n*(pairs of number) + 2 (unique numbers). Is there an efficient way of keeping only the 2 uniques values (i.e. the 2 with single occurence)? Here, I would like…
Denis Rouzaud
  • 2,412
  • 2
  • 26
  • 45
1
vote
3 answers

Counting character occurrences in a string - Java

I'm having trouble writing a method that takes a string and counts the number of times the first character (or really any character) appears. The code I've written is below, but for some reason keeps returning half the correct count when I run it.…
Ron A
  • 15
  • 3
1
vote
0 answers

Find maximum scoring characters with non overlapping occurrences from a string

I have a problem related to Episode Mining in which I need to find the maximal utility of a episode given its occurrences in an event sequence.But I am presenting the question in a different form so that it's easier to explain. There is a long…
1
vote
1 answer

Counting Occurrences of a word using a input/output program in java

How would you find the most occurring words in a file that has five or more letters using an input/output program? This is a starter code that i have import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import…
user3012019
  • 75
  • 1
  • 1
  • 3
1
vote
2 answers

How can you determine the number of occurrences of a keyword in a web page?

I'm trying to figure out how search for the number of occurrence for a keyword on a php webpage. Not a string but count the occurrences and then post the number, for how many times a certain number appears on the page. Are there any functions for…
Fonzworth
  • 13
  • 2
1
vote
1 answer

Count and change text color of occurrences of string in NSTextView

I have an task where I need to count the occurrences of errors in a log file and I know how to do that. Now Im trying to change the font color of these occurrences. I have it kinda working but it doesn't change the whole word to the wanted color and…
Breathable
  • 89
  • 10
1
vote
3 answers

Sql query to find items that had n consecutive failed attempts

I only found slightly different examples I couldn't adapt to my needs due to my very limited sql skills. I have a table with 3 revelant columns: ItemID Date Result 1 1.2.2014 A 5 6.4.2014 B 9 7.4.2014 A 1 8.4.2014 …
1
vote
1 answer

Android: counting occurrence of words on file on SD Card

This should be straight forward but for some reason when I try to count words in a file after I download it to my SD Card, the number seems to be off. Also the more occurrences there are, the further my result seems to be off. I use Microsoft Word…
Mike6679
  • 5,547
  • 19
  • 63
  • 108
1
vote
1 answer

Find the number of occurrences of a set of two columns of a data frame in other data frames in r

I have 103 data frames with 7 variables and more than 1000 rows. I want to find the number of occurrences of a pair of two columns of one data frame in other 102 data frames. In other words, how many times c(V1,V2) together (=two columns of a data…
MASUMEH
  • 41
  • 6
1
vote
2 answers

Bash script to find first occurrence of a string after an URL

I can't find out how to solve this simple problem: I have an XML file and an an URL as a parameter in the script: $URL. I need to find the string "NO_CODE" just after the $URL (which could be: http://www.webpage2.com) and replace this string with:…
user3139207
  • 121
  • 13
1
vote
2 answers

Counting the occurrence of objects in an ArrayList, using either Collections or my functions

I have an ArrayList of FlowerClass objects. Each of these FlowerClass objects has a name. I want to go through the ArrayList and count them. I want to display the amount of each. So if I have three FlowerClass objects named Rose, two named Daffodil,…
1
vote
1 answer

Eclipse "Write Occurrences" Click Highlight Delay

How do I decrease the "Write Occurrences" delay in Eclipse? When I click a variable in the editor, it takes a while before it highlights all instances of it. I want to make this instantaneous.
Monstieur
  • 7,992
  • 10
  • 51
  • 77
1
vote
1 answer

Speeding up Finding the Cumulative Occurrence of Elements

I'm trying to improve the performance of my code. The code basicly calculates the value of L_total (1x2640) and it does it by fetching the data from another variable called L_CN (1320x6). I also have colindexes matrix (2640x3) which stores the…
etua
  • 83
  • 8
1
vote
1 answer
1
vote
3 answers

How to return the frequency of a substring in a string?

function occurrence(string,substring) { var counter = 0; var sub = substring.toLowerCase(); var str = string.toLowerCase(); var array = [] var ans; for (var i = 0; i < str.length; i++) { if (str.indexOf(sub) != -1)…
jellybean_232
  • 189
  • 1
  • 4
  • 16