- Powerless middle managers, they will impose a new rule when something goes wrong. How else can they reassure their higher-ups that nothing will go wrong again? But, all the rules stifle developers, making work no fun.
- People had pagers in the mid-1990s before cell phones were common.
- A key fob is something you swipe at a door to be allowed access in. It's a physical trinket.
- There is a fifty dollar fee for transferring Bitcoin from one party to another.
- Verizon JetPack is a type of AirCard and AirCards are little portable devices that all you to make a HotSpot with a cell phone signal, just as you can with the iPhone 4S and better, only this is independent of your phone and you can thus both talk on the phone and use this other device to browse the internet.
- Blockfolio is a portfolio for cryptocurrency stuff. Daedalus is a cryptocurrency wallet.
- LIS is laboratory information system and I guess HIS is hospital information system too. These are communication protocols. ASTM is an example as is HL7 (Health Level 7) and PACS, RIS, CIS, and DICOM too.
- Ripple is another cryptocurrency.
- There are seventy trillion US dollars in the world economy (that is a value across all diversified currencies) and one percent of it is now in cryptocurrency.
- FileSaver.js is an npm packet with some magic to help with naming downloaded files and other tricks to do with downloading files.
- You have access to kernel memory for anything within the immediate process exposed in Intel processors! You may dig it out with JavaScript from a site open in a tab in Google Chrome for example. Encrypted passwords had to be in plain text at one point.
- testdriven.net allows you to run tests in Visual Studio and I think I recall that one performance benefits is that it uses its own process and thus does not force you to recompile a project into a .dll when nothing changed in the project and, yes, there is a performance gain in terms of speediness to be had therein.
- Minder is the Muslim Tinder!
- There is much to debate in autoincrementing numeric ids versus GUIDs as database identities for records, and the debate is much more interesting than spaces versus tabs for indenting or if an open curly brace should be on the same line as the thing it chases. One advantage of GUIDs is that you may copy records from one environment into another without having to redo the keys ever. Another is of security. It is a lot harder to guess at GUIDs than it is at numbers. A problem is that GUIDs are hard to read and remember. Ayende Rahien hates reading GUIDs aloud over the telephone to others as it is tough. Supposedly when you add while autoincrementing you are putting a record at the end of table, but not necessarily so with GUIDs and that can cause performance heartache. In adhering to the concept presented with ORMs, one would want to be able to define the record ID outside of the database and just put it in without thinking about getting a number for the record back. If it is even possible to use an autoincrementing numeric id with NHibernate I have not seen it yet myself. That is not how NHibernate works.
- Ballmer's Peak as a concept suggests there is a perfect amount of drunkenness that one may have as a state for writing code. In this model one is better at coding at Ballmer's Peak than one is if one is sober. However, if you are not that intoxicated yet or more intoxicated then, yes, it is worse for you to write code in that state than if you were sober. This is named for Steve Ballmer, a former CEO of Microsoft.
- Visual Paradigm is a let's-make-some-UML tool.
- If you do undo back far enough with WebStorm 2017.1 and you bridge the point that you reverted from source control and it will ask you if you want to "Undo Reload From Disk" which is a lifesaver!
- Patrick Lioi's Fixie is another testing framework for C#.
- Pidgin is a messaging client.
- The footprint of an .mdf will only grow until you explicitly "shrink" it and even if you delete all of the rows out of all of the tables the file size of an .mdf will not drop downwards until shrunk.
- The tide pod challenge is a make-a-YouTube-video-of-yourself-doing-something-stupid not unlike Neknominate or for that matter the ice bucket challenge (that killed someone too).
- Back in the 1990s, I recall one could put an .ini file by an .exe file to speak settings to the .exe file. The .ini file would be something you could just edit in Notepad.
- AutoSys Job Scheduler is for running batch jobs.
- Macromedia Authorware was something akin to Macromedia Director. Wikipedia suggests some flowcharting capabilities set it apart from Director. Adobe owns both things now.
- Parkmobile is some sort of mobile app to allow you to pay for your parking with an account bound to one of your credit cards.
Wednesday, January 31, 2018
January Queso
Monday, January 29, 2018
I saw Jeff Strauss speak on ES2016, ES2017, and what is in the pipe for the future of JavaScript at the St. Louis .NET User Group tonight.
It has been a long day, but let me see if I can touch on the high level of what I learned. Alright, ES6 in 2015 was the first major update to ECMAScript since 2009 and it had some interesting things in it like the promise API and the fat arrow operator for better handling lexical this and also something called "destructoring" which would define the k and the v variables for key value pairs in:
for (const [k, v] of Object.entries(family)){
Object.entries (manhandling the "family" variable here, which would be a JSON object) is of ES2017 however and will give us an array of arrays wherein each of the nested arrays are two items long and the first of the two items is the string name of a key on the object and the second item is the value itself. There is a concept now in ECMAScript called iterable which is akin to IEnumerable in C# insofar as that a thing that is iterable may be iterated over. There are new iterable goodies like maps and sets but of course an object is not iterable. This gets around that. There is also a more simplistic Object.values which just gives an array of the values in ES2017 and as much and Object.entries are follow-ups to Object.keys which already existed which gives an array of strings with just the names of the keys. The async and await keywords of C# are now right there in ECMAScript too as of ES2017.
async function awaitCalls(){
const a = await loadData();
const b = await loadOverData(a);
const c = await processTheData(b);
const d = await saveData(c);
console.log(d);
}
Alright this is a little bit better than chaining .Done four times over as the a variable can be used downstream of the setup of the b variable if you like and the whole thing may be wrapped in a try/catch. Promise.all which is kinda like .WhenAll in C# may now be sidestepped for just handing two things into a function with the await keyword leading both actors. So that leaves ES2016 between the current version and the one two back to explain. What was new in it? Only two things. One was a double asterisk operator for raising numbers to a certain power. The other was a .includes for arrays to see if an array contains something in lieu of using an .indexOf is not strictly equals comparison against -1 which will always return false if NaN is somewhere in the array in a buggy manner. Coming the future? A spread operator like that of TypeScript and hopefully private and public variables! This talk was hosted at World Wide Technology, Inc. The employee who let me in the door said that the company was akin to a "one stop shop" for IT needs. They build LANs and they also do custom application development. It sounded to me like a modern Network Logistic, Inc. with the "one stop shop" tag line and what not. There was a lightning talk before the main talk by a John Baluka on TestStack.net, an open source project, and to some extent its not-for-free rivals Ranorex and Coded UI, which may be used in tandem with Selenium testing to provide test data in a better way akin to that of an ORM or may be used to test desktop stuff for .NET be it WinForms or WPF stuff. In the latter case, TestStack.net in particular has something akin to the Google Chrome Developer Tools or the F12 tools of IE called "UI Automation Verify" which allows one to inspect the elements in the UI and manipulate them. Again, that's for desktop app stuff. I've moved to St. Louis, Missouri everyone!
Deer Park!
I am moving on from my job in "Houston" which was technically in the Houston, Texas border town of Deer Park. I had lived in Houston once before (actually in the Houston part of Houston) for two and a half years straddling the turn of the millennium. Houston is the biggest, in terms of both sprawl and population, city I have ever lived in. It is both modern and thriving and run down and ghetto. The other time I lived there I read something that compared Houston to Hollywood insofar as that it is an industry capital. Movies are made all over the world, but the contracts are drawn up in L.A. and it is L.A. where the major companies are headquartered. This is stealing from the thing I read whose source/author I cannot recall. Anyhow, Houston is the same thing for oil and gas. I once saw a made-for-TV movie called "Oil Storm" that suggested that all of the oil that comes into the United States on tankers for processing comes in at either Port Fourchon, Louisiana or the Houston Ship Channel, so Houston is pretty significant machine performing a specific and crucial role. There were factories everywhere on the Southeast side of Houston where Deer Park is. On my way into work in the mornings I could often see a flare or two burning. Coworkers teased me that I shouldn't actually live in Deer Park where the job was as I might get cancer from the air and water, but I was already there leasing an apartment. Notably, there are no deer in Deer Park. This is a city like Grand Prairie, Texas swallowed up and surrounded by strip malls and cement whose name now just seems sad. Ugly signage with digital displays is a little too common in Deer Park. The people are really friendly though. Even the ridiculously large police force which will pull you over in the middle of the night for nothing and then let you go with a warning is pretty polite. The code I wrote for work was of a recruiting workflow lining warm bodies up with nonpermanent flux work at factories. On rare occasions, I'd let the talent into the lobby before anyone else had showed up at work and they always seemed pretty cool. Similar talent could be seen all about Deer Park on lunch outings. There were always characters running around in jumpsuits on weekdays. I can remember seeing three guys in red jumpsuits sitting at a circular table-and-benches ensemble that was attached directly to the pavement (unmovable) outside of maybe a Jimmy John's or something like that and it looked just like a scene from a movie with prisoners in a prison yard. There is a Subway Sandwiches in town that is open 24 hours. That's another surreal thing. You can go there instead of Denny's or IHOP in the middle of the night. Another noteworthy restaurant is in a building on the grounds of the token golf course. The golf course is probably the only reason you'd have to be in Deer Park if you didn't live or work there. It is the one attraction. Its namesake winks at Deer Park's tagline "Birthplace of Texas" which seems a bit odd to me as the San Jacinto monument is technically in neighboring La Porte, Texas. Whatever. Anyhow it is at this locus that Santa Anna turned into Santa Claus, albeit at gunpoint, and gave Sam Houston the Texas territory which became its own nation for a while and then eventually one of the states in the United States. (Hawaii and Vermont are the only other states to have once been their own countries.) In seeing the San Jacinto monument I felt the need to bone up on Texas history and, as I was already driving between Austin and Deer Park anyways in the name of making a change of apartments, I thought I'd swing by Gonzales, Texas and see the "Come and Take It" cannon. That cannon is tiny. It's like two feet long and six inches in diameter. Also, the museum where the cannon is kept, a goofy state museum, is the most Mickey Mouse museum I have ever been to. There was one attendant and no security guards. Anyone with the skills to rob a 7ELEVEN could just go there and take the "Come and Take It" cannon. Remember in the first season of "Narcos" when those communists break into that museum and steal the sword of a long dead Columbian hero because of what it symbolizes? Well, the equivalent to that sword in contemporary Texas would be the "Come and Take It" cannon. Evil thoughts! I digress. I thought of one more thing to say about Deer Park. There is a 1970s-style roller disco there called "Skate World" which means there are two attractions in total.
Saturday, January 27, 2018
Thursday, January 25, 2018
a StackOverflow example of running another executable from a C# console app
I have not tried this firsthand. I don't guarantee that it works.
var proc = new Process();
proc.StartInfo.FileName = "something.exe";
proc.StartInfo.Arguments = "-v -s -a";
proc.Start();
proc.WaitForExit();
var exitCode = proc.ExitCode;
proc.Close();
Sunday, January 21, 2018
logging for sister SPA apps/headless apps
In our JavaScript we probably don't just want to just be writing things to the console, right? We probably need to make a REST call back to the stuff in C# and have our errors go into the guts of the main logging and not die silently at the console. Having said that, I have not yet worked on an application where that was actually being done. I have heard some high-minded talk of it, nothing more. It is a new chore. This is going to be one scenario in which the new way of doing things is hurting us instead of helping us, the logging is trickier. Have we all gone mad in the name of being elegant?
Thursday, January 18, 2018
There are two ways to conditionally use a class with ngClass in an Angular 4 application.
The first is a no brainer:
<some-element [ngClass]="isWhatever ? 'second' : 'third'">
The second is a little more strange. You may use an object wherein the property names are the classes and the classes will only be shown if the value for a property is truthy like so:
<some-element [ngClass]="{'first': true, 'second': isWhatever, 'third': !isWhatever}">
The class names enclosed in single quotes in both scenarios may be a series of class names separated by spaces too.
Tuesday, January 16, 2018
Reset a mydatepicker control from an Angular 4 application.
- Make a local reference for the control in your template and then map it to an ElementRef in your corresponding component with the ViewChild trick so that if #myDay were your local reference (put this inline inside of the my-date-picker tag) then in turn @ViewChild('myDay') myDay: ElementRef; would go somewhere inside of component itself to ensure the mapping of the control to a manhandlable variable that you may... manhandle.
- Figure out how you want to reset the control, perhaps upon the click of a button, and then make a method in your component for the act, you will first need this line of code.
this.myDay.selectionDayTxt = "";
This wipes the obvious visual setting. WebStorm 2017.1 puts a squiggly red line under this line of code indicating that it can't compile. The way around this is to make the ElementRef an any instead. - Immediately following the line of code in step two above you will want to run the lines of code you run at your template in the dateChanged event for the mydatepicker which in this example are like:
this.someDate = new Date(1753,0,1);
this.doSomething();
Monday, January 15, 2018
pattern matching in C# 7.0
This is something else that is sevenesque. You can do some tricks with the is keyword that you might expect of the == operator as suggested here. An example:
if (o is "o") {
Tuples in C# 7.0 look kinda interesting.
Per this you may have something like this wherein (string, string) is a ValueTuple of string, string.
public (string, string) LookupName(long id)
{
return ("John", "Doe");
}
The input variable for id obviously does nothing, right? Anyhow, an example of an assignment from the same blog posting is:
ValueTuple<string, string> c = LookupName(0);
A ValueTuple is mutable! Also, an assignment, not to a tuple, but to two variables would look like so and this trick is referred to as deconstruction.
(string first, string last) = LookupName(0);
Friday, January 12, 2018
ON DELETE CASCADE
NUMERIC datatypes in T-SQL for unsigned numbers
A find Pinal Dave's blog some when I Google and this post in particular says: I can use NUMERIC(20) datatype for 64-bit unsigned integer value, NUMERIC(10) datatype for 32-bit unsigned integer value and NUMERIC(5) datatype for 16-bit unsigned integer value. An unsigned numeric type starts at zero and counts upwards until its cap such as uint in C# while a signed numeric types like int in both C# and T-SQL and what is Int64 in C# but bigint in T-SQL instead have a range straddling zero with half of the capacity allowing you to count downwards into negative numbers. The u in uint must stand for unsigned I guess.
a ghetto "getting started" with Bootstrap 4
Let's set up some tabs as suggested here and as I inappropriately suggest are "ARIA tabs" here like so:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Whatever</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css" media="screen" />
<link rel="stylesheet" type="text/css" href="css/bootstrap-grid.css" media="screen" />
<link rel="stylesheet" type="text/css" href="css/bootstrap-reboot.css"
media="screen" />
<script src="js/utils.js" type="text/javascript"></script>
<script src="js/tether.js" type="text/javascript"></script>
<script src="js/jquery-3.2.1.js" type="text/javascript"></script>
<script src="js/bootstrap.js" type="text/javascript"></script>
</head>
<body>
<ul class="nav nav-tabs pull-xs-left" id="mainTabs" role="tablist">
<li class="nav-item">
<a id="foo-tab" data-toggle="tab" href="#foo" role="tab" aria-controls="foo"
aria-expanded="true" class="nav-link active">Foo</a>
</li>
<li class="nav-item">
<a id="bar-tab" data-toggle="tab" href="#bar" role="tab" aria-controls="bar"
aria-expanded="true" class="nav-link">Bar</a>
</li>
<li class="nav-item">
<a id="baz-tab" data-toggle="tab" href="#baz" role="tab" aria-controls="baz"
aria-expanded="true" class="nav-link">Baz</a>
</li>
<li class="nav-item">
<a id="qux-tab" data-toggle="tab" href="#qux" role="tab" aria-controls="qux"
aria-expanded="true" class="nav-link">Qux</a>
</li>
</ul>
<div class="tab-content mb-lg">
<div id="foo" role="tabpanel" aria-labelledby="foo-tab" aria-expanded="true"
class="tab-pane active in clearfix">
<div id="basic-content" class="container-fluid">
OK, now he was close
</div>
</div>
<div id="bar" role="tabpanel" aria-labelledby="bar-tab" aria-expanded="false"
class="tab-pane">
<div id="basic-content" class="container-fluid">
Tried to domesticate you
</div>
</div>
<div id="baz" role="tabpanel" aria-labelledby="baz-tab" aria-expanded="false"
class="tab-pane">
<div id="basic-content" class="container-fluid">
But you're an animal
</div>
</div>
<div id="qux" role="tabpanel" aria-labelledby="qux-tab" aria-expanded="false"
class="tab-pane">
<div id="basic-content" class="container-fluid">
Baby, it's in your nature
</div>
</div>
</div>
</body>
</html>
We'll end up with something like this, and this is ghetto because I do not yet know how to make that tether error go away. The tabs work however.
Let's talk through how his was done. I made a folder and I made an index.html file in it with Notepad. Then I just ran the .html file locally without any server by just double-clicking upon it. If you did web development back in the 1990s you will recall that you can just do this with plane Jane .html files. Anyways, it order for the paths into "js" and "css" folders to lead to anything there must be "js" and "css" folders sitting side by side with our index.html file. Get these by downloading Bootstrap. You will end up with "js" and "css" folders and just set them in the same folder as your index.html file. I tried to get this to work without jQuery and tether but the errors that came up to the console suggested that I needed them, so I got them too. I recommend that you download jQuery and put its one file in the "js" folder and I recommend that you download tether and put its handful of files in the "js" folder as well. That should, in a minimalistic manner, get the stuff on exposition here working. Again, I don't yet know how to get rid of the somewhat harmless tether console error that says: Uncaught SyntaxError: Identifier 'getScrollParents' has already been declared
The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on local machine.
Fix this error with this download. (basically you just need the driver)
Thursday, January 11, 2018
How may I conditionally prevent users from changing Bootstrap tabs in an Angular 4 application?
What I erroneous refer to as an ARIA Tab Panel here is just the Bootstrap 4 way of setting up in-page tabs. The individual tabs look like this:
<li class="nav-item">
<a class="nav-link" id="benefits-tab" data-toggle="tab" href="#benefits" role="tab"
aria-controls="benefits" aria-expanded="true">Benefits</a>
</li>
Me may revamp like so for the desired effect.
<li class="nav-item">
<a class="nav-link" id="benefits-tab" [attr.data-toggle]="isWhatever ? 'disabled' : 'tab'"
href="#benefits" role="tab" aria-controls="benefits" aria-expanded="true"
(click)="changeTabs($event)" onclick="return false;">Benefits</a>
</li>
isWhatever here will be our conditional for whether or not we wish to squawk if a user tries to change tabs (maybe they have unsaved work) and looping in isWhatever (use a better name in real code) is basically one of three changes which specifically are:
- [attr.data-toggle]="isWhatever ? 'disabled' : 'tab'"
- (click)="changeTabs($event)"
- onclick="return false;"
In the first bullet above, disabled in lieu of tab means nothing. You could just use x instead of disabled as the point is that we are not using tab in that case. The second bullet above has an event in it and that should look something like so at your component's TypeScript code:
changeTabs(event: any):void{
if (event.target.className.indexOf("active") == -1){
if (this.isWhatever){
var result = confirm("Are you sure you want to leave?");
if (result) {
this.stupidService.isToUseGuard = false;
this.isWhatever = false;
}
}
}
}
The reason to hand in the current tab and check for the active CSS style is that you do not want to trigger this stuff if the user merely clicks on the tab he or she is already on for some silly reason. That act should be mundane as it is harmless. Also, stupidService here is going to be akin to stupidService here. You will probably want to use guards in your Angular app to prevent users from changing routes if you are also preventing them from changing tabs, so write the two implementations with each other in mind.
With ChangeDetectionStrategy in Angular 4 you may also have a ChangeDetectorRef, and, I believe, call detectChanges() on it to force the sleeping watchers to wake up an open an eye.
Wednesday, January 10, 2018
The template setting for [(ngModel)] doesn't necessarily have to have a dance partner on the TypeScript in a component.
Without it you are of course doing a two-way databinding to nothing. You may use the same setting in two controls and as you type in one control the other control will be updated too. I don't know that there is really any praxis for not having a counterpart at the component. I just found this interesting. I suppose one negative side effect that could come from a lack of an error being explicitly thrown is that you could more easily mess your real wire-ups.
Tuesday, January 9, 2018
how to use mydatepicker in an Angular 4 app
You set up something like this on the template side of a component:
<my-date-picker id="startStartDate" placeholder="MM/DD/YYYY"
(dateChanged)="someDate=$event.date; doSomething()" [options]="myOptions">
</my-date-picker>
We set a not-quite-date on the TypeScript side with the assignment to "someDate" herein and then turn around and call the doSomething() method too. Options may just be like:
private myOptions:IMyOptions = {
dateFormat: 'mm/dd/yyyy',
firstDayOfWeek: 'su'
};
Note that $event.jsdate instead of $event.date will give you a traditional JavaScript date back.
Monday, January 8, 2018
Interfaces in CanDeactivate guards in Angular 4!
Alright, when I wrote this I could not figure out how to use the interfaces. I think I know how now, though I have not immediately tested in. If you have a .doWhatever() method in your interface the ideal dance partner to hydrate the interface is the component you are attempting to leave itself as specified in the route. The reason I have not tested it myself is because we are using an app where routes specify modules in lieu of components as suggested here. I do not think there is a way to get the interfaces working with modules in the routes. In these cases you have to loop in a service instead and have a nude/empty interface for the interface.
Friday, January 5, 2018
Talk up to a wrapping component from a nested component in an Angular 4 app and not just down to the nested component from the wrapping component.
How is this possible? Just change values on the object being handed down. The wrapping component and the nested component are going to be using the same reference. You may then have logic in your wrapping component check against state changes in the object being handed in as an Input to the nested component. This provides a way to speak back up without an EventEmitter. Is it the most elegant thing to do? Maybe not. This will not trigger ngOnChanges at the wrapper so if you need an immediate reaction you will still need to use an EventEmitter. If you merely need to react when a user clicks something or something like that however, this will work for you. You may doublecheck state at that time.
obfuscation as opposed to minification
In the strictest sense minification just removes whitespace while obfuscation renames function and variable names which are hopefully private in scope in JavaScript to more terse names. This makes the code harder to read and hence it will obfuscate the code. An obfuscator will also minify the JS. Just the renaming part of obfuscation could be considered: Uglification
routes that point to modules instead of components
Assuming this as suggested here:
const myRoutes = [
{path: '', component: StartingOutComponent},
{path: 'foo', component: FooComponent},
{path: 'bar', component: BarComponent}
];
The following change may allow for the loading of modules wrapping the components in the name of this trick:
const myRoutes = [
{path: '', loadChildren: () => System.import('../startingOut.module')},
{path: 'foo', loadChildren: () => System.import('../foo.module')},
{path: 'bar', loadChildren: () => System.import('../bar.module')}
];
I have not tried this myself. This is how things seem to behave in an app I am looking at:
I'm realizing a little more about how the prototype keyword works in JavaScript.
foo.prototype.somethingNew = whatever;
...creates a new property on foo called somethingNew with whatever as the assignment while this...
foo.prototype = whatever;
...makes all properties on whatever now properties on foo too. prototype basically says "Bolt this/these on." while a dot off of prototype kinda says: "Bolt this/these on here."
Thursday, January 4, 2018
Do the extra work in order to have names that don't stink.
It was deemed today that IsActive is really a better name than IsToDeactive to drive a flag on a DTO for whether or not to soft delete that record alongside all of the other PUT verb-style updates that might be made. The reason I had IsToDeactive is because if this was just left unset, and indeed the delete flag was going to be set in one update scenario and not all update scenarios that end up hitting the repository for as much, that it would just end up as false in bridging the leap from Angular 4 to a .NET Core REST API. With the IsActive approach I had to have a nullable bool in lieu of a bool and then have some logic in the repository like so:
if (prospectData.IsActive == null) prospectData.IsActive = true;
...and yet this is the way it has to be. Don't forfeit good names for elegant code.
Tuesday, January 2, 2018
.IndexOf in C# or .indexOf in JavaScript beyond returning -1 when a match cannot happen will return a number for the position of the first match.
In ["foo","bar",baz","qux"] 2 would be the index of "baz" if that makes sense. Does it? (The indexing is zero based.)
portal.azure.com has Azure slots that you may deploy to.
You my stop preprod, deploy to a prepod slot, turn preprod back on, and then, after testing, swap the prod and preprod slots. You will see your hosting at yourdomainnamehere.azurewebsites.net
You may click on the individual files in a commit in history in Atlassian's paradigm and pick "Reverse hunk" to undo the changes for that one file.
Obviously, you may progressively do this for every file in a commit if you need to. This is a way to do damage control to backpedal from doing something you should not have done.