Tuesday, November 20, 2012

Zend, Zend, What Have you Done Now?

To paraphrase the Sam Jaffe character from the Flintstones send-up of Ben Casey, (Ben Caserock?), "Zend, Zend, What have you done now, Zend?
Yet another installation that the designing company imagines is a snap to get done. I decided I wanted to play with the Zend framework, because I like to torture myself. I decided against the all inclusive Zend Server, as I didn't need any more PHP installations, and looked to add ZF2 to my WAMP server instead. I placed the framework directories inside WAMP and created another directory to be my Zend playground.
I then did the recommended Composer thingee to get the sample skeleton project installed, but the official instructions didn't exactly go according to plan. Instead of running `php composer.phar self-update`, followed by `php composer.phar install` in the DOS prompt window, I first ran `composer self-update` as per someone's suggestion, but not entirely per their suggestion.
The suggestion had added that I should remove the .PHAR from the file name. Instead, what I really did was run the composer.bat file instead of the PHAR file. I then had to copy the composer.json file to my root C directory. The sum total of the json file is:
{
    "require": {
        "monolog/monolog": "1.2.*"
    }
}
Just make it in notepad. Then I ran `composer install` from the C prompt and got the skeletons out of their closet. That was not the end, however. Some virtual hosting had to be done.
Made all my preferred playground directory localhost aliases in Windows hosts file, created a playgrounddirectory.com.conf file in WAMP's vhosts directory, added the requisite <Directory> and <VirtualHost 127.0.0.1> groups to Apache's httpd-vhosts.conf file.
But still, the WAMPstones characters personalities are mixed up. One more little detail still needed to be attended to.
Had to add to Apache's httpd.conf file, the line `SetEnv ZF2_PATH "c:/wamp/ZendFramework203/library"`, the location where I chose to store Zend.(Zend came by default as `ZendFramework-2.0.3`, but I'm prejudiced against hyphens and periods)
I could have just called it `library`, or `stupid`, or anything, I suppose. As long as the Zend subdirectory within library could be found. Zend Caserock has finally returned all the WAMPstones personalities back to their proper characters.

Wednesday, October 17, 2012

Port 80 - The Friday the 13th of Web Server Issues

To paraphrase the late Ronald Reagan, after installing WebMatrix 2, "There you go again!"
Of course no sooner was WebMatrix 2 in use, I found my Wamp Server, which I now regret assigning to port 80, failing to start again. Apache couldn't open its logs.
The long and the short of this is:
1: The culprit was one that came back from the dead, Web Deployment Agent Service, resurrected by WebMatrix, which I needed for hosting MicroHard's IIS Express on my old creaky Windows XP system.
2: The solution (I hesitate to label it Final Solution, for both sensitivity and expectation issues), is to go into your registry.
3: First go into services from control panel/administrative tools, and stop that service.
4: Then go to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
  • Scroll down the long list to MsDepSvc
  • Choose Parameters, and open ListenUrl to modify.
  • By default, unless you custom installed from the get go, should be: http://+:80/MsDeployAgentService
  • Change the 80 to whatever port you want to fob theis service off to.
  • In my case, I chose 8080. New value: http://+:8080/MsDeployAgentService

5: Reboot.
Keep track of your server ports, if you're like me and have begun to collect web servers like coins. I gave 8081 to Bitnami, 8082 to SQL reporting services, etc.

Thursday, October 4, 2012

jQuery $.getJSON is NOT Jason from Friday the 13th

Although at times $.getJSON can certainly seem like a maniacal mass murderer to those not used to working with it.
Tips for the unwary and clues for the clueless.
When iterating through data returned by $.getJSON, make sure you know when to refer to the subscripts as numeric arrays as opposed to associative arrays.
EG: From a typical json file:


