Check for Valid Date with PHP

I stumbled on this handy function this morning when putting together a form that required a valid date (example: 02/30/2011 would not be valid because there are not 30 days in February). Very simple and useful!

checkdate ( int $month , int $day , int $year )

Checks the validity of the date formed by the arguments. A date is considered valid if each parameter is properly defined.

Documentation: http://php.net/manual/en/function.checkdate.php

Show Disk Space Usage (Sorted)

Every once and awhile I find myself needed to what is the space hog on my computer/server. While the command du – h in the command line works for a general overview – I really want to see the results in descending order (by space used). This command will list out everything in descending order so you can quickly see where the most space is used:


du -k -s * | sort -k1 -g -r

The Delicate Balance of Parenting

I love my kids more than I ever thought possible. Once and awhile everything fits together nicely and you feel like you everything is in balance. Most days however there is a constant multi-dimensional game of tug of war going on with both parents over how to do x, y, and z with the kids.

For an example – let’s talk about a problem for most parents…listening. If the child is not listening, what do you do? Do you talk to them about the importance of listening, ask them to politely listen, give them multiple chances to listen (repeating their name over and over until they listen), give them positive reinforcement? Or do you raise your voice and/or give them a consequence if they do not listen?

While one parent generally believe in one way to accomplish getting the child to listen – they are usually not on the same page as the other parent. Not only do you have a strike a balance of consequences (bad/good) you also have to strike a balance between you and the other parent (assuming there is another parent). This is not only very delicate but also very exhausting. Finding this balance seems to be something that goes on just about everyday in my household – especially with three kids under the age of five and two adults who are both stubborn and non-pushovers.

We struggle to find a good balance on how to deal with certain situations (like listening) but at the end of the day – we try and find a common voice so we do not confuse the kids. I might not necessarily agree with the options put forth or the method of trying to correct the child’s behavior but I can always live with that. It is also understood if those options or methods do not work – we can try it another way at a later date. Overall – it is important to show the child you are in control and agree with the other parent at least on some level.

Real life example: this past weekend my oldest son was not behaving as we expected. We had been trying to give him positive feedback, had a sticker chart for him, and had clearly defined good behaviors which would result in a reward once the sticker chart was full. No voice raising, time outs, etc. Everything appeared to be going well until Saturday when Evan mis-behaved at soccer. I ended up taking a harder approach to curbing bad behavior by raising my voice (not in public), not giving him multiple chances, etc. While we – the parents – were not in total agreement on this, both of us realized the positive feedback was not the end all approach and was clearly not working and it was time to shift gears. We – as the parents – discussed ways of handling this and at the end of the weekend – although I was being more vocal and less patience of Evan – he stuck to me like glue and wanted to be with me, play with me, and wanted my input on more than usual. This was not expected and I think we feared it would be the opposite but it goes to show you kids respond differently to different parenting styles. Finding that balance is key.

Protect Your Email Address

In a moment of weakness I gave someone (that I would not normally) my email address. As soon as I got off the phone with them – the spam started rolling in and I kicked myself. Word to the wise – if you have any inkling at all that someone will sell your email address or add you to some crazy list – give them an alternative email address so you can tell who exactly is spamming you. You can then filter those (fi you want to read them) or ignore them. I just kicked myself again…and again.

Sample Video Files

There usually comes a time when working on a project where I need to show the client how a particular video plugin works. I sometimes will do a quick Google search to find a sample video file to put in – but today when searching for a “sample MP4 video” – I found something extremely helpful: QuickTime: Sample files. There are sample files in the following format to use:

  • H.264 (for iPod models with video capability)
  • Animation
  • MPEG-4
  • 3GPP
  • 3GPP2
  • MPEG 2
  • Sorenson

Thanks Apple for making these available. My search for sample video content just got a lot easier!

Gentle Reminder: Check Your Backups

Every once and awhile I make sure to check to make sure my backups are in place, sufficient, and running. It is also a good idea to go through a restore once and awhile too to make sure you know how to actually do a restore and also so you know that the process you have in place actually works.

If you do not have a backup system in place – there is no excuse. Stop what you are doing and at least take a look at something like Jungle Disk. You can easily backup your data (automatically) online for a cost that that is worth every penny.

Seriously – stop what you are doing and take 5 minutes to think or re-think about your backups.

When Designing – Use Real Content

There are many lessons to learn out there as a designer, and please let this be at the top of your list: when designing something – whether it be a business card, a brochure, or a web site – use real content.

Lately – when doing any design work for a client – we always make sure they provide us with actual content so they can see their content in a working design. Often clients will see another site they like – want you to use similar ideas – but in actuality – their content is completely different or would not work. (We see this a lot). When working with clients who have their own designers or some pre-designed mockups – we always allot for more time – as there are bound to be changes because the designer only showed a few items (which in reality is a lot of items) – and then the client does not like the layout of their “real content”.

If the client does not have real content – red flags should go up. Not only are you setting yourself up for a potentially longer than expected engagement (if they do not know what their actual content is – do they really even know what they want anything to look like?) – but a lot of changes and headaches will follow. If they provide the content up front – everyone’s expectations are set right away and the end result will match the design. No questions/confusion.

In conclusion – save yourself a lot of time, frustration, and potentially endless change cycles by making the client provide real content for your designs.

Time to Reconnect and Disconnect

A few months ago I closed my Facebook account in order to try and stop wasting so much time on my computer/iPad/iPhone looking at my friend’s and family’s daily statuses, game play activity, and other garbage that got fed to me. Since then – I have not looked back and have been enjoying more quality time actually talking to people and not reading about them. I am more and more people are doing the same thing and actually enjoying turning their phone off, not using Facebook, and not being tied down to Twitter.

I commend them as it is really nice to spend the time – once checking out who was getting new crops in Farmville – actually picking up the phone and talking with someone or going and doing something with friends and family. Take one day or a weekend and every time you want to check out Facebook – actually call someone. You will find it is much more enjoyable. Seriously – do you really care if person x you sort of knew a few years back is taking a walk? Time is too precious!

Check out:

Which WordPress Caching Plugin Is Right For You?

Most people can agree on one thing: they want their site to load faster. With a number of WordPress caching plugins now available – it is nice to see someone that did a comparison between the top contenders: http://www.tutorial9.net/web-tutorials/wordpress-caching-whats-the-best-caching-plugin/.

Remember – your results will vary based on your hosting environment, your theme, your plugins, etc.