• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 05:06
CET 11:06
KST 19:06
  • 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 Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10
Community News
BGE Stara Zagora 2026 announced9[BSL21] Ro.16 Group Stage (C->B->A->D)4Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win3RSL Season 3: RO16 results & RO8 bracket13Weekly Cups (Nov 10-16): Reynor, Solar lead Zerg surge2
StarCraft 2
General
BGE Stara Zagora 2026 announced SC: Evo Complete - Ranked Ladder OPEN ALPHA When will we find out if there are more tournament Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win Weekly Cups (Nov 10-16): Reynor, Solar lead Zerg surge
Tourneys
RSL Revival: Season 3 Constellation Cup - Main Event - Stellar Fest Tenacious Turtle Tussle [Alpha Pro Series] Nice vs Cure $5,000+ WardiTV 2025 Championship
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 501 Price of Progress Mutation # 500 Fright night Mutation # 499 Chilling Adaptation Mutation # 498 Wheel of Misfortune|Cradle of Death
Brood War
General
Which season is the best in ASL? BW General Discussion A cwal.gg Extension - Easily keep track of anyone soO on: FanTaSy's Potential Return to StarCraft BGH Auto Balance -> http://bghmmr.eu/
Tourneys
[Megathread] Daily Proleagues [BSL21] RO16 Group B - Sunday 21:00 CET [BSL21] RO16 Group C - Saturday 21:00 CET Small VOD Thread 2.0
Strategy
Game Theory for Starcraft How to stay on top of macro? Current Meta PvZ map balance
Other Games
General Games
Nintendo Switch Thread The Perfect Game Stormgate/Frost Giant Megathread Beyond All Reason Should offensive tower rushing be viable in RTS games?
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 TL Mafia Community Thread
Community
General
The Big Programming Thread Russo-Ukrainian War Thread US Politics Mega-thread Things Aren’t Peaceful in Palestine Artificial Intelligence Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
[Manga] One Piece Movie Discussion! Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Where to ask questions and add stream? The Automated Ban List
Blogs
Esports Earnings: Bigger Pri…
TrAiDoS
Thanks for the RSL
Hildegard
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1359 users

More From Bob

Blogs > tofucake
Post a Reply
tofucake
Profile Blog Joined October 2009
Hyrule19162 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
Hyrule19162 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
Hyrule19162 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
Replay Cast
09:00
2025 KFC Monthly #3 - Day 3
CranKy Ducklings127
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SortOf 205
MindelVK 2
StarCraft: Brood War
Britney 35091
PianO 4289
Horang2 1318
Larva 515
BeSt 378
Leta 278
Zeus 186
sorry 116
Bale 85
Dewaltoss 84
[ Show more ]
Hyun 78
Pusan 60
Backho 52
Shine 43
Sharp 38
Rush 29
ZerO 22
Noble 12
Stork 12
Terrorterran 10
IntoTheRainbow 9
Mong 2
Dota 2
XcaliburYe605
NeuroSwarm116
League of Legends
JimRising 493
Counter-Strike
byalli2627
PGG 154
oskar49
Heroes of the Storm
Khaldor171
Other Games
summit1g14828
ceh9577
Happy461
Mew2King239
Fuzer 214
ZerO(Twitch)3
Organizations
Dota 2
PGL Dota 2 - Main Stream440
StarCraft: Brood War
lovetv 13
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 13 non-featured ]
StarCraft 2
• LUISG 31
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota2154
League of Legends
• Lourlo1747
Upcoming Events
WardiTV Korean Royale
1h 54m
ByuN vs Cure
TBD vs NightMare
TBD vs Classic
TBD vs Solar
Zoun vs Creator
OSC
6h 54m
Sparkling Tuna Cup
23h 54m
WardiTV Korean Royale
1d 1h
TBD vs SHIN
TBD vs Reynor
TBD vs herO
Replay Cast
1d 13h
Wardi Open
2 days
Monday Night Weeklies
2 days
StarCraft2.fi
2 days
Replay Cast
2 days
Wardi Open
3 days
[ Show More ]
StarCraft2.fi
3 days
PiGosaur Monday
3 days
Wardi Open
4 days
StarCraft2.fi
4 days
Replay Cast
4 days
The PondCast
4 days
Replay Cast
5 days
Korean StarCraft League
6 days
CranKy Ducklings
6 days
Liquipedia Results

Completed

SOOP Univ League 2025
RSL Revival: Season 3
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
CSCL: Masked Kings S3
Slon Tour Season 2
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
StarSeries Fall 2025
FISSURE Playground #2

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter 2026: Closed Qualifier
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.