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
//add compile 'net.ypresto.qtfaststartjava:qtfaststart:0.1.0' to build.gradle | |
String videoFileNameWithoutExtension = com.google.common.io.Files.getNameWithoutExtension(path2OutputFile); | |
File outputFile = new File(path2OutputFile); // Your outputFile file | |
String pathToParent = outputFile.getParent(); | |
Path noStreamOutputFile = Paths.get(pathToParent, videoFileNameWithoutExtension + "_nostream.mp4"); | |
Files.move(outputFile.toPath(), noStreamOutputFile); | |
try { | |
QtFastStart.fastStart(new File(noStreamOutputFile.toString()), outputFile); |
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
Tree prefixTree = new Tree(); | |
prefixTree.AddWord("abc"); | |
prefixTree.AddWord("abcd"); | |
prefixTree.AddWord("abcde"); | |
prefixTree.AddWord("abcdef"); | |
prefixTree.AddWord("ab123cd"); | |
prefixTree.AddWord("abc123d"); | |
prefixTree.AddWord("abc132d"); | |
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
/// <summary> | |
/// get the autocomplete matches given the input | |
/// </summary> | |
/// <param name="query">the input</param> | |
/// <returns>the list of autocomplete matches</returns> | |
public List<string> GetMatches(string query) | |
{ | |
StringBuilder sbPrevious = new StringBuilder(); | |
char[] chars = query.ToCharArray(); | |
Node currentNode = _root; |
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
private List<string> subsequentStrings; | |
/// <summary> | |
/// Create a prefix tree - the root node should always store ' ' | |
/// Initializae the list that will store the strings | |
/// found during the autocomplete process | |
/// </summary> | |
public Tree() | |
{ | |
_root = new Node(' '); |
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
open System.Collections.Generic; | |
//the trie node type which is stores a char, a bool to mark the end of the node and a list of all it's subnodes | |
type TrieNode = TrieNode of (char * bool * TrieNode list) with | |
//just a getter the char stored | |
member this.Char = match this with TrieNode(c,weh,subnodes) -> c | |
//get the first node that is a subnode of the current node and stores the char passed as parameter (c) | |
//this returns a list which can be either empty or have one element this is probably not the best option since there will never be | |
//more than one element in the list but I am new to F# | |
member this.GetChild(c:char) = match this with TrieNode(c,weh,subnodes) -> match List.tryFind (fun (this:TrieNode) -> this.Char = c) subnodes with |
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
var tree = new Tree(); | |
tree.Insert("romane"); | |
tree.Insert("romanus"); | |
tree.Insert("romulus"); | |
tree.Insert("rubens"); | |
tree.Insert("ruber"); | |
tree.Insert("rubicon"); | |
tree.Insert("rubicundus"); | |
Console.WriteLine("predecessor of the word \"romanes\":" + tree.FindPredecessor("romanes")); |
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 Tree | |
{ | |
/// <summary> | |
/// store the tree's root | |
/// </summary> | |
private Node _root; | |
/// <summary> | |
/// construct a new tree with it's root | |
/// </summary> |
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
/// <summary> | |
/// represents a node in the radix tree | |
/// stores: | |
/// a label - string that the tree holds | |
/// a list of the node's subnodes - a list of other objects of this type | |
/// </summary> | |
public class Node | |
{ | |
public Node() | |
{ |
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
static void MergeDocs(string doc1Path,string doc2Path) | |
{ | |
using (var doc2FileStream = File.Open(doc2Path, FileMode.Open)) | |
{ | |
using (WordprocessingDocument doc2 = WordprocessingDocument.Open(doc2FileStream, true)) | |
{ | |
var doc2Body = (Body)doc2.MainDocumentPart.Document.Body.CloneNode(true); | |
using (var doc1FileStream = File.Open(doc1Path, FileMode.Open)) | |
{ |