numeric

Is there anyway to use a numeric type as an object key?

It seems that when I use a numeric type as a key name in an object, it always gets converted to a string. Is there anyway to actually get it to store as a numeric? The normal typecasting does not seem to work. Example: var userId = 1; console.log( typeof userId ); // number myObject[userId] = 'a value'; console.dir(myObject); Dir Out...

Validating input in multi-lingual application

I'm working on an application that will support both english and arabic languages. The application takes numeric input for use. In arabic language, the numeric characters are different! So, what's the best way to validate numeric input (amount, percentage, number) in such a situation? ...

Lucene Numeric range query doesn't return all of the hits I expect.

I have a set of documents that all have a "timestamp" field which is stored as a long integer number. The field is indexed in my Lucene index as a number using NumericField with a precision step of 8: NumericField("timestamp", 8). This is done so I can do numeric range queries to retrieve all documents that fall within a specific time ...

Query number of decimal places in a sql server resultset

I have a table which contains a field of type numeric(28,10). I would like to display the records with a monospaced font, and a matching number of decimal places so that they line up when right aligned. Is there any way to figure out the maximum number of decimal places that can be found in a given result set so that I can format accor...

Is there a simple method of converting an ordinal numeric string to its matching numeric value?

Does anyone know of a method to convert words like "first", "tenth" and "one hundredth" to their numeric equivalent? Samples: "first" -> 1, "second" -> 2, "tenth" -> 10, "hundredth" -> 100 Any algorithm will suffice but I'm writing this in C#. EDIT It ain't pretty and only works with one word at a time but it suits my purposes. Mayb...

blackberry browser - numeric keys

Is there a javascript/html way of forcing the Blackberry browser to convert alpha characters to numeric within a specific HTML form text input box? Normally users have to hold down the alt key and click a bi-functional key to get numeric values. In BB/Java, you can apply a numeric mask to an input field. I have not found an equivalent...

WPF Databinding TextBox to integer property in another object

I have what I think is a very simple databinding question (I'm still new to WPF). I have a class (simplified for this question) public class ConfigurationData { public int BaudRate { get; set; } } In MainWindow.Xaml.cs I have a private member variable: private ConfigurationData m_data; and a method void DoStuff() { // do...

Need a numeric only windows control TextBox

Hello! I am creating an old-school dialog in c# using a System.Windows.Controls.TextBox . Is there an easy way of limiting text input in this box to numeric only? Thanks! ...

How can I use SYNCSORT to format a Packed Decimal field with a specifc sign value?

I want to use SYNCSORT to force all Packed Decimal fields to a negative sign value. The critical requirement is the 2nd nibble must be Hex 'D'. I have a method that works but it seems much too complex. In keeping with the KISS principle, I'm hoping someone has a better method. Perhaps using a bit mask on the last 4 bits? Here is the ...

Line clipping to arbitary 2D polygon

Hi, guys, If I get a line segment which was long enough to cross a given polygon, which could be concave or convex polygon. How did I find the all the intersected light segments which was contained in the polygon? If the target region is not polygon, but a implicit curve function or spline curve, how to do it? Thanks! ...

how to create the frame data structure with columns from csv data in R?

Hi, Below are the first five rows of the imported data in R: data[1:5,] user event_date day_of_week 1 00002781A2ADA816CDB0D138146BD63323CCDAB2 2010-09-04 Saturday 2 00002D2354C7080C0868CB0E18C46157CA9F0FD4 2010-09-04 Saturday 3 00002D2354C7080C0868CB0E18C46157CA9F0FD4 2010-09-07 Tuesday 4 00002D2354C7080C0868CB0E18C46157...

Display a numeric keypad on activity without an input area

I use the following code to pop up the soft input keyboard in my Activity InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.getInputMethodList(); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); This displays the alphabetic keyboard. But I want to display the numeric keyboar...

Scala - implicit conversion of Int to Numeric[Int]

I've created a class that can be parameterised by anything that can be converted to Numeric class Complex[T <% Numeric[T]] (val real : T, val imag : T) { //... complex number methods ... } Then elsewhere in the code I try: var myComplex = new Complex(0, 1) This raises a compilation error because (surprisingly) there's no implici...

OWL: restrict property value to a numeric string

In my database I have things with string properties. Some of the property values match numeric strings (only contain digits). I'd like to give these things a special type (a subtype of what they are). Is such a thing possible in OWL? ...