Saturday, December 30, 2023

The bad water heater that wasn't: A Disconnect

 We were out of town for a few days when my parents, who were puppy sitting, let us know that our water heater stopped producing hot water.  "Great.." is what went through my mind.  When we got back, I did some checks on the water heater.  The smart controls were blank. My non-contact voltage tested (which is all I could find that second) indicated that power was getting to it at the wires entering the water heater. I even verified that power was getting to the elements - but no hot water output.  So I assumed that lighting or a surge fried the electronics. 

I would try to fix myself but no replacement parts at the local store. I didn't want to call a plumber - the cost at that point would be close to replacement cost of the water heater.  So I did the next best thing. I bought a new non-smart water heater. I turned off the breaker and installed over a couple hours.  Hours later, as I went to test and enjoy the fresh hot water - I was disappointed.  There still wasn't any hot water.  What?

I searched around and finally found my multi-meter and checked  the electrical.  I was only getting a few volts instead of the 240v I expected.  So it did have power but just barely.  So I checked the breaker and it had 240v as expected.  I also had a disconnect switch for the water heater that I had installed next to it.  I went to pull the disconnect out and wasn't able to. At that point, I figured that was a bad sign and related to the issue. I ended up breaking most of the surrounding plastic face for the disconnect. I finally was able to get to the internals and found that they were melted and the metal switch pieces were not touching correctly. 

Once I finally extracted the rest of the parts, I could tell that one of the screw terminals must have loosened and then heated excessively - melting the supports and causing the remaining metal to lose further contact.

A trip to Lowe's got me a new disconnect box. After installation and a "good tightening", we finally had hot water.

Here is a picture of the melted disconnect switch parts.



This was an inconvenient problem but we were blessed by the fact we didn't have a house fire which this could easily could have produced.

Hope your day is blessed. Thanks for reading!

Scott

Tuesday, June 6, 2023

JSR 376 / Java Platform Module system and Service Loader experience

 I have some pet projects I work on and I decided to convert one from a plain Java project over to using the Java Service loader and the Java Platform Module System.  The project uses a few well known libraries but isn't using Spring or other giant frameworks. I figured this should be pretty straight forward to do.

I started by converting over to the Java Service loader and after a bit of refactoring I got that working pretty well.  I expect anyone trying to convert an application or service over to it will find plenty of things that should be refactored to make it work well. It was a good experience though even though it was a good amount of work initially.

And then I started the conversion to the Java Platform Module system.  This was pretty difficult to get started and required more work and refactoring.  Some issues may simply be tooling issues in Eclipse or something along those lines.  For my first attempt, I eventually bailed on it and started from scratch again. 

At this point, I did make lots of good progress. I had things pretty much sorted out except for one thing. I had a problem with the Infinispan cache and the module system.  I didn't expect that and I tried all kinds of things to get past the issue.  I eventually ended using the JSR 107 Cache-api to abstract as much as possible from Infinispan specifics.  At this point, I expected it to work but I finally ended up at a particular error. The error indicated that there was an Infinispan package name that existed in two different jar files (with different classes) and that isn't supported by the module system.  I thought maybe it was a regression or small oversight - I mean, the module system has been around for some time now.  

I did a search of Infinispan issues for JSR 376, Jigsaw and platform module system but found no issues.  I finally put in an issue and the next day the tech lead closed the issue as a duplicate.  The original issue was reported by that tech lead back in 2019 as a high priority ticket.  If I had searched for "module", I probably would have found it.  Anyways, being that this was known since 2019 and the original ticket mentioned more packages that were split between jars - I am guessing this won't end up fixed anytime soon.

I removed Infinispan and am just using the JSR-107 support as a way to hide my use of a simple map for in-memory use for now.  I wanted to persist my data (which was a key benefit of Infinispan) so I briefly looked at creating my own file based persistence layer using some plain IO stream support along with protobuffers but even that had some issues.  

I'm planning to switch to ASN.1 - that is more standardized and has better "enterprise support" than most of the other serialization frameworks. Try finding active open source projects for "serialization" from google results related to that.  There are a few but there are many more that seem pretty dead. ASN.1 isn't going away anytime soon and there is an active Java project supporting it (along with many other language projects).

