This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Viterbi algorithm for finding hidden relationships | |
function Viterbi(data) { | |
var V = [{}]; | |
var path = {}; | |
// Initialize base cases (t == 0) | |
for(var i=0;i<data.states.length;i++) { | |
var state = data.states[i]; | |
V[0][state] = data.start_probability[state] * data.emission_probability[state][data.observations[0]]; | |
path[state] = [state]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Original code found at: | |
https://code.google.com/p/android-stocker/source/browse/trunk/src/com/twofuse/stocker/Rotate3dAnimation.java?r=2 | |
Use (in set): | |
Rotate3dAnimation skew = new Rotate3dAnimation(20, 0, 0, 0, 0, 0); | |
set.addAnimation(skew); | |
animation = new TranslateAnimation(0, 0, 0, 0, Animation.RELATIVE_TO_SELF, 0.5f, 0, 0); | |
set.addAnimation(animation); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Represents an edge from source to sink with capacity | |
var Edge = function(source, sink, capacity) { | |
this.source = source; | |
this.sink = sink; | |
this.capacity = capacity; | |
}; | |
// Main class to manage the network | |
var Graph = function() { | |
this.edges = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.fn.noisy = function(opacity) { | |
if (typeof(opacity) === 'undefined') { | |
opacity = 0.1; | |
} | |
var wrapper = jQuery(this).wrapInner('<div />').children(); | |
var canvas = document.createElement("canvas"); | |
canvas.width = 100; | |
canvas.height = 100; | |
var ctx = canvas.getContext("2d"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Represents an edge from source to sink with capacity | |
var Edge = function(source, sink, capacity) { | |
this.source = source; | |
this.sink = sink; | |
this.capacity = capacity; | |
this.reverseEdge = null; | |
this.flow = 0; | |
}; | |
// Main class to manage the network |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.HashMap; | |
import java.util.Iterator; | |
import java.util.Map; | |
import android.content.ContentValues; | |
import android.content.Context; | |
import android.database.Cursor; | |
import android.database.SQLException; | |
import android.database.sqlite.SQLiteDatabase; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<android.support.v4.widget.DrawerLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:id="@+id/drawer_layout" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<FrameLayout | |
android:id="@+id/content_frame" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:layout_marginLeft="@dimen/drawer_content_padding"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DummyFragment extends Fragment { | |
private UpdateHandler handler; | |
private Timer timer; | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
handler = new UpdateHandler(this); | |
super.onCreate(savedInstanceState); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Example: | |
* new ListLoader(listView).execute(new Select().from(TestEntity.class)); | |
*/ | |
import java.lang.ref.WeakReference; | |
import java.util.List; | |
import android.os.AsyncTask; | |
import android.widget.ListView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns list.handler | |
(:use compojure.core | |
ring.adapter.jetty | |
[net.cgrand.enlive-html :as html]) | |
(:require [compojure.handler :as handler] | |
[compojure.route :as route]) | |
(:gen-class)) | |
(defmacro maybe-substitute | |
([expr] `(if-let [x# ~expr] (html/substitute x#) identity)) |
NewerOlder