Friday, July 11, 2014

Windows System Environment Variables

Windows System Environment Variables

 This drive me nuts especially PATH, well mostly when a program does not add the paths it requires. So what do you do you add the path yourself but then you realize i have to restart for this to work. Well i found a small work around from a command prompt SET PATH=%PATH%;C:\CmdShortcuts. It does not work every time but it has save me from a lot of reboots. I figure you can do this with every environment variable.

Thursday, June 5, 2014

All lowercase table names MySQL

Lowercase table names in MySQL

I started working on a project that I do not spend much time on. Right now I am forced to use  windows. This database I created 9 years ago uses camel case I.G. customerNetworks, So I imported this into my local database and something strange happened, all my tables are lower case I.G. customernetworks. This really bugged me. The table calls could be case insensitive. So I pushed on to meet my deadline, When I went to roll out the code, I found case sensitive bugs in my code. To make a long story short, even if you are a *nix person or not, when you write code/databases you need to think about everyone that is going to use it and use "customer_networks" instead of  "customerNetworks". 

NOTES: If you have to use a database that has camel case here is a article for you http://stackoverflow.com/questions/6248735/how-to-force-case-sensitive-table-names

Wednesday, May 7, 2014

How to get the viewport height using javascript

How to get the viewport height using javascript.

Ok let me give you some background on what i have been dealing with. with fancybox you can set the height and width. This is good because fancy box itself does not do a great job on pages with long documents. Fancybox was putting the iframe about halfway down the screen and much longer then the clients view port. This made it very cumbersome to use the document that was pulled up.

Things i have tried

// This gives you the entire height of the document.
jQuery(window).height;
// This also gives you the entire height of the document.
jQuery(document).height;

The Fix

// This will give you the viewPort size of the clients window
// In mine i minus 70 pixels from the default height and that was the fix
document.body.clientHeight;

Please comment if you know a better way of doing this!!