• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 06:45
CEST 12:45
KST 19:45
  • 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 1 - Final Week5[ASL19] Finals Recap: Standing Tall10HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0
Community News
Firefly given lifetime ban by ESIC following match-fixing investigation17$25,000 Streamerzone StarCraft Pro Series announced7Weekly Cups (June 30 - July 6): Classic Doubles6[BSL20] Non-Korean Championship 4x BSL + 4x China10Flash Announces Hiatus From ASL70
StarCraft 2
General
RSL Revival patreon money discussion thread Esports World Cup 2025 - Final Player Roster Server Blocker RSL Season 1 - Final Week The GOAT ranking of GOAT rankings
Tourneys
RSL: Revival, a new crowdfunded tournament series $25,000 Streamerzone StarCraft Pro Series announced FEL Cracov 2025 (July 27) - $8000 live event Sparkling Tuna Cup - Weekly Open Tournament WardiTV Mondays
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
https://www.facebook.com/SAINTSKINVitaminCSerumCan
External Content
Mutation # 481 Fear and Lava Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma
Brood War
General
Script to open stream directly using middle click A cwal.gg Extension - Easily keep track of anyone BW General Discussion ASL20 Preliminary Maps BGH Auto Balance -> http://bghmmr.eu/
Tourneys
[Megathread] Daily Proleagues Small VOD Thread 2.0 Last Minute Live-Report Thread Resource! [BSL20] Non-Korean Championship 4x BSL + 4x China
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Stormgate/Frost Giant Megathread Path of Exile CCLP - Command & Conquer League Project The PlayStation 5 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
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread The Accidental Video Game Porn Archive Stop Killing Games - European Citizens Initiative
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread [\m/] Heavy Metal Thread
Sports
2024 - 2025 Football Thread Formula 1 Discussion NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Men Take Risks, Women Win Ga…
TrAiDoS
momentary artworks from des…
tankgirl
from making sc maps to makin…
Husyelt
StarCraft improvement
iopq
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 718 users

More From Bob

Blogs > tofucake
Post a Reply
tofucake
Profile Blog Joined October 2009
Hyrule19033 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
Calgary25980 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
Hyrule19033 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
Hyrule19033 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
10:00
Season 1: Playoffs Day 7
SHIN vs ClemLIVE!
Cure vs TBD
Crank 1274
Tasteless937
ComeBackTV 921
IndyStarCraft 156
Rex102
3DClanTV 66
IntoTheiNu 18
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Crank 1274
Tasteless 937
mouzHeroMarine 417
Nina 169
IndyStarCraft 156
Rex 102
StarCraft: Brood War
Sea 4725
Jaedong 868
Nal_rA 528
ToSsGirL 348
firebathero 328
Light 252
PianO 203
Pusan 167
JulyZerg 160
Leta 147
[ Show more ]
Last 132
soO 113
Mind 78
EffOrt 55
sorry 46
GoRush 34
NaDa 25
Barracks 24
Shinee 19
zelot 19
NotJumperer 14
SilentControl 12
ivOry 3
Dota 2
XcaliburYe411
League of Legends
JimRising 472
Counter-Strike
pashabiceps1485
chrisJcsgo124
Heroes of the Storm
Khaldor218
Other Games
gofns28394
tarik_tv24896
shahzam401
DeMusliM334
crisheroes324
Fuzer 262
SortOf126
Lowko38
Trikslyr29
ArmadaUGS19
Organizations
Other Games
gamesdonequick33732
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 12 non-featured ]
StarCraft 2
• LUISG 7
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota2183
Upcoming Events
FEL
1h 15m
FEL
5h 15m
Gerald vs PAPI
Spirit vs ArT
CSO Cup
5h 15m
BSL20 Non-Korean Champi…
7h 15m
Bonyth vs QiaoGege
Dewalt vs Fengzi
Hawk vs Zhanhun
Sziky vs Mihu
Mihu vs QiaoGege
Zhanhun vs Sziky
Fengzi vs Hawk
DaveTesta Events
7h 15m
Sparkling Tuna Cup
23h 15m
RSL Revival
23h 15m
Classic vs TBD
FEL
1d 4h
BSL20 Non-Korean Champi…
1d 7h
Bonyth vs Dewalt
QiaoGege vs Dewalt
Hawk vs Bonyth
Sziky vs Fengzi
Mihu vs Zhanhun
QiaoGege vs Zhanhun
Fengzi vs Mihu
Wardi Open
2 days
[ Show More ]
Replay Cast
2 days
WardiTV European League
3 days
PiGosaur Monday
3 days
uThermal 2v2 Circuit
4 days
Replay Cast
4 days
The PondCast
4 days
Replay Cast
5 days
Epic.LAN
6 days
CranKy Ducklings
6 days
Liquipedia Results

Completed

KCM Race Survival 2025 Season 2
HSC XXVII
NC Random Cup

Ongoing

JPL Season 2
BSL 2v2 Season 3
Acropolis #3
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Jiahua Invitational
2025 ACS Season 2: Qualifier
CSLPRO Last Chance 2025
Championship of Russia 2025
RSL Revival: Season 1
Murky Cup #2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters

Upcoming

CSL Xiamen Invitational
CSL Xiamen Invitational: ShowMatche
2025 ACS Season 2
CSLPRO Chat StarLAN 3
K-Championship
uThermal 2v2 Main Event
SEL Season 2 Championship
FEL Cracov 2025
Esports World Cup 2025
Underdog Cup #2
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
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.