Monday, April 30, 2012

8000 More And I can Bust Out a Meme

I remember a while back I was browsing the stats page provided by blogger, and I realized I had just over 2500 hits (page views) total, since I'd started this blog several years ago. I felt pretty satisfied with that because I started this blog as just a personal journal of sorts. One where I could get my ranting out, or post things I'd learned.

Since then, I've actually been posting pretty often, trying to average one every other day. And I guess you all are interested enough to read. My hit counter for April just broke 1000. I'd been happy with 2500 over several years ... now we're looking at over 1000 a month. So thank you, all you nameless faceless readers out there. You just made my day.

Yet none of you ever comment or give me feedback ... Ya just look and then leave. Say something once in a while! Speaking of which, a good topic to give me feedback on is the lock of my blog. I'm considering switching to a modern theme. I took this one up back a long while ago, and have since edited it to make it wider. It's not even offered anymore, and it's quite out of date. Yet I like it because of the simplicity. Any thoughts?
 

Sunday, April 29, 2012

SQL Insertion Update

In regards to my post on Friday about SQL Insertion, I've been playing around with it and found some interesting things. The reason I never noticed a need for the fix before is that some implementations of PHP auto correct it. They automatically add backslashes to any character that could break the input, such as apostrophes and quotations. Unfortunately, I still don't know how to figure out if that correction is in place except for manual testing.

The server hosting the CESAC site doesn't use auto correction, while the servers hosting our Purdue ICS sites do. The question will be how to figure it out with a code check so that I only correct when it's needed. I'll update this post if I figure out how.

EDIT:

Got it. Turns out that when using the POST method for forms, a backslash is added to the three special characters: apostrophe, quotation mark, and backslash. This is because these three characters are used in the SQL insertion statement. They are then stripped when being added to the SQL. When an implementation of PHP has magic_quotes_gpc turned on, nothing happens to these backslashes. When magic_quotes_gpc is turned off, they are removed. The way then to test is a simple if statement, which returns a 1 for on and 0 for off.

if(get_magic_quotes_gpc(void)) { }

Additionally I found a better way to fix the problem if it needs fixing. I was using str_replace before, but that only works for apostrophes and backslashes, not quotations. I found a way to fix the problem specifically however. There is a function in PHP which does exactly what is needed. It adds back slashes to each of the three characters. The code ends up being:

if(get_magic_quotes_gpc(void)) {
    $title = $_POST["title"];
    $content = $_POST["content"];
}
else {
    $title = addslashes($_POST["title"]);
    $content = addslashes($_POST["content"]);
}

 

Friday, April 27, 2012

SQL Insertion

Earlier this Spring I build an online login section for the CESAC website, so that future webmasters wouldn't have to touch the code to just put in a quick announcement update.

It worked well, until yesterday I tried putting in an update, and nothing happened. I got no PHP error, instead the PHP went through the Insertion and then passed over to a success page, but didn't insert.

Given that yesterday evening I turned in my final project of the semester, this afternoon I had time to sit down and go through the code line by line (not as bad as it seemed, the submit page was only 20ish lines). It took me a good two hours, but I finally figured out the cause. Whenever a string that I was inputting contained an apostrophe, it would screw up the SQL insertion. It wouldn't cause a problem with the PHP, which is why I wasn't getting an error.

I was inserting using variables, and used apostrophes to contain each variable, ex: ... '$month', '$date' ... So whenever the string had an apostrophe, it ended the variable, or so it thought. And ended up really messing up the statement.

Turns out SQL has a quick fix for this. Placing a backslash ( "\" ) in front of an apostrophe tells the SQL to treat it as a character, instead of a limiter. So the solution was simple really. I had to use str_replace to replace all apostrophes with double apostrophes. $content = str_replace("'","\'",$content);

Success!
 

Thursday, April 26, 2012

Eureka Finally Tanks

Eureka got canceled by SyFy last fall, taking effect at the end of the season that started 2 weeks ago. The writers decided to protest by destroying the show and the universe in the cruelest ways they could think of. They started out by taking half the characters and placing them in a virtual reality box seemingly four years into the future.

Now besides a lot of platonic friendships, there are three significant relationships among the main characters that have been built up over the past four seasons. With two of these, one of the partners ends up in the virtual reality and one doesn't. And of course, the ones stuck inside get their hearts broken by the fake virtual partners. Just because the writers decided it would be fun to be cruel.

One of the relationships though, (Fargo and Dr Martin (Felicia Day)), was seemingly spared. Both went on the mission at the end of last season that got hijacked, and so both were stuck in the virtual reality together. So up to this point, I was willing to wait and see what happened.

Turns out that the writers were just delaying an episode to give us the taste of hope for a happy ending, in order to make it all that more painful when it was snatched away. In a giant ██████ to Fargo, they killed off Felicia Day in episode 2. So they managed in two episodes to destroy everything that took 4 years to build up.

So I want to write this to the writers of Eureka. You are the most cruel human beings I've ever interacted with. You are ██████ people, and the world would be a better place if you ████ a █████ ███ ███ ████ ███████. ██ ████ ██████████. I hope you ███, slowly and █████████.

After writing the above, I decided that posting it in public might not be the best idea. So I'm compromising and blacking out the choice words. But don't worry, writers of Eureka, I've sent you several emails in which I'm very specific on my thoughts to you.
 

Does ITaP Even Train LAs Anymore?

I had an interesting experience today while working trying to work on my final project for my surveying class. I'm using AutoCAD to create it, and it's a program which needs the mouse wheel for fine control zooming. I logged into a lab computer, and the mouse wheel was scrapped. You've probably seen similar mice, where you'll turn the wheel slowly and nothing will happen. A very quick turn will sometimes make contact, but it's very difficult to control.

I told the LA about it, because LAs can put in trouble reports and get new equipment sent out to labs. Her initial reaction was a laugh and say okay, when I told her. Seeing that I wasn't walking away, she sort of gave me a dirty look and said that she didn't have any, and would have to have someone else come bring it out, implying it would be a huge hassle. I didn't take the bait, and just nodded and say okay, and kept looking at her.

She grimaced, got up, and reluctantly followed me to the computer in question. I picked up the mouse, and slowly rolled it for a good 10 seconds. Nothing happened on the screen. She took it, and rolled it really quickly. Several times. Nothing happened. She rolled it again more quickly and harder, and it jerk zoomed in 2 or 3 levels. She then set it down and said, okay, anything else?

I'm like, not really, how long will it take a new one to get here? She says, nothing's wrong with it, it moved. I picked it up again and moved it for another 5 or 6 seconds with nothing happening. Finally she sighed and said okay and went and put in a trouble report.

Well to you anonymous lab assistant, ma'am, you need to get a new job because you don't know a thing computers, or customer service.
 

Wednesday, April 25, 2012

Catstache - Update 2

New iteration with a reworked button system. The buttons queue an animation that involves the top panel bouncing down, then sliding up under the header until it's fully hidden, and then sliding back out, with a switched panel. This is the last screenshot I'll be posting of this codebase, I'm going to be starting from scratch this afternoon on a new version, because there are several large changes that I want to do in how I'm coding it, things that have changed a little over and over and over so that they are coded very inefficiently.

What do you guys think of the background color? I like white personally, but my partner disagrees. And anything that isn't white or black has advantages in terms of making borders look 3D, so that's a nice little perk.



Thoughts? Better, worse?
 

Sunday, April 22, 2012

New Music Playlist

I previously posted a Pure Moods playlist that I'd assembled on Youtube, with the goal of finding music which was relaxing yet focusing ... music to chill out to, or do homework to.

This is the opposite. These songs won't relax you, but if you need to get pumped up, if you need to get excited, then these are for you.


 

Almost Done

Seems that hell week went well, I've gotten back grades for all but one exams, and so far I'm standing at 2 As and a B. Plus two 100%s on quizzes. That said, some of the more recent material for construction as well as soils has been difficult, so over the next week I'll probably be spending more time in office hours getting help.

Finally found a class buddy to work on soils homework with, and she's been a godsend. I most certainly wouldn't have done well on the last few homework assignments, or the exam, without having someone to bounce ideas off of. If you out there ever get a chance to study with a partner, jump on it! It's very useful.

Dead week and finals are all that's left of the semester, and I still don't know if I have an internship for this summer. My interview with Janssen and Spaans went really well, but they still haven't told me one way or the other. I've got a phone interview with the Oregon Dept of Transportation this week though, so hopefully I'll have a backup.

Catstache is moving. Slowly, but it's moving. Hope you all enjoyed the look at it, though since I posted the last update it's changed quite a bit. I'll post an update in the next few days. With the design nearly finalized, I'll be able to move it over to WordPress soon, and get it up and running. Then it'll be time to start finding clients. The first two we had lined up have both basically canceled, unfortunately.
 

Tuesday, April 17, 2012

Burst Angel - Review

I got into a show called Burst Angel a few days ago. It's pretty short, one season, about 12 hours total. It was entertaining enough that I powered through it in 3 days. Problem is, I just watched the ending.

To summarize, the show basically ends with all the main characters, all the secondary characters, and everyone in the entire city of Tokyo dying, with the sole exception of one of the two main characters who in the previous scene got her heart broken, and is in the end left crying and alone on a random beach.

No surprise happy ending. Just one broken-hearted character surrounded by a destroyed city. I'm a tad bit pissed off, to put it mildly. I wasted 12 hours, not to mention emotional connection with characters, only to have them all die. What was the point of any of the episodes previously, they should have just put the gun in their mouths on episode one and saved all the trouble.

Only upside, it did have some really good music. Might try and find the soundtrack.
 

Saturday, April 14, 2012

Catstache - Update

Yesterday I shared a first look at the website I'm currently working on, Catstache Design. I spent some time today working on it and polishing it up. I changed the colors somewhat, to move away from the green/teal look. Also added some shadows using the CSS3 Box-Shadow property. Which of course won't work on older versions of IE, so I'll have to create a work-around with images eventually.

IE is low on my priorities at the moment though, first I want to get the site design finalized. Granted, all this might change, because my partner has final say in how the site will look, given that she is the actual graphic designer. But for now, this is where we are at.



Thoughts? Better, worse?
 

Friday, April 13, 2012

Catstache Design - First Look

This week has been the busiest all semester. 4 midterm exams, 2 quizzes, and several homework assignments. Throw in a good 7 hours of driving and an interview, and it makes for very little free time. But I made it through, and classes got out at 2:30 today, so I had some free time to finally work more on the homepage to Catstache Design. Granted, my graphic designer partner is suppose to be doing said design, then handing it off to be to build, but she's been even busier than I have, and I was never one for patience *laugh*.

So, below is the first (4th, but first that it decent enough I'm willing to share) iteration of the widescreen version of the homepage.



I'm not really satisfied with bar that crosses the screen mid page; the coloring of it. It's basically a tab bar to change the box above to different panels, so we can hold more information. I'll hopefully be able to run it by the partner and get some suggestions. Any thoughts of your own? Let me know in the comments.
 

Wednesday, April 11, 2012

Ups and Downs

In the true form of Karma, last week and this are polar opposites. Last week was an easy cruise. Not a single homework assignment due the entire week, no exams, no quizzes. Nothing.

This week however, I have a grand total of: 2 quizzes, 4 midterm exams, and several homework assignments. So far I've taken one of the quizzes and two of the midterms, and I'm feeling pretty good about them. The first midterm was in psychology, and was pretty easy even without much studying. The second, which I just took, was in surveying. Not much more difficult, and it certainly took a lot less time. It was just several problems to solve, and we knew ahead of time what kinds of problems we'd be tested over, so it was easy to study for it.

I did have some pretty great news this week as well. Very last minute, I heard that Janssen and Spaans was looking for an intern for this summer, in their Indianapolis office. I sent my resume over last Friday, and they want me to come down tomorrow morning for an interview! Instead of leaving here at 6am, I'm just going to drive down to Indy this afternoon and spend the night with the parents, who live only 20 minutes away from the Janssen and Spaans office.

Additionally, the Oregon Dept of Transportation called me and asked if I was still interested in a traffic internship with them this summer, and we set up a phone interview for later this April. Two in just a week! I'm not sure which I'd really like best, because living at home would save a lot of money, but living in Oregon would be a cool experience; getting out of the midwest for the first time in my life. We'll see what the offers are, pay, hours, etc.

Later today I have a midterm in soils, which is going to be difficult. It really doesn't matter however, because it's one of two midterms, and the lowest is thrown out. I got a decent grade on the first exam, so even if I utterly fail this one, I still have a decent grade. I've studied for it, but I'm not freakin' out about it.

Then I've gotta call Enterprise around 3, after bowling gets out, and get my car for the day. Turns out they charge by the day, and a full size is only 10 bucks more than a compact. Might as well go full and drive down to Indy more comfortably. Then back here tomorrow afternoon, and another midterm exam on Friday, to finish up the week.

Two more weeks after, and finals, and this semester is done!
 

Friday, April 6, 2012

Kimbra/Gotye Explosion

Recently everywhere I look, someone is talking about Somebody I Used to Know. It's giving me very mixed feelings. On one hand, I'm happy for both artists that they are finally gaining exposure. On the other hand, it felt good supporting small artists that no one else knew about, and being able to introduce people to them.

Have you heard this song? Yes, yes I have ... a year ago.

Though I guess that's how all early fans of any artist that hits the big time feel. In the end, I think the satisfaction of seeing others enjoying the music trumps the bandwagon effect.

Still, in honor of all you long term fans, here some classic Kimbra (and Miami Horror!) beats, back from 2010.


 

Responsive Desgn - More Thoughts

As detailed in my post a few days ago, I'm planning out my sites on a 4 layout setup, (mobile, narrow, normal, wide). I'm not sure that's enough though, and I'm debating splitting mobile into two versions, mobile narrow and mobile wide. Or mobile landscape and mobile portrait.

I starting thinking about this when I had to change up the way my header looked at the high end of mobile down to the low end, and I ended up using a media query inside the mobile css sheet to do it. Which leads me to another point, how to apply media queries.

The first method is to apply them inside a css sheet. You'd link one css sheet to the webpage, then inside that sheet, you'd specify all the styling. Example (inside the css stylesheet):

#wrapper {width:1000px;}

@media (max-width:1050px) {

#wrapper {width:100%;}

}

The advantage of doing this lies in the fact that you can write less code. Styling which doesn't change can be written just once, only things that change have to be re-written.

However, this can get overly complicated. Trying to find the source of a problem can involve digging through the entire sheet, finding the styling on an element in multiple places.

The alternative to this is just creating entirely separate style sheets. Create multiple css files, name them mobile.css, wide.css, etc, and use media queries to link them in the web page. Example (inside the webpage file):

<link rel="stylesheet" type="text/css" media="(min-width:0px) and (max-width:660px)" href="css/mobile.css"/>

<link rel="stylesheet" type="text/css" media="(min-width:661px) and (max-width:1020px)" href="css/narrow.css"/>

<link rel="stylesheet" type="text/css" media="(min-width:1021px) and (max-width:1401px)" href="css/normal.css"/>

<link rel="stylesheet" type="text/css" media="(min-width:1401px)" href="css/wide.css"/>

Besides the opposites advantage and disadvantage of the first method, this method has another advantage which is loading speed. When a page loads, it'll only load the CSS sheets that it needs. If one is on a widescreen monitor, it will load only the wide.css. This takes less time than loading all the css, for every possible screen size.

This is the method that I'm using at the moment. There is one problem though, which is that the most common script for giving IE7-8 the functionality of media queries doesn't work with the second method. I'm trying to find a hack around it, and I'll post it here if I figure it out.
 

Thursday, April 5, 2012

First Client Meeting for Catstache? Or Not ...

I had a meeting with a potential client for Catstache yesterday, pretty excited about it because it was the first person who'd actually contacted us. And we haven't even started advertising yet.

Aside from the guy arriving over an hour late, the meeting went pretty well, except that it wasn't at all what I was expecting. Turns out, he just blind emailed everyone on listed on the ITaP SAC (student council) website, because he's not looking to hire a company to build him a site, he's looking to hire individual people to join his company, to build the site in-house.

Then there is the scale. Catstache builds personal sites, either statically or powered by WordPress. Anywhere from 1-10 pages normally, it's not really a complex task. This site is more on the level of Facebook, from the sounds of it. At least Facebook back when it started.

It did sound quite fun, and even though I can't talk about the content of the proposed site (had to sign an NDA), I can say it fill a niche that is unfilled, vaguely related to the concept I was working on last summer with the virtual career fair site, but on a whole different scale.

Unfortunately, there's no team in place, no direction really. The owner of the site isn't a tech person, and is really in the starting stages of gathering up a team. I told him he needs to find, before anything else, a web consultant, who's sole job is just, looking at the site, step by step, piece by piece, and figuring out who needs to be hired to complete it all. Once there is a list of necessary people, work can start on hiring them all, and there's no risk of individual web devs getting screwed because of lack of help.

It's not a Catstache project, that is for sure. But depending on if he can round up others, I might be joining over the summer. Updates to follow.
 

Wednesday, April 4, 2012

Math Humor

If you've ever taken higher calculus ...


 

Tuesday, April 3, 2012

Imposing Values

"Lefty liberals only seek to IMPOSE their own moral views on other people, by fiat or social engineering."

I read this as a comment in an article about DOMA today.

Liberals only seek to impose. The problem is that it's opposite of the truth, because in terms of marriage, there are three positions. On one end of the spectrum, there is the position that, we allow heterosexuals to get married, and don't allow homosexuals. In the middle is, we allow both. On the other end is, we allow homosexuals to get married, and don't allow heterosexuals. Those are the three positions.

Personally, I don't like either one, or three, because they are both rather extreme. They involve forcing your own view (that either homo or hetero is bad) on other people, and controlling their actions (not allowing them to get married). The middle position, is that of live and let live. Yet somehow, it's that middle position, of not seeking to control ANYONE, not seeking to impose EITHER moral, that the commenter seemed to think was imposing. Not sure how that works.

It amazes me that the GOP, which prides itself on limited government and staying out of people's lives, tries to impose a specific religious morality on everyone. Or, I wish it amazed me.
 

Sunday, April 1, 2012

Things are Moving!

Any reader of this blog knows that I love web design. HTML, CSS, PHP, jQuery. Recently I've gotten really into mobile, and I'm trying to push myself with the actual graphic design part, though I'm still quite terrible in that aspect. Yet, what is the point in all this, besides it being fun?

I was approached by a good friend of mine a while back about starting a web design company, and turning my hobby into a part time job on the side. (A profitable one, since an average personal wordpress site goes for anywhere from $700 to $2000). Still, it's been slow going, weeks passing with really nothing happening. However, over the past week things have finally started moving.

The first surprisingly difficult hurdle was creating a name. Catchy, simple, and most importantly, not already taken. And if you think that there are lots of names out there not taken, try googling random stuff followed by the word design. We progressed through Blue Hat, to Blue Beard, to Cat Beard, and finally came up with out new name: CatStasche.

Picture, the face of a cat, with a prominent mustache.

That done, we registered the URL, www.catstachedesign.com, and I put up a coming soon page. Then work started on our actual site. It'll be powered by WordPress eventually, but right now we're working with static HTML and CSS just to get the layout working. One major aspect I'm putting a lot of effort into is responsive design, which is one of the few areas that I both A, understand well, and B, am getting in on the ground floor of.

I've decided on standardizing upon 4 widths, and making the design flexible within each of the four.

Mobile
0px - 600px
Smartphones, tablets in portrait mode
Narrow
600px - 1000px
Old monitors, and tablets in landscape mode
Normal
1000px - 1400px
Traditional 1024x768, and very common 1280x1024.
Wide
1400px - Infinity
Widescreen large monitors, normally 22" and above


Some sites have the region that I have as mobile split again, for phones in landscape vs portrait, but all my mobile designs are going to be 100% flexible, using no fixed-length values, so it'll scale, and make another split unnecessary. I've got the layout tentatively working for Wide and Normal, and will be working on the Narrow and Mobile versions over the next few days while my partner finishes the logo and starts working on the color scheme. Hopefully the site should be completely designed within the next week, so I can then spend the week after moving translating it to WordPress. And then we'll really be ready to rock.