While I intend to continue posting to this blog, I have a new blog over at kavwoosh.com! It is primarily going to focus on games and game design, while this blog will stay at a more technical "i-had-this-problem-and-did-this" level. Kavwoosh will also focus on my professional activities, so keep an eye out!
Tuesday, March 3, 2009
Friday, February 27, 2009
MySql Subquerys Are Molasses
Just a quick note on an issue I ran into today.
When using MySql, if you have a query that looks like this:
Select A, B
From table
where A in (Select C, D From AnotherTable)
Even when the subquery returns a very small resultset, the overall query will slow to a crawl, if it completes at all. This is because of how mysql handles the "in" statement. The only way to really get around it is just to join the two queries and filter, which isn't terrible, though I hope a situation comes up where this solution is untenable.
Monday, February 23, 2009
Peek-a-Boo Divs
I was just messing around with some HTML/CSS/Javascript stuff the other day, and came up with something kind of awesome. It's a div that hides until it has the mouse placed over it, and then hides again when the mouse leaves. It's very similar to a hiding toolbar, and could be very useful if applied correctly.
Due to its ability to be present, although mainly unseen, it would be particularly useful for web pages/applications that require large amounts of content on screen, so that more wouldn't have to be devoted to the standard menu.
I've tested this in IE7, Firefox, Chrome, and Opera. It works no matter the resolution, though I have yet to try it on my G1 (for the size tests, I basically just scrunched firefox and IE down very small). It's W3C compliant (except for the colors, which I don't really care about) for both the html and the CSS. The HTML uses the XHTML 1.0 strict dtd, and there isn't a single table anywhere. This is how I roll.
HTML:
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Menu Bar Test</title>
<link rel="stylesheet" href="./menubar.css" />
<script type="text/javascript" src="./menubar.js"></script>
</head>
<body onload='pageLoaded()'>
<!--<div id="collapsedmenubar" class="menubar" onMouseOver="overCollapsedMenu()">
<p>Click here for menu</p>
</div>-->
<div id="fullmenubar" class="menubar" onmouseover="overCollapsedMenu()" onmouseout="leftFullMenu()">
<h1>Menu</h1>
<p>
<a href="index.html">Home</a>
<a href="index.html">Projects</a>
<a href="index.html">Contact Info</a>
</p>
</div>
<div id="content">
<p>This is where the content goes!</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin nibh nisi, dapibus vel, elementum eget, vehicula vel, lorem. Donec ipsum est, tincidunt iaculis, nonummy ut, dictum vel, velit. In leo magna, aliquam et, suscipit sed, cursus in, tellus. Suspendisse dui felis, convallis vel, porttitor pellentesque, dapibus vitae, neque. Suspendisse potenti. Sed erat orci, rhoncus at, tempor in, pellentesque vel, tortor. Nam urna. Sed bibendum. Aenean ultrices vehicula lacus. Duis ac arcu. Nulla facilisi. Sed pulvinar risus eget leo. Praesent pulvinar varius ante. Cras lorem nibh, elementum nec, accumsan nec, imperdiet et, felis. Fusce gravida sem et orci. Suspendisse lectus nibh, tempus eget, sagittis sit amet, pretium vel, dui. </p>
<!--There was more Lorem Ipsum, but I dropped it for readability's sake.--%gt;
</div>
<div id="footer">
<p>Here is the footer!</p>
</div>
</body>
</html>
CSS:
*{ /*I know this is bad, but hey, it's a test document.*/
padding: 0px;
margin: 0px;
border: 0px;
}
.floatedlabel{
float:left;
}
.menubar{
background-color: green;
border-left: 5px yellow solid;
border-right: 5px yellow solid;
border-bottom: 5px yellow solid;
color: white;
left: 10%;
position: fixed;
right: 10%;
text-align: center;
top: 0px;
width: 80%;
z-index: 9001;
}
body{
background: lightblue;
padding-top: 5%;
}
h1{
float: left;
}
#content{
background-color: lightgreen;
border: 2px yellow solid;
left: 5%;
position: relative;
width: 90%;
}
#footer{
background-color: lightgreen;
border-left: 2px yellow solid;
border-right: 2px yellow solid;
border-top: 2px yellow solid;
left: 15%;
position: relative;
text-align: center;
top: 5px;
width: 70%;
}
Javascript:
function pageLoaded()
{
var fullmenu = document.getElementById("fullmenubar");
//fullmenu.style.visibility = "hidden";
fullmenu.style.top = "-70em";
fullmenu.style.height = "70.2em";
}
function overCollapsedMenu()
{
var fullmenu = document.getElementById("fullmenubar");
//fullmenu.style.visibility = "visible";
fullmenu.style.top = "0px";
fullmenu.style.height = "";
}
function leftFullMenu()
{
var fullmenu = document.getElementById("fullmenubar");
//fullmenu.style.visibility = "hidden";
fullmenu.style.top = "-70em";
fullmenu.style.height = "70.2em";
}
Oh, sorry, did you want that menu to be at the bottom, maybe for some Mac OS X dock-style menu? Well, in that case, for the menubar, change
top: 0px;
to
bottom: 0px;
and in the javascript replace all instances of "top" with "bottom". Enjoy.
Labels: css, div, hidden, hiding, html, interface, javascript, productivity
Wednesday, February 4, 2009
PyGame Presentation
It's been a while since I posted, I know, but I've been busy. Here's one of the things that's been occupying my time. I worked up a 2d top-down collecting game demo for the Drexel Game Developer's Group, and a presentation to go along with it. I'm only a week behind schedule for posting it, which is easily attributable to my laziness.
You need to have python and pygame installed to run it, but other than that, just execute runner.py.
Wednesday, December 31, 2008
Defend The < Insert Anything >!
Happy New Year! It's been a while since I last posted but I've started a few other posts, and will hopefully will be getting them out of the tube sometime soon.
Thursday, December 18, 2008
The Analysis of the Dead
Sure, zombies are getting big. Pirates got big, Ninjas got big, monkeys...I think their time has passed as well. Zombies seem to be sticking around for a bit longer though. It's probably partly due to the whole "decomposing" thing. All joking aside, what makes nerds, a generally erudite and intolerant bunch, so happy to have an antagonist that is slow, dim-witted, operates in hordes, and attempts to eat brains?In this past week's Zero Punctuation (I should really stop getting my blog ideas from it, I'll work on that), Yahtzee remarked that besides Pirates, Monkeys, and Ninjas, Zombies were perhaps the most popular thing among "nerds". Specifically gaming nerds. Yes, the "legitimacy" of zombies in popular culture is growing every year. What used to just be a cheap horror movie effect has actually been used to create artsy, compelling narratives and games. Need proof? Check out "Fido."
Hey, wait a second, I think there might be something there.
Zombies are the exact opposite of what a stereotypical nerd wants to be. They're barely above fungi when it comes to IQ, and have an unstoppable need to attack those that aren't one of themselves. Is it just me, or does this sound exactly like the kids that made fun of you in high school because you'd rather read than watch "Grey's Anatomy"? In fact, when you think about it, what do zombies usually want to eat? Brains? What's the only way to kill them? Kill their brains? If someone was coming up with these metaphors, they weren't digging very deep (probably about 6 feet).
What naturally follows the intelligence disparity is the common criticism nerds have for "normal" people, that they act like sheep, meandering pointlessly around in herds. Or hordes. Used to social exile, imposed either by self or by others, nerds generally scoff at being part of a large group. They don't want to be following the trends that everyone else follows, because everyone else is stupid, and probably wrong. If you hadn't noticed, this is where the intolerance comes out. Although they commonly accept people who are "different" into their ranks, many nerds find non-nerds to be unbearable. Therefore, any nerd anathema is most definitely going to exist in some sort of large group. This serves another purpose as well. By making their antagonists a seething mass, each individual is deidentified, and it doesn't really matter who's head you're having to lop off to get to the rescue zone. It could be your old gym teacher, that cute girl who said you smelled funny when you asked her out, anyone.
All that being said, I have to say that I'm still a zombie fan. Although I like to think of myself as a very tolerant person, I'd definitely agree that part of my liking of the zombie metaphor is a bit of distrust and dislike of the general public. Not exactly as a mass of individuals, but the whole societies themselves. To me, the zombie hordes represent the selfish, immutable cultures that are sending all of us to hell in a handbasket, finally imploding upon themselves, making way for a new world, while still representing major obstacles to that world as they slowly rot away.
Or maybe I'm just hungry for BRAIIINS.
Tuesday, November 25, 2008
Thoughts on Advertising
This is actually a topic that I've been thinking about for a while now, going back to a conversation I had at with Corvus Elrod at his "moving to the West Coast" party. We were discussing advertising in games, and generated a lot of interesting points. As a storyteller, it is anathema for him to see anything that pulls a player out of the game experience, and have them thinking about products in the real world. I agree with this, to a point. When one thinks of the rise of casual games, and the free product business model, it has to be conceded that advertising is one of the main revenue streams (and therefore driver of) the games industry. Armor Games was a company that I though had nothing but cheesy, vapid fare, until I was given a disk by the people of the Indie Games Showcase. Some of their offerings, particularly in the puzzle category (which I usually avoid), blew my mind with their innovations. This company, which is producing quality (though flash) games, is completely supported by the ads on their site (as far as I can tell).
Labels: advertising, flash, games, gaming