Search Results

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

Page 24/447 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • how can I count number of occurance of a word in a string while ignoring cases

    - by Ronny
    I am trying to count the number of occurance of a given word while ignoring cases. I have tried <?php $string = 'Hello World! EARTh in earth and EARth';//string to look into. if(stristr($string, 'eartH')) { echo 'Found';// this just show eartH was found. } $timesfound = substr_count($string, stristr($string, 'eartH'));// this count how many times. echo $timesfound; // this outputs 1 instead of 3.

    Read the article

  • sql boolean truth test: zero OR null

    - by AK
    Is there way to test for both 0 and NULL with one equality operator? I realize I could do this: WHERE field = 0 OR field IS NULL But my life would be a hundred times easier if this would work: WHERE field IN (0, NULL) (btw, why doesn't that work?) I've also read about converting NULL to 0 in the SELECT statement (with COALESCE). The framework I'm using would also make this unpleasant. Realize this is oddly specific, but is there any way to test for 0 and NULL with one WHERE predicate?

    Read the article

  • Cannot compute equation, always gives zero

    - by user1738391
    Did i miss something? The variable percentage_ always equals 0. I've checked nTimes and winnings, they give the correct values as what is being input. Even when I test out a simple equation like, percentage_=1+1, percentage_ will give 0. Can someone help? #pragma once #include <iostream> #include <string> #include <cstdlib> #include <iomanip> using namespace std; class GuessMachine { private: int nTimes; int winnings; string nM[6]; public: GuessMachine(); void displayPrizes(); void displayMenu(); int getInput(); void checkNumber(); void checkPrize(); }; void GuessMachine::checkPrize() { MagicNumber mn; int prize_=mn.generateNumber(); float percentage_; percentage_ = float (winnings/nTimes*100); //<--On this line percentage is always 0 no matter what winnings and nTimes are cout<<"Percentage is "<<percentage_<<endl; if(percentage_ >= 50) { cout<<"You have scored "<<percentage_<<"% and won "<<nM[prize_]; } else { cout<<"You have scored "<<percentage_<<"%. You lose!!"; } cin.ignore(); cin.ignore(); }

    Read the article

  • Filter on count(*) in oracle

    - by chris
    I have a grouped query, and would like to filter it based on count(*) Can I do this without a subquery? This is what I have currently: select * from (select ID, count(*) cnt from name group by ID) where cnt > 1;

    Read the article

  • Bind to Count of items in the DataContext

    - by Organ Grinding Monkey
    I want to bind to the Count/amount of items within my DataContext. I have an object, lets say person which has a List<address> as a property. I would like to display the amount of addresses for that person ie: 5 or 6 or whatever the case may be. I've tried {Binding Path=address#.Count} and a few others but that doesnt seem to work. Any help would be appreciated, thanks.

    Read the article

  • Programming tutorials for people with zero experience

    - by www.aegisub.net
    A friend of mine is interested in learning how to program computers, but she knows nothing about programming. I suggested that Python might be a good language to start with, but after some googling, I couldn't find any tutorials that covered both programming and Python in an adequate way. I don't want her to go through the tiresome "learn algorithms in pseudocode first" routine. Instead, I'd like a tutorial that will explain the basic ideas while working towards a real goal, e.g. a very simple console game. Does anyone know of any such tutorials? Do you think that I'm mistaken in how I'm handling this? Is Python a bad choice? I know that something like C, C++ or Java won't work - too many details will be very counterproductive. On the other hand, I think that Lisp might be too mathematical and abstract. Python, on the other hand, will let her even do something like coding primitive graphical games in a short period of time.

    Read the article

  • Efficient SQL to count an occurrence in the latest X rows

    - by pulegium
    For example I have: create table a (i int); Assume there are 10k rows. I want to count 0's in the last 20 rows. Something like: select count(*) from (select i from a limit 20) where i = 0; Is that possible to make it more efficient? Like a single SQL statement or something? PS. DB is SQLite3 if that matters at all...

    Read the article

  • The sign of zero with float2

    - by JackOLantern
    Consider the following code performing operations on complex numbers with C/C++'s float: float real_part = log(3.f); float imag_part = 0.f; float real_part2 = (imag_part)*(imag_part)-(real_part*real_part); float imag_part2 = (imag_part)*(real_part)+(real_part*imag_part); The result will be real_part2= -1.20695 imag_part2= 0 angle= 3.14159 where angle is the phase of the complex number and, in this case, is pi. Now consider the following code: float real_part = log(3.f); float imag_part = 0.f; float real_part2 = (-imag_part)*(-imag_part)-(real_part)*(real_part); float imag_part2 = (-imag_part)*(real_part)+(real_part)*(-imag_part); The result will be real_part2= -1.20695 imag_part2= 0 angle= -3.14159 The imaginary part of the result is -0 which makes the phase of the result be -pi. Although still accomplishing with the principal argument of a complex number and with the signed property of floating point's 0, this changes is a problem when one is defining functions of complex numbers. For example, if one is defining sqrt of a complex number by the de Moivre formula, this will change the sign of the imaginary part of the result to a wrong value. How to deal with this effect?

    Read the article

  • LINQ2SQL: How to let a column accept null values as zero (0) in Self-Relation table

    - by Remon
    As described in the img, I got a parent-Children relation and since the ParentID not accepting null values (and I can't change to nullabel due to some restriction in the UI I have), how can I remove an existence relation between ReportDataSources in order to change the parent for them (here i want to set the parentId for one of them = 0) how could i do that since i cant change the ParentID directly and setting Parent = null is not valid public void SetReportDataSourceAsMaster(ReportDataSource reportDataSource) { //Some logic - not necessarily for this scenario //Reset Master this.ReportDataSources.ToList().ForEach(rds => rds.IsMaster = false); //Set Master reportDataSource.IsMaster = true; //Set Parent ID for the rest of the Reports data sources this.ReportDataSources.Where(rds => rds.ID != reportDataSource.ID).ToList().ForEach(rds => { //Change Parent ID rds.Parent = reportDataSource; //Remove filttering data rds.FilteringDataMembers.Clear(); //Remove Grouping Data rds.GroupingDataMembers.Clear(); }); //Delete parent HERE THE EXCEPTION THROWN AFTER CALLING SUBMITCHANGES() reportDataSource.Parent = null; //Other logic } Exception thrown after calling submitChanges An attempt was made to remove a relationship between a ReportDataSource and a ReportDataSource. However, one of the relationship's foreign keys (ReportDataSource.ParentID) cannot be set to null.

    Read the article

  • Replacing emty csv column values with a zero

    - by homerjay
    Hey, So I'm dealing with a csv file that has missing values. What I want my script to is: #!/usr/bin/python import csv import sys #1. Place each record of a file in a list. #2. Iterate thru each element of the list and get its length. #3. If the length is less than one replace with value x. reader = csv.reader(open(sys.argv[1], "rb")) for row in reader: for x in row[:]: if len(x)< 1: x = 0 print x print row Here is an example of data, I trying it on, ideally it should work on any column lenghth Before: actnum,col2,col4 xxxxx , , xxxxx , 845 , xxxxx , ,545 After actnum,col2,col4 xxxxx , 0 , 0 xxxxx , 845, 0 xxxxx , 0 ,545 Any guidance would be appreciated

    Read the article

  • how to count NULL categories in one SQL question

    - by grzes
    hi, i have a blog application were Post belongsTo Category and Category hasMany Post Post can have a Category or not - in latter case NULL value is present in Post.category_id field. Now i would like to have following category count with single SQL query category|post_count -------------- PHP | 2 JavaScript | 4 SomeOtherCat | 1 NULL | 3 The clue here is that i also want to count posts without category (NULL row above). Is it posibble with one SQL query?

    Read the article

  • Returning Null values with COUNT

    - by Randy B.
    With this query, I get a result that is two short of the table because they are not included in count, and I would like get the NULL values in the result. To do this, I am pretty sure I need to use a subquery of some kind, but I am not sure how, since the attribute in question is an aggregate. SELECT Equipment.SerialNo , Name, COUNT(Assignment.SerialNo) FROM Equipment INNER JOIN Assignment ON Assignment.SerialNo = Equipment.SerialNo GROUP BY Equipment.SerialNo, Name

    Read the article

  • Array length is zero in jQuery.

    - by James123
    I wrote like this. After submit click loop is not excuting. But I saw value are there, But array lenght is showing '0'. (Please see picture). Why it is not going into loop? and $('#myVisibleRows').val(idsString); becoming 'empty'. $(document).ready(function() { $('tr[@class^=RegText]').hide().children('td'); var list_Visible_Ids = []; var idsString, idsArray; alert($('#myVisibleRows').val()); idsString = $('#myVisibleRows').val(); idsArray = idsString.split(','); $.each(idsArray, function() { if (this != "") { $('#' + this).siblings(('.RegText').toggle(true)); window['list_Visible_Ids'][this] = 1; } }); $('tr.subCategory1') .css("cursor", "pointer") .attr("title", "Click to expand/collapse") .click(function() { //this = $(this); $(this).siblings('.RegText').toggle(); list_Visible_Ids[$(this).attr('id')] = $(this).css('display') != 'none' ? 1 : null; alert(list_Visible_Ids[$(this).attr('id')]) }); $('#form1').submit(function() { idsString = ''; $.each(list_Visible_Ids, function(key, val) { alert(val); if (val) { idsString += (idsString != '' ? ',' : '') + key; } }); $('#myVisibleRows').val(idsString); form.submit(); }); });

    Read the article

  • python count number of times the date has appeared

    - by Rajeev
    From the following array,how to count the dates for the number of times it has occured in the array.The output should be in the following format [date,count] new_dates = [['2012-12-02', 14],['2012-12-03',2],....] Input: dates = [['2012-12-02', 17], ['2012-12-01', 5], ['2012-12-02', 15], ['2012-12-02', 8], ['2012-12-02', 17], ['2012-12-02', 15], ['2012-12-11', 6], ['2012-12-02', 1], ['2012-12-02', 9], ['2012-12-02', 11], ['2012-12-03', 13], ['2012-12-03', 10], ['2012-12-02', 18], ['2012-12-02', 11], ['2012-12-02', 12], ['2012-12-05', 14], ['2012-12-02', 3], ['2012-12-02', 6], ['2012-12-06', 10], ['2012-12-07', 0], ['2012-12-08', 3], ['2012-12-09', 12], ['2012-12-02', 6]]

    Read the article

  • Symfony: there is a "0" (zero) in a sfWidgetFormChoice

    - by user248959
    Hi, i want to show a select which options are the character '-' and a range of integers. I have this: $years = range(14,130); new sfWidgetFormChoice(array('choices' => array_merge(array('' => '-',array_combine($years,$years))); The problem: between the '-' and the range of integers there is a "0" (bold and italic). Any help? Regards Javi

    Read the article

  • Count days within a month from date range

    - by G. Muqtada
    I have three date ranges in mysql table as follow from 2013-09-29 to 2013-10-02 from 2013-10-14 to 2013-10-16 from 2013-10-28 to 2013-11-05 I want to count only days that occur in Month of October, for example from first range (2013-09-29 to 2013-10-02) I should get difference of two days (1st and 2nd October) , and it should ignore days from September month, Finally i want to count total days in a given month from above date ranges. Can it be done from direct mysql query. or any short PHP logic.

    Read the article

  • mySQL JOIN wont return results with 0 count

    - by MPC
    SELECT categories.*, COUNT(categoryID) AS kritCount FROM categories AS categories LEFT JOIN krits ON categories.id = categoryID WHERE (krits.approved = '1') GROUP BY categories.id So this works great except that it does not return a category that has a 0 count of krits in the category. It will if I remove the WHERE statement but I need the WHERE to only select the krits where the field approved = 1

    Read the article

  • least value in count

    - by Nyfer
    i have a table employee(id,dept_id,salary,hire_date,job_id) . the following query i have to execute. Show all the employee who were hired on the day of the week on which least no of employee were hired. i have done the query, but am not able to get the least. please check if am correct. select id, WEEKDAY(hire_date)+1 as days,count(WEEKDAY(hire_date)+1) as count from test.employee group by days

    Read the article

  • sql count() query for tables

    - by air
    i have two tables table1 fields fid,fname,fage a ,abc ,20 b ,bcv ,21 c ,cyx ,19 table2 fields rcno,fid,status 1 ,a ,ok 2 ,c ,ok 3 ,a ,ok 4 ,b ,ok 5 ,a ,ok i want to display rectors like this fid from table1 , count(recno) from table 2 and fage from table1 fid,count(recno),fage a ,3 ,20 b ,2 ,21 c ,1 ,19 i try many sql queries but got error Thanks

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >