Category: Software
-
Calculating “Business time” logic in PHP
Struggling trying to come up with a solution to calculate the time difference between two datetimes, with respect to when a business is open? I was too. First approach I looked into was a package that does just this: https://packagist.org/packages/hughgrigg/php-business-time . Unfortunately it doesn’t allow much configuration for constraints. Ie, if you have different hours…
-
Man page for Node JS
NODE.JS(1) NODE.JS(1) NAME node – Server-side JavaScript SYNOPSIS node [ -v ] [ –debug | –debug-brk ] [ –v8-options ] [ -e command | script.js ] [ arguments ] Execute without arguments to start the REPL. DESCRIPTION Node is a set of libraries for javascript which allows it to be used outside of the browser.…
-
Does CURL follow redirects by default?
What happens when PHP’s CURL library encounters a 301 Redirect header? It depends. By default, it does NOT redirect. It will simply halt after the header is returned. However, there is an option you can set that allows it to follow up to 5 redirects in a chain: the CURLOPT_FOLLOWLOCATION setting. curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); Hope that helps…
-
Does file_get_contents follow redirects by default?
What happens when PHP’s file_get_contents() function encounters a 301 Redirect header? I thought I could find out by going to the PHP documentation, but I couldn’t find anything. So instead, I set up a simple test myself. Just made a simple script that echos file_get_contents() and pointed it to a URL that I know has…
-
Internal Server Error 500 on a new server
We just got a new server on HostGator, and upon accessing some php files we had uploaded, we got this error: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [email protected] and inform them of the time the error occurred, and…
-
Calling document.write after page load causes blank screen
I came across some interesting behavior when calling document.write multiple times. The first time I called it was fine, but if I called it again in a setTimeout, the page would go blank. Turns out that it’s because once the page loads and fires document ready event, it doesn’t know where the current cursor is.…
-
EasyDbs Review
EasyDbs.com is a website that allows you to purchase common databases at reasonable prices. What sets them apart from the rest is that they are EASY! All of their databases are packaged with something called the EZDB system. I’m not sure what that is, but I can vouch that it made my database installation super…
-
WordPress: Removing all Javascript and Styles/CSS from the head
I wanted to remove ALL javascript and css from the head, but still call the wp_head function since it loads other stuff (meta, plugins, etc). Most advice tells you to use wp_deregister_script() and wp_deregister_style() to individually remove each file, but you need to know the name they were registered as, which requires you to dig…
-
Clicktale – Show Hidden Page Views Bookmarklet
Clicktale’s free plan only allows you to see 2 page views per recording session. And that’s simply not enough to see if Clicktale is worth paying for. How are you supposed to decide whether to upgrade to a paid plan if you haven’t been able to gauge the power of the tool? So, while you’re…
-
Getting rid of ^M newline characters in Notepad++
Today I was modifying someone else’s file when I noticed that when I uploaded it to the server it displayed horribly. All whitespace was gone, and in the place of newlines was ^M characters. Here’s a snapshot of how the file looked when I uploaded. If I viewed it with ‘more filename.php’ I didn’t see…