Carnali.com
  • Home
  • Home
Carnali.com

Serving humanity for over fifty years

Other

Cookie Inflation

by Al March 13, 2023
written by Al
Missing Oreos.
Missing Oreos

I purchased some Lemon Oreos yesterday and when I opened them today found that each row in the package was missing either two or three cookies. (See above photo) I don’t know if this was a packaging mistake or just the way they sell them. It’s possible that they share packaging between the different types of Oreos and that the lemon version are more expensive so they put in less. It’s also possible that they just started including fewer Oreos to keep from having to raise the price as a consequence of Biden’s inflation. No matter what, it doesn’t give the customer a good first impression of the product when you open the package.

On the same store trip, while standing in line I noticed that M&Ms are now $2.50 per package. $2.50! Just incredible.

March 13, 2023 0 comment
0 FacebookTwitterPinterestEmail
Personal

Job Interview Update

by Al June 14, 2022
written by Al

A couple of weeks ago, I mentioned that I was going on a job interview. I did and was actually offered the job but ended up turning it down.

The process had started with a recruiter contacting me and telling me about a job that had come up that was a close match to my skillset. Usually, I just ignore these calls because more often that not, they’re not even close to matching what I do. This time though it was a good match so I decided to pursue it.

Before going too deep into it, I told the recruiter my salary requirements. I’ve run into situations before where a company wants to hire an experienced engineer but wants to pay them what they would pay someone that had just graduated from college and had no experience. I didn’t want to waste my time if this was going to be one of those deals. He assured me there would be no problem and that the salary that I was asking for was right in the range that they were expecting to pay. Good enough. I agreed to go forward with it.

First stage was a phone interview. It included myself and four people from the company, one of which was the CEO himself which I thought was a bit odd for the first interview since usually upper management doesn’t get involved until you’ve passed through the gatekeepers. The interview went on for about an hour. Things went well and although the CEO seemed a little confrontational everyone else was fine and seemed to think I’d be a good fit.

I got a call from the software manager a few days latter saying that they were definitely interested in me and wanted me to come in and do a live interview. Once again, I brought up my salary requirements and was assured that it would not be a problem.

They set up the interview and I was supposed to meet with four people but when I arrived at the company the only one that was there to interview me was the software manager. All others were out of the office that day. Seemed kind of odd. Anyway, the manager was nice enough, seemed to know his stuff and wanted me to start as soon as possible. He just needed to get final approval from the CEO.

A few days, go by and I finally get an e-mail with an offer. As you may already of guessed, it was less than what I was asking for. In all honesty, it was still a pretty good offer but it wasn’t what we had verbally agreed upon. This seemed wrong to me so I declined the offer. I didn’t know if this was just a negotiating tactic on their part or whether it was a far as they were going to go but I wasn’t willing to back down since I had received assurances that they would indeed be willing to pay me what I was asking for.

In the mean time, I took another look at the offer. Initially, I was just looking at the salary, but upon further inspection I learned that the benefits were abysmal. One weeks vacation, one week of sick time and only five paid holidays per year. On top of that they talked about health insurance and said that it would be split by the company and the employee but gave no indication of the percentages. Usually when they leave out something, it’s for a reason, so I’m guessing that the insurance split was not going to a positive thing.

There seemed to be lots of bad signs here, so I decided even if they contacted me with a better offer I was not going to take it.

I received a call from the manager who told me it was a small company and they couldn’t afford to pay what I was asking and that even if they could, it wouldn’t be fair to the existing employees. Both these things may have been true but why did they assure me up front that the salary would not be a problem?

Anyway, I politely declined the offer with the following e-mail:

Hi XXX,

Sorry I missed you.  I was outside doing some yard work and didn’t have my phone with me.

I’m going to pass.  It wasn’t just the salary, the benefits just weren’t there either.  I appreciate that you’re a small company and I also understand the politics involved in keeping a whole group happy with various salaries makes things complex.  I just don’t think I’d be happy there under the circumstances.

It was really nice meeting you and I do appreciate the time you took showing me around the place.   No hard feelings on my part and I hope the same goes for you.  Sometimes things just don’t work out.

Thanks again and best of luck to you and the people of YYY,

Al

I do wish them luck, but I’m glad I declined. The money wasn’t the big issue, it was the fact that they mislead me about the money that was the issue. Turning it around, if I had told them I was an expert in C++ and then at the last minute told them I really wasn’t all that good at it, would they still have hired me? Of course not and rightfully so. Honesty is important and starting a job where my first interaction with management was a negative one did not sit well. I would have been unhappy with them from the start and I don’t believe that’s the best way to go into a new job.

