Blog

  • My First Node Application

    I have the unique pleasure of being a technical reviewer for an upcoming book by a former co-worker of mine.  Since it will be his second book on Node (his first being a co-author of Node Up and Running), I thought I should probably get a feel for using Node.  I’ve of course read some of the documentation and have a thorough understand of JavaScript already, as well as event driven programming – working on some very large MMO projects.

    I thought I would share how easy it is to really and truly get up and running with Node.

    (more…)

  • Mysql: Insert or Update in One SQL Statement

    I must say, I really wish I knew about this technique years ago – before I started using frameworks to do a lot of my development.  The effort that was wasted in building separate code and separate logic to deal with inserts vs updates, when all of this time, there is a nice and simple feature built-in to Mysql that does this for us…

    (more…)

  • Regular Expressions with Mysql

    I must admit, this is something that I’ve never done until just recently; creating a regular expression in Mysql.  I’ve typically been able to accomplish whatever I wanted to with a LIKE statement or some server-side code.

    However, just recently I updated the plugin I use to output sample code.  I was previously using a syntax of [codesyntax lang=”php”] and now I needed to change it simply be [code].  This wasn’t that simple since I’ve done hundreds of blogs with several different languages.  In searching I had over 15 distinct differences – hence, regular expressions to the rescue!

    (more…)

  • Mysql Uptime Check Script

    I’ve been pretty vocal recently over my move to Amazon EC2 and switching to LEMP stack and then switch to a LEPP stack.  This has certainly seen some great improvements in speed, traffic, and Google indexing.  Unfortunately as many of you may know who run their own dedicated server, it’s not all white sandy beaches and beautiful sunsets!  When something goes wrong, it’s up to you to fix it.

    So far the only issue that I see keep cropping up is my Mysql database seems to crash every several days.  From what I can see, it appears to be a lack of memory issue – it appears my EC2 server is just shy on a bit of memory.

    At this point, I don’t think it’s worth upgrading; instead I’ve built a simple Mysql uptime script that will ensure it’s always running for me.

    (more…)

  • Renaming a Database in Mysql

    Unfortunately – and probably for good reason – the RENAME DATABASE command had a short life in Mysql for safety precaution reasons.

    After doing some research, it appears that the best approach is as follows as it works well for both MyISAM and InnoDB table types:

    1. Create new database
    2. Perform RENAME TABLE command that includes the table and database from the old one to the newly created database
    3. Repeat once for each table

    In all of the examples I didn’t find an automated script – time to make one I thought!

    (more…)