Posts

loading - Firebase Rate Limiting -

i'm experiencing huge load times firebase. have 5,000 entries in "users" collection, , working fine until added base64-encoded photo each user. here's summary of code: function initcurrentauth() { return authref.$requireauth().then(attachuserobject); } function attachuserobject(authdata) { getuser(authdata.uid).$loaded().then(function(user) { ...this code never runs because getuser never resolves } } function getuser(id) { userreference = usersref.child(id); return $firebaseobject(userreference); } i'm on free firebase plan, i'm wondering if i'm being throttled? if has insights, appreciated. thanks! not sure if else, in case - frank suggested, did have "listener". had been looking $watch in code trigger it, had $firebaseobject(users) call triggered massive download.

ocr - Can I read this captcha with imagemagick/tesseract? -

Image
i'm week trying read captcha. i'm using imagemagick treat image , tesseract interpret. without success. me? thank you! . convert captcha-novo.png -fuzz -50% -transparent black -fuzz 15% -fill black -opaque 'rgb(16,128,176)' -fuzz 40% -fill white +opaque blue -colorspace gray captcha-interpretado.png . tesseract captcha-interpretado.png page-empty.txt

algorithm - Contextual type for closure argument list expects 1 argument, but 2 were specified -

i'm trying algorithm working swift 2.1: http://users.eecs.northwestern.edu/~wkliao/kmeans/ though getting error on line: return map(zip2sequence(centroids, clustersizes)) { cluster(centroid: $0, size: $1) } here's full function: func kmeans<t : clusteredtype>( points: [t], k: int, seed: uint32, distance: ((t, t) -> float), threshold: float = 0.0001 ) -> [cluster<t>] { let n = points.count assert(k <= n, "k cannot larger total number of points") var centroids = points.randomvalues(seed, num: k) var memberships = [int](count: n, repeatedvalue: -1) var clustersizes = [int](count: k, repeatedvalue: 0) var error: float = 0 var previouserror: float = 0 repeat { error = 0 var newcentroids = [t](count: k, repeatedvalue: t.identity) var newclustersizes = [int](count: k, repeatedvalue: 0) in 0..<n { ...

Android Studio program seems to be getting stuck at HTTPResponse -

i'm working on app in android studio, i'm relatively new , i'm trying pull information website. i'm running problem. code seems sticking @ httpresponse request. i've stuck load of debug logs in , last 1 print "log.v("arg", "trying 2");". i've included applicable code below, can maybe point out i'm doing wrong? appreciated. @override protected string doinbackground(string... medurls) { log.v("arg", "executed"); string medname = "medname"; (string medsearchurl : medurls) { httpclient medclient = new defaulthttpclient(); log.v("arg", medsearchurl); try { log.v("arg", "trying 1"); httpget medget = new httpget(medsearchurl); log.v("arg", "trying 2"); httpresponse medresponse = medclient.execute(medget); log....

ios - Swift: Adding UISegmentedControl/UITextField to dynamic UITableView -

i creating registration form application. app allows users create registration forms, , these registration forms displayed using uitableview. questions can either in form of text input (uitextfield) or multiple choice (uisegmentedcontrol). have question creation working, cannot figure out how display uitextfields , uisegmentedcontrols in uitableview. class use create question: class question { var label: string var required: int // create question init (label: string, required: int) { self.label = label self.required = required if (self.required == 0) { self.label = self.label + " *" } } } class textinput: question { var placeholder: string init (placeholder: string, label: string, required: int) { self.placeholder = placeholder super.init(label: label, required: required) } } class multichoice: question { var answers: [string] init(answers: [string], label: string, required: int) { self.answers = answers super.init(label: ...

return reference to element of dynamic array in C++? -

is how return reference element of dynamically allocated array index ?? int& dynamic_array::operator[](unsigned int i) { if (i >= get_size()) throw exception(subscript_range_exception); else return array[i]; } yes, correct – alexander shishenko thanks

java - Decode UTF-8 String -

import java.nio.charset.charset; import java.security.messagedigest; import java.security.security; import javax.crypto.cipher; import javax.crypto.spec.ivparameterspec; import javax.crypto.spec.secretkeyspec; import org.apache.commons.codec.binary.base64; public class cryptolib { public cryptolib() { security.addprovider(new org.bouncycastle.jce.provider.bouncycastleprovider()); } public string encrypt(string plaintext, string key) throws exception { // convert key bytes messagedigest md = messagedigest.getinstance("md5"); md.update(key.getbytes("utf-8")); byte[] keybytes = md.digest(); // use first 16 bytes (or less if key shorter) byte[] keybytes16 = new byte[16]; system.arraycopy(keybytes, 0, keybytes16, 0, math.min(keybytes.length, 64)); system.arraycopy(keybytes, 0, keybytes16, 0, math.min(keybytes.length, 16)); // convert plain text bytes ...