formatting

How do I autoformat some Python code to be correctly formatted?

I have some existing code which isn't formatted consistently -- sometimes two spaces are used for indent, sometimes four, and so on. The code itself is correct and well-tested, but the formatting is awful. Is there a place online where I can simply paste a snippet of Python code and have it be indented/formatted automatically for me? Al...

Reading numeric Date value from CSV file to data.frame in "R"

> D <- read.csv("sample1.csv", header = FALSE, sep = ",") > D V1 V2 V3 V4 1 20100316 109825 352120 239065 2 20100317 108625 352020 239000 3 20100318 109125 352324 241065 > D[,1] [1] 20100316 20100317 20100318 In the above example how do I get the data in D[,1] to be read, and stored as date values: 2010-03-16, 201...

Yet another date formatting problem :(

Hi folks, I seem to have a date formatting problem every day! I am querying a table and am getting a date back in the format dd/mm/yyyy (as a string btw). Brilliant! thats what I want. But, now I want to convert that string to a date so i can do dim dayNumber as integer = day.DayOfWeek But when I convert it to a date it changes it ...

Underlining text in UIButton

Hi, Can anyone help me out in underlining the title of the UIButton. I have a UIButton of Custom type, and i want the Title to be underlined, but the Interface Builder does not provide any option to do so. In Interface Builder when you select the Font Option for a Button, it provides option to select None, Single, Double, Color but no...

how to show rich formatted text in textarea

hello, I have a form that uses Richtexteditor of Flex3 to write in their reply. The reply is then posted to a textarea, where all of the formatting is lost! I have embedded the font since I was doing some tweeening on the text boxes. I need to find out how keep the formatting intact in the textarea from richtexteditor! has anybody an id...

LaTeX - Changing the font size for a document, but in the preamble, not the document class?

I have a LaTeX document. I want to change the font size of all the text, to make it smaller. Normally I would just change the documentclass part. However I am generating LaTeX files from another programme, and it is setting the documentclass, I can't change that. However I can put things in the preamble. Is there anyway to change the f...

Python string formatting too slow

I use the following code to log a map, it is fast when it only contains zeroes, but as soon as there is actual data in the map it becomes unbearably slow... Is there any way to do this faster? log_file = open('testfile', 'w') for i, x in ((i, start + i * interval) for i in range(length)): log_file.write('%-5d %8.3f %13g %13g %13g %1...

SSRS Tablix Header Row Formatting

I've got several reports and they have been built with various formatting. Nothing huge just the header row is different between them. I'd like to pick a standard and just update the reports so they all look the same. This can be done on a textbox by textbox basis - setting the font, font color, font size and background color. It see...

Formatting Controls in ASP.NET

I feel as though this this is a simple question, but can't find an answer anywhere. We've got an interface we're trying to move to an ASP.NET control. It currently looks like: <link rel=""stylesheet"" type=""text/css"" href=""/Layout/CaptchaLayout.css"" /> <script type=""text/javascript"" src=""../../Scripts/vcaptcha_control.js""></sc...

How do you print a limited number of characters?

Sorry to put a post up about something so simple, but I don't see what I'm doing wrong here. char data[1024]; DWORD numRead; ReadFile(handle, data, 1024, &numRead, NULL); if (numRead > 0) printf(data, "%.5s"); My intention with the above is to read data from a file, and then only print out 5 characters. However, it prints out al...

Java's equivalence to Python's "Got value: %s" % variable?

Java's equivalence to Python's "Got value: %s" % variable? ...

Convert 2010-04-16 16:30:00 to "Tomorrow Afternoon".

Convert 2010-04-16 16:30:00 to "Tomorrow Afternoon" or convert another date to "this afternoon", "next year", "next week wednesday". You get the picture. Anyone know of a PHP or Javascript library that can do this? ...

Why would LaTeX ignore the font size in the documentclass

I have a LaTeX file. I'm experimenting with trying to reduce the font size (this is related to my other question here http://stackoverflow.com/questions/2636647/latex-changing-the-font-size-for-a-document-but-in-the-preamble-not-the-docum ). The LaTeX file is generated from another programme. I have edited it to start with \documentcla...

Access Expression problem: it's too complex, so how do I turn it in to a function?

Access 2007 is telling me that my new expression is to complex. It used to work when we had 10 service levels, but now we have 19! Great! I've asked this question in SuperUser and someone suggested I try it over here. Suggestions are I turn it in to a function - but I'm not sure where to begin and what the function would look like. My e...

Delphi DateTimeFormat returning wrong year

I have a form that allows users to enter a date of birth: ie: 4/16/40 Then when the user processes the form there's a function that checks it's length, adds leading zeros, parses the date and then uses FormatDateTime to just return the year of birth: strTemp := strPostedByDOB; If Length(strTemp) = 5 then strTemp = '0' + strTemp; if...

Floated Child Elements: overflow:hidden or clear:both?

As a web developer I frequently will have two floated (child) divs inside of another (parent) div. Actually I do this all day long. <style type="text/css"> #left {float:left;} #right {float:right;} </style> <div id="parent"> <div id="left" class="child">&nbsp;</div> <div id="right" class="child">&nbsp;</div> </div> Thi...

CodeIgniter: Where should a particular functionality go ?

Here is a quick overview of the controllers functionality in most of the application: controller loads a specific model, gets data from it, formats the data and passes the formatted data to the view. Now there is a search page, which needs to do a search query over entire database (all models). It needs to show each type of data in i...

RegEx to ignore / skip everything in html tags

Looking for a way to combine two Regular Expressions. One to catch the urls and the other to ensure is skips text within html tags. See sample text below functions. Need to pass a block of news text and format text by wrapping urls and email addresses in html tags so users don't have to. The below code works great until there are alread...

Python: Convert format string to regular expression

The users of my app can configure the layout of certain files via a format string. For example, the config value the user specifies might be: layout = '%(group)s/foo-%(locale)s/file.txt' I now need to find all such files that already exist. This seems easy enough using the glob module: glob_pattern = layout % {'group': '*', 'locale'...

How to format TSQL SELECT output in SQL Sever

How to loop through a select statement results to have a formatted text? for example the select is like: select name from table and we want a variable @names like this: "name1,name2,name3" Database is SQL Server 2005 ...