Skip to content

Instantly share code, notes, and snippets.

View cpoDesign's full-sized avatar

Pavel cpoDesign

View GitHub Profile
@cpoDesign
cpoDesign / v
Created April 4, 2016 16:14
vzaar video player example
<html>
<body>
<script src="https://code.jquery.com/jquery-1.12.2.min.js" integrity="sha256-lZFHibXzMHo3GGeehn1hudTAP3Sc0uKXBXAzHX1sjtk=" crossorigin="anonymous"></script>
<script>
function populateVideoElement(videoId) {
var dynamicName = 'vzvd-' + videoId;
var link = "https://view.vzaar.com/"+videoId +"/player";
@cpoDesign
cpoDesign / dynamicIframe.html
Last active April 3, 2016 20:43
example of generating iframe
<html>
<body>
<button onclick="pgen(1)" >open 1 </button>
<div id="gen">
demo
</div>
<script src="https://code.jquery.com/jquery-1.12.2.min.js" integrity="sha256-lZFHibXzMHo3GGeehn1hudTAP3Sc0uKXBXAzHX1sjtk=" crossorigin="anonymous"></script>
<script>
@cpoDesign
cpoDesign / FileHelpers.cs
Created March 29, 2016 16:31
Implementation of XmlSchema Validator
using System;
using System.IO;
using System.Reflection;
namespace XmlSchemaValidator.FileUtility
{
public class FileHelpers
{
public static string AssemblyDirectory
{
@cpoDesign
cpoDesign / video_player.html
Last active March 23, 2016 09:04
Example how to play video in html5
<html>
<body>
<video width="320" height="240" controls id="vieoEl" autoplay>
<source src="video.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
<button onclick="setVideoSource()" >Update videSource </button>
<script>
@cpoDesign
cpoDesign / buildError.log
Created March 21, 2016 16:58
TFS Errors workspace does not exists
D:\Builds\01\src\External\Newtonsoft.Json.5.0.8\lib\net45\Newtonsoft.Json.xml: TF14061: The workspace 01_TFS-BUILD01;TFS_BuildService does not exist.
Exception Message: TF14061: The workspace 01_TFS-BUILD01;TFS_BuildService does not exist. (type WorkspaceNotFoundException)
Exception Stack Trace:
Server stack trace:
at Microsoft.TeamFoundation.Client.Channels.TfsHttpClientBase.HandleReply(TfsClientOperation operation, TfsMessage message, Object[]& outputs)
at Microsoft.TeamFoundation.Client.Channels.TfsHttpClientBase.Invoke(TfsClientOperation operation, Object[] parameters, Object[]& outputs)
at Microsoft.TeamFoundation.Client.Channels.TfsHttpClientBase.Invoke(TfsClientOperation operation, Object[] parameters)
at Microsoft.TeamFoundation.VersionControl.Client.Repository5.UpdateLocalVersion(String workspaceName, String ownerName, ServerItemLocalVersionUpdate[] updates, Int32 maxClientPathLength)
at Microsoft.TeamFoundation.VersionControl.Client.WebServiceLayer.UpdateLocalVersion(String workspa
@cpoDesign
cpoDesign / stopAndUninstallService.nsi
Last active November 17, 2021 17:27
Example of stopping and uninstalling service using nsis
!define APPNAME "App Name"
!define COMPANYNAME "Company Name"
!define DESCRIPTION "A short description goes here"
# These three must be integers
!define VERSIONMAJOR 1
!define VERSIONMINOR 1
!define VERSIONBUILD 1
# These will be displayed by the "Click here for support information" link in "Add/Remove Programs"
# It is possible to use "mailto:" links in here to open the email client
!define HELPURL "http://..." # "Support Information" link
@cpoDesign
cpoDesign / Model.cs
Created March 14, 2016 08:15
Model binding to the partial view
public class ExamResultsFormViewModel
{
public PreliminaryInformationViewModel PreliminaryInformation { get; set; }
public string MemberID { get; set; }
public string MemberName { get; set; }
public int PatientID { get; set; }
@cpoDesign
cpoDesign / example.cs
Last active March 11, 2016 21:03
Get User details from active directory
using (var context = new PrincipalContext(ContextType.Domain, "spacenation"))
{
using (var searcher = new PrincipalSearcher(new UserPrincipal(context)))
{
foreach (var result in searcher.FindAll().Where(x => x.SamAccountName.Contains("UserName")))
{
DirectoryEntry de = result.GetUnderlyingObject() as DirectoryEntry;
Console.WriteLine("First Name: " + de.Properties["givenName"].Value);
Console.WriteLine("Last Name : " + de.Properties["sn"].Value);
Console.WriteLine("User principal name: " + de.Properties["userPrincipalName"].Value);
@cpoDesign
cpoDesign / DemoController_v4.cs
Created February 17, 2016 23:42
Example of implementation of @Html.DropDownListFor
public class DemoController : Controller
{
public ActionResult Index()
{
var model = new DemoModel();
model.Items = new List<SelectListItem>()
{
new SelectListItem()
{
Text = "one",
@cpoDesign
cpoDesign / storedProcWithReturnValue.vb
Created February 3, 2016 10:03
example to read return value from sp and output value in vb
Dim returnValue As String = ""
Try
Using tmsCommand As New SqlCommand("dbo.getUserXml", _tmsConnection)
If _tmsConnection.State = ConnectionState.Closed Then _tmsConnection.Open()
tmsCommand.CommandType = CommandType.StoredProcedure
tmsCommand.Parameters.Add(New SqlParameter("@UserId", SqlDbType.Int, ParameterDirection.Input)).Value = userID
tmsCommand.Parameters.Add(New SqlParameter("@UserXml", SqlDbType.Xml, 1)).Direction = ParameterDirection.Output
Dim returnSpValue = New SqlParameter("@ReturnVal", SqlDbType.Int)
tmsCommand.Parameters.Add(returnSpValue).Direction = ParameterDirection.ReturnValue
tmsCommand.ExecuteNonQuery()