Skip to content

Instantly share code, notes, and snippets.

@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.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 / gist:69dc9eaa1e254080833c
Created August 2, 2014 15:05
Save Case Class as TSV On Spark
implicit class ProductRDD[T <: Product](rdd: RDD[T]) {
/* Saves a RDD of Tuples into a TSV.
* Ex: Employee(emp_id = 123, Name(first="Bob",last="Smith")) => "123\tBob\tSmith"
*/
def saveAsTsv(path: String) {
rdd.map(p => p.productIterator.flatMap {
case a: Product => a.productIterator //flattens nested case classes
case b => Seq(b)
}.mkString("\t"))
@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;