format

Java format xml using Transformer with CDATA part

做~自己de王妃 提交于 2019-12-13 06:15:37
问题 I want to format string to xml this my code: Source xmlInput = new StreamSource(new StringReader(input)); StringWriter stringWriter = new StringWriter(); StreamResult xmlOutput = new StreamResult(stringWriter); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", String.valueOf(4)

Return true when chunk is used iTextSharp

我与影子孤独终老i 提交于 2019-12-13 06:14:36
问题 I'm trying to bold my font by using chunk. But the special thing is that my label is written under the addcell within a datareader. This is how i attempt to format my label within my datareader table.AddCell(phrase.Add(new Chunk("test:", normalFont)) + dr[0].ToString()); This is the declaration to phrase and font type: var normalFont = FontFactory.GetFont(FontFactory.HELVETICA, 12); var phrase = new Phrase(); And this is what is being displayed: However before i attempt to format my label

Exporting SQL data to Excel without losing the 0 in the phone number

 ̄綄美尐妖づ 提交于 2019-12-13 06:08:22
问题 I currently have a simple database which stores a customers basic table. However when ever I try to export my sql query to Excel the phone number field always appears without a 0. My SQL query results: ID | Name |Address |DOB | Gender |Phone_Number | --------------------------------------------------------- 01 | Max |Abc Road| 2000-12-19 | Male |07777 893 8902 | 02 | Sam |TBH Road| null | Male |077778938902 | 03 | Doe |Dr Road| 1999-11-13 | Male |077778 938902 | What I get in Excel: ID | Name

/Date(1341788400000+0100)/ to DD/MM/YYYY HH:MM

ぐ巨炮叔叔 提交于 2019-12-13 06:06:18
问题 I have several dates being outputted into variables. They are formatted as follows: /Date(1341788400000+0100)/ How would I go about formatting them using PHP into: DD/MM/YYYY HH:MM Thanks! 回答1: I ended up using the following, as the initial format was in milliseconds: $date = 1341788400000+0100; $date = ( $date / 1000 ); $date = date("d/m/Y H:m", $date); 回答2: $date = 1341788400000+0100; echo date("Y/m/d H:m",$date); Unless the +0100 is the actual time of the day (01:00) ? 回答3: First, you

Linux script that counts number of printf parameters for each occurrence

眉间皱痕 提交于 2019-12-13 06:01:40
问题 I want to write a script in sh that for each given file, for each printf occurrence, it will count the number of %'s (or alternatively the number of parameters the printf function receives) and rename the printf to printfX, when X is that number. I got stuck because printf doesn't end with new line... e.g. printf("hello " "world %d\n", 1); should return printf1("hello " "world %d\n", 1); 回答1: There is no simple (= as in script) solution for this because to parse C code, you need an LL(1)

Write a loop of formatStyle in R shiny

假装没事ソ 提交于 2019-12-13 05:26:05
问题 Guys. I met a problem that: I am developing a R shiny app and I want to highlight some values in the datatable. I have a dataframe(entities) and a vector(vec1), and I want to highlight a specific value in each column when the value in each column is equal to the value in a vec1. Now I achieved it by repeating the formatStyle code 25 times, but I believe it can be done by writing a loop. Could anyone help me? vec1 = c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25) datatable

How to calculate the time consumed from start time to end time in php

送分小仙女□ 提交于 2019-12-13 05:24:06
问题 I want to get the perfect time consumed or the total time from start time to end time: My code: $start_time = $this->input->post('start_time'); $end_time = $this->input->post('end_time'); $t1 = strtotime($start_time); $t2 = strtotime($end_time); $differenceInSeconds = $t2 - $t1; $differenceInHours = $differenceInSeconds / 3600; if($differenceInHours<0) { $differenceInHours += 24; } In the code above if $start_time = 11:00:00 PM and $end_date =11:30:00 it gives me the output of 0.5 instead of

String.format() get maximum value

蓝咒 提交于 2019-12-13 05:16:51
问题 I implemented a counter method that returns always an incremented number. But the user can give wished format, 2 digits, 3 digits or whatever he wants. The format is the standard String.format() type of String like %02d or %5d . When the maximum value is reached, the counter should be reset to 0. How can I find out the max value that can be represented with the given format? int counter = 0; private String getCounter(String format){ if(counter >= getMaximum(format)){ counter = 0; } else {

How to design a Format with Multiple Column Report

荒凉一梦 提交于 2019-12-13 05:10:21
问题 I am designing a report With the Format With Multiple Columns option in the crystal report to display 10 records per column.But, my result set is Showing like, 1.Row1 2.Row2 3.Row3 4.Row4 5.Row5 6.Row6 7.Row7 8.Row8 9.Row9 10.Row10 11.Row11 12.Row12 13.Row13 14.Row14 15.Row15 16.Row16 17.Row17 18.Row18 19.Row19 20.Row20 instead of 1.Row1 11.Row11 2.Row2 12.Row12 3.Row3 13.Row13 4.Row4 14.Row14 5.Row5 15.Row15 6.Row6 16.Row16 7.Row7 17.Row17 8.Row8 18.Row18 9.Row9 19.Row19 10.Row10 20.Row20

How do I specify a relative cell address in a conditional format in Excel?

ε祈祈猫儿з 提交于 2019-12-13 04:46:11
问题 I am conditionally formatting a row to a turn yellow if a date exists in a cell on that row. When I copy the format to other rows below, it keys on that specific cell, turning all rows yellow. What I want is to turn row 1 yellow if cell G1 is not null. Turn row 2 yellow if G2 is not null, etc. I can manually edit the conditional format for each row, but as this condition will apply to over 1000 rows, there has to be a better way. I would appreciate any help anyone can provide. 回答1: I was