VIRTUAL DAN

VIRTUAL DAN

Notes from my travels around the internet

VIRTUAL DAN
  • My Pacific Northwest Solar
  • About

Blazor and WordPress – The Story Continues

Recently I got a comment on my first Blazor and WordPress blog post that my demo wasn’t working. I hadn’t looked at it in months, but sure enough my weather forecast component wasn’t rendering. Blazor was working, but it was defaulting to ‘route not found’ condition.

I have learned a bit more since my original experiment, so I dug back into my demo and made some improvements.

In my first version, I used the router, and set my @page directive to match the url of the blog post.

For some reason the router was no longer recognizing that route. I assume some wordpress upgrade messed with the url rewriter, but I didn’t look into that closely – I decided that was the wrong approach. Instead, I just updated the router (my app.razor file) to rely on the notfound condition:

Now my app has no routes defined, and I rely on my defaultlayout.razor page to always render. Note that I can likely get rid of the <Found condition in the router – I didnt only because it was working and I didn’t want to mess with it anymore.

So my DefaultLayout.Razor file is pretty simple:

All it essentially does is render my weather forecast component. I think this is a much better pattern to use when embedding Blazor in WordPress. If you do need to deal with routing, my recommendation would be to either sniff the url in your blazor app and decide what to do, or just control the state of your components by setting variables that cause components to either show or hide.

A couple other thoughts:

  • You may have to add mime types to your WordPress server if your app doesn’t work or you get console errors. Take a look at the web.config that gets generated when you publish, and you will see the ones you need.  If you manage the wordpress hosting server you can add them in on your admin panel.  If not, there are some wordpress plugins that allow you to manage mimetypes.
  • I am beginning to wonder if embedding blazor in wordpress is the right architecture.  The other option is build a blazor app that calls the wordpress API – and just have it pull all the wordpress content into your standalone blazor app.  That way you can still maintain the content in wordpress, but you have the full flexibility of blazor routing. If you don’t change your themes a lot, and you don’t require a lot of plugins, this approach might be better.  Just a thought.  SEO would be an issue in this approach though, since search engines don’t appear to index Blazor apps.

For reference, below is the working example of the Blazor rendered weather forecast:

Loading…

I am surprised there is not more chatter on the internet about integrating WordPress and Blazor – its a pretty interesting solution to quickly adding components to a WordPress site. If you follow the instructions from my previous post, along with the things I learned above, you can easily get it set up.

APPIP ERROR: amazon-search[

]
October 29, 2020 Dan 3 Comments

Adventures in Bonds

For years I have held several bond funds, from corporate to high yield and international bonds, and I have been fairly satisfied with that low risk, low return portion of the portfolio.

As mentioned in a previous post, I am re-evaluating my allocation to bonds and bond funds, but I have also been experimenting with buying bonds directly rather than funds. It has been an interesting experience, and I thought it would be worth recapping a few points below.

  1. High Yield Bonds. For years I have owned the Vanguard High Yield bond fund, which is probably the lowest cost high yield fund out there. Earlier this year, I reduced my allocation in high yield bonds, primarily because they tend to correlate more to the stock market than the bond market. Since my objective to buying bonds is to diversify from the stock market, that kind of defeats the purpose. However, as rates have fallen further and further, I decided to switch some of my corporate low-yield bond allocation to high yield, and take control of buying the bonds myself. The hope is I can get a little higher yield than just regular bonds, thus keeping the correlation with the stock market lower. High yield bond funds typically have a huge allocation to energy stocks, which in this environment I also want to stay away from. So I have been building a portfolio of reasonable quality short term maturities that are technically high yield, but I expect will behave more like bonds. I have bought bonds issued by companies such as T-Mobile, Netflix, Best Buy, and Lennar Corp which I feel pretty comfortable owning. Of course, I sacrifice yield for this, but I do feel better owning bonds in companies I understand.
  2. TIPS. I can’t do a post on bonds without mentioning TIPS – Treasury Inflation protected securities. TIPS are issued by the Federal government and the interest rate is pegged to the inflation rate. These rates naturally are very low.. but then what isn’t? My recommendation for anybody considering TIPs is to make sure and buy I-Bonds from treasurydirect.gov first. The government limits the purchase of I-Bonds to $10,000 per Social security number. The current composite rate for I-Bonds is 1.06% which in most worlds is terrible. However, you can withdraw them penalty free after 5 years (so effectively a 5 year maturity), plus you get inflation protection. In past years there has been a fixed component to the rate, so it was even a better deal, but the current rate is still above a 5 year CD rate, and if inflation increases, you will do even better. And you know the Fed is trying everything it can to increase inflation.
  3. Foreign Bonds. I have foreign bond funds, and I was considering starting to allocate to owning individual foreign bonds. So I started by looking at the holdings in the Vanguard Emerging Market Bond ETF. This fund has a yield of 3.89%, which is nice in this environment. However, the average maturity is pretty high at 13+ years, which is way longer than I would typically buy a bond for (who knows what he world will look like in 13 years?). It then occurred to me that I have no strong feeling about which countries are over or under priced. I also looked at the market value they had listed for some of their bonds, and looked at the price I could buy the bond for, and in most cases their listed price was about 1% cheaper than I can buy the bond for. I am pretty leery about bond spreads, especially when rates are so low – a 1% spread is in many cases one years worth of interest. So for now, I think I will continue to buy foreign bonds thru funds, as I don’t think I can outperform the experts by 1%.

