A Simple Prompt Modal Dialog for JQuery JavaScript

image.png

Do you hate what the basic alert(‘hello there’) looks like in JavaScript to your viewing public?  All I want is a simple modal prompt dialog that works with JQuery.   For a long time, I’ve been looking for a simple to use replacement.  It seems like when I scour the internet, I run into lots of people telling you simple ways to use JQueryUI’s Dialog.  For example, when you search “jquery alert simple” you get tons of hits.  This one: http://stackoverflow.com/questions/5355178/jquery-ui-dialog-on-the-fly-without-div It seems the highest voted one says do this: $("<div>My div content</div>").dialog(); Way down in the comments of the SO post, zod posts “What about prompt” with a links … Continue Reading

In JavaScript, ‘true’ == true is false, truthy truth

Somehow, I had thought that in JavaScript that if I said ‘true’ == true that a string conversion to bool would happen on the left side of the comparator and that the == instead of the truthy === would do a type conversion for me. Apparently not. So, for now on, all my JavaScript will look like this when I’m saving off a boolean that I collect in string form. var donationConfirmed = $('#RegisterUserInfoLoggedIn_DonationConfirmed'). val().toLowerCase() === "true"; Happy to hear why I’m wrong here but I don’t think I am. … Continue Reading

All ASP.NET MVC Forms Need To Include Html.AntiForgeryToken() For Security

image.png

Having recently been implementing many new form pages in ASP.NET MVC, I’ve found myself over and over again adding the following two things to every form. After Html.BeginForm() I Put @Html.AntiForgeryToken() Add the Attribute [ValidateAntiForgeryToken] To Every Post Action Method Before I was doing so much ASP.NET MVC, I would often see in Channel 9 videos, the presenter add the AntiForgeryToken() after the BeginForm() method on the cshtml razor page and say something like “you should always add this”.  I never saw them say “and don’t forget to add the attribute ValidateAntiForgeryToken to the controller POST method. Just to be clear, below is what I’m talking about: What this does is to make sure that the trusted … Continue Reading

Tuples In C#, A Useful Example

Background Last year I worked consulted with a company that had an engineer that used tuples in C# and tried to explain to me how they were useful.  To be honest, I never quite saw the value proposition (until today).  I remember he kept saying they were kind of like key value pairs but could go beyond that.  I remember those words but never internalized that. The Example My example is a simple one.  I’m currently working on providing data to an external application that will provide business intelligence (help with session selection) to the Silicon Valley Code Camp web site.  The data I’m providing is every mark of interest and plan to attend for every session ever given at code camp (that’s 220,000 … Continue Reading

Follow

Get every new post delivered to your Inbox

Join other followers: