w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Member 'Application' on embedded interop type 'Microsoft.Office.Interop.Excel.Workbook' cannot be evaluated
Please note that I ended up solving the problem by manually copying the data over into a new Excel file and importing that file--I'm still not sure what exactly was wrong with the original Excel file. Thank you to everyone for your suggestions.

Categories : C#

Use a COM+ object in Visual Studio C# without using Interop-DLL
Can't help myself giving a late answer to this question, as I just dealt with a similar thing. Basically, you could define your own subset of their interfaces to be used via late binding only, here's how: [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] // late binding only [Guid("00020400-0000-0000-C000-000000000046")] // IDispatch's GUID interface IMyLateBindingAdaptor { // a subset of IWebBrowser2 [http://msdn.microsoft.com/en-us/library/aa752127(v=vs.85).aspx] string LocationURL { get; } void Navigate(string url, ref object flags, ref object TargetFrameName, ref object PostData, ref object Headers); } Make sure the names and signatures of the defined properties and method match the specification from your vendor. Using it: var adaptor = this.webBrowser1.ActiveXI

Categories : C#

Returning on ISNULL decimal "0,00"
Change , with . in your query. ISNULL(s_prijmy, 0.00) I would also note that GetDecimal(34) gets the 35th column as it is zero-based... Use: GetDecimal(33) for the 34th column. Check here

Categories : C#

Set location of app.config file for interop com object
Using application settings in a class library is in general a poor practice, .NET only supports them for EXE projects. It is off the chart in the case of a [ComVisible] DLL, you have completely no control over which EXE uses your code. It's not like it doesn't work, putting a copy of foo.exe.config in the foo.exe client directory works just fine. Trouble starts when you are not the only one that looked for this solution. Now installers start to overwrite each other's .config files, your customer loses big time when add-ins fail undiagnosably. There's just one solution to this problem: don't use settings. Plenty of other ways to provide config to a class library. An .xml file in a well known location works just fine as well.

Categories : Vb.Net

How do I fix this preparedStatement error when returning a decimal value?
How about treating it as an appropriate number? String.valueOf(resultSet.getDouble(i)) If the value is returned as a String, then the trailing "0" never has a chance to be treated in a numeric context and "fall off". When treated as a number the trailing 0 is insignificant and "falls off": 204.40 == 204.4 // -> true String.valueOf(204.40) // -> "204.4" Of course, it might be more appropriate to use the number instead of turning it [back] into a String ..

Categories : Java

C# COM Interop: exposing function with a managed object as parameter
The questions you are asking are classical, fundamental questions about COM that could take a small book to answer. I would suggest you get a tutorial or a book on COM that will bring you up to speed. You won't understand the interop until you understand COM basics. Start there, then work through the harder stuff. It takes some serious time to get up to speed on all the issues involved, so don't get in a hurry! Here's a place to start: http://msdn.microsoft.com/en-us/library/727z646z(v=vs.80).aspx

Categories : C#

JavaScript code returning to many digits after decimal
You can use .toFixed(2) to format a number to 2 decimal places. Note that .toFixed() returns a string so if you want to work with the result as a number again, you'll need to parseFloat(). function GetDiff (dt) { sMins = " Min"; sHours = " Hrs"; sDays = " Days"; if ( Math.abs (DateDiff ("n", now, dt)) < 1440 ) { if ( Math.abs (DateDiff ("n", now, dt)) <= 60 ) { return (Math.abs (DateDiff ("n", now, dt)) + sMins).toFixed(2); } else { return (Math.abs (DateDiff ("n", now, dt)/60) + sHours).toFixed(2); } } else { return (Math.abs (DateDiff ("n", now, dt)/1440) + sDays).toFixed(2); } }

Categories : Javascript

Python - Chaining methods: returning `self` vs returning a new cloned object
Django does this so that the base query can be kept around and reused, without inheriting changes from a future "child" query, like your exclude() on your filter(). I'm guessing somebody tried storing queries for later, and realized that didn't work well without copying. I cloned the django repo and did a quick git log on django/db/models/query.py, searching for the phrase clone. The patch that introduces this change is here: https://github.com/django/django/commit/d4a3a4b

Categories : Python

Drop extraneous decimal places when using Python's decimal.Decimal
Use Decimal.normalize: >>> Decimal('0.00').normalize() Decimal('0') >>> Decimal('0.50').normalize() Decimal('0.5')

Categories : Python

Knockout.js Dynamic HTML Binding returning [object Object]
Your optionText is indeed an Option object. Try: htmlContent += item.optionText.optionText; UPDATE: The real problem lies here: function PagesViewModel(pageNo, pageHeader, questions) { this.pageNumber = ko.observable(pageNo); this.pageHeaderText = ko.observable(pageHeader); this.questionItems = ko.observableArray($.map(questions, function (n) { return [new QuestionViewModel(n.questionType, n.questionNumber, n.questionText, n.pointsBudget, n.options)] })); } When you're creating your PagesViewModel, the questions parameter is already an array of QuestionViewModel objects, and by assigning this.questionItems with your custom function, you're re-creating the QuestionViewModel, passing it n.options that is already an array of Option objects thus re-wrapping it

Categories : Javascript

How can I add decimal places to a TimeSpan object's totalseconds?
Try using return String.Format("{0}", timestamp.TotalSeconds); and then you can use the format string. See this MSDN article for formatting information. Edit 1: Thanks @MortenMertner for the correct format. Try using: return String.Format("{0:N6}", timestamp.TotalSeconds); to force 6 decimal places. Edit 2: You can lookup custom numeric format strings and standard numeric format strings to work out the best way to do this. One way is to use F instead of N (both of which are standard numeric format strings). N will comma delimit the thousands where F will not. return String.Format("{0:F6}", timestamp.TotalSeconds); Edit 3: As @sa_ddam213 points out in his answer, the standard ToString() method has an overload that accepts a formatting parameter. MSDN documents it here for a

Categories : C#

Function returning an object by value or nothing if object doesn't exists
You can use the "Option Pattern". The basic idea is: template <typename T> class Optional { private: bool valueIsPresent; T value; } Then, from the function you can return Optional<YourType>. Client code can then check if a value is effectively present before trying to access it and use it.

Categories : C++

C# Double type in DataRow to Decimal in Object for XSD serialisation
I still don't know the answer to question 1 but I have solved question 2. As per this link http://social.msdn.microsoft.com/Forums/en-US/csharplanguage/thread/d7582772-ab2c-4f05-9ba3-c96728dfbe82 I changed the definition of my class GAD. [XmlIgnore] public decimal Total { get { return this.totalField; } set { this.totalField = value; } } [XmlElement("Total")] public string TotalString { get { return Total.ToString("F2"); } set { decimal total = 0; if (Decimal.TryParse(value, out total)) Total = total;

Categories : C#

Creating new object in python is not returning a new object
You have created x as a class variable rather than an instance variable. To associate the variable with a particular instance of a class, do something like this: class myObject(object): def __init__(self): # The "constructor" self.x = [] # Assign x to this particular instance of myObject >>> debug: [] >>> debug: [] For a little better explanation of what's going on, have a look at this little mockup that demonstrates the same thing, a little more explicitly (if also more verbosely). class A(object): class_var = [] # make a list attached to the A *class* def __init__(self): self.instance_var = [] # make a list attached to any *instance* of A print 'class var:', A.class_var # prints [] # print 'instance var:', A.instance_var # This would ra

Categories : Python

GetConnection object not returning connection object
According to The doc for WrapperDataSource it doesn't implement DataSource. If you want to get a connection change your code this way: import org.jboss.resource.adapter.jdbc.WrapperDataSource; ... WrapperDataSource ds=(WrapperDataSource)jndiCntx.lookup("java:/MySqlDS"); return ds.getConnection();

Categories : Java

jQuery UI autocomplete returning [object Object]
Keep the line $('.search_box').val(searchTerm); But change the previous line to var searchTerm = ui.item.label; That will do it. Look in the log of this fiddle: http://jsfiddle.net/Ntb7G/

Categories : Jquery

Error: Option Strict On disallows implicit conversions from 'Object' to 'Decimal'
Range("J34") produces an object reference of type Object, not Range. You'll have to cast to keep Option Strict On happy: Dim sel As Range = CType(Globals.dsbPositionBoard.Range("J34"), Range) decAnnualMid = Convert.ToDecimal(sel.Value)

Categories : Vb.Net

Reading an Excel File (Excelfinlename.dvd) with decimal comma instaed of decimal point?
By using only Matlab: you could try to use the raw-output and replace comma with dot. You get the raw data as the third output of xlsread: [num,txt,raw] = xlsread(_) additionally returns the text fields in cell array txt, and the unprocessed data (numbers and text) in cell array raw using any of the input arguments in the previous syntaxes. If xlRange is specified, leading blank rows and columns in the worksheet that precede rows and columns with data are returned in raw. What would be better in my opinion, is to change comma to dot within Excel. At the moment, matlab (or xlsread) is interpreting the data as something else.

