- 1
- 2
- 3
- 4
- 5
- 6
- 7
public void onApplicationStateChanged(int state)
{
if (state == Application.APPSTATE_UNINITIALIZED)
{
// TODO: what to do?
}
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+144
public void onApplicationStateChanged(int state)
{
if (state == Application.APPSTATE_UNINITIALIZED)
{
// TODO: what to do?
}
}
Чувак начал писать и забыл о чем...
−176.1
ДатаНачалаПериода = НачалоМесяца(Дата(Строка(Формат(ТекущийГод, "ЧГ=0")) + Строка(ТекущийМесяц) + "01"));
Фрагмент кода от разработчиков конфигурации. Дело в том, что дату начала текущего месяца можно получить как НачалоМесяца(ТекущаяДата()). Даже если предположить, что переменные "ТекущийГод" и "ТекущийМесяц" содержат не актуальные значения (например, при перерасчете прошлых документов), достаточно выполнить НачалоМесяца(Дата(ТекущийГод, ТекущийМесяц, 1))
+166.8
unset($keys[count($keys)-1][count($keys[count($keys)-1])-1]);
+75.3
public static ru.project.subpackage.PersonDTO convertOshPersonDtoToPersonDto(OshPersonDTO person){
ru.project.subpackage.PersonDTO dto = new ru.project.subpackage.PersonDTO();
dto.setPersonid(person.getPersonid().longValue());
dto.setNamelast(person.getNamelast());
dto.setNamefirst (person.getNamefirst ());
dto.setNamesec (person.getNamesec ());
dto.setInitials (person.getInitials ());
dto.setSex (convertSkVocValue(person.getSex()));
dto.setReason (person.getReason ());
dto.setWorkphone (person.getWorkphone ());
dto.setWorkphonedigit (person.getWorkphonedigit ());
dto.setLocalphone (person.getLocalphone ());
dto.setLocalphonedigit (person.getLocalphonedigit ());
dto.setHomephone (person.getHomephone ());
dto.setHomephonedigit (person.getHomephonedigit ());
dto.setMobilephone (person.getMobilephone ());
dto.setMobilephonedigit (person.getMobilephonedigit ());
dto.setFax (person.getFax ());
dto.setFaxdigit (person.getFaxdigit ());
dto.setPager (person.getPager ());
dto.setEmail (person.getEmail ());
dto.setWeb (person.getWeb ());
dto.setNamelastdative (person.getNamelastdative ());
dto.setNamefirstdative (person.getNamefirstdative ());
dto.setNamesecdative (person.getNamesecdative ());
dto.setNamelastaccusative (person.getNamelastaccusative ());
dto.setNamefirstaccusative (person.getNamefirstaccusative ());
dto.setNamesecaccusative (person.getNamesecaccusative ());
dto.setNamelastgenitive (person.getNamelastgenitive ());
dto.setNamefirstgenitive (person.getNamefirstgenitive ());
dto.setNamesecgenitive (person.getNamesecgenitive ());
dto.setNamelastinstrumental (person.getNamelastinstrumental ());
dto.setNamefirstinstrumental(person.getNamefirstinstrumental());
dto.setNamesecinstrumental (person.getNamesecinstrumental ());
dto.setNamelastprepositional(person.getNamelastprepositional());
dto.setNamefirstprepositional(person.getNamefirstprepositional());
dto.setNamesecprepositional (person.getNamesecprepositional ());
return dto;
}
И так далее еще несколько сотен строк. А главное переупаковка из одних объектов в другие и обратно бессмысленна, т.к. можно использовать исходные (они доступны в приложении)
+82.7
public static boolean isUnix()
{
return System.getProperty("file.separator").equals("/");
}
+71.3
/**
* Возбуждает IllegalArgumentException если аргумент null.
* Формирует сообщение об ошибке с именем условия.
*
* @param argument проверяемый аргумент
* @param argumentName имя аргумента
*/
public static void ensureNotNull(Object argument, String argumentName) {
if (argument == null) {
throw new IllegalArgumentException("Null '" + argumentName + "' not allowed.");
}
}
+83.9
/**
* проебразует объект <code>o</code> в объект
*
* @param o объект
* @return объект со значением <code>o</code>
*/
public static Object toObject(Object o) {
return o;
}
Полное отсутствие знаний основ java
+190.4
// register.php
// ...
$login = $_POST["login"];
// some checks...
$sql = "CREATE TABLE `$login` (
`city` TINYINT UNSIGNED NOT NULL ,
// other fields here...
);";
Из модуля регистрации в системе удаленного ввода данных через web. После сохранения информации о новом пользователе для него создается новая таблица для хранения вводимых данных...
Больше слов нет...
+127
/// <summary>
/// Retrieve currency rates from an external site to be sure they are up to date.
/// In this case just checking the one currency (Australian Dollar) so no need to dynamically parse the site.
/// </summary>
/// <returns>currency rates or msg indicating an error</returns>
private String getCurrencyRates()
{
string strURL = @"http://www.x-rates.com/d/JPY/table.html";
HttpWebRequest txtRequest = (HttpWebRequest)WebRequest.Create(strURL);
txtRequest.Method = "GET";
txtRequest.ContentType = "application/x-www-form-urlencoded";
string response;
using (StreamReader streamReader = new StreamReader(txtRequest.GetResponse().GetResponseStream()))
{
response = streamReader.ReadToEnd();
if (response.IndexOf("Australian Dollar") > 0)
{
//parse the returned page for the two values of the currency rate based on the existing design
int ind_jpy = (response.IndexOf("/d/AUD/JPY/graph120.html") + 39);
int ind_aud = (response.IndexOf("/d/JPY/AUD/graph120.html") + 39);
String jpy_aud = response.Substring(ind_jpy, (response.IndexOf("</a>",ind_jpy) - ind_jpy) );
String aud_jpy = response.Substring(ind_aud, (response.IndexOf("</a>", ind_aud) - ind_aud));
Session["curr_rate"] = "set";
Session["JPY"] = jpy_aud;
Session["AUD"] = aud_jpy;
return aud_jpy + " / " + jpy_aud;
}
//else present msg to user that unable to obtain currency rates
}
return "";
}
Еще один кандидат
+135.2
public string GetDollarKurs(string input)
{
string dol = "[.\\s]*<img height=\"11\" alt=\"Доллар США\" hspace=\"2\" src=\"/images/icon_dollar.gif\" width=\"11\" align=\"left\" vspace=\"2\" border=\"0\">Доллар \r\n\t\t\tСША</td>\r\n\t\t<td></td>\r\n\t\t<td class=\"digit\" align=\"right\">[\\s]*\\d+\\,\\d+[.\\s]*";
MatchCollection Matches = Regex.Matches(input, dol);
if (Matches.Count == 1)
{
string res = Matches[0].Value;
res = res.Trim();
res = res.Substring(res.LastIndexOf('>') + 1);
return res;
}
else
return "";
}
Функция для получения курса доллара, в input подаётся хтмл главной страницы сайта cbr.ru и парсится.
А web-сервисы пусть кто-нибудь другой изучает... :o)