SubOne.org

Welcome Guest! Log in or Register.

Archive for September, 2008

CSS3 Suggestion

Sunday, September 28th, 2008

Is it too late to request something like ‘background-position-x’ and ‘background-position-y’ to be added to the CSS3 spec? These would be extremely useful in cutting down the amount of code needed when the X position of the background needs to be as previously set but the Y needs to be changed.

This is useful for sprite techniques. For example, say you have a single image with a bunch of icons in a matrix. Different icons are represented horizontally in the image and different styles of those images (e.g. hover, selected,disabled) are represented vertically. So, now you can style all elements that contain icons with the ‘icon’ class which defines the background-image. Then add an additional class to each of these based on which icon it represents, which would change the background-position-x to display the appropriate icon image. Finally, you would have addition rules that define current state of the icon, such as a ‘select’ class or a ‘.icon:hover’, which would change the background-position-y.

An example of 5 icons with 3 states (e.g. normal, hover, selected) would require 15 different rules as follows:

.icon {
  background: url('images/icons.png') 0 0 no-repeat;
  width: 16px;
  height: 16px;
}
.icon1:hover {
  background-position: 0 -16px;
}
.icon1.selected {
  background-position: 0 -32px;
}
.icon2 {
  background-position: -16px 0;
}
.icon2:hover {
  background-position: -16px -16px;
}
.icon2.selected {
  background-position: -16px -32px;
}
.icon3 {
  background-position: -32px 0;
}
.icon3:hover {
  background-position: -32px -16px;
}
.icon3.selected {
  background-position: -32px -32px;
}
.icon4 {
  background-position: -48px 0;
}
.icon4:hover {
  background-position: -48px -16px;
}
.icon4.selected {
  background-position: -48px -32px;
}
.icon5 {
  background-position: -64px 0;
}
.icon5:hover {
  background-position: -64px -16px;
}
.icon5.selected {
  background-position: -64px -32px;
}

Whereas with the background-position-x/-y properties it would only need the following 7 rules:

.icon {
  background: url('images/icons.png') 0 0 no-repeat;
  width: 16px;
  height: 16px;
}
.icon2 {
  background-position-x: -16px;
}
.icon3 {
  background-position-x: -32px;
}
.icon4 {
  background-position-x: -48px;
}
.icon5 {
  background-position-x: -64px;
}
.icon:hover {
  background-position-y: -16px;
}
.icon.selected {
  background-position-y: -32px;
}

Of course, the more sprites used the more redundancy is needed without the use of a background-position-x/-y. Without separate X and Y properties it takes i*s rules, where i represents the number of icons and s represents the number of states. With them it would only take i+s-1. The benefits are obvious.

Motorola S9 Fix

Saturday, September 27th, 2008

So I bought these really nice wireless bluetooth stereo headphones from Motorola back about a month ago. I opened the package while I was out and about and promptly made the huge mistake of just throwing out the packaging and reciept after making sure they work with my BlackBerry Curve. They are pretty sweet, and not too expensive for the convinience of being able to control volume up/down, track back/forward, initialize voice calling, and play/pause right from the touch of an ear peice.

The problem? They were broken and I didn’t even know it! That is until I started fiddling with them and hit the volume down button. I quickly found my volume at the lowest setting. Cool, nice feature, but wait, where’s the volume up button? I took them off and sure enough I was hitting the right button. Nothing is happening! Now they are stuck at the lowest volume setting and its the volume on the headset not on the phone.

So, I tossed them into a box for a while until I finally sat down and took out a handy soldering iron and started to strip a few wires and make some connections. I’m no electronics genious or anything, but I guessed right that black is always ground and found that the red wire is for the voice dial initialization. After accidentally ripping that wire out (no matter, since I planned to cut the activation strip off the earpiece so that this wouldn’t happen again) I found the yellow wire on my second attempt. The yellow wire was indeed the volume up!

I then soldered a hole right through the volume up and down connectors before remembering I cut out by accident. No worries, one day I’ll get around to repairing it and the connector is still there, so it will work.

Apparently this is a common issue with these headphones. Whether it just be sweat interfering and/or frying connections or, in my case, the circuit was just torn to bits when I got them. I didn’t check all the wires since I got it on my second try, but maybe I will later. Nonetheless, anyone that has these now has a partial pinout! Black is ground, red is voice, yellow is volume up. Comment with more if you’ve got them 😀

Ouroboros: 2

Wednesday, September 24th, 2008

This is one chapter of a short story. To start from the beginning of the story head over to Ouroboros: 1.

Ben plopped himself down on the bed from his upright position. He stared at the ceiling for answers. “Could it have been a dream?” He found it just about as difficult to believe that as he did that the experience was real. Having had the same dream for the past fifteen years, he was slow to accept the possibility, but what else could it have been. “Things like that just don’t happen in reality,” he thought. He made a mental note to discuss it with his therapist. The ordeal slipped from his mind entirely as he looked around.

His room was covered in obsolete movie posters from the theater that his mother worked at. There were model cars lined up on his dresser and a recently raided jar of mostly pennies setting on its side beside them. The room was well lit by the eastern morning sun through faded beige curtains. The bright sun revealed little in the small room, but papers strewn about the floor and a backpack leaning against a wall in the corner. Ben thought for a moment that the room looked pretty empty.

Everything in the house had a putrid yellow-beige color to it, but the color was deepened the closer you looked towards the ceiling. Ben’s father was quite the smoker, and the smell and look of the place had slowly taken a downward spiral since they moved in, but nobody ever noticed. There were streaks running down some walls in the living area where the nicotine had condensed together and dripped slower than the eye could perceive. Despite the appearance, the walls were dry to the touch.

Without thinking, Ben dragged his hands across the walls of the hallway on his way to the bathroom. He headed for the toilet, but did a double take at his image in the mirror. He spoke to himself “Darn, I got a pimple. I’m not supposed to get those yet!”

“Ben! Time for school!” His mom had to yell for him every morning, since he was typically a slow start to get out of bed. (more…)

New Site Layout

Wednesday, September 10th, 2008

I’ve designed a new layout for the site finally. It’s funny how it can be so easy to come up with ideas for other people’s sites and so difficult when it comes to your own site. I’m just so picky and I wanted something that could serve both personal and professional purposes. Anyway, it’s done and it’s mostly integrated as a WordPress theme. I’ll just fix little problems as I see them, but I’m not too worried about it right now, because I am reading Pro Drupal Development Second Edition which is over 700 pages long. So, I will most likely be converting the theme over to Drupal soon. No reason to get too cozy with WordPress then right?

Once I learn Drupal pretty well I may be using it in all of my projects. The first theme I made for Drupal was certainly less complex than my first WordPress theme. If that says anything at all for Drupal then I’m all for it.

Note to self: write another story or an update to Ouroboros.