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
trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.
I think php is basically what you get when you just slap a bunch of things together without sitting back down to look at what you've done. Then add even more poorly thought out poo poo on to that base of poo poo for another 16 years.

Adbot
ADBOT LOVES YOU

Scaevolus
Apr 16, 2007

Optimus Prime Ribs posted:

I have to wonder: is Ramsus just a gigantic meat-head or is PHP an elaborate troll?
Yes.

Rasmus Lerdof posted:

I'm not a real programmer. I throw together things until it works then I move on. The real programmers will say "Yeah it works but you're leaking memory everywhere. Perhaps we should fix that." I’ll just restart Apache every 10 requests.

Rasmus Lerdof posted:

I don't know how to stop it, there was never any intent to write a programming language [...] I have absolutely no idea how to write a programming language, I just kept adding the next logical step on the way.

Optimus Prime Ribs
Jul 25, 2007

Rasmus Lerdof posted:

I'm not a real programmer. I throw together things until it works then I move on. The real programmers will say "Yeah it works but you're leaking memory everywhere. Perhaps we should fix that." I’ll just restart Apache every 10 requests.

Did he seriously say this? :stare:

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Optimus Prime Ribs posted:

Did he seriously say this? :stare:

Ya, it is a very famous quote. (Well, famous as far programming language creator quotes go)

http://en.wikiquote.org/wiki/Rasmus_Lerdorf

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
The real horror is people who took a lightweight templating language and decided to hack it into a full web development language by copy-pasting all the C apis for stuff.

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
PHP is as much an approach to engineering and problem solving as it is a language.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Jabor posted:

The real horror is people who took a lightweight templating language and decided to hack it into a full web development language by copy-pasting all the C apis for stuff.

creating a sensible library for your language is way too much work compared to just writing thin wrappers around c apis

evensevenone
May 12, 2001
Glass is a solid.

Internet Janitor posted:

PHP is as much an approach to engineering and problem solving as it is a language.
Kind of like how Duck tape is as much an approach to engineering and problem solving as it is an adhesive?

Doc Hawkins
Jun 15, 2010

Dashing? But I'm not even moving!


TRex EaterofCars posted:

I think php is basically what you get when you just slap a bunch of things together without sitting back down to look at what you've done. Then add even more poorly thought out poo poo on to that base of poo poo for another 16 years.

The Star Trek of languages.

Sewer Adventure
Aug 25, 2004
Who'd have guessed Calibre has terrible developers?

https://bugs.launchpad.net/calibre/+bug/885027

qntm
Jun 17, 2009
Worse is better.

Optimus Prime Ribs
Jul 25, 2007

For better or worse.

Ursine Catastrophe
Nov 9, 2009

It's a lovely morning in the void and you are a horrible lady-in-waiting.



don't ask how i know

Dinosaur Gum

Sewer Adventure posted:

Who'd have guessed Calibre has terrible developers?

https://bugs.launchpad.net/calibre/+bug/885027

That thread went downhill faster than a tobogganist with diarrhea.

So, anyone got a good CLI alternative for Calibre? :v:

McGlockenshire
Dec 16, 2005

GOLLOCKS!

quote:

FWIW I didn't know anything about calibre before reading this. I read this because it was handed to me as an example of how not to handle a bug report. As I read through it, and the argument about whether having an application that lets anyone mount anything anywhere, a realization slowly dawned on me...

This is not a disk utility.

This is an ebook reader!
And there we have it, this is what takes it from clueless open source developer rage into full out WTFery.

Senso
Nov 4, 2005

Always working

Sewer Adventure posted:

Who'd have guessed Calibre has terrible developers?

https://bugs.launchpad.net/calibre/+bug/885027

Reading this made my day, thanks!

Jonnty
Aug 2, 2007

The enemy has become a flaming star!

Haha, incredible.

quote:

You mean that a program designed to let an unprivileged user
mount/unmount/eject anything he wants has a security flaw because it allows
him to mount/unmount/eject anything he wants? I'm shocked.

You mean redefining a massive security vulnerability as a feature doesn't make it any less insecure? I'm shocked.


e: awww this is just cute

quote:

I'm not sure this is actually exploitable...the posted exploit fails on my GNU/kFreeBSD box:

$ gcc 70calibrerassaultmount.sh -o full-nelson
70calibrerassaultmount.sh: file not recognized: File format not recognized
$ ./full-nelson
-bash: ./full-nelson: No such file or directory

Is there different compiler (icc?) or architecture (maybe needs a RISC arch?) requirement?

Jonnty fucked around with this message at 14:00 on Nov 4, 2011

Toady
Jan 12, 2009

It's amusing how many times the developer claims something is fixed, followed by someone posting an exploit to prove it's not. I don't understand why he got mad at that Dan Rosenberg guy, other than bruised ego.

tef
May 30, 2004

-> some l-system crap ->
it's more along the lines of 'no, you see I made bash suid on purpose, you stupid security person'

Dr Monkeysee
Oct 11, 2002

just a fox like a hundred thousand others
Nap Ghost

Toady posted:

It's amusing how many times the developer claims something is fixed, followed by someone posting an exploit to prove it's not. I don't understand why he got mad at that Dan Rosenberg guy, other than bruised ego.

Yeah what the gently caress was up with kovid's "final warning" to Rosenberg? As far as I can tell Rosenberg's been cordial the entire thread.

Bhaal
Jul 13, 2001
I ain't going down alone
Dr. Infant, MD
Not to mention helped him out of severe future embarrassment. I don't think he realizes that this is finding security holes in your project done via the easy way. No, instead it's this defensive, adversarial attitude, "Go on, just try and see if you can find yet another glaring security hole in my program for me. I'll just fix it :smug: Otherwise, I'll ignore you :smug:"

Bhaal fucked around with this message at 19:47 on Nov 4, 2011

Toady
Jan 12, 2009

He admitted he actually put Rosenberg on ignore, causing him to miss one of Rosenberg's exploit reports.

Jonnty posted:

e: awww this is just cute

It's a tongue-in-cheek reference to this:
http://www.exploit-db.com/exploits/15704/

Toady fucked around with this message at 23:26 on Nov 4, 2011

Lurchington
Jan 2, 2003

Forums Dragoon
code:
def setencoding():
    """Set the string encoding used by the Unicode implementation.  The
    default is 'ascii', but if you're willing to experiment, you can
    change this."""
    encoding = "ascii" # Default value set by _PyUnicode_Init()
    if 0:
        # Enable to support locale aware default string encodings.
        import locale
        loc = locale.getdefaultlocale()
        if loc[1]:
            encoding = loc[1]
    if 0:
        # Enable to switch off string to Unicode coercion and implicit
        # Unicode to string conversion.
        encoding = "undefined"
    if encoding != "ascii":
        # On Non-Unicode builds this will raise an AttributeError...
        sys.setdefaultencoding(encoding) # Needs Python Unicode build !
fffffffffffff you site.py from the standard library.

The Zen of Python posted:

Explicit is better than implicit.

follow your own advice.

For context, to set the default unicode encoding in python you apparently need to edit the site.py file for ALL of python everywhere, and if 0 is how they choose to do it

(you could also use an essentially undocumented feature in 'sitecustomize' which is what I did instead)

Lurchington fucked around with this message at 01:37 on Nov 5, 2011

Jonnty
Aug 2, 2007

The enemy has become a flaming star!

Toady posted:

He admitted he actually put Rosenberg on ignore, causing him to miss one of Rosenberg's exploit reports.


It's a tongue-in-cheek reference to this:
http://www.exploit-db.com/exploits/15704/

Oh whoops, didn't actually see the name there somehow.

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Lurchington posted:

code:
def setencoding():
    """Set the string encoding used by the Unicode implementation.  The
    default is 'ascii', but if you're willing to experiment, you can
    change this."""
    encoding = "ascii" # Default value set by _PyUnicode_Init()
    if 0:
        # Enable to support locale aware default string encodings.
        import locale
        loc = locale.getdefaultlocale()
        if loc[1]:
            encoding = loc[1]
    if 0:
        # Enable to switch off string to Unicode coercion and implicit
        # Unicode to string conversion.
        encoding = "undefined"
    if encoding != "ascii":
        # On Non-Unicode builds this will raise an AttributeError...
        sys.setdefaultencoding(encoding) # Needs Python Unicode build !
