Friday, April 13, 2018

Listening For JS Error Events

I was recently reading a blog article, Ben Nadel JS Error.   In the article Ben showed how to setup an error event handler that would be triggered for any failed image loads on a page.  This was done by attaching an error event handler to the body element.  Also he had to pass the last argument to addEventListener as true so that it would trigger in the capture phase of the event. This event handler will run whenever an external resource like an image or a style sheet fails to load on the page.

After some experimenting I found that if I attach the event to the window object it is triggered for all the failed resources and also for any javascript errors that happen on the page.  Setting this up on a site with quite a bit of traffic from different browsers was very interesting.  It was a bit overwhelming at first until some things were fixed and some checking was added to filter out some of the errors.  In the event handler the event and error information is being posted back to a server and then sent in an email so it can be reviewed.


Wednesday, April 11, 2018

My First Memories of Coding

The first time I remember writing code was in grade school in the computer lab.  We were learning Basic.  I'm not sure how old I was, but it would have been sometime in the late '80s or early '90s.  I remember they had us write a program that would take some numbers from the user and print out the average.  I had to ask how to do division. I had only seen it with the standard division symbol in math class, not the forward slash.  Soon after that I was able to get Basic on my home PC.  Actually I think it was included in MS-DOS.

At school and in the beginning at home I was using Basic where you had to use line numbers to write your code.  Then to edit a line you had to retype that line with the number.  Soon after that I was able to get QBasic and a book to help me get started.


Sunday, March 5, 2017

Using IR codes from Broadlink backup file

This is a continuation of yesterdays post about the Broadlink RM2 wifi remote.  I was able to test out using the codes to control my remote today.  They are stored in JSON format in the broadlink backup file.  The backup file is a zip file.  After you extract it there is a folder named SharedData.  There are several files in the folder.  The one that seems to have all the codes is named jsonIrCode.  The data looks like an array of objects, each with a code and some other information.


Friday, March 3, 2017

Python control of Broadlink RM2 wifi remote

I recently got a Broadlink wifi remote.  I have been playing around trying to send commands to it with python.  I found code on github that does most of what I need.  It looks like the device itself doesn't learn any remote codes.  It is all in the app.  The code I found can send codes to the device and get codes from learning mode.
I have a bunch of buttons programmed in the app already.  I wanted to see if I could get those codes.  I think I got them today.  The app, called eControls, allows you to backup your setup.  Today I was able to get my backup file from their backup site.
Tomorrow I will try to use the codes from the backup.

Saturday, November 5, 2016

Getting Hidden App Data From Your Google Drive

Some Android applications use space on your Google Drive to store data.  You can't see this data by browsing drive the normal way.  You can get access to it if you get the access token from the app and do a few other things.

I use an app to keep some notes and other things.  They require getting the paid version of the app to backup your data.  I wanted to see if I could get it myself without paying for the app.  I found out how to do this from this Stackoverflow post http://stackoverflow.com/questions/22832104/see-hidden-app-data-in-google-drive.  The example there uses php. Since I have been learning Python recently, I decided to see if I could do the same thing with Python.

 There is a pretty good explanation of why you need to go through all the steps you need to go through to get your data in the accepted answer for that post, so I won't go into too much detail about that here.


Tuesday, August 2, 2016

More Python - From web servers to machine learning

I have an idea for building something with python that uses machine learning.  It also involves the web.  I have been working towards getting this all to work.
I started with the machine learning parts.  I am using the scikit learn library.  I have also looked into the tensor flow library that Google made.  I decided to stay with scikit learn for now.  It looks like you can transition pretty easily if it turns out I need to.
To test some parts of my idea I needed a web server.  I created one in python.  It took a bit of reading and several iterations before I got something that I liked.  It is now setup so that it will serve any files in a folder or allow me to do things with any custom urls that I want.
I'll try to post more about this soon.  Maybe I'll post some code.  Probably not.  I never have time for that anymore.

Thursday, June 23, 2016

Learning python

I've started learning python.  I started looking into it because we may be doing some things with it at work if we move away from coldfusion.
In a previous post I mentioned the Unity3d terrain editor and the ability to import and export the terrain height data.  I decided to try to create one of those height map images using python.   I found a Perlin noise library for python and started working on it.  I haven't quite got it right yet, but I was able to generate a file that can be imported.
I will try to post more about this with some actual code when I get it working.

Middle of the night AI thoughts

Patterns   Reinforcement learning based on finding patterns.  Could an AI look through data and find patterns, using this as positive reinfo...