Skip to content

Instantly share code, notes, and snippets.

@mlehman
mlehman / Fluent.ListBoxValidator.aspx
Created April 22, 2010 22:26
Fluent.ListBoxValidator Example
<%@ Register TagPrefix="fluent" Namespace="Fluent" Assembly="Fluent.ListBoxValidator" %>
...
<asp:ListBox ID="ListBoxEmployees" SelectionMode="Multiple" Runat="server"/>
<fluent:ListBoxValidator
ID="ListBoxValidator1"
Runat="server"
ControlToValidate="ListBoxEmployees"
ErrorMessage="Please select an employee"
@mlehman
mlehman / Fluent.ControlFocus.aspx
Created April 22, 2010 22:31
Fluent.ControlFocus Example
<%@ Register TagPrefix="fluent" Namespace="Fluent.ControlFocus" Assembly="Fluent.ControlFocus" %>
...
<asp:TextBox runat="server" ID="FirstTextBox" /><br/>
<%-- the control below, SecondTextBox, will be focused on page load --%>
<asp:TextBox runat="server" ID="SecondTextBox" />
<fluent:ControlFocus runat="server" Control="SecondTextBox" />
@mlehman
mlehman / Fluent.DataGridAdapter.aspx
Created April 22, 2010 22:53
Fluent.DataGridAdapter Example
<%@ Register TagPrefix="fluent" Namespace="Fluent"
Assembly="Fluent.DataGridAdapter" %>
<html>
<head>
<script language="C#" runat="server">
protected void DataGridAdapter1_DataGridBinding(
DataGridAdapter sender, DataGridBindingEventArgs e) {
SqlDataAccessCommand command;
@mlehman
mlehman / Fluent.ListTransfer.aspx
Created April 22, 2010 22:57
Fluent.ListTransfer Example
<%@ Register TagPrefix="fluent" Namespace="Fluent" Assembly="Fluent.ListTransfer" %>
...
<fluent:ListTransfer Runat="server" ID="ListTransferEmployees"
ListControlTo="ListBoxProjectMembers"
ListControlFrom="ListBoxEmployees"
EnableClientSide="True"
>
<asp:ListBox ID="ListBoxEmployees" Runat="server"
SelectionMode="Multiple"
@mlehman
mlehman / Fluent.LogicTemplates.aspx
Created April 22, 2010 22:59
Fluent.LogicTemplates Example
<%@ Register TagPrefix="fluent" Namespace="Fluent.LogicTemplates" Assembly="Fluent.LogicTemplates" %>
<html>
<head>
<script language="C#" runat="server">
private void Page_Load(object sender, System.EventArgs e) {
if(!IsPostBack){
BindDataList();
}
}
TocClient tc = new TocClient();
tc.SignOn("myscreenname","password");
tc.Send("mybuddy","Hello!");
tc.SignOff();
TocClient tc = new TocClient();
tc.Message += new MessageEventHandler(OnMessage);
tc.SignOn("myscreenname","password");
tc.StartListening();
...
protected void OnMessage(object sender, MessageEventArgs e){
WriteLine("{0}: {1}",e.From, e.Message);
}
(def my-credentials
(struct credentials "my-token" "my-client-name"))
(get-users my-credentials)
(get-projects my-credentials)
(get-tags my-credentials)
(get-entries my-credentials)
(get-entries my-credentials
{:to "iso-date-string" :from "iso-date-string"})
;; Embedded Solr Example
(def server (create-solr-server
{:type :embedded :core "mycore" :dir "/home-path"}))
;; Http Solr Example
(def server (create-solr-server
{:type :http :host "localhost"}))
;; Adding Documents
(add server {:title "Don Quixote"
@mlehman
mlehman / gist:8772354
Last active August 29, 2015 13:55
Secondary Sort in Avro using Pair
import org.apache.avro.Schema;
import org.apache.avro.io.BinaryData;
import org.apache.avro.mapred.AvroKey;
import org.apache.avro.mapred.Pair;
import org.apache.avro.mapreduce.AvroJob;
import org.apache.avro.reflect.ReflectData;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.io.RawComparator;