format

Use SO's URL format for $_GET

时间秒杀一切 提交于 2019-12-08 06:32:09
问题 StackOverflow has a very neat, clean URL format. It looks the same as a directory structure, but there can't be a directory for each question on here! My question is this: How can I get http://www.site.com/sections/tutorials/tutorial1 , for example, to stay like that in the address bar, but convert it to a $_GET request for PHP to mess around with? I could use a .htaccess file, but I don't want the URL being rewritten - I'd like it to remain clean and friendly. Is my only option here to use

Extract information in a line of text with a format from user input

白昼怎懂夜的黑 提交于 2019-12-08 03:28:21
问题 I am trying to make a program which takes in input song files and a format to write metatags in file. Here is a few examples of the call: ./parser '%n_-_%t.mp3' 01_-_Respect.mp3 gives me track=01; title=Respect ./parser '%b._%n.%t.mp3' The_Queen_of_Soul._01.Respect.mp3 gives me album=The_Queen_of_Sould; track=01; title=Respect ./parser '%a-%b._%n.%t.mp3' Aretha_Franklin-The_Queen_of_Soul._01.Respect.mp3 gives me artist=Aretha_Franklin; track=01; title=Respect ./parser '%a_-_%b_-_%n_-_%t.mp3'

C# Is there a built-in function to convert a formatted String back to a Number?

独自空忆成欢 提交于 2019-12-08 03:26:20
问题 How do I convert a string that's a formatted number, back to a number? Decimal percent = 55.76; String strPercent = String.Format("{0:0.0}%", percent); Decimal dollars = 33.5; String strDollars = String.Format("{0:C}", dollars); Say later, I want to get the percent and dollar value back, as numbers. Is there any built-in way to do this using C# and asp.net? I know how I use regex and a String function, but I read about a Decimal.Parse() function from http://msdn.microsoft.com/en-us/library

how to load the private key from a .der file into java private key object

不想你离开。 提交于 2019-12-08 02:20:35
问题 I'm writing a java program to import private keys from files within the file system and make a private key object, using java... I could do it for files in .pem format but, with .der format, I had no idea what to do, since I couldnt firstly detect the algorithm used to generate the keys. within .pem files I could determine the algorithm from the header for PKCS#1 which have a header like -----BEGIN RSA PRIVATE KEY---- formats and used the bouncycastle pem reader for those in PKCS#8 which have

Variable String.Format length

北慕城南 提交于 2019-12-08 02:16:54
问题 I have the following code: var str = "ABC"; var n = 7; var output = String.Format("{0,n}", str); This should output the string " ABC" How should I change the line above? 回答1: Format strings are just strings too - you can define the format separately: int n = 3; string format = string.Format("{{0,{0}}}", n); //or more readable: string format = "{0," + n + "}"; var output = string.Format(format, str); Edit: After your update it looks like what you want can also be achieved by PadLeft(): var str

VB6: validating date with a certain format

て烟熏妆下的殇ゞ 提交于 2019-12-08 02:03:33
问题 I have built a form using Visual Basic 6. Everything goes great, the form inserts the data in my database and no problems here at all. Now I need to validate the date field, I need the dates entered to have this format: dd/mm/yyyy I'm doing: Private Sub txtMyText_Validate(Index As Integer, Cancel As Boolean) If IsDate(Format$(txtMyText(9).Text, "dd/mm/yyyy")) Or txtMyText(9).Text = "" Then txtMyText(9).SetFocus Else txtMyText(9).SetFocus MsgBox "Please enter a valid date with this format: dd

RobotFramework - get current Date

天大地大妈咪最大 提交于 2019-12-08 01:57:25
问题 I need to test that the current date is displayed on my device, The date on the device is in format Monday, September 9, 2018 but when i try to test it i can only use the format Monday, 09, 2018 which would fail the test as there is no 0 in the Month date. page should contain element ${DATE} ${DATE_MESSAGE} get current date result_format=%A, %d, %Y element should contain text ${DATE} ${DATE_MESSAGE} How can change the format in robotframework to verify THis format Monday, September 9, 2018.

mySQL format number output , thousands separator

半腔热情 提交于 2019-12-08 00:57:40
问题 I have a mySQL query which is outputting decimal fields with a comma. SELECT Metals.Metal, FORMAT(Fixes.GBPam, 3) AS AM, FORMAT(Fixes.GBPpm, 3) AS PM, DATE_FORMAT(Fixes.DateTime, '%d-%m-%y') AS Date FROM Fixes, Metals WHERE Metals.Id = Fixes.Metals_Id Fields GBPam and GBPpm are both of type decimal(10,5) Now I want columns AM and PM to be formatted to 3 decimal places in my sql query - Correct I want values in the thousands to be formatted as xxxx.xxx and not x,xxx.xxx - Incorrect Example

how to set the number format for an EditText

我们两清 提交于 2019-12-08 00:27:46
问题 I want the number being displayed in my EditText upto 1 decimal place with no leading zeroes e.g. 25.0 not like 025.0 how can i do this? this is in android 回答1: You can use DecimalFormat DecimalFormat format = new DecimalFormat("##.#"); String formattedText = format.format(025.0); editText.setText(formattedText); You will get result in EditText as 25.0 回答2: you can set it in xml file. Like <EditText android:id="@+id/editText1" android:layout_width="wrap_content" android:layout_height="wrap

Customize date format in C++

风流意气都作罢 提交于 2019-12-08 00:10:24
问题 I have this function: void Log::Write(string logline){ //2011-10-12 13:07:40 correct format time_t rawtime; struct tm * timeinfo; time ( &rawtime ); timeinfo = localtime ( &rawtime ); m_stream.write( asctime (timeinfo), 24 ); m_stream << " - " << logline << std::endl; } The output is like this: Thu Oct 13 12:35:30 2011 but I wanna see the output like the comment section: 2011-10-12 13:07:40 How is it possible? 回答1: It's very possible. Look at the manpage for strftime() . In this case, you'd