Search Results

Search found 11153 results on 447 pages for 'count zero'.

Page 36/447 | < Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >

  • Get n Number of words using regex in Java

    - by Aymon Fournier
    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){ String[] m = s.split("([a-zA-Z_0-9]+\b.*?)", (nWords / 5)); return "Part One: \n" + m[1] + "\n\n" + "Part Two: \n" + m[2] + "\n\n" + "Part Three: \n" + m[3] + "\n\n" + "Part Four: \n" + m[4] + "\n\n" + "Part Five: \n" + m[5]; } Thanks!

    Read the article

  • mysql select where count = 0

    - by david parloir
    Hi, In my db, I have a "sales" table and a "sales_item". Sometimes, something goes wrong and the sale is recorded but not the sales item's. So I'm trying to get the salesID from my table "sales" that haven't got any rows in the sales_item table. Here's the mysql query I thought would work, but it doesn't: SELECT s.* FROM sales s NATURAL JOIN sales_item si WHERE s.date like '" . ((isset($_GET['date'])) ? $_GET['date'] : date("Y-m-d")) . "%' AND v.sales_id like '" . ((isset($_GET['shop'])) ? $_GET['shop'] : substr($_COOKIE['shop'], 0, 3)) ."%' HAVING count(si.sales_item_id) = 0; Any thoughts?

    Read the article

  • Counting number of times an item occurs in a linked list

    - by HanaCHaN92
    Here is the assignment: Here's the assignment: Implement a method countValue() that counts the number of times an item occurs in a linked list. Remember to use the STL list. int countValue(list front, const int item); Generate 20 random numbers in the range of 0 to 4, and insert each number in the linked list. Output the list by using a method which you would call writeLinkedList which you would add to the ListP.cpp. In a loop, call the method countValue() , and display the number of occurrences of each value from 0 to 4 in the list. Remember that all the above is to be included in the file ListP.ccp Run: 2 3 4 0 1 0 2 4 2 3 3 4 3 3 3 0 0 2 0 2 0 : 5, 1 : 1, 2 : 5, 3 : 6, 4 : 3 and here is what I have so far: #include<iostream> #include<list> #include<tchar.h> int countValue(list<int> front, const int item); using namespace std; int _tmain(int argc, _TCHAR* argv[]){ list<int> front; int listCount; cout << "Enter the size of the list: "; cin >> listCount; for (int i = 1; i <= listCount; i++) front.insert(rand()%5); cout << "Original List of Values: " << endl; //writeLinkedList(front, " "); cout << endl; for(int j=0;j<5;++j) cout << countValue (front,j) << endl; cout << endl; return 0; } int countValue(list<int> front, const int item) { int count0; int count1; int count2; int count3; int count4; list<int> *List; for(list<int>::iterator i = front.begin(); i != front.end(); i++) { if(List->item == 0) { count0++; } if(List->item == 1) { count1++; } if(List->item == 2) { count2++; } if(List->item == 3) { count2++; }if(List->item == 4) { count4++; } } } And here are the errors: error C2065: 'list' : undeclared identifier line 5 error C2062: type 'int' unexpected line 5 error C2661: 'std::list<_Ty>::insert' : no overloaded function takes 1 arguments line 16 error C3861: 'countValue': identifier not found line 21 IntelliSense: no instance of overloaded function "std::list<_Ty, _Ax>::insert [with _Ty=int, _Ax=std::allocator<int>]" matches the argument list line 16 IntelliSense: too few arguments in function call line 16 error C2039: 'item': is not a member of 'std::list<_Ty>' lines 34, 38, 42, 46, 49 IntelliSense: declaration is incompatible with "int countValue" (declared at line 5) line 25 IntelliSense: class "std::list<int, std:: allocator<int>>" has no member "item" lines 34, 38, 42, 46, 49 I just want to know what I've done wrong and how to fix it and also if someone could help me figure out if I'm doing the countValue function wrong or not based on the instructions I would really appreciate it. I've read the chapter in our textbook several times, looked up tutorials on youtube and on Dream in Code, and still I can not figure this out. All helpful information is appreciated!

    Read the article

  • Count the number of objects in an Image

    - by kunjaan
    I am investigating the possibility of image processing to identify certain objects and also count them in an image. I will be given a picture and I need to identify the number of boxes present in that image. Does anybody have any experience with any Machine Vision/ Image Processing libraries like ImageJ, Fiji, JAI, jMagick ,Java Vision Toolkit? Which do you think is best suited for the job? What do you guys suggest? If the APIs can be used from Java, it would be better. Thank you. Edit: I am dealing with warehouse brown boxes. Yes I am talking about regular photos. The source is usually a mobile phone picture.

    Read the article

  • mysql query to concat information from 3 tables - getting incorrect result count

    - by iPfaffy
    I have 3 tables in my database. ab_contacts id first_name last_name addressbook_id ab_addressbooks name id co_comments id link_id comment I'd like to create a query that will let me select all the contacts and comments related to them in a given addressbook. To select all the people in a given addressbook, I can use: select count(*) from ab_contacts where addressbook_id = '50'; This returns 8152 people. However, when I run my query: select ab_contacts.first_name, ab_contacts.last_name, ab_contacts.email, ab_addressbooks.name, co_comments.comments from ab_contacts JOIN ab_addressbooks ON (ab_contacts.addressbook_id = ab_addressbooks.id) JOIN co_comments ON (ab_contacts.id = co_comments.link_id) WHERE ab_contacts.addressbook_id = '50';` the format works, but I only get 1045 results. I'm sure there is something I am missing, but I cannot figure it out. Any help would be greatly appreciated.

    Read the article

  • Population count of rightmost n integers

    - by Jason Baker
    I'm implementing Bagwell's Ideal Hash Trie in Haskell. To find an element in a sub-trie, he says to do the following: Finding the arc for a symbol s, requires ?nding its corresponding bit in the bit map and then counting the one bits below it in the map to compute an index into the ordered sub-trie. What is the best way to do this? It sounds like the most straightforward way of doing this is to select the bits below that bit and do a population count on the resulting number. Is there a faster or better way to do this?

    Read the article

  • Get consolidated results with following tables

    - by Ted
    I have a scenario. Here's my table structure is: ID LoginDate RemovalDate ---------------------------------------- 1 2009/08/01 NULL 2 2009/09/12 2010/01/02 3 2009/08/31 2009/10/29 4 2010/02/17 NULL 5 2009/10/18 2009/11/22 I want a consolidated results of how many ID's were not removed in a particular month. So the result set should be Date NotRemoved_ID -------------------------- 2009/08 2 2009/09 3 2009/10 3 [One ID got removed in 2009/10] 2010/02 2 [Two got removed in 2009/11 and 2010/01] Please help.

    Read the article

  • why does vector.size() read in one line too little?

    - by ace
    when running the following code, the amount of lines will read on less then there actually is (if the input file is main itself, or otherwise) why is this and how can i change that fact (besides for just adding 1)? #include <fstream> #include <iostream> #include <string> #include <vector> using namespace std; int main() { // open text file for input string file_name; cout << "please enter file name: "; cin >> file_name; // associate the input file stream with a text file ifstream infile(file_name.c_str()); // error checking for a valid filename if ( !infile ) { cerr << "Unable to open file " << file_name << " -- quitting!\n"; return( -1 ); } else cout << "\n"; // some data structures to perform the function vector<string> lines_of_text; string textline; // read in text file, line by line while (getline( infile, textline, '\n' )) { // add the new element to the vector lines_of_text.push_back( textline ); // print the 'back' vector element - see the STL documentation cout << "line read: " << lines_of_text.back() << "\n"; } cout<<lines_of_text.size(); return 0; }

    Read the article

  • php array count

    - by user295189
    I have a var dump of my sql query which return the following I wanna to count in the array below that how many rows of myID = 5 are there. How would I do that. I am using php. Thanks in advance array 0 = object(stdClass)[17] public 'myID' => string '5' (length=1) public 'data' => string '123' (length=3) 1 = object(stdClass)[18] public 'myID' => string '5' (length=1) public 'data' => string '123' (length=3) 2 = object(stdClass)[19] public 'relativeTypeID' => string '2' (length=1) public 'data' => string '256' (length=3) 3 = object(stdClass)[20] public 'myID' => string '4' (length=1) public 'data' => string '786' (length=3) object(stdClass)[21] public 'myID' => string '4' (length=1) public 'data' => string '786' (length=3)

    Read the article

  • Jquery canvas touch count

    - by user897764
    Can someone help me with a script I'm working with. http://jsfiddle.net/InVAMPED/XsG4e/4/ What I'm trying to achieve is placing a image where the user touches(ipad). There will be say 5 images that will each get attached once only. So first touch places img1, second touch imag2 etc untill all the images have been placed. Problem with my fsfiddle example is that when on ipad it doesnt count the first touch so you place the first image twice. it does duplicate the image on the second time just moves it to the second touches coordinates, then move on to 2, 3, 4, 5 as it should. any advice? or help to do this a better way? thanks

    Read the article

  • Count Similar iTems in Array

    - by Taimur Hamza
    Hi guys, I need to count the similar elements in an array. For example, if i have an array, array[0,0,0,1,2,3,3].The number of 0's are 3 , no. of 1's are 1 , no. of 2's are 1 , no. of 3's are 2 in this array . I am sorry if this message has been posted before. Help is appreciated. Thanks in advance. Regards, THM P.S : Language is C/C++

    Read the article

  • sql count function

    - by suryll
    Hi I have three tables and I want to know how much jobs with the wage of 1000 an employee has had The first SQL query gives me the names of all the employees that has recieved 1000 for a job SELECT distinct first_name FROM employee, job, link WHERE job.wage = 1000 AND job.job_id = link.job_id and employee.employee_id = link.employee_id; The second SQL query gives me the total number for all employees of how much jobs they have made for 1000 SELECT count(wage) FROM employee, job, link WHERE job.wage = 1000 AND job.job_id = link.job_id and employee.employee_id = link.employee_id; I was wondering if there was a way of joining both queries and also making the second for each specific employee???

    Read the article

  • Finding folders

    - by gedO
    Hello. I want to find how much folders are in folder or I should say how much SubFolreds are in folder. So, how I should do that??? P.S. I'm programing with Delphi

    Read the article

  • The least amount of code possible for this MySQL query?

    - by ddan
    I have a MySQL query that: gets data from three tables linked by unique id's. counts the number of games played in each category, from each user and counts the number of games each user has played that fall under the "fps" category It seems to me that this code could be a lot smaller. How would I go about making this query smaller. http://sqlfiddle.com/#!2/6d211/1 Any help is appreciated even if you just give me links to check out.

    Read the article

  • set label text to total row count of gridview

    - by woolardz
    I'm using a stored procedure in a sql database as the data source for a SqlDataSourceControl on my .aspx page. I'm then using the SqlDataSourceControl as the data source for a gridview on my page. Paging is set to true on the gridview. What i would like to do is set the text of a label to the total number of rows in the gridview. I can use this code 'labelRowCount.Text = GridView2.Rows.Count & " layers found" to return the number of results per page, but it doesn't give me the total. I've looked in several places and haven't been successful in finding a solution.

    Read the article

  • Date range advanced count calculation in TSQL

    - by cihata87
    I am working on call center project and I have to calculate the call arrivals at the same time between specific time ranges. I have to write a procedure which has parameters StartTime, EndTime and Interval For Example: Start Time: 11:00 End Time: 12:00 Interval: 20 minutes so program should divide the 1-hour time range into 3 parts and each part should count the arrivals which started and finished in this range OR arrivals which started and haven't finished yet Should be like this: 11:00 - 11:20 15 calls at the same time(TimePeaks) 11:20 - 11:40 21 calls ... 11:40 - 12:00 8 calls ... Any suggestions how to calculate them?

    Read the article

  • count number of rows to be affected before update in trigger

    - by tomaszsobczak
    Hi, I want to know number of rows that will be affected by UPDATE query in BEFORE per statement trigger . Is that possible? The problem is that i want to allow only queries that will update up to 4 rows. If affected rows count is 5 or more i want to raise error. I don't want to do this in code because i need this check on db level. Is this at all possible? Thanks in advance for any clues on that

    Read the article

  • Get total marker count from Google API placesSearch

    - by okTalk
    In the example fiddle, how can I get the total number of markers displayed on the map? I'm pushing each of the markers into an array like this: markers.push(marker) And attempting to get the total number of markers like this: $('.marker-count span').html(markers.length); Unfortunately, "markers.length" is returning 0 when it should be returning at least 3. I have example code here: http://jsfiddle.net/287C7/ How can I display the total number of markers? Is it not possible to add each marker to my array? I need to know the amount of markers shown so that I can alert the user if there are none. Thanks,

    Read the article

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

    - by happyhardik
    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 though there was no row updated. Can anyone tell me what could it be?

    Read the article

  • Symantec publie son bilan 2010 et ses prévisions pour 2011, plus d'exploits de failles zero-day et d'attaques sensibles

    Symantec fait son bilan 2010 et donne ses perspectives pour 2011 : plus d'attaques contre les infrastructures vitales et d'exploits de failles zero-day Symantec publie aujourd'hui ses perspectives en termes de sécurité informatique pour 2011, grâce à l'observation des phénomènes apparus ou s'étant développés en 2010, et s'appuyant sur son réseau de plus de 240.000 capteurs dans le monde entier. Première tendance lourde : « L'hactivisme » - La fréquence des attaques contre les infrastructures vitales va augmenter et les fournisseurs de services vont réagir, mais les gouvernements risquent d'être plus lents Les pirates ont certainement été attentifs aux effets produits par la menace Stuxnet sur les secteurs d'...

    Read the article

  • Simulating smooth movement along a line after calculating a collision containing a restitution of zero in 2D

    - by Casey
    [for tl;dr see after listing] //...Code to determine shapes types involved in collision here... //...Rectangle-Line collision detected. if(_rbTest->GetCollisionShape()->Intersects(*_ground->GetCollisionShape())) { //Convert incoming shape to a line. a2de::Line l(*dynamic_cast<a2de::Line*>(_ground->GetCollisionShape())); //Get line's normal. a2de::Vector2D normal_vector(l.GetSlope().GetY(), -l.GetSlope().GetX()); a2de::Vector2D::Normalize(normal_vector); //Accumulate forces involved. a2de::Vector2D intermediate_forces; a2de::Vector2D normal_force = normal_vector * _rbTest->GetMass() * _world->GetGravityHandler()->GetGravityValue(); intermediate_forces += normal_force; //Calculate final velocity: See [1] double Ma = _rbTest->GetMass(); a2de::Vector2D Ua = _rbTest->GetVelocity(); double Mb = _ground->GetMass(); a2de::Vector2D Ub = _ground->GetVelocity(); double mCr = Mb * _ground->GetRestitution(); a2de::Vector2D collision_velocity( ((Ma * Ua) + (Mb * Ub) + ((mCr * Ub) - (mCr * Ua))) / (Ma + Mb)); //Calculate reflection vector: See [2] a2de::Vector2D reflect_velocity( -collision_velocity + 2 * (a2de::Vector2D::DotProduct(collision_velocity, normal_vector)) * normal_vector ); //Affect velocity to account for restitution of colliding bodies. reflect_velocity *= (_ground->GetRestitution() * _rbTest->GetRestitution()); _rbTest->SetVelocity(reflect_velocity); //THE ULTIMATE ISSUE STEMS FROM THE FOLLOWING LINE: //Move object away from collision one pixel to prevent constant collision. _rbTest->SetPosition(_rbTest->GetPosition() + normal_vector); _rbTest->ApplyImpulse(intermediate_forces); } Sources: (1) Wikipedia: Coefficient of Restitution: Speeds after impact (2) Wikipedia: Specular Reflection: Direction of reflection First, I have a system in place to account for friction (that is, a coefficient of friction) but is not used right now (in addition, it is zero, which should not affect the math anyway). I'll deal with that after I get this working. Anyway, when the restitution of either object involved in the collision is zero the object stops as required, but if movement along the same direction (again, irrespective of the friction value that isn't used) as the line is attempted the object moves as if slogging through knee deep snow. If I remove the line of code in question and the object is not push away one pixel the object barely moves at all. All because the object collides, is stopped, is pushed up, collides, is stopped...etc. OR collides, is stopped, collides, is stopped, etc... TL;DR How do I only account for a collision ONCE for restitution purposes (BONUS: but CONTINUALLY for frictional purposes, to be implemented later)

    Read the article

  • Zero-channel RAID for High Performance MySQL Server (IBM ServeRAID 8k) : Any Experience/Recommendation?

    - by prs563
    We are getting this IBM rack mount server and it has this IBM ServeRAID8k storage controller with Zero-Channel RAID and 256MB battery backed cache. It can support RAID 10 which we need for our high performance MySQL server which will have 4 x 15000K RPM 300GB SAS HDD. This is mission-critical and we want as much bandwidth and performance. Is this a good card or should we replace with another IBM RAID card? IBM ServeRAID 8k SAS Controller option provides 256 MB of battery backed 533 MHz DDR2 standard power memory in a fixed mounting arrangement. The device attaches directly to IBM planar which can provide full RAID capability. Manufacturer IBM Manufacturer Part # 25R8064 Cost Central Item # 10025907 Product Description IBM ServeRAID 8k SAS - Storage controller (zero-channel RAID) - RAID 0, 1, 5, 6, 10, 1E Device Type Storage controller (zero-channel RAID) - plug-in module Buffer Size 256 MB Supported Devices Disk array (RAID) Max Storage Devices Qty 8 RAID Level RAID 0, RAID 1, RAID 5, RAID 6, RAID 10, RAID 1E Manufacturer Warranty 1 year warranty

    Read the article

< Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >