Initial import
brought over all the files from the Jekyll version, fixed categories, reformatted for different markdown processor
This commit is contained in:
79
source/_posts/2014/a-handy-c-sharp-async-utility-method.md
Normal file
79
source/_posts/2014/a-handy-c-sharp-async-utility-method.md
Normal file
@@ -0,0 +1,79 @@
|
||||
---
|
||||
layout: post
|
||||
title: A Handy C# Async Utility Method
|
||||
author: Daniel
|
||||
date: 2014-08-04 19:48:43
|
||||
categories:
|
||||
- [ Programming, .NET, C# ]
|
||||
tags:
|
||||
- asynchronous
|
||||
- c#
|
||||
- utility
|
||||
summary: Using async when you can't use async
|
||||
---
|
||||
|
||||
In the course of writing C# code utilizing the new (for 4.5.1) [Task-based asynchronous programming][async], I've run across a couple of places where the `await` keyword either is not allowed (a catch block or a property accessor) or the `async` keyword greatly complicates the syntax (lambda expressions). I've found myself writing this method for two different projects, and so I thought I would drop this Q&D, more-comments-than-code utility method here for others to use if you see the need.
|
||||
|
||||
_(UPDATE: This works well in console applications; it can cause deadlocks in desktop and web apps. Test before you rely on it.)_
|
||||
|
||||
{% codeblock lang:csharp %}
|
||||
/// <summary>
|
||||
/// Get the result of a task in contexts where the "await" keyword may be prohibited
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The return type for the task</typeparam>
|
||||
/// <param name="task">The task to be awaited</param>
|
||||
/// <returns>The result of the task</returns>
|
||||
public static T TaskResult<T>(Task<T> task)
|
||||
{
|
||||
Task.WaitAll(task);
|
||||
return task.Result;
|
||||
}
|
||||
{% endcodeblock %}
|
||||
|
||||
And, in places where you can't do something like this...
|
||||
|
||||
{% codeblock ExampleClass.cs lang:csharp %}
|
||||
/// <summary>
|
||||
/// A horribly contrived example class
|
||||
/// </summary>
|
||||
/// <remarks>Don't ever structure your POCOs this way, unless EF is handling the navigation properties</remarks>
|
||||
public class ExampleClass
|
||||
{
|
||||
/// <summary>
|
||||
/// A contrived ID to a dependent entity
|
||||
/// </summary>
|
||||
public int ForeignKeyID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The contrived dependent entity
|
||||
/// </summary>
|
||||
public DependentEntity DependentEntity
|
||||
{
|
||||
get
|
||||
{
|
||||
// Does not compile; can't use await without async, can't mark a property as async
|
||||
return await Data.DependentEntities
|
||||
.FirstOrDefaultAsync(entity => entity.ID == ForeignKeyID);
|
||||
}
|
||||
}
|
||||
}
|
||||
{% endcodeblock %}
|
||||
|
||||
...you can instead do this in that "DependentEntity" property...
|
||||
|
||||
{% codeblock lang:csharp %}
|
||||
/// <summary>
|
||||
/// The contrived dependent entity
|
||||
/// </summary>
|
||||
public DependentEntity DependentEntity
|
||||
{
|
||||
get
|
||||
{
|
||||
return UtilClass.TaskResult<DependentEntity>(Data.DependentEntities
|
||||
.FirstOrDefaultAsync(entity => entity.ID == ForeignKeyID));
|
||||
}
|
||||
}
|
||||
{% endcodeblock %}
|
||||
|
||||
|
||||
[async]: //msdn.microsoft.com/EN-US/library/vstudio/hh191443(v=vs.110).aspx "Asynchronous Programming with Async and Await - MSDN"
|
||||
28
source/_posts/2014/gxine-0-5-908-rpm.md
Normal file
28
source/_posts/2014/gxine-0-5-908-rpm.md
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
layout: post
|
||||
title: gxine 0.5.908 RPM
|
||||
author: Daniel
|
||||
date: 2014-08-24 19:37:37
|
||||
categories:
|
||||
- [ Hosted 64-bit Software, xine RPMs ]
|
||||
tags:
|
||||
- gxine
|
||||
- rpm
|
||||
- xine-lib
|
||||
---
|
||||
|
||||
Below are the RPMs for gxine version 0.5.908. See [About the xine RPMs][abt] for information on how these were built.
|
||||
|
||||
[gxine][] - The main gxine program
|
||||
[gxineplugin][] - Browser plugin library for gxine
|
||||
|
||||
To use this, you'll also need xine-lib - as of this release, the most recent release of [xine-lib is 1.2.6][lib]. The latest [xine-lib 1.1 is 1.1.21][lib1].
|
||||
|
||||
(To save disk space, only the current release and two prior releases will be maintained.)
|
||||
|
||||
|
||||
[abt]: /2005/about-the-xine-rpms.html "About the xine RPMs • DJS Consulting Tech Blog"
|
||||
[gxine]: //hosted.djs-consulting.com/software/xine/gxine/gxine-0.5.908-2.x86_64.rpm
|
||||
[gxineplugin]: //hosted.djs-consulting.com/software/xine/gxine/gxineplugin-0.5.908-2.x86_64.rpm
|
||||
[lib]: /2014/xine-lib-1-2-6-rpm.html
|
||||
[lib1]: /2012/xine-lib-1-1-21-rpm.html
|
||||
31
source/_posts/2014/xine-lib-1-2-6-rpm.md
Normal file
31
source/_posts/2014/xine-lib-1-2-6-rpm.md
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
layout: post
|
||||
title: xine-lib 1.2.6 RPM
|
||||
author: Daniel
|
||||
date: 2014-08-24 19:33:28
|
||||
categories:
|
||||
- [ Hosted 64-bit Software, xine RPMs ]
|
||||
tags:
|
||||
- gxine
|
||||
- rpm
|
||||
- xine-lib
|
||||
- xine-ui
|
||||
---
|
||||
|
||||
Below are the library and development RPMs for xine-lib version 1.2.6. Be sure to check out the [About the xine RPMs][abt] post for information on how these were built.
|
||||
|
||||
[xine-lib][] - The main xine library
|
||||
[xine-lib-dev][] - The development xine library (needed if you're building an interface against xine-lib)
|
||||
[xine-lib-doc][] - Documentation
|
||||
|
||||
You'll also need a user interface - as of this release, the most current release of [xine-ui is 0.99.9][ui], and the most current release of [gxine is 0.5.908][gxine].
|
||||
|
||||
(To save disk space, only the current release and two prior releases in the 1.2-series will be maintained.)
|
||||
|
||||
|
||||
[abt]: /2005/about-the-xine-rpms.html "About the xine RPMs • DJS Consulting Tech Blog"
|
||||
[xine-lib]: //hosted.djs-consulting.com/software/xine/xine-lib/libxine2-1.2.6-2.x86_64.rpm
|
||||
[xine-lib-dev]: //hosted.djs-consulting.com/software/xine/xine-lib/libxine2-dev-1.2.6-2.x86_64.rpm
|
||||
[xine-lib-doc]: //hosted.djs-consulting.com/software/xine/xine-lib/libxine2-doc-1.2.6-2.noarch.rpm
|
||||
[ui]: /2014/xine-ui-0-99-9-rpm.html "xine-ui 0.99.9 RPM • DJS Consulting Tech Blog"
|
||||
[gxine]: /2014/gxine-0-5-908-rpm.html "gxine 0.5.908 RPM • DJS Consulting Tech Blog"
|
||||
25
source/_posts/2014/xine-ui-0-99-8-rpm.md
Normal file
25
source/_posts/2014/xine-ui-0-99-8-rpm.md
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
layout: post
|
||||
title: xine-ui 0.99.8 RPM
|
||||
author: Daniel
|
||||
date: 2014-02-26 05:42:19
|
||||
categories:
|
||||
- [ Hosted 64-bit Software, xine RPMs ]
|
||||
tags:
|
||||
- rpm
|
||||
- xine-ui
|
||||
---
|
||||
|
||||
Below is the RPM for xine-ui version 0.99.8. See the [About the xine RPMs][abt] post for information on how this RPM was built.
|
||||
|
||||
[xine-ui][] - The user interface
|
||||
|
||||
To use this, you'll also need xine-lib - as of this release, the most recent release of [xine-lib is 1.1.21][lib].
|
||||
|
||||
(To save disk space, only the current release and two [prior releases][pri] will be maintained.)
|
||||
|
||||
|
||||
[abt]: /2005/about-the-xine-rpms.html "About the xine RPMs • DJS Consulting Tech Blog"
|
||||
[xine-ui]: //hosted.djs-consulting.com/software/xine/xine-ui/xine-ui-0.99.8-2.x86_64.rpm
|
||||
[lib]: /2012/xine-lib-1-1-21-rpm.html
|
||||
[pri]: /2012/xine-ui-0-99-7-rpm.html
|
||||
26
source/_posts/2014/xine-ui-0-99-9-rpm.md
Normal file
26
source/_posts/2014/xine-ui-0-99-9-rpm.md
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
layout: post
|
||||
title: xine-ui 0.99.9 RPM
|
||||
author: Daniel
|
||||
date: 2014-08-24 19:24:14
|
||||
categories:
|
||||
- [ Hosted 64-bit Software, xine RPMs ]
|
||||
tags:
|
||||
- rpm
|
||||
- xine-ui
|
||||
---
|
||||
|
||||
Below is the RPM for xine-ui version 0.99.9. See the [About the xine RPMs][abt] post for information on how this RPM was built.
|
||||
|
||||
[xine-ui][] — The user interface
|
||||
|
||||
To use this, you'll also need xine-lib - as of this release, the most recent release of [xine-lib is 1.2.6][lib]. The latest [xine-lib 1.1 is 1.1.21][lib1].
|
||||
|
||||
(To save disk space, only the current release and two [prior releases][pri] will be maintained.)
|
||||
|
||||
|
||||
[abt]: /2005/about-the-xine-rpms.html "About the xine RPMs • DJS Consulting Tech Blog"
|
||||
[xine-ui]: //hosted.djs-consulting.com/software/xine/xine-ui/xine-ui-0.99.9-2.x86_64.rpm
|
||||
[lib]: /2014/xine-lib-1-2-6-rpm.html
|
||||
[lib1]: /2012/xine-lib-1-1-21-rpm.html
|
||||
[pri]: /2014/xine-ui-0-99-8-rpm.html "xine-lib 0.99.8 RPM • DJS Consulting Tech Blog"
|
||||
Reference in New Issue
Block a user