fffffffffffff you site.py from the standard library.


follow your own advice.

For context, to set the default unicode encoding in python you apparently need to edit the site.py file for ALL of python everywhere, and if 0 is how they choose to do it

(you could also use an essentially undocumented feature in 'sitecustomize' which is what I did instead)

Can't you just redefine that method in your own code?

darthbob88
Oct 13, 2011

YOSPOS
Found something I think is horrible; the framework for an e-commerce site I'm doing work on generates its pages based on where certain comments are, which caused me a certain amount of difficulty when certain of those comments were duplicated. It might just be that I learned to program with languages that actually respect comments, but this is madness. It's like building a mansion with a marble frieze spelling out "The Owner is a twit", just because somebody scribbled a note on the plans. Comments are for people, not programs.

Ursine Catastrophe
Nov 9, 2009

It's a lovely morning in the void and you are a horrible lady-in-waiting.



don't ask how i know

Dinosaur Gum

darthbob88 posted:

Found something I think is horrible; the framework for an e-commerce site I'm doing work on generates its pages based on where certain comments are, which caused me a certain amount of difficulty when certain of those comments were duplicated. It might just be that I learned to program with languages that actually respect comments, but this is madness. It's like building a mansion with a marble frieze spelling out "The Owner is a twit", just because somebody scribbled a note on the plans. Comments are for people, not programs.

So basically someone's recreated IFDEF in...what, PHP? Except with comments instead of, you know, ifdef.

Fantastic. Let me guess, they have a file that reads other PHP files and evals code based on comments?

It seems like one of those "I wonder if PHP can do this..." ideas that got out of hand :v:

Lurchington
Jan 2, 2003

Forums Dragoon

BonzoESC posted:

Can't you just redefine that method in your own code?

I was trying to make the default unicode encoding for my project UTF-8, and along the way found out more than I really wanted to know how python does that.

Short version is that there is a sys.setdefaultencoding method, that's DELETED by site.py when the interpreter is activated. The function I pasted in is from site.py and is used to set the default unicode encoding to ascii.

So, while you could redefine, or even monkeypatch the original method, the site.py one is going to get called first. The way you're supposed to do it define a 'sitecustomize' module that does what you want, and tha's what I'm doing

darthbob88
Oct 13, 2011

YOSPOS

OriginalPseudonym posted:

So basically someone's recreated IFDEF in...what, PHP? Except with comments instead of, you know, ifdef.

Fantastic. Let me guess, they have a file that reads other PHP files and evals code based on comments?

It seems like one of those "I wonder if PHP can do this..." ideas that got out of hand :v:
It's not "IFDEF foo THEN bar", it's more like "s/COMMENT/CODE/"; replace <!--SHOPPING CART--> with the actual shopping cart code.

Honestly don't know much about the system; I'm doing some simple work on a website which uses that framework, some simple Javascript and CSS work. Apparently it might be written in ASP.

tef
May 30, 2004

-> some l-system crap ->

Lurchington posted:

I was trying to make the default unicode encoding for my project UTF-8

This will only cause endless suffering

Try using python 3 if you have unsatiated cravings for unicode.

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

tef posted:

This will only cause endless suffering

Try using python 3 if you have unsatiated cravings for unicode.

Python 3's the "right" one to use for new work, just like Ruby 1.9.3 is the "right" ruby, right?

Lurchington
Jan 2, 2003

Forums Dragoon

tef posted:

This will only cause endless suffering

Try using python 3 if you have unsatiated cravings for unicode.

We deploy on centos, so this project is first one we've got buy-in for 2.7 (from 2.6). We'll probably make the jump when 3.3 goes final, so we're prepping for the switch now by doing a lot of the future imports like unicode_literals.

Unicode literals being the thing that showed that logging non-ascii data is a gigantic pain unless you manually encode as something else, which led to my search for default encoding.

e.g.
code:
logging.debug(u'username %s logged in', username)
(we're using unicode literals to make the "u" default, but it's otherwise identical)