June 14, 2022 0 comment
0 FacebookTwitterPinterestEmail
Technology

Improving the Music Inventory Example from Head First Object Oriented Analysis and Design

by Al June 13, 2022
written by Al

I’ve been refreshing my knowledge of software design by working through the book, ‘Head First Object Oriented Analysis and Design.’

One of the examples that they use to show how designs can evolve and be improved upon over time is an application that is used to track musical instruments inventory. The initial design of the app is poor in that it lacks maintainability and requires modification of existing classes (one of the no-no’s of SOLID design principles) and the addition of many new classes any time you want to add a new instrument type to the application. In chapter 5 of the book, they improve the design considerably by replacing unique classes for each instrument with a single class, InstrumentSpec that maintains a list of properties for the instrument that it represents. Not only does this eliminate the need for the creation of a new instrument class, it also allows you to dynamically add new properties to each class instead of having them hardwired into the class.

While I agree with them about the software being greatly improved, I still feel there’s one glaring problem with it. When a new property is added to the InstrumentSpec class it uses a key/value pair to store the property. For the key, they’ve chosen to use the string type. While this gives you a lot of flexibility, I feel it’s pretty much a disaster waiting to happen. Not only does the user of InstrumentSpec has to be relied upon to make sure the string is a valid value and is spelled correctly, if a mistake is made it won’t be found at compile time but instead will manifest itself at runtime. The last thing you want happening is your software to fail in the field instead of failing when you’re designing it. Granted a lot of this can be avoided by the use of appropriate test cases but that still takes a leap of faith that the error will be caught.

A better way to handle this is to replace the string key with an enumeration key. This prevents the user from ever using an invalid key and also prevents the code from compiling if an incorrect key is used. The only downside to this approach is that you have to modify the PropertyKey enumeration any time you add a new property to the software. To me this seems a minor tradeoff that goes a long way towards creating more robust software.

The following example shows the use of property keys instead of strings.

InstrumentSpec.cs

using System;
using System.Collections.Generic;

namespace CH3_Guitar_Application
{
    internal class InstrumentSpec
    {
        private Dictionary<PropertyKeys, object> _properties;

        public InstrumentSpec(Dictionary<PropertyKeys, object> properties)
        {
            if (properties == null)
                _properties = new Dictionary<PropertyKeys, object>();
            else
                _properties = new Dictionary<PropertyKeys, object>(properties);
        }

        public object GetProperty(PropertyKeys propertyName)
        {
            return _properties[propertyName];
        }

        public Dictionary<PropertyKeys, object> GetProperties()
        {
            return _properties;
        }

        public Boolean Matches(InstrumentSpec otherSpec)
        {
            foreach (var property in otherSpec.GetProperties())
            {
                if (!_properties.TryGetValue(property.Key, out var value))
                    return false;

                if (property.Value != value)
                    return false;
            }

            return true;
        }
    }
}

PropertyKeys.cs

namespace CH3_Guitar_Application
{
    internal enum PropertyKeys
    {
        INSTRUMENT_TYPE,
        BUILDER,
        MODEL,
        INSTRUMENT_STYLE,
        NUM_STRINGS,
        TOP_WOOD,
        BACK_WOOD
    }
}

A second problem that I ran into was because of my choice of rewriting the examples in C# instead of doing them in Java like the book does.

The original application prints out a human readable string based on the value of an enumeration. This string is different than the actual name of the enumeration and is not a problem in Java. Unfortunately, in C# the enum type is limited and if you attempt to use the ToString() method to print out the enum, it will display the actual enum text instead of something that is tailored for readability.

To fix this problem, I replaced the enum type with the Enumeration class written by Jimmy Bogard. https://lostechies.com/jimmybogard/2008/08/12/enumeration-classes/ Not only does this class allow you to associate a human readable string with an enumeration, it also allows you to add methods to the enumeration if you need to perform other operations when using the enum. Most of the time you won’t need all this extra functionality and regular enums will do just fine but if you ever do, it’s nice to know this class is available.

Here’s an example of using the Enumeration class. Just subclass the Enumeration class, add your enumeration values with a human readable string and you’re good to go.

InstrumentType.cs