Thanks for reading!

Scott

[2023/06/11 Update] I'm coming to the conclusion that using the Java Platform Module system is both too high of a risk and too painful to do for any large software system. It is a risk because you can't guarantee it is going to work in a fully modular system because so many libraries and transitive dependencies are not modularized and/or have split packages. Based on how long the feature has been around, I don't see the situation improving without some major push that forces it. Trying to use Maven plugins such as "moditect-maven-plugin" and the "jlink" tool is way more effort than a short or mid-term payback would make worthwhile. Working with this tooling and trying to resolve the issues one at a time is a huge headache - certain errors are not found in a deterministic fashion. This means that you add a "fix" into the config and rerun your build and you don't get the error but you end up with a different one.  This doesn't mean you fixed the original error, it just means that it didn't pick the same problem point to report on.

I'm also rethinking the ASN.1 conversion. I was able to get the asn1bean project compiled (i.e. the ASN1 Compiler part) with Java 18 with some effort. I'm still determining if the generated code will really work the way I need/expect it to.  I've got some other things I want to work on now so maybe I'll come back to it later.


Jokes for my kids

My kids like to grown at my "bad dad" jokes. I come up with quite a few but I tend to quickly forget them before sharing.  I hope to capture many of the jokes here so they can be shared later.

  • What did the sheep say when a pig told them that all the cows got stuck in the mud by the pond?
    • The sheep said that is a "Cow-tastrophe".
  • What did the carrot say to the mature green onion when it saw containers of new onions?
    • You should be proud of your bunches of "bunches of [baby] onions"!

Here are my Chick-fil-a jokes from some time ago.

Random ideas and questions

  1.  Since the gravity from a black hole pulls in both light and matter, how might someone determine the effect on matter as it is drawn into a black hole?
    1. Could quantum entanglement be used? If two atoms were quantum entangled and one was released into the gravity of a black hole could you monitor the remaining atom for changes in spin patterns as the other atom is drawn into the black hole? What about trying to change the spin of the local atom and determine if there is any type of resistance to change in the spin? Would we even know if/when the quantum entanglement was broken or disrupted?
  2. Every CNC type machine I am aware of uses electric motors (servo or stepper) to drive a screw rod which then moves a platform or device. As the desired max distance increases, it becomes more difficult (or expensive) to handle larger speeds due to rod "flapping" (over a distance without any intermediate supports). Thicker/stiffer rods or reduced speeds often help. Is there a potentially better method available?  Maybe an electric motor with a hollow threaded shaft mounted to the platform instead? So instead of the long threaded shaft spinning, the electric motors threaded shaft spins and moves the platform along the threaded rod?  Downside is extra weight of electric motor on top of the normal platform/device weight. 
  3. Homes have all types of appliance that either generate, consume and/or move heat from one place to another; Clothes dryers create heat, hot water generation creates and/or consumes heat, refrigerators and HVAC move heat between locations. Would it be useful/possible to design homes with a "central heat exchanger" where waste heat could be transferred to devices needing heat? i.e. Heat produced by a clothes dryer might get transferred to a water heater instead of directly vented to outside a house. This might need intentional design support for appliances and there are likely issues with "dirty sources" like lint in dryer exhaust. Probably many other issues I'm not thinking of this second.
  4. Hot water is useful and needed for many things - showers, baths, washing dishes/clothes, pool heating, etc. In warm climates, using some form of solar heating of water usually involves use of some type of plastic piping, etc which is directly exposed to sunlight - where the heat transfers through the pipe into the water/liquid which then is moved somewhere else for use.  The piping outside is usually on a roof or possibly even taking up space in a yard.  Instead of having external piping, would it be efficient enough to use attic space?  The roof area is typically pretty significant so a huge amount of piping could be run in between rafters/trusses. Lack of direct sun reduces efficiency but the larger area and tendency to retain heat may make up for it - although cost may be a limiting factor. I also wonder if using the "waste heat" from an attic may provide a benefit of lowering cooling needs for a home? There would be obvious concerns about leaks in an attic but I wonder if techniques used for joining pipes for underground geothermal lines might work well. There is also the "my roofer used too long of a nail" type problems to avoid.
  5. If small drones were combined with helium "balloons" for lack of a better description and light weight, flexible solar panels with power storage - could it maintain flight for weeks or more? Could modular, self-assembling floating platforms be created from groups of drones? It would likely need some sort of method to prevent "flapping" of the joined drones - maybe some sort of torsion bar joined across the drones.  I visualize this like torsion bars in cars and trucks. I don't consider this "floating" drone as a close cousin to blimps, etc - it would be more aerodynamic and suited to maintaining its location with relatively low power consumption.  Applications of this might include long term monitoring of beaches and shallows (for sharks, etc), wildlife movements (pythons in Florida, turtle nests in remote areas), security, ground monitoring (sinkholes?), disaster relief deliveries, search/rescue, etc. Some domains are likely better handled by simpler technology so this would be more specialized. Domains of use should require fast setup, easy to relocate/remove/replace, reduce danger to human life for placing/operating/monitoring.

