Click here to Skip to main content
15,921,452 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: Magic numbers! An so many! EEEEEEEK! Pin
Ed.Poore11-Sep-07 0:06
Ed.Poore11-Sep-07 0:06 
GeneralRe: Magic numbers! An so many! EEEEEEEK! Pin
Rajesh R Subramanian11-Sep-07 0:17
professionalRajesh R Subramanian11-Sep-07 0:17 
GeneralRe: Magic numbers! An so many! EEEEEEEK! Pin
Ed.Poore11-Sep-07 2:47
Ed.Poore11-Sep-07 2:47 
GeneralRe: Magic numbers! An so many! EEEEEEEK! Pin
Vasudevan Deepak Kumar11-Sep-07 4:57
Vasudevan Deepak Kumar11-Sep-07 4:57 
GeneralRe: Magic numbers! An so many! EEEEEEEK! Pin
Rajesh R Subramanian12-Sep-07 5:12
professionalRajesh R Subramanian12-Sep-07 5:12 
GeneralRe: Magic numbers! An so many! EEEEEEEK! Pin
PIEBALDconsult12-Sep-07 6:54
mvePIEBALDconsult12-Sep-07 6:54 
GeneralRe: Magic numbers! An so many! EEEEEEEK! Pin
Pete O'Hanlon12-Sep-07 10:33
mvePete O'Hanlon12-Sep-07 10:33 
GeneralRe: Magic numbers! An so many! EEEEEEEK! Pin
Luc Pattyn12-Sep-07 15:11
sitebuilderLuc Pattyn12-Sep-07 15:11 
GeneralRe: Magic numbers! An so many! EEEEEEEK! Pin
Manuel F. Hernandez13-Sep-07 6:45
Manuel F. Hernandez13-Sep-07 6:45 
GeneralRe: Magic numbers! An so many! EEEEEEEK! Pin
leppie11-Sep-07 0:23
leppie11-Sep-07 0:23 
GeneralRe: Magic numbers! An so many! EEEEEEEK! Pin
peterchen12-Sep-07 23:19
peterchen12-Sep-07 23:19 
GeneralRe: if if if if if if Pin
cp987611-Sep-07 1:51
cp987611-Sep-07 1:51 
GeneralRe: if if if if if if Pin
Llasus11-Sep-07 14:30
Llasus11-Sep-07 14:30 
GeneralRe: if if if if if if Pin
Rajesh R Subramanian11-Sep-07 23:34
professionalRajesh R Subramanian11-Sep-07 23:34 
GeneralRe: if if if if if if Pin
cp987612-Sep-07 2:00
cp987612-Sep-07 2:00 
GeneralRe: if if if if if if Pin
Rajesh R Subramanian12-Sep-07 3:29
professionalRajesh R Subramanian12-Sep-07 3:29 
GeneralRe: if if if if if if Pin
KarstenK11-Sep-07 2:30
mveKarstenK11-Sep-07 2:30 
GeneralRe: if if if if if if Pin
Rajesh R Subramanian11-Sep-07 23:30
professionalRajesh R Subramanian11-Sep-07 23:30 
GeneralRe: if if if if if if Pin
KarstenK12-Sep-07 0:12
mveKarstenK12-Sep-07 0:12 
GeneralRe: if if if if if if Pin
Rajesh R Subramanian12-Sep-07 0:13
professionalRajesh R Subramanian12-Sep-07 0:13 
JokeRe: if if if if if if Pin
Pete O'Hanlon11-Sep-07 5:12
mvePete O'Hanlon11-Sep-07 5:12 
GeneralRe: if if if if if if [modified] Pin
Rajesh R Subramanian11-Sep-07 23:37
professionalRajesh R Subramanian11-Sep-07 23:37 
GeneralRe: if if if if if if Pin
mimante11-Sep-07 22:16
mimante11-Sep-07 22:16 
GeneralRe: if if if if if if Pin
Plasmodium5-Oct-07 13:07
Plasmodium5-Oct-07 13:07 
Generalparsing string for int sqlParameter Pin
Seishin#10-Sep-07 4:54
Seishin#10-Sep-07 4:54 
once i got some code for a webpage.. there was this search 'engine' using one mathod:
<br />
public static dt_Product[] DB_Search(<br />
                           int _CMS_LanguageID,<br />
                           int _SubGroup,<br />
                           int _Make,<br />
                           string _ITEMNMBR,<br />
                           string _KTMDESC)<br />
        {<br />
<br />
            SqlParameter[] p ={<br />
                        new SqlParameter("@CMS_LanguageID", _CMS_LanguageID),<br />
                        new SqlParameter("@SubGroup", _SubGroup),<br />
                        new SqlParameter("@Group", int.Parse("-1")),<br />
                        new SqlParameter("@Make", _Make),<br />
                        new SqlParameter("@ITEMNMBR", _ITEMNMBR),<br />
                        new SqlParameter("@KTMDESC", _KTMDESC),<br />
                        new SqlParameter("@PRICELEVEL", ""),<br />
                        new SqlParameter("@IDSUBCAT_1", int.Parse("-1")),<br />
                        new SqlParameter("@IDVALUE_1_P", int.Parse("-1")),<br />
                        new SqlParameter("@IDVALUE_1_K", int.Parse("-1")),<br />
                        new SqlParameter("@IDSUBCAT_2", int.Parse("-1")),<br />
                        new SqlParameter("@IDVALUE_2_P", int.Parse("-1")),<br />
                        new SqlParameter("@IDVALUE_2_K", int.Parse("-1")),<br />
                        new SqlParameter("@IDSUBCAT_3", int.Parse("-1")),<br />
                        new SqlParameter("@IDVALUE_3_P", int.Parse("-1")),<br />
                        new SqlParameter("@IDVALUE_3_K", int.Parse("-1")),<br />
                        new SqlParameter("@IDSUBCAT_4", int.Parse("-1")),<br />
                        new SqlParameter("@IDVALUE_4_P", int.Parse("-1")),<br />
                        new SqlParameter("@IDVALUE_4_K", int.Parse("-1")),<br />
                        new SqlParameter("@IDSUBCAT_5", int.Parse("-1")),<br />
                        new SqlParameter("@IDVALUE_5_P", int.Parse("-1")),<br />
                        new SqlParameter("@IDVALUE_5_K", int.Parse("-1")),<br />
                        new SqlParameter("@IDSUBCAT_6", int.Parse("-1")),<br />
                        new SqlParameter("@IDVALUE_6_P", int.Parse("-1")),<br />
                        new SqlParameter("@IDVALUE_6_K", int.Parse("-1")),<br />
                        new SqlParameter("@IDSUBCAT_7", int.Parse("-1")),<br />
                        new SqlParameter("@IDVALUE_7_P", int.Parse("-1")),<br />
                        new SqlParameter("@IDVALUE_7_K", int.Parse("-1")),<br />
                        new SqlParameter("@IDSUBCAT_8", int.Parse("-1")),<br />
                        new SqlParameter("@IDVALUE_8_P", int.Parse("-1")),<br />
                        new SqlParameter("@IDVALUE_8_K", int.Parse("-1")),<br />
                        new SqlParameter("@IDSUBCAT_9", int.Parse("-1")),<br />
                        new SqlParameter("@IDVALUE_9_P", int.Parse("-1")),<br />
                        new SqlParameter("@IDVALUE_9_K", int.Parse("-1")),<br />
                        new SqlParameter("@IDSUBCAT_10", int.Parse("-1")),<br />
                        new SqlParameter("@IDVALUE_10_P", int.Parse("-1")),<br />
                        new SqlParameter("@IDVALUE_10_K", int.Parse("-1"))};<br />
<br />
            return (dt_Product[])Data.DataReader.DB_Get(typeof(dt_Product), "Product_Search", p);<br />
        }<br />


another horror i found in their code was the pagination of the search results ..
long story short after completing the search they did a 'for' loop for all of the results and if i % 5 == 0 they put link to i / 5 page.
also they displayed results in another loop which also was for whole collection.. they checked if i was in range of the page...

all i could say then was: damn =_=' ...

life is study!!!

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.