// home

Latest Post

The valuable value of MySQL NULL

In many programming languages, coders often use NULL or null as an equivalent to the numeric ’0′ (zero) in comparison tests. This normally works out, but it’s worth mentioning that in the database world, ‘NULL’ means something else. To illustrate this, in MySQL we can see that querying NULL returns a string representing the keyword/value [...]

Asides

  • I'm writing this today to relay my tactics for combating insomnia. Please comment if you want to share your tactics! For years, I battled insomnia to the point where I began documenting my trial-and-error approach in an attempt to find what worked for me. Here's the list. 1.) Start a conversation with yourself by saying the following: "This is okay and human. A lot of people go through this and they didn't die or 'go insane'. Nothing bad is going to happen if I stay up all night other than being sleepy." 2.) Take a chewable vitamin-c and drink water until you have the sensation to urinate. Repeat every 4 hours all day. 3.) If you drink caffeinated beverages, stop at noon. No caffeine after noon!!! You need it out of your bloodstream by bedtime. 4.) Just before bedtime, get a notepad and make a list of all the things that are stressing you. 5.) Then make another list of all the things you have to do tomorrow. 6.) Pick up the notepad tomorrow before bed and check off your accomplishments. Repeat steps 4-5. 7.) If you're under stress, use rational thought to ask "What's the worst that would happen?" You'll quickly come the conclusion that even if you "lost" everything that unburdening yourself would actually be a blessing. 8.) Use my patented "fuck it" technique when your head is spinning with anxiety. When each negative thought of worry creeps in, say: "fuck it." Over and over and over. You'll quickly see that worry has no real power over you. 9.) Turn your negative into a positive. Find something that you can do to be productive in the middle of the night. Start writing, sewing, or whatever. Sometimes not lying down is the best thing for falling asleep. Get up and make something. Set out the materials you will need so you aren't scrounging in the middle of the night. Prepare and enjoy the quiet. 10.) Don't dismiss being artificially positive. Congratulate and compliment others as often as possible. The tide of positivity will come back to you in a big way. Oh, and a little "yay me" doesn't hurt either. 11.) Celebrate your own successes with subtle indulgence. After a good day, break your normal routine for 10-15 minutes, go to the park and swing on the swings like a little kid. Why did we ever grow up? 12.) Lying awake in the dark is hell, I know. Don't ask yourself why, instead, try to become physically tired. Get up and do 50 pushups and 50 chair squats. If you're still awake at least you're strengthening your body. 13.) Ask your doctor about trying Relacore PM. This REALLY worked for me. Maybe a little too well. I can only take this once a week because it makes me sleep too much. It lowered my feelings of stress and allowed my body to calm down enough to stay asleep for 7-8 hours. 14.) Keep a sleep calendar. Every time you get up, write down the hours you were able to sleep. 15.) See a psychologist and get over it. Probably 99 out of 100 people you know had childhood drama that now has them seeking answers as adults. This is actually a GOOD sign. Your brain knows there were problems and shelved them. EMDR - Eye Movement Desensitization and Reprocessing is a fantastic therapy that is under-utilized IMHO. ..I've got more, but I'm tired now and going back to sleep… Zzzzzz #
  • Linode is a fantastic cloud provider. #
  • Fear is the enemy of ambition. Anger is the enemy of control. Panic is the enemy of focus. Action is the best friend of luck. #
  • sunlightjs syntax highlighting is fun and awesome. Thanks, Tommy! http://sunlightjs.com/ #
  • Let me preface this post by saying, these are hacks. Neither the best or the only ways to achieve the desired results. But hey, if they work for me, they may work for you. Enjoy! ping -i 10 4.2.2.2 Send a ping request to an IP address once every 10 seconds. Why would I do this? I've noticed that on some wifi connections, I disconnected after so many minutes of inactivity. This keeps my connection active when I'm not. for i in {1..25}; do mysql -u user -ppassword -h some-load-balancer-vip -e "SELECT @@hostname" -s ; done Ask mysqld 25 times what host name it's running for a particular hostname (-h). Why would I do this? If you're calling a real host, then it's not much fun... however, against a Load Balancer VIP, that's another story. It's a down and dirty way to check which hosts are members of a Load Balancer VIP and to see if the balance method is behaving as expected. e.g. if you have 3 mysqld hosts behind a VIP, you should expect to see at least 3 different host names depending on the balance algorithm of the LB. sar -i 1 10 For ten seconds, show system activity every second. echo "722 / 846" | bc -l Use the "bc" command for basic calculations! Or just: echo $((722 / 846)); Do some math in your shell. echo -n "HashMe" | shasum -a 1 The shasum command is a hash one-stop shop. #