Wednesday, November 2, 2011

OpenWRT and Wake on Lan (WoL) how to make it work

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:
(There are many visitors to this page - but I'm not sure if any of this has helped others do what I did.
f the information below helps you, or you have questions, please use the comments to let me know.)

So, if you're trying to send a WoL wakeup packet to a single host on your LAN from your WAN segment, you'll need to use inbound port redirection.

Because I've not yet been able to make inbound NAT forward to my LAN's broadcast address,
you will need one "Redirection item" and a unique udp/port# pair per internal host, plus a static MAC address entry.

The missing static MAC entry is usually the second half of the puzzle that most folks don't figure out, and never get WoL working. This is something I think is broken in the kernel ip_tables module; it should log an error if a NAT redirection To: rule is missing from the ARP table, and the packet is being dropped due to lack of a MAC entry.

If you're using LuCI, this is done using a "Redirection" item.

Web Console path: admin/network/firewall
Here you will find three sections, (at least in my version, 10.03RC5 backfire):
• Zones
• Redirections
• Rules

To get WoL to work, I added one new Redirection item:

Name: WakeOnLan broadcast
Protocol: UDP
Source: wan:0.0.0.0/0:*
Via: Device:0.0.0.0/0:9
Destination: lan:192.168.1.69:*
Action: DNAT

Where 192.168.1.69 is an example internal LAN IP for the host you want to direct the WoL packets to.

As mentioned earlier, this isn't sufficient to make things work yet.

When the LAN host you're trying to wake up is powered off, it can't respond to ARP requests.
When a NAT packet is received by your router, it tries to forward it to the LAN segment, and perform DNAT.
Your router must know the ARP address of your To: destination host in order to send the UDP packet to it. And, since it's powered off, it won't know what that is, unless you set a static ARP address for it...

Where I found how to set a static MAC address:
https://forum.openwrt.org/viewtopic.php?id=1787

This command statically sets the ARP address for an IP.  (Replace 00:de:ad:be:ef:00 with your hosts's ethernet MAC address.)

ip neigh add 192.168.1.69    lladdr 00:de:ad:be:ef:00  nud permanent   dev br-lan


I added the above 'ip neigh add' command line to my router's
/etc/rc.local
file.

If the 'ip' command is not installed, you should be able to install it with '
opkg update; opkg install ip
'.


Note that if you change physical ethernet devices on this host, you'll have to update this line.


If you're still having trouble and you can do WoL from the local LAN, but can't get forwarding to work, drop me a note in the comments and I'll try to help.


If someone finds a way to get a Redirection rule to work with Destination: lan:192.168.199.255:* (the LAN broadcast address), please drop a note in the comments!


Cheers,
Marc.


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:
LAST=$(cat /tmp/last_nsec)
# 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
/root/wattvision:
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
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


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 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.
Shell commands::
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
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.
Shell commands::
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
Set a secure password for the aegir user, as it needs shell access.
Shell Commands::
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
Add the aegir user to the _www group. This is the group Apache runs as.
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
Go to the last line of the file and add the following:
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
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.
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

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


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.


So, with this, I created a custom page size 3.4"w x 4.4"h in the OS print dialogs, as well
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',
);

Saturday, July 23, 2011

OSX strace dtrace

http://humberto.digi.com.br/blog/2008/02/25/strace-on-mac-os-x-leopard/ 

strace on Mac OS X Leopard

One of the most important tools for sysadmins and programmers working in the Linux/BSD environment is called strace. As it took me some time to find out where is “strace for Mac”, I thought it would be worth documenting here…
Making a long story short: in Tiger it was called ktrace, in Leopard it’s called dtrace, but it’s simpler if you just call dtruss.
Here are some examples directly from the dtruss man page:
dtruss df -h     # run and examine the "df -h" command

dtruss -p 1871   # examine PID 1871

dtruss -n tar    # examine all processes called "tar"
For a more “real-life” example, please see this article: Why DTrace Makes Leopard a Must-Have Upgrade — you’ll even learn how to prevent Time Machine from consuming all your CPU.
UPDATE: Just after posting this I discovered that:
1. There’s a really cool GUI for DTrace called Instruments. After playing with it for just a few minutes I was able to detect that it waspsyco that was causing Python 2.4 to segfault when running web2ldap. Now back to a little more tinkering to discover why
2. Leopard/DTrace provides one command that I always wanted: iotop, to show which processes are responsible for the disk I/O (more dtrace commands here). Now to the question: is there a Linux version? The answer is: yes, and it’s written in Python (and requires a kernel >= 2.6.20).

