Search Results

Search found 6094 results on 244 pages for 'double gras'.

Page 14/244 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • Double pointer as Objective-C block parameter

    - by George WS
    Is it possible (and if so, safe) to create/use a block which takes a double pointer as an argument? For instance: - (void)methodWithBlock:(void (^)(NSError **error))block; Additional context, research, and questions: I'm using ARC. When I declare the method above and attempt to call it, XCode autocompletes my method invocation as follows: [self methodWithBlock:^(NSError *__autoreleasing *error) {}]; What does __autoreleasing mean here and why is it being added? I presume it has something to do with ARC. If this is possible and safe, can the pointer still be dereferenced in the block as it would be anywhere else? In general, what are the important differences between doing what I'm describing, and simply passing a double pointer as a method parameter (e.g. - (void)methodWithDoublePointer:(NSError **)error;)? What special considerations, if any, should be taken into account (again assuming this is possible at all)?

    Read the article

  • .net converting bytearray to double[]

    - by AJ
    Hello, I am working with a database from a legacy app which stores 24 floating point values (doubles) as a byte array of length 192, so 8 bytes per value. This byte array is stored in a column of type image in a SQL Server 2005 database. In my .net app I need to read this byte array and convert it to a array of type Double[24]. I can access the field easy enough reader.GetBytes(...) but how to convert the returned ByteArray to Double[24] Any ideas? Thanks, AJ

    Read the article

  • Databinding to type double - decimal mark lost

    - by user1277327
    I have a project where I'm databinding a gridview to a list, where one column is databound to a gridview. The problem I have is that with the double being 5.5 on one computer it appears as 5.5 in the gridview. But on another it looks like 55, the decimal mark dissapears. So 3.14 will look like 314 etc. The error occurs with the following code: myDatagrid.ItemsSource = someList; Binding binding = new Binding("DoubleValue"); myColumnInDatagrid.Binding = binding; I've also tried using a very simple valueconverter, that just return the double, and parsed it in ConvertBack. I'm pretty new to WPF so I'm sorry if I've made some obvious mistakes, I just don't understand why it works on one computer but not on the other. Perhaps it should be noted that both of the computers use the same operating system, with the same language settings (afaik at least).

    Read the article

  • Compilation hangs for a class with field double d = 2.2250738585072012e-308

    - by 01es
    I have come across an interesting situation. A coworker committed some changes, which would not compile on my machine neither from the IDE (Eclipse) nor from a command line (Maven). The problem manifested in the compilation process taking 100% CPU and only killing the process would help to stop it. After some analysis the cause of the problem was located and resolved. It turned out be a line "double d = 2.2250738585072012e-308" (without semicolon at the end) in one of the interfaces. The following snipped duplicates it. public class WeirdCompilationIssue { double d = 2.2250738585072012e-308 } Why would compiler hang? A language edge case?

    Read the article

  • best way to output a full precision double into a text file

    - by flevine100
    Hi, I need to use an existing text file to store some very precise values. When read back in, the numbers essentially need to be exactly equivalent to the ones that were originally written. Now, a normal person would use a binary file... for a number of reasons, that's not possible in this case. So... do any of you have a good way of encoding a double as a string of characters (aside from increasing the precision). My first thought was to cast the double to a char[] and write out the chars. I don't think that's going to work because some of the characters are not visible, produce sounds, and even terminate strings ('\0'... I'm talkin to you!) Thoughts?

    Read the article

  • Perl Regular expression remove double tabs, line breaks, white spaces

    - by Scoox
    Hi guys, I want to write a perl script that removes double tabs, line breaks and white spaces. What I have so far is: $txt=~s/\r//gs; $txt=~s/ +/ /gs; $txt=~s/\t+/\t/gs; $txt=~s/[\t\n]*\n/\n/gs; $txt=~s/\n+/\n/gs; But, 1. It's not beautiful. Should be possible to do that with far less regexps. 2. It just doesn't work and I really do not know why. It leaves some double tabs, white spaces and empty lines (i.e. lines with only a tab or whitespace) I could solve it with a while, but that is very slow and ugly. Any suggestions?

    Read the article

  • In .net, how do I choose between a Decimal and a Double

    - by Ian Ringrose
    We were discussing this the other day at work and I wish there was a Stackoverflow question I would point people at so here goes.) What is the difference between a Double and a Decimal? When (in what cases) should you always use a Double? When (in what cases) should you always use a Decimal? What’s the diver factors to consider in cases that don’t fall into one of the two camps above? (There a lot of questions that overlap this question, but they tend to be asking what someone should do in a given case, not how to decide in the general case)

    Read the article

  • Why does C++ mandate that complex only be instantiated for float, double, or long double?

    - by templatetypedef
    According to the C++ ISO spec, §26.2/2: The effect of instantiating the template complex for any type other than float, double or long double is unspecified. Why would the standard authors explicitly add this restriction? This makes it unspecified, for example, what happens if you make complex<int> or a complex<MyCustomFixedPointType> and seems like an artificial restriction. Is there a reason for this limitation? Is there a workaround if you want to instantiate complex with your own custom type? I'm primarily asking this question because of this earlier question, in which the OP was confused as to why abs was giving bizarre outputs for complex<int>. That said, this still doesn't quite make sense given that we also might want to make complex numbers out of fixed-points types, higher-precision real numbers, etc. Thanks!

    Read the article

  • Distinguish between a single click and a double click in Java

    - by user552279
    Hi, I search the forum and see this codes: public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { System.out.println(" and it's a double click!"); wasDoubleClick = true; } else { Integer timerinterval = (Integer) Toolkit.getDefaultToolkit().getDesktopProperty( "awt.multiClickInterval"); timer = new Timer(timerinterval.intValue(), new ActionListener() { public void actionPerformed(ActionEvent evt) { if (wasDoubleClick) { wasDoubleClick = false; // reset flag } else { System.out.println(" and it's a simple click!"); } } }); timer.setRepeats(false); timer.start(); } } but the code runs incorrectly(Sometime it prints out " and it's a single click!" 2 times . It should print out " and it's a double click!"). Can anybody show me why? or can you give me some better ways to do this? Thank you!

    Read the article

  • Count double palindromes in given int sequence

    - by jakubmal
    For a given int sequence check number of double palindromes, where by double palindrome we mean sequence of two same palindromes without break between them. So for example: in 1 0 1 1 0 1 we have 1 0 1 as a palindrome which appears 2 times without a break, in 1 0 1 5 1 0 1 we have 1 0 1 but it's separated (apart from the other palindromes in these sequences) Problem example test data is: 3 12 0 1 1 0 0 1 1 0 0 1 1 0 12 1 0 1 0 1 0 1 0 1 0 1 0 6 3 3 3 3 3 3 with answers 8 0 9 Manacher is obvious for the begging, but I'm not sure what to do next. Any ideas appreciated. Complexity should be below n^2 I guess. EDIT: int is here treated as single element of alphabet

    Read the article

  • double returning only one precision in java

    - by srinath
    in my code i am performing division on numbers and storing it in a double variable. but the variable is returning with only one precision. i want to increase the precision how could i do that. double x; for ( int i =0 ; i<10000 ; i++) { x= w[i] / l[i]; System.out.println(x); } in the above code w and l are integer arrays; i am getting output like 3.0 0.0 1.0 0.0 i want to increase the precision upto 4 atleast.

    Read the article

  • Java Double Array

    - by user1062058
    I'm having trouble setting up and placing values into an array using a text file containing the floating point numbers 2.1 and 4.3 each number is separated by a space - below is the error I'm getting: Exception in thread "main" java.util.NoSuchElementException import java.util.*; import java.io.*; public class DoubleArray { public static void main(String[] args) throws FileNotFoundException { Scanner in = new Scanner(new FileReader("mytestnumbers.txt")); double [] nums = new double[2]; for (int counter=0; counter < 2; counter++) { int index = 0; index++; nums[index] = in.nextDouble(); } } } Thanks, I'm sure this isn't a hard question to answer... I appreciate your time.

    Read the article

  • Type casting int into double C++

    - by user1705380
    I am new to programming and this might be an obvious question, though i cannot for life of me figure out why my program is not returning as a double. I am suppose to write a stocks program that takes in shares of stock, whole dollar portion of price and the fraction portion. And the fraction portion is to be inputted as two int values, and include a function definition with 3 int values.The function returns the price as a double. #include <iostream> using namespace std; int price(int, int, int); int main() { int dollars, numerator, denominator, price1, shares; char ans; do { cout<<"Enter the stock price and the number of shares.\n"; cout<<"Enter the price and integers: Dollars, numerator, denominator\n"; cin>>dollars>>numerator>>denominator; cout<<"Enter the number of shares held\n"; cin>>shares; cout<<shares; price1 = price(dollars,numerator,denominator); cout<<" shares of stock with market price of "; cout<< dollars << " " << numerator<<'/'<<denominator<<endl; cout<<"have a value of " << shares * price1<<endl; cout<<"Enter either Y/y to continue"; cin>>ans; }while (ans == 'Y' || ans == 'y'); system("pause"); return 0; } int price(int dollars, int numerator, int denominator) { return dollars + numerator/static_cast<double>(denominator); }

    Read the article

  • Preserving NULL values in a Double Variable

    - by Sam
    Hi, I'm working on a vb.net application which imports from an Excel spreadsheet. If rdr.HasRows Then Do While rdr.Read() If rdr.GetValue(0).Equals(System.DBNull.Value) Then Return Nothing Else Return rdr.GetValue(0) End If Loop Else I was using string value to store the double values and when preparing the database statement I'd use this code: If (LastDayAverage = Nothing) Then command.Parameters.AddWithValue("@WF_LAST_DAY_TAG", System.DBNull.Value) Else command.Parameters.AddWithValue("@WF_LAST_DAY_TAG", Convert.ToDecimal(LastDayAverage)) End If I now have some data with quite a few decimal places and the data was put into the string variable in scientific notation, so this seems to be the wrong approach. It didn't seem right using the string variable to begin with. If I use a double or decimal type variable, the blank excel values come across as 0.0. How can I preserve the blank values? Thanks

    Read the article

  • Double "!!" in Ruby [closed]

    - by Alex Maslakov
    Possible Duplicate: What does !! mean in ruby? Ruby, !! operator (a/k/a the double-bang) Sometimes I see a Ruby code like this def sent? !!@sent_at end It seems to be not logical. Is it necessary to use here double !? As far as I'm concerned, it might be just def sent? @sent_at end UPDATE: then what is the difference between these def sent? !!@sent_at end def sent? @sent_at.nil? end def sent? @sent_at == nil end

    Read the article

  • C++: Checking for non-numeric input and assigning to a double

    - by Brundle
    Here is the code I have at the moment: char ch; int sum = 0; double values[10]; int i = 0; cin >> ch; while (!isalpha(ch)) { values[i] = ch; sum += values[i]; i++; cin >> ch; } What is happening is that if I enter the value 1, that gets assigned to ch as a char. Now ch is assigning it's value to a double and doing an implicit cast. So it is assigning the ASCII value of '1' to values[i]. I want it to just assign 1 to values[i]. Is there a better way to do this? Or is there something that I'm missing?

    Read the article

  • Making Visual C++ DLL from C++ class

    - by prosseek
    I have the following C++ code to make dll (Visual Studio 2010). class Shape { public: Shape() { nshapes++; } virtual ~Shape() { nshapes--; }; double x, y; void move(double dx, double dy); virtual double area(void) = 0; virtual double perimeter(void) = 0; static int nshapes; }; class __declspec(dllexport) Circle : public Shape { private: double radius; public: Circle(double r) : radius(r) { }; virtual double area(void); virtual double perimeter(void); }; class __declspec(dllexport) Square : public Shape { private: double width; public: Square(double w) : width(w) { }; virtual double area(void); virtual double perimeter(void); }; I have the __declspec, class __declspec(dllexport) Circle I could build a dll with the following command CL.exe /c example.cxx link.exe /OUT:"example.dll" /DLL example.obj When I tried to use the library, Square* square; square->area() I got the error messages. What's wrong or missing? example_unittest.obj : error LNK2001: unresolved external symbol "public: virtual double __thiscall ... Square::area(void)" (?area@Square@@UAENXZ) ADDED Following wengseng's answer, I modified the header file, and for DLL C++ code, I added #define XYZLIBRARY_EXPORT However, I still got errors. example_unittest.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __th iscall Circle::Circle(double)" (__imp_??0Circle@@QAE@N@Z) referenced in function "protected: virtual void __thiscall TestOne::SetUp(void)" (?SetUp@TestOne@@MAEXXZ) example_unittest.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __th iscall Square::Square(double)" (__imp_??0Square@@QAE@N@Z) referenced in function "protected: virtual void __thiscall TestOne::SetUp(void)" (?SetUp@TestOne@@MAEXXZ) example_unittest.obj : error LNK2001: unresolved external symbol "public: virtual double __thiscall Square::area(void)" (?area@Square@@UAENXZ) example_unittest.obj : error LNK2001: unresolved external symbol "public: virtual double __thiscall Square::perimeter(void)" (?perimeter@Square@@UAENXZ) example_unittest.obj : error LNK2001: unresolved external symbol "public: virtual double __thiscall Circle::area(void)" (?area@Circle@@UAENXZ) example_unittest.obj : error LNK2001: unresolved external symbol "public: virtual double __thiscall Circle::perimeter(void)" (?perimeter@Circle@@UAENXZ)

    Read the article

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