Thursday, June 23, 2016

When you don't explictly have your output parameter for your sproc amongst the other parameters in ExecuteNonQuery in C#...

System.InvalidCastException

{"Object cannot be cast from DBNull to other types."}

 
 

I know this doesn't make much sense. Hey, I'm going to stop blogging for a while. I hope you have enjoyed it! I saw the film "The Neon Demon" tonight and it was pretty good.

string is basically a fixed size array of char and it is immutable

That is how it can live on the stack instead of the heap in C#. A string technically never grows. There may be other places in this blog where I imply strings live in the heap and I'm just wrong. I'm sorry. Ok, wait, here is a better explanation. A string is a class and a reference type that lives on the heap and has a pointer, but it defers to its guts which is a char array on the stack. As it is immutable, whenever you change it you are remaking its guts on the stack too. So basically, it's fair to just think of a string a reference type on the heap as you will interact with it that way. How it behaves on the stack is all stuff being wrapped and obfuscated from your perspective code monkey.

Make up your own inline attributes at the tag for a DevExpress ASPxCheckBox!

Do DataBinder.Eval stuff to make a setting and then fish out the setting on the C# side like this!

var checky = (ASPxCheckBox)whatever.FindControl("Whatever");
var attrib = Covert.ToInt32(checky.Attributes["MyMagicString"]);

man in the middle attack

MITM, MitM, MIM, MiM attack or MITMA involves putting eyes and ears on the unsecure as it travels from point A to point B. I don't really undertstand how these works. This suggests if someone visits a web site through a sinister proxy that the proxy would be the middleman.

Wednesday, June 22, 2016

Capacity of Lists

var foo = new List<int>(13);

 
 

...is not the same as:

var foo = new List<int>(){13};

 
 

The first approach is setting a capacity of thirteen for the list, and I basically think this entails setting aside some memory on the heap. The footprint will then not need to grow until a fourteenth item is shoved in. This is not like sizing an array wherein the size cannot change after the new up.

Processors and cores could be synonyms in the right circumstance.

That being multi-core CPU threading.

awesome

<script>window.googleJavaScriptRedirect=1</script><META name="referrer" content="origin"><script>var n={navigateTo:function(b,a,d){if(b!=a&&b.google){if(b.google.r){b.google.r=0;b.location.href=d;a.location.replace("about:blank");}}else{a.location.replace(d);}}};n.navigateTo(window.parent,window,"http://consequenceofsound.net/2015/10/how-josie-and-the-pussycats-walked-the-line-between-satire-and-outright-hypocrisy/"); </script><noscript><META http-equiv="refresh" content="0;URL='http://consequenceofsound.net/2015/10/how-josie-and-the-pussycats-walked-the-line-between-satire-and-outright-hypocrisy/'"></noscript>

This somehow ended up on my desktop as an .htm file. With Google Chrome as my default browser, it appeared to be an icon to launch Google Chrome, but whenever I clicked upon it it took me off to a funny site. How did I get this?

Company Code

In the SAP space this is a common name for an organizational unit in accounting. A company must have a code before accounting based on a tax code may begin. This name creeps beyond SAP as convention elsewhere as it is the center of the accounting flux wheel (month-to-month changes in invoices and expenses) back at SAP.

User Agent String

This is a placeholder for metadata in the header of an HTTP request. It typically communicates what browser you are using in a string with details for version number, etc.

things from a Web API discussion yesterday

  • The HatEoAS Hypermedia stuff is a good way to provide documentation to make an API discoverable.
  • My colleagues have often seen security for the ASP.NET Web API in such a shape that one hands in usernames and passwords in plain text over https. This seems pretty common in the field. There really is no security functionality to the Web API itself, so you are left to cowboy code your own fix and this is how a lot of people do it. What if you want a nonce (pronounced "en once" maybe? think n in n+1) approach in which someone cannot hit a second time or attempt a brute force attack? Maybe it's best to send a packet with your IP address, the datetime, a key, and the request URI, amongst other things. This should make the packet hard to spoof. The key could be temporary and time out.
  • "limit" and "offset" are often allowed as URI parameters for pagination when retrieving records which are likely to be GET requests anyways. You can pass URI parameters even beyond GET calls and make sense of them though.

crosstalk without atomic types

When you need to get a type from say JSON to C# and it's not a simple primitive atomic type (float, int, bool, or char) you will need to get creative. Maybe a JSON object will be demanded for the fish that has evolved to walk on land, but there are a lot of the smidge-better-than-amoeba mollusks in the "sea" that are capable of just being cast from strings, and the decimal type is an example ...so you could hand in a string to make a decimal. DateTime types are often communicated in string format, especially so when talking into SQL. ISO 8601 is an example of a spec for strings for DateTime stuff.

 
 

Addendum 5/9/2018: 2012-04-23T18:25:43.511Z is suggested as a good JSON format for holding a JavaScript date here.

Tuesday, June 21, 2016

Supposedly the more items you add to a dictionary in Swift (in assigning a variable with a fleshed-out dictionary) the longer the compiler will take, exponentially longer, to a ridiculous degree as there is a bug with type inference.

Type inference is the deduction of type based upon assignment. true might be a bool and 13 an int in C# when one assigns to a var variable. null cannot be an assignment to a var variable because there is no way to infer a type, you know?

Monday, June 20, 2016

Add stuff to ASPxComboBox controls!

This will show the blank entry as the default:

<dx:ASPxComboBox runat="server" ID="Whatever">
   <Items>
      <dx:ListEditItem Text="" />
      <dx:ListEditItem Text="Foo" Value="Bar" />
   </Items>
</dx:ASPxComboBox>

 
 

The use of Selected here changes things and makes the Foo value the defaut:

<dx:ASPxComboBox runat="server" ID="Whatever">
   <Items>
      <dx:ListEditItem Text="" />
      <dx:ListEditItem Text="Foo" Value="Bar" Selected />
   </Items>
</dx:ASPxComboBox>

 
 

Use a ASPxListBox (multiselect) instead of a ASPxComboBox (dropdown list) is you need multiple line items showing at once. Shove in a third item on the C# side and make it selected like so:

var whatever = (ASPxComboBox)e.Item.FindControl("Whatever");
var item = new ListEditItem("Baz", "Qux");
whatever.Items.Add(item);
whatever.SelectedIndex = 2;

 
 

More shit:

chrome://plugins/

The long way to get here (the plugins) is:

  1. pick "Settings" from the hotdog menu in Google Chrome
  2. click "Show advanced settings..."
  3. click "Content settings..." under the "Privacy" subsection
  4. click "Manage individual plugins..." under the "Plugins" subsection of the modal which appears

right-click on an unused using directive in Visual Studio 2015 and pick "Cleanup Code..."

This will do a number of canned things which are editable. One of the default things it will do is get rid of unused using directives.

Ctrl-M-O and Ctrl-M-P

These seem to close and then open methods in Visual Studio 2015 and by closing methods I mean that to close a method is to collaspe it onto one line that has a little plus symbol off to the the left to open it back up again. This is plus and minus expand and collaspe stuff.

You can't use Url.Action at a Controller's constructor, but it will work a bit farther downstream in the life cycle.

An Action isn't the only place this is legit, however there are places where Url.Action will break the code too. The following is fine:

protected override void OnActionExecuting(ActionExecutingContext ctx)
{
   var foo = Url.Action("Index", "Whatever");

[SetterProperty]

You slap this on a getsetter for an interface to have it hydrated from StructureMap. I don't understand it yet.

There is no longer an official download link for Safari for Windows!

It's over! I guess it's not the new IE6 after all or anymore.

commit, commit, commit

Note to self: Stop being quick to commit Tom. Everyone hated you doing it at @hand and you're not going to look good doing it at your current job either. Chill out. This is a place you need to improve. Learn to sit on code without checking it in. You can do it. You can forgive yourself for looking at Erica Campbell (Lena Martin) on tumblr if you'll change this one bad habit.

It's the first day of Summer. Things are gonna get better. I have optimism.

Yes, Photoshop stops working when your subscription runs out.

You'll be able to use it one last time while it figures out what's up.

Saturday, June 18, 2016

The Url.Action thing is not just for Razor.

It works just fine inside a Controller Action too.

var whatever = Url.Action("Bar","Foo");

 
 

This will create a relative path starting with a slash and leaving off the domain name and the http/https opening.

Friday, June 17, 2016

Did you know that if you wrap a radio button and some adjacent copy in a label tag that if you click up to copy it will affect the radio button as though you clicked it too?

<div>
   <label>
      <input type="radio" name="Connection" value="Heart">
      Heart
   </label>
</div>
<div>
   <label>
      <input type="radio" name="Connection" value="Spade">
      Spade
   </label>
</div>

 
 

While I'm on this ASP.NET MVC will model bind based on the name of a radio button and not the id as, duh, obviously the id should not be the same across numerous radio buttons, and, yet, .NET has a bad habit of just assigning the same id to numerous radio buttons. If you want to fight this "feature" in the RadioButtonFor Razor markup you may do so like this:

@Html.RadioButtonFor(m => m.Connection, "Heart", new {id="heart"})

expressions in CSS

.this below could be .body too in order implementations.

@media (max-height: 200px) {
   .PerRoleRepeaterDiv
   {
      overflow-y:hidden;
      overflow-x:hidden;
      max-height:200px;
      height:expression(this.scrollHeight>199?"200px":"auto");
   }
}
@media (min-height: 201px) {
   .PerRoleRepeaterDiv
   {
      overflow-y:scroll;
      overflow-x:hidden;
      max-height:200px;
      height:expression(this.scrollHeight>199?"200px":"auto");
   }
}

Thursday, June 16, 2016

How can I edit my title at Outlook?

This touches on it some, but at unless you're the one to administer the server you're going to have to ask someone to do it for you.

the forgot your password questions

A coworker pointed out to me that you shouldn't fill these out honestly if you are a celebrity as anyone can go to Wikipedia to fish for the name of your home town and your elementary school.

Wednesday, June 15, 2016

What are devs supposed to do in dead time when they are waiting around for a peer to do a peer review?

You can't really start another story on the side as that would be denying another team member who isn't waiting around the ability to start the story for real. Straddling stories is bad. I've never seen that in any of the "agile" places I've worked. Man I hate the peer review thing. I'm glad that's not going on where I work now. I think it's a trapping of ghetto hole-in-the-wall startups which don't want to spend money on a testing team. (or maybe they want to spend the money but can't)

A trailing comma in a collection doesn't stop the compiler in C#.

The following test passes. The fourth comma is harmless all and all. Just as you can get away with a semicolon on a line all by itself you may have a trailing comma without consequence.

using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTestProject
{
   [TestClass]
   public class UnitTest
   {
      [TestMethod]
      public void Go()
      {
         List<string> whatever = new List<string>() { "foo", "bar", "baz", "qux", };
         Assert.AreEqual(whatever[0], "foo");
         Assert.AreEqual(whatever[1], "bar");
         Assert.AreEqual(whatever[2], "baz");
         Assert.AreEqual(whatever[3], "qux");
      }
   }
}

Tuesday, June 14, 2016

agile manifesto

We have come to value...

  • individuals and interactions over processes and tools
  • working software over comprehensive documentation
  • customer collaboration over contract negotiation
  • responding to change over following a plan

The Agile thing is kinda dead huh? It backslid into a grey area of murkiness. Everyone does their own thing anymore and it's wild and loose. I guess all we have really taken away from it is that we hate Waterfall and hence, yes, customer collaboration over contract negotiation is preferred, but what that looks like is undefined. How do I wiggle out of the vise of a finite contract? I can't even tell you what was originally intended by "individuals and interactions over processes and tools" because I've never been on a project where the platform was negotiable. Either we do C# or we do Java here and we're not just gonna pick the one that's best.... that sort of thing. I can't imagine a team saying: "Let's do the new greenfield project in web forms instead of MVC because that's what's best." Maybe that's a bad example though and maybe MVC is just better, huh? Scrum sort of allows for a CYA thing when a consultancy is engaging with a client to crank out some code. The burndown chart can scream "We are not going to make it" and the client can then begrudgingly make sacrifices because they were roped into a contract that had the burndown chart's concept baked into it. Do any of the point estimates otherwise matter? What are the consequences for blowing an estimate? Is the Lean concept that we are just gonna work on what we have to work on anyways, rain or shine, king? If estimates do matter how on earth can we get them right? So many questions... that we've given up on! If your wacky process seems to be working for you, how do you know it can't be better? Maybe it's best to not break a working business model at that point, eh? Whatever. So we'll all be sick and convince ourselves that we are healthy. We have a cough, but at least we don't have cancer.

How can I figure out what that goofy song is supposed to be about?

Search at Google and you'll probably find songmeanings.com.

Use IsDBNull to see if a column coming back from a sproc has data at all for a given row in C#.

More or less like this, but a bit different...

x = !Convert.IsDBNull(dataRow["X"]) ? Convert.ToString(dataRow["X"]) : null;

Monday, June 13, 2016

Close existing connections

You probably need to check this checkbox when deleting a database in SSMS. I don't think there is ever a reason not to do it.

How do you crank up the contrast in Adobe Photoshop?

This (it's called "Brightness/Contrast...") and other simple effects like "Invert" are found at "Adjustments" under the "Image" menu. I was looking for this last week and I couldn't find it as I hardly ever use Photoshop anymore for anything other than cropping screengrabs.

Did you know that you have to explicitly allow for handing in empty string values when talking to sprocs in C#?

ExecuteReaderCollection<Cat>("HereKittyKitty", new[]
{
   CreateParameter("Name", "")
});

 
 

must become...

ExecuteReaderCollection<Cat>("HereKittyKitty", new[]
{
   CreateParameter("Name", "", whiteSpaceIsNull:false)
});

 
 

If you don't do this you are handing in a null value for Name to HereKittyKitty. This disappoints me.

emoji are smileys

OK?

Who knows who Hoovers is anymore?

Companies used to buy lists to cold call against from these guys. They are at least partially located here in Austin, Texas. At least some of their tech is. Microsoft will buy LinkedIn. That news broke today. I once spoke to a dev from Hoovers who told me of how they (Hoovers) were to buy LinkedIn and passed on the opportunity. He said it was a mistake. I think this was back in 2010. It was at a surprise birthday party for Kevin Hurwitz. He turned 32 and it was one of Kevin's friends who was at Hoovers and I think he was past coworker of Kevin's. I can't remember the guy's name. His wife was very pregnant and miserable as she was pregnant in the Summertime and he and I and the wife all talked about how awesome the movie "Josie and the Pussycats" is/was. Whatever. Yikes Hoovers what a loss, huh? You know there is nothing special about LinkedIn other than the convention that distinguishes it from Facebook and MySpace and the like that people will use it for business. The funny thing is that we've all imbraced the convention and use it as was hoped for instead of dragging that part of our lives into Google+ or something similar. The boundary between what it stands for and other social media is not enforced with code itself and there is really nothing stopping bikini-clad girl pictures from appearing all over LinkedIn other than a tradition we all seem to honor. That's weird and cool. I digress.

Sunday, June 12, 2016

Adobe Premiere versus Adobe After Effects

This, partway in, suggests that Premiere is for video editing while After Effects is really for the concept of compositing, laying one thing onto and over another as a background or having twins played by the same actor conversing with each other in a scene. The later is for the magic and the former is more cut and dry.

Saturday, June 11, 2016

more takeaways from a Cigital training at work this week

Some rather convoluted suggestions for abandoning ship in Forms Authentication (bolt account creds right into the Web.config file???):

  1. FormsAuthentication.SignOut();
    FormsAuthentication.RedirectToLoginPage();
  2. Session.Clear();
    Session.Abandon();
    Response.Cookies["ASP.NET_SessionId"].Value = string.Empty;
    Response.Cookies["ASP.NET_SessionId"].Expires =
          DateTime.Now.AddMonths(-20);
    Response.Redirect("login.aspx");

 
 

Also you can bring SSL into the mix in cookies!

HttpCookie RoleCookie = new HttpCookie("Role");
RoleCookie.Value = role;
RoleCookie.HttpOnly = true;
RoleCookie.Secure = true;
Request.Cookies.Add(RoleCookie);

 
 

This goes in the Web.config to make it happen:

<httpCookies httpOnlyCookies="true" requireSSL="true" domain="www.example.com" />

 
 

The .Find Lambda is going to throw an exception when it can't find a match.

That is its Achilles heel. It's otherwise more efficient than using .Where or, my old crutch, the foreach loop to fish something out of a collection. You'll have to wrap your .Find implementation in a try/catch if there is a possibility of a fail. Don't expect to map the result from a .Find to a string and have the string just be null when the .Find finds nothing. That's not how things work in C#.

 
 

Addendum 6/13/2016: This isn't true at all as it turns out. .Find, like .FirstOrDefault will return the default for a type if it can't make a match, for example a null value for a string. This suggests that .Find has existed since C# 2.0 at lists while .FirstOrDefault came later with the LINQ and Lambda stuff and is for IEnumerable more universally.

RadioButtonFor is the Razor means for doing radio buttons.

If our model has a bool type getsetter called IsToUseSpecificCulture we could have a radio button in a .cshtml view like so:

@Html.RadioButtonFor(m => m.IsToUseSpecificCulture, false)

 
 

That just makes the false radio button and one radio button by itself is no fun. You have to have a sister or sister radio button(s) elsewhere in markup like so:

@Html.RadioButtonFor(m => m.IsToUseSpecificCulture, true)

 
 

The two together should provide our true/false toggle. The setting on the getsetter will drive which radio button starts out as checked. I haven't tried to manually set a setting in the markup, but I think you may do so like this based on what I'm Googling as I type this up:

@Html.RadioButtonFor(m => m.IsToUseSpecificCulture, false, new {@checked=true})

[HttpGet]

This attribute for an MVC action is kind of like the [HttpPost] action save that it is for what happens when a user just visits the route to the action in lieu of posting a form to that route. If you have a form at an Index action and it posts to a Save action which just shows the same form again to let you know what you just saved, you could have a breakout between Save for POST and Save for Get wherein the Get will just maybe RedirectToAction back to the Index. This still doesn't protect against someone submitting the form and then refreshing the browser in lieu of just pressing enter at the URL line. The former act will trigger the Post again while the later the Get. However, this sort of breakout does help some I suppose.

Policy Decision Point (PDP) in contrast to Policy Enforcement Point (PEP)

These came up in a security training at work this week. PDP is of how decisions are made in code to determine who can do what. This could be whether or not someone is anonymous or logged in with the one God password in a very elementary application, but "Role-based Access Control" is the common pattern, marinated in roles, that we tend to see. PEP is the definition for how policy is enforced. The two common-shapes, assuming we are probably doing the roles thing, are Programmatically in which we just have if/then logic in code saying things like "yes, you may go forward, but only if you have this role" and Declarative in which the roles themselves are in charge. It's harder for me to squint my eyes and picture how this second thing works. I guess the power of the role is in its record at its row in the database, perhaps holding bit values for a bunch of flags??? I don't really know.

worm

It's a virus, a computer virus. Don't confuse this with wyrm, a dragon.

Friday, June 10, 2016

Gawker applies for Bankruptcy after Hulk Hogan's lawsuit over them hosting a sex tape with him in it devastates them.

This is bad, bad, bad guys. Section 230 is supposed to protect us from this sort of thing. If there are any other examples of this sort of liability rearing its head I've never heard of them. I think this is a first and thus a terrible precedent to set. Hogan, yes the professional wrestler from the 1980s, uses the N word in the tape, recorded of him surreptitiously, and when that is exposed to the world it ruins him professionally. The damages he won for that legally then tanks Gawker itself. This is bad for 1st amendment freedoms.

CareCredit

...is an online credit system straight out of Holy Fire. (I'm joking.)

HackerRank

...offers online assessments for job screenings.

async/await at Actions

If you want to await in an Action, but you don't want to use .Result which can lead to deadlocks you need to craft the signature of your MVC Action like so:

public async Task<ActionResult> Whatever(Foo foo)

 
 

...in lieu of just:

public ActionResult Whatever(Foo foo)

more on the AntiForgeryToken

The @Html.AntiForgeryToken Razor snippet should probably go inside of each form in Razor markup. It prevents cross-site request forgery (CSRF or XSRF) wherein sinister links or redirects or reroutings of some manner are injected into legitimate views or content. Put [ValidateAntiForgeryToken] as an attibute at your MVC action to make it count!

attribute to make a getsetter a password control in Razor

[DataType(DataType.Password)]

Slap this on a getsetter for a string at your model and then in the Razor markup it needs to map to an EditorFor in lieu of just a TextBoxFor.

Grubhub

Find restaurants who deliver in your area with Grubhub!

Spooling up HTML on the code side!

As suggested here, one may just spool up a bunch of gunk via string concatenation in code and then barf it into a web page as HTML. I did this all the time in PHP a dozen years ago and supposedly when guys like me were trying to transition to web forms we did the same thing with the Literal control. For a while this became seen as a bad practice, but perhaps individual HTML tags can be crafted sparingly on the C# side. I'd keep such mechanics in the UI project of an Onion Architecture approach. Again, it's for individual tags not a big spool of tags back to back. That part of the past needs to be left in the past.

Wednesday, June 8, 2016

LinkedIn won't let you send too many messages???

Here is something you can do as a techie to help other techies.

  1. Whenever recruiters try to friend you on LinkedIn, friend them!
  2. When they message you, once connected, about an opportunity, just don't respond.
  3. When you know of another techie looking for work, then respond to their messages off topic and mention that that party is looking.

By the time you are doing step 3, infrequently, you should be messaging multiple recruiters who have spooled up in your history/connections. This helps everyone, techies and recruiters alike, and it's something that anyone can do philanthropically but yet no one does do. As of tonight, I am hitting an obstacle with this however. LinkedIn seems to be blocking me from sending more messages to advertise that someone I know is on the market looking for work. Boo! I guess I could compose one blanket message to all recruiters in network at all recruiting firms, but that sure would be ghetto. I don't want to do that. How long must I wait before I may message again?

When you add two char variables together in C# you are combining their numeric values not concatenating a string.

Beware!

Unity and Unreal Engine 4

These are engines for making games.

That type which Enum.GetValues makes, whatever it is, may just be cast back to your enum's type!

<select id="Locale">
   <option selected></option>
   @foreach (var enumValue in Enum.GetValues(typeof(Language)))
   {
      Language language = (Language)enumValue;
      FieldInfo fieldInfo = language.GetType().GetField(language.ToString());
      object[] attrs = fieldInfo.GetCustomAttributes(typeof(DescriptionAttribute), true);
      var friendlyName = ((DescriptionAttribute)attrs[0]).Description;
      <option value="@enumValue">@friendlyName</option>
   }
</select>

Did you know that if you make an enum and a class in C# and have your enum as a getsetter on your class that its first value will be the default value when you new up an instance of your class?

nice! (false is the default for a bool in this sort of situation and zero the default for an int and twelve ante meridiem on day one of year one for a DateTime)

Tuesday, June 7, 2016

analog

This means not digital, old stuff like magnetic strip tape. It's any old electronica way of doing things before bytes of data. Analog versus digital is not exactly a parallel so to speak for hard versus soft as a hard copy isn't necessarily electronic while analog is at least vacuum tube techesque methinks. A soft copy of a document might be a Microsoft Word file while the hard counterpart might be a print out.

{"\":\" is not valid at the start of a code block. Only identifiers, keywords, comments, \"(\" and \"{\" are valid.\r\n"}

This error basically means something went wrong in Razor markup. When I try to google it, I see some results for this error message instead:

{"\"@\" is not valid at the start of a code block. Only identifiers, keywords, comments, \"(\" and \"{\" are valid.\r\n"}

 
 

...so that's an at symbol instead of a colon and the threads I find from Google suggest just doubling up the at symbol as @@ so that Razor does not misinterpret it. I can't even find in the code base I'm looking at the colon which is so objectionable. Whatever.

How to drive the LabelFor and ValidationMessageFor copy in an MVC app from a resource file.

Use these two attributes at your model and you can probably tell which is for which, eh?

using System.ComponentModel.DataAnnotations;
namespace Foo
{
   public class Bar
   {
      [Required(ErrorMessageResourceType = typeof(Resources.Resources),
            ErrorMessageResourceName = @"Baz")]
      [Display(ResourceType = typeof(Resources.Resources), Name = @"Qux")]
      public string Whatever { get; set; }
   }
}

 
 

Resources.Resources above suggests a file called Resources.resx in your resources project within your ASP.NET solution that also holds your MVC project. The model above should play nicely with Razor markup like so:

@Html.LabelFor(m => m.Whatever)
@Html.TextBoxFor(m => m.Whatever)
@Html.ValidationMessageFor(m => m.Whatever)

Suck a string out of a resource file into Razor markup!

<h1>@OurApp.Resources.MyResources.MyHeader</h1>

Monday, June 6, 2016

right-click on a database in SSMS and pick "Link database to source control..."

...to do exactly what you'd expect. The database can then be kept up to date by way of scripts checked into source control. Click the "SQL Source Control" button in SSMS at the top nav for tabs such as "Get latest" for getting the latest changes, etc.

 
 

Addendum 6/8/2016: Under the "Get latest" tab there will be a left pointing arrow for: "Update the database with latest changes from source control"

TeamViewer hacked

Time to uninstall this guys. The bad guys had a way to break into any install without a username/password. From there they could take remote control of your PC, so said a coworker.

(Restoring...)

I tried to restore a database and then my VM crashed due to running out of space. When I freed up some space and came back to life "(Restoring...)" was listed by the messed up database I attempted to restore in SSMS. I found this for what to do about the problem but honestly I haven't tried it. I just reverted to a snapshot of my VM and started again.

Friday, June 3, 2016

Did you know you may hand a first name space last name space email address format in as a toAddress in C# when sending emails?

For a System.Net.Mail.MailMessage "Mickey Mouse mmouse@disney.com" is legit. In Outlook you'll get the dressup wherein the message appears to be to "Mickey Mouse" for readability.

Did you know that when inspecting variables while stopped at a breakpoint debugging in Cassini that you may edit the values realtime to experiment with what will happen downstream?

Mouse over the variable to see the value. Click into the value to edit it. Remember to press return to make your change take.

some Netflixesque monthly subscription services for reading comic books digitally

While I'm thinking about it I think Playboy magazine now has a service in which one can pay to just browse all of its nude pics ever online. This comes as they are getting out of the nude business and trying to sell the company, well, a bit in advance of that. I have another thing to say. Google may use AdSense and Google Analytics to know what you are browsing for even when you are not logged into your Google account. I only looked at Amazon Comixology and then ads for it started to appear at the right pane of my Skype chat window!

Thursday, June 2, 2016

It drives me nuts that I can't do a screengrab of a collection I'm inspecting while debugging in Visual Studio.

The fix is to right-click on the variable and pick: "Add Watch"

how to set a message for when there are no records at an old school web forms Repeater to unsure the header isn't just floating there by itself

I found something at StackOverflow suggesting that you should set the OnItemDataBound method for your Repeater like so:

public void BonesRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
   if (BonesRepeater.Items.Count < 1)
   {
      if (e.Item.ItemType == ListItemType.Header)
      {
         HtmlGenericControl foo = (e.Item.FindControl("Foo") as HtmlGenericControl);
         foo.Visible = true;
      }
   }
}

 
 

I had better luck with something like this:

public void BonesRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
   if (BonesRepeater.Items.Count < 1)
   {
      if (e.Item.ItemType == ListItemType.Header)
      {
         e.Item.Controls[1].Visible = true;
      }
   }
}

 
 

The control, would be something put inside of the HeaderTemplate tags in the Repeater like so:

<div id="Foo" runat="server" visible="false">
   There are no bones in ice cream!
</div>

runat="client" in .NET?

I see intellisense in Visual Studio 2015 trying to suggest this is an alternative to runat="server" and I'm gonna have a nosebleed. This isn't a real thing. It's bullshit, flapdoodle, balderdash, malarkey, hogwash, hooey, poppycock...

Wednesday, June 1, 2016