Archive

Posts Tagged ‘Tips’

Use JQuery to get data from specific html table column


One of the gigs I am currently working on is to load test a web application. I needed some ids to feed my load test scripts but I didn’t have access to the database. I can view the information on a grid on one of the HTML pages. I solved the problem by using JQuery to query the HTML table and extract the ids I need. The id column is the second column on the grid and hence I am using eq(1) in the script below.

Click F12 to open the dev tools and I excuted the following scripts to get the ids  I needed.

$(‘table > tbody > tr’).each(function(i) {

console.log( $(this).find(‘td:eq(1)’).text())

});

 

About Lajak Technologies

A consulting firm in Ottawa, Ontario that provides services related to Microsoft technologies, Team Foundation Server, DevOps practices, security and more. Contact us today to help you solving your complex software problems. Visit us at http://www.lajak.com.

Advertisements
Categories: javaScript, Uncategorized Tags: ,

Read Authorization section from Web.config


In my current project, I had to read the find the Windows group for the ESB portal which can be found in the authorization section of the web.config for the ESB portal. I used the following code to read it:

var config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(“/Bam”, “Default web Site”);
var section = config.GetSection(“system.web/authorization”) as AuthorizationSection;

if (section == null)
{
    return string.Empty;
}

foreach (AuthorizationRule rule in section.Rules)
{
     if (rule.Action.ToString().ToLower() == “allow” && rule.Roles.Count > 0)
     {
        foreach (var item in rule.Roles)
        {
            if (item != “*”)
            {
                return rule.Roles[0];
            }
        }
    }
}
return string.Empty;

[/soucecode]

Categories: .NET, asp.net, C#, Tips Tags: , ,

Biztalk: Instance was not successfully terminated. Status is Pending


Sometimes when you try to terminate messages in Biztalk, messages may fail to terminate. Before you force the termination, you need to make sure you are ONLY terminating the messages you intend to terminate.

To force the termination, try one of the following:

Restart/Stop host instances assigned to the port or orchestration

Recycle the application pool assigned to the Webservice/WCF service if the port’s host is an isolated host

You can also wait for Biztalk to finish retrying sending the message, hence messages become suspended instances

IIS: There was an error while performing this operation


This is more of a tip than a post. Today I had  the following error in IIS while modifying Handler Mappings

There was an error while performing this operation.

Details:

Filename: \\?\C:\SomePath\web.config

Error: Cannot write configuration file due to insufficient permissions

Solution:

We are using TFS, and TFS sets the Readonly flag when the file is checkin. Basically, all you need is to check out the web.config before do your modifications in IIS

Categories: Tips Tags: ,

LightSwitch: Hide Export to Excel Button


To hide the Export to Excel button follow these steps:

Open the screen

In the screen designer, select the Data Grid whose excel button to be hidden

Open property window or press F4

Check Disable Export to Excel

 

Launch the application

Categories: LightSwitch, Tips Tags: ,

Lightswitch: Hide Grid’s Search Textbox


In some cases, we need to hide the search textbox on top of the grid.

 

To hide the textbox following these steps:

Open the screen that contains the grid

Select the query for the grid whose search textbox need to be hidden

Open Property Window (or hit F4)

Uncheck Support Search

Run the application

Categories: LightSwitch, Tips Tags: ,