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 static String documentType(String file) | |
{ | |
String fileType = "Undetermined"; | |
try | |
{ | |
final URL url = new URL("file://" + file); | |
final URLConnection connection = url.openConnection(); | |
fileType = connection.getContentType(); | |
} | |
catch (MalformedURLException badUrlEx) |
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
@Override | |
protected TokenStreamComponents createComponents(String fieldName) | |
{ | |
final Tokenizer source = new StandardTokenizer(); | |
TokenStream tokenStream = source; | |
tokenStream = new StandardFilter(tokenStream); | |
tokenStream = new LowerCaseFilter(tokenStream); | |
tokenStream = new StopFilter(tokenStream, getStopwordSet()); |
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
@Override | |
protected TokenStreamComponents createComponents(String fieldName) | |
{ | |
final Tokenizer source = new StandardTokenizer(); | |
TokenStream tokenStream = source; | |
tokenStream = new StandardFilter(tokenStream); | |
tokenStream = new LowerCaseFilter(tokenStream); | |
tokenStream = new StopFilter(tokenStream, getStopwordSet()); |
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
/* | |
* ===================================================================================== | |
* | |
* Filename: merge_k_sorted_lists_with_heap.cpp | |
* | |
* Description: https://leetcode.com/submissions/detail/29638723/ | |
* | |
* Version: 1.0 | |
* Created: 06/08/2015 03:07:49 PM | |
* Revision: none |
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
/* | |
* ===================================================================================== | |
* | |
* Filename: IA_dijkstra.cpp | |
* | |
* Description: http://www.infoarena.ro/problema/dijkstra | |
Graful este orientat. | |
* | |
* Version: 1.0 | |
* Created: 06/21/2015 13:13:34 |
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
/* | |
* ===================================================================================== | |
* | |
* Filename: 290_div2_B_fox_and_two_dots.cpp | |
* | |
* Description: 290_div2_B_fox_and_two_dots.cpp | |
* http://codeforces.com/contest/510/problem/B | |
* | |
* Version: 1.0 | |
* Created: 06/03/2015 12:32:31 PM |
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
/* | |
* ===================================================================================== | |
* | |
* Filename: graph_traversals.cpp | |
* | |
* Description: | |
* | |
* Version: 1.0 | |
* Created: 06/03/2015 02:55:12 PM | |
* Revision: none |
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
/* | |
* ===================================================================================== | |
* | |
* Filename: reverse_string_stl.cpp | |
* | |
* Description: | |
* | |
* Version: 1.0 | |
* Created: 03/04/2015 09:49:47 AM | |
* Revision: none |
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
/* | |
struct ListNode { | |
int val; | |
ListNode* next; | |
}; | |
*/ | |
/** | |
* return the nth node from the end of the list | |
* in O(N) time, O(1) space |
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 subprocess | |
def print_shell_command(cmd): | |
## run it ## | |
p = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE) | |
while True: | |
out = p.stderr.read(1) | |
if out == '' and p.poll() != None: | |
break |