• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 02:23
CET 08:23
KST 16:23
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
RSL Revival - 2025 Season Finals Preview5RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12
Community News
Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump1Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced15[BSL21] Ro.16 Group Stage (C->B->A->D)4Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win3
StarCraft 2
General
RSL Revival - 2025 Season Finals Preview Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump Chinese SC2 server to reopen; live all-star event in Hangzhou Maestros of the Game: Live Finals Preview (RO4) BGE Stara Zagora 2026 announced
Tourneys
RSL Offline Finals Info - Dec 13 and 14! Tenacious Turtle Tussle 2025 RSL Offline Finals Dates + Ticket Sales! Sparkling Tuna Cup - Weekly Open Tournament StarCraft2.fi 15th Anniversary Cup
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 503 Fowl Play Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress Mutation # 500 Fright night
Brood War
General
FlaSh on: Biggest Problem With SnOw's Playstyle BGH Auto Balance -> http://bghmmr.eu/ [BSL21] RO8 Bracket & Prediction Contest BW General Discussion Let's talk about Metropolis
Tourneys
[ASL20] Grand Finals [BSL21] RO8 - Day 2 - Sunday 21:00 CET [BSL21] RO8 - Day 1 - Saturday 21:00 CET Small VOD Thread 2.0
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates Current Meta Game Theory for Starcraft
Other Games
General Games
Dawn of War IV Path of Exile Stormgate/Frost Giant Megathread Awesome Games Done Quick 2026! Nintendo Switch Thread
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas Survivor II: The Amazon Sengoku Mafia TL Mafia Community Thread
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine YouTube Thread European Politico-economics QA Mega-thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece Movie Discussion!
Sports
Formula 1 Discussion 2024 - 2026 Football Thread
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
TL+ Announced Where to ask questions and add stream?
Blogs
How Sleep Deprivation Affect…
TrAiDoS
I decided to write a webnov…
DjKniteX
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 804 users

More From Bob

Blogs > tofucake
Post a Reply
tofucake
Profile Blog Joined October 2009
Hyrule19177 Posts
Last Edited: 2010-07-13 01:42:24
July 12 2010 21:04 GMT
#1
I'm at work, so I'll do an analysis when I get home. But here's some more from Bob, with my version underneath:
Bob's version:
$query = "SELECT MAX( ProcessingDate ) FROM processinglog WHERE ProcessingTypeCode = 'D' ";
$i = 0;
$result = mysql_query( $query );
$entrydate = date('Y' ).'-'.date( 'm' ).'-'.date( 'd' );

$duedate = new DateTime( $entrydate );
$dd = date_format( $duedate, 'd' );
$dm = date_format( $duedate, 'm' );
$dy = date_format( $duedate, 'Y' );
$tstamp = mktime( 0, 0, 0, $dm, $dd, $dy);

while ( $row = mysql_fetch_array( $result, MYSQL_NUM ) )
{
$lastdateprocessed = $row[ 0 ];
$duedate = new DateTime( $lastdateprocessed );
$duedate -> modify( '+1 days' );
$dd = date_format( $duedate, 'd' );
$dm = date_format( $duedate, 'm' );
$dy = date_format( $duedate, 'Y' );
$processdate = $dy.'-'.$dm.'-'.$dd;

$i++;
}
if ($i == 0 ){

$duedate = new DateTime( $entrydate );
$duedate -> modify( '-1 days' );
$dd = date_format( $duedate, 'd' );
$dm = date_format( $duedate, 'm' );
$dy = date_format( $duedate, 'Y' );
$processdate = $dy.'-'.$dm.'-'.$dd;
}

// preform daily processing if the last day processed is less than the previous day

// loop for processdate = processdate to yesterday

$duedate = new DateTime( $processdate );
$dd = date_format( $duedate, 'd' );
$dm = date_format( $duedate, 'm' );
$dy = date_format( $duedate, 'Y' );
$pstamp = mktime( 0, 0, 0, $dm, $dd, $dy);
while ( $pstamp < $tstamp )
{
$duedate = new DateTime( $processdate );
$dd = date_format( $duedate, 'd' );
$dm = date_format( $duedate, 'm' );
$dy = date_format( $duedate, 'Y' );
$iday = (int)$dd;
$imonth = (int)$dm;
$iyear = (int)$dy;
$processmonth = 100 * $iyear + $imonth;
// snip another 1500 lines


My version:
$tstamp = time();

$query = "SELECT MAX(`ProcessingDate`) ProcessingDate FROM `processinglog` WHERE `ProcessingTypeCode` = 'D' ";
checkErr($res = $DB->Query($query, __FILE__, __LINE__));
$row = $DB->Fetch($res);

if($row === FALSE)
{
$process = new DateTime();
$process->setTimestamp($tstamp);
$process->modify('-1 days');
} else {
$process = new DateTime($row['ProcessingDate']);
$process->modify('+1 days');
}

$processdate = $process->format('Y-m-d');
$pstamp = $process->getTimestamp();

while($pstamp < $tstamp)
{
$processmonth = $process->format('Ym');


le sigh...

[update]
So I said I'd elaborate, but I'm tired (I just scrubbed my kitchen floor), so here's a rough overview

$entrydate = date('Y' ).'-'.date( 'm' ).'-'.date( 'd' );

$duedate = new DateTime( $entrydate );
$dd = date_format( $duedate, 'd' );
$dm = date_format( $duedate, 'm' );
$dy = date_format( $duedate, 'Y' );
$tstamp = mktime( 0, 0, 0, $dm, $dd, $dy);


You may look at that and think "Ok, that looks reasonable". But all it actually did was
$tstamp = time();


.....and that's it. But no, Bob decided to do it the hard way. Even most bad PHP developers I know would have at LEAST done date('Y-m-d' ). Then he takes it a step further and instantiates a DateTime object and another 3 strings. Slow to the max, especially on the crappy machines my office uses as "servers" (and I don't mean him doing it once slows down the site, that's negligible, but he does it thousands of times accross many thousands of files).

**
Liquipediaasante sana squash banana
illu
Profile Blog Joined December 2008
Canada2531 Posts
July 12 2010 21:08 GMT
#2
WTF???
:]
Chef
Profile Blog Joined August 2005
10810 Posts
July 12 2010 21:09 GMT
#3
You should solidify Bob's stapler in Jello. That'll learn him!
LEGEND!! LEGEND!!
Atom Cannister
Profile Blog Joined April 2009
Germany380 Posts
July 12 2010 21:23 GMT
#4
I wish I could understand just so I could fit in...
...
Chill
Profile Blog Joined January 2005
Calgary25989 Posts
July 12 2010 21:28 GMT
#5
If I give you some code I wrote will you do me next?
Moderator
Baksteen
Profile Blog Joined June 2010
Netherlands438 Posts
July 12 2010 21:32 GMT
#6
Why be hatin' on the bob

Though i don't understand i presume that less characters = better coding?

gj!
Derp Derp Derp
ella_guru
Profile Blog Joined August 2009
Canada1741 Posts
July 12 2010 21:51 GMT
#7
These are getting boring and just turning into brag blog.

I like bob. He seems to represent the common man, not really specialized in anything but doing his best to keep a grasp of the fleeting world around him, accepting the fact that as he gets older, the young people will always stay young. A foot in both realities, but is everything I can hope to be.
Each day gets better : )
PanN
Profile Blog Joined December 2008
United States2828 Posts
July 12 2010 22:00 GMT
#8
Is this really a code bragging blog?
We have multiple brackets generated in advance. Relax . (Kennigit) I just simply do not understand how it can be the time to play can be 22nd at 9:30 pm PST / midnight the 23rd at the same time. (GGzerg)
SonuvBob
Profile Blog Joined October 2006
Aiur21550 Posts
July 12 2010 22:09 GMT
#9
I'd like to mention that this Bob is in no way related to me.

Though some of TL's old code looked a lot like the example above. Except the variable names were in Dutch ($dag, $jaar, etc) :p
Administrator
LTT
Profile Blog Joined March 2003
Shakuras1095 Posts
July 12 2010 23:00 GMT
#10
On July 13 2010 07:09 SonuvBob wrote:
I'd like to mention that this Bob is in no way related to me.


[image loading]
tofucake
Profile Blog Joined October 2009
Hyrule19177 Posts
July 12 2010 23:02 GMT
#11
On July 13 2010 06:09 Chef wrote:
You should solidify Bob's stapler in Jello. That'll learn him!

Bob is no longer with the company.

On July 13 2010 06:28 Chill wrote:
If I give you some code I wrote will you do me next?

Ok!

On July 13 2010 06:32 Baksteen wrote:
Why be hatin' on the bob

Though i don't understand i presume that less characters = better coding?

gj!

Not necessarily. But when you can do something BETTER in 1 line than you can in 5, then yes.

On July 13 2010 06:51 ella_guru wrote:
These are getting boring and just turning into brag blog.

I like bob. He seems to represent the common man, not really specialized in anything but doing his best to keep a grasp of the fleeting world around him, accepting the fact that as he gets older, the young people will always stay young. A foot in both realities, but is everything I can hope to be.

More like he figured out how to go right by making 3 lefts.

On July 13 2010 07:00 PanN wrote:
Is this really a code bragging blog?

Somewhat? It's more of a "omfg I actually have to READ this crap all day" blog.

On July 13 2010 07:09 SonuvBob wrote:
I'd like to mention that this Bob is in no way related to me.

Though some of TL's old code looked a lot like the example above. Except the variable names were in Dutch ($dag, $jaar, etc) :p

at least they weren't things like
//                         initialize amortized origination fees
$amortizedoriginationfees = 0.00;
Liquipediaasante sana squash banana
SonuvBob
Profile Blog Joined October 2006
Aiur21550 Posts
July 13 2010 01:15 GMT
#12
What's wrong with that? The redundant comment and the unreadable variable name cancel each other out.
Administrator
tofucake
Profile Blog Joined October 2009
Hyrule19177 Posts
July 13 2010 01:31 GMT
#13
Yes, they cancel each other out and leave me with
                               =              0.00;

which isn't very helpful!
Liquipediaasante sana squash banana
Please log in or register to reply.
Live Events Refresh
RSL Revival
04:30
Last Chance Qualifier
Crank 1039
Tasteless871
RotterdaM294
IndyStarCraft 105
CranKy Ducklings83
3DClanTV 68
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Crank 1039
Tasteless 871
WinterStarcraft592
RotterdaM 294
IndyStarCraft 105
Nina 74
StarCraft: Brood War
Killer 1737
actioN 576
Hyun 450
Stork 312
Leta 122
sorry 97
910 73
soO 43
Sacsri 32
Mind 26
[ Show more ]
Movie 20
Bale 19
NotJumperer 12
Dota 2
LuMiX1
League of Legends
JimRising 633
C9.Mang0441
Other Games
summit1g9524
XaKoH 152
Mew2King58
Livibee50
ViBE46
Trikslyr22
Organizations
Other Games
gamesdonequick742
StarCraft: Brood War
lovetv 6
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 13 non-featured ]
StarCraft 2
• Berry_CruncH111
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Stunt423
• HappyZerGling143
Upcoming Events
StarCraft2.fi
2h 37m
IPSL
9h 37m
Sziky vs JDConan
OSC
9h 37m
Solar vs Percival
Gerald vs Nicoract
Creator vs ByuN
BSL 21
12h 37m
Sziky vs StRyKeR
Hawk vs Dewalt
RSL Revival
21h 7m
Classic vs TBD
herO vs Zoun
WardiTV 2025
1d 5h
herO vs ShoWTimE
SHIN vs herO
Clem vs herO
SHIN vs Clem
SHIN vs ShoWTimE
Clem vs ShoWTimE
IPSL
1d 9h
Tarson vs DragOn
BSL 21
1d 12h
Tech vs Cross
Bonyth vs eOnzErG
Replay Cast
2 days
Wardi Open
2 days
[ Show More ]
Monday Night Weeklies
2 days
Sparkling Tuna Cup
3 days
Replay Cast
4 days
The PondCast
5 days
Liquipedia Results

Completed

Acropolis #4 - TS3
RSL Revival: Season 3
Kuram Kup

Ongoing

IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
Slon Tour Season 2
WardiTV 2025
RSL Offline Finals
META Madness #9
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Big Gabe Cup #3
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.