w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
error: cannot convert 'double (evaluator::*)(double, double)' to 'double (*)(double, double)' in assignment
This: double (*ope)(double, double); should be: double (evaluator::*ope)(double, double); // ^^^^^^^^^^^^ because you are using a pointer to member.

Categories : C++

Manually convert string to double java without using parse double
This is how oracle does it :) http://docs.oracle.com/javase/6/docs/api/java/lang/Double.html#valueOf(java.lang.String) final String Digits = "(\p{Digit}+)"; final String HexDigits = "(\p{XDigit}+)"; // an exponent is 'e' or 'E' followed by an optionally // signed decimal integer. final String Exp = "[eE][+-]?"+Digits; final String fpRegex = ("[\x00-\x20]*"+ // Optional leading "whitespace" "[+-]?(" + // Optional sign character "NaN|" + // "NaN" string "Infinity|" + // "Infinity" string // A decimal floating-point string representing a finite positive // number without a leading sign has at most five basic pieces: // Digits . Digits ExponentPart FloatTypeSuffix // // Since this method allows integer-only

Categories : Java

Null pointer exception when trying to parse array (java)
Looks like results[index] needs to be initialized. You allocated memory for results[0..n] with new, but not results[index][0...n]. If you're always storing four values, add something like: results[index] = new Double[4];

Categories : Java

Does double.IsInfinity(value) cover double.IsPositiveInfinity(value) and double.IsNegativeInfinity(value))?
Yes, the extra checks are redundant. As noted on MSDN for Double.IsInfinity: Returns a value indicating whether the specified number evaluates to negative or positive infinity

Categories : C#

"Warning: assignment from incompatible pointer type" when using a double pointer
files has type char (*)[128], not char**; there is no second level of pointer (and we're not talking about const yet; it's another can of worms). This code should not show a warning (except the one for constness) const char files[][128]={"file1","file2","file3"}; char (*ptr)[128]; ptr=files;

Categories : C

Want to pass a single char pointer from a double pointer
For simplicity's sake, you can assume a double pointer to be equivalent to a 2d array (it is not!). However, this means that you can use array-convention to access contents of a double pointer. #include <stdio.h> #include <string.h> char *query[5] = {"the","new","store","in","SF"}; char *stopwords[2] = {"the","in"}; char main_array[256]; void remove_stopwords(char **query,int query_length, char **stopwords, int stopwords_length); int main() { remove_stopwords(query,5,stopwords,2); puts(main_array); return 0; } void remove_stopwords(char **query,int query_length, char **stopwords, int stopwords_length) { int i,j,found; for(i=0;i<query_length;i++) { found=0; for(j=0;j<stopwords_length;j++) { if(strcmp(query[i]

Categories : C

Why would you use float over double, or double over long double?
The basic principle here would be don't use more than you need. The first consideration is memory use, you probably realized that already, if you are making only one double no big deal, but what if you create a billion than you just used twice as much memory space as you had too. Next is processor utilization, I believe on many processors if you use smaller data types it can do a form of threading where it does multiple operations at once. So an extension to this part of the answer is SSE instructions basically this allows you to used packed data to do multiple floating point operations at once, which in an idealized case can double the speed of your program. Lastly is readability, when someone is reading your code if you use a float they will immediately realize that you are

Categories : C++

dereferencing pointer that was cast to double pointer
Free = *((T**)Free); I think this could be more clearly written as: Free = (T *) *Free; Both statements rely on undefined behavior, treating a T as a T * pointer. Conceptually, what's they're doing is assigning *Free to Free. For example, if T were int, then the statement reinterprets an int as a pointer to int assigns it overtop of the original pointer. As to what kind of sense this makes, that depends on the larger context. The code is sketchy; it could be genius or it could be foolishness.

Categories : C++

Double pointer of Mat initialization
The pointer which you have declared is not a double(**) pointer to Mat array. Instead you can do this, Mat (*Objs_avgwB)[25] = new Mat[vseg.avgw][25]; which declares a pointer Objs_avgwB to a Mat whose first row has 25 elements in it. You can use this if you're creating a 2-D array with 25 elements per row, because the return type of new in this case is Mat(*)[25]. Also, don't forget to call the delete[] at the end.

Categories : C++

