FAQ Database Discussion Community

## How to prefix values when templating them with rivets?

javascript,formatting,rivets.js
I am working with the rivets.js library to template data into my application. I am stuck at a kind of a formatting issue. How do I format values while templating them? For example I have to template the user's photo location inside the image tag and I am getting the...

## new line for String.format works on console, but in not in email

java,string,email,formatting
This is what I set as property props.setProperty(EmailSender.MAIL_BODY, "This is an automated email.%nZip Path: %s\nAdditional Text: %s\nThank you."); and I use it as private String generateEmailBody(final EmailRequest diagnosticRequest) { final String bodyTemplate = getExistingProperty(MAIL_BODY); return String.format(bodyTemplate, diagnosticRequest.getZipFilePath(), diagnosticRequest.getTextFromCustomer()); } When I run test, I see on console as following Content-Type:...

## Selecting parameters in String.format() [duplicate]

java,formatting
This question already has an answer here: Java Equivalent to .NET's String.Format 5 answers In C# you can specify which parameter is used for a formatted string with para 2: {2}. This allows for using parameters in arbitrary places and multiple times. Is there a way to do this...

## Hide leading 0 on CAST SELECT output either in MySQL or PHP

php,mysql,casting,formatting,decimal
Morning, I currently have a SELECT statement calculating the PCT for a sports table: SELECT team , COUNT(*) as played , SUM(win) as wins , SUM(loss) as lost , SUM(draw) as draws , SUM(SelfScore) as ptsfor , SUM(OpponentScore) as ptsagainst , SUM((win*2 + draw)- loss) as score , CAST(SUM(win +...

## How do I pass an HTML document to CodeMirror as a start value?

javascript,html,xml,formatting,codemirror

## Excel formatting with Java Apache POI

java,excel,formatting,apache-poi
I have an excel file in the following format: I would like to restructure this format and have it outputted in the following format: The sections are repeating and can appear in any order but they will have either format. The 'Check' column is sometimes merged across rows as shown...

## Show number sign at the right side of number using cell formatting

excel,formatting,excel-formula,worksheet-function,conditional-formatting
I need to create formatting for numbers while keeping their actual value: If a negative is number entered, the minus sign needs to appear on the right-hand side of the number. If a positive number is entered, the plus sign needs to be on the right-hand side of the number...

## Printing a dictionary without newlines?

python,dictionary,file-io,printing,formatting
I'm trying to get the formatting right on my print-out and it's trickier than it should be. My objective is to have my code read in a dictionary, turn it to a list, sort it, then print it back out a text file looking like "String" "Float" "String" "Float" "String"...

## 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')...

## MariaDB formatting view code

When i save view on mariadb on debian(6) I lose comments and formatting of code. What is this feature of mariadb? How turn if off? On windows instance all comments and formats are stored. Both instances is MariaDB 10.0.17. Managed with Heidi 9.1 from Windows. Edit 1. Semi solved. LOAD_FILE...

I can't seem to find out how to format my javadoc to show to show up with links to String rather than the whole path. I've gone through several different guides with no luck. I was hoping to make it look more in line with how documents at oracle look....

## CSS table cell inputs not taking full width

html,css,formatting
I have a snippet in my project that involves laying out a grid for a form using CSS tables. However, I am having trouble making it work where it does not take up the full width as I would expect. .full_width { width: 100% } .table { display: table; }...

## 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...

## Engineering notation with Haskell

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 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();...

## Can this be done with formatting strings alone?

c#,.net,vb.net,formatting,string-formatting
I think I've found something that can't be done with formatting strings alone: I'm needing a string that would allow me to format a double to show no decimals and so that: Numbers are thousand separated 0 shows a dash Negative numbers are shown between parentheses 0.5 is rounded to...

## 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...

## 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; }...

## Wrong column filtering for date column

javascript,sorting,formatting,filtering,tablesorter
I use tablesorter to sort columns. But I found the following issue: As you can see the second row doesn't have 16. This table also have the external search field and search result equals 1 if I type 16, thus second row doesn't show. But it lools like a tablesorter...

## 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 make string paragraph easier to read for source code

powershell,formatting

## How to format code so while loop is triggered C

c,while-loop,formatting,boolean-logic
So I have two while loops. The outer most one does not loop back the way I want it to. I first tried: #define true 1 #define false 0 But then set it to what I did below. My problem is that when I run the program, it terminates after...

## Customised Style not showing in pages

c#,wpf,xaml,formatting
I've been working on this for a while and hit a hump that I cannot solve. The custom style I have works for some elements and not others. For instance, it works for the fonts, and will even format the button fonts, when I've only stipulated the TextBlock fonts. Most...

## XCode Formatting

xcode,formatting,keyboard-shortcuts
Is there a short cut or some quick way for Xcode to format this code: if(x==10){ if(y=100){ //Do this } } To this: if(x==10){ if(y=100){ //Do this } } Sometimes the logic of the code can get a little hard to read. I seem to spend a lot of time...

## 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...

## Unfamiliar Javascript syntax/hack

html,formatting,script-tag,hacking
I'm perusing some source, and I see this <script type="text/javascript" src="script/jquery/jquery.1.7.1.js">//]]> </script> <script type="text/javascript" src="script/swfobject_modified.js">//]]> </script> There's a dozen or so dependencies in the head listed in such a fashion, what is the purpose of the //]]> after each script tag? The code looks a bit old school, and is...

## TextField formatting (padding) issue in Titanium Android

android,formatting,textfield,titanium-mobile,titanium-android
I am facing the issue of formatting a simple textfield in Titanium Android. Problem : I am not able to view the text field input value that I enter. If I print the logs its getting entered but not visible. In some devices I get cut-off text. Below is my...

## How to write a large amount of columns in a formatted file

formatting,fortran,fortran90
I'm trying to write a code in fortran90 that allows me to create lets say 20 columns (f10.6) with one space between them in to the "output file". When I try to create file just with the 4 columns it works, but when I try to format a file with...