FAQ Database Discussion Community

## Altering XML file format in C#

c#,xml,formatting
I have a program in Visual Studio which gives the output in an XML file. It looks like so: <?xml version="1.0" encoding="utf-8"?> <leaCEDS> <district> <leaID>01</leaID> <name>Alachua</name> <organizationType>LEA</organizationType> <streetLine1>620 E University Ave</streetLine1> <city>Gainesville</city> <stateProvince>FL</stateProvince> <postalCode>326015448</postalCode> <county>Alachua</county>...

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

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

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

## SQl query, subquery formatting issue

sql,sql-server,formatting,result
I need someone to help me with some formatting. I have tried to get this into a Row using subqueries and UNION ALL etc with no success. It would seem to be rather easy but I am just beating my head against a wall with this. The table is laid...

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

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

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

javascript,html,xml,formatting,codemirror

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

## Reformatting Dictionary output in python

python,csv,formatting,ordereddictionary
I have an OrderedDict and I've exported it to a csv but I want it to be formatted differently. My code for reading, sorting, and making the dictionary: from collections import defaultdict, OrderedDict counts = defaultdict(lambda: {"User": 0, "Equipment": 0, "Neither": 0}) with open('sorterexample.csv', 'rb') as fh: reader = csv.reader(fh,...

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

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

## highlight “partial” duplicates across entire sheet in Google Sheets using conditional formatting

formatting,duplicates,conditional,highlight,partial
Im trying to highlight partial duplicates in google sheets using conditional formatting. I need to highlight duplicates across multiple columns and rows in any matching cells. so far I'm using this... =countif(INDIRECT({"C2:Z18"}),C2)>1 Which works to a degree, but it only highlights exact matches. I need to find a way to...

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

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

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

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

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

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

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

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

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

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

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

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

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

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

## Python's Multiplication Function

python,formatting,multiplication,presentation
In python I found a multiplication solution very useful for the software I am writing. Problem is when using the software, user is asked a question (i.e 8x2) but it prints a command-type line (i.e 14). This is not so user friendly and I would like to display it in...

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

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

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

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

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

formatting,latex

## Copying lines from text file- remove formatting- Python

python,file,formatting,format
I am attempting to read text from a file, then print out the corresponding Shakespearean sonnet off of input from a user. [if the user enters 1, print sonnet 1, etc.]. The code I have below functions, however, I would like the answers to be without all the formatting 'def...

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

## How can you use a variable name inside a Python format specifier

python,formatting
Is it possible to use a variable inside of a Python string formatting specifier? I have tried: display_width = 50 print('\n{:^display_width}'.format('some text here')) but get a ValueError: Invalid format specifier. I have also tried display_width = str(50) however, just entering print('\n{:^50}'.format('some text here')) works just fine....

## Override Conditional Formatting with Worksheet_SelectionChange

excel,vba,events,formatting
I have some code in a worksheet to highlight the row of a selected cell. However, this sheet has conditional formatting which colours some of the rows. The highlighting macro does not work on the rows where the formatting condition is being met (in the sense that the colour of...

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

## How to apply scales::percent or scales::percent_format() to prop.table in R to format numbers as percentages

r,formatting,plyr,percentage,crosstab
Consider the following example: tab <- table(mtcars$vs, mtcars$cyl, dnn = c("vs", "cylinder")) prop.table(tab) # cylinder # vs 4 6 8 # 0 0.03125 0.09375 0.43750 # 1 0.31250 0.12500 0.00000 round(prop.table(tab)*100, 1) # cylinder # vs 4 6 8 # 0 3.1 9.4 43.8 # 1 31.2 12.5 0.0 Desired...

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

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

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

## Populate DataGridView Column With a Double forcing to 2 Decimal Places, with Sort

vb.net,sorting,datagridview,formatting
Sorry for the weird title but I didn't know how to phrase it any better. I'm trying to populate a column on my DataGridView with a number that has 2 decimal places. To do this I'm using Dim _Size as Double = 1.2345 DataGridView1.Item(0, 0).Value = Format(_Size, "0.00") This populates...

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

## How to serialize a custom formatted time to/from xml in Go?

xml,go,formatting,date-formatting
When serializing a datetime to/from xml how do I make it use a custom time format?

## Regain an original fractional numeric value that Excel has transformed to a date value

excel,date,formatting,numeric
I have an Excel workbook that contains numeric values and some of them have been transformed by Excel auto format feature into the date values. I do not know the original numeric values and neither do I have access to the .txt version of that file. Is there a way...

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

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

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

## How to set font-weight of a column text to bold based on another column value in Telerik Grid

telerik,formatting,conditional,client-templates
I have a Telerik grid in which based on whether my IsTrue value is true or false, I need to set the font-weight of Name text in only that particular row to bold. I tried the following but I seem to be missing something. columns.Bound(d => d.IsTrue).Width(0).HtmlAttributes(new { id="hdnIsTrue", style...

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

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

## Auto insert a standard comment header for every “newly generated java file” in eclipse

java,eclipse,formatting
I want to add some default text to every newly generated java file, so that I don't have to add it manually every time. I've set the below configuration in eclipse: But when I create a new java file, the default comment I found is blank, like 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 +...

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

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

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

## Getting a key error while using a dict with TEMPLATE.format()

python,string,python-3.x,dictionary,formatting
At a loss on this. I'm getting a key error but I can't figure out why as the key referenced looks like it's in the dict. Any help? TEMPLATE = "{ticker:6s}:{shares:3d} x {price:8.2f} = {value:8.2f}" report = [] stock = {'ticker': 'AAPL', 'price': 128.75, 'value': 2575.0, 'shares': 20} report.append(TEMPLATE.format(stock)) This...

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

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

## Adding a trailing 0 to my 0.1, 0.2 values, but not to my 0.25 values

java,formatting
I have a double value that is pulled in from an external method call. When a 0.6 value comes through, I want it to be changed into 0.60, but I don't wan't to put "0" at the end of my string or else it will make my 0.65 values 0.650....