The suggestion I see at Stack Overflow is that if you see this error you are trying to pull down too much locally and you had better chunk it up some if you really need all of it.
Thursday, October 31, 2019
Delete Shelveset
To destroy one of your shelvesets in TFS, "go a finding" for your own shelvesets like so and then right-click on a line item and pick: Delete Shelveset
C# 8 is finally here as of .NET Core 3.0.0.
Both were released timed with .NET Conf on September 23rd it would seem. I just heard about it last night myself.
Get rid of server sync with TFS.
In Visual Studio 2017 at the Team Explorer's main splash page, reachable by clicking on the "Home" icon at the top which looks like a house, expand "Solutions" (below the eight buttons for "Project") and at the Workspace setting click the downwards pointing blue arrow. Next click Manage Workspaces... Edit a workspace here. At the dialog box for editing a workspace click Advanced > > and then set "Location:" from "Server" to "Local" before pressing the OK button.
The L.I.O.N. acronym that people put by their names on LinkedIn stands for LinkedIn Open Networker it would seem.
You know people and you're going places, get it? This is some wacky pseudostreetcred. Fun, fun.
Wednesday, October 30, 2019
At the Pending Changes tab in the Team Explorer in Visual Studio 2107, click on Pending Changes to pick one of the other top tier menu items of the Team Explorer.
You don't have to go back to the "Home" view for everything as it turns out. A little menu of items, such as "Builds" for example, will materialize when you take this step. At Builds you may click Builds to similarly go back to Pending Changes. (Builds shows you if the most recent build passed or failed.)
Cannot insert explicit value for identity column in table 'Players' when IDENTITY_INSERT is set to OFF.
What are we to do about this error in Entity Framework Core implementations? Well, this might be an actual opportunity for me to provide some value with my blog as all of the Stack Overflow stuff I see just suggests decorating the field which cannot be written to with...
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
...but that does not get at what was going on for me. The problem lay in attempting to add children of a parent and the column in question was to hold the reference key to the parent. In my case the parent was a Player which looked like so:
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace FluffyNothing.Core.Objects
{
public class Player
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long PlayerId { get; set; }
[Required]
[MaxLength(15)]
public string PlayerIp { get; set; }
public virtual ICollection<Message> Messages { get; set; }
}
}
The players have messages and the Message object looks like this:
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace FluffyNothing.Core.Objects
{
public class Message
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long MessageId { get; set; }
[Required]
[ForeignKey("PlayerId")]
public Player Player { get; set; }
[Required]
public string Copy { get; set; }
public DateTime Time { get; set; }
}
}
Alright, the thing that threw the error looked like so:
public void WriteMessages(Message player1Message, Message player2Message)
{
var optionsBuilder = new DbContextOptionsBuilder<PlayerContext>();
using (var context = new PlayerContext(optionsBuilder.Options))
{
using (var transaction = context.Database.BeginTransaction())
{
context.Messages.Add(player1Message);
context.Messages.Add(player2Message);
context.SaveChanges();
transaction.Commit();
}
}
}
I'm just trying to jam the messages in the database. That won't work. Instead I needed to query the parents and make an association to the parents. I did that like this:
public void WriteMessages(Message player1Message, Message player2Message)
{
var optionsBuilder = new DbContextOptionsBuilder<PlayerContext>();
using (var context = new PlayerContext(optionsBuilder.Options))
{
using (var transaction = context.Database.BeginTransaction())
{
List<Player> twoPlayers = context.Players.Where(p => p.PlayerId ==
player1Message.Player.PlayerId || p.PlayerId ==
player2Message.Player.PlayerId).ToList();
foreach (Player player in twoPlayers)
{
if (player.Messages == null) player.Messages = new List<Message>();
if (player.PlayerId == player1Message.Player.PlayerId)
{
player.Messages.Add(player1Message);
}
if (player.PlayerId == player2Message.Player.PlayerId)
{
player.Messages.Add(player2Message);
}
}
context.SaveChanges();
transaction.Commit();
}
}
}
Tuesday, October 29, 2019
AspNetSynchronizationContext in the .NET Framework is a forerunner to the SynchronizationContext of .NET Core.
The earlier item is more prone to deadlocks. "ASP.NET Core 2 and Angular 5" by Valerio De Sanctis mentions this on page 373. AspNetSynchronizationContext is kind of the root UI thread in a Framework web app.
Get a link to a TFS shelveset to hand to another for code review.
After you find the shelveset, pick "Open In Browser" from the "Actions" menu with the downward pointing arrow at its right.
When you do a commit instead of a shelve in TFS...
- Make a copy of the folder with your gunk elsewhere on your computer.
- Rollback in TFS to the number of your commit and not the number beforehand. (I made that mistake and undid someone else's commit.)
- Paste your copied-away stuff back into the source code.
- Use this "Check Out for Edit..." trick to find your fixes anew.
- Make a shelf.
How may I find all of the files modified outside of Visual Studio 2017 which have changes TFS cannot "see" as they didn't happen in Visual Studio 2017?
In Visual Studio 2017, go to the Source Control Explorer (from the Source Control Explorer button at the Team Explorer pane (found with Team Explorer under the View menu)) and right-click on the appropriate folder which is the umbrella over everything and pick "Compare.." ...also here you will need to right-click on each item that appears and do the "Check Out for Edit..." trick described here to make the files something that can be seen by TFS for check in.
How do I rollback someone else's changeset in TFS?
I'm not so sure myself. From "Source Control Explorer" you may right-click on a branch and pick "View History" to get a list of commit numbers and you may also pick "Rollback..." from the same menu to rollback to a previous commit by number. "Undo Pending Changes... " from this menu may be the easiest thing.
See flat files made by the TFS build process.
On the main landing "page" of the Team Explorer tab in Visual Studio 2017, the one you can always return to by clicking on the "Home" icon that looks like a little house at the top of the pane, there will be a "Builds" button in a set that is My Work, Pending Changes, Source Control Explorer, Work Items, Builds, Reports, Documents, and Settings. Click here. Then click "Actions" and after that "View Controller Queue" from the little menu which appears. The "Build Explorer" tab appears and from here one may right-click on the items listed and pick "Open Drop Folder" to see flat files made by the build process. In the "TestReports" folder in the "Logs" folder in the particular setup I am looking at now there is a single .xml file. Search for "failures" in there. Also double-clicking on any one item in the "Build Explorer" folder opens up a little splash page on that item. Errors will be listed there as well.
Monday, October 28, 2019
Jumping from http to https works in IE11 and Chrome but not Firefox.
Well, if you can't navigate from http to https via a form post or something, try just going to the http URL in Firefox and indulging whatever it wants you to do to live on the edge with unsafe browsing. The https site in question probably doesn't have a certificate and isn't really secure.
How do I install the certificate for my locally running https site to make it not hurt?
When installing a certificate in Windows 10 by just double-clicking a .crt file, you will eventually come to a crossroads wherein there are radio buttons for "Automatically select the certificate store based on the type of certificate" and "Place all certificates in the following store" and herein you will want to pick "Place all certificates in the following store" and then browse to find "Trusted Root Certificate Authorities" which in turn will allow you to browse to some locally running https site in peace without blockage. Also, it may help to add the site being trusted to Trusted sites at the Sites button under Trusted sites at the Security tab of the dialog box that one gets after clicking "Internet Options" after clicking "Network and Internet" at the control panel.
Override Warnings
When you want to check in in TFS but you are in collision with some policy that is preventing that, click on "Override Warnings" in the Team Explorer pane of Visual Studio Community 2017 to get around as much. Well, or you could satisfy the missing requirement. You do what you feel is best, yo.
Saturday, October 26, 2019
Microsoft.EntityFrameworkCore.Tools
I have recently upgraded to version 3.0.0 of EntityFrameworkCore at a .NET Core application. I am utilizing Onion Architecture. It was painful to spin up the database. Instead of just having Microsoft.EntityFrameworkCore.SqlServer as a dependency in my Infrastructure project I also had to add Microsoft.EntityFrameworkCore.Tools to my UserInterface project. That really blows. I don't see why my UserInterface project needs to know anything about Entity Framework at all. Yikes!
Friday, October 25, 2019
the JavaScript Event Loop
JavaScript constantly checks a call stack to see if there are functions which need to run.
Thursday, October 24, 2019
Add a bookmark in Edge by clicking the star at the right end of the URL line.
I struggled to find it so I supposed it merits a blog post. Just to the right of the URL line is an icon which looks like a star with some horizontal lines coming off of it and that is where one goes to get back at the bookmarks.
In an Angular application that interacts with GraphQL instead of ReST you may only need one method to crosstalk to the server.
Everything is a POST and while you may hand in queries of different shapes, all of the queries are basically strings. You basically need something like the first method here only it would take a string (the graph) as the one inbound parameter at the method signature and hand back an Observable of any instead of an Observable of Campaign by replacing...
.map((res: Response) => <Campaign>res.json());
...with just a semicolon. The many other actors which use this method can then use the syntax above to map the Observable of any to an Observable of Campaign or what the circumstance demands, be it what it may, case-to-case, instead.
Wikipedia suggests JAWS can do a "refreshable braille display"
The braille terminal, it suggests, is another device you may plug into your computer that changes around little bumps on some small surface your may feel about. Download JAWS here.
MathML
It is mathematics markup. The ML would stand for Markup Language. It tries to less painfully put math formulas into HTML.
Wednesday, October 23, 2019
Copyleft provides a means for something to be modified and distributed for free while keeping the original owner.
The original owner maintains the copyright in a copyleft, I think. They just cannot sue for the use and change up of the thing in question.
A cmdlet might have a .cmd extension.
These could be .bat files too, but .bat as a convention is an old DOS convention. I guess a PowerShell script might also have the .ps1 extension too.
I am hearing that the free edition of JAWS is basically a virus.
...must be like the free edition of KaZaA!
WAVE Evaluation Tool
This is a Google Chrome plugin which makes recommendations on accessibility compliance against whatever you are looking at. I am not sure what WAVE stands for.
Use IdentityDbContext in lieu of DbCotext to loop in the Identity Server stuff with Entity Framework as a tie in.
This per page 367 of "ASP.NET Core 2 and Angular 5" by Valerio De Sanctis.
You may need the EnableEndpointRouting setting in .NET Core 3.0.0 to get the MVC stuff to behave.
Inside ConfigureServices in Startup.cs have...
services.AddMvc(options =>
{
options.EnableEndpointRouting = false;
Tuesday, October 22, 2019
I have finally finished Chapter 7 of "ASP.NET Core 2 and Angular 5" by Valerio De Sanctis.
I think it was my new years resolution to finish this book this year. It's not going to happen. Maybe I can finish it by the end of 2020 when it will be really out of date. Ha! Chapter 6 on LESS and Chapter 7 on Angular's reactive forms have really taken the wind out of my sails, and I'm no longer doing the coding examples along with the book. I have decided that it is enough to just read in the book. Anyhow, I am now on the other side of Chapter 7 so maybe I can be enthusiastic anew. Here was what was in the last few pages of Chapter 7 that interested me:
- A new form was made from a FormBuilder named fb like so:
this.form = this.fb.group({
Text: ['', Validators.required]
});
...and interesting things shown to be hanging off of form include:
• .value
• .status
• .dirty
• .valueChanges.subscribe
• .get("foo").valueChanges.subscribe
The subscribes require, yes, unsubscribes.
- Page 349 suggests the built-in pipes in Angular 5 are DatePipe, UpperCasePipe, LowerCasePipe, PercentPipe, and JsonPipe. You can probably guess what the first four of these do. The JsonPipe takes a JSON object and turns it into a "pretty-printed JSON" string in the name of testing stuff and barfing readable JSON up to the display.
- If you have a string with HTML in it you cannot spit it into view with the string interpolation double curly braces syntax. Therein HTML tags will be stripped out. The way around this is decorate the wrapping tag like so:
<div [innerHTML]="thingToShowOff"></div>
- Page 354 makes mention of the "Local" window in Visual Studio 2017 and what it probably means, in spite of yet another typo, is the Autos and Locals windows that you may serve up while stopped on a breakpoint while debugging. These will both be options under the "Windows" option under the "Debug" menu at the top navigation if you are debugging and will otherwise not show up. Autos shows you all variables available then in that moment and Locals shows "local scope" stuff like what is tied to the this keyword.
- WebPackMiddleware was namedropped on page 355. Again, maybe a typo? Maybe what was meant was webpack-dev-middleware perhaps. Googling against this stuff, I get the impression that the middleware for webpack will allow for hot swappability of modules and other esoteric things of that ilk.
- Page 355 also mentions the "Angular testing utilities" which are built-into-Angular testing goodies. TestBed is amongst this suite of stuff.
- The last page in the chapter suggests the template-driven stuff is a carryover from AngularJS.
PerformYard offers performance evaluation software.
How is my underwater basket weaving FTW? (FTW is for the win not to be confused with WTF which is WHAT THE FUCK? or TFW which is that feeling when...)
You may both extend and implement from a class in Java.
public class Foo extends Bar implements Baz
{
Stemming and Lemmatization
Stemming matches words of different pluralization and tenses. This is tricky because you cannot just add or remove an s on the end of an English language word for a universal win for pluralization. The words mouse and mice won't play well together in that circumstance. Lemmatization is stemming and then some with matching across Thesaurus alignments for similarities or outright synonyms. Microsoft's FAST (Fast Search & Transfer) search engine uses lemmatization.
The @override annotation in Java marks a method as overriding another method.
I think it could be @Override with a capital O too.
download Visual Studio Community 2017 just so you may use TFS
I found a link at: https://www.kunal-chowdhury.com/p/download-visual-studio-2017.html (It is free too.)
Symantec VIP Access for iPhone
It's another smartphone app for authentication not unlike this. A Credential ID will be unique to each device while a Security Code refreshes every thirty seconds.
Monday, October 21, 2019
Network Node Manager iSPI
NNMi monitors the health and availability of both physical and virtual devices. iSPI stands for i Smart Plug-ins.
Windows mail is the successor to Outlook Express.
This email client shows up in Windows Vista and the later versions of Windows.
a front door for using Office 365 online
...is at: www.office.com (you may also install the software to your PC from this place too)
Specify what kind of exception to throw from a method in Java when exceptions occur.
public Connection getConnection() throws SQLException
{
Sunday, October 20, 2019
Windows Mojave
This was another code word for Windows Vista not unlike Longhorn. This one was tied to a failed marketing campaign to try to convince the public the Vista wasn't that bad. Hey, here's a picture of me with a beard from the first day of 2014. It's not that bad right?
Friday, October 18, 2019
The deps trick in Angular's IoC will fill in the variables at the service's constructor.
retech!
If you work at ILM Services, at some point you go through a retech which is a second (or third or fourth) technical interview after the interview you passed to work at the company to begin with. The retech affects how much your stats go up and thus a raise that might be coming your way. It is an annual process. I learned a few things in my retech today.
- If you are to nest a common component in your outermost God module in an Angular project and then use it in components lazy-loaded via lazy-loaded modules later on, it has to go in the exports in the outermost God module. I do have something like this at my blog already but in that scenario I have a ceremonial module wrapping the component to be distributed to multiple lazy-loaded modules and components and the other module is looped in as applicable.
- View Encapsulation as a term could describe the boundaries that the ::ng-deep hack in Angular works around.
- In TypeScript a module is anything you can import.
- The "changed after it was checked" error message is a common heartache in Angular. It has to do with race conditions in Observables.
- If you have an autocomplete input trick set up and you are debouncing in advance of acting on Observable feedback in an Angular application, flattening the Observables out of Observable shape with .switchMap will make sure you get the return result from the last most actor if debounce spaces out three attempts, for example, to garner feedback. This prevents a race condition in which another actor wins. .mergeMap in contrast to .switchMap others no such safeguard while otherwise providing the same functionality of taking the Observable wrapper off of the pieces of candy being wrapped. rxjs-marbles is a testing library that helps with this and marbles as a term could be thought of as the three points along the timeline I suggest.
- Google AdSense is Google's biggest money-making revenue stream and it is written with Angular. With it advertisers push advertisements and Google's search algorithms help the advertisements reach the right audience.
Thursday, October 17, 2019
some random content types for when you are turning bytes arrays back into files
Following up on the Excel setting here, the content types for a few other variants of file are, I suspect...
application/pdf | ||
docx | application/vnd.openxmlformats-officedocument.wordprocessingml.document | |
csv | text/csv | |
msg | application/vnd.ms-outlook |
Another, bigger cheatsheet, without the Outlook message alas, is here.
Wednesday, October 16, 2019
iOS 13 will have an option to make unknown callers fall over to your voicemail.
Andrew Yang isn't the only one who fears automation.
Tuesday, October 15, 2019
Account for nulls in MIN and MAX operations in T-SQL.
SELECT
foo,
CASE WHEN MAX(CASE WHEN bar IS NULL THEN 0 ELSE bar END)=1 THEN 1 ELSE 0 END as bar
FROM baz
GROUP BY foo
HAVING qux > 42
Get yesterday's date in T-SQL.
I am stealing from here...
select dateadd(dd,-1, cast(getdate() as date))
Monday, October 14, 2019
How do I name a file I made with the atob/Blob trick in JavaScript something other than a random Guid?
The last line here reading window.open(fileURL); needs to be replaced with seven new lines of code which look like this in JavaScript:
var a = document.createElement("a");
document.body.appendChild(a);
a.style = "display: none;";
a.href = fileURL;
a.download = "HelloWorld.xlsx";
a.click();
window.URL.revokeObjectURL(fileURL);
In TypeScript instead of JavaScript the first of these lines changes up slightly like so:
var a = <any>document.createElement("a");
The TypeScript any hack sidesteps this TypeScript error:
Cannot assign to 'style' because it is a read-only property.
TypeScript seems to consider the a of HTMLAnchorElement as a type and, hence, there seems to be no way to set a style. Lame! I stole the code you see here from this and it seems gold (in Chrome, but not IE11).
EIN stands for employer identification number.
This is an SSN (social security number) for a business in the United States of America.
Sunday, October 13, 2019
link an SSRS report to another SSRS report
Right-click in a cell in a table, select "Text Box Properties" and then go the "Action" tab where you will check "Go to report" maybe? I dunno. I'm just stealing that from this. The thing I am stealing from suggests you will be able to pass variables along.
I saw Tammylynne Jonas give the "Ten Commandments of Data" at the Minnesota Developers Conference and honestly there was more than ten.
She had a lot of customer-facing experience and, hence, that flavored a lot of her slides. Her slides each had a title caption of sorts which I am recreating here verbatim while I toss in my two cents on what I felt the explanation of as much was. Do note that there was an admission at one point that all of your analytics can be defeated by the HiPPO (highest paid person's opinion).
Get the data that matters. If customers are deceased, should you close off their credit card account? Executives attempting to prevent credit card fraud assumed so in one scenario only to be embarrassed by the reality that 95% of cards used after death were used by widows of deceased husbands. Instead it would have been better to target large purchases or another detail as a more focused indicator of potential fraud.
Everyone has enough data. There is a law of diminishing returns thing going on in thinking more data gives you a better picture.
Art and science. Take a dataset and see what jumps out.
Get directionally correction, not perfect. You can narrow in on scope too much. If you want to find a way to solve the problem of too many returned purchases the thing not to do is to drill into all customers who made returns in ninety days time where two things were returned in that window which were sporting equipment-related in nature and wherein the households of the returns held baseball aged children, etc. The Tammylynne Jonas example held even more of a drill in that this, but this is all I bothered to write in my notes. You get the idea, right? Don't filter away too far.
Don't build it yourself. Try to use good tools. Building everything yourself is expensive.
Data scientists are unicorns. They are hard to find and expensive to keep. Their compensation may not be worth the ROI (return on investment). Unicorns like to frolic with other unicorns, so a data scientist may not stay at your company long if there are not other data scientists there.
Not all data applies. You could drop the emphasis on how weather patterns affect sales and instead focus elsewhere. If you are trying to give people ads that trigger impulse purchases such as ice cream on a hot day, well, maybe that's fine for Dairy Queen soft serve sales but might be the wrong carryover to another space. If people are stuck in traffic (a bigger concern here than the weather) a duck into Dairy Queen for some Dairy Queen "ice cream" might entice, but that won't help you sell pants at Kohl's.
Should be actionable. Try to piece together what leads to what in lieu of just thinking: "Oh, no we have a problem." In the retail space 70% of returns are because something is too small.
Context patterns. In beacon technology we don't have to have GPS accuracy within twelve feet. We need to know what you are looking at/for. What does a longer than a sixty second delay in a department store tell you? Is the party comparison shopping, shopping with a friend, checking Instagram, unable to find the desired color and size, or confused in general? If you could fill in a story maybe you could help the hung up.
Sometimes there is no data. On autonomous driving cars, the artificial intelligence is like a toddler in that the more feedback you give it the smarter it gets. There are no autonomous driving cars that can handle snow or icy conditions however because the feedback hasn't been provided.
Get more than what your competitors have (but no less). You can't be late to the game. You cannot wait to have more perfect information in some scenarios.
Collect more data at the sources. Millennials and Gen Z are excited to give information on themselves. Make BuzzFeed Quizes and give them to Millennials and Gen Z. Which type of vegetable are you? etc.
Monetize what you can. At Coca-Cola you want to know how much coke you sell in a similar space as it compares to Pringles and twenty ounce Mountain Dew and their wallet shares.
Common sense still needed. Email campaigns and direct mail campaigns won't add up to more sales if the inventory is zero. (This is a scenario that actually happened that was spoken to.) Your analytics don't tell you about an inventory problem or, for that matter, a URL being advertised incorrectly. Sanity check to ensure a use of the head (do you rationally believe it?), heart (overcome feelings), and hands (can you get your target clientele to interact with it?).
Data doesn't solve everything. Sometimes trial and error gets you there.
Be compliant... not crazy. Don't worry too hard about compliance with the CCPA (California Consumer Privacy Act) or the GDPR. There could be fewer than ten requests a month telling your coffee company to drop clientele data. While "customer old preferences" have to be dropped when requested per the CCPA, that is subject to interpretation.
Saturday, October 12, 2019
The keynote at the Minnesota Developers Conference came from Burke Holland!
It was on serverless. The definition from Martin Fowler's website is: ...custom code run in managed, ephemeral containers as a "Functions as a Service" (FaaS) platform. Burke Holland himself offered as a definition three criteria:
- Furthest Abstraction, you have no knowledge of what the underlying technology is
- Least Consumption, you only pay for what you use
- Inherent Scale, with the scaling being a solved problem
Amazon EC2 (Amazon Elastic Compute Cloud) was namedropped. As a service it allows users to rent virtual computers. Cosmos DB is a NoSQL database running behind the scenes at Azure which you may agnostically interface with as if it were of MSSQL or alternatively take a NoSQL approach. "Personal Home Page Tools" was suggested to be what PHP stood for which I had not heard before.
Today is the annual International Day Against DRM.
Can't legally make a copy of a DVD (digital versatile disc) or CD (compact disc) that you own? That's DRM! A lot of people don't like it.
I saw Tony Bjerstedt speak on feature toggles at the Minnesota Developers Conference.
This talk basically covered the art of making a little branch of our own to develop on and then merging it back into master and was on trunk-based development. "Principles of Product Development Flow" by Donald G. Reinertsen was a book that was namedropped. If you migrate infrastructure from Redis to Memcached (a rival tool) well... better have a branch! As a subtopic Tony Bjerstedt went into toggles and listed four variants:
- Release Toggles are short-lived and don't change. These allow for early releases of features which can then be shut off again via configuration file changes.
- Ops Toggles are long-lived and sometimes change. Do load testing to see where the app is cratering and crawling then wall off a potential fail point behind a toggle.
- Experiment Toggles are short-lived and often change. This is for A/B testing.
- Permission Toggles are long-lived and often change. This is for premium features.
Friday, October 11, 2019
shadow banning
This is when a social media platform limits who sees your posts without telling you in the name of a soft shutup.
package is a reserved keyword in Java that ended up being a reserved keyword in JavaScript.
Strict mode will complain if you name a variable package.
DateTime.Parse might be the way to map something returned from a sproc to a DateTime or DateTime? in C#.
Think DataSet, DataTable, DataRow, etc.
if (!(dataRow[7] is DBNull)) asOf = DateTime.Parse(dataRow[7].ToString());
Run an .msi as Administrator?
Run the command prompt as Administrator. Navigate to the folder where the .msi is kept and then type the name of the .msi at the command line all by itself. Press enter.
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
This seems to be the MediaTypeHeaderValue in C# for an Excel .xlsx sheet in that when you new up a MediaTypeHeaderValue object you hand this in as the magic string in the subject line. It is the content type setting for an attachment.
Thursday, October 10, 2019
When I am uploading a file via my web app, writing it to a file share and then exposing links to the file share to the "same" user, two different users are really accessing the file share.
Well, yes. In that case if Joe Blow uploads an SLA (service-level agreement) in PDF format and it goes off from the browser to the REST API and then whoever (who the user?) is running the REST API at IIS writes a file from the bytes, that user is not the same user as Joe Blow himself when he tries to turnaround and click on a link which theoretically exposes that file via an anchor link tag at the web. This could be bad if you don't want to allow everyone and their dog direct access to the file share that link leads into. How do you get around that permissions challenge? Instead of giving Joe Blow a link to the file, why not have him make a REST call that returns an HttpResponseMessage (in C# since 2012) with a copy of the file that was drunk up by the user who wrote it in the first place and then streamed out? This StackOverflow article touches on it.
Addendum 10/14/2019: The better way to pull the file back down is like this.
Azure Active Directory Graph API giving way to the Microsoft Graph API?
I guess both would give ways to fish our records from Active Directory.
PCF is pivotal cloud foundry!
It comes from Pivotal Software, Inc. which VMWare (Dell) is going to buy up. Electro-Motive Diesel (EMC) and VMWare birthed this company to begin with in 2012. EMC is also now part of Dell. You make VMs and manage them with PCF.
Wednesday, October 9, 2019
No easy way to get the median in T-SQL?
I Googled against this some today and you have to write your own logic as best as I can tell. You can find all sorts of dueling examples online with no consensus. With SQL Server 2012 or greater I think there is a workaround with PERCENTILE_CONT. What if you have an even number of numbers and there is no number in the middle? It looks like the appropriate mathematics to average the two middlemost numbers in the sequence.
Douyin is like the China-only version of TikTok.
The same fools (ByteDance) made both things. Douyin was first.
Drag emails into a web app from Outlook?
In modern times you should be able to drag an email out of Outlook, I'd imagine in an .msg file format as that is what the emails there become when you manually save them off, to a file upload control in HTML at a web application. (An .msg file is like an .eml file only Outlook specific. These keep individual emails. .eml is more generic. Outlook Express and Thunderbird use the .eml thing.) I get that from this which says partway down "Microsoft Edge (as of Windows 10 1709) and Google Chrome (as of version 76) natively support drag and drop from Outlook on Windows. If you use one of these browsers, then this plugin is not necessary." in, um, referring to a plugin I don't need.
the direct query of Power BI and its alternative in the on prem space
You may either directly query your databases with Power BI or have an in-memory snapshot of the data to make the reports load snappier. The in-memory thing is going to have the "eventually consistent" problem.
non-fast-forward
There is something wrong with your git branch and you cannot merge this thing into master. Lame! This happened to me today for no good reason.
Addendum 10/10/2019: "today" above should be "yesterday"
Tuesday, October 8, 2019
Why are monitors landscape instead of portrait?
StackExchange thinks it is because our two eyes are in a horizontal row instead of a vertical row and therefore there is more horizontal space to see. I remember having a 1990s college typography class in which the teacher asserted that the landscape orientation stemmed from early uses of the computer being spreadsheet based and a student piped up and challenged her and suggested that really the computer monitor orientations just parroted that of the television. They were both wrong! Ha!
Monday, October 7, 2019
HtmlTags
I saw Jimmy Bogard mention HtmlTags on Twitter today as I guess it is now on version 8 (as of today). I've not heard of it. It puts stuff (HTML tags) to the DOM in a jQueryesque manner it would seem and is a .NET project. It looks like Josh Flanagan and Jeremy Miller also have worked on the project. Joshua Flanagan of Dovetail showed up in a dream I had once in 2012. He asked my why one could not use structs everywhere in an app instead of classes and I couldn't answer his question. I went to work the next day at HDRI and asked others and the biggest thing is that there is no inheritance with structs. The one time I interacted with Josh in real life was that I played that Bomberman arcade game with him inside of Dovetail's office with him and I think Chad Myers and a third person I cannot remember. It's a game like Gauntlet where four can play at once. I guess Josh was at some of those geek lunches that used to be held in Austin too.
STRING_AGG is to T-SQL what GROUP_CONCAT is to MySQL.
Use it to aggregrate stuff in a GROUP BY query in T-SQL.
I saw Matt Allinder speak on team building at the Minnesota Developers Conference.
"Crucial Conversations" by Joseph Grenny, Ron McMillan, Al Switzler, and Laura Roppe was a book he recommended. DISC assessments which focus on Dominance (D), Influence (I), Steadiness (S), and Conscientiousness (C) as personality traits and also the Myers–Briggs thing were namedropped. PIP stands for performance improvement plan. In communicating, 7% of what you communicate is your words and 93% is your body language and tone. The visionary, coaching, relational (building trust), and democratic (trying to get feedback and having voices heard) are good flavors of leadership personality while pacesetter and autocratic (just tells people what to do) are not. None of this is too new. At the end of the talk however Matt was asked about how to have confrontational peer reviews and he wisely suggested that nothing in a peer review should be a surprise. You should have already been having the tough conversations long in advance.
Get the .clientWidth off of an element to know how wide it is!
...should it be set to a width of 100% for example, this will give you a number in JavaScript.
Sunday, October 6, 2019
I saw Mike Benkovich speak on blueprints in the Azure space at the Minnesota Developers Conference.
@config["FavoriteColor"] might be, in Razor markup, the way to pull something directly from appsettings.json. I've never needed to do this before but this showed up in one of Mike's examples. He made on the fly an MVC application and then went on to discuss how FavoriteColor in appsettings.json could be changed out from the Azure side. A blueprint in Azure is a collection of resource groups, policies, role-based access controls (RBAC), and templates. Blueprints in Azure allow you to create starting spots for an app with some of the stuff you know you are going to want already baked out. SWIFT CSP stands for the Society for Worldwide Interbank Financial Telecommunication and Customer Security Programme respectively. A personal access token is referred to as a PAT token. This is some of the stuff you might preconfigure. You may version blueprints. At Application Insights (analytics) you may have key values in the cloud and you may change out the app settings in the cloud to point into app settings for an App Service. A resource group object in an App Service will make an app setting override the app setting in the appsettings.json file and there you are. The Azure Resource Manager or ARM lets you deploy stuff in Azure and ARM speaks ReST natively.
Saturday, October 5, 2019
Dagger 2
Dagger is an IoC (dependency injection specifically) tool for Android and Java. There is now a version 2 and Dagger 2 is the thing to Google. Dagger 2 is based on JSR 330 wherein JSR stands for Java Specification Request.
Friday, October 4, 2019
I saw Chris Vitko speak on Tailwind CSS at the Minnesota Developers Conference on Tuesday.
This was one of six talks I saw at the Minnesota Developers Conference and it wasn't the first but it was the best. I'll get around to telling you about the other five. Ha. The conference was at the Earle Brown Heritage Center in Brooklyn Center Minnesota and Chris Vitko like myself works at ILM Services and ILM Services itself coordinated the event. Alright beyond the three options to approach CSS of plain CSS, preprocessors, and heavier frameworks like Bootstrap or another one that was namedropped called Bulma which I had not heard of, there is now this fourth actor. In this paradigm every class is one style long and has a predictable name that reveals what that class does. In code reviews Chris never needs to look at the stylesheets themselves, he can just tell by looking at the markup what the styles are. Why not just have inline styles and skip Tailwind? Tailwind will allow for short terse classes which include hovers and media queries and you can't get that with regular inline styles! I took some photos with my phone of what Chris projected and the class setting inside an img tag in his markup was w-10 h-10 rounded-full mr-4 hover:text-red-500 and therein you can see the hover, right? Chris described this as "functional" CSS and bemoaned all of the times he has otherwise edited someone's stylesheet worried that he will sabotage another part of the application at hand while making the feature immediately in front of him aesthetic. No more! A div had a class setting which started out as h-48 lg:h-auto lg:w-48 flex-none bg-cover rounded-t lg:rounded-t-none lg:rounded-l text-center overflow-hid... and eventually ran off the edge of what was being projected as this stuff is bound to run long. This second example shows us the media query stuff. The thing that starts with hid and gets cut off must mean hidden. I asked if such a style was really equivalent to having display:none; jammed into a style tag as there could be a FOUC (flash of unstyled content) if you have to wait on the stylesheet to load and Chris suggested that as much really wasn't a modern problem in frameworks like Angular, React, etc. You have to have a service running in the background somewhere that bakes out the Tailwind stuff not unlike how preprocessors for CSS work and there will be a main.css file with...
@tailwind base;
@tailwind components;
@tailwind utilities;
...inside of it, and you may jam in your own styles between these lines or after all three to override the Tailwind stuff. PurgeCSS can be used to crawl your code and make the Tailwind render-outs less fat by way of finding what is not used and, yes, purging it away. If you have a class being applied exclusively via JavaScript however PurgeCSS will not find it.
Trump/Twitter
Evan Williams cooked up Twitter and Blogger which I use all the time and something called Medium which is somewhere between the two. Anyways, I thought of him yesterday, visited the Wikipedia write up on him, and was surprised to see that it suggested that Donald Trump credited Twitter with his presidential victory. What is more, Evan Williams nods in affirmation for this and has apologized as he is not a fan of the president. (I'm home from work sick today.)
Thursday, October 3, 2019
applying a CSS color to the selection at a dropdown list in HTML versus the individual items within
<select class="noop">
<option value="" class="noop" selected>Choose</option>
<option value="foo" class="nice">Foo</option>
<option value="bar" class="nice">Bar</option>
<option value="baz" class="nice">Baz</option>
<option value="qux" class="nice">Qux</option>
</select>
Alright, herein shall we say that noop gives us a muted grey color because we don't want the form to be submitted without a selection? Come to think of it, maybe bright red would be a better noop color as that says error or not OK instead of just disabled. That seems like better UX to me. I digress. Anyhow nice will just be black. You can basically see how this works above, but what you will need is some JavaScript watching for changes so that noop is set to nice and vice versa as appropriate when a new option is picked at the select tag. At the option tags, the styles will never need to change. Only the style at the select tag changes up via JavaScript. If you jammed #meta (change)="metaChange()" into the select tag in an Angular 7 application you could do something like what follows in the name of swapping out noop for nice and the other way around at the component's TypeScript.
@ViewChild('meta') meta: ElementRef;
public metaChange():void {
if(this.meta.nativeElement.options[this.meta.nativeElement.selectedIndex].value) {
this.meta.nativeElement.classList.remove("noop");
this.meta.nativeElement.classList.add("nice");
} else {
this.meta.nativeElement.classList.remove("nice");
this.meta.nativeElement.classList.add("noop");
}
}
Regarding this problem, it may be best to use a .forEach instead of a .changes.subscribe when you have to use ViewChildren instead of a ViewChild. Perhaps an approach to as much could look like:
@ViewChildren('meta') meta: QueryList<ElementRef>
public metaChange():void {
this.meta.forEach(m => {
if(m.nativeElement.options[m.nativeElement.selectedIndex].value) {
m.nativeElement.classList.remove("noop");
m.nativeElement.classList.add("nice");
} else {
m.nativeElement.classList.remove("nice");
m.nativeElement.classList.add("noop");
}
});
}
How much is Java really like C#?
The one time I went to No Fluff Just Stuff it was a little bit after I started keeping this blog in July of 2011. Five blog posts that I've made that tie back to it are this, this, this, this, and this. What is there new to mention? Sukant Hajra ran into me there and pointed out to his friends that I was there even though I was a C# guy instead of a Java guy as if to try to add street cred to the notion that No Fluff Just Stuff wasn't just for Java devs like he had just been arguing that point. Paul Rayner told me I could attend his DDD training over email even though I had a C# background. I thought about it. At a lunch I commented to others how much the Java code Paul Rayner showed off sure looked like C#. I'm no longer at Optum because the .NET work they had for me to do basically amounted to server maintenance. I put my hand up to just write Java like everyone else and my superior wasn't crazy about that.
Wednesday, October 2, 2019
Put single quotes inside of double quotes to make ngClass behave just like class.
[ngClass]="'foo'" behaves like class="foo"
The ActiveDebugProfile setting in the csproj.user XML.
This has to do with this and can be changed by setting the setting to either "IIS Express" or "Project" or something else as is appropriate.
Delete every git branch but the master from the Git Bash shell!
git branch | grep -v "master" | xargs git branch -D
...is the command and...
git branch | grep -v "master" | xargs git branch -D -r
...might clean up some of the entries you see when you look at a list of the remotely committed branches with:
git branch -r
By the way...
git branch -a
...should show local and remotely committed branches while...
git branch
...shows the local stuff. Delete any one branch one off like this:
git branch thisIsMyBranch -D
Tuesday, October 1, 2019
iSeries is an operating system for AS/400.
Application System is what the AS stands for. I don't know what the i stands for. Maybe IBM? Rexx (Restructured Extended Executor) is an unrelated old programming language from IBM.