Jump to content

skaterdav85

Members
  • Posts

    874
  • Joined

  • Last visited

Posts posted by skaterdav85

  1. In Javascript, when you evaluate a logical OR expression the value of that expression will be the first "truthy" value. So if args does not evaluate to false, then args || arguments will evaluate to args, or else it will evaluate to arguments. It's the same as doing this: if (args) callArgs = args;else callArgs = arguments;
    you explained it much better JSG
  2. 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.

  3. 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;

  4. 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.

  5. 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

  6. 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.

  7. 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!

  8. 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.

  9. Thanks for the resources! I actually just installed Git on my work computer (a PC) and I noticed there was a Git GUI program along with Git Bash. I just used Git Bash since I am familiar with the terminal commands but maybe I should give the GUI version a shot. How do you like it? Easy to use? I guess for macs we're just left w the command line, which is fine i guess but it was a bit to learn when i first started. Thankfully, im over that hump now.

  10. Woa, I havent heard of this. I have a mac and after you get used to the terminal, it's not all that hard to use. Looks like this is only for PC, which I may use whenever I'm on a PC. I've tried Tower before I was familiar with the terminal and I thought it was pretty good. Except you have to pay for it so I just went with learning the commands, which is probably a more valuable skill to have anyways.

  11. When I first started web development, I bought DW because that was the only editor I knew. Several years later, I've been exposed to several other IDE's and I think I would still buy DW because of its Managing Sites feature. This makes FTPing files so much easier, especially if you have files in several different folders. With FileZilla or Fetch, I have to constantly open up the right folder and drag over my local copy of a file to update the new one on the server. In DW, I can just click that Put arrow and it figures out the proper folder for where to update the file.

  12. When you try to select the text with the text tool, it will tell you which font is missing.Write down the font name, and do a search for it. If its freely available, then download and install it. If its a commercial font then you'll have to buy it, or find a free alternative thats very close to the original.Installing fonts depends on your Operating System.
    oh ok. thanks! i see it displaying the missing font types.
  13. im not much of a PS guy, but i have to slice a psd. i got a psd from someone and when i open it up in PS on my computer, it says:"Some text layers contain fonts that are missing. These layers will need to have the missing fonts replaced before they can be used for vector output."Is there a quick fix to solve this? I googled a bit but i didnt find a direct answer.

  14. I'm surprised Netbeans isn't listed in this poll. I've tried probably half a dozen code editors/IDEs, and Netbeans beats 'em all (except Dreamweaver, but the price difference is $399! So in bang-for-the-buck, Netbeans still wins hands-down).
    netbeans is really good, except what i hate about DW and Netbeans is the load time. neither are lightweight and sometimes lag a little depending on if other processes are running in the background whereas something like TextMate which has bundles and syntax highlighting is really lightweight and good enough for most of what i do.
×
×
  • Create New...