Yearly Archives: 2011


windows 7 command line switch drives

In command prompt we can switch from one drive to another drive by just typing the drive letter name suffixed with the character ‘:’

For example if you are working in C: drive and if you want to switch to E: drive just type ‘E:’ at command prompt and press ‘Enter‘.


How to import a delimited file with mysql

Using Mac OS X on the command line, log into mysql and select your database. Then run the following for a tab delimited file located on your desktop:

load data LOCAL infile ‘/Users/YOURNAME/Desktop/standards.txt’ into table TABLE_NAME fields terminated by “\t” lines terminated by “\r”


Cloning an array with JavaScript

I had a need to clone an array with JavaScript. There appears to be a number of different ways to do it, including writing your own function. All of these solutions below will just create a reference to the original array:

var newArray = myArray.slice(0);
var newArray = myArray.concat([]);
var newArray = clone(myArray);

A popular answer using jQuery is the following:

var newArray = jQuery.extend(true, {}, myArray);

However, this solution will return an object and you cannot get the length of an object like you can an array.

To return an array, we change the curly braces to square brackets like so:

var newArray = jQuery.extend(true, [], myArray);

This is the solution that works.


PHP and Web Development Tutor in Minneapolis Minnesota

I have a bachelor’s in Management Information Systems and have been a full time professional web developer since 2004. I have experience leading a team of web developer’s with a focus on creating a learning environment. Through my years of web development I’ve accumulated a variety of related skills including html, css, javascript, xml, seo, php, and sql to name a few.

Previously in my career I built a successful ecommerce business and grew it for over five years, then sold it in 2011. I have first hand knowledge of all areas of running an online business from sourcing a distributor / drop shipper, coding the website, search engine optimization, online marketing and advertising, payment and checkout, and customer retainment.

New to web development? I’ll show you the basics from first principles. Need help with a programming class? We’ll work through your assignments, the book problems and exercises and I’ll fill in all the gaps your professor didn’t. Want to make the leap from book exercises to making a great looking website following best practices? It’s a big one, and together we can do it.

I would love to work with you and help you in any way I can, and I look forward to hearing from you! Please contact me to set something up. I can do remote tutoring over skype if you’d like.


How to use date on google scatter chart 2

The google visualization api limits you to using numeric values for both the X and Y axis, but there is a trick you can do with the google image chart api to covert the value to a date as below. Use JavaScript’s Date() object for the conversion. It would be nice if we could just specify the column as a string like data.addColumn(‘string’, ‘Date’), but the chart still will not accept the string. It will accept a date object though. The next task is to format the date string, it appears google accounts for with the google.visualization.DateFormat method, but it does not work. In the end, I had to accept the formatting provided by the chart of “15 Nov 2011” as the format for a “datetime” column, which looked better than the format displayed for a “date” column.

    var data = new google.visualization.DataTable();
    data.addColumn('datetime', 'Date');
    data.addColumn('number', 'Quantity');
    data.addRow([new Date(2011, 0, 1), 10])
    data.addRow([new Date(2011, 1, 1), 15])
    data.addRow([new Date(2011, 2, 1), 12])
    data.addRow([new Date(2011, 3, 1), 18])
    data.addRow([new Date(2011, 4, 1), 17])
    data.addRow([new Date(2011, 5, 1), 19])
    data.addRow([new Date(2011, 6, 1), 25])
    data.addRow([new Date(2011, 7, 1), 18])
    data.addRow([new Date(2011, 8, 1), 24])
    data.addRow([new Date(2011, 9, 1), 28])
    data.addRow([new Date(2011, 10, 1), 27])
    data.addRow([new Date(2011, 11, 1), 34])
 
 
    // Create and draw the visualization.
    var chart = new google.visualization.ScatterChart(
        document.getElementById('chart'));
    chart.draw(data, {title: 'Test',
                      width: 600, height: 400,
                      vAxis: {title: "cr"},
                      hAxis: {title: "time"}
                      }
              );