How To Fix Empty ContentEditable Not Allowing Click



TODO:

Have you ever had an empty content editable element, which means the only way to get focus to it was to tab to it?

 

SOLUTION:

Enclose your element in a <div class="editableCell">.  Then track the click on the div, setting focus to it's first child, which will be your empty content editable element.  See the JQuery code below.

$(document).on('click', '.editableCell', onClick);

//So we need this because when there is an empty contenteditable element it wont take a click.  So we need to get the parent (TD) then set focus to the SPAN which will allow data entry.
function onClick(e) {
     $(e.target).children('span')[0].focus();
}
 


NOTES:

You can change the 'span' to whatever your contenteditable element is.  In my case it was a span.

How To Get The Week Of The Year By Using A Custom First Day Of The Week Value



TODO:

Have  you ever wanted to get the week of the year by using a a custom first day of the week?

 

SOLUTION:

var weekOfYear = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(
                DateTime.Now,
                CalendarWeekRule.FirstDay,
                DayOfWeek.Monday);


NOTES:

This sample will get the week of the year by using the FirstDay of the week set to Monday, rather than the default of Sunday.

Considering NordicTrack, Read This First!!!!!



Are you considering buying a NordicTrack machine, if so read this carefully.  I purchased an Elite Elliptical for $999 about 9 months ago.  It started making a thumping sound, so on January 11, 2016 I called NordicTrack.  I was on hold for about 30 minutes before I gave up.  A couple days later, I called back, and again gave up after 30 minutes on hold.  On January 20, 2016 I filled out a support ticket on their site.  No response back from them at all.  Today, February 4, 2016 I called back and this time waited until I got an agent on the phone.  They had no record of my support ticket even though I have a confirmation email from the request.  Now I know why the hold times are unacceptable.  The agent first had to collect a bunch of information that was already on the account profile page I filled out weeks ago.  Next, they had me go to the machine, with a toolbox of tools to begin troubleshooting.  Luckily I am an engineer by trade, because I do not see a un-handy person SAFELY doing the things I was asked to do.  I was asked to take the cover off of the flywheel to check inside for a unaligned belt.  Then I was asked to take another cover off of the inside of the flywheel to look at that side of the wheel.  I was then asked to take the top cover off of the wheel case.  I spent over 1 hr with this agent "troubleshooting" this device.  Incredibly, the issue is coming from a part of the machine that came preassembled.  

The machine is a good machine from a functionality standpoint.  But the service is TERRIBLE.  Long hold times, BS troubleshooting, and as a very last effort they may send a tech.  The caveat is they cannot send a technician UNLESS they also order a part.  So it appears you better be able to troubleshoot for them, because without a part, there is no service visit.

I would never buy another NordicTrack anything.  When we moved I sold my elliptical so that I could buy this one, and in hindsight that was a foolish decision.  The service and support are the WORST I have ever seen.

How To Fix "App installation failed: Could not inspect application package" Error When Installing App In XCode



TODO:

Have you ever got the error message "App installation failed: Could not inspect application package" when you try to deploy your swift app to your iPhone?

 

SOLUTION:

There are many causes but what my issue was was this.  I had an info.plist file specified in the "Copy Bundle Resources" section in "Build Phases".  Once I removed that, my app installed.

There are also a series of other solutions at this site that may help if you do not have the issue above.

 

NOTES:

The app would work in the Simulator just not install to the iPhone

How To Change An Application Pool Username and/or Password Using C#



TODO: 

Have you ever wanted to change the username and password for an Application Pool using C#?

 

SOLUTION:

using(ServerManager serverManager = new ServerManager())
{
   ApplicationPool pool = serverManager.ApplicationPools["AppPoolName"];

   pool.ProcessModel.IdentityType = ProcessModelIdentityType.SpecificUser;
   pool.ProcessModel.UserName = @"username";
   pool.ProcessModel.Password = @"password";

   serverManager.CommitChanges();
}

 

NOTES:

You need to add a reference to Microsoft.Web.Administration dll, located in Windows\System32\inetsrv directory

How To Create IsWeekday Function In T-SQL To Determine If A Date Is A Weekday Or Weekend



TODO:

Have you ever wanted a function that tells you if a certain date is a Weekday?

 

SOLUTION:

CREATE FUNCTION IsWeekday(@InputDate datetime) RETURNS int
AS
BEGIN
DECLARE @isweekday int

select @isweekday=choose(datepart(dw, @InputDate), 0,1,1,1,1,1,0)

RETURN @isweekday

END

 

NOTES:

There are no notes on this topic

How To Fix VMWare Fusion Keeps Resetting Windows Screen Resolution



TODO:

When you switch between OSX and VMWare Fusion 7, your windows screen resolution gets reset.

 

SOLUTION:

1.  Open file:  /Users/{username}/Library/Preferences/VMware Fusion

2.  Add the following 2 lines at the bottom


pref.autoFitGuestToWindow = "FALSE"
pref.autoFitFullScreen = "stretchGuestToHost"

 

NOTES:

There are no notes on this topic

Telerik RadGrid GridEditCommandColumn Only Shows Text Rather Than Default Image



TODO:

You have a RadGrid and the edit column does not show the edit button, only the "edit" text

 

SOLUTION:

In my case the following was in my web.config,

<add key="Telerik.EnableEmbeddedSkins" value="false"/>
   

so the solution was as follows.

  1. Add EnableEmbeddedSkins="true" to your RadGrid declaration
  2. Add Skin="" to your RadGrid declaration


NOTES:

How To Validate A Page On The Client Using Javascript



TODO:

Have you ever wanted to validate a page on the client side?

 

SOLUTION:

if (Page_ClientValidate("vgForgotPassword")) {
//do something
}

 

NOTES:

If the validation group does not have a name use ""

 

How To Disable Edit Of A Particular RadGrid Cell And Hide The Edit Control



TODO:

Have you ever wanted to remove a TextBox or other Control from a particular cell in a RadGrid?  This is particularly useful when you want to conditionally allow edits based on certain data in the record.

 

SOLUTION:

protected void rgMyGrid_ItemDataBound(object sender, GridItemEventArgs e)
{
        //do it when in edit mode
     if (e.Item.IsInEditMode && e.Item is GridEditableItem)
     {
          GridEditableItem dataItem = e.Item as GridEditableItem;

          //if we have a particular type, do not allow the cell to be edited.  if it is not this type, we can allow the cell to be edited
          if (((Employee)dataItem.DataItem).SSN == Ssn1 ||
                ((Employee)dataItem.DataItem).SSN == Ssn2)
          {
                //we have one that needs to have name edit disabled and hidden
                dataItem["Name"].Enabled = false;
                dataItem["Name"].Controls[0].Visible = false;

                //now create a label and add it to the controls of the "Name" cell.  Set the text of the label to the text that is in the edit TextBox that we hid.
                Label descLabel = new Label();
                descLabel.Text = (dataItem["Name"].Controls[0] as TextBox).Text;
                dataItem["Name"].Controls.Add(descLabel);
          }
     }
}

 

NOTES:

There are no notes on this topic