FAQ Database Discussion Community

## How to make string paragraph easier to read for source code

powershell,formatting

## Modifying formatters in Haskell's formatting library

I'm using Chris Done's formatting library (specifically formatting-6.0.0). I'm finding it difficult to construct a `higher order' function which maps a formatter to a list formatter, performing a custom action on the resultant list of Builders: list :: ([Builder] -> Builder) -> Format r (a -> r) -> Format r...

formatting,latex

## C code doesn't show in the output zero number

c++,formatting
When I'm compiling the following source code, in the output the zero doesn't correctly show. Why? I want the output text to have the following format: 01 02 03 04 05 06 07 08 not 1 2 3 4.... How can I fix this issue? #include "stdio.h" int main(int argc,...

## SSRS Average Time in Minutes and then Format to HH MM

sql,stored-procedures,reporting-services,formatting
I've seen a lot of questions about average time in SSRS but I'm pretty new to this and none of these questions address my specific need so any help would be appreciated. I have a duration field (Fields!Duration1.Value) which is pulling in a duration in minutes (example: 170). In my...

## DateTimeFormatter auto-corrects invalid (syntactically possible) calendar date

java,parsing,date,formatting,java-time
Java DateTimeFormatter throws an exception for when you try a date that goes outside of a possible range, for example: DateTimeFormatter dtf = DateTimeFormatter.ofPattern("M/d/yyyy"); String dateString = "12/32/2015"; LocalDate ld = LocalDate.parse(dateString, dtf); will throw: Exception in thread "main" java.time.format.DateTimeParseException: Text '12/32/2015' could not be parsed: Invalid value for DayOfMonth...

## MySQL formatting query - Setting column Results as a Table header

mysql,table,formatting
I am trying to create a report in MySQL to output number of Traded Shares, by Client and by Market. I have got the results I want (using multiple tables), but need to change the output table so that the results from one column become the header of another, and...

## Trying to copy Formatting in all cells from one Excell sheet into another specifically keeping fill and text color using VBA

excel,excel-vba,formatting,copy-paste
I have a working VBA script that copies exactly what I need except formatting. I at least need it to copy Fill and Text color. Here is my current code. Private Sub Workbook_Open() Application.DisplayAlerts = False Cells.Select Range("A1").Activate Selection.ClearContents Selection.UnMerge Selection.ClearContents Range("A1").Select Workbooks.Open Filename:= _ "Photo\Studio\\DAILY_REPORT_BACKUPS\DIGI_Review_Terry.xlsm" Range("A1:XFD70").Select Range("A1:XFD70").Activate Selection.Copy ActiveWindow.Close...

Is there a existing Haskell function which provide an engineering notation formatting (as String)? If not, I read that printf can be extended by adding an instance to PrintfArg. Do you believe this is a good solution ? By engineering notation, I mean an exponent notation whose exponent is a...

## How do I convert a double into an n-character string using exponential notation?

java,string,formatting,double
I have found this vise-versa many times on SO, but never like I want it. I want to convert a double into a string that takes up exactly n characters. If n is, for example, 6, then 1,000,123.456 would become 1.00E6 -1,000,123.456 would become 1.0E-6 1.2345678 would become 1.2345 1,000,000,000,000...

## MySql datatype versus PHP formatting whilst not losing numeric sorting capabilities

php,mysql,types,formatting
See http://pdga-europe.com/standings-2015/ It's probably the simplest question you've seen in a while, but I'm stumped. I am importing an XLS sheet to MySql database, and most data is integers, but some (really, only some) are fractions (at an exact .5) Data type gets set to DECIMAL (4,1) by PHPMyAdmin, and...

## Need help in writing this multiplication code

c,formatting,output,multiplication,spaces
I need to show process of multiplication in output.for ex:- inputs are two numbers(say 325 and 4405) the output would be:- 325 *4405 ----- 1625 0 1300 1300 ------- 1431625 NOTE:-number of spaces should be minimum. I don't need the exact code. Just tell me which property or way I...

## How to configure Eclipse Formatter to add this. in front of class members

java,eclipse,formatting
How can I configure the Eclipse Formatter to add this. in front of every class member use? I can't find this in the Formatter configuration and Google does not give me reasonable answer. I need this: public class Foo { private int bar; public void methodUsingBar(){ bar = 1; }...

## Add blank row to MySQL query results based upon change in column value

mysql,sql,formatting
If I have a typical MySQL query such as: SELECT CommentNo, CreatedDate, CreatedTime, Text FROM Comment The results will be displayed in a simple table. But is it possible to have MySQL format the output so that a blank line can be inserted into the results based upon a change...

## How to .write() two items, a zero and an iterator in Python?

python,csv,formatting,conditional-statements,writing
I may have a simple formatting question here - I would like to do something like hrOut.write('0',i) in order to add/preface a zero to 'i' which is a timestamp, but I don't know the correct syntax. My code is below. Thank you all. hrIn = open('HrsInput.csv') hrOut = open('HrsOutput.csv', 'wt')...

## Bifurcate a string, removing the middle of the string instead of end

c#,.net,string,formatting
I want something similar to this question I found lead me to this answer on another question where I tried to convert it from php to c# my attempt to convert it... failed very badly: private string trimString(string str, int maxCharacters = 16) { int textLength = str.Length; return str.Substring(maxCharacters/2,...

## How can I style this php with divs?

php,html,css,formatting
So I'm trying to style this php with divs but it's not behaving how I'd like. I would like each thumbnail to have the catalog number appear under it. What's the best way to do this? I'm not super clear on how php and css interact yet. $records =$result->getRecords();...

## Represent a buffer efficiently as unicode string

c++,windows,string,unicode,formatting
I have a random buffer. I need to encode it to a unicode string (utf16 LE. as used by windows wide-char specification) so it can be used as PWSTR. For example when calling to StringCchPrintfW A possible solution can be to use base64. But in order to make it a...

## Python 2.7 Etree/lxml minimizing [duplicate]

python,xsd,formatting,lxml
This question already has an answer here: Close a tag with no text in lxml 3 answers Im using lxml/Etree to parse and write to XSD documents. I have the basic structure tree = ET.parse('file.xsd') # do stuff tree.write('output.xsd') But tags get minimized in some instances, for example: <Cars>...

## Matplotlib shows superfluous microsecond precision on x axis ticks

datetime,matplotlib,formatting,decimal,ticker
I would like to plot some data as a function of time. I have used matplotlib and datetime, and it works well except for the x axis ticks. The time interval is about an hour, and there are ticks every 10 minutes. However, the ticks do show, for example, 17:50,...