count

How get divs count in jquery?

I used this jquery each function and iterated my json data with it.... $.each(data.Results, function() { divs += '<div class="resultsdiv"><br /> <span style="display: inline-block;width:150px;" class="resultName">' + this.Mat_Name + '</span><span class="resultfields" style="padding-left:10px;"> Measurement&nbsp;:</span>&nbsp;<sp...

Lines-of-code counting for many C# solutions

I am currently researching a solution for counting lines of code in C#. I pretty much need a combination of the following two tools: http://richnewman.wordpress.com/2007/07/01/c-and-vbnet-line-count-utility/ http://www.locmetrics.com/index.html My problem is that I need to recursively scan a folder containing a lot of visual studio...

Probability algorithm: Finding probable correct item in a list (e.g John, John, Jon)

Hi, Take for example the list (L): John, John, John, John, Jon We are to presume one item is to be correct (e.g. John in this case), and give a probability it is correct. First (and good!) attempt: MostFrequentItem(L).Count / L.Count (e.g. 4/5 or 80% likelihood) But consider the cases: John, John, Jon, Jonny John, John, Jon, Jon I w...

Microsoft T-SQL Counting Consecutive Records

Problem: From the most current day per person, count the number of consecutive days that each person has received 0 points for being good. Sample data to work from : Date Name Points 2010-05-07 Jane 0 2010-05-06 Jane 1 2010-05-07 John 0 2010-05-06 John 0 2010-05-05 John 0 2010-05-04 John 0 2010-05-03 John 1 2010-05...

Codeigniter: Count columns with value for user

How do I get a count of columns where('user_id', $id)...? ...

Get n Number of words using regex in Java

I have a section of a book, complete with punctuation, line breaks etc. and I want to be able to extract the first n words from the text, and divide that into 5 parts. Regex mystifies me. This is what I am trying. I creates an array of index size 0, with all the input text: public static String getNumberWords2(String s, int nWords){ ...

How to get length of the longest sequence with same characters in a string?

To be specified: function getLength($str) { //function i need } $str1 = 'aabbcccc'; $str2 = 'aabbccccaaaaa'; echo getLength($str1); //will get 4 echo getLength($str2); //will get 5 Any good ideas?Thanks in advance! ...

MySQL Count and sort rows

What is the best way to count and sort a column of data in mysql and output the results as a html list? Example Data: **Type** Train Car Car Car Bus Bus Output should be sorted with largest count item first: - car(3) - bus(2) - train (1) Also, is this bad practice to do on large table? ...

Why does my count(*) query time out but the inline view whose records it is counting does not?

Can't figure this one out... when I execute a select query it shows an explain plan cost of ~4500 and takes ~3 seconds to return. When I wrap that query (no changes) inside of: select count(*) from ( /*query here*/ ) It times out. It's at 5 minutes and counting now. I tried this in SQL Developer and Aqua Data Studio -- same result...

How do I keep a count of undefined strings within a loop using PHP?

I'm using a loop to try to generate keyword combinations and also find the ones that have been used the most. The loop finds all the records in the "posts" table where keyword = "chicago". Within this loop, I need to generate strings. Which, would look something like "chicago bulls" "chicago bears" "chicago cubs" etc... How do I tempo...

How do I do a .count on the model an object belongs_to in rails?

I have @contacts_added defined as follows: @contacts_added = Contact.all(:conditions => ["date_entered >?", 5.days.ago.to_date]) Each contact belongs_to a Company. I want to be able the count the number of distinct Companies that @contacts_added belong to. contacts_added will have many contacts that belong to a single company, acces...

I need to count the lines from matching config file entries, preferably with 'grep'.

I have a configuration file that has entries for various devices, with each entry separated by a blank line. I need to search the file for all instances of a given device type, and count the number of non-blank lines following the occurrence, stopping at the first blank. For example: Server=foo config line 1 config line 2 con...

mysql to get depth of record, count parent and ancestor records

Hey All, Say I have a post table containing the fields post_id and parent_post_id. I want to return every record in the post table with a count of the "depth" of the post. By depth, I mean, how many parent and ancestor records exist. Take this data for example... post_id parent_post_id ------- -------------- 1 null 2 ...

GroupBy Count With Subsonic 3

Hi, I like to perform the following with SubSonic 3 without using Linq (using dynamic lookup of columns and tables). Also, no inline sql (to prevent sql-injections). http://www.java2s.com/Code/SQL/Select-Clause/COUNTandGROUPBY.htm mysql> SELECT species, COUNT(*) FROM Bird GROUP BY species; +---------+----------+ | species | COUNT(*) | ...

Mysql : Count Posts and Group by date

Hello , I am not very good at sql , generally I use php to do my complicated tasks , But in this task , there are lots of data , so using php for counting posts is very slow. So I want a sql which counts post by date , but my date column in table is php's time stamp (int).I will crate post number x date chart ...

Count total number of Phone Numbers in AddressBook iPhone

I am trying to get the total count for the phone numbers listed in the AddressBook, in all groups as a whole. I can successfully retrieve Person count and Group count, just not the total number of Phone Numbers. ABAddressBookRef m_addressbook = ABAddressBookCreate(); CFIndex nPeople = ABAddressBookGetPersonCount(m_addressbook)...

Count max rectangles number, that can be placed inside character

Hi, I need a solution for quite complex problem. Exactly, I need to calculate the number of rectangles that can be placed inside letter/character with given size, considering that all rectangles are the same size, but it(the size) and the letter/character(of some regular specific font) itself can be changed by user(this will be used as w...

Count files in directories AND subdirectories? iPhone

I am trying to count entire files in a directory, including subdirectories. This is what I have to count files in the first folder: -(NSString *)numberOfPhotos { NSString *MyPath = @"/rootdirectory/"; NSArray *directoryContent = [[NSFileManager defaultManager] directoryContentsAtPath:MyPath]; return [NSString stringWithFo...

mysql_affected_rows() always returns 1 even though no row was updated.

What I am trying to do is: (programmatically) Update status where id is something, if no rows where updated, give error: we cannot find the record with id something, otherwise give message success. Here I am using mysql_affected_rows() to know if a row was updated or not, but it always return 1, so the user gets a success message, even...

Search number entries on a mysql database with COUNT

I have a mysql database which allocate: iid, name, description, url, namecategory, idcategory, nametopic, idtopic How can i know the number of entries that has categoryid=1 and topicid=1? I've tried $result = mysql_query("SELECT COUNT(id) FROM videos WHERE idcategory = 1 ...