X X X

Pageviews

Socialize - Share

Share

Monday, September 15, 2025

Do you pray before you write code?

Of course, you say your morning prayers to guide and protect you throughout the day, but have you thought about saying a prayer, perhaps one from a saint like Saint Thomas Aquinas, before you start writing new code? Or do you wait until you're struggling with debugging and fully immersed in frustration?

That was me too.

I still get anxious and jump in before I write, but when I stop, pray, think, and then jump, I find that development goes much better. Debugging has more common-sense cause and effect.

Try it for a week and see if it doesn't reduce your stress and improve your success. You'll feel smarter and more productive without the surprises.

I recommend this one from Saint Thomas Aquinas

Creator of all things, true Source of light and wisdom, lofty origin of all being, graciously let a ray of Your brilliance penetrate into the darkness of my understanding and take from me the double darkness in which I have been born, an obscurity of both sin and ignorance.

Give me a sharp sense of understanding, a retentive memory, and the ability to grasp things correctly and fundamentally.

Grant me the talent of being exact in my explanations, and the ability to express myself with thoroughness and charm. Point out the beginning, direct the progress, and help in completion; through Christ our Lord.

Amen

Friday, February 16, 2024

Bard is now Gemini

Bard is now known as Gemini, the best way to get direct access to Gemini models. You can chat with Gemini to supercharge your ideas.

Sunday, July 23, 2023

In case you missed it - 2020

FICO Score scoring changed to F10

The new version, FICO 10 Suite, has been largely adopted by many lenders. Recall all the TV Ads promoting the ability to track your FICO score. With this model, personal loans are treated as a separate category of debt.

One of the notable changes means that, if someone consolidated their credit card with a loan, and then continued to run up debt, that will hurt their score.

A Longer-Term View of Credit

A version of the new model, called 10T, evaluates credit card usage trends over 24 months rather than provide a monthly snapshot. With this formula, someone who carries a high credit card balance for a month or two after, say, a vacation trip, then pays it off is less likely to see a lower credit score than before. By contrast, someone who fails to pay off balances consistently is penalized. Based on the impact of past changes in scoring models, FICO 10 shifts the average score a modest amount, perhaps 20 to 25 points.

The changes came as a result of credit scores rising -- the average score reached an all-time high of 703 2019, according to a report from Experian. Scores in the 670 to 739 range are considered good; scores between 740 and 799 are very good, and 800-plus is exceptional.

One reason for the rise in scores is that negative credit indicators, such as bankruptcies and unpaid debts, fall off credit reports after seven years. That's happened for many consumers given the long economic recovery since the Great Recession in 2008-2009. Besides, "Trending data has better predictive value in terms of assessing risk."

MORE ON CREDIT SCORES
  • Why It's Still So Hard to Fix Credit Report Errors
  • More From Consumer Reports
  • What's a Good Credit Score?
  • Smart Strategies for Millennials to Build Credit
  • More From Consumer Reports

Sunday, July 9, 2023

Battery Life i.e., Your Cell Phone

Forget about your big-huge EV car battery and the thousands of dollars to replace that when its time comes, but rather, you can see and feel it in your cell phone when your lithium-ion battery doesn't seem to take a full charge. Eventually it feels like you are constantly putting it back on the charger to get through the day, until you decide to toss it for a new cell phone (lease).

Rechargable batteries have a lifespan and it is not forever. The life of a rechargable battery is related to its chemical age. This is more than just the length of time since the battery was assembled from its raw elements. It chemical age results from a complex combination of multiple factors, such as temperature history and (probably most importantly) the charging pattern. All rechargeable batteries are consumable components that become less effective as they chemically age. As a lithium-ion battery chemically age, the amount of charge it can hold diminishes, resulting in reduced battery life and reduced peak performance.

Monday, March 22, 2021

Swift iOS HTTP / HTTPS new construct: NSURLSession

let defaultSession = URLSession(configuration: .default)
var dataTask: URLSessionDataTask?
dataTask?.cancel()
    

if var urlComponents = URLComponents(string: "https://itunes.apple.com/search") {
  urlComponents.query = "media=music&entity=song&term=\(searchTerm)"      

  guard let url = urlComponents.url else {
    return
  }

  dataTask = 
    defaultSession.dataTask(with: url) { [weak self] data, response, error in 
    defer {
      self?.dataTask = nil
    }

    if let error = error {
      self?.errorMessage += "DataTask error: " + 
                              error.localizedDescription + "\n"
    } else if 
      let data = data,
      let response = response as? HTTPURLResponse,
      response.statusCode == 200 {       
      self?.updateSearchResults(data)

      DispatchQueue.main.async {
        completion(self?.tracks, self?.errorMessage ?? "")
      }
    }
  }

  dataTask?.resume()
}

Wednesday, December 2, 2020

Dependency Injection in Android

Fundamentals of dependency injection

Any module that relies on an underlying technology or platform is less reusable and makes changes to software complex and expensive. With proper decomposing of the complex problem, that is being addressed by a software module, into smaller components enables defining dependency components. Then when the time comes to replace a component, it is less disruptive to the larger component, therefore, more reusable.

The Dependency Injection pattern based on the "inversion of control" (IoC) principle. This relates to the way in which an object obtains references to its dependencies - the object is passed its dependencies through constructor arguments or after construction through setter methods or interface methods. It is called dependency injection since the dependencies of an object are 'injected' into it, the term dependency is a little misleading here, since it is not a new 'dependency' which is injected but rather a 'provider' of that particular capability. For example, passing a database connection as an argument to a constructor instead of creating one internal would be categorized as dependency injection. The pattern seeks to establish a level of abstraction via a public interface and to remove dependencies on components by supplying a 'plugin' architecture. This means that the individual components are tied together by the architecture rather than being linked together themselves. The responsibility for object creation and linking is removed from the objects themselves and moved to a factory.

There are 3 forms of dependency injection: setter-, constructor- and interface-based injection.

When developing - for example - a business service, that service is implemented to work with an interface of the Data Access Object. If you then want to use that module with a certain DAO - for example a DAO to access your mySQL database - you somehow have to tell the service to use exactly that object. This, however, would create a dependency between the service and the DAO. With the IoC pattern, as implemented in Spring, the developer defines which DAO (in this case the mySQL DAO) in an external configuration file (in our example: beans.xml). At runtime, the information from the configuration file are parsed and the dependency is injected into the service.

Use the dependency injection pattern when:

  • the coupling between components needs to be reduced
  • you are expecting to run controlled unit tests.
  • With dependency injection, testing can begin very early in the development cycle
  • you want to save time in that you don't have to write boilerplate factory creation code over and over again

What is dependency injection?

Classes often require references to other classes. For example, a Car class might need a reference to an Engine class. These required classes are called dependencies, and in this example the Car class is dependent on having an instance of the Engine class to run.

There are three ways for a class to get an object it needs:

The class constructs the dependency it needs. In the example above, Car would create and initialize its own instance of Engine. Grab it from somewhere else. Some Android APIs, such as Context getters and getSystemService(), work this way. Have it supplied as a parameter. The app can provide these dependencies when the class is constructed or pass them in to the functions that need each dependency. In the example above, the Car constructor would receive Engine as a parameter. The third option is dependency injection! With this approach you take the dependencies of a class and provide them rather than having the class instance obtain them itself.


References

Essence of Android Architecture Components

Drive UI/UX from a model

A key principle of AAC is that the code should be model-centric and drive the UI/UX from a model. The majority of all apps benefit from a persistent model. Models are the components that are responsible for handling the data/content that supports the Business Use Cases for any typical app. The model(s) are independent from the View/Widget objects and app components in your app, so they can be unaffected by the app's lifecycle and the resulting concerns.

Persistence is important for the following disruptive reasons:

Users won't lose data if the Android OS destroys the app to free up resources. The app continues to work in cases when a network connection is unstable or unreachable. By basing the app on model classes, with well-defined boundaries of responsibility for managing the data, the app is more consistent and verifiable.


References
UA-42937108-2