jacob | 06 December, 2011 10:44
Just wanted to note a very bizarre bit of behavior that I noticed with some of PHP's predefined constants.
The $_SERVER['SCRIPT_FILENAME'] variable in PHP gives you the currently executing script's file name - no surprises there. It always gives you the name of the parent script, though; so, if you include a file, and reference $_SERVER['SCRIPT_FILENAME'] in that included file, it will give you the address of the including file.
For example, if we execute test.php, and it includes lib.php, a reference to $_SERVER['SCRIPT_FILENAME'] in either file will return "test.php". Here's the code:
test.php:
<?php
echo $_SERVER['SCRIPT_FILENAME'], "\n";
include('lib.php');
?>
lib.php:
<?php
echo $_SERVER['SCRIPT_FILENAME'];
?>
Produces:
/var/www/test.php
/var/www/test.php
The __FILE__ variable in PHP gives you the file name of whatever script it's called in. So, if you call it from an included file, you'll get the file name of the included file.
test.php:
<?php
echo __FILE__, "\n";
include('lib.php');
?>
lib.php:
<?php
echo __FILE__;
?>
Produces:
/var/www/test.php
/var/www/lib.php
The bizarre behavior comes with symlinks. On my workstation, I had a symlink for /var/www that pointed to a folder in my home directory. This caused some very bizarre behavior:
test.php:
<?php
echo __FILE__, "\n",
$_SERVER['SCRIPT_FILENAME'], "\n\n";
include('lib.php');
?>
lib.php:
<?php
echo __FILE__, "\n",
$_SERVER['SCRIPT_FILENAME'], "\n\n";
?>
Produces:
/home/windigo/test/test.php
/var/www/test.php
/home/windigo/test/lib.php
/var/www/test.php
Well, that was unexpected! Apparently the $_SERVER variables report the path that I would expect, where the magic constant seems to dereference (?) the symlink and point directly at the target file.
This caused some strange behavior in the pages I was working on, so I thought I should shed some light on things and write it down in case I ran into it again later. Hope this helps somebody out - otherwise, carry on. :)
Note: Formatting kinda jacked up, will work on that once I get my blog moved to newer, cooler software.
jacob | 25 November, 2011 15:42
After Identi.ca had a rash of issues shortly following the release of Status.net 1.0, I decided that the only logical solution was to take advantage of the open source nature of Status.net, and set up my own instance. Overall, I'd say this is a success; although there are a couple issues that could be addressed.
One of the issues you run into immediately after getting Status.net and OStatus set up is that you're still extremely dependent on Identi.ca. I have over 200 subscriptions, and the vast majority of them are still on Identi.ca. When Identi.ca goes down, your instance may still be up and running - but it's not doing all that much.
Not only do you get an empty timeline, but any posts you make probably won't get through to the majority of your subscribers. The method in which posts are synchronized across instances is beyond me; but messages can be, and have been, lost.
One of the issues I encountered when I first set up my instance involved the OStatus plugin - or lack thereof. OStatus wasn't listed anywhere in the admin section, either...
A quick stop into the Status.net IRC informed me that I needed to add the plugin manually via the config.php file, and then run checkSchema.php from the command line to make sure all of the right database tables are present.
...really? It seems like this could be refined quite a bit. Enabling a plugin shouldn't require hacking in PHP and executing shell scripts.
Honestly, I've had a pretty good experience overall with my Status.net instance, Micro.FragDev.net. Most of the pain points occurred early in the setup, and the community supporting people who run their own instances has been wonderful. Whenever Identi.ca goes down, there are still a bunch of federated users having discussions in my timeline.
It seems like version 1.0 of Status.net might have better been a beta release, with a bit of more polish applied before it was thrown on a huge production system like Identi.ca.
I'll be sticking with Status.net for the time being - and look forward to further development and improvement from Evan and the team.
jacob | 10 August, 2011 09:56
I don't always put people as my wallpaper. But when I do, I prefer Jezra.
Stay happy, my friend.
jacob | 08 August, 2011 15:38
While I'm primarily a web guy now, I graduated college as a networker. I really dig networking stuff, so the fact that I didn't have anything that supported IPv6 bothered me.
If you haven't heard of IPv6 before, you can go over to the Wikipedia Page on IPv6 for all of the information you could possibly desire. If you have better things to do with your life, I'll do a brutal summary for you.
Computers identify themselves on the Internet by using something called an "IP address". The current set of addresses, specified as part of IPv4, look like this: 1.2.3.4. We have about 4 billion (4,294,967,296) of those addresses, and we just ran out of them. That's a bit of an issue. The rest is invisible, don't worry about it.
IPv6 addresses look like this: fe80::f03c:91ff:fe93:5121. A little bit more confusing, but you don't usually use them directly. As for the number of addresses, IPv6 has 340 septillu-frepto-blarkin (340,282,366,920,938,463,463,374,607,431,768,211,456) available, which is at least twice as many as we have now. Since that number is just astronomically large, let's get astronomical. Let's take the Sun - you know, shiny outside thing, middle of galaxy. The sun is about ~300,000 times the size of planet Earth.
If you chopped the Sun into cubes that weighted one gram, you would have enough addresses to give ~300,000 addresses to each cube. That's how many addresses we're talkin' about.
IPv6 really appeals to me on a very basic geek level, because of stuff like that. So, I went about setting it up on my virtual server, hosted by the good folks at Linode. It's a good thing the IPv6 explanation got to be a bit wordy, because this part won't.
First thing I had to do was log into Linode and click on the "Enable IPv6" link underneath the "Remote Access" tab of the VPS in question. This rebooted my server, which now had a brand spankin' new IPv6 address upon booting. If you buy a new VPS from them, I think it's enabled by default and you can skip this step.
After that, I logged into my registrar and added a "AAAA" record to point to my web server at it's new IPv6 address. Your registrar will have to support IPv6 records, but a lot of the good ones do: Gandi.net and GoDaddy both do.
Then I had to.... wait, no. That was it. That was the only change I had to make.
So, if you're interested in being ahead of the curve, and you have a Linode, do it up. It's easy as hell, and will give you an edge over all of the old crusty IPv4-only people out there. Next up, I'm planning on figuring out how to get a IPv6 tunnel set up so I can visit other web sites with IPv6. Stay tuned!
jacob | 12 January, 2011 11:32
This is a bit of a rant, but it drives me crazy when some sort of fancy-pants Web 2.0 web site informs me, in an obnoxious way, that "Your browser does not support Javascript".
Thanks, but my browser supports Javascript just fine. It's your visitor, me, that doesn't support Javascript. If your tacky web site needs Javascript to make it's transparent chrome drop-down menu system work, then maybe you should reconsider how you do your navigation.
As web developers, we need to stop relying on Javascript for important parts of our web sites! If your visitors have Javascript disabled, there's probably a good reason for it. Make sure they have a viable fallback, and only use Javascript to progressively enhance your web site. Frameworks like jQuery make this trivial, and there just isn't any excuse not to.
If your web site informs me that my browser doesn't support Javascript, and I don't see a reason it should, I'll have to inform you that I won't be visiting your site again.
| « | February 2012 | » | ||||
|---|---|---|---|---|---|---|
| Su | Mo | Tu | We | Th | Fr | Sa |
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | |||
Fragmented Development
, abbreviated FragDev, summarizes to the
nature of the web; many disparate technologies make today's web. This variety makes
development both challenging and enjoyable.
FragDev is also the technical blog of Jacob Hume, a web developer and Free Software enthusiast. On the internet, he usually uses the username Windigo.