formatting

How to format hash-based parameters in the URL when creating Blueprint API doc?

青春壹個敷衍的年華 提交于 2020-01-14 06:21:07
问题 With the Rails Way of adding hashes in the parameter of an URL like so: http://api.example.com?person[first]=Jane&person[last]=Doe&person[email]=jane@doe.com How do I format the API Blueprint doc to accommodate a list of available hashes? Parameters person[first] (required, string, Jane ) ... First name This is not legal when I execute the document. Any ideas or tips are welcome! 回答1: Per https://tools.ietf.org/html/rfc3986#section-3.2.2, you must escape [] in URIs. As such, you need to do:

MySQL Weekday/Weekend count - Part II

不羁的心 提交于 2020-01-14 05:49:14
问题 I have posted about this before, which helped to give me the following SQL: SELECT fname, MONTH( eventDate ) , IF( WEEKDAY( eventDate ) <5, 'weekday', 'weekend' ) AS DAY , COUNT( * ) FROM eventcal AS e LEFT JOIN users AS u ON e.primary = u.username GROUP BY fname, MONTH( eventDate ) , IF( WEEKDAY( eventDate ) <5, 'weekday', 'weekend' ) ; And that gives me the following results: fname MONTH( eventDate ) DAY COUNT( * ) Kevin 7 weekday 3 Kevin 7 weekend 1 Missy 7 weekday 3 Missy 7 weekend 1 I'm

AutoFilter DateTime values - Local decimal point issue

杀马特。学长 韩版系。学妹 提交于 2020-01-13 18:13:11
问题 Background While I was trying to solve a problem for another user I ran into, seemingly, a local issue. Imagine some very simple sample data (being true date-time values): | DateTimeVals | |----------------| | 1-1-2019 01:00 | | 2-1-2019 01:00 | | 3-1-2019 01:00 | | 4-1-2019 01:00 | | 5-1-2019 01:00 | It doesn't need to be more complicated to show you the issue at hand. Let's imagine we would want to filter on 3-1-2019 01:00 (3rd of Jan). Simply using: Range("A1").AutoFilter Field:=1,

Output/Print a “readable” dictionary

可紊 提交于 2020-01-13 17:04:54
问题 I am preparing an api, and using docstrings as documentation. An api service selects the related ApiClass methods and join each docstring to create the documentation. This way, both program developers and users of the api reached the same documentation. My class structure is like: API_STATUS = { 1: 'some status', 2: 'some other status message' } class MyApi: def __init__(self): blah blah blah def ApiService1(self, some_param): """ here is the documentation * some thing * some other thing keep

Currency symbol with another number format

元气小坏坏 提交于 2020-01-13 11:19:28
问题 I was wondering if there was an elegant way to set the currency format of a number in one way but keep the actual number formatting in another. It is Java. Essentially I am doing this NumberFormat format = NumberFormat.getCurrencyInstance(locale); This is largely fine except I am writing a system for UK based users and my users are upset that when showing (for example) euros the number is formatted as europeans would use it. So € 500,000 as a UK person would write it is displaying as € 500

How to left-pad an integer with spaces?

本小妞迷上赌 提交于 2020-01-13 09:16:33
问题 How to format an Integer value without leading zero? I tried using decimal format but I can't achieve exact result: DecimalFormat dFormat=new DecimalFormat("000"); mTotalNoCallsLbl.setText(""+dFormat.format(mTotalNoOfCallsCount)); mTotalNoOfSmsLbl.setText(""+dFormat.format(mTotalNoOfSmsCount)); mSelectedNoOfCallsLbl.setText(""+dFormat.format(mSelectedNoOfCallLogsCount)); mSelectedNoOfSmsLbl.setText(""+dFormat.format(mSelectedNoOfSmsCount)); I'm getting these output : 500 004 011 234 but I

Format date in String Template email

前提是你 提交于 2020-01-13 09:08:13
问题 I'm creating an email using String Template but when I print out a date, it prints out the full date (eg. Wed Apr 28 10:51:37 BST 2010). I'd like to print it out in the format dd/mm/yyyy but don't know how to format this in the .st file. I can't modify the date individually (using java's simpleDateFormatter) because I iterate over a collection of objects with dates. Is there a way to format the date in the .st email template? 回答1: Use additional renderers like this: internal class

Linq 2 Sql DateTime format to string yyyy-MM-dd

耗尽温柔 提交于 2020-01-13 08:10:42
问题 Basically, i need the equivalent of T-SQL CONVERT(NVARCHAR(10), datevalue, 126) I've tried: from t in ctx.table select t.Date.ToString("yyyy-MM-dd") but it throws not supported exception from t in ctx.table select "" + t.Date.Year + "-" + t.Date.Month + "-" + t.Date.Day but i don't think it's an usable solution, because i might need to be able to change the format. The only option I see is to use Convert.ToString(t.Date, FormatProvider) , but i need a format provider, and I'm not sure it

How do I apply a custom format such as “Text:” 0.0% in Excel VBA

夙愿已清 提交于 2020-01-13 05:49:11
问题 I would like Excel VBA to write either a number or a percentage, depending upon a user control. In Excel, I can hit Ctrl 1 to apply a custom format such as "Text:" 0.0% or "Text:" 0.0. I have managed to write the text and then use either Format() or Round(), depending upon the control value. However, Format has two decimal places, and I would like a single decimal place. Here is some illustrative code. As stated above, I would like to have control over the number of decimal places for the

Formatted output in OpenOffice/Microsoft Word with Python

让人想犯罪 __ 提交于 2020-01-12 19:29:41
问题 I am working on a project (in Python) that needs formatted, editable output. Since the end-user isn't going to be technically proficient, the output needs to be in a word processor editable format. The formatting is complex (bullet points, paragraphs, bold face, etc). Is there a way to generate such a report using Python? I feel like there should be a way to do this using Microsoft Word/OpenOffice templates and Python, but I can't find anything advanced enough to get good formatting. Any