Questions tagged [formatting]

1

votes
1

answer
103

Views

How the non-sticky format properties are reset?

Consider the following code: class C{}; std::ostream &operator
PaperBirdMaster
1

votes
1

answer
1k

Views

Visual Studio 2013 auto indent

In Visual Studio 2013, under Tools > Options > Text Editor > File Extension, I have set three file extensions, namely .cginc, .compute, and .shader (these are Unity3D shader files) to use Microsoft Visual C++ for auto formatting. Sometimes auto indent (for curly braces) works, and sometimes it doesn...
Patrick Purcell
1

votes
1

answer
1.2k

Views

WPF - ToolTip Binding with stringformat

I want to make a tool tip using binding and string format, he is what I've tried: The value of Name is : Golan What I expected to see is: The name is: Golan But all is see is: Golan
Pachu
-1

votes
1

answer
18

Views

Columns pandas data frame with different type object - python

I need to convert numeric values of a column (pandas data frame) to float, but they are in string format. d = {'col1': ['1', '2.1', '3.1'], 'col2': ['yes', '4', '6'], 'col3': ['1', '4', 'not']} Expected: {'col1': [1, 2.1, 3.1], 'col2': ['yes', 4, 6], 'col3': [1, 4, 'not']}
stefanodv
1

votes
1

answer
2.1k

Views

How to rename columns in a Shiny renderTable?

I am using renderTable in Shiny to display a table. I am having trouble renaming the column names in the output. server.R: reactive.tables % summarise(lump.sum.2 = sum(lump.sum.2), n = n()) %>% na.omit }, colnames(output$lump.sum.2) = c("company", "lump sum", "occupancies") ) Renaming columns seems...
1

votes
1

answer
158

Views

VSCode not respecting tab size when formatting a Dart file

