Jump to content

Adam

Moderators
  • Posts

    5,717
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Adam

  1. Looks like you're using PDO. Check if ->errorInfo() contains an error that might explain the problem.
  2. Use the createElement() method of the document object. Sample code: // Create the element var input = document.createElement('input'); input.type = 'file'; input.name = 'myfile'; // Append to the document body document.body.appendChild(input); Of course you'll probably want to append it to a DIV container or something instead, so that you can position it correctly.
  3. Welcome aboard "justbob"!
  4. A database would be ideal yes, though not essential. As for procedure, do you mean in terms of the code / database structure needed or.. more about the logic behind it?
  5. The case-insensitive flag is a 'modifier'. All modifiers are applied globally to an expression, and as such are placed after the right-side delimiter, to separate them from the rest of the expression: /^[a-z0-9][a-z0-9_-]*$/i The caret character means the start of the string. If used, there can be nothing within the string that doesn't start with a match for the expression. If you also apply a dollar to the end of the expression, then that means there can be nothing in the string after the expression too. If you didn't use the caret, "_myUsername" would still be considered a match. That's because the expression is only matching "_myUsername".
  6. Did you look at the jQuery.ajax API? It's pretty straight-forward. You can practically copy and paste the code provided, and only have to change the path to your PHP script to get it working. By the way I'm not rich and I don't live with my parents. I don't get what you're getting at there? Many people can pick up jQuery because it's so simple and there's plenty of documentation/tutorials available. If you're not willing to learn it yourself, either pay someone to do it or don't expect to use it.
  7. That's correct. You can accomplish what you're after with: /^[a-z0-9][a-z0-9_-]*$/ The first range limits a single character to a-z and 0-9, then the second is almost the same, but adds the extra two characters. Be aware that the hyphen must be at the end of the characters unless escaped with a blackslash ("\-"). The asterix on the end means that range must be matched '0 or more times'. The leading "^" and ending "$" mean the start and end of the string. If you want the second character to be required, then you could change it to a plus, which means '1 or more times'. Or you could specify a minimum & maximum on the end using "{min, max}": /^[a-z0-9][a-z0-9_-]{2,9}$/ That would require a username between 3 and 10 characters, starting with a-z / 0-9.
  8. A callback is a function or piece of code that is called after a specific event or action. In this case it's called after the +1 button is clicked, but it's not triggered by the click event. The Google API will return to call that code after it's done what it does. As for writing it for you, I'm afraid that simply won't happen. We're here to help you if you get stuck trying to do it yourself, not complete your work at your request. We can guide you though.. Creating an AJAX request is extremely easy with jQuery (look into the jQuery.ajax API). As a first step, get that working with a static value. Then concentrate on retrieving the "ID" - although I have no idea where this ID comes from. Is the callback function handed some kind of response data containing it? Never used the Google +1 API before.
  9. http://www.regular-expressions.info/tutorial.html
  10. Just like any other query?
  11. Yeah..? If outside of the class, use Foo::constant: $foo->someMethod(Foo::constant) IF you're calling the method internally, use self.
  12. Remove the plus, which means 1 or more, and add "{4}". That will require exactly 4 repetitions of the token.. /^\d{4}$/
  13. If using classes, you should define them as a class constant: class Foo { const constant1 = 1; const constant2 = 2; [...] Then accessed through: self::constant1 // from within the class Foo::constant1 // from outside of the class
  14. Adam

    Firefox 6?

    I just got a Beta alert about FF6 earlier. Really? I only just installed FF5 a couple of weeks back? Google have kick started some bizarre browser-version competition.. There's barely even been a noticeable difference from 4-6!
  15. What's your question?
  16. I just meant explain what the code is for..
  17. Care to explain your reason for this post? Do you mean that on the second call it starts to give off the error? Try adding an IF statement around it: if (canvas1.getContext) { var context1=canvas1.getContext("2d"); // ... rest of code here } That would prevent multiple calls to getContext() - though this is my first encounter with it to be honest.
  18. This really isn't difficult to implement. You just need to know how to query a database and concatenate strings. No idea what your API for sending the messages is like, so can't comment on that. I assume though it'll just be a string of recipients delimited by a special character, or you loop through an array of recipients and repeatedly call some construct. Just tackle it one step at a time; * set-up the database table structure * create the form for inserting into the table * query the table for the data * concatenate the fields together * check for length restrictions * call API to send message If you get stuck at any of these points, come back here and explain to us the problem. You're going to get far better support for those kind of questions than.. Well a very broad range of problems that most people don't have the time to talk you through.
  19. The error suggests that canvas1 is null. Are you retrieving it correctly?
  20. You can use an anonymous function: setTimeout(function() { draw(500); }, 5000);
  21. You would need to access the form through the forms array: document.forms[form].submit(); Otherwise JS will try to look for a form named "form". I wouldn't advise using a link to submit the form though, as users with JS disabled won't be able to use it and you'll have no fall back. More and more common these days, with mobile devices and users trying to combat pop-ups and such. What's wrong with the fully supported submit button? You can even style it to look and behave like a link if you prefer: <style type="text/css"> input.link-submit { background: transparent; border: 0; color: blue; cursor: pointer; display: inline; text-decoration: none; } input.link-submit:hover { text-decoration: underline; } </style> <input type="submit" class="link-submit" value="Send" />
  22. No suggestions come to mind. A transitional doctype is a lot more forgiving too, so I doubt it's an issue with the mark-up. Do you have this online for us to look at?
  23. Assuming we're talking about a standard image, you can't force the browser to slowly draw it. Browsers aim to be fast, so forcing them to go slow is counter-intuitive. Plus browsers don't tend to load images line by line anymore - maybe IE does actually, I'm not sure. I don't know exactly what they do, but the image appears pixelated and becomes clearer, so they must read certain pixels at varied points to give a basic view of the image, and then go through and fill in the gaps. Just guessing here though, I've not looked into it. Anyway, the best solution for this wouldn't be to try and control the browser. You should look at animating a DIV element displayed over the image, to slowly reveal the image. It shouldn't be very difficult to do, especially with jQuery.
  24. That's exactly what happens already.. Do you mean after the page has loaded?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.