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
Impotence
Nov 8, 2010
Lipstick Apathy

yaoi prophet posted:

Tumblr lets users reblog/like posts they see on their dashboard. When you look at an individual post, it also shows you the last 50 or so 'notes' (reblogs, likes, and replies) on that post, not only by that user, but by all people who reblogged that post. Pretty interesting, right? Sounds like the sort of data you might want to visualize if you're into that sort of thing.

This is awesome.

quote:

<a class="more_notes_link" href="#" onclick="this.style.display='none';document.getElementById('notes_loading_POSTID').style.display = 'inline';if(window.ActiveXObject)var tumblrReq=new ActiveXObject('Microsoft.XMLHTTP');else if(window.XMLHttpRequest)var tumblrReq=new XMLHttpRequest();else return false;tumblrReq.onreadystatechange=function(){if(tumblrReq.readyState==4){var notes_html=tumblrReq.responseText.split('<!-- START '+'NOTES -->')[1].split('<!-- END '+'NOTES -->')[0];if(window.tumblrNotesLoaded)if(tumblrNotesLoaded(notes_html)==false)return;var more_notes_link=document.getElementById('more_notes_POSTID');var notes=more_notes_link.parentNode;notes.removeChild(more_notes_link);notes.innerHTML+=notes_html;if(window.tumblrNotesInserted)tumblrNotesInserted(notes_html);}};tumblrReq.open('GET','/notes/POSTID/REBLOG_KEY?from_c=',true);tumblrReq.send();return false;">Show more notes</a><span id="notes_loading_POSTID" style="display:none;">Loading...</span>

Adbot
ADBOT LOVES YOU

Impotence
Nov 8, 2010
Lipstick Apathy
Wouldn't it just be easier to resave the word document as .docx and unzip it

Impotence
Nov 8, 2010
Lipstick Apathy

Monkeyseesaw posted:

Rule #1 of web development: Browsers don't scream about *anything*.

code:
try {
	// Everything
}

catch (e) {}

Impotence
Nov 8, 2010
Lipstick Apathy

NotShadowStar posted:

code:
strong, b { font-weight: 100; }

I know one of those SEO spammer retards loves doing stuff like
code:
p,strong,b,h1,h2,h3{font-weight:normal!important;font-size:14pt!important}
Then throw their entire keyword-packed paragraph inside a <h1> because "headers are important to google"

Impotence
Nov 8, 2010
Lipstick Apathy
course you can

code:
<style>
div[style='position:relative; left:160px;top:-190px; height:200px;width:800px;background-color:yellow'] {
	position: absolute!important; 
	top: 0!important; 
	left: 0!important; 
	height:800px!important;
	width: 200px!important;
	background-color: green!important;
}
</style>

Impotence
Nov 8, 2010
Lipstick Apathy
To be fair, gcc has it described as

-Wall Emits all generally useful warnings that gcc can provide. Specific warnings can
also be flagged using -Wwarning, where warning is replaced by a string
identifying an item for which you want to list warnings.



while php has it as


// Report all PHP errors (see changelog)
error_reporting(E_ALL);

Impotence
Nov 8, 2010
Lipstick Apathy

Chairman Steve posted:

Isn't this part of PHP's API for interacting with MySQL, and not inherently part of MySQL itself?

Oh, PHP, a language that lets you define when you really mean it.

PHp's API for interacting with mysql should bloody well be prepare, execute, fetch

Not real escape string

Impotence
Nov 8, 2010
Lipstick Apathy
Today I saw a MySQL database for an old internal webapp. It has one column that contains base64-encoded XML for data.

Impotence
Nov 8, 2010
Lipstick Apathy
Ghettocode horror: find nd replace 'id=' with 'class=' then iterate through that

Impotence
Nov 8, 2010
Lipstick Apathy

Profane Obituary! posted:

this is what blame is for.

Assuming you use version control at all.

Impotence
Nov 8, 2010
Lipstick Apathy

Internet Janitor posted:

Good luck punching 80 characters on a card- where the hell do you plan on putting the identification sequence? Most compilers don't even accept more than 72 characters. I suppose next you guys are going to tell me you waste space on multi-character variable names.

i, ì, í, î, ï are all perfectly valid variable names and I see them used far too often.

Impotence
Nov 8, 2010
Lipstick Apathy

NotShadowStar posted:

I've been working with Drupal a hell of a lot the last six months. The core developers behind it seem like reasonably intelligent people and understand PHP is a wretched language and keep it to the very basics: arrays, functions, very basic objects and it works okay-ish, if not excessively verbose. Unfortunately when I have to delve into PHP land I remember how god awful it its. It took me an entire afternoon to parse a CSV file because neither str_getcsv or fgetcsv could figure out new lines properly so it always just split CSV files into one gigantic flat array. Something that would take minutes to do in any other language.

Presenting the PHP global function namespace

e: HOW FAR DOWN THE HOLE DO YOU WANT TO GO

It works okay provided your newlines are at the end of a line and not within any value field ever

Impotence
Nov 8, 2010
Lipstick Apathy

Wheany posted:

var hasChanged = false;

hasChanged |= module1.hasChanged() |
module2.hasChanged() |
module3.hasChanged() |
module4.hasChanged();

if(hasChanged){
module1.reload();
module2.reload();
module3.reload();
module4.reload();
}



Spoilers: Bitwise vs logical OR.

Not a great horror, but if you are going to reload every module anyway, you might as well make use of short circuiting.

Why not just use hasChanged && (module1.reload(), module2.reload(), module3.reload(), module4.reload());

(assuming this is js)

Impotence
Nov 8, 2010
Lipstick Apathy

Monkeyseesaw posted:

Well I was being glib to some degree.

I completely agree as to the reasons why it was given a C-like syntax. But it makes people think of it as a C-like language when it isn't. I think that's one of the reasons why JS didn't really come into its own until ~2006 or so, though again arguably it would have never caught on at all if not for its syntax.


The general consensus these days is JavaScript is becoming the "assembler of the web".


Hah, I recently had to implement a 3-column layout in CSS that could be flexible as to which column-ordering, width, etc, and the closing series of divs looks exactly like that. CSS is a horror from start to finish.


edit: I want to bitch about this more and the stairway of divs is a good illustration of that. CSS was a loving disaster the second it left the gate because for anything more complicated then a very basic document layout you have to add elements just to get the styling rules targeted correctly. So you end up with these horrible nested monstrosities just so you can get this float to relatively position itself next to that list or whatever.

Can you imagine if UI toolkits worked this way? That if you wanted to make a dialog button position itself in relation to the dialog message text you had to wrap it in 6 levels of panels or group boxes just to apply a series of esoteric positioning rules? They'd scrap that poo poo immediately.

There is a vast gap between the minimal semantic markup it takes to describe for example a news article with navigation menu and the actual markup you need so you can write the set of CSS rules that makes it look half-way decent. That's the very definition of a failed styling language and it should have been immediately obvious to anyone paying attention.

I loving hate CSS so much.

Never fear, Adobe is here!



edit: the css is worse

Impotence
Nov 8, 2010
Lipstick Apathy
I've seen some assholes in unicode-aware languages use ìíîıǐi for nested ++

Seems like a good idea.

Impotence
Nov 8, 2010
Lipstick Apathy

nielsm posted:

But how else could you write financial applications if you don't have a way for decimal numbers!

I've seen code where
php:
<?
$price1 = mysql_result($dbprice1);
$price2 = mysql_result($dbprice2);

$price = $price1.'.'.$price2;
?>
oh, and the price fields in the database are varchars

Impotence
Nov 8, 2010
Lipstick Apathy

yaoi prophet posted:

The next time I really want to gently caress with a web dev I'm using this trick on them.

Don't forget that certain things carry weight so if they use multiple CSS files you can also override them or use comically specific > rules

Impotence
Nov 8, 2010
Lipstick Apathy

Zamujasa posted:

Holy poo poo, that TVTropes page is amazing. I wonder how many terrible hacks have been added to the source to do these sorts of things, since they definitely don't seem to be standard markup.


It's certainly a better analogy than rape.

http://tvtropes.org/pmwiki/pmwiki.php/Tropers/Solstace?action=source

Haha, what the hell

Impotence
Nov 8, 2010
Lipstick Apathy

Wheany posted:

If you want to be a cool dude, roll your own json encoder in php. Then make everything a string. And also, don't bother quoting every name in an object, you're a cool dude, after all.

code:
{butts:
    [{
    "farts":"7", 
    "poop":"null"
     }]
}
I don't see the problem in this vendor lock in/DRM solution!

Impotence
Nov 8, 2010
Lipstick Apathy

baquerd posted:

I counter with

code:
$sqlQuery = "select * from THREAD_" . $_GET["threadid"]

code:
// Use PDO for security
$sql = "select * from THREAD_" . $_GET["threadid"];
$db->query($sql);

Impotence
Nov 8, 2010
Lipstick Apathy

Rainbow Pony Deluxe posted:

Is this how you say "Come at me, bro" in PHP?

No, this is the tvtropes forum javascript library in a nutshell

Impotence
Nov 8, 2010
Lipstick Apathy

Zamujasa posted:

That quote reminds me of people who almost exhibit common sense, but make a sharp turn into a wall. For example, it really is possible to pull off a man-in-the-middle attack, but... not quite like the way he's showing.

The bit about trying to foil keyloggers is hilarious, though, and really comes out of nowhere as completely silly advice. :tinfoil:

Lol: L=Alto Palo

Impotence
Nov 8, 2010
Lipstick Apathy
I think the real horror there is running a version of PHP vulnerable to so many fun, hilarious things and ..that old

Impotence
Nov 8, 2010
Lipstick Apathy
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
^C
(interrupt) use quit to exit.

Impotence
Nov 8, 2010
Lipstick Apathy

nielsm posted:

phpFreeChat.
It's an AJAX-based webchat thing, obviously with a PHP backend.
I don't know much about its internals, I just know that the version I'm exposed to doesn't work on IE9 unless you enable some compatibility modes.

They like dynamically generating stuff, so they make sure to dynamically generate stuff to dynamically generate more stuff.
In particular, the IE9 problem is caused by some (more or less) dynamically generated CSS not being inserted properly on the page. (It does work in IE8 or IE7 compatibility modes.)

