Background Worker Wrapper (oldie but goodie)

Ran into a need to run a long running process in a Windows Application

Figured writing a wrapper class made calling it much easier

public class BackgroundWorkerWrapper

{

BackgroundWorker _worker;

public Action RunAction{get; set;}

public Action PostAction{get; set;}

public BackgroundWorkerWrapper(Action runAction = null, Action postAction = null)

{

RunAction = runAction;

PostAction = postAction;

_worker = new BackgroundWorker();

_worker.WorkerReportsProgress = true;

_worker.DoWork += _worker_DoWork;

_worker.RunWorkerCompleted += _worker_RunWorkerCompleted;

Run();

}

public void Run()

{

_worker.RunWorkerAsync();

}

void _worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)

{

PostAction.Invoke();

}

void _worker_DoWork(object sender, DoWorkEventArgs e)

{

RunAction.Invoke();

}

}

.

 

 

Share on Facebook

Visual Studio 2015 – An error occurred while signing: Failed to sign SignTool Error: No certificates were found that met all the given criteria.

Visual Studio 2015 – An error occurred while signing: Failed to sign SignTool Error: No certificates were found that met all the given criteria.

Create a pfx as you normally would with Sign the File:
2014-11-13_0117

2014-11-13_0121

 

 

 

Select From File:
2014-11-13_0121_001

 

 

Find your PFX, and open:
2014-11-13_0123

 

Rebuild:

2014-11-13_0123_001

Share on Facebook

Clear Canvas – No Plugins found

keywords: clearcanvas clear canvas no plugins found plugin errors can’t send 1.5

What a flippin nightmare. Days of lost work.
None of the “fixes” from the site work.

How to remove all Plugin calls from Clear canvas. (old version)
Search for all EnsurePluginsLoaded();

Return the default empty list.

Example :
public IList ExtensionPoints
{
get
{
//EnsurePluginsLoaded();
return new List();
}
}

Share on Facebook

TypeSwitch Pattern for generic Entity Framework Calls.


You can find the TypeSwitch code here :
http://blogs.msdn.com/b/jaredpar/archive/2008/05/16/switching-on-types.aspx

I found this useful rather than having to use wrapper classes or additional properties to switch on.
This was very well done and it seems to lend itself to base frameworks, navigation, replacement of IOC containers etc.

public static Container Entities = new Container(new Uri("SomeOdataIP"));

public static void Add<T>((T item)
{
TypeSwitch.Do(
typeof(T),
TypeSwitch.Case<Class1>(() => { Entities.AddToClass1s(item as Class1); }),
TypeSwitch.Case<Car>((() => { Entities.AddToCars(item as car); }),
TypeSwitch.Case<Tire>((() => { Entities.AddToTires(item as Tire); }),
TypeSwitch.Default(() =>
{
//Do Nothing
}));

Entities.BeginSaveChanges(null, null);

}

Share on Facebook

C# code for text messaging resolution

using ALineOfCode.Community.AugmentedLibraries.Common.Classes.SMS;
using System.Collections.Generic;

namespace ALineOfCode.Community.AugmentedLibraries.Common.Constants
{
//http://www.emailtextmessages.com/
public static class SMSCarrierInfoConstants
{
public static SMSCarrierInfo _3RiverWireless = new SMSCarrierInfo() { EmailAddress = “sms.3rivers.net”, Receiver = Enums.SMSReceivingCompany._3RiverWireless };
public static SMSCarrierInfo ACSWireless = new SMSCarrierInfo() { EmailAddress = “paging.acswireless.com”, Receiver = Enums.SMSReceivingCompany.ACSWireless };
public static SMSCarrierInfo Alltel = new SMSCarrierInfo() { EmailAddress = “message.alltel.com”, Receiver = Enums.SMSReceivingCompany.Alltel };
public static SMSCarrierInfo ATT = new SMSCarrierInfo() { EmailAddress = “txt.att.net”, Receiver = Enums.SMSReceivingCompany.ATT };
public static SMSCarrierInfo BellCanada = new SMSCarrierInfo() { EmailAddress = “txt.bellmobility.ca”, Receiver = Enums.SMSReceivingCompany.BellCanada };
public static SMSCarrierInfo BellMobility = new SMSCarrierInfo() { EmailAddress = “txt.bellmobility.ca”, Receiver = Enums.SMSReceivingCompany.BellMobility };
public static SMSCarrierInfo BellMobilityCanada = new SMSCarrierInfo() { EmailAddress = “txt.bell.ca”, Receiver = Enums.SMSReceivingCompany.BellMobilityCanada };
public static SMSCarrierInfo BlueGrassCellular = new SMSCarrierInfo() { EmailAddress = “sms.bluecell.com”, Receiver = Enums.SMSReceivingCompany.BlueGrassCellular };
public static SMSCarrierInfo BlueSkyFrog = new SMSCarrierInfo() { EmailAddress = “blueskyfrog.com”, Receiver = Enums.SMSReceivingCompany.BlueSkyFrog };
public static SMSCarrierInfo BoostMobile = new SMSCarrierInfo() { EmailAddress = “myboostmobile.com”, Receiver = Enums.SMSReceivingCompany.BoostMobile };
public static SMSCarrierInfo BPLMobile = new SMSCarrierInfo() { EmailAddress = “bplmobile.com”, Receiver = Enums.SMSReceivingCompany.BPLMobile };
public static SMSCarrierInfo CarolinaWestWireLess = new SMSCarrierInfo() { EmailAddress = “cwwsms.com”, Receiver = Enums.SMSReceivingCompany.CarolinaWestWireLess };
public static SMSCarrierInfo CellularOne = new SMSCarrierInfo() { EmailAddress = “mobile.celloneusa.com”, Receiver = Enums.SMSReceivingCompany.CellularOne };
public static SMSCarrierInfo CellularSouth = new SMSCarrierInfo() { EmailAddress = “csouth1.com”, Receiver = Enums.SMSReceivingCompany.CellularSouth };
public static SMSCarrierInfo CentennialWireless = new SMSCarrierInfo() { EmailAddress = “cwemail.com”, Receiver = Enums.SMSReceivingCompany.CentennialWireless };
public static SMSCarrierInfo CenturyTel = new SMSCarrierInfo() { EmailAddress = “messaging.centurytel.net”, Receiver = Enums.SMSReceivingCompany.CenturyTel };
public static SMSCarrierInfo Cingular = new SMSCarrierInfo() { EmailAddress = “txt.att.net “, Receiver = Enums.SMSReceivingCompany.Cingular };
public static SMSCarrierInfo Clearnet = new SMSCarrierInfo() { EmailAddress = “msg.clearnet.com”, Receiver = Enums.SMSReceivingCompany.Clearnet };
public static SMSCarrierInfo Comcast = new SMSCarrierInfo() { EmailAddress = “comcastpcs.textmsg.com”, Receiver = Enums.SMSReceivingCompany.Comcast };
public static SMSCarrierInfo CorrWirelessCommunications = new SMSCarrierInfo() { EmailAddress = “corrwireless.net”, Receiver = Enums.SMSReceivingCompany.CorrWirelessCommunications };
public static SMSCarrierInfo Dobson = new SMSCarrierInfo() { EmailAddress = “mobile.dobson.net”, Receiver = Enums.SMSReceivingCompany.Dobson };
public static SMSCarrierInfo EdgeWireless = new SMSCarrierInfo() { EmailAddress = “sms.edgewireless.com”, Receiver = Enums.SMSReceivingCompany.EdgeWireless };
public static SMSCarrierInfo Fido = new SMSCarrierInfo() { EmailAddress = “fido.ca”, Receiver = Enums.SMSReceivingCompany.Fido };
public static SMSCarrierInfo GoldenTelecom = new SMSCarrierInfo() { EmailAddress = “sms.goldentele.com”, Receiver = Enums.SMSReceivingCompany.GoldenTelecom };
public static SMSCarrierInfo Helio = new SMSCarrierInfo() { EmailAddress = “messaging.sprintpcs.com”, Receiver = Enums.SMSReceivingCompany.Helio };
public static SMSCarrierInfo HoustonCellular = new SMSCarrierInfo() { EmailAddress = “text.houstoncellular.net”, Receiver = Enums.SMSReceivingCompany.HoustonCellular };
public static SMSCarrierInfo IdeaCellular = new SMSCarrierInfo() { EmailAddress = “ideacellular.net”, Receiver = Enums.SMSReceivingCompany.IdeaCellular };
public static SMSCarrierInfo IllinoisValleyCellular = new SMSCarrierInfo() { EmailAddress = “ivctext.com”, Receiver = Enums.SMSReceivingCompany.IllinoisValleyCellular };
public static SMSCarrierInfo InlandCellularTelephone = new SMSCarrierInfo() { EmailAddress = “inlandlink.com”, Receiver = Enums.SMSReceivingCompany.InlandCellularTelephone };
public static SMSCarrierInfo MCI = new SMSCarrierInfo() { EmailAddress = “pagemci.com”, Receiver = Enums.SMSReceivingCompany.MCI };
public static SMSCarrierInfo Metrocall = new SMSCarrierInfo() { EmailAddress = “page.metrocall.com”, Receiver = Enums.SMSReceivingCompany.Metrocall };
public static SMSCarrierInfo Metrocall2Way = new SMSCarrierInfo() { EmailAddress = “my2way.com”, Receiver = Enums.SMSReceivingCompany.Metrocall2Way };
public static SMSCarrierInfo MetroPCS = new SMSCarrierInfo() { EmailAddress = “mymetropcs.com”, Receiver = Enums.SMSReceivingCompany.MetroPCS };
public static SMSCarrierInfo Microcell = new SMSCarrierInfo() { EmailAddress = “fido.ca”, Receiver = Enums.SMSReceivingCompany.Microcell };
public static SMSCarrierInfo MidwestWireless = new SMSCarrierInfo() { EmailAddress = “clearlydigital.com”, Receiver = Enums.SMSReceivingCompany.MidwestWireless };
public static SMSCarrierInfo MobilComm = new SMSCarrierInfo() { EmailAddress = “mobilecomm.net”, Receiver = Enums.SMSReceivingCompany.MobilComm };
public static SMSCarrierInfo MTS = new SMSCarrierInfo() { EmailAddress = “text.mtsmobility.com”, Receiver = Enums.SMSReceivingCompany.MTS };
public static SMSCarrierInfo Nextel = new SMSCarrierInfo() { EmailAddress = “messaging.nextel.com”, Receiver = Enums.SMSReceivingCompany.Nextel };
public static SMSCarrierInfo None = new SMSCarrierInfo();
public static SMSCarrierInfo OnlineBeep = new SMSCarrierInfo() { EmailAddress = “onlinebeep.net”, Receiver = Enums.SMSReceivingCompany.OnlineBeep };
public static SMSCarrierInfo PCSOne = new SMSCarrierInfo() { EmailAddress = “pcsone.net”, Receiver = Enums.SMSReceivingCompany.PCSOne };
public static SMSCarrierInfo PresidentsChoice = new SMSCarrierInfo() { EmailAddress = “TODO”, Receiver = Enums.SMSReceivingCompany.PresidentsChoice };
public static SMSCarrierInfo PublicCellularService = new SMSCarrierInfo() { EmailAddress = “TODO”, Receiver = Enums.SMSReceivingCompany.PublicCellularService };
public static SMSCarrierInfo Qwest = new SMSCarrierInfo() { EmailAddress = “qwestmp.com”, Receiver = Enums.SMSReceivingCompany.Qwest };
public static SMSCarrierInfo RogersATTWireless = new SMSCarrierInfo() { EmailAddress = “pcs.rogers.com”, Receiver = Enums.SMSReceivingCompany.RogersATTWireless };
public static SMSCarrierInfo RogersCanada = new SMSCarrierInfo() { EmailAddress = “pcs.rogers.com”, Receiver = Enums.SMSReceivingCompany.RogersCanada };
public static SMSCarrierInfo Satellink = new SMSCarrierInfo() { EmailAddress = “satellink.net”, Receiver = Enums.SMSReceivingCompany.Satellink };
public static SMSCarrierInfo SoloMobile = new SMSCarrierInfo() { EmailAddress = “txt.bell.ca”, Receiver = Enums.SMSReceivingCompany.SoloMobile };
public static SMSCarrierInfo SouthwesternBell = new SMSCarrierInfo() { EmailAddress = “”, Receiver = Enums.SMSReceivingCompany.SouthwesternBell };
public static SMSCarrierInfo Sprint = new SMSCarrierInfo() { EmailAddress = “messaging.sprintpcs.com”, Receiver = Enums.SMSReceivingCompany.Sprint };
public static SMSCarrierInfo Sumcom = new SMSCarrierInfo() { EmailAddress = “tms.suncom.com”, Receiver = Enums.SMSReceivingCompany.Sumcom };
public static SMSCarrierInfo SurewestCommunications = new SMSCarrierInfo() { EmailAddress = “mobile.surewest.com”, Receiver = Enums.SMSReceivingCompany.SurewestCommunications };
public static SMSCarrierInfo Telus = new SMSCarrierInfo() { EmailAddress = “msg.telus.com”, Receiver = Enums.SMSReceivingCompany.Telus };
public static SMSCarrierInfo TMobile = new SMSCarrierInfo() { EmailAddress = “tmomail.net”, Receiver = Enums.SMSReceivingCompany.TMobile };
public static SMSCarrierInfo Tracfone = new SMSCarrierInfo() { EmailAddress = “txt.att.net”, Receiver = Enums.SMSReceivingCompany.Tracfone };
public static SMSCarrierInfo Triton = new SMSCarrierInfo() { EmailAddress = “tms.suncom.com”, Receiver = Enums.SMSReceivingCompany.Triton };
public static SMSCarrierInfo Unicel = new SMSCarrierInfo() { EmailAddress = “utext.com”, Receiver = Enums.SMSReceivingCompany.Unicel };
public static SMSCarrierInfo USCellular = new SMSCarrierInfo() { EmailAddress = “email.uscc.net “, Receiver = Enums.SMSReceivingCompany.USCellular };
public static SMSCarrierInfo USWest = new SMSCarrierInfo() { EmailAddress = “uswestdatamail.com”, Receiver = Enums.SMSReceivingCompany.USWest };
public static SMSCarrierInfo Verizon = new SMSCarrierInfo() { EmailAddress = “vtext.com”, Receiver = Enums.SMSReceivingCompany.Verizon };
public static SMSCarrierInfo VirginMobile = new SMSCarrierInfo() { EmailAddress = “vmobl.com”, Receiver = Enums.SMSReceivingCompany.VirginMobile };
public static SMSCarrierInfo VirginMobileCanada = new SMSCarrierInfo() { EmailAddress = “vmobile.ca”, Receiver = Enums.SMSReceivingCompany.VirginMobileCanada };
public static SMSCarrierInfo WestCentralWireless = new SMSCarrierInfo() { EmailAddress = “sms.wcc.net”, Receiver = Enums.SMSReceivingCompany.WestCentralWireless };
public static SMSCarrierInfo WesternWireless = new SMSCarrierInfo() { EmailAddress = “cellularonewest.com”, Receiver = Enums.SMSReceivingCompany.WesternWireless };

public static List All()
{
return new List()
{
None,
_3RiverWireless,
ACSWireless,
Alltel,
ATT,
BellCanada,
BellMobilityCanada,
BellMobility,
BlueSkyFrog,
BlueGrassCellular,
BoostMobile,
BPLMobile,
CarolinaWestWireLess,
CellularOne,
CellularSouth,
CentennialWireless,
CenturyTel,
Cingular,
Clearnet,
Comcast,
CorrWirelessCommunications,
Dobson,
EdgeWireless,
Fido,
GoldenTelecom,
Helio,
HoustonCellular,
IdeaCellular,
IllinoisValleyCellular,
InlandCellularTelephone,
MCI,
Metrocall,
Metrocall2Way,
MetroPCS,
Microcell,
MidwestWireless,
MobilComm,
MTS,
Nextel,
OnlineBeep,
PCSOne,
PresidentsChoice,
PublicCellularService,
Qwest,
RogersATTWireless,
RogersCanada,
Satellink,
SoloMobile,
SouthwesternBell,
Sprint,
Sumcom,
SurewestCommunications,
TMobile,
Telus,
Tracfone,
Triton,
Unicel,
USCellular,
USWest,
Verizon,
VirginMobile,
VirginMobileCanada,
WestCentralWireless,
WesternWireless,
};
}
}
}

Share on Facebook

Fixing Pluralsight – Building Web Apps & Services with Entity Framework and Web API

keywords: Breeze, angular, pluralsight, webapi2, Unknown provider, unable to load module

Since this tutorial came out there have been some changes in Breeze and I noticed a few hundred blog entries trying to figure out the problems.

Unknown provider: breezeProvider <- breeze <- entityManagerFactory <- datacontext This is why the demo wont work. breeze.angular.q is gone and now you use breeze.angular Read John Papa here: John Papa’s Step by Step

Breeze Documentation

Share on Facebook

Basic Jasmine Runscript

describe(‘Test Jasmine Functionality…’, function () {
var jasmineUnitTest = ”;
// where you can do setup for test.
beforeEach(function () { jasminUnitTest = “hello” });
// where you can do cleanup for test
afterEach(function () { jasmineUnitTest = “”; });
it(‘Testing true..’, function () {
expect(true).toBeTruthy();
});
it(‘Testing proper addition..’, function () {
expect(1 + 1).toBe(2);
});
it(‘Testing not proper addition..’, function () {
expect(1 + 2).not.toBe(2);
});
it(‘Testing beforeEach set jasminUnitTest = hello’, function () {
expect(jasmineUnitTest).toBe(“hello”);
});
})

//Matchers
// use .not. for reverse
//toMatch(regex)

//toEqual = C# ==
//toBe = C# ===

//toBeLessThan = < //toBeGreaterThan = >

//toBeDefined()
//toBeUndefined()

//toBeNull()
//toBeTruthy() -> checks for true
//toBeFalsy() -> checks for false

//toContain() => contained within an array
//expect(funtion(){somemethod();}).toThrow(ex) uses callback to throw expection.

Share on Facebook

Ninject WebAPI Circular Reference

keywords, ninject, webapi 2, odata, circular reference.

If you installed Ninject MVC for 5 and 3 for some reason this doesn’t work, gives above error.  There are a ton of documented long drawn out fixes, but uninstalling both ninject for MVC5 and MVC3  then reinstalling Ninject  MVC3 fixed thew issue finally.

 

Hoping to save others time.

 

Mark

Share on Facebook

Cannot find angular.js

Keywords John Papa HotTowel can’t find angular.js

Been running down bugs on a few pluralsight tutorials.

WEBAPI with Jesse liberty, this leads into Hot Towel.  THe demo was great. I was just applying it towards a different set of data so sometimes I run into issues;

 

Fix: add src to angular.js

<script src=”scripts/angular.js”></script>

app.run([‘$route’, function ($route) {
breeze.core.extendQ($rootScope, $q);
routemediator.setRoutingHandlers();
// Include $route to kick start the router.
}]);

<link href=”content/breeze.directives.css” rel=”stylesheet” />

<script src=”scripts/breeze.debug.js”></script>
<script src=”scripts/breeze.angular.js”></script>
<script src=”scripts/angular.js”></script>
<script src=”scripts/breeze.saveErrorExtensions.js”></script>
<script src=”scripts/breeze.directives.js”></script>
<script src=”scripts/breeze.to$q.shim.js”></script> <!– Needed only if you are using to$q –>

Share on Facebook

WebRTC – Learning the ropes.

http://iswebrtcreadyyet.com/
webrtc

At this time the things I am really interested in are inj green and purple. Though not supported yet for Screen Sharing, the API and stream call are available with a plugin.

This will attempt to use STUN over TURN / ICE (TURN-STUN) but for free ;).


# source : http://code.google.com/p/natvpn/source/browse/trunk/stun_server_list
# A list of available STUN server.
stun.l.google.com:19302
stun1.l.google.com:19302
stun2.l.google.com:19302
stun3.l.google.com:19302
stun4.l.google.com:19302
stun01.sipphone.com
stun.ekiga.net
stun.fwdnet.net
stun.ideasip.com
stun.iptel.org
stun.rixtelecom.se
stun.schlund.de
stunserver.org
stun.softjoys.com
stun.voiparound.com
stun.voipbuster.com
stun.voipstunt.com
stun.voxgratia.org
stun.xten.com

view raw

stuns

hosted with ❤ by GitHub

List of public stun servers

SIMPLEWEBRTC is a very nice API I found listening to Lisa Larson-Kelley on Pluralsight. Found that the code was in place here:
http://simplewebrtc.com/demo.html

Open chrome, copy out HTML and JS.  Copy JS into a scripts file and reference it.

Change the latest.js to simplewebrtc.com/latest.js

Copy out the HTML and JS, Move JS into another file and reference, then make latest reference site like so:
(in HTML)

<script type=“text/javascript” src=“http://simplewebrtc.com/latest.js”></script>

<script type=“text/javascript” src=“~/Scripts/aloc-simplewebrtc.js”></script>

After that you should be good to go.
Here is a set of 3 instances al connected.

webrtc-multiclient-simplertcf

Share on Facebook