Thursday, March 06, 2008

Django on Ubuntu Gutsy

My first steps at Django

sudo apt-get install libapache2-mod-python python-django
sudo apt-get install mysql-server python-mysqldb
sudo /etc/init.d/mysql start (the previous line upgraded mysql and didn't restart it)

cd /home/username_here
django-admin startproject mysite
cd mysite
./manage.py runserver

[I opened up a putty session forwarding my localport 7145 over to localhost:8000 on the ubuntu box]

in firefox: http://localhost:7145

Wednesday, March 05, 2008

Simulations

For my ME Capstone course, I'm building a distance sensing circuit which will throw a dual colored LED on way or the other depending on which site of a distance threshold the tip of the device is at.

Currently, we have a potentiometer to calibrate the device in one location and we're thinking of moving to another location with the hopes of making the device 'totally calibratable'. This is in an effort to compensate for variances in photoresistor performance.


So, I'm going to run a parametric sweep simulation to show my how the device switches for the configuration we have now, and then I will run the same simulation, moving the pot as shown above.

Here are the results from my first simulation.

Wednesday, November 28, 2007

Organizing my LIfe

I decided to organize my life. 

Google Calendar (calendar) and rememberthemilk.com (todo) should do the trick.

I was also able to suck the BYU calendars off there site.  I had to do a little snooping to find the URL, but here it is...
http://byunews.byu.edu/calendar/icalmulti.aspx?month=11/23/2007&alumni=false&type=academic

Wednesday, October 24, 2007

Search and Replace

Search and Replace (and destroy!) for file in *.*; do sed 's/Procedures.html/Procedures.php/g' $file > tmp.$file; [ -s tmp.$file ] && mv tmp.$file $file; done

Or superior:
find ./ -type f -exec sed -i ’s/string1/string2/’ {} \;

Thursday, August 23, 2007

Cougareat Fusion

In case my work gets somehow lost or deleted....

  • I created a custom content containing the certifications for each of the restaurants: Scoreboard, Teriyaki, Subway, etc....
  • I clicked the checkbox indicating use in NodeProfile
  • I created a relation in NodeFamily (I'm unsure of the need for this)
  • Create a view for user
  • Created a view for teriyaki certs
  • then used views fusion to join

Monday, July 23, 2007

Druapl Mania

I'm working on getting Drupal to work as a CMS for BYU. I've learned a lot in the last few weeks of work. Right now I'm working on the menuing system. We want drop down menus. I built one from scratch using the yui, but alas, it wasn't cross-browser compatible, which really stinks. So now I'm trying out using yui's menu class as the base. I'm over-ridding some of Drupal's themeing functions to get it to work. Here's what I have so far:
 /**
* Generate the HTML for a menu tree.
*
* @param $pid
* The parent id of the menu.
*
* @ingroup themeable
*/
function byu1_menu_tree($pid = 1, $level = 0) {
if ($tree = byu1_menu_tree_improved($pid, $level)) {
return "\n
\n
\n
    \n". $tree ."\n
\n
\n";
}
}


/**
* Returns a rendered menu tree.
*
* @param $pid
* The parent id of the menu.
*/
function byu1_menu_tree_improved($pid = 1, $level = 0) {
$menu = menu_get_menu();
$output = '';

if (isset($menu['visible'][$pid]) && $menu['visible'][$pid]['children']) {
$num_children = count($menu['visible'][$pid]['children']);
for ($i=0; $i < $num_children; ++$i) { $i == 0 ? $level++ : ''; $mid = $menu['visible'][$pid]['children'][$i]; $type = isset($menu['visible'][$mid]['type']) ? $menu['visible'][$mid]['type'] : NULL; $children = isset($menu['visible'][$mid]['children']) ? $menu['visible'][$mid]['children'] : NULL; $extraclass = $i == 0 ? 'first' : ($i == $num_children-1 ? 'last' : ''); $output .= theme('menu_item', $mid, menu_in_active_trail($mid) || ($type & MENU_EXPANDED) ? theme('menu_tree', $mid, $level) : '', count($children) == 0, $extraclass, $level); $i == $num_children - 1 ? $level-- : ''; } } return $output; } /** * Generate the HTML output for a single menu item. * * @param $mid * The menu id of the item. * @param $children * A string containing any rendered child items of this menu. * @param $leaf * A boolean indicating whether this menu item is a leaf. * * @ingroup themeable */ function byu1_menu_item($mid, $children = '', $leaf = TRUE, $extraclass = '', $level) { return '
  • '. menu_item_link($mid, TRUE, $extraclass) . $children ."
  • \n";
    }

    Thursday, July 19, 2007

    Cannot Find NoniGPSPlot

    I was getting the "cannot find NoniGPSPlot" error on the mio. It was remedied by downloading http://hautil.free.fr/bm/PackDll2006.zip and placing it's contents in the program's folder.

    Pyjamas