WebDev

Converting Ticks to a Timestamp

I recently had to deal with a SQLite database that stored the timestamps as ticks.  Having to first research what a tick is, I created a simple function that will convert a tick value to a timestamp or MySQL datetime value since I couldn’t find anyone else who had done such a thing yet.
You can [...]


Bug with Adobe Flash on Mac when uploading files to a redirected URL

Just spent almost the entire day trying to figure out what I was doing wrong when trying out many different flash multi-file uploading widgets. All of them would give me a 302 redirect http error, even when testing locally.
So after much searching and reading and studying… and finally testing this on my Windows machine (which [...]


Redirect all but used subdomains to primary domain using mod_rewrite and CodeIgniter

I was recently playing with mod_rewrite and wanting a couple of subdomains to act as subdomains, but all others to redirect back to my site without the leading “www”. For example:
www.example.com => example.com
bad.example.com => example.com
api.example.com => api.example.com
Not being a regular expression or mod_rewrite expert (or any resemblance of such), this was a bit of a [...]


Serving a large file through PHP without hitting memory_limit

Ran into a little problem hitting the memory limit for PHP when serving 100MB+ files through a script like:
$file = @fopen($filename,”r”);<br/><br />
if ($file)<br />
{<br />
while(!feof($file))<br />
{<br />
    print(fread($file, 1024*4));<br />
    [...]