formatter

How to define different indentation levels in the same document with Xtext formatter

时光怂恿深爱的人放手 提交于 2019-12-01 13:14:09
问题 Is it possible to format a document as follows, using Xtext formatting? As you can see, Test children are indented with 4 spaces while External children are indented with 2 spaces only. I am using Xtext 2.12.0. Test my_prog { Device = "my_device"; Param = 0; } External { Path = "my_path"; File = "my_file"; } 回答1: you could try to work with custom replacers, dont know if this will work with nested block though def dispatch void format(External model, extension IFormattableDocument document) {

Symfony2 : use Processors while logging in different files

橙三吉。 提交于 2019-12-01 00:26:45
I want to write my application logs in another file than the one Symfony2 writes its own logs and system logs. I understood that I needed to create a service of my own like this : services: actionslogger: class: Symfony\Bridge\Monolog\Logger arguments: [app] calls: - [pushHandler, [@actionslogger_handler]] actionslogger_handler: class: Monolog\Handler\StreamHandler arguments: [%kernel.logs_dir%/actions_%kernel.environment%.log, 200] That works fine when I use $logger = $this->get('actionslogger'); in my application, so that's ok. But I also want to use a Formatter and a Processor to manage the

Can the Eclipse formatter be configured to indent multiple lines between parenthesis properly?

末鹿安然 提交于 2019-11-30 20:17:11
Can eclipse formatter and code cleanup be configured (or extended) to add the indentation I expect in the following examples: public static void main(String[] args) { String[] numbers = new String[] { "one", "two", "three", "four", }; new MessageFormat("{0} {1} {2} {3}").format( "this is string one", "this is string two", "this is string three" ); System.out.println( new MessageFormat("{0} {1} {2} {3}").format( new String[]{ "this is string zero", "this is string one", "this is string two", "this is string three" } ) ); } I've played around with all the settings that I can find. The "never

How can I correctly format currency using jquery?

夙愿已清 提交于 2019-11-30 06:18:48
问题 I do not need a mask, but I need something that will format currency(in all browsers) and not allow for any letters or special char's to be typed. Thanks for the help Example: Valid: $50.00 $1,000.53 Not Valid: $w45.00 $34.3r6 回答1: JQUERY FORMATCURRENCY PLUGIN http://code.google.com/p/jquery-formatcurrency/ 回答2: Another option (If you are using ASP.Net razor view) is, On your view you can do <div>@String.Format("{0:C}", Model.total)</div> This would format it correctly. note (item.total is

android EditText ,keyboard textWatcher problem

偶尔善良 提交于 2019-11-30 03:42:28
I am working on a android app and I have an EditText where user can input numbers. I want to format the number using different currency formats (say ##,##,###) and I want to do it on the fly, ie when user enter each digit(not when enter is pressed). I googled around, and came across TextWatcher which I first found promising, but it turned out to be an absolute pain. I am debugging my code on a HTC Desire phone which only has a soft keyboard. Now I want to get a callback when user press numbers (0 to 9) , del (backspace) key and enter key. From my testing I found these (atleast on my phone) 1)

Python Formatter Tool

两盒软妹~` 提交于 2019-11-29 21:25:20
I was wondering if there exists a sort of Python beautifier like the gnu-indent command line tool for C code. Of course indentation is not the point in Python since it is programmer's responsibility but I wish to get my code written in a perfectly homogenous way, taking care particularly of having always identical blank space between operands or after and before separators and between blocks. I am the one who asks the question. In fact, the tool the closest to my needs seems to be PythonTidy (it's a Python program of course : Python is best served by himself ;) ). autopep8 attempts to automate

How do i modify a log format with Simple Formatter?

旧时模样 提交于 2019-11-29 18:38:14
I've tried adding this line into logging.properties, but the output doesn't change java.util.logging.SimpleFormatter.format='%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$s %2$s %5$s%6$s%n' I also tried System.setProperty, but it still doesn't work, what am i doing wrong? import java.util.*; import java.util.logging.Logger; import java.util.logging.SimpleFormatter; import java.io.*; import java.awt.*; public class LoggerFormat { private static final Logger logger = Logger.getLogger(LoggerFormat.class.getName()); public static void main(String[] args) { System.setProperty("java.util.logging

How to align String on console output

余生颓废 提交于 2019-11-29 03:33:35
I've to write code for: I'd written the code: public class tables { public static void main(String[] args) { //int[][] table = new int[12][12]; String table=""; for(int i=1; i<13; i++){ for(int j=1; j<13; j++){ //table[i-1][j-1] = i*j; table+=(i*j)+" "; } System.out.println(table.trim()); table=""; } } } But the problem is with the output format. I need the output in a matrix like fashion, each number formatted to a width of 4 (the numbers are right-aligned and strip out leading/trailing spaces on each line). I'd tried google but not find any good solution to my problem. Can anybody help me

Change how eclipse formatter wraps long strings

心不动则不痛 提交于 2019-11-29 01:09:28
I have set the eclipse java formatter to wrap lines that exceed 120 characters to conform to our team's coding standard. However, when I have a long string that is wrapped I want the plus sign (+) to appear as the last character on the first line e.g. String s = "Very long line that should be " + "wrapped across several rows"; The default behaviour is that the plus sign is placed on its own line e.g. String s = "Very long line that should be " + "wrapped across several rows"; So is it possible to specify where the plus sign should appear in the eclipse java formatter? Preferences > Java > Code

android EditText ,keyboard textWatcher problem

巧了我就是萌 提交于 2019-11-28 22:58:01
问题 I am working on a android app and I have an EditText where user can input numbers. I want to format the number using different currency formats (say ##,##,###) and I want to do it on the fly, ie when user enter each digit(not when enter is pressed). I googled around, and came across TextWatcher which I first found promising, but it turned out to be an absolute pain. I am debugging my code on a HTC Desire phone which only has a soft keyboard. Now I want to get a callback when user press