How to marshal a double pointer?
Check out this description for what an IntPtr is. Have you tried using: [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public class xyz { IntPtr np; IntPtr foo; }

Categories : C#

The method println(double) in the type PrintStream is not applicable for the arguments (String, double)
you are looking for System.out.println("The cost of your movie tickets before is " + aprice); + concatenates Strings. , separates method parameters.

Categories : Java

SQLite update to change double-double quotes ("") to regular quotation marks (")?
SQLite uses single quotes to escape string literals. It escapes single quotes by adding another single quote (likewise for double quotes). So technically as long as your SQL is well constructed, the import process should work properly. The strings should be enclosed in single quotes, and not double quotes. I suspect that your code may be constructing the SQL by hand instead of binding/properly escaping the values. SQLite has a built in function to quote string's. It's called quote. Here are some sample inputs, and the corresponding output: sqlite> SELECT quote("foo"); 'foo' sqlite> SELECT quote("foo ""bar"""); 'foo "bar"' sqlite> SELECT quote("foo 'bar'"); 'foo ''bar''' So you could remove the twice escaped double quote before it even goes to SQLite using NSString methods. [@

Categories : Iphone

How to catch opening double quotes and closing double qoutes with a regular expression?
You can perform an automatic replacement (in the TextChanged Event of the TextBoxes, as shown below; or just before dealing with the given String). For example: Private Sub TextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBox1.TextChanged TextBox1.Text = TextBox1.Text.Replace(ChrW(8220), "") TextBox1.Text = TextBox1.Text.Replace(ChrW(8221), "") TextBox1.Text = TextBox1.Text.Replace("""", "") If (TextBox1.TextLength > 0) Then TextBox1.Select(TextBox1.TextLength, 1) End If End Sub This code does not allow users to write ",“ or ”. The reason for a so complicated code is that dealing with "curvy" double quotes (as the ones in your sample code) is not straightforward: VB.NET considers them as normal double quotes in mos

Categories : Asp Net

ANTLRv4: How to read double quote escaped double quotes in string?
Like this: STRING : '"' (~[ "] | '""')* '"' ; where ~[ "] | '""' means: ~[ "] # any char other than ' ', ' ' and double quotes | # OR '""' # two successive double quotes And is it possible to rewrite it to turn double double quotes in single double quotes? Not without embedding custom code. In Java that could look like: STRING : '"' (~[ "] | '""')* '"' { String s = getText(); s = s.substring(1, s.length() - 1); // strip the leading and trailing quotes s = s.replace("""", """); // replace all double quotes with single quotes setText(s); } ;

Categories : Ant

Model binder can't handle double.MAX string representation back to double
I'm using @Html.HiddenFor to create the hidden input. After carefully reading Scott's post I saw that he mentions the round-trip specifier. I also found an example here on StackOverflow. The R stands for "round-trip". From MSDN: This format is supported only for the Single and Double types. The round-trip specifier guarantees that a numeric value converted to a string will be parsed back into the same numeric value. So I did this: @Html.HiddenFor(m => m.Maximum, new { Value = Model.Maximum.ToString("R") }) Now this gives me a double.MAX string representation that can be round-tripped back to a double on the controller side: 1.7976931348623157E+308 Nice... problem solved. Hope it helps anyone that might face this same problem in the future. How int

Categories : Asp Net Mvc

create a field in solr that will index both a double value and the floor of that double value
You can try these options :- If you are feeding the data, handle it on the client side to index it as a multivalued field with both the values, the double as well as the rounded one If you are using DIH you can easily use the ScriptTransformer to convert it into multivalued fields Example - Data Config - Add custom field - <script><![CDATA[ function addfield(row){ var fieldName = row.get('double_value'); // Round it row.put(fieldName, double_rounded); return row; } ]]></script> Else, just write a Custom filter which would store both the Original token and the Rounded value in the index. With the fields being Mark Float, the Range Queries also should work fine.

Categories : Solr

c++ fastest way to write vector to file
Serializing of the coordinates can be parallelized by dividing the input across several threads and then joining the return values from them. Then writing the returned value to the file. This way we can speed up the process.

Categories : C++

What is the best way to recognize and convert these "minimum" double values into C# Double.MinValue?
You seem to want to check if a double is really small and positive or really big, finite, and negative. (Others have detailed some problems with your approach in the comments; I'm not going to go into that here.) A test like this: if (d == d && (d > 0 && d < 1e-290 || d < -1e270 && d + d != d)) might do roughly what you want. You'll probably need to tweak the numbers above. The d == d test is checking for NaN, while the d + d != d test is checking for infinities.

Categories : C#

Pointer cannot be cast to type 'double'
You have to use NSString convertation method doubleValue. Have a look here: How to do string conversions in Objective-C?

Categories : Objective C

editText parse double
findViewById needs the current hiearchy of views to be created in order to work, so you can call EditText length = (EditText) findViewById(R.id.editText1); String lengthString = length.getText().toString(); only after setContentView

Categories : Android

replace double quotes within double quoted strings
Get the following substring: "brown fox" child* !"big planes" .. and replace quotation marks with: &quot; SET DECLARE OFF; SELECT SUBSTR(str, 1, INSTR(str, '""', 1, 1)) || REPLACE(SUBSTR(str, INSTR(str, '""', 1, 1) + 1, INSTR(str, '""', -1, 1) - INSTR(str, '""', 1, 1)), '"', '&quot;') || SUBSTR(str, INSTR(str, '""', -1, 1) + 1) AS col FROM ( SELECT '<?xml version=...><Fetch searchstr=""brown fox" child* !"big planes"" begin="yesterday" ...><otherele>...</otherele><some>...</some></Fetch>' AS str FROM DUAL ); The result: <?xml version=...><Fetch searchstr="&quot;brown fox&quot; child* !&quot;big planes&quot;" begin="yesterday" ...><otherele>...</otherele><some>...</some&g

Categories : SQL

Convert string/char to double and following calculation with the double
First of all, since you are using c_str, your strings cannot be of type char*; most likely they are std::string. In addition, you don't need to create a copy of your string: std::string str = msg->data is superfluous (even though it doesn't hurt). As for the bad output you get - Shashwat Kumar points out that your code doesn't print the number correctly, even though the number itself is correct. If ROS_INFO has the same syntax as printf, use %lf or %f format specifier to print a number of type double: ROS_INFO("I am making calculation: [%f]", fmsg + 1); (also, no need to spell 1 as 1.0; you may prefer 1.0 if you think it's better)

Categories : C++

Return double or complex from template function
In C++11, you can use the alternative function declaration syntax: #include <utility> // for declval template<class T, class U, class V> auto operator*(const T a, const matrix<U> A) -> decltype( std::declval<T>() * std::declval<U>() ) { //... }

Categories : C++

Double pointer in c, assignment warning for my code
You get warnings because p is an int ** and you are allocating memory as if it was an int * in your if..else lines. Simply replace your lines as follows: p=(int **)malloc(1*sizeof(int *)); p=(int **)realloc(p,(i+1)*sizeof(int *));

Categories : C

How to parse Int or Double in scala depending on value?
The following code returns an Int if possible, otherwise a Double if (doubleValue.isValidInt) doubleValue.toInt else doubleValue You must beware that the common type between the two is AnyVal, and sometimes you should declare it explicitly to avoid the compiler to reconvert automatically the Int result to a Double. P.S. if the outcome must be a String, you can pack the above code in a method and call toString on the result.

Categories : Scala

string - double in java without using parse
int exp1=num.length(); This line is part of your problem. Your loop will always loops num.length() times, but num isn't changing in length (so always 3, in your case). This is causing all three numbers to be treated as thousandths. Also, remember that decimal values can't be represented exactly in the IEEE-754 format. By doing all these multiplications and additions, you're introducing error into your result. Double.Parse is going to give you the best approximation possible for your number.

Categories : Java

c# double.parse() to always use a . period not comma
Use Double.Parse Method (String, IFormatProvider) with CultureInfo.InvariantCulture for parsing. double d = double.Parse("2.2", CultureInfo.InvariantCulture);

Categories : C#

Convert.ToDouble and Double.Parse in C#
double is a value type which cannot be null. double.Parse will try to parse a string into a double. It does not try to coerce mismatched values such as null. Convert.ToDouble will try to take mismatched strings and find a suitable value. For null that would be 0.0. To check if a sting is directly parsable try using double.TryParse with the appropriate overload. For example: double red; Console.Write("Red = "); var input = Console.ReadLine(); if(!double.TryParse(input, out red)) { Console.WriteLine("You have not entered an appropriate value!"); } This will try to parse a double using the current Culture and default NumberStyles.

Categories : C#

Calling a C method with double pointer parameter from Android with NDK/JNI
This is just a guess. BIOAPI_INVALID: ...if any badge number in the list is invalid, ... Might 0 be invalid? If I were designing the Java API, I would leave out concepts such as "null terminated array" that service only weak C data structures. So, int [] badgeNumberList would just be a list of badge numbers. Try: int[] badgeNumberList = { 100 }; You really need the docs for the Java API.

Categories : Java

Double pointer indirection when passing an array to a function
If I'm following the example correctly, they use a void ** because it is really a (void *)[]; an array of untyped memory. The compare function is given two pointers to untyped memory (void *), and is asked to compare the data. What you don't understand is that in the first example, your array should be an array of pointers, not an array of values. Your array should look like: int *val0 = malloc(sizeof(int)); *val0 = 51; int *val1 = malloc(sizeof(int)); *val1 = 3; // ... for all values int *values[] = { val0, val1, val2, ... }; Then the compare function cmp needs to return a comparison value based on the values, not the pointers that it is given. Code: int cmp(const void* t1, const void* t2) { if((const int)(*t1) > (const int)(*t2)) { return 1; } else if((const i

Categories : C

How to convert an ArrayList to a double[] array?
Ok just found a solution: double[][] returnvalue = new double[resultat.size()][resultat.size()]; for(int i =0;i<resultat.size();i++) { returnvalue[i] = resultat.get(i); }

Categories : Java

how to set double latitude and double longitude into array
You could make an internal class called LatLong or use simplelatlng public class LatLong { double lat; double long; public LatLong(double lat, double long) { this.lat = lat; this.long = long; } public double getLat(){ return this.lat; } public double getLong(){ return this.long; } } Then you could add this to MainActivity final List<LatLong> latLongList = new ArrayList<LatLong>(); public void onClick(View arg0) { //... double latitude = gps.getLatitude(); double longitude = gps.getLongitude(); latLongList.add(new LatLong(latitude, longitude)); //... }

Categories : Java

Sum an array of Func objects
Do you mean something like this? Func<double, double>[] l = new Func<double, double>[2] {(x) => x, (x) => x + 1}; Func<double, double> m = x => l.Sum(f => f(x)); For example, m(5) → l[0](5) + l[1](5) → (5) + (5 + 1) → 11.

Categories : C#

Is it possible to create a pow(double a, double b) function in C without assembly?
You can calculate anything without assembly (the same way you might calculate it by hand), but it will be much slower; that's why no one does these things without using special hardware support.

Categories : C

Replace 2 double quotes with 1 double quote with VBA
Try this, maybe, using FileSystemObject to create the text file/html file: Public Const strResult As String = "<META http-equiv=""Content-Type"" content=""text/html"">" '"document.writeln('<div class=""pagebreak"">');" Sub Test() Dim sFile As String Dim fso As Object 'Scripting.FileSystemObject sFile = "C:users" & Environ("username") & "desktopTNTLabel.html" Set fso = CreateObject("Scripting.FileSystemObject") fso.CreateTextFile(Filename:=sFile, Overwrite:=True).Write strResult Set fso = Nothing End Sub This creates the following text file, note that there are no double-quotes and I did not use any Replace or other string functions to remove them from the strResult: Alternatively, when I used freefile method to write the file, it preserves it as string literal,

Categories : Xml

Why JSON.parse removes double quotes?
If you want JSON to be printed, convert it back to JSON: document.writeln(JSON.stringify(obj[1])); By using JSON.parse, you convert the JSON into a real JavaScript array. There's no JSON in obj, and therefore no quotes. If you want to manipulate the array, you can do this as you would any other array: var str = '[[[0,123,"John Doe"]],[[0,189,"Jane Doe, Mike Smith"]]]'; var obj = JSON.parse(str); obj[0][0][2] = "John Smith"; And then if you want your quotes back, you'll have to convert it back to JSON with JSON.stringify.

Categories : Javascript

Allocate Object member variable to another double strong pointer
Accessing a property through dot notation is syntax sugar for a method call, so what you are really doing is &[dataObject item1] which is not allowed by the grammar. The argument of the & is an expression that must be an lvalue or a function designator [1], and a method call is neither. If want the address of the value returned by the getter, you have to turn it into a lvalue first. The most straightforward way is to assign it to a local variable: NSString * item1 = dataObject.item1; // now item1 is a lvalue NSString * __strong * tmp_pointer = &item1; // so it can be the argument of & [1] A function designator as an expression that has function type. An object is a region of storage that can be examined and stored into and an lvalue is an expression th

Categories : Objective C

How can I copy a array of strings into an unmanaged char double pointer?
A System.Char is a unicode 16 bits character [MSDN]. You probably work with ASCII string. The pointer arithmetic seems wrong here, since you are working with a pointer who points to an array of three pointers you probably need to get the address of the string using : Marshal.ReadIntPtr(ptr, i * IntPtr.Size) thus the resulting code will be : public static void StringArrayToPtr(IntPtr ptr, string[] array) { for (int i = 0; i < array.Length; i++) { byte[] chars = System.Text.Encoding.ASCII.GetBytes(array[i] + ''); Marshal.Copy(chars, 0, Marshal.ReadIntPtr(ptr, i * IntPtr.Size), chars.Length); } }

Categories : C#

Null Pointer Exception: setinput function for Xmlpullparser assigning null value with StringReader
The stack trace shows WffdhomeActivity.update_screen(WordItem) line: 110 WffdhomeActivity$1.onClick(View) line: 51 So something on line 110 is null: xpp.setInput( new StringReader ( mwordItem.getFeed()) ); Since xpp seems to be set, look at mwordItem. It comes from the call at line 51, where myWordItem is passed. In the code posted, myWordItem is never set. So, from the code you have posted: myWordItem is null.

Categories : Android

null pointer exception in string array with assigning null during initialization
Trying to populate a nullarray is unacceptable: String d[]=null; Change it to String[] d = new String[20];, but here is another problem, you don't know how many tokens you will get, so using a dynamic list (e.g. ArrayList) will be finer.

Categories : Java



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.