Posts

Why I'm Not Down with GitHub Copilot

Image
  If you don’t know how something works, how can you fix it when it doesn’t  work? This is why I’m not entirely behind something like GitHub Copilot. It’s already easy for developers to copy and paste code they find on the internet and implement it without understanding how it works. Here’s a ridiculous, real-world example. In 1979, “Star Trek: The Motion Picture” was released. It had amazing special effects but awful pacing. It’s a slow movie, to put it lightly. Yet it’s been re-released twice in the past 20 years with additional special effects work…and not much done to improve its pace. The special effects were never the problem, but that’s what they’ve “fixed”, twice. This is a movie which includes a 10 minute long sequence with no dialog, just the characters flying through a cloud and looking at a viewscreen. They might as well have put the word “Intermission” on the screen during this sequence so the audience would know they could get up, use the bathroom, and not miss anything i

Ranking Queen’s Studio Albums

Image
One of my favorite bands is Queen . Probably more than any band, the music of Queen takes me back to certain moments of my life, as if part of the soundtrack to it. Along with Iron Maiden , they were a perennial during a period of my life. Just recently, I started listening to them again after many years without. I became a fan after their career with the original lineup had ended, and over the course of some time collected their albums. I didn't get them all in the order they were released (far from it), and could easily pick up an album from a different stage in their career which was much different in style from whatever my previous purchase was. Below is my ranking of their studio albums, from least favorite to favorite. This is just my opinion , and not an attempt to say "this album is better than that  one" -- it's only personal preference. 15. Flash Gordon Released 12/8/1980 This album is ranked last on my list simply because it's the one I listen to least.

Formatting Dates in Angular Without Using DatePipe

For formatting dates in HTML, Angular provides DatePipe , but what if you need to format a date within a component, service, or other non-HTML code? For this, Angular provides the formatDate()  function. I was unaware of this function until one of the developers I work with submitted a pull request where he used it. I've often seen developers inject DatePipe  into their components when they need to format dates, but formatDate()  is the better option for that. Here's an example: public formattedDate : string = formatDate ( Date . now (), "MM/dd/yyyy" , 'en-US' ); You can read it about it at the official docs here .

How to Verify Observables are Unsubscribed to in Angular Unit Tests

In most cases, when you subscribe to an Observable , you should also unsubscribe  from it. In Angular, there are a few exceptions (for example, Observables returned by HttpClient ), but usually unsubscribing is the way to go. But how would you write a unit test to make sure this happens? One way is by using a  Subject . A Subject is a kind of Observable. It includes an observed  property which is a boolean and indicates whether or not it is being subscribed to. Prior to this, there was an observers  property which provided a count of observers, but this has been deprecated. In the test below, the component being tested contains code to ensure that JobListenerService.jobCompleted  Observable is being unsubscribed to when the component's ngOnDestroy()  method is called. The mock of the service returns a Subject  (a type of Observable), and we use that Subject to verify that it's being observed before the component is destroyed, but no longer being observed after  the component is

Architectural Considerations for Angular Applications

Image
When it comes to application architecture, my approach is holistic: it's not just about the application design, but the things around  the application -- for example, unit tests and linting -- that can help produce a solid application.  Here are some of my thoughts for creating successful Angular applications, though many of these apply to other sorts of applications as well. The goal is to design something in such a way that it's easy to maintain, easy to enhance, avoids pitfalls, and most importantly, works as intended . Here we go! 1. Use those spec files Angular was designed from the start with unit testing in mind. But a lot of Angular developers I've spoken to don't use the spec files the CLI creates for us. Having good code coverage is important, and it's worth taking the time to write those unit tests. For more information on how unit testing has helped me write better software, check out  this post. 2. Organize code into judicious feature modules with lazy-

Meta Quest Pro Lens Issue

Image
The Problem Meta Doesn't Want You to Know About...and The Worst Customer Support Ever The Problem When using the Meta Quest Pro with a game or app taking place in a dark environment, yellow / brown / auburn colored haze appears along the outer edge of the lenses (more so, seemingly, on the right lens, and more near the top of the lens). In a bright game or app, the problem isn't visible, but when using a dark one, this problem is apparent. In the picture below, the issue can be observed most prominently near the top of the lens -- that brownish haze. It's been speculated that the issue could be backlight bleed or IPS glow, but as far as I know, neither has been confirmed. Here are some of the threads from Reddit and from Meta's Support forum discussing the issue: https://www.reddit.com/r/OculusQuest/comments/yfonqx/severe_backlight_edge_bleed_on_quest_pro_possibly/ (This one contains a "solution" that does not fix the problem.) https://communityforums.atmeta.c

Retro Review: It Came Upon the Midnight Clear

Image
It Came Upon the Midnight Clear  is an old made-for-TV movie that I saw in syndication when I was a kid. I seem to recall it being on more than once, either multiple times during the same holiday season, or in consecutive years. I loved this movie, but looking back on it, all I remembered was that it starred Mickey Rooney as a grandfather hanging around with his grandson during the Christmas season, and the ending of the film. It doesn't appear to have gotten a home release past the VHS format, and is long out of print. I was happy to find it on YouTube recently, and watched it for the first time in ages. Even though I had fond memories of it, I had little  memory of it -- what was it about the film that I liked way back then? It was strange watching it again, as nothing was coming back to me as I did so. I'd have expected some "Oh, now I remember this part" moments, but that never happened, and by the end, I was curious as to why I had enjoyed the film so much as a