http://www.ecs.com.tw/ECSWebSite/Product/Product_Detail.aspx?CategoryID=1&DetailID=685&DetailName=Feature&MenuID=24&LanID=9
5 beeps = ?
http://www.bioscentral.com/postcodes/awardbios.htm
only post codes -- no post code reader.
remove ram, eraser the contacts and then replace.
fixed.
Tuesday, September 27, 2011
Thursday, September 1, 2011
every 15 second mode
aliasing problems (full second resolution timing) coming from motion events turns out to be the limiting factor:
/usr/local/bin/on_event_start:
POST_DATA1=(as before)
while true ; do
POST_DATA2="time=$(date -u +%Y-%m-%dT%H:%M:%S)"
POST_DATA3="ms_per_wh=$(cat /tmp/last_ms_per_wh)"
POST_DATA="${POST_DATA1}&${POST_DATA2}&${POST_DATA3}"
wget -q -O - --post-data="${POST_DATA}" http://www.wattvision.com/api
code=$?
echo $POST_DATA3, return code: $code
sleep 17
done
Next up - patch motion to allow events to be of a sub-second interval.
/usr/local/bin/on_event_start:
LAST=$(cat /tmp/last_nsec)/root/wattvision:
# NS resolution counter:
NOW=$(awk 'NR == 3 { print $3 }' /proc/timer_list)
DELTA_MS=$(( (NOW - LAST) / 1000000 ))
echo $NOW > /tmp/last_nsec
echo $DELTA_MS > /tmp/last_ms_per_wh
POST_DATA1=(as before)
while true ; do
POST_DATA2="time=$(date -u +%Y-%m-%dT%H:%M:%S)"
POST_DATA3="ms_per_wh=$(cat /tmp/last_ms_per_wh)"
POST_DATA="${POST_DATA1}&${POST_DATA2}&${POST_DATA3}"
wget -q -O - --post-data="${POST_DATA}" http://www.wattvision.com/api
code=$?
echo $POST_DATA3, return code: $code
sleep 17
done
Next up - patch motion to allow events to be of a sub-second interval.
Sunday, August 28, 2011
webcam and motion based power meter data sender
Instead of doing anything to do with actual hardware-hacking, I decided to use a webcam to read the infrared blips from my electric power meter.
I placed the webcam on top of the meter (a better, weatherproof, mounting system is still needed).
Taped it in place, placed some addition material above it to shield it from background light.
I then used the open source package 'motion' and basically don't use it's snapshot or movie taking modes at all.
I use it strictly to trigger my data logger script:
motion.conf useful bits:
width 176
height 144
framerate 30
# Check if motion died, if it did, restart and log it
MOTION_EXEC=$(ls -l /proc/$(cat /tmp/motion.pid)/exe 2>/dev/null | cut -f2 -d\>)
[ x${MOTION_EXEC} != x"/usr/bin/motion" ] && (
/usr/bin/motion
date >> /root/motion.restart.log
)
Next up: an every-15 second reporting mode.
I placed the webcam on top of the meter (a better, weatherproof, mounting system is still needed).
Taped it in place, placed some addition material above it to shield it from background light.
I then used the open source package 'motion' and basically don't use it's snapshot or movie taking modes at all.
I use it strictly to trigger my data logger script:
motion.conf useful bits:
width 176
height 144
framerate 30
gap 1
output_normal off #this disables picture taking
on_event_start /usr/local/bin/on_event_start
ppm on # speeds things up
webcam_maxrate 30 # we can watch it in realtime, but only feasible using ppm
threshold 50
noise_level 32
auto_brightness off
brightness 200
contrast 250
webcam_maxrate 30 # we can watch it in realtime, but only feasible using ppm
threshold 50
noise_level 32
auto_brightness off
brightness 200
contrast 250
on_event_start looks like:
#!/bin/sh
DATE=$(date -u +%Y-%m-%dT%H:%M:%S)
FILE=$(echo $DATE | cut -f1-2 -d:)
SECONDS=$(echo $DATE | cut -f3 -d:)
echo $SECONDS >> /tmp/${FILE}
and I push these files via wattvision's public API with this script:
#!/bin/sh
# Check if motion died, if it did, restart and log it
MOTION_EXEC=$(ls -l /proc/$(cat /tmp/motion.pid)/exe 2>/dev/null | cut -f2 -d\>)
[ x${MOTION_EXEC} != x"/usr/bin/motion" ] && (
/usr/bin/motion
date >> /root/motion.restart.log
)
# this will skip the last matching file, since it's not yet complete:
PENDING_LIST=$(echo /tmp/????-??-??T??:?? | tr ' ' '\n' | tac | tail +2 | tac)
for crumb in ${PENDING_LIST} ; do
echo -n processing ${crumb}==
COUNT=0
COUNT="$(grep -c . ${crumb})"
AVG_DT=$(( 60 / ${COUNT} ))
# INST_WATTS=$(( 3600 / $AVG_DT ))
# echo -n instant $INST_WATTS
MS_PER_WH=$(( 60000 / ${COUNT} )) # ( 1minute in ms / pulses last minute )
echo ms_per_wh $MS_PER_WH
POST_DATA1="h=<house_id>&k=<secret_api_key>&v=0.1"
POST_DATA2="time=$(basename $crumb):00"
POST_DATA3="ms_per_wh=${MS_PER_WH}"
POST_DATA="${POST_DATA1}&${POST_DATA2}&${POST_DATA3}"
wget -q -O - --post-data="${POST_DATA}" http://www.wattvision.com/api
code=$?
echo return code: $code
[ $code -eq 0 ] && rm $crumb
sleep 15
done
and I run the script every minute from cron.
Next up: an every-15 second reporting mode.
Monday, August 22, 2011
Power meter reader
http://www.avbrand.com/projects/powermonitor/
and derivative projects:
http://blog.blakecrosby.com/2011/05/08/arduino-electricity-monitor.html (solar cell)
and directory: http://sourceforge.net/apps/wordpress/irmetermon/2011/05/15/similar-power-monitor-projects/
-------
and derivative projects:
http://blog.blakecrosby.com/2011/05/08/arduino-electricity-monitor.html (solar cell)
and directory: http://sourceforge.net/apps/wordpress/irmetermon/2011/05/15/similar-power-monitor-projects/
and published arduino code from: http://www.avbrand.com/projects/powermonitor/code.asp
and blakecrosby...
-------
void setup() { // Pin 13 is the blinking status LED pinMode(13, OUTPUT); // Pin 2 is the input from the phototransistor pinMode(2, INPUT); // Start serial communication Serial.begin(115200); } int lastRead = HIGH; // The last reading (off) long lastUpdate = 0; // The last time we sent an update long counter = 0; // The current counter // Track the rate. long lastBlink = 0; // The last time we saw a blink // Average blink times over 10 blinks long blinkTimes[10]; byte currBlink = 0; void loop() { int r = digitalRead(2); if (r != lastRead) { lastRead = r; if (r == LOW) // A blink has been detected. { counter++; blinkTimes[currBlink] = millis() - lastBlink; lastBlink = millis(); currBlink++; if (currBlink > 9) currBlink = 0; digitalWrite(13, HIGH); } else { digitalWrite(13, LOW); } } if (millis() > lastUpdate + 1000 || millis() < lastUpdate) { // Send data out the serial port. lastUpdate = millis(); Serial.print(counter); Serial.print("\t"); Serial.println(avgBlinks()); } } long avgBlinks() { // Calculate the average time between blinks. // This gives us the number we need to calculate the watts long avgCounter = 0; for (int i = 0; i <= 9; i++) { avgCounter += blinkTimes[i]; } return avgCounter / 9; }
osx user/group administration examples (chgrp)
From http://drupal.org/node/783808
2. Configure system requirements
================================
================================
Next we'll create the aegir user and add it to the _www group. This part is
very different on Mac OS X than Linux or most other Unices. Must be a NeXTism.
very different on Mac OS X than Linux or most other Unices. Must be a NeXTism.
Shell commands::
sudo dscl . -create /Users/aegir NFSHomeDirectory /var/aegir
sudo dscl . -create /Users/aegir NFSHomeDirectory /var/aegir
Now you need to find the next spare UID to assign the user.
Here's how you find out on your system:
Shell commands::
sudo dsexport users.out /Local/Default dsRecTypeStandard:Users
sudo dsexport users.out /Local/Default dsRecTypeStandard:Users
Then open the file users.out in a text editor, search for the highest 5xx user
ID and add 1 to it (in your brain, not in the file). So if you find 506 but
no 507, use 507. When you're done, delete users.out to be safe.
ID and add 1 to it (in your brain, not in the file). So if you find 506 but
no 507, use 507. When you're done, delete users.out to be safe.
Shell commands::
sudo rm users.out
sudo rm users.out
Now assign this UID to the aegir user, replacing "5xx" with the UID.
Shell commands::
sudo dscl . -create /Users/aegir UniqueID 5xx
sudo dscl . -create /Users/aegir UniqueID 5xx
Set a secure password for the aegir user, as it needs shell access.
Shell Commands::
sudo passwd aegir
sudo passwd aegir
Create the aegir home directory and set its permissions.
Shell Commands::
sudo mkdir /var/aegir
sudo chown aegir /var/aegir
sudo chgrp _www /var/aegir
sudo mkdir /var/aegir
sudo chown aegir /var/aegir
sudo chgrp _www /var/aegir
Add the aegir user to the _www group. This is the group Apache runs as.
sudo dscl . -append /Groups/_www GroupMembership aegir
sudo dscl . -append /Groups/_www GroupMembership aegir
Give the aegir user the ability to restart Apache.
Shell Commands::
sudo mv /usr/sbin/apachectl /usr/sbin/apachectl-apple
sudo ln -s /opt/local/apache2/bin/apachectl /usr/sbin/apachectl
sudo visudo
sudo mv /usr/sbin/apachectl /usr/sbin/apachectl-apple
sudo ln -s /opt/local/apache2/bin/apachectl /usr/sbin/apachectl
sudo visudo
Go to the last line of the file and add the following:
aegir ALL=NOPASSWD: /usr/sbin/apachectl
aegir ALL=NOPASSWD: /usr/sbin/apachectl
Save the file and exit your text editor.
Next configure Apache to include the Aegir config.
Shell Commands::
echo "Include /var/aegir/config/apache.conf" >> /opt/local/apache2/conf/httpd.conf
/opt/local/apache2/bin/apachectl restart
echo "Include /var/aegir/config/apache.conf" >> /opt/local/apache2/conf/httpd.conf
/opt/local/apache2/bin/apachectl restart
Configuring your MySQL database and user accounts is the same as in the
INSTALL.txt file. But you probably want to add the path to its executables
to your user's PATH and the aegir user's PATH.
INSTALL.txt file. But you probably want to add the path to its executables
to your user's PATH and the aegir user's PATH.
Shell Commands::
echo 'export PATH=/opt/local/lib/mysql5/bin:$PATH' >> ~/.profile
su - aegir
Password: (the password you setup earlier)
echo 'export PATH=/opt/local/lib/mysql5/bin:$PATH' >> ~/.profile
exit
echo 'export PATH=/opt/local/lib/mysql5/bin:$PATH' >> ~/.profile
su - aegir
Password: (the password you setup earlier)
echo 'export PATH=/opt/local/lib/mysql5/bin:$PATH' >> ~/.profile
exit
Saturday, August 13, 2011
setting RTF margins using TextEdit
http://forums.macrumors.com/showpost.php?s=aa2f711c386a64e6ffaca955a19ed9ad&p=9877191&postcount=14 - How do you control the margins in TextEdit? View Single Post
So, with this, I created a custom page size 3.4"w x 4.4"h in the OS print dialogs, as well
Create or edit the to of your RTF document near:
{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf480
{\fonttbl}
{\colortbl;\red255\green255\blue255;}
{\info
{}}\margl720\margr720\margt720\margb720\vieww15400\viewh17940\viewkind1\viewscale100
}
save this and then use it as a template with 1/2" margins all the way around. Adust the 720 as you need. 1440 = 1" so do the math.
{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf480
{\fonttbl}
{\colortbl;\red255\green255\blue255;}
{\info
{}}\margl720\margr720\margt720\margb720\vieww15400\viewh17940\viewkind1\viewscale100
}
save this and then use it as a template with 1/2" margins all the way around. Adust the 720 as you need. 1440 = 1" so do the math.
http://www.mobileread.com/forums/showthread.php?t=63607 - "Ideal" Kindle 2 PDF page size
as set my margins to be maybe 0.1":
\paperw4809\paperh6451\margl120\margr120\margb120\margt120
Voila.
Perfect edge-edge PDF for kindle 2.
Sunday, August 7, 2011
some basic config stuff for yii
--- testdrive/protected/config/main.php 2011-07-07 06:16:45.000000000 -0700
+++ test/protected/config/main.php 2011-07-21 10:13:13.000000000 -0700
@@ -7,7 +7,7 @@
// CWebApplication properties can be configured here.
return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
- 'name'=>'My Web Application',
+ 'name'=>'My Awesome Web Application',
// preloading 'log' component
'preload'=>array('log'),
@@ -16,15 +16,19 @@
'import'=>array(
'application.models.*',
'application.components.*',
+ 'application.extensions.yiidebugtb.*', // debugging toolbar
),
'modules'=>array(
+ // uncomment the following to enable the Gii tool
+
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'obihai',
// If removed, Gii defaults to localhost only. Edit carefully to taste.
'ipFilters'=>array('127.0.0.1','::1'),
),
+
),
// application components
@@ -34,16 +38,18 @@
'allowAutoLogin'=>true,
),
// uncomment the following to enable URLs in path-format
- /*
'urlManager'=>array(
'urlFormat'=>'path',
+ 'showScriptName'=>'false',
'rules'=>array(
- '<controller:\w+>/<id:\d+>'=>'<controller>/view',
- '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
+ '<controller:\w+>'=>'<controller>/list',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
+ '<controller:\w+>/<id:\d+>/<title>'=>'<controller>/view',
+ '<controller:\w+>/<id:\d+>'=>'<controller>/view',
+
+/* '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>', */
),
),
- */
'db'=>array(
'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
),
@@ -68,6 +74,13 @@
'class'=>'CFileLogRoute',
'levels'=>'error, warning',
),
+ array( // configuration for the toolbar
+ 'class'=>'XWebDebugRouter',
+ 'config'=>'alignLeft, opaque, runInDebug, fixedPos, collapsed, yamlStyle',
+ 'levels'=>'error, warning, trace, profile, info',
+ 'allowedIPs'=>array('127.0.0.1','::1'),
+ // '192.168.1.54','192\.168\.1[0-5]\.[0-9]{3}'),
+ ),
// uncomment the following to show log messages on web pages
/*
array(
@@ -82,6 +95,7 @@
// using Yii::app()->params['paramName']
'params'=>array(
// this is used in contact page
'adminEmail'=>'webmaster@example.com',
),
+ 'defaultController' => 'site/login',
);
Subscribe to:
Posts (Atom)
#RSFtalks with Edward Snowden
What an intelligent, thoughtful individual. I find it difficult to forgive 44 for failing to pardon this patriot and instead pursuing him ...
Other Popular Posts:
-
The TP-Link Archer AC1750 C7 runs OpenWRT and is a great router IMHO. You can also try the same hardware, rebranded by Amazon as the A7: ...
-
[original post written in 2011, see below for Updates] Click image to zoom in. Here's a diagram of how I configure my Mac to locally r...
-
What an intelligent, thoughtful individual. I find it difficult to forgive 44 for failing to pardon this patriot and instead pursuing him ...