formatting

Any SQL formatter plugin for Eclipse avaialble?

倖福魔咒の 提交于 2019-12-12 09:42:25
问题 I am not finding any standard open source sql formatter eclipse plugin on net. I am using eclipse helios. I can find Edit-->FormatSQL but that does not seems to be working. Found one at http://ventralnet.blogspot.in/2010/11/sql-beautifier-eclipse-plugin.html but formatting is not good. Any suggestion will be helpful. For info I am using sqlserver sql scripts. 回答1: Some of my favorites are: Eclipse SQL Explorer at: http://eclipsesql.sourceforge.net DBViewer at: http://www.ne.jp/asahi/zigen

Pad a number with starting zero in .Net

被刻印的时光 ゝ 提交于 2019-12-12 09:28:34
问题 I have a requirement to pad all single digits numbers with a starting zero. Can some one please suggest the best method? (ex 1 -> 01, 2 -> 02, etc) 回答1: I'd call .ToString on the numbers, providing a format string which requires two digits, as below: int number = 1; string paddedNumber = number.ToString("00"); If it's part of a larger string, you can use the format string within a placeholder: string result = string.Format("{0:00} minutes remaining", number); 回答2: number.ToString().PadLeft(2,

Objective-C - How To Remove Characters From a String?

試著忘記壹切 提交于 2019-12-12 09:16:15
问题 I have a UILabel that has a formatted String (formatted for currency), so there is a dollar sign, $21.34. In the core data entity the attribute is of a type double, I am using an NSDecimalNumber to save to the database. self.purchase.name = self.nameTextField.text; NSString *string = self.amountLabel.text NSDecimalNumber *newAmount = [[NSDecimalNumber alloc] initWithString:string]; NSLog(@"%@", string); // THIS RETURNS NaN, because of dollar sign i think NSManagedObjectContext *context = self

Auto-indent HTML Code and Display It

喜你入骨 提交于 2019-12-12 09:10:32
问题 When displaying HTML code in PHP, if I want to indent tags what would be the best way? For example, <?php $html = '<div><p><span>some text</span></p></div>'; echo htmlspecialchars($html); ?> will give <div><p><span>some text</span</p></div> . Instead, I'd like to show something like, <div> <p> <span>some text</span> </p> </div> 回答1: You can use htmLawed http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/ this would be your code: <?php require("htmLawed/htmLawed.php"); echo "

BBCode for Ruby on Rails

纵饮孤独 提交于 2019-12-12 08:55:18
问题 So I'm putting together a simple forum. I'd like to allow my users limited formatting options and BBCode would be plenty for my users. Knowing that I'm assuredly not the first one to want to use BBCode with RoR I googled but couldn't find a straight forward tutorial on how to create a editor which accepts BBCode nor a way to parse and display BBCode formatted input. Any help or guides would be appreciated! 回答1: You should give bb-ruby a try. Its documentation on the web page seems to be very

bash string to date

六眼飞鱼酱① 提交于 2019-12-12 08:53:26
问题 Is there an opportunity to convert a string into a date in bash? For example: I have a time format: "%Y-%m-%dS%H:%M:%S" . An example of such string is "2009-06-24S12:34:56" . I need to convert this string into a date (unix timestamp) in bash. How can I do this? 回答1: Use date --utc --date "<input string>" +%s 来源: https://stackoverflow.com/questions/1253828/bash-string-to-date

How do you do tab stops in HTML/CSS

此生再无相见时 提交于 2019-12-12 08:31:44
问题 There is some text whose formatting I would like to render in HTML. Here is an image: Note the gray lines with the bullet points and the paragraph numbers. The bullets should be centered on the page and the numbers should be justified right. I've been trying to think of how to do this in HTML and am coming up blank. How would you capture this formatting? 回答1: You can use the :before and :after psuedo-elements to great effect here: http://jsfiddle.net/yNnv4/1/ This will work in all modern

Visual Studio 2010 insists on inserting spaces in JavaScript

末鹿安然 提交于 2019-12-12 08:26:14
问题 Visual Studio 2010 inserts a space between the keyword "function" and the following parenthesis. Is it possible to turn this off? i.e. Visual Studio formats my code like: var vsfn = function () { }; I would like this formatting: var myfn = function() {}; 回答1: VS2010 sp1 introduced a new option: Insert space after function keyword for anonymous functions in Tools > Options > Text Editor > JScript > Formatting > Spacing . You can turn it off to get the desired behavior. 回答2: You should find

Visual Studio changing the way Ctrl-K-D works

强颜欢笑 提交于 2019-12-12 08:23:32
问题 In Visual Studio (I'm using 2012), is there any way of editing the way that Ctrl - K - D combinations handles its Auto-Formatting ? I don't mean changing what these key combinations do, I mean extending the way the auto-formatting is done . The way it handles tabbing , etc are fine, I'm more concerned with white-space . We're using a plugin that makes it easy to align variable properties, making them easy to read. Like so: var test = 'whatever', another = 'this one', alignedProperly = 'yay';

UNIX stat time format

旧时模样 提交于 2019-12-12 07:48:46
问题 Is it possible to format the time output of stat? I am using stat -c '%n %A %z' $filename in a bash script, but its time format is not what I want. Is it possible to change this format in the command, or would I have to manually do it later? An example output follows: /lib drwxr-xr-x 2010-11-15 04:02:38.000000000 -0800 回答1: You could try something like: date -d "1970-01-01 + $(stat -c '%Z' $filename ) secs" Which gives you only the date. You can format the date using date's formatting options