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
func idGenerator() chan int { | |
ids := make(chan int) | |
go func() { | |
id := 0 //intializare cu ultimul nr din baza de date | |
for { | |
id++ | |
ch <- id | |
} | |
}() | |
return ids |
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
VIEWS=`curl --request GET -s "http://$server:5984/$database/_all_docs?startkey=%22_design/%22&endkey=%22_design0%22" | awk '{FS="[\":\"]+";if($2 == "id") print $3}'` | |
for VIEW in $VIEWS | |
do | |
#echo "index view: ${VIEW}" | |
echo "curl -X GET -s \"http://$server:5984/$database/_design/{$urls}\" >/dev/null 2>&1" >> $filename | |
done |
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
<?php | |
// Connecting, selecting database | |
$dbconn = pg_connect("host= port= dbname= user= password=") | |
or die('Could not connect: ' . pg_last_error()); | |
//Tre sa fac validarea asta doar pentru TC.1 | |
$crotalie = 'RO03000021724'; | |
// Performing SQL query | |
$query = 'select apt.cod_crotalie | |
from apia_bd2010.application_tag apt |
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
$.couch.urlPrefix = "http://localhost:5984"; | |
$.couch.info({ | |
success: function(data) { | |
console.log(data); | |
} | |
}); | |
$.couch.db("bd2013").info({ | |
success: function(data) { | |
console.log(data); |
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
func (h *timeoutHandler) ServeHTTP(w ResponseWriter, r *Request) { | |
done := make(chan bool, 1) | |
tw := &timeoutWriter{w: w} | |
go func() { | |
h.handler.ServeHTTP(tw, r) | |
done <- true | |
}() | |
select { | |
case <-done: | |
return |
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
in header-ul cu import trebuie adaugata linia: | |
_ "net/http/pprof" | |
dupa care se pot accesa urmatoarele url-uri (sunt accesibile si din afara): | |
http://localhost:8081/debug/pprof/ - centralizatorul cu situatia de facto | |
http://localhost:8081/pprof/heap | |
http://localhost:8081/pprof/profile | |
http://localhost:8081/pprof/block |
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
func init() { | |
logf, err := os.OpenFile("log/mid_loop_"+ (time.Now()).Format("2006-01-02_15-04-05") +".log", os.O_WRONLY|os.O_CREATE, 0640) | |
if err != nil { | |
log.Fatalln(err) | |
} | |
log.SetOutput(logf) | |
... | |
} | |
pe exit inchide go filehandler sau se poate pune explicit in main |
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
$('#divLeduriComunicatie').one('cancel_GenerarePDF', function() { | |
... | |
}); | |
Asta înseamnă că la primul event de tipul ăla, se va executa funcția și se va face automat și unbind, asta e bine că nu mai uiți să faci unbound! | |
http://api.jquery.com/one/ | |
the handler is removed after the first time the event occurs at the delegated element |
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" | |
"net/url" | |
"reflect" | |
"strconv" | |
) | |
type Person struct { |
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]; | |
} |
OlderNewer