• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 08:12
CET 14:12
KST 22:12
  • 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 Preview8RSL 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
[BSL21] Non-Korean Championship - Starts Jan 100SC2 All-Star Invitational: Jan 17-1819Weekly Cups (Dec 22-28): Classic & MaxPax win, Percival surprises2Weekly Cups (Dec 15-21): Classic wins big, MaxPax & Clem take weeklies3ComeBackTV's documentary on Byun's Career !11
StarCraft 2
General
SC2 All-Star Invitational: Jan 17-18 Weekly Cups (Dec 22-28): Classic & MaxPax win, Percival surprises Chinese SC2 server to reopen; live all-star event in Hangzhou Starcraft 2 Zerg Coach ComeBackTV's documentary on Byun's Career !
Tourneys
OSC Season 13 World Championship WardiTV Mondays $5,000+ WardiTV 2025 Championship $100 Prize Pool - Winter Warp Gate Masters Showdow Sparkling Tuna Cup - Weekly Open Tournament
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 506 Warp Zone Mutation # 505 Rise From Ashes Mutation # 504 Retribution Mutation # 503 Fowl Play
Brood War
General
A cwal.gg Extension - Easily keep track of anyone I would like to say something about StarCraft BGH Auto Balance -> http://bghmmr.eu/ (UMS) SWITCHEROO *New* /Destination Edit/ What monitor do you use for playing Remastered?
Tourneys
SLON Grand Finals – Season 2 [BSL21] Non-Korean Championship - Starts Jan 10 [Megathread] Daily Proleagues [BSL21] Grand Finals - Sunday 21:00 CET
Strategy
Simple Questions, Simple Answers Current Meta [G] How to get started on ladder as a new Z player Fighting Spirit mining rates
Other Games
General Games
General RTS Discussion Thread Nintendo Switch Thread Awesome Games Done Quick 2026! Stormgate/Frost Giant Megathread Mechabellum
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
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas Survivor II: The Amazon Sengoku Mafia
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread Canadian Politics Mega-thread The Games Industry And ATVI 12 Days of Starcraft
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece
Sports
2024 - 2026 Football Thread Formula 1 Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List TL+ Announced
Blogs
National Diversity: A Challe…
TrAiDoS
I decided to write a webnov…
DjKniteX
James Bond movies ranking - pa…
Topin
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 962 users

More From Bob

Blogs > tofucake
Post a Reply
tofucake
Profile Blog Joined October 2009
Hyrule19186 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
Calgary25991 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
Hyrule19186 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
Hyrule19186 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
Platinum Heroes Events
13:00
PSC2L Finals - Playoffs
Percival vs NicoractLIVE!
NightMare vs Jumy
Krystianer vs Creator
Shameless vs Gerald
RotterdaM439
Liquipedia
OSC
13:00
World Championship: Challenger
WardiTV225
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RotterdaM 439
Lowko372
StarCraft: Brood War
Horang2 2090
PianO 1677
Jaedong 881
EffOrt 639
Shuttle 623
Stork 533
Soma 396
actioN 356
Larva 352
Light 302
[ Show more ]
Mini 298
firebathero 243
Hyuk 179
Sharp 149
ZerO 148
hero 147
ggaemo 121
Snow 108
Pusan 97
sorry 86
Barracks 84
Killer 79
Hyun 76
Mong 74
Rush 61
JYJ 60
ToSsGirL 51
Sea.KH 45
ajuk12(nOOB) 24
zelot 23
yabsab 23
soO 21
HiyA 20
Terrorterran 17
Rock 15
Sacsri 13
GoRush 11
scan(afreeca) 11
Noble 10
Shine 7
Dota 2
syndereN594
qojqva556
League of Legends
C9.Mang0459
Counter-Strike
x6flipin772
Other Games
B2W.Neo1754
Fuzer 245
ZerO(Twitch)12
hiko5
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 12 non-featured ]
StarCraft 2
• Adnapsc2 17
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos3130
Upcoming Events
Korean StarCraft League
13h 48m
OSC
22h 48m
IPSL
1d
Dewalt vs Bonyth
OSC
1d 4h
OSC
1d 22h
uThermal 2v2 Circuit
2 days
Replay Cast
2 days
Patches Events
3 days
OSC
3 days
OSC
4 days
[ Show More ]
OSC
6 days
Liquipedia Results

Completed

C-Race Season 1
WardiTV 2025
META Madness #9

Ongoing

IPSL Winter 2025-26
BSL Season 21
Slon Tour Season 2
CSL Season 19: Qualifier 2
Escore Tournament S1: W2
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025

Upcoming

CSL 2025 WINTER (S19)
Escore Tournament S1: W3
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Thunderfire SC2 All-star 2025
Big Gabe Cup #3
OSC Championship Season 13
Nations Cup 2026
Underdog Cup #3
NA Kuram Kup
ESL Pro League Season 23
ESL Pro League Season 23
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
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 © 2026 TLnet. All Rights Reserved.