formatting

Alert Dialog with a numeric EditText field

ⅰ亾dé卋堺 提交于 2019-12-12 16:26:03
问题 I am alerting the user with and alert dialog box that has an EditText field. AlertDialog.Builder alert = new AlertDialog.Builder(this); db.open(); Cursor f = db.getTitle(position + 1); alert.setTitle("Age"); alert.setMessage("New age?"); // Set an EditText view to get user input final EditText input = new EditText(this); alert.setView(input); input.setText(f.getString(3)); db.close(); alert.setPositiveButton("Change", new DialogInterface.OnClickListener() { public void onClick(DialogInterface

XML writer with custom formatting

旧巷老猫 提交于 2019-12-12 16:02:02
问题 I need to create a human-readable XML file. XmlWriter seems to be almost perfect for this, but I'd like to insert line breaks or, in general, custom whitespace where I want them. Neither WriteRaw nor WriteWhitespace seem to work between the attributes in an element. The latter looks like it should work ( This method is used to manually format your document ), but throws InvalidOperationException ( Token StartAttribute in state Element Content would result in an invalid XML document ) if used

JQGrid Date Formatting

拟墨画扇 提交于 2019-12-12 13:36:19
问题 I am using the jQuery JQGrid plug-in, version 3.8.2 and am having trouble trying to figure out how to format a date/time for display. The date/time comes in ISO long format, i.e. 2011-02-16T14:46:43Z. I want it shown in mm/dd/yy H:m:s format. Here is my current code, which does not work: currOption.formatoptions = { srcformat: 'Y-m-dQH:i:sZ', newformat: 'm/d/Y g:i A' }; Note that I have a "Q" in there because if I use "T", it blows up (which makes sense, as "T" has meaning in PHP date

Linux automated code formatting (PHP, JavaScript, HTML, CSS, MySQL)

帅比萌擦擦* 提交于 2019-12-12 13:07:31
问题 I am seeking a Linux or PHP program to automate code formatting. Optimally it would handle many languages, but the priority is (highest first): PHP, JavaScript, HTML, CSS and MySQL. Comparability is nice, but not the most important feature. Context / use: automation via Subversion post-commit. I'm working with teams and want to always follow a single method of formatting. 回答1: Astyle is the canonical answer if you insist on just one. You likely cannot get a single formatter for many langauges

Erlang: How to transform a decimale into a Hex string filled with zeros

你离开我真会死。 提交于 2019-12-12 13:04:34
问题 I would like to transform 42 (Base 10) into 000002A (Base 16) in Erlang... I have found some pointers on the web : io:format("~8..0B~n", [42]) -> 00000042 And io:format("~.16B~n", [42]) -> 2A But I cannot seems to find how to do both at the same time, I have tried : io:format("~8..0.16B~n", [42]) Which seemed to be the logical thing, but it is not, it gives me an error. Thanks. 回答1: io:format("~8.16.0B~n", [42]). 0000002A basically, it's ~F.P.Pad where: F = field width P = precsion Pad = pad

VBA Named Range most efficient way to check if name exists

对着背影说爱祢 提交于 2019-12-12 12:50:26
问题 I have a routine, that fills a calendar with all important events for the commodity markets for each day of the following week. I have a calendar grid laid out on the page and have ten named cells for each day i.e. Monday1, Monday2 and so on (each day only goes up to 10 for now, i.e.Monday10), in each days column. BTW the cells are 2 cells wide and 2 cells deep. Many times there are more than 10 events for a given day. I am trying to test for the named range to see if it exists, if not copy

How to set a custom thousands separator?

一个人想着一个人 提交于 2019-12-12 12:32:00
问题 I know that theoretically digits in large integers can be grouped by thousands for better readability: Python 3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import locale >>> locale.setlocale(locale.LC_ALL, 'en_US.UTF-8') 'en_US.UTF-8' >>> locale.format('%d', 1234567890, grouping=True) '1,234,567,890' >>> "{:n}".format(1234567890) '1,234,567,890' However, surprisingly, this won’t work for every

Output text/numbers in MATLAB but overwrite same line in command window

♀尐吖头ヾ 提交于 2019-12-12 12:26:35
问题 So I have a for-loop, and at every iteration, I would like to display formatted text, along with some numbers. Normally one could use disp or fprintf I suppose, but what I want to do, is have the same part of the command window output the text/numbers, just overwriting the old output. How might I be able to do that? I have seen it in some other programs so I know it is possible, but not how. As an example, lets say on the first iteration of a for-loop, I want this to be output on the command

matplotlib: formatting of timestamp on x-axis

戏子无情 提交于 2019-12-12 12:15:21
问题 I'm trying to format the x-axis in my weather data plot. I'm happy with the y-axis but all my tries to get the x-axis into a decent, human-readable format didn't work so far. So after several hours of trial and error I hope for your help. What I'm trying to achieve In the end I would like to have tick marks every 30 minutes, a vertical dotted grid line every hour with the time written as HH:MM beneath it and additionally the date written every night at 00:00 hours. Something like this

PHP Tag Removes Last Newline in Document

自作多情 提交于 2019-12-12 12:13:06
问题 This issue is purely in the interest of having tidy HTML code output. In a simple PHP file, you can choose when to have PHP embedded in the document by using the tags. However, it appears that when this tag is used directly above a regular HTML element, the newline separating the two is apparently removed or ignored. Observe the following code in PHP <div> <?php echo "This is some extra text." ?> </div> The output is as follows <div> This is some extra text.</div> However, if I add something