"In a sense, this is what we do. We build your digital business even while you're up and running."
Thursday, August 28, 2008
Что такое комментарии к коду?
Вопрос: Что в языке программирования подразумевается под комментариями?
Варианты ответов:
1) Слова, которые произносит программист при отладке программы
...
Варианты ответов:
1) Слова, которые произносит программист при отладке программы
...
Imperative vs. Declarative
Забавно, но, похоже, большинство программистов, программирующих на императивных языках программирования (говорящих КАК что-то должно быть сделано), предпочитают быть управляемыми декларативными методами - т.е. получать инструкции по поводу того, ЧТО должно быть сделано, оставляя "как" на их усмотрение. Это, кстати, называется "дизайном". :) Таким образом разработчик на императивном языке является фактически (увы, несовершенным) декларативным интерфейсом к этому языку. :)
Tuesday, August 26, 2008
Thursday, August 21, 2008
Number to month name
echo form_label('Month: ');
$options = array(
'0' => 'New',
'1' => 'January',
'2' => 'February',
'3' => 'March',
'4' => 'April',
'5' => 'May',
'6' => 'June',
'7' => 'July',
'8' => 'August',
'9' => 'September',
'10' => 'October',
'11' => 'November',
'12' => 'December',
'13' => 'I'm an idiot!',
);
Wednesday, August 20, 2008
The March of Progress
1980: C
1988: C++
1996: Java
2004: Java
printf("%10.2f", x);1988: C++
cout << setw(10) << setprecision(2) << showpoint << x;
1996: Java
java.text.NumberFormat formatter
= java.text.NumberFormat.getNumberInstance();
formatter.setMinimumFractionDigits(2);
formatter.setMaximumFractionDigits(2);
String s = formatter.format(x);
for (int i = s.length(); i < 10; i++) System.out.print(' ');
System.out.print(s);
2004: Java
System.out.printf("%10.2f", x);Thursday, August 14, 2008
Encoding Recipe
Q: знатоки, подскажите, как из строки типа "Привет" получить "\u0441\u043b\u0443\u0445\u0438"?
A: на C это делается так:
A: на C это делается так:
if (str == "Привет") str = "\u0441\u043b\u0443\u0445\u0438";
Tuesday, August 5, 2008
Transaction management and JPA
"My current project is a web application with Struts in the web tier, a stateless session EJB (EJB3) in the middle tier and various entity pojos (JPA) that model the data. The application server is JBoss 4.2.0.CR2 that uses Hibernate as the persistence provider.
In this configuration with container-managed transactions, the transaction boundary is the EJB method call. Struts action classes make calls to the session EJB methods in order to retrieve data for display in various JSPs. The problem is that after the EJB method returns, the transaction is over, the persistence context has ended and the POJOs returned are detached. If the JSP that displays the data tries to access any lazily loaded associations an exception occurs."
In this configuration with container-managed transactions, the transaction boundary is the EJB method call. Struts action classes make calls to the session EJB methods in order to retrieve data for display in various JSPs. The problem is that after the EJB method returns, the transaction is over, the persistence context has ended and the POJOs returned are detached. If the JSP that displays the data tries to access any lazily loaded associations an exception occurs."
[chstath]