Friday, June 30, 2017

June Queso

  1. Pull in Atlassian SourceTree after making a branch in Jira or you'll never see the branch.
  2. Omni Plus and OmniServer are accounting/HR tools.
  3. IMO means in my opinion and IMAO means in my ARROGANT opinion.
  4. GNU stands for "GNU's Not Unix" but it is a Unixesque operating system nonetheless don't you know?
  5. Any engine can be used as a generator and you may record audio through your headphones. Electronic devices may be run in reverse.
  6. Jade has been renamed to Pug. It's some sort of templating thingy.
  7. Hornil StylePix is perhaps another image editor.
  8. Friend or Follow is an app to let you know who unfollowed you on social media.
  9. duckduckgo.com is another search engine
  10. Assembly is the second generation language between binary ones and zeros and a third generation language like C++. Microsoft Access might be an example of fourth generation language, something with a GUI (graphical user interface) flavoring written in a third generation language.
  11. Windows Store apps are going to run on Windows 10.
  12. In Adobe Photoshop CS6: Filter > Sharpen > Sharpen ...tries to make the blurry crisp.
  13. Smite is a game like Overwatch.
  14. A lot of true/false values appear as Y or N for yes or no in Viewpoint and are not even bit types at the database. CootiesYN might be the name of a Viewpoint database table of this ilk.
  15. Three Layers is the old framework for an application before Onion Architecture. A data layer bleeds into a middle layer of logic and that bleeds into a third layer that is the UI. All three layers end up tightly tied to each other and it is not too easy to get the business logic stuff under unit tests. Moreover, the business logic layer tends to be thin thusly. A lot of spaghetti code builds up just in the UI, and obviously so at the data layer in the absence of an ORM like NHibernate. Our sandwich is thus mostly bread and sparse on meat.
  16. Rickrolling loosely is the art of baiting users with a link for something only to give them something else upon their taking of the bait and clicking the link. In the more strict interpretation, for which the namesake is derived, the bait and switch takes one to the music video of Rick Astley singing Never Gonna Give You Up, hence the moniker.
  17. FUD is an old IBM sales strategy. You fill your victim with fear, uncertainty, and doubt and scare them into protecting themselves... with your help of course.
  18. Apache Spark is for big data analytics and Apache Sqoop for importing big data. Apache Kafka is pub/sub stuff. Apache Flume is for aggregating logs. Apache Cassandra is a NoSQL database. Vertica is a kind of database and Cloudera a server for managing databases. Oozie server is for workflow scheduling.
  19. A word cloud is an image made up of words. The words describe a thing, like how you, all of XYZ Corp's employees, feel about working at XYZ Corp, etc. The size and loudness of particular words in the image will be greater based upon upvotes.
  20. Windows 10 Home is some sort of watered-down, not for work, Windows 10.
  21. datatables.net is some sort of jQuery way (toolkit) to do paginated lists.
  22. If a column is consistently null at a production database table, you probably don't need it's field at the sister POCO at all.
  23. A type ahead feature sort of makes suggestions for what you might put as you start typing at a text field.
  24. "nothing blocking" is something you might say in a stand up meeting to let others know you're not blocked
  25. The Bourne part of Bourne shell is named for a Stephen R. Bourne.
  26. 666 is numeric notation for a really weird, nonsensical Unix file permission in which everyone can write and execute but no one can read. In a set of three numbers like this (it's not one number in the hundreds) the first number represents permissions for the immediate user, the second for the user's group, and the third is a corny sticky setting for those who are not the user himself/herself. 124 would mean the user can read only, the group can write only, and the sticky folk may execute only. Do you see what the 1, the 2, and the 4 do? A 0 is for no permissions whatsoever and combination of the one, the two, the four, and I suppose even the zero if you like, will add up to cumulative permissions such that a three may read and write but not execute and a seven may do everything.
  27. affiliate - a business concern owned or controlled in whole or in part by another concern (thank you dictionary.com)
  28. Noise cancelling headphones will mess with your mind by not allowing you to hear much of your own voice when you speak.
  29. SFTP could be SSH File Transfer Protocol or Secure File Transfer Protocol and is a different way to transfer files, not FTP.
  30. Remediation has to do with (is of) code clean up.
  31. Workbench as a term could imply a place to hook up a computer to do diagnostics and upgrades/updates. You could dogpile a bunch of computers that need love here too and get to them when you can. This is something other (different locale) than the rack at the data center. Think of the shop for the A+ certified computer repair space, etc. The term feels a bit blue collar anymore.
  32. Go is a programming language and Apiary a platform for API design.
  33. www.thinkgeek.com has some geeky stuff for you to buy
  34. Onion Skin is a term in cartooning. It has to do with thin pieces of paper and how one can lay one sheet over another and trace what is there while changing up just a little bit. Progressively you can make an animation in this nature.
  35. Viewpoint will come with x number of user licenses and if everyone is using Viewpoint at once you may have to ask someone to get out of Viewpoint in order for you to get in.
  36. I've heard before that the R in CRUD was for rename, but I don't think this is so. I think I've heard of replace too. It's read.
  37. AMBER (America's Missing: Broadcast Emergency Response) Alerts are named for Amber Hagerman. They didn't used to automatically trickle into your iPhone, but at some point an iOS update made them commonplace.
  38. Erlang is another programming language. It was developed by Ericsson, the Swedish cell phone company that was big in the 1990s.
  39. Fine Uploader (see fineuploader.com) is a JavaScript library for breaking a file up into digestible chunks while pushing it to an endpoint for upload.
  40. In theory, Microsoft is not to ever again have a new operating system. It will just extend Windows 10. We shall see how long that lasts.
  41. A coworker suggested that when you use an app for free that it's you who are the product. Facebook sells off your data which is how it makes money, etc. It will microphone lurk at your phone and pick up speech and then match on keywords. Fun, fun!
  42. cuil is a long dead search engine
  43. Wikipedia says that Silicon Graphics, Inc. (SGI) at one point bought that Alias, Wavefront, and Cray.
  44. The web safe colors are a very 1990s list of hexadecimal values for colors to use on monitors which cannot handle millions of colors.
  45. The HTC corporation has virtual reality headsets which I think are referred to as: HTC Vive
  46. "Escape The Room" is a fun thing to do as a teambuilder distraction for work. As best as I can tell a lot of differing companies offer this service. They put your team in a room for an hour and you see if you can solve the puzzles you have to solve to get out of the room before an hour ticks off the clock.
  47. A org chart is a breakdown of who is equal, who is less equal, and who reports to who. When your pseudoboss tells you he can't talk to you about grievances because you don't report to him, it's the org chart he's pointing to, etc. Oh, elation!
  48. Periodically, someone will gatecrash the phone tree and ring my desk phone at work. I'll then have to give them the number for the secretary.
  49. Carpal Tunnel is the disorder wherein your hand hurts from using the mouse and/or the keyboard. If you have this, you're worthless to society.
  50. A parallelogram in UML represents an input or output. A rectangle is a process of some sort.
  51. Hand sanitizer dispensers of various shapes are a new modern trapping. They have only been existing in mass all around us in the little while that I have been keeping this blog. You are a hypochondriac modern man!
  52. Venmo, owned by PayPal, is an app for little transactions... repay a friend $13 for lunch, etc.
  53. woot.com is a goofy place to buy stuff now owned by Amazon.
  54. UML stands for Unified Modeling Language.
  55. Mark Zuckerberg is the name of that guy running Facebook. The Social Network is that movie about him and his power struggle with the Winklevosses amongst other things.
  56. That decorator pattern is older than Eric Evans ideas which explains why it's so goofy. I don't think I need it in my wheelhouse. If you had a Tshirt as a product and a cigarette pocket and a 2XL size as customizations, you would make a TShirt object and then make a CigarettePocket object while handing the TShirt in at the CigarettePocket's constructor and then, finally, make a TwoXLSize while handing the CigarettePocket in at the TwoXLSize's constructor. The TwoXLSize then has enough going on under the hood to masquerade as a TShirt in terms of what comes up to the UI. How is this not ghetto?
  57. Micromanagement is close scrutiny and redirection, in the form of course corrections, of employees. Think of that Dilbert cartoon where the boss is standing at his shoulder and telling him to click on something. Ha! Before you go on a self-righteous tirade about how this is bad remember that this is only happening to you because you have some chops to begin with and that the way "out" or somewhat out is to grow more chops which will demand more carte blanche respect. This is part of capitalism... anymore. Unions no longer have clout.
  58. spreadingsantorum.com is an SEO hack made to embarrass Rick Santorum!
  59. moniker.com is a place to get a domain name.
  60. Barco's wireless presentation systems are interesting. ClickShare CS-100 is an example of a model, though maybe not the model we have at my work. There will be a device that plugs into a USB port (at a laptop) which just has a button. You hook the device up and find ClickShare_for_Windows.exe on the device across the USB port and run the .exe. Going forward you just press the physical button when you want to take over from someone else and start presenting. This is cool stuff with a bit of bling.
  61. Ctrl-mousewheel tends to scale browser fonts or alternatively the font in Visual Studio up and down in size.
  62. Hyper-V is some sort of VM/cloud solution/tool. It is Microsoft stuff.
  63. taxonomy is gonna be a game plan for classifying things, naming conventions for breaking up files into folders, etc.
  64. Someone once told me about an app which recommends times for pee breaks during movies, but I cannot remember what it is. The concept is fascinating because I assume the app would recommend the most worthless time/part of a movie to miss. How would it know? Would users suggest points of disinterest in each film?
  65. a KPI (Key Performance Indicator) is a metric to track (one of many) for how healthy your business is and how well it is doing and KPM (Key Performance Measure) is a similar acronym
  66. When you add a getsetter to an object in C# only to find you cannot use the new getsetter, well maybe you drilled into a .dll in Visual Studio by way of some of JetBrain's magic and maybe you made a pseudochange there at the object.
  67. OKR (Objectives and Key Results) is a leadership process for setting goals.
  68. In cold calling people you are trying to get past the "gatekeeper" to speak to the "decision maker" in your tedium. Sandler sales training specifically has a fail fast philosophy. If it's not a good fit, let's just move on. The old school model of going door-to-door selling a vacuum cleaner, or at least trying to, and talking a victim into something they don't need doesn't apply here. Instead a good victim is already in pain and really needs the thing you have to offer to get out of pain. In prospecting and having conversations that might lead to leads for victims even in the immediate party doesn't fit, part of the manipulation is to tell others "Hey, I have a note from my boss here to call you. Do you know why we should be speaking?" and to let the other party brainstorm ways there might be a fit in the name of saving you. Going "not OK" and saying things like "I know we screwed up and I bet you'll never use us again." is another way to get... "saved"
  69. Early Access is a term for an open alpha of sorts in gaming, video games.
  70. William Gibson coined the terms cyberspace and cyberpunk, the former being of the internet and the later a little harder to define. Steampunk, sort of old-meets-new in science fiction (that will remind you that science fiction technically starts with Jules Verne and "Twenty Thousand Leagues Under the Sea" in 1870 and the not cold war space race) is a terminology offshoot.
  71. MSAjax was some way to do Ajax in MVC 1. You never hear about it anymore. Everyone realized the jQuery way was best instead back then.
  72. You photobomb someone when you purposefully put yourself as an unwanted addition in the background of the photo with them.
  73. VirusTotal is a Google-owned, online scan-for-viruses tool.
  74. MSCD is Microsoft Certified Solutions Developer... another silly certification
  75. gofundme.com is some crowdsourcing funding thing.
  76. Comcast has a one terabyte data limit.

 
 

Addendum 4/20/2018: Scrolling the mousewheel adjusts the zoom at a browser and not the font size. See this.

 
 

Addendum 1/13/2020: "Escape The Room" in 46 should just be an escape room as "Escape The Room" is more specifically a company that offers escape room adventures. 70 is probably partially inaccurate. There is a reassessment in modern years in which Mary Shelley's Frankenstein is deemed the first example of science-fiction.

Thursday, June 29, 2017

Fun fact: Did you know that a bytes array representation of a file in C# when consumed from a REST endpoint will become a string in JSON/JavaScript?

A .txt file containing "Hello World" and nothing else makes for a bytes array with this in it when consumed in C#:

  1. 72
  2. 101
  3. 108
  4. 108
  5. 111
  6. 32
  7. 87
  8. 111
  9. 114
  10. 108
  11. 100

The values here I assume correspond to applicable ASCII (American Standard Code for Information Interchange) characters. Anyhow, when you get this in JavaScript, you'll just have: SGVsbG8gV29ybGQ=

 
 

By the way, this is how you'd barf back a file from this data on the JavaScript side from a base64 string. I am stealing this from here and, yes, it works.

var byteCharacters = atob("SGVsbG8gV29ybGQ=");
var byteNumbers = new Array(byteCharacters.length);
for (var i = 0; i < byteCharacters.length; i++) {
   byteNumbers[i] = byteCharacters.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
var blob = new Blob([byteArray], {type: "text/plain"});
var fileURL = URL.createObjectURL(blob);
window.open(fileURL);

I want a variable at the route of an Microsoft.AspNetCore.Mvc.Controller action to have a different name than the same variable at the method signature because I'm a tool.

You're very special. Here is how you may have what you want:

[HttpGet]
[Route("api/foo/{id}")]
public Foo GetFooById([Bind(Prefix = "id")]int fooId)
{

Wednesday, June 28, 2017

pull down a file from Azure!

Alright, it turn out that, yes, this works! You could jam a static method like so...

public static string Download(string storageDirectory, Guid fileId, string fileName, string
      connectionString)
{
   var storageAccount = CloudStorageAccount.Parse(connectionString);
   var blobStorage = storageAccount.CreateCloudBlobClient();
   CloudBlobContainer container = blobStorage.GetContainerReference("dummyfiles");
   string blobId = string.Format("{0}/{1}_{2}", storageDirectory, fileId, fileName);
   CloudBlockBlob blob = container.GetBlockBlobReference(blobId);
   var token = blob.GetSharedAccessSignature(new SharedAccessBlobPolicy()
   {
      Permissions = SharedAccessBlobPermissions.Read,
      SharedAccessExpiryTime = DateTime.UtcNow.AddMinutes(1)
   }, new SharedAccessBlobHeaders()
   {
      ContentDisposition = string.Format("attachment; filename=\"{0}\"", fileName)
   });
   return string.Format("{0}{1}", blob.Uri, token);
}

 
 

...into AzureService to download a file you uploaded. Obviously, the Upload method would need some love so that fileId would be handed in to be used lieu of the Guid.NewGuid() hack.

The global namespace in C#!

var x = new global::Walrus(); varies from var y = new Walrus(); in that the first will look for Walrus in the global namespace which is the project-wide globally available stuff that exists when you do not wrap a class declaration in a using directive. Think extension methods. Obviously if you need something out of the global namespace and it has a name conflict with something in the immediate namespace it will be tricky to call. You cannot lead the type with dot, dot, dot to give the namespace, right? Instead, use this hacky thing.

change around the font in WebStorm 2017.1.2

First, press Ctrl-Alt-S to open the settings and preferences dialog box. Next, nagivate to: Editor > Colors & Fonts > Font

Tuesday, June 27, 2017

push up a new file to Azure?

I'm not 100% confident this works yet.

using System;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
namespace Whatever.Services
{
   public static class AzureService
   {
      public static void Upload(string storageDirectory, string connectionString,
         byte[] fileData, string fileName, long fileLength, string contentType, string userId)
      {
         CloudBlockBlob blob = null;
         var storageAccount = CloudStorageAccount.Parse(connectionString);
         var blobStorage = storageAccount.CreateCloudBlobClient();
         CloudBlobContainer container =
               blobStorage.GetContainerReference("dummyfiles");
         if (container.CreateIfNotExists())
         {
            var permissions = container.GetPermissions();
            permissions.PublicAccess = BlobContainerPublicAccessType.Off;
            container.SetPermissions(permissions);
         }
         string uniqueBlobName = string.Format("{0}/{1}_{2}", storageDirectory,
               Guid.NewGuid(), fileName);
         blob = container.GetBlockBlobReference(uniqueBlobName);
         blob.Properties.ContentType = contentType;
         blob.UploadFromByteArray(fileData, 0, (int) fileLength,
               AccessCondition.GenerateEmptyCondition());
      }
   }
}

Monday, June 26, 2017

ICollection, IEnumerable, IDictionary, IList are interfaces for collections in C#.

You may have an IList type getsetter and assign a list or an array to it and the same may be said of IEnumerable. Clearly IList and IEnumerable behave differently in the same way List and IEnumerable behave differently with IEnumerable exposing fewing convenience methods for functionality in exchange for a lighter footprint. ICollection in contrast may also have a HashSet assigned to it!

Friday, June 23, 2017

Fire and forget with Angular 2 REST service calls.

Consider this:

this.http.put(myUrl, myJson, myOptions);

 
 

It does nothing. It fails silently. You have to chain stuff off of the put to get it to do something like so:

this.http.put(myUrl, myJson, myOptions).toPromise().then(function(){},
      function(){}).catch(function(){});

 
 

That's terrible too because, per Roy Fielding, PUT as a verb should not roundtrip something back up to you. At your ASP.NET Web API endpoint you should just have a void method and not a method that returns a true value bool as a hack to accomodate Angular 2. The fix is this:

this.http.put(myUrl, myJson, myOptions).toPromise();

 
 

This was allow you to hit an endpoint that returns void.

Thursday, June 22, 2017

when newing up a specific date in JavaScript/TypeScript...

var whatever = new Date(1974, 7, 24);

This date is going be August 24th of 1974 and not July 24th of 1974. Remember the goofy zero to eleven scale for month. You have to think of it when it comes to pulling the month back out. Bonus: Also note that .getUTCFullYear(), .getUTCDate(), and .getUTCMonth() are a thing when pulling stuff back out.

Wednesday, June 21, 2017

Ctrl-Shift-Z is the Ctrl-Y in WebStorm

You redo an undo (Ctrl-Z) with Ctrl-Shift-Z while Ctrl-Y just seems to destroy the line you are on which is infuriating.

HttpResponseMessage to an MVC Controller causes: Incorrect Content-Type: application/json; charset=utf-8

This error ended up having more to do with the listening ear than what was talking in. The DTO below ended up with a bunch of null values.

[HttpPost]
[Produces("application/json")]
[Route("foo/bar/baz/")]
public string Whatever(MyDto myDto)
{

 
 

This change made the problem go away:

[HttpPost]
[Produces("application/json")]
[Route("foo/bar/baz/")]
public string Whatever([FromBody] MyDto myDto)
{

Upload something from Angular 2 with the both the file input type HTML control and Observable.

If this is at your component's template...

<input type="file" (change)="uploadFile($event)">

 
 

...you may kick off this in the component itself:

uploadFile(event:any):void{
   let filePath = event.target.value;
   if (filePath){
      this.myService.uploadFile(event.target.files[0]);
   }
}

 
 

That in turn may reach into your service for this method. Note that Headers and RequestOptions must be imported from '@angular/http' while FormData just seems to magically work.

public uploadFile(file: any): void {
   var url = "http://www.example.com/api/whatever/";
   let formData:FormData = new FormData();
   formData.append('uploadFile', file, file.name);
   let headers = new Headers();
   headers.append('Content-Type', 'multipart/form-data');
   headers.append('Accept', 'application/json');
   let options = new RequestOptions({ headers: headers });
   this.http.post(url, formData, options)
      .catch(error => Observable.throw(error))
      .subscribe(
         data => console.log('success'),
         error => console.log(error)
   )
}

 
 

At the ASP.NET Web API side of things you could have an endpoint like so in a .NET Core Microsoft.AspNetCore.Mvc.Controller:

[HttpPost]
[Route("api/whatever")]
public void SaveStuff()
{
   HttpRequest request = this.Request;
   IFormFile file = request.Form.Files[0];
   using (var reader = new StreamReader(file.OpenReadStream()))
   {
      var fileContent = default(byte[]);
      using (var memoryStream = new MemoryStream())
      {
         var buffer = new byte[file.Length];
         var bytesRead = default(int);
         while ((bytesRead = reader.BaseStream.Read(buffer, 0, buffer.Length)) > 0)
         {
            memoryStream.Write(buffer, 0, bytesRead);
         }
         fileContent = memoryStream.ToArray();
      }
      using (var writer = new BinaryWriter(System.IO.File.Open("C:\\x.jpg",
            FileMode.OpenOrCreate)))
      {
         writer.Write(fileContent);
      }
   }
}

 
 

Clearly the BinaryWriter stuff above is silly. It's just there to show off that the code above works. If you want the file name for the file, you could have gotten above with:

string fileName = file.FileName;

 
 

Addendum 6/26/2017: This is also legit, giving something like: image/jpeg

string contentType = file.ContentType;

Monday, June 19, 2017

Do not expect to error catch a 404 coming back off an Observable promise.

this.http.get("http://www.example.com/api/whatever").toPromise().then(

...is not going to play nicely with example.com not existing outright. To avoid a blow up you will want to wrap this line of code in a try/catch. How realistic is it to worry about your endpoint not being there? Well, you're still reading, aren't you?

Sunday, June 18, 2017

yet more gunk from a series of Angular 4 training videos

  1. [ngStyle]="{backgroundColor: whatever===13 ? 'red' : 'blue'}" is an example of a condition in an ngStyle.
  2. In making an attribute directive such as myHighlight here you may add something like so at the constructor... private rendery: Renderer2 and then turn around and use it like this:
    ngOnInit() {
       this.rendery.setStyle(this.el.nativeElement, 'width', '50px');
    }

    ...this sort of assumes that private el: ElementRef is also at the constructor.
  3. @HostListener('mouseenter') myMouseEvent(eventData: Event) { is a way to catch a mouseenter event at a tag within your attribute directive. mouseleave and other events are available too.
  4. @HostBinding('style.marginTop') myMargin: string; inside an attribute directive allows for something like this inside a @HostListener method: this.myMargin='10px';
  5. @Input myOffset: string = '10px'; at an attribute directive allows for this.myMargin=this.myOffset; and kinda takes place at the tag itself like so:
    <p myHighlight myOffset="30px;">Highlight me!</p>.
    You may have an alias at the Input to make it whatever you'd like at the tag and you may even make the alias the same name as the selector for the directive! When you do that, you may have something like so:
    <p myHighlight="30px;">Highlight me!</p>
  6. The training kinda touched on making your own structural directive though I don't really see a bunch of reasons to do so myself. If you have something like private foo: TemplateRef<any>, private bar: ViewContainerRef in the constructor then this.bar.EmbeddedView(this.foo); in the getter of a getsetter for an @Input which shares the name with your directive (It has to!) it will allow you to show what is inside of your tag while this.bar.clear(); shows nothing. Based on the value handed in you may write your own thing like *ngIf, but again... why?
  7. The training had an example of doing so some static state stuff in a service and cautioned that if you share a service across two components that, if you want to share state and not have two separate instances, that you need to loop in the provider not at each component but hierarchically above at a component wrapping the components.

Yay! It's fun to build stuff:

Saturday, June 17, 2017

I saw Jason Awbrey speak on Xamarin at the North Houston .NET Users Group on Thursday night.

This was my first time to hit this group and Mr. Awbrey turned out to be a former president of the organization. It was advertised that there is also an independent Houston Xamarin Users Group that is a meetup.com group as well. Alright, this was refresher on what Xamarin is and it can be a few things. Just as Oracle is sort of an ambiguous term as one could be speaking of the database or one could speaking of the ERP, Xamarin has few products and can mean a few things. The space itself, in a generic sense, has, per the speaker, picked up in interest since Xamarin the company was bought by Microsoft and became a subsidiary of it. James displayed some charts that ostensively showed a spike in interest as of the acquisition and moreover and more importantly he asserted that he now sees companies hiring for Xamarin. I have tried to get into Xamarin before and have goofed off with what Mr. Awbrey would call Traditional Xamarin. As badly as I wanted to get that Xamarin Store app working so that I could get one of those cool free green C# T-shirts, I could not, and when I could not I just gave up as Xamarin did not, at the time, seem to be a real world skill to hone as I never saw it appear in job descriptions when I was chasing work. Is that all about to change? I was getting a soft yes from presenter. As far as my inability to get the Xamarin Store afloat before goes, Jason suggested that he hears all the time of developers complaining of how they couldn't get Xamarin to work in Visual Studio on a PC (which was my circumstance too) and he suggested that while this shouldn't be the case and that it should work, the real way to approach Xamarin development is to get a Macintosh and run Xamarin Studio there. Xamarin Studio was showed off by Jason and it vaguely has a Visual Studio projects-inside-of-solutions feel. Traditional Xamarin apps have solutions with C# base projects and then different UI projects for the iOS and Android breakouts. In order to actually push something for iOS that can get into the Apple Store you have to use some SDKs that Apple provides that cannot run on a PC so you have to, bottom line, develop on a Macintosh. When Jason announced this to the room full of .NET geeks the audience groaned in denial and horror. I've never had to get used to the goofy Macintosh interface (don't need it professionally) or buy a Macintosh laptop. Do I now have to? This is going to be an adjustment. Traditional Xamarin grew out of a beta of MonoTouch and became a third alternative to two bad ways to develop celly apps, the first of these being to have two different code bases for iOS and Android and the later being to make an HTML hybrid app with stuff like PhoneGap, Lua (from the Portuguese word for moon, this is a programming language for "embedded systems" or computers with "dedicated functions" like smartphones which are only so open and not particularly inviting of extension), Cordova, and React Native. The second way, while better than the first, is bad by way of being too consistent. The application will behave the same in both environments and not have the idiomatic feel of a given environment and hence just feel clunky/kludgy to a user used to his phone feeling like his phone and not something foreign. Now, that said, one of the criticisms I have heard of Xamarin in general is that you end up having to write a bunch of platform specific code and are approaching being back in the trap of writing an app for two environments anyways. Jason mentioned just as someone, a C# dev, who knew WinForms in trying to understand web forms could come to the space armed with a lot of the knowledge he needed... he would still be in the situation of having to learn new things, the stateless web, HTTP, etc. ...well also in getting into Xamarin you have to learn to ramp up on a lot of new things like the fact the AppDelegate.cs is the main launching point for an iOS app in their paradigm, etc. One thing that is now making it less painful and addressing the criticism I've heard is Xamarin.Forms (also known as Xamarin 2.0) and in these solutions between the C# layer and the diversified UI layers there is also a common UI layer filled with canned controls for iOS, Android, and I think also Windows Phone environments. These controls behave as they should in each environment, tailored to the space. The thing to assume is that the trend will continue and the future of Xamarin will feature a continuing lessening of the pain of the environment split. Other things mentioned included:

  • There is a great community of open source projects to make this space even better. SQLite was suggested to be typically used for the database in these apps and sqlite-crypto was suggested as a way to obfuscate (encrypt) the databases. Also, PCLStorage is a good way to do File I/O stuff. You need a little something extra if you're also targeting Windows Phone as it's sandboxing for "isolated storage" is not the sandboxing for "local storage" of iOS and Android.
  • Xamarin Live Player lets you deploy from Windows to one particular iOS device, such as an iPad, for testing, but don't try to squint your eyes and imagine not buying a Macintosh just because of this. That's not the way to go per Jason.
  • A .pcl will drive the base C# core underlying project in a solution and by that I do not mean that the base project is the .pcl but that instead it will go into the .pcl for things like the counterparts to System.Web which would come from a .NET .dll in the traditional Visual Studio for-the-web paradigm. A .pcl is not a consistent canned thing like a specific version of a .dll. You make a .pcl by checking some checkboxes for what environments you wish to support and render out a .pcl which will have functionality for C# that may run in the environments selected. Obviously, the more environments you pick, the less the .pcl can do for you.
  • Charles Petzold has an eBook on Xamarin.Forms which was recommended.

Friday, June 16, 2017

run Visual Studio in elevated mode to avoid this error

Consider this error upon build for Visual Studio 2015:

The command ""C:\Users\tom.jaeschke\Documents\stuff\Whatever\\..\Tools\gacutil\gacutil.exe" /if "C:\Users\tom.jaeschke\Documents\stuff\Whatever\bin\DEV.Debug\Whatever.dll" IF %ERRORLEVEL% NEQ 0 ECHO ERROR: PLEASE RUN VISUAL STUDIO IN ELEVATED MODE TO AVOID THIS ERROR so Whatever.dll can be installed to GAC" exited with code 1. Whatever

 
 

To get around this I:

  1. restarted Visual Studio, running as Administrator
  2. closed a second instance of Visual Studio I had opened
  3. temporarily switched from the unusual startup project I had picked back to the default just so I could build .dlls and then switched back

Thursday, June 15, 2017

.unshift lets you put something at the beginning of an array in JavaScript the way .push would put something at the end

Per this, this is an example:

var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.unshift("Lemon","Pineapple");

 
 

Which would make an array holding:

  1. Lemon
  2. Pineapple
  3. Banana
  4. Orange
  5. Apple
  6. Mango

Timesheets are changing at JIRA.

Tempo > Timesheets is being replaced by Temp > My Work. A cloud-based progressive rollout will eventually update stuff at your JIRA too if it hasn't already. My Work has swim lanes like Boards > All Projects while Tempo > Reports looks a little more like the timesheet of yore. Still, you'll submit time at My Work.

Wednesday, June 14, 2017

Is it alright to reset data when tabbing away to other tabs?

Is it bad UX to let a user switch to another tab in a SPA app and then switch back while yet showing unsaved changes? Should the data that hydrated the tab to begin with just rehydrate it? Well, probably not. The problem with that is it should really only happen if you are going to warn users that they are to lose data when switching tabs without saving and that is kinda tedious because it slows the app experience down.

/poll "Do you like corn flakes?" "yes" "no"

...is an example of having a poll in Slack. You just give something like this in the chat window's input box. The first thing in quotes is the question and the rest of the items are possbile answers.

my data wrapper of T

I'm seeing sort of thing more and more. Instead of just handing an object back from a C# service call or repository call or whatever, one hands back the object, whatever it may be, in a predictable wrapper.

namespace Whatever
{
   public class ImportantStuffWrapper<T>
   {
      public T ImportantStuff { get; set; }
      public bool IsErroneous { get; set; } = false;
      public string ErrorMessage { get; set; }
      public double PriceOfTeaInChina { get; set; }
   }
}

 
 

ImportantStuffWrapper<Ostrich> wraps an Ostrich in this example.

Error trying to diff '[object Object]'

This comes up as an error in Angular 2, at Google Chrome's console, in attempting to cast a standalone object, not an array, to an array of something.

Tuesday, June 13, 2017

pseudocontravariance via serialization!

If we can make C# Animal objects from this...

namespace Casting.Models
{
   public class Animal
   {
      public string Name { get; set; }
   }
}

 
 

...and Cat inheirts from Animal...

namespace Casting.Models
{
   public class Cat : Animal
   {
      public int Lives { get; set; }
   }
}

 
 

Well remember how you can't upcast a list of children to a list of parents in C#. I found a way. Look!

using System.Collections.Generic;
using System.Web.Mvc;
using Casting.Models;
using Newtonsoft.Json;
namespace Casting.Controllers
{
   public class HomeController : Controller
   {
      public ActionResult Index()
      {
         List<Cat> cats = new List<Cat>()
         {
            new Cat() { Name="Foo", Lives=9 },
            new Cat() { Name="Bar", Lives=8 },
            new Cat() { Name="Baz", Lives=7 },
            new Cat() { Name="Qux", Lives=6 }
         };
         string json = JsonConvert.SerializeObject(cats);
         List<Animal> animals = JsonConvert.DeserializeObject<List<Animal>>(json);
         return View(animals);
      }
   }
}

 
 

We may, yes, downcast the other way around. Not only does the code above not break but the code below does not break either. The Lives getsetter just gets lost above and below it become zero for every Cat.

using System.Collections.Generic;
using System.Web.Mvc;
using Casting.Models;
using Newtonsoft.Json;
namespace Casting.Controllers
{
   public class HomeController : Controller
   {
      public ActionResult Index()
      {
         List<Animal> animals = new List<Animal>()
         {
            new Animal() { Name="Foo" },
            new Animal() { Name="Bar" },
            new Animal() { Name="Baz" },
            new Animal() { Name="Qux" }
         };
         string json = JsonConvert.SerializeObject(animals);
         List<Cat> cats = JsonConvert.DeserializeObject<List<Cat>>(json);
         return View(cats);
      }
   }
}

 
 

What's not to like? Well, this does not make for polymorphic behavior as the Cats that become Animals do not retain any of their cattiness. What is to like? Fake contravariance!

Ctrl + Alt + Forward Slash is the other Resharper way toggle commenting out code when Ctrl + Forward Slash alone does not work.

I seem to have the Visual Studio settings in lieu of the IntelliJ settings as someone else prepped my machine. This means Ctrl-T finds something instead of Ctrl-N and the like. I guess I can get back out of this trap.

When HttpUtility.UrlEncode(whatever) won't do in C# because you don't want to loop in System.Web or just can't.

var foo = System.Uri.EscapeDataString(whatever);

Make a method come back with it's result wrapped in a Task in C#!

var whatever = Task.Run(() => MyStaticClass.MyStaticMethod("abc",123));

when to cache

I'm part of cleaning up an app that caches everything that comes up from the database and that isn't too good. You don't need to cache little things like a list of U.S. States because the performance gain is miniscule but you do need to only cache things that change rarely, like, say a list of U.S. States. Ha ha. Maybe a list of vendor cities is a more applicable example, not a list of vendor paychecks in an accounts payable system which would be added all the time. When a vendor city does change, what do you do about the cache that no longer reflects reality? Do you have the caches expire ever so often or do you explicitly associate dropping things out of the cache to writing to the database?

How do I even use stuff I stage in Startup in a .NET Core app beyond Startup?

Let's say you have a IConfigurationRoot in Startup.cs named Configuration which you prep like so per this:

var builder = new ConfigurationBuilder()
   .SetBasePath(env.ContentRootPath)
   .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
   .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
   .AddEnvironmentVariables();
Configuration = builder.Build();

 
 

...and, also maybe string Whatever = Configuration["Whatever"]; wherein Whatever is a property in the JSON object inside of appsettings.json. Alright, how can we keep what we pulled out from appsettings in the name of using it in a Controller? I recommend Static State!

 
 

Addendum 6/27/2017: If you need to drill into the json object with the settings, do so with colons in lieu of dots like so:

string Whatever = Configuration["Foo:Bar:Baz:Qux"];

At a timesheet in JIRA you may accidentally add "planned time" in lieu of actual time if you try to add time to a category of open issues instead of an actual open issue.

Click back where you clicked before to get rid of this.

Sunday, June 11, 2017

Moar!

I'm crack smoking my way through a series of online trainings on Angular 4. Some things from this weekend are:

  1. You may define a custom shape for an input on a component like so:
    @Input whatever: { foo: string, bar: Boolean, baz: number, qux: Date };
  2. @Input('significance') whatever: any; is an example of having an alias at an Input. (You may have one of these at an Output too.) Where you hand something in for the Input from outside the component you will have/use "significance" at the component tag, but inside it's just: "whatever"
  3. The styles and stylesUrls metadata properties at a component's decorator by default will be scoped to the component that uses them and components set here will not bleed into other components. To make this happen there are some compiler tricks that dress up the CSS you give. Setting all the text to be red in color at one component will not bias a neighboring component. If you want to affect everyone outside of yourself, so to speak, there is a way to do so. You may use, at your component's decorator, the metadata property of encapsulation like so:
    encapulation: ViewEncapsulation.None
    ViewEncapsulation has two other settings besides None. The first is Emulated which is the default setting we really just discussed and the other, red-headed stepchild, is Native, which attempts to use the Shadow DOM to manipulate a tree of nodes. Do note that a Shadow DOM approach (walling off a bit of the DOM into a pseudosecondDOM) is not supported by all browsers.
  4. The pound sign led variables inside of a tag which are sort of the new ids are formerly called local references. A local reference may be handed into other things in the same template only, for example a click event such as (click)="whatever(myLocalReference)" and yet with something like @ViewChild('myLocalReference') myComponentSideVariable: ElementRef you may have at the local reference at the TypeScript side of the component and do things like:
    let foo = this.myComponentSideVariable.nativeElement.value;
  5. The stuff inside of a component's selector tag is generally just a temporary message to be displayed before a component and its template loads, however, if you actually want to use this, whatever it is, in the template for the component, you may use this tag to make it happen:
    <ng-content></ng-content>
  6. I'm learning a little more about some of the esoteric lifecycle hooks. ngDoCheck runs when there is a change. It runs when change detection runs, be it when a button is clicked or a timer is fired, etc. ngAfterContentInit runs when the parent (well, wrapping) component's view loads and ngAfterContentChecked when it is done loading while ngAfterViewInit happens when the view for the component itself starts loading and ngAfterViewChecked when it is done loading. ngOnDestroy fires off when a component is destroyed. So when would you have an example of a component being destroyed? Well, let's say you have an array as a property in a component and that array feeds an *ngFor loop at the template and furthermore inside the *ngFor loop there is a selector tag for a nested component. OK, well, in that scenario, when you drop something out of the array you are also dropping a component. Something like ngDoCheck gets looped in from @angular/core as DoCheck. Basically at the imports you use the same names without the leading ng.
  7. <div *ngIf="whatever; else elsey">True</div>
    <ng-template #elsey>False</ng-template>

    ...is an example of using an else condition with an *ngIf and do note that along these lines there is also support for a then condition...
    <div *ngIf="whatever; then thenish else elsey">True</div>
    <ng-template #thenish>Still True</ng-template>
    <ng-template #elsey>False</ng-template>
  8. new EventEmitter<{ foo: string, bar: Boolean, baz: number, qux: Date }> is also legit.
  9. @ContentChild is kinda like @ViewChild but it applies to content in the ng-content tag. It may be had at as soon as the ngAfterContentInit lifecycle hook while @ViewChild may be had at the ngAfterViewInit lifecycle hook.
  10. At an event or an attribute you may always pass a function call with a variable (or two or three) or a equality comparison for true or false result. At events you may just hand in a string or an object instead of $event or make $event a second parameter.
  11. At a component selector tag you may have an *ngFor and then also hand in the child variable name to an attribute at the tag.

Saturday, June 10, 2017

You're not supposed to have two ids with the same name in HTML.

Everyone know that, and yet, what are the consequences exactly? Consider this:

<html lang="en">
   <head>
      <meta charset="utf-8">
      <title>Whatever</title>
      <style type="text/css" media="all">
         #dupe {
            color: red;
         }
      </style>
   </head>
   <body>
      <div id="dupe">foo</div>
      <div id="dupe">bar</div>
      <script type="text/javascript">
         var x = document.getElementById('dupe').innerHTML;
         alert(x);
      </script>
   </body>
</html>

 
 

In both Chrome and IE both divs get colored red but only "foo" appears in an alert. So... there is some drama and strange, unpredictable behavior. Yeah, best to avoid this.

Fidget Spinner

It seems to be the tweak toy du jour.

Friday, June 9, 2017

Bootstrap Glyphicons

This has a list of them, and something like...

<span class="glyphicon glyphicon-remove"></span>

 
 

...is going to make an: X

image as a type at a database table?

Hey why not? Corel Paradox and early Microsoft Access did this. Well, there are some good reasons why not. You should probably have a separate file server for your files. That said, I learned today that Viewpoint stores images at the database.

query child objects inside of a query for an IQueryable

var query  =  from i in DbContext.Infected.Where(x => x.Id == somethingErOther)
join t in (
   from w in DbContext.Tapeworms
   select new
   {
      Fk_Id = w.VictimId,
      Result = new TapewormDTO()
      {
         Name = w.Name,
         Length = w.Length,
         Variation = w.Variety
      }
   })
on i.Id = t.Fk_Id into TapewormResult
join c in DbContext.Cities.Where(x => x.Id == i.CityId)
select new InfectedDTO()
{
   Name = i.Name,
   Locale = c.Name,
   Tapeworms = TapewormResult.Select(x => x.Result).ToList()
};

More Information: Connected to the remote computer ("whatever") using the specified process ("Web Management Service"), but could not verify the server's certificate. If you trust the server, connect again and allow untrusted certificates. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_CERTIFICATE_VALIDATION_FAILED.

A possible fix for this problem:

  1. Go into that goofy "Properties" folder that Visual Studio made for your startup project upon compilation and then into the "PublishProfiles" folder inside that.
  2. Open the applicable .pubxml file for the profile that can't publish.
  3. Set the "AllowUntrustedCertificate" value to True and save the file.

Force your way onto another branch with Atlassian's SourceTree.

Don't you hate it when you click on a branch in SourceTree and you cannot jump to it because the branch you are leaving has uncommitted or undiscarded changes. Well, when you try and the "Confirm Branch Switch" dialog box comes up you may always just click the "Clean (discard all changes)" checkbox to abandon completely that which you are fleeing from.

Could not find a part of the path 'C:\Users\tom.jaeschke\.nuget\packages\.tools\BundlerMinifier.Core'.

Fix this compilation error with this NuGet command:

Install-Package BuildBundlerMinifier

The Ctrl-Space trick also kicks IntelliSense awake!

When you dot off something in C# and you don't get a list of options you may just use this trick to see the IntelliSense list. Up until now I have been erasing the period and retyping it. Ha ha. Stupid me.

Getting modern .NET Core projects to work in old man Visual Studio 2015.

I've downloaded the 4.7 .NET Framework and .NET Core 1.1 and I have Update 3 so what gives? Why can't Visual Studio make sense of a UI project?

  • get "NET Core tools Preview 2 for Visual Studio 2015" from here
  • install the missing .NET Core 1.0.1 SDK 1.0.0 Preview from here

Thursday, June 8, 2017

import {Injector} from '@angular/core';

I'm a little fuzzy on how Injector manages/assists dependency injection in an Angular 2 app. At a glance it seems you may have a child with a constructor like so:

export class MyOneOffWackiness extends MyUniversalDependencies {
   constructor(public foo: Foo, public bar: Bar, injector: Injector) {
      super(injector);
   }

 
 

The parent would then look like this:

export abstract class MyUniversalDependencies {
   foo: Foo;
   bar: Bar;
   constructor(public injector: Injector) {
      this.foo = injector.get(Foo);
      this.bar = injector.get(Bar);
   }

 
 

This basically just wires up the default Foo for foo and the default Bar for bar (as best as I can tell) but it also leaves the door open for one to double back to this and make something that inherits from Foo feed foo while also making a sweeping change for all of the children implementations in one place.

Node may need GIT installed to download some stuff for node_modules.

Get GIT and then type "git" at a command prompt to make sure it is there. Yay!

Pull down source code from Atlassian Bitbucket's web interface.

  1. Go to https://bitbucket.org/whatever/ or whatever and login.
  2. Drill into the project to want.
  3. Click on the "Clone in SourceTree" icon. It will look like an arrow pointing downwards into an "inbox" and by inbox I mean a U-shaped thing wherein the U is much more wide than tall.

a .jspa page is an alias to/for a .jsp page

An exclamation mark in a .jspa url may mean (give away) that you are using Jakarta Struts, a "Model 2" (somewhat more complex that the simple) architecture with Java Beans.

Wednesday, June 7, 2017

no name or id setting on controls inside of a *ngFor

You really don't need that stuff. You may just have events or even the [(ngModel)] trick doctor up stuff on the immediate object in the collection. A save button event may then just take the collection and do whatever dirty checking you need to do to save off that which has changed. You may find yourself doctoring base objects with inheritance to add dupe getsetters for what a value was versus what it might be (for dirty checking) or the range a numeric value may become (for sanity checking), etc. Don't let the old ways bleed into the new out of habit. You don't want an unholy hodgepodge of two dissimilar things. It won't make sense.

when you try to use your Dell XPS laptop as the first of three monitors at a docking station and it periodically goes black

Right-click in the desktop at Windows 10 and pick "Display settings" and then go to "Power & sleep" at the left nav like so:

At the upper right of this screen you will see "Additional Power Settings" which should be clicked. Then you should click "Change plan settings" and after that "Change advanced power settings" to get a dialog box like so:

Turn off: Link State Power Management

 
 

Addendum 6/8/2017: What is above is all wrong. All you have to do is install the latest drivers to fix this problem.

 
 

Addendum 6/9/2017: As it turns out, the drivers didn't help either. I don't know what to do about this problem.

 
 

Addendum 6/28/2017: This turned out to be a really tough problem to solve. We are guessing that it is some sort of collision between a Dell XPS laptop and a Dell K17A001 dock. The problem is unique. A tech support call to Dell revealed that no one else had reported up the problem as of yet. The problem was "solved" by setting the laptop display to sleep in lieu of a do nothing default state. It's not going to sleep while I'm using it obviously. That "fixed" the issue. The sleep setting doesn't have the gremlin the other setting had.

Tuesday, June 6, 2017

An exception of type 'System.NotSupportedException' occurred in EntityFramework.SqlServer.dll but was not handled in user code

Additional information: Unable to process the type 'Whatever[]', because it has no known mapping to the value layer.

If you are popping an IQueryable off to a List and then trying to use that List as an assignment at another IQueryable it just won't work. You'll end up with this error. Instead, you should get that second IQueryable off to a List and then do the doctor up. There was time when I was child when I got kicked out of a waterslide park in my hometown of West Palm Beach, Florida for doing things I wasn't supposed to do like standing up on the mat like I was surfing or trying to stop on the slide and let others crash into me. IQueryable is kinda like a waterslide in that there is a lot of stuff you just can't do on slides. String.IsNullOrWhiteSpace will also not work, etc.

The Git Flow button in Atlassian SourceTree will only branch off the main branch.

To branch off the branch you have selected use the Branch button.

rem versus em in CSS

rem is short for Root EM and it is more likely to stick to one unit equaling sixteen pixels than is mere em alone which can be warped by users setting the fonts big at their browsers. rem can be warped some too it would seem, but less so.

Monday, June 5, 2017

I am getting used to the .edmx Entity Framework IQueryable incompatibility with partial extensions of generated code.

Oldest C# trick in the book: I have a POCO (plain old CLR object) named Person and Person has getsetters for FirstName and LastName. I also make a convenience method for FullName which basically concatenates the two with a space between them. Well, I guess that is not the very oldest trick. !Page.IsPostBack probably beats that. Anyhow, in the Entity Framework means there would be a generated partial class for Person with the FirstName and the LastName and you could extend it by making a partial class with your own malarkey like a FullName method... you just can't use Full name in an IQueryable.

It may be wise to have a module for a pipe in the Angular 2 paradigm.

This defers the loading of the JS for the pipe until it is really needed and If there are is not otherwise just one God module wrapping everything (and if individual components thus have modules) you may find that when you loop in a pipe by itself at one of the Russian dolls (without the module) that a module higher up the hierarchy will start throwing errors.

Branches 'Whatever' and 'origin/Whatever' have diverged. And branch 'Whatever' may be fast-forwarded.

This error in Atlassian SourceTree seems to happen when one is branching off a branch and the main branch is not yet updated, for example if I were tying to make a Whatever3 branch off of the Whatever2 branch that was splintered from the Whatever branch to begin with and there are checkins yet to pull for Whatever. This is confusing because it wouldn't seem at a glance like Whatever should affect breaking Whatever3 off of Whatever2, but whatever. This may all be because there is no easy way to branch off of Whatever2 without first merging it to Whatever. If you merge to Whatever in the name of this hack and then want to throw away the merge after a commit but not a push, just delete the branch from Branches and then get it again from Remotes. You may need to check the checkbox for Force Delete if SorceTree complains.

MarkerClusterer at the Google Maps API

This explains it some. In the initMap() function you will have something like, per their (see the link) example...

var markerCluster = new MarkerClusterer(map, markers,
   {imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/
      markerclusterer/m'});
}

 
 

map and markers being the map itself and an array of markers sitting on this map. What this does is it keeps a bunch of markers sitting on top of each other from having unreadable names (due to the jumble) by replacing the markers with a placeholder for the number of markers there. As you drill into the map enough you eventually see markers again when it's not too noisy. You add the likes of https://developers.google
.com/maps/documentation/javascript/examples/markerclusterer/markerclusterer.js to make this happen. Today I tried a bit to get MarkerClusterer to work with SebmGoogleMapMarker of Angular 2 per this and this but I only got as far as this:

import {SebmGoogleMap, SebmGoogleMapMarker} from 'angular2-google-maps/core';

Sunday, June 4, 2017

some Bootstrap stuff

I've been going through a tutorial on Angular 4 and, honestly, this weekend I mostly just learned about Bootstrap. Some class settings:

  • navbar navbar-default
  • navbar-header
  • collapse navbar-collaspe (for collapsible stuff)
  • caret (chases the element in the tag with a downwards pointing arrow)

 
 

class="dropdown-toggle" role="button"> at a tag seems to give/get the cursor:pointer; (yes, you may touch me) styling, and <div class="row"> seems to commonly wrap other gunk where widths are set. Stuff can float left and float right like this:

<span class="pull-left">foo</span>
<span class="pull-right">bar</span>

 
 

Some classes for buttons are:

  • btn btn-success (green)
  • btn btn-primary (blue)
  • btn btn-danger (red)

 
 

I think by default the buttons are just grey.

global setting for EVERYTHING in CSS???

Stealing from here...

*{
   margin: 0;
   padding: 0;
}

 
 

I fell into this wondering how to make one of those goofy corner ribbons that appeared in examples when CSS3 first emerged which no one ever actually used. I guess it is just a matter of positioning a div floating above everything with absolute positioning and rotating it at a forty-five degree angle. I ended up finding something worth caring about along the way! Sink your teeth into that!

Saturday, June 3, 2017

SebmGoogleMapMarker

This is some sort of canned Google Maps feature for Angular 2's space. You put in selector tags with tag names such as sebm-google-map-marker. It seems a little tricky and little clunky. I don't know yet if one may aggregate a bunch of pins right on top of each other into a cluster or not.

[ngForOf]

I'm not crystal clear as to what this does yet. Instead of having this...

<ng-container *ngFor="let cat of cats">

 
 

...maybe you could have...

<ng-container ngFor let-m [ngForOf]="cats">

 
 

...or per this have:

<ng-container ngFor let-item="$implicit" [ngForOf]="cats">

 
 

I'm not saying these three do the same thing. I don't know that yet.

Friday, June 2, 2017

Life without Photoshop

It is getting more and more common for me not to have Photoshop at work. If I just want to send someone a screengrab the Paint app built into Windows 10 tends to work just fine honestly. I almost never edit images professionally anymore. So much of modern design is CSS styling NOT dependent on background images. (flat and simple stuff) Anyways, sometimes to do want to know exactly how wide or tall something in a screengrab is and that is the one time I will miss Photoshop wherein things are easy to crop. I never warmed up to GIMP, but today I figured out how to crop stuff in it. (version 2.8)

  1. Open a file just like you would in Photoshop.
  2. Use the magnifying glass (Zoom Tool) to zoom in with clicks or zoom out while holding Ctrl and clicking and ultimate use the X-Acto knife (Crop Tool) to draw out a rectangular region for cropping. Like in Photoshop, if you are zoomed way in, the cropping will restrain itself to representations of enlarged pixels and not ambiguously not line up with pixel borders.
  3. Click inside a box you drag out to make the crop our outside the box to abort the crop.
  4. After the crop you will see by the file name at the top of the file window the size (in pixels) of the image.
  5. If you want to save the file you have to do an Export As to sidestep the GIMP XCF format. You cannot just save.
  6. After you have saved a file, you may always right-click on a file in Windowsland and pick Properties and then go the Details tab to see the size in pixels of any file that is an image.

The type 'Whatever' appears in two structurally incompatible initializations within a single LINQ to Entities query. A type can be initialized in two places in the same query, but only if the same properties are set in both places and those properties are set in the same order.

In an Entity Framework paradigm if foo and bar are both IQueryable<Whatever> in which several tables queried off an .edmx are joined together and then aggregated to a custom type like so...

var foo  =  from f in DbContext.Fleas
from d in DbContext.Dogs.Where(d => d.DogID == f.DogID)
from m in DbContext.Men.Where(m => m.ManID == d.ManID)
where d.Name != "Lucky"
orderby f.Name, d.Name, m.Name descending
select new Whatever()
{
   FleaName = f.Name,
   DogName = d.Name,
   DogOwner = m.Name
};

...then if foo doesn't fill in the exact same fields as bar and then we ultimately jam two IQueryable<Whatever> into one with var baz = foo.Except(bar); or something, we will get this confusing error message. By the way, you want to try your hand at an Onion Architecture with and .edmx I think this is the way to do it. Map joined gunk off to your own types. If there is only one table involved and not some joining, I guess you still have to map it off to a POCO in the core project. Writing back to the database should be easier than reading. In an Onion Architecture, I guess an IQueryable has to get popped off to an IEnumerable or another collection before being handed out of the repository to a core interface implementation (the interface method signatures demand Lists or Dictionaries or whatever but not IQueryables) as not doing so would represent an external dependency bleeding in. Not cool. Sucks huh? The ORM isn't much of an ORM when it comes to abstraction. You'd have to map off a second time from what comes up off the ORM.