Monday, April 10, 2023

Selecting technology for a software system


Selecting technology for a new software system is challenging. There are very diverse technologies available and opinions on each are equally diverse. You may find some people with the opinion that the selection isn't hard because there is only one good choice (or close to it) - in their opinion given their requirements and assumptions.  

Why do I feel the selection is difficult? There are a number of reasons. 

  • Is there a perfect programming language for all needs?
    • No; each language has trade-offs.
  • In a number of cases, a specific language may be a good choice but you also need to consider different runtime environments for a language and the inherent trade-offs.
  • Different business domains / uses may match up better to specific languages or technology stacks.
  • A language / runtime isn't a solution on its own; you also need to consider the overall environment in which the software will operate.
  • Some software systems require higher security and some technology stacks are more mature in that area.
  • Some systems are especially sensitive to the speed of implementation.
  • The expected lifetime of a system and maintenance needs affects choices.
  • The maturity of the 3rd party ecosystem for a language / tech stack affects choices.
  • Another item which tends to be considered but usually without thinking about it is - what languages are your staff skilled with?
  • And then you have the choices affecting performance, scalability, reliability, cost, etc.
The above list is a bit abstract in nature.  What are some very real and important examples?

A common language that comes up often as the "golden choice" is Python. Is Python a good language - yes, for appropriate uses/domains.  I won't dive into what are good uses for it, I tend to prefer knowing how to rule out items so I can get to a short list for final selection. In the case of Python, what aspects are worth considering? 
  • Memory handling
  • Threading / Giant lock
  • Build time / dependencies
  • Backers of the language
One aspect of memory handling that is problematic (at a minimum for CPython) is that there is no control of limits by the runtime system. In standalone / local applications, this isn't a huge burden but if you are using a containerization / orchestration type systems such as Docker or Kubernetes (K8S) then you run into a dilemma.  Docker / K8S enable you to set memory limits and when those limits are exceeded, generally the container is killed and restarted.  The CPython runtime isn't aware when there is memory pressure and isn't tuned to attempt to prevent over-allocation.  To prevent containers from over allocating memory and being killed - more headroom memory is needed per container instance.  This can reduce the efficient use of memory which increases cost.  If you try to run more CPython processes in a container to improve generally efficiency - you can cause more workloads to restart due to a single over-allocation. The result is poor user experience. Increasing the number of container instances requires adequate memory for each which translates into higher costs.  

CPython also has a giant lock which impedes its multi-threading capabilities (Python GIL / Threading). So managing high request rates in a web application may provide some challenges. You may think it is easily resolved by use of some messaging type system (maybe Kafka, MQ, etc) but if the client libraries don't work-around the inherent issue then you end up with problems that may be hard to diagnose and even harder to fix. 

If you are using a standard interpreted version of Python then you don't really need to worry about build time related to your actual code but you may need to deal with the time required for building any required native dependencies. There are many libraries that work with Python but they are implemented using native libraries which the Python runtime loads and uses. This often means you need C/C++ and / or other compilers to enable building the native libs. This can be slow and error prone when working with containers initially. Given time and effort, you can create a solid build process but this is something that brings the overall complexity of creating, containerizing and deploying a software system to levels similar to compiled languages.

