Wednesday, July 25, 2012

The Dark Kitten Rises


 

Tuesday, July 24, 2012

Remove Query From URL Using PHP

I had some free time the past two days, so I've been working on finishing up the the CESAC members area. While I had the Add New Members functionality complete, adding the Edit Existing Member was more interesting.

Given that it's both A, an obscure small site, and B, already password protected, I'm not putting all that much effort into security. Mostly I'm trying to idiot proof it rather than prevent a determined hacker. As such, on pages that should only be accessed in pattern, I'm just grabbing the referrer and validating it against what the previous page should be.

This is fine, until you get start using a single edit page to edit any member. This involves using a query in the URL, the ?ID=somenumber. And this plays hells with my validation. So what is the best way to remove the query? I googled and found a few answers, but all of them use complex filtering, or splitting the URL into pieces and then rebuilding. And since it's rebuilding, the parts that you should include have to be defined. This limits what type of URL you can use without throwing an error.

Instead of building, I'd rather subtract. I'd rather remove the query and leave everything else the same. To this end, the code below solves the problem quite nicely.

$referer = $_SERVER['HTTP_REFERER'];

  $url = parse_url($referer);

  $referer = str_replace('?'.$url['query'],'',$referer);


First we grab the initial full URL. We then break it into an array. And finally, we replace the query with nothing, essentially subtracting it.
 

Wednesday, July 18, 2012

Firefox 14 Changes Icons, Encrypts Search

Like clockwork, every 6 weeks we see Firefox getting a refresh. Today was no different, with Firefox prompting users to update to the next version, 14.0.1. Like previous incremental updates, this provides several small graphical changes along with some under the hood improvements.

The biggest change that people are talking about is in the way Firefox displays Favicons. Favicons, the little icon that nearly all websites have, are normally shown in your bookmarks list, beside the website’s address, and on the top of each tab...

Read my full article at TekGoblin.com.
 

Sunday, July 15, 2012

Game of Thrones Review

Game of Thrones is an HBO produced show. That means you can be sure of two things. The production value is sky high, and so is the level of nudity/sex. Unfortunately the two can't be divorced it seems, so we live with it, and enjoy the show itself. And enjoy it I did.

I burned through both seasons in a single week once I finally started. I was hooked. It achieves a perfect level of grayness in which there are some definite protagonists I can root for the entire time, without going entirely black and white. Characters surprise me, do bad or good things unexpectedly, and are just generally enjoyable to watch.

It was of course depressing when Ned Stark died at the end of season 1, but we got past that as new heroes rose up to defend the north. Really the one big problem I had with the show was it's fuzziness on some of the topics. Religion was confusing because there are three main religions, an old, a new, and a newest. But some refer to the middle as the old religion, and some refer to it as the new. The show never really explains it well enough. I had to go to the wiki online to really figure it all out.

I don't hold it against them too much though, because there's SO much to cover. The world and backstory are massively in-depth. With only 10 episodes a season, it's difficult to cover everything.

Overall, I'd give the show an 8/10.
 

Friday, July 13, 2012

Exercise

Getting healthy and into shape when you aren't already is an interesting concept. One problem is that it's unpleasant in many aspects. Running and pushups are harder than sitting and watching TV, and water doesn't taste as good as Pepsi. Another of course is that problem is that it takes a long time, results aren't instant. We can't do anything about the first part. Exercise is work, by definition. But as to the seeming lack of progress, we can do something.

There are two aspects to this. First, you set small goals. You aren't going to lose 20lbs in a month. Not healthily anyway. You can though, see noticable results in what you can do, if not how you look. Over the past 2 months I've been really pushing myself. When I started, I could jog for maybe 30 seconds. Today I ran a 10 minute mile. At the beginning, I could do 15 situps. Now I can do 40. I could do barely 3 pushups. Now I can do over 15.

You look at things that improve faster and focus on them, so that you show yourself that yes, you Are getting something for all this work. But that's not enough. The best way is not just to show yourself, but show others. Post your progress on Facebook or Google+; get your friends interested. As terrible as it sounds, humans do enjoy praise, so any time someone congratulates you on your progress, you'll be that much more likely to continue.

Better yet get them to start exercising themselves. Do it together and you'll all help each other. Make a game out of it, race each other, play soccer or basketball, games in which there's a lot of movement.

Myself, I haven't yet gotten my friends onto the exercise train yet, but I am progressing. The most important thing is to keep trying. Even slowly walking for a few minutes is better than nothing.
 

Monday, July 9, 2012

Misc Updates

Been nearly 2 weeks since I last touched this blog. You might notice a new name though. No longer do you have to type in .blogspot between the name and .com. 1and1 was having a weekend special, URLs for $0.99, so I picked up thephilosophicalgeek.com. A small thing, but it makes me happy.

Catstache is finally fully official as well, we now have an operating agreement and a bank account, so we can finally start our first project. Additionally I've been picking up some work for TKOSEO, which has been nice. It'll be my first legit paycheck since December.

In other news, I mentioned several weeks ago that I was going out. And while things haven't been perfect, she hasn't told me to jump in a lake yet, so that's good! I'm going to see the new Spiderman movie with her later this week; I'm looking forward to it.

I'm going to try to start posting some things about Wordpress here soon. The stuff I've been doing for TKOSEO has been theme building from scratch, which has involved a lot of backend work. I've learned more about Wordpress in the past two weeks than any time before combined, and my first theme has a custom backend menu page that can change all sorts of options.

Hopefully I'll have time to start writing up some of the basics here. There are many advanced tutorials on the internet. But very few basic ones; everyone assumes the reader is familiar with Wordpress development.

Anyway, hopefully we won't have any more 2 week gaps here. Depends on time, as does everything.