• Awning Works 1
  • Socaz 2
  • Socaz 1
  • Randy Montana 3
  • Randy Montana 2
  • Randy Montana 1
  • Rodgers & Hammerstein 3
  • Rodgers & Hammerstein 2
  • Rodgers and Hammerstein 1
  • Love Fine Art
  • Oct
  • 10
  • 2011

PHP and MySQL command line with MAMP on OSX

Posted by admin In MAMP, MySQL, PHP, UNIX / LINIX | No Comments »

I found a handy article named

Getting command line access to PHP and MySQL running MAMP on OSX

by  Joaquin Lippincott .

It was very helpful for getting PHP and MySQL acces from the terminal on a mac.

In addition, one of the comments by Matthew Bacon was about getting the ZEND FRAMWORK up and running with the command line. I have copied it here for your convenience. I hope this helps someone.

Posted by Matthew Bacon on

To anyone who is having problems getting Zend_Tool working on their MAC OS X (10.6) in Terminal, this is how to solve the problem.

Step 1

Download the Zend Framework to your downloads folder. Once downloaded, rename the folder ZendFramework

Step 2

Open Terminal and type: sudo cp -r ~/Downloads/ZendFramework /usr/local/ZendFrameworkCli

Step 3

In Terminal, type: open ~/.bash_profile

Note: If file is not found…

Open the application TextEdit. Create a new file and make sure you are typing in plain text only. Type the following: alias zf=/usr/local/ZendFrameworkCli/bin/zf.sh

Save and exit TextEdit

Step 4

In Terminal, type: zf show version

Done!

 

  • Oct
  • 09
  • 2011

MySQL from the Command Line (terminal) in MAMP PRO

Posted by admin In MAMP, MySQL, UNIX / LINIX | No Comments »
MySQL from the Command Line (terminal) in MAMP PRO

To get to the command line for MySQL for MAMP or MAMP PRO just open up you terminal and enter the following:

 
/Applications/MAMP/Library/bin/mysql –host=localhost -uroot -proot

You can see all the databases by using the following command:

mysql command line command show databases

If you type the MySQL command : USE <table name>  you can then start using that particular database.

Another convenient command is SHOW TABLES. Can you figure out what that does?

Now you can type MySQL commands right from the command line.

 
 
 
  • Jan
  • 30
  • 2011

MAMP: Dealing with HUGE MySQL Queries

Posted by admin In MAMP, MySQL, Web Design | No Comments »
MAMP: Dealing with HUGE MySQL Queries

After importing a relativly huge table into my local dev using MAMP, I was experiencing MySQL hangups on large queries that when on a live site would be no problem.

To fix this I made the following adjustments to the MAMP PRO my.cnf  file.

The my.cnf file is edited in MAMP PRO pulldown menu by clicking on  FILE>>Edit Template>>MySQL my.cnf
MAMP my.cnf file edit

Notice starting on line 30 (image below) that I made changes to buffer allowances and memory allowances etc.
Basically just making everything bigger. I could hone this to the “best sizes” but really i don’t have time
and this is just for my local dev so threw some pretty big numbers in there for plenty of elbow room. IF you have any suggestions or have optimized your my.cnf file please feel free to make a comment.

Screen shot 2011-01-30 at 5.33.19 PM

  • Sep
  • 13
  • 2010

Import WordPress Database from Staging Server to Local Development Server

Posted by admin In MAMP, MySQL, WordPress | No Comments »

You may be working with a WordPress project and wish to use SVN to have a development instance, a staging instance, a local development instance and of course a production instance of the web site. This could prove to be problematic in keeping track of your data base instances. WordPress stores the root URL (http://website.com) at several places in their database. This can cause a problem when you try to import a copy of one of the live databases to your local development environment. When ever you click on a link it will send you to the live instance instead of remaining on your local environment. A way around this, for local development environment purposes, would be as follows:

  1. prior to importing the .sql file, open it in your favorite code editor. I like to use BB Edit.
  2. Perform a search and replace on the .sql file for the root url.
  3. ie:  search for “http://www.livestagingserver.com” and replace with “http://mylocaldev.me”
  4. Save the file and import it into your local WordPress data base.

Now whenever you click on your posts in your local development environment the links will stay within your local development environment.
This way, you can keep a local copy of your database so you have a faster and more local way of working. This also serves to keep the live instance of the database from getting contaminated with the residual artifacts of development work.

  • Feb
  • 13
  • 2010

Navicat Connetion with MAMP Pro

Posted by admin In Drupal 6 & Drupal 7, MAMP, MySQL | No Comments »
Navicat Connetion with MAMP Pro

MAMP Pro has a lot of nice features. However, this means it changes things up a bit. How you make a connection with Navicat is one such example. So here is a quick helper post get Navicat up and running with MAMP PRo.

1) Add your information to the “Connection Properties” Pane as you normally would.

