« first day (633 days earlier)      last day (4315 days later) » 

2:02 PM
and DCA airport is 70 bucks cheaper still
 
Coffeescript was designed after Ruby
 
0
Q: Best way to create SVG from database? (Using PHP)

SomeKittensI've got a SQL database that keeps track of which services a client has. I need to create an image using SVG that only displays the services that the client has. The database stores the services in the format 1,2,3,6,7,9. Here's what I have: <?php header("Content-type: image/svg+xml")...

"Coffeescript was designed" I don't believe you .
 
Woot, added wiki.php.net/rfc/hash_pbkdf2 to accepted. Now to merge the PR
 
I think there is some syntaxing error or conceptual error.

I have a simple ajax call where im passing a json string to a php file.
This is what the ajax call looks like:

<script>
$(document).ready(function () {
$("#btn").click( function() {

var id = $('#id').val();
var name = $('#name').val();
var Address = $('#Address').val();

$.ajax({
url: "connection.php",
type: "POST",
data: { topost : "{id':'" + id + "','name':'" + name + "','Address':'" + Address + "'}"},
datatype: "jsonp",
success: function (status)
Mine is a very simple question, i hope...
Im new to php
Please help me out!
 
@MadhulikaMukherjee What's the problem?
 
2:18 PM
The problem is that im getting an error of 'undefined variable' in my php, at the line where 'topost' is present
i am sending topost as a string from my ajax
i dont understand why is it 'undefined' in my php
 
have you taken a look at your headers to make sure its getting sent right?
 
how do i see if its getting sent right?
the php file is hosted by my localhost, and im using xampp
 
LiveHTTPHeaders in Firefox, or Developer Console in Chrome, etc
 
@ircmaxell grats
always nice if stuff gets accepted unanimously
 
2:21 PM
:-D
 
@NikiC Well after the amount of tweaks they asked for, would be surprising if it wasn't :P
 
@MadhulikaMukherjee You should be able to watch the ajax request through firebug or the webkit debugger and inspect the request headers.. you should see your 'topost' content being sent
 
@Leigh This is hash_pbkdf2(), not password_hash()
 
@ircmaxell hmm, i'm misremembering threads then
 
2:22 PM
alright. thanks @Mike
i will get back to you in a while
 
This one had almost no disucssion
 
That's right, @Mike will do whatever it takes
 
bahahaha
 
@MikeB im sorry, this is a stupid question, but if i want to inspect the request headers, i should open my php file in chrome, right? Why am i not being able to do that?
 
Am I the only one who think this isn't a particular good idea? And a fix for something which isn't a problem?
 
2:27 PM
@PeeHaa looks pretty bare, yes.
I'm missing in the discussion the naming of mine-types.
 
@PeeHaa nope
 
@PeeHaa "The <?php tag, contained within one of these files, tells the webserver to, in essence, “switch to PHP mode”" Isn't this in itself incorrect? When the script is compiled, isn't everything not inside tags just treated as a constant string to be printed?
the webserver “switches back” and resumes parsing it as HTML .. seems like he has a problem with his webserver, if it is parsing his HTML
 
The RFC is probably a hoax.
 
Will file it under hoax :)
 
No, it's not
 
2:31 PM
I mean removing the <?php ?> tags - why should I use it then?
 
it'll never pass the vote anyway
 
Does PHP has support like this here: (?)
  #!/bin/sh
  exec scala "$0" "$@"
  !#
  object HelloWorld {
    def main(args: Array[String]) {
      println("Hello, world! " + args.toList)
    }
  }
  HelloWorld.main(args)
 
huh?
 
perl?
 
@hakre bash object ?
 
2:35 PM
@OmeidHerat no the code below !# is scala.
 
I think the !# is meant to "close" the sh part of the file (the shebang #!/bin/sh). More likely how ?> closes <?php.
 
ah, so we got some spaghetti code right there.
 
I'd say more a extended shebang.
 
Hey a quesiton, I have a really simple Bash tool, and the installation process is fairly simple (dependency check and simple copy), is it still a good idea to go for Make or I should just use a Bash script ?
 
@PeeHaa This RFC feels a bit strange.
 
0
Q: Interesting behaviour when reassigning $this

neylI adapted a very simple View class to pass variables from Controller to View so that in the view I can call the variables directly e.g. <?php echo $name; ?> and not <?php echo $this->name; ?> All the view vars are stored in an associative array called vars e.g. $vars['name']=...

My favorite kind of question. I'm doing something that shouldn't be possible! What? Why? How? Where?
Another reason extract() isn't too be trusted :p
I feel like some people mine bugs.php.net for somewhat-interesting bugs and backwards-engineer them into obscure SO questions
 
lol
 
What does double sigil do in PHP? ($$var)
 
Thanks for fixing formatting - I was in the middle and you got there first! The Question is How can $this point to "test_this" and $this->view_file points to "view.html.php"? — neyl 4 mins ago
 
user895378
2:48 PM
@PeeHaa That RFC is a terrible idea. It sounds like a a framework author trying to prevent people from being stupid. NEWSFLASH: you can't prevent someone from being an idiot.
 
@Whisperity and on a side-note, uness you are doing meta programming, you should avoid that as it makes debugging hell a lot harder.
 
@rdlowrey exactly
 
@rdlowrey PHP has a history of trying: magic quotes, safe-mode etc
 
@rdlowrey yup
 
user895378
Let's make everything super convoluted to fix a problem that isn't a problem!
 
2:50 PM
look up, see all your starred messages, feel superior
 
lol
@tcoder: nope, you're not missing something. that is indeed a div trying very hard to pretend to be a form. — Marc B 17 secs ago
Those damn divs always trying to get into the club pretending to be forms. I hate those guys
 
@OmeidHerat So here is the reason why I never saw them. (Or just my eyes ignored them.)
 
http://stackoverflow.com/questions/11412413/how-to-create-a-soap-domain-checker
Too localized, asking for help fixing a script they found
 
user895378
@CarrieKendall I am agree with all.
 
@MikeB So what is the actual reason. Is $this->something resolved at compile time, not at runtime?
 
2:53 PM
@Whisperity yup, though there is legit and nice use-cases though.
 
@rdlowrey memes are overrated ;]
 
@Leigh No, it's resolved at runtime IIRC... Do an opcode dump and check for yourself
 
Jul 5 at 16:59, by Omeid Herat
memes are so overrated.
Jul 5 at 17:00, by Carrie Kendall
stupidest thing i have ever heard
@CarrieKendall :P
 
user895378
lol
 
user895378
Chat history never forgets.
 
2:55 PM
exactly.
 
@ircmaxell is there a command line option for that? (not seeing it)
 
@Leigh I guess my point is.. does it really matter? You're trying to reassign $this
Why go beyond that?
 
@MikeB because I like to know the why
 
oops, forgot my <sarcasm> tags, my apologies @OmeidHerat
 
2:55 PM
@Leigh Unfortunately no. viper7 used to do it...
 
@Leigh So you're the type of person that upvotes these weird behavior questions
How are they useful to you
 
@CarrieKendall Ok now someone has to do a "THIS IS PHP!" version
 
In the future when you're reassigning $this you can look back and recall why it doesn't work the way you'd expect it to?
 
@CarrieKendall it's so tempting to say accepted but I guess I am going with No worries :P
 
@MikeB I don't upvote them, I'd like to be able to give the answer though
 
2:57 PM
wat @OmeidHerat
 
is downvoting questions or answers free, I forget?
 
questions
 
Cleanup city, coming to PHP tags
 
@Event_Horizon Negative, it costs rep for answers.
 
@CarrieKendall when someone says apologies you can be a very rude person and say accepted.
 
2:59 PM
@Event_Horizon questions
 
oh, i don't find that rude :]
 
ah, then everything is cool around here. :)
 
user895378
There will probably be a lot of people who like this RFC for automatic getters/setters, but IMHO it only eliminates a couple of keystrokes and completely foobars your class structure. It's changing the class structure at a very fundamental level with no benefit (that I can see) over an explicit method declaration.
 
You want fries with that? — PeeHaa 1 min ago
LOL
 
@CarrieKendall lmfao
@PeeHaa Can I have some drinks please :P
 
Is crc32() the best function to generate hashes whose sole purpose is to be used for collision detection? High speed and low collisions are priority
 
nczonline.net/blog/2012/06/12/… fairly old article... long read... good read..
 
@OmeidHerat Sure post a question on SO and you'll be served
 
@MikeB collision detection? No. crc32() is good for checksums only
if you want collision detection, use sha1 or sha256
 
holy crappy questions watman
 
@rdlowrey oy...
 
@ircmaxell Let me rephrase, I've concatenated a huge string together from different fields. I want to be able to represent that exact combination of variables as a hash so I can come back later and check for duplicates via that hash
 
He deleted it..
 
3:07 PM
@MikeB exactly, use a cryptographic hash
 
user895378
Nice. Good for him.
 
@ircmaxell cryptographic because it has low collisions?
 
yes
 
Where as crc32 is a checksum.. so while it's fast it has a higher probability of producing collisions (want to make sure I'm understanding this right)
 
Oy....
0
Q: Show image on hover with PHP

SoroshI have a small problem with my PHP code and It would be very nice if someone could help me. I want to display an image when hovering over a link. This is the link with the PHP code that I have now: <a href="<?php the_permalink(); ?>"><?php if ( has_post_thumbnail() ) {the_post_thu...

 
3:13 PM
@MikeB very high probability...
 
Got it - thanks
 
@ircmaxell: Used vulcan disassembler. $this "kind of" is resolved at compile time. FETCH_OBJ_R opcodes are generated to access properties
 
what about it?
 
3:27 PM
I can also vote now on rfc's. Cool :)
 
3:38 PM
@rdlowrey It does have the benefit of showing the class member and it's respective getter/setter immediately by it. I generate a lot of getters and setters, but PhpStorm takes care of it nicely.
Not sure I agree with adding new syntactic sugar to shorten the syntax. Maybe, I'm not sure yet.
 
user895378
@LeviMorrison To me it only just barely shortens the syntax. I just don't see enough benefit to justify adding it ...
 
I do like read-only and write-only.
Well, read-only mostly.
I do like being able to define methods for things like set without having to call setVariable and avoiding __set magic.
My overall feeling at the moment is that it is a good addition.
 
http://stackoverflow.com/questions/11416934/phpexcel-add-new-line
 
user895378
@LeviMorrison I only see obfuscation by doing this:
 
user895378
class TimePeriod {
    private $Seconds;

    // This property has specified the read-only keyword and therefore is read-only
    public read-only $Hours {
        get { return $this->Seconds / 3600; }
        // Setter may not be defined
    }
}
 
user895378
3:43 PM
As opposed to:
 
user895378
class TimePeriod {
    private $Seconds;
    private $Hours;
    public function getHours() {
        return $this->Seconds / 3600;
    }
}
 
user895378
Where's the demonstrable benefit? Adding a second way to do something that is already extremely simple?
 
class SampleClass {
    public $MyProperty {
        get;
        set;
        isset;
        unset;
    }
}
That cuts down on SOOO much writing. To be honest, my IDE does the work, but it's still less code.
 
http://stackoverflow.com/questions/11416928/predictable-ids-to-non-predictable-short-strings-in-php
 
user895378
3:47 PM
@LeviMorrison It does ... I guess I just am not a fan of adding syntax when the only benefit is to allow me to write less code. Maybe other people are.
 
@rdlowrey One nice thing is that it defines all the available options for a variable as part of its declaration.
Keep in mind this is mostly useful for value-objects.
Things that don't hold logic.
Every application should have a few (or maybe a lot) of these.
 
i broke SO
 
@CarrieKendall ? It looks fine to me
 
@CarrieKendall ??
 
user895378
@LeviMorrison I was about to say, "Yes, but people will use it all over their classes and crush encapsulation" but you can already do that without the added syntax :)
 
3:51 PM
@rdlowrey And since they work in interfaces, you can still do inheritance with it.
 
woot, my rep is 2222, and my badges are 2 silver, 20 bronze... where can I get 2 more bronze badges hmmm
 
user895378
@Leigh Post a crap answer and I'll downvote to help you get the Peer Pressure badge :)
 
Heh, I already had a question in the -20s because I was argumentitive :D
 
hehe
ok beer number 2
 
beer makes ... PeeHaaPee
 
3:54 PM
@Leigh :-)
 
user895378
@LeviMorrison In this example: isset already works for isset($this->myPublicProperty), why add the declaration? As for unset, do you really want code outside the object to be able to unset an object property?
 
jesus RoR is confusing at first
 
@Mike why are you using ror?
 
trying to learn it :)
 
3:55 PM
@rdlowrey You can define a custom isset/unset functionality. In that example, I'd just use {get, set}.
 
@Mike shouldn't you start with vanilla ruby?
 
@CarrieKendall What do you see in the console?
 
@CarrieKendall That happened to me yesterday too
 
not how i roll
 
3:56 PM
@CarrieKendall post a meta abou tit
 
@rdlowrey Unset may be as simple as turning a value to '', instead of erasing it completely.
That does have benefit.
 
@Mike kinda funny.. "why ror, because it's not how i rol"
 
@PeeHaa made me LOL
 
yeah figured it was
 
Maybe it's just me who's nerd enough to think of ror/rol as rotate right and rotate left in ASM ;x
 
user895378
3:57 PM
I can see your arguments, but I envision automatic getters and setters perpetrating mass atrocities against object encapsulation. Is it the language's job to protect people from themselves? Maybe not, but I'm still not sold that there's enough benefit to justify the addition.
 
@CarrieKendall damn lol :P
Well that too
 
@rdlowrey Give me an example of an atrocity against object encapsulation.
 
my problem isnt with ruby/ror @PeeHaa its with formtastic, and changing the displayed "title" of a select input element
f.input :author, :as => :select, :collection => Author.all figured it out
 
4
A: "Stack Overflow requires external JavaScript from another domain" message

ArjanFor future reference (not for this specific case, but for future search results): If you receive Stack Overflow requires external JavaScript from another domain which is blocked or failed to load. The Stack Exchange sites fetch jQuery JavaScript libraries from a Google domain. When these...

 
@Leigh All variables (apart from variable variables) are kind of resolved at compile time ;)
 
4:01 PM
> The al problem with PHP is that you CAN and easily can give bad advice! Because PHP is so terribly designed.
> Try to give bad advice in Java! Not so easy!
 
That's why they are called Compiled Variables :)
I see you're a room owner too @LeviMorrison :)
 
@PeeHaa i was trying to figure out how to redefine the displayed name of values in a select box. i've never used formtastic.. my code ended up being: f.input :site, :as => :select, :collection => Site.all, :member_label => :site_name
 
Great scott I am!
It never told me I was one.
 
user895378
@LeviMorrison At least if you want to incorrectly break encapsulation now in non-value objects you need to explicitly specify a getter method. If you tell the vast majority of PHP coders that they can just use these simple declarations to access, they won't have any black boxes. Everything will be public. I know that falls into the category of "you can't protect people from being stupid if they want to," but good OO php code is hard enough to come by as it is ...
 
4:04 PM
@LeviMorrison you weren't until today :)
 
@rdlowrey The real question is: does the benefit outweigh the bad?
 
@NikiC Well $this is special it seems. It actually causes different parameters to be passed to the opcode.
 
user895378
@LeviMorrison And I think that's probably just a personal preference decision. The Senate in my head votes 55-45 against the motion, but other people (clearly) may lean the other way.
 
@rdlowrey I spent about an hour yesterday making some value objects. Now, the IDE sped things up a bit, but I think with accessors it would have been even faster.
I'm not really sure how it hurts anything.
 
user895378
@LeviMorrison I totally understand. I spent a lot of time making value objects to pass to data mappers yesterday to :)
 
4:07 PM
@Leigh Not sure what you mean
@rdlowrey I like the getter/setter proposal
Or at least the idea, haven't looked at the details
It allows you to work with properties, but still define custom logic when you need it
Currently you basically can't use public properties at all
 
@NikiC When you do $obj->prop then FETCH_OBJ_R is called with 2 params, the variable ($obj), and a string ('prop'), when you do $this->prop, the opcode is only called with the property, so it is resolved in the object scope automatically
 
@Leigh Ah, that's what you mean
 
user895378
@NikiC I think that's a plus because it encourages people to use interfaces and design by contract. Public properties are ... meh.
 
@rdlowrey But why are they meh? It's because you can't safely use them at all.
 
Yeah, that would well be. Then it'll probably access EG(This) directly instead of the compiled var lookup
 
4:09 PM
@NikiC which is why the guy could modify $this with a variable variable, and still access properties. They were already (kinda) resolved by the compiler
 
@Leigh Oh, I didn't quite know the context ^^
I only saw you writing something about it
 
@rdlowrey Another reason they are meh is because properties can't be required by interfaces.
 
ow wait
 
4:10 PM
But these accessors CAN be included in interfaces.
 
user895378
@LeviMorrison But I see it kind of like magic methods ... I think it's better to use an explicit method declaration for the same reason __get and __set are bad for automatic getters and setters.
 
user895378
It's the explicit declaration of what's happening in a method that I prefer.
 
@rdlowrey They are magic, but they are scoped to a single variable and have a well-defined pattern. IDE's can easily make tools to test where the variables are used and such.
You can't do that with __get and __set. Also, __get and __set are only called on variables that don't exist. With accessors, you are tied directly to a variable.
 
user895378
@LeviMorrison You're right there ... but should I have to rely on an IDE to easily know what's going on? Shouldn't the code be as explicit as possible?
 
user895378
4:13 PM
I don't know. I don't feel strongly that it shouldn't be included, I just am not sure I'll use it if it is.
 
@rdlowrey Oh, you wouldn't be reliant on an IDE. I was just mentioning that unlike __get and __set tools can be easily made for accessors.
 
user895378
If I had a vote (which I don't) I would probably abstain.
 
user895378
@LeviMorrison I'm glad my original comment instigated discussion, though. That's what I was hoping for :)
 
yay! hash_pbkdf2() is implemented in master. Now to write the docs for it
 
4:15 PM
@ircmaxell Gratz! :)
 
@rdlowrey One thing I don't like about the proposal is that they allow for static contexts . . .
Now that's a language tool that shouldn't exist in high-level languages.
 
user895378
@LeviMorrison Oh, I must've missed that part.
 
user895378
automatic static getters/setters sounds like a train wreck waiting to happen
 
@rdlowrey static anything is already a trainwreck waiting to happen.
 
4:18 PM
in case anyone is interested in the solutions to my mini-problem of yesterday about how to get mysql and PHP to use the same timezone... in my.cnf/my.ini timezones are set by providing a GMT zone like this
 
hah i was about to that @Neal
 
[mysqld]
# Set timezone to Europe/Zurich
default-time-zone = '+02:00'
 
@markustharkun That's a strange way to define a timezone ^^
Because it looks as if a UTC offset was enough to specify the timezone, which it is not :)
 
@markustharkun Does that work???
 
@markustharkun its the default GTM ?
 
4:19 PM
@PeeHaa er, yes
it is indeed strange
 
@CarrieKendall ^_^
 
> This sounds reasonable. But one concern is the lack of translations and buildable formats with the wiki. I'm not sure if the simplicity/ease of a wiki is worth it, but it may be. But this entire idea is valid and worth talking about and solving. And it also relates to user comments within the PHP manual. ~Philip Olson
^ @ircmaxell That is a problem with a wiki format for tutorials.
 
That's it!:
 
@PeeHaa yeah its horrid today.. like i can't find a good question
 
user895378
4:23 PM
@PeeHaa lol I had to look at that a couple of times to understand what you meant :)
 
@rdlowrey How cute you're new here ;-)
 
user895378
I was so confused :)
 
hehe
 
user895378
Grammar Ping!
 
@rdlowrey <sarcasm src="http://gist.github.com/1689430" /> ^^
 
4:25 PM
lol
 
user895378
@CarrieKendall oh thanks, maybe I'll star that so it shows up in my personal favorites list over on the right.
 
user895378
Gee, this room sure is helpful. I might need to start idling here.
 
@rdlowrey Do it. I dare you.
 
@rdlowrey I lol'd
 
user895378
@LeviMorrison hehe it would've been funnier to star before @CarrieKendall added the <sarcasm> tag
 
ok last beer before I go home
 
user895378
@LeviMorrison For the record, the only thing worse than writing out 50 getter/setter methods manually is writing out unit test cases for all of them.
 
@rdlowrey I quit testing value objects a long time ago.
lol
My IDE generates them correctly every time.
 
user895378
@LeviMorrison if only my OCD didn't need to see that 100% ... it's a curse.
 
4:30 PM
(Of course, I may be bitten at some point down the road)
 
I'm tempted to change:
> Using global keyword outside a function is not an error. It can be used if the file is included from inside a function.
by:
> Using global keyword is an error.
:-)
 
for those moments when you feel you have too much spare time: youtube.com/watch?v=T8r3cWM4JII&feature=g-vrec
 
@PeeHaa Well I do have my superglobal classes like $c_user, $c_db and $c_tplsys made global at initialization.
 
@CarrieKendall I wonder how much time the editor for that video had :P
 
Can't edit any post. "Suggested Edit Queue is full" Edit links are greyed out.
 
4:43 PM
@Davinder "No more beer in office". Refrigerator is empty.
 
> Another important feature of variable scoping is the static variable.
^ Citation needed.
 
@PeeHaa :)
 
@LeviMorrison No, it's not. Because tutorials should not be designed to be translated.
 
@ircmaxell Perhaps. It's at least something to think about.
 
@Davinder But serious. Try again please
 
@LeviMorrison We really should drop all translations and focus on making the EN docs better .....
 
@PeeHaa I myself have very low rep (100+) so can't see the review queue.. Can just suggest. People need to process the suggestion list.
 
@NikiC Sorry, I can only work on so many things at once and keep a job!
 
@NikiC If you see parts that needs fixing add them to the list: gist.github.com/3055731 and maybe, sometime somebody can have a look at it ;)
 
@Davinder I also have 100+ rep :)
 
4:46 PM
@Davinder I've cleared some edits so you should be able to add edits
 
@LeviMorrison Dropping translations is no work :P
 
@PeeHaa Thanks..
 
np
 
Wow, I just did a PhpStorm patch update and it worked without errors. That never happened before
 
@NikiC But I can't work on docs and the prototype and try to figure out better data-structures, etc.
@NikiC Really? I haven't had problems yet.
 
4:48 PM
@LeviMorrison Is there anything new on proto?
 
it's Friday, Friday, gotta pass ZCFE exam on Friday
 
Btw, it would be nice to get some visual feedback when hoverting over the download buttons / texts :)
 
@LeviMorrison sure
 
@NikiC Nothing published. Trying to figure out some of the sub-pages.
 
/me is checkout out php-doc for the first time to make a manual change (adding hash_pbkdf2() docs)
 
4:50 PM
0
A: How do I add a value into parent class in php

Omeid HeratYou are violating The Sing responsibility principle by extended the user object into a authentication object. You should use a better session and authentication mechanism by use of Object composition.

my first answer after a long long long time in SO.
 
@ircmaxell I do have a local phpdoc checkout, but I never use it ^^ I just rely on someone telling me when I break the build :P
 
@NikiC There's actually been some discussion on the Thanks To portion. I couldn't believe it! Discussion? Really?
 
@LeviMorrison Is that good or bad?
 
> You are violating The Sing responsiblity principle.
 
@NikiC Discussion is good when historically there hasn't been any.
 
4:55 PM
Ah okay
I thought that maybe you're complaining about bikeshedding or so ;9
 
@LeviMorrison Isn't prototype on github?
 
@PeeHaa I don't know if it is on github. It is a git repository.
 
@LeviMorrison PROTOTYPE_2010 branch?
 
@PeeHaa Nope.
 

« first day (633 days earlier)      last day (4315 days later) »