Bit Queue Launched!

Today I launched an extension for Twitch that allows streamers to perform queue management!
User
Bit Queue allows you to create queues for viewers to join, requiring custom fields and bits to join. Useful for creative talents, games or anything that is worth something to your fans when you’re in demand!

Many streamers lack a way to be compensated for their interaction with viewers. Bit Queue lets you close the gap between viewers and broadcaster by allowing them to join your queue and see their position. Joining can cost a flat out bit fee or if demand outweighs supply let them put their bits where their mouth is!
The bit queue lets you customize the queues in many ways including:
– Custom fields to satisfy the queue
– Restrict to followers or subscribers
– A cost to join the queue
– Allowing a bidding war over position
– A fast pass to the top of the queue

Be rewarded for your talents and fame.

Check it out at https://www.twitch.tv/ext/49qu7wv3myvul5fa7fxazo1bcsnc8j

Directory.Build.Targets (Solution wide MSBuild target – Part 2)

As an update to http://blog.seravy.com/solution-wide-msbuild-target/ I am happy to report that there is a far easier way to add in custom logic to all common project types in visual studio 2017/MSBuild 15.
As a result of the issue https://github.com/Microsoft/msbuild/issues/222 there in common.targets (and so most project types) will attempt to import the file Directory.Build.targets and/or Directory.Build.props in the same folder and traverse up until it hits the root drive. This means provided your solution is in a parent directory of all your project files it will load a Directory.Build.targets or/and Directory.Build.props in the same directory as it.

If you had multiple solutions and wanted to include specific logic for each of them you could use the $(SolutionPath) variable to put conditional logic.

See the example on github and run the solution from visual studio 2017 or run the batch file.
https://github.com/Serivy/Blog/tree/master/2016-12%20-%20Directory.Build.Targets


1>------ Rebuild All started: Project: ClassLibrary, Configuration: Debug Any CPU ------
2>------ Rebuild All started: Project: ConsoleApp, Configuration: Debug Any CPU ------
2> ConsoleApp -> C:\Users\Seravy\Desktop\Directory.Build.Example\ConsoleApp\bin\Debug\ConsoleApp.exe
2> Scope: Project. I performing an action per project from a solution include. C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0 C:\Users\Seravy\AppData\Local\Microsoft\MSBuild\15.0
1> ClassLibrary -> C:\Users\Seravy\Desktop\Directory.Build.Example\ClassLibrary\bin\Debug\ClassLibrary.dll
1> Scope: Project. I performing an action per project from a solution include. C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0 C:\Users\Seravy\AppData\Local\Microsoft\MSBuild\15.0
========== Rebuild All: 2 succeeded, 0 failed, 0 skipped ==========

MSBuild download file task

I had a need to download a file in MSBuild and didn’t want to assume any tools on the server. I coded together a simple task which lets you specify the URL to download, and optionally a file name or/and a output path. The goal was to keep it as small as possible, thus the bad formatting and non existent error checking.

<DownloadFile Url=”http://ftp.iinet.net.au/welcome.txt”  />
<DownloadFile Url=”http://ftp.iinet.net.au/welcome.txt” OutputFolder=”D:\” File=”awesome.txt” />

https://gist.github.com/Serivy/cbf2bc3eedeecedcb5cffc2fe3e4206d

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <UsingTask TaskName="DownloadFile" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v12.0.dll">
    <ParameterGroup>
      <Url ParameterType="System.String" Required="true" />
      <File ParameterType="System.String" Required="false" />
      <OutputFolder ParameterType="System.String" Required="false" />
    </ParameterGroup>
    <Task>
      <Using Namespace="System.Web"/>
      <Code Type="Fragment" Language="cs"><![CDATA[
        using (var client = new System.Net.WebClient())
            { client.DownloadFile(Url, (OutputFolder != null ? OutputFolder + "/" : "") + (File ?? System.IO.Path.GetFileName(new Uri(Url).LocalPath))); }
        ]]></Code>
    </Task>
  </UsingTask>
</Project>

JQuery Queue unleashed

If you need a good way to get queues in javascript/typescript, i have been playing around with jquery.queue. Its suppose to be for transitions and animations but has lately been opened up for whatever you want (sort of). I was looking at getting a third party queue because of my monstrosity in the check in process like http://benalman.com/code/projects/jquery-message-queuing/examples/ajax/ but i didn’t want to use a third party library. I decided to ignore the warnings of ‘its for animation only’ and see how i could use it.

// Queue can be stored in an empty object like this or any other element.
var queuedObject = $({});

// You may have a collection of many items, or a recursive call to deal with a number of items
// that you wish to proces in an orderly way.
var unknownArray = [‘one’, ‘two’, ‘three’, ‘four’];
$.each(unknownArray, (i, item) => {
// We can either queue them in loop/recursion or send the queued functions all through.
queuedObject.queue(“nameOfOperation”, (next: Function) => {
// Add the logic you want the queued item to do, this could include a deffered object.
alert(‘Message: ‘ + item);

// Calling the next function removes the item from the queue and kicks off the next one.
next();
});
});
// This starts the queue going. You can use queuedObject.clearQueue() or queuedObject.stop() to clear/pause during operation.
queuedObject.dequeue(“nameOfOperation”);

Restoring nuget packages on build servers or without Visual Studio

Nuget’s package restore is automated by the visual studio extension but what about when msbuild.exe runs against the .sln? When you execute the build without the packages you will end up with errors:

warning MSB3245: Could not resolve this reference. Could not locate the assembly

Fortunately we can create a file called ‘after.<SolutionName>.sln.targets’ replacing <SolutionName> with your soltion and putting it in in the folder with the solution and Nuget.exe.

Put the follow contents:

<?xml version=”1.0″ encoding=”utf-8″?>
<Project ToolsVersion=”14.0″ xmlns=”http://schemas.microsoft.com/developer/msbuild/2003″>
<Target Name=”RestoreNuget” BeforeTargets=”Build”>
<Exec Command=”&quot;Nuget.exe&quot; restore &quot;$(SolutionPath)&quot;” WorkingDirectory=”$(MSBuildProjectDirectory)”/>
</Target>
</Project>

Now when you run msbuild.exe ExampleApplication.sln

RestoreNuget:
“Nuget.exe” restore “C:\Dev\Repos\Blog\2015-11 – Solution Package Restore\ExampleApplication.sln”
Installing ‘Microsoft.Web.Xdt 2.1.1’.
Successfully installed ‘Microsoft.Web.Xdt 2.1.1’.
Installing ‘NuGet.Core 2.9.0’.
Successfully installed ‘NuGet.Core 2.9.0’.

You can also do things like Upgrade with the -safe flag for continuous integration situations. You can see the example of this on GitHub:

TFS 2008 SP1 Upgrade Part 2 – Error TF30059: Fatal error while initializing web service from server

The night after my first failed upgrade I kicked off another attempt.
This time I was to install Service Pack 1 for Visual Studio 2008 before installing the service pack for Team Foundation Server. A few problems I came across:

Continue reading TFS 2008 SP1 Upgrade Part 2 – Error TF30059: Fatal error while initializing web service from server

TFS 2008 SP1 Upgrade – The server returned content type , which is not supported

It’s 1AM, you’ve just completed a TFS 2008 upgrade to SP 1 and for a test you just performed a ‘Get Latest’ on a project tree.

Error!

‘The server returned content type , which is not supported’

Well, that doesn’t sound good. Skim reading TFSInstall-SP1-RTM-v080908.chm shows nothing about this. Just before pressing the panic button you do one last thing. Google it.

Thankfully I came across a post to a problem which is both similar and different on the MSDN Fourms.

Continue reading TFS 2008 SP1 Upgrade – The server returned content type , which is not supported