I attended a SQLSaturday for the first time today. It was OK. Honestly, there was a lead-in training that my work sent me to yesterday at the Microsoft Center which was considerably better. The best session I saw today was on PowerShell. It was outstanding, but the other talks were so-so. Anyways, I'll try to blog of the Friday training, the awesome PowerShell talk, and the so-so talks. It will take me while to type up all of my notes so please be patient. It's coming.
Saturday, January 31, 2015
OmniFocus
A coworker mentioned yesterday that he uses OmniFocus as a Getting Things Done application and that he likes it. It uses geofencing to know if you're at work or at home and to ping you appropriately with notes you've made away from work or away from home when your location changes.
Thursday, January 29, 2015
It turns out that any application that is PCI compliant must have a maximum session life of no more than 15 minutes of inactivity.
Andy Warhol's old standard may rear its head at Web.config like so:
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false" timeout="15" />
This touches on the four modes. The InProc option is going to drop sessions whenever the appPool refreshes.
Register DevExpress in web forms after the life of the trial is gone.
View an ASP.NET web form, web user control, etc. which contains DevExpress stuff in Design mode. You will see a modal with a button on it for registering the product. See also: this
doing old school JavaScriptless validation in a DevExpress grid wherein a little red octagon with an exclamation mark inside of it appears by a form field where validation fails
protected void MyGrid_RowValidating(object sender, ASPxDataValidationEventArgs e)
{
if ((e.NewValues[2] as string).Trim().Length < 42)
{
e.Errors[MyGrid.Columns[2]] = "Too short!";
}
}
"Too short!" will end up in a tooltip one sees upon mousing over the red octagon. Associate this event with your DevExpress grid like so:
MyGrid.RowValidating += MyGrid_RowValidating;
Make a control to change the amount of pagination in a DevExpress grid to one of a view canned settings.
Per this:
</Columns>
<SettingsPager Position="TopAndBottom">
<PageSizeItemSettings Items="5, 10, 20, 50, 100" />
</SettingsPager>
</dx:ASPxGridView>
Wednesday, January 28, 2015
open two completely different instances of Microsoft Excel in Windows 7 so that you may keep one on one monitor and one on the other
- open Excel
- right-click on the Excel icon at the start bar
- click on the line item for Excel in the menu that appears
angle brackets
...this means using surrounding text with a leading less than sign and a trailing greater than sign. It's the convention for HTML and XML tags.
Make edits happen within a selected row at a DevExpress ASPxGridView.
MyGrid.SettingsEditing.Mode = GridViewEditingMode.Inline;
Please remember that this will allow one to fall back out of editing a row:
UserManagementGrid.CancelEdit();
Tuesday, January 27, 2015
constraint on text values in MSSQL
One may force the strings in a varchar column to be unqiue. This might be handy if the column contains the usernames for user accounts which should never to duplicates, etc. For an example of the SQL, this offers this:
ALTER TABLE MyTable WITH CHECK
ADD CONSTRAINT UQ_MyTable_Email UNIQUE (EmailAddress)
for a column value in a DevExpress grid, show the name of a child
If you have a dx:ASPxGridView showing off a list of Foo and each Foo has a child Bar kept in a property called "TheBar" on Foo and TheBar has a string property called BarName...
<dx:GridViewDataComboBoxColumn FieldName="TheBar.BarName" VisibleIndex="13">
<PropertiesComboBox ValueField="BarId" TextField="BarName"
ValueType="System.String" DropDownStyle="DropDown" />
</dx:GridViewDataComboBoxColumn>
Monday, January 26, 2015
.Replace("\\\\", "!").Replace("\\", "").Replace("!", "\\\\");
...is my hacky C# magic for trimming the escapes out of a string while leaving the backslashes in file path names.
setting property variables in log4net implementations
In the XML for configuration they look like this:
<conversionPattern value=\"%date %property{Whatever} %message %newline\" />
Per this you may set values in C# like so:
log4net.ThreadContext.Properties["Whatever"] = "foo";
the burndown chart is burned down based on hours assigned to tasks
...not points assigned to stories
Sunday, January 25, 2015
Individual User Accounts
More from Scott K. Allen's pluralsight.com trainings: When starting a new ASP.NET Project in Visual Studio 2013 and picking "MVC" the "Change Authentication" button one may change the default away from "Individual User Accounts" to something else. The options are: No Authentication, Individual User Accounts, Organizational Accounts, and Windows Authentication. The first just lets everyone see every "page" as if for a vanity web site perhaps while the second is going to store user accounts in database tables not unlike the tables that worked with the goofy web forms login controls which were shoved down your throat with Visual Studio 2005. Twitter accounts and the like (Facebook, etc.) may also be used in this option. (Organizational Accounts is for Azure while Windows Authentication is of Active Directory.) It looks like the Individual User Accounts controls will just be set up when one spins up a new project. The _LoginPartial partial shows if you are logged in or baits you to log in based upon Request.IsAuthenticated. User.Identity.GetUserName() retrieves the username. A "ContentResult" as a return type is basically a string which may be returned from an MVC action. It can bubble up into a browser. Using the [Authorize] attribute on an MVC action (or Controller) will shut out anonymous users and just reroute them to the login view when then try to access something they should not. [AllowAnonymous] on an action will open up an action within a Controller decorated by [Authorize] to "the dumb public" so to speak. [Authorize(Users="tjaeschke")] and [Authorize(Roles="whatever, freaks")] are examples of restraining who may login. If you do the "Show All Files" trick in Solution Explorer you should be able to find an .mdf in "App_Data"which is where user accounts are being written to by default. Double-click it to see the tables in the "Server Explorer." A _MigrationHistory table is a giveaway that the process is using the Entity Framework. The DefaultConnection string in connectionStrings in the Web.config tells you where the database is found. Cookies are used in the login means. There may be some cookie caching nastiness when one is swapping databases. When you point the connectionString to a new database, Mr. Allen's training implies that the user tables will just be built out for you. Perhaps this is the Entity Framework code first stuff in action. The NuGet package Microsoft.AspNet.Identity.Core is installed by default with the Individual User Accounts thing and manages this stuff. User IUserStore to create, edit, and delete users. IUserPasswordStore inheirts/implements/subclasses IUserStore and lets you also set passwords and such. But, don't use IUserStore or IUserPasswordStore directly. Use the IDisposable type of "UserManager" as an API to interface with these interfaces. Or at least, Mr. Allen recommends that you don't use IUserStore or IUserPasswordStore directly. UserStore (which I suppose subclasses IUserStore in the default way-to-go) is of EntityFramework and need you to give it a DbContext.
Friday, January 23, 2015
rebuild lite for DNN
A coworker shared this blob of XML for DotNetNuke configuration today:
<compilation debug="true" strict="false" batch="false" optimizeCompilations="true">
<buildProviders>
<remove extension=".resx" />
<remove extension=".resources" />
</buildProviders>
batch="false" optimizeCompilations="true" in particular will allow one to only rebuild that which needs rebuilding instead of EVERYTHING. As you might imagine this speeds up the build time.
Thursday, January 22, 2015
notes from a Cigital architecture risk analysis (ARA) training
- CIA (confidentiality, integrity, availability) is very high level and Viega and McGraw has a more granular list of specific goals/concerns.
- Time to check to time to us (TOCTOU) is an example of a race condition.
- "Struts" is a framework for Java and not a word that has meaning in a greater computer science way as I suspected it might.
- validateRequest is a .NET Framework sanity-checker of sorts for input values.
- Tightly coupled code and data together in a single package wherein data may be interpreted as code opens the door to injection attacks. This is (John) Von Neumann's curse.
- Defense in depth conceptually means that you do not rely on any one single means to provide security for a point of vulnerability.
- There is a distinction between symmetric and asymmetric encryption. In asymmetric encryption one shares a public key for encrypting and keeps a private key for decrypting allowing others to send one messages that only that party may read. In contrast, everyone just reads and writes with the same key in the symmetric approach.
- Hash functions must have 1. efficiency, 2. pre-imaging (you cannot just reverse the hash function to unhash something) and 3. collision resistance.
- SHA1 and MD5 are popular hash functions.
- Message authentication codes (MAC) are cryptographic primitives which, through the use of a shared key, will allow one to tell if a party was the author of the hash. A CBC (Cipher Block Chaining) MAC is based on a block cipher like AES (Advanced Encryption Standard). The value of the last cipher text block is the MAC because it depends on the values of all of the blocks which precede it. HMAC (hash-based message authentication code) is a CBC alternative.
- XACML (Extensible Access Control Markup Language) is a standard for exchanging authentication and access controls information.
Oracle EBS actually has web services allowing it be a lot easier to crosstalk with than SAP where one must interact with RFC endpoints.
iPayments used to be the stuff to speak to for payment-related data. Now it's called just Payments.
Wednesday, January 21, 2015
Copying file wse3policyCache.config to obj\Release\PackageTmp\wse3policyCache.config failed. Could not find file 'wse3policyCache.config'.
This error is telling you that you need the wse3policyCache.config in the root of your UI project to publish the Microsoft.Web.Services3.dll library when publishing your ASP.NET solution in general. Duh.
better membership provider
My boss provided this link on a better membership provider for ASP.NET today: http://weblogs.asp.net/jongalloway/simplemembership-membership-providers-universal-providers-and-the-new-asp-net-4-5-web-forms-and-asp-net-mvc-4-templates
Tuesday, January 20, 2015
When doing a "Save As" in Fireworks there is an option for a flattened .png which will drop all of the layers and vector formatting stuff.
The flattened files will be much smaller in KB size.
It does not look like you specify in-house package sources for NuGet in an .sln, .csproj, or packages.nuget file.
Your build script has to go get it.
You don't just need to install the DevExpress installer in your development environment.
As, best as I can tell you will need to install it on the web server where you aim to host the application you are building too. At a minimum this will give the server the .dlls you need. I suppose it is likely possible to hack around this by just copying them there. I don't know what else the installer may provide for an environment prep.
Monday, January 19, 2015
grant the permission to execute (use) a sproc to a particular role
IF OBJECT_ID(N'dbo.UpdateElephants') IS NULL
BEGIN
EXECUTE('CREATE PROCEDURE [dbo].[UpdateElephants] AS RETURN 0')
GRANT EXECUTE ON [dbo].UpdateElephants TO [Tusker]
END
GO
more notes from the 1/12/2015 talk
- foo = N'foo' is an example of a Unicode string and I get the impression that these are more in tune with being used with nvarchar columns than regular strings (foo = 'foo') which fit well with varchar types. The speaker said not use nvarchar columns if you can help it. He also warned of the performance hit of implicit castings, not just from strings to numeric types but also from varchar into nvarchar!
- CHECKPOINT;
DBCC DROPCLEANBUFFERS;
DBCC FREEPROCCACHE;
...in advance of a query will drop any sort of caching of the query. The caching of a query may give you warped performance metrics when you attempt to use extended events to analyze how long things took. The caching will speed things up which is normally a good thing. - COALESCE does scanning while ISNULL does seeking. http://msdn.microsoft.com/en-us/library/ms190349.aspx suggests COALESCE will find data in the first not null column in a select like so:
SELECT Name, Class, Color, ProductNumber,
COALESCE(Class, Color, ProductNumber) AS FirstNotNull
FROM Production.Product; - rowbar means row-by-row processing.
- RECOMPILE as a keyword may be thrown into the SQL of sprocs to help optimize their execution plans. I don't get it yet. http://msdn.microsoft.com/en-us/library/ms190439.aspx has more.
The talk all this was from is detailed here.
Addendum 2/8/2015: I think "rowbar" is better spelled: rbar
Friday, January 16, 2015
Extended Events
Something more from this talk, was Extended Events found under Management in SSMS. It was suggested that instead of using the profiler or the tuner that Extended Events and Executions Plans were now the way to go. I tried to set one up by right-clicking on "Sessions" under Extended Events and picking "New Session..."
I then picked "Query Detail Sampling" as a template per this, but I really didn't get much farther in this process.
I get the impression that I should next be able to run a SQL query and see some reporting in the Extended Event as an effect. (By the way, once you have an event under "Sessions" you will need to right-click upon it to make it started instead of stopped.) Alas, I really didn't have any luck getting it to work today, not before I reached a point at which I told myself I was spending too much time on it.
more on upsert (maybe insert or maybe update) logic in T-SQL
Let me start by saying that I'm just learning that T-SQL is the SSMS Microsoft SQL. I've just been calling it MSSQL but I guess that's wrong. I guess T-SQL is "Transact-SQL" and thus it has the T. While I'm also babbling let me say that GETDATE() is the DateTime.Now of T-SQL. Alright, now that I have those things out of my need to document, I'd like to mention that I tried to write a merge yesterday as suggested here and it ended up looking like this:
DECLARE @upsert TABLE
(
FriendlyName nvarchar(50),
Markup nvarchar(max),
ImmediateMomentInTime datetime
)
INSERT INTO @upsert(FriendlyName, Markup, ImmediateMomentInTime) VALUES ('Log4NetConfig',
'<log4net><appender name=\"RollingFileAppender\" type=\"log4net.Appender.RollingFileAppender\"><file...'
, GETDATE())
MERGE INTO Properties USING @upsert ON Property_Name = FriendlyName
WHEN MATCHED THEN
UPDATE SET Property_Value = Markup, Mod_Date = ImmediateMomentInTime
WHEN NOT MATCHED THEN
INSERT (Property_Name, Property_Value, Mod_Date) VALUES (FriendlyName, Markup, ImmediateMomentInTime);
When I tried to actually run the SQL I got this error:
Incorrect syntax near 'MERGE'. You may need to set the compatibility level of the current database to a higher value to enable this feature. See help for the SET COMPATIBILITY_LEVEL option of ALTER DATABASE.
When I asked my boss if it was alright to open up permissions he pointed out to me that there was already a stored procedure that more or less did what I was attempting. It didn't use merge as it turned out. Instead it either ran an update or an insert based upon if/else logic defined like this:
IF EXISTS (SELECT 1 FROM dbo.Properties WHERE Property_Name = 'Log4NetConfig')
Thursday, January 15, 2015
scans and seeks
Something else I learned about in this talk was execution plans. You may see the execution plan for a swath of SQL by clicking the "Include Actual Execution Plan" icon in SSMS like so:
The icon three to the left is the "Display Estimated Execution Plan" icon and I think it is supposed to have a different effect, but I kept just falling over to the actual execution plan when I attempted to use it. I'm not yet sure why. Clicking on some of the items in the execution plan should give you details for them like so:
This brings us the difference between scans and seeks. I scan touches every row in a table in the name of finding something. A seek will touch only the applicable rows.
An example of executing a sproc in MSSQL while passing in parameters.
EXECUTE My_Sproc @PriceOfTeaInChina = 13.42, @Flavor = 'Mint'
The parameters here are not OUT or INOUT parameters. They are IN parameters.
Wednesday, January 14, 2015
MSSQL table variables don't show statistics for their performance hits in Extended Events in SSMS while temp tables do and tend run faster.
The only reason to use a table variable instead of a temp table is if the dataset inside is small. Only then might a table variable shine and perform better than a temp table. This example...
DECLARE @Whatever TABLE
(
WhateverID int PRIMARY KEY CLUSTERED,
Green money
)
INSERT INTO @Whatever (WhateverID, Green) VALUES (1, 13.42)
INSERT INTO @Whatever (WhateverID, Green) VALUES (2, 42.13)
SELECT * FROM @Whatever
...returns the same results as this:
DECLARE @Whatever TABLE
(
WhateverID int NOT NULL identity(1,1),
Green money
)
INSERT INTO @Whatever (Green) VALUES (13.42)
INSERT INTO @Whatever (Green) VALUES (42.13)
SELECT * FROM @Whatever
However, you can probably see that they are not the same, huh? This content is a snippet from a piece of greater talk on improving SQL performance by John Sterrett of Linchpin People Monday night at the Austin .Net User Group. The talk included a lot of content, but I suspect I will (probably) present the whole of the talk in a series of chunks across many blog postings.
when StructureMap does not use Singleton() and a getsetter is used to get instances of an interface...
This getsetter would be refactored to be like so:
public ILogger Logger
{
get
{
return ObjectFactory.GetInstance<ILogger>();
}
}
interface inheritance, and especially so in regard to IDisposable
This turns out to be some stupidity on my part. The way out of the problem is to just make an interface inherit from IDisposable, and, yes, you may do that. This suggests that while classes implement interfaces, interfaces do not implement other interfaces they inherit other interfaces, but I wonder if that is true given that an interface may "inherit" more than one interface. Interfaces may not inherit from classes.
Don't make IDisposable types singletons.
ObjectFactory.Initialize(maps =>
{
maps.For<IFoo>().Use<Foo>();
});
...is going to be superior to...
ObjectFactory.Initialize(maps =>
{
maps.For<IFoo>().Singleton().Use<Foo>();
});
Duh! This goes with this which will make it make some more sense.
add a column to a table in SQL
ALTER TABLE person
ADD AddressId int
...the following will turn around and throw the new column away again:
ALTER TABLE person
DROP COLUMN AddressId
Tuesday, January 13, 2015
Let's get nasty!
public void SaveGroceryList(List<string> list, SqlServer sqlServer)
{
using (sqlServer)
{
sqlServer.DoWhatever(list);
}
}
If SqlServer is a type that inherits from IDisposable and you put it behind a second interface in the name of inversion of control, preexisting using statements around SqlServer, such as the one above, will need to be rewritten like so:
public void SaveGroceryList(List<string> list, ISqlServer sqlServer)
{
try
{
sqlServer.DoWhatever(list);
}
catch(Exception exception)
{
throw;
}
finally
{
sqlServer.Dispose();
}
}
This may mean there is no reason anymore to inherit from IDisposable at all. It really depends on whether or not anything in SqlServer's own project make a using statement with SqlServer. Implementations of such a shape likely will NOT need to be abstracted behind an interface.
Addendum 1/14/2015: It turns out that this blog posting is nasty with stupidity. One may just make an interface inheirt from IDisposable to get around this whole problem. Please see: this
Monday, January 12, 2015
There are no constructors for C# interfaces!
See this for more and note that if you need a constructor to fire off in a StructureMap wireup you may still have it happen. StructureMap will run the constructor of the longest signature by default. For more see:
C# classes may only inherit from one class but they may implement numerous interfaces!
This will allow, for example, one to implement both IDisposable and also IWhatever (for dependency injection) for Whatever.
Version 8 of DotNetNuke is to have full MVC support.
We (humanity) are on version 7.4 now and version 7.5 will be a major release with MVC modules being brought into play.
Bonus: The ?. operator in C# 6.0 will make it that much easier to break the Law of Demeter!
var parakeet = me?.CollegeRoomate?.ExWife?.HouseCat?.StomachContents;
if (parakeet != null) {
parakeet.Resuscitate();
}
Per this, thanks to the "safe navigation operator" usage herein, we no longer need to worry if any of the steps along the way resolve to null as they will just make our variable null instead of throwing a complier error. Now I may easily reach into the stomach of the cat of the ex-wife of my college roommate as though I deserve to have my hands in there!
the way to get rid of ObjectFactory in StructureMap implementations
...seems to be tied to the new magic of having StructureMap hydrate interfaces that are called out at MVC controller constructors. So, what does one do in the web forms world? As best as I can tell that space has just been left to be. I have tried to minimize the use of ObjectFactory by having a static (factory) class with static methods keeping all of the callouts to ObjectFactory in a web forms app. I called my class ExternalDependencies, it lived in the UI project, and one just went to ExternalDependencies to get interfaces for, um, external dependencies. My superior suggested that instead it would be better to introduce a middleman between each web form code behind and System.Web.UI.Page like so:
using Whatever.Logging;
using StructureMap;
namespace Stuff.UserInterface
{
public class BasePage : System.Web.UI.Page
{
private ILogger _logger;
public ILogger Logger
{
get
{
if (_logger == null)
{
_logger = ObjectFactory.GetInstance<ILogger>();
}
return _logger;
}
}
}
}
The way this works is the code behind inherits from BasePage and then uses Logger whenever it needs whatever it is the Logger decouples from the code behind. When I changed the inheritance at the .cs files, I feared that the .designer.cs dance partners would also need updating too, but, as it turns out, in a partial class paradigm only one of the partial classes in a set or group needs to denote inheritance. Note: The code behind for a master page inheirts from System.Web.UI.MasterPage instead of System.Web.UI.Page. This modestly complicates this idea of using a middleman to keep token references to ObjectFactory, especially so if you don't want to break the DRY (don't repeat yourself) rule by making a middleman between the master page and System.Web.UI.MasterPage. Hmmmm. What do to?
Sunday, January 11, 2015
two things related to music, tech, and my sister
One: I saw my mother and sister today. We played cards at my sister's apartment. I had given my sister a copy of Pitch Black Prism for Christmas and she played it on her Xbox. It turns out that when you play a CD on an Xbox you get visuals comparably to those goofy visuals one sees when using the Windows Media Player. My sister projects the display from her Xbox onto a wall in her place. It is shown here. These are the CD's effects.
Two: My sister has claimed an abandoned acoustical guitar that was left by the dumpster at her apartment complex and I Googled for an application to help her tune it. We found Guitar Tuna and she liked it. You play a string, it will listen, and it will tell you if you need to tighten or loosen a knob at the guitar's end or head or whatever the proper term is. I guess this shows off how little I know about guitars. She said she had tried Guitar Tuner, a different iPhone app, previously to no avail. Guitar Tuna, the better app, is shown here.
How does Anonymous keep outsiders from pretending to be a part of Anonymous?
If I were to just pretend to be a part of Anonymous and start espousing random political opinions as if they belonged to Anonymous what consequences would befall me?
You're doing Agile wrong if you don't have clients at your demos and, also, prototyping is very beneficial.
These were the two central themes of a roundtable discussion at the reboot of the Agile Austin UX SIG (special interest group) on Friday. The event was held at BancVue and a Charlotte Wise of BancVue mentioned that the original SIG was spearheaded by a Thomas Tucker and held at Mister Tramps. It seems Mr. Tucker has moved to Houston and his child has been hibernating for over a year, but, now, it's back! This was the first of what are to be ongoing monthly meetings on UX. The coordinators are a Nathan Bussiere of Bancvue (pictured at the left) and an Alex Soufi of Hitachi Consulting (pictured at the right). The three individuals I've mentioned and myself comprised half of a group of eight attendees. The other four were Melissa Brown, a recent University of Texas graduate with a background in UX, Brad Friemel of Volusion, Jeff Neria of Famigo, Inc., and an eighth person whose name I failed to record in my notes. Noteworthy things discussed:
- Many desire an MVP (minimum viable product) but the nebulous definition of MVP often does not include user experience. It was argued that "shallow does not equal shitty" and that a product is not viable without the UX experience.
- UX should fall into the Agile cycle. It's about collaboration and working together in a functional group. In waterfall approaches you are making the best decisions possible upfront with the least amount of information leading to a big GANTT (Henry Gantt's timeline/gameplan flow) chart. In Agile, in contrast, instead of trying to start out with "boiling the ocean" one incrementally creates a product. Alex offered: "UX is about building the right thing and Agile is building things right."
- Constant customer feedback is desirable. How do most businesses get feedback? Do the marketing people just speak of how customers have been complaining? Instead, invite customers to sprint reviews. Ask "Does this make sense to you?" and "Would you want this?" etc. Often the inclusion of having customers present in the process is never built in upfront, and the only feedback a team gets from its clientele is in the form of a bug report. You're not really doing Agile if you're just using Rally and running sprints.
- Where does a UX backlog come from when there is only one person on a team doing UX or worse one person doing UX across several teams. Charlotte told a story of a circumstance in which she was the only UX player across several teams and she found an individual in each team who was the most UX-friendly and recruited a person from each team to form the UX Mafia at BancVue and together they met and developed their own backlog and set aside two to four hours each a week to work against the UX Mafia backlog.
- The gentleman sitting at my right whose name I did not record said that user stories are not: "As a designer, I will create a design for the project." An attitude of "I've got to get this done so it's just a backlog thing" was lacking in his opinion. He said the Agile process makes each step smaller and cheaper and he takes the time to spell out interface requirements in stories. Charlotte will denote fonts and font sizes as they should be in CSS to alleviate ambiguity.
- Jeff wondered if the learning should be happening as the product is being built or if it is better to build prototypes in advance of the product. Jeff has tried to learn upfront with prototypes and mockups.
- Alex told a story of a circumstance in which his team replaced a failing consulting team (which had delivered nothing) at a point at which only a third of the allocated budget was yet remaining. In the pinch, Alex's team decided to only strive to build a prototype. Low fidelity wireframes were provided (quickly) in lieu of more costly high fidelity mockups and the client liked seeing the prototype first. The prototype was something that could furthermore be used (built on top of) in the actual development.
- Axure and InVision were prototyping tools mentioned by the guy on my right (who later also namedropped Basecamp for project management, saying that he had tried it and Trello and Jira and Rally and Google Documents and that nothing was the be-all tool). With Axure one may change the fidelity of wireframes quickly. You can get Axure wireframes in front of people quickly and see how they use it and see if something works. InVision is for mock up comps for flow. Axure is better for more dynamic actions.
- Alex mentioned that his project got bogged down when stakeholders saw things a couple of pixels off and hence it became best to switch to low fidelity wireframe mockups. The guy at my right spoke to how he dealt with the same challenge. He suggested that often clients will want to see the jazzy eye candy upfront and thus he would start out ironing out just a precious few flashy full detailed designs allowing the clients to relax about the look and feel upfront. He suggested that the clientele he interacts with seem to need this in the beginning and once they breathe a sigh of relief the development can fall over to being done speedier with low fidelity wireframes.
- Alex mentioned that when he presented to seventy people that he witnessed a bunch of corporate politics and cutthroat infighting. If the revenue for a department affects a division head's bonus, the division head may ask for a link to his department at the home page of the thing being developed. Alex eventually set a rule in which one had to show up to a demo and provide feedback for the demo within 24 hours or else one lost one's opportunity to provide feedback.
- It might be smart to work on numerous related projects in parallel instead of doing them sequentially.
- Sometimes when one starts to design one may just stare at one's monitor for an hour or three hours and not know where to start. That's normal.
- Don't let prototyping take disproportionate time. You'll know when things are going wrong and it's taking too long. It is supposed to be quick. Keep prototyping a part of the Agile cycle.
- Axure makes HTML functionality that one may click about in. When attempting to emulate a native mobile application in an Axure design there is going to be noticeable kluginess.
- Prototyping should uncover challenges ahead of time. An example: How will the ability to tweak options for products fit into a shopping cart?
- There really should be a sprint zero in an Agile process and during this time a product owner should be busy doing user research. Unfortunately sprint zero tends to just be a time when the LAN and local environment is set up or when, more unfortunately, the designer is put in the tough situation of crafting the whole of the design for all sprints to come!
Saturday, January 10, 2015
StructureMap struggles with log4net?
StructureMap Exception Code: 202
No Default Instance defined for PluginFamily log4net.ILog, log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a
This error appears when a dependency which uses log4net rears its head the wrong way in the .Initialize wire up. Here is how the something is wired up to work properly instead. I'm using StructureMap 3.1.0.133 and StructureMap.Net4 3.1.0.133 is also in the mix, but I don't see it in the using declarations at the top of Global.asax so perhaps it is not used.
ObjectFactory.Initialize(maps =>
{
maps.For<IFoo>().Singleton().Use<Foo>();
maps.For<IBar>().Singleton().Use<Bar>();
maps.For<ISomething>().AlwaysUnique().Use(s => new
Something(LogManager.GetLogger(s.ParentType ?? s.RootType)));
});
Huh? Cassini can write logs with log3net but IIS Express can't?
Well, in my case it turned out that IIS Express didn't have permission to write logs to the folder in question. This let me know what I was doing wrong.
An OU is an organizational unit in active directory routes.
CN stands for common name and DC stands for domain component.
The name 'Whatever' does not exist in the current context.
I got this error in trying to reference a class out of the App_Code folder. I solved the problem by just putting the class elsewhere so I don't really know how to solve this problem. This suggest that such: "can occur when namespaces, classes and variables become tangled when they have the same name"
Do not manually install a reference installed by NuGet.
At: TOOLS > NuGet Package Manager > Manage NuGet Packages for Solution... ...I found a package I needed to install already marked as installed because I had previously installed it in every project before I made the mistake of manually removing its reference from one of the projects. Running an uninstall-package command at the console for the specific project and then reinstalling it from the command line was the only way to wiggle away from this mess.
a divide between the UI and everything else
I've worked two places so far where there has been a predisposition to, instead of setting up onion architecture for new projects, keep core logic and infrastructure mechanics in the same Visual Studio project. In effect the solutions have "two layers" wherein one is the User Interface and the other is this other animal which the UI inherits. We call it the "Data Access Layer" where I work currently. Core logic and infrastructure mechanics are still split apart by the usual interfaces and StructureMap approach. My current job is, again, one of two where I've seen this and, moreover, when I was at a third place of employment, I witnessed a lively debate between two coworkers over whether or not this was the way to go or if, instead, the onion architecture was unquestionably sound. The antagonist for the onion architecture suggested that the deployable code beyond the UI should really be something that one might bundle into one .dll in the name of clean packaging. Interesting stuff.
Thursday, January 8, 2015
Make StructureMap use a config file!
Per this, have something like this in Global.asax.cs:
protected void Application_Start(object sender, EventArgs e)
{
ObjectFactory.Initialize(maps => { maps.UseDefaultStructureMapConfigFile = true; });
}
This has more details on the config files. An ASP.NET application's config file will be called StructureMap.config.
Wednesday, January 7, 2015
distinctions between running an IIS web site as Mr. X and running the application pool as Mr. X
...well, one of them is that the web site will try to access C:\Windows\Microsoft.NET\ and it's files and need to be able to modify them (assuming an ASP.NET app) and the application pool's user will govern which user attempts to access a database when attempting to use a connection string that specifies integrated security in lieu of a specific, hard-coded user.
When the DevExpress upgrade wizard complains that it cannot change a file due to its encoding...
- shut Visual Studio 2013
- revert the mess you just made (I hope you had your solution in source control.)
- reopen the solution in Visual Studio 2013
- say "No" when flagged to make a upgrade
- find the objectionable files (I guess I should have mentioned that you should have made a list of these. Hopefully, you're not reading these instructions as you go.)
- pick: Save YourFileNameHere.cs As... from the "File" menu for each messed up file and pick that little down arrow by the Save button to pick the "Save with Encoding..." option and when saving set the "Encoding:"
- dropdown to "Unicode (UTF-8 with signature) – Codepage 65001"
- close and reopen Visual Studio 2013
- say "Yes"
Tuesday, January 6, 2015
Alipay
Somewhat like a 3DS process, use of Alipay, when afforded to shoppers, will allow ahoppers to leave a web site where they wish to check out by clicking a "Pay with Alipay" button which then routes them to Alipay's site where they then enter their payment credentials. One is then routed back from Alipay to the site they left where they are given a confirmation screen. There is thus some cross communication between Alipay and that which would offer it up as a way to pay.
cannot resolve symbol 'SetClientCredential'
.SetPolicy is also sabotaged in web services using ASP.NET's Web Services Enhancements 3.0! this suggests there is no good way to fix this in modern day Visual Studio. The one solution I see involves opening the old code where WSE 3.0 was current back in Visual Studio 2005 and jumping through some hoops in that IDE!
Web Services Enhancements (WSE) 3.0 for Microsoft .NET
Where does one get the Microsoft.Web.Services3 and Microsoft.Web.Services3 and Microsoft.Web.Services3.Security.Tokens namespaces? Well, this suggests that one may have at Microsoft.Web.Services3.dll here which is what is what is also suggested to be missing. When I ran the .msi I ended up getting the file installed to: C:\Program Files (x86)\Microsoft WSE\v3.0\Microsoft.Web.Services3.dll
I bought an extension cord for my headphones at Fry's Electronics last night.
I tried it out today. It worked dandy.
Monday, January 5, 2015
Chromecast and Amazon Fire TV Stick
Wikipedia says "Chromecast is a digital media player developed by Google. The device, a 2.83-inch (72 mm) HDMI dongle, plays audio/video content on a high-definition display by directly streaming it via Wi-Fi from the Internet or a local network. Users select the media to play using mobile apps and web apps that support the Google Cast technology." and Amazon Fire TV Sticks are the Amazon alternative product.
OWIN middleware!
As mentioned, I've followed Scott Allen's pluralsight.com MVC5 trainings to build a .NET Framework 4.5.1 OWIN-flavored console application like so:
using System;
using Microsoft.Owin.Hosting;
namespace MyKatana
{
class Program
{
static void Main(string[] args)
{
string uri = "http://localhost:8080";
using (WebApp.Start<Startup>(uri))
{
Console.WriteLine("Started!");
Console.ReadKey();
Console.WriteLine("Stopping!");
}
}
}
}
Also, as mentioned here, there is a Startup class in the mix. Recently, I altered it (from what is at the link I provide) as seen here:
using MyKatana.Middleware;
using Owin;
namespace MyKatana
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.Use<HelloWorldComponent>();
}
}
}
I did this to bring in a component, a piece of middleware that is! In Mr. Allen's video he first builds a piece of middleware like so to show off a common shape:
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace MyKatana.Middleware
{
public class HelloWorldComponent
{
private Func<IDictionary<string, object>, Task> _next;
public HelloWorldComponent(Func<IDictionary<string, object>, Task> next)
{
_next = next;
}
public async Task Invoke(IDictionary<string, object> environment)
{
await _next(environment);
}
}
}
A Func<IDictionary<string, object>, Task> must be taken at the constructor of a componet for it to behave well (or at all really) in the OWIN context, and thus there is a need to write a custom constructor with the signature seen here for each component. We also need an Invoke method. It is important to note that using the await keyword in lieu of a return requires one to also use the async keyword. Mr. Allen suggested that the await/async shape to the Invoke method is the norm. It is not however mandatory, as he went on to refactor what is above to what is below.
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
namespace MyKatana.Middleware
{
public class HelloWorldComponent
{
private Func<IDictionary<string, object>, Task> _next;
public HelloWorldComponent(Func<IDictionary<string, object>, Task> next)
{
_next = next;
}
public Task Invoke(IDictionary<string, object> environment)
{
Stream response = environment["owin.ResponseBody"] as Stream;
using (StreamWriter writer = new StreamWriter(response))
{
return writer.WriteAsync("Hello World!");
}
}
}
}
We take off async in taking off await! Alright, clearly this piece is intended to the very last in a sequence of steps while the prior shape (which did nothing) was more friendly to being somewhere upstream of a last step. How can we use both shapes and still write a line of copy to the browser?
using MyKatana.Middleware;
using Owin;
namespace MyKatana
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.Use<HelloComponent>().Use<WorldComponent>();
}
}
}
We will run the HelloComponent before the WorldComponent and it looks like so:
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
namespace MyKatana.Middleware
{
public class HelloComponent
{
private Func<IDictionary<string, object>, Task> _next;
public HelloComponent(Func<IDictionary<string, object>, Task> next)
{
_next = next;
}
public async Task Invoke(IDictionary<string, object> environment)
{
Stream response = environment["owin.ResponseBody"] as Stream;
using (StreamWriter writer = new StreamWriter(response))
{
writer.Write("Hello: ");
}
await _next(environment);
}
}
}
environment["owin.ResponseBody"] = response; ...was just before the last line of code above is my first pass at this. It turns out I didn't need it after after given that I am altering a reference type however. WorldComponent is just a mild revamp of HelloWorldComponent. It looks like this:
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
namespace MyKatana.Middleware
{
public class WorldComponent
{
private Func<IDictionary<string, object>, Task> _next;
public WorldComponent(Func<IDictionary<string, object>, Task> next)
{
_next = next;
}
public Task Invoke(IDictionary<string, object> environment)
{
Stream response = environment["owin.ResponseBody"] as Stream;
using (StreamWriter writer = new StreamWriter(response))
{
return writer.WriteAsync("World!!!");
}
}
}
}
After I did this, I turned around and mused that HelloComponent didn't really need to interface with owin.ResponseBody the way the last step in the chain (WorldComponent) must. I ended up refactoring it like so:
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace MyKatana.Middleware
{
public class HelloComponent
{
private Func<IDictionary<string, object>, Task> _next;
public HelloComponent(Func<IDictionary<string, object>, Task> next)
{
_next = next;
}
public async Task Invoke(IDictionary<string, object> environment)
{
environment["htmlspool"] = "Hello: ";
await _next(environment);
}
}
}
This makes WorldComponent change up to accomodate.
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
namespace MyKatana.Middleware
{
public class WorldComponent
{
private Func<IDictionary<string, object>, Task> _next;
public WorldComponent(Func<IDictionary<string, object>, Task> next)
{
_next = next;
}
public Task Invoke(IDictionary<string, object> environment)
{
string htmlspool = environment["htmlspool"] as String;
Stream response = environment["owin.ResponseBody"] as Stream;
using (StreamWriter writer = new StreamWriter(response))
{
return writer.WriteAsync(htmlspool + "World!!!");
}
}
}
}
Another part of Mr. Allen's training involves making an AppFunc using statement not unlike a using directive. Here is what one of those looks like:
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
namespace MyKatana.Middleware
{
using AppFunc = Func<IDictionary<string, object>, Task>;
public class WorldComponent
{
AppFunc _next;
public WorldComponent(AppFunc next)
{
_next = next;
}
public Task Invoke(IDictionary<string, object> environment)
{
string htmlspool = environment["htmlspool"] as String;
Stream response = environment["owin.ResponseBody"] as Stream;
using (StreamWriter writer = new StreamWriter(response))
{
return writer.WriteAsync(htmlspool + "World!!!");
}
}
}
}
At the very end I decided to fall back to using a .Run instead of a .Use to implement the last step in my process. I did so like this:
using MyKatana.Middleware;
using Owin;
namespace MyKatana
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.Use<HelloComponent>().Run(environment =>
{
return environment.Response.WriteAsync("World!!!");
});
}
}
}
That meant that it now made sense to revert the HelloComponent class to its initial shape:
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
namespace MyKatana.Middleware
{
public class HelloComponent
{
private Func<IDictionary<string, object>, Task> _next;
public HelloComponent(Func<IDictionary<string, object>, Task> next)
{
_next = next;
}
public async Task Invoke(IDictionary<string, object> environment)
{
Stream response = environment["owin.ResponseBody"] as Stream;
using (StreamWriter writer = new StreamWriter(response))
{
writer.Write("Hello: ");
}
await _next(environment);
}
}
}
using System.Web.Http;
using MyKatana.Middleware;
using Owin;
namespace MyKatana
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
HttpConfiguration config = new HttpConfiguration();
config.Routes.MapHttpRoute(
"MyRoutingRule",
"api/{controller}/{id}",
new {id = RouteParameter.Optional});
app.UseWebApi(config).Use<HelloComponent>().Run(environment =>
{
return environment.Response.WriteAsync("World!!!");
});
}
}
}
Now the app will continue to just serve up "Hello: World!!!" unless a legitimate ApiController route is hit at which point behavior differs! http://localhost:8080/api/whatever/ is such a route thanks to this controller:
using System;
using System.Web.Http;
using MyKatana.Objects;
namespace MyKatana.Controllers
{
public class WhateverController : ApiController
{
public Whatever Get()
{
return new Whatever()
{
MeaningOfEverything = 42
};
}
}
}
It will cough up an instance of this object:
namespace MyKatana.Objects
{
public class Whatever
{
public int MeaningOfEverything { get; set; }
}
}
Microsoft and .NET ...is not equal to... nuget.org
Go to: TOOLS > NuGet Package Manager > Package Manager Settings ...in Visual Studio 2013 which will bring up an "Options" dialog box wherein you will see options for "Nuget Package Manager" split into "General" and "Package Sources" and if you pick the second option you will see a list of "Available package sources:" where "nuget.org" may or may not be checked depending upon your settings. With regards to the silly problem I mention in another blog posting here, at the Package Manager Console the "Package source:" dropdown afforded options for NAMEOFMYCOMPANY.nuget and "Microsoft and .NET" and I made the false assumption that "Microsoft and .NET" and "nuget.org" (which was indeed an unchecked checkbox) where the same thing.
Sunday, January 4, 2015
I am enjoying Scott Allen's pluralsight.com trainings!
They are stronger than I expected. I guess this means I need to actually pay for an account instead of trying to just get away with abusing a ten day free trail, huh? Here are some dirty notes I've taken since Friday on OWIN:
- The AppFunc: Func<IDictionary<string, object>, Task>;
- A low level OWIN Component is called Middleware!
public async Task Invoke(IDictionary<string, object> environment)
{
await _nextComponent(environment);
} - Keys which MUST appear in the AppFunc Request Environment: owin.RequestBody, owin.RequestHeaders, owin.RequestMethod, owin.RequestPath, owin.RequestPathBase, owin.RequestProtocol, owin.RequestQueryString, owin.RequestScheme
- MUST appear in the Response Environment: owin.ResponseBody, owin.ResponseHeaders
- remember setting status codes!
- look at how he is processing requests!
- Nancy is for routing on top of OWIN.
- Both Nancy and Web API do not have dependency on System.Web or ASP.NET
- IIS Express "is essentally the core of IIS but I can run it from the command line"
- Microsoft.Owin.Host.SystemWeb ...makes an OWIN app IIS friendly
- change Console Application to Class Library
- change Output Path at "Build" to "bin"
- how was Startup found?
- Startup.cs in an MVC5 project!
- There is a by default a middleware component for authentication and there are more components for various types of authentication
- katanaproject.codeplex.com has the source! ...canned, existing middleware is here
Friday, January 2, 2015
JavaScript templates
A coworker was just telling me about JavaScript templates as a concept. In HTML you have braces (variables in braces) which decry template data kept in a .js file and you use a template tool like Jade to bring it into your HTML, this can improve performance as the .js content will be cached at a browser improving the speed of a web application.
an inability to install anything at all from NuGet!
This and this touch on this error:
There seems to be a suggestion that one may get around it by uninstalling Visual Studio and reinstalling it followed perhaps by a restart of the VM or computer at hand, but I've done this and have had no luck. That said, I noticed that the AttachTo plugin and AnkhSVN were back automatically upon the other side of my wipe and recreate which means my wipe and recreate must have been an imperfect cleansing. I wonder if I need to throw away my VM. How can I use Visual Studio without NuGet?
Addendum 1/5/2015: I made a stupid mistake as it turns out. See: this
I'm down to just one dead end now.
I started an online training on MVC5 today and it delved into OWIN and illuminated a solution for one of the two problems I mention here. One installs Microsoft.Owin.Hosting and Microsoft.Owin.Host.HttpListener from NuGet and one holds open the console application which one spins up like so:
using System;
using Microsoft.Owin.Hosting;
namespace MyKatana
{
class Program
{
static void Main(string[] args)
{
string uri = "http://localhost:8080";
using (WebApp.Start<Startup>(uri))
{
Console.WriteLine("Started!");
Console.ReadKey();
Console.WriteLine("Stopping!");
}
}
}
}
It looks a lot like holding open a console application in a general sense, no? Yet, it's a bit different. To get this to work I also need a Startup class and it looks like this:
using Owin;
namespace MyKatana
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.Run(ctx =>
{
return ctx.Response.WriteAsync("Hello World!");
});
}
}
}
Here are some dirty notes I typed up while listening to the training before I got to the solution above:
- K. Scott Allen's MVC5 training at Pluralsight (http://www.pluralsight.com/courses/aspdotnet-mvc5-fundamentals)
- membership and security model in MVC4 is now obsolete
- Katana is a new project type for ASP.NET
- a lot of MVC features have been moved into "OWIN middleware"
- ASP.NET membership providers and simple membership providers are gone.
- Identity componets which are interface-based provide some more flexibility and understand technologies like OAuth and OpenId and local accounts stored in SQL server databases
- attribute routing
- the Microsoft.AspNet.Mvc line item at packages.config should decry what version of MVC one is using
- the video shows and upgrade from MVC4 to MVC5. The Target framework of the project gets moved from .NET Framework 4 to .NET Framework 4.5.1
- go to "Manage NuGet Packages"
- Microsoft.AspNet.Web.Helpers.Mvc has been renamed for MVC5 ... this needs to be uninstalled, then updates run, then the new version installed
- one may "roll the dice" and pick "Update All" to bring all the packages up to date, or update oneseys and twoseys
- ugh, the upgrade process is WAY painful
- Microsoft.AspNet.WebHelpers in the new Microsoft.AspNet.Web.Helpers.Mvc
- If you unload a .csproj file in Visual Studio you may edit it not unlike editing it in notepad... one then needs to Reload the project
- particularly in cloud apps where you pay for every byte, there is a need to have things be light
- Katana is Microsoft's implementation of an open standard named OWIN (Open Web Interface for .NET)
- web frameworks and web servers should be decoupled
- MONO is the open source implemenation of .NET
- System.Web is tied to ASP.NET and IIS as kinda fat instead of fast
- MVC5 has a reference to Microsoft.Owin and Microsoft.Owin.Security and Owin
- create a Console Application for Katana to listen to and process HTTP request
- install-package -IncludePrerelease Microsoft.Owin.Hosting ...to the console app
- install-package -IncludePrerelease Microsoft.Owin.Host.HttpListener
- using Owin namespace one may add an IAppBuilder app
- .Environment in IAppBuilder has a dictionary of things like cookies and headers and server variables, etc.
- install-package -IncludePrerelease Microsoft.Owin.Diagnostics ...has the welcome page
- an IDictionary of string,object is an environment
- as you add extensions with other NuGet Owin packages they will typically add things you may dot off to from an IAppBuilder
VMware snapshots
This suggests (correctly) one may make a snapshot by selecting the tab of the VM to capture and then going to "Take Snapshot..." beneath the "Snapshot" menu beneath the "VM" menu. To revert to a snapshot, per this, do so also at the "Snapshot" menu by picking "Revert to Snapshot: YOURSNAPSHOTNAMEHERE"