Posts

go - Managing errors in golang -

i'm coming ruby , looking @ go @ moment. start writing little bit of code check tls support given host. var tls_versions = map[uint16]string{ tls.versionssl30: "sslv3", tls.versiontls10: "tlsv1.0", tls.versiontls11: "tlsv1.1", tls.versiontls12: "tlsv1.2", } var refused_re = regexp.mustcompile(": connection refused") var nodns_re = regexp.mustcompile(": no such host") var versionnotsupported_re = regexp.mustcompile(": protocol version not supported") func checkversion(host string) (map[string]bool, error) { // {{ ret := map[string]bool{} version := tls.versionssl30; version <= tls.versiontls12; version++ { conn, err := tls.dial("tcp", host+":443", &tls.config{ minversion: uint16(version), }) if err != nil && (refused_re.matchstring(err.error()) == true || nodns_re.matchstring(err.error()) == true) { log.println(err) ...

windows - Asking for Java path every time when launching SQLDeveloper -

whenever i'm launching sqldeveloper, prompted enter java path. please see sqldeveloper.conf : includeconffile ../../ide/bin/ide.conf setjavahome c:\program files\java\jdk1.8.0_45\bin addvmoption -doracle.ide.util.addinpolicyutils.override_flag=true addvmoption -dsun.java2d.ddoffscreen=false addvmoption -dwindows.shell.font.languages= addvmoption -xx:maxpermsize=128m addvmoption -doracle.jdbc.mapdatetotimestamp=false includeconffile sqldeveloper-nondebug.conf addvmoption -dide.noextensions=oracle.ide.webupdate am missing here? or additional configuration files, needs change? beginning version 4.0, sqldeveloper not sqldeveloper.conf file anymore. instead, @ product.conf in user directory. path should c:\users\jweawer\appdata\roaming\sqldeveloper\version\product.conf . once set java_home in file, should no longer prompted this. see more details here http://www.thatjeffsmith.com/archive/2013/12/oracle-sql-developer-4-windows-and-the-jdk/ .

javascript - Load Images from within objects with array -

i have class i've created, called sprite: var sprite = function sprite() { = this; that.xpos = 0; that.ypos = 0; … that.image = null; this.render =function() { … } this.setimage(filename) { that.image = new image(); that.image.src = filename; } } and create array of objects: var names=[ {filename:"a1.png"}, {filename:"a2.png"}, {filename:"a3.png"}, {filename:"a4.png"} ]; var objs = []; for(var l=0;l<names.length;l++) { objs.push({}); objs[l] = new sprite(); … setimage(names[l]); } every object in array point same image (with same image file.) can tell me i'm doing wrong here? is there better way can this? thanks. your setimage(names[l]); in loop seems overwriting hence same image, try doing like: var sprite = function sprite() { = this; that.xpos = 0; that.ypos = 0; that.image = null; this.setimage = function(filename) { that.image = new image(); that.image....

Masking exceptions in Python? -

it typical use with statement open file file handle cannot leaked: with open("myfile") f: … but if exception occurs somewhere within open call? open function not atomic instruction in python interpreter, it's entirely possible asynchronous exception such keyboardinterrupt thrown* @ moment before open call has finished, after system call has completed. the conventional way of handle (in, example, posix signals) use masking mechanism : while masked, delivery of exceptions suspended until later unmasked. allows operations such open implemented in atomic way. such primitive exist in python? [*] 1 might it's doesn't matter keyboardinterrupt since program die anyway, not true of programs. it's conceivable program might choose catch keyboardinterrupt on top level , continue execution, in case leaked file handle can add on time. i not think possible mask exceptions , can mask signals not exceptions . in case keyboardinterrupt...

iOS UIImage: set image orientation without rotating the image itself -

i using avcapture+camera portrait mode capture image. when display captured image, fine--looks fine. when convert jpeg representation , convert base64 string server , server stored it, "rotated" already. so checked image orientation before sending server: uiimageorientation.right(so there way capture image using portrait mode captured image orientation up? well, doubt after digging). after server got image, did not anything, ignored metadata orientation guess. since image captured looks fine, want preserve how image like. however, want set image orientation up. if set image orientation, image not right anymore. so there way set orientation without causing image rotated or after setting orientation up, how keep orientation rotate actual image make right? - (uiimage *)removerotationforimage:(uiimage*)image { if (image.imageorientation == uiimageorientationup) return image; uigraphicsbeginimagecontextwithoptions(image.size, no, image.scale); [image d...

gnupg - How am I notified about a new GPG message? -

i'm reading little gpg , keypair (public/private keys). i'm trying understand basic mechanism have question. if sends me file (using public key), receive it? mean, how notified sent file me? gpg doesn't handle message delivery, encryption. lot of features assume file sent email, , email programs have built-in gpg support, can use file delivery system like.

c# - How to make a WPF Desktop application accessible over a network -

Image
i designing wpf application connects ms sql server database using entity framework. the application reads data excel file , saves records database. next requirement has come application should accessible multiple users @ same time (company network) users can see data in database , query/update whenever required. what thinking is, need put database on central machine should on company's internal network , application should connect database , allow users perform operations. what changes require current connection string? <connectionstrings> <add name="tpmscontext" connectionstring="metadata=res://*/tpmsmodel.csdl|res://*/tpmsmodel.ssdl|res://*/tpmsmodel.msl;provider=system.data.sqlclient;provider connection string=&quot;data source=test-dell;initial catalog=tpms;integrated security=true;multipleactiveresultsets=true;app=entityframework&quot;" providername="system.data.entityclient" /> </connectionstrings> an...