formatting

mysql timestamp conversion/formatting Notice: A non well formed numeric value encountered

筅森魡賤 提交于 2019-12-19 05:45:16
问题 In my database I have set row "posted" as a timestamp but I get this notice when trying to convert/format it: Notice: A non well formed numeric value encountered code: $posted = date('d/m/Y H:i:s', $row['posted']); echo $posted; what am I doing wrong? 回答1: This means that the second parameter for date() is expecting integer, so convert $row['posted'] to timestamp first. Try $posted = date('d/m/Y H:i:s', strtotime($row['posted'])); 来源: https://stackoverflow.com/questions/11622755/mysql

Formatting of dynamically generated HTML - does no one care?

泄露秘密 提交于 2019-12-19 05:23:50
问题 I have very little experience in web development, so this may be a very basic question. It's just, from the limited experience I do have (a little PHP, and a little Ruby on Rails), it seems that the way dynamically generated HTML is formatted just "doesn't matter"; it ends up ugly, with weird indentation, and nobody cares because that isn't what the users sees. Unless, of course, the user is a developer, or even just someone who's curious to look at a little HTML to try and learn something.

Always show decimal places in SQL?

扶醉桌前 提交于 2019-12-19 05:23:17
问题 I'm working on a query which returns numeric values (currency). Some of the values are whole numbers and are being displayed as 3, 5, 2 etc whilst other numbers are coming up like 2.52, 4.50 etc. How can I force oracle to always show the decimal places? Thanks 回答1: TO_CHAR(pAmount, '9,999,999.99'); http://www.techonthenet.com/oracle/functions/to_char.php http://www.ss64.com/orasyntax/to_char.html 回答2: To enhance the answers already given, you can use: TO_CHAR(your_value,'fm999.99') to prevent

How to format numbers to a hex strings?

荒凉一梦 提交于 2019-12-19 05:12:55
问题 I want to format int numbers as hex strings. System.out.println(Integer.toHexString(1)); prints 1 but I want it as 0x00000001 . How do I do that? 回答1: Try this System.out.println(String.format("0x%08X", 1)); 回答2: You can use the String.format to format an integer as a hex string. System.out.println(String.format("0x%08X", 1)); That is, pad with zeros, and make the total width 8. The 1 is converted to hex for you. The above line gives: 0x00000001 and System.out.println(String.format("0x%08X",

Sitecore: Forcing pasting as unformatted text

一个人想着一个人 提交于 2019-12-19 04:15:23
问题 Is there a good way to force pasting as text inside Rich Text Fields inside Sitecore? I know there's a "Paste as Text" button in the Rich Text Editor itself, but content authors are almost definitely going to just hit Ctrl+V or Right-Click->Paste to put the text in, and if that content came from Word, all hell breaks loose with the markup. The workaround we have so far is to paste into notepad and then to copy that text and paste it into the Rich Text Field, but that solution is inelegant and

Merge two tables (CSV) if (table1 column A == table2 column A)

。_饼干妹妹 提交于 2019-12-19 04:12:33
问题 I have two CSV's, openable in Numbers or Excel, structured: | word | num1 | and | word | num2 | if the two words are equal (like they're both 'hi' and 'hi') I want it to become: | word | num1 | num2 | here are some pictures: So like for row 1, since both the words are the same, 'TRUE', I want it to become something like | TRUE | 5.371748 | 4.48957 | Either through some small script, or if there's some feature/ function I'm overlooking. Thanks! 回答1: Use a dict: with open('file1.csv', 'rb') as

Is it possible to format Tooltip-Text (bold, underline… etc)?

▼魔方 西西 提交于 2019-12-19 04:01:55
问题 I want to make some passages of a standard tooltip bold in a WinForms application. Is this possible? If not, is there a (free) tooltip component that allows me to style them (preferably also border and background)? Thanks! 回答1: You can use this type : Balloon tool tip. This let you have some bold title and some color option. You might be able to modify the source to get underline, italic and bold inside the message. Update: You can modify the drawing of the ToolTip (and the FONT object of the

Formatting sentences in a string using C#

女生的网名这么多〃 提交于 2019-12-19 03:09:14
问题 I have a string with multiple sentences. How do I Capitalize the first letter of first word in every sentence. Something like paragraph formatting in word. eg ."this is some code. the code is in C#. " The ouput must be "This is some code. The code is in C#". one way would be to split the string based on '.' and then capitalize the first letter and then rejoin. Is there a better solution? 回答1: In my opinion, when it comes to potentially complex rules-based string matching and replacing - you

Split on either a space or a hyphen?

£可爱£侵袭症+ 提交于 2019-12-19 02:06:23
问题 In Python, how do I split on either a space or a hyphen? Input: You think we did this un-thinkingly? Desired output: ["You", "think", "we", "did", "this", "un", "thinkingly"] I can get as far as mystr.split(' ') But I don't know how to split on hyphens as well as spaces and the Python definition of split only seems to specify a string. Do I need to use a regex? 回答1: If your pattern is simple enough for one (or maybe two) replace , use it: mystr.replace('-', ' ').split(' ') Otherwise, use RE

How can you intercept pasting into a NSTextView to remove unsupported formatting?

主宰稳场 提交于 2019-12-19 00:08:25
问题 I'm trying to create a simple NSTextView-based window for simple WYSIWYG editing. However, I only want to allow certain types of formatting (e.g. Bold, Italic, Underline and a single heading type but no colors or different fonts.) The issue is if I simply use NSTextView, someone can create or copy formatted text in another program, then simply paste it into that view and all that formatting goes with it, allowing things I'm not allowing, such as different fonts, colors, etc. At best, I want