formatting

Can I make Visual Studio place curly braces on the same line as an if statement (in HTML)?

假如想象 提交于 2019-12-20 09:14:00
问题 In Visual Studio while designing MVC views (in .aspx or .ascx files) I often use if statements. When I auto-format (Ctrl-K,D), VS wraps the braces in this really ugly and hard to read way: <% if (Model.UserIsAuthenticated) { %> (some HTML goes here...) <% } %> Is there any way to make Visual Studio auto-format like this instead: <% if (Model.UserIsAuthenticated) { %> (some HTML goes here...) <% } %> Or is there a better way to do this? I don't want to use Razor quite yet, but it looks like it

Get correct indentation in Resharper for object and array initializers

馋奶兔 提交于 2019-12-20 09:09:56
问题 Right now resharper formats our code like this: private readonly List<Folder> folders = new List<Folder> { new Folder() }; but I want it to look like this: private readonly List<Folder> folders = new List<Folder> { new Folder() }; I've been messing with the options a lot, but can't seem to get them right. Can you help? 回答1: I had the same issue with anonymous delegates. The fix for anonymous delegate formatting is here: I did finally find the way to fix this. The options for formatting

Enabling IntelliJ's fancy ≠ (not equal to) operator

放肆的年华 提交于 2019-12-20 09:09:04
问题 I witnessed this in the GOTO 2016 • Kotlin - Ready for Production conference by Hadi Hariri. In some of his code, what would normally look like: if (x != y) { /* do some stuff */ } Is being displayed in an elegant style: if (x ≠ y) { /* do some stuff */ } Here's a screen-shot from the live coding session: He's using the regular != operator, the IDEA is taking care of the rest. I've been playing with my IntelliJ's configuration but couldn't enable this new fancy feature. Any help? PS. I'm

Disable :.format routes in rails3

孤街醉人 提交于 2019-12-20 08:57:13
问题 Could you tell me how to disable the .:format options in rails routes? I only need html... 回答1: In 3.1.1 at least you can add , :format => false to the end of the route. Found here: http://guides.rubyonrails.org/routing.html#request-based-constraints under section 3.11 Route Globbing eg.. match '*pages' => 'pages#show', :format => false Which would allow params[:pages] to include a period. 回答2: http://guides.rubyonrails.org/routing.html#request-based-constraints This will constrain your

How to preserve formatting from rstudio when copy/pasting to Word?

ぃ、小莉子 提交于 2019-12-20 08:48:56
问题 New to R, Rstudio, and SO -- my apologies in advance for any faux pas. I want to reproduce my code in Word 2010 for a homework assignment. The scripts were written in rstudio, and I would like to preserve rstudio's formatting when pasting into Word. Principally, I like the font colors and spacing that rstudio uses. I find that when I paste from SAS to Word, the formatting is preserved, but no dice here. I would usually look for copy special / paste special options to do this, but I can't find

How can I format bytes a cell in Excel as KB, MB, GB etc?

断了今生、忘了曾经 提交于 2019-12-20 08:09:45
问题 I have a value in a cell that's in bytes. But nobody can read 728398112238. I'd rather it say 678.37GB To write a formula to format it relatively easy (here's one: http://www.yonahruss.com/2007/02/format-excel-numbers-as-gb-mb-kb-b.html) But is there any way to do this as a 'format'? I'd like to have the big number in the cell, but have it display as the human-readable format. 回答1: You can't really do calculations in the formatting features of Excel. You can use something like the following

jqplot Pie Chart data label format precision without trailing zeros

北城以北 提交于 2019-12-20 05:28:13
问题 I would like to know how to format the data labels on a Pie Chart so it shows max 2 decimal characters, and never shows trailing zeros , for example: 2 -> 2 2.0 -> 2 2.566 -> 2.57 In other words, I am asking how to set dataLabelFormatString parameter ? I know it is using sprintf , thus I tried '%.2f' and '%g'. They do not solved my problem though. Since the first makes each number to show to decimal characters, the other just removes trailing zeros but doesn't work with precision as in this

knitr: code in chunks gets wrapped unexpectedly

冷暖自知 提交于 2019-12-20 05:10:10
问题 In a beamer presentation using knit2pdf() and LaTeX, I sometimes find that code in chunks gets wrapped, even though I have set tidy=FALSE globally. For example, this chunk: \item Fit this using \func{glm}: <<berk-logit2, size='footnotesize'>>= berkeley <- as.data.frame(UCBAdmissions) berk.logit2 <- glm(Admit == "Admitted" ~ Dept + Gender, data = berkeley, weights = Freq, family = "binomial") @ Appears like this: Note that all three lines are wrapped, as if in paragraph mode. The indented line

How to force PHP to read newlines and returns as <br>

耗尽温柔 提交于 2019-12-20 05:00:08
问题 The title is a little off im sorry. however what the scenario IS. I'm reading from a MySQL Database the field format is "mediumtext". At current it knows when there is a new line from hitting enter/return. there is no html involved. however when i pull this from the database onto my page, there is no formatting. however if you look at the html the code it beautifuly formatted with new lines! ive already got a find/replace function setup for some simple BBCode so might be able to use this. so

Python String Formatting - Type Error - Not enough arguments for format string

纵饮孤独 提交于 2019-12-20 04:38:12
问题 So what's wrong with this string? I'm not able to figure out why it says there's not enough arguments for format string. I'm new to Python and just figuring things out. Edit: This is not the same as the other question suggested. The other is trying to do some crazy array stuff that I am not even getting into. I just need to understand the basic concept of tuples and how string formatting works. data = ["John", 23, "United States", "United Kingdom"] format_string = "Your name is %s and you are