Jump to content

johnsmith153

Members
  • Posts

    709
  • Joined

  • Last visited

Everything posted by johnsmith153

  1. Doesn't really explain Barand's answer though, unless he's just not up with the latest (which I doubt).
  2. I'm guessing there must be a reason why many examples I see use the old fashioned method, including Barand's example.
  3. Hi, Thanks for helping with this, but it doesn't really work. I think there's some things I could probably change though. Using this as an example: //returns an array of 1 - 30 (because only 30 days in April) echo get_date_time(1, 954806400, 957916800); // 4th April 2000 and 10th May 2000 (1) It returns 3rd April to 9th May, so it's maybe one day out either side. (2) It also returns a big long array, so in the above situation it doesn't return 30 values, it returns 37. I think a solution would be to just remove duplicate array keys, but does that seem wasteful to create a big array and then reduce it? Imagine for other scenarios where many years are used between the start/end values. Thanks again.
  4. Hi Requinix, It returns a list of options the user could choose from based on a min and max value. The result would be to create drop downs for date/time selections using the array as the values. From your questions: (1) Days for April 10th - May 4th = returns 1,2,3,4,10,11,12,13,14,15......29, 30 (so 1-4 and 10-30) I suppose 1-30 would be acceptable considering. (2) Option 2 month just returns the months (or a number referencing the month). So April 10th to May 4th returns April, May Option 3 year returns just the year, so April 10th to May 4th would return '2012' and March 2010 to August 2012 returns 2010, 2011, 2012 etc. Thanks for helping.
  5. Thanks Requinix, I'm looking at advancing this a bit and I've created this: It might be a bit much for a forum, so I'm considering posting it on Elance or something, but if you can point me in a direction then that would help, or maybe tell me if my instructions make sense when I post it to a job site. Thanks again for helping. -- I'm trying to create a function where I pass in a minimum and maximum timestamp and select one of 6 options: Options: (1) day (2) month (3) year (4) hour (5) minute (6) month and year The result will be an array returned with just the day, month, year, hour, minute or month and year. Month and year will be in the format "February, 2012" etc. function get_date_time($option, $min, $max) { ///etc } // returns an array of 4 - 15 echo get_date_time(1, 954806400, 955756800); // 4th April 2000 and 15th April 2000 //returns an array of 1 - 30 (because only 30 days in April) echo get_date_time(1, 954806400, 957916800); // 4th April 2000 and 10th May 2000 //returns an array of 1 - 31 (now allows 31 as 31 days in May) echo get_date_time(1, 954806400, 961459200); // 4th April 2000 and 20th June 2000
  6. I want to pass in a timestamp of start and end dates and return an array for a dropdown. So if I pass in 1117843200 (4th June 2005) and 1186704000 (10th August 2007), it will return all 27 months June, 2005 July, 2005 August, 2005 ... etc. ... July, 2007 August, 2007 -- I also want to do the same kind of thing for full dates too. So again if I pass in the same dates as above I can choose a date from three drop downs (day / month / year). -- I tried something like this, but it's not going to work: for ($yy = $start_y; $yy <= $end_y; $yy++) { for ($mm = $start_m; $mm <= $end_m; $mm++) { $values[] = date( 'F', mktime(0, 0, 0, $mm) ) . ", " . $yy; } }
  7. Example content: a CSS file, such as http://www.phpfreaks.com/media/css/screen.min.css It basically searches through a CSS file and returns an array of image URLs.
  8. Hi, Thanks for replying. My Regex is very poor and I put this together the best I can using various tutorials etc. If anything looks stupid then it probably is. It basically searches through a CSS file and returns an array of image URLs. That's all it needs to do. It doesn't need to to replace anything. It works, but takes ages to complete the processing.
  9. This: /[^\(]+\.(gif|jpg|jpeg|png|svg|bmp)[^;\s]*\)/gi ..runs quite slow. Any ideas to speed it up?
  10. Perfect. Thanks Ignace. How would you write it then ChristianF ?
  11. I have this: $value = '/\\' . $currency . '[0-9]*[.]?[0-9]{0,2}/'; ..which will get all price information on a page. The problem is if the price is "$1,000" then it only returns $1 - so I need it to also pick up the comma. I'm guessing this is easy, but I can't image how to solve this.
  12. I executed a SELECT query in phpMyAdmin which took a long time (lots of records etc.) In the 'processes' area it showed that it was 'creating a temporary table on disk'. When that completed, nothing happened. Where would the temp table be and how can I see the results of the query? I didn't want a temp table and my query was a simple SELECT with a few joins etc. (execution time being the only complexity).
  13. All this has been discussed so far. Unfortunately you need to read the whole topic to understand what is going on. I'm still surprised nobody's moved this to another of the forums on this site.
  14. Thanks for actually reading enough of the topic to understand it. Fair point about lazy loading images. There's still no way of telling the script 'how many' images to lazy load, and when to stop, though, but of course there's pros and cons with any method. I am thinking this might be better for image quantity though. Of course this will help file (image/video) quantity, but not file quality/size decision making. What about HTML5 video. What do you suggest for this?
  15. This is what I went with in the end. What made me look at this was how phpfreaks.com passes the session id in the URL (if cookies are off). I was testing a site with cookies off in the browser and realised PHP Freaks still allowed login.
  16. All above was mentioned in my posts. Yes, I do that, as mentioned in my posts. Have you ready them? I don't do that, as mentioned in my posts. Have you read them? No, I can't find it. I have posted this question on another forum as well, and more people have said it is a good idea. More than who have said it is bad. As you obviously haven't read enough of the posts on here to understand what is going on, I will repeat it: I am doing this IN ADDITION to everything else (device detection etc.) ChristianF is the only one who understands this: The site will run perfectly without this script. The site will run perfectly without JavaScript. The detection script will be used to provide an improved HTML5 video and image gallery experience ONLY.
  17. Only one person has commented on here about me using an Ajax call to determine bandwidth. That was ChristianF, who gave me the idea, and he seems to know what he is talking about. If nobody says otherwise then what else can I do? Nobody has told me not to do it, so what do you mean? I am currently working on something actually. It's a combination of the different scripts that are out there. It's not perfect, but I'm happy so far. I'm regularly getting feedback and advice from people in the know, so it's looking positive so far.
  18. jQuery mobile is very good, thanks. I personally prefer a solution that supports all devices, including desktops, in the same code base, but jQuery Mob does provide excellent support for older mobile devices. In fact, this link: http://jquerymobile.com/gbs/ is a very good list to use to check which devices you should support (e.g. if not developing in jQuery Mobile) - even more detailed than my list a few posts above.
  19. This is a poor attitude to have in a discussion forum. People won't always agree, and that is what makes debate in these forums so interesting and often educational. You decision to respond to my advice in this way is detrimental to any forum community. If you don't agree then say so, but responding like this helps nobody.
  20. Why do questions like this get so many answers? Surely there's somebody who's posted a long-winded, difficult question that could be given all this time everyone seems to have? Basically, he is asking if there is anything Java can do that PHP can't, and if there is, then what can it do? Scootstah gave a good answer though. Your response should be something like: "Java can do xyz that PHP can't. This is useful because of abc." Simple enough for me, although I know nothing of Java - or PHP for that matter.
  21. Psycho, I believe your methods are completely wrong. (1) Maybe the reason that mobile devices makes up a "miniscule percentage of our traffic" is because your sites don't support them. If 60% of visits to the London 2012 Olympics website were on a mobile or tablet, then that is saying something. If the 2012 website didn't support a mobile device then I can tell you for certain that they also would have very few visitors on a mobile device (and less visits overall no doubt as well). Of course every site should cater for a different amount of support, and the 2012 website would be a perfect example of one that should be created to support all and every (recent) device, but I can't think of one site that shouldn't support at least an iPhone and iPad. (2) You don't need a different stylesheet for each OS. Why would you need that? Why does Android need a different stylesheet to iOS? Use a responsive layout, and that is all you need in terms of CSS. it makes good business sense to create one stylesheet than to create many different ones. (3) You also say "soon we'll be adding support for Win Phone and Tablets". You don't need to "add support for tablets" if you code it right. That's like saying "soon we'll be adding support for people with monitors wider than 1200px". If a site works on an iPhone and is responsive, then it will automatically work on an iPad (both screen resolutions). Of course you should test it and decide if you are happy with the overall look on an iPad, but it won't need another stylesheet like you suggest. It appears that you have a problem creating a site which supports all these devices (listing all your problems with them). Don't let that make you not want to support them. (4) Testing doesn't have to be 1,400 devices. You can test on these OS: (some OS listed below are due to be released soon of course) - iPad (iOS 5 and iOS 6) - iPhone (iOS 5 and iOS 6) - Blackberry 5 and 7 - Blackberry Tablet OS 2.1 - Blackberry 10 - Windows Phone 7.5 (and 8 when available) - Android ICS 4 / 4.1 - Android 3.x - Andorid 2.3 - Nokia browser // these are browsers available on various OS that should be tested - Opera Mini - Opera Mobile - UC Browser - Google Chrome - Firefox Mobile There are various others, but overall they make up about 1% of all web traffic. The list above isn't that much. if you own the devices (I'm sure your company could afford them) then testing is easy.
  22. neil.johnson, Thanks, because I know you're trying to help, but I'm not talking about the correct way to build a website. Everything you say is true, except that I want to detect connection speed IN ADDITION to everything else. Just remember this is a PHP forum, and whilst my solution turned out to require JS and PHP, what you and Psycho are talking about is mainly front-end development, so you are completely off topic. (Of course device detection through the user agent isn't front-end development). Psycho, like you, is wrong in thinking the question is anything other than what it was. Psycho is also stuck in the past saying, "OK, if you are talking about supporting mobile devices...". A developer should equally support all recent browsers and recent devices. My question was: ChristianF got it right, and that was where this post should have ended. I have ended up with this: http://www.page-test.co.uk/c.php - which will return an approximate connection speed. Of course it isn't perfect. Of course I should run it a few times and get an average. Of course there are many, many negative things that can be said about that script, but it gives a very rough idea, and allows a device to be put into one of three categories for connection speed. I plan to use the script that I have now created (obviously there is more work to do than just the script in the link I posted) to offer an improved website experience when displaying HTML5 video and an image gallery. If JS is off, if the browser doesn't support my Ajax implementation (some mobiles don't), if session storage isn't available (I chose this over cookies) - basically if anything is wrong then the script won't run and default settings will be used (which the user can always override if they want to). If the script does run, and it detects a connection speed, then that data can be used to improve the website experience. HTML 5 video can't itself detect bandwidth - so this is essential.
  23. OK, if you are talking about supporting mobile devices then that aspect alone should be your criteria, IMHO. A mobile device has limited screen real-estate and you should limit the number of photos on that rather than their connection speed. In addition to limiting the number of records per page you can also implement different style sheets for mobile vs. desktop. "Supporting mobile devices?" Do people still ask that? 60% of visits to the London 2012 Olympics website was on a mobile or tablet. People still make an effort to support IE8. What if someone was using a laptop with a 3G dongle? Large screen and slow connection. My question is about detecting connection speed, not satisfying a different screen size. ChristianF has got this right. I will use settings, but of course people may not bother to change these, so an automatic detection helps as well. Anyone thinking this is unnecessary should think about HTML5 video. Unlike Flash, HTML5 video has no support for detecting connection speed.
  24. I'm talking about lots of images (image gallery). I certainly wouldn't just tone down a bit of HTML. If someone is on a cheap Android phone with an average connection (2G or even 3G) then I would probably show 10 images at a time. If someone was using wi-fi then I would show a lot more.
  25. I want to detect the user's connection speed to offer an improved website experience. As an example, use 20 records per page pagination, but allow the detection script to change that to higher or lower (as well as other things). How is the best way to do this, and can someone point me in the right direction? Thanks.
×
×
  • 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.