Friday, July 22, 2011

corp images

https://ssl.gstatic.com/corpsso/images/3235300735_db3bdde565.jpg

https://ssl.gstatic.com/corpsso/images/beach_jump_Saunton_Sands_kim.jpg

https://ssl.gstatic.com/corpsso/images/IMG_0874.jpg

https://ssl.gstatic.com/corpsso/images/Half_Dome.jpg

https://ssl.gstatic.com/corpsso/images/DSC03448.jpg

https://ssl.gstatic.com/corpsso/images/baja_sunset2.png

https://ssl.gstatic.com/corpsso/images/Bandelier_20dwellings.jpg

https://ssl.gstatic.com/corpsso/images/Chandrataal.jpg

https://ssl.gstatic.com/corpsso/images/Route_66.jpg

https://ssl.gstatic.com/corpsso/images/52796885_80b2aa3517_o.jpg

https://ssl.gstatic.com/corpsso/images/new.jpg

https://ssl.gstatic.com/corpsso/images/hermit-crab.jpg

https://ssl.gstatic.com/corpsso/images/Chitzen_Itza_7.jpg

https://ssl.gstatic.com/corpsso/images/Underwater_Turtle_2.jpg

https://ssl.gstatic.com/corpsso/images/manhattan_beach_plumeria.jpg

https://ssl.gstatic.com/corpsso/images/2054919569_558b427352.jpg

https://ssl.gstatic.com/corpsso/images/Bali_-_Rice_Terrace__cp_.jpg

https://ssl.gstatic.com/corpsso/images/canyon.jpg

https://ssl.gstatic.com/corpsso/images/sasso.jpg

https://ssl.gstatic.com/corpsso/images/aquarium1.jpg

https://ssl.gstatic.com/corpsso/images/ashton2.jpg

https://ssl.gstatic.com/corpsso/images/seronera_river.jpg

https://ssl.gstatic.com/corpsso/images/Charminar.jpg

https://ssl.gstatic.com/corpsso/images/Feet.jpg

https://ssl.gstatic.com/corpsso/images/tokyo_cherry_blossoms_light.jpg


https://ssl.gstatic.com/corpsso/images/Route_66.jpg

https://ssl.gstatic.com/corpsso/images/CIMG2441_001.jpg

https://ssl.gstatic.com/corpsso/images/eyechart-larger.jpg

https://ssl.gstatic.com/corpsso/images/564050313_SZCFJ-L.jpg

https://ssl.gstatic.com/corpsso/images/IMG_0436.jpg

https://ssl.gstatic.com/corpsso/images/Australia-26.jpg

https://ssl.gstatic.com/corpsso/images/Tree_Rock__Bolivia.jpg

https://ssl.gstatic.com/corpsso/images/DSC03520.jpg

https://ssl.gstatic.com/corpsso/images/temple.jpg

https://ssl.gstatic.com/corpsso/images/CIMG1081.jpg

https://ssl.gstatic.com/corpsso/images/07-29-2006-01-015.jpg

https://ssl.gstatic.com/corpsso/images/SF_GGBridge_cp.jpg

https://ssl.gstatic.com/corpsso/images/DSCN2364_001.jpg

https://ssl.gstatic.com/corpsso/images/half-moon-bay-bridge-right.jpg

https://ssl.gstatic.com/corpsso/images/2651197556_b4353be44a.jpg

https://ssl.gstatic.com/corpsso/images/Avalanche_barriers_-_Hoher_Kasten.jpg

https://ssl.gstatic.com/corpsso/images/baja_sunset2.png

https://ssl.gstatic.com/corpsso/images/orange_butterfly_on_pink_flowers.jpg

https://ssl.gstatic.com/corpsso/images/IMG_6264c.jpg

https://ssl.gstatic.com/corpsso/images/kevinskitchen.jpg

https://ssl.gstatic.com/corpsso/images/Mono_20Lake.jpg

https://ssl.gstatic.com/corpsso/images/memory.jpg

https://ssl.gstatic.com/corpsso/images/CIMG2299.jpg

https://ssl.gstatic.com/corpsso/images/IMG_1642.jpg

https://ssl.gstatic.com/corpsso/images/velib.jpg

https://ssl.gstatic.com/corpsso/images/Africa_Leopard.jpg

https://ssl.gstatic.com/corpsso/images/116_1690.jpg

https://ssl.gstatic.com/corpsso/images/IMG_0072.jpg

https://ssl.gstatic.com/corpsso/images/jlinet2.jpg

https://ssl.gstatic.com/corpsso/images/IMG_2664hdr2.jpg

https://ssl.gstatic.com/corpsso/images/trogdor_bearded_dragon.jpg

https://ssl.gstatic.com/corpsso/images/20070911063428_picture_20012.jpg

https://ssl.gstatic.com/corpsso/images/mood07f.jpg

https://ssl.gstatic.com/corpsso/images/2167372413_82383e869b.jpg

https://ssl.gstatic.com/corpsso/images/DSCN2364_001.jpg

Thursday, July 21, 2011

todays android links

Or, "How to build the Calendar.apk from source - and install it in an emulator and have it do something useful"

Calendar source:  http://android.git.kernel.org/?p=platform/packages/apps/Calendar.git;a=summary


http://source.android.com/source/building.html



http://forum.xda-developers.com/showthread.php?t=899674

http://andromnia.sourceforge.net/wiki/docs/howto_build_android_from_source

https://groups.google.com/forum/#!topic/android-building/qzJDZ5PkLsI - Android Building FAQ

http://elinux.org/Android_Build_System


key step:


$ lunch sdk-eng  # or sdk-userdebug
$ make sdk

got to the part where I installed Calendar.apk, but there was no google accounts on the avm emulator -- so it wanted me to setup an ms exchange account....

how do I get live data onto it to play with?


http://www.google.com/support/mobile/bin/answer.py?answer=138740&topic=14252

Setup MS Exchange Sync with my google account, of course!

Monday, July 11, 2011

How to integrate PHPUnit and the newer Selenium webdriver

Turns out this is a cutting edge development area:

https://github.com/chibimagic/WebDriver-PHP is currently getting commits.
http://code.google.com/p/php-webdriver-bindings/ is also.

This is separate from the other configuration nightmare that I was facing -- how to test in Selenium using chrome:

http://code.google.com/p/selenium/wiki/ChromeDriver

So, for now, I can either go with the older Selenium 1.0 framework (Selenium RC) -- and the current bindings in PHPUnit -- or use bleeding edge bindings.

Ugh.

Spinwait.

Thursday, July 7, 2011

PHP5 on OSX 10.6

Beginning steps:

copy /etc/php.ini.default to /etc/php.ini

edit/set the time zone in the php.ini file.

enable OSX web sharing (turns on apache2)

follow the yii guide installation instructions (pdf in the -docs package)

install yiiframework somewhere in ~/Sites

instructions to compile a compatible libmcrypt into the stock apache2:
http://michaelgracie.com/2009/09/23/plugging-mcrypt-into-php-on-mac-os-x-snow-leopard-10-6-1/

visit
  http://127.0.0.1/~username/yii/requirements/index.php
profit!


update: we might just want to recompile:

http://www.malisphoto.com/tips/php-on-os-x.html ::
These installation instructions will compile PHP with a configuration that closely matches the PHP configuration shipped with OS X, but with the addition of enabling GD, PDO and MCRYPT support.
but we wound up not using these explicit instructions, and macports just worked.

apple's php534 was configured with:

'/var/tmp/apache_mod_php/apache_mod_php-53.4~2/php/configure' '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-dependency-tracking' '--sysconfdir=/private/etc' '--with-apxs2=/usr/sbin/apxs' '--enable-cli' '--with-config-file-path=/etc' '--with-libxml-dir=/usr' '--with-openssl=/usr' '--with-kerberos=/usr' '--with-zlib=/usr' '--enable-bcmath' '--with-bz2=/usr' '--enable-calendar' '--with-curl=/usr' '--enable-exif' '--enable-ftp' '--with-gd' '--with-jpeg-dir=/BinaryCache/apache_mod_php/apache_mod_php-53.4~2/Root/usr/local' '--with-png-dir=/BinaryCache/apache_mod_php/apache_mod_php-53.4~2/Root/usr/local' '--enable-gd-native-ttf' '--with-ldap=/usr' '--with-ldap-sasl=/usr' '--enable-mbstring' '--enable-mbregex' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--with-mysql-sock=/var/mysql/mysql.sock' '--with-iodbc=/usr' '--enable-shmop' '--with-snmp=/usr' '--enable-soap' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-wddx' '--with-xmlrpc' '--with-iconv-dir=/usr' '--with-xsl=/usr' '--enable-zend-multibyte' '--enable-zip' '--with-pcre-regex=/usr'


except -- at this point -- it would seem silly to try and recompile an "apple-like" php5


why not just use macports:


http://stackoverflow.com/questions/3484306/setting-up-postgresql-to-work-with-my-local-dev
and
http://laurii.info/2010/08/macports-berkley-db-4-problem-and-work-around/


which had the command:

sudo port install apache2 postgresql83 php+postgresql83+mysql5+pear+apache2
but didn't work exactly -- we found out later.

and with only a tiny bit of cruft (need to add local machine name to /etc/hosts as a loopback ip)
http://old.nabble.com/Localhost-down-%7C-MacPorts-LAMP-td27733679.html

using instructions at http://www.mkbernier.com/2010/09/28/installing-macports-php-mysql-pear-and-phpunit-on-mac-osx-snow-leopard/

we recompiled php5 with additional flags, and followed their config changes.

sudo port install php5 +apache2


sudo port install php5-sqlite php5-gd php5-mcrypt


fairly good looking success now:

Apache/2.2.19 (Unix) mod_ssl/2.2.19 OpenSSL/1.0.0d DAV/2 PHP/5.3.6 Yii Framework/1.1.8 2011-07-07 05:46

Thursday, June 30, 2011

my stupid cable modem, and crontab entry to reboot it

My modem took a dump and stopped passing upstream data yesterday - but remained online.
My old cable modem and router setup had a crontab to test for this and remotely reboot the cable modem box:

Oh yeah and it has a stupid default password: W2402

http://www.borfast.com/blog/scientific-atlanta-webstar-2203c-how-access-locked-pages

http://superuser.com/questions/56644/url-to-reboot-a-webstar-dpc2100r2-cable-modem-with-curl

curl http://192.168.100.1/goform/gscan -d SADownStartingFrequency=687000000


combining into a crontab entry test::


curl --connect-timeout 120 --max-time 240 --fail -k -I http://www.google.com/intl/en/privacy/ || curl http://192.168.100.1/goform/gscan  -d SADownStartingFrequency=687000000



Thursday, June 23, 2011

recipe for android emulator running Maps and Market

trying to get a working android emulator with Google Maps and Market.

some guides that didn't get us a working Market (Vending.apk):
http://anythingsimple.blogspot.com/2010/09/how-to-use-android-market-on-android.html
http://techdroid.kbeanie.com/2009/11/android-market-on-emulator.html  (LOTS of comments)
best comment: http://techdroid.kbeanie.com/2009/11/android-market-on-emulator.html?showComment=1301959932119#c4444648731124403327

google apps on emulator: http://forum.cyanogenmod.com/topic/5340-android-emulator/

porting google apps/sync -- http://forum.xda-developers.com/showpost.php?p=5045511&postcount=33
clued us in on the framework/lib stuff needed copying

first good guide:  http://nookdevs.com/Honeycomb_Google_Apps_and_Market
also clued us in on what we needed to do.

resources to grab:
cyanogenmod 4 DRC83 google apps:
http://wiki.cyanogenmod.com/index.php?title=Latest_Version
-> http://android.d3xt3r01.tk/cyanogen/cm4/DRC83_base_defanged.zip

basic recipe:

