Jump to content

.josh

Staff Alumni
  • Content Count

    14,780
  • Joined

  • Last visited

  • Days Won

    43

.josh last won the day on September 16 2019

.josh had the most liked content!

Community Reputation

1,420 Excellent

About .josh

  • Rank
    .josh

Recent Profile Visitors

39,080 profile views
  1. So a couple of things. Firstly, sure, there are more "elegant" ways of writing this if "make the shortest amount of code possible" is what you consider "elegant". However, I would argue what is more readable and flexible for yourself and other non/semi-coders in the future would be to have a lookup table of hours, Something along the lines of this (I think I got the hours of operation right, based on your condition): function checkTime() { // array of 7 elements, one for each day of the week var hoursOfOperation = [ // array of 24 elements, one for each hour of the day.
  2. yeah well I have a feeling that's not what he really wants.
  3. You need to restructure your code to use AJAX. Read up on how to submit an AJAX POST request and receive a response to update a div or w/e on the same page. There are a billion tutorials out there for it. Come back with specific questions about it if you get stuck.
  4. Literally the only thing I have ever seen popup when I try to close my tab/browser or otherwise navigate from the page that I only _marginally_ consider "okay" (read: barely tolerable) is a warning about losing unsaved changes to something.
  5. At face value, this should work for you: preg_match('~^\d+/\d+$~',$subject,$match); if ($match) { // matched, do something } but i have a sneaking suspicion you aren't telling us the whole story/requirements.
  6. You can try adding something like this. I've seen it more or less work as a bandaid for some: $(document.ready(function() { $('.product-small .show-details').hide(); }); I don't really have an explanation why it happens though.
  7. Here is a basic example for what you want to do, that will work for the link example you provided: <script> $(document).ready(function(){ $('a').each(function() { var onclick = $(this).attr('onclick')||''; var qs = location.search.replace('?',''); var url=onclick.match(/window\.open\('([^']+)/); if (url&&url[0]) { newUrl = url[0] + ((url[0].indexOf('?')==-1) ? '?' : '&') + qs; $(this).attr('onclick',onclick.replace(url[0],newUrl)); } var href = $(this).attr('href')||''; if (href) { href += ((href.indexOf('?')==-1) ? '?' : '&a
  8. If you are absolutely, positively, 100% sure you will not ever need to actually do any queries to return data sets based off stuff within there, then it shouldn't be an issue
  9. Just a random thought.. I don't know full context so this may or may not be something you can do, but I assume if it's a list of numbers you will split at the comma and loop anyways.. why not just simplify to ^[0-9,]+$
  10. To directly answer your question, with regex you can use a negative character class to match anything that is not a quote. You didn't actually post your regex code, so a simple example matching relevant part: preg_match('~<span id="[^"]*">~',$content,$match); However, I agree with kicken about using a DOM parser. Depending on what exactly you are looking to grab, you can sometimes get away with parsing html with regex, but in general, regex alone cannot be used to fully and reliably parse html. Regular expressions (regex) parses regular language types (hence the name), meaning, there
  11. regex engine ignores does not capture groups in zero-width assertions (e.g. your positive lookahead), so there is no performance difference between using (?:[pattern]) vs. ([pattern]) unless you want to count the unmeasurably small amount of time it takes to read (and ignore) a single colon char.
  12. a) Let me remind you that you are responding to a post that was posted several years ago, when this stuff was a much bigger issue. b) I work in the web analytics industry. I look at web stats all day long. And I talk to corporations all day long about those numbers vs. their web sites and the user experience (UX) of their sites. What I see is the exact opposite of your thoughts about webmasters still striving to cater to <IE8. I have been fighting for clients to ditch IE6/7/8 support for years and they are only just now starting to come around since earlier this year, only because
  13. Frank, that's not a fully cross-browser compatible version of ajax for <IE8. Most people still strive to support IE6 and IE7, even though Microsoft stopped officially supporting those versions (and IE8) earlier this year (April 2014 - XP no longer supported, so by extension <IE9 no longer supported). Also sidenote: you gave a simple example of what to do with the response. That example isn't cross-browser compatible either. And in reality, most people use ajax in conjunction with more complex code, from event handlers to selectors, notwithstanding applying previous stuff to whatever
  14. It was not my intention (nor do I think I implied it) to say you're stupid if you don't use a framework. I said do yourself a favor and make your life easier. Also, I am not "just another soldier" in the "we use frameworks" army. I actually actively resisted and opposed frameworks for a very long time. I too made arguments such as "If people learn jQuery, they won't learn the core language and therefore they will be weak." But the bottom line is that there's always going to be a certain amount of coding involved to keep things cross-browser compatible. And after several years of deve
  15. sounds more like a memory problem, not an ftp program problem. By "map" I assume you mean folder or directory, right? you may need to ftp from command line or write your own script that ftps to it..IOW a method that doesn't involve trying to grab and display a list of the working directory/folder. And then NOT do things like list or display dir content.
×
×
  • 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.