I want VSCode on my Mac to use 4 spaces instead of 2 when I select Format Document. This is what I have on my User Settings: { "editor.fontFamily": "Andale Mono", "editor.fontSize": 13, "editor.renderWhitespace": "all", "editor.tabSize": 4, "[dart]": { "editor.tabSize": 4, "editor.detectIndentation"...
Hahnemann
0

votes
0

answer
18

Views

Delete lines during file compare without deleting line numbers or injecting new blank lines

I am comparing two files to eliminate data in file-1 that is the same data in file-2. I want to remove the data and leave the line blank in file-1. My code is removing data and the line number, and creating new blank lines that were not there in the first place. I have tried altering the code dozens...
cyberzyme
1

votes
0

answer
17

Views

Format a number using “figure space” \u2007?

Normally string.Format() uses space characters (\u0020) as leading spaces while formatting numbers. Because space characters are smaller than digits, the width of the graphical representation of the string varies with the number of spaces. Is there any way to tell string.Format() to use "figure spac...
Ralf Casperson
0

votes
0

answer
19

Views

Python Pandas Conditional Formatting of Dataframe without Jupyter Notebook

I would like to apply conditional formatting of a dataframe and save it has html. If I dont use a Jupyter notebook the program crashes. How can I write an html without using Jupyter? import pandas as pd import numpy as np df = pd.DataFrame(np.random.randn(5,5), columns=list('ABCDE')) def highlight_v...
Travis
1

votes
3

answer
8.9k

Views

ReportLab Paragraph and text formatting

My issue is that when using reportlab to generate a simple text document it loses all of the formatting. I've run it through a few times to try and debug it and the issue seems to be, when passing the msgStr to Paragraph it loses all of the formatting sent with it. Does anyone know how to generate a...
Jim
1

votes
1

answer
189

Views

How to change date format in ngbDatepicker input field in angular bootstrap?

HTML:- Date of birth {{ 'Validations.dob' | translate }} Now when I select some date, it set as YYYY-MM-DD format but I need to change in other format (MM-DD-YYYY or DD-MM-YYY). Check its node_modules folder but didn't git any solution for the same. I checked the gist https://gist.github.com/nrobina...
VIKAS KOHLI
1

votes
2

answer
36

Views

How to format a list to rows with certain number of items?

I'm having issues on formatting a list to a formatted output that each row contains five elements but I am stuck. words = ["letter", "good", "course", "land", "car", "tea", "speaker",\ "music", "length", "apple", "cash", "floor", "dance", "rice",\ "bow", "peach", "cook", "hot", "none", "word", "happ...
allendom
1

votes
2

answer
427

Views

Django: How to nicely format an address in a template without knowing how much information is available?

I have a table with address information. It has these fields. address_1 address_2 city state zip No field is required. I want to display this in a template and format it nicely. I want line breaks between address_1, address_2, and the city/state/zip line for any of those that exists. I also want a c...
raddevon
1

votes
1

answer
170

Views

IntelliJ plugin autocomplete formatting

I add an autocomplete fonctionnality to my IntelliJ plugin like this : String completionString = "myFunction(err, data){if(err){}else{}}"; return LookupElementBuilder .create(completionString) .withBoldness(true) .withIcon(SailsJSIcons.SailsJS) .withPresentableText("myFunction()") .withCaseSensitiv...
jaumard
1

votes
1

answer
2.1k

Views

Formatting json to geojson via PHP

I am trying to get some data that I have called from a mySQL database to correctly display in a GeoJSON format. Here's some of my PHP code: $data = array(); //setting up an empty PHP array for the data to go into if($result = mysqli_query($db,$query)) { while ($row = mysqli_fetch_assoc($result)) { $...
sleepy_daze
3

votes
5

answer
121

Views

Python : replace multiple occurrence of characater by one but single occurrence by none

I have a string: a = '0202201131181' I want to replace all multiple occurrences of 1 in a if present, by a single 1 but if only one occurrence of '1' is found then replace it by empty string ''. My end goal is to get: a = '0202201318' Here the '1' after character '8' is occurring only once, so it's...
michael petronav
1

votes
2

answer
7.9k

Views

Remove Header and Footer from Pandas Dataframe print

The following code prints all the values I want but has "Date" as the first row and "Name: Close, Length: 1828, dtype: float64" as the last row import pandas as pd from pandas.io.data import DataReader from datetime import datetime ibm = DataReader('IBM', 'yahoo', datetime(2009,1,1)) pd.set_optio...
Dante
1

votes
1

answer
1.8k

Views

Markdown Table not working (kramdown)

code Its working perfectly in the atom md preview but it outputs terribly in Github hosted jekyll website? My posted md file online: https://kevin-do.github.io//aztec-parking/ Could someone please help?
Kevin Do
1

votes
2

answer
1.8k

Views

MS SQL Server equivalent of to_char

In Redshift, we use below command for converting datetime to a formatted string as shown below- to_char(, 'MM/DD/YYYY HH:MI AM') AS dateTime How can I achieve the same in MS SQL server. I used convert and cast but I cannot exactly format it the same way as above. I used select convert(varchar(20),...
1

votes
1

answer
153

Views

How to wrap text in pygame using pygame.font.Font()?

I am making a would you rather game, and I would like to not have character restrictions for the W.Y.R. questions. I have seen many examples here on Stack Overflow and other websites, but they use other modules and methods I don't understand how to use or want to use. So I would rather use button_t...
K. Turkey
1

votes
4

answer
55

Views

Bash multi-line command with input | output

My question is a simple one. I am looking to simply format my bash code into something a little more readable for other users .. While this works: mysql --login-path=main-data -N -e "SELECT section_id FROM db.table WHERE contractor_id = '1'" | while read contractor_info_id; do #......// done I don...
Zak
0

votes
2

answer
13

Views

Regular Expression to find money in text

I need to find a regular expression that will extract any $ followed by an integer like $200 or $50 or $50.00 or $5,000 from a text. Thank you
Batch Wade
0

votes
0

answer
4

Views

What is the Conditional Formatting formula for two conditions?

I have an excel file that I need to format a certain color. I have tried: =AND(A:A=FALSE,B:BNull) =AND(A:A="FALSE",B:B" ") =AND(A:A=FALSE,NOT(ISBLANK(B:B))) Along with multiple If-statements with this scenario. Picture won't work but my file is somewhat like this: A | B 1 FALSE | 1/14/2017 2...
SharonIsKaren
1

votes
1

answer
1.1k

Views

How can I prevent ReSharper from inserting a blank line between my MSpec fields?

When I write an MSpec context like this: [Subject(typeof(TheType), "Concern")] internal class when_this_test_is_run { Establish context = () => { // some code... }; Because of = () => Do.Something(); It should_do_this; It should_do_that; } When I let ReSharper reformat the code, it always inserts a...
Tim Long
0

votes
1

answer
51

Views

Format currency in Android like SkuDetails' getPrice method

I'm trying to convert a float number to a currency string in a similar format returned by SkuDetail's getPrice method, for reference it returns a string like this 1 234,56 Ft I've tried NumberFormat format = NumberFormat.getCurrencyInstance(); format.setCurrency(Currency.getInstance("HUF")); format....
kviktor
1

votes
1

answer
1.3k

Views

How to create my own 'Reformat Code' style in Android Studio?

In Eclipse,(Window -> Preferences -> Java -> Code Style -> Formatter) there was a facility to create my own format style and apply it in the code. Is there a way to do that in Android Studio(for Java code) ?
Tomin Jacob
1

votes
1

answer
373

Views

Format float with padding and justification

I know I can do > print '|{:16.3f}|\n|{:16.3f}|'.format(1, 10) | 1.000| | 10.000| to pad a number so that the output is a certain number of columns, and I can do > print '|{:
bheklilr
1

votes
1

answer
17k

Views

Excel Macro to Change Cell Format to Currency

I have a file where a column is full of numbers, and the second column has the respective currency of each number. I have USD, EUR, CHF, and GBP. I want to create a macro that will format the number column from number to currency, and then apply the currency from the second column. The trick to...
Irina
1

votes
5

answer
4.1k

Views

Implement compare method of Comparator out of defining line

Generally I define Comparator as - Comparator comparator= new Comparator() { public int compare(Obj o1, Obj o2) { //implementation... } }; And when the Comaprator is a part of class memeber's it's slightly does not looks good on the code format . Is there any way to define the Comparator as Comp...
URL87
1

votes
3

answer
117

Views

How to specify a directory when creating a File object?

This should be a really simple question but Google + my code isn't working out. In Eclipse on Windows, I want my program to look inside a certain folder. The folder is directly inside the Project folder, on the same level as .settings, bin, src, etc. My folder is called surveys, and that's the one I...
iaacp
1

votes
2

answer
1.6k

Views

Apply javascript function to an html element

Sorry for the noob question but I am trying to apply this javascript function to data in an html table. The function comes from this Stack Overflow post. function numberWithCommas(x) { return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); } I wish to apply this function to something like this:...
Erik Berger
1

votes
2

answer
470

Views

Converting time with Python and DataNitro in Excel

I have a list of times in h:m format in an Excel spreadsheet, and I'm trying to do some manipulation with DataNitro but it doesn't seem to like the way Excel formats times. For example, in Excel the time 8:32 is actually just the decimal number .355556 formatted to appear as 8:32. When I access that...
user1104854
1

votes
2

answer
62

Views

Casing text depending on punctuation [closed]

Which would be the most efficient way to change a text to it's proper case depending on punctuation marks and fix formatting (whitespace, etc)? the qUiCk BROWN fox:: jumped. over , the lazy dog. Desired result: The quick brown fox: jumped. Over, the lazy dog.
1

votes
2

answer
1.7k

Views

PyQt: QDateComboBox setDate using string?

How can I set the date of a QDateComboBox using a string that some times can also be empty?
Antoni4040
1

votes
2

answer
83

Views

Eclipse Annoying Default Formatting

My original code: ListView myListView = (ListView) view.findViewById(R.id.myListView); Code after format (annoying!): ListView myListView = (ListView) view .findViewById(R.id.myListView); What setting do I adjust to prevent eclipse's format from making this particular change? I'm looking in the for...
MikeS
1

votes
1

answer
6.6k

Views

How to set precision of double values to be of the form ##.## at ALL times?

I am currently trying to create a timer for an android game which has the form ##.## at all times. The issue I am having is that if my timer reaches say 23.50, it will set it as 23.5 So, I am trying to set the precision of my double value to be exactly 2 decimal places. This is my code so far, which...
Andrew Seymour
1

votes
2

answer
378

Views

Specific database columns into an array

Originally, this simple array and a foreach statement works perfect, but I need to change from a php array to getting the information out of the database: $serversArray = array( "domainname1.com", "domainname2.com:port", "domainname3.org", "000.000.000.000:port"); foreach($serversArray as $server) ....
DreamPhreak
1

votes
3

answer
535

Views

Format string for printf hacking

This is hacking for a useful (non-malicious) purpose and I'm not sure what I want can be done but I'd like to try. I'm running software that is closed source so I can't modify the original function call. The call is: sprintf(string, this->LabelFormat, value) And this->LabelFormat is %-#6.3g by defau...
tpg2114
1

votes
2

answer
1.1k

Views

XYPlot without vertical axis and horizontal line grid?

Can I draw only vertical data axis (without axis line( in XYPlot and only horizontal line in grid lines (I know the hack - draw them by white color, that is coincident with background color, may be, there is more pure way) ?
Eugene Shmorgun
1

votes
5

answer
1.2k

Views

Need to display price without decimal

Im trying to display price of a product, and when the price is a whole value to NOT display the decimal ".00"; But the current result is ALWAYS showing the decimal value. I have provided my current logic below; $price_value = "20.00"; //coming from DB as string if (is_int($price_value)) { //Display...
IEnumerable

View additional questions