1. create an AVM (SDK version 4 - android 1.6 works with the DRC83 image below)
2. copy the default system.img from the android-sdk-mac_x86/platforms/android-X/images/ directory to the AVM (on a mac it's in $USER/.android/avd/YOUR_AVM_NAME_HERE/
3. Launch the AVM (using the android AVD manager will hang you up with a full system partition)
   ~/src/android-sdk-mac_x86/tools/emulator -avd fun -partition-size 128
(wait for it to boot)
4. adb remount (remounts the /system volume read/write)
5. adb pull system/build.prop
6. comment out the line: #ro.config.nocheckin=yes in build.prop
7. push it back: adb push build.prop system/build.prop
8. copy missing files in DRC83 tree :

to copy all files missing in the emulator from the DRC83_base_defanged.zip tree:

mkdir DRC83 ; cd DRC83 ; unzip ../DRC83_base_defanged.zip


for i in $(find system) ; do \
adb shell ls $i | grep "No such file" && \
  echo adb push $i $(dirname $i) && \
       adb push $i $(dirname $i) ;
done

file permissions are not synced when doing this.
i do not claim this to be correct, but I couldn't get 'adb sync' to work


Things working:
Maps, Market


Things not working:
Gmail/Calendar/Contact sync

Tuesday, June 21, 2011

Android adb shell am broadcast: Bad component name

http://stackoverflow.com/questions/5171354/android-adb-shell-am-broadcast-bad-component-name


adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -c android.intent.category.HOME -n net.fstab.checkit_android/.StartupReceiver
Practically it turns out that you just have to add a slash after the package name.

Monday, June 6, 2011

How to record all Google Voice calls on OSX (not just incoming ones) using Google Voice and GMail "Call Phone" features.


Click image to zoom in.

Here's a diagram of how I configure my Mac to locally record voice calls made in Google Talk (inbound and outbound).

I used Soundflower, LineIn and Audacity to record the comings and goings of the Google Talk Plugin.

Be sure to use headphones as this configuration has the potential to cause feedback if you don't.

To record a call, start by opening a new recording in Audacity, and then hit the record button.
Audio from Google Talk Plugin should then start flowing thru to the system speaker output (eg. headphones).

Initiate a call in GMail by selecting the "Call Phone" entry in the Google Talk widget, and the Dialer mole appears at the bottom right of the GMail window.


If you've started a recording in Audacity -- once you enter a number and press "Call", sound should come out the speakers.

If you don't know how to use Audacity -- go read it's documentation -- it's an audio editing program.  When you're done recording -- remember to save it.

Notes:

There's a bit of delayed self-echo on the local headphones due to the echo cancellation coupled with a small (25ms?) delay incurred by using the "software play-thru" during recording in audacity, but it's reasonable, and doesn't affect call quality.

When not using Audacity to record calls, I usually either change my google talk plugin mic/speaker settings, or run a second copy of LineIn to bounce from SoundFlower(2ch) to my Internal Speakers.


[4] Google Talk Plugin -- http://www.google.com/chat/video

Enjoy.

Thursday, April 14, 2011

Windows 2000 + IE6 fun --- NOT

crazyness to get IE6 installed over IE5.

first of all, IE5 can't even see the Download button on:

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=1e1550cb-5e5d-48f5-b02b-20b602228de6&displaylang=en

so you have to download it via a side channel.

then you have to invoke it thusly:


I've used windows for 10+ years and I've never had to use Run...Browse.

"C:\ie6setup.exe" /c:"ie6wzd.exe /d /s:""C:\ie6setup.exe"""

jeez.

Tuesday, March 8, 2011

Nice Poem

I don't know you

I didn't see the life you have had to live

But I hope someday our children come together

And fill the void that we never did

Saturday, February 26, 2011

Wishlist for my MacBook Air

Prevent accidents from becoming bigger accidents:

http://www.usbfirewire.com/Parts/rr-aar04-16.html - 4" USB right angle extension

You gotta love this gadget

http://ideativeinc.com/flipit.html

Passive thru connection AC 110V outlet/charger

Lets see .75A @ 120V == a whopping 90 Watts.

Neat.

Wednesday, January 19, 2011

jitouch, should I try running both versions at the same time?

version 2.21 works correctly on the internal macbook air trackpad, but jitouch gestures does not work on an bluetooth external Magic trackpad.

version 2.31 does not add gestures to the internal trackpad, but does work with the bluetooth external magic trackpad.

http://www.jitouch.com/index.php?page=jitouch

Window manager automation tools

http://tomas.styblo.name/wmctrl/
http://stackoverflow.com/questions/1029027/x11-move-an-existing-window-via-command-line
http://www.semicomplete.com/projects/xdotool/xdotool

#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: