Friday, April 29, 2016

Uncaught TypeError: Cannot read property 'allowDrag' of null

This error would appear in the console, alongside one for DXR.axd, when I attempted to drag a column, in attempting to make a DevExpress MVC GridView both use a Customization Window and an Adaptive Design like so:

@Html.DevExpress().GridView(
settings =>
{
   settings.Name = "grid";
   
more settings here... columns are defined, etc.
   settings.Settings.ShowFilterRow = true;
   settings.SettingsAdaptivity.AdaptivityMode =
         GridViewAdaptivityMode.HideDataCellsWindowLimit;
   settings.SettingsAdaptivity.HideDataCellsAtWindowInnerWidth = 800;
   settings.SettingsAdaptivity.AllowOnlyOneAdaptiveDetailExpanded = true;
   settings.EditFormLayoutProperties.SettingsAdaptivity.AdaptivityMode =
         FormLayoutAdaptivityMode.SingleColumnWindowLimit;
   settings.EditFormLayoutProperties.SettingsAdaptivity.
         SwitchToSingleColumnAtWindowInnerWidth = 600;
   settings.SettingsBehavior.AllowSelectByRowClick = true;
   settings.SettingsPopup.CustomizationWindow.Height = 200;
   settings.SettingsPopup.CustomizationWindow.Width = 200;
   settings.SettingsBehavior.EnableCustomizationWindow = true;
   settings.Settings.ShowGroupPanel = true;
   settings.ClientSideEvents.CustomizationWindowCloseUp =
         "grid_CustomizationWindowCloseUp";
}).Bind(Model).GetHtml()

 
 

OK, outside of the grid there is going to be a button with an id of btShowCustomizationWindow for showing and hiding the Customization Window. I stole its name and the JavaScript to get it to work from here and the JavaScript looks like this:

$(document).ready(function () {
   $("#btShowCustomizationWindow").click(
      function () {
         UpdateCustomizationWindowVisibility();
      }
   );
   UpdateCustomizationWindowVisibility();
});
function grid_CustomizationWin
dowCloseUp(s, e) {
   UpdateButtonText();
}
function UpdateCustomizationWindowVisibility() {
   if (grid.IsCustomizationWindowVisible())
      grid.HideCustomizationWindow();
   else
      grid.ShowCustomizationWindow();
   UpdateButtonText();
}
function UpdateButtonText() {
   var text = grid.IsCustomizationWindowVisible() ? "Hide" : "Show";
   text += " Customization Window";
   $("#btShowCustomizationWindow").val(text);
}

 
 

So what's wrong? Well, as it turns out, I can get the draggability and everything else to work by just getting rid of this line of code which isn't needed:

settings.ClientSideEvents.CustomizationWindowCloseUp =
      "grid_CustomizationWindowCloseUp";

 
 

Something else worth mentioning while I'm thinking of it is that you should note that I did not have to do ANYTHING to force the code side name of "grid" to materialize as "grid" on the HTML side as an id that one could lasso with JavaScript. The whole cast-the-client-side-id-as-static thing in the web forms way of doing DevExpress grids doesn't apply in their MVC paradigm.

SDET stands for Software Development Engineer in Test

See: this

Thursday, April 28, 2016

the Customization Window for DevExpress GridViews

This allows you to drag columns off to a side pane to remove them from what is shown. Some links:

confusing "Settings" within "settings" at MVC DevExpress GridViews

@Html.DevExpress().GridView(
settings =>
{
   settings.Name = "GridView";
   settings.Settings.ShowFilterRow = true;

Adaptive Layouts at DevExpress MVC Grid Views!

You can do this with version 15.2.9.0 but you must set up an MVC app as a Responsive Web Application to begin with. When setting up a new project in Visual Studio pick "DevExpress v15.1 Template Gallery" and then when the setup wizard appears pick "Responsive Web Application" from the options under "ASP.NET MVC" mkay?

Wednesday, April 27, 2016

Others build filters for Snapchat beyond the defaults.

When they do Snapchat gets a kickback and that is how Snapchat makes money.

Error: The value for the @newname parameter contains invalid characters or violates a basic restriction ().

When I got this error in playing with sp_rename it was because I was trying to rename an empty string to and empty string!

If you rename unwanted tables in T-SQL instead of deleting them...

...this should let you know if you can live without the tables without error and also provides a way out of the change for a rollback script.

crosstalk over a once-upon-a-time primary key

Challenge: All of the user management database tables come out of your application to be the guts of a single sign-on service which your app and a new app will use in tandem. How will you crosstalk between your app and the tables? Will you now hand in a username to get a user? It's been pointed out to me that in-house you can just keep using the user ID. The database tables which had constraints tying the IDs to the users table in foreign key columns will have their constraints broken, but there is really no reason why they can't just keep using the IDs for the lookups against the service. Keep the columns full of IDs! If this wasn't going on in your own little Petri dish and two very independent applications with different keepers were talking you wouldn't use an esoteric encoding for lookups, but if it's all in-house, why not?

Tuesday, April 26, 2016

If you're like me and you put notes to yourself all over your Outlook Calendar, but you won't want to give the appearance that you actually have a meeting...

right-click on the line item at your calendar and pick "Free" below "Show As"

Universal Windows Apps

...are WPF apps that use the .NET Core in lieu of the .NET Framework. The link I give here suggests: ".NET Core is a modular version of the .NET Framework designed to be portable across platforms for maximum code reuse and code sharing. In addition, .NET Core will be open-sourced and accept contributions from the community." The Universal Windows Platform (UWP) for apps does not target an OS (operating system) but instead a developer picks device families to target and to attempt to push out compiled code to.

How do I get stuff back out of a DataSource?

We all know how to hydrate a DataSource and then DataBind as suggested here right? But how do we read into a ObjectDataSource to loop through its rows on the C# side if it is prepped in the ASP.NET markup? You may cast it's guts back to a DataTable like so:

DataTable dataTable = (DataTable) MyDataSource.Select();

I'm intrigued by .Cast

foreach (DataRow dataRow in dataTable.Rows)
{
   if (dataRow["User_Name"].ToString() == foo.UserName)
   {
      foo.UserId = Convert.ToInt32(dataRow["User_ID"]);
      break;
   }
}

 
 

ReSharper suggested that I refactor the C# above into a LINQ (Language Integrated Query) shape like so:

foreach (DataRow dataRow in dataTable.Rows.Cast<DataRow>().Where(dataRow =>
      dataRow["User_Name"].ToString() == foo.UserName))
{
   foo.UserId = Convert.ToInt32(dataRow["User_ID"]);
   break;
}

Monday, April 25, 2016

Install-Package angularjs

I assume that this NuGet console command will install the latest, greatest AngularJS and set it up a little bit in an ASP.NET MVC app. Angular isn't going away, is it?

Sunday, April 24, 2016

tuples just keep getting better

This C# 4.0 way of doing things...

public Tuple<string, int> GetSayingAndSubstance()
{
   return new Tuple<string, int>("lucky",13);
}

 
 

...may now take a shape like so in C# 7.0!

public (string Saying, int Substance) GetSayingAndSubstance()
{
   return new (string Saying, int Substance)
      {
         Saying = "lucky",
         Substance = 13
      };
}

 
 

This means that this in the C# 4.0 way of doing things...

var x = GetSayingAndSubstance();
var y = x.Item1;
var z = x.Item2;

 
 

...may be reshaped like so the C# 7.0 approach to be more elegant:

var x = GetSayingAndSubstance();
var y = x.Saying;
var z = x.Substance;

An envelope in the SOAP paradigm is the root element of a XML message.

This has some note on envelopes and more or less suggests the root elements needs specific and particular formatting.

Friday, April 22, 2016

Put underscores around a word in Skype to make it italic.

asterisks make the word bold

you can't use SQL variants with Entity Framework

sql_variant isn't supported

Claims in the Identity model are pieces of identity such as an email address or how old you are.

Identity is the new and better answer to the Membership Provider in the ASP.NET space. A coworker was telling me about claims today. He said they are kind of nebulous and thus they provide lots of room for you to roll your own antipattern. The half of an email address after the @ could be a claim and so could a date or a geographic region as defined by IP sniffing. He suggested that in the new model one now longer logs in and wanders that app as a user but instead on the other side of the log in a bag of claims is collected from differing sources to stand in for a user as an identity. There could be separate upfront lookups for roles and for permissions which are also types of claims and which would be used to decide, for example, if one can see what's at a particular MVC route or if one gets the boot. Some links:

Thursday, April 21, 2016

NS in Objective-C

I heard today that NS is sprinkled throughout Objective-C in names and that it comes from NeXT Solutions, a company Steve Jobs spearheaded. Stack Overflow thinks it stands for NeXTSTEP (libraries named for NeXT).

Tuesday, April 19, 2016

SCCM is System Center Configuration Manager

I guess you manage a local area network (LAN) or a wide area network (WAN) with it. I think it does reports amongst many other things. It's a Microsoft product.

How do I use the Membership Provider?

  • Roll your own class which inheirts from MembershipProvider.
  • Add a membership node within the system.web stuff at Web.config to tell .NET to use your class whenever membership is called out to like so:
    var x = System.Web.Security.Membership.GetUser().UserName;

Membership Provider is a web forms thing which doesn't exist in MVC. It's counterpart is Identity in that space.

Monday, April 18, 2016

"Failed to parse SourceMap:" errors at Google Chrome's console

This is a WebEssentials problem to do with making bad .map files in its minification process. We need a patch for Web Essentials as version 2015.1 (1.0.211) isn't enough!

DPI

It's Dots Per Inch. It's resolution both in print media and at the monitor.

Saturday, April 16, 2016

Rally MySpace hijacking

You may type in HTML in many fields in CA Technologies Agile Central and it will actually display as HTML when bubbling back out in a report or a list of line items or the like. For example if you wrap the name of a story or part of the name in a span tag and then have an inline style defining color you may make the title of the story more fun so that it pops out the meet the eye agreeably when displayed in a list for easy reading.

Advanced REST client

This is a means to test REST APIs that is a Google Chrome extension.

white labeling

This as to do with making an application that your own clients may turn around and present as their own to their clients with their logo adorning it and their own color scheme and so on. When you build the app you have to make at least some content swappable and uploadable to accommodate this.

Plex.tv

Allows you to host movies on your computer that others may download. This is kinda like the old pier-to-pier software piracy sharing model of KaZaA and Morpheus. Instead of multiple piers making it fast (there is none of that) the movie is streamed as you enjoy it.

Wednesday, April 13, 2016

SalesForce a CRM... or an ERP?

Beyond the customer relationship management (CRM) that is SalesForce, I guess there is something called Rootstock which is an ERP (enterprise resource planning) by the same peeps.

Tuesday, April 12, 2016

Infor

It's another ERP!

PowerShell try/catch

try
{
   asdfljkasdxfkljsdhjklgnslgn!
}
catch
{
   echo "Something went South! Specifically:"
   echo $_.Exception.Message
}
finally
{
   echo "Whatever."
}

I struggled how to understand how to type into a particular window in PowerShell today and yesterday.

Add-Type @"
   using System;
   using System.Runtime.InteropServices;
   public class UserWindows {
      [DllImport("user32.dll")]
      public static extern IntPtr GetForegroundWindow();
}
"@
$ActiveHandle = [UserWindows]::GetForegroundWindow()
$Process = Get-Process | ? {$_.MainWindowHandle -eq $activeHandle}
[void] [System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms")
[System.Windows.Forms.SendKeys]::SendWait("hello there")

 
 

This does find the process and then put "hello there" to the console, but if you spawned a new explorer window between the third to last line and the second to last line the typing would happen at the new window and not the console. The same is true if it's jammed between the fourth to last and third to last lines of code above. Nuts. There must be some way to tab back to where you were, but I can't figure it out. Some links I found in learning this are:

 
 

The last link above has a list of variables for special keys. I wished there was a way to emulate pressing the Windows key so that I might do things like mimic a Windows key and Left Arrow combination to make an explorer window snap to and fill the left side of the monitor, but there is not. AutoIt might be the thing to use for that. Also Add-Type -AssemblyName System.Windows.Forms is maybe something that could go in the place of [void] [System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms") above.

Attachments: Text version of this message. (2KB)

How to make a PowerShell script do it's thing in a different console window!

Below the prompts to press a key represent the real work to be done and the rest of this is the dress up around that to stage it:

#WHAT IS THIS THING? HOW DO I GET IT TO WORK?
 
#1. run Powershell as an administrator
#2. navigate to the folder which holds helper.ps1 or put the helper.ps1 file in the folder
      suggested at the command prompt
#3. run the command: powershell.exe -executionpolicy unrestricted
#4. run the command: .\helper.ps1
 
 
param([Int32]$step=1)
if($step -eq 2)
{
   echo "press (almost) any key to start"
   cmd /c pause | out-null
   echo "press (almost) any key to end"
   cmd /c pause | out-null
}
else
{
   $invocation = (Get-Variable MyInvocation).Value
   $directorypath = Split-Path $invocation.MyCommand.Path
   Start-Process powershell -ArgumentList "-file $directorypath\helper.ps1 -step 2"
}

Monday, April 11, 2016

random things learned yesterday

  1. Etsy let's you set up a storefront to sell your trinkets and knick-knacks. They take a cut. You do this when you are just starting out and still establishing yourself and you don't want your own shopping cart.
  2. Twitch let's you stream video.
  3. Frontier Communications is an Austin, Texas ISP. (internet service provider)

Sunday, April 10, 2016

Users at IIS web sites will have a session devoted to them but not a likely a dedicated thread.

Imagine one hundred threads for one hundred users. It's silly. The locking and the like of threading is really not a user-based bounds thing. Spin up different threads when writing flat files en masse, but not to manage user boundaries.

Friday, April 8, 2016

SecureString

In .NET this is a type which is a mutable string of sorts. It has a fixed size so that it doesn't have to sit on the heap. It's basically a character array. You can put stuff in and out of SecureString until setting it to be read only. The whole reason for this thing is to store in strings stuff you want to explicitly destroy quickly without either forcing garbage collection or waiting for garbage collection. Why would you care? There are some wacky memory attacks that try to fish out data from not-cleaned-up memory.

If you can view sprocs but not execute sprocs due to your permissions, you can still roundabout run the sprocs for reading things.

Just copy the guts of the sprocs into their own standalone queries.

F#

It's a CLI language like C#. I've never used it and don't really know what sets it apart. Supposedly, it's better for math-heavy calculations than C# would be.

Tuesday, April 5, 2016

OptionsPager for ASPxPivotGrid

Well, it's a lot like pagination for an ASPxGridView and yet it has to be different:

<OptionsPager Visible="True" AlwaysShowPager="True" RowsPerPage="10">
   <AllButton Visible="True"></AllButton>
</OptionsPager>

You may jam as many wacky conditions into an ON clause in a JOIN in T-SQL as you might a WHERE clause.

I am used to seeing ON clauses which just match unique ID to unique ID to join tables, but that doesn't mean it has to be that way. You can have two conditions instead of just one.

Monday, April 4, 2016

Today is the day of the Panama Papers data leak!

It's the biggest data leak ever! It shows the very wealthy hiding wealth where it cannot be taxed in places like the British Virgin Islands and it names names like Vladimir Putin.

 
 

Addendum 4/5/2016: Iceland's Prime Minister Sigmundur David Gunnlaugsson resigned over this. I think 4/3 is technically the day of the publish of the data not 4/4. I heard of it yesterday myself.

If you enter the commit number for a story to be reviewed first at SmartBear Collaborator...

...when prepping a new review, Collaborator with automatically populate the author for you off of subversion metadata for the commits!

string concatenation in T-SQL

Print ('the number of table rows altered was ' + CAST(@counter AS VARCHAR(2)))

The service code on your credit card is an embedded three digit number.

This is not the CVC2/CVV2/CID/CAV2 number it is a different data point which I learned about for the first time today in a security training.

Other things:

  • In a stack-based overflow attack there is a spillover past, say, the bounds of an array on the stack wherein the extra items do things like override pointers on the stack and affect method return instructions causing havoc. In a heap-based overflow a chunk of the heap set aside for being written to gets written to and then some and the spillover writes gunk into another chunk causing pain.
  • MD5, SHA-1, RC3, RC4 and all homebrew solutions are bad algorithms for encryption.
  • IMEI stands for International Mobile Station Equipment Identity and is a unqiue id for a phone.
  • A PIN is a personal identification number. Duh.
  • AuthN and AuthZ are gansta ways to suggest authentication and authorization respectively.
  • PCI-DSS is now up to version 6.5!

I don't always use web sites with popups...

...but when I do I just use Internet Explorer.

Friday, April 1, 2016

ClientInstanceName and the public facing HTML id parameter are not the same thing in DevExpress' web forms paradigm, but you can assign the later to the former.

MyGrid.ClientInstanceName = MyGrid.ClientID;

...is an example of doing so in C#. I ran into some nastiness in which an ASPxGridView in an .ascx used several times over in an .aspx staged a scenario wherein the ClientInstanceName when used in JavaScript would affect one grid and not another and not the right thing and there was a bunch of we-are-stepping-on-each-others-toes contamination going on.