Category Archives: Programming

neDb Issues on

Share this:  

It’s really not Glitch’s fault. I’m the guy who decided that I wanted to use neDb to save my data in. But, every so often when I do a query, it doesn’t return anything. Do the query again and it correctly returns the data. During that time no inserts, updates, or deletes are going on.

I’m not sure exactly how I want to deal with this… I’ve gone down the neDb rabbit hole rather far at this point!

Using the Android Emulator

Share this:  

Apparently, the Android Emulator is part of the the Android Studio application. So I downloaded it from the Android Developer web site and installed it. I’ve been meaning to do this for a long time!

I don’t want to write Android apps (at least for the moment), but for now I’m interested in bringing up different web pages in the emulator’s browser that I might be working on and see how they lay out. I want to try out progressive web apps on them too!

I just finished installing the Pixel 2 API 29 and appears in a dropdown to build basically a do-nothing app I set up from a template.

I just ran the fmwhatsapp file and it takes a good while to bring up the emulator, let alone the do-nothing app!

Closed my do-nothing app and got back to Android’s “Home” screen. And, I was able to launch the Chrome browser on it.

I opened up a page I’ve been working on. Not bad! It looks like I will be able to test this way. ūüôā

Embedding a YouTube Video in a 3D Scene (THREE.JS)

Share this:  

I wanted to see if I could get a YouTube video to play on a plane inside of a Three.js rendering.

I have ideas for having pop-up short videos as part of interactive displays. We will see when and if I do something with this!


And it is possible, I found a  demo on the three.js web site, and built this Pen on CodePen which works nicely!

See the Pen YouTube Video Player in Three.js by Orville Chomer (@orvilleChomer) on CodePen.0

Cloudkit Fussiness in Xcode

Share this:  

Well, I’ve started to mess around with Cloudkit. And, before I could get out of the gate, before I could write a line of useful code, I ran into some troubles. These are probably due to my unique quirky circumstances. But then again, there are probably a small handful of developers who may have run into some of these problems and perhaps my blunders and lessons learned may be of help to you.

First of all, the Cloudkit Dashboard only “kind of” worked.

  • First problem here: I created my developer Apple Id a long long time ago when it could be anything (as long as someone else didn’t have it already).
    • Now, various Apple tools want your Apple Id to be a valid email address. Mine was not an email address! Never had been!
    • First of all, I created a new Gmail account just for my Apple Development work.
    • Then I had to figure out the process for changing my Apple Id. I dreaded that I would have to re-log into everything, and have things blowing up left and right. It turns out the process was not that scary and I did not have to re-log into everything! Phew!
    • The nasty messages about needing to have my Apple Id be an email address went away.
  • Second Problem: my iCloud log on.
    • When trying to access the private database in my project’s container, it said that I wasn’t logged into iCloud. But I was logged in! I checked!
    • It turned out that I couldn’t just be logged in with any old log in. The iCloud log in in my System Preferences had to be the same as my developer log in. What a pain! But, once I changed that, all of a sudden things started working…
      • On the Cloudkit Dashboard, I created a new record type in my private db, added a couple fields to it, and added a couple indexes to it to boot!

For now, on my Mac, I’ve set up a separate developer log on. If that’s what I need to do to get things to work that is what I will do. There is still a bunch of other things I need to set up on this new user account to make it usable for more than opening Xcode and building apps.

I’d rather have a spot in Xcode where I could log into iCloud just for the apps I’m building. Perhaps it’s there? Am I missing something? If you know something that I don’t leave a comment below.

Experiments with Getting Web Content Using ColdFusion and PHP

Share this:  

So you want to get content from another web site out there to use on your site. You may be doing screen scraping of a page out there… But a better use is to get info from some sort of a web API.

Case in point: Calling a URI from the U.S. Weather Service to get current weather information.

… This URI will return weather data from Chicago’s Midway Airport

Using ColdFusion

Here is a ColdFusion file for getting info on the current weather in Chicago:

It works fine. I do any Ajax call to “weather.cfm” from my home page, parse of the current temperature, and weather description and display it on my home page. ¬†Nice!


If I call “weather.cfm” directly, I get weather data back for Chicago’s weather:

Below you can roughly see how it displays this page in Safari:

If you were to view the source, this is approximately what you would see, XML output:

Again, I have a JavaScript routine that calls weather.cfm via AJAX and pulls data from the <weather></weather> and the <temp_f></temp_f> tags.

This was running in ColdFusion Developer on my iMac and I can access on my personal wifi network.


Using PHP

I also wanted to do the same sort of thing using PHP. I decided I would use cUrl. Here is the code I used in a file called “weather.php”:

Notice that the URL is the same one as I’m using in the ColdFusion example.


So what happens if I directly call this “weather.php” page I created in my Safari web browser?

Well, we get a page like the one displayed above. Bummer! This is running on a PHP MAMP server on the same iMac as the ColdFusion server is. And trust me, the ColdFusion server is not calling this URL with any special permissions!

This led me to suspect that there was something different about the HTTP Header being sent by the ColdFusion server than was being sent by the PHP server using cURL.

But how to figure out what ColdFusion is doing differently than PHP? ¬†Create a new PHP page to call instead of calling the xml file…



HTTP Header Test Page

I was going to create a PHP page that would look at it’s HTTP Header values and output them to the page for me to be able to see!

Here it is:


Now, if we changed weather.php to point to this URL, what do we get?

Note that the ‘1’ at the bottom is an artifact of cUrl (unless you set the¬†CURLOPT_RETURNTRANSFER option to true.

What about doing the same thing with weather.cfm ?

There is definitely a difference between the two. Both have the same value for “Host”. Not much else is the same! It could be that the PHP request has HTTP Headers that the server does not like… But I’m going with the assumption that the PHP request is MISSING one or more HTTP headers that the web server ( is expecting. So lets modify our weather.php file:


Notice above how I added a new block of code (lines 8 through 12). This is adding three headers to our HTTP Header: ‘User-Agent’, ‘Connection’, and ‘Accept-Encoding’. I saved my changes and refreshed this page.


But is the server looking for all three of these headers?

I remove¬†‘Accept-Encoding’. ¬†I refresh the browser. ¬†It still works.

I remove¬†‘Connection’. ¬†I refresh the browser. ¬†It still works.

And (of course) I remove¬†‘User-Agent’. ¬†I refresh the browser. ¬†And of course it fails.

So,¬†‘User-Agent’ is the key. Currently, in our example, it is set to the value of ‘ColdFusion’. Because that is the value I got when running the ColdFusion page. But actually (of course) our page is a PHP page when is requesting the info.

I change the value of ‘User-Agent’ from ‘ColdFusion’ to ‘PHP’. I refresh the browser and it works.

I wonder, is: ¬†¬† ¬† looking for specific values for this header, or just that the ‘User-Agent’ header is present in the HTTP header?

So, I change the value of ‘User-Agent’ to: ‘SugarBoogers’. ¬†I refresh the page and it works! This means that the server (at least in this case) is just checking to make sure that the ‘User-Agent’ HTTP Header is present and has a value… but doesn’t care WHAT the value is (I’m sure that ‘SugarBoogers’ is not a common user agent to check for!

Wrapping It Up

You might be able to “screen scrape” a web page without custom setting any HTTP headers. But I suspect that if your calling some sort of XML feed, JSON resource, or web service URI, there’s a good chance that you will need to set the ‘User-Agent’ HTTP header in order to get it to work.

Any comments? Thoughts? Let me know.

Happy Coding!



Entity Render Experiment in CodePen

Share this:  

Here is a little something that I’ve been messing around with in @CodePen. It renders the block diagram of a “data model.” ¬†If you’ve ever used a modeling tool like Erwin this will look familiar…

Screen Shot of Model Render Demo

This is an experiment in rendering a lot of UI elements (entities) without having poor performance. In that, it will only render to the DOM entities that can currently be seen in the view port.

Right now, by default, it generates 200 entities. Try 2000 or 20000, or any other positive integer value, and see how it performs!

There are still a few bugs in it (its rendering too many entities at a time for example), but I think it proves its certainly possible.

You can try it yourself on CodePen here:

Let me know what you think.

Enabling F12 Developer Tools in IE

Share this:  

For some strange reason on my work computer the F12 Developer Tools option was disabled on my Tools menu in Internet Explorer (IE 11). Other devs on my team had access to it, but I did not.

Well, I found out, at least in my case, that if I did the following steps, I could enable this option:

  • Click the “Start” button in the lower left-hand side of your screen.
  • Select the Run… option.
  • Type in the following and hit the Enter key: ¬† ¬† ¬†gpedit.msc
  • You may be prompted to enter your Window user name and password, if so, enter it in.
  • The Local Group Policy Editor will come up.
  • On the left hand side of this window is a tree navigation control.
  • Make sure that¬†the Computer Configuration node is expanded.
  • Under that, expand the Administrative Templates node.
  • Under that, expand the Windows Components node.
  • Under that, expand the Internet Explorer node.
  • Under that, select the Toolbars node.
  • Select the setting: ¬†Turn off Developer Tools
  • Click the edit policy setting link to the left.
  • Pick the Disabled option and Apply the changes.

That is it! After I did this the F12 Developer Tools option in IE was accessible to me!

Doing a Page Redirect from a Java Struts2 Action Class

Share this:  


I began working on a web site written in Java using Struts2. I wrote a general purpose class to be used by the application. One method in the class was supposed to check if the user was logged in. If not, redirect to the logon page (I did NOT want to add a tag entry to every <action> block in the struts.xml file)!

I searched the web and did not find anything that worked quite right. Finally, after some experimentation, I got something working! Here is some sample code for you:

Helper Class

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.servlet.*;
import javax.servlet.http.*;

public class myExample {
   public void doARedirectToGoogle() {
      HttpServletResponse response = ServletActionContext.getResponse();
      try {
      } catch (IOException e) {
      } // end of try / catch
   } // end of doARedirectToGoogle() method
} // end of myExample class

Note the try/catch block must be in place in order for this to compile and work.

Struts2 Action Class:

import com.chomer.demo;

public class demoPage extends ActionSupport {
   public String execute() {
      myExample demo = new myExample();
      return "success";
   } // end off execute() method
} // end of demoPage class

Action Block added to struts.xml:

<action name="demoPage" method="execute" class="com.chomer.actions.demoPage">
   <result name="success">/pages/demoPage.jsp</result>
   <result name="error">/pages/demoPageErr.jsp</result>

Success Page… demoPage.jsp:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %>
      <h1>This page will come up if the redirect does not work!</h1>

Failure Page… demoPageErr.jsp:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %>
      <h1>This page will come up if the redirect does not work AND there was an error!</h1>

In the above example I made up some arbitrary packages names. You will have your own structure in place. If this works you should never see the success or failure page.

In a real world scenario, the redirect would happen only if a certain condition was being met (such as the user is not logged in). If the user were logged in, demoPage.jsp’s contents would appear.

Time Off and Some Progress on my Own Blog Software

Share this:  

Yay! I am off until the end of the year! When it comes to vacation where I work its “use it or lose it!”

Blog Software
Its on Apache, using PHP, mySQL, and a .htaccess  file. After futsing about I got the .htaccess file doing what I want for my new blog software (I am no expert on this file by any means though).

The development environment is my iMac using MAMP. I’ve got it reading a site table in my mySQL database. This software will support multiple sites on one server!

Next I’ve got to look up how to use sub-string functions in PHP. I need to take the rootPath field value from my sites table and compare it with the beginning of the URI that the user typed in in their browser. If it matches, I will set the site id, if not, I want to have some sort of fall-out page.

Wishing for Memory Functions in JavaScript

Share this:  

At work I am working on a web app that is very data intensive. A whole lot is done on the client side in JavaScript. There are certain instances in tests I have done where I have run out of memory.

I can adjust parameters down until the errors go away but:

  • Am I getting the absolute best usage of my memory or am I “leaving my change on the table?”
  • What if a user’s PC has less memory than me, are they going to get out of memory errors?
  • What if a user’s PC has a lot more memory than I do… then they really will not be able to leverage that extra memory to their advantage.

I wish there were two JavaScript functions available for programmers to use:

  • totalMemory()
  • availableMemory()

The functions could be called something else, that’s fine. But if there were these functions and if they returned the number of bytes relative to what was accessible to that current instance of the web browser, that would be so useful! As far as I know, JavaScript does not have any functions like this. I’ve looked ūüôā

Am I missing something? Are there functions or object properties that I’ve missed? If you are a web developer working on some data intensive stuff on the client side don’t you wish you had these functions available?

One More Memory Related Thing
One more thing regarding JavaScript memory usage… There is a piece of info that I do know is out there somewhere… but I have not found yet… How much memory do JavaScript variables use?

I assume strings ¬†may use 1 byte per character (or do they use 2 bytes to support unicode). I assume booleans take the least amount of memory (possibly 1 bit)? There are integers and floating point values… how many bytes do they use each? What is the overhead number of bytes for each variable and for each element in an array? Knowing this information could be helpful in deciding how to store information in memory the most efficient way.

Microsoft says that their floating point variables in JavaScript use 8 bytes (search for the word “byte” on the page).

This looks like an interesting JS library: something where you pass in a variable or JSON string and it returns how many bytes it takes up.  I have to investigate this further when I have some time!

1 2 3