The Man in the Arena

It is not the critic who counts; not the man who points out how the strong man stumbles, or where the doer of deeds could have done them better. The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood; who strives valiantly; who errs, who comes short again and again, because there is no effort without error and shortcoming; but who does actually strive to do the deeds; who knows great enthusiasms, the great devotions; who spends himself in a worthy cause; who at the best knows in the end the triumph of high achievement, and who at the worst, if he fails, at least fails while daring greatly, so that his place shall never be with those cold and timid souls who neither know victory nor defeat.  –Theodore Roosevelt

This blog is one way I have stepped into the “Arena”.  Of course the dust and sweat and blood are only figurative for me. All that I risk is my pride, and reputation.  Thinking of myself a little less often is always a worthy goal.  My reputation is how I build my client base.  Risking my reputation can have a negative impact on my income.

I was reminded this week that taking risk has some advantages. I listen to multiple podcasts each week.  On the Photography Tips From The Top Floor podcast, Chris mentions that he only does most photo tours “twice only” and refers to an article that explains why.  This article reminded me that by taking chances I am stretching myself, and adding a little spice to what I do.

A software engineer has reminded me several times “If it were easy, anybody could do it.” Just because something is difficult, doesn’t mean I shouldn’t try.  I should weigh the value of trying and failing against “Aiming at nothing” and succeeding. Often, trying and failing is more valuable than not trying. Sometimes the difficult project has very little value to me even if I succeed.

Recently I have been working on a project that requires knowledge of web development.  Because I haven’t had any experience with web protocols, this has been a difficult project.  I didn’t shy away from the project because it was difficult.  However, I have found that I don’t like working in that world. For future projects when web protocols are required, I will hire out that part of the project or not take that part on in the first place.

From this experience, I am still willing to take chances, like making a voltage boost circuit without any experience.  I have also learned an area of programming that I should leave to other professionals.  This voltage boost circuit has been a great learning experience and I am still learning.  I had no idea whether I would be able to make it work or not.  I hope I have encouraged you to take a chance and try something difficult to do.

I have not received any negative comments.  Very few comments at all really.  After doing this for over a year, I had anticipated more interaction with you the readers.  How have you taken a risk recently?  Did you learn from it?  Did you succeed or fail on your goal?

Web Server feature customization

I found out why my URLs without .html on the end weren’t being handled the same as the rest.  There is an array defined in app.c that maps URL paths to alternate paths.

URLsI haven’t found the code that uses this yet, but it seems pretty straight forward what this is used for.

In the function init_http_server in app.c I found several functions that I think I don’t want.  I put a // at the beginning of those lines so that the compiler treats those lines of code as comments.  This is called “commenting out”.  This is useful when removing code that you suspect has an error, or , as in this case, I suspect I can remove.

I don’t need the captive portal. I am happy if users can use the IP address to get to the web server.  Having a domain name and using the web server from within a local network complicates things.

I commented out the lines:

    http_server_bind_domain(INTERFACE_DOMAIN);
    http_server_enable_captive_portal();
and
    http_server_bind_urls((http_server_url *)&api_urls);

I compiled with these changes, “crossed my fingers”, and uploaded. And… I got a continuous stream of reboots with messages coming into the serial terminal program at 115,200.  this means it started the code that initializes the UART and failed some time after that.

Backing up, I uncommented the server_bind lines and again tested on my board. I am able to connect to the Access Point with my android phone. When I point my phone browser to 192.168.4.1, I get an empty page. When I point my desktop browser to the assigned network address, I also get a blank page from the server.  When I point either browser to smart.relay.com. they both load the initial webpage.

I decided to do a hello world cgi function trying to understand how things work.  To the api_urls I added an entry pointing to a new function called http_tst_api_hello.  I then added that function to the cgirelay.c and cgirelay.h files.  The new function will send “Hello World” out on the serial port using the DBG macro.  The new button shows up on the page, but doesn’t appear to do anything except cause a jump to the top of the page.

I don’t know Javascript, CSS and only a little bit of HTML, this part is going to be a challenge. I did finally get what I was trying to do.  Seems like a small step, but it took a lot of studying and tinkering.

I am not putting any of this code up on github, because I am only taking steps to learn how things work. When I start building in real functionality, then I will start putting this code on github.

Web Page Hello World

Serial Hello World