• Web Dev Questions That Don't Need Their Own Thread v4
    5,001 replies, posted
I'm using PHP and [url=https://github.com/abartholomew/twitchphp/]this[/url] Twitch library to fetch a list of streams for a certain game. It works perfectly [i]most[/i] of the time. However, rarely the information fails to load, resulting in an infinite loading time for the rest of the page. I put the set_time_limit() inside the library's function to fetch the Twitch information, but before I could test it the page loaded fine again. (There was a period of about 60 seconds where it didn't work) My question is, is using set_time_limit() the correct way to prevent infinite loading with PHP?
[QUOTE=Cep.;46039999]I'm using PHP and [url=https://github.com/abartholomew/twitchphp/]this[/url] Twitch library to fetch a list of streams for a certain game. It works perfectly [i]most[/i] of the time. However, rarely the information fails to load, resulting in an infinite loading time for the rest of the page. I put the set_time_limit() inside the library's function to fetch the Twitch information, but before I could test it the page loaded fine again. (There was a period of about 60 seconds where it didn't work) My question is, is using set_time_limit() the correct way to prevent infinite loading with PHP?[/QUOTE] PHP, by default, has a maximum execution time of 30 seconds. Check your phpinfo(), it should have a line saying "max_execution_time". The value behind it, is the time in seconds that the script should run for. If the request takes longer than this, I'm quite sure it returns a HTTP 500 error. Check your phpinfo(), if this isn't the case, then I think it is something clientside that prevents it from loading, not your webserver.
fp isn't letting me post anything with code in it so CEP, go here. [url]http://pastebin.com/Bnc7CcX5[/url]
[QUOTE=01271;46040644]fp isn't letting me post anything with code in it so CEP, go here. [url]http://pastebin.com/Bnc7CcX5[/url][/QUOTE] use [code] [code] //$c = file_get_contents($this->getApiUri("channel").$channel); //file_get_contents is extremely slow and unreliable for downloading. //add this function: function get_from_url($url, $timeout = 5) { try { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); $data = curl_exec($ch); curl_close($ch); return $data; } catch (Exception $e) { return false; } } /* *And then replace every single file_get_contents with that. *Change $timeout (the time it'll wait for the entire page to download) to whatever value you want. *also add a thing that if the download returns false say "something went wrong with twitch!" */ [/code]
Hey guys, I'm having an annoying render problem between Firefox and Chrome. Chrome renders the fonts perfectly with TTF and OTF formats, whereas Firefox rejects that completely - I have to use WOFF instead. Unfortunately, the rendering for the two is completely different. [img]http://i.imgur.com/yVPCOCO.png[/img] (Chrome above, Firefox below) Is there any solution for this? It's not so bad in small amounts, but for body paragraphs it becomes slightly obnoxious. Using the font (aleo) in other programs such as Skype, it renders as it should as well.
[QUOTE=ramirez!;46044053]Hey guys, I'm having an annoying render problem between Firefox and Chrome. Chrome renders the fonts perfectly with TTF and OTF formats, whereas Firefox rejects that completely - I have to use WOFF instead. Unfortunately, the rendering for the two is completely different. [img]http://i.imgur.com/yVPCOCO.png[/img] (Chrome above, Firefox below) Is there any solution for this? It's not so bad in small amounts, but for body paragraphs it becomes slightly obnoxious. Using the font (aleo) in other programs such as Skype, it renders as it should as well.[/QUOTE] If I'm not mistaken, Chrome renders its fonts differently now. That's probably what you're experiencing.
Opinion on the fastest webserver set-up: Ngninx + MemcacheD + Varnish
[QUOTE=Neophyte;46045970]Opinion on the fastest webserver set-up: Ngninx + MemcacheD + Varnish[/QUOTE] Whatever floats your boat, it's not like you're running a website for a fortune 500 company, use whatever you want that works for you
[QUOTE=Goz3rr;46046506]Whatever floats your boat, it's not like you're running a website for a fortune 500 company, use whatever you want that works for you[/QUOTE] Just as a note, most "fortune 500" companies use a CMS, usually ASP.NET-based.
Last question! I switched fonts to Candara, and am currently trying to load it off a server for Mac users only (Candara being a Windows Cleartype font). I've set up a script to detect operating system, and testing it to change link colors to red if the user was on a Mac OS worked well, but it appears dropping an @font-face inside the resulting CSS tag just doesn't work. Any thoughts on how I could approach this? EDIT: Loading Candara's ttf in an @font-face outside the tag obviously works on both Mac and PC, so if need be I'll resort to that.
[QUOTE=smidge146;46015209]How do I change this code: [CODE]function SearchCtrl($scope, $http) { $scope.url = 'search.php'; // The url of our search // The function that will be executed on button click (ng-click="search()") $scope.search = function($sce) { // Create the http post request // the data holds the keywords // The request is a JSON request. $http.post($scope.url, { "data" : $scope.keywords}). success(function(data, status) { $scope.status = status; $scope.data = data; $scope.result = data; // Show result from server in our <pre></pre> element }) }; }[/CODE] So I can return it using ng-bind-html????[/QUOTE] Did you try $sce.trustAsHtml
[QUOTE=Moofy;46041812]use [code] [/QUOTE] I know how that tag works but cloudflare or something always gives me problems and I end up at a blank page instead of posting when I embed php.
First time posting here so.... Ok ive learnt a lot of css and html and I want to move onto some other web development languages but im not sure which direction to go from here. I know JQuery can be used for some better designs and stuff which i havent learnt yet but my end aim is to make a test site where users can register and upload things like a simple article or something that can be publicly viewed. Im not sure what other languages to take up for this? Im pretty patient too and dont skip ahead of things
Maybe start with some basic JavaScript? It's best to have the basics down before moving on to frameworks. I can recommend codeAcademy. It's a good start before moving on to jQuery, which is far more useful than animations
[QUOTE=_Entity;46058632]First time posting here so.... Ok ive learnt a lot of css and html and I want to move onto some other web development languages but im not sure which direction to go from here. I know JQuery can be used for some better designs and stuff which i havent learnt yet but my end aim is to make a test site where users can register and upload things like a simple article or something that can be publicly viewed. Im not sure what other languages to take up for this? Im pretty patient too and dont skip ahead of things[/QUOTE] Start with some JavaScript tutorials. Once you feel more comfortable with that, do JQuery. While doing JQuery I feel grabbing [URL="http://getbootstrap.com/"]Bootstrap[/URL] will help a lot. [QUOTE=Cuel;46060462]Maybe start with some basic JavaScript? It's best to have the basics down before moving on to frameworks. I can recommend codeAcademy. It's a good start before moving on to jQuery, which is far more useful than animations[/QUOTE] The problem with Code Academy is that it dives you into JQuery without really doing much JS, and it never differentiates the two. I mean yeah, they're pretty much the same thing for anyone who has used them for any length but I still think it's important to understand it. It was a good review (and update) for me but I was already familiar with JS/JQ from college. I feel it would be pretty god damn harsh on a newcomer.
[IMG]http://i.imgur.com/jQmQnsK.jpg[/IMG] HOW DO DORK
[QUOTE=FlakAttack;46061423]Start with some JavaScript tutorials. Once you feel more comfortable with that, do JQuery. While doing JQuery I feel grabbing [URL="http://getbootstrap.com/"]Bootstrap[/URL] will help a lot. The problem with Code Academy is that it dives you into JQuery without really doing much JS, and it never differentiates the two. I mean yeah, they're pretty much the same thing for anyone who has used them for any length but I still think it's important to understand it. It was a good review (and update) for me but I was already familiar with JS/JQ from college. I feel it would be pretty god damn harsh on a newcomer.[/QUOTE] really? i don't remember any JQ while i was doing the JS at codeacademy, maybe it has changed?
[QUOTE=Cuel;46063110]really? i don't remember any JQ while i was doing the JS at codeacademy, maybe it has changed?[/QUOTE] It has a jQuery one and a Javascript one, so I guess he means that the jQuery one requires a bit of Javascript know-how beforehand
[QUOTE=Cuel;46063110]really? i don't remember any JQ while i was doing the JS at codeacademy, maybe it has changed?[/QUOTE] I did it about a week or so ago as a review and it was pretty good for that, but the second tutorial has you calling things by class via JQuery before ever really bothering to explain JQ or the DOM. Maybe it does in other tutorials? I finished the 2 basic web tutorials and it never really talked about it, just did it. Granted in a 5 hour tutorial I wouldn't want to have to wrap my head around the DOM either but it seemed odd to do it in that order. EDIT: Ok after looking at the site in more detail I'm seeing two distinct JS and JQ tutorials that are quite a bit more detailed. Scratch what I said, looks like you were right.
Is there like a repository anywhere of official vector logos - you know how on loads of tech websites they have logos of companies that use their product (e.g. [url]http://www.git-tower.com/[/url]) - does anyone know where they get them? I imagine on some sites they maybe just contact the company and ask for the vectors or whatever but surely not everyone can do that - I don't want to just take them off google images or wikimedia or whatever for licensing reasons.
Having a little hard time with rewrite rules. [CODE]RewriteRule ^dir/(.+)\.html$ /dir/index.php?p=$1 [NC][/CODE] [CODE]RewriteRule ^dir/(.+)$ /dir/index.php?p=$1 [NC][/CODE] can someone explain why former works but the latter doesn't? I can't find any good tutorials explaining anything. [editline]25th September 2014[/editline] I'm trying to shorten [B]example.com/dir/index.php?p=page[/B] to [B]example.com/dir/page[/B]
[QUOTE=Worre;46072431]Having a little hard time with rewrite rules. [CODE]RewriteRule ^dir/(.+)\.html$ /dir/index.php?p=$1 [NC][/CODE] [CODE]RewriteRule ^dir/(.+)l$ /dir/index.php?p=$1 [NC][/CODE] can someone explain why former works but the latter doesn't? I can't find any good tutorials explaining anything. [editline]25th September 2014[/editline] I'm trying to shorten [B]example.com/dir/index.php?p=page[/B] to [B]example.com/dir/page[/B][/QUOTE] I want to know this as well...
[QUOTE=Worre;46072431]Having a little hard time with rewrite rules. [CODE]RewriteRule ^dir/(.+)\.html$ /dir/index.php?p=$1 [NC][/CODE] [CODE]RewriteRule ^dir/(.+)$ /dir/index.php?p=$1 [NC][/CODE] can someone explain why former works but the latter doesn't? I can't find any good tutorials explaining anything. [editline]25th September 2014[/editline] I'm trying to shorten [B]example.com/dir/index.php?p=page[/B] to [B]example.com/dir/page[/B][/QUOTE] they both looks like it works though. what is the error showing?
[QUOTE=jung3o;46074639]they both looks like it works though. what is the error showing?[/QUOTE] Latter gives 500.
probably because it's looping [code]RewriteCond %{REQUEST_FILENAME} !-f[/code] add that
[QUOTE=jung3o;46075624]probably because it's looping [code]RewriteCond %{REQUEST_FILENAME} !-f[/code] add that[/QUOTE] Well, that removed the 500 error and replaced it with 404 error. [editline]26th September 2014[/editline] Which is weird when the former rule can fetch the page. [editline]26th September 2014[/editline] Ok, now it just decided that it requires a filename extension in the rule... Maybe I should just try to find a node.js type router for php
[QUOTE=Worre;46079290]Well, that removed the 500 error and replaced it with 404 error. [editline]26th September 2014[/editline] Which is weird when the former rule can fetch the page. [editline]26th September 2014[/editline] Ok, now it just decided that it requires a filename extension in the rule... Maybe I should just try to find a node.js type router for php[/QUOTE] [url=https://github.com/dannyvankooten/PHP-Router]I found this[/url]
[QUOTE=Worre;46079290] Maybe I should just try to find a node.js type router for php[/QUOTE] When i read this at a glance I imagined that you'd actually use node.js as a router to pass requests to PHP
Is there an online service for event planning where I can pull information from via PHP? Basically my client wants to have a calendar where they can easily add events, but they aren't really tech savvy. So if there exists a event planning website where they can add events and I can pull info from it would be perfect.
Does anyone know of any forum software that allows you to completely override the login handler and user system with your own? phpBB kinda supports overriding the login handler, but a user is still required to be created with a separate password and such.
Sorry, you need to Log In to post a reply to this thread.