0
1 2 3 4 5 6 7 8 9 10 11 12 13
for(int time = 0; time < 24 * 3600; time++)
{
for(int i = 0; i < arr.Length; i++)
if(time >=toSec(arr[i]) && time < toSec(dep[i]))
{
if(time >= toSec("18:00:00") && time <= toSec("23:59:59"))
x++;
else if (time >= toSec("00:00:00") && time <= toSec("05:59:59"))
x++;
else
s++;
break;
}
guest ,
13.04.2009 (Updated 24.03.2018 )
0
1
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
JasperReports - говёная тулза для геренации отчётов в Java.
Основное достоинство - бесплатность и открытость исходного кода.
Главный минус - XML-шаблоны для отчётов.
guest ,
08.04.2009 (Updated 24.03.2018 )
0
1 2 3 4
if (cache != null) {
UserSession us = (UserSession)cache.get(FQN, sessionId);
return (us != null ? us : null);
}
guest ,
07.04.2009 (Updated 24.03.2018 )
0
1 2 3 4 5
Calendar calen = new GregorianCalendar();
calen.setTime(beginDate);
while (!calen.equals(endDate)) {
calen.add(Calendar.DATE,1);
}
guest ,
30.03.2009 (Updated 24.03.2018 )
0
1 2
File pom = new File(dir.getAbsoluteFile()
+ String.valueOf(File.separatorChar) + "pom.xml");
В классе java.io.File специально для таких умников есть две константы :
public static final char separatorChar = '\';
public static final String separator = "" + separatorChar;
Одна из них - это char, а вторая - String.
guest ,
20.03.2009 (Updated 24.03.2018 )
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
public NewsWrapper[] getTopNews() {
String query = "SELECT n FROM News n ORDER BY n.newsDate DESC";
Query q = JpaManager.getEntityManager().createQuery(query).
setHint(TopLinkQueryHints.REFRESH, HintValues.TRUE);
ArrayList topNews = new ArrayList(q.getResultList());
ArrayList sortedTopNews = new ArrayList();
while (topNews.size() > 0) {
News newsItem = topNews.get(topNews.size() - 1);
if (newsItem.getIsPublish() && sortedTopNews.size() < TOP_NEWS_COUNT)
sortedTopNews.add(newsItem);
topNews.remove(newsItem);
}
return CommonEnt.toEntArray(NewsWrapper.class,
CommonEnt.transformEntCollection(new NewsTransformer(), sortedTopNews));
}
А всего-то надо было отобразить некоторое количество записей...
guest ,
18.03.2009 (Updated 24.03.2018 )
0
1 2 3 4 5 6 7 8 9 10 11 12
public static String normalizeEncoding(String encoding) {
if (encoding == null) {
encoding = "";
}
encoding = encoding.trim();
encoding = encoding.replace("cp1251", "windows-1251");
encoding = encoding.replace("cp1251", "windows-1251");
encoding = encoding.replace("cp-1251", "windows-1251");
encoding = encoding.replace("win-1251", "windows-1251");
encoding = encoding.replace("utf8", "utf-8");
return encoding;
}
" Не хочешь - научим, не умеешь - заставим! "
guest ,
17.03.2009 (Updated 24.03.2018 )
0
1 2 3 4
public void setDoubleValue( double doubleValue ) {
DecimalFormat myFormatter = new DecimalFormat("###.##");
this.doubleValue=Double.valueOf(myFormatter.format(doubleValue));
}
Округление дробной части до двух знаков запятой? Даже если так, то как насчет статического члена класса?
guest ,
13.03.2009 (Updated 24.03.2018 )
0
1 2 3 4 5 6 7 8 9
if(included.equals(INCLUDED_ALL) || fieldNames.indexOf(field.getName()) != -1) {
if ((field.getDocumentMapping() != null && field.getDocumentMapping().trim().length() > 0)
|| (isCase.booleanValue()
&& ((field.getWorkflowMapping() != null && field.getWorkflowMapping().trim().length() > 0)
|| (field.getContentMapping() != null && field.getContentMapping().trim().length() > 0))
) {
// тут еще насрано
}}
) {
классический унылый говнокод, весь проект в таком стиле..
guest ,
11.03.2009 (Updated 24.03.2018 )
0
1
int dayOfWeek = calendar.get(calendar.get(Calendar.DAY_OF_WEEK));
guest ,
10.03.2009 (Updated 24.03.2018 )