Search Results

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

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

  • GDI handles in a DotNET application

    - by David Rutten
    My pure DotNET library runs as a plugin inside an unmanaged desktop application. I've been getting a steady (though low) stream of crash reports that seem to indicate a problem with GDI handles (fonts in error messages etc. revert to the system font, display of all sorts of controls break down, massive crash shortly after). My Forms have few controls, but I do a lot of GDI+ drawing in User controls. What's a good way to tell how many handles I'm using, or even leaking? Thanks, David

    Read the article

  • PHP mySQL count number of fields not empty

    - by Pez Cuckow
    I have a database of users where they can send messages to other users (up to four) and the ID of the message they sent is in their user row. e.g. Name, Email, Msg1, Msg2, Msg3, Msg4 Pez, [email protected], 1, 55, 42, 5 //Send 4 messages Steve, [email protected], 0, 0, 0, 0 //Send 0 messages Leon, [email protected], 3, 0, 3, 5 //Send 3 messages How in a MySQL query can I get the amount of those message rows that are not empty or not equal to 0, allowing me to order by that? So it would return Pez - 4 Mesasges Leon - 3 Messages Steve - 0 Messages Im my mind something like order by count(!empty(msg1)+!empty(msg2)+!empty(msg3)+!empty(msg4)) Many thanks,

    Read the article

  • jQuery counter to count up to a target number

    - by Matt Huggins
    I'm trying to find out if anyone knows about an already existing jQuery plugin that will count up to a target number at a specified speed. For example, take a look at Google's number of MB of free storage on the Gmail homepage, under the heading that reads "Lots of space". It has a starting number in a <span> tag, and slowly counts upward every second. I'm looking for something similar, but I'd like to be able to specify: The start number The end number The amount of time it should take to get from start to end. A custom callback function that can execute when a counter is finished.

    Read the article

  • Incorrect decrement of the reference count

    - by idober
    I have the following problem: In one flow of the execution I use alloc, and on the other flow, alloc is not needed. At the end of the if statement, in any case, I release the object. When I do 'build and Analize' I get an error: 'Incorrect decrement of the reference count of an object is not owned by the caller'. How to solve that? UIImage *image; int RandomIndex = arc4random() % 10; if (RandomIndex<5) { image = [[UIImage alloc] initWithContentsOfFile:@"dd"]; } else { image = [UIImage imageNamed:@"dd"]; } UIImageView *imageLabel =[[UIImageView alloc] initWithImage:image]; [image release]; [imageLabel release];

    Read the article

  • SQL Query - Count column values separately

    - by user575535
    I have a hard time getting a Query to work right. This is the DDL for my Tables CREATE TABLE Agency ( id SERIAL not null, city VARCHAR(200) not null, PRIMARY KEY(id) ); CREATE TABLE Customer ( id SERIAL not null, fullname VARCHAR(200) not null, status VARCHAR(15) not null CHECK(status IN ('new','regular','gold')), agencyID INTEGER not null REFERENCES Agency(id), PRIMARY KEY(id) ); Sample Data from the Tables AGENCY id|'city' 1 |'London' 2 |'Moscow' 3 |'Beijing' CUSTOMER id|'fullname' |'status' |agencyid 1 |'Michael Smith' |'new' |1 2 |'John Doe' |'regular'|1 3 |'Vlad Atanasov' |'new' |2 4 |'Vasili Karasev'|'regular'|2 5 |'Elena Miskova' |'gold' |2 6 |'Kim Yin Lu' |'new' |3 7 |'Hu Jintao' |'regular'|3 8 |'Wen Jiabao' |'regular'|3 I want to produce the following output, but i need to count separately for ('new','regular','gold') 'city' |new_customers|regular_customers|gold_customers 'Moscow' |1 |1 |1 'Beijing'|1 |2 |0 'London' |1 |1 |0

    Read the article

  • GAE, JDO, count() doesn't work ?

    - by NilsBor
    On GAE with Spring/JDO after saving 2 entities (in transaction). On calling getById - entities fetched from data storage. On calling getCount() returns "0" and - on calling getAll() - returns empty collection. plz help me ! DAO: @Override public Long getCount() { return ((Integer) getJdoTemplate().execute(new JdoCallback() { @Override public Object doInJdo(PersistenceManager pm) throws JDOException { Query q = pm.newQuery(getPersistentClass()); q.setResult("count(this)"); return q.execute(); } })).longValue(); } @Override public void saveOrUpdate(T entity) { getJdoTemplate().makePersistent(entity); } @Override public List getAll() { return new ArrayList(getJdoTemplate().find(getPersistentClass())); }

    Read the article

  • SQL programming

    - by Prince
    how can I determine the number of CoE students per school per city? the coe students belongs to a different table from the school table from the city table. I really need some help now. thanks

    Read the article

  • Django query: Count and Group BY

    - by Tyler Lane
    I have a query that I'm trying to figure the "django" way of doing it: I want to take the last 100 calls from Call. Which is easy: calls = Call.objects.all().order_by('-call_time')[:100] However the next part I can't find the way to do it via django's ORM. I want to get a list of the call_types and the number of calls each one has WITHIN that previous queryset i just did. Normally i would do a query like this: "SELECT COUNT(id),calltype FROM call WHERE id IN ( SELECT id FROM call ORDER BY call_time DESC LIMIT 100 ) GROUP BY calltype;" I can't seem to find the django way of doing this particular query. Here are my 2 models: class Call( models.Model ): call_time = models.DateTimeField( "Call Time", auto_now = False, auto_now_add = False ) description = models.CharField( max_length = 150 ) response = models.CharField( max_length = 50 ) event_num = models.CharField( max_length = 20 ) report_num = models.CharField( max_length = 20 ) address = models.CharField( max_length = 150 ) zip_code = models.CharField( max_length = 10 ) geom = models.PointField(srid=4326) calltype = models.ForeignKey(CallType) objects = models.GeoManager() class CallType( models.Model ): name = models.CharField( max_length = 50 ) description = models.CharField( max_length = 150 ) active = models.BooleanField() time_init = models.DateTimeField( "Date Added", auto_now = False, auto_now_add = True ) objects = models.Manager()

    Read the article

  • Finding the Reachability Count for all vertices of a DAG

    - by ChrisH
    I am trying to find a fast algorithm with modest space requirements to solve the following problem. For each vertex of a DAG find the sum of its in-degree and out-degree in the DAG's transitive closure. Given this DAG: I expect the following result: Vertex # Reacability Count Reachable Vertices in closure 7 5 (11, 8, 2, 9, 10) 5 4 (11, 2, 9, 10) 3 3 (8, 9, 10) 11 5 (7, 5, 2, 9, 10) 8 3 (7, 3, 9) 2 3 (7, 5, 11) 9 5 (7, 5, 11, 8, 3) 10 4 (7, 5, 11, 3) It seems to me that this should be possible without actually constructing the transitive closure. I haven't been able to find anything on the net that exactly describes this problem. I've got some ideas about how to do this, but I wanted to see what the SO crowd could come up with.

    Read the article

  • Daily, Weekly and Monthly Page View Counter

    - by Jens Fahnenbruck
    I'm building a website with user generated content. On the home page I want to show a list of all created items, and I want to be able to sort them by a view counter. That's sound easy, but I want multiple counters. I want to know which was the most visited item in the last day, last week or last months or overall. My first Idea was to create 4 counter columns in the item's DB-Table. One for each of daily, weekly, monthly and overall, and the create a cron job, that clears the daily counter every 24 hours, the weekly counter every 7 days and so on. But my problem with this is, what happens if I want to know which was the most viewed item of the week, just after the weekly counter got cleared? What I need is an efficient way to create a continous counter, which got reduced for every page view that is too old, and increased for every new page view. Right now I'm thinking of a solution with the redis server, but I have no solution yet. I'm just looking for a general idea here, but FYI I'm developing this application in Ruby on Rails.

    Read the article

  • Live Character Count For EditText Android

    - by Taylor Perkins
    Hello, I was wondering what the best way to do a live character count of an edit-text box is in Android. I was looking at this but I couldn't seem to make any sense of it. To describe the problem, I have an EditText and I'm trying to limit the characters to 150. I can do this with an input filter, however I want to show right below the text box the number of characters a user has entered(Almost like stack overflow is doing right now). If someone could write a small snippet of example code or point me in the right direction I'd appreciate it a lot. Thanks in advance.

    Read the article

  • ng-grid get filtered column count after filtering

    - by Ryan Langton
    I'm using ng-grid with filtering. Any time the filter updates I want to get the filtered item count. I have been able to do this using the filteredRows property of ngGrid. However I'm getting the rows BEFORE the filtering occurs and I want them AFTER the filtering occurs. Here is a plunker to demonstrate the behavior: http://plnkr.co/edit/onyE9e?p=preview Here is the code where filtering is occuring: $scope.$watch('gridOptions.filterOptions.filterText2', function(searchText, oldsearchText) { if (searchText !== oldsearchText) { $scope.gridOptions.filterOptions.filterText = "name:" + searchText + "; "; $scope.recordCount = $scope.gridOptions.ngGrid.filteredRows.length; } });

    Read the article

  • Find all cycles in graph, redux

    - by Shadow
    Hi, I know there are a quite some answers existing on this question. However, I found none of them really bringing it to the point. Some argue that a cycle is (almost) the same as a strongly connected components (s. http://stackoverflow.com/questions/546655/finding-all-cycles-in-graph/549402#549402) , so one could use algorithms designed for that goal. Some argue that finding a cycle can be done via DFS and checking for back-edges (s. boost graph documentation on file dependencies). I now would like to have some suggestions on whether all cycles in a graph can be detected via DFS and checking for back-edges? My opinion is that it indeed could work that way as DFS-VISIT (s. pseudocode of DFS) freshly enters each node that was not yet visited. In that sense, each vertex exhibits a potential start of a cycle. Additionally, as DFS visits each edge once, each edge leading to the starting point of a cycle is also covered. Thus, by using DFS and back-edge checking it should indeed be possible to detect all cycles in a graph. Note that, if cycles with different numbers of participant nodes exist (e.g. triangles, rectangles etc.), additional work has to be done to discriminate the acutal "shape" of each cycle.

    Read the article

  • Joining two tables using a count

    - by Dave
    I have two tables as defined below: EMAILS ID SUBJECT BODY 1 Test1 blah blah 2 Test2 blah blah blah 3 Test3 more blah ATTACHMENTS ID EMAIL_ID ATTACHMENT NAME 1 2 TEST.DOC 2 2 TEST.XLS I'm trying to perform a select to get back all of the emails and a count of how many attachments (if any) for each row in the EMAILS table -- preferably in a single query where the results would resemble something like: EMAIL_ID SUBJECT NUM_ATTACHMENTS BODY 1 Test1 0 blah blah 2 Test2 2 blah blah blah 3 Test3 0 more blah I've tried everything but the "right way" and if anyone has a few minutes to help me create the right SQL to build this, I'd greatly appreciate it. Thanks.

    Read the article

  • Change values in first key from 0 to count(array) - 1

    - by sologhost
    Ok, I have an array like so: $myArray[32]['value'] = 'value1'; $myArray[32]['type'] = 'type1'; $myArray[33]['value'] = 'value2'; $myArray[33]['type'] = 'type2'; $myArray[35]['value'] = 'value3'; $myArray[42]['value'] = 'value4'; $myArray[42]['type'] = 'type4'; Ok, looking for a quick way to change all numbers in the first key 32, 33, 35, and 42 into 0, 1, 2, and 3 instead. But I need to preserve the 2nd key and all of the values. The array is already ordered correctly, since I ordered it using a ksort, but now I need to reset the array from 0 - count($myArray) - 1 and keep the 2nd key intact and its value as well. Can someone please help me?

    Read the article

  • Count end points in XML using XSL

    - by Chris
    I want to be able to count "end points" in an XML file using XSL. By endpoint I mean tag's with no children that contain data. i.e. <xmlsnippet> <tag1>NOTENOUGHDAYS</tag1> <tag2>INVALIDINPUTS</tag2> <tag3> <tag4> <tag5>2</tag5> <tag6>1</tag6> </tag4> </tag3> </xmlsnippet> This XML should return 4 as there are 4 "end points"

    Read the article

  • MySQL: Getting "busiest" or "most popular" hour from a datetime field?

    - by k00k
    Consider the following table which has the fields - id (int) and date_created (datetime): id date_created 1 2010-02-25 12:25:32 2 2010-02-26 13:40:37 3 2010-03-01 12:02:22 4 2010-03-01 12:10:23 5 2010-03-02 10:10:09 6 2010-03-03 12:45:03 I want to know the busiest/most popular hour of the day for this set of data. In this example, the result I'm looking for would be 12. Ideas?

    Read the article

  • Does different iVar name change retain count when used with property

    - by russell
    Here is 2 code snapshot- Class A:NSObject { NSMutableArray *a; } @property (retain) NSMutableArray *a; @implementation @synthesize a; -(id)init { if(self=[super init]) { a=[[NSMutableArray alloc] init]; } } @end Class A:NSObject { NSMutableArray *_a; } @property (retain) NSMutableArray *a; @implementation @synthesize a=_a; -(id)init { if(self=[super init]) { _a=[[NSMutableArray alloc] init]; } } @end Now what i need to know, is in both code instance variable assigned value directly rather than using accessor and retain count is 1? Or there is difference between them. Thanks. And one more things, apple recommended not to use accessor in init/dealloc, but at the same time ask not to directly set iVar. So what is the best way to assign value of ivar in init()??

    Read the article

  • Determine if count of related model > 0

    - by Lowgain
    I have a model called Stem. I need a 'thumbs up' feature, so I have created a second model called Thumb, which consists of stem_id and user_id. I'm also using the restful authentication plugin for user credentials. I have the 'thumbs up' button working, which adds a row to the thumbs table fine, but I'd like to be able to check if the currently logged in user has already given a thumbs up to this particular stem. I tried adding this to the Stem model: def thumbed Thumb.count_by_sql ["SELECT COUNT(*) FROM thumbs WHERE user_id = ? AND stem_id = ?", current_user.id, self.id ] end The problem here is that the stem model has no access to the current_user variable the the controllers have. Is there a way I can get access to this property, or alternatively, is there another way I could go about checking this? I was hoping to get this as a property in the model because the stems are passed over to a Flex app using RubyAMF. Thanks!

    Read the article

  • Trying to understand NavigationController retain count for ViewControllers on its stack

    - by sharkan
    I have an UITableViewController as the rootViewController for my navigatorController. When I press a table cell I do the following: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { MessageHistory *msg = (MessageHistory *)[[self fetchedResultsController]objectAtIndexPath:indexPath]; ConversationViewController *chatController = [[ConversationViewController alloc]initWithNibName:@"ConversationView" bundle:nil andUser:msg.user]; [self.navigationController pushViewController:chatController animated:YES]; [chatController release]; But when I'm returning from the chatController (using the back button on the navbar) I get “EXC_BAD_ACCESS” commenting //[chatController release]; solves the problem. How? I thought when pushing to the navigationController adds a retain count and when pop from it release it? Also I believe if I'm not including the release after pushing to the navcontroller I'm generating a leak. Any idea what's happening here?

    Read the article

  • Comparing COUNT values within a query?

    - by outsyncof
    I have the following tables in a relation: person(ssn,sex) employment(ssn,workweeksperyear) assume ssn is a key. My assignment was to do this: Given as input the number of weeks per year a person has worked, determine whether there are more males than females who work more weeks than the input value. SELECT COUNT(sex) AS NumMales FROM person WHERE sex = 'Male' AND ssn IN (SELECT ssn FROM employment WHERE workweeksperyear > 48); The above query gets me the number of males for an input value and I could do the same for number of females but how do I compare the 2 results? Any help will be greatly appreciated!

    Read the article

  • How to count incrementally in SQL SERVER

    - by joe
    Hi Folks, I am assigned a problem which i am not sure how to write it in SQL SEVER (version 5/8) yet. Here is the simple query and its output: Select location, date_time, Item_sold From Product Location Date_time Item_sold VA 12/10/2010 1:30:00 PM Candy VA 12/10/2010 3:30:00 PM Chips VA 12/13/2010 12:50:00 AM Wine DC 12/13/2010 8:00:00 AM Gum DC 12/13/2010 12:30:00 PM Bags DC 12/13/2010 1:16:00 PM Cheese DC 12/13/2010 12:00:00 AM Hotdog NJ 12/15/2010 12:00:00 AM Coffee NJ 12/15/2010 1:15:00 PM Beers NJ 12/15/2010 3:45:00 AM Cream Here is my desired output, which I guess a while/for loop or a pivot function could do the job but my experience is not there yet. Basically, I need to count the number of item sold from the Item_sold column incrementally (base line date starts from 12/8 to 12/9, 12/8 to 12/10, 12/8 to 12/11, 12/8 to 12/12...) I was wondering if anyone could edcuate and solve this problem. Many thanks in advance, Joe Location 12/8 |12/8-12/9 |12/8-12/10 |12/8 - 12/11 |12/8 - 12/12 |12/8 - 12/13 VA 0 0 2 0 0 3 DC 0 0 0 0 0 4

    Read the article

  • Merging multiple array then sorting by array value count

    - by Sofyan
    Hi, Please help me, i need to merge multiple arrays then sorting it by array value count. Below is the problem: $array1 = array("abc", "def", "ghi", "jkl", "mno"); $array2 = array("mno", "jkl", "mno", "ghi", "pqr", "stu"); $array3 = array_merge($array1, $array2); $array4 = ??? print_r($array4); I want the returns of $array4 like this: Array ( [0] => mno [1] => ghi [2] => jkl [3] => abc [4] => def [5] => pqr [6] => stu )

    Read the article

  • c++ variadic macro argument count

    - by chedi
    Hi, is there any way to count the number of argument of a variadic macro, other than this one: #define PP_NARG(...) PP_NARG_(__VA_ARGS__,PP_RSEQ_N()) #define PP_NARG_(...) PP_ARG_N(__VA_ARGS__) #define PP_ARG_N( \ _1, _2, _3, _4, _5, _6, _7, _8, _9,_10, _11,_12,_13,_14,_15,_16,_17,_18,_19,_20, \ _21,_22,_23,_24,_25,_26,_27,_28,_29,_30, _31,_32,_33,_34,_35,_36,_37,_38,_39,_40, \ _41,_42,_43,_44,_45,_46,_47,_48,_49,_50, _51,_52,_53,_54,_55,_56,_57,_58,_59,_60, \ _61,_62,_63,N,...) N #define PP_RSEQ_N() \ 63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40, \ 39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16, \ 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0

    Read the article

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