formatting

How to format an XML with closing nodes and tags on a new line?

I'm modifying some .vcrpoj files in .NET but when I save them the formatting changes (which wrecks havoc with my diff tool), the original files look like this: <VisualStudioProject ProjectType="Visual C++" Version="8.00" > <Platforms> <Platform Name="Win32" /> </Platforms> <ToolFiles> </ToolFiles> But when I save the changes it lo...

WPF: fast way to apply formatting to RichTextBox

I'm trying to display basic syntax highlighting in a WPF RichTextBox. It mostly works, but the rendering performance is awful. First I naively tried: /// <summary> /// Main event handler for syntax highlighting. /// </summary> private void XmlChanged(object sender, TextChangedEventArgs e) { VM.Dirty = true; if (VM.Pretty) ...

Forcing "+0000" timezone for RFC2822 times in Ruby

How can I force the Time.rfc2822 function to spit out +0000? Ruby lets me parse RFC2822 formatted times pretty easily: require 'time' time = Time.parse('14 Aug 2009 09:28:32 +0000') puts time => "2009-08-14 05:28:32 -0400" But what about displaying times? Notice that the time it parsed is a local time. No worries, I can convert it ...

Why doesn't DateTime.ToShortTimeString() respect the Short Time format in "Regional and Language Settings"?

I have run into an issue that is probably due to my mis-understanding of how the DateTime.ToShortTimeString() method works. When formatting time strings with this function, I was assuming that it would respect the "Short Time" setting in Windows 7's Format settings Control Panel -> Clock, Language and Region -> Region and Language -> Fo...

How to move headings aside each other?

<h5>Category</h5><h6>auto</h6> and result: Category auto how do that: Category auto Sorry if my English is not perfect, I'm not a native. Thank you for your help. ...

Zend_PDF text formatting

Hi, I use Zend Framework for my project. And my question is how can I convert html text like "helloworld" into PDF text to be the same using Zend_PDF ? Thx. ...

How to implement scoped iostream formatting?

I'd like to scope-limit the effect of I/O stream formatting in C++, so that I can do something like this: std::cout << std::hex << ... if (some_condition) { scoped_iofmt localized(std::cout); std::cout << std::oct << ... } // outside the block, we're now back to hex so that base, precision, fill, etc. are restored to their previo...

How do I indent my code in Emacs by 4 spaces intead of 2 for a bunch of files?

What is a more sane, automatic solution to tabbing my code by 4 spaces for a bunch of files? How do I make sure that tabify does not affect perldoc? ...

C++ inline String formatting and numeric conversion

Hello all, C# has a nice static method String.Format(string, params string[]); that returns a new string with the formatting and values that are provided. Is there an equivalent in C++? The reason is because I'm using log4cxx and want to take advantage of the macros like LOG4CXX_DEBUG( logger, expr ); that uses short-circuit ev...

formatting dates in Grails

I have a domain class in Grails with a field journeyDate. journeyDate is defined like this:- Date journeyDate then in my list.gsp I display the date like this:- ${fieldValue(bean:journeyInstance, field:'journeyDate')} And it is displayed in the following format:- 2009-08-19 17:12:00.0 does anyone know how I can format this on the l...

How do you change the style of a text box? (HTML / CSS)

How do you change the style of a text box from the default. For instance, so it looks like: or instead of: ...

What is the correct way to format SPGridView values being displayed?

Hello. Problem As we know, SharePoint saves data in database in plain text. Some fields even have concatenated strings like <id>;#<value> for user fields. Percents are saved as doubles (1.00000000000000 for 100%) and etc. Ofcourse, I want to display data as they are displayed in lists. What should I do? Should I use derived SPBoundF...

Is there a standard or guideline for creating XML files?

I’m curious if there is standard or guideline for determining what types of things should be attributes vs elements within the xml file. I’m also curious about creating xmlarray and xmlarrayitem lists using XMLSerializer. For example if I have the following: <SomeBaseTag> <Item1 Attr11=”one” Attr12=”two” /> <Item1 Attr11=”one” A...

Python String Formatting And String Multiplication Oddity

Python is doing string multiplication where I would expect it to do numeric multiplication, and I don't know why. >>> print('%d' % 2 * 4) 2222 >>> print('%d' % (2 * 4)) 8 Even forcing the type to integer does nothing. (I realize this is redundant, but it's an idiot-check for me: >>> print('%d' % int(2) * int(4)) 2222 Obviously I ...

Citation formatting and the hyperref package

I'm using the hyperref package in my document. One of the things that it does is create bookmarks in my pdf, based on the table of contents. Some section titles contain a reference to a citation \section{Some title \citep{BibTeXkey}} The label of the bookmark then looks like Some title BibTeXkey But I would like it to be Some tit...

Line-breaking algorithm

Where can I find an efficient algorithm for breaking lines of text for formatted display? ...

TinyMCE - Can't get CODE option in Format Menu to do anything

TinyMCE docs have this example for setting up the format menu. Most of these options (h1, h2...blockquote, etc) are working for me, but for some reason, selecting the CODE option from the drop down menu does nothing. Whereas selecting BLOCKQUOTE does what you'd expect, wraps the blockquote tag around the selected text. Anyone know how ...

Change wrap width in a text file using Vim

I want to format srt subtitle text files to avoid wrapping problems on my media player. I need to set a line wrap width to a number of characters e.g. 43 I can do this with Editplus, its a built in function and works well. The reason I want to do it in Vim, firstly Editplus is only available on the PC and the secondly Vim is badass. ...

Render a string[] as a series of editable controls?

I have a string[] containing individual words parsed out of a paragraph of text. I need to display each word in its own cell, and have each cell be assigned a dynamic width based on the word's length. I want to be able to have as many words as possible within the maximum width of each row. In short, I'm trying to take a given parag...

RegEx to modify urls in htmlText as3

Hi, I have some html text that I set into a TextField in flash. I want to highlight links ( either in a different colour, either just by using underline and make sure the link target is set to "_blank". I am really bad at RegEx. I found a handy expression on RegExr : </?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)/?> b...