Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

12 Good

About skaterdav85

  • Rank
    Invested Member
  • Birthday 09/28/1985

Profile Information

  • Location
    Los Angeles

Previous Fields

  • Languages
    JavaScript & PHP

Recent Profile Visitors

11,744 profile views
  1. skaterdav85

    Apache connections limit

    Thanks! I found a really good article that explains it in a little more detail too. http://abdussamad.com/archives/169-Apache-optimization:-KeepAlive-On-or-Off.html Basically I was wondering how to fine tune Apache for large spikes of traffic.
  2. skaterdav85

    Apache connections limit

    Do Apache connections close once a server serves a web page for a given request? Also, if you are hosting all your static assets (JS, CSS, images, etc) on the same server as your site, how does that affect Apache connections? I was reading about the MaxClients Directive and these questions came to mind.
  3. skaterdav85

    Variable visibility

    you explained it much better JSG
  4. skaterdav85

    js var from php var SOLVED with thanks

    The code hasn't run through the PHP interpreter Save your file with a .php extension, and if you have a local web server with PHP installed, you will see the PHP code being interpreted.
  5. skaterdav85

    php callback function help

    Interesting, thanks! I used the ReflectionMethod class instead of ReflectionProperty for my protected method, but it worked similarly.
  6. skaterdav85

    php callback function help

    How would I use the setAccessible method in this case? Do all class members have a static method setAccessible so you can change it's access modifier on the fly?
  7. skaterdav85

    Variable visibility

    Yes, it is a logical OR. If args returns false, that expression will return arguments. If args returns true, args will be returned.
  8. skaterdav85

    Variable visibility

    Thanks JSG! I like your createDelegate method. Quite clever. In this situate I always just save this in a variable called that, which I'm sure you've seen before. It is kinda ugly especially if you have to do it in multiple methods.
  9. skaterdav85

    Variable visibility

    Well first off, why are you declaring a function called window? window is already a reserved object in the browser. Second, you will probably want to create all your instance properties/variables on the object. Right now you arent setting all those properties on your InitBuffer object. Move the following into InitBuffer and invoke it with new. this.xmlsource=objectsSource; this.indexbuffer = null; this.texelbuffer = null; this.initbuffer = InitBuffer;
  10. skaterdav85

    php callback function help

    super interesting, thanks everyone for helping with this! EDIT: Just noticed, even though I can pass in $this using the 'use' statement, I can no longer call protected and private members. I have to make them public. I'm guessing it is because the context of the callback function is no longer in the class.
  11. skaterdav85

    php callback function help

    In the code sample below, how do I access the value of $this inside the callback function in the hello() method? I also attached the class to this post if you want to execute it. I am getting the error: Fatal error: Using $this when not in object context I want $this to point to the current instance. class Person {public function hello() { $list = array(1, 2, 3, 4, 5); $this->iterate($list, function($num) { echo $this->multiply_by_100($num) . 'hello <br>'; });}public function iterate($list, $callback) { foreach ($list as $num) { call_user_func($callback, $num); }}public function multiply_by_100($num) { return $num * 100;}} $d = new Person();$d->hello(); php_closure.php
  12. skaterdav85


    Ya I saw that about PHP 5.4. This was one tricky bug to find out. Luckily there was an extra query string parameter that I could pass to Facebook to encode large ints as strings, which is what I wanted. All the other solutions I saw used tricky regular expressions which looked nasty.
  13. skaterdav85


    On my local MAMP stack (PHP V 5.3.6), json_decode is taking my JSON and converting long ints to strings. On my production server (PHP V 5.3.2), json_decode is converting long ints to floats. My long ints are Facebook page ID's that looks something like: 755509932534027 I found a workaround that tells Facebook to send me long ints encoded as strings, but how can json_decode behave differently on production? Is it possible to alter the default behavior of this function? Is this common? Thanks!
  14. skaterdav85

    simplexml parsing

    I did a print_r on a simplexml object and I get the following: SimpleXMLElement Object( [@attributes] => Array ( [term] => Standards [scheme] => Responsible Organization ) ) How do I access @attributes? I want to get the array element [scheme]. $root->@attributes throws a syntax error because of the @ symbol.
  15. skaterdav85

    Cacheing AJAX responses with jQuery

    Thanks JSG. The Cache-Control header is easier and I did: header('Cache-Control: max-age=86400'); //1 day = 86 400 seconds Also, by appending d=3_14_2012 to each request, the URL for the next day will be unique thus, not using the cache from the previous day.