• 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
  • 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 | No 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

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.

  • Feb
  • 15
  • 2012

Drupal 7: How to Make a Drupal Theme Function in a Module

This is intended as a simple reminder for all of those out there who find making a drupal theme a bit confusing at times.
There are three main steps that all work together.

1) hook_theme which adds an array of callbacks and their arguments to the theme registry. You need to put this in your sites/all/modules/mymodule/mymodule.module file to rebuild the theme registry before it would be added.

23
24
25
26
27
28
29
30
31
32
33
function mymodule_theme($existing, $type, $theme, $path) {
  $theme = array(
    // This is in the mymodule.module file.
    // example theme template register
    // for sites/all/modules/mymodule/templates/mymodule_theme_name.tpl.php
    'mymodule_theme_function_name' => array(
        'variables' => array('node' => NULL, $param2 =>NULL),
        'type' => 'module',
       ),  
  return $theme;
}// function

2) The themable function itself which starts with theme_ followed by the function name that was added to the registry with hook_theme

45
46
47
48
49
50
51
52
// The $vars paramiter is an array of passed 
// variables corresponding to the 'variables' 
// key in the the above hook_theme() function.
function theme_mymodule_theme_function_name( $vars ){
... code here ...
// Return a string that contains the rendered representation of the data.
 return $output; 
}//function

3) Then call the function,

52
 theme('mymodule_theme_function_name', $whatever_argument );

which actually calls the function.

It is important to remember all three of these or the theme will not work.

  • Jan
  • 30
  • 2012

DRUPAL 7: How to Expose a Field in Views

DRUPAL 7: How to Expose a Field in Views

The other day when trying to expose a Filter criteria in a view of the Views module 7.x-3.1, I was frustrated by the fact that it would not function despite my best efforts. After triple checking my set up and reading a lot of documentation, there was no fix. Finally, after digging deep into some threads by a person having the same frustration with Views in Drupal 7 and exposed filters, I found the simple, although illusive, solution.

In the VIEWS UI, open the “ADVANCED” section and look under the “OTHER” subsection. Find the item “Use AJAX” and set the value to yes. I know, I know, (pause, make face) – right? Well, the guy on the thread that helped me complained enough about it so I’ll just keep my mouth shut.

I hope that if you were having this problem you found my post faster than I found that thread. : )

As, always, feel free to comment and make suggestions.

select yes for use ajax

  • Jan
  • 24
  • 2012

Drupal 7 Calendar New Interface Set Up (in Views)

I found this very helpful video by Arlin Sandbulte on the
Drupal Calendar version 7.3 configuration (Calendar 7.x-3.x-dev).

The interface on this Calendar is quite different than what is shown in other slightly older videos.

The new video for Drupal 7 Calendar New Interface Set Up.

  • Jan
  • 13
  • 2012

Mac OS: How to Change Screen Shot Save Folder

Posted by admin In How To | No Comments »

First of all, a big “thank you” to the author at snowleopardtips.net who wrote “Everything you need to know about customizing screen captures“! This very helpful article cut through the chase and made changing the screen shot folder easy.

OK, so here is the “How To”:

1) open your terminal and enter the following line. Note:The default location for screenshots is ~/Desktop.

    defaults write com.apple.screencapture location <your new path ie ~/screenshots>

2) Reset the System UI Server so you can see the change.

    killall SystemUIServer
  • Jan
  • 06
  • 2012

HTML5: How to Make a datalist for a Form Field Input Element

Isn’t it nice when web developers make it easy for end users to fill out a form? One way to make for a pleasant user experience is to offer suggestions on a form’s input field. HTML5 now has a cool feature that makes this easier for the developers too!

The HTML5 datalist element provides an “autocomplete” feature on form elements. With it, you can provide a list of predefined options to the user as they input data.

Now, when a user is entering some text into a text field, a list can drop down with pre-filled values for them to choose from.

How to Make a datalist for a Form Field Input Element
The datalist tag was introduced in HTML 5.

Use the ID of the datalist tag to associate it with the appropriate input.
For example, if the datalist tag has an id=”myDataList”, then the list attribute of the input element will look like this: list=”myDataList”.

You can fill the datalist element by nesting option tags inside the datalist tag. Here is an example of the code for the HTML5 datalist element:

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<p>
<label>
  Enter your favorite Star Trek character:<br />
<input type="text" name="favCharacter" list="myDataList">
<datalist id="myDataList">
 <option value="Captain Kirk">
 <option value="Spock">
 <option value="Bones">
 <option value="Scotty">
 <option value="Sulu">
 <option value="Chekov">
 <option value="Uhura">
 <option value="Jean-Luc Picard">
 <option value="Data">
 <option value="Geordi La Forge">
 <option value="Worf">
</datalist>
</label>
</p>


OK, so now you know. Go be nice to your users with the HTML5 tag!

Flickr Stream