Jump to content
Larry Ullman's Book Forums

HartleySan

Members
  • Posts

    3047
  • Joined

  • Last visited

  • Days Won

    243

Everything posted by HartleySan

  1. That's kind of why Java was created; you have a platform that Java sits on that works the same across all OSs.
  2. Yes, if you use double quotes for the entire string, then you must do that, yes. Personally, I prefer to use single quotes for everything but the newline characters, and then switch to double quotes for just those. Either way though, you can solve your problem.
  3. Welcome to the forums. You're going to need to provide a lot more info than that. Please post the relevant code.
  4. That's why a lot of bigger websites these days use CDNs (content delivery networks) like Akamai.
  5. Note that the proxy script you write to retrieve the images will run on a separate process thread, thus the header issue is not a problem. For example, all the images you want to load via the proxy script will require markup like the following: <img src="image_proxy_script.php?img=image1.png"> You can have as many of those image tags as you want on the page, as they will all invoke separate processes, thus not causing any issues. To answer your second question, I imagine that you'd want to construct a data model that allows you to loop through an array where each element is a post and all the data surrounding that post, including the URL to the avatar image. As such, one SQL call to get all the avatar images makes the most sense to me. In fact, I imagine that with the proper joins, you could get all the post info you need in one query. With all that said though, please note that for each img tag you have in your markup, a separate HTTP request will be made for those images. That is how the protocol works and is unavoidable.
  6. It may work, but realize that you're now allowing any valid URL to get through and potentially lead users to malicious sites.
  7. Okay, I think I understand what you're asking now. Like I said before though, this is not a trivial task, and will require the use of at least one very complicated regex. To get you started, please look at the following: http://stackoverflow.com/questions/161738/what-is-the-best-regular-expression-to-check-if-a-string-is-a-valid-url If you're still up for the challenge, give it a go and report back with any problems you find.
  8. I still don't really understand your question, but it sounds like you are turning all HTML special characters into HTML entities before inserting the data into the database, and you then want to (sometimes) turn the a links back into actual links. Is that correct? Operating on that assumption, I have a few comments: I would not recommend altering the user input before it's put in the DB. I would alter it as need be every time you retrieve it for view purposes. Keeping the input in its raw form in the DB will give you maximum flexibility. To do a mass string replace across disparate values, you're going to have to use regexes. This is not a trivial task if you're not used to it. I warn against attempting this because of #3 below. Allowing for clickable links from user input is one of the biggest security risks you can imagine. I would be very careful about how you handle this. With all that said though, I'm still not sure I understand your question, so please clarify. Thank you.
  9. Believe me, I've been in the same situation myself many times. Unfortunately, debugging is one of those things that no one enjoys doing, and you really only get better at it by doing it a lot. Anyway, I guess the lesson here is to always output some sort of temporary message for all parts of a conditional so that you can more easily catch these things. Good find!
  10. That's not quite what I was asking. I meant, what is the actual query, minus all the variables, etc. For example: SELECT *, DATE_FORMAT(payment_date) AS formatted_date FROM item_payments WHERE username = 'Bob' AND item_name = 'Invitations'; Also, you have a comma at the end of your query, not a semicolon. Is that the problem?
  11. You mean you want this? <?php function create_text_field($label, $name, $value) { echo '<label>' . $label . '</label>'; echo '<input type="text" name="' . $name . '" value="' . $value . '" />'; echo '<br><br>'; } ?> Also, you're mixing HTML and XHTML and your br tags are not semantic.
  12. Hello and welcome to the forums. The value you set for the value attribute of the input element is what will actually be made "sticky". In other words, in your code above, the value of the $value variable will be made sticky. Make sense?
  13. I can't understand what you're asking. Could you please provide some code to clarify?
  14. Hello, and welcome to the forums. If only "hello" is output, then your DB connection is probably okay. Try running a query and see if the results come back.
  15. I will admit that the CKEditor interface is a bit annoying to get used to, but basically, you need to first get the container element of the text through some sort of DOM selector (or by looping through the CKEditor interfaces from the CKEditor object). From there, you have to either use the value property or textContent/innerText to get the text within the container, and then reference the length property of that string. It's hard to give a more specific answer than that without some code to reference, but that's the basic premise.
  16. I've only used MariaDB briefly, but it seemed totally fine to me. Also, to be honest, I've never really been one to utilize all the latest-and-greatest most products have to offer, so I'm probably not the best one to comment on the feature sets of MySQL and MariaDB. I generally stick with MySQL only because it's what everyone uses and it has the established history and support. For the most part though, I always stick with basic CRUD queries using prepared statements, which all RDBMSs support anyway, so I'm pretty much RDBMS-agnostic. Anyway, please let us know what your experience is if you use it. Thanks.
  17. The original MySQL team is the MariaDB team. If I remember correctly, the MySQL team continued to work on MySQL after Oracle bought it, and after a number of disagreements, they broke away from Oracle and created MariaDB. A lot of people say that MariaDB is the true MySQL, but regardless of what you think, it's good.
  18. It won't "automatically" execute, per se, but it will execute because you have the parentheses after the function name. Any time you put parentheses after a function name, the function will be called. The only difference from my code and yours is that the return value of the regularExpressionMatchFunction function is then sent as an argument to the push method of the returnVals array (in one line of code). You could, of course, pull the code out across a couple of lines for clarity's sake, but I really don't think it necessary in this case. Also, I'm more than happy to help, but I would recommend a couple of things in the future: Try not to rely on me and this forum too much. Really, really try to do things yourself before coming here. It's not that we don't want you here; it's more that I think you'll grow more as a programmer if you try more to solve problems you encounter yourself. Sure, it can certainly be frustrating (believe me, I know), but I think maybe giving problems you face a little more time yourself before coming on here will help you grow. Please make more of a concerted effort to clearly explain any problems you're having and provide legible code snippets in your posts. Whenever I make a post asking for help here or on Stack Overflow, etc., I always re-read my post many times and edit it accordingly before actually posting it to make it as simple and straightforward as possible for anyone that may potentially help me. Doing so will make it much more likely that people will in fact try to help you. Anyway, I'm glad you solved your problem!
  19. angels, please use the <> button in the site editor to mark your code. Your code is still hard to read. Anyway, as a general solution, I would first always return flagVariableNoError from the regularExpressionMatchFunction function, regardless of whether it is true or false. I would then have that return value stored in an array of return values. For example, at the top of the validateFormOnSubmit function, define a new variable as such: var returnVals = []; Then, store each of the values returned by the regularExpressionMatchFunction function calls in the array like so: returnVals.push(regularExpressionMatchFunction("firstName", /^[A-Za-z'\.]+\s*[A-Za-z'\.\s]*$/, "The name must include alphabetical letters \(and can include apostrophes, periods, and spaces\)")); Then, after all the regularExpressionMatchFunction function calls are complete, do something like the following: for (var i = 0, len = returnVals.length; i < len; i += 1) { if (!returnVals[i]) { return false; } } That answer your question?
  20. Hello and welcome to the forums. I am unclear on what you want, but it sounds like when someone clicks on a horse, you want to get more info about that horse. What does that have to do with autocomplete? Do you want a PHP-only solution, or a solution that uses JS as well?
×
×
  • Create New...