Every popular language remains popular by changing enough to meet new needs and challenges in the software development ecosystem. In some cases, languages are backed by committees (C++) and others have a community/large organization as the primary backing (Java, .Net). For Python, Guido appears to maintain primary control and he has done a wonderful job. The question is - someday, when Guido decides to step away completely - who or what controls the direction of the language and will it diverge much from Guido's current direction?  One link regarding the "no future Python 4" path is: No Python 4.
If you invest heavily in Python and something changes significantly (and quickly) then it could be very costly to change. At the same time, if a language looses popularity after its creator moves on then you may also be in a bad state.

The above coverage of Python is mainly targeted at CPython. The analysis for a different runtime, such as Jython, would need an independent review.  Performance, backing/maintenance and implementation details can be very different.

Another common language stack is NodeJS / JavaScript. It is often touted as high performance and has a large ecosystem of 3rd party libraries.  What aspects of this might affect the consideration for some software system?

Two item that comes up regularly for me are
  • The maturity of the 3rd party ecosystem. 
  • The expected lifetime of a system.
The problem I tend to run into is that there are many 3rd party libraries but the quality differs drastically and the long term support/maintenance of some frameworks is lacking. If you have a system which you expect to maintain for 5-10 years then you probably want to base it on technology which gets continued incremental maintenance over time.  Relying on unmaintained libraries and frameworks when security is important seems like a poor bet. You also don't want to do massive rewrites of a system every year because some new "great idea" arrived.  I've run into situations where core libraries used in NodeJS applications were abandoned by authors in favor of other completely different solutions.  I'd even agree with the authors decisions to abandon something which was no longer a good fit - but it isn't a good place to be in if you heavily rely on that software in a large or complex system.

Another popular language is Java - what are some considerations for it?
  • Speed of system implementation
  • Business domain for new system
Java is a good general language but it isn't normally considered as the first choice when "speed to market" is the most critical aspect. If you have a very limited time frame and no other requirements push you towards Java then another language may be more appropriate.  That is also true if your business domain is potentially in a scientific area where there are fewer 3rd party libraries available compared to a language such as Python. 

And if you have requirements which cross a number of these items resulting in no "perfect for this use" selection then you have hard decisions to make. 

This post could go on for many more examples and languages but hopefully provides a useful analysis for some of the challenges involved.

Wishing you the best!
Scott

Sunday, March 5, 2023

What is difficult?

 It is days like today where the meaning of difficult changes.  Before today, difficult meant dealing with things like a couple of spots of skin cancer on a nose and recovery after surgery.  It also meant dealing with the frustration of finding a good job in the IT field again. And then there are other aches and pains to deal with.

Today it changed a bit. 

Our daughter decided she wanted to join the Marines just before last Christmas (2022).  We sent her off on Dec. 19th, 2022 and in about 2 weeks she ended up with injuries of unknown severity.  Initially she was told it was just a stress fracture in one foot.  Over the weeks, she was in more pain and swelling so finally they did an MRI. It now appears that it is more severe than a stress fracture and both tibia's might also be affected. She went from simply being on crutches to a boot and a wheelchair.  With only 5 minutes a week of phone time, it is difficult to get the full picture of what is going on.

So 'difficult' is having your child in pain, away from home and no one knowing what her medical outcome is going to be. 

The best we can do is pray and ask for prayers from others.

God is always in control..  need to remember this more than daily.

I wish everyone a blessed day.

Scott

Monday, February 6, 2023

Prime number definition using geometry?

I've not seen a definition of "prime numbers" based on geometry and I wonder if there is one. It seems plausible that a definition is possible by using polygons or at least vertices/points and connections between them with some constraints. 

Maybe something like;  

For a set of [N > 2] points forming a polygon; N is prime if you cannot add internal non-overlapping edges resulting in all polygons with an equal number of vertices.

Of course, this doesn't cover 2 so it wouldn't be a general solution and may fail in other cases - I haven't put a lot of thought into it.

Friday, January 20, 2023

Skin cancer - don't delay

The COVID pandemic was difficult in many ways for many people. One of the aspects for myself was that I delayed some medical things which I now know was a mistake. If you are uncomfortable with pictures of medical wounds then skip those at the end of this.

