Search Results

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

Page 11/447 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • VBA Range.Rows.Count giving unexpected results

    - by Jeffrey
    I have a Range variable that contains an address - $2:$2,$4:$205,$214:$214 - (3 groups of rows). I would like to get the count of all the rows in that range. However, range.Count gives me the count of all the cells (50,000~) and range.Rows.Count only return 1 - the count of all the rows in the first group. How do I get the count of all the rows Thanks

    Read the article

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

    - by mike
    I'm using a loop within a loop to try to generate keyword combinations and also find the ones that have been used the most. My outside loop just queries a list of keywords (lets use "chicago" as our first keyword, 3 records were found). The inside loop finds all the records in the "posts" table where keyword = "chicago". Within this loop, I need to generate strings based on info I found in the database. Which, would look something like "chicago bulls", "chicago bears", "chicago cubs" etc... I know how to do everything up until this point, but how do I temporary hold these generated strings and count how many times they have been found within the 3 records?

    Read the article

  • ActionScript display zero value

    - by bwong
    It seems the number Datatype handles zeros and nulls the same. I need to display a zero value on the screen, but AS displays nothing. When it's saved, the value is saved as a zero, and therefore shows up zero on the screen. Is there a way to display the zero value using a new object? public class myObject{ private var numVar:Number } My AS file: var temp:MyObject temp.numVar = 0; When I debug, temp.numVar contains a value of 0, but does not show anything on the UI. If this object is then saved to the DB, and then displayed to the UI, it shows a 0. My question is - how do I get temp.numVar to display 0 before persistenting it to the DB?

    Read the article

  • Letter Count on a string

    - by user74283
    Python newb here. I m trying to count the number of letter "a"s in a given string. Code is below. It keeps returning 1 instead 3 in string "banana". Any input appreciated. def count_letters(word, char): count = 0 while count <= len(word): for char in word: if char == word[count]: count += 1 return count print count_letters('banana','a')

    Read the article

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

    - by Chris
    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 config line 3 Server=bar config line 1 config line 2 Server=foo config line 1 If I wanted to know how many total "config lines" were associated with server "foo", I should get four. Can you please help?

    Read the article

  • Overload the behavior of count() when called on certain objects

    - by Tom
    In PHP 5, you can use magic methods, overload some classes, etc. In C++, you can implement functions that exist is STL as long as the argument types are different. Is there a way to do this in PHP? An example of what I'd like to do is this: class a { function a() { $this->list = array("1", "2"); } } $blah = new a(); count($blah); I would like blah to return 2. IE count the values of a specific array in the class. So in C++, the way I would do this might look like this: int count(a varName) { return count(varName->list); } Basically, I am trying to simplify data calls for a large application so I can call do this: count($object); rather than count($object->list); The list is going to be potentially a list of objects so depending on how it's used, it could be really nasty statement if someone has to do it the current way: count($object->list[0]->list[0]->list); So, can I make something similar to this: function count(a $object) { count($object->list); } I know PHP's count accepts a mixed var, so I don't know if I can override an individual type.

    Read the article

  • How do I do a count on that meet a specific condition, dependent on several has_many relationships i

    - by Angela
    I have a Model Campaign. A Campaign has many Events. Each Event has an attribute :days. A Campaign also has_many Contacts. Each Contact as a :date_entered attribute. The from_today(contact,event) method returns a number, which is the number of days from the contact's :date_entered till today minus the event's :days. In other words, a positive number shows the number of days from today till the :days of the event is elapsed. If it is negative, if means that the number of days that has elapsed since the :date_entered is greater than the :days attribute of an event. In other words, the event is overdue. What I would like to be able to do is do campaign.overdue and this would result in a total number of contacts that have an overdue event. It shouldn't count multiple events for a single contact, just one contact. How do I do that? It seems like I would need to cycle through all the events for every contact and keep a counter but I'm assuming that there is a better way.

    Read the article

  • Why can i read dirty rows in MySql

    - by acidzombie24
    I cant believe this, i always throught the below would be concurrency safe. I write to a row in one transaction and i am able to read the dirty value from another transaction/command/connection! Why is this possible (not my main question) isnt this not desired and cause more troubles!?! Anyways, i expected that once i write to a row nothing else will be able to read to the row until the transaction is finished. And at least if the row can be still read that the clean (original) value will be read. (but maybe that would cause problems as well if the transaction doesnt use the newly commited data from the other transaction when it is ran) I would like count to == 11. I thought this would be safe in all variants of sql. What can i do to either 1) Not read the dirty value but clean 2) Have that row be locked until the transaction is finished? static MySqlConnection MakeConn() { string connStr = "server=192.168.126.128;user=root;database=TestDB;port=3306;password=a;"; MySqlConnection conn = new MySqlConnection(connStr); conn.Open(); return conn; } static Semaphore sem1 = new Semaphore(1, 1); static Semaphore sem2 = new Semaphore(1, 1); static void Main2() { Console.WriteLine("Starting Test"); // sem1.WaitOne(); Console.WriteLine("1W"); sem2.WaitOne(); Console.WriteLine("2W"); Thread oThread = new Thread(new ThreadStart(fn2)); oThread.Start(); var conn = MakeConn(); var cmd = new MySqlCommand(@" CREATE TABLE IF NOT EXISTS Persons ( P_Id int NOT NULL, name varchar(255), count int, PRIMARY KEY (P_Id) )", conn); cmd.ExecuteNonQuery(); cmd.CommandText = "delete from Persons; insert into Persons(name, count) VALUES('E', '4');"; cmd.ExecuteNonQuery(); cmd.CommandText = "select count from Persons;"; var count = (int)cmd.ExecuteScalar(); Console.WriteLine("Finish inserting. v={0}", count); sem2.Release(); Console.WriteLine("2R"); sem1.WaitOne(); Console.WriteLine("1W"); Console.WriteLine("Starting transaction"); using (var tns = conn.BeginTransaction()) { cmd.CommandText = "update Persons set count=count+1"; cmd.ExecuteNonQuery(); cmd.CommandText = "select count from Persons;"; count = (int)cmd.ExecuteScalar(); Console.WriteLine("count is {0}", count); sem2.Release(); Console.WriteLine("2R"); sem1.WaitOne(); Console.WriteLine("1W"); count += 5; //10 cmd.CommandText = "update Persons set count=" + count.ToString(); cmd.ExecuteNonQuery(); cmd.CommandText = "select count from Persons;"; count = (int)cmd.ExecuteScalar(); Console.WriteLine("count is {0}", count); tns.Commit(); } Console.WriteLine("finished transaction 1"); sem2.Release(); Console.WriteLine("2R"); sem1.WaitOne(); Console.WriteLine("1W"); cmd.CommandText = "select count from Persons;"; count = (int)cmd.ExecuteScalar(); Console.WriteLine("count is {0}", count); sem2.Release(); Console.WriteLine("2R"); //sem1.WaitOne(); Console.WriteLine("1W"); } static void fn2() { int count; Console.WriteLine("Starting thread 2"); sem2.WaitOne(); Console.WriteLine("1W"); var conn = MakeConn(); var cmd = new MySqlCommand("", conn); sem1.Release(); Console.WriteLine("1R"); sem2.WaitOne(); Console.WriteLine("2W"); using (var tns = conn.BeginTransaction()) { cmd.CommandText = "update Persons set count=count+1"; cmd.ExecuteNonQuery(); cmd.CommandText = "select count from Persons;"; count = (int)cmd.ExecuteScalar(); Console.WriteLine("count is {0}", count); sem1.Release(); Console.WriteLine("1R"); sem2.WaitOne(); Console.WriteLine("2W"); tns.Commit(); } Console.WriteLine("finished transaction 2"); sem1.Release(); Console.WriteLine("1R"); sem2.WaitOne(); Console.WriteLine("2W"); cmd.CommandText = "select count from Persons;"; count = (int)cmd.ExecuteScalar(); Console.WriteLine("count is {0}", count); //should be 11. 4 + 1x2(one each thread) += 5 from first thread == 11 sem1.Release(); Console.WriteLine("1R"); } console Starting Test 1W 2W Starting thread 2 Finish inserting. v=4 2R 1W 1R 1W Starting transaction count is 5 2R 2W count is 6 1R 1W count is 10 finished transaction 1 2R 2W finished transaction 2 1R 1W count is 10 2R 2W count is 10 1R

    Read the article

  • S.M.A.R.T - Predictive Failure Count

    - by Bastien974
    I'm monitoring my IBM ServeRAID M5015 controller for RAID status with MegaCLI, I have this on one of the disk : Enclosure Device ID: 252 Slot Number: 6 Enclosure position: 0 Device Id: 14 Sequence Number: 2 Media Error Count: 32 Other Error Count: 0 Predictive Failure Count: 18 Last Predictive Failure Event Seq Number: 8119 PD Type: SAS Raw Size: 279.396 GB [0x22ecb25c Sectors] Non Coerced Size: 278.896 GB [0x22dcb25c Sectors] Coerced Size: 278.464 GB [0x22cee000 Sectors] Firmware state: Online, Spun Up SAS Address(0): 0x5000c50042c319c9 SAS Address(1): 0x0 Connected Port Number: 5(path0) Inquiry Data: IBM-ESXSST9300653SS B6336XN04HC10525B633 IBM FRU/CRU: 81Y9671 FDE Capable: Not Capable FDE Enable: Disable Secured: Unsecured Locked: Unlocked Needs EKM Attention: No Foreign State: None Device Speed: 6.0Gb/s Link Speed: 6.0Gb/s Media Type: Hard Disk Device Drive: Not Certified Drive Temperature :33 Celsius What does this mean exactly ? I can't find an exact description, is there a way to have more details ? The RAID array has the Optimal state. Media Error Count: 32 Predictive Failure Count: 18 Is there a way through the CLI to power-on the front LED so I physically know which disk I need to replace ?

    Read the article

  • Zero sized tar.gz file found inside a tar.gz file

    - by PavanM
    My current directory contains a single file like this- $ls -l -rw-r--r-- 1 root staff 8 May 28 09:10 pavan Now, I want to tar and gzip this file like $tar -cvf - * 2>/dev/null |gzip -vf9 > pavan.tar.gz 2>/dev/null (I am aware I am creating the zipped file in the same directory as the original file) When I run the above tar/gzip commands around 20 times, a few times I observe that the final tarred and zipped file pavan.tar.gz file has a ZERO sized pavan.tar.gz file. I am not sure from where is this zero sized file coming into the archive from. Note: I am NOT running tar/gzip commands on an already existing tar.gz file. I always make sure that the directory has only one file before running the commands On googling, as described here, I suspected that the tar.gz being created was also part of the file being archived. But in my case, gzip is the one who's creating the final file and by the time gzip runs, tar should be done tarring. This is happening on AIX but I've used Linux tag too, to draw more attention, as I guess the problem is platform independent.

    Read the article

  • linux kernel buffer memory is zero

    - by user64772
    Hi all. There are one qestion that i can`t find in google. I have many linux boxes mostly with SLES or openSUSE, diffrent versions and kernels. On some of them i faced with slow oracle transactions problem. It time to time problem and when i log in the box on that time i see that oracle blocked in kernel function sync_page # while :; do ps axo stat,pid,cmd,wchan | egrep '^D|^R'; echo --; sleep 5; done D 3483 hald-addon-storage: polling ide_do_drive_cmd Ds 4635 ora_dbw0_orcl sync_page Ds 4637 ora_lgwr_orcl sync_page Ds 4639 ora_ckpt_orcl sync_page D 11210 oracleorcl (LOCAL=NO) sync_page D 12457 [smtpd] sync_page R+ 12458 ps axo stat,pid,cmd,wchan - -- Ds 4635 ora_dbw0_orcl sync_page Ds 4637 ora_lgwr_orcl sync_page Ds 4639 ora_ckpt_orcl sync_page D 11210 oracleorcl (LOCAL=NO) sync_page R+ 12501 ps axo stat,pid,cmd,wchan - -- Ds 4635 ora_dbw0_orcl sync_page Ds 4637 ora_lgwr_orcl sync_page Ds 4639 ora_ckpt_orcl sync_page D 11210 oracleorcl (LOCAL=NO) sync_page R+ 12535 ps axo stat,pid,cmd,wchan - -- Ds 4635 ora_dbw0_orcl sync_page Ds 4637 ora_lgwr_orcl sync_page Ds 4639 ora_ckpt_orcl sync_page D 11210 oracleorcl (LOCAL=NO) sync_page R+ 12570 ps axo stat,pid,cmd,wchan - -- so i think that box is run out of memory for disk buffers but memry is fine total used free shared buffers cached Mem: 4149084 3994552 154532 0 0 2424328 -/+ buffers/cache: 1570224 2578860 Swap: 3148700 750696 2398004 i think that this is the problem, buffer is zero and we must write directly to disk, but why buffer is zero ? - i try to google it and find nothing - is anyone can help ?

    Read the article

  • Count rows against to SQL server (2005) table?

    - by David.Chu.ca
    I have a simple question with two options to get count of rows in a SQL server (2005). I am using VS 2005. There are two options to get the count: SELECT id FROM Table1 WHERE dt >= startDt AND dt < endDt;; I get a list of ids from above call in cache and then I get count by List.Count. Another option is SELECT COUNT(*) FROM Table1 WHERE dt >= startDt AND dt < endDt; The above call will get the count directly. The issue is that I had several cases of exceptions with the second method: timeout. What I found is that the table1 is too big with millions of data. When I used the first option, it seems OK. I am confused by the fact that Count() takes more time than getting all the rows(is that true?). Not sure if the aggregation call with Count() would cause SQL server to create temporary table or cache on server side and it would result in slow performance when table is too big? I am not sure what is the best way to get the count?

    Read the article

  • Wp-count Malware Injection [closed]

    - by Amar Ryder
    I received a malware notification from Google Webmaster tools yesterday for my blog which is running on Wordpress. After going through website I found that there is a file called wp-count.php creating malware code. I tried to delete that but it reappears again and again so I have erased coding inside. Now its there without coding but still I think it may be any other codes which are effect my website. How can I fix it?

    Read the article

  • Running CLOC (count lines of code) on Windows...or alternative

    - by Chelonian
    I'm trying to use CLOC on Windows (XP) to count lines of code, and I can't get it to work. I downloaded the latest Win installer for CLOC 1.5.6, ran it (which caused a "DOS" window to open, scroll with text rapidly, then close before I could read anything) and then wrote cloc at the cmd prompt...and Windows doesn't recognize it as a command. Or if there is another easy-to-use lines of code counter that one could recommend (that runs on Windows), I'd be happy to try that.

    Read the article

  • Connect to a MySQL database and count the number of rows.

    - by Hugo
    Hi there! I need to connect to a MySQL database and then show the number of rows. This is what I've got so far; <?php include "connect.php"; db_connect(); $result = mysql_query("SELECT * FROM hacker"); $num_rows = mysql_num_rows($result); echo $num_rows; ?> When I use that code I end up with this error; Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\Documents and Settings\username\Desktop\xammp\htdocs\news2\results.php on line 10 Thanks in advance :D

    Read the article

  • How do I recover jegs with zero bytes?

    - by Jill
    I downloaded some wedding photos into my external drive about a month ago. A total of 3 cards were downloaded into 3 different files. The first file lists all of the photos, about 600 images, but they have zero bytes. The other 2 files are fine. I can't recover the compact flash card because I have used it too many times since then. Is there any way to recover the images on my drive?

    Read the article

  • How do I recover JPEGs with zero bytes?

    - by Jill
    I downloaded some wedding photos into my external drive about a month ago. A total of 3 cards were downloaded into 3 different files. The first file lists all of the photos, about 600 images, but they have zero bytes. The other 2 files are fine. I can't recover the compact flash card because I have used it too many times since then. Is there any way to recover the images on my drive?

    Read the article

  • Set automatic axis limits without defaulting to zero (Excel)

    - by djeidot
    I am build a bar chart in Excel with data values ranging from e.g. 10 to 20. I want the X axis limits to be automatic, but although the right limit (near 20) works correctly, the left limit always defaults to 0. I'd like the left limit to be near 10, instead of zero, without having to have the limit fixed. Is there any way to do this?

    Read the article

  • error in coding a lexer in c

    - by mekasperasky
    #include<stdio.h> #include<ctype.h> #include<string.h> /* this is a lexer which recognizes constants , variables ,symbols, identifiers , functions , comments and also header files . It stores the lexemes in 3 different files . One file contains all the headers and the comments . Another file will contain all the variables , another will contain all the symbols. */ int main() { int i=0,j,k,count=0; char a,b[100],c[10000],d[100]; memset ( d, 0, 100 ); j=30; FILE *fp1,*fp2; fp1=fopen("source.txt","r"); //the source file is opened in read only mode which will passed through the lexer fp2=fopen("lext.txt","w"); //now lets remove all the white spaces and store the rest of the words in a file if(fp1==NULL) { perror("failed to open source.txt"); //return EXIT_FAILURE; } i=0; k=0; while(!feof(fp1)) { a=fgetc(fp1); if(a!=' '&&a!='\n') { if (!isalpha(a)) { switch(a) { case '+':{fprintf(fp2,"+ ----> PLUS \n"); i=0;break;} case '-':{fprintf(fp2,"- ---> MINUS \n"); i=0;break;} case '*':{fprintf(fp2, "* --->MULT \n"); i=0;break;} case '/':{fprintf(fp2, "/ --->DIV \n"); i=0;break;} //case '+=':fprintf(fp2, "%.20s\n", "ADD_ASSIGN"); //case '-=':fprintf(fp2, "%.20s\n", "SUB_ASSIGN"); case '=':{fprintf(fp2, "= ---> ASSIGN \n"); i=0;break;} case '%':{fprintf(fp2, "% ---> MOD \n"); i=0;break;} case '<':{fprintf(fp2, "< ---> LESSER_THAN \n"); i=0;break;} case '>':{fprintf(fp2, "> --> GREATER_THAN \n"); i=0;break;} //case '++':fprintf(fp2, "%.20s\n", "INCREMENT"); //case '--':fprintf(fp2, "%.20s\n", "DECREMENT"); //case '==':fprintf(fp2, "%.20s\n", "ASSIGNMENT"); case ';':{fprintf(fp2, "; --->SEMI_COLUMN \n"); i=0;break;} case ':':{fprintf(fp2, ": --->COLUMN \n"); i=0;break;} case '(':{fprintf(fp2, "( --->LPAR \n"); i=0;break;} case ')':{fprintf(fp2, ") --->RPAR \n"); i=0;break;} case '{':{fprintf(fp2, "{ --->LBRACE \n"); i=0;break;} case '}':{fprintf(fp2, "} ---> RBRACE \n"); i=0;break;} } } else { d[i]=a; //printf("%c\n",d[i]); i=i+1; } //} /* we can make the lexer more complex by including even more depths of checks for the symbols*/ } else { d[i+1]='\0'; printf("\n"); if((strcmp(d,"if ")==0)){fprintf(fp2,"if ----> IDENTIFIER \n"); //printf("%s \n",d); memset ( d, 0, 100 ); //printf("%s \n",d); count=count+1;} else if(strcmp(d,"then")==0){fprintf(fp2,"then ----> IDENTIFIER \n"); count=count+1;} else if(strcmp(d,"else")==0){fprintf(fp2,"else ----> IDENTIFIER \n"); count=count+1;} else if(strcmp(d,"switch")==0){fprintf(fp2,"switch ----> IDENTIFIER \n"); count=count+1;} else if(strcmp(d,"printf")==0){fprintf(fp2,"prtintf ----> IDENTIFIER \n"); count=count+1;} else if(strcmp(d,"scanf")==0){fprintf(fp2,"scanf ----> IDENTIFIER \n"); count=count+1;} else if(strcmp(d,"NULL")==0){fprintf(fp2,"NULL ----> IDENTIFIER \n"); count=count+1;} else if(strcmp(d,"int")==0){fprintf(fp2,"INT ----> IDENTIFIER \n"); count=count+1;} else if(strcmp(d,"char")==0){fprintf(fp2,"char ----> IDENTIFIER \n"); count=count+1;} else if(strcmp(d,"float")==0){fprintf(fp2,"float ----> IDENTIFIER \n"); count=count+1;} else if(strcmp(d,"long")==0){fprintf(fp2,"long ----> IDENTIFIER \n"); count=count+1;} else if(strcmp(d,"double")==0){fprintf(fp2,"double ----> IDENTIFIER \n"); count=count+1;} else if(strcmp(d,"const")==0){fprintf(fp2,"const ----> IDENTIFIER \n"); count=count+1;} else if(strcmp(d,"continue")==0)fprintf(fp2,"continue ----> IDENTIFIER \n"); else if(strcmp(d,"size of")==0){fprintf(fp2,"size of ----> IDENTIFIER \n"); count=count+1;} else if(strcmp(d,"register")==0){fprintf(fp2,"register ----> IDENTIFIER \n"); count=count+1;} else if(strcmp(d,"short")==0){fprintf(fp2,"short ----> IDENTIFIER \n"); count=count+1;} else if(strcmp(d,"auto")==0){fprintf(fp2,"auto ----> IDENTIFIER \n"); count=count+1;} else if(strcmp(d,"while")==0){fprintf(fp2,"while ----> IDENTIFIER \n"); count=count+1;} else if(strcmp(d,"do")==0){fprintf(fp2,"do ----> IDENTIFIER \n"); count=count+1;} else if(strcmp(d,"case")==0){fprintf(fp2,"case ----> IDENTIFIER \n"); count=count+1;} else if (isdigit(d[i])) { fprintf(fp2,"%s ---->NUMBER",d); } else if (isalpha(a)) { fprintf(fp2,"%s ----> Variable",d); //printf("%s",d); // memset ( d, 0, 100 );} //fprintf(fp2, "s\n", b); i=0; k=k+1; continue; } i=i+1; k=k+1; } fclose(fp1); fclose(fp2); printf("%d",count); return 0; } In this code , my source.txt has if (a+b) stored . But only ( , + and ) is getting written into lext.txt and not the identifier if or the variable a and b . Any particular reason why?

    Read the article

  • VS C++ throwing divide by zero exception after a specific check

    - by Dr. Monkey
    In the following C++ code, it should be impossible for ain integer division by zero to occur: // gradedUnits and totalGrades are both of type int if (gradedUnits == 0) { return 0; } else { return totalGrades/gradedUnits; //call stack points to this line } however Visual Studio is popping up this error: Unhandled exception at 0x001712c0 in DSA_asgn1.exe: 0xC0000094: Integer division by zero. And the stack trace points to the line indicated in the code. It seems like VS might just do this with any integer division, without checking whether a divide by zero is possible. Do I need to catch this exception even though the code should never be able to throw it? If so, what's the best way to go about this? This is for an assignment that specifies VS 2005/2008 with C++. I would prefer not to make things more complicated than I need to, but at the same time I like to do things properly where possible.

    Read the article

  • SQL Query to get Count within a Stored Proc

    - by sia
    So i need to figure out how i can get a record count value and use that count as a new value to insert into a table. Ex: In My Stored Procedure @Count int What im looking for @Count to equal "select top (1) _fieldName from _someTable order by _fieldName Desc" Finally insert into _newTable (_fieldName) values (@Count) End I dont have to use a variable, just trying to demonstrate what im really trying to do. My SQL knowledge is pretty limited so no laughing, or smirking! ;)

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >