count

C++ - Using std::count() with abstract data types ?

Hello, My code is using std::count() on a list of an abstract data type that i have defined. (Sommet or Edge in english). But it doesn't work, although i've overloaded the < and == operators like this : bool operator< (const Sommet &left, const Sommet &right) { if(left.m_id_sommet < right.m_id_sommet) return true; return fals...

ms access complicated query. querying last two entries by date for each ID. very slow

I have two tables. Widgets, which has information about each widget (Color, size, etc); each widget has a unique ID, WidgetID. The other table is Tests, and it contains information about multiple tests that were run on each widget. This table, therefore, has multiple rows for each WidgetID. It contains information that we can call (Widg...

simplest, shortest way to count capital letters in a string with php?

I am looking for the shortest, simplest and most elegant way to count the number of capital letters in a given string. ...

How to count differences between two files on linux?

Hi all, I need to work with large files and must find differences between two. And I don't need the different bits, but the number of differences. For the differ rows I come up with diff --suppress-common-lines --speed-large-files -y File1 File2 | wc -l And it works, but is there a better way to do it? And how to count the exact ...

Spreadsheet: Count Repeated Values In A Column

I'm not particularly knowledgeable about spreadsheet wrangling, so I could use some assitance with a seemingly simple problem. I have a column of year values which I am sorting by. I'd like to find the quantity per year ( read: number of repeats of each year value ). I'd like to chart said values. I'm not sure how to make this happen. I...

how to group by and count using MySQL

I have data which looks like this: ID post_author post_title guid 3309 21 Should somebody not yet on SQL 2008 wait for SQL 2008 R2, since it's near release? http://sql.stackexchange.com/questions/379/should-somebody-not-yet-on-sql-2008-wait-for-sql-2008-r2-since-its-near-release 1695 429 How do we politely decline well meaning a...

xslt count nodesets returned by key

In my xslt, I am trying to determine the number of distinct schedule_id values in my <event/>s so that I can output a table where each column is used for one schedule_id. The following key should retrieve the nodesets grouped as I require. So how do I determine how many nodesets are returned? <xsl:key name="events-by-schedule" match="...

How to return zero using Count() with multiple tables

i have three tables (SQL Server) Month - month_id, month name, .... Award - award_id, award name, .... Nomination - fk_award_id, fk_month_id, name, address,... I need to count the number of different types of awards awarded per month while returning 0 in cases where nobody is awarded for ex. the results should look like A...

DataView.Count different DataView.Table.Rows.Count

I am using C# and .NET 3.5 and have a GridView that I am setting the dataSource programatically in the code-behind page. I have data in a DataTable and then depending on a column value (isValid boolean) of each Row, I create a new row using DataRowView.AddNew() method into 1 of 2 DataViews - dvValid or dvInvalid. I am NOT creating a new ...

Count occurrences of a char in plain text file

Is there any way under linux/terminal to count, how many times the char f occurs in a plain text file? ...

Counting Instances of Unique Value in Field

Suppose you have a table in SQL: Prices ------ 13.99 14.00 52.00 52.00 52.00 13.99 How would you count the amount of times a DIFFERENT field has been entered in? Therefore an example of such a count would output: 13.99 - 2 times. 14.00 - 1 times. 52.00 - 3 times. OR perhaps: 3 (i.e. 13.99, 14.00, 52.00) Can anyone advise? ...

Count if there is more than 1 occurrence in a 2d array in Ruby

I've got a sorted array: array = [[4, 13], [1, 12], [3, 8], [2, 8], [0, 3]] Which shows me a position (array[n][0]) and the number of occurrences of that position (array[n][1]). I need to test to see if more than one item in the array has the same number of occurrences as the last item. I thought I might be able to do it with this: ...

Count Instances in Table1 AND link to Table2

Please refer to this background question. After constructing this COUNT, how would I then link each of these 'Prices' to, for instance, a column called 'Genre' in TableTwo? e.g. Table1: Prices, ID Table2: Genre, ID Example output: PRICES, COUNT, Genre -------------------- 13.99, 2, Horror 52.00, 3, Comedy 1.99, 1, Rom...

Looking for SQL constraint: SELECT COUNT(*) from tBoss < 2

Hi, I'd like to limit the entries in a table. Let's say in table tBoss. Is there a SQL constraint that checks how many tuples are currently in the table? Like SELECT COUNT(*) from tBoss < 2 Firebird says: Invalid token. Dynamic SQL Error. SQL error code = -104. Token unknown - line 3, column 8. SELECT. Thanks. Norbert ...

How to get the item count for sub-categories on each parent?

This is related to the following post: The function that retrieves the item counts for each folder (category) is: ALTER FUNCTION [dbo].[GetFolderReceiptCount] ( -- Add the parameters for the function here @FolderID bigint ) RETURNS int AS BEGIN DECLARE @Return int SET @Return = 0 SELECT --H.ReceiptFolderID,...

Parameter Count Mismatch

Having trouble with the following segment of code. I'm getting a parameter count mismatch. I've had to write this because of problems with multiple threads and unsafe updates. delegate void data_INPUTDelegate(object sender, System.IO.Ports.SerialDataReceivedEventArgs e); private void data_INPUT(object sender, System.IO.Por...

How to count group by rows in rails?

When i use User.count(:all, :group => "name"), i got multi rows, but it's not i want, what i want is the count of the rows, how can I do it? ...

Check if at least 75% of a string is UPPERCASE

Hi, I'm writing bug tracking software in PHP, and today I saw this in another bug tracker: http://bugs.php.net/bug.php?id=12017 Now I want to add a feature in my software which will block titles where at least 75% of all characters is uppercase. How can I do this? Thanks, P.S. CSS will not work, because, for example if you have the w...

C# Count() Extension Method Performance

If the LINQ Count() extension method is invoked on an IEnumerable<T> that has a Count property (e.g. List<T>), does the Count() method look for that property and return it (rather than counting the items by enumerating them)? The following test code seems to indicate that it does: using System; using System.Collections; using System.Col...

CKeditor character/word count

I need to display character count and word count with the new CKeditor. I tried to search for a plugin but there are none, except few hacks for the old fckeditor. ...