Normal I wouldn't say much about medical items in a blog entry since it makes me very self-conscious. I'm making an exception for this since it could help others to decide to get checkups and prevent them from going through the same issues.

Late last year I decided to start getting some checkups and one of those was for skin cancer.  This wasn't my first checkup but it had been sometime since the previous one.  At that November checkup, I ended up getting multiple biopsies done.  One of those biopsies came back as basal cell carcinoma on my nose.  The good news is this is much easier cancer to treat than some others. 

I was quickly scheduled for a Mohs surgery in early December. That surgery involves repeatedly removing skin layers and testing for cancer.  So you go into the surgical office and they numb up the area and remove a layer.  You then sit in a waiting room while they test it.  If it comes back cancer free then you are done.  If the sample still contained cancer then you immediately repeat that process.  I'm under the impression that 1-3 surgical rounds are normal. It took 3 rounds to get all my cancer. Once done, they use some sort of laser to cauterize the area to stop any bleeding.

The numbing method involved injecting lidocaine at a number of spots surrounding the target area for the surgery. This was a little uncomfortable but not even close to passing kidney stones.  With this numbing method, this is an outpatient surgery and you remain awake during it.  I think I was at the surgical office for about 4 hours.

The cauterization was a bit difficult for me.  Another patient had mentioned it in the waiting room beforehand so I was a bit prepared. The nose area is very sensitive, bleeds easily and my blood had been thinned a bit for other stuff. It took them some time to get the bleeding under control.

I was pretty worn out by the end up surgery but needed cosmetic surgery to cover the hole.  I went back to the surgeon the next day and she ended up doing a skin graft. She took skin from slightly above the area and shifted it down over the wound.

It has been about 6 weeks since the graft. Every week or 2 I go back in to get the area looked at.  It seems to be healing well but the resulting scab is still there.  I'm supposed to keep Vaseline and a bandage on it most of the time. As of the last follow-up appointment, I'm supposed to soak/wet the area with a rag or gauze for 20 minutes a day. Hoping that it will come off cleanly before the next 2-week appointment.

Here I am after the initial surgery but before the skin graft. It felt like I could store a couple dimes in the wound.


The below picture is immediately after the graft was done.


This picture represents most of the 6 weeks after the stitches were removed and the initial swelling went down. 

I'm supposed to put Vaseline on the area and keep it bandaged. Our "medical kit" was original put together when our kids were young.  Our kids are adults now.  I was desperate for a bandage this day before going to a followup appointment.  I got a few looks, smiles and maybe a few laughs at the surgeons office.

Before going in for surgery, some friends from up north gave me some ideas for my resulting "nose job". I touched up a photo to represent one of my friends ideas for me.  The "blue nose" is from some fish picture.  

I hope your day is blessed and your family is healthy!
Scott

Friday, January 13, 2023

From Gnome to KDE

 I've been using Ubuntu for some time along with Gnome. It had been working pretty well until I started to experiment a bit more with GPU related technologies and a few other items.  At some point, my system ended up with an issue where the systems settings app (as example) would sort of "strobe" for lack of a better description.  I didn't find a good way to fix it and after quite a few months I decided to try KDE instead.  

I like KDE. The process of manually converting to KDE wasn't super easy though. I've slowly fixed various issues. One issue was simply that wallpaper settings were lost when the screen saver or other power saving features kicked in.  I did a cleanup of installed software packages and found a few new packages to add - and suddenly it seems to work now (for now).  I do have 2 graphics cards and 3 monitors so I  think that complicated things a bit. I also try to keep up with more recent Linux kernels - stuck on a 6.1 rc version right now.

I also have FreeBSD installed and am trying to get that working adequately.  If I get that working smoother then I may switch over to it.  The software available via package management may not be quite as recent as on Linux but it may be more stable.

As another alternative, I'm working with the "nix" package management on Linux now as well.  It could be a good alternative to other options.  I'm not overly fond of snap packages and similar - has been a bit limiting in customization and a few other areas. Maybe there are workarounds but if nix fixes my complaints without added complexity then it seems like a good idea. 

Wishing everyone a blessed day!

Scott