FAQ Database Discussion Community

## Is there analog of fmt:formatNumber in velocity like in jsp?

jsp,formatting,velocity,template-engine

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

## Google Sheets - propagate column date formatting to new rows

The date format in the column is not propagating to new rows, whenever new rows are being added to the bottom of the sheet. The column formatting is not automatically applied - this in regards to date, currency format, alignment etc.

## why is my string not in fixed size?

java,string,formatting,string-formatting
I try to print strings with padding (table like): StringBuilder sb = new StringBuilder(); sb.append(String.format("%1$15s", "bulk name")); sb.append(String.format(" | ")); sb.append(String.format("%1$15s", "baseline")); sb.append(String.format(" | ")); sb.append(String.format("%1$15s", "current")); sb.append(String.format(" | ")); sb.append("\n"); for (int i = 0; i < baseLine.tillOneSecondBulks.size(); i++) { sb.append(String.format("%1$15s", baseLine.tillOneSecondBulks.get(i).bulkName)); sb.append(String.format(" | "));...

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

## Formatting number in European format with two decimals

javascript,formatting,locale,culture
Trying to format a number to two decimals format in European culture. So that comma is decimal separator and space thousands separator. In example 213245 should be formatted as 213 245,00 How can I do that? 213245.toFixed(2).toLocaleString(); gives 213245.00 but it should be 213 245,00 however 213245.toLocaleString() gives 213 245...

## What does this horribly ugly (yet somehow secretly beautiful) Perl code do?

perl,formatting,deobfuscation
I found this code in a Powerpoint presentation about Perl scripting and this was on a page demonstrating how ugly Perl code can get if you really wanted to make it that way. The presentation says nothing about what this code does. Honestly I am just very curious to know......

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

## Replacing section of python string with a designated variable

python,string,formatting
Currently I'm working on a message that I'd like to include multiple changing variables. Now I'm not exactly sure whether I explained that right, therefore here's an example: """ Hello world! %s %(what goes here?) """.format() Basically I'd like to apply another "%s", though I don't know how to do...

## Display a table in MATLAB

matlab,formatting
I am trying to display a table with two columns and 86 rows. Instead of outputting the rows, the size is stated. Is there a way to change this? I am new to MATLAB and am coming from a background in C/C++ so I may just be approaching this all...

## Get text from Gtk3 TextView/TextBuffer with formatting tags included in Python

python,formatting,gtk3
I'm working on a Python 3 project that uses the Gtk3 TextView/TextBuffer to get a user's input, and I've got it working to where I can have the user typing in rich text and able to format it as Bold/Italic/Underline/Combination of these. However, I'm stuck on trying to figure out...

## How to convert a Rational into a “pretty” String?

I want to display some Rational values in their decimal expansion. That is, instead of displaying 3 % 4, I would rather display 0.75. I'd like this function to be of type Int -> Rational -> String. The first Int is to specify the maximum number of decimal places, since...

## Formating data in HTTP POST request with PHP

php,http,post,data,formatting
I'm using an API which gives an example of how they want the data of the POST request I'm about to make to be formatted. This is their example: un=chris& key=xxxx& origin=plot& platform=lisp& args=[[0, 1, 2], [3, 4, 5], [1, 2, 3], [6, 6, 5]]& kwargs={"filename": "plot from api", "fileopt":...

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

## How will I handle JSON key with dash/hypen in Retrofit?

android,parsing,formatting,retrofit
Below is an example response I got from the server. "request": { "authenticate-login": { "response": { "status": 1, "msg": "User Authorized!" } } } I have used Retrofit for a quite some time now and it's my first to encounter such issue....

## Insert Excel row using format from row below, not above

I need to insert a row into an existing Excel worksheet using C# but keep the existing formatting. The default behaviour in Excel is to use the formatting of the row above, which in some cases is what I don't want as this could be different. I am sure I...

## Python3 Display certain number of output

python,python-3.x,formatting,format
I have a list a numbers, I want to display 10 per line, and they have to format really nice start: 1 End: 1000 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101...

## How to format the values of a model in Marionette Backbone View before rendering?

view,formatting,typescript,rendering,marionette
If you implement the onBeforeRender method the is no way to access the model values in order to format them temporarily Ideally you would want to format the values just before rendering without changing the model values of course! How to do it?...

## Simple and clean java float to string conversion

java,string,floating-point,formatting,type-conversion
This is a very simple question, but I'm amazed on how difficult it has been to answer. Even the documentation didn't give a clear and straight answer. You see, I'm simply trying to convert a simple float to a string such that the result only has one decimal digit. For...

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

## Why is my file output overwritten?

c,file,struct,formatting
My program takes user input and stores it in an array of Records that I've defined as a structure: struct Record. The user input is are the fields of the struct. Everything complies error free, but it seems I can't get the formatting correct. My program keeps asking for user...

## Formatting long-form survey data in R

r,table,formatting,reshape,long-form
We asked 3 people two or three yes-no questions. Let me denote these 3 people by 101,102,103 the questions by "A", "B","C" and the responses by 0, 1. The result is q<-data.frame(response=c(0,0,1,0,0,1,1), qstn=c("A","B","A","B","A","B","C"), person=c(101,101,102,102,103,103,103)) We need to convert this table to the following format person|qustionA|questionB|questionC 101 | 0 | 0...

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

## Is there a specific way to input characters at the beginning of a new line?

python,string,formatting
Current I am trying to implement a way to input ">" at the beginning of each separate line in a string. An example would be: String: "Hello how are you! Python is cool!" Now that's all one big string, with a line break. But is there a function to establish...

## OpenOffice Calc displays only 9 numbers after decimal points, how to show more

formatting,openoffice-calc,formulas,libreoffice-calc
I am in a situation of dealing with numbers when there is need to display the numbers as is on the excel sheet. Currently 37.6172080480001 is being displayed as 37.617208048 Seems like the sheet by default only displays 9 digits after the decimal points. How can that be updated to...

## Get wordpress formatted post content without including wordpress functions

php,wordpress,formatting
I'm creating a script that gets the content and meta of wordpress posts for an app, doing queries directly on the database because it's way faster than including the wp functions. However the problem is that the post content is saved into the db without formatting. I know that I...

## TypeError: unsupported operand type(s) for %: 'int' and 'tuple' [closed]

python,formatting,raspberry-pi
On a Raspberry Pi, I've set it up so that it's monitoring ASCII serial input from the user, which it then parses and populates a matrix with the parsed data. But when I try to do something with the data: for i in range(1,7): if matrixA[i][1]>0: print "sending DO_Fire (pin...

## C++: Re-use line printed to console [duplicate]

c++,terminal,console,formatting,output
This question already has an answer here: How to rollback lines from cout? 3 answers Edit: Thanks to user mah's comment, I found what I was looking for. I want to rollback the line, see this question. I always print information to the console using std::cout and std::endl, but...

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

## Format datetime axis in highcharts?

datetime,highcharts,formatting,axis-labels
http://jsfiddle.net/LLExL/4537/ Can anyone please help with this date time axis formatting on highcharts. I want Xaxis to show month only once unless the new month begins. Like 29 April 30 1 May 2 3 4 5 Any help would be highly appreciated ...

## List git branches in directory using bash with formatting

git,bash,shell,ubuntu,formatting
I wants to list git branches in a set of directories using bash. Now I just want to format the branch name differently if it's "master". In other words, if the branch is 'master' I want to display it in Blue or any other color....

## 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 convert html code to a string that replaces the newlines with \n and tabs with \t

javascript,html,string,formatting,markup
Is there an easy way to convert HTML code, that is structured in a certain way, to a single string (that can then be used in a Javascript variable). The new lines and tabs in the html code need to be converted to \n and \t so that the formatting...

## Excel - Conditional Formatting using time arguments

excel,date,formatting,formula,conditional-statements
Looking to change the fill of a cell based upon the amount of time between the current date (TODAY), an entered value detailing when something was done historically and a set period from that historical date of either 6months or 1year. E.g. I have a date of 12/04/2015 entered as...

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

powershell,formatting

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

## Use DateTime format in a class but restrict time tokens

c#,parsing,datetime,formatting
I have a peculiar problem I want to solve. I have written a MonthYear class which essentially maintains a DateTime object behind the scenes and only allows methods/properties for month and year portion of the DateTime. Everything is working fine. Now I have another requirement. I want to allow anyone...

## Show Results' line numbers using grep

linux,bash,grep,formatting,line
how i can show the result of my grep command with incremental numbers before them , i'm not talking about using -n or -nr to show where is my string located in that files. i'm talking about something like this : grep foo *.* result should be like this :...

## Erlang: strange output formatting

xml,file,formatting,erlang,output
Windows 7 x64, Erlang-OTP 17. I wrote simple module like this: -module (somequery). -export ([fbquery/2]). fbquery(P1,P2) -> inets:start(), ssl:start(), token = "78a8shd67tyajsndweiu03hr83h19j", Encoded = {"Authorization","Basic " ++ base64:encode_to_string(lists:append([token,":",""]))}, ContentType = "application/xml", Headers = [Encoded, {"Content-Type",ContentType}], Options = [{body_format,binary}], {ok, File}=file:read_file(P1), Res = httpc:request(post, {"https://datapi.com/api/xml4-8", Headers, ContentType, File}, [], Options),...

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

## Use XSLT to convert date time to full words

xml,date,xslt,time,formatting
I am just starting to learn XSLT and am hoping to convert some XML time and date data so that it is fully spelled out. While I have seen methods to have the date information output as words (12 to December) I don't see anything that allows be to convert...

## Proper Formatting in a listbox

vb.net,listbox,formatting
I'm trying to format my listbox so that it looks neat when its in use. I want to add dollar signs to my numbers, and left align them. Any help would be appreciated. They currently look really sloppy. Dim salesTotal As Double customerListBox.Items.Add("Customer: " & " " & "Total Sale:...

## How can I print decimal places, up-to the point there are not two repeating zeros?

java,floating-point,formatting
I would like to change the below output 5250.000000000000 5512.500000000000 5788.125000000001 6077.531250000001 6381.407812500002 6700.478203125002 7035.502113281253 7387.277218945315 7756.641079892581 8144.47313388721 To the below output. 5250.0 5512.5 5788.125 6077.53125 6381.4078125 6700.478203125 7035.50211328125 7387.277218945313 7756.641079892578 8144.473133887207 So it appears the logic I need, is to only print decimal places if there is less than...

## Delphi 7: Formatting changes after using delete procedure

delphi,formatting,string-formatting,richedit
I was working on my text editor, which I have completed, but I still have this one problem I'm trying to solve. My problem is, that I want to delete specific symbols on the end of lines, which were created by pressing the speedbutton (button is down). So when I...

## Formatting large numbers in C#

c#,.net,unity3d,formatting
I am using Unity to make an "Incremental Game" also known as an "Idle Game" and I am trying to format large numbers. For example, when gold gets to say 1000 or more, it will display as Gold: 1k instead of Gold: 1000. using UnityEngine; using System.Collections; public class Click...

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

## Retaining original table formatting after a 'pagebreak'

excel,excel-vba,table,formatting,page-break
So here's the finished product, a statement of accounts with a working statement table, and an ageing analysis: Everything works great. It basically populates itself row by row with data from another table. Here is the sample code: j = 21 'First row on the statement of accounts workbook For...

## format output to body of mail using powershell

email,powershell,formatting
I want to display the disk size of certain directory and file for a particular directory in a formatted output and send it as a body in the mail using powershell. I used in the powershell code but not able to save the same in a variable: C:\Users\abc\Desktop\xyz\file.bat -Name powershell...

## Scala: Better way for String Formatting to PhoneNumber and using Java's MessageFormat

scala,formatting,messageformat
I'm looking for a better way to better implement the following: I have imported import java.text.MessageFormat to set the format I would like. val szphoneFrmt holds the format I would like. val szInitialString is set to the value I pulled from the database. val szWorkString breaks up the string via...

## Powershell script to send email with list of files in a folder - formatting issue

email,powershell,formatting
thank you for taking the time to look at my question. I have a Powershell script that checks for files in a folder and sends an email if any files are older than 3 hours. The only problem is, I can't seem to get the formatting right when trying to...

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