namespace CH3_Guitar_Application
{
    public class InstrumentType : Enumeration
    {
        public static readonly InstrumentType GUITAR = new InstrumentType(0, "Guitar");
        public static readonly InstrumentType BANJO = new InstrumentType(1, "Banjo");
        public static readonly InstrumentType DOBRO = new InstrumentType(2, "Dobro");
        public static readonly InstrumentType FIDDLE = new InstrumentType(3, "Fiddle");
        public static readonly InstrumentType BASS = new InstrumentType(4, "Bass");
        public static readonly InstrumentType MANDOLIN = new InstrumentType(5, "Mandolin");
        public static readonly InstrumentType ANY = new InstrumentType(6, "Unspecified");

        private InstrumentType()
        {
        }

        private InstrumentType(int value, string displayName) : base(value, displayName)
        {
        }
    }
}

June 13, 2022 0 comment
0 FacebookTwitterPinterestEmail
Personal

Mail and E-mail

by Al May 29, 2022
written by Al

Yesterday, I was thinking about how much e-mail is like regular mail.

When I was a kid, during summer vacation, I couldn’t wait for the mail to arrive, always believing that today would be the day that something really cool would appear. It never did. Mostly the mail consisted of ads and bills.

I do the same with e-mail now. When I’m working on my computer, every time the e-mail chime goes off I’m immediately checking to see what came in, expecting it to be something interesting. It seldom is. Like regular mail, it mostly contains ads and bills. The only difference is that now I get to pay those bill instead of my parents paying them.

May 29, 2022 0 comment
0 FacebookTwitterPinterestEmail
Personal

New Toy – Husqvarna 525RC Brushcutter

by Al May 27, 2022
written by Al

I purchased a Husqvarna 525RC Brushcutter at the local Lowes today. I mentioned in a previous post how I had replaced the carburetor on an old brushcutter that I owned and was still having a few problems with it. I planned on troubleshooting it and hoped to find out what was going on with it but decided I really needed something now so I ended up buying the Husqvarna instead.

The unit is solid, well built and a lot more powerful than the previous brushcutter. It vibrates a whole lot less than the old brushcutter and because of that it’s a lot more pleasant to use. Assembly was relatively easy but the instructions weren’t all that great. Lots of little illustrations that didn’t really do a good job of showing you what you needed to do. Luckily, YouTube had some decent videos that I was able to watch to learn what I needed to know.

The Husqvarna is probably more than I need but it should last a long time and I’d rather over-buy then find out later that I owned something that wasn’t up to the job.

We have a few acres of land and there’s constantly stuff growing up between the ground cover and some places that I just can’t get to with the lawn tractor so the brushcutter fills in the gaps.

Gas powered equipment is great but it’s also a pain. Yearly maintenance is needed and unless you’re someone that’s into that sort of thing (which I’m not), it’s kind of a drag. The alternative is electric but it’s not as powerful, needs to be charged and your stuck with expensive dead batteries that are hard to dispose of when they go bad. It might work if you’re just doing a small back yard but if you have a large property, it’s just not practical.

May 27, 2022 0 comment
0 FacebookTwitterPinterestEmail
Uncategorized

Job Interview

by Al May 26, 2022
written by Al

I had an onsite job interview today. This was a follow up to a phone interview that took place last week. After completing the phone interview I was pretty sure that I had done well and was under consideration so when they called me in for a face to face I wasn’t really all that surprised. What did surprise me is when I got there, it appeared that they had pretty much decided they would already hire me and that this second ‘interview’ was more a chance to see the place than it was additional vetting. I was also surprised that it looks like if the details can be ironed out, I’ll be starting next week.

The new place is a semi-conductor equipment company. Even though it appears to have been around for awhile, it seems that they run it more like a start-up and that the attitude is more about getting things done with little emphasis on the layers of corporate BS that seem to have infected a lot of the companies that I’ve worked for in the past. I hope this is the case. It would be really refreshing.

May 26, 2022 0 comment
0 FacebookTwitterPinterestEmail
Personal

Dentist Appointment and Installing a Carburetor

by Al May 25, 2022
written by Al

Dentist appointment this morning. I had my teeth cleaned. The most painful part was paying for it out of my own pocket because I don’t currently have dental insurance. When I semi-retired last fall I looked into it but it appeared that after you got the insurance, you had to wait anywhere from six months to a year for most of the benefits to kick in. Didn’t seem like a good deal to me.

I spent the afternoon installing a new carburetor on a brush cutter/weed wacker. I’ve had the thing for a number of years now and did little maintenance on it outside of changing the sparkplug. Last year it seemed sluggish, this year it seemed really sluggish. Sometimes it would run decently while other times it would barely run and didn’t even seem to want to turn the blade. I took a small engine repair course in the fall and after bringing it in and demoing it, the instructor said it was most likely the carburetor failing. Since it was a two-cycle engine he recommended replacing it instead of rebuilding it since the cost would be about the same and rebuilding would require a lot more work. I purchased a cheap Chinese knockoff carburetor on Amazon (which the instructor said would be just fine) and finally got around to installing it today. It took a while to do but was fairly straight forward. After completing the installation I revved it up and sorry to say it’s not any better. It might actually be a little worse. At least it started though which shows I probably did the installation correctly. I’ll take another look at it this weekend and see if I can figure out what’s going on with it. It may just be time for a new brush cutter.

Here’s a helpful hint. The most important thing I learned in the small engine repair course was not to use regular gas in small engines. The ethanol that the government requires in the gas leaves deposits and will destroy an engine over time. If you’re using a small device such as a weed wacker your best bet is probably the 100% gas available at places like Home Depot. If you’re using a lawn tractor or something bigger go with premium and put an engine stabilizer in it to keep it from spoiling.

May 25, 2022 0 comment
0 FacebookTwitterPinterestEmail
Fun

When Good Toilet Seats Go Bad

by Al May 24, 2022
written by Al

My family says I’m cheap. I like to think of myself as frugal. It’s not that I won’t spend money or always go for the cheapest deal. It’s just that I won’t spend money on something that I don’t perceive as worth it. I’ll buy the top of the line if it gives me something that other products don’t but I won’t spend money needlessly for status or prestige.

Sometimes that gets me into trouble.

The other day our toilet seat broke. One of the hinges on the back snapped off. (Perhaps we should consider diets.) Anyway, it was time to replace it so I looked at the seats that were available at The Home Depot. Thirty dollars for a toilet seat! Ridiculous. It’s a toilet seat for crying out loud. You sit on it, do you business and move on. Surely, I could get something for less than thirty dollars.

So I checked out the Walmart site.

They had a wooden seat available for eighteen dollars. Now we’re talking. Under twenty bucks, made of wood, none of that cheap plastic and on top of that, it got lots of good reviews.

I drove to Walmart to check it out. Yup. Looked good. Solid construction, enamel coated and built like a tank. The thing should last me for years.

Made the purchase, drove home and installed it. The installation seemed a little weird. Instead of bolting the seat directly to the toilet, you install the plastic bolts in the holes on the toilet, slide the seat on to the bolts, tighten the bolts down and snap shut the covers.

I did the first two steps but skipped the third. I didn’t want to overtighten the bolts and risk breaking anything so I went lightly and left the snap on covers up thinking in a week or so I could tighten them up a bit more if they loosened up.

That was a mistake.

After using the toilet for the first time when I went to get up, the seat shot off the bolts landing my backside in the water and the seat on the ground. Luckily no injuries were sustained. Should have tightened the damn things. My fault.

So I redid my work; this time tightening the bolts snuggly and and making sure that the covers were on tight. That seemed to do the trick. The seat was on solidly now. There would be no chance of an embarrassing accident and an awkward conversation with the paramedics.

I thought my problems were solved until we started using the thing. The seat and cover were really heavy and if you let them loose while closing them, they would crash down on to the porcelain toilet with a big bang. One time I just attempted to put the seat down and the cover came crashing down catching my thumb between the cover and the seat. It hurt like hell and the thumbnail is still aching.

I finally came to my senses. The risk of injury or cracking of the porcelain toilet from a falling lid were just too much. I figured it was just a matter of time before something bad happened, so I went to The Home Depot and bought the thirty dollar seat.

So now I’m out fifty bucks. Twenty for the unusable seat and thirty for the good one. If that’s not enough, I think I’m going to lose my thumbnail.

Sometimes it doesn’t pay to be cheap… I mean frugal.

May 24, 2022 0 comment
0 FacebookTwitterPinterestEmail
Python

Python Dictionary Comprehension

by Al February 27, 2022
written by Al

I’ve been busy refreshing my Python skills by working through the excellent udemy, 100 Days of Code: The Complete Python Pro Bootcamp for 2022 course by Dr. Angela Yu.

I’m currently working on day 48 which involves scrapping the Upcoming Events section of the Python.org website using the Selenium WebDriver. In the example code, Dr. Yu shows how to write the output of the scrapping operation into a dictionary using a for loop but says that it also could be accomplished using dictionary comprehension. I decided that would be an interesting challenge and would help to reinforce my knowledge of dictionary comprehension so I gave it a try.

I thought that it would be a fairly easy thing to do but it turned out to be more complex that I anticipated. I did a search for examples and came up with nothing so I’ve decided to share what I found here, hoping that it might help someone else.

Lets start by showing the desired output structure:

and here’s the code that I used to accomplish the task:

from selenium import webdriver
from selenium.webdriver.common.by import By

chrome_driver_path = "C:/Development/chromedriver.exe"

THE_URL = "https://www.python.org/"

driver = webdriver.Chrome(executable_path=chrome_driver_path)

driver.get(THE_URL)

event_times = driver.find_elements(By.CSS_SELECTOR, value=".event-widget time")
event_names = driver.find_elements(By.CSS_SELECTOR, value=".event-widget li a")

events = {}

events = {x: {"time": value[0].text, "name": value[1].text} for x, value in enumerate(zip(event_times, event_names))}

print(events)

driver.quit()

Most of it is pretty straight forward. I use the find_elements function to create two lists containing times and event using the CSS_SELECTOR as the key. Next comes the fun part, using dictionary comprehension to massage the results into the desired format.

Here’s an explanation of what’s going on:

The zip function combines the two list together allowing you to access both the time and name data simultaneously during each iteration of the loop. If we were just creating a dictionary with time and event data this would be alright but we are really trying to create a set of dictionaries within dictionaries with the key to outer dictionary being an integer value from 0..n. To accomplish this, we need to pass the zip function to the enumerate function.

The enumerate function will take the output of the zip function, wrap in into a tuple and associate it with an index value. The ‘for x, value’ part of the statement is assigning names to those values with x representing the index and value representing the tuple.

The final part of the statement ‘{x: {“time”: value[0].text, “name”: value[1].text}’ is pretty much standard dictionary comprehension stuff, were using the values we’ve just retrieved to write out the entries to the dictionary. Note that we access the both the time and name values by dereferencing the tuple using and index value.

The code is not all that complicated and once written it seems pretty obvious but if your just starting out with this stuff it could be intimidating. I hope this example will help someone else trying to accomplish the same task.

February 27, 2022 0 comment
0 FacebookTwitterPinterestEmail
AstronomyPhotographyTechnology

Horsehead Nebula and Flame Nebula

by Al November 15, 2021
written by Al
Horsehead Nebula and Flame Nebula

The Horsehead Nebula and Flame Nebula (lower left). Narrowband hydrogen-alpha, sulfur II and oxygen III data was acquired over two nights, processed using Pixinsight and the channels were mapped to the Hubble Palette. Not my favorite color combination but it does bring out a lot of detail in the image.

Astrophotography is tough. Before you can produce anything of interest, you first need to learn how to use your equipment to acquire images and then you need to learn how to use the software tools to process those images.

On the acquisition side, you’re having to master the use of a lot of different hardware. You need to understand and be able to set up a telescope, a mount, an auto-focuser and a color wheel and connect all of these to a computer so you can guide the mount and acquire your images. If you make a mistake with any of these, you have probably wasted a nights worth of work. You can look for help online but everyones setup is slightly different so you’ll probably have to do a lot of experimentation to make your own equipment work properly.

On the processing side, the tools are daunting. My processing tool of choice is called Pixinsight which consists of a suite of processes that you run your images through to achieve your final image. Almost all the processes have multiple parameters that you can tweek to control the mathematics behind the processing of the images. I suspect few actually understand what all of the parameters do and mostly rely on experimentation to determine the best values for their images.

Understanding what processes to use and the order in which to apply them is another challange. For me, as I suspect it is for most people, the path to learning was to watch lots of YouTube videos, try out the various techniques, and over time, build up a repertoire of things that work while tossing out the things that dont. This takes many hours and often ends with sub-optimal results that you end up just throwing away. It can be frustrating.

Unless you have lots of time and patience, you should probably consider another hobby. On the other hand, if you like challenges and are willing to put in the time, it can be really fun.

November 15, 2021 0 comment
0 FacebookTwitterPinterestEmail
Newer Posts
Older Posts

Categories

  • Adventure
  • Astronomy
  • Culture
  • Fun
  • Interesting
  • Music
  • Other
  • Personal
  • Photography
  • Politics
  • Python
  • Reviews
  • Slider
  • Technology
  • Uncategorized
  • Facebook
  • Twitter
  • Youtube

@2019 - All Right Reserved. Designed and Developed by PenciDesign


Back To Top