Dev box
I'm a 32-year-old Ruby on Rails web developer. With the help of friends and co-workers, I've been teaching myself Rails. I worked as a Rails developer for Crowd911 in Colorado. I live in Berlin.
In my developer blog I publish a stochastic array of thoughts and ideas, lessons, mistakes, questions and attempts as answers about Rails and Ruby. I am also posting Anki cards that I used to help myself study. In my view most knowledge is about practice. If you have thoughts, questions, ideas, corrections, arguments, feel free to email me at henryvw@gmail.com.

Chrome OS X - Removing Browser Pop-Ups

How to get rid of thoser annoying pop-ups? Delete or Rename the Captive Assistant,

https://discussions.apple.com/thread/3308224?tstart=0

 

Read More

MySQL Database with Homebrew

Instally MySQL with Homebrew. 

Way easier.

You can even run "brew services start mysql" to have it run with launchctl on its own at startup, etc.

  • https://coderwall.com/p/os6woq/uninstall-all-those-broken-versions-of-mysql-and-re-install-it-with-brew-on-mac-mavericks

 

brew services start mysql

brew services stop mysql

 

It installs mysql WITHOUT root password. Thank goodness. Then you can change it yourself.

Read More
MySQL

Launching and shutting down MySQL Databases on a Mac

If you just find the process and do "kill -9" or "kill" the database will restart with another new PID. 

The MySQL database is part of a launch-control (launchctl) function that keeps it running. So you need to shut that down.

sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
Read More
MySQL

Learning about Javascript, HTML, & Web API, Event Listeners, Callback Functions, (Inside Event Listeners), Streams, DOM Emitting Events

Me working below on replacing, concatenating and adding an event listener on elements. 

HTML DOM emits a kind of stream of outputs on "events" like, "click", "scroll", and most fundamentally, "change." You can also customize your own "event". Any existing Web API events, or your own customized event, you can then "listen" to that event. The DOM element automatically emits a new snapshot of itself on the event. And you can write "callback" functions to take the argument of that snapshot output ("event") and do stuff with it, e.g., post it to the console.log, or add it elsewhere back into the DOM, or whatever you want.

Another learning. ".innerHTML" is a kind of weird "method" in that it is actually an ATTRIBUTE of elements like, <p>, <h>  etc. For normal DOM objects you can't just say, "element.innerHTML = something ". You need to say, "element.appendData = something ".

Lastly, rather than making lots of DOM calls, you can prepare a Javascript ARRAY and then make calls off of that, and let it be the one point of DOM-call.

+<script>
    + var booking_day = document.getElementById("booking_starts_at_1x");
    + var booking_month = document.getElementById("booking_starts_at_2x");
    + var booking_year = document.getElementById("booking_starts_at_3x");
    + var booking_request_date = [ booking_day.value, booking_month.value, booking_year.value ];
    + var booking_date = document.getElementById("at_date");
    +
    + booking_day.addEventListener("change", function(event){
    + booking_request_date[0] = event.target.value
    + booking_date.value = booking_request_date.join("")
    + console.log(booking_date.value)
    + })
    + booking_month.addEventListener("change", function(event){
    + booking_request_date[1] = event.target.value
    + booking_date.value = booking_request_date.join("")
    + console.log(booking_date.value)
    + })
    + booking_year.addEventListener("change", function(event){
    + booking_request_date[2] = event.target.value
    + booking_date.value = booking_request_date.join("")
    + console.log(booking_date.value)
    + })
    +
    + var booking_hour = document.getElementById("booking_starts_at_4x");
    + var booking_minute = document.getElementById("booking_starts_at_5x");
    + var booking_request_time = [ booking_hour.value, booking_minute.value ];
    + var booking_time = document.getElementById("at_time");
    +
    + booking_hour.addEventListener("change", function(event){
    + booking_request_time[0] = event.target.value
    + booking_time.value = booking_request_time.join("")
    + console.log(booking_time.value)
    + })
    + booking_minute.addEventListener("change", function(event){
    + booking_request_time[1] = event.target.value
    + booking_time.value = booking_request_time.join("")
    + console.log(booking_time.value)
    + })
    +
    +</script>

 


Tim explaining Callback functions to me:

  1. function abstractMethod( eventName, callback ){
  2.   varevent="test"
  3.   if(eventName ==="change"){
  4.     callback(event)
  5.   }
  6. }
  7. abstractMethod('change',function(event){
  8.   console.log(event)
  9. })
  10. #############################################################
  11. def abstract_method( eventName, callback)
  12.   event="test"
  13.   if eventName =="change"
  14.     callback(event)
  15.   end
  16. end
  17. def callbackMethod(event)
  18. end
  19. abstract_method("change", callbackMethod)
Read More
DOM, HTML, addEventListener

Learning about Javascript, HTML, & Web API, Event Listeners, Callback Functions, (Inside Event Listeners), Streams, DOM Emitting Events

 

Me working below on replacing, concatenating and adding an event listener on elements. 

HTML DOM emits a kind of stream of outputs on "events" like, "click", "scroll", and most fundamentally, "change." You can also customize your own "event". Any existing Web API events, or your own customized event, you can then "listen" to that event. The DOM element automatically emits a new snapshot of itself on the event. And you can write "callback" functions to take the argument of that snapshot output ("event") and do stuff with it, e.g., post it to the console.log, or add it elsewhere back into the DOM, or whatever you want.

 

166   var aphrodite_style_option = document.createElement("option");

167   var booking_day = document.getElementById("booking_starts_at_1x");

168   var booking_month = document.getElementById("booking_starts_at_2x");

169   var booking_year = document.getElementById("booking_starts_at_3x");

170   var booking_request_date = booking_day.value + booking_month.value +  booking_year.value;

171   var aphrodite_style_textnode = document.createTextNode(booking_request_date);

172   var transfer_new_booking = document.getElementById("transfer_new_booking");

173   transfer_new_booking.appendChild(aphrodite_style_textnode);

174

175

176   booking_day.addEventListener("change", function(event){

177     console.log(event.target.value)

178   })

179 </script>

 


Tim explaining Callback functions to me:

  1. function abstractMethod( eventName, callback ){
  2.   varevent="test"
  3.   if(eventName ==="change"){
  4.     callback(event)
  5.   }
  6. }
  7. abstractMethod('change',function(event){
  8.   console.log(event)
  9. })
  10. #############################################################
  11. def abstract_method( eventName, callback)
  12.   event="test"
  13.   if eventName =="change"
  14.     callback(event)
  15.   end
  16. end
  17. def callbackMethod(event)
  18. end
  19. abstract_method("change", callbackMethod)
Read More
DOM, HTML, addEventListener






Footerfull