{
"customers": [
{ "id":1,"name":"John Doe" },
{ "id":2,"name":"Sand Wich" },
{ "id":3,"name":"Meanmissus Jones" },
{"id":4,"name":"Hung Lo"},
{"id":5,"name":"Cardin Naal"}
],
"magazines": [
{ "id":1,"name":"Field and Wild","rate":29.99 },
{ "id":2,"name":"Car and Driven","rate":34.95},
{ "id":3,"name":"Unpopular Scientists","rate":42.95 },
{"id":4,"name":"TV Lied","rate":19.99},
{"id":5,"name":"Readers Indigestion","rate":24.99}
],
"subscriptions": 
{"1": [{"id":2,"startdate":"01/01/2012","enddate":"01/01/2013"},
{"id":4,"startdate":"01/01/2012","enddate":"01/01/2014"},
{"id":5,"startdate":"01/01/2011","enddate":"01/01/2013"}
],
"2": [{"id":1,"startdate":"01/01/2011","enddate":"01/01/2013"},
{"id":3,"startdate":"01/01/2012","enddate":"01/01/2015"},
{"id":5,"startdate":"01/01/2011","enddate":"01/01/2012"}
],
"3": [{"id":2,"startdate":"09/01/2011","enddate":"09/01/2012"},
{"id":3,"startdate":"01/01/2012","enddate":"01/01/2014"},
{"id":4,"startdate":"06/01/2010","enddate":"06/01/2012"}
],
"4": [
{"id":4,"startdate":"01/01/2012","enddate":"01/01/2015"}
],
"5": [{"id":1,"startdate":"01/01/2011","enddate":"01/01/2013"},
{"id":2,"startdate":"06/01/2011","enddate":"06/01/2013"}
]}

}


Say you're in a for loop, using i as the iterator to run through subscriptions, and starting i at 1: data.subscriptions[i] does NOT equal data.subscriptions[1], as in the 2nd subscript of a numeric array. It equals data.subscriptions['1'], with '1' (variable i's value) being the key, and the 3 groups of subscription data following it as the value (itself a numeric array in this case). For magazines and customers, however, magazines[i] would equate to magazines[1], the 2nd subscript (Car and Driven). In iterating through subscriptions, we're first going through the associate array from keys 1 through 5. Each of those contains a numeric array. If i2 starts at 0 for going through that array and i still ='1': data2.subscriptions[i][i2].id refers to data2.subscriptions['1'][0].id, the first subscript under key '1', with a value of 2. data2.subscriptions['1'][1].id equals 4, data2.subscriptions['1'][2].startdate = "01/01/2011", etc, etc.

Tuesday, October 2, 2012

Not So Fast Wise Guys!

Well ho dee do, if good ole Flickr, or should I say Yahoo, didn't hit me with a 200 most recent uploads visible limit unless I upgrade to a paid account.
Well that sure as heck ain't about to happen, fellas!
I've got eons worth of storage for my stuff on Facebook. What do I need y'all for?
I'll keep what I put on y'all thus far, but I'm a po' folk right now and you can't have any of my assets, such as still exist.

Just Opened a Flickr Account for Streetlights Site

New Flickr page for Streetlights Site is at http://www.flickr.com/photos/streetlightsite/. What the heck. If they're giving me the space, why not use it?

Monday, September 24, 2012

Getting SQL Server 2008 R2 Installed The Hard Way

Had a woeful experience trying to get SQL Server 2008 R2 to install on my old XP Pro PC. Every single attempt failed on one component or another. Almost each fail was due to something else. I'd address one issue, another would kill the works. The biggest nut to crack seemed to be Reporting Services.
Finally, I stopped spinning my wheels as myself, and installed the beast logged in as Administrator.
You wouldn't think you're not the administrator of your own computer, but you're not.
Why this computer forced the issue is beyond me. I installed the free versions of these things before as myself.
You can't use reason, however, with an unreasonable PC; it's either the PC's way, or the highway. So finally, hands clasped in prayer, the Nth installation finished without a hitch, thanks to Administrator, whoever you are.
Windows XP doesn't make it very obvious either, how to log in as Administrator, but that's a subject for another blog.
Having learned this other lesson already, I made sure to tell the installer to leave Report Service configuration to me,  and made sure it did NOT try to steal port 80.

Sunday, September 16, 2012

Whoo Hoo! Something That Actually Works!

Flawless installment today of Bitnami RubyStack web servers on my old XP and Windows 7 PCs.
This after ripping what little hair Microsoft left me trying to get my WAMP Apache to treat Ruby scripts as web pages.
Never had any such software install and work out of the box so easily.
Accepted different ports than those used by Wamp and IIS without a hassle.
The only thing that wasn't intuitive to a Ruby Newbie was this:
For the browser to read your rb files as text, put them in Apache2/htdocs.
To read as web pages, Apache2/cgi-bin.
At least out of the box.
Get RubyStack at BitNami. It succeeded Instant Rails.
Like Wamp, it comes with PHP, Apache, etc. Also includes a few versioning programs like Subversion.
Ruby on Rails does not have to be tough as nails. I will not torture y'all with any more rhymes.
Someone tell the Spell Check used by Blogger.com that "versioning" is indeed a legitimate word at this point in time. I hate seeing red lines under legit new-age words.