formatting

How to pprint a clojure file?

百般思念 提交于 2019-12-12 04:34:42
问题 I want to be able to format an entire clojure file to look nice. The nicest thing I have found is clojures pprint. It does indentation and line breaks at correct locations. However it can only read clojure litterals. Clojure files are read in as strings. read-string will only take the first parenthesis of a string. Mapping read-string over the whole sequence has a host of issues I am running into. Does someone know of an automatic way to make a clojure file look pretty? Not just indent it

How can I Format Width in puttime?

主宰稳场 提交于 2019-12-12 04:31:05
问题 Let's say that I want to print something simple like this table: January 1 February 2 March 3 April 4 May 5 June 6 July 7 August 8 September 9 October 10 November 11 December 12 I'd like to accomplish this like: for(tm i{ 0, 0, 0, 1, 0 }; i.tm_mon < 12; ++i.tm_mon) cout << put_time(&i, "%-9B") << i.tm_mon + 1 << endl; Unfortunately puttime doesn't seem to allow me to use field flags in it's format fields. Additionally this puttime doesn't seem to play nice with setw . Is my only option to do

Printing mountain ranges algorithm

风格不统一 提交于 2019-12-12 03:56:21
问题 /\ / \ / \ /\/\ / \ /\ /\/ \ /\ / \/\ /\/\/\ for n=3 pairs of ups and downs I have 5 possible way to draw these mountains.(I should never go below the x=0 axis). I have the following long javascript code which works fine when I print these outputs in the console of the browser.However when I try to output them as html the ups and downs are not correctly aligned. Here is my Code: <html> <script> F=n=> { m = n+n outer: for (i=1; i < 1<<m; i+=2) { o=[] l=0; p=1; for (j = 1; j <1<<m; j+=j,p++) {

how to build a better looking XML with XStream in Java?

六月ゝ 毕业季﹏ 提交于 2019-12-12 03:56:20
问题 I've created a main() method in a class to test the construction of a XML file. public static void main(String[] args) { createXmlEmail(); } And this is the method that builds the XML file. private static void createXmlEmail() { XStream xstream = new XStream(new DomDriver()); xstream.setMode(XStream.NO_REFERENCES); xstream.alias("email", EmailPojo.class); xstream.alias("recipient", Recipient.class); EmailPojo ep = new EmailPojo(); List<Recipient> toRecipient = new ArrayList<Recipient>();

How to Change the Date formatting with jQuery UI Datepicker and Rails?

ε祈祈猫儿з 提交于 2019-12-12 03:55:55
问题 I can't believe how complicated the date picker can be. I have looked at various questions on Stackoverflow, but can't get the formatting to work. I used the Railscasts #213 Calendars (revised) to set up the jQuery Datepicker. Here in South Africa we use the dd/mm/yyyy formating and not the mm/dd/yyyy formatting as everyone says. First problem is when I pick the date it shows up on the form as mm/dd/yyyy. I can't change this - tried changing the Coffee Script, but that doesn't do anything:

How to enable page numbers without affecting footers/headers

我只是一个虾纸丫 提交于 2019-12-12 03:52:32
问题 I am trying to put page numbers on the right hand side on the bottom of the page, but it keeps moving the text of the footer making it off center. Anyone know how to keep this from happening? Also, does anyone know how to enable total pages like 3/4. Any help would be appreciated. Here's what I have so far: .ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).range.Paragraphs.Alignment = wdAlignParagraphCenter 'Centers Header' .ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary)

New page within chapter in iText

南笙酒味 提交于 2019-12-12 03:44:14
问题 I have a large chapter containing several sections. I need to split one section content to make it more pretty and readable. I tried to use setPageEmpty(false) and newPage() before expected page break but the page doesn't breaks: Document doc = new Document(); PdfWriter writer = PdfWriter.getInstance(doc, new FileOutputStream(filename)); writer.setPageEvent(new PageEventHandler(doc)); doc.open(); Chapter chapter = new ChapterAutoNumber("Main info"); chapter.add(new Paragraph("Lorem ipsum

How to format the userId in Google Analytics script?

戏子无情 提交于 2019-12-12 03:39:29
问题 for my static HTML webside I embedded this recommended script code to every page of the side. <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-96597161-1', 'auto'); ga('send', 'pageview'); ga('set',

Global VBA date format and decimal separator

此生再无相见时 提交于 2019-12-12 03:37:54
问题 Is there a way to change VBA settings globally on PC to accept dates and number on a specified format? (on my case dd/mm/yyyy and comma) Changing Excel settings doesn't solve it for me. As an small time VBA developer, I'm mostly creating userforms for data input and validation. Alongside with some basic access privileges, It keeps users (mostly an client's hired arms) from nosing on the database and corrupting it. But, on form's submitting, the textbox values are saved temporally on

VBA for changing multiple cell formats - stop values from repeating

£可爱£侵袭症+ 提交于 2019-12-12 03:37:37
问题 A previous problem I posed to the group was solved thanks to Vincent G's help. To summarize, I have written some VBA which identifies cells formatted general like "<0" (with the symbol "<" as part of the cell value), and the VBA will change the format to a numerical format (with the "<" as part of the format) with the same number of decimal places as the original value (e.g., "<0.564" general will be changed to "< 0.564" numerical). This code worked on a small set of test data, but when