Thursday, May 31, 2012

Installing Wordpress on WAMP

As I mentioned recently, I set up a server environment on my local computer using WAMP. Today I installed a fresh copy of Wordpress, so that I could play around with some realty listings plugins. Unfortunately I couldn't even get through the setup without something going wrong.

After Wordpress was installed, I created a test page, and then changed the URL linking over to use names. IE, the post's URL would be localhost/testpage/, instead of localhost/post=001. I clicked to view it, and I got a 404 error. Imagine my surprise, given that this is a pretty common change.

It took me a while to track down, but I finally found the answer and solution online. Turns out that WAMP's default Apache installation has a setting that prevents things I don't really understand from happening, which in turn prevents Wordpress from working correctly. A.N.M. Saiful over at Checkmate had the solution, which was to go into the Apache config file and mess with some settings.

Not being a server guy, I really have no idea what it means, but Wordpress now works on my localhost server, so I consider it to be a success.
 

Tuesday, May 29, 2012

The Sound of Thunder

I woke this morning to the sound of thunder outside. We haven't had rain in 3 weeks, so the water will help. And the fact that it's arriving in the form of a thunderstorm instead of gentle rain is just a bonus.

The sole problem is that it's just barely after 6 am, and I'm totally awake. I do have some music to listen to though. I stumbled upon this last night before I went to bed.



On an entirely different note, I saw an article in the local paper talking about how gay marriage, politically, is a paradox. The idea being that national polls show the issue now commands over 50% support nation wide, yet each time it goes on the ballot it loses.

This isn't a paradox. It only broke 50% in the past few years, and we've only had a few state contests over the past few years. The most recent being South Carolina. What the paper doesn't seem to understand is that geography plays a roll in politics. South Carolina isn't going to see things the same way that the rest of the US does.

Plus the issue is up for a vote in Maryland this November, and the local polls show over 60% support gay marriage, so it's expected to win there. Ergo, this isn't paradox. It's just politics taking time to catch up with beliefs.
 

Saturday, May 26, 2012

Web Development on Windows

As I've mentioned before, I've gotten spoiled as a Purdue student. Since we're provided with webspace on a root server that we can map to Windows as a networked drive, I can just edit files in a seemingly local folder. It makes for easy updating.

Since I'm no longer at Purdue, I have to use a VPN to gain access to this networked drive. This still works, but it's incredibly slow. Think 2KB/s speed. Slow to the point of being really unusable. Really the only way I've been able to do thinks is by creating mirrored folders locally, updating the local files, and then starting a sync and letting it run for a while, while I go do something else.

Additionally, my local machine isn't a web server, meaning that PHP files don't work. The browser will open them and display whatever HTML there is, but it will also display the PHP as the actual PHP code.

So today in the couple hours I have before heading out to a meeting, I've decided to set up a PHP web development environment. The other tech guy who was going to be working with me on KollegeKareer had mentioned it was easy if I found the right thing, and after looking around I think I've got what he was talking about. WAMP Server, standing for Windows/Apache/MySQL/PHP. I'm installing now, and we'll see if it works.

UPDATE:
Well after cleaning two hurdles, I have gotten it all working. WAMP comes with no instructions unfortunately. And from Googling, it seems that a LOT of people had both problems I had. The first is that Windows machines come with a server that's already running, from Microsoft. You either have to disable it, or change it to a different port. I found a Youtube video that explained changing the ports so that both can run together. Then I started getting an 403 Access Denied error. Turns out that WAMP comes with an Apache installation that is locked down. You have to go in and find a config file to unlock it.

That said, it's working now! w00t.
 

Friday, May 25, 2012

First Private Spaceship Docks with ISS

I had an argument with my parents several years back when Obama for all practical purposes privatized NASA. Cancelling nearly all projects and throwing money instead at private companies, it was a very controversial policy move at the time.

My parents who'd grown up through the cold war were of course angered by the idea. I however, took the approach that if something can be done privately, then lets do it privately. I'd rather see space go the way that airflight has gone, and I believed that it could be done.

And so today, I feel rather vindicated. The first private spaceship, operated by SpaceX, has docked at the ISS (International Space Station). The launch was delayed several times, but ended up successfully occurring last Tuesday. Now it has docked and delivered supplies.

The trip was unmanned, but SpaceX is hoping to launch manned flights before the end of the year. Video of docking below!


 

Tuesday, May 22, 2012

Murphy's Ridin' My Shoulder

What a summer this has been. Applied for 11 engineering internships. Interviewed for 2. Got 0. But also had a verbal offer from a guy wanting to start a big website, hiring me and another guy to build it.

