count

How can I return the count of objects for an FRC fetch?

I am trying to use the count of objects from my FRC fetch so that I can create an "Add" cell after all of my fetched objects have been listed in a UITableView. Is there a method for returning the number of objects fetched? I can only find a method that returns the count of sections for a given FRC. ...

How expensive is find('count') in CakePHP?

I have a CakePHP application where I am trying to get a count of how many of each type of post a user has. I am also using the paginate helper to display all the user's posts on their profile. I could: 1) Make a find('all', $conditions) request for all the user's posts then parse that for the counts I need (by going post by post and chec...

SQL Server Select COUNT without using aggregate function or group by

I'm in a very, very tight situation here. I have an SQL query running on SQL Server 2005: SELECT col1,col2,col3 FROM myTable Which of course gives: col1 | col2 | col3 ------------------ 1 | a | i 2 | b | ii etc I need to, if possible, add a COUNT query so that it will return the number of records returned. I cannot use...

Performance of collection count (array etc) vs storing the count in a variable

Is there a performance difference between getting the count of an array (for example in c#) vs storing the count of an array in a variable. This is assuming that the count isn't changing. I'm presuming the answer will that storing it in a variable will cost more memory and accessing it directly e.g. array.length will be slightly slower...

XSL QUESTION: alternative method to count the number of lines or newline characters of an xml attribute

I've scoured the internet to discover this method of finding the number of lines in an xml element.: <xsl:if test="string-length(@Example) - string-length(translate(@Example, '&#xa;', '')) &lt; 10"> In the example above, @Example is the element for which the number of lines is counted. I didn't like this code, however, because it aut...

Counting objects in image

Dear Sir I want to count no of objects in an image using open cv. I have a soybean image and now I want to count the soybean numbers. If possible please help me and let me know the counting algorithms. Thanks and I look forward to hear from you. Regards, Sumon ...

Help forming a SQL statement.

I have two tables: attractions and cities. Attractions contains a column called city, which is a reference to the id in the cities table. I want to form a MySQL statement that will show me which cities have the most attractions. I know I can do: SELECT COUNT(*) as `number` FROM `attractions` WHERE `city` = XX ...to get a count o...

Calculate the number of direct children in a hierarchy

I have a simple hierarchy of categories in an SQLite3 database, each row storing a parent ID or NULL as appropriate. I would like to find out whether a particular category is a leaf, essentially by determining, for each row, whether it has a parent ID defined. Or rather, determining a count of child rows for each row. Table definiti...

How to count number of non-derived files in an Eclipse project.

So, how to count number of files in an Eclipse project, with the specific requirement that derived resources should not be counted. (otherwise one could easily use unix command line tools to calculate that) Linked and virtual resources need not be considered, although, bonus points if you do. ...

Get mysql tables in a query

There is any way to get the tables I'm using in a query? The first method I was using was with regular expressions: // result[1] = "SELECT" // result[3] = "All between FROM and WHERE, ex: `users`, ex: `users`, `test` if($result[1] == "SELECT" && !preg_match('/FROM\s*(.*?,.*?)\s*WHERE/i', $query, $res)) { $tables = preg_replace('/`...

How to Count number of lines of javascript in php files?

I need to count the no. of lines of inline java script between script tags in php files. How do I do it? Will grep linux command suffice or I can get some tool to do it? Please help. ...

PHP stop foreach()

There is a variable $posts, which gives an array with many values. foreach() is used for output: foreach($posts as $post) { ... } How to show only five first values from $posts? Like, if we have 100 values, it should give just five. Thanks. ...

Using GroupBy, Count and Sum in LINQ Lambda Expressions

I have a collection of boxes with the properties weight, volume and owner. I want to use LINQ to get a summarized list (by owner) of the box information e.g. **Owner, Boxes, Total Weight, Total Volume** Jim, 5, 1430.00, 3.65 George, 2, 37.50, 1.22 Can someone show me how to do this with Lambda expression...

JAVASCRIPT: Count the number of REGEX results

This is what regex should find { anything in it }, and then I want to count the number of results what the regex found. So I have a string like this: {example1}{example2}{example3} in this case the count number is 3 ...

SQL Server Number of records affected by an update before executing the actual update

Hey Is there a way to get the number of records by an update-statement before executing the actual update? I know you can just create a select count(1) statement, but my process needs something more generic. ...

SQL Server joins, groups, and etc. to do simple number crunching

Here's what I'm working with (SQL Server): departments: deptID, deptName students: studID, studName, deptID assignment: studID, courseID, status Students are assigned to a department and the student record holds the department's ID number. The "assignment" is a link between a student and a course (course not shown) that holds a statu...

SQL Count where clause

I have the the following SQL statement: SELECT [l.LeagueId] AS LeagueId, [l.LeagueName] AS NAME, [lp.PositionId] FROM (Leagues l INNER JOIN Lineups lp ON l.LeagueId = lp.LeagueId) WHERE (lp.PositionId = 1) OR (lp.PositionId = 3) OR (lp.PositionId ...

Querying on count value having ()

I'm having difficulty with a query which displays records according to their fill rate. For instance, a vacancy can have no bookings or some bookings. If a vacancy has bookings, they can be in the form of 'active [1]', 'pending [0]'. The query I have written so far works if the vacancy has booking records but I can't get it to work if ...

COUNT is grouping rows unexpectedly

Table items keeps track of the different types of items that can be stocked. item_type item_name last_stock 1 cake 2010-08-10 2 fruit 2010-08-07 3 soda 2010-08-07 4 water 2010-08-09 Table individual_items keeps track of each specific item. id item_type 1 ...

count the urls on my sitemap.xml file

How can I do a page count on a sitemap.xml file? ...