• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 10:51
CET 15:51
KST 23:51
  • 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
Intel X Team Liquid Seoul event: Showmatches and Meet the Pros9[ASL20] Finals Preview: Arrival13TL.net Map Contest #21: Voting10[ASL20] Ro4 Preview: Descent11Team TLMC #5: Winners Announced!3
Community News
Weekly Cups (Oct 20-26): MaxPax, Clem, Creator win52025 RSL Offline Finals Dates + Ticket Sales!10BSL21 Open Qualifiers Week & CONFIRM PARTICIPATION1Crank Gathers Season 2: SC II Pro Teams10Merivale 8 Open - LAN - Stellar Fest4
StarCraft 2
General
RotterdaM "Serral is the GOAT, and it's not close" Intel X Team Liquid Seoul event: Showmatches and Meet the Pros Weekly Cups (Oct 20-26): MaxPax, Clem, Creator win Weekly Cups (Oct 13-19): Clem Goes for Four DreamHack Open 2013 revealed
Tourneys
SC4ALL $6,000 Open LAN in Philadelphia Kirktown Chat Brawl #9 $50 8:30PM EST 2025 RSL Offline Finals Dates + Ticket Sales! Merivale 8 Open - LAN - Stellar Fest Crank Gathers Season 2: SC II Pro Teams
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 497 Battle Haredened Mutation # 496 Endless Infection Mutation # 495 Rest In Peace Mutation # 494 Unstable Environment
Brood War
General
Ladder Map Matchup Stats Map pack for 3v3/4v4/FFA games BW General Discussion SnOw's ASL S20 Finals Review [ASL20] Ask the mapmakers — Drop your questions
Tourneys
[ASL20] Grand Finals Small VOD Thread 2.0 The Casual Games of the Week Thread BSL21 Open Qualifiers Week & CONFIRM PARTICIPATION
Strategy
PvZ map balance Current Meta How to stay on top of macro? Soma's 9 hatch build from ASL Game 2
Other Games
General Games
Nintendo Switch Thread Path of Exile Dawn of War IV Beyond All Reason Stormgate/Frost Giant Megathread
Dota 2
Official 'what is Dota anymore' discussion LiquidDota to reintegrate into TL.net
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
TL Mafia Community Thread SPIRED by.ASL Mafia {211640}
Community
General
Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine US Politics Mega-thread The Big Programming Thread YouTube Thread
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
Anime Discussion Thread Movie Discussion! [Manga] One Piece Korean Music Discussion Series you have seen recently...
Sports
TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion MLB/Baseball 2023 2024 - 2026 Football Thread NBA General Discussion
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Recent Gifted Posts
Blogs
Career Paths and Skills for …
TrAiDoS
KPDH "Golden" as Squid Game…
Peanutsc
Reality "theory" prov…
perfectspheres
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1687 users

More From Bob

Blogs > tofucake
Post a Reply
tofucake
Profile Blog Joined October 2009
Hyrule19150 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
Calgary25986 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
Aiur21549 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
Hyrule19150 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
Aiur21549 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
Hyrule19150 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
SC4ALL
14:00
SC4All Day 1
LiquipediaDiscussion
SC4ALL
14:00
SC4ALL - Day 1
RotterdaM258
IndyStarCraft 101
CranKy Ducklings85
SteadfastSC84
LiquipediaDiscussion
BSL Team A[vengers]
14:00
Day 3
Dewalt vs ZeLoT
UltrA vs ZeLoT
ZZZero.O110
LiquipediaDiscussion
Epic.LAN
12:00
Epic.LAN 46 Playoffs Stage
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Artosis 524
Lowko404
RotterdaM 258
IndyStarCraft 101
LamboSC2 101
Rex 89
SteadfastSC 84
Codebar 27
StarCraft: Brood War
Calm 5933
PianO 3192
Barracks 523
sorry 375
Last 209
ZZZero.O 110
Dewaltoss 83
zelot 82
Bonyth 62
HiyA 51
[ Show more ]
ToSsGirL 32
Rock 23
Shine 23
910 13
Terrorterran 12
Dota 2
Gorgc3444
qojqva2706
syndereN143
League of Legends
Reynor139
Counter-Strike
fl0m826
PGG 121
Heroes of the Storm
Khaldor262
Other Games
singsing1801
B2W.Neo1323
DeMusliM333
Hui .208
Liquid`LucifroN172
XcaliburYe161
KnowMe95
Mew2King69
QueenE58
nookyyy 58
Organizations
Counter-Strike
PGL21419
Other Games
gamesdonequick986
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
StarCraft 2
ComeBackTV 0
StarCraft: Brood War
sctven
[ Show 18 non-featured ]
StarCraft 2
• StrangeGG 56
• Adnapsc2 18
• iHatsuTV 3
• IndyKCrew
• AfreecaTV YouTube
• intothetv
• Kozan
• sooper7s
• LaughNgamezSOOP
• Migwel
StarCraft: Brood War
• Michael_bg 1
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• WagamamaTV323
• Ler85
League of Legends
• Nemesis3696
• Jankos2925
Upcoming Events
BSL 21
4h 9m
BSL Team A[vengers]
23h 9m
Cross vs Sobenz
Sziky vs IcaruS
SC4ALL
1d
SC4ALL
1d
BSL 21
1d 4h
Replay Cast
1d 18h
Wardi Open
1d 21h
Monday Night Weeklies
2 days
Replay Cast
2 days
Sparkling Tuna Cup
2 days
[ Show More ]
WardiTV Korean Royale
2 days
Replay Cast
3 days
WardiTV Korean Royale
3 days
The PondCast
4 days
Korean StarCraft League
6 days
CranKy Ducklings
6 days
Liquipedia Results

Completed

CSL 2025 AUTUMN (S18)
CranK Gathers Season 2: SC II Pro Teams
Eternal Conflict S1

Ongoing

BSL 21 Points
BSL 21 Team A
C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
SOOP Univ League 2025
SC4ALL: Brood War
SC4ALL: StarCraft II
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025

Upcoming

YSL S2
BSL Season 21
SLON Tour Season 2
BSL 21 Non-Korean Championship
RSL Offline Finals
WardiTV 2025
RSL Revival: Season 3
Stellar Fest
META Madness #9
BLAST Bounty Winter 2026: Closed Qualifier
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 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.