Advertisement

Customize

blah

Recent Entries

4/7/08 12:11 pm - post a contact from a form into highrisehq

Some php that will put the output of a contact form into highrisehq. Uses the simplehighrise.php wrapper from:
http://www.activistnerd.com/simplehighrise-a-php-wrapper-class-for-the-highrise-api/

had to hack up a different get_ID solution, as neither of the ways the wrapper did it work for me. almost certainly related to php version (them 5 me 4)

also note that I put the contacts into a company called DEMOFORM, as I couldn't create and apply a tag. Let me know if you can




//info about person
$firstName = $name;
$lastName = "";
$phoneNumber = $phone;
$companyName = "DEMOFORM";
$emailAddress = $email;
$noteBody ="Feedback Submitted! \n Name:".$name."\n Organization: ".$org."\n Email:".$email."\n Phone: ".$phone."\n Subje
ct: ".$subject."\n Interests: ".$str."\n Message: ".$msg;
;

//set up for highrise--put your token below
include('simplehighrise.php');
$token = "blah4532jh5l2jkh348gshljhblahblah".":foo"; // tack on : (colon) and dummy password
$hr = new SimpleHighrise('foobar', $token);

//function to pull first found persons ID out of the xml
function find_ID ($result = ""){
// goto person section
$PersonLine=strpos($result, "");
$string=substr($result, $PersonLine);
//goto ID line
$IDLine=strpos($result, "");
$string=substr($result, $IDLine);
// find first and last position of ID field
$IDLine=strpos($string,">");
$IDLineEnd=strpos($string,"
");
//save out the ID
$string=substr($string,$IDLine + 1,$IDLineEnd - 1 - $IDLine );
return $string;
}
//search for person current ID
$searchResult = $hr->search_people($firstName);
$personId = find_ID($searchResult);

//if they don't exist, then create them
if ($personId == ""){
$createResult = $hr->create_new_person($firstName, $lastName, $phoneNumber, $companyName, $emailAddress);
$personId = find_ID($createResult);
}
// note rest of info onto person
$noteResult = $hr->create_new_note_person($personId, $body = $noteBody, $subjectType = "DEMOFORM");

//echo $result;

//end by going to a thank you page
header("Location: http://example.com/thanks.html");

4/2/08 12:06 pm - dv2710 and Slackware 12.0

Got a HP dv2710us laptop at work a few weeks ago. it's neat. solid feel and fast machine
dv2710us: slackware 12.0
Notes so far....
misc:requires press power button during bootup, after lilo. this allows to continue, but a keypress is required later to continue again. this seems to in some way be related to forcedeth module. need to upgrade kernel to see if this is fixed. many reports of problems with this chipset fixed in later kernels.

run:update-pciids

network: works with forcedeth module, but device # increments every module load due to weirdness with card and a udev rule. restart numbering with look at /etc/udev/rules.d/75-network-devices.rules. blacklisted driver, set up in rc.local to delete that file and load driver

video: install and configure nvidia driver. working on proper setup for laptop roaming (add and subtract external monitor correctly) useing nvidia's tool for xconfig

audio: just worked, but only master volume and PCM? plug in headphone jack doesn't mute speakers?

wireless: ndiswrapper with driver that worked for XP, no problems it is a bcm43xx card

mouse: added scrollwheel stuff, need to do touch pad, but works fine now

card reader:modprobe mmc_block to rc.modules

buttons: all sensed by xev except dvd and weird circle thingy, but don't think they are supposed to work in except for pre-boot. Seen in KDE, volume just works, play/stop/etc mapped to amarok. mute is seen but does nothing.

acpi: modprobe buttons/processor/battery/thermal/etc

ntfs-3g/hal:follow http://www.linuxquestions.org/questions/slackware-14/12.0-and-hal-read-this-566862/

built in cam:uvc driver works--commands to use:sudo mplayer tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0 -fps 30orsudo luvcview -i 30 -f yuv -s 640x480 -o ./test.avi

1/18/08 11:04 am - updated vbox.rc

cleaned up and added ability to stop and start individual machines. Also machines are now started based on names in VMLIST file. biggest problem still to fix is adding/subtracting network interfaces for each machine. too lazy too fix right now.


#!/bin/sh
# start and stop virtual box machines when machine is rebooted.


VMLIST=/etc/vboxmachinelist

#machine specific functions
start_machine(){
echo starting VirtualBox $1
VBoxVRDP -startvm $1 &
}

stop_machine(){
echo stoping machine VirtualBox $1
VBoxManage controlvm $1 savestate
}


#vbox general functions
vbox_start(){
echo Starting vbox drivers, machines
# Start vboxdrv
if [ -x /etc/rc.d/rc.vboxdrv ]; then
/etc/rc.d/rc.vboxdrv start
fi

# Start vboxnet
echo Starting Vbox network drivers
if [ -x /etc/rc.d/rc.vboxnet ]; then
/etc/rc.d/rc.vboxnet start
fi

# add vbox interfaces
# for now just adding a few. later need to spend more time on doing this right
/usr/bin/VBoxAddIF vbox0 root br0
/usr/bin/VBoxAddIF vbox1 root br0
/usr/bin/VBoxAddIF vbox2 root br0
/usr/bin/VBoxAddIF vbox3 root br0


cat $VMLIST |while read LINE; do
start_machine $LINE
sleep 1
echo --
done
}

vbox_stop(){
echo Stoping VirtualBox RDP machines, and remove drivers

# stop machine gently
cat $VMLIST |while read LINE; do
stop_machine $LINE
sleep 1
echo --
done

# make sure machine is stopped
killall VBoxVRDP
sleep 1
# get rid of vbox interfaces
/usr/bin/VBoxDeleteIF vbox0
/usr/bin/VBoxDeleteIF vbox1
/usr/bin/VBoxDeleteIF vbox2
/usr/bin/VBoxDeleteIF vbox3

# Stop vboxnet
if [ -x /etc/rc.d/rc.vboxnet ]; then
/etc/rc.d/rc.vboxnet stop
fi

# Stop vboxdrv
if [ -x /etc/rc.d/rc.vboxdrv ]; then
/etc/rc.d/rc.vboxdrv stop
fi

}

vbox_restart(){
vbox_stop
echo " "
sleep 1
vbox_start
}

case "$1" in

*_start)
MACHINE=`echo $1 | /bin/cut -d '_' -f 1`
start_machine $MACHINE
;;
*_stop)
MACHINE=`echo $1 | /bin/cut -d '_' -f 1`
stop_machine $MACHINE
;;
*_restart)
MACHINE=`echo $1 | /bin/cut -d '_' -f 1`
stop_machine $MACHINE
sleep 1
start_machine $MACHINE
;;
# *_save)
# MACHINE=`echo $1 | /bin/cut -d '_' -f 1`
# save_machine $MACHINE
# ;;
'start')
vbox_start
;;
'stop')
vbox_stop
;;
'restart')
vbox_restart
;;

*)
echo "usage $0 start|stop|restart"
esac

12/12/07 02:06 pm - rc.vbox for slackware

Again this needs more work, but good enough for me for now. too specific to my setup though. also need to add ability to start stop individual machines


#!/bin/sh

#machine specific functions
start_machine(){
echo starting VirtualBox $1
VBoxVRDP -startvm $1 &
}

stop_machine(){
echo stoping machine VirtualBox $1
VBoxManage controlvm $1 savestate
}

#vbox functions
vbox_start(){
echo Starting vbox drivers, machines
# Start vboxdrv
if [ -x /etc/rc.d/rc.vboxdrv ]; then
/etc/rc.d/rc.vboxdrv start
fi

# Start vboxnet
if [ -x /etc/rc.d/rc.vboxnet ]; then
/etc/rc.d/rc.vboxnet start
fi

# add vbox interfaces
/usr/bin/VBoxAddIF vbox0 root br0
/usr/bin/VBoxAddIF vbox1 root br0
/usr/bin/VBoxAddIF vbox2 root br0
/usr/bin/VBoxAddIF vbox3 root br0

start_machine XP
sleep 1
echo --
start_machine w2k3
sleep 1
echo --
start_machine kulasvn

}

vbox_stop(){
echo Stoping VirtualBox RDP machines, and remove drivers

# stop machine gently
stop_machine XP
stop_machine w2k3
stop_machine kulasvn
sleep 1
# make sure machine is stopped
killall VBoxVRDP
sleep 1
# get rid of vbox interfaces
/usr/bin/VBoxDeleteIF vbox0
/usr/bin/VBoxDeleteIF vbox1
/usr/bin/VBoxDeleteIF vbox2
/usr/bin/VBoxDeleteIF vbox3

# Stop vboxnet
if [ -x /etc/rc.d/rc.vboxnet ]; then
/etc/rc.d/rc.vboxnet stop
fi

# Stop vboxdrv
if [ -x /etc/rc.d/rc.vboxdrv ]; then
/etc/rc.d/rc.vboxdrv stop
fi

}

vbox_restart(){
vbox_stop
echo " "
sleep 1
vbox_start
}

case "$1" in
'start')
vbox_start
;;
'stop')
vbox_stop
;;
'restart')
vbox_restart
;;
*)
echo "usage $0 start|stop|restart"
esac

12/12/07 02:03 pm - rc.bridge for virtualbox in slackware

this works for me, but needs more checking if interfaces exist, etc

#!/bin/bash
#bond the network interfaces together and then place in a bridge for vbox
echo bridge network interfaces

bonding_start(){
# start bonding module
modprobe bonding mode=balance-alb miimon=100

#bring up bond interface
ifconfig bond0 up

#put hardware in bond
ifenslave bond0 eth0
ifenslave bond0 eth1

# add Bridge br0 and assign the interfaces
brctl addbr br0
brctl addif br0 bond0

#clear out interface
ifconfig bond0 0.0.0.0 promisc up

dhclient br0
}

bonding_stop(){
ifconfig bond0 down
brctl delif br0 bond0
brctl delbr br0
rmmod bonding
}

bonding_restart(){
bonding_stop
bonding_start
}

case "$1" in
'start')
bonding_start
;;
'stop')
bonding_stop
;;
'restart')
bonding_restart
;;
*)
echo "usage $0 start|stop|restart"
esac

9/7/07 09:11 pm - bored

oh well
Powered by LiveJournal.com

Advertisement

Customize