Navicat Pane -General

2) Click on the “Advanced” pane and check the box next to “Use socket for localhost connection.”

3) Then for the “Socket File Path” field type the following path.

/Applications/MAMP/tmp/mysql/mysql.sock

The “Advanced” Pane should now look like this:

Navicat Advanced Pane

Click “OK” and you should be all set.

Navicat Connection Sucessfull

I hope this helps. Please feel free to make comments.

  • Sep
  • 25
  • 2009

Schema Data Structure Documentation in Drupal

I have been working on a project on the Drupal 6 platform that requires the web application to recognize dynamically created sub-domains so the functionality of the database can be adjusted according to what sub-domain is in the current URL.

To get Drupal 6 to do this, I am creating a custom module. One of the things I have learned about creating a custom module in Drupal 6 is the implementation of the module’s “install” file.

If you create a module named say,  my_module.module then the module’s install file name would be  my_module.install and will reside in the directory named my_module located at….

my_site/sites/all/modules/my_module

Drupal 6 Module Install File Documentation

The  .install file will be run by Drupal 6 the 1st time my_module has been enabled. The my_module.install file will then be used to run setup procedures as stipulated by your module. The most common task for the my_module.install file to perform is creating database tables and fields. There is no special syntax for the install file. It is simply a PHP file with a .install extension to properly identify it to the Drupal 6 platform.

There is special function used in the .install file called hook_schema(). Where hook would be replaced by the name of your module. For example, if  the module you create is named my_module, then you would create a PHP file and name it my_module.install. Inside that file you will create a function named  my_module_schema(). The my_module_schema() function is used to create arrays representingthe database tables you wish the module to create in the Drupal database. You can see how this works here.

Why do it this way?

Once you build the Drupal API Schema there is no more need for  separate CREATE TABLE or ALTER TABLE statements on each database. As a module developer, you only need to create a schema structure and/or use the Drupal Schema API functions, and Drupal takes care of the rest. This greatly simplifies  writing install and update functions.

This way of creating the module install files also allows for support in multiple database platforms.

According to Drupal’s Blog this also allows for “Several advanced capabilities, such as incremental database updates, a simple and consistent CRUD API, form scaffolding, simpler CCK and Views, schema and data validation, become much easier to implement in future enhancements.”

Schema Data Structure Documentation by Drupal

  • Jul
  • 03
  • 2009

Screen shot of the up and comming CPI Data Panel

Posted by admin In AJAX, CSS, MySQL, Web Design | No Comments »
Screen shot of the up and comming CPI Data Panel

I havn’t posted in few weeks because I have been very busy with several projects. One of the projects I am particularly excited about the CPI panel. The Cpi panel is new “back end” for LoveFineArt.com. IT used to be that each and every product would take about 20 minuets to enter. With this new panel (incorperating secure AJAX), The products can be entered as fast as the site owner can type!

Here is a screen shot of the new back end.

Screen shot of the up and comming CPI Data Panel

I have also been busy learning the Drupal platform. AS I become more knowledgeable there will be posts and perhaps a special section on this blog devoted to cool new drupalistic methods and problem solving.

AS always, I invite you to leave a coment or sugestion or critisizm.

  • May
  • 07
  • 2009

How to Protect Against SQL Injection

Posted by admin In AJAX, How To, MySQL, PHP, Web Security | No Comments »
How to Protect Against SQL Injection

One of the most common web security problems is SQL Injection. As the name implies, SQL injections works by introducing malicious SQL code where it doesn’t belong. Since it is SQL code you could probably guess that the attacker “injects” his poison via database queries. Web developers often pass some sort of variable to their database queries. Very common are variables that are influenced by user input. User input, to variable, then to query,- get it? So, there is a need for a way of eliminating the user’s ability to manipulate the variable in any way that could effect the query.

What Happens With SQL Injection

By passing an unexpected string of code into a user input, such a form, an attacker send damaging code that causes an otherwise good query to go haywire. For example:

Flickr Stream