UnleashedCreativity.net
Postings on Mondays, Wednesdays, and Fridays or When-I-Have-Time-days

Login

username:
password:

Last 10 entries


Tags

.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 日本


Affiliates

  • Narcissism Incorporated
  • Wolfram Studios
  • KaleNet Web Design
  • OffTopic Productions
  • Deus Ex: High Definition Texture Project
  • The Nameless Mod


Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial 3.0 United States License.
tag: 

PHP

PHP - Ternary Conditional Operators

Posted on: Wed Feb 20, 2008 01:25 PM
tags: php

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.


Unleashed Creativity, now with 100% more SEO!

Posted on: Thu Jan 10, 2008 08:13 AM
tags: coding php

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!


Build a site in 24 hours? Yes, says the man in the blogosphere!

Posted on: Wed Jan 09, 2008 05:11 PM

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!


Having problems with PHP 5.2.3 and its MySQL extensions?

Posted on: Mon Aug 06, 2007 02:03 PM
tags: php

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:
Error in my_thread_global_end(): 1 threads didn't exit

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


TAKE THAT, TECHNOLOGY!

Posted on: Fri Jun 22, 2007 04:28 AM

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!


AJAX, meet PHP. PHP, meet AJAX.

Posted on: Sun Apr 01, 2007 12:46 PM
tags: php
AJAX is one of those technologies that really took off after the introduction of the Web 2.0 craze. With its ability to update page content without reloading the page, it offered developers a way of "prettying" up their sites and adding in bits of functionality that were, until then, impossible.

Its been a couple years since AJAX made its debut, and I've finally gotten the two technologies to work together! Here's the tech demo I set up that integrates both Javascript Drag and Drop and AJAX. I based the page on Tool-Man's Drag and Drop library and after a few hours of tweaking and digging, I managed to find a launching point for AJAX and integrate some of my own code in.

When you move around elements, the page automatically updates itself to show you what element you moved and whether you selected the element by clicking on it or by dragging around. I have a few ideas for what I'm going to do with it, and I believe I've built up a strong-enough foundation to allow for the realization of those ideas. School's starting back up, though, so development will be slow as I focus on the new quarter, start a web-development internship with my university's web department, and face the many curves that life in general will inevitably throw my way.

And now, back to Bond! Casino Royale beckons to me!

Another WIP: Gallery with Dynamic Thumbnail-Generation

Posted on: Fri Jan 19, 2007 12:00 PM
tags: php coding
I've not had the amount of time needed to get that program review up here, but I have something just as good. About a month ago, I decided to finally get around to creating a PHP image gallery...with a twist!

I'd created a photo gallery about a year and a half ago for someone else's site, but the site never took off and the gallery remained in a partially-usable state. What I did recently was take the existing code for the gallery and added in dynamic thumbnail generation using PHP's GD2 library. Part of my motivation for this was wanting some kind of image gallery to go along with this blog system, linked above in the still-inactive 'Gallery' link under the logo, that would allow you, the readers, to peruse through the images I use in my posts, as well as any other random pictures I might upload to it.

For now, though, I've set it up for testing purposes, viewable here. I don't know when I'll pick the code back up and finish it, but I just might find time after I finish up a couple of other paying projects!

Making Progress

Posted on: Tue Sep 05, 2006 10:26 AM
I've really dropped the ball recently. Its been, what, a week since the "Possible Downtime"? Well, I have a couple boring things to mention and a bit of a product review, so brace yourself! Excitement abounds in the land of the web designers and techies.

First off, let it be known that I hate LA and its impatient drivers. The only thing that keeps me coming back is getting paid $15/hour for easy work AND the time I spent on the road travelling there (2 hours each way). That is all.

In regards to the title, I've upgraded my blog's backend a bit. For the most part, I believe the front end, the bits of the blogging system that involve input from you the readers is complete. I've addressed spamming from bots, the numerous date problems have all been figured out, and the format of the posts are, I think, organized and easy to read.

The backend, on the other hand, the part that I get to see and use, has been in a state of disarray for a while, with half of the functionality actually implemented. Well, last week I decided to finish the missing components and make it that much easier for me to manage my blog when I'm away from home. I've decided to treat you all with a picture of the admin page, just so you can see what kind of management features I've stuck into my site:

[center]

The Matt's Blog Admin page
[/center]

To be honest, there's not much to look at. The categories are self-explanatory, dividing up various tools into their appropriate groups. At the moment, everything with a link works EXCEPT for the "Categories" section. I'm still trying to figure out how to tag my articles to allow for easy searching, so I jumped the gun a bit and made that a working link. The "Comment Control" category will be removed because I've worked in comment deletion into the same page that you edit news posts from. I've found that lot easier to keep track of and delete only the comments I want to delete.

The "Database Connection Settings" link does indeed work, and through that I can...well, I'm sure you can figure out what that's for!

Last but not least, I have the option to "Edit Side Panels", the various link buttons you see to the right of the posts. That's no more than a <textarea> with some HTML in it, and in the future I'll have to flesh that out a bit more to make it more user-friendly.

I would have included pictures of each of the subpages, but I'd rather keep that to myself until I'm ready to release this as software for people to try out and perhaps buy...but that's a ways down the road.

Moving on...

If you've been reading my blog for the past few months, you'll remember this post I made about various freeware programs I use that replace commonly used commercial applications. One of the points I brought to light in that article was that I had yet to find a suitable free replacement for Dreamweaver. I have a bit of an update to that article.

About two weeks ago, I came across Webuilder 2006 by Blumentals Software in another one of my efforts to find a program that was as powerful as Dreamweaver without the cost. At first, I had disregarded this program because it cost money and thus would not have been a suitable FREE replacement for Dreamweaver.

Well, four months after that post, I decided to give Webuilder a try, drunk on the fact that I had just finished up with a client's website and I now had money to spend on such a program. Lets just say that I ended up purchasing the program (for a paltry $50) 5 days after downloading the demo. I was very impressed with what I had seen and experienced, and I am very comfortable in saying that this program could give Dreamweaver a run for its money.

The interface is very customizable. All of the toolbars under the menu items can be added or removed and moved around to suit one's preferences. I prefer a rather spartan coding environment, so alot of the available tools are hidden away. In the screenshot below, you'll notice that the buttons just about mimic the style of toolbars in Microsoft Office applications, and I think this helps the programmer feel more comfortable with his coding environment. The color scheme, fortunately, is customizable, too. Before I got my hands on it, the code used a lot of blues and purple and greys, and it made it difficult to tell where one block of code ended and the other began. I went in and modified the color scheme to use PHP's colors, making it incredibly easier to keep my PHP seperated from my HTML code.

You'll see two other panes to the left and to the right of the code. The Code Explorer to sealed the deal once I saw what it did. In PHP mode, this panel will show you EVERY CUSTOM-CREATED FUNCTION ON THE PAGE! Simply put, I can see all of the functions I've made and reference them without having to find out where they're located on the page. Dreamweaver never had this feature, and looking back I'm surprised that it went this long without it.

The File Explorer to the right is a pretty standard feature in coding environments, and Webuilder goes two steps forward by including FTP connectivity and "Projects" that you can set up to organize all the websites you're working on. Its very nice that all three functions are included in one pane because it keeps most of the program open for the code window.
[center]

Webuilder's IDE, customized to my liking
[/center]

Like many other IDE's, Webuilder has a split-screen setup that lets you make changes on top and see the code rendered within Webuilder. The nice thing about the in-program renderer is that you can see the page you're working on in both IE and Firefox without having to have those programs open. I find this feature indispensible because I can see code changes without having to wait for a browser window to open up.
[center]

Split-screen IDE
[/center]

Here's some miscellaneous pictures I took of the various features in Webuilder:
[center]

Function hints for custom-created functions
[/center]

[center]

Publish files to the internet based on when you edited them
[/center]

[center]

Code hints and completion for CSS!
[/center]

So I hope this makes up for the week without a post. I'm going back out to LA with a friend tomorrow to do some more computer work, so I have four more hours of work to look forward to. AND, before I forget, look for tomorrow's big announcement! What could possibly be so amazing that I create this much suspense a day in advance? You'll just have to tune back in tomorrow to find out. For my fellow Americans, I hope you had a pleasant Labor Day, and for my international friends, I hope you had a very nice September 4th!

Warning! Possible downtime ahead!

Posted on: Sun Aug 27, 2006 05:45 PM
tags: misc. php
I've decided to go ahead and fix the comment system. With any luck, I should have it figured out by the tonight, but we'll see...while you're waiting for things to get back in order, check out Sitcom, four flash animations staring Tommy and Bobby. My personal favorites are #389 and #390 :P

[EDIT] Alright, all the comments have been transitioned over. Thankfully, PHP made the task of replacing all the existing comment's post times in timestamp form a MILLION times easier, so I spent the remainder of the time playing around with the comments and verifying that they do indeed work.

And I've taken it upon myself to reserve my name ("Matt") for the comments. You'll see what I mean if you go back a bit and look for comments I've made. I saw this done on a couple other blogs and thought it was a great way to show feedback originating straight from the author's mouth. "Matthew" is not reserved, so if you read my blog and happened to be named Matthew, then by all means go ahead and comment with that name.

I'll scrounge up a new post here in the next day or two. I just wanted you to know that I was resolving some of the bugs on this site so you don't have to worry about the site throwing up in your face anymore when you comment.

[EDIT 2] I found a better way to do timezones with timestamps, so I've disabled commenting for the next few hours until I get that squared away. Until I make the changes, all the times will appear 7 hours earlier than they should be. That'll be fixed by the end of the day, so no worries :)

[EDIT 3] Alright, I've gotten all the timestamps taken care of. I found out a way to ensure that time() spits out a timestamp that's set to Pacific Standard Time, so I went ahead and got all the timestamps in both comments and posts to post correct times using this new environment variable. Joy!

Take that, pesky spam!

Posted on: Sun Jun 25, 2006 02:52 PM
tags: php misc.
After EER pointed out the ability to post comments into non-existant news items (albeit by a round-a-bout method not many would think of), I decided that while I was fixing that one problem, I would address the other problem I've been having of spammer bots invading and posting their smut ads into the comments of several of my news items.

I had been meaning to put some kind of security measure up to combat this problem, and today I implemented the security element that will hopefully keep spammers at bay. When you comment on any of the posts I've made, you'll notice a new image that appears below the comment box. Normal humans can discern the individual letters and numbers that will appear, but web spiders and bots cannot.

From now on, you'll need to fill out that extra text box in order for your comments to appear; I know, its inconvenient, but if you want to get mad at anyone get mad at the spammers that feel it necessary to spread their material all over the internet.

Anyway, I tested out the system, it should work fine but if you run across any problems, feel free to send me an e-mail. The Contact link is above, in the header.

EVERYTHING on this site is © Matthew Miller, 2005-2010, so don't friggin' touch