Monday, June 5, 2017

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.