Monday, January 23, 2017

Need to import things from JIRA into Google sheets?

Attach this to a google sheet and then just pass in the filter number.

This should get past both jira's 1000 issue limit and importxml's limit. The only limitation is script runtime which is 5 minutes. Have imported up to 1500 issues with no problem.

function parseXml(searchNumber) {
  var searchURL = 'https://jira.wherever.com/sr/jira.issueviews:searchrequest-xml/' + searchNumber + '/SearchRequest-' + searchNumber + '.xml?tempMax=500&os_username=username&os_password=password';
  var xml = UrlFetchApp.fetch(searchURL).getContentText();
  var document = XmlService.parse(xml);
  
  // get total
  var total = document.getContent(2).getChild("channel").getChild("issue").getAttribute("total").getValue();
  var pages = Math.ceil(total/500);
  
  var sheetData = new Array();
  
  //loop through pages
  for (var i = 0; i < pages; i++)
  {
    var pageURL = searchURL + '&pager/start=' + i * 500;
    var xml = UrlFetchApp.fetch(pageURL).getContentText();
    var document = XmlService.parse(xml);
    var items = document.getContent(2).getChild("channel").getChildren("item");
    
    var xmlElementNames = [
                             "title", 
                             "link",
                             "project",
                             "description",
                             "key",
                             "summary",
                             "type",
                             "priority",
                             "status",
                             "resolution",
                             "assignee",
                             "reporter",
                             "created",
                             "updated",
                             "fixVersion",
                             "timeoriginalestimate",
                             "timeestimate",
                             "comments",
                             "Sprint"
                            ]
    
    sheetData.push(xmlElementNames);
    
    for (var j = 0; j < items.length; j++) 
    {
      var rowData = [];
      for (var k = 0; k < xmlElementNames.length; k++)
      {
        var itemElement = items[j].getChild(xmlElementNames[k]);
        if( itemElement )
        {
          rowData.push(itemElement.getText());
        } 
        else
        {
          // check the customfields
          var customfields = items[j].getChild("customfields").getChildren("customfield");
          var customfieldfound = false;
          for (var l = 0; l < customfields.length; l++)
          {
            if( customfields[l].getChild("customfieldname").getValue() == xmlElementNames[k] )
            {
              rowData.push(customfields[l].getChild("customfieldvalues").getChild("customfieldvalue").getText());
              customfieldfound = true;
            }
          }
          if( customfieldfound == false )
          {
            rowData.push("");
          }
        }
      }
      sheetData.push( rowData );
      //Logger.log(items[j].getChild("title").getText());
    }
  }
  
  var sheet = SpreadsheetApp.getActiveSheet();
  sheet.clear();
  var sheetRange = sheet.getRange(1, 1, sheetData.length, sheetData[0].length );
  sheetRange.setValues(sheetData);
  
}

Wednesday, September 28, 2016

Need a dump?

If you ever need a crash dump from a remote machine because you're trying to debug a crash.

Create a key at 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps
No settings required. Just the key's existence is enough 

Default settings will put the dump in to %LOCALAPPDATA%\CrashDumps

For more info : Here.

Tuesday, December 2, 2014

WASP x64 ( Windows x64 , Apache 2.4 x64 , SVN, PHP )

To make things easy WASP will now go out in the wild.

Ever wanted a 64 bit distribution of apache 2.4, svn and php but putting all the parts together caused butt pain?
Well here you go.

How stable is it?
It hasn't crashed in production. YET.

How is it configured?
httpd.conf. It uses lots of memory! It eats 2.3 GB of RAM, and then holds steady due to a 2GB svn cache. If you have a small repo and more RAM? MAKE the cache BIGGER!

In production it currently serves a 1.6TB svn repo with 465k revisions that is growing, and acts as a proxy for multiple internal web servers. It also runs PHP so you can use it to do other useful things. Uses rotatelogs to make daily rotating logs, cause usually no one sets this up either!

Why did I put it together?
Because nothing out there fit my needs.

Why did I put this here?
Because hopefully it'll benefit someone else that also wants to roll their own and not use collabnet/wandisco/visualsvn. They are all great products, but not quite what I'm looking for.

How do I install it?
Extract to C:\WASP. Run httpd.exe

Download




Monday, July 21, 2014

Note to self : 0x000001d error

Usually means some /arch: for code generation that is not supported, like SSE2 / AVX

Monday, June 9, 2014

Beware the Windows Scheduled Tasks!

I've had a TeamCity server run much much slower than it's other counterparts.

I finally narrowed it down to Scheduled Tasks. The agent was started at logon by Scheduled Tasks.

It looks like Scheduled Tasks will start in under below normal priority and while this wasn't a problem for many of our build tools, TortoiseSVN however performs very very poorly in below normal priority.

Simple Hall and Teamcity Integration

You will have to set up these 2 parameters as environment variables to be passed in your TeamCity project parameters configuration.

env.BuildID = %teamcity.build.id%
env.BuildTypeID = %system.teamcity.buildType.id%

Checks to see if it's running under TeamCity and then sends the INFO

if not "%TEAMCITY_PROJECT_NAME%" == "" curl -X POST -H "Content-Type: application/json" -d "{\"title\":\"TeamCity\",\"message\":\"Failed - %TEAMCITY_PROJECT_NAME% - %TEAMCITY_BUILDCONF_NAME% - %BUILD_NUMBER% ^<a href="http://TEAMCITYURL/viewLog.html?buildId=%BuildID%&buildTypeId=%BuildTypeID%&tab=buildResultsDiv"^>View Build^</a^>\",\"picture\":\"http:/TEAMCITYURL/img/icons/TeamCity32.png\"}" https://hall.com/api/1/services/generic/HALLID

Thursday, June 5, 2014

Visual Studio Property files and line endings

If you like to lay out multi line preprocessor definition in macros in .props files.

<pc32_preprocessor>
      WF_PC32;
      WIN32;
      _CRT_SECURE_NO_WARNINGS;
      $(FORCED_ENVARS)
</pc32_preprocessor>

Something like that. Certain plugins like the clang plugin will cause all sorts of interesting errors because it'll pass the command line to the compiler with the CRLF.

Change line endings to Old Mac format CR only.

VS will allow you to edit and it will respect the line endings and wont convert it, and it seems to pass through to the compiler just fine.

Integrating windows hosted SVN with hall, logs and diffs provided with WEBSVN

For posterity

SET PATH=%PATH%;E:\svn;E:\curl\bin;E:\bin

SET REPOS="%1"
SET REV=%2

SET HALLROOM=put Group API Token here
SET WEBSVNHOST=https://YOUR_URL_HERE/revision.php?repname=REPONAME
SET PATHTOMATCH=trunk

REM HALL INTEGRATION

svnlook author %REPOS% --revision %REV%> E:\temp\svnlook%REV%_USER
SET /P SVN_USERNAME=<E:\temp\svnlook%REV%_USER
del E:\temp\svnlook%REV%_USER

svnlook log %REPOS% --revision %REV%> E:\temp\svnlook%REV%_LOG
SET /P SVN_COMMIT_MESSAGE=<E:\temp\svnlook%REV%_LOG
del E:\temp\svnlook%REV%_LOG

svnlook dirs-changed %REPOS% --revision %REV%> E:\temp\svnlook%REV%_CHANGED
SET /P SVN_COMMIT_DIRECTORY=<E:\temp\svnlook%REV%_CHANGED

SET SVNMESSAGE=Revision : %REV% - %SVN_USERNAME% - %SVN_COMMIT_MESSAGE%

grep -E "%PATHTOMATCH%" E:\temp\svnlook%REV%_CHANGED
if "%ERRORLEVEL%"=="0" curl -X POST -H "Content-Type: application/json" -d "{\"title\":\"SVN Commit\",\"message\":\"%SVNMESSAGE%^<br^> ^<a href="%WEBSVNHOST%&path=%%2F&rev=%REV%"^>Inspect Log^</a^>\"}" https://hall.com/api/1/services/generic/%HALLROOM%

del E:\temp\svnlook%REV%_CHANGED

Wednesday, May 1, 2013

Reset WINS cache on a QNAP device

Disable WINS server from web administration page

SSH into it

cd /var/log/samba/locks

delete wins.dat

Enable WINS server from web administration page

Done.

Wednesday, October 17, 2012

VSPTree is alive!

I've been using Windows 8 for the last couple of months and have been having a great time with it. It's Windows 7 with a nice flat UI, much faster I/O. Stability is the same, and pretty much have never opened a metro app. I'm not even sure how to use those correctly. The new Start Menu is just a very big start menu to me.

Anyway I digress, I needed to profile something and went with the usual suspects. CodeAnalyst, Got no data. AQTime, failed to launch the exe. Very Sleepy, worked but no hierarchical call graph. Tried to resurrect VSPTree with the VS2010 profiler and I got a driver not allowed error.

Oh well. Some digging around and I found Remote Tools for Visual Studio 2012.

So I took a little time and updated VSPTree to work with it, and added some minor usability updates. It's not the best application in the world, but sometimes it's handy just to have it.

VSPTree 0.5 : Now with Windows 8 64 bit support. Here.