formatting

JSON formatting adding \ characters when I append file, but not to string in output

妖精的绣舞 提交于 2019-12-20 04:22:49
问题 I am using the following function to get json from the flickr API . The string it returns is a properly formatted chunk of JSON: def get_photo_data(photo_id): para = {} para["photo_id"] = photo_id para["method"] = "flickr.photos.getInfo" para["format"] = "json" para["api_key"] = FLICKR_KEY request_data = params_unique_combination("https://api.flickr.com/services/rest/", para) if request_data in CACHE_DICTION: return CACHE_DICTION[request_data] else: response = requests.get("https://api.flickr

JTextField time in HH:mm:ss

拥有回忆 提交于 2019-12-20 03:21:54
问题 I have the estimated time the it would take for a particular task in minutes in a float. How can I put this in a JFormattedTextField in the format of HH:mm:ss ? 回答1: JFormattedTextField accepts a Format object - you could thus pass a DateFormat that you get by calling DateFormat#getTimeInstance(). You might also use a SimpleDateFormat with HH:mm:ss as the format string. See also: http://download.oracle.com/javase/tutorial/uiswing/components/formattedtextfield.html#format If you're not

How can i get the cell value from jqGrid column to do conditional formatting for backcolor

ε祈祈猫儿з 提交于 2019-12-20 02:38:18
问题 i am using jqGrid treegrid and i want to format the back color of columns based on the value of the data in the cell (its an integer): Here is an example where I setup the column: { name: 'missingBooks', cellattr: function (rowId, tv, rawObject, cm, rdata) { //conditional formatting if (rawObject[11] > 0) { return 'style="background-color:#FFCCCC"'; } }, width: 75, unformat: originalValueUnFormatter, formatter: missingBooksFormatter, align: "right", index: 'missingBooks', hidden: false,

SQL Server Date Formats — ddd

随声附和 提交于 2019-12-20 01:38:30
问题 How do I get the day of the week (in ddd format, so Mon, Tue etc.) in SQL ? I don't see anything about it in the CAST and CONVERT documentation.. 回答1: Many ways to do it, here's one way: SELECT LEFT(DATENAME(dw, GETDATE()), 3) 回答2: You could use the DATENAME method to extract the day and then use the SUBSTRING to only take the first 3 chars. SELECT SUBSTRING(DATENAME(DW, '09/11/2009'), 1, 3) 回答3: I would use SELECT CONVERT(CHAR(3),DATENAME(weekday,GETDATE())) so as to avoid using another

Python numbers formatting [duplicate]

杀马特。学长 韩版系。学妹 提交于 2019-12-20 01:09:58
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: String formatting options: pros and cons What's the difference between "%.2f" % x and "{:.2f}".format(x) I am a bit confused about which method should I use and for which version of Python. 回答1: In general you want to use the 2nd form ( .format() ) it's newer and the other one will eventually go away (at least that was the intention at some point - see Notes below). To quote the Python What’s New In Python 3.0

P text added to html text

ぐ巨炮叔叔 提交于 2019-12-19 23:25:15
问题 I know there are a lot of topics on this, and I've already looked at all them and none of the solutions there apply to me. I've put a shortcode to run a jscript for a responsive slider in the 'text' side of my page editor. Yet when I load the page, the source code has tons of paragraph tags after every line of the javascript. It even has a paragraph tag before it even asks for the content itself. I've tried editing the functions.php file of my theme (Reason 2.0), but I'm not sure I could mark

Converting time difference to a given format in Oracle

送分小仙女□ 提交于 2019-12-19 17:39:27
问题 How do I convert EVENT_DATE_B - EVENT_DATE_A which is a number of days to string with HH:MM format? 回答1: If dates are differ only in time part you can use interval day to second. For instance: SQL> select (to_date('25.12.12 15:37:32', 'DD.MM.YY HH24:MI:SS') 2 - to_date('25.12.12 12:45:45', 'DD.MM.YY HH24:MI:SS')) day(0) to second(0) as Time 3 from dual 4 ; TIME ------------- +0 02:51:47 But obviously it will not always be the case. So you could write a long query to calculate different parts

Copy a rows contents and formatting (to another sheet)

南楼画角 提交于 2019-12-19 17:30:24
问题 What do I want is to copy an entire row's contents and formatting to another sheet. At the moment I've had to settle for setting the old cells contents to the new cells contents and in doing so it only copies the contents and not the formatting. (my cells have different colours that need to be carried across) At the moment I have the following: (this works fine for cells in the same sheet) Range(Cells(45, 2), Cells(45, 3)).Copy Range(Cells(50, 2), Cells(50, 3)) However, I'm trying to do it

Copy a rows contents and formatting (to another sheet)

房东的猫 提交于 2019-12-19 17:29:09
问题 What do I want is to copy an entire row's contents and formatting to another sheet. At the moment I've had to settle for setting the old cells contents to the new cells contents and in doing so it only copies the contents and not the formatting. (my cells have different colours that need to be carried across) At the moment I have the following: (this works fine for cells in the same sheet) Range(Cells(45, 2), Cells(45, 3)).Copy Range(Cells(50, 2), Cells(50, 3)) However, I'm trying to do it

ColdFusion - Create Time from Number of Minutes

醉酒当歌 提交于 2019-12-19 16:47:26
问题 I have the number of minutes (ie. 25, 120, 300, etc) entered by the user, and I need to display it in a h:mm:ss format. Are there any built-in ColdFusion functions that can do this for me, or does anyone have any suggestions about the easiest way to build out the string? 回答1: <cfset totaltime = "#totalminutes\60#:#numberformat(totalminutes % 60, "00")#:00" /> 回答2: Kinda late to the game, but this works pretty nicely: TimeFormat(CreateTimeSpan(0,0,minutes,0)) 来源: https://stackoverflow.com