format

percentage symbol in strings.xml

随声附和 提交于 2019-12-21 06:49:28
问题 Im trying to format a string from string.xml to reuse it with several Values. I'm running into some problems as the String should also contain the percentage-symbol which is used by the formatter. I already tried to replace the % symbol by its unicode presentation but that doesnt seem to work: <?xml version="1.0" encoding="utf-8"?> <resources> <string name="teststring">The new value is %1$s%</string> <string name="teststring2">The new value is %1$s\u0025</string> <string name="teststring3"

Printf raw data to a fixed length hex output

杀马特。学长 韩版系。学妹 提交于 2019-12-21 04:05:03
问题 I have a struct, well pointer to a struct, and I wish to printf the first n bytes as a long hex number, or as a string of hex bytes. Essentially I need the printf equivalent of gdb's examine memory command, x/nxb . If possible I would like to still use printf as the program's logger function just variant of it. Even better if I can do so without looping through the data. 回答1: Just took Eric Postpischil's advice and cooked up the following : struct mystruc { int a; char b; float c; }; int main

How do I quickly convert the size element of file.info() from bytes to KB, MB, GB, etc.?

喜夏-厌秋 提交于 2019-12-21 03:12:18
问题 I expect there is already an answer for this on stackoverflow, and I simply failed to find it. Desired outcome: Quickly convert the file size element in a file.info() call from bytes to KB, MB, etc. I'm fine if the output is either i) a character string with the desired size type, e.g., "96 bytes" or ii) simply a numeric conversion, e.g., from 60963 bytes to 60.963 KB (per Google). Repro steps: Create a folder to store the file: dir.create("census-app/data") Download the file (~60KB):

kendo ui grid datasource filter date format

送分小仙女□ 提交于 2019-12-20 12:41:01
问题 I have a kendo grid with a date field in the datasource. When displaying the field I use a template to display the date in the UK date format 'dd/MM/yyyy'. The problem is when filtering, I don't know how to display the date filter in UK format. Another problem I am having is there is no datetime type, just date, so can only filter by dates not datetimes. Any help or ideas would be appreciated. This is the partial view (cshtml) <script type="text/javascript"> $(document).ready(function() { var

Format MySQL code inside PHP string

末鹿安然 提交于 2019-12-20 10:26:36
问题 Is there any program IDE or not that can format MySQL code inside PHP string e.g. I use PHPStorm IDE and it cannot do it. It does that for PHP and MYSQL but not for MYSQL inside php string. I am ready to use new IDE because now i have to manually format hundreds of database requests that are one line and not readable. Only criteria for my choice is that ide can do that automatically. <?php ... $request1 = "select * from tbl_admin where admin_id= {$_SESSION['admin_id']} and active= 1 order By

Why was the comment that said “Don't format a floppy at the same time” funny when talking about threads and processes?

折月煮酒 提交于 2019-12-20 10:14:39
问题 I was reading up the difference between Thread and Processes and came across the comment left by users in the second answer which stated As so long as you don't format a floppy at the same time. It has 27 upvotes but no one has explained the reason behind it . I would like to know what the commentor means when he said the above comment ?? Can someone suggest a more meaningful question name which reflects what the question is asking 回答1: In the early days of Windows, a floppy could be crashed

Easy way to convert exec sp_executesql to a normal query?

谁都会走 提交于 2019-12-20 09:16:40
问题 When dealing with debugging queries using Profiler and SSMS, its pretty common for me to copy a query from Profiler and test them in SSMS. Because I use parameterized sql, my queries are all sent as exec sp_executesql queries. exec sp_executesql N'/*some query here*/', N'@someParameter tinyint', @ someParameter =2 I'll take this and convert it into a normal query for ease of editing (intellisense, error checking, line numbers, etc): DECLARE @someParameter tinyint SET @someParameter = 2 /*some

Matlab: how to display the “real” values of an array?

亡梦爱人 提交于 2019-12-20 07:43:21
问题 I have a vector that is caluculated in a script. After calculation, I display the values to the command window. It is displayed as follows: finalResults = 1.0e+05 * 0.0001 0 0.0005 0.0002 0.0001 0.0027 0.0033 0.0001 -0.0000 -0.0000 1.3750 0.0066 How do I make it display with the real values (i.e. with the 1.0e+05 multiplied in)? 回答1: format longG should do the trick. This uses either long or longE , whichever is shorter for each element . Same can be done with format shortG if you want

Change MYSQL date format

我只是一个虾纸丫 提交于 2019-12-20 07:37:39
问题 I have a table in MYSQL of which 3 columns have dates and they are formatted in the not desired way. Currently I have: mm/dd/yyyy and I want to change those dates into dd/mm/yyyy . Table name is Vehicles and the columns names are: CRTD INSR SERD 回答1: Your current datatype for your column is not date right? you need to convert it to date first using STR_TO_DATE() and convert back to string SELECT DATE_FORMAT(STR_TO_DATE(colName, '%c/%d/%Y'), '%d/%c/%Y') FROM table1 SQLFiddle Demo 回答2: try this

How to format this date type 2010-06-24T00:00:00Z to sun,24/06/10 7.15 p.m (CDT) using javascript or jquery

故事扮演 提交于 2019-12-20 07:28:35
问题 How to format this date type 2010-06-24T00:00:00Z to sun,24/06/10 7.15 p.m (CDT) using JavaScript or jQuery.? sun,24/06/10 7.15 p.m (CDT) is just a format representation which I need and not the actual date of the above string. 回答1: Pretty simple with JS - var d_names = new Array("sun", "mon", "tue", "wed", "thu", "fri", "sat"); var d = new Date(); var curr_date = d.getDate(); var curr_month = d.getMonth(); curr_month++; var curr_year = d.getFullYear(); document.write(d_names[curr_day] + ", "