.net 3d art blog c# coding college computers editorial entertainment firefox food freeware gaming hardware hdtp hiking humor ide japan japan, javascript linux mac mailbox milestone misc. mods momoiwa, mono movie nintendo philosophy php politics rant rebun review science software technology test time ucr wakkanai windows work wormholeftp 日本
Ternary conditional operators are incredibly useful in PHP (and just about every other programming language) because they turn a multi-line IF statement into a single line! Case in point:
if($variable == "hello")
{
$response = true;
}
else
{
$response = false;
}
Becomes:
$variable == "hello" ? $response = true : $response = false;
And just like that, I've saved 7 lines of code! This is incredibly helpful when you need to check multiple variables and don't want to write up an entire if...else... statement to assign values to other variables.
And now that I've blogged about this structure, I won't have to look all over the internet when I need it but have forgotten what it's called.
I'd heard about Search Engine Optimization (SEO) before, but I'd never really thought about applying it to this blog. SEO aids search engine crawlers in indexing the content on your site by offering up more information into URL's than you'd normally get using integers to call up certain posts. Before today, when you clicked on a link to comment on a post, you'd be taken to a url that looked like this:
http://unleashedcreativity.net/comments.php?post=140
To a search engine, this post reveals nothing about the contents of post #140. If someone tried to look for this post by its title, they'd have to know the exact title and hope that it was the first result that popped up when they performed a search. SEO works for bloggers by making it easier for viewers to find content.
Case in point: Now, when you want to see post #140, you'll see a link that looks like this:
http://unleashedcreativity.net/comment/140/Build_a_site_in_24_hours_Yes_says_the_ man_in_the_blogosphere.html
As a viewer, you're more likely to remember the fact that I used "blogosphere" in the title of that post than you would the fact that you were reading post #140. In the future, you'll be able to search for "Unleashed Creativity blogosphere" and find that post at the top of the list instead of whatever post featured the most occurrences of that word!
I feel bad waiting until now to mention his name, but I wouldn't have been able to get the blog up to SEO standards without some gentle prodding and help from EER. We just finished spending two and a half hours working mod_rewrite into the system, making sure that any link to a comment page was in SEO-format, devising a means for me to link to previous posts through FCKEditor, and optimizing the search-by-tags functionality. It went off very well, all things considered; we ran into a fair share of problems, but between the two of us we were able to make everything play nicely.
I'd get a bit more technical in this post, but my brain is fried and I'm about two and a half hours behind on my reading for the week. EER is waiting on the wings and will post about an as-of-yet-unknown topic in the next day or two, so stay tuned for that; provided he doesn't talk about all the work we did today, I'll be back after him to explain some of the techniques we used to revitalize UC!
During my travails around the interwebs, I came across an interesting Digg article. It turns out someone managed to get a website up and online, from scratch, in 24 hours. The 24 hours were spread out over 4 days, but it was still an impressive feat to go from mock-up to development to production in such a short amount of time.
To get the site up and running as quickly as he did, he relied on Ruby on Rails for the site's framework, as well as some free SVN to keep track of changes to the site files (a technique I plan on looking into implementing in the next day or two).
Graphically, the site isn't too complicated, but he admitted himself he's not much of a CSS buff; he basically took a template he designed in Photoshop and sliced it up into easy-to-manage template images. It's an admirable approach, but I know I can do better since I'm quite good at CSS!
I also have to give props to the guy for developing a fairly robust API within the 24-hour time slot. It appears to be fairly painless to use and offers a degree of interactivity that you wouldn't expect from a quickly-launched website.
Needless to say, Dominiek's endeavor got me thinking. I've been sitting on a novel website idea for the last four months or so, and I've decided that it's time I brushed the dust off and resumed work. I have a lot of ground to cover if I plan on launching any time soon, but I think if I tackle it in small chunks, it'll all come together relatively quickly. I'll start to reveal details of my mystery project as they're fleshed out, so stay tuned!
And I need more readers! Perhaps when I get my new project off the ground I'll develop some readers. I've only had a few "tech-related" postings, and I've done squat for SEO or marketing, so I can understand why my blog has basically tanked. I suppose there's always a chance my new project will take off and I'll gain a loyal following, but I'm sure that's something time will have to determine!
Until next time, folks!
After a long-awaited reinstall of Windows XP on my laptop, I came across a rather annoying problem as I was restoring my WIMP web development platform (Windows, IIS, MySQL, PHP).
After installing PHP 5.2.3 with the appropriate MySQL and MySQLi DLL's enabled in php.ini, I would get an error message six seconds or so after a PHP page loaded. The error looked something like this:
Quote:After scouring Google for a solution to this problem, I discovered a couple things:
1. The bug has been recognized by PHP as a problem since 5.2.2. It turns out there's a problem with the MySQL and MySQLi DLL's that are bundled with PHP 5.2.2 and 5.2.3. Here's the bug report for this problem: http://bugs.php.net/bug.php?id=41350
2. There is a temporary fix! To avoid this error message, download the zip package of PHP 5.2.1 from http://us.php.net/get/php-5.2.1-Win32.zip/from/a/mirror. Replace your current lib_mysql.dll and lib_mysqli.dll with the files of the same name from the 5.2.1 zip package.*
Since PHP is aware of the problem, I'm anticipating an end to this problem when PHP 5.2.4 rolls out; for now, though, we'll have to make do with a bit of version-mixing.
*You might need to set the correct file permissions to these files to allow the system to access them
Mad snaps, kudos, and props to EER and Danny! That's right, the problem I was having with the admin-side notes textbox was solved by none other than Erik and Danny!
To recap, about 6 months ago I created a textbox on the admin page that I could type up random snippits of my thoughts and ideas for future articles into. Despite the simplicity of such a system, I decided to integrate the note into the MySQL database. After all, how difficult would it be to update the one entry in the notes table every time I clicked a button? Little did I know that I would lose many hours of sleep in an attempt to figure out why something so simple could fail so horribly.
The problem I was having was when I clicked the Submit button, whatever value was in the Notes field would be completely erased. I could put a value into that field via PHPMyAdmin, but whenever I ran my script from my blog, the value would be deleted. At first I thought it might have been a problem with the structure of my MySQL query, so I echoed out the text that was being spit out to the MySQL UPDATE query. Nothing was wrong with my query; I could take it and run it through MySQL Query Browser, and it would work as I intended...so why was the value being deleted?!
For the next six months, I let that feature simmer on the back burner. I ended up sextuple-checking my code for errors, looking for anything that would affect the table, but nothing came up. My code was fine, my SQL query was well-developed...this problem should not have occurred, as it simply defied all programming logic.
Flash to today. A couple co-workers of mine (not Erik or Danny) tried solving the Case of the Mischievous Update and made the interesting discovery that the update query was running twice! Rather than use an UPDATE query, they used an INSERT query and every time they submitted the Notes textbox, two new rows would appear in the Notes table, one with the value in the textbox, and one blank one. Curioue, eh? After a couple hours (divided up over a couple days, yes we do get work done here!) of scouring my code, neither of them could find a reason why the MySQL query would submit twice.
Enter Erik and Danny. I explained to Erik the new findings, that the MySQL query was being run twice. Now, being the curious individual he is (and having an entire copy of my blog's codebase), he took it upon himself to figure out what exactly was causing the problem. Today, he finally figured out what had been causing the problem!
What was it that was messing with my Notes?
Any guesses?
I could give you 10 chances and you would get all of them wrong. Do you know why? Because you would NEVER guess that it was a JAVASCRIPT file causing the problem! Yes, a client-side Javascript file was somehow messing with a server-side MySQL query! Don't ask me how that works, since none of us, myself included, can see the logic behind that. Suffice to say that the site's Lightbox script was causing the problem, and after commenting out that javascript file from the header, the Notes box worked just as I had originally intended!
Thus ends one horrible and confusing chapter to the book that is Unleashed Creativity's Development! Were it not for the ingenuity of Erik and his cohort Danny, I would most likely still be struggling with this problem, but now, I can move onto bigger and better things, like FLAT-FILING THE NOTES INSTEAD OF TAKING UP SPACE IN A MYSQL DATABASE FOR SUCH AN INSIGNIFICANT AMOUNT OF INFORMATION!