formatting

How to format GPS latitude and longitude?

倾然丶 夕夏残阳落幕 提交于 2020-01-22 17:42:23
问题 In android(java) when you get the current latitude and longitude using the function getlatitude() etc you get the coordinates in decimal format: latitude: 24.3454523 longitude: 10.123450 I want to get this into degrees and decimal minutes to look something like this: Latitude: 40°42′51″ N Longitude: 74°00′21″ W 回答1: to conver from decimals to degrees you can do as follow String strLongitude = Location.convert(location.getLongitude(), Location.FORMAT_DEGREES); String strLatitude = Location

Python: Not all of arguments converted during string formatting

风流意气都作罢 提交于 2020-01-22 13:23:06
问题 Im wrtiting a script which saves the current date and time as a filename but I get an error stating "TypeError: not all arguments converted during string formatting" I am new to Python andmay of missed something obvious. Code below: from subprocess import Popen import datetime today = datetime.date.today() today = str(today) print today f = open("%s.sql", "w" % (today)) x = Popen(["mysqldump", "-u", "root", "-pucsdrv", "normalisationtion"], stdout = f) x.wait() f.close() 回答1: You're putting

How to format plaintext like a book/magazine with PHP?

人走茶凉 提交于 2020-01-22 02:48:09
问题 This question was migrated from Super User because it can be answered on Stack Overflow. Migrated 9 days ago . I have: This is a test string. Cool, huh? I want: This is a te- st string. C- ool, huh? That is, each line is exactly 13 chars, according to the English rules for this . That is, I'm not sure if "test" can be broken up like "te-st", or that "Cool" can be broken up to "C-ool", but that's the "style" I'm trying to achieve. I've made about a thousand search queries. I find nothing

Defining cross-platform money_format function (Linux and Windows)

邮差的信 提交于 2020-01-21 04:50:43
问题 I have read that money_format is not available on windows, and on some Linux distributions (i.e. BSD 4.11 variants). But I want to write cross-platform library using normal function, when available and using this workaround when not, so my library will be able to run on every PHP-based web server. Is there any simple solution to check whether built-in function is available and if not to include the solution from above? 回答1: The function money_format() is only defined if the system has strfmon

Pretty print XML data in JSP

ぐ巨炮叔叔 提交于 2020-01-17 03:55:06
问题 How do I pretty print (ie. with indentation) XML data in the JSP? I have the following code: <c:forEach items="${stuffs}" var="stuff"> <pre> <c:out value="${stuff}" escapeXml="true"/><br/> </pre> </c:forEach> But the problem is when ${stuff} is an unformatted XML, it will show in the jsp as one long XML data. I need it pretty-printed inside the <p> tag. 回答1: XSLT has a simple means of doing this via the xsl:output element. If you can apply an XSLT, I suggest using a stylesheet like this

Excel, VB - Character Operations & Date Reformating Inside Array

依然范特西╮ 提交于 2020-01-16 19:04:31
问题 ISSUE Large dataset with many improperly or non-uniformly entered dates in a specific field. There are about 19 different ways the dates have been entered in about 60,000 records. Some entries are completely invalid and must be discarded, others must be formatted properly. I am loading the range into an array and then performing the operations. I wrote out the operations as I believe I need, however I need some help in actually getting them working. See code below; error in comments. CURRENT

Formatting ListView Content During onCreate() method (getting ListView children)

女生的网名这么多〃 提交于 2020-01-16 18:27:47
问题 I am using a ListActivity which fills from a database. Depending on a the information stored in the record I want to format the row in the listView. For example, I have a boolean coulmn which specifies whether the current entry has been 'marked off' and if so then I want to set the strike-through formatting flag on one of the textViews inside the list row. The way I thought that I could do this was by getting the ListView from the ListActivity and then getting the view that I wanted to change

Can a character style be applied programmatically to a string before it is written to the Word document with VBA?

青春壹個敷衍的年華 提交于 2020-01-16 16:57:23
问题 I am grabbing some data from an Excel sheet and populating it into a Word template. I'm hoping that I can assign some of the Document's character styles to sub strings that will be added to the Document as the string is built up rather than having add the string to the Document and then select each string individually to apply the appropriate style. Right now, I'm concatenating a few strings and adding them to a text box in the document like this: ActiveDocument.Shapes("Text Box 7").TextFrame

Logging a literal message in NLog and/or Serilog

孤人 提交于 2020-01-16 13:18:19
问题 UPDATE: This turned out to be a discrepancy that exists in Serilog (which I tunnel to), but does not exist in NLog, which treats a single argument as a verbatim string (as one (and specifically, I) might expect) Using NLog, if I want to log something potentially containing embedded double braces: {{ without having them collapsed, what's the most efficient way? e.g.: NLog.LogManager.GetLogger("x").Warn("{{\"aaa}}") emits in my custom serilog-target: {"aaa} And I want: {{"aaa}} Is NLog

pascal triangle proper formatting java

假装没事ソ 提交于 2020-01-16 10:54:01
问题 so I'm currently working on an assignment that I just can't seem to finish. Well I have everything finished but would like the extra credit. I've been looking around the web and can't really seem to find exactly what I'm looking for. public class PascalTester { public static void main(String[] args) { Scanner kb = new Scanner(System.in); System.out.println("Welcome to the Pascal's Triangle program!"); System.out.println("Please enter the size of the triangle you want"); int size = kb.nextInt(