My foray into holding individual bonds has been interesting, and it makes me feel better when I understand what I own. That is probably the biggest benefit to buying bonds outright. Even if I was a bond wizard I don’t think I can win big holding bonds vs funds. The biggest benefit is probably education and learning about how the bond market works.

APPIP ERROR: amazon-search[

]
October 15, 2020 Dan Leave a comment

My Custom Blazor Authentication

I have been building out my first Blazor application, and have been figuring out the pattern I want to follow for user authentication. Rather than use the built in Blazor authentication components, I am using the libraries I have built over the years, and I can plug into almost any app without having to think.

Where I got tripped up a bit with Blazor was in communicating the logged in an logged out status across components. After lots of Googling and experimenting, here is what I came up with:

In my Blazor Mainlayout page, I embedded the login bar component directly. This login bar just shows a login button, or if the user is logged in shows a logout button and the users name. When the signin button is clicked, the logon bar launches a login form component to collect username and password, and call the authentication API with the credentials. When a login is successful, the login bar updates a singleton class applicationvars.cs that holds all the profile information. This singleton allows all pages in the application to access these values. This is a nice, compact, and elegant way to handle what we used to call global and session variables – and is rapidly becoming one of my favorite things about Blazor.

Where I got tripped up was when I wanted to enforce a logout, or deal with a user session expired situation and message it appropriately. I finally settled on the solution of adding multiple routes to the same index page. I built route called ‘/logout’ and ‘/expired’, and added that route to the index page:

Where I erred was I put the logic to destroy the credentials in applicationvars inside the index page, which renders after the login bar, so the login bar didn’t reflect the credentials change. I futzed around with trying to get the index page to fire an event when the logout is detected, and have the login bar listen for the event and update appropriately. The better solution was to have the loginbar sniff the url, and when it sees the logout or expired URL, it destroys the credentials and redirects to the appropriate index URL. It was a much more elegant solution than getting the event wired up. It makes me wonder – maybe a new rule I need to follow: for your average business application, if you have to fire an event, you are probably doing something wrong in your design.

This design is working, and so far it has nicely isolated the authentication logic from the rest of the application. One worry is there is no easy way to have the app communicate with the login bar, so I may have isolated it too much. In recent various Blazor blog posts, I have noticed people are moving away from the singleton approach in favor of wrapping application vars around the whole application in the router. This new technique doesn’t change the over concept, so I may adapt that pattern in my next project. But for now, I will proceed with this pattern, and see how many times this paints me into a corner I don’t want to be in.

APPIP ERROR: amazon-search[

]
September 21, 2020 Dan Leave a comment

The Bond Dilemma

The craziness of markets over the last few months caused by the Coronavirus have been incredible. As in investor, I am trying to forecast where we go from here, and what are the best and worst possible outcomes. While the stock market and its disconnect from the economy seems to be getting most of the headlines, I think the bigger story is the bond market and where it goes from here.

As seen in the chart above, the 2 year treasury bond has dropped from near 3.00% in late 2018 to 0.13% in September of 2020. This, along with the government’s fiscal stimulus is probably most responsible for the stock market’s disconnect from the economy.

The stimulus here is unprecedented – dwarfing the financial crisis of 2009:

The stock market is fueled by stimulus, and seems to be signalling full speed ahead. Given the government intervention, it is nearly impossible to determine if the market is overvalued or undervalued, as the economy is a secondary factor to stimulus.

I also think the stock market is being fueled by Bond investors jumping ship. Risk averse bond investors not reinvesting bonds that mature at .14% – instead invest in Apple or Microsoft that has a growing yield and is ‘safe’. I understand the appeal of this strategy, but at these prices it seems like a lot or risk is being taken on out of desperation.

At any rate, one almost sure bet is that the bond market will be a loser. This bet does assume that the aversion to negative interest rates in the US will persist. Given that assumption, the best case for the investors in 2 year treasuries would be a no inflation or deflationary economy, with rates at or near zero. Given that assumption, the rate of return on bonds is still near zero.

The worst case scenario for bond investors is all this stimulus in the hands of consumers, combined with an economy waking from the COVID shutdown, leads to inflation. The only hope the government has of reducing the debt is to increase inflation, and so those in charge of the money press are incented to cause some inflation. The government has targeted and pretty much achieved a 2% inflation rate for the last few years. The Federal Reserve recently adjusted its inflation mandate to declare they may allow overshooting their 2% target rate – a further sign of inflation in the medium to long term. This does not bode well for a T-Bill yielding .14%.

So what to do with my bond portfolio. My asset allocation currently has a percentage in US Bonds, and if I am to reduce that allocation, where to I put it? Lots of options, but none that I really like:

  1. Increase Allocation to the stock market.  One option is to increase allocation to the stock market- maybe in the ‘bond proxy’ sectors. Options such as Utilities and Financials (JP Morgan is yielding over 3.6%%, and the government won’t let anything happen to that bank. Most local and regional ‘safe’ utilities yield in the 2-4 % range. Other options might be focusing on reasonable yielding low valuation stocks. Rocky Brands comes to mind with a near 2% yield and Price/Book around 1, P/E of 9, and a little growth.  Many bond investors have already flocked to the market and these sectors, so it may be too late here to buy these possibly inflated assets.  Definitely adding risk with this strategy.
  2. Increase Allocation to Gold.  I have an allocation in gold already, though I hate the idea of holding rocks in my portfolio. But the way the world if printing money, Gold has had a pretty good year and the money printing wont be stopping anytime soon. I have been experimenting with buying quality Gold miners, then selling covered calls in the +10% range which generates pretty good income. This is still an experimental strategy, but it seems to be doing no worse than just holding gold (via BAR) and gold mining stocks, and makes me feel better about holding this asset class.
  3. Increase Allocation to TIPS (Treasury Inflation Protection Securities).  An interesting play here – TIPS are pegged to the inflation rate – so if inflation does hit, your interest rate increases. If we have deflation, yields will turn negative (unless you buy IBonds via Treasury Direct – which have a floor of 0% rate – but there is a limit on annual purchases). Probably worth taking your chances with TIPS over fixed rate bonds, The Vanguard TIPS Mutual Fund is currently yielding over 2%, so that might be an interesting option, but its not going to make you rich.  Its also moved up alot over the last few months, as other people have figured this out several months ago.
  4. Increase Allocation to Real Estate/REITs.  This is my least favorite diversification play. In volatile times, REITs move more like stocks than bonds, so its a huge risk increase to move from bonds to economy dependant real estate. There are certain areas of REITs that my be interesting for ‘safer’ diversification (i.e. farmland REITs), but historically they haven’t performed well.  I also believe the fallout from COVID has yet to be reflected in the commercial REITS.

I am not alone facing these choices – most investors saving for retirement or in retirement are facing this dilemma. Right now I am leaning toward increasing my allocations to the stock market – but really emphasizing low P/E or low Price to Book stocks in defensive sectors that haven’t participated in this recent tech bubble run-up. Those stocks are out there, it just requires some digging.

APPIP ERROR: amazon-search[

]
September 2, 2020 Dan Leave a comment

The Microsoft Surface Duo

I have been reading a lot of bad reviews about Microsoft’s new dual screen device called the Surface Duo. What I find most surprising is most the bad reviews center around the lack of purpose for a dual screen device. The Windows Blog provides a pretty good overview of the device.

Surface Duo

It seems to me there would be demand for a dual screen device – no so much for single app use, but for business multitasking. It seems to me the logical use case is to have one side of the phone for apps consuming media, the other side for apps where your create media. So if I was to get one, I would likely keep my email and messaging app on one side, and my web browser and reading apps on the other. Other use cases Microsoft shows that essentially using the device as a doublewide screen are less compelling to me, as even a double wide screen is probably too small to do any real work. But for a productivity tool, I think this form factor will catch on.

Besides the consternation regarding how to use the device, the bad reviews have focused around the low specs on this device. On this point I agree – for a list price of $1,400, I would want a more high end device.

The low end specifications for such a high priced device will put this product at a disadvantage, and it may not succeed. But I don’t necessarily think Microsoft was planning on a huge success in this round. This is an experiment and I think they are looking to see what users and app developers do with this form factor. Again, at $1400 this device isn’t for me, but I give Microsoft credit for putting it out there.

APPIP ERROR: amazon-search[

]
August 19, 2020 Dan Leave a comment

Rocky Brands Update



I just published a new article on Seeking Alpha covering Rocky Brands:

https://seekingalpha.com/article/4367000-rocky-brands-online-strategy-provides-profitability-through-pandemic

Rocky Brands is an interesting story – one would think they would be hit pretty hard during the pandemic. They were expected to lose $0.16 a share in Q2, instead they reported a $0.33 gain on unexpected demand.

An interesting conservative buy at these levels and in this environment.

August 10, 2020 Dan Leave a comment

Measuring Air Quality

In the past few months I have become more curious about the air quality of our house.  I noticed as I get older I feel more congested in the winter, and lately our cat has been sneezing more – so I decided to throw technology at the question.  In the winter here in the Pacific Northwest, we keep the windows closed most days in winters, and we don’t usually have all the rooms in our house fully heated.  In winter months, when I am not heating my office it can dip down to the low 60’s, and with the wet weather we receive, I wonder if we have mildew or other organisms that like damp, cool environments. 

So I decided to research air quality trackers, and came across this Awair Air Quality monitor.

APPIP ERROR: amazonproducts[
TooManyRequests|The request was denied due to request throttling. Please verify the number of requests made per second to the Amazon Product Advertising API.
]

I was able to buy it at just over $100, and while it was more than I wanted to spend, but I couldn’t pass up the connected home features this one offers.  It comes with a nice app that gives you more than enough information about your home air quality.  I set it up in my office where it sits on my desk and I can see the numbers go up and down.  I have it set up to give me notifications on my phone when thresholds exceed certain levels.  After watching it for several months, the only thing it gives me a low score is typically on is the temperature and humidity.  If I don’t have the heat on in my office, the humidity can quickly rise to above 70% on rainy days, which isn’t great.  So I have been using this monitor to manage the humidity without grossly heating an empty room.

This does detect chemicals in the air pretty well though. One weekend, I got an alert from my Awair that chemicals in the air were high. I was just sitting in my office, and the numbers were spiking out of nowhere. After thinking about all the stuff I had been doing that day, I realized what was probably causing the issue. Earlier in the day around 2pm, I had painted a closet door in the garage with latex paint, and after I was done I used a utility sink to wash out the brush I was using. I have done this for years, never thinking anything of it. Well it turns out, the furnace is in the same room as the sink, and when the heat kicked on, it must have picked up all the latex compounds that I washed in the sink.

Note that from the above data the number spike corresponds to a heat increase around 4:30pm – when the furnace kicked on. Amazingly just washing paintbrushes was enough to hit an unhealthy level in the house.  Since then, the numbers have gone back down to normal and have not spiked since. I have some more painting to do – so I will test this out again just to prove my theory.  

I tried moving the Awair to the Kitchen, and it seems pretty accurate detecting smoke from cooking too. Pretty much anytime when cooking, the particulate numbers will elevate, and turning on the kitchen fan does affect the numbers. Interesting the quickest way to get the numbers down is to open doors and windows, which almost immediately flushes the air.

For just over $100, this Awair appliance is interesting, although once you measure your air for a period of time, it doesn’t give you much actionable info.  And I am not sure it answers my question about the mildew or mold in the air, but it does tell me I have no major problems.   For now though, my indoor air quality is for the most part excellent and so I can rest (and breath) easy.

APPIP ERROR: amazon-search[

]
July 21, 2020 Dan Leave a comment

The Framework Nightmare of the 2010’s

If historians ever write about software development in the 2010’s, the main discussion point will have to be the mess caused by JavaScript and competing JavaScript frameworks. The chart from Google trends shows how each year a different JavaScript framework was the ‘best framework to use’:

The reason this happened is they are all inferior. A JavaScript framework itself is a tool to try to cover up the deficiencies of JavaScript, a language that had developers grasping for a tool that would help. With frameworks came helper packages to help deploy frameworks, leading to a huge conglomeration of various packages needed to write front end software to run in a web browser.

The legacy of this mess will be with us for years. React is currently the winning framework (if you use Google search trends as a guide), and so new applications will more likely be written in React than the other frameworks. Thus, the pool of experienced developers with these older frameworks will shrink, making it more difficult to maintain these applications written just a few years ago. And no developer will want to put Vue or AngularJS on their resume when React is what is in demand at the moment, further weakening support for the older frameworks.

Granted many developers who know one framework know others, but the pressure will be one to translate, or rewrite an application from one framework to another. And that effort is expensive. Given that the business rules have likely changed since the original app was written in the mid 2010’s – it’s likely a new app in the current framework will be written from scratch. The good news I guess is since these apps only had a useful life of say 5 years, they will be easier to rewrite – but it won’t make the business person paying the bill feel any better.

Here is where I bring up Blazor – my favorite development tool of the day. While everybody is still writing apps using React – I think Blazor will be the ultimate winner. Its a much simpler, elegant, and efficient front end than any JavaScript framework can build. Remember – JavaScript frameworks are built on JavaScript, an un-typed, interpreted language. Blazor is a binary in WebAssembly using C#, allowing full stack developers to work in the same language from the front end to the server.

It’s still early days for Blazor, as the chart above shows. But I am confident that Blazor will be the winner, and I am currently writing all new apps using Blazor. Unfortunately for the business world, I expect in a few years I will be fielding lots of requests to rewrite very young React applications in Blazor.

APPIP ERROR: amazon-search[

]
July 1, 2020 Dan Leave a comment

Modern Monetary Theory

I have been thinking a lot lately about Modern Monetary Theory (MMT) – the economic principle that the US has defacto adopted as part of the COVID-19 stimulus package. One could argue that we had adopted it prior to COVID, but the record money printing that the US did in early 2020 cements our place in the MMT camp.

Wikipedia has a good summary of the principles of MMT. This table of the main tenents is the most enlightening. A government that has the power to issue its own currency:

  1. Can pay for goods, services, and financial assets without a need to collect money in the form of taxes or debt issuance in advance of such purchases;
  2. Cannot be forced to default on debt denominated in its own currency;
  3. Is only limited in its money creation and purchases by inflation, which accelerates once the real resources (labour, capital and natural resources) of the economy are utilized at full employment;
  4. Can control demand-pull inflation[6] by taxation and bond issuance, which remove excess money from circulation (although the political will to do so may not always exist);
  5. Does not need to compete with the private sector for scarce savings by issuing bonds.

So if I understand this right – as long as there is no inflation, the government can print as much money as it wants. Deficits truly don’t matter. I can see why this is so attractive to governments around the world.

A few issues I have with this. It’s pretty clear that as the government has run up huge budget deficits in the last 10 years – the money has gone into the stock market – not the economy. So the only inflation that has occurred is in financial assets, which I assume is excluded from the traditional measure of inflation. Now maybe that is because of the way the government has been distributing all this excess cash. If over the last 10 years the focus had been to to get the money to the public rather than work through the banking system, maybe these excess dollars would be showing up in the economy as inflation.

The other issue I have with this (as does the author of these points apparently) is item #4. The assumption is that when inflation does arrive, the government will raise taxes to slow the economy. I find that uh.. very unlikely – as there will be no political will to do so, especially when workers are seeing their paychecks erode during inflationary periods. Unless of course the taxes are raised on financial assets and investments – and we know there is no political will to do that. We can even look so far as the latest CBO Budget estimate to see there is no projection to deal with budget deficits through 2030:

Perhaps the assumption is there will be no inflation for the next 10 years – in that case – the good times are here.

Nobody knows how this will ultimately play out. if no inflation does occur in the next few decades, I will have to admit the Modern monetary theorists were probably right. If we do start to see inflation, and see rising interest rates increase the debt service in our annual budget, I will be interested to see if the Modern Monetary Theorists stick to the plan when it becomes politically difficult.

APPIP ERROR: amazon-search[

]
June 18, 2020 Dan Leave a comment

Adams Resources Update

I just published another new article on Seeking Alpha:

https://seekingalpha.com/article/4351149-adams-resources-energy-bet-on-oil-and-management

Adams Resources and Energy is a company I have followed for awhile, and decided to do a deep dive into seeing where this company is going. Right now I am neutral on the stock, but if new management can show commitment to improving margins, it might be a nice ‘safe’ place to invest. Its tied to oil prices, so if you think oil is going to zero (or below) – probably not for you.

APPIP ERROR: amazon-search[

]

June 6, 2020 Dan Leave a comment

Posts navigation

← Previous 1 2 3 … 34 Next →

Categories

  • Investing
  • Other Stuff
  • Politics
  • Technology
  • Uncategorized

Archives

  • August 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • July 2019
  • June 2019
  • May 2019
  • April 2019
  • March 2019
  • February 2019
  • January 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • June 2018
  • May 2018
  • April 2018
  • March 2018
  • February 2018
  • January 2018
  • December 2017
  • November 2017
  • October 2017
  • September 2017
  • August 2017
  • July 2017
  • June 2017
  • May 2017
  • April 2017
  • March 2017
  • February 2017
  • January 2017
  • December 2016
  • November 2016
  • October 2016
  • September 2016
  • August 2016
  • July 2016
  • June 2016
  • May 2016
  • April 2016
  • March 2016
  • February 2016
  • January 2016
  • December 2015
  • November 2015
  • October 2015
  • September 2015
  • August 2015
  • July 2015
  • June 2015
  • May 2015
  • April 2015
  • March 2015
  • February 2015
  • January 2015
  • December 2014
  • November 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • June 2014
  • May 2014
  • April 2014
  • March 2014
  • February 2014
  • January 2014
  • December 2013
  • November 2013
  • October 2013
  • September 2013
  • August 2013
  • July 2013
  • June 2013
  • May 2013
  • April 2013
  • March 2013
  • February 2013
  • January 2013
  • December 2012
  • November 2012
  • October 2012
  • September 2012
  • August 2012
  • July 2012
  • June 2012
  • May 2012
  • March 2012
  • February 2012
  • January 2012
  • December 2011
  • November 2011
  • October 2011
  • September 2011
  • August 2011
  • July 2011
  • June 2011
  • May 2011
  • April 2011
  • March 2011
WEBSITE DISCLAIMER: The operator of this site (Vertical Financial Systems, Inc) are not registered investment advisers, broker/dealers, or research analysts/organizations. The content on this website is issued solely for information purposes and should not to be construed as an offer to buy, sell, or trade in any way, any security mentioned herein. All information presented on this website is believed to be reliable and written in good faith, but no representation or warranty, expressed or implied is made as to their accuracy, completeness or correctness. You are responsible for doing your own research before investing in any securities mentioned herein. Readers are urged to consult with their own independent financial advisors with respect to any investment. Neither Vertical Financial Systems, Inc, nor its officers or employees accept any liability whatsoever for any direct or consequential loss arising from any use of information on this website.
Full Disclosure: As an Amazon Associate I earn from qualifying purchases
Powered by WordPress | theme SG Simple