-
Список говнокодов пользователя OlgaWolga
Всего: 5
-
+127
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
/// <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 "";
}
Еще один кандидат
OlgaWolga,
07 Сентября 2009
-
+158.9
- 1
- 2
- 3
- 4
- 5
static $badwords = array(
...
'(?<=[_\d]) [гg]_?[оo]_?[вvb]_?[нnh]_?[оoаaяеeyу]', #говн[оаяеу]
...
);
самый дословный (мета-)говнокод.
из censure.php -- Функция пытается определить наличие мата (нецензурных, матерных слов) в html-тексте.
http://forum.dklab.ru/viewtopic.php?t=17146
OlgaWolga,
05 Сентября 2009
-
+132.5
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
foreach ( DataRow dr in dsWorkPolicyTa.Tables[0].Rows)
{
if(strMasterNumber==dr["MAST_NO"].ToString() && strMasterSequence == dr["MAST_SEQ"].ToString() && strSectionSequence == dr["SEQ"].ToString() && strPremiumCurrency == dr["PREMIUM_CURRENCY"].ToString())
{
if (( strPremiumCurrency.CompareTo(dr["PREMIUM_CURRENCY"].ToString())==0)&& ( dr["ENDORSEMENT_NUMBER"].ToString().CompareTo(dsWorkPolicyTa.Tables[0].Rows[marker]["ENDORSEMENT_NUMBER"].ToString()) == 0 )&& (strEntrySurrogate==dr["EYAFNB"].ToString()) && ( dr["E2E0CD"].ToString().CompareTo(dsWorkPolicyTa.Tables[0].Rows[marker]["E2E0CD"].ToString()) == 0 ))
{
//Unauthorised/Policy Premium
if((dsWorkPolicyTa.Tables[0].Rows[marker]["PREMIUM"]!= System.DBNull.Value)&& (dr["PREMIUM"] != System.DBNull.Value)&& (dsWorkPolicyTa.Tables[0].Rows[marker]["PREMIUM"].ToString()!= "")&& (dr["PREMIUM"].ToString() != ""))
dsWorkPolicyTa.Tables[0].Rows[marker]["PREMIUM"]=Convert.ToDouble(dsWorkPolicyTa.Tables[0].Rows[marker]["PREMIUM"])+ Convert.ToDouble(dr["PREMIUM"]);
else
dsWorkPolicyTa.Tables[0].Rows[marker]["PREMIUM"]=dr["PREMIUM"];
if((dsWorkPolicyTa.Tables[0].Rows[marker]["PREMIUM_BASE"]!= System.DBNull.Value)&& (dr["PREMIUM_BASE"] != System.DBNull.Value)&& (dsWorkPolicyTa.Tables[0].Rows[marker]["PREMIUM_BASE"].ToString()!= "")&& (dr["PREMIUM_BASE"].ToString() != ""))
dsWorkPolicyTa.Tables[0].Rows[marker]["PREMIUM_BASE"]=Convert.ToDouble(dsWorkPolicyTa.Tables[0].Rows[marker]["PREMIUM_BASE"])+ Convert.ToDouble(dr["PREMIUM_BASE"]);
else
dsWorkPolicyTa.Tables[0].Rows[marker]["PREMIUM_BASE"]=dr["PREMIUM_BASE"];
if((dsWorkPolicyTa.Tables[0].Rows[marker]["PREMIUM_OURSHARE"]!= System.DBNull.Value) && (dr["PREMIUM_OURSHARE"] != System.DBNull.Value)&& (dsWorkPolicyTa.Tables[0].Rows[marker]["PREMIUM_OURSHARE"].ToString()!= "") && (dr["PREMIUM_OURSHARE"].ToString() != ""))
dsWorkPolicyTa.Tables[0].Rows[marker]["PREMIUM_OURSHARE"]=Convert.ToDouble(dsWorkPolicyTa.Tables[0].Rows[marker]["PREMIUM_OURSHARE"])+ Convert.ToDouble(dr["PREMIUM_OURSHARE"]);
else
dsWorkPolicyTa.Tables[0].Rows[marker]["PREMIUM_OURSHARE"]=dr["PREMIUM_OURSHARE"];
if((dsWorkPolicyTa.Tables[0].Rows[marker]["PREMIUM_BASE_OURSHARE"]!= System.DBNull.Value)&& (dr["PREMIUM_BASE_OURSHARE"] != System.DBNull.Value) && (dsWorkPolicyTa.Tables[0].Rows[marker]["PREMIUM_BASE_OURSHARE"].ToString()!= "")&& (dr["PREMIUM_BASE_OURSHARE"].ToString() != ""))
dsWorkPolicyTa.Tables[0].Rows[marker]["PREMIUM_BASE_OURSHARE"]=Convert.ToDouble(dsWorkPolicyTa.Tables[0].Rows[marker]["PREMIUM_BASE_OURSHARE"])+ Convert.ToDouble(dr["PREMIUM_BASE_OURSHARE"]);
else
dsWorkPolicyTa.Tables[0].Rows[marker]["PREMIUM_BASE_OURSHARE"]=dr["PREMIUM_BASE_OURSHARE"];
//Quoted Premium
if((dsWorkPolicyTa.Tables[0].Rows[marker]["QUOTED_PREMIUM"]!= System.DBNull.Value)&& (dr["QUOTED_PREMIUM"] != System.DBNull.Value) && (dsWorkPolicyTa.Tables[0].Rows[marker]["QUOTED_PREMIUM"].ToString()!= "")&& (dr["QUOTED_PREMIUM"].ToString() != ""))
dsWorkPolicyTa.Tables[0].Rows[marker]["QUOTED_PREMIUM"]=Convert.ToDouble(dsWorkPolicyTa.Tables[0].Rows[marker]["QUOTED_PREMIUM"])+ Convert.ToDouble(dr["QUOTED_PREMIUM"]);
else
dsWorkPolicyTa.Tables[0].Rows[marker]["QUOTED_PREMIUM"]=dr["QUOTED_PREMIUM"];
if((dsWorkPolicyTa.Tables[0].Rows[marker]["QUOTED_PREMIUM_BASE"]!= System.DBNull.Value)&& (dr["QUOTED_PREMIUM_BASE"] != System.DBNull.Value) && (dsWorkPolicyTa.Tables[0].Rows[marker]["QUOTED_PREMIUM_BASE"].ToString()!= "")&& (dr["QUOTED_PREMIUM_BASE"].ToString() != ""))
dsWorkPolicyTa.Tables[0].Rows[marker]["QUOTED_PREMIUM_BASE"]=Convert.ToDouble(dsWorkPolicyTa.Tables[0].Rows[marker]["QUOTED_PREMIUM_BASE"])+ Convert.ToDouble(dr["QUOTED_PREMIUM_BASE"]);
else
dsWorkPolicyTa.Tables[0].Rows[marker]["QUOTED_PREMIUM_BASE"]=dr["QUOTED_PREMIUM_BASE"];
Кусок примера кода предоставленного кандидатом на должность программиста.
Модуль называеться "Genius".
При попытке наговнокодить все 100 строчек произошла "Ошибка компиляции кода: Такой длинный код врядли может быть смешным. Пожалуйста, ограничьтесь сотней строк и 4000 символами."
Пришлось ограничить 4000 символами, но не стало смешнее :(
OlgaWolga,
04 Сентября 2009
-
+136.4
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
public class Xps2Slides
{
private int MakeCollection(List<string> data)
{
...
CallGC();
...
}
private void bgw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
...
CallGC();
...
}
private void makeDeepZoomFiles(string png)
{
...
CallGC();
}
private string MakePNG(ref FrameworkElement fe, int pageNumber)
{
CallGC();
...
CallGC();
...
}
private void doPNG(string outputPath, ref RenderTargetBitmap bmp)
{
...
CallGC();
...
}
private void CallGC()
{
GC.AddMemoryPressure(300000);// number was picked at random..
GC.Collect();
GC.WaitForPendingFinalizers();
GC.WaitForFullGCComplete();
}
}
Кандидат на позицию программиста: "There are alot of samples on the internet of such similar code, but nothing that could be used for serially generating these collections on the fly without crashing with a memory overflow error or some other input output issue. I have resolved these problems in the file contained in the sample."
OlgaWolga,
02 Сентября 2009
-
+136
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
/// <summary>Read-Only property. Gets the Age.</summary>
public Int32 Age {
get {
Int32 age = 0;
if(this.dateOfBirth != DateTime.MaxValue){
String temp = (DateTime.Now.Subtract(this.dateOfBirth).TotalDays / 365).ToString();
age = Convert.ToInt32(temp.Substring(0, temp.IndexOf(".")));
}
return (age);
}
}
вот только одно не понимаю -- мочему Int32?
OlgaWolga,
02 Сентября 2009