Feed aggregator
China Launches GPMI, a Powerful Alternative To HDMI and DisplayPort
Read more of this story at Slashdot.
Waymo May Use Interior Camera Data To Train Generative AI Models, Sell Ads
Read more of this story at Slashdot.
UK Bans Fake Reviews and 'Sneaky' Fees For Online Products
Read more of this story at Slashdot.
Scientists Debate Actual Weight of the Internet
Read more of this story at Slashdot.
Apple Rushes Shipments From India To Dodge Tariffs
Read more of this story at Slashdot.
Trump Opens Trade Talks Window While Threatening China With Steeper Tariffs
Read more of this story at Slashdot.
UK Effort To Keep Apple Encryption Fight Secret Is Blocked
Read more of this story at Slashdot.
Microsoft AI Chief Sees Advantage in Building Models '3 or 6 Months Behind'
Read more of this story at Slashdot.
America's NIH Scientists Have a Cancer Breakthrough. Layoffs are Delaying It.
Read more of this story at Slashdot.
Can Using a Dumber Phone Cure 'Brain Rot'?
Read more of this story at Slashdot.
CodeSOD: Unnavigable
Do you know what I had forgotten until this morning? That VBScript (and thus, older versions of Visual Basic) don't require you to use parentheses when calling a function. Foo 5 and Foo(5) are the same thing.
Of course, why would I remember that? I thankfully haven't touched any of those languages since about… 2012. Which is actually a horrifyingly short time ago, back when I supported classic ASP web apps. Even when I did, I always used parentheses because I wanted my code to be something close to readable.
Classic ASP, there's a WTF for you. All the joy of the way PHP mixes markup and code into a single document, but with an arguably worse and weirder language.
Which finally, brings us to Josh's code. Josh worked for a traveling exhibition company, and that company had an entirely homebrewed CMS written in classic ASP. Here's a few hundred lines out of their navigation menu.
<ul class=menuMain> <% if menu = "1" then Response.Write "<li class='activ'><b></b><i></i><a href='/home.asp' title='Home'>Home</a></li>" else Response.Write "<li><a href='/home.asp' title='Home'>Home</a></li>" end if if menu = "2" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/about_wc_homepage.asp' title='About World Challenge'>About us</a></li>" else Response.Write "<li><a href='/expeditions/about_wc_homepage.asp' title='About World Challenge'>About us</a></li>" end if if menu = "3" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/book-a-school-expedition.asp' title='How to book'>How to book</a></li>" else Response.Write "<li><a href='/expeditions/book-a-school-expedition.asp' title='How to book'>How to book</a></li>" end if if menu = "4" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/expeditions_home.asp' title='Expeditions'>Expeditions</a></li>" else Response.Write "<li><a href='/expeditions/expeditions_home.asp' title='Expeditions'>Expeditions</a></li>" end if if menu = "5" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/safety_home.asp' title='Safety'>Safety</a></li>" else Response.Write "<li><a href='/expeditions/safety_home.asp' title='Safety'>Safety</a></li>" end if if menu = "6" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/mm_what_is_mm.asp' title='Fundraising support'>Fundraising</a></li>" else Response.Write "<li><a href='/expeditions/mm_what_is_mm.asp' title='Fundraising support'>Fundraising</a></li>" end if if menu = "7" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/careers_home.asp' title='Work for us'>Work for us</a></li>" else Response.Write "<li><a href='/expeditions/careers_home.asp' title='Work for us'>Work for us</a></li>" end if if menu = "8" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/contact_us_home.asp' title='Contact us'>Contact us</a></li>" else Response.Write "<li><a href='/expeditions/contact_us_home.asp' title='Contact us'>Contact us</a></li>" end if Response.Write "</ul>" Response.Write "<ul class='menuSub'>" if menu = "1" then end if if menu = "2" then if submenu = "1" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/about_wc_who_we_are.asp' title='Who we are'>Who we are</a></li>" else Response.Write "<li><a href='/expeditions/about_wc_who_we_are.asp'title='Who we are'>Who we are</a></li>" end if if submenu = "2" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/world_challenge_CSR.asp' title='CSR'>CSR</a></li>" else Response.Write "<li><a href='/expeditions/world_challenge_CSR.asp' title='CSR'>CSR</a></li>" end if if submenu = "3" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/World-Challenge-Accreditation.asp' title='Partners and accreditation'>Partners and accreditation</a></li>" else Response.Write "<li><a href='/expeditions/World-Challenge-Accreditation.asp' title='Partners and accreditation'>Partners and accreditation</a></li>" end if if submenu = "4" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/curriculum-links.asp' title='Curriculum links'>Curriculum links</a></li>" else Response.Write "<li><a href='/expeditions/curriculum-links.asp' title='Curriculum links'>Curriculum links</a></li>" end if if submenu = "5" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/expedition_advice.asp' title='Expedition advice'>Expedition advice</a></li>" else Response.Write "<li><a href='/expeditions/expedition_advice.asp' title='Expedition advice'>Expedition advice</a></li>" end if if submenu = "6" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/about_wc_press_and_publications.asp' title='Press resources'>Press resources</a></li>" else Response.Write "<li><a href='/expeditions/about_wc_press_and_publications.asp' title='Press resources'>Press resources</a></li>" end if end if if menu = "3" then Response.Write "<li></li>" end if if menu = "4" then if submenu = "1" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/exped_lh_dest_ca.asp' title='Central & North America'>Central and North America</a></li>" else Response.Write "<li><a href='/expeditions/exped_lh_dest_ca.asp' title='Central and North America'>Central and North America</a></li>" end if if submenu = "2" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/exped_lh_dest_sa.asp' title='South America'>South America</a></li>" else Response.Write "<li><a href='/expeditions/exped_lh_dest_sa.asp' title='South America'>South America</a></li>" end if if submenu = "3" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/exped_lh_dest_sea.asp' title='South East Asia'>South East Asia</a></li>" else Response.Write "<li><a href='/expeditions/exped_lh_dest_sea.asp' title='South East Asia'>South East Asia</a></li>" end if if submenu = "4" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/exped_lh_dest_asia.asp' title='Asia'>Asia</a></li>" else Response.Write "<li><a href='/expeditions/exped_lh_dest_asia.asp' title='Asia'>Asia</a></li>" end if if submenu = "5" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/exped_lh_dest_africa.asp' title='Africa'>Africa</a></li>" else Response.Write "<li><a href='/expeditions/exped_lh_dest_africa.asp' title='Africa'>Africa</a></li>" end if if submenu = "6" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/europe_school_expeditions.asp' title='Europe'>Europe</a></li>" else Response.Write "<li><a href='/expeditions/europe_school_expeditions.asp' title='Europe'>Europe</a></li>" end if if submenu = "7" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/community-projects.asp' title='Community projects'>Community projects</a></li>" else Response.Write "<li><a href='/expeditions/community-projects.asp' title='Community projects'>Community projects</a></li>" end if if submenu = "8" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/exped_indiv_home.asp' title='Independent'>Independent</a></li>" else Response.Write "<li><a href='/expeditions/exped_indiv_home.asp' title='Independent'>Independent</a></li>" end if end if if menu = "5" then if submenu = "1" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/safe-people.asp' title='Safe People'>Safe people</a></li>" else Response.Write "<li><a href='/expeditions/safe-people.asp' title='Safe People'>Safe people</a></li>" end if if submenu = "2" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/safe-place.asp' title='Safe places'>Safe places</a></li>" else Response.Write "<li><a href='/expeditions/safe-place.asp' title='Safe places'>Safe places</a></li>" end if if submenu = "3" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/safe-policies-practises.asp' title='Safe practices and policies'>Safe practices and policies</a></li>" else Response.Write "<li><a href='/expeditions/safe-policies-practises.asp' title='Safe practices and policies'>Safe practices and policies</a></li>" end if if submenu = "4" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/safe-resources.asp' title='Safe Resources'>Safe resources</a></li>" else Response.Write "<li><a href='/expeditions/safe-resources.asp' title='Safe Resources'>Safe resources</a></li>" end if if submenu = "5" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/safety_ops_centre.asp' title='Operations Centre'>Operations Centre</a></li>" else Response.Write "<li><a href='/expeditions/safety_ops_centre.asp' title='Operations Centre'>Operations Centre</a></li>" end if if submenu = "6" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/travel_safety_course.asp' title='Travelsafe course'>Travelsafe course</a></li>" else Response.Write "<li><a href='/expeditions/travel_safety_course.asp' title='Travelsafe course'>Travelsafe course</a></li>" end if end if if menu = "6" then ' if submenu = "1" then ' Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/fundraising-team.asp' title='Fundraising team'>Fundraising team</a></li>" ' else ' Response.Write "<li><a href='/expeditions/fundraising-team.asp' title='Fundraising team'>Fundraising team</a></li>" ' end if if submenu = "2" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/mm_ideas.asp' title='Fundraising ideas'>Fundraising ideas</a></li>" else Response.Write "<li><a href='/expeditions/mm_ideas.asp' title='Fundraising ideas'>Fundraising ideas</a></li>" end if if submenu = "3" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/about_wc_events_challenger_events.asp' title='Fundraising events'>Fundraising events</a></li>" else Response.Write "<li><a href='/expeditions/about_wc_events_challenger_events.asp' title='Fundraising events'>Fundraising events</a></li>" end if end if if menu = "7" then if submenu = "1" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/careers_leader_ops_overseas.asp' title='Lead an expedition'>Lead an expedition</a></li>" else Response.Write "<li><a href='/expeditions/careers_leader_ops_overseas.asp' title='Lead an expedition'>Lead an expedition</a></li>" end if if submenu = "2" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/permanent_jobs_world_challenge.asp' title='Office based positions'>Office based positions</a></li>" else Response.Write "<li><a href='/expeditions/permanent_jobs_world_challenge.asp' title='Office based positions'>Office based positions</a></li>" end if end if if menu = "8" then if submenu = "1" then Response.Write "<li class='activ'><b></b><i></i><a href='/pages/forms-brochure.asp' title='Request a brochure'>Request a brochure</a></li>" else Response.Write "<li><a href='/pages/forms-brochure.asp' title='Request a brochure'>Request a brochure</a></li>" end if if submenu = "2" then Response.Write "<li class='activ'><b></b><i></i><a rel='external' href='http://f.chtah.com/s/3/2069554126/signup.html' title='Sign up for e-news'>Sign up for e-news</a></li>" else Response.Write "<li><a rel='external' href='http://f.chtah.com/s/3/2069554126/signup.html' title='Sign up for e-news'>Sign up for e-news</a></li>" end if if submenu = "3" then Response.Write "<li class='activ'><b></b><i></i><a href='/expeditions/about_wc_press_and_publications.asp' title='Press resources'>Press resources</a></li>" else Response.Write "<li><a href='/expeditions/about_wc_press_and_publications.asp' title='Press resources'>Press resources</a></li>" end if end if %> </ul>This renders the whole menu, but based on the selected menu and submenu, it adds an activ class to the HTML elements. Which means that each HTML element is defined here twice, once with and without the CSS class on it. I know folks like to talk about dry code, but this code is SOGGY with repetition. Just absolutely dripping wet with the same thing multiple times. Moist.
[Advertisement] ProGet’s got you covered with security and access controls on your NuGet feeds. Learn more.The Tumblr Revival is Real - and Gen Z is Leading the Charge
Read more of this story at Slashdot.
As Stocks (and Cryptocurrencies) Drop After Tariffs, France Considers Retaliating Against US Big Tech
Read more of this story at Slashdot.
Microsoft's Copilot Roasts Bill Gates, Steve Ballmer, and Satya Nadella
Read more of this story at Slashdot.
Could We Reach Mars Faster With Nuclear Fusion-Powered Rockets?
Read more of this story at Slashdot.
'Minecraft Movie' Scores Biggest Videogame Movie Opening Ever, Faces Early Leaks Online
Read more of this story at Slashdot.
NFL Adopts Sony's 'Virtual Measurements' for Football's First Downs
Read more of this story at Slashdot.
In 'Milestone' for Open Source, Meta Releases New Benchmark-Beating Llama 4 Models
Read more of this story at Slashdot.
Forget 'Snow Sequoia'. Now I'm Cheering for Better Linux Hardware
Read more of this story at Slashdot.
After 48 Years, Voyager Scientist Confronts the Mission's Final Years
Read more of this story at Slashdot.