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
Am făcut niscai teste și toată căcănăria provine din biblioteca folosită de PostgreSQL pentru comparația de string-uri pentru crearea arborilor când se face indexarea. | |
Baza când este inițializată se inițializează ca proasta cu opțiunea default de "collate en_US.UTF-8" în loc de anticul "collate C" și folosește o altă bibliotecă, specială, pentru comparațiile "lexicografice" de caractere! | |
Să vedem niște teste și să luăăăm amiiiiinteeeeee .... | |
// "Încălzim cache-ul" să ducem tabela în memorie să nu conteze citirea din disc | |
root@bnd:/home/teo# time psql cs_muster -c "select count(*) from crotalie" | |
count | |
---------- | |
91.505.920 |
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
class CallbackFunction implements Function { | |
final Function f; | |
CallbackFunction(this.f); | |
call() => throw new StateError('There should always been at least 1 parameter' | |
'(js this).'); | |
noSuchMethod(Invocation invocation) { | |
Function.apply(f, []); | |
} | |
} |
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
package main | |
import ( | |
"fmt" | |
"io" | |
//"github.com/rcrowley/go-metrics" | |
"crypto/md5" | |
"github.com/rcrowley/go-tigertonic" | |
"net/http" | |
"net/url" |
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
function getSelectedText() { | |
if (window.getSelection) return window.getSelection().toString(); | |
if (document.getSelection) return document.getSelection().toString(); | |
if (document.selection) return document.selection.createRange().text.toString(); | |
return ""; | |
} | |
//În altă parte vrei să se declanșeze ceva când utilizatorul a selectat un cuvânt: | |
//- merge pe selecție prin drag peste text, când termini, pe mouseUp | |
//- merge când faci dublu-click, că face și selecția și apoi la mouseUp declanșează acțiunea |
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
onBlurCodFiscal: function() { | |
var localThis = this, | |
cui = trim(this.findByNume("cui").val()); | |
if ( cui=="" ) return; | |
$.ajax({ | |
type: 'get', | |
url: 'servlet/proxyOpenAPI.php', | |
data: { | |
cui: cui | |
}, |
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
package main | |
import "fmt" | |
import "bufio" | |
import "os" | |
func main() { | |
f, _ := os.Create("outputgo.txt") | |
reader := bufio.NewReader(os.Stdin) | |
for { | |
line, err := reader.ReadString('\n') |
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
package main | |
import "encoding/json" | |
import "fmt" | |
type Person struct { | |
Name string `json:"name"` |
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
fun(Head, {Req}) -> | |
Send(<<"[">>), | |
Fun = fun({Row}, Virgula) -> | |
Send(Virgula), | |
case proplists:get_value(<<"doc">>, Row) of | |
{Doc} -> | |
%% mă asigur că nu trimit altceva decât documente de tip "localitate" | |
%% și nu am primit din view și vreun document de tip _design | |
Elocalitate = proplists:is_defined(<<"Siruta">>, Doc), | |
if |
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
%%Map | |
fun({Doc}) -> | |
Filtre = [ {"ț","T"}, {"Ț","T"}, {"ș","S"}, {"Ș","S"}, {"ă","A"}, {"â","A"}, {"Ă","A"}, {"Â","A"}, {"Î","I"}, {"î","I"} ], | |
Nume = proplists:get_value(<<"Nume">>, Doc), | |
Cuvinte = string:tokens(binary_to_list(Nume)," (),-.?!'"), | |
lists:foreach(fun((Cuvant)) -> | |
Lung = string:len(Cuvant), | |
if | |
Lung>2 -> | |
Filtrat = lists:foldl(fun({Pattern, Replacement}, Subject) -> |
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
//Map | |
function(doc) { | |
// Machetă document complex | |
if ( doc.tip=='MD' ) { | |
var ss = ''+doc.macheta+doc.prd+doc['_id']+doc['_rev']; | |
for (var i=0,n=doc.valori.length; i<n; i++) { | |
for (var j=0, m=doc.valori[i].registre.length; j<m; j++) { | |
var k = doc.valori[i].registre[j]; | |
ss += doc.valori[i].valoare+k[0]+k[1]+k[2]+k[3]; | |
} |