Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
geonetix
Mar 6, 2011


Optimus Prime Ribs posted:

Well, that certainly is obfuscated... :monocle:

Yes, it's quite unwieldy.

Adbot
ADBOT LOVES YOU

EAT THE EGGS RICOLA
May 29, 2008

code:
jQuery(document).ready(function($){
  $.get("html/mypage.html", function(response){
    $("#foo").html(response);
  });
});
Pfft you can turn it into japanese-style emoticons too:

quote:

゚ω゚ノ= /`m´)ノ ~┻━┻ //*´∇`*/ ['_']; o=(゚ー゚) =_=3; c=(゚Θ゚) =(゚ー゚)-(゚ー゚); (゚Д゚) =(゚Θ゚)= (o^_^o)/ (o^_^o);(゚Д゚)={゚Θ゚: '_' ,゚ω゚ノ : ((゚ω゚ノ==3) +'_') [゚Θ゚] ,゚ー゚ノ :(゚ω゚ノ+ '_')[o^_^o -(゚Θ゚)] ,゚Д゚ノ:((゚ー゚==3) +'_')[゚ー゚] }; (゚Д゚) [゚Θ゚] =((゚ω゚ノ==3) +'_') [c^_^o];(゚Д゚) ['c'] = ((゚Д゚)+'_') [ (゚ー゚)+(゚ー゚)-(゚Θ゚) ];(゚Д゚) ['o'] = ((゚Д゚)+'_') [゚Θ゚];(゚o゚)=(゚Д゚) ['c']+(゚Д゚) ['o']+(゚ω゚ノ +'_')[゚Θ゚]+ ((゚ω゚ノ==3) +'_') [゚ー゚] + ((゚Д゚) +'_') [(゚ー゚)+(゚ー゚)]+ ((゚ー゚==3) +'_') [゚Θ゚]+((゚ー゚==3) +'_') [(゚ー゚) - (゚Θ゚)]+(゚Д゚) ['c']+((゚Д゚)+'_') [(゚ー゚)+(゚ー゚)]+ (゚Д゚) ['o']+((゚ー゚==3) +'_') [゚Θ゚];(゚Д゚) ['_'] =(o^_^o) [゚o゚] [゚o゚];(゚ε゚)=((゚ー゚==3) +'_') [゚Θ゚]+ (゚Д゚) .゚Д゚ノ+((゚Д゚)+'_') [(゚ー゚) + (゚ー゚)]+((゚ー゚==3) +'_') [o^_^o -゚Θ゚]+((゚ー゚==3) +'_') [゚Θ゚]+ (゚ω゚ノ +'_') [゚Θ゚]; (゚ー゚)+=(゚Θ゚); (゚Д゚)[゚ε゚]='\\'; (゚Д゚).゚Θ゚ノ=(゚Д゚+ ゚ー゚)[o^_^o -(゚Θ゚)];(o゚ー゚o)=(゚ω゚ノ +'_')[c^_^o];(゚Д゚) [゚o゚]='\"';(゚Д゚) ['_'] ( (゚Д゚) ['_'] (゚ε゚+(゚Д゚)[゚o゚]+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) - (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (o^_^o))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (o^_^o))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ (゚ー゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (o^_^o))+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚ー゚)+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ (゚ー゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (o^_^o))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (o^_^o))+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚ー゚)+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ (゚ー゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚ー゚)+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚ー゚)+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (o^_^o))+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚ー゚)+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (o^_^o))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (o^_^o))+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (o^_^o))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (o^_^o))+ (o^_^o)+ (゚Д゚)[゚o゚]) (゚Θ゚)) ('_');

senrath
Nov 4, 2009

Look Professor, a destruct switch!


Oh, right, it was the emoticon one that I overloaded by feeding it its own output too many times. Boy does that look a mess.

darthbob88
Oct 13, 2011

YOSPOS
I think I just came across a small coding horror; for the past while our service hasn't been logging sales from some of our clients, meaning that our data is out of date, which is bad. I managed to track down the most likely cause of the problem to a subtle typo. Observe.
JavaScript code:
//From the sales logging function.
if (Order[9]) _4TellBoost.setCustomerID(Order[9]);
var userID = _4TellBoost.getCustomerID();
//the functions I'm calling
_4TellBoost.setCustomerId();
_4TellBoost.getCustomerID();
Note a subtle difference. Fortunately this would be easy to change, only affects a dozen clients and not visibly, but, well, inconsistency like this is just waiting to cause more problems for whoever comes after me. We're currently tooling up to get processes and protocols in place for code changes, so I'm pushing to include a code review and refactor, to get rid of traps like this.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Surely that'd throw an exception? Or is there some other function called setCustomerId?

Mogomra
Nov 5, 2005

simply having a wonderful time
Anyone have any idea why this works?
http://jsfiddle.net/btleffler/jRteU/

JavaScript code:
(function (w) {
    "use strict";
    
    function foo (bar) {
        if (w.console) {
            console.log(bar);
        } else {
            alert(bar);
        }
    }
    
    setInterval("foo('baz ' + Math.random())", 2500);
    
    w.foo = foo;
})(window);
:psyduck: I've never seen setInterval() or setTimeout() used like that before.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
setInterval takes either a function or a string that gets eval'd.

https://developer.mozilla.org/en-US/docs/DOM/window.setInterval

ToxicFrog
Apr 26, 2008


pokeyman posted:

setInterval takes either a function or a string that gets eval'd.

https://developer.mozilla.org/en-US/docs/DOM/window.setInterval

Does the string get eval()'d in the scope of the caller or something? Otherwise I don't see how it could close over foo.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
It doesn't close over foo. He assigns it to the window, which is the global object.

darthbob88
Oct 13, 2011

YOSPOS

pokeyman posted:

Surely that'd throw an exception? Or is there some other function called setCustomerId?

That's the problem exactly. The reportSales function tries to call setCustomerID, it throws an exception because there is no setCustomerID function, and errors out of the reportSales function.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
I hope the fix that you deployed was to make aliases.

darthbob88
Oct 13, 2011

YOSPOS

Suspicious Dish posted:

I hope the fix that you deployed was to make aliases.

Haven't deployed it yet; will hold off until tonight, after peak business hours for the clients, when my frenzied attempts to fix the real problem won't cause too many problems for people. Adding this alias will still cause a small problem because the JS file it's going in is already 43K and growing, which is one of the reasons I want to refactor it.

darthbob88 fucked around with this message at 02:55 on Aug 17, 2012

Alligator
Jun 10, 2009

LOCK AND LOAF
hey why is the month wrong on this page?
JavaScript code:
var mon = ['Jan.', 'Feb.', 'Mar.', 'Apr.', 'May', 'Jun.', 'Jul.', 'Sep.', 'Oct.', 'Nov.', 'Dec.']
oh.

Alliterate Addict
Jul 10, 2012

dreaming of that face again

it's bright and blue and shimmering

grinning wide and comforting me with it's three warm and wild eyes

Alligator posted:

hey why is the month wrong on this page?
JavaScript code:

var mon = ['Jan.', 'Feb.', 'Mar.', 'Apr.', 'May', 'Jun.', 'Jul.', 'Sep.', 'Oct.', 'Nov.', 'Dec.']
oh.

Speaking of crappy arrays, I found a great pair in some PHP code this week. Someone had an array of "Second, "Minute", "Hour", etc, up to "Year", and then a second unrelated array with 1, 60, 3600...I just don't know why hashes seem to elude so many PHP programmers (and that's ignoring the non-use of strtotime) :psyduck:

tef
May 30, 2004

-> some l-system crap ->
http://blog.serverdensity.com/removing-memcached-because-its-too-slow/

quote:

Throttling: the performance impact of the global lock in MongoDB 1.8 was such that we couldn’t insert our monitoring postback data directly into MongoDB – it had to be inserted into Memcached first then throttled into MongoDB via a few processor daemons (as opposed to larger numbers of web clients).

Using memcache (a cache of all things) as a write queue for mongo db. :psyduck:

Factor Mystic
Mar 20, 2006

Baby's First Post-Apocalyptic Fiction
This must be what the nosql revolution looks like

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.
to help speed it up even more they should use a bloom filter to test if the data they're writing is already in their database!

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Factor Mystic posted:

This must be what the nosql revolution looks like

Just the highly visible, stupider side. All the good nosql work is done in huge places like Amazon and Google and their poo poo actually works.

shrughes
Oct 11, 2008

(call/cc call/cc)

trex eaterofcadrs posted:

Just the highly visible, stupider side. All the good nosql work is done in huge places like Amazon and Google and their poo poo actually works.

Possibly Yahoo, as well. They have a big NoSQL system they've developed internally.

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Aleksei Vasiliev posted:

to help speed it up even more they should use a bloom filter to test if the data they're writing is already in their database!

Riak 1.2's leveldb backend adds a bloom filter because otherwise checking for non-existence of a key was expensive as poo poo.

The application I work on that previously used a secondary index to see if we needed to write a new or update an existing value will now use a bloom filter to test if the data we're writing is already in the database.

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