How the CSS is supposed to be generated:
Some running JS dynamically fetches some PHP page.
Said PHP page dynamically generates some JS, which is eval()d by the fetching thing. (This is not JSON, it's straight JS.)
This dynamically generated JS contains a bunch of code that builds a hashmap of CSS selectors to CSS rules. (Nothing is dynamically built here, it's just plain strings.)
This hashmap is then iterated over and every key/value pair is fed into a class that uses DOM to insert singular text nodes in a dynamically inserted Style element in the head.

I wonder what's wrong with <link rel="stylesheet" type="text/css" href="whatever.php">.

It also makes extensive use of UA detection rather than feature detection.
You forgot about the hilarious security holes it has. XSS, CSRF, session hijacking, not sanitising certain data sent to everyone in chat...

Impotence
Nov 8, 2010
Lipstick Apathy
I just found an old PHP script that used sqlite2.

The issue here wasn't sqlite2. It was remote access to it: the other end would exec("rm -rf /tmp/sqdb"); exec("wget -q -O /tmp/sqdb phpurl"); - which would send the entire database, run an insert, then send it back up in a cURL HTTP POST

:psyduck:

Impotence
Nov 8, 2010
Lipstick Apathy
code:
function forwardedfor(ip) {
  var ip_address = ip.connection.remoteAddress ? ip.connection.remoteAddress : ip.remoteAddress;
  try {
    if(ip.headers["X-Forwarded-For"]) {
      var host_array = ip_address.split(".");
      var XFF = false;
      switch(parseInt(host_array[0])) {
        case 192:
          if(parseInt(host_array[1]) == 168 && parseInt(host_array[2]) > -1 || parseInt(host_array[2]) < 256) {
            XFF = true;
          }
          break;
        case 172:
          if(parseInt(host_array[1]) > 15 || parseInt(host_array[1]) < 32) {
            XFF = true;
          }
          break;
      }
      if(XFF) {
        ip_address = ip.headers["X-Forwarded-For"];
      }
    }
  }
  catch(e) {}
  return ip_address;
}
;
This isn't IPv6 ready, is it

Impotence
Nov 8, 2010
Lipstick Apathy

pokeyman posted:

Would it be too generous to suggest that someone forgot to add if (debug) around that garbage?

Why would you think that?

(production)

Impotence
Nov 8, 2010
Lipstick Apathy

The Gripper posted:

What on earth is it trying to do?

I presume it's to do something like allowing X-F-F to be parsed for logging to access.log/error.log or for DB/logins/etc

It doesn't actually work.


edit: the only thing that that function is called in is to log to access.log on page hit

access.log's IPs consist entirely of 10.* LAN IPs.

Impotence fucked around with this message at 01:34 on Feb 11, 2012

Impotence
Nov 8, 2010
Lipstick Apathy
Zend_Mail does sanitisation in any way right..?

Impotence
Nov 8, 2010
Lipstick Apathy

Wheany posted:

hg init
hg add
hg commit

or

git init
git add .
git commit

This is literally how easy it is to have version control these days. You don't have to administer servers (until maybe later if you want to make distribution a bit easier). And this works on Windows and Linux (and I assume Mac) :mad:

What, I have to type git commit every single time I make a change? :v:

Impotence
Nov 8, 2010
Lipstick Apathy

Contero posted:



:stare:

code:
<string encryption="64-bit">
	PHN0cmluZyB4bWxucz0idXJuOkluaXRlY2guR2xvYmFsLlNlcnZpY2VzIj4NCiAgJmx0O0NvbXBhbnlHZXRDb25uZWN0b3
	ImZ3Q7DQogICAgJmx0O3hzOnNjaGVtYSB4bWxuczp4cz0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiJmd0
	Ow0KICAgICAgJmx0O3hzOmVsZW1lbnQgbmFtZT0iSW5pdGVjaEdldENvbm5lY3RvciImZ3Q7DQogICAgICAgICZsdDt4cz
	pjb21wbGV4VHlwZSZndDsNCiAgICAgICAgICAmbHQ7eHM6Y2hvaWNlIG1heE9jY3Vycz0idW5ib3VuZGVkIiZndDsNCiAg
	ICAgICAgICAgICZsdDt4czplbGVtZW50IG5hbWU9ImVtcGxveWVlcyImZ3Q7DQogICAgICAgICAgICAgICZsdDt4czpjb2
	1wbGV4VHlwZSZndDsNCiAgICAgICAgICAgICAgICAmbHQ7eHM6c2VxdWVuY2UmZ3Q7DQogICAgICAgICAgICAgICAgICAm
	bHQ7eHM6ZWxlbWVudCBuYW1lPSJFbXBsb3llck5hbWUiIHR5cGU9InhzOnN0cmluZyIgbWluT2NjdXJzPSIwIi8mZ3Q7DQ
	ogICAgICAgICAgICAgICAgICAmbHQ7eHM6ZWxlbWVudCBuYW1lPSJFbXBsb3llZSIgdHlwZT0ieHM6c3RyaW5nIiBtaW5P
	Y2N1cnM9IjAiLyZndDsNCiAgICAgICAgICAgICAgICAgICZsdDt4czplbGVtZW50IG5hbWU9IkZpcnN0bmFtZSIgdHlwZT	
	
	[cut rest of blob]
</string>

Impotence
Nov 8, 2010
Lipstick Apathy

yaoi prophet posted:

I like the repeating ICAgICAgICAg. I bet they're using EBC because the person who implemented their encryption doesn't know the first thing about block ciphers.

Nah, that was base64 of the quoted post. I've actually seen it encapsulated in XML like three levels deep. And some people actually consider it encryption :psyboom:

Impotence
Nov 8, 2010
Lipstick Apathy

trex eaterofcadrs posted:

Any reason you're not using solr or elasticsearch? They do all that kind of crap for you.

Out of curiosity, what are your thoughts on indextank?

Impotence
Nov 8, 2010
Lipstick Apathy
question: it's php 5.4 already and there is still an error in transliterated hebrew. what causes it?

:v:

Impotence
Nov 8, 2010
Lipstick Apathy
What is it with PHP and virtually every environment for it? It seems like PHP is almost always running disgustingly out of date versions, no "normal host off the street" (or anywhere else really) runs up to date/anywhere close to up to date versions/5.4?

Impotence
Nov 8, 2010
Lipstick Apathy

Otto Skorzeny posted:

a shitload of weed.

http://utf-8.jp/public/aaencode.html

Impotence
Nov 8, 2010
Lipstick Apathy

Zamujasa posted:

<html xmlns="http://www.w3.org/1999/xhtml" />

Did he seriously close the <html> tag?

Impotence
Nov 8, 2010
Lipstick Apathy

Gazpacho posted:

As the internet creates a fetish subculture for everything, so does project hosting create...

Harmony Framework - PHP is now in your browser!

(Inactive since 2009 thankfully, but it's only a matter of time.)

php:
<?
$Text4fba9fe079c2a->setText('Hello world');    
$HBox4fba9fe079af5->addChild($Text4fba9fe079c2a);
$input4fba9fe079cca = new Harmony_Toolkit_Element('input');?>
That is some really descriptive code

Adbot
ADBOT LOVES YOU

Impotence
Nov 8, 2010
Lipstick Apathy

Does http://publib.boulder.ibm.com/infocenter/wsdatap/v3r8m1/topic/xi50/convertingbetweenjsonandjsonx07.htm#wq18 count?

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