Sunday, February 14, 2016

Why I like my MacBook Pro - The Little Things

A friend of mine asked me to record some of the reasons I like my new MacBook Pro so much. Here it is.

MacBook Pro - The Little Things

  • Boots in 10 seconds
  • Multiple desktops (spaces)
  • Trackpad so nice that external mouse no longer necessary
  • Safari browser favorites easy to use without having to have a favorites bar showing and taking up space (it pops up when you click in the URL textbox)
  • Text on my Mac with keyboard instead of using my phone
  • Decline calls from my Mac
  • Shuts down in two seconds
  • On Windows, tool tips pop-up immediately. That’s always been a pet peeve of mine. As you’re moving the mouse around the screen, things keep popping up and getting in the way. On the Mac, you need to pause over something for the tip to come up.
  • Copying files and opening file explorer doesn’t fail.
  • It took 10 minutes for my Win 10 laptop to boot. It blue-screened, then restarted and downloaded updates.
  • Power cord attaches to laptop magnetically. No getting loose over time.

Thursday, January 21, 2016

Gig History

My experience playing on stage:

Solo:

Feb 2015: Joined a band on stage (bar is Desire) for two songs on Penang Island, in Malaysia.


Creep
Some Chinese song


AmpWagon (I joined the band 12-Jun-2015):



1. 29-Aug-2015: Nate and Wally's Fishbowl
2. 11-Sep-2015: Nate and Wally's Fishbowl
3. 17-Oct-2015: BGSU Tailgate
4. 24-Oct-2015: Halloween Party
5. 7-Nov-2015: The Alehouse
6. 21-Nov-2015: Nate and Wally's Fishbowl
7. 11-Dec-2015: Nate and Wally's Fishbowl
8. 22-Jan-2016: Howard's Club H
9. 17-Mar-2016: Howard's Club H


Groove Cricket (I started the band. First practice was Oct 2016.)



1. 17-Dec-2016: Christmas Party at Dave Riffer's (guitarist) house
2. 13-Apr-2017: Howard's Club H (open mic night)
3. Dec 2017: Christmas Party at Dave Riffer's house

First Set List:


Thursday, January 14, 2016

Web Security Implementation

I needed to pick an approach to security for my new web front end for my open source project Presto. My first step was to ask for overall direction from some industry experts. So, special thanks to Jim Manico (@manicode, site) for helping me. While this approach is still evolving as I work through it, I wanted to summarize the security implementation here.

Overview

Instead of defining roles and allowing things based on those roles, define permissions (functionality seems to be a more intuitive word here) and allow things based on those permissions. For example, if I define an admin role, some company may want some admins to do some things and other admins to do different things, so don't lump them all together. Instead, create a list of specific functionality (print this, save that, etc.) and assign each user(?) to each functionality. Then there is a lot more flexibility.

With this approach, we won't have to change source code in the future. For example, if we wanted to add a new AD group, and we specified AD groups/users in code, we'd have to change code. With this approach, each piece of functionality gets its own unique name. Then each is mapped to AD groups in some central store.

Note: We ended up abandoning this approach for one main reason: our security line of trust is at the logic layer in our business logic classes. If we secure at the Web API, then we have to secure correctly at every Web API we implement. It's better to have security in one spot, which, in our case, is at each method in our logic layer.


Implementation

Web API


Web.config (the key is the functionality, the value is the AD group):
<add key="DeleteUser" value="Some AD Group"/>

(Note: The web.config is used here just as a demo to get this working. Perhaps this info should be in the DB.)

FunctionalityAttribute:
public class FunctionalityAttribute : AuthorizeAttribute
    {
        public string FunctionalityName { getset; }
 
        protected override bool IsAuthorized(HttpActionContext actionContext)
        {
            string adGroup = WebConfigurationManager.AppSettings[FunctionalityName];
 
            if (actionContext.RequestContext.Principal.IsInRole(adGroup)) { return true; }
 
            return false;
        }
 
        protected override void HandleUnauthorizedRequest(HttpActionContext actionContext)
        {
            // Authenticated, but not authorized.
            if (actionContext.RequestContext.Principal.Identity.IsAuthenticated)
            {
                // Use Forbidden because Unauthorized causes a login prompt to display.
                actionContext.Response = new HttpResponseMessage(HttpStatusCode.Forbidden);
            }
        }
    }

API Controller:
[Functionality(FunctionalityName = "DeleteUser")]
public class AppsController : ApiController

(Note: The attributes will actually go on the methods, not the class. This example is just to test at the moment.)




Dealing with success and failure in the AngularJS repository call

$http.get('/PrestoWeb/api/apps/')
    .then(function (result) {
        data = result.data;
        $rootScope.setUserMessage("Application list refreshed");
        callbackFunction(data);
    }, function (response) {
        console.log(response);
        if (response.status == 403) {
            $rootScope.setUserMessage("Unauthorized");
            callbackFunction(null);
        }
    });




JavaScript

if (user.canAccess("DeleteUser")) {
    // Set AngularJS scope variable that shows that the delete button should be enabled
}




WCF Service

What's to stop someone from changing the JavaScript and getting the DELETE button enabled? Nothing, that's why you don't trust the browser. Whatever security we implement on the web page must also be implemented at the service or logic layer. In my case, that would be the WCF service. So while the user can enable the DELETE button by hacking the JS, he won't actually be able to delete because the security at the service (or logic) layer will prevent that.

ToDo: Show WCF security implementation here after I do it.

Resources

Cross Site Scripting Prevention Cheat Sheet
Java Authorization Guide


Some Notes

As a product, you need to support many different kinds of authentication.
As a service, you need to support SAML and similar for federation - especially for big customers.

Friday, November 20, 2015

iTunes and Windows 10 - Update Issue

After installing Windows 10, I let iTunes update itself and then it wouldn't run. So I tried reinstalling it, only to get this error:



After trying quite a few things, I was finally able to get it to install by doing a repair on the Apple Software Update application.

Hope that works for you.

Friday, April 24, 2015

Why Does Programming Take So Long?

I could write 500 pages on this topic. Instead of coming up with analogies and serious reasons why the software development industry has problems justifying things taking "too long," I thought I'd start a list of annoying reasons that cause delays. These are issues that are almost impossible to relate to management because each incident is fairly insignificant, but the sheer volume of occurrences is staggering. It's impossible to remember them all, so here is a list of irritating things that constantly degrade the quality of life of a software developer. I'll record these when they happen, if I can remember to do so.

Bad Characters
We needed to start a SQL job on our QA DB. We've run this job before. Well, we just replaced our old QA server with a new one. A stored procedure and table were missing on the new server. I had to find a developer who had the source code. He emailed me the source code. When I executed the TSQL to create the table and sproc, I got many "incorrect syntax" errors. That's because there were bad, invisible characters in the TSQL. Since it was impossible to tell where these characters were in the file, I had to delete every whitespace character and add a new one throughout the files. What should have taken two minutes, to start the process, took 30 minutes just to get back to the state of having the process in the first place.

Padding
A record wasn't coming back in a database query. The record was there; we could see it. Could not figure out why it wasn't included in the query. Turns out someone padded the value with spaces to make it 10 characters.

Breakpoint
A team is building some SSIS and we are testing and promoting. Guy checked it in with a breakpoint in the SSIS that wasn’t visible in my VS. I spent an hour checking connections, DTC setup, until I finally noticed “breakpoint hit on task X” in the output window.

Icon Width in VS
I needed to look through my recent changesets, so I found the list by my user ID within Visual Studio. Each time I clicked on a changeset to view its details, the icons next to each file in the changeset got bigger and bigger. Near the end, only three or four rows would fit on the window. Finally, VS threw an exception that the width was too big. After trying a few things, I restarted VS and it was working again.





More to come as they happen...

Thursday, August 21, 2014

Top 10 Ways to Annoy a Software Developer

10. Talk disparagingly about Scott Hanselman, Jon Skeet, Martin Fowler, or other luminaries of the software development pantheon.

9. Require the code to change as the requirements change, but allow the project documentation to get out of sync.  Attempt to use a series of email chains as a floating addendum to the specification.

8. Tell developers how to implement a solution to a problem instead of just laying out the details of the problem.

7. Assert that “done is better than perfect” but ignore the option of having it done right.

6. Say you’re “too busy” to do any QA.

5.  Imply that a developer is being difficult when he highlights potential difficulties instead of welcoming the opportunity to evaluate assumptions and get out in front of project risks.

4.  Trivialize the development effort for any feature that you are not directly responsible for designing or building.  Doubly annoying when adding new requirements while the project is already in QA.

3.  Put a 2 paragraph project overview in a Word document and call it a func spec.

2.  Set an arbitrary project deadline prior to finalizing the project scope and doing technical analysis.

1.  Send out a congratulatory email after a successful go-live and say “Great work <insert analyst name here> and team!”

Sunday, June 1, 2014

WCF or ASP.NET Web API

There are a lot of resources out there that explain the pros and cons of using one over the other. But what about what they actually are? I mean, at the most fundamental level? I researched a bit. This SO answer helped.

WCF and Web API
They are both hosted on a server, and both accept socket requests. The point is to accept messages and do something and possibly return something.

WCF
WCF replaced web services. It can be made to be restful, and it can be made to use SOAP. Hmmm, doesn't restful imply using HTTP GET and/or POST? And if it's restful, then our message protocol can be XML, JSON, plain text, etc. The point is that we're not tied to SOAP here. With SOAP, we're not tied to HTTP, so we can use protocols like TCP.

Web API
Web API uses HTTP. Period. So, what's the point, if WCF can be made to work this way as well? Perhaps it's because WCF needs to be made to fit the HTTP paradigm, and it's not natural, making it a bit of a pain to make it fit?

I've started by reading two good articles, here and here. The first thing I'd like to do is parse this excerpt from that first link:

There is also a need to also support non-SOAP services, especially over HTTP, where you can harness the power of the HTTP protocol to create HTTP services: services that are activated by simple GET requests, or by passing plain XML over POST, and respond with non-SOAP content such as plain XML, a JSON string, or any other content that can be used by the consumer.

First, about non-SOAP services. I understand JSON being non-SOAP, but why is XML non-SOAP? Isn't SOAP really just XML? Perhaps SOAP is XML, but it's XML wrapped in a SOAP envelope, header and body. So, that's the difference? SOAP isn't only XML, it's XML inside SOAP.

What is the power of the HTTP protocol? Is is that we can use simple GET and POST requests, or is there more than that?

Understanding the Conclusions From the article mentioned above:

If your intention is to create services that support special scenarios – one way messaging, message queues, duplex communication etc, then you’re better of picking WCF.

Why? Because HTTP GET and POST simply don't work that way?

If you want to create services that can use fast transport channels when available, such as TCP, Named Pipes, or maybe even UDP (in WCF 4.5), and you also want to support HTTP when all other transports are unavailable, then you’re better off with WCF and using both SOAP-based bindings and the WebHttp binding.

It's not even an issue of being better off, right? I mean, if Web API is only HTTP, then we simply CANNOT use it for anything other than HTTP.

If you want to create resource-oriented services over HTTP that can use the full features of HTTP – define cache control for browsers, versioning and concurrency using ETags, pass various content types such as images, documents, HTML pages etc., use URI templates to include Task URIs in your responses, then the new Web APIs are the best choice for you.

Makes sense.