Search Results

Search found 5960 results on 239 pages for 'numbers'.

Page 5/239 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How to implement square root and exponentiation on arbitrary length numbers?

    - by tomp
    I'm working on new data type for arbitrary length numbers (only non-negative integers) and I got stuck at implementing square root and exponentiation functions (only for natural exponents). Please help. I store the arbitrary length number as a string, so all operations are made char by char. Please don't include advices to use different (existing) library or other way to store the number than string. It's meant to be a programming exercise, not a real-world application, so optimization and performance are not so necessary. If you include code in your answer, I would prefer it to be in either pseudo-code or in C++. The important thing is the algorithm, not the implementation itself. Thanks for the help.

    Read the article

  • How to prevent users from inputting letters or numbers ?

    - by ZaZu
    Hello, I have a simple problem; Here is the code : #include<stdio.h> main(){ int input; printf("Choose a numeric value"); scanf("%d",&input); } I want the user to only enter numbers ... So it has to be something like this : #include<stdio.h> main(){ int input; printf("Choose a numeric value"); do{ scanf("%d",&input); }while(input!= 'something'); } My problem is that I dont know what to replace in 'something' ... How can I prevent users from inputting alphabetic characters ? Thanks for your help ! }

    Read the article

  • What is the best way for converting phone numbers into international format (E.164) using Java?

    - by Vihung
    What is the best way for converting phone numbers into international format (E.164) using Java? Given a 'phone number' and a country id (let's say an ISO country code), I would like to convert it into a standard E.164 international format phone number. I am sure I can do it by hand quite easily - but I would not be sure it would work correctly in all situations. Which Java framework/library/utility would you recommend to accomplish this? P.S. The 'phone number' could be anything identifiable by the general public - such as * (510) 786-0404 * 1-800-GOT-MILK * +44-(0)800-7310658 that last one is my favourite - it is how some people write their number in the UK and means that you should either use the +44 or you should use the 0. The E.164 format number should be all numeric, and use the full international country code (e.g.+44)

    Read the article

  • Automate Reading Lotto Numbers

    - by neiling
    When we buy a large qty of Lotto tickets, is there a way to read all those numbers into a spreadsheet so that they can be checked against the winning numbers thru formulas/macros? I am looking for an OCR application that can read the scanned PDF/JPG file and dump them into a file. (This might apply not only to Lotto, but also to other scanned documents.) As for checking for winning numbers, I know how to do it once I have them in a CSV/XLS file.

    Read the article

  • Problems in "Save as PDF" plugin with Arabic numbers

    - by Mohamed Mohsen
    I use the "Save as PDF" plugin with Microsoft word 2007 to generate a PDF document from DOCX document. It works great except that the Arabic numbers in the word file have been converted to English numbers in the PDF document. Kindly find two links containing two screen shots explaining the problem. http://img27.imageshack.us/img27/2893/englishpdf.jpg http://img4.imageshack.us/img4/1857/arabicword.jpg The first image is the generated PDF file with the English numbers highlighted. The second image is the original word file with the Arabic numbers highlighted. Thanks in advance

    Read the article

  • Page numbers in Word 2007

    - by ldigas
    I'm gonna skip the usual rant which normally follows upon mention of the words "Word 2007" I have a numbered section. Which has page numbers. Then, I insert a new section break at the end of the current section ... go to page numbers, format ..., and "start at ...", and the new section then has a new page numbering (starting with some other number). But, how do I after inserting a new section break, remove the page numbering in the new section ? If I go to remove page numbers option, Word removes the numbers from the new, but also from the old section (i.e. all of them). Help ... time is short ...

    Read the article

  • sed: replace only the first range of numbers

    - by Marit Hoen
    Imagine I have an input file like this: INSERT INTO video_item_theme VALUES('9', '29'); INSERT INTO video_item_theme VALUES('19', '312'); INSERT INTO video_item_theme VALUES('414', '1'); And I wish to add 10000 to only the first range of numbers, so I end up with something like this: INSERT INTO video_item_theme VALUES('10009', '29'); INSERT INTO video_item_theme VALUES('10019', '312'); INSERT INTO video_item_theme VALUES('10414', '1'); My approach would be to prefix "1000" to one digit numbers, "100" Something like...: sed 's/[0-9]\{2\}/10&/g' ... isn't very helpful, since it changes each occurance of two numbers, not only in the first occurance of numbers: INSERT INTO video_item_theme VALUES('9', '10029'); INSERT INTO video_item_theme VALUES('10019', '100312'); INSERT INTO video_item_theme VALUES('100414', '1');

    Read the article

  • Python - Check if numbers in list are factors of a number

    - by Zach
    Hey, I have a list of numbers (integers) (say, from 1 to 10). They're not necessarily consecutive, but they are in ascending order. I've prompted the user multiple times to enter a choice of the available numbers. When that number is entered, it is removed from the list along with any of its factors that may be there. I've prevented the user from selecting prime numbers. However, at some point in time, there may be non-prime numbers there, which have no factors remaining. I'm relatively new to Python, so I'm having trouble implementing: Checking if the number selected has no factors remaining (even if it is not prime). Checking if only prime numbers remain, or numbers without factors. I'm thinking of using for statements, but I'm not sure exactly how to implement them. Can anyone offer advice, or code? Thanks in advance... PS. In case anyone's wondering, I'm doing an implementation of the game of Taxman in Python.

    Read the article

  • Get `n` random values between 2 numbers having average `x`

    - by Somnath Muluk
    I want to get n random numbers(e.g n=16)(whole numbers) between 1 to 5(including both) so that average is x. x can be any value between (1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5). I am using PHP. e.g. Suppose I have average x= 3. Then required 16 whole numbers between 1 to 5(including both). like (1,5,3,3,3,3,2,4,2,4,1,5,1,5,3,3) Update: if x=3.5 means average of 16 numbers should be between 3.5 to 4. and if x=4 means average of 16 numbers should be between 4 to 4.5 and if x=5 means all numbers are 5

    Read the article

  • What are events SQL profiler eventclass numbers 65527,65528,65533,65534

    - by simonsabin
    I’ve been trying to use RML to process some files and couldn’t figure out why the numbers where all so much smaller than they should be. I then found a line in the RML output “Found [TRACE_STOP] event indicating the end of the trace files” This causes RML to stop processing further data, oh. In my case I had stopped the trace to add some error events because the client was experiencing errors. How do I get RML to process all the other data I wondered. This lead me to the eventclasses in the trace...(read more)

    Read the article

  • Multi-lingual error messages and error numbers

    - by Jon Hopkins
    So we're looking at the possibility of porting our software to support multiple languages and one of the areas we're going to have to deal with is error messages and other notifications. These obviously have to be reported to the users in their own language. Our team (largely) only speak English and even if we were all multi-lingual we're looking at selling to a wide range of countries and could never expect to have a reasonable number of people speaking all languages (we're a small company). The obvious way to get round the language issue when errors or other messages we may get asked about which are being reported is error numbers which would be consistent across language. While these are going to exist in the backend (if only as key on the error message), I'd really rather not throw them at users if we don't have to but I don't have any other solution. Anyone have any useful suggestions for alternatives?

    Read the article

  • Numbers on the launcher

    - by pete of ebor
    Using 12.04 LTS - few days ago, I left my machine on while I went out. On my return, the launcher was showing (it is set to be hidden) and there were small numbers 1-9 on the icons and letters s on the bottom-most icon and t on the rubbish bin. System still worked fine, although the launcher remained visible, and would not hide. After about 20 mins work, they suddenly vanished and the launcher hid itself.. is this a normal action ? It hasn't happened since..

    Read the article

  • Which numeral systems are useful in computer science?

    - by authchir
    I am wondering which numeral system different programmers are using, or would use if their language has support for them. As an example, in C++ we can use: Octal by prefixing with 0 (e.g. 0377) Decimal by default (e.g. 255) Hexadecimal by prefixing with 0x (e.g. 0xff) When working with bitmask, I am using hexadecimal but would sometimes want to be able to express binary numbers directly. I know some programming language support it with 0b syntax (e.g. 0b11111111). Is there any other numeric system useful in some computer science domain (e.g. cryptography, codecs, 3D graphics, etc)?

    Read the article

  • Find alternative numbers using IE accelerators and the SayNoTo0870 website

    - by simonsabin
    I’ve been a fan of the the SayNoTo0870 website for ages. I hate it costing me money to phone a company for support of their product. Especially on a mobile phone where 0845 and 0870 numbers are v expensive. So I’ve developed an accelerators for IE one allows you to find an alternative number using the company name and the other by using the original number. You can add the accelerators by going to my downloads page . To use the accelerator just select the company name, right click and navigate to...(read more)

    Read the article

  • Formatting Dates, Times and Numbers in ASP.NET

    Formatting is the process of converting a variable from its native type into a string representation. Anytime you display a DateTime or numeric variables in an ASP.NET page, you are formatting that variable from its native type into some sort of string representation. How a DateTime or numeric variable is formatted depends on the culture settings and the format string. Because dates and numeric values are formatted differently across cultures, the .NET Framework bases its formatting on the specified culture settings. By default, the formatting routines use the culture settings defined on the web server, but you can indicate that a particular culture be used anytime you format. In addition to the culture settings, formatting is also affected by a format string, which spells out the formatting details to apply. The .NET Framework contains a bounty of format strings. There are standard format strings, which are typically a single letter that applies detailed formatting logic. For example, the "C" format specifier will format a numeric type as a currency value; the "Y" format specifier displays the month name and four-digit year of the specified DateTime value. There are also custom format strings, which display a apply a very specific formatting rule. These custom format strings can be put together to build more intricate formats. For instance, the format string "dddd, MMMM d" displays the full day of the week name followed by a comma followed by the full name of the month followed by the day of the month. For more involved formatting scenarios, where neither the standard or custom format strings cut the mustard, you can always create your own formatting extension methods. This article explores the standard format strings for dates, times and numbers and includes a number of custom formatting methods I've created and use in my own projects. There's also a demo application you can download that lets you specify a culture and then shows you the output for the standard format strings for the selected culture. Read on to learn more! Read More >

    Read the article

  • SQL SERVER – Solution – Generating Zero Without using Any Numbers in T-SQL

    - by pinaldave
    SQL Server MVP and my friend My friend Madhivanan has asked very interesting question on his blog regarding How to Generate Zero without using Any Numbers in T-SQL. He has demonstrated various methods how one can generate Zero. When I posted note regarding how one he has generated Zero without using number in my blog post for Free Online Training, blog readers have come up with few very interesting answers. I really found them very interesting and here I am listing them with due credit. Special mention to Andery.ca as the answer Andery provided is the one, I myself come up with after very first look and that is why I had left the same as hint in the original article. anil try this select count(cast(null as int)) or any false condition select count(*) where ‘a’=’b’ Varinder Sandhu It seems every currency symbol that SQL Server supports. Return the same value as zero i tried some as select € select ¥ select £ Andrey.ca select count(*)-count(*) Vinay Kumar Another way for generate zero. select Ascii(‘Y’)-Ascii(‘Y’) OR select LEN(”) I like Madhivanan’s answer. and it was awesome. Reference: Pinal Dave (http://blog.SQLAuthority.com) Filed under: PostADay, Readers Contribution, SQL, SQL Authority, SQL Puzzle, SQL Query, SQL Server, SQL Tips and Tricks, SQLServer, T SQL, Technology

    Read the article

  • Fibonacci numbers in F#

    - by BobPalmer
    As you may have gathered from some of my previous posts, I've been spending some quality time at Project Euler.  Normally I do my solutions in C#, but since I have also started learning F#, it only made sense to switch over to F# to get my math coding fix. This week's post is just a small snippet - spefically, a simple function to return a fibonacci number given it's place in the sequence.  One popular example uses recursion: let rec fib n = if n < 2 then 1 else fib (n-2) + fib(n-1) While this is certainly elegant, the recursion is absolutely brutal on performance.  So I decided to spend a little time, and find an option that achieved the same functionality, but used a recursive function.  And since this is F#, I wanted to make sure I did it without the use of any mutable variables. Here's the solution I came up with: let rec fib n1 n2 c =    if c = 1 then        n2    else        fib n2 (n1+n2) (c-1);;let GetFib num =    (fib 1 1 num);;printfn "%A" (GetFib 1000);; Essentially, this function works through the sequence moving forward, passing the two most recent numbers and a counter to the recursive calls until it has achieved the desired number of iterations.  At that point, it returns the latest fibonacci number. Enjoy!

    Read the article

  • PHP rand function (or not so rand)

    - by Badr Hari
    I was testing PHP rand function to write on a image. Of course the output shows that it's not so random. The code I used: <?php header('Content-Type: image/png'); $lenght = 512; $im = imagecreatetruecolor($lenght, $lenght); $blue = imagecolorallocate($im, 0, 255, 255); for ($y = 0; $y < $lenght; $y++) { for ($x = 0; $x < $lenght; $x++) { if (rand(0,1) == 0) { imagesetpixel($im, $x, $y, $blue); } } } imagepng($im); imagedestroy($im); ?> My question is, if I use image width/lenght (variable $lenght in this example) number like 512, 256 or 1024, it is very clear that it's not so random. When I change the variable to 513 for an example, it is so much harder for human eye to detect it. Why is that? What is so special about these numbers? 512: 513: Edit: I'm running xampp on Windows to test it.

    Read the article

  • Finding maximum number of congruent numbers

    - by Stefan Czarnecki
    Let's say we have a multiset (set with possible duplicates) of integers. We would like to find the size of the largest subset of the multiset such that all numbers in the subset are congruent to each other modulo some m 1. For example: 1 4 7 7 8 10 for m = 2 the subsets are: (1, 7, 7) and (4, 8, 10), both having size 3. for m = 3 the subsets are: (1, 4, 7, 7, 10) and (8), the larger set of size 5. for m = 4 the subsets are: (1), (4, 8), (7, 7), (10), the largest set of size 2. At this moment it is evident that the best answer is 5 for m = 3. Given m we can find the size of the largest subset in linear time. Because the answer is always equal or larger than half of the size of the set, it is enough to check for values of m upto median of the set. Also I noticed it is necessary to check for only prime values of m. However if values in the set are large the algorithm is still rather slow. Does anyone have any ideas how to improve it?

    Read the article

  • Filter list of phone numbers using php

    - by LiveEn
    I have a list of phone numbers that start with the below numbers and in different formats...i need to grab the numbers that start only with the below numbers/format using php...... 020 8 07974 +44 (0) 20 +44 0 440203 any help will be appreciated..

    Read the article

  • Is there a module for parsing numbers (inkl. ranges)?

    - by sid_com
    Is there a module, which does this for me? #!/usr/bin/env perl use warnings; use strict; use 5.012; sub aw_parse { my( $in, $max ) = @_; chomp $in; my @array = split ( /\s*,\s*/, $in ); my %zahlen; for ( @array ) { if ( /^\s*(\d+)\s*$/ ) { $zahlen{$1}++; } elsif ( /^\s*(\d+)\s*-\s*(\d+)\s*$/ ) { die "'$1-$2' not a valid input $!" if $1 >= $2; for ( $1 .. $2 ) { $zahlen{$_}++; } } else { die "'$_' not a valid input $!"; } } @array = sort { $a <=> $b } keys ( %zahlen ); if ( defined $max ) { for ( @array ) { die "Input '0' not allowed $!" if $_ == 0; die "Input ($_) greater than $max not allowed $!" if $_ > $max; } } return \@array; } my $max = 20; print "Input (max $max): "; my $in = <>; my $out = aw_parse( $in, $max ); say "@$out";

    Read the article

  • Is there a Perl module for parsing numbers, including ranges?

    - by sid_com
    Is there a module, which does this for me? sample_input: 2, 5-7, 9, 3, 11-14 #!/usr/bin/env perl use warnings; use strict; use 5.012; sub aw_parse { my( $in, $max ) = @_; chomp $in; my @array = split ( /\s*,\s*/, $in ); my %zahlen; for ( @array ) { if ( /^\s*(\d+)\s*$/ ) { $zahlen{$1}++; } elsif ( /^\s*(\d+)\s*-\s*(\d+)\s*$/ ) { die "'$1-$2' not a valid input $!" if $1 >= $2; for ( $1 .. $2 ) { $zahlen{$_}++; } } else { die "'$_' not a valid input $!"; } } @array = sort { $a <=> $b } keys ( %zahlen ); if ( defined $max ) { for ( @array ) { die "Input '0' not allowed $!" if $_ == 0; die "Input ($_) greater than $max not allowed $!" if $_ > $max; } } return \@array; } my $max = 20; print "Input (max $max): "; my $in = <>; my $out = aw_parse( $in, $max ); say "@$out";

    Read the article

  • Name of the Countdown Numbers round problem - and algorithmic solutions?

    - by Dai
    For the non-Brits in the audience, there's a segment of a daytime game-show where contestants have a set of 6 numbers and a randomly generated target number. They have to reach the target number using any (but not necessarily all) of the 6 numbers using only arithmetic operators. All calculations must result in positive integers. An example: Youtube: Countdown - The Most Extraordinary Numbers Game Ever? A detailed description is given on Wikipedia: Countdown (Game Show) For example: The contentant selects 6 numbers - two large (possibilities include 25, 50, 75, 100) and four small (numbers 1 .. 10, each included twice in the pool). The numbers picked are 75, 50, 2, 3, 8, 7 are given with a target number of 812. One attempt is (75 + 50 - 8) * 7 - (3 * 2) = 813 (This scores 7 points for a solution within 5 of the target) An exact answer would be (50 + 8) * 7 * 2 = 812 (This would have scored 10 points exactly matching the target). Obviously this problem has existed before the advent of TV, but the Wikipedia article doesn't give it a name. I've also saw this game at a primary school I attended where the game was called "Crypto" as an inter-class competition - but searching for it now reveals nothing. I took part in it a few times and my dad wrote an Excel spreadsheet that attempted to brute-force the problem, I don't remember how it worked (only that it didn't work, what with Excel's 65535 row limit), but surely there must be an algorithmic solution for the problem. Maybe there's a solution that works the way human cognition does (e.g. in-parallel to find numbers 'close enough', then taking candidates and performing 'smaller' operations).

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >