Calendar

November 2014
S M T W T F S
« Oct    
 1
2345678
9101112131415
16171819202122
23242526272829
30  

Dynamically Selecting a Value in a C# DropdownList Control

In a recent internal C# web project, I needed to accept a URL parameter and use that value to select an item value, if it exists, within a DropDownList control. I have provided the code, along with some commentary, to use as a refresher for myself and a base for others.

This code was implemented within my page’s Page_Load event outside of an IsPostBack check.

//Check for URL Parameters
if (Request.QueryString.Count > 0)
{
      if (!string.IsNullOrEmpty(Request.QueryString["Value"]))
      {
           // If TestPlan parameter is not null, attempt to find the value in the release filter dropdown
           if (DropDownListbox.Items.FindByText(Uri.UnescapeDataString(Request.QueryString["Value"].ToString())) != null)
           {
                // Found the item in the release filter dropdown. Select it and load the filtered data.
                DropDownListbox.Items.FindByText(Uri.UnescapeDataString(Request.QueryString["Value"].ToString())).Selected = true;
                // Continue processing
           }
           else
           {
                 // Could not find the value in the release filter dropdown.
                 //do something else
           }
     }
}

 

AxoSoft OnTime – Metrics – Defects by Severity

I have recently been introduced to a new tool, Axosoft‘s OnTime. For what it is, it works well as an Agile project management tool, complete with defect and incident tracking. From a quality assurance perspective, it’s nice to have flexibility of workflow management, custom fields and such. What I have found a bit lacking, however, is consistent metrics. I’m prone to create my own metrics reporting, so I have a tendency of querying databases directly.

In OnTime, the data structure is fairly straightforward. However, our organizational structure within the tool’s concepts of Releases and Projects is hierarchal in nature and makes my queries a tad more complex.

First, I had to decide to base my metrics off or projects or releases. I selected Releases, since we tend to have more projects in a single release.

Second, I had to determine how to traverse through a particular release and all sub-releases. For this, I created a temporary table to set up the hierarchy of releases. As an added bonus, I got to delve into a bit of recursion. In this temporary table, you must determine the ReleaseID of your parent release and use that as your anchor. The commented line shows you where to enter that value.

Third, it was a matter of constructing my select statement. You will notice several left joins, as many of the fields we track aren’t required. Later, in the where clause is where you can filter your query based on the data you want to see.

Lastly, I needed to generate a PIVOT to allow me to view the Severity values as individual columns. You will need to ensure that the values in your Severity query match the values in your table.

This will give you a snapshot count of Defects by Severity.

I have found this very useful in communicating a bunch of useful data in a simple to consume chart. You can also take this a step further to track your snapshots over a time period for trend analysis.

Here is the query:

WITH AllReleases AS
(
    SELECT ParentRelease.ReleaseId, ParentRelease.Name
    FROM Releases AS ParentRelease
    WHERE ParentRelease.ReleaseId = 1 – This is the Parent Release ID
   
    UNION ALL
   
    SELECT SubRelease.ReleaseId, SubRelease.Name
    FROM Releases AS SubRelease
        INNER JOIN AllReleases AS AR
            ON SubRelease.ParentReleaseId = AR.ReleaseID
)
               
SELECT
    ‘Release Name’ AS Release,
    Critical,
    [High Impact],
    [Medium Impact],
    [Low Impact],
    [No Impact]
FROM
    (SELECT
          Sev.Name AS “Severity”
        FROM
            Defects AS D
                LEFT JOIN Projects AS P
                    ON D.ProjectId = P.ProjectId
                LEFT JOIN StatusTypes AS S
                    ON D.StatusTypeId = S.StatusTypeId
                LEFT JOIN SeverityTypes AS Sev
                    ON D.SeverityTypeId = Sev.SeverityTypeId
                LEFT JOIN PriorityTypes AS Pri
                    ON D.PriorityTypeId = Pri.PriorityTypeId
                LEFT JOIN WorkflowSteps AS WF
                    ON D.WorkflowStepId = WF.WorkflowStepId
                LEFT JOIN Releases AS R
                    ON D.ReleaseId = R.ReleaseId
                LEFT JOIN DefectCustomFields AS DCF
                    ON D.DefectId = DCF.DefectId   
        WHERE D.ReleaseId IN
            (
                SELECT ReleaseId FROM AllReleases
                    WHERE AllReleases.Name NOT LIKE ‘%backlog%’ – Filter the releases by name.
            )
       
        ) AS tbl
    PIVOT
        (COUNT(“Severity”)
            FOR “SEVERITY” IN (Critical, [High Impact], [Low Impact], [Medium Impact], [No Impact] )
        ) AS pvt

Here are the results from this query (both Raw Data and fed through an Excel graph).

To learn more about OnTime, take a look at their website: www.ontimenow.com.

Upgrading Concrete5 5.2.2.1 to 5.6.0.1 using SimpleScripts

I currently run several Concrete5 web sites from my host, Bluehost.com. Typically, I use the SimpleScripts tool to do the typical upgrade maintenance for all of my apps. It’s simple, easy to use, and rarely causes concern. However, this upgrade was a little different. I clicked the upgrade icon and away it went. upon review of the new site, I saw that my site was displaying nothing but blank pages. I couldn’t see my dashboard and no discernible error message.

After some quick looking around, as I hadn’t needed to look through the file system before, I found the “error_log” file sitting in the root installation directory. Error logs are usually an invaluable resource while troubleshooting. This was certainly the case this time around. In the log, I found the following messages:

[25-Sep-2012 07:05:42] PHP Warning: require_once(/home1/source/public_html/site/concrete/libraries/3rdparty/htmLawed.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory in /home1/source/public_html/site/concrete/core/libraries/loader.php on line 30
[25-Sep-2012 07:05:42] PHP Fatal error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required ‘/home1/source/public_html/site/concrete/libraries/3rdparty/htmLawed.php’ (include_path=’/home1/source/public_html/site/libraries/3rdparty:/home1/source/public_html/site/concrete/libraries/3rdparty:.:/usr/lib/php:/usr/local/lib/php’) in /home1/source/public_html/site/concrete/core/libraries/loader.php on line 30
[25-Sep-2012 07:05:43] PHP Warning: require_once(/home1/source/public_html/site/concrete/libraries/3rdparty/htmLawed.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory in /home1/source/public_html/site/concrete/core/libraries/loader.php on line 30

This was repeated every time the site was loaded. I checked in the directory and found, as expected, the htmLawed.php file did not exist. I copied this file over from a diffferent, working installation and retried. I received a bevy of other errors. At this point, I was getting somewhat frustrated. The support staff was not very involved, a departure from their usual outstanding efforts.

I walked away from my troubleshooting for a few hours so I avoid tunnel vision. With a fresh head, I went through and finally found great support information on the Concrete5 Community. I had started my search there, but never quite found the right terminology to get to the right answer. I knew I couldn’t have been the only person to face this issue. Here is the URL that holds the key to this problem: http://www.concrete5.org/documentation/how-tos/developers/troubleshooting-concrete5-updates/.

It turns out that the SimpleScripts upgrade did not fully complete, leaving the Database and the GUI out of sync. According to the post, I fell under Scenario #1, the Core being newer than the Database.

Scenario #1: Core is newer than the database (and you want finish the upgrade)

In this case, you can run the upgrade script directly from its url in your tools directory:

http://www.your-concrete5-site.com/index.php/tools/required/upgrade

If all goes well, this will update the database schema to match the core. It’s a good idea to make sure you have a copy of the unaltered database hanging around in case something doesn’t work.

Once I completed the upgrade process, my website was restored, up and running, with no issues. Admittedly, this was a simple fix, just a frustrating journey to determine the root cause. I certainly hope this post helps prevent hours of wasted time for others facing this issue. I’ve truly enjoyed the simplicity of Concrete5, I’m just not an expert at this point. I’ll be sure to share any other  gotchas I come across.

Fixing Magento Connect on Magento v1.7

I recently upgraded a Magento store from v1.4 to v1.7. In doing so, the administration link to Magento Connect started throwing a weird error. Once I logged in, it brought me to a page that looked like this:

Mac OS X  2??ATTR??X?Xcom.apple.quarantineq/0001;4fabe10e;Google\x20Chrome;D30B167B-7520-4A4B-BB90-173681AAF80E|com.google.ChromeMac OS X  2??ATTR??X?Xcom.apple.quarantineq/0001;4fabe10e;Google\x20Chrome;D30B167B-7520-4A4B-BB90-173681AAF80E|com.google.ChromeMac OS X  2??ATTR??X?Xcom.apple.quarantineq/0001;4fabe10e;Google\x20Chrome;D30B167B-7520-4A4B-BB90-173681AAF80E|com.google.ChromeMac OS X  2??ATTR??X?Xcom.apple.quarantineq/0001;4fabe10e;Google\x20Chrome;D30B167B-7520-4A4B-BB90-173681AAF80E|com.google.ChromeMac OS X  2??ATTR??X?Xcom.apple.quarantineq/0001;4fabe10e;Google\x20Chrome;D30B167B-7520-4A4B-BB90-173681AAF80E|com.google.ChromeMac OS X  2??ATTR??X?Xcom.apple.quarantineq/0001;4fabe10e;Google\x20Chrome;D30B167B-7520-4A4B-BB90-173681AAF80E|com.google.Chrome

For the longest time, I had couldn’t find any information on how to fix this. Then I came across this link: http://www.magentocommerce.com/boards/viewthread/282891/#t397128

Effectively, once I navigated to this folder of my installation: $/public_html/{yourSiteInstallationFolder}/downloader/lib/Mage/Connect/Command I was able to delete all ._* files and access the MagentoConnect site again.

Cheers!

HP ALM – Determining when a Test Case Instance is added to a Test Set

As mentioned in a previous post, my team has been attempting to generate reporting metrics directly out of the ALM database. One of the issues we were running into was determining when a Test Case Instance (TESTCYCL) has been added to a Test Set (CYCLE). There were many queries put together and tables examined and we finally came up with the following SQL Query that appears to get what we need.  It is as follows:

select AU_ENTITY_ID, MIN(AU_TIME) as [Earliest Date]
from AUDIT_LOG
where AU_ENTITY_TYPE = ‘TESTCYCL’
GROUP BY AU_ENTITY_ID

There are a few issues with this, as discovered through conversations with HP Platinum Support Vendors and HP representatives directly. The prime issue is that, HP ALM, as of version 11, will delete these audit records from the AUDIT_LOG table upon removing the Test Case Instance from the Test Set. If you are looking to determine ‘No Run’ test status counts, this will cause an issue. This has been determined to be a defect in ALM, which has been reported due to this particular effort.

The only workarounds that we have been presented to accurately determine this information is to create a custom field in our ALM project and implement workflow code to populate this field for us. Then we could query off this user-generated field. Personally, I have to believe there is a better way, but we haven’t been able to determine it.

Should HP developers run across this post, I’d recommend adding a set of audit columns to the TESTCYCL, CYCLE, and RUN tables or add a “CREATED” series of records to the AUDIT_LOG table.

Bosco Siting – 8/22/2012

Bosco

Unamused Bosco is unamused.

HP ALM Database metrics

The past week has seen me and my team attempting to create several SQL Queries to pull specific information out of our HP ALM Project databases. Basically, we are looking to pull test case execution and status updates per day and report on our local Confluence installation.

The TESTCYCL table stores data pertaining to each specific test case instance in a project. These records are associated with the CYCLE table, which catalogs each Test Set in the Test Lab. There are several other details, which I will explore at another time.

Since we are looking for status updates, it is very important that we get “No Run” counts. The RUN table captures the data for each test run for each test instance. Each record is timestamped, allowing us to determine the resulting Test Execution Status by date. Once we get that data, we can pivot the information and report the counts by date. However, this doesn’t provide the full picture. Remember: the RUN table captures each test execution.

Since no test execution has happened when you add a test case instance to a test set, there is no record in the RUN table. This means our status counts will not accurate reflect “No Runs”. To account for these “No Runs”, the database assumes that TESTCYCL records with no accompanying RUN records is a ‘No Run’. Simple enough… except…

What we have discovered is that the HP ALM database structure does not allow you to determine when a test case instance has been added to a test set. This means that we cannot easily determine this portion of the “No Run” counts by date. If HP (or perhaps Mercury Interactive) would have included a simple set of audit fields on this table, then we would have been able to finish our reports.

I will provide an update if we determine how to solve this issue fully.

Turn Signals and my Honda Accord

Recently, I needed to perform so minor maintenance on my 2002 Honda Accord. Basically, I had to replace the bulb on my dashboard clock, a relatively simple process.

I pried the dashboard clock out of the console and disconnected the two wiring terminals, so I could easily hold the component while screwing the replacement bulb in. This particular component also contains the hazard light switch. I reconnected the wiring and turned the car on. As expected, my clock is now illuminated again!

The bad news, my turn signals no longer work. Brake lights: fine. Headlights: fine. Flip the turn signal, no signal.

Following this story, it is pretty obvious what the issue was. However, at the time, my mind raced through any number of options. Blown fuses: no. Replace the relay: nope. Then it dawned on me… let’s check the wiring cables on the clock component. I pulled out the component, reseated by connections and confirmed they both clicked firmly into place. I tried the turn signals and they popped right on.

Here is the lesson that I learned: the turn signal operations routes through the Hazard Switch. This was a relatively easy fix and simple problem that caused me a bunch of heartache.

The Zoey Chronicles: A Poem

Daddy’s House, Nana’s House
Daddy’s House, Daddy’s House

Trees are up
Clouds are Down
Trees are up, trees are down.
Clouds are up, clouds are down.

Close you eyes, I’m a do maaaaaagic.

The Zoey Chronicles #2 – The Hungry Dinosaur

Today, I bring you the second story told to me by Zoey.

“The Hungry Dragon”

There was a dragon. He was hungry. What did he eat? Five Dora chips. Five Dora chips that were as big as a car!

But he was still hungry.

Then he ate three fluffy cheese pops.

But he was still hungry.

So he ate a bunny.

He wasnt hungry anymore! He was friendly and smiled a lot.

The End