• Feb
  • 14
  • 2014

SSL for MAMP PRO

Posted by admin In Apache, How To, MAMP | No Comments »

I found a few useful post that may help for setting up SSL (https) for MAMP PRO

Something that was not clear to me is to do the steps outlined here.

Open MAMP Pro.

  1. In Server Tab Make Sure Your HTTP Port is 80 and HTTPS Port is 443
  2. Click on Hosts Tab
  3. Click On Plus Arrow for add new host.
  4. Add 127.0.0.1 As Hostname
  5. Click SSL Enable
  6. Select Directory Where is your htdocs or websites folder
  7. Click on SSL Tab
  8. Create Self Signed Certificate By Button Below.
  9. Then it will ask for save location after save it will select certificate auto.
  10. Restart your MAMP Server.

Then, after that I setup a SEPARATE host with the host name I want (as opposed to 127.0.0.1) and set it up in with the files in the same location. Then it worked.

http://tommcfarlin.com/enable-ssl-in-mamp/

http://stackoverflow.com/questions/6318467/configuring-mamp-for-ssl

  • Dec
  • 06
  • 2013

Git, How to Cherry Pick

Posted by admin In Drupal 6 & Drupal 7, Git, How To | No Comments »

When maintaining a team of developers and keeping track of all the code changes it is important to be able to select pieces of functionality that you can include and exclude at will.

This will allow one to manage the progress of a project better.

At times you may need to go back in the history of the repository and select a single commit or two and re-commit them in your current branch.

Git makes this pretty easy with git cherry-pick

Here is one way to do it:

$ git cherry-pick bB07Q8b
Finished one cherry-pick.
[master]: created bB07Q8b: "Some previous commit comment."
 7 files changed, 63 insertions(+), 3 deletions(-)
 create mode 100644 lib/tribble/task.rb
  • Sep
  • 27
  • 2013

Linux: Which command

Posted by admin In How To, LINIX, Web Design | No Comments »

The “which” command will reveal the absolute path of the executable file called when issuing a command.

The linux which command is useful in determining if you may need to add a path to your $PATH variable in your ~/.profile file in order to be able to issue the command.


promt$>which php
/usr/bin/php

promt$>which wget
/usr/bin/wget

The above example echos out the path. It is possible that there are more than one pathh to the executable file in the $PATH variable.
If you want to echo out ALL the paths in the $PATH variable, then use the -a flag (option)

  • Sep
  • 23
  • 2013

Linux Find Command: Searching Within a Directory

Posted by admin In How To, LINIX, Web Design | No Comments »

The Linux find command starts looking wherever you tell it to. This Post is about how to tell it where to start looking for the files you specify when you type out the rest of the find command line.
Specifying the directory is as simple as typing it immediately after the word find, like this:

( in this example we look for a filed named “foo” )

find /some/directory -name foo

You can limit how deep into the sub directories the linux find command searches by using the maxdepth flag. :

find /some/directory -name foo -maxdepth 5

You can tell the linux find command how deep into the sub directories to start searching as well (-mindepth flag).

find /some/directory -name foo -mindepth 3

Its no problem to specify both how deep into a sub directory to start searching with find and also how far down the directory tree you wish to search by using both flags, like this:

find /some/directory -name foo -mindepth 3 -maxdepth 5
  • Sep
  • 19
  • 2013

Linux Find Command: Locate Files and Change File Owner

Posted by admin In How To, LINIX | No Comments »

Ever need to change file permissions on files that are scattered who know’s where up under some directory?
Here is a great command to not only change the file permissions, but also take the work out of locating the files you need to change the permissions on.

The find command is a very powerful tool for not only finding files but also for executing commands on the found files on the fly!

In this example we will use the find command and its powerful parameters to locate files and change their ownership.

You will need sudo permissions to do this. Remember, with great power comes responsibility. Be very careful that what you are doing is what you want to be doing. There is not “undo button”. Although, if you use the -print flag you may at least have a record of what files you effected so that you can manually undo your last command.

OK so here is the command:


sudo find  -type f -user mrfoo -print -exec chown mrbar:bargroup {} \;

The above command translates to: “Find, by looking for files (-type f ) in a directory named /the/path/to/some/directory/to/look/in/, files owned by the user “mrfoo”, print a list of the found files with path (-print), then execute the command “chown mrbar:bargroup (on each found file as indicated by the curly brackets {}).” (Notice the escaped semicolon for the end of the command).

Now there is no need to go looking fall all the files in a given directory to change their file owner. This command works for sever other command as well. I recommend you look up the man page for find and start getting familiar with this powerful command line tool.

  • May
  • 10
  • 2013

DOMDocument and XPath in a Drupal Module to Alter Links

I found this article by Artem Russakovskii very useful in working out the bugs for this module.

More to come on this article. In the mean time check out Artem’s
SmartDOMDocument – A Smarter PHP DOMDocument Class

  • Nov
  • 16
  • 2012

Be Careful When Adding a Custom Field in NetSuite

Posted by admin In How To, NetSuite | No Comments »

You may have reason to add a custom field in NetSuite. A caution to take in NetSuite is not to add the field to ALL forms as this may adversely effect others in your NetSuite team.
Here is a simple way to prevent this from happening:

  1. Once you have entered the appropriate data to create your new field, click on the little arrow to the right of the save button.
  2. You will see a drop-down. Select ‘save & applay to forms’.
  3. In the resulting list of forms, click the ‘un-check all’ button.
  4. Then go through and select the forms that you want this field to show up on.

In this way you can be sure to prevent disrupting the work-flow of others on your NetSuite team.

  • Sep
  • 09
  • 2012

How to Set Up MySQL Workbench on a MAMP Server

Posted by admin In How To, MAMP, MySQL, Web Design | 2 Comments »

My main reason for using MySQL Workbench, at least for now, is for the really cool Data Modeling tools.
It a bit of a pain to MySQL Workbench up for MAMP, though. To set mySQL workbench up for MAMP, I found the following to work after scouring the internet and finding this simple to the point post at chrischarlton.us. I am sharing it again in this post to make finding help a bit easier for myself and others.

In the right side pane of the Front panel click “New Server Instance”.
The choose “localhost” and click Continue.
Even if the “Testing the Database Connection” tests all fail, click Continue.
The for Operating System & MySQL Package: Choose “Mac OS X”.
For the Testing Host Machine Settings: Even if the tests all fail, again, click Continue.
Check the “Change Parameters” checkbox and click Continue.
Update – the path to Configuration File: /Applications/MAMP/tmp/mysql/mysql.sock,
Note that both click “Check Path” then click “Check Name” – should pass.
here are the commands to start & stop MySQL respectively:
start: /Applications/MAMP/bin/startMysql.sh
stop: /Applications/MAMP/bin/stopMysql.sh
You may or may not need to check the elevated privileges checkbox.
Server Instance Name: MAMP@localhost (or whatever you want)

Im not sure why, exactly, but I had to do this a few times before I could get it to work. You may also need to restart your MAMP server. I hope this helps.

  • Jul
  • 05
  • 2012

How to Export a Large MySQL Table on MAMP to a CSV File

Posted by admin In How To, LINIX, MAMP, MySQL, Web Design | No Comments »

You many need to export a data base table that is larger than phpMyAdmin’s maximum allowed size (in the export table tab). An easy way to do this by using the terminal.
I have provided a simple example below for MAMP users like me. This information is based on a blog post I found on how to export mysql data to a csv file I hope this makes someone’s day a little easier.

 
/Applications/MAMP/Library/bin/mysql -u username -ppassword NameOfDatabase -B -e "SELECT * FROM tablename;" >  '/path/to/file.csv'

The above code creates a TAB delimited file. You may want to use grep to convert the tabs to ;(semi colons).
I use semi-colons because there are often commas within the actual data.
Remember that in whatever text editor you are using to make sure it is using UNIX line returns.

  • Feb
  • 16
  • 2012

Drupal 7: How To Create a Views View from Within a Module (default view)

The whole idea in making a module is to make it, well ‘modular’, right? The person who is going to install the module should not have to create and configure a view. Chances are they would not get it just right anyway (you know, with all the exact settings the module depends upon). This is because the Views UI is so versatile that no two people are likely to set it up the exact same way. In many cases, if a module depends on data from a view, all the Views setting need to be just so in order for the module to work its magic.

Although this is very doable, I found it very difficult to locate documentation spelling out just how to do it. I’m not sure if it was not documented in a way that was easy to find or if it was the fact that I had a 3-day headache pounding away. Either way, I did finally come across a few links.

techcommons.stanford.edu

Drupal API

To give myself and others one more place to stumble upon what to do I have documented how to create a Views default view from within a module below. A default Views view is a view that weather enabled or not shows up on the /admin/structure/views page once a module is installed and enabled.

For the purpose of these notes we will call our module, ‘mymodule’. Everywhere you see ‘mymodule’ you need to replace with the name of your actual module name. This article assumes that you are familiar with module development basics and that you have already created your basic module files ( mymodule/mymodule.module, mymodule/mymodule.install & mymodule/mymodule.info ).

OK, let’s create a default view in a module!

Create a new file named mymodule.views_default.inc and save it into a directory named mymodule/includes/.

Inside the file you just created, paste the following function…

23
24
25
26
27
28
29
30
31
32
/**
 * Implementation of hook_views_default_views().
 */
function mymodule_views_default_views() {
 
  //PASTE EXPORTED VIEW CODE HERE
 
  $views[$view->name] = $view;
  return $views;
}

You can now create a View in the Views UI as you normally would.
Then export the view. Select the entire export text as presented in the textarea of the export result and past it in place of where you see “PASTE EXPORTED VIEW CODE HERE” inside the function you just made and save the file.

OK, next, inside the file your mymodule.module file, paste the following function (remember that everywhere you see ‘mymodule’ you need to replace with the name of your actual module name.).

47
48
49
50
51
52
53
54
55
/**
* Implementation of hook_views_api().
*/
function mymodule_views_api() {
  return array(
    'api' => 3.0,
    'path' => drupal_get_path('module', 'mymodule') .'/includes'
  );
}

Now you can clear your cache and see the default View you just created in the list of default views at ‘admin/structure/views’

Please feel free to register and comment.

Flickr Stream