Search Results

Search found 5064 results on 203 pages for 'automatic ref counting'.

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

  • Discrete mathematics problem - Probability theory and counting

    - by Mohammad
    Hello All, I'm taking a discrete mathematics course, and I encountered a question and I need your help. I don't know if this is the right place for that though :) It says: Each user on a computer system has a password, which is six to eight characters long, where each character is an uppercase letter or a digit. Each password must contain at least one digit. How many possible passwords are there? The book solves this by adding the probabilities of having six,seven and eight characters long password. However, when he solves for probability of six characters he does this P6 = 36^6 - 26^6 and does P7 = 36^7 - 26^7 and P8 = 36^8 - 26^8 and then add them all I understand the solution, but my question is why doesn't calculating, P6 = 10*36^5 and the same for P7 and P8, work? 10 for the digit and 36 for the alphanumeric? Also, if anyone could give me another solution, other than the one in the book. Thank you very much :)

    Read the article

  • Counting longest occurence of repeated sequence in Python

    - by user248237
    What's the easiest way to count the longest consecutive repeat of a certain character in a string? For example, the longest consecutive repeat of "b" in the following string: my_str = "abcdefgfaabbbffbbbbbbfgbb" would be 6, since other consecutive repeats are shorter (3 and 2, respectively.) How can I do this in Python? thanks.

    Read the article

  • Counting number of children in hierarchical SQL data

    - by moontear
    for a simple data structure such as so: ID parentID Text Price 1 Root 2 1 Flowers 3 1 Electro 4 2 Rose 10 5 2 Violet 5 6 4 Red Rose 12 7 3 Television 100 8 3 Radio 70 9 8 Webradio 90 For reference, the hierarchy tree looks like this: ID Text Price 1 Root |2 Flowers |-4 Rose 10 | |-6 Red Rose 12 |-5 Violet 5 |3 Electro |-7 Television 100 |-8 Radio 70 |-9 Webradio 90 I'd like to count the number of children per level. So I would get a new column "NoOfChildren" like so: ID parentID Text Price NoOfChildren 1 Root 8 2 1 Flowers 3 3 1 Electro 3 4 2 Rose 10 1 5 2 Violet 5 0 6 4 Red Rose 12 0 7 3 Television 100 0 8 3 Radio 70 1 9 8 Webradio 90 0 I read a few things about hierarchical data, but I somehow get stuck on the multiple inner joins on the parentIDs. Maybe someone could help me out here. moon

    Read the article

  • Verify Authenticode signature as being from our company for automatic updater

    - by James Johnston
    I am implementing an automatic update feature and need some advice on how to do this securely using best practices. I would like to use the downloaded file's Authenticode signature to verify that it is safe to run (i.e. originates from our company and hasn't been tampered with). My question is very similar to question #2008519. The bottom-line question: what's the best, most secure way to check Authenticode signatures for an automatic update feature? What fields in the certificate should be checked? Requirements being: (1) check signature is valid, (2) check it's my signature, (3) old clients can still update when my certificate expires and I get a new one. Here's some background information / ideas from my research: I believe this could be broken into two steps: Verify that the signature is valid. I believe this should be easy using WinVerifyTrust as outlined in http://msdn.microsoft.com/en-us/library/aa382384(VS.85).aspx - I don't expect problems here. Verify that the signature corresponds to our company, and not another company. This seems to be a more difficult question to answer: One possibility is to check some of the strings in the signature. Could be obtained via code at MS KB article #323809, but this article doesn't make recommendations on what fields should be checked for this type of application (or any other, for that matter). Question #1072540 also illustrates how to get some certificate info, but again doesn't recommend what fields to actually check. My concern is that the strings might not be the best check: what if another person is able to obtain a certificate with the same name, for example? Or if there's a valid reason for us to change the strings in the future? The person at question #2008519 has a very similar requirement. His need for a "TrustedByUs" function is identical to mine. However, he goes about doing the check by comparing public keys. While this would work in the short-term, it seems like it won't work for an automatic update feature. This is because code signing certificates are only valid for 2 - 3 years max. Therefore, in the future, when we buy a new certificate in 2 years, the old clients wouldn't be able to update any more due to the change in public key.

    Read the article

  • Counting the number of words in a text area

    - by user1320483
    Hello everyone my first question on stack overflow import javax.swing.*; import java.util.*; import java.awt.event.*; public class TI extends JFrame implements ActionListener { static int count=0; String ct; JTextField word; JTextArea tohide; public static void main(String arg[]) { TI ti=new TI(); } public TI() { JPanel j=new JPanel(); JLabel def=new JLabel("Enter the text to be encrypted"); word=new JTextField("",20); tohide=new JTextArea("",5,20); JButton jb=new JButton("COUNT"); tohide.setBorder(BorderFactory.createLoweredBevelBorder()); j.add(def); j.add(tohide); j.add(word); j.add(jb); add(j); setSize(500,500); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationRelativeTo(null); jb.addActionListener(this); } public void actionPerformed(ActionEvent ae) { String txt=tohide.getText(); StringTokenizer stk=new StringTokenizer(txt," "); while(stk.hasMoreTokens()) { String token=stk.nextToken(); count++; } ct=Integer.toString(count);; word.setText(ct); } } I want to count the number of words that are being typed in the textarea.There is a logical error.As I keep clicking the count button the word count increases.

    Read the article

  • Counting the number of visitors for a web page - JavaScript and Struts

    - by Dj
    Hi i am Dhananjay, I need to keep track of the number of visitors to a web page. I have planned like this: on load of the home page, I will call a javascript callCounter(); From javascript, I need then to call an action and update a record in database. Please help me with this. How do i call the action? I should be in the same home jsp after updating database. Thanks in advance, Dhananjay

    Read the article

  • Counting FLOPS/GFLOPS in program - CUDA

    - by msx
    Already finished my application which multiplies CRS matrix and vector (SpMV) and the only thing to do now is to count FLOPS my application did. In my opinion it's really hard to estimate number of floating point operation in case of sparse matrix - vector multiplication, because the number of multiplies in one row is really "jumpy" or fluent. I only tried to measure time using "cudaprof" ( available in ./CUDA/bin directory) - it works fine. Any sugestions and instruction pastes appreciated !

    Read the article

  • Need Help With Simple Counting Bug in iPhone SDK

    - by seanny94
    So I'm basically making an app that adds a count to a number and then displays it each time you tap the button. However, the first tap issued doesn't take any action but adds one (just as planned) on the second tap. I've searched to the ends of the earth looking for the solution with no luck, so I'll see what you guys can make of this. :) #import "MainView.h" @implementation MainView int count = 0; -(void)awakeFromNib { counter.text = @"0"; } - (IBAction)addUnit { if(count >= 999) return; NSString *numValue = [[NSString alloc] initWithFormat:@"%d", count++]; counter.text = numValue; [numValue release]; } - (IBAction)subtractUnit { if(count <= 0) return; NSString *numValue = [[NSString alloc] initWithFormat:@"%d", count--]; counter.text = numValue; [numValue release]; } @end

    Read the article

  • Metatool for automatic xml code generation

    - by iceman
    I want to develop a programming tool for developers which can do automatic xml code generation for specifying a GUI design and its controls. The aim is to allow non-programmers specify GUI controls(which in this case perform higher level task unlike WinForms ) from a GUI. So the xml code generated is essentially an internal representation which programmers can understand and further use in any automatic GUI generator. So the workflow is GUI(non-programmers)-xml(for programmers)-GUI(non-programmers). Is there a Microsoft project similar to this?

    Read the article

  • Counting multiple entries in a MySQL database?

    - by Aaron
    Hi all, I'm trying to count multiple entries in a MySQL database, I know how to use COUNT(), but the exact syntax I want to get the results I need eludes me. The problem: Table structure: ID, CODE, AUTHOR, COUNTRY, TIMESTAMP. Code, Author and Country overlap many times in the table. I am trying to discover if there is one simple query that can be ran to return (using WHERE clause on COUNTRY) the author field, the code field, and then a final field that counts the number of times the CODE was present in the query result. So, theoretically I could end up with an array like: array('author', 'code', 'codeAppearsNTimes'); Authors also have varying codes associated with them, so I don't want the results merged. I suppose the end result would be: 'This author is associated with this code this many times'. Is this possible with MySQL? Thanks in advance.

    Read the article

  • Counting computers for each lab

    - by Irvin
    Alright I have a problem with having to count PCs, and Macs from different labs. In each lab I need to display how many PC and Macs there is available. The data is coming from a SQL server, right am trying sub queries and the use of union, this the closest I can get to what I need. The query below shows me the number of PCs, and Macs in two different columns, but of course, the PCs will be in one row and the Macs on another right below it. Having the lab come up twice. EX: LabName -- PC / MAC Lab1 -- 5 / 0 Lab1 -- 0 / 2 Query SELECT Labs.LabName, COUNT(*),0 AS Mac FROM HardWare INNER JOIN Labs ON HardWare.LabID = Labs.LabID WHERE ComputerStatus = 'AVAILABLE' GROUP BY Labs.LabName UNION SELECT Labs.LabName, COUNT(*), (SELECT COUNT(Manufacturer)) AS Mac FROM HardWare INNER JOIN Labs ON HardWare.LabID = Labs.LabID WHERE ComputerStatus = 'AVAILABLE' AND Manufacturer = 'Apple' GROUP BY Labs.LabName ORDER BY Labs.LabName So is there any way to get them together in one row as in Lab1 -- 5 / 2 or is there a different way to write the query? anything will be a big help, am pretty much stuck here. Cheers

    Read the article

  • Counting Alphabetic Characters That Are Contained in an Array with C

    - by Craig
    Hello everyone, I am having trouble with a homework question that I've been working at for quite some time. I don't know exactly why the question is asking and need some clarification on that and also a push in the right direction. Here is the question: (2) Solve this problem using one single subscripted array of counters. The program uses an array of characters defined using the C initialization feature. The program counts the number of each of the alphabetic characters a to z (only lower case characters are counted) and prints a report (in a neat table) of the number of occurrences of each lower case character found. Only print the counts for the letters that occur at least once. That is do not print a count if it is zero. DO NOT use a switch statement in your solution. NOTE: if x is of type char, x-‘a’ is the difference between the ASCII codes for the character in x and the character ‘a’. For example if x holds the character ‘c’ then x-‘a’ has the value 2, while if x holds the character ‘d’, then x-‘a’ has the value 3. Provide test results using the following string: “This is an example of text for exercise (2).” And here is my source code so far: #include<stdio.h> int main() { char c[] = "This is an example of text for exercise (2)."; char d[26]; int i; int j = 0; int k; j = 0; //char s = 97; for(i = 0; i < sizeof(c); i++) { for(s = 'a'; s < 'z'; s++){ if( c[i] == s){ k++; printf("%c,%d\n", s, k); k = 0; } } } return 0; } As you can see, my current solution is a little anemic. Thanks for the help, and I know everyone on the net doesn't necessarily like helping with other people's homework. ;P

    Read the article

  • R counting the occurance of similar rows of data frame

    - by Matt
    I have data in the following format called DF (this is just a made up simplified sample): eval.num, eval.count, fitness, fitness.mean, green.h.0, green.v.0, offset.0 random 1 1 1500 1500 100 120 40 232342 2 2 1000 1250 100 120 40 11843 3 3 1250 1250 100 120 40 981340234 4 4 1000 1187.5 100 120 40 4363453 5 1 2000 2000 200 100 40 345902 6 1 3000 3000 150 90 10 943 7 1 2000 2000 90 90 100 9304358 8 2 1800 1900 90 90 100 284333 However, the eval.count column is incorrect and I need to fix it. It should report the number of rows with the same values for (green.h.0, green.v.0, and offset.0) by only looking at the previous rows. The example above uses the expected values, but assume they are incorrect. How can I add a new column (say "count") which will count all previous rows which have the same values of the specified variables? I have gotten help on a similar problem of just selecting all rows with the same values for specified columns, so I supposed I could just write a loop around that, but it seems inefficient to me.

    Read the article

  • SQL - Counting sets of Field-B values for each Field-A value

    - by potrnd
    Hello, First of all sorry that I could not think of a more descriptive title. What I want to do is the following using only SQL: I have some lists of strings, list1, list2 and list3. I have a dataset that contains two interesting columns, A and B. Column A contains a TransactionID and column B contains an ItemID. Naturally, there can be multiple rows that share the same TransactionIDs. I need to catch those transactions that have at least one ItemID in each and every list (list1 AND list2 AND list3). I also need to count how many times does that happen for each transaction. [EDIT] That is, count how many full sets of ItemIDs there are for each TransactionID", "Full Set" being any element of the list1 with any element of the list2 with any element of the list3 I hope that makes enough sense, perhaps I will be able to explain it better with a clear head. Thanks in advance

    Read the article

  • counting fields based on group in crystal report

    - by hatem gamil
    hi all i wana ask a question about crystal reporting in vs 2008 lets say i have a report with these data customer_ID Customer_Name Order_amoont Order_Date (#group1 VipCustomer) 1 xyz 3 1/1/2010 2 abc 4 2/2/2010 5 sds 21 3/12/2009 (#Group2 NormalCustomer) 3 tyt 2 3/3/2010 4 ha 4 21/3/2009 i want only to display records where Order_Date year is in 2010 only so i went to the section expert and i added a condintion in suppress formula Year(order_Date)=2010 and i get the result ,,the question is how to count how many vip customers ordered in 2010 only and how many normal customer order in 2010 only ,,then i want the total number of both type of customers to be displayed to have a report like that:: customer_ID Customer_Name Order_amoont Order_Date (#group1 VipCustomer) 1 xyz 3 1/1/2010 2 abc 4 2/2/2010 subtotal 2 (#Group2 NormalCustomer) 3 tyt 2 3/3/2010 subtotal 1 total 3 thnx

    Read the article

  • postgres counting one record twice if it meets certain criteria

    - by Dashiell0415
    I thought that the query below would naturally do what I explain, but apparently not... My table looks like this: id | name | g | partner | g2 1 | John | M | Sam | M 2 | Devon | M | Mike | M 3 | Kurt | M | Susan | F 4 | Stacy | F | Bob | M 5 | Rosa | F | Rita | F I'm trying to get the id where either the g or g2 value equals 'M'... But, a record where both the g and g2 values are 'M' should return two lines, not 1. So, in the above sample data, I'm trying to return: $q = pg_query("SELECT id FROM mytable WHERE ( g = 'M' OR g2 = 'M' )"); 1 1 2 2 3 4 But, it always returns: 1 2 3 4

    Read the article

  • counting rows that date hasn't yet passed

    - by AdRock
    I am trying to count the number of rows whose date has not yet passed so i can get only the current records I get an error sayng MySQL error #111 Invalid use of group function SELECT COUNT(festivalid) FROM festivals WHERE min(datefrom) > now()

    Read the article

  • Counting elements and reading attributes with .net2.0 ?

    - by Prix
    I have an application that is on .net 2.0 and I am having some difficult with it as I am more use to linq. The xml file look like this: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <updates> <files> <file url="files/filename.ext" checksum="06B9EEA618EEFF53D0E9B97C33C4D3DE3492E086" folder="bin" system="0" size="40448" /> <file url="files/filename.ext" checksum="CA8078D1FDCBD589D3769D293014154B8854D6A9" folder="" system="0" size="216" /> <file url="files/filename.ext" checksum="CA8078D1FDCBD589D3769D293014154B8854D6A9" folder="" system="0" size="216" /> </files> </updates> The file is downloaded and readed on the fly: XmlDocument readXML = new XmlDocument(); readXML.LoadXml(xmlData); Initially i was thinking it would go with something like this: XmlElement root = doc.DocumentElement; XmlNodeList nodes = root.SelectNodes("//files"); foreach (XmlNode node in nodes) { ... im reading it ... } But before reading them I need to know how many they are to use on my progress bar and I am also clueless on how to grab the attribute of the file element in this case. How could I count how many "file" ELEMENTS I have (count them before entering the foreach ofc) and read their attributes ? I need the count because it will be used to update the progress bar. Overall it is not reading my xml very well.

    Read the article

  • IN R counting hierarchical data

    - by Alison
    I have a list of counties in each state that received nonattainment status in years 1995-2005. I want to know how many counties in each state each year that received this status. If my data is formatted like this, State1 Country1 YR1 Yr2 Yr3 Yr4... State1 Country2 YR1 Yr2 Yr3 Yr4 State2 County1 Yr1 Yr2..... Each year variable could have a 1 or a zero, since a county may gain or loose this status in a time period. I need to count each year how many counties in each state have nonattainment status (YRx=1), but can't think of how to do it.

    Read the article

  • Counting problem: possible sudoko tables?

    - by Sorush Rabiee
    Hi, I'm working on a sudoko solver. my method is using a game tree and explore possible permutations for each set of digits by DFS Algorithm. in order to analyzing problem, i want to know what is the count of possible valid and invalid sudoko tables? - a 9*9 table that have 9 one, 9 two, ... , 9 nine. (this isn't exact duplicate by this question) my solution is: 1- First select 9 cells for 1s: (*) 2- and like (1) for other digits (each time, 9 cells will be deleted from remaining available cells): C(81-9,9) , C(81-9*2,9) .... = 3- finally multiply the result by 9! (permutation of 123456789 in (*)) this is not equal to accepted answer of this question but problems are equivalent. what did i do wrong?

    Read the article

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