Format:
Recent snippets for: Rick Strahl
FUNCTION GetCollectionFromUrlEncodedValues(lcVars,lcPrefix) LOCAL loVars, lnX, lnAt, lcPoint,lnEqual,lcKey, lcValue loVars = CREATEOBJECT("wwNameValueCollection") IF EMPTY(lcPrefix) lcPrefix = "" ENDIF lcPointer = "&"+lcVars
10 Views
no comments
/// <summary> /// This method is used to write out attribute values using /// some funky nested tuple storage. /// /// Handles situations like href="@Model.Entry.Id" /// /// This call comes in from the Razor runtime parser /// </summary> /// <param name="attr"></param> /// <param name="tokens"></param>
193 Views
no comments
<html> <head> <link href="scripts/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <link href="Css/Reset.css" rel="stylesheet" type="text/css" /> <link href="Css/Standard.css" rel="stylesheet" type="text/css" /> <link href="Css/Classifieds.less.css" rel="stylesheet" type="text/css" />
35 Views
no comments
public static class NetworkUtils
{
/// <summary>
/// Retrieves a base domain name from a full domain name.
/// For example: www.west-wind.com produces west-wind.com
/// </summary>
/// <param name="domainName">Dns Domain name as a string</param>
/// <returns></returns>
public static string GetBaseDomain(string domainName)
209 Views
no comments
// Predicate Builder code // Produces match only on LAST match - INCORRECT var predicate = PredicateBuilder.False<Entry>(); foreach (string phrase in searchPhrases) { predicate = predicate.Or(ent => (ent.Title.Contains(phrase) || ent.Keywords.Contains(phrase) || ent.Description.Contains(phrase))); } entries = entries.AsExpandable().Where(predicate);
59 Views
no comments
if (searchPhrases.Count() > 0) { var whereParms = new List<string>(); StringBuilder sb = new StringBuilder(); int counter = 0; foreach (string phrase in searchPhrases) { string num = counter.ToString(); sb.Append("title.Contains(@" + num + ") || " +
224 Views
no comments
// search all search phrases foreach(string phrase in searchPhrases) { if (parms.SearchDescription) entries = entries.Where(ent => (ent.Keywords.Contains(phrase) || ent.Title.Contains(phrase) || ent.Description.Contains(phrase)) ); else entries = entries.Where(ent => (ent.Keywords.Contains(phrase) || ent.Title.Contains(phrase) ) ); }
206 Views
1 comments
/// <summary> /// This method is used to write out attribute values using /// some funky nested tuple storage. /// /// Handles situations like href="@Model.Entry.Id" /// /// This call comes in from the Razor runtime parser /// </summary> /// <param name="attr"></param> /// <param name="tokens"></param>
221 Views
no comments
void Main()
{
Environment.Version.ToString().Dump();
Environment.Version.Build.Dump();
Environment.Version.Revision.Dump();
Environment.Version.Major.Dump();
IsDotNet45().Dump();
}
158 Views
no comments
-- generated from Context.ReportedAbuses.Where(ab => ab.EntryId == entryId).Count() > 0; exec sp_executesql N'SELECT [GroupBy1].[A1] AS [C1] FROM ( SELECT COUNT(1) AS [A1] FROM [dbo].[ReportedAbuses] AS [Extent1] WHERE [Extent1].[EntryId] = @p__linq__0 ) AS [GroupBy1]',N'@p__linq__0 int',@p__linq__0=3
239 Views
1 comments
using System; using System.IO; using System.Net; using System.Net.Http.Formatting; using System.Net.Http.Headers; using System.Threading.Tasks; using System.Web; namespace Thinktecture.Web.Http.Formatters {
63 Views
no comments
// this will never get called with JSON/XML content body // parameter works from route or query string but not complete content public string ReturnString(string message) { return message; } // Using [FromBody] is required to make this work public string ReturnString([FromBody] string message) {
156 Views
no comments
// JavaScript Code $().ready(function () { ajaxCallMethod("CallbackHandler.ashx?", "GetDate", [{ Name: "Rick", Entered: new Date(2012,0,1) }], function (result) { alert(result); }); ajaxCallMethod("CallbackHandler.ashx?", "GetDate",
104 Views
no comments
ajaxCallMethod("CallbackHandler.ashx?", "Test", [{ Entered: "03/15/2010", Name: "Rick"}], function (result) { alert(result); }); ajaxCallMethod("CallbackHandler.ashx?", "Test", [{ Entered: new Date(2010,2,15), Name: "Rick"}], function (result) { alert(result); });
57 Views
no comments
using System; using System.Net.Http.Formatting; using System.Threading.Tasks; using System.Web.Script.Serialization; using System.Json; using System.IO; namespace Westwind.Web.WebApi { public class JavaScriptSerializerFormatter : MediaTypeFormatter
378 Views
no comments
var reader = new StreamReader(HttpContext.Current.Server.MapPath("~/symbollist.txt")); string current = string.Empty; while(current != null) { current = reader.ReadLine(); if (current == null) continue; var tokens = current.Split(',');
59 Views
no comments
@model ClassifiedsWeb.EntryViewModel
@{
ViewBag.Title = "New Message"
}
...
<div class="fieldarea">
<!-- this always renders 'New Message' rather than
Model.Entry.Title -->
308 Views
no comments
<div id="PostItemContainer" style="height: 300px;overflow-y: scroll;"> @{ int catId = -1; foreach (var entry in Model) { if (catId != entry.Category.Id) { <div class="listcategoryheader">@entry.Category.Name</div> <text><div class="listcategorycontent"></text> }
316 Views
no comments
// this code requires a reference to JSON.NET in your project #if true using System; using System.Net.Http.Formatting; using System.Threading.Tasks; using System.Web.Script.Serialization; using System.Json; using Newtonsoft.Json; using System.IO;
669 Views
no comments
using System; using System.Collections.Generic; using System.Linq; using System.Dynamic; using System.Reflection; using System.Collections; namespace Westwind.Utilities.Dynamic { /// <summary>
569 Views
2 comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