Categories : Matlab

Access adding column of type decimal(number with fieldsize decimal)
Your query looks fine. The decimal data type isn't supported in the default Jet 4.0 mdb file. You have to use the SQL Server compatibility syntax (ANSI 92) setting to use the decimal data type in the SQL Window. Click on the menu, Tools > Options. Click on the Tables/Query tab. Mark the check box for "This database" in the SQL Server compatibility syntax (ANSI 92) section. This mode will affect the entire db, including queries with wildcards, so you may want to try this on a copy of your db

Categories : SQL

Formatting a decimal value with ToString() to have commas as thousand separators where the amount of decimal places is unknown
Try using Format. double d = 1.234567; String output = d.ToString("#,##0.##"); Also, double d = 123456789.1; string format = d.ToString(). IndexOf(NumberFormatInfo.CurrentInfo.NumberDecimalSeparator) >=0 ? "#,##0.00" : "#,##0"; Console.WriteLine (d.ToString(format));

Categories : C#

How can a decimal format to string in mvc avoiding the last two zero s after the decimal point in mvc3
You can create Helper method e.g. DisplayDecimal public static class HtmlExtensionsView { public static string DisplayDecimal(this HtmlHelper helper, decimal? input) { // you can do you rouding math here } } then in your .cshtml file you can call (referencing extension's namespace) @Html.DisplayDecimal(modelItem => item.LoanAmount) More information about rounding in C# is available at http://msdn.microsoft.com/en-us/library/3s2d3xkk.aspx

Categories : Asp Net Mvc

SQL Server - Convert decimal to string with padding - implied decimal
Maybe the following sql code will be useful: SELECT CASE WHEN NUMBER < 100 THEN RIGHT('0000' + CAST(CAST(NUMBER AS INT) AS VARCHAR),4) ELSE RIGHT(SUBSTRING(CAST(NUMBER AS VARCHAR),1,CHARINDEX('.',CAST(NUMBER AS VARCHAR))-1),4) + LEFT(PARSENAME(NUMBER,1),1) END RESULT FROM TEST You can try this here sqlfiddle. Note: NUMBER is your field, and TEST is your TABLE.

Categories : SQL

Precisely multiplying 100,000 decimal digits using decimal module in python
I think that your problem is that you are either saving x in a string and re-interpreting in or you have x from a previous calculation as a Decimal and you are doing Decimal(A_Decimal). If x is already a decimal then do not reinterpret it and if to save time you are saving if then use pickle or cpickle to save it as an object. BTW try to avoid import * - use namespaces. BTW be sure and set the current precision before importing x from anywhere!

Categories : Python

Why is Javascript returning [object Object]?
console.log will give you a debugging view of an object. alert will give you a string view of an object. Objects are converted to strings by calling .toString() on them. The default toString() function on a basic object will return "[Object object]"

Categories : Javascript

Why in SQL Server Decimal type round up every decimal result?
Because by default, the number of digits that are stored after the decimal point is 0, and you haven't specified a value to override this. See the MSDN documentation here. To fix: declare @dcml decimal(18,5) This will store 5 digits after the decimal point. Basically you had an integer type there.

Categories : Sql Server

How can it be that variable with decimal assigned to it behaves not the same way as actual decimal does?
type name[10] is Fixed array declaration. type name[exp] is Variable-length array. Allocation is performed every time you encounter this declaration (in block) is from C99 variable-length arrays. Size is fixed after it is once formed. So, the behavior of the case, such as access to outside the bounds of the array in code like the example is undefined.

Categories : C

Converting Decimal BGR color to individual RGB decimal values
One of my first languages was C, and the following would be a fairly trivial macro. color = ((color & 0xff0000) >> 16) | (color & 0x00ff00) | ((color & 0x0000ff) << 16) Put this inside a bgr_to_rgb method and forget about it. There is no need to reach for #to_s or #hex. To get the individual R, G, B values from a BGR code, use red = color & 0x0000ff green = color & 0x00ff00 blue = color & 0xff0000

Categories : Ruby On Rails

Convert .net decimal type to tsql decimal(3,3)
Maximum value decimal(3,3) will allow is 0.999, so when you try to insert something larger than that exception will occur. try something like decimal(4,3)

Categories : C#

convert hex decimal numbers to decimal using python
If you have the hex bytes in readable form then use the decimal value as the key for the sort. hlist.sort(key=lambda x: int(x, 16)) If you have the raw hex bytes and they're all the same length then you don't need an explicit key, since bytestrings sort naturally. hlist.sort()

Categories : Python

Power of a negative decimal raised to a decimal
Yes, there's an issue with your logic. Please go and read about complex numbers. The problem is that a negative base raised to a non-integer negative power results in a complex number, not a real double. There's an imaginary part that Math.pow can't deal with.

Categories : Java

How to remove decimal separator if the decimal part is zero?
Many thanks to Jason for the link to CLOSED XML: Conditional Formatting! Thanks to this I managed to find the way to apply conditional formatting I needed: cell.AddConditionalFormat() .WhenEquals( string.Format( "=TRUNC(${0}${1})", cell.WorksheetColumn().ColumnLetter(), cell.WorksheetRow().RowNumber())) .NumberFormat .Format = "general"%""; I gave up using percent format specifier, as it makes me divide by 100. From Excel Custom Number Formats: % Percentage. Microsoft Excel multiplies by 100 and adds the % character. Now I simply add % as a string, not as a format specifier. So the main number format is 0.##"%", but when the value's decimal part is zero, I substitute the number format to the general one with % in th

Categories : C#

For loop from integer to decimal. How can it reach the decimal?
You need the Step keyword, or the loop will jump in steps of 1 only and will ignore non-integer values. for example: Dim start As Decimal = 1 Dim finish As Decimal = 60.1875 For i=start to finish Step 0.0005 If i = Int(i) Or i=start or i=finish Then '... do whatever End If Next Added the check for integers and outer bounds, but tbh this is cacked; there are better ways to do it!

Categories : Asp Net

Returning object in Yii Component
Suppose you have this in your config file: ... 'components' => array( 'parameters' => array( 'class' => 'path.to.parameters.php', 'applications' => array( 'productName' => array( 'tableName' => 'settings', 'property' => 'param1' ), ) ), ), ... If you want to have Yii::app()->parameters->productName->tableName return the value "settings". Your application component would then have to override the __get magic method to check if $this->applications contains the "productName" key using isset() and return that key's value as an object instead of an array. The application component would look like this: <?php namespace Sakanade; class parameters extends CApplicationComponent { public $cacheAll = false; p

Categories : PHP

Why isn't this query returning an object?
There's probably an error in your SQL query and $result is false instead of the result object. I think it's probably because you're missing some spaces in the query. This line: $query = "select * from books where".$searchtype."like '%".$seachterm."%'"; should be something like: $query = "SELECT * FROM books WHERE '" .$searchtype. "' LIKE '%".$seachterm."%'"; It would help if we knew the values of: $_POST['searchtype']; $_POST['searchterm'];

Categories : PHP

How is returning an object by reference possible?
It could be as simple as a cv::Mat having a shared pointer to a dynamically allocated block of memory. When you copy a Mat instance, you copy the shared pointer (incrementing the reference count), not the resource it points to.

Categories : C++

Microsoft/SSRS report textbox returns #error when string value that is decimal is converted to decimal and empty string is just printed
Iif is a function and so all arguments are evaluated before the function is called. So there is no use in using Iif to prevent error. I suppose you need a User defined function (Writing Custom functions in SSRS) So instead Iif(IsNumeric(Fields!Amount.Value),...) define a function Function DecimalIfPossible(Value as string) As Object If IsNumeric(Fields!Amount.Value) then Return CDec(Fields!Amount.Value) else Return Fields!Amount.Value End if End Function and call it DecimalIfPossible(Fields!Amount.Value).

Categories : Dotnet

C++ overloading operators and returning same object
Create operator- as a namespace scope function (not as a member function): Vector3 operator-(const Vector3 &lhs, const Vector3 &rhs) { Vector3 result{lhs}; // Subtract out rhs ... // Do the math return result; } Nothing gets leaked in any case, because you haven't allocated anything off of the heap (free store).

Categories : C++

DatePeriod returning empty object
$arrival = 2013-09-05 $departure = 2013-08-16 Arrival is not greater than Departure. If you set $arrival = 2013-08-05. Then output will be 2013-08-05 2013-08-06 2013-08-07 2013-08-08 2013-08-09 2013-08-10 2013-08-11 2013-08-12 2013-08-13 2013-08-14 2013-08-15

Categories : PHP

Correctly returning object through Many to Many relationship
try this: class ArticleUserOwnership (models.Model): article = models.ManyToManyField(Article) user = models.ManyToManyField(User) def __unicode__(self): return self.article OR def __unicode__(self): return self.article.question

Categories : Django

hql - returning single object instead of list?
No, it will still return a collection for you to iterate over - but you can use uniqueObject to get a single result instead. That will throw an exception if it turns out there's more than one result.

Categories : Java



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