-
вот так!
Date: 12/21/05
Keywords: database, sql
public static void isDBConnectionValid(Connection dbConnection)
throws Exception
{
if(dbConnection == null)
throw new SQLException("Database connection does not exist");
else
return;
}
Source: http://community.livejournal.com/code_wtf/21568.html
-
Провокационный вопрос, javascript
Date: 12/13/05
Keywords: no keywords
Как думаете, alert() будет вызван?
if ('false') {
alert("Weakly typed languages rule forever!!!");
}
Source: http://www.livejournal.com/community/code_wtf/20857.html
-
Провокационный вопрос, javascript
Date: 12/13/05
Keywords: no keywords
Как думаете, alert() будет вызван?
if ('false') {
alert("Weakly typed languages rule forever!!!");
}
UPD по заявкам читающих: как это было в реальном проекте
Source: http://community.livejournal.com/code_wtf/20857.html
-
PHP
Date: 12/10/05
Keywords: no keywords
$tpl->assign(base64_decode('Y29weXJpZ2h0'), base64_decode('UG93ZXJlZCBieSBiMWdNYWlsIDY='));
отсюда
Source: http://www.livejournal.com/community/code_wtf/20647.html
-
PHP
Date: 12/10/05
Keywords: no keywords
$tpl->assign(base64_decode('Y29weXJpZ2h0'), base64_decode('UG93ZXJlZCBieSBiMWdNYWlsIDY='));
отсюда
Source: http://community.livejournal.com/code_wtf/20647.html
-
Я фигею
Date: 12/06/05
Keywords: no keywords
Я фигею без баяна.
Может, немного оффтоп, но по-моему, оно того стоит.
quote>
Удивительно, но так медленно сами программисты создают программы, которые автоматизируют труд программиста. И, приступил я к написанию кода со свойствами искусственного интелекта. Пусть программа накапливает знания и приемы программирования. Научим робота делать рутинную работу!
Линк2
Линк3
Source: http://www.livejournal.com/community/code_wtf/20320.html
-
Я фигею
Date: 12/06/05
Keywords: no keywords
Я фигею без баяна.
Может, немного оффтоп, но по-моему, оно того стоит.
quote>
Удивительно, но так медленно сами программисты создают программы, которые автоматизируют труд программиста. И, приступил я к написанию кода со свойствами искусственного интелекта. Пусть программа накапливает знания и приемы программирования. Научим робота делать рутинную работу!
Линк2
Линк3
Source: http://community.livejournal.com/code_wtf/20320.html
-
Рихтер и его Applied .Net Framework Programming
Date: 12/05/05
Keywords: no keywords
[Flags]
public enum Accounts {
Savings = 0x0001,
Checking = 0x0002,
Brokerage = 0x0004
}
// Definition of a class with Accounts accounts member skiped.
// Check if two class objects match:
if ((other.accounts & accounts) != accounts) return false;
Source: http://www.livejournal.com/community/code_wtf/20130.html
-
Рихтер и его Applied .Net Framework Programming
Date: 12/05/05
Keywords: no keywords
[Flags]
public enum Accounts {
Savings = 0x0001,
Checking = 0x0002,
Brokerage = 0x0004
}
// Definition of a class with Accounts accounts member skiped.
// Check if two class objects match:
if ((other.accounts & accounts) != accounts) return false;
Source: http://community.livejournal.com/code_wtf/20130.html
-
How to write unmantainable code - The Kama Sutra
Date: 12/02/05
Keywords: html
This technique has the added advantage of driving any users or documenters of the package to distraction as well as the maintenance programmers. Create a dozen overloaded variants of the same method that differ in only the most minute detail.
I think it was Oscar Wilde who observed that positions 47 and 115 of the Kama Sutra were the same except in 115 the woman had her fingers crossed.
Users of the package then have to carefully peruse the long list of methods to figure out just which variant to use. The technique also balloons the documentation and thus ensures it will more likely be out of date. If the boss asks why you are doing this, explain it is solely for the convenience of the users.
Again for the full effect, clone any common logic and sit back and wait for it the copies to gradually get out of sync.
Боянец, хотя почитать через год все-таки интересно, полная версия - http://thc.org/root/phun/unmaintain.html
Source: http://www.livejournal.com/community/code_wtf/19552.html
-
How to write unmantainable code - The Kama Sutra
Date: 12/02/05
Keywords: html
This technique has the added advantage of driving any users or documenters of the package to distraction as well as the maintenance programmers. Create a dozen overloaded variants of the same method that differ in only the most minute detail.
I think it was Oscar Wilde who observed that positions 47 and 115 of the Kama Sutra were the same except in 115 the woman had her fingers crossed.
Users of the package then have to carefully peruse the long list of methods to figure out just which variant to use. The technique also balloons the documentation and thus ensures it will more likely be out of date. If the boss asks why you are doing this, explain it is solely for the convenience of the users.
Again for the full effect, clone any common logic and sit back and wait for it the copies to gradually get out of sync.
Боянец, хотя почитать через год все-таки интересно, полная версия - http://thc.org/root/phun/unmaintain.html
Source: http://community.livejournal.com/code_wtf/19552.html
-
Оччень мило..
Date: 11/11/05
Keywords: no keywords
Смотрю сырцы мега-тулзы:
push(@errors, "$target is DOWN." . $res->status_line)
or error("Cannot push error for DOWN");
Source: http://www.livejournal.com/community/code_wtf/18552.html
-
Оччень мило..
Date: 11/11/05
Keywords: no keywords
Смотрю сырцы мега-тулзы:
push(@errors, "$target is DOWN." . $res->status_line)
or error("Cannot push error for DOWN");
Source: http://community.livejournal.com/code_wtf/18552.html
-
MS Vs Netscape :-)
Date: 11/01/05
Keywords: no keywords
Working project!
Source: http://www.livejournal.com/community/code_wtf/18372.html
-
MS Vs Netscape :-)
Date: 11/01/05
Keywords: browser, microsoft
<script language="JavaScript">
var globalTable,oRow,oCell,aRows,aCells,oCell1_1;
if ('Netscape' == "Microsoft")
{
globalTable=document.all.globalTable;
}
else // it can be Netscape or any other browser
{
globalTable=document.getElementById("globalTable");
}
...
</script>
Working project!
Source: http://community.livejournal.com/code_wtf/18372.html
-
I founf the following on a website, with a link to their INTRANET
Date: 10/17/05
Keywords: html
function passBox() {
var passwordText = "";
passwordText = prompt("vul hier het password in ", "type to connect");
if (passwordText == "personeel only") {
alert("Correct Password - Click OK To Continue")
location.href = "personeelspagina.html"
}
Source: http://www.livejournal.com/community/code_wtf/17784.html
-
I founf the following on a website, with a link to their INTRANET
Date: 10/17/05
Keywords: html
function passBox() {
var passwordText = "";
passwordText = prompt("vul hier het password in ", "type to connect");
if (passwordText == "personeel only") {
alert("Correct Password - Click OK To Continue")
location.href = "personeelspagina.html"
}
Source: http://community.livejournal.com/code_wtf/17784.html
-
MS VBScript в сети [via stanis]
Date: 10/14/05
Keywords: no keywords
Original post
Source: http://www.livejournal.com/community/code_wtf/17429.html
-
MS VBScript в сети [via stanis]
Date: 10/14/05
Keywords: no keywords
Original post
Source: http://community.livejournal.com/code_wtf/17429.html
-
Java :: Fragment of JobEntry.java (Jakarta Turbine 2.2-B)
Date: 10/06/05
Keywords: no keywords
/**
* What schedule am I on?
*
* I know this is kinda ugly! If you can think of a cleaner way
* to do this, please jump in!
*
* @return A number specifying the type of schedule. See
* calcRunTime().
* @exception Exception, a generic exception.
*/
private int evaluateJobType()
throws Exception
{
// First start by checking if it's a day of the month job.
if ( day_of_month < 0 )
{
// Not a day of the month job... check weekday.
if ( weekday < 0 )
{
// Not a weekday job...check if by the hour.
if ( hour < 0 )
{
// Not an hourly job...check if it is by the minute
if ( minute < 0 )
{
// Not a by the minute job so must be by the second
if ( second < 0)
throw new Exception("Error in JobEntry. Bad Job parameter.");
return SECOND;
}
else
{
// Must be a job run by the minute so we need minutes and
// seconds.
if ( minute < 0 || second < 0 )
throw new Exception("Error in JobEntry. Bad Job parameter.");
return MINUTE;
}
}
else
{
// Must be a daily job by hours minutes, and seconds. In
// this case, we need the minute, second, and hour params.
if ( minute < 0 || hour < 0 || second < 0)
throw new Exception("Error in JobEntry. Bad Job parameter.");
return DAILY;
}
}
else
{
// Must be a weekday job. In this case, we need
// minute, second, and hour params
if ( minute < 0 || hour < 0 || second < 0 )
throw new Exception("Error in JobEntry. Bad Job parameter.");
return WEEK_DAY;
}
}
else
{
// Must be a day of the month job. In this case, we need
// minute, second, and hour params
if ( minute < 0 || hour < 0 )
throw new Exception("Error in JobEntry. Bad Job parameter.");
return DAY_OF_MONTH;
}
}
Source: http://www.livejournal.com/community/code_wtf/16294.html