count

Jquery Count Divs with class name

Seems pretty simple but I cant get it to work. If I have two divs with the class of 'user' I want to output 'you have 2 divs' <script type="text/javascript"> $(document).ready(function() { function divcount() { var mycount = $('.user').length(); document.write(mycount) } }); </script> I'm sure im mi...

XSLT Global count of grouped items

Hi there, I have a set of items which i am grouping using the muenchian method using keys. This is working great however when i try to do things with the first x number of items it is doing it on the x number of items in each group rather than across the whole set of results. How would i get the individual position of each item accros...

How to count diffrent rows in MySQL ? (three columns as a whole)

How to count rows with distinct values on any of the three columns: col1, col2, col3? ...

SQL count() with group by not returning 0/zero records

For ease of discussion, consider this basic table (Test) in Access... ID division name role 1 1 Frank 100 2 2 David 101 3 3 John 101 4 2 Mike 102 5 2 Rob 102 7 3 Dave 102 8 3 Greg 102 I want to count the users of a certain role in a division. If I ...

Word occurrence in a String(word count)

Hello. Im stuck on writing Word occurrence in a string. I got some tip(in task notes) to use is compareToIgnoreCase. so I tried something like this: splitwords = StringCont.split("\\s"); for(int i=0; i<splitwords.length; i++) { if(splitwords[1].compareToIgnoreCase(splitwords[i]) == 0) splitcount++; } It is of course just w...

Suggestions for improving count performance on a SQL query?

I've got a query that is taking a very long time to run due to a select similar to: SELECT Count( Distinct t1.v1), Count (Distinct Case t2.v1 When 'blah' then t1.v1 Else null End ), .... FROM t1 LEFT JOIN t2 ON t1.v3 = t2.v3 WHERE t1.myDate BETWEEN @start and @end AND t2.v5 = @id Can anyone suggest any good methods for improving thi...

Row count of a column family in Cassandra

Is there a way to get a row count (key count) of a single column family in Cassandra? get_count can only be used to get the column count. For instance, if I have a column family containing users and wanted to get the number of users. How could I do it? Each user is it's own row. ...

Why does Perl's tr/\n// get slower and slower as line lengths increase?

In perlfaq5, there's an answer for How do I count the number of lines in a file?. The current answer suggests a sysread and a tr/\n//. I wanted to try a few other things to see how much faster tr/\n// would be, and also try it against files with different average line lengths. I created a benchmark to try various ways to do it. I'm runni...

How to use "count" in rails to show how many projects/tasks user has?

Hello, I defined method 'count' in my tasks controller as: def count @count = current_user.tasks.count end I'm not sure how to show that in my tasks views. Do I just use Tasks count: <% @count %>? How do I get in my view how many tasks the user has? Thanks ...

How many times a string occurs in another string (textbox) VB.NET

How can I get how many times a string occurs in a textbox? I thought the find function would return the number of times found but it seems to return the location of it. ...

mysql query - Need a little help with grouping...

I'm wondering how to write this query, it's a little complicated... This is an example of what's being stored in the table: KID Utype Qtype Qname Resp UID Q24-YYY Case T001 HM-99678 N8944 2455 Q24-YYY Case T001 HM-99678 N8944 9874 Q24-YYY Case F099 HM-99678 N8944 6554 Q24-YYY Case F099 HM-99678 SD789 2331 Q24-YYY Case F099 HM...

Percentage of results that have a column in SQL

I am trying to get a results that will show Uniuque "Reasons", the number of them there are, and the percentage of the total that they are. so far I have SELECT DISTINCT Reason, COUNT(Reason) AS Number, CAST(COUNT(Reason) AS float) / CAST(COUNT(*) AS float) AS percentage FROM DeletedClients However as I have discovered...

count function in xpath

I have got an XML document and trying to get the number of nodes that have a particular text using xpath. see xml below count(//event_type) returns the number of event_type nodes but what I want is the number of event_type nodes that have the Error text. <Response> <run_id>20091231-105000</run_id> <message> <timestamp>2...

SQL Count(*) on multiple tables

Hi all, I am writing a horse racing web app and i have a stats page. What i am trying to do is show how many winners there are from each year. Currently i have this: SELECT `Horse Number`, Count(*) AS `Total Winners` FROM `races`.`2009` WHERE `Win $`>0 GROUP BY `Horse Number` ORDER BY Count(*) DESC; It works like a charm and return...

MYSQL COUNT GROUP BY question

I'd like to only select the rows where the count is greater than 1 (in other words the duplicates) right now from a few thousand records i am mostly seeing ones with a few 2s and 3s here and there SELECT count( * ) AS `Number` , GI . * FROM `GeneralInformation` AS GI GROUP BY `FirstName` , `Surname` how can I do this? ...

group by price range

Say I have a table of real estate properties: A 15,000 B 50,000 C 100,000 D 25,000 I'd like to group them by 0 - 49,999, 50,000 - 99,999 and 100,000 - 200,000 So the result should be: 0 - 49k (2) 50k - 99k (1) 100k - 200k (1) Is there a way to do that in one SQL statement? I'm using Postgres by the way. ...

How To Count Associated Entities Without Fetching Them In Entity Framework

Hello everyone, I've been wondering about this one for a while now, so I thought it would be worth using my first Stack Overflow post to ask about it. Imagine I have a discussion with an associated list of messages: DiscussionCategory discussionCategory = _repository.GetDiscussionCategory(id); discussionCategory.Discussions is a lis...

Looking to add something to count images in PDFs in this python program...

Here's my code, I'm looking for a way to count the images in the pdfs while I extract the text. import pyPdf import os import csv class UnicodeWriter: """ A CSV writer which will write rows to CSV file "f", which is encoded in the given encoding. """ def __init__(self, f, dialect=csv.excel, encoding="utf-8", **kwd...

Group and count in Rails

I know I've seen this before but I can't find anything now. I want to group a query by a certain column and be able to display how many are in each group. I got the first part down: @line_items = @project.line_items.all(:group => "device_id") This is for my line item index view, which is just a table displaying the line items. How...

Is performing a count() calculation slowing down my mysql query?

I'm still learning about MySQL. I may be making a very basic error, and I'm prepared to be chastened here... What this query is trying to do is select the top members from our website based on a count of the number of book and recipe reviews they have made. I'm making a calculation of the total in the SQL query itself. The query is s...