How not to PHP
-
I skimmed the Hack website today. Despite the stupid name, it seems to have some nice features. But alas, it's going to be the same problem as with Python - lack of hosts.
-
@toon said:
You've peaked my interest.
Piqued! Piqued!I'd say spelling Nazism makes me peaked, but it doesn't.
-
I have often seen peak and peek used and they're both wrong. Nice to see someone agrees with me about this.
-
And the same thing doesn't apply to Python, Java, C#..? Good frameworks are a large part of making a successful language. Do you do C# without .NET? Java's a fucking hot mess, but Spring, et al makes it tolerable.
Javascript? Yeah, raw JS is actually pretty rad, but you need a framework.
No, I'm saying that anything that helps you work in PHP is a bad idea.
-
Is it possible to write websites in Python without some WTF-ery of difficult-to-install-and-configure packages that haven't had their Linux docs updated since 1812? I rather like Python, if it was as simple to set up and deploy as PHP I'd look into it.
You're thinking of Perl. Python deployment couldn't possibly be easier.
-
Better someone like Morbs doing PHP than the majority that are merely playing at it.
-
If it's small and brown, gun it down. If it's a caucasian you see, let it be.
If it's brown, gun it down. If it's white, it has rights.
-
You're thinking of Perl. Python deployment couldn't possibly be easier.
Ugh, I've had lots of problems with Python dependencies, but not nearly so many as Ruby.
-
Ah fuck, thanks. I knew I was doing something wrong, didn't know what at the time.
-
If it's brown, gun it down. If it's white, it has rights.
If it prays to Allah, send it sprawling like La Jolla.
If Infidel thy be, no Hellfire for thee, 'less your grazing fee, is insufficient to parry, greed which will not tarry, of Senator named Harry.
-
If it prays to Allah, send it sprawling like La Jolla.
If Infidel thy be, no Hellfire for thee, 'less your grazing fee, is insufficient to parry, greed which will not tarry, of Senator named Harry.
What about La Jolla?
-
What about La Jolla?
Do you know how hard it is to find a sensible rhyme for "Allah"? I mean, easier than "Mohammed", but still..
-
Seems like you could rhyme Mohammed with "my bed" pretty easily.
But you might not like the implications of the resulting poem.
-
I just find it odd that the city that I live 2 blocks from randomly came up.
-
Piqued! Piqued!
Thank you!
WTF? Dicsores actually quoted the formatting right? How'd that happen?
-
>chubertdev said:
What about La Jolla?Do you know how hard it is to find a sensible rhyme for "Allah"?
Except that it doesn't rhyme, not even close. La HOY-ya. Or /lə ˈhoi-jə/ (or something close to that) for the IPA pedants.
-
Rhymes with Georgetown Hoya.
-
Yes, not with Allah, which was my point.
-
I wonder how he would pronounce "El Cajon"
-
Probably like spicy Louisiana food.
-
-
Filed under: extra large corn-on-the-cob!
-
-
That guy was a piker. Kirk FTW!
Pike?
http://spectrum.ieee.org/images/public_html/tech_talk/pike1new.jpg
-
-
-
Well, that guy's a son of a bitch. His last tweet was mocking "BigBangCBS" which I assume is the twitter handle of the show...except it's been suspended. Coincidence? I .... don't care!
-
His last tweet was Jan 8.
He's also a bot.
-
He's also a bot.
[insert 10-page rant on gender definitions followed by 25-page flame war on a different subject]
-
-
His last tweet was Jan 8.
He's also a bot.
I'd probably have to care to know that.
-
It was blatantly obvious from the page you had to go to to get the information you ranted about earlier. How lazy can you get? Literally a few pixels away from where you clicked to find out that the account being quoted was dead was a date the post you were clicking on was made!
-
How lazy can you get?
Lazy enough to not bother reading anything else on the page, apparently.
-
Next time be a little lazier and don't make a post bitching about it.
-
Next time be a little lazier and don't make a post bitching about it.
Where's the fun in that?
-
Really? This is an interesting misuse of the function. Does json_encode sanitise strings as a side-effect?
Or are you being facetious?
EDIT - in scrolling down to my post, I thought about it - and sure, Javascript Object Notation is not a bad way to present a PHP var in JS. It gets rid of the int vs string issues of`
jsvar = <?=somePhpVar ?>; // may result in jsvar being assigned blank space
vs
jsvar = '<?=somePhpVar ?>'; // always results in jsvar being assigned, but as a string
at the very least, which itself is cool.
-
Well if you find a way to "break out" of a json_encode'd string, please tell me how ;-) But please report it secretly to bugs.php.net before that
I don't consider using json_encode() as "misuse" here. I want to represent something as JavaScript, so I convert it in JS's ON form. Simple as that. Takes care of accidentally having true/false/null etc. and is certainly a lot better than using addslashes() or htmlspecialchars().
-
I don't consider using json_encode() as "misuse" here. I want to represent something as JavaScript, so I convert it in JS's ON form. Simple as that. Takes care of accidentally having true/false/null etc. and is certainly a lot better than using addslashes() or htmlspecialchars().
Same here.
-
I don't consider using json_encode() as "misuse" here.
It's not a misuse, it's even referenced on the documentation page that it handles strings.
-
[insert 10-page rant on gender definitions followed by 25-scroll flame war on a different subject]
FTFY
-
At least they seem to have fixed the retarded behaviour where previously it would use the locale settings to output strings.
Great if, say, you happen to be dealing with arrays of floating point numbers with a European locale where the decimal point position is indicated with a comma...
-
I've never had that happen to me with json_encode(), but I made it a habit to always use
sprintf('%.F', ...)
(note the capital F) when turning floats into strings that are meant to be processed in any way, usually with a length parameter (e.g.%.2F
).
-
Do you habitually call setlocale for exotic and interesting locales?
-
Nope. Mostly because setlocale() works like shit on Windows ;-)
What should I expect from "exotic" locales? What are those?
-
If I could, I'd replace all usages of setlocale() and related things with the intl extension, but good luck a) finding web hosters that have it enabled and b) making sure your entire codebase relies on intl.
-
It's not entirely terrible on Windows, only mostly.
As for exoticity, the example I gave previously: number formatting that uses commas instead of periods for the decimal separator. At least json_encode doesn't get confused now ;)
Yes, the intl extension would be better but a) is a significantly larger problem than b) if you built your codebase right in the first place.
-
Just for clarity, I'm working in Germany, so switching between dot and comma for decimal separators (partially via locales, of course) is a common thing for me. "Exotic" would be Turkish with that weird lowercase i business. ^.^
-
Ah, whereas I deal with people for whom the comma-as-separator would be exotic ;)
-
jsvar = <?=somePhpVar ?>; // may result in jsvar being assigned blank space
The original programmer of our system didn't seem to know about this, doing the equivalent of:
<input type="hidden" id="foo" value="<?=somePhPVar?>">
And then:
var jsvar = document.getElementById('foo').value;
And then hoping for the best wrt typing. I have found a few "11" strings instead of integer 2. But I have also found many parseInt() and parseFloat() and even "makeNumber()" from util.js. Sometimes there is a JS variable literally called
obj
which could be a HTML Element or jQuery object or even just avar obj = {}
.
-
The original programmer of our system didn't seem to know about this, doing the equivalent of:
<input type="hidden" id="foo" value="<?=somePhPVar?>">
And then:
var jsvar = document.getElementById('foo').value;
And then hoping for the best wrt typing. I have found a few "11" strings instead of integer 2. But I have also found many parseInt() and parseFloat() and even "makeNumber()" from util.js. Sometimes there is a JS variable literally called
obj
which could be a HTML Element or jQuery object or even just avar obj = {}
.Yeah, except that wouldn't cause a JS error and jsvar would be set to "".