despite being a unicode string, that won't log right if username is 'andré' because the default unicode encoding is ascii.
The formatting comment (link) in your module won't help here, since the string would need to be implicitly encoded to utf-8 in the logging module, which doesn't have the comment.

All of this is pretty much the exact same in Python 3. The main change is that everything's unicode, not that encodings are suddenly handled better.

Opinion Haver
Apr 9, 2007

BonzoESC posted:

Python 3's the "right" one to use for new work, just like Ruby 1.9.3 is the "right" ruby, right?

My personal policy is python 3 unless I'm making something that uses 2.x.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Ditto for ruby 1.9, and I honestly don't remember the last time I used a 1.8-only library.

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

pokeyman posted:

Ditto for ruby 1.9, and I honestly don't remember the last time I used a 1.8-only library.

You won't find it in one of mine: s.required_ruby_version = '~> 1.9.2'

Beef
Jul 26, 2004
How often does a new Ruby or Python update gently caress up your code, either directly or indirectly through incompatible libraries? I usually have enough of a library hell in C/C++, Java and in lesser degree Common Lisp.

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Beef posted:

How often does a new Ruby or Python update gently caress up your code, either directly or indirectly through incompatible libraries? I usually have enough of a library hell in C/C++, Java and in lesser degree Common Lisp.

Most utility or API libraries that don't do weird interpreter stuf don't have problems. The kind of version conflict I run in to most is Gem A depending on rack ~> 1.3, and Gem B depending on rack ~> 1.2.4.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

Beef posted:

How often does a new Ruby or Python update gently caress up your code, either directly or indirectly through incompatible libraries? I usually have enough of a library hell in C/C++, Java and in lesser degree Common Lisp.

Python 2 releases: typically not much. You might see some breakage if you were using strings as exceptions:
code:
Python 2.4.3 (#1, Sep 21 2011, 19:55:41) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> raise "some string"
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
some string
code:
Python 2.7.2+ (default, Oct  4 2011, 20:06:09) 
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> raise "some string"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: exceptions must be old-style classes or derived from BaseException, not str
You might also have some problems if you were using the new keywords in 2.6 as variable names. A friend of mine was working on a 100K+ LOC code base that had variables named as everywhere, and he said that it was a royal pain to get everything running on 2.6.

Python 2.x -> 3, though: :stare:
(Actually it's not that bad. Run the code through 2to3.py, fix anything that it couldn't, remove some unnecessary calls to list that it isn't smart enough to omit, and you'll probably be fine. This is only for pure Python code: I don't think there's an automated way to update extension modules written in C.)

My name aint Jerry
Sep 4, 2011

Good job with notjerry.org, Not Jerry. Here is not-a-trophy for you.

Lurchington posted:

We deploy on centos, so this project is first one we've got buy-in for 2.7 (from 2.6). We'll probably make the jump when 3.3 goes final, so we're prepping for the switch now by doing a lot of the future imports like unicode_literals.

Unicode literals being the thing that showed that logging non-ascii data is a gigantic pain unless you manually encode as something else, which led to my search for default encoding.

e.g.
code:
logging.debug(u'username %s logged in', username)
(we're using unicode literals to make the "u" default, but it's otherwise identical)

despite being a unicode string, that won't log right if username is 'andré' because the default unicode encoding is ascii.

I would suggest:
code:
logging.debug(u'username %s logged in', username.decode('UTF-8'))
You're only having problem when you're converting strings to unicode implicitly. If you know your inputs' encoding, then you simply tell python about it and you'll be fine, whatever the default encoding is.

Lurchington
Jan 2, 2003

Forums Dragoon
that's a really useful way to get around this kind of thing, but this quest was started because of the fact that so much of our data really was UTF-8, so were pasting that decode method around most log lines. Thanks for the reminder though :)

Adbot
ADBOT LOVES YOU

tef
May 30, 2004

-> some l-system crap ->

quote:

filedesc://IA-001102.arc 0.0.0.0 19960923142103 text/plain 200 - - 0
IA-001102.arc 122
2 0 Alexa Internet
URL IP-address Archive-date Content-type Result-code Checksum
Location Offset Filename Archive-length

yup, the names of the headers are in the body of the record


:smithicide:

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