73 чистых, читаемые, символы, записанные в мире java
boolean p(String s){return s.equals(""+new StringBuffer(s).reverse());}
:)
In order to optimise performance, the JVM uses a "pseudo memory barrier" in code to act as a fencing instruction when synchronizing across multiple processors. It is possible to revert back to a "true" memory barrier instruction, but this can have a noticeable (and bad) effect upon performance.
The use of -XX:+UseMembar
causes the VM to revert back to true memory barrier instructions. This parameter was originally intended to exist temporarily as a verification mechanism of the new pseudo-barrier logic, but it turned out that the new pseudo-memory barrier code introduced some synchronization issues. I believe these are now fixed, but until they were, the acceptable way to get around these issues was to use the reinstated flag.
The bug was introduced in 1.5, and I believe the flag exists in 1.5 and 1.6.
I've google-fu'ed this from a variety of mailing lists and JVM bugs:
Чтобы вставить:
# replace first argument of STR_TO_DATE with value from PHP/frontend
TIME( STR_TO_DATE( '10:00 PM', '%h:%i %p' ) );
Чтобы выбрать:
# replace first argument with your time field
TIME_FORMAT( '22:00:00', '%h:%i %p' );
EDIT:
Я просто продолжу и предположу, что вы используете функции mysql lib.
// first sanitize the $_POST input
// also, make sure you use quotes to identify the $_POST keys
$open = mysql_real_escape_string( $_POST[ 'MondayOpen' ] );
$close = mysql_real_escape_string( $_POST[ 'MondayClose' ] );
// this is the query, which should work just fine.
$sql = '
INSERT INTO
`table_lib_hours`
SET
`day_name` = "Monday",
`day_open_time` = TIME( STR_TO_DATE( "' . $open . '", "%h:%i %p" ) ),
`day_close_time` = TIME( STR_TO_DATE( "' . $close . '", "%h:%i %p" ) )
';
$result = mysql_query( $sql );
Для получения значений
$sql = '
SELECT
`day_open_time`,
`day_close_time`,
TIME_FORMAT( `day_open_time`, "%h:%i %p" ) as day_open_time_formatted,
TIME_FORMAT( `day_close_time`, "%h:%i %p" ) as day_close_time_formatted
FROM
`table_lib_hours`
WHERE
`day_name` = "Monday"
';
$resultset = mysql_query( $sql );
возвращает результирующий набор, в котором форматированные данные находятся в полях * _ formatted
EDIT:
Откорректировано % m
(месяц) до % i
(минуты). Спасибо Донни за хорошо замеченную пробуксовку.
В этом случае просто укажите URL-адрес отправки формы частичного представления на действие, которое было целью вашего проблемного перенаправления, и позвольте ему выполнить перенаправление в свою версию GET.
-121--1589896-Я не согласен с ответом от butterchicken. Эта страница http://www.md.pp.ru/~eu/jdk6options.html указывает, что этот флаг вызывает выдачу барьеров памяти, а затем изменение состояния потока (например, с RUNNABLE на WAITING или BLOCKED).