western willow ventures inc.

eye on the net
  • Services offered
  • Contact
  • Art
  • Fun
  • ARDi
  • Terms of Service
  • Privacy
  • Home

Search

Comments/Feedback

If you have comments or thoughts about my blog, you can contact me at my lab here:
http://lab.westernwillow.com/contact

Home | Blogs

Franco's blog

Easy exporting of Drupal 7 custom fields for use in module code.

Fri, 2013-05-17 16:49 |  Franco

ok, down and dirty, you need the devel module installed and working, but this code will produce two arrays you can paste into your :

_my_module_installed_fields() and _my_module_installed_instances()
Functions.

eg:

/**
* Returns a structured array defining the fields created by this content type.
*
* @return
*  An associative array specifying the fields we wish to add to our
*  new node type.
*/
function _my_custom_module_installed_fields() {
  $t = get_t();
  PASTE GENERATED CODE HERE
}

Read more
Login to post comments |  15 reads |  Tags: coding, Devel, Drupal 7, Exports, Fields, php, Programming

Midnight Commander on OS-X

Sat, 2013-03-30 10:40 |  Franco

As a die hard terminal man, I have found my Macbook Pro to be a pain because of my linux habits. I found myself asking; How do i select files and access the menu in Midnight Commander on OS-X

Google is my friend :)

On a Mac the insert key may be triggered by the <ctrl>+<t> shortcut. So you may use this key combination to select files in the Midnight Commander.

When using this Norton Commander clone, you may also want to access the menu. But the function keys are preassigned to OS-X functions. So how do you get them to work with Midnight Commander?

Read more
Login to post comments |  142 reads |  Tags: Macbook Pro, MC, OS-X, Terminal

Get lists of NIDs from DB filtering by fields without having to do joins - Hello "Entity Field Query"

Thu, 2013-03-28 16:50 |  Franco

New with D7 is the Entity Field Query. Use it like this!

<?php
$query = new EntityFieldQuery();

$query->entityCondition('entity_type', 'node')
->entityCondition('bundle', 'article')
->propertyCondition('status', 1)
->fieldCondition('field_news_types', 'value', 'spotlight', '=')
->fieldCondition('field_photo', 'fid', 'NULL', '!=')
->fieldCondition('field_faculty_tag', 'tid', $value)
->fieldCondition('field_news_publishdate', 'value', $year. '%', 'like')
->range(0, 10)
->addMetaData('account', user_load(1)); // Run the query as user 1.

Read more
Login to post comments |  121 reads |  Tags: coding, Database, Drupal 7

Setting the maximum upload size or php memory for Drupal 7

Thu, 2013-03-28 10:46 |  Franco

There are 3 main ways to do this:
1) custom PHP.INI file
2) .htaccess
3) settings.php

I may come back and document the other 2 in this post at a later date but for now I will cover the custom PHP.INI approach.

I tend to use this approach in a hosting environment and becuase if you need additional memory to install drupal as is the case if you install a profile like Commerce Kickstart, then the changes set in the settings.php are not used until after the install.

First I create a blank file in the drupal directory called php.ini

Read more
Login to post comments |  218 reads |  Tags: Drupal 7, File Upload Size, PHP Memory Limit

Charts and Graphs in Drupal 7

Wed, 2013-03-27 11:07 |  Franco
graphs.png

I have been struggling to find a solution to creating graphs from views in Drupal 7 for some time and recently while working on the SPARCS project and at long last I have done the hard work to get it going.

If you want to just create a simple graph easily, use the CHART module. This will use the google charts api and draw simple but many different graphs:

drush dl chart
drush en chart_views

Read more
Login to post comments |  219 reads |  Tags: Charts, drupal, Drupal 7, Graphs, views

Restore a LVM image to LVM direct from gzip to LVM with a progress bar

Wed, 2013-03-20 10:35 |  Franco

By piping commands together you can save yourself the trouble of filling your harddisk with the uncompressed logical volume manager (LVM) image and pipe the image direct to a logical volume.
Assumptions:
the LV is here: /dev/lg_storage/lv_harddisk (16 gigs)
the compressed image is: disk_backup.gz (2 gigs - 16 gigs uncompressed)
you have pv installed (apt-get install pv)

as root do:

pv disk_backup.gz | gzip -d | dd of=/dev/lg_storage/lv_harddisk

this will give you:
0.88GB 0:02:09 [84.41MB/s] [=========>              ] 41% ETA 0:04:30

Read more
Login to post comments |  140 reads |  Tags: GZIP, linux, lvm, pipe viewer, pv, ubuntu

Check if port XXX is listening on your server

Tue, 2013-01-29 16:03 |  Franco

I use two approaches with the same tool, netstat.

sudo netstat --listen

this gives output like:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *:webmin *:* LISTEN
tcp 0 0 *:ssh *:* LISTEN
tcp 0 0 localhost:postgresql *:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN

Read more
Login to post comments |  366 reads |  Tags: linux, netstat, network, tcp ports, ubuntu server

Fix slow SSH response on your Ubuntu Server

Tue, 2013-01-29 11:43 |  Franco

By default, ubuntu will force each connection to have a reverse-dns lookup before establishing the session, this is great when doing a forensic audit of which IP address/FQDN logged into your server, but for day to day internal lan use, this added security measure is a PITA when you dont have a reverse dns as all it does is delay the establishment of the SSH session.

Read more
Login to post comments |  206 reads |  Tags: ssh, ssh tricks, sshd, tweaking ubuntu, ubuntu

Things i like to do to Ubuntu to make it rock.

Wed, 2013-01-23 12:11 |  Franco

This post will be an ongoing work:

I like to have a few standard tools I like to use:

sudo apt-get install nano mc htop ncdu

I also like the desktop to default to list view not icons:
In nautilus, go to Edit -> Preferences and select "list view", instead of "icon view" (in the "default view" section).

Login to post comments |  130 reads |  Tags: Setup, ubuntu

Find and eliminate rogue or ghost KVM Virtual machines under Cloudmin

Fri, 2013-01-18 15:59 |  Franco

I simply love managing my KVM virtual machines on ubuntu using cloudmin. But if you are like me you will have renamed a few virtual machine hostnames before you realize that doing so can orphan the VM processes under cloudmin and that these rogues will persist even after a reboot, or even a reinstall.

Read more
Login to post comments |  261 reads |  Tags: Cloudmin, kvm, virtual machine, virtualization
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • next ›
  • last »

Visit our Image Studio

Tags in Blog Tags

graphics the gimp linux ubuntu ssh diskspace free and open sourced software Drupal 7 command line howto digital art drupal
more tags

Recent blog posts

  • Easy exporting of Drupal 7 custom fields for use in module code.
  • Midnight Commander on OS-X
  • Get lists of NIDs from DB filtering by fields without having to do joins - Hello "Entity Field Query"
  • Setting the maximum upload size or php memory for Drupal 7
  • Charts and Graphs in Drupal 7
  • Restore a LVM image to LVM direct from gzip to LVM with a progress bar
  • Check if port XXX is listening on your server
  • Fix slow SSH response on your Ubuntu Server
  • Things i like to do to Ubuntu to make it rock.
  • Find and eliminate rogue or ghost KVM Virtual machines under Cloudmin
more

© 2010 Western Willow Ventures Inc.

Designed by Heidi Selzler.