Search Results

Search found 2558 results on 103 pages for 'significant digits'.

Page 46/103 | < Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >

  • Is the last digit of a phone number random?

    - by sehugg
    I have a telephony app which has a prompt which requires user choice. I made the app select one of 10 different phone prompts based on the last digit of the caller's phone number. Then I measure whether the user responds to the prompt (accept) or decides to skip to the next step (reject). I thought this would work well enough as a random selection, but I think I may be wrong. What I'm finding is that the exact same prompt has a dramatically different response rate (25% vs 35%) for two different last digits. Now I'm curious why this is. Does anyone know how phone numbers are assigned and why the last digit would be significant?

    Read the article

  • HowTo parse numbers from string with BOOST methods?

    - by mosg
    Problem: Visual C++ 10 project (using MFC and Boost libraries). In one of my methods I'm reading simple test.txt file. Here is what inside of the file (std::string): 12 asdf789, 54,19 1000 nsfewer:22!13 Then I'm reading it and I have to convert all digits to int only with boost methods. For example, I have a list of different characters which I have to parse: ( ’ ' ) ( [ ], ( ), { }, ? ? ) ( : ) ( , ) ( ! ) ( . ) ( - ) ( ? ) ( ‘ ’, “ ”, « » ) ( ; ) ( / ) And after conversation I must have some kind of a massive of int's values, like this one: 12,789,54,19,1000,22,13 Maybe some one already did this job? PS. I'm new for boost. Thanks!

    Read the article

  • Getting specific values with regex

    - by David
    I need to knowingly isolate each row of the vCard and get its value. For instance, I want to get "5555" from X-CUSTOMFIELD. So far, my thoughts are: "X-CUSTOMFIELD;\d+" I have been looking at some tutorials and I am a little confused with what function to use? What would my regex above return? Would it give me the whole line or just the numerical part (5555)? I was thinking I i get the whole row, I can use substring to get the digits? BEGIN:VCARD VERSION:2.1 N:Last;First; FN:First Last TEL;HOME;VOICE:111111 TEL;MOBILE;VOICE:222222 X-CUSTOMFIELD;5555 END:VCARD

    Read the article

  • How to render Max(Substring) with Lambda Extensions

    - by caifa
    Hi everybody. I'm using NHibernate with Lambda Extensions. I'd like to know how to nest a Max function with a Substring. The following statement retrieves Max("invoice_id") var ret = session .CreateCriteria<Invoice>() .SetProjection(Projections.Max("invoice_id")) .UniqueResult(); but in my case the field invoice_id is made in this way: 12345.10 where 12345 is the invoice number, and 10 refers to the current year (2010). So I need to calculate the Max function only over the first 5 digits. How can I do it?

    Read the article

  • sloving Algorithm notation

    - by neednewname
    Use big-O notation to classify the traditional grade school algorithms for addition and multiplication. That is, if asked to add two numbers each having N digits, how many individual additions must be performed? If asked to multiply two N-digit numbers, how many individual multiplications are required Suppose f is a function that returns the result of reversing the string of symbols given as its input, and g is a function that returns the concatenation of the two strings given as its input. If x is the string hrwa, what is returned by g(f(x),x)? Explain your answer - don't just provide the result!

    Read the article

  • I need to pad IP addresses with Zeroes for each octet

    - by Felipe Alvarez
    Starting with a string of an unspecified length, I need to make it exactly 43 characters long (front-padded with zeroes). It is going to contain IP addresses and port numbers. Something like: ### BEFORE # Unfortunately includes ':' colon 66.35.205.123.80-137.30.123.78.52172: ### AFTER # Colon removed. # Digits padded to three (3) and five (5) # characters (for IP address and port numbers, respectively) 066.035.05.123.00080-137.030.123.078.52172 This is similar to the output produced by tcpflow. Programming in Bash. I can provide copy of script if required. If it's at all possible, it would be nice to use a bash built-in, for speed. Is printf suitable for this type of thing?

    Read the article

  • Execute python code inside browser without Jython

    - by proportional
    Is there a way to execute python code in a browser, other than using Jython and an applet? The execution does not have to deal with anything related to graphics. For example, just sum all the digits of a binary 1Gb file (chosen by the browser user) and then return the result to the server. I am aware that python can be executed remotely outside a browser, but my requirement is to be done inside a browser. For sure, I take for granted the user will keep the right to execute or not, and will be asked to do so, and all this security stuff... but that is not my question.

    Read the article

  • character matching in grayscale image

    - by maximus
    I made patterns: images with the "A" letter of different sizes (from 12 to 72: 12, 14, .., 72) And I tested the method of pattern matching and it gave a good results. One way to select text regions from image is to run that algorithm for all small and big letters and digits of different sizes. And fonts! I don't like it. Instead of it I want to make something like a universal pattern or better to say: scanning image with different window sizes and select those regions where some function (probability of that there is a character at that window) is more than some fixed value. Do you know any methods or ideas to make that function? It must work with original image (grayscale).

    Read the article

  • Count in base 2, 3, 4 etc in Java and output all permutations

    - by tree-hacker
    I want to write a function in Java that takes as input an integer and outputs every possible permutation of numbers up to that integer. For example: f(1) 0 f(2) should output: 00 01 10 11 f(3) should output: 000 001 002 010 011 012 020 021 022 100 .... 220 221 222 That is it should output all 27 permutations of the digits of the numbers 0, 1, 2. f(4) should output 0000 0001 0002 0003 0010 ... 3330 3331 3332 3333 f(4) should output 00000 00001 ... 44443 44444 I have been trying to solve this problem but cannot seem to work out how to do it and keep getting confused by how many loops I need. Does anyone know how to solve this problem? Thanks in advance.

    Read the article

  • How to restrict the range of elements of C++ STL vector?

    - by cambr
    vector<int> l; for(int i=0;i<10;i++){ l.push_back(i); } I want the vector to only be able to store numbers from a specified range (or set). How can that be done, in general? In particular, I want to restrict the vector to beonly be able to store single digits. So, if I do a l[9]++, it should give me an error or warn me. (because 10 is not a single digit number). Similarly, l[0]-- should warn me. Is there a way to do this using C++ STL vector?

    Read the article

  • Jquery Validation Central Message Many Errors

    - by Iamjon
    Hi everyone, I have a form that is being valdated with the Jquery Validation Plugin. I have managed to get a centeral message "Please Recheck the form", and to have the input focus on the first error. To get this, I had to override the default message of each of the errors. I was wondering if anyone could help me figure out how I can have it display the error message associated with the first error input instead of a general error message. Here is the code: $("#Help-A-Noobie-Form" ).validate({ invalidHandler: function(form, validator) { $(this).find(":input.error:first").focus(); var message = 'Please Recheck The Form' ; $("#Help-A-Noobie-Form #Message p").addClass('red').html(message); }, showErrors: function(errorMap, errorList) { this.defaultShowErrors(); }, rules: { required:true, email: {email:true}, phone: {digits:true} }, messages: { email: "", phone: "", lastname: "", firstname: "", required:"" } })

    Read the article

  • Why does the right-shift operator produce a zero instead of a one?

    - by mrt181
    Hi, i am teaching myself java and i work through the exercises in Thinking in Java. On page 116, exercise 11, you should right-shift an integer through all its binary positions and display each position with Integer.toBinaryString. public static void main(String[] args) { int i = 8; System.out.println(Integer.toBinaryString(i)); int maxIterations = Integer.toBinaryString(i).length(); int j; for (j = 1; j < maxIterations; j++) { i >>= 1; System.out.println(Integer.toBinaryString(i)); } In the solution guide the output looks like this: 1000 1100 1110 1111 When i run this code i get this: 1000 100 10 1 What is going on here. Are the digits cut off? I am using jdk1.6.0_20 64bit. The book uses jdk1.5 32bit.

    Read the article

  • Fastest algorithm to check if a number is pandigital?

    - by medopal
    Pandigital number is a number that contains the digits 1..number length. For example 123, 4312 and 967412385. I have solved many Project Euler problems, but the Pandigital problems always exceed the one minute rule. This is my pandigital function: private boolean isPandigital(int n){ Set<Character> set= new TreeSet<Character>(); String string = n+""; for (char c:string.toCharArray()){ if (c=='0') return false; set.add(c); } return set.size()==string.length(); } Create your own function and test it with this method int pans=0; for (int i=123456789;i<=123987654;i++){ if (isPandigital(i)){ pans++; } } Using this loop, you should get 720 pandigital numbers. My average time was 500 millisecond. I'm using Java, but the question is open to any language.

    Read the article

  • Compute hex color code for an arbitrary string

    - by user222164
    Heading Is there a way to map an arbitrary string to a HEX COLOR code. I tried to compute the HEX number for string using string hashcode. Now I need to convert this hex number to six digits which are in HEX color code range. Any suggestions ? String [] programs = {"XYZ", "TEST1", "TEST2", "TEST3", "SDFSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"}; for(int i = 0; i < programs.length; i++) { System.out.println( programs[i] + " -- " + Integer.toHexString(programs[i].hashCode())); }

    Read the article

  • Normalising book titles - Python

    - by RadiantHex
    Hi folks, I have a list of books titles: "The Hobbit: 70th Anniversary Edition" "The Hobbit" "The Hobbit (Illustrated/Collector Edition)[There and Back Again]" "The Hobbit: or, There and Back Again" "The Hobbit: Gift Pack" and so on... I thought that if I normalised the titles somehow, it would be easier to implement an automated way to know what book each edition is referring to. normalised = ''.join([char for char in title if char in (string.ascii_letters + string.digits)]) or normalised = '' for char in title: if char in ':/()|': break normalised += char return normalised But obviously they are not working as intended, as titles can contain special characters and editions can basically have very different title layouts. Help would be very much appreciated! Thanks :)

    Read the article

  • Swing: Multiple CellEditors for a column

    - by Luhar
    Hi, In my JTable, I have two editable numeric columns. The editor for both columns extends AbstractCellEditor and uses a JFormattedTextField as an the editing component. The problem is that the format for input depends on the value of another column in the row. If condition X is met, the number of fraction digits should be Y, otherwise they should be Y+2. I attempted to override the getTableCellEditor(..) method to associate a TableCellEditor per row. See this example. However, since I have two editable columns, sharing a single TableCellEditor object per row gives some very odd results. I don't think this is an appropriate solution. Any ideas on how to approach this would be much appreciated! Thank you!

    Read the article

  • Python: Regex outputs 12_34 - I need 1234

    - by Guy F-W
    So I have input coming in like: 12_34 5_6_8_2 4___3 1234 and the output I need from it is: 1234, 5682, 43, 1234 I'm currently working with r'[0-9]+[0-9_]*'.replace('_','') which (as far as I can tell) successfully rejects any input which is not a combination of numeric digits and under-scores, where the underscore cannot be the first character. However, replacing the _ with the empty string causes 12_34 to come out as 12 and 34. Is there a better method than 'replace' for this? Or could I adapt my regex to deal with this problem?

    Read the article

  • How do I find the next multiple of 10 of any integer?

    - by Tommy
    Dynamic integer will be any number from 0 to 150. i.e. - number returns 41, need to return 50. If number is 10 need to return 10. Number is 1 need to return 10. Was thinking I could use the ceiling function if I modify the integer as a decimal...? then use ceiling function, and put back to decimal? Only thing is would also have to know if the number is 1, 2 or 3 digits (i.e. - 7 vs 94 vs 136) Is there a better way to achieve this? Thank You,

    Read the article

  • PHP - Why does my computation produce a different result when I assign it to a variable?

    - by David
    I want to round a number to a specific number of significant digits - basically I want the following function: round(12345.67, 2) -> 12000 round(8888, 3) -> 8890 I have the following, but there's a strange problem. function round_to_sf($number, $sf) { $mostsigplace = floor(log10(abs($number)))+1; $num = $number / pow(10, ($mostsigplace-$sf)); echo ($number / pow(10, ($mostsigplace-$sf))).' '.$num.'<BR>'; } round_to_sf(41918.522, 1); Produces the following output: 4.1918522 -0 How can the result of a computation be different when it's assigned to a variable?

    Read the article

  • Need a Concatenating VBA code to prevent memory issue workaround

    - by doharr
    My set up: Have 50,000 rows of data. ( My row count will increase in the future. So might as well say I have a full worksheet of 64000+ rows.) All Data is TEXT, no formulas, etc. Column A is open Columns B thru AC contain the Data that needs to be concatenated The Data in the rows once concatenated to Column A will contain 60,000 digits or 6kb in file size. After additional maniuplation each cell will become a file. I have tried concatenating in Excel and I run into memory issues. The memory issue is when I Select and fill down the concatenating function into the worksheet. It crashes at the 8200 +/-row. My system is 2gb of ram, windows xp professional and Excel 2003. Have 4GB of disk space Hoping to find a VBA code that will conserve memory, and not crash like it does in excel. Thank you

    Read the article

  • Convert Decimal number into Fraction

    - by alankrita
    I am trying to convert decimal number into its fraction. Decimal numbers will be having a maximum 4 digits after the decimal place. example:- 12.34 = 1234/100 12.3456 = 123456/10000 my code :- #include <stdio.h> int main(void) { double a=12.34; int c=10000; double b=(a-floor(a))*c; int d=(int)floor(a)*c+(int)b; while(1) { if(d%10==0) { d=d/10; c=c/10; } else break; } printf("%d/%d",d,c); return 0; } but I am not getting correct output, Decimal numbers will be of double precision only.Please guide me what I should do.

    Read the article

  • Which database should I use for best performance

    - by _simon_
    Hello, I am working in Visual Studio 2005, .NET 2.0. I need to write an application, which listens on COM port and saves incoming data to a database. Main feature: save incoming data (series of 13-digits numbers), if this number allready exists, then mark it as double. For example, there could be these records in database: 0000000000001 OK 0000000000002 OK 0000000000002 Double 0000000000003 OK 0000000000004 OK I could use SQL database, but I don't know if it is fast enough... Database should be able to store up to 10.000.000 records and write up to 100 records per minute (so it needs to check 100 times per minute if this record allready exists). Which database should I use? Maybe the whole database would need to be in RAM. Where could I learn more about this? Thanks

    Read the article

  • How do I do division on HH:MM:SS format time strings in C#?

    - by Jake
    I have a series of times that are coming to me as strings from a web service. The times are formated as HH:MM:SS:000 (3 milisecond digits). I need to compare two times to determine if one is more than twice as long as the other: if ( timeA / timeB > 2 ) What's the simplest way to work with the time strings? If I was writing in Python this would be the answer to my question: Difference between two time intervals in Python Edit: What I'm really looking for is a way to get the ratio of timeA to timeB, which requires division, not subtraction. Unfortunately, the DateTime structure doesn't appear to have a division operator. Updated the question title to reflect this.

    Read the article

  • How to add Transparency information to a HEX color code?

    - by TK123
    I have to modify some code and the previous developer left this comment: color: color, // e.g. '#RRGGBBFF' - Last 2 digits are alpha information On the page there is a color picker that let's the user change text color. It gives HEX values like so: #RRGGBB And there is a slider that allows the user to change a text's transparency. It runs from 0.1 to 1 Somehow I need to get a 2 digit letter from this transparency amount and append it to the HEX value for it to work. Does anyone know how to append Alpga information to HEX color codes? What is the math formula for it? I guess the question can also be answered if anyone knows how to concert RGBA color values with transparency into HEX: rgba(255, 255, 255, 0.6)

    Read the article

  • Why is this C or C++ macro not expanded by the preprocessor?

    - by Atul
    Can someone points me the problem in the code when compiled with gcc 4.1.0. #define X 10 int main() { double a = 1e-X; return 0; } I am getting error:Exponent has no digits. When i replace X with 10, it works fine. Also i checked with g++ -E command to see the file with preprocessors applied, it has not replaced X with 10. I was under the impression that preprocessor replaces every macro defined in the file with the replacement text with applying any intelligence. Am I wrong? I know this is a really silly question but I am confused and I would rather be silly than confused :). Any comments/suggestions.

    Read the article

< Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >