format

r: dprint: size of image of table alteration

二次信任 提交于 2019-12-10 17:55:56
问题 I am using the dprint package with knitr , mainly so that I can highlight rows from a table, which I have got working, but the output image leaves a fairly large space for a footnote, and it is taking up unnecessary space. Is there away to get rid of it? Also since I am fairly new to dprint, if anybody has better ideas/suggestions as to how to highlight tables and make them look pretty without any footnotes... or ways to tidy up my code that would be great! An example of the Rmd file code is

Python Floating Point Formatting

Deadly 提交于 2019-12-10 17:55:31
问题 I've seen a few questions about this already, but none that I read helped me actually understand why what I am trying to do is failing. So I have a bunch of floating point values, and they have different precisions. Some are 0.1 others are 1.759374, etc. And I want to format them so they are ALL in the form of "+0.0000000E+00" I tried doing number = '%1.7f' % oldnumber but that didn't work. I thought what I was telling it to do was "one digit perfor the decimal point, and 7 after, float" but

How to change display format of legend in MATLAB

瘦欲@ 提交于 2019-12-10 17:54:33
问题 I am looking for a way to force the legend entries in a particular format. I following code, they are displayed like Instead I want it like 1e-1,1e-2,1e-3,1e-4, 1e-5. Is there a way to do this. MWE: sig=[0.1 0.01 0.001 0.0001 0.00001]; for j=1:length(sig) for x=1:10 Cost(j,x) = 2*x+j; end plot(1:10,Cost(j,:)); end legend(strcat('\sigma^2_n=',num2str((sig)'))); set(h,'Interpreter','latex') 回答1: You should specify that you'd like to use scientific notation when you convert sig to a string by

Android currency symbol ordering

匆匆过客 提交于 2019-12-10 17:39:38
问题 I'm getting on devices with not-english locale, the english currencies formated like this: 1 $ If I have english locale I get euro currency like: € 1 Using format.setCurrency(Currency.getInstance(currency)); return format.format(amount); Found in the documentation: http://developer.android.com/reference/java/util/Currency.html#getSymbol() Returns the localized currency symbol for this currency in locale. That is, given "USD" and Locale.US, you'd get "$", but given "USD" and a non-US locale,

VS code Format Code command and shortcut Shift+Alt+F doesn't work

一笑奈何 提交于 2019-12-10 17:39:16
问题 Any clues on why my VS Code "Format Code" command doesn't work? I used Shift+Ctrl+P and entered Format Code or used the shortcut Shift + Alt + F . None seem to be working. Any clue? 回答1: i'm having the same issue - it's looks like a bug. See: https://github.com/Microsoft/vscode/issues/12359 https://github.com/Microsoft/vscode/issues/12705 https://github.com/Microsoft/TypeScript/issues/11101 回答2: Make sure you changed your language to the type of file. ( Ctrl + K , M or Ctrl + Shift + P ->

Date of birth regex yyyy-mm-dd for rails app

本秂侑毒 提交于 2019-12-10 17:28:36
问题 I am creating a user signup form, and I am adding date of birth to the required fields. I have scoured google, github and stackoverflow for a good date of birth (date) regex, and found this: user.rb DateRegex = /^\d{4}-\d{2}-\d{2}/ validates_format_of :date_of_birth, :with => DateRegex new.html.erb <%=label_tag :date_of_birth %> <%=f.text_field :date_of_birth %> (I know that this will allow some bogus birth dates, but I prefer not to install anything like validate timeliness at this point.)

Converting string timestamp to date [duplicate]

喜夏-厌秋 提交于 2019-12-10 16:46:54
问题 This question already has answers here : How to parse a date? [duplicate] (5 answers) Closed 4 years ago . How do i convert a string time-stamp like "Thu Jun 07 13:01:59 IST 2007" to date format in java ? 回答1: String ds = "Thu Jun 07 13:01:59 IST 2007"; SimpleDateFormat f = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy"); Date d = f.parse(ds); As others mentioned, the answer is in the docs. 回答2: You can use DateFormat: DateFormat dateFormat = new SimpleDateFormat("E M d HH:mm:ss z yyyy")

Adtf dat files - streams and structure types

天涯浪子 提交于 2019-12-10 15:56:13
问题 ADTF dat file contains streams of data. In the .dat file there is only a stream name. To find the structure of the stream one has to go through DDL .description file. Sometimes the .description files are incomplete or are missing link from stream name to corresponding structure. Is there some additional information about structure name hidden in the .dat file itself? (Or my understanding is completely wrong?) 回答1: You must differ between ADTF 2.x and ADTF 3.x and their (adtf)dat file

Theme manipulation in ggplot2: altering x and y grid lines

时间秒杀一切 提交于 2019-12-10 15:54:24
问题 Is it possible to manipulate the spacing and size of dashed and dotted grid lines in ggplot using the themes? The following plot: p + l + opts(panel.grid.major = theme_line(colour = 'black', linetype = 'dashed'), panel.grid.minor = theme_line(colour = NA), panel.background = theme_rect(colour = 'white')) I'd like to change the spacing (such as in Illustrator) between dashed and dotted grid lines. Additionally, does anyone know if the x-axis and y-axis grid lines can be manipulated separately?

Formatting Javascript string to have 03 not 3?

怎甘沉沦 提交于 2019-12-10 15:48:51
问题 I have a Javascript that opens today file in html. function openToday() { var today = new Date(); var strYear = today.getFullYear(); var strMonth = today.getMonth(); var strDay = today.getDate(); var strURL = "file:/time/"+strYear+"/"+strMonth+"/" + strYear+"_"+strMonth+"_"+strDay+ "/" + strYear+"_"+strMonth+"_"+strDay+".html"; alert(strURL); window.open(strURL,"myWindow"); } The problem is that I want to have the 2011_03_10 , but the code gives me 2011_3_10 . How can I format the Javascript