I’ve recently been curious about switching to a time API for my time stamps and removing any dependency the app might have on the server for a timestamp. Upon Googling I found some paid services, some free and of the free ones, I noticed one was hosted on Heroku. I’ve heard of Heroku, but never had a reason to attempt to use it. This was the perfect chance.
How I Created a Small “GetTime” API
First, I created a free account on Heroku, nothing special. After verifying my email, I logged in to my Heroku Dashboard and up on the right hand corner, selected Create New App. I named it my company-api and out popped an app.
I decided on just plain, legacy PHP and a simple DateTime string passed thru JSON encode, just to get started. No authentication, no timezone, just a simple spit out if a request to the site came, like this:
$DateTime = new DateTime();
$currentTime = $DateTime->format("Y-m-d H:i:s");
I created a Git repo for this brand new file and pushed it out. Then, I went back to Heroku, Dashboard, My App and Deploy. I selected Github as my deploy “resource” …
The idea behind this was to create a nice, easy UI that users can download media files they request often. We moved it to Azure to prevent killing our on-prem bandwidth, but then I had to deal with the flat file structure, etc. The end result was simply: a fast search of all the blobs (with link) and underneath that, a tree structure of the blobs that they can browse through.
The Set Up
First, I created a Storage container through Azure Portal, then I used Azure Storage Explorer to create a Blob Container under that storage account. I also set read-only permissions to my blobs by right clicking the container in Azure Storage Explorer, then: Set Container Public Access Level > Public Read Access for Blobs Only.
To make this code work, I needed to setup an environment variable for my connection string. I used the prefix CUSTOMCONNSTR_ on my variable name as it comes in handy when deploying to Azure Web Apps. To get the connection string: Azure Portal > Storage Account you created > Access Keys.
setx CUSTOMCONNSTR_storageConnectionString "<yourconnectionstring>"
Finally, I got a folder I wanted to share and dragged and dropped it into my …
The first package management system I learned to use was Bower. It was great for the short love affair we had together, but it stopped being supported and I was weary of learning to use one of its replacements. Fortunately, I haven’t had to with Libman. Libman’s (Library Manager) simple JSON approach to bringing front end dependencies has been the easiest for me quickly implement and it has been a great addition to Visual Studio. I implemented it possibly too quickly, however, and overlooked one powerful configuration setting: provider.…
I had a recent bug that took me much too long to solve and the root of the cause was me. I got a bit too delete happy and deleted a crucial file that allows me to use Razor Tag Helpers to bring a List into a View as a Drop Down (Select).
Here’s how the error presented itself:
- SelectList won’t populate
- Select or DropDown is empty
- value = Microsoft.AspNetCore.Mvc.Rendering.SelectList or
- System.Linq.OrderedEnumerable2 [Microsoft.AspNetCore.Mvc.Rendering.SelectListItem, System.String]
I recently had an issue with printing a report to PDF using Microsoft Reporting Service and a RDLC file, etc. Something similar to this. Unfortunately, it worked great in development, but refused to work once deployed into Azure. No matter what I did, I could not duck the GDI errors I kept getting, and apparently this continues through a line of various PDF exporting extensions, all of which rely on GDI for export. Turns out, I’m not alone in facing this problem and so, I decided to find a solution.
My general idea was to use something to render my PDF view, send that view as one long html string to a free PDF microservice and get the PDF in return.…
New Environment, New Approach
It’s Day 1, my first Microsoft Build, and I was not prepared for the sheer numbers nor format. I tediously worked out this schedule with sessions and back up sessions (in case, I don’t know… tripped on the way to the first one?). I lost my OCD mind when I realized these sessions were held open format in the MIDDLE OF THE EXPO!
I quickly realized the “sessions” were to show off their specialty. To draw you in by topic, touch on some “new” topics you hadn’t heard of, and get you to come talk to them. The presentation was not so much a sales pitch as it was a “let me help you develop on our platform.” Interesting……