Tuesday, November 11, 2014

Tuesday, August 12, 2014

Why you should use <colgroup> to assign classes to columns

I recently stumbled upon a bug that had me baffled for a while. I had a simple label input table with the labels set to 15% width and the inputs set to 85% width. I added a class to each <td> to set the width. Everything was working great. Until it wasn't.

I noticed the columns were both at 50%. The css was still set correctly. So I started undoing my changes one by one to see what the affecting code was.

Turns out I had added a <tr> to the top of the table with colspan="2" not knowing that would affect the width of each column.

I wanted to keep that column at the top so I added a <colgroup> with the classes on each <col> instead of each <td> and voilà. Everything went back to normal.

Conclusion: When setting column classes on a table use <colgroup>

UPDATE:
I found out that only certain css properties work on <colgroups>
http://stackoverflow.com/questions/1238115/using-text-align-center-in-colgroup

So my solution is to use classes on <colgroup>s and <td>s

Friday, July 18, 2014

<colgroup>

in HTML you can specify a colgroup element to style each column instead of setting a class for each cell

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/colgroup

Sunday, June 29, 2014

How to unicycle

I think I can officially say that I can ride a unicycle. I have been practicing on a unicycle for a couple weeks here and there. I finally got to the point where I can ride comfortably for a while. It requires A LOT more leg strength than a bicycle, so right now my longest is about 200 meters, just because my legs started to give out.

Thursday, June 26, 2014

Use bin2hex and unhex as simple sql injection prevention

When it comes to sql injection prevention prepared statement is definitely the correct solution but if you find yourself in a predicament that prevents you from using one hexing and unhexing works.

Use a query like this:
$query = "SELECT * FROM table WHERE column = UNHEX(".bin2hex($userInput).")";

http://stackoverflow.com/questions/22567944/is-hexing-input-sufficient-to-sanitize-sql-queries

Tuesday, May 13, 2014

Monday, May 12, 2014

Search for vendor based on mac address

While trying to fix a duplicate IP address problem on a network I learned that you can search for a vendor given the MAC address.1 Also that Roku devices do not broadcast a net bios name.


1http://www.macvendorlookup.com/

Tuesday, May 6, 2014

Change oil in a boat motor

I was helping my dad get his boat ready for fishing opener and he showed me how to change the oil.
  1. Find the two screws on the side of the motor.
  2. Unscrew the top screw.
  3. Unscrew the bottom screw and stick the new oil tube into the bottom hole fast to prevent oil from spilling out of the bottom hole.
  4. Squeeze the tube until oil comes out of the top hole (water might come out first.)
  5. Take the new oil tube out of the bottom hole and screw in the bottom screw fast to prevent oil from spilling out of the bottom hole.
  6. Top off the oil through the top hole.
  7. Screw in the top screw.
  8. Clean up.
  9. Party!