Search Results

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

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

  • Converting digits, generated by weblog service, to Arabic form

    - by Sorush Rabiee
    sorry if this is irrelevance :-) I need to write something in my html code to convert digits of form 0123456789 to ?????????? (Persian digits uni06F0..uni06F9). the number of visitors is generated by blog service. and I want to convert its digits to Arabic. Counter: ????? ????????????? : <BlogSky:Weblog Counter /> ??? the Persian part of above code mean 'Number of visitors' and 'Persons' (from left to right). but digits are represented in latin (0123...). Is it possible to write something like a function in html? i want it to be a global one for using in weblogs. Note: I don't know anything about web programming languages. I'm not sure about language of above code. (html?)

    Read the article

  • a simple program that counts and sums digits. How can I make it work?

    - by user1710386
    So I've to write a simple program(that loops) where you can enter an int and it spews out the number count and the sum of the numbers. Since I am such a tard when it comes to programming, I just scavanged the code online and tried to piece it together. I guess the sum block screws with n, but I am not really sure. Anyway, I would really appreciate it if somebody could point out mistakes and show me how can I make it work. #include <iostream> using namespace std; int main() { while(1) { int i,p,n,sum=0; //sum block cout<<"enter an int: "; cin>>n; { while(n!=0) { p=n % 10; sum+=p; n=n/10; } cout<<"int digit sum: "<<sum <<endl; } { int count = 0; while(n) { n /= 10; ++count; } cout <<"number of digits: " << count << '\n';} } }

    Read the article

  • Significant figures in the decimal module

    - by Jason Baker
    So I've decided to try to solve my physics homework by writing some python scripts to solve problems for me. One problem that I'm running into is that significant figures don't always seem to come out properly. For example this handles significant figures properly: from decimal import Decimal >>> Decimal('1.0') + Decimal('2.0') Decimal("3.0") But this doesn't: >>> Decimal('1.00') / Decimal('3.00') Decimal("0.3333333333333333333333333333") So two questions: Am I right that this isn't the expected amount of significant digits, or do I need to brush up on significant digit math? Is there any way to do this without having to set the decimal precision manually? Granted, I'm sure I can use numpy to do this, but I just want to know if there's a way to do this with the decimal module out of curiosity.

    Read the article

  • Are there significant performance difference between chipsets?

    - by Let_Me_Be
    I wanted to build a single PC to fit all my needs, but since hardware virtualization support (Vt-d specifically) is a huge problem, I decided to build multiple single-use oriented computers. In this scenario I want these computers to be as minimal as possible. So the core of my question is: "Are there significant performance difference between chipsets?" I'm considering Sandy-Bridge i7 or i5 for my "game console" computer. And since I will use only one graphic card, one or two HDD, 4-8GB RAM and nothing else, I would be fine with a micro-ATX board with a Q67 (or some other low-end chipset).

    Read the article

  • Significant OS X Finder lag when listing directories/files

    - by Jack Sleight
    I'm experiencing some significant OS X finder lag, that seems to be purely an issue with Finder itself, and not the HD or any other part of OS X (I'll explain below). The lag only appears to be when listing directories/files, where I'm seeing up to twelve or so seconds of lag (the folder opens with a blank list and the spinner going in the bottom right). This happens with both the local SSD and network drives (connected via ethernet or wifi) Browsing both local and network drives in terminal and listing directories is instant I can actually browse files on my NAS from my phone over a 3G connection from the other side of the country faster than Finder can when connected to the local network (madness!) Can anyone help? Thanks.

    Read the article

  • (This is for a project, so yes it is homework) How would I finish this java code?

    - by user2924318
    The task is to create arrays using user input (which I was able to do), then for the second part, use a separate method to sort the array in ascending order then output it. I have gotten it to do everything I need except I don't know how I would get it to sort. The directions say to use a while loop from 0 to the length to find the minimum value then swap that with the 1st, but I don't know how to do this. This is what I have so far: public static void main(String[] args) { Scanner in = new Scanner(System.in); int storage = getNumDigits(in); if(storage == 0){ System.out.print("No digits to store? OK, goodbye!"); System.exit(0); } int []a = new int [storage]; a = getDigits(a, in); displayDigits(a); selectionSort(a); } private static int getNumDigits(Scanner inScanner) { System.out.print("Please enter the number of digits to be stored: "); int stored = inScanner.nextInt(); while(stored < 0){ System.out.println("ERROR! You must enter a non-negative number of digits!"); System.out.println(); System.out.print("Please enter the number of digits to be stored: "); stored = inScanner.nextInt(); } return stored; } private static int[] getDigits(int[] digits, Scanner inScanner) { int length = digits.length; int count = 0; int toBeStored = 0; while(count < length){ System.out.print("Enter integer " +count +": "); toBeStored = inScanner.nextInt(); digits[count] = toBeStored; count++; } return digits; } private static void displayDigits(int[] digits) { int len = digits.length; System.out.println(); System.out.println("Array before sorting:"); System.out.println("Number of digits in array: " +len); System.out.print("Digits in array: "); for(int cnt = 0; cnt < len-1; cnt++){ System.out.print(digits[cnt] + ", "); } System.out.println(digits[len-1]); } private static void selectionSort(int[] digits) { int l = digits.length; System.out.println(); System.out.println("Array after sorting:"); System.out.println("Number of digits in array: " +l); System.out.print("Digits in array: "); int index = 0; int value = digits[0]; int indVal = digits[index]; while(index < l){ indVal = digits[index]; if(indVal <= value){ indVal = value; digits[index] = value; index++; } else if(value < indVal){ index++; } System.out.print(value); //This is where I don't know what to do. } }

    Read the article

  • Significant events in Computer Science

    - by Brabster
    What were the most significant events or milestones in the history of computer science? I haven't been able to find a potted history, so I thought I'd see what views the SO community had on the question. I'm studying for a Masters in CS at the moment, so I'm hoping for some stuff to go take a look at that I've not come across before. Related: Computer science advances in past 5 years Significant new inventions in computing since 1980

    Read the article

  • Find most significant bit (left-most) that is set in a bit array

    - by Claudiu
    I have a bit array implementation where the 0th index is the MSB of the first byte in an array, the 8th index is the MSB of the second byte, etc... What's a fast way to find the first bit that is set in this bit array? All the related solutions I have looked up find the first least significant bit, but I need the first most significant one. So, given 0x00A1, I want 9.

    Read the article

  • Fastest way to find sum of digits on big numbers

    - by dada
    I have some big numbers (again) and i need to find if the sum of the digits is an even number. I tried this: finding the sum of the digits with a while loop and then checking if that sum % 2 equals 0 and it's working but it's too slow for big numbers, because i am given intervals of numbers and if the input is 1999999 19999999999 then my program fails, i cannot complete within the time limit which is 0,1 sec. What to do ? Is there any other faster way to do this ? EDIT: The input 1999999 19999999999 means it will start with 1999999 and check all the numbers like i wrote above until 19999999999, and because we are talking about big numbers (< 2^30) my program is not worthy.

    Read the article

  • Java MVC - How to divide a done text game into MVC?

    - by Zopyrus
    Been sitting here for hours now trying to figure this out, so a bit sympathy for this large question. :) The Goal: I simply want to divide my done code into MVC (Model View Controller) parts. I have the game logics done and text based - the code works fine. The Problem: Well, I want to implement this code into MVC, but where do explain for the MODEL that it should use text-based? Because the VIEW is only for the layout (graphically) correct? I am having a REALLY hard time figuring out where to begin at all. Any pointers would be so nice! Here is my game logics code: import mind.*; import javax.swing.*; import java.util.*; import java.lang.*; import java.awt.*; public class Drive { String[] mellan; boolean gameEnd, checkempty, checkempty2, enemy, enemy2; String gr,rd,tom; int digits; public Drive() { // Gamepieces in textform gr="G"; rd="R"; tom=" "; mellan = new String[7]; String[] begin = {gr,gr,gr,tom,rd,rd,rd}; String[] end = {rd,rd,rd,tom,gr,gr,gr}; //input Scanner in = new Scanner(System.in); mellan=begin; gameEnd=false; while (gameEnd == false) { for(int i=0; i<mellan.length; i++) { System.out.print(mellan[i]); } System.out.print(" Choose 0-6: "); digits = in.nextInt(); move(); checkWin(); } } void move() { //BOOLEAN for gameruls!!! checkempty = digits<6 && mellan[digits+1]==tom; checkempty2 = digits>0 && mellan[digits-1]==tom; enemy = (mellan[digits]==gr && mellan[digits+1]==rd && mellan[digits+2]==tom); enemy2 = (mellan[digits]==rd && mellan[digits-1]==gr && mellan[digits-2]==tom); if(checkempty) { mellan[digits+1]=mellan[digits]; mellan[digits]=tom; } else if (checkempty2) { mellan[digits-1]=mellan[digits]; mellan[digits]=tom; } else if (enemy) { mellan[digits+2]=mellan[digits]; mellan[digits]=tom; } else if (enemy2) { mellan[digits-2]=mellan[digits]; mellan[digits]=tom; } } void checkWin() { String[] end = {rd,rd,rd,tom,gr,gr,gr}; for (int i=0; i<mellan.length; i++){ } if (Arrays.equals(mellan,end)) { for (int j=0; j<mellan.length; j++) { System.out.print(mellan[j]); } displayWin(); } } void displayWin() { gameEnd = true; System.out.println("\nNicely Done!"); return; } // Kör Drive! public static void main(String args[]) { new Drive(); } } Here is how I defined my DriveView thus far: (just trying to make one button to work) import mind.*; import javax.swing.*; import java.util.*; import java.lang.*; import java.awt.*; import java.awt.event.*; public class DriveView extends JFrame { JButton ruta1 = new JButton("Green"); JButton ruta2 = new JButton("Green"); JButton rutatom = new JButton(""); JButton ruta6 = new JButton("Red"); private DriveModel m_model; public DriveView(DriveModel model) { m_model = model; //Layout for View JPanel myPanel = new JPanel(); myPanel.setLayout(new FlowLayout()); myPanel.add(ruta1); myPanel.add(ruta2); myPanel.add(rutatom); myPanel.add(ruta6); this.setContentPane(myPanel); this.pack(); this.setTitle("Drive"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } void addMouseListener(ActionListener mol) { ruta2.addActionListener(mol); } } And DriveController which gives me error at compile import mind.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.lang.*; public class DriveController { private DriveModel m_model; private DriveView m_view; public DriveController(DriveModel model, DriveView view) { m_model = model; m_view = view; view.addMouseListener(new MouseListener()); } class MouseListener implements ActionListener { public void actionPerformed(ActionEvent e) { String mening; mening = e.getActionCommand(); if (mening.equals("Green")) { setForeground(Color.red); } } } }

    Read the article

  • Find out number of fraction digits in currency in iOS

    - by thejaz
    I use NSNumberFormatter to format currencies in a localized way, and it works fine. But I want to override this and give the user the option to override the number of digits after the decimal separator. How can I find out the number of digits the NSNumberFormatter will use for a certain currency? I have looked in the NSLocale object, but none of the keys tell me this. NSString * const NSLocaleIdentifier; NSString * const NSLocaleLanguageCode; NSString * const NSLocaleCountryCode; NSString * const NSLocaleScriptCode; NSString * const NSLocaleVariantCode; NSString * const NSLocaleExemplarCharacterSet; NSString * const NSLocaleCalendar; NSString * const NSLocaleCollationIdentifier; NSString * const NSLocaleUsesMetricSystem; NSString * const NSLocaleMeasurementSystem; NSString * const NSLocaleDecimalSeparator; NSString * const NSLocaleGroupingSeparator; NSString * const NSLocaleCurrencySymbol; NSString * const NSLocaleCurrencyCode; NSString * const NSLocaleCollatorIdentifier; NSString * const NSLocaleQuotationBeginDelimiterKey; NSString * const NSLocaleQuotationEndDelimiterKey; NSString * const NSLocaleAlternateQuotationBeginDelimiterKey; NSString * const NSLocaleAlternateQuotationEndDelimiterKey; How can I find out the correct number of decimals for a currency like the NSNumberFormatter seems to know?

    Read the article

  • Does a servlet-based stack have significant overheads?

    - by John
    I don't know if it's simply because page-loads take a little time, or the way servlets have an abstraction framework above the 'bare metal' of HTTP, or just because of the "Enterprise" in Jave-EE, but in my head I have the notion that a servlet-based app is inherently adding overhead compared to a Java app which simply deals with sockets directly. Forget web-pages, imagine instead a Java server app where you send it a question over an HTTP request and it looks up an answer from memory and returns the answer in the response. You can easily write a Java socket-based app which does this, you can also do a servlet approach and get away from the "bare metal" of sockets. Is there any measurable performance impact to be expected implementing the same approach using Servlets rather than a custom socket-based HTTP listening app? And yes, I am hazy on the exact data sent in HTTP requests and I know it's a vague question. It's really about whether servlet implementations have lots of layers of indirection or anything else that would add up to a significant overhead per call, where by significant I mean maybe an additional 0.1s or more.

    Read the article

  • Show a number with specified number of significant digits

    - by dreeves
    I use the following function to convert a number to a string for display purposes (don't use scientific notation, don't use a trailing dot, round as specified): (* Show Number. Convert to string w/ no trailing dot. Round to the nearest r. *) Unprotect[Round]; Round[x_,0] := x; Protect[Round]; shn[x_, r_:0] := StringReplace[ ToString@NumberForm[Round[N@x,r], ExponentFunction->(Null&)], re@"\\.$"->""] (Note that re is an alias for RegularExpression.) That's been serving me well for years. But sometimes I don't want to specify the number of digits to round to, rather I want to specify a number of significant figures. For example, 123.456 should display as 123.5 but 0.00123456 should display as 0.001235. To get really fancy, I might want to specify significant digits both before and after the decimal point. For example, I might want .789 to display as 0.8 but 789.0 to display as 789 rather than 800. Do you have a handy utility function for this sort of thing, or suggestions for generalizing my function above? Related: Suppressing a trailing "." in numerical output from Mathematica

    Read the article

  • Matching digits in Notepad++ extended search mode

    - by ketchup
    Notepad++'s manual is rather vague on the special character for numerical used in extended search mode. It says: \d### - Decimal value (between 000 and 255) but literally entering "\d###" doesn't match anything. What I am trying to do is to replace if VarA == 12 VarB = 1 with if VarA == 12 Var12=1 VarB=1

    Read the article

  • batch file to strip numbers from filename and pad to two digits

    - by ss2k
    I have a text file with a list of server names (servers.txt) that looks something like this: server1 server2 server3 I have a feeling this can be done with the FOR command as I use that to perform an action on each name in the file, but I'm not quite sure how to use the delimiters to accomplish this. for /F "tokens=*" %%G in (servers.txt) do ( SET machinenum = <magic here> ECHO %machinenum% ) expected output 01 02 03

    Read the article

  • Splitting integers in arrays to individual digits

    - by Neville
    hello all. I have an array: int test[]={10212,10202,11000,11000,11010}; I want to split the inetger values to individual digits and place them in a new array as individual elements such that my array now is: int test2[]={1,0,2,1,2,1,0,2,0,2,1,1,0,0,0,1,1,0,0,0,1,1,0,1,0}; How would i go about doing that? I'm doing this in java. Thank you.

    Read the article

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