Problem is that he's dragged it out for weeks now, delaying over and over. And today when he finally sent me final terms ... he cut the cash compensation by 60% from what we'd discussed. No explanation as to what had changed. Needless to say it's frustrating.

At the same time, yet another client for Catstache who initially contacted us is no longer responding to calls/emails. I'm starting to consider just stopping the web stuff altogether. I started it as a hobby, because it was enjoyable. But it's no longer enjoyable. We'll see how the next few days go. I'll make one more attempt to contact the client, and if I hear nothing will assume that she's no longer interested. As to the main full time web job I mentioned above, we'll see how things go over the next few days.

Suffice to say I'm right on the edge of going to Walmart and putting in an application.
 

Monday, May 21, 2012

Pokemon Cards Will Be Valuable! ... not

When I finally sold off all my pokemon cards, I saved one card. A special promo card, Mew. The special 151st pokemon; the 'last' pokemon .... until it got profitable enough to add another 100, then another, then more and more, and more games.

Still, it was supposed to be very rare because it was a promo card. However, after all these years, I checked on Amazon and it's selling for a grand total of ... wait for it ... 3 bucks!. Damn, did I make the right decision to keep it! I can sell it now and get all that money! That's HUNDREDS of pennies! Shopping spree!

Seriously though, it's somewhat disappointing. Only somewhat because I wasn't really expecting it to become valuable. One always hopes though, right?

Sorry I haven't been posting much this month. It's been a mix of hectic and utterly boring. I still don't have a job, because KK owner has delayed another week. I've got my Ruby environment set up, and worked my way through several tutorials. It's definitely a different experience, working from the command line. But it works. We'll see if I get to use it.
 

Friday, May 18, 2012

Protect Your Children!

Thursday, May 17, 2012

Ruby on Rails

For many years I've had HTML in my toolbox. Several years ago I added CSS. Last summer I tackled Javascript/jQuery, mySQL, and PHP. Over the past year I've been polishing up my knowledge of these tools and practicing with them. Now however, it's time to add more to the toolbox. More being, Ruby on Rails.

Ruby on Rails in a website framework, similar to PHP, but much more scalable, and so better for larger projects. It uses the Model/View/Controller programming ideal, which forces designers to separate elements of a web application (site) into different parts. When something goes wrong, it's easy to find the error because everything is in a specific place for it's functionality.

I've spent the past two days reading up on all this. There's a lot to take in, because it's not just Rails (Ruby on Rails), it's also Ruby itself, the programming languages that Rails is built with, plus Git, Github, re-learning the Command Prompt (or Terminal if one is on a Mac), etc. I found a nice long tutorial, so that's been helpful. It's as long as a book though, so it's taking time.

I spent many hours yesterday just trying to get a working development environment set up on my computer. Turns out most people who do this do it on a Linux/Unix machine or on a Mac. Only recently have people been trying to push to make it easier on Windows, and there's a nice installer package now, which is very recent.

I'm doing this of course, because Rails is what we're building KollegeKareer in, and it seems that that is what I'll be doing for the summer. Probably. If I ever get a contract to sign.
 

Wednesday, May 16, 2012

Songs!

Okay people. Got some songs for you. First, watch this. It is in German, but it still sounds pretty good.



Okay, no, think how you feel watching it, what your impressions were, then watch this. It's the same song, in English. Watch the top one first.


 

Thursday, May 10, 2012

New Code View

I've been working for the past day on integrating jQuery and user defined javascript functions, and finally figured out what I was trying to finish. Coming here to show off the results, I realized that I'm quite tired of scripts/HTML/CSS looking terrible. So I've finally gotten around to adding a special view for code, using the open-source Syntax Highlighter. Great code, and very useful as you can see below.

So on to what I was showing off. In the members section of the CESAC website, I'm building up a set of tools that will allow future webmasters to edit the site without touching code. The current section I'm working on is the members database. One tool in that section is an Add New page. On that page, one item is an HTML textarea, for the member's description. Since the description field in the SQL database is limited to 1000 characters, I don't want people putting more than 1000 characters into the textbox. I also wanted to give them a live updating monitor of how many characters they have typed.

I gave the textarea a class of 'new_description', and the monitor 'new_description_monitor'. Below is my initial script.

