Wednesday, February 1, 2017

Classic ASP

I am currently learning Angular 2 and it makes me glad I never learned Angular 1 honestly. The two are so very different and one is of the past and one (two) is of the future. I've been doing C# for a decade now and the modern Angular 1 versus Angular 2 circumstance makes me think of the old Active Server Pages in contrast to more modern modernity and makes me glad I never learned it given that it was all to get abandoned for .NET. Sure I dabbed in PHP and Cold Fusion in the ASP era, but in bailing for .NET it was like I was escaping to something better, not reluctantly cursing the fact that someone made a wildly different version of the thing I already knew. I've been there before in moving from the DOS (disk operating system) version of 3D Studio to 3D Studio Max back in the 1990s. PHP and Cold Fusion were probably better than ASP by a hair. You couldn't do any file uploading in old school ASP I recall. Cold Fusion had a low barrier to entry and PHP ran on dirt cheap hosting. Anyways, I do have a funny story to tell. In 2006 I was working at a consultancy which had a client that was a sizable organization with many departments. For example, Mechanical Engineering was one of the departments. The departments didn't have their own IT subdepartments within however. There was a common IT across all departments which was thus inattentive as everyone fought for its attention and Mechanical Engineering wanted to create an intranet site while sidestepping actually setting it up through IT as that would be a tedious waiting process with a bunch of red tape. This was a windowsland LAN environment and I was dispatched to see what could be done. I determined that without being able to set up a site in IIS (which only the ivory tower IT department could) that there would be no way to see the code inside a .NET .dll and hence .NET was out. I did determine that one could drop an old school ASP web site on a file share and hit the pages at a browser URL by way of going to an IP address in lieu of a domain name and then specifying the applicable file name for an entry point after a forward slash. What was more such an ASP site could successfully talk to a Microsoft Access database which could also just be dropped onto a file share! When I got back to the office I told Karl Parker my idea and he vetoed it. We ended up building the app the right way in .NET and then there was a bunch of drama and heartache in the name of getting IT involved to roll it out. And yet, I am proud of my ability to hack as exemplified here and I also wonder if this sort of hacking can't just be done at Windowland LANs today. Could you set up a rouge intranet site at your work with Classic ASP as the engine? What's in the way per se? Will this get me the ten at Black Hat I crave?

Tuesday, November 15, 2016

I'm done with blogging for a while.

To set up dual monitor displays at Windows 10, right-click in the taskbar, pick "Properties" and then click "Customize..." and then from the "System" box that appears go to "Display" and start by changing "Multiple displays" to: "Extend desktop to this display" ...you know, I've kept this blog for 5+ years and only now am I using an operating system at work that is newer than the blog itself. (not Windows 7)

Monday, November 7, 2016

abstraction: the fourth pillar

I thought there were three pillars to OOO as suggested here. In Googling it some, it kinda seems like some lists include abstraction as a fourth pillar. In many ways this is a lot like encapsulation in that in both cases you are trying to expose what is important and marginally hide that which is merely necessary that should draw the eye less sort of like the distinction between the "Wizard" of Oz and the man behind the curtain. (We want to keep him behind a curtain.) However, that said, encapsulation is something in particular, very particular, and has to do with how gunk is kept in a class itself. Abstraction will have you pulling stuff out of a class to another class.

 
 

Addendum 2/22/2019: OOO stands for Out Of Office and really OOO here should be OOP for Object-oriented programming.

Use the ES6 fat arrow for simple function substitution.

var x = y => alert(y+y);
x("hi");

 
 

...which is gonna tell you "hihi" is bascially the same as...

var x = function(y){
   alert(y+y);
};
x("hi");

There is a way to "autoseek" dependencies in web forms with StructureMap as one does in MVC where they may now auto-hydrate at controller constructors.

I spoke to someone who has done it before over a phone screen just now. It's nasty. You have to inject something into the HTTP model to catch a page before it complies code but after it's baked and inject stuff. Is ObjectFactory that evil that I should want to go there?

closures in JavaScript

What I suggest here is probably really wrong. Instead if you just Google against this topic you'll find stuff like this giving a different explanation. Alright, consider this:

var myClosure = function() {
   counter++;
   alert(counter);
};
myClosure();
myClosure();
myClosure();

 
 

It's gonna fail, right? You can't do plus plus on something undefined, right? Well, what if counter did correspond to a number in a backing store, someplace where state could be kept? It can. You can have this:

var myClosure = (function() {
   var counter = 0;
   return function() {
      counter++;
      alert(counter);
   }
})();
myClosure();
myClosure();
myClosure();

 
 

This code will not break and will moreover throw up three alerts, one after the other, with 1, 2, and 3, in them. We have made counter a privately-scoped variable really only approachable by myClosure and we are using it as a backing store for state. After initial assignment, myClosure behaves in the code immediately above just as it does in the code at the very top of this blog posting. The only difference is that now counter means something.

Saturday, November 5, 2016

yet more RANDOM notes from trying to find a job

a lot of this is shamelessly stolen from other stuff I found online...

  • var x = y.OrderByDescending(z =>
          z.Date).ThenByDescending(z => z.Name).Skip(5).Take(8);

          ...is an example of .ThenByDescending/.Take/.Skip in a Lambdaland.
  • cookies are a long-standing way of maintaining state at the browser while sessionStorage and localStorage are new to HTML5. localStorage lasts until you get rid of it, cookies may be set to last X number of days or minutes, and sessionStorage only lasts until the browser closes
  • data- attributes in HTML! You may invent your own "legitimate" inline parameter at an HTML tag to make it easy to latch onto the tag in JavaScript or communicate things in JavaScript.
  • The Discovery web service is a tool used to determine the organizations that a user is a member of in Microsoft Dynamics CRM.
  • Use both yield return and yield break TOGETHER...
    while (true)
    {
       if (i < 5)
       {
          yield return i;
       }
       else
       {
          yield break;
       }
       i++;
    }