Search Results

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

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

  • Mathematica: get number of arguments passed to a function?

    - by dbjohn
    How do I get the number of arguments passed to a function, such as Plus[2,3,4,5] has 4 arguments passed to it. I was thinking it may involve the use of the function Length and getting the arguments into a list. The intention is to iterate an operation based on the number of arguments for a function. There is probably a simple solution or function but I haven't come across it yet. Any other ways or suggestions are welcome as well?

    Read the article

  • incremental OL using letters (jQuery)

    - by jquery n00b
    Hi, I'm trying to dynamically add a span to an ol, where the counter should be in letters. eg: A result B result C result etc etc I've got this code which is great for using numbers but I've no idea what to do to it to make the numbers into letters jQuery(document).ready( function() { jQuery('.results ol').each(function () { jQuery(this).find('li').each(function (i) { i = i+1; jQuery(this).prepend('<span class="marker">' + i + '</span>'); }); }); }); Any help is greatly appreciated!

    Read the article

  • Get number of concurrent users online - ASP.NET

    - by Srikanth
    I would like to know the number of users logged into my ASP.NET 2.0 application. Points to be considered: 1) Simplest way would be to use Application or Cache object to have the counts on Session start or end. However this would fail if there is a worker process recycle. Wouldn't it? 2) Should't make a difference whether the session is inproc/state server managed/ or SQL server managed. 3) Should preferably be seamless to a web-farm architecture.

    Read the article

  • Objective-c Method to get a number then countdown in 1 every second

    - by Sami
    Hi, i need a little help i have a method which gets value such as 50, it then assigns that value to trackDuration, so NSNumber *trackDuration = 50, i want the method to every second minus 1 from the value of trackDuration and update a label, the label being called duration. Here's what i have so far; - (void) countDown { iTunesApplication *iTunes = [SBApplication applicationWithBundleIdentifier:@"com.apple.iTunes"]; NSNumber *trackDuration = [NSNumber numberWithDouble:[[iTunes currentTrack] duration]]; while (trackDuration > 0) { trackDuration - 1; int inputSeconds = [trackDuration intValue]; int hours = inputSeconds / 3600; int minutes = ( inputSeconds - hours * 3600 ) / 60; int seconds = inputSeconds - hours * 3600 - minutes * 60; NSString *trackDurationString = [NSString stringWithFormat:@"%.2d:%.2d:%.2d", hours, minutes, seconds]; [duration setStringValue:trackDurationString]; sleep(1); }} Any help would be much appreciated, thanks in advanced, Sami.

    Read the article

  • jquery outerwidth submenu items

    - by Epco
    i'm looking for a way to calculate the total width of de level 2 items and put it in the ul. I have looked at some jquery thinks like outerWidth and .lengt but can't figure it out. thanks in advance $('#menu li:has(ul) ul').each(function() <ul> <li>level 1</li> <li> <ul style="widht:??;"> <li>level 2</li> <li>level 2</li> </ul> </li> <li>level 1</li> </ul>

    Read the article

  • deallocated memory in tableview: message sent to deallocated instance

    - by Kirn
    I tried looking up other issues but couldn't find anything to match so here goes: I'm trying to display text in the table view so I use this bit of code: // StockData is an object I created and it pulls information from Yahoo APIs based on // a stock ticker stored in NSString *heading NSArray* tickerValues = [heading componentsSeparatedByString:@" "]; StockData *chosenStock = [[StockData alloc] initWithContents:[tickerValues objectAtIndex:0]]; [chosenStock getData]; // Set up the cell... NSDictionary *tempDict = [chosenStock values]; NSArray *tempArr = [tempDict allValues]; cell.textLabel.text = [tempArr objectAtIndex:indexPath.row]; return cell; This is all under cellForRowAtIndexPath When I try to release the chosenStock object though I get this error: [CFDictionary release]: message sent to deallocated instance 0x434d3d0 Ive tried using NSZombieEnabled and Build and Analyze to detect problems but no luck thus far. Ive even gone so far as to comment bits and pieces of the code with NSLog but no luck. I'll post the code for StockData below this. As far as I can figure something is getting deallocated before I do the release but I'm not sure how. The only place I've got release in my code is under dealloc method call. Here's the StockData code: // StockData contains all stock information pulled in through Yahoo! to be displayed @implementation StockData @synthesize ticker, values; - (id) initWithContents: (NSString *)newName { if(self = [super init]){ ticker = newName; } return self; } - (void) getData { NSURL *url = [NSURL URLWithString: [NSString stringWithFormat:@"http://download.finance.yahoo.com/d/quotes.csv?s=%@&f=%@&e=.csv", ticker, @"chgvj1"]]; NSError *error; NSURLResponse *response; NSURLRequest *request = [NSURLRequest requestWithURL:url]; NSData *stockData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; if(stockData) { NSString *tempStr = [[NSString alloc] initWithData:stockData encoding:NSASCIIStringEncoding]; NSArray *receivedValuesArr = [tempStr componentsSeparatedByString:@","]; [tempStr release]; values = [NSDictionary dictionaryWithObjects:receivedValuesArr forKeys:[@"change, high, low, volume, market" componentsSeparatedByString:@", "]]; } else { NSLog(@"Connection failed: %@", error); } } - (void)dealloc { [ticker release]; [values release]; [super dealloc]; NSLog(@"Release took place fine"); } @end

    Read the article

  • Count the unread emails in exchange for each user

    - by Luis
    Hi, i want to count the unread emails in exchange with c# i all conected to the exchange, and get all users and the corresponding email. for the connection i have .. RunspaceConfiguration rsConfig = RunspaceConfiguration.Create(); PSSnapInException snapInException = null; PSSnapInInfo info = rsConfig.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.Admin", out snapInException); Runspace myRunSpace = RunspaceFactory.CreateRunspace(rsConfig); myRunSpace.Open(); Pipeline pipeline = myRunSpace.CreatePipeline(); Command myCommand = new Command("Get-Mailbox"); pipeline.Commands.Add(myCommand); Collection<PSObject> commandResults = pipeline.Invoke(); // Ok, now we've got a bunch of mailboxes, cycle through them foreach (PSObject mailbox in commandResults) { //define which properties to get foreach (String propName in new string[] { "Name", "EmailAddresses", "Database", "OrganizationalUnit", "UserPrincipalName" }) { //grab the specified property of this mailbox Object objValue = mailbox.Properties[propName].Value; .......

    Read the article

  • Django: order by count of a ForeignKey field?

    - by AP257
    This is almost certainly a duplicate question, in which case apologies, but I've been searching for around half an hour on SO and can't find the answer here. I'm probably using the wrong search terms, sorry. I have a User model and a Submission model. Each Submission has a ForeignKey field called user_submitted for the User who uploaded it. class Submission(models.Model): uploaded_by = models.ForeignKey('User') class User(models.Model): name = models.CharField(max_length=250 ) My question is pretty simple: how can I get a list of the three users with the most Submissions? I trued creating a num_submissions method on the User model: def num_submissions(self): num_submissions = Submission.objects.filter(uploaded_by=self).count() return num_submissions and then doing: top_users = User.objects.filter(problem_user=False).order_by('num_submissions')[:3] but this fails, as do all the other things I've tried. Can I actually do it using a smart database query? Or should I just do something more hacky in the views file?

    Read the article

  • Optimizing MySQL statement with lot of count(row) an sum(row+row2)...

    - by Zombies
    I need to use InnoDB storage engine on a table with about 1mil or so records in it at any given time. It has records being inserted to it at a very fast rate, which are then dropped within a few days, maybe a week. The ping table has about a million rows, whereas the website table only about 10,000. My statement is this: select url from website ws, ping pi where ws.idproxy = pi.idproxy and pi.entrytime > curdate() - 3 and contentping+tcpping is not null group by url having sum(contentping+tcpping)/(count(*)-count(errortype)) < 500 and count(*) > 3 and count(errortype)/count(*) < .15 order by sum(contentping+tcpping)/(count(*)-count(errortype)) asc; I added an index on entrytime, yet no dice. Can anyone throw me a bone as to what I should consider to look into for basic optimization of this query. The result set is only like 200 rows, so I'm not getting killed there.

    Read the article

  • How to get count of another table in a left join

    - by Sinan
    I have multiple tables post id Name 1 post-name1 2 post-name2 user id username 1 user1 2 user2 post_user post_id user_id 1 1 2 1 post_comments post_id comment_id 1 1 1 2 1 3 I am using a query like this: SELECT post.id, post.title, user.id AS uid, username FROM `post` LEFT JOIN post_user ON post.id = post_user.post_id LEFT JOIN user ON user.id = post_user.user_id ORDER BY post_date DESC It works as intended. However I would like the get the number of comments for each post too. So how can i modify the this query so I can get the count of comments. Any ideas?

    Read the article

  • Use LINQ to count the number of combinations existing in two lists

    - by Ben McCormack
    I'm trying to create a LINQ query (or queries) that count the total number of occurences of a combinations of items in one list that exist in a different list. For example, take the following lists: CartItems DiscountItems ========= ============= AAA AAA AAA BBB AAA BBB BBB CCC CCC DDD The result of the query operation should be 2 since I can find two combinations of AAA and BBB (from DiscountItems) within the contents of CartItems. My thinking in approaching the query is to join the lists together to shorten CartItems to only include items from DiscountItems. The solution would be to find the CartItem in the resulting query that occurs the least amount of times, thus indicating how many combinations of items exist in CartItems. How can this be done? Here's the query I already have, but it's not working. query results in an enumeration with 100 items, far more than I expected. Dim query = From cartItem In Cart.CartItems Group Join discountItem In DiscountGroup.DiscountItems On cartItem.SKU Equals discountItem.SKU Into Group Select SKU = cartItem.SKU, CartItems = Group Return query.Min(Function(x) x.CartItems.Sum(Function(y) y.Quantity))

    Read the article

  • MYSQL - multiple count statments

    - by darudude
    I'm trying to do a lookup on our demographioc table to display some stats. However, since out demographic table is quit big I want to do it in one query. There are 2 fields that are important: sex, last_login I want to be able to get the total number of logins for various date ranges (<1day ago, 1-7 days ago, 7-30 days ago, etc) GROUPED BY sex I right now know how to do it for one date range. For example less than 1 day ago: SELECT sex, count(*) peeps FROM player_account_demo WHERE last_demo_update>1275868800 GROUP BY sex Which returns: sex peeps UNKNOWN 22 MALE 43 FEMALE 86 However I'd have to do this once for each range. Is there a way to get all 3 ranges in there? I'd want my end result to look something like this: sex peeps<1day peeps1-7days peeps7-30days Thanks!

    Read the article

  • Counting distinct and duplicate attribute values in an array

    - by keruilin
    I have an array of users that's sorted in descending order based on total_points. I need to find the rank of each user in that array. The issue is that more than one user can have the same total points and, thus, the same rank. For example, three users could be in 3rd place with 200 Points. Here's my current code: class Leader < ActiveRecord::Base def self.points_leaders all_leaders = all_points_leaders # returns array of users sorted by total_points in desc order all_leaders_with_rank = [] all_leaders.each do |user| rank = all_leaders.index(user)+1 all_leaders_with_rank << Ldr.new(rank, user) # Ldr is a Struct end return all_leaders_with_rank end end How must I modify the code so that the correct rank is returned, and not just the value of the index position?

    Read the article

  • STL class for reference-counted pointers?

    - by hasen j
    This should be trivial but I can't seem to find it (unless no such class exists!) What's the STL class (or set of classes) for smart pointers? UPDATE Thanks for the responses, I must say I'm surprised there's no standard implementation. I ended up using this one: http://www.gamedev.net/reference/articles/article1060.asp

    Read the article

  • Add results from MySQL?

    - by NardCake
    Not quite sure how descriptive that title was but this is what I want to do. I scripted a URL shortener today and it's working fine, I just want to add some stats on the bottom of it saying how many links there are and how many clicks there are. Now everytime a user clicks one of the links it +1 the column in the database then it redirects the user. I want to query that and add all of those numbers together from each row. I attempted a while loop which im not surprised didn't work: while($rows = mysql_fetch_assoc($check_count)){ $clicks = $rows['clicks']; $clicks = $clicks+$clicks; } If you don't understand please ask and if you do understand it means alot for any response!

    Read the article

  • IEnumerable not null but calling Count() results in Exception

    - by Draak
    I have code that's working beautifully on my development machine, but when deployed to the server is throwing null reference exception. So, I can't step through the code, but I've pinned down the culprit. But now I am puzzled. Here's the code. The question is below. Dim certs = From p In persons _ Select New Certificate( _ p.Value, _ New CertificateData.Seminar(thisEvent.Seminar.Name, _ thisEvent.StartDate.Value, _ thisEvent.EndDate.Value, _ thisEvent.Venue.City, _ thisEvent.Venue.State, _ New CertificateData.Instructor( _ staffMember.Name, _ staffMember.Titles, _ instrSignatPath))) _ With {.CertificateId = p.Key} lblMessage.Text = CStr(certs Is Nothing) lblMessage.Text = lblMessage.Text + "<br />" + CStr(certs.Count()) In the code above persons is a dictionary of custom class, and certs is of IEnumerable type. Now here's the quandary.. The first line that sets the label returns False, so certs is not null. But the second line throws an null reference exception. How is this possible?

    Read the article

  • SQL HAVING COUNT and JOIN

    - by user1833274
    I have tried to this query: What are the doctors that work on less than 2 Hospitals. I have these tables: CREATE TABLE Hospital ( hid INT PRIMARY KEY, name VARCHAR(127) UNIQUE, country VARCHAR(127), area INT ); CREATE TABLE Doctor ( ic INT PRIMARY KEY, name VARCHAR(127), date_of_birth INT, ); CREATE TABLE Work ( hid INT, ic INT, since INT, FOREIGN KEY (hid) REFERENCES Hospital (hid), FOREIGN KEY (ic) REFERENCES Doctor (ic), PRIMARY KEY (hid,ic) ); I tried with this: SELECT DISTINCT D.ic FROM Doctor D, Work W JOIN Hospital H ON (H.hid = W.hid) WHERE D.bi = W.bi GROUP BY (D.ic) HAVING COUNT(H.hid) < 2 ;

    Read the article

  • Summary count for Python logging

    - by Craig McQueen
    At the end of my Python program, I'd like to be able to get a summary of the number of items logged through the standard logging module. I'd specifically like to be able to get a count for each specified name (and possibly its children). E.g. if I have: input_logger = getLogger('input') input_logger.debug("got input1") input_logger.debug("got input2") input_logger.debug("got input3") network_input_logger = getLogger('input.network') network_input_logger.debug("got network input1") network_input_logger.debug("got network input2") getLogger('output') output_logger.debug("sent output1") Then at the end I'd like to get a summary such as: input: 5 input.network: 2 output: 1 Perhaps by calling a getcount() method for a logger or a handler. What would be a good way to achieve this? I imagine it would involve a sub-class of one of the logging classes, but I'm not sure which one would be best.

    Read the article

  • Display number of retweets of a blog post

    - by Clint
    Hi, I was wondering if anyone has a link to any information regarding building in Twitter Mention functionality into a website like here, http://paul.boagworld.com/?page=2, where each post dispays the number of times it has been mentioned on twitter. Many thanks, C

    Read the article

  • postgresql count

    - by dars
    Can this be done in PGSQL? I have a view which I created where hostname,ip, and datacenter are from one table, and ifdesc and if stats from another table. the view output looks like this: hostname | ip | datacenter | ifdesc | ifadminstat | ifoperstat| ---------- ------------------------------------------------------------------ r1 1.1.1.1 dc GigabitEthernet1/1 2 1 r1 1.1.1.1 dc GigabitEthernet1/2 2 2 r1 1.1.1.1 dc GigabitEthernet1/3 2 2 r1 1.1.1.1 dc GigabitEthernet1/4 2 1 r1 1.1.1.1 dc GigabitEthernet2/1 2 2 r1 1.1.1.1 dc GigabitEthernet2/2 2 2 r2 2.2.2.2 dc GigabitEthernet1/1 2 2 r2 2.2.2.2 dc GigabitEthernet1/2 2 2 I need to get a count of "ifadminstat = 2" and "ifoperstat = 2" for all interfaces on each blade, for each router (for example... for r1, how many interfaces on blade 1 (GigabitEthernet1/1-48) have "ifadminstat = 2" and "ifoperstat = 2". I am trying to do the counting in Postgresql then present the results on a website using PHP.

    Read the article

  • How do a search a table for similar records and displaying count - Ruby on Rails

    - by bgadoci
    I have created a table in my Ruby on Rails application that I am building called Tags. It is a blog application so I allow the user to associate tags with a post and do this through a :posts, :has_many = tags and Tag belongs_to :post association. Now that I have my Tags table I am trying to see how I would render the view such that it displays the tag and tag count. (it should be noted that I am trying to render this in the /views/posts/index.html.erb file). For instance, if there are 10 entries in the Tag table for tag_name Sports. How can I display Sports (10) in the view. I am not looking to do this for a specific tag but rather, somehow search the table, combine like tags and display a list of all tags with counts next to them. (I really want these to be a link to a list of posts that contain that tag but I learned early on only to ask one question at a time). Hope that makes sense.

    Read the article

  • Why my combobox count is 0?

    - by just_name
    Why the count of items in my ComboBox is always 0 although the datasource of this combobox has data !! <div align="right" dir="rtl"> <asp:Label ID="lbl_contactListName" runat="server" Text="Menu Name :" CssClass="span"></asp:Label> <telerik:RadComboBox ID="ddl_contactList" runat="server" AutoPostBack="True" CausesValidation="False" CollapseDelay="0" Culture="ar-EG" ExpandDelay="0" Filter="StartsWith" ItemsPerRequest="10" MarkFirstMatch="true" Skin="Outlook" EnableAutomaticLoadOnDemand="True" EmptyMessage="-New Menu-" ShowMoreResultsBox="True" OnSelectedIndexChanged="ddl_contactList_SelectedIndexChanged" EnableVirtualScrolling="True" DataTextField="list_desc" DataValueField="list_code" DataSourceID="ObjectDataSource1" EnableViewState="true" Width="300px"> </telerik:RadComboBox> </div> <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetContactListsByDep" TypeName="SendSMS_EmailModule.ContactList"> <SelectParameters> <asp:SessionParameter Name="year" SessionField="year" Type="Int32" /> <asp:SessionParameter Name="main_code" SessionField="main_code" Type="Int32" /> </SelectParameters> </asp:ObjectDataSource>

    Read the article

  • SQL Count unique objects defined by parameters

    - by Eduardo
    I have a table with: id | parameter 1 | A 1 | B 2 | A 3 | A 3 | B That represent objects defined with the values as: 1 -> A,B 2 -> A 3 -> A,B I want to count the number of objects with different parameters using a SQL query, so in this case it would be 2 unique objects as 1 and 3 have the same parameters. The database is a Microsoft SQL Server 2000. But I do not mind knowing the solution for other databases.

    Read the article

  • Get the count of login datetime and username from the textfile

    - by user2897388
    I am having a textfile with usename, userid, login and logout time. From this textfile I need to get the userid and howmany times that user logged in on that particular date. I am doing this one using C# (.NET) in windows applications. I tried this code but I am getting the whole text into the string strRead. In that strRead I need to get the count of user login basing on date. StreamReader strmrdr = new StreamReader("Logfiles.txt"); string strRead = strmrdr.ReadToEnd(); Username:Rajini||UserId:abc||Userlogintime:10/19/13 12:33:29 PM||UserLogoutTime:10/19/13 12:33:57 PM Username:Rajini||UserId:abc||Userlogintime:10/19/13 12:35:29 PM||UserLogoutTime:10/19/13 12:36:57 PM

    Read the article

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