tef posted:

http://blog.serverdensity.com/removing-memcached-because-its-too-slow/


Using memcache (a cache of all things) as a write queue for mongo db. :psyduck:

I bet that completely undoes all the work making MongoDB green:

Zombywuf
Mar 29, 2008

*writes sql query*

*watches db engine turn query into a series of data streams, cached partial operations, spools, bloom filters, etc....*

*laughs at nosql people doing it by hand*

Bunny Cuddlin
Dec 12, 2004

Cocoa Crispies posted:

I bet that completely undoes all the work making MongoDB green:



https://twitter.com/bgajdero/status/231487316877778945 This is amazing (scroll up to read the whole thing in context)

tef
May 30, 2004

-> some l-system crap ->

Zombywuf posted:

*writes sql query*

*watches db engine turn query into a series of data streams, cached partial operations, spools, bloom filters, etc....*

*laughs at nosql people doing it by hand*

If we're honest, it's more like:

Writes Sql Query, Watches it turn into series of streams, cached operations etc,

Rewrites Sql Query after inspecting the query plan, tries again.

Laughs at nosql people writing what they want directly rather than second guessing a non deterministic query planner.

MononcQc
May 29, 2007

Nearly nobody explores the PA/EC parts of PACELC :(

Zombywuf
Mar 29, 2008

tef posted:

If we're honest, it's more like:

Writes Sql Query, Watches it turn into series of streams, cached operations etc,

Rewrites Sql Query after inspecting the query plan, tries again.

Laughs at nosql people writing what they want directly rather than second guessing a non deterministic query planner.

Postgres's query planner is only non-deterministic in certain deterministic cases. Otherwise it's pretty easy to predict.

Milotic
Mar 4, 2009

9CL apologist
Slippery Tilde

tef posted:

If we're honest, it's more like:

Writes Sql Query, Watches it turn into series of streams, cached operations etc,

Rewrites Sql Query after inspecting the query plan, tries again.

Laughs at nosql people writing what they want directly rather than second guessing a non deterministic query planner.

You missed off:

Update statistics
Wait
Pray
Re-run
Swear
Add missing index that the query plan is complaining about, even though you know it won't use it
Re-run
Moan softly as it still does a full table scan

I like working with traditional RDBMS, but let's be honest, it's more a craft than a science.

tef
May 30, 2004

-> some l-system crap ->
Postgres 9.2 introduces index only scans http://wiki.postgresql.org/wiki/What%27s_new_in_PostgreSQL_9.2#Index-only_scans :swoon:

Zombywuf
Mar 29, 2008

Milotic posted:

You missed off:

Add missing index that the query plan is complaining about, even though you know it won't use it

Well, if you will trust the magic index hinter (hint: don't).

Milotic
Mar 4, 2009

9CL apologist
Slippery Tilde

Zombywuf posted:

Well, if you will trust the magic index hinter (hint: don't).

I don't. That said, it has helped when someone creates a table with a foreign key and forgets to create an index on the foreign key. The % of batch information in the query plan is also utterly misleading. No Gods, no masters, only SET STATISTICS TIME ON.

Zombywuf
Mar 29, 2008

Milotic posted:

I don't. That said, it has helped when someone creates a table with a foreign key and forgets to create an index on the foreign key. The % of batch information in the query plan is also utterly misleading. No Gods, no masters, only SET STATISTICS TIME ON.

Heh, postgres doesn't let you do that. Also, run the query with plan output mode on (or SET STATISTICS XML ON) to get the real % batch information. Also STATISTICS IO ON. In fact, turn everything on. When I used to do stuff in SSMS my template empty buffer looked something like:
code:
asoteuhsatoesntahoeaoeunthaeonstoeu --- So that when I habitually press C-e to go to the end of the line I don't drop any tables

SET STATISTICS TIME ON;
SET STATISTICS IO ON;
-- SET STATISTICS XML ON;
Is it wrong that I'm probably at my happiest when optimising database queries?

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Zombywuf posted:

Heh, postgres doesn't let you do that. Also, run the query with plan output mode on (or SET STATISTICS XML ON) to get the real % batch information. Also STATISTICS IO ON. In fact, turn everything on. When I used to do stuff in SSMS my template empty buffer looked something like:
code:
asoteuhsatoesntahoeaoeunthaeonstoeu --- So that when I habitually press C-e to go to the end of the line I don't drop any tables

SET STATISTICS TIME ON;
SET STATISTICS IO ON;
-- SET STATISTICS XML ON;
Is it wrong that I'm probably at my happiest when optimising database queries?
I think your boner is showing

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice
I'm not surprised that people who's only RDBMS experience is with MySQL think that SQL is overrated. Most of the MySQL databases I come across have no indexes whatsoever. I explained what a View was and why you'd want one to a PHP "developer" recently and it was a literal :psyboom:

Zamujasa
Oct 27, 2010



Bread Liar

Ender.uNF posted:

I'm not surprised that people who's only RDBMS experience is with MySQL think that SQL is overrated. Most of the MySQL databases I come across have no indexes whatsoever. I explained what a View was and why you'd want one to a PHP "developer" recently and it was a literal :psyboom:

We have* had no indexes. One of the reports on the data that someone else wrote took over 5 minutes to finish.

I stuck an EXPLAIN EXTENDED to the front, found the table scans, and added the relevant indexes. It just boggles the mind how many times I've seen people not understand what an index does.


As for views... I've had trouble finding good uses for them. :( I know there are some good ones, but it seems like they're mostly an easy way to effectively turn a SELECT statement into a new (always up-to-date) table. Maybe useful to cut out the hand-written JOINs, though.**




* I've been doing what I can, but hundreds of rows of the same varchar() value don't really index well.

** In my spare time at my job I like to read through the MySQL documentation (and sometimes that of other languages like Lua). I'm trying to learn, but my job does't really offer any opportunities to put it to use.

Alliterate Addict
Jul 10, 2012

dreaming of that face again

it's bright and blue and shimmering

grinning wide and comforting me with it's three warm and wild eyes

Ender.uNF posted:

I'm not surprised that people who's only RDBMS experience is with MySQL think that SQL is overrated. Most of the MySQL databases I come across have no indexes whatsoever. I explained what a View was and why you'd want one to a PHP "developer" recently and it was a literal :psyboom:

Speaking as probably-one-of-those-developers, would you recommend a specific book for learning that kind of thing? Even the college I went to treated SQL as "data blobs" and 90% of the teacher-given examples were of the "select * from blah" type.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Ursine Asylum posted:

Speaking as probably-one-of-those-developers, would you recommend a specific book for learning that kind of thing? Even the college I went to treated SQL as "data blobs" and 90% of the teacher-given examples were of the "select * from blah" type.

This website is specifically about indexes. I flicked through some of it one time and it seemed ok. Looks like they are selling an actual book as well if you want to kill trees.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice
That website's not terrible at first glance but I haven't read it in depth.

The Wikipedia article isn't half bad either: http://en.wikipedia.org/wiki/Database_index

At its most basic level, anytime you have a medium-to-large table and you regularly run a query against a column (it appears in the WHERE clause), that column should be indexed. What I tell beginners is that an index is kinda like a hash table or dictionary, only instead of looking up objects you can look up database rows very quickly. Obviously that's not strictly true and there is a lot more to it than that but it gets the point across.

The best scenario is where you take your top X queries and create an index for each one with the columns that appear in the WHERE clause (and for Oracle/MySQL often in the same order). When you do that, the query can return all the matching rows in a trivial amount of time even if there are millions of rows, whereas a table scan could take minutes or more.

Another good rule of thumb is to index foreign keys which will usually help your joins speed up by quite a bit, and if your database is any good at query optimization it should be able to stitch together indexes across various joins, groups, etc. For example if one of the tables in the join has 100 million rows, the best plan is probably to use whatever indexes that table has to filter it down to the 100 rows you care about before bothering to join against any of the other tables. SQLServer and Oracle will also split the query up and execute parts in parallel if possible, can't recall if MySQL is doing that as of yet.

gold brick
Jun 19, 2001

no he isn't
code:
 /**
   * Returns true if this error was marked as "fatal" by the _________
   * application. Normally fatal and non-fatal errors are treated the same 
   * by an application interfacing with __________.
   *
   * @return True
   * @deprecated As of 2012 R2, this method is obsolete.  It always returns true.
   */
  
  @Deprecated
  public boolean getFatal()
  {
      return false;
  }

Optimus Prime Ribs
Jul 25, 2007

The morons whom my boss picked to host our servers have kept up their reputation of being incompetently unreliable; just came into work to find this on every site:

quote:

Warning: session_start(): open(/nas/sa7/phpsess/sess_k2khv9jbm0ufi88hatp73lggi7, O_RDWR) failed: Input/output error (5)
Warning: session_start(): Cannot send session cache limiter - headers already sent

:thumbsup:

Adbot
ADBOT LOVES YOU

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
gold brick: Maybe that's just a "clever" way of telling people who use deprecated methods to go gently caress themselves.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply