Live update / hot reload / browser sync

https://stackoverflow.com/questions/42391747/is-there-a-way-to-live-update-the-page-when-using-p5js

You need Node.js for this. You can install BrowserSync using the command :

npm install -g browser-sync

Then browse to your project directory and open browsersync using :

browser-sync start --server --directory --files "*"

This will open a new tab in your browser which will list files in the directory, you can then select a html file to load and you should see a Connected to Browsersync message on the top right. This will also track changes in all files in your current directory and update the page whenever any file changes.

Master Yushi

Select a SharePoint WebPart Item with jQuery

Kode i .ascx file:

<asp:Label ID="lblSomeLabel" runat="server"></asp:Label>

Kode i endelig html:

<span id="ctl00_m_g_6fb87798_677a_4b2e_804d_6cb23c3672d1_ctl00_lblSomeLabel"></span>

Så hvordan fanger man elementet fra JavaScript?

<script>
  "use strict";
  var $lblSomeLabel = $("[id$='_lblSomeLabel']");
  $lblSomeLabel.hide();
</script>

Læs mere på api.jquery.com:

Attribute Ends With Selector [name$=”value”]

Windows finder ikke min beaglebone via browseren? (beaglebone.local)

http://beaglebone.local/ virker ikke i windows?

Installer Bonjour!

  1. Hent itunes
  2. Udpak installationsfilen med winrar
  3. kør Bonjour64.msi

Forsøg at gå til http://beaglebone.local/ igen.

Løsning fundet her: http://superuser.com/questions/491747/how-can-i-resolve-local-addresses-in-windows

Boot, ur og email

Når BBB starter op vil jeg have den til at stille uret og sende mig en email.

1. Installer exim4 (email program):

apt-get update
apt-get install exim4

2. konfigurer exim4:

dpkg-reconfigure exim4-config

Mail Server: “mail sent by smarthost; no local mail”
Mail Server configuration: “smtp.altiboxmail.dk”

/etc/exim4/update-exim4.conf.conf

dc_eximconfig_configtype='satellite'
dc_other_hostnames='beaglebone.localdomain'
dc_local_interfaces='127.0.0.1 ; ::1'
dc_readhost='beaglebone.localdomain'
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost='smtp.altiboxmail.dk'
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname='true'
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'

3. opret script til at sende email:
nano /root/emailnotify.sh

#!/bin/bash
#sleep 60
IP=`hostname -I`
HOSTNAME=`hostname -f`
echo "$HOSTNAME online. IP address: $IP" > /root/email.txt
echo >> /root/email.txt
date >> /root/email.txt
mail -s "$HOSTNAME online" -r root@$HOSTNAME max@max-it.dk < /root/email.txt
#cat /root/email.txt
rm -rf /root/email.txt
 

4. Opdater ur og kør email-script:

nano /etc/rc.local

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# update clock
ntpdate -b -s -u pool.ntp.org

# email
/root/emailnotify.sh

exit 0

5. genstart

reboot

6. Kontrol:

tail /var/log/exim4/mainlog

BBB Node og RS232

Gør ttyO1 tilgængelig fra boot (bemærk det er ttyO1, ikke tty01, altså et stort o, ikke et 0 (nul)):
http://beaglebone.cameon.net/home/serial-ports-uart

# ls -l /dev/ttyO*
crw-rw---- 1 root tty 247, 0 Jul 18 21:42 /dev/ttyO0

Rediger /boot/uEnv.txt

# nano /boot/uEnv.txt

Tilføj:

optargs=capemgr.enable_partno=BB-UART1
# reboot

Kontroller:

# ls -l /dev/ttyO*
crw-rw---- 1 root tty     247, 0 Jul 18 22:13 /dev/ttyO0
crw-rw---T 1 root dialout 247, 1 Jul 18 22:13 /dev/ttyO1

Installer node-serialport, express og socket.io

cd /var/lib/cloud9
npm install serialport && npm install express && npm install socket.io

Virker under node v0.10.38, npm v1.4.21

BBB Debian static IP

Rediger /etc/network/interfaces

nano /etc/network/interfaces

Tilføj/ret:

auto eth0
iface eth0 inet static
    address 192.168.1.215
    netmask 255.255.255.0
    gateway 192.168.1.1
    dns-nameservers 8.8.8.8
    dns-nameservers 8.8.4.4

Fjern wicd:

wicd er måske installeret og vil OGSÅ bestemme over ip config.
Ved afbrydelse og gentilslutning af netværk bestemmer wicd, ikke /etc/network/interfaces !!!

apt-get remove wicd-daemon
apt-get autoremove
reboot

Kontroller:

ifconfig