Jump to content
Larry Ullman's Book Forums


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About JasonC

  • Rank
  1. Still learning, find this interesting. I'm not a programmer, more of a hobbyist.
  2. Appears perhaps to be making use of a dispatch table and late binding, described briefly at http://designpepper.com/blog/drips/using-dispatch-tables-to-avoid-conditionals-in-javascript
  3. Thanks! Just spent much of the night getting PHP to post to the Twitter API by hand coding myself, hopefully this is easier.
  4. Larry, is there a broken link on this page (http://www.peachpit.com/articles/article.aspx?p=1998951&seqNum=4)? A few lines down, the following is written: NOTE You can download the complete script here. But there's no link. I'd be interested in seeing the script, is it available somewhere?
  5. I have a similar problem not fixed with the above solution. For some reason, Postfix on my Mac (running OSX 10.6.8) is setting the "From" as coming from the Apache User (_www on my machine), despite the PHP headers and despite the -t flag above. My real-world email server then rejects the email because _www is "Not our Customer (in reply to MAIL FROM command)." If I change the Apache user to my user name for my real world email account, everything works fine. I have usually had the Apache User set to my login name on my Mac, but have read this is not a good idea, Apache should be running u
  6. Okay. This is probably the most challenging Javascript code I've tried to understand. I think I now understand theoretically what's going on. I'm wondering how one would change the code to make it more explicit what is happening while still keeping the X function syntax the same? Maybe using the call, apply, or bind methods? I'm not a programmer by training, just someone who uses Javascript and finds it interesting. I know some BASIC and some C, so I'm more familiar with the imperative paradigm than OOP. So I'm learning, but this pattern seems to be unusual. I find three things in this
  7. That's awesome, thanks! Give me some time to work through this, there's a lot going on.
  8. All right, after tearing this function apart, reporting variable values at every step to both the console using console.log and also to the page using document.write, I think I understand what's going on, at least a bit more. The for/in loop seems to be creating methods and assigning JUST the function STATEMENT to the new method name, not invoking it; e.g., "out[hide]" = "function (x) {out.map(m, x);return out;}". The only time I can get "m" to return a value is WITHIN the for/in loop, otherwise I get the error "ReferenceError: m is not defined". I don't understand why "m" is not being replace
  9. I've read the entire thread many times, and I'm still working on understanding this. Changing the immediately invoked function expression to the wrapper function makes it clearer, but I'm still trying to understand the inner workings of what is going on. My primary difficulty is understanding what is happening with the map method, what exactly is being assigned to what, and when and where the methods are being invoked when the X object is used. I understand the map method's definition, but this is not a simple example of its use. I understand this has something to do with functional progra
  10. I'm learning from various sources and can usually puzzle out what's going on, but this has me a bit stumped. I came across this code at http://www.webdeveloper.com/forum/showthread.php?224180-JQuery-how-does-it-s-insides-work: function X(css){ //dom utility //a couple of node harvesters, using id and tag name... function el(id){ return document.getElementById(id);} function tags(elm){return document.getElementsByTagName(elm);} //collect output: var out=[]; if(css[0]=="#"){//id out.push(el(css.slice(1))); }else{//tags out=out.concat([].slice.call(ta
  11. Found the answer, I guess, at http://stackoverflow.com/questions/153598/unknown-column-in-where-clause
  12. I'm just trying to use an alias in a select query and I'm having a problem. It's not a big deal, but I don't know why I'm getting an error. Can anyone answer this: Why does SELECT title, text, id FROM memos LEFT JOIN memos_associations USING (id) WHERE CONCAT_WS(' ',title,text) REGEXP '[[:<:]]potassium[[:>:]]' = 1 work ok, but SELECT title, text, id, CONCAT_WS(' ',title,text) AS combo FROM memos LEFT JOIN memos_associations USING (id) WHERE combo REGEXP '[[:<:]]potassium[[:>:]]' = 1 not? The latter generates the error, "ERROR 1054 (42S22): Unknown column 'combo'
  13. I found the problem. I had "submit" as name and id in the HTML for the submit button, somehow that was messing up the Javascript. Changed the id and name to "submitButton" and now the script works like you would think it would. Good grief!
  14. Okay, this is driving me crazy. I have a form that I am trying to submit using Javascript. I get a reference to the form with the DOM, add submit() to it, but I get an error in the Firebug console, "TypeError: document.getElementById("loginForm").submit". Any idea why this won't work? Page 379 gives an example where this should work, but also makes the point that "doing this does not actually trigger a submit event." I can get around the problem by generating a click() action on the submit button, but why doesn't submit() work?
  • Create New...