Sunday, March 29, 2020

Processing Data from End Devices. (draft exploration)

 


end device capture and database side code
update with http://reactivex.io/documentation/observable.html 
with an interesting link??:
why? we might have multiple threads and we need to handle them asynchronously. see ryan dahl's node.js talk:
https://www.youtube.com/watch?v=jo_B4LTHi3I




https://www.youtube.com/watch?v=CrZL-A2v0s0  (end devices side w/ http get on laptop)
https://www.youtube.com/watch?v=lS5El3wH6XA (subset: sensor to lora board)



Utilized links:
https://heltec-automation-docs.readthedocs.io/en/latest/esp32/quick_start.html
https://stackoverflow.com/questions/6768793/get-the-full-url-in-php
https://developer.couchbase.com/documentation/server/3.x/developer/java-2.0/observables.html
https://reactphp.org/http-client/
https://www.php.net/manual/en/function.var-dump.php
https://stackoverflow.com/questions/7492145/php-mysql-insert-new-record-into-table-with-auto-increment-on-primary-key
https://stackoverflow.com/questions/5665571/auto-increment-in-phpmyadmin
https://stackoverflow.com/questions/3137925/mysql-maxid-called-from-php-produces-strange-value
https://www.php.net/manual/en/function.date.php
https://stackoverflow.com/questions/14912943/how-to-print-current-url-path
https://stackoverflow.com/questions/7537377/how-to-include-a-php-variable-inside-a-mysql-statement
https://stackoverflow.com/questions/6768793/get-the-full-url-in-php
https://www.php.net/manual/en/mysqli.query.php
https://www.thegeekstuff.com/2017/05/php-mysql-connect/
https://mediatemple.net/community/products/dv/204643880/how-can-i-create-a-phpinfo.php-page
https://hostadvice.com/how-to/how-to-enable-apache-mod_rewrite-on-an-ubuntu-18-04-vps-or-dedicated-server/
https://linuxize.com/post/show-tables-in-mysql-database/
https://www.petefreitag.com/item/516.cfm (installing php on apache 2)
https://ubuntuforums.org/showthread.php?t=1001780 (reset apache2 back to default)
https://stackoverflow.com/questions/12224431/create-a-root-password-for-phpmyadmin
https://stackoverflow.com/questions/37879448/mysql-fails-on-mysql-error-1524-hy000-plugin-auth-socket-is-not-loaded
https://tableplus.com/blog/2018/11/what-is-the-default-username-password-in-mysql.html
https://stackoverflow.com/questions/11657829/error-2002-hy000-cant-connect-to-local-mysql-server-through-socket-var-run
https://linuxconfig.org/how-to-reset-root-mysql-password-on-ubuntu-18-04-bionic-beaver-linux
https://support.rackspace.com/how-to/mysql-resetting-a-lost-mysql-root-password/
https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-18-04
https://github.com/Embedotronics/Sending-Temperature-and-Humidity-Data-to-MySQL-Server-PHPMYADMIN-using-Arduino/blob/master/DHT11_data_to_phpmyadmindatabase.ino (see related YouTube video)https://www.sitepoint.com/community/t/class-calling-external-function/3514
https://www.php.net/manual/en/function.var-dump.php
https://packagist.org/packages/react/react
https://reactphp.org/http-client/
https://requests.ryanmccue.info/
http://reactivex.io/documentation/observable.html
https://developer.couchbase.com/documentation/server/3.x/developer/java-2.0/observables.html
https://github.com/ReactiveX/RxPHP
https://www.php.net/manual/en/function.preg-filter.php
https://reactphp.org/event-loop/
https://www.gnu.org/software/grep/manual/grep.html#Generic-Program-Information
https://www.php.net/manual/en/context.http (simple http request. no library)

Thursday, March 26, 2020

taking data from a web server and writing it to a database?? (plan)

to pull data from a server and place it periodically in a sql database maybe I need:

https://amphp.org/amp/




and possibly streams from

https://reactphp.org/



first steps taken to get php to work with composer

Follow the instructions to quickly get composer installed in a particular folder::

https://getcomposer.org/download/

Create a composer.json file in the same folder::
https://getcomposer.org/doc/01-basic-usage.md#basic-usage



create a php file with the following contents::
https://getcomposer.org/doc/01-basic-usage.md#autoloading


add print_r($log); to see your object when running the php file.





Sunday, March 15, 2020

musings about dht

Brent shambaugh:
scr-1584310817.png scr-1584310817.png
2 replies
Brent Shambaugh:
IPFS uses a DHT. A hash table is a key-value store.
DHT:::
https://en.m.wikipedia.org/wiki/Distributed_hash_table
IPFS::
https://en.m.wikipedia.org/wiki/InterPlanetary_File_System
FWIW. https://thegraph.com/ maps the blockchain to IPFS and exposes queries to a GRAPHQL endpoint. There are a ton of them, including one for Moloch. A ton of them seems bad. I am not married to making thegraph better, but I see a potential application of mmkv.
"A distributed hash table (DHT) is a distributed system that provides a lookup service similar to a hash table: (key, value) pairs are stored in a DHT, and any participating node can efficiently retrieve the value associated with a given key. The main advantage of a DHT is that nodes can be added/removed with minimum work around re-distributing keys. Keys are unique identifiers which map to particular values, which in turn can be anything from addresses, to documents, to arbitrary data. Responsibility for maintaining the mapping from keys to values is distributed among the nodes, in such a way that a change in the set of participants causes a minimal amount of disruption. This allows a DHT to…"

"The InterPlanetary File System (IPFS) is a protocol and peer-to-peer network for storing and sharing data in a distributed file system. IPFS uses content-addressing to uniquely identify each file in a global namespace connecting all computing devices.IPFS allows users to not only receive but host content, in a similar manner to BitTorrent. As opposed to a centrally located server, IPFS is built around a decentralized system of user-operators who hold a portion of the overall data, creating a resilient system of file storage and sharing. Any user in the network can serve a file by its content address, and other peers in the network can find and request that content from any node who has it us…"
thegraph.com
A query protocol for building decentralized applications quickly on Ethereum and IPFS using GraphQL(238 kB)


How to copy and paste from xterm & also to pop of the "confguration menus" (ramblings)

[edit March 29th: the procedure followed in xterm is: (1) within the shell window ctrl+{left & right click}to get VT Options then mouseover (using track pad) "select to clipboard" , (2) right click and drag to highlight text in shell (3) left click to select to clipboard (4) Ctrl+V to paste where you prefer.]

This link gives cut and paste that works with the xterm with no special arguments:
https://scarygliders.net/2011/12/01/customize-xterm-the-original-and-best-terminal/
"

2) Cutting and pasting with Xterm

Cutting text with xterm is pretty much the same as with gnome terminal. The difference being that any text you select, automatically gets placed into the clipboard.
  • Drag the mouse cursor along the text you wish to copy whilst holding down the LEFT mouse button.
  • double-clicking on a word will select that word (or if you’ve included my tweaks it’ll select a whole URL)
  • triple-clicking on a line will select that line"


this was a pain to finally arrive at. I created a ~/.Xsession file and failed.

=========

as a sidenote "configuration menus":

ctrl+leftmousebutton -> main options
ctrl+rightmousebutton ->vt options
ctrl_rightmousebutton -> unicode facts


use the  trackpad to scroll around. lift your finger to select.

==========

xclip allows me to redirect output from a command to the clipboard. However I do not know how to configure it to allow be to use Ctrl+C, Ctrl+Shift+C Ctrl+PrtSrc (?) .

==============

xclip redirects output of a command to the clipboard:

https://opensource.com/article/19/7/xclip

===============

Payloads written to ~/.Xsession (2) and (3) starting with the link:
https://superuser.com/questions/487973/what-is-alternative-for-middle-click-paste-in-xorg

"
In most X11 programs, ShiftInsert should work – it pastes from the same "PRIMARY" selection that xterm copies to.
If you need to paste to Firefox or Chromium, though, you will need a program that synchronizes both selections, such as Klipper (KDE), Parcellite/Clipit (GNOME), or loliclip (generic). [The term is "clipboard manager".]

Alternatively, configure Xterm to copy to the "CLIPBOARD" selection instead, by adding one of the following to your ~/.Xresources file:
  1. Retain normal behavior when selecting, but copy to "CLIPBOARD" when CtrlShiftC is pressed:
    XTerm*vt100*translations:   #override           \n\
        Shift <Key> Delete: insert-selection(SELECT)    \n\
        Shift Ctrl <Key> C: select-end(CLIPBOARD)       \n\
        Shift Ctrl <Key> V: insert-selection(CLIPBOARD) \n\
        Shift Ctrl <Key> N: spawn-new-terminal()        \n
    
  2. Always copy to "CLIPBOARD" when selecting:
    XTerm*selectToClipboard: true
    
(Run xrdb -merge ~/.Xresources after editing.)

"

I have no idea where the middle click is. (I have a trackpad and a left and right mouse button)

xdm must have something to do with xterm  (/etc/X11/xdm) , (/etc/X11)

http://www.rru.com/~meo/pubsntalks/xrj/xdm.html


======

this fun stuff must be for ubuntu+gnome (https://www.howtogeek.com/440558/how-to-copy-and-paste-text-at-linuxs-bash-shell/) b/c it does not work for me

=======


 curiously, I can get Ctrl+C and Ctrl+V to work with xterm using:

"
30

Xterm uses cut buffers, not the standard X11 clipboard selection used for standard copy-paste that gnome-terminal and most other Linux programs now use.
But if you start xterm like this:
xterm -ls -xrm 'XTerm*selectToClipboard: true'&
then selections are available via the standard clipboard.
Read more at Copying and Pasting in Xterm | StarNet Knowledge Database - PC X, X Windows, X 11 & More - StarNet
The xcb program also provides command-line access to the cut buffers.
E.g. in Trusty Tahr 12.04, running lxde window manager, I can triple click on a line of text in xterm, which highlights it and puts it in cut buffer 0. I can then run xcb -p 0 which prints the line out on stdout.
For some reason it didn't work for me to click both buttons (simulating middle click) in an xterm, but shift-insert did work in an xterm.
" (https://askubuntu.com/questions/237942/how-does-copy-paste-work-with-xterm) ... I had an .Xsession file, but I do not know if it was used. I did not use the restarting xdm method described in (http://www.rru.com/~meo/pubsntalks/xrj/xdm.html) ... there are a lot of rc.d(?) (process daemons running) on startup that I do not understand.

================

In the process I discovered tmux:

https://www.hamvocke.com/blog/a-quick-and-easy-guide-to-tmux/

which the link describes as:

"tmux’s authors describe it as a terminal multiplexer. Behind this fancy term hides a simple concept: Within one terminal window you can open multiple windows and split-views (called “panes” in tmux lingo). Each pane will contain its own, independently running terminal instance."



Saturday, March 14, 2020

did thought

I'm probably going to pull in DIDs somewhere, and I hope it turns out amazingly well. someone told me that I should figure out how to track lots of drones. DIDs have to do with the E2E security scheme I am plotting. maybe I can find them if I search the DIDs? That is a whole other rabbit hole. (edited) 

Tuesday, March 10, 2020

notes about sbt and scala-ide

sbt project in eclipse:

https://www.lagomframework.com/documentation/1.6.x/java/EclipseSbt.html

https://www.scala-sbt.org/1.x/docs/sbt-by-example.html

http://scala-ide.org/