$(document).ready(function(){

  if      ($(".new_description").val().length < 1)    { $(".new_description_monitor").css("color","black"); }

  else if ($(".new_description").val().length < 1001) { $(".new_description_monitor").css("color","green"); }

  else                                  { $(".new_description_monitor").css("color","red"); }

  $(".new_description_monitor").text( $(".new_description").val().length + "/1000" );

  $(text).keypress(function(event) {

    window.setTimeout(function(){

      if      ($(".new_description").val().length < 1)    { $(".new_description_monitor").css("color","black"); }

      else if ($(".new_description").val().length < 1001) { $(".new_description_monitor").css("color","green"); }

      else                                  { $(".new_description_monitor").css("color","red"); }

      $(".new_description_monitor").text( $(".new_description").val().length + "/1000" );

    }, 0);

  });
  
});
It works perfectly. It annoyed me though, because I'm using the same code twice, once on pageload, and once each type a key is typed. I wanted to be able to type out the function once, then just reference it twice. So I dove into it, went through about 10 iterations, stopped by the jQuery forums for some help, and finally arrived at what you see below.
$(document).ready(function() {

  $("textarea").each(function(){ update_monitor('.' + $(this).attr('class')); });

  $("textarea").keypress(function(event) {

    var text = '.' + $(this).attr('class');

    window.setTimeout(function() { update_monitor(text);},0);

  });

});

function update_monitor(text)
{
  var value = $(text).val().length;

  var colour = (value < 1 ? 'black' : (value < 1001 ? 'green' : 'red'));

  $(text + '_monitor').text(value + '/1000').css('color', colour);
}

The function is declared and separated entirely from the main code. Additionally, this script will handle infinite textarea/monitors on a single page, as long as the monitor has a classname that is the classname of the linked textarea plus '_monitor'.
 

Sunday, May 6, 2012

HTML Textbox Form - Character Limit

Last semester CESAC moved our registration system for the Career Fair to an online version run by Purdue Conferences. There were issues.

One big one was that the company description box said it was limited to 400 words. In reality, it was limited to 300 characters. Which is way too small. So we're working with Conferences to try and fix that.

Meanwhile I'm working on automating the member database for the Council so that the next webmaster has less code to touch. I've got the List page done, the quickedits working, and I'm almost finished building the New Member page. One feature of the page will be a text box for inputting a description for the member.

I decided, one thing that would be useful would be a live updating ticker on the side of the box, giving the user an up to date character number, so they know how much more can be added. Up to date to the point of every keystroke.

How to do this though, is the question. I googled to see if anyone else had built one, and couldn't find anything. So I just started working on my own from scratch. The first thing was how to grab the value of characters. The second would be how to update the page. And the third would be how to trigger those events on each keystroke.

First part was easy enough, it's just .val().length, added to the text box. The second part was also easy, I used .text, which replaces just the inside text of an element without having the replace the entire thing. The third was tricky though.

I considered using .keydown, but that triggers on any key, not just value keys, and if you press and hold down a key, it only triggers once, not each time the letter/number is added to the box. .keypress though, ended up being exactly what I was looking for. The final code was remarkably simple for what it does.

$(document).ready(function(){

    $(".new_description").keypress(function(event) {

        window.setTimeout(function(){ $(".new_textlength").text( $(".new_description").val().length + "/1000" ); }, 1);

    });

});

Note there is a setTimeout in there as well. I tried it without that, but the number updated before registering the changed value of characters, so it would be one off. The setTimeout fixed the problem.
 

Double Lives

Every time I go home to visit my parents, I seem to step into a different life. I fall into old routines like I never left; doing laundry, taking out the dog, mowing the lawn. Then I go back to Purdue, and take off like I never left. It almost feels like I'm flipping between two different lives.

This summer might be different in that I'll be home, but working full time with engineering (If I get the J&S internship), but it certainly doesn't feel different. Greenfield has this sense of constant-ness about it. Nothing ever seems to change.

I guess the main thing that ties everything together is my digital life. My computer, my web projects, this blog, they are everywhere; at home, at Purdue, on vacation. The thread that ties my life together is a collection of magnetically etched data on rotating metal disks spread in data centers across the world. Strange to think about.
 

Saturday, May 5, 2012

8 Done, 1 To Go

I took my last exam for the semester this morning, and am finally finished. Hoping for 4 As and a B this semester, but we'll see what happens. I'm taking the rest of the day off; might go see The Avengers tonight. Been packing for a while now, cleaning up my room and throwing away quite a bit of built up junk.

I still have no idea what I'm doing this summer. ODOT hasn't gotten back to me, and according to what they told me, that means I'm not being hired by them. J&S hasn't gotten back to me, but I was told that I'd be informed either way. I'm going to call again on Monday morning to get a hold of my contact personally, and if he still doesn't know, I might just take the other offer that I have, which is with a startup web company.

I've been sick for the past week, but yesterday I was finally on the upswing and last night I slept well for the first time since last weekend, so I think I'm mostly over it.

It's strange, knowing that if I wasn't taking extra semester, I'd be graduating college. I'm not sure I'm ready yet for that, so I'm glad that I've got one more. Goal now is to get through this summer, make some money to help pay for next semester, and then get done.
 

Thursday, May 3, 2012

Great Video