Home

About

Photos

FAQ

Blog

Posts Tagged ‘Random’

Random Handstands with MySQL and CSS Fix

Random Handstands

Well, it turns out that the “Random” handstands you see on the right were actually not all that random. They weren’t showing any from my roadtrip or beyond which was puzzling. I still don’t know exactly why that code didn’t work, but I have some that does now, which is less efficient (but works)!

For anyone who is a MySQL guru, I wanted to determine the MAX id, and then generate a random id off of that. Then using that id, retrieve the information.

I accomplish it by making 2 calls now:

  • Call 1 (Getting a Random id):

    • SELECT FLOOR(MAX(id) * RAND()) FROM `$this->table` LIMIT 1
  • Call 2 (Getting the properties out for that id):
    • SELECT `id`, `title`, `description`, `small` FROM `$this->table` WHERE id = $rand_id ORDER BY id LIMIT 1

How do I make a query that works in one shot, but accomplishes the same thing?

CSS Fix

My About page was looking messed up as the footer came up and swallowed the entire page. I ended up fixing that thankfully though too. Yay for fixes!


Did you know?

Milepost 159.15 is where the chesapeake bay watershed ends on I-81.


Foreign Affairs

What is foreignaffairs.us? Exit 213B on I-81. I would guess an auto shop?


On my route to Greenville,

On my route to Greenville, SC via I-81, I pass Greenville, VA | Blacksburg,VA | Blacksburg, SC | Greenville, SC. Whoa.


My co-workers are cool

I thought this was pretty funny, haha.


Zach:
awesome
i am just printing something random to the console and it works

Me:
TIGHT
you are a GOD

Zach:
lol, i made alot of mistakes, like the dinosaurs

Me:
LOL

Zach:
but least i turned em into oil


Coffee?

Working from Kristen’s place poses one problem… No coffee.

No problem. I’ve got grounds and filters, and I can make hot water.

Our Yosemite backpacking trip was even more “ghetto-fied” where we used a mosquito head net as a coffee strainer.


Let me out!

Soo, I rode my bike over to the Tee Hangars today to take some more pictures. They turned out pretty well as can be seen below :-) However… I think the gate is activated by weight when a car pulls up to it and I was not heavy enough. So… I broke out of the airport by scaling the fence, and then used my access card to open the gate and rescue my bike and backpack.


Cessna 150 Cockpit

Piper Cherokee HDR