formatting

jquery mobile input masking not working

怎甘沉沦 提交于 2019-12-12 20:21:23
问题 I am trying to mask SSN input using jquery mask plugin, however it doesn't seem to play well with jquery mobile. The code is here. Appreciate any help. If this doesnt work, what are the alternatives? Also copied the code for reference below: Scripts: jquery.mobile-1.0.1.min.css jquery-1.6.4.min.js jquery.mobile-1.0.1.min.js $("#ssnprimary").mask("999-99-9999"); HTML: <div data-role="page" id="mainpage"> <div data-role="header"> <h1> My Test </h1> </div><!-- /header --> <div data-role="content

Formatting time in Python?

醉酒当歌 提交于 2019-12-12 19:34:11
问题 How would I go about formatting time in Python? Lets say I have time = 9.122491 The time is in hours and I need to convert it to h:m format. So the desired output should be: 9:07 Any help would be greatly appreciated! 回答1: Using the datetime module: >>> from datetime import datetime, timedelta >>> mytime = 9.122491 >>> temp = timedelta(hours=mytime) >>> print((datetime(1, 1, 1) + temp).strftime('%H:%M')) 09:07 回答2: If you don't want to use a module, you can do it fairly simply like this: >>>

Formatting tooltip value with StandardXYToolTipGenerator

烂漫一生 提交于 2019-12-12 19:29:12
问题 In desktop Java project I used StandardXYToolTipGenerator for generating tooltips on chart. Renderer was configured as below: renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator("{0} - {2} ({1})",new SimpleDateFormat("HH:mm:ss"), NumberFormat.getNumberInstance())); Where {2} is value (example 1.149431) but when I am using NumberFormat it format itself and return value 1.149, I want get precisely rounding. How to get it? Any idea? I tried extend NumberFormat class, but method

Scientific Notation formatting in Python

安稳与你 提交于 2019-12-12 19:18:04
问题 How can get following formatting (input values are always less than 0.1): > formatting(0.09112346) 0.91123E-01 > formatting(0.00112346) 0.11234E-02 and so on. I am looking for some elegant solution. I am already using a custom function given below: def formatting(x, prec=5): tup = x.as_tuple() digits = list(tup.digits[:prec]) dec = ''.join(str(i) for i in digits) exp = x.adjusted() return '0.{dec}E{exp}'.format(dec=dec, exp=exp) 回答1: You can use the format() function. The format specification

Excel doesn't apply mso-number-format from HTML

拜拜、爱过 提交于 2019-12-12 18:58:03
问题 Here is my situation: I have simple Excel OOXML file with Web Query connection to my server. All cells with dates have "General" horizontal alignment (no alignment) and MM/DD/YYYY format. It looks like this: On refresh server responses with pretty straightforward HTML: <html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"> <head> <style id="Leads_style"> table { mso-displayed-decimal-separator:"\."; mso

Currency symbol in numeric value based on object property in XAML

时光怂恿深爱的人放手 提交于 2019-12-12 18:44:55
问题 How to show a numeric (currency) value in WPF so that the currency symbol would not come from the user's regional settings, locale or anything but from the property of the binded object. For example in DataGrid I would have Item objects: <DataGrid Grid.Row="1" ItemsSource="{Binding Items}"> <DataGrid.Columns> <DataGridTextColumn Binding="{Binding SomeNumber, StringFormat=c}" /> </DataGrid.Columns> </DataGrid> public Item() { public double SomeNumber { get; set; } public string CurrencySymbol

Decimal Casting

牧云@^-^@ 提交于 2019-12-12 18:44:18
问题 I have a decimal number like this: 62.000,0000000 I need to cast that decimal into int; it will always have zero decimal numbers; so I wont loose any precision. What I want is this: 62.000 Stored on an int variable in c#. I try many ways but it always give me an error, that the string isn't in the correct format, this is one of the ways i tryied: int.Parse("62.000,0000000"); Hope you can help me, thanks. 回答1: You need to parse it in the right culture. For example, the German culture uses "."

Excel Conditional Formatting over multiple rows

喜欢而已 提交于 2019-12-12 18:37:45
问题 I am trying to highlight cells that fall outside the expected value range (higher or lower only). Each row corresponds to a different row that has two cells with a max and min. Is there a way to make Excel figure that out? For example Row 7's cells should only highlight if they value is outside the min of B31 or max B32. And Row 18 should be governed by Row 42. I have used conditional formatting. But I want to apply the same logic to all the cells and rows instead of doing them one by one.

Java MethodOverloading error with double values

孤街醉人 提交于 2019-12-12 18:14:14
问题 Here is a part of my code I'm having trouble with: ===Class Overload=== public class Overload { public void testOverLoadeds() { System.out.printf("Square of integer 7 is %d\n",square(7)); System.out.printf("Square of double 7.5 is %d\n",square(7.5)); }//..end testOverloadeds public int square(int intValue) { System.out. printf("\nCalled square with int argument: %d\n",intValue); return intValue * intValue; }//..end square int public double square(double doubleValue) { System.out.printf("

Remove whitespace before a field using AWK

自作多情 提交于 2019-12-12 17:35:15
问题 ( Almost exact duplicate of Keeping original format POST passing through AWK submitted by same person. ) I have a simple question pertaining to g awk, illustrated below: 1 int blah (void) 2 { 3 if (foo) { 4 printf ("blah\n"); 5 } 6 return 0; 7 } Using the following gawk code - using gensub() to maintain original formatting: gawk '{ print gensub($1, "\t", 1) }' ./sample_code.out int blah (void) { if (foo) { printf ("blah\n"); } return 0; } How can I use g awk or awk (maybe with regular