Posts

Showing posts from March, 2014

r - A hybrid way to produce high resolution ggplot image using RStudio's export function? -

i using ggplot2 rstudio produce 300 dpi image. method using "tiff("test.tif"...)" produced wired image big text , small plot; while export function in rstudio convenient use helpful interactive graphics scale falls short in producing low resolution 72 dpi image. there hybrid way both high resolution , interactive image operations?

smartphone - application is not installed on your phone error in android -

i beginner in android programming. this problem occured when run application on android device eclipse. have run same application many times, when run today device restarted automatically , after app shortcuts icon changed default android icon, , in app list icon writen sd @ bottom-right. when click icon giving message "application not installed on phone". i worked around this, in solution saying these apps installed in sd card, dont know happened app. in device no memory card attached when check files sdcard showing in path. i restared device couple of times didnt solved. go settings > apps > google play > clear cache/ clear data

javascript - Preserve function name uglify mangle -

this question has answer here: prevent uglifyjs renaming functions 2 answers we're linking javascript , as3. work as3 needs know function names of javascript methods. we're using uglify optimize our javascript code. don't want these specific functions mangled. other functions can mangled fine. possible accomplish this? use parameter: --reserved-names “myfunction” possible duplicate: prevent uglifyjs renaming functions

python - Str object has no attribute "add" -

can me fix this: import random import operator operator import add, sub, mul random import randint score = 0 name = input("what name? ") in range(10): n1 = randint(1,10) n2 = randint(1,10) ops =[["+", operator.add],["-", operator.sub],["*", operator.mul]] randomop = random.choice(list(ops)) operator = randomop[0] op = randomop[1] prod = op(int(n1), int(n2)) ask = ("what is",int(n1),operator,int(n2),"?") ans = input(ask) if ans == ("%d" % (prod)): print ("that's right -- done") score = score + 1 else: print ("no, answer %d. " % (prod)) print (name, "i asked 10 questions. got %d of them right." % (score)) print ("quiz finished") you assigned string operator name: operator = randomop[0] you masking operator module. don't re-use names that, because next iteration of for loop o

c++ - strcpy copies content of an other array -

so have piece of code convert char array contents of struct. (no, i'm not gonna argue on whether or not right/most efficient way it) void chararray_to_categorie(categorie &levarr, char** chararray) { string temp = chararray[0]; int length = temp.length(); temp = temp.substr(0, ((length<21)?length:20)); strcpy(levarr.naam, temp.c_str()); //a sloppy way use substring on char array. tried memcpy , caused same results why i'm trying way. levarr.naam[20] = '\0'; strcpy(levarr.omschrijving, chararray[1]); cout << endl << chararray[0] << endl << temp << endl << levarr.naam << endl << length << endl << ((length<21) ? length : 20); _getch(); /* input: naam: 1234567890123456789012345678901234567890 omschrijving: lol output: chararray[0]: 1234567890123456789012345678901234567890

image processing - Java -OpenCV Error: Assertion failed while running FaceRecognition Program -

this question has answer here: opencv 3.0.0 facedetect sample fails 6 answers i new opencv. link got java sample program face detection . encountered problems installed opencv 3.0 version , code 2.4.6 version. anyway errors solved changed code as system.loadlibrary(core.native_library_name); system.out.println("\nrunning facedetector"); cascadeclassifier facedetector = new cascadeclassifier(facedetection.class.getresource("/resources/xmls/haarcascade_frontalface_alt.xml").getpath()); mat image = imgcodecs.imread(facedetection.class.getresource("/resources/testimages/facetest.jpg").getpath()); matofrect facedetections = new matofrect(); facedetector.detectmultiscale(image, facedetections); system.out.println(string.format("detected %s faces", facedetections.toarray().length)

c# - Why is this appearing: System.NullReferenceException: Object reference not set to an instance of an object -

this question has answer here: what nullreferenceexception, , how fix it? 29 answers i read other answers on here nothing has worked. issue if user enters incorrect password error (username fine): system.nullreferenceexception: object reference not set instance of object. stack trace: [nullreferenceexception: object reference not set instance of object.] login.btnlogin_click(object sender, eventargs e) in c:\users\michelle\desktop\comf510_65300_hs_task_2\login.aspx.cs:31 system.web.ui.webcontrols.button.onclick(eventargs e) +9628614 system.web.ui.webcontrols.button.raisepostbackevent(string eventargument) +103 system.web.ui.webcontrols.button.system.web.ui.ipostbackeventhandler.raisepostbackevent(string eventargument) +10 system.web.ui.page.raisepostbackevent(ipostbackeventhandler sourcecontrol, string eventargument) +13 system.web.ui.page.rai

php - Need Help on .htaccess code to redirect category URLs into informative -

may me on following redirection? current link of main category - www.sitename.com/categories/main-category.html current link of sub category - www.sitename.com/categories/sub-category.html links static not looking – possible make them more informative in manner – www.sitename.com/main-category.html www.sitename.com/main-category/sub-category.html i using htaccess code, - rewriterule ^(.+)-cusid-(.+).html index\.php\?m=$1&id=$2 [qsa,l] rewriterule ^search-(.+)-(.+)-(.+).html index\.php\?m=$2&s=$3&key=$1 [qsa,l] rewriterule ^(.+)-(.+)-(.+).html index\.php\?m=$1&s=$2&id=$3 [qsa,l] rewriterule ^(.+)-(.+).html index\.php\?m=$1&s=$2 [qsa,l] rewriterule ^(.+)-(.+).html index\.php\?m=$1&id=$2 [qsa,l] rewriterule ^(\w+).html$ index\.php\?m=$1 [qsa,l] rewriterule ^_(.+)-(.+)-(.+)/(.+) index\.php\?m=$1&s=$2&id=$3$4 [qsa,l] rewriterule ^_(

javascript - jquery resizable with absolute position -

i have following problem: need make div re-sizable, needs located on right bottom of page. when use jquery resizable function , position: absolute, div jumps around... sample code: $('#resizable').resizable({ handles: { 'nw': '#nwgrip', 'n': '#ngrip', 'w': '#wgrip' } }); <div id='resizable'> <div id='content'> im resizable! </div> <!-- define corners --> <div class="ui-resizable-handle ui-resizable-nw" id="nwgrip"></div> <div class="ui-resizable-handle ui-resizable-n" id="ngrip"></div> <div class="ui-resizable-handle ui-resizable-w" id="wgrip"></div> </div> the problem resizable uses top left with , height set element's position. now yours positioned right , bottom @ beginning, moment resizable updates position

c# - Extracted thumbnail from DNG image using DCRaw -

Image
i using dcraw command line utility extract thumbnails dng images. thumbnail colors way off , inverting them not help. i took photo camera , preview looks this: here how call dcraw: settings osettings = settings.getinstance(); var startinfo = new processstartinfo(dcrawpath) { arguments = "-e \"" + sinputfilename + "\"", useshellexecute = true, redirectstandardoutput = false, windowstyle = processwindowstyle.hidden, createnowindow = true, workingdirectory = rootdirectory }; var process = process.start(startinfo); the result ppm file looks this: i tried inverting thumbnail using code: static readonly colormatrix _inversecolormatrix = new colormatrix(new[] { new float[] {-1, 0, 0, 0, 0}, new float[] {0, -1, 0, 0, 0}, new float[] {0, 0, -1, 0, 0}, new float[] {0, 0, 0, 1, 0}, new float[] {1, 1, 1, 0, 1} }); public static bitmap inverseimage(bitmap source) { var newbitmap = new bitmap(source.width,

ios - Error displaying a prototype cell and its content -

i'm doing rob's udemy ios8 swift course , far good. i use tab bar controller separate tabs: profile, ask, browse etc... in 'ask' tab, input text , uploaded parse , want text displayed in 'browse' tab. browse tab table view prototype cell, added labels there display username , text. my problem doesn't display text nor username parse. here code: import uikit import parse class browseviewcontroller: uitableviewcontroller{ var postedquestion = [string]() var usernames = [string]() override func viewdidload() { super.viewdidload() var query = pfquery(classname:"post") query.findobjectsinbackgroundwithblock { (objects: [anyobject]?, error: nserror?) -> void in if error != nil { if let objects = objects as? [pfobject] { object in objects { self.postedquestion.append(object["postedquestion"] as! string) self.usernames.appe

query mysql in php to get the difference between two tables -

i have 2 tables same structure users finger print data , want first table data not exist in second table , insert second table structure of 2 tables: id user_id check_time check_type sensor_id you can use insert select from using additional join as insert table2 select t1.* table1 t1 left join table2 t2 on t1.user_id = t2.user_id , t1.check_time = t2.check_time t2.user_id null , t2.check_time null

.net - Type Is not defined - C# class to VB.NET -

i sitting rather strange error - believe followed correct steps solve. basically, compiler complains following: type 'interactionsentities' not defined here explanation of have done. goal use class compiled in c# within vb.net project. step 1 : right clicked vb.net project - add > reference step 2 : out of project list, selected c# project containing interactionsentities class , pressed ok. step 3 : added line of code in vb.net module: imports csharpproject.csharpnamespace step 4 : within module, added variable: private context = new interactionsentities -- note on point, intellisense able find class required. step 5 : ensure project can use entity framework, used nuget package manager install entity framework. so following steps listed above, have following code: imports csharpproject.csharpnamespace module module1 dim context = new interactionsentities() sub main(properties string()) dim documents = context.documents.select(fu

eclipse - Why will Java not open up a Batch file when executed with a ProcessBuilder? -

i've coded java program open batch file imported resources of program. even running code in eclipse, batch file not work. have opened batch file using project explorer, batch file works. the file serves, essentially, command prompt, when may blocked group policies. the contents of batch file follows... @echo off title command prompt ver | find /i " " echo portable cmd made batch. echo. cd /d %systemdrive% && cd %userprofile% :user set /p input="%cd%>" %input% echo. goto user now, when execute code: classloader classload = this.getclass().getclassloader(); url batchpath = classload.getresource("cmd.bat"); string batch = batchpath.tostring(); system.out.println("batchpath " + batchpath); system.out.println("batch " + batch); string batchcommand = batch.replacefirst("file:/", ""); batchcommand = batchcommand.replace('/', '\\'); batchcommand = batchcommand.replaceall(&qu

android - TypedArray.getDimensionPixelSize crash -

when use typedarray = context.obtainstyledattributes(attrs, com.android.internal.r.styleable.view, defstyle, 0); a.getdimensionpixelsize(com.android.internal.r.styleable.view_padding, layout_unknow); the typedarray.getdimensionpixelsize(typedarray.java:572) method crashed in android 5.0 the log follows: caused by: java.lang.unsupportedoperationexception: can't convert dimension: type=0x3 e androidruntime: @ android.content.res.typedarray.getdimensionpixelsize(typedarray.java:572) how can solve issue?

php - Is this too many lines and too many nested blocks? -

i have function loads list of things database , put them select list. function follows : (pseudocode) protected function foo() { try { pdo instance prepare statement if (pdo query executes) { while (row = fetched rows) { stuff row } } } catch (pdoexception $ex) { error stuff here } } netbeans gives code hint many lines , many nested blocks. feel function should acceptable. feel break logic smaller functions bit looney, why netbeans lie me:) ? so questions follows: is bad logic or go ahead? welcome suggestions on how might redesign function fit within netbean constraints. edit: i won't answer own question in case there 1 nested block not needed. pdo retrieved singleton class has try/catch block. dont need repeat again in function because exception of been caught. edit 2: removing try catch block robbing peter pay paul. i

Should i use transaction for single Select, Insert, Update, Delete statements in SQL Server? -

should use transaction single select, insert, update, delete statements in sql server? could useful in case need avoid phantoms, dirty reads or other issues those. depends on framework you're using perform such operations, in simple scenario (one single workflow) transactions not needed

Simulate Resolving and intent:#Intent Uri for Android Testing -

i have launched app chrome on android using intent uri (see make link in android browser start app? ) , automate testing generator wrote create launchable intent uris pass different parameters extras browsable activity. but how test this? figured essentially: - run generator huge intent uri string tons of parameters: "intent:#intent:component=some/activity;param1=value;param2=value2;...;end" - construct intent in test string: intent.parseuri(generatoroutput,uri_intent_scheme); - , find extras: intent.getextras().keyset(); but getextras returns null, means intent.parsefrom(originalintent.geturi(uri_intent_scheme), uri_intent_scheme) != originalintent does know if there way construct intent intent uri , extras populated. functionality available in android since android this.

spark-submit yarn-client run failed -

using yarn-client run spark program. i've build spark on yarn environment. scripts ./bin/spark-submit --class wordcounttest \ --master yarn-client \ --num-executors 1 \ --executor-cores 1 \ --queue root.hadoop \ /root/desktop/test2.jar \ 10 when running following exception. 15/05/12 17:42:01 info spark.sparkcontext: running spark version 1.3.1 15/05/12 17:42:01 warn spark.sparkconf: spark_classpath detected (set ':/usr/local/hadoop/hadoop-2.5.2/share/hadoop/common/hadoop-lzo-0.4.20-snapshot.jar'). deprecated in spark 1.0+. please instead use: - ./spark-submit --driver-class-path augment driver classpath - spark.executor.extraclasspath augment executor classpath 15/05/12 17:42:01 warn spark.sparkconf: setting 'spark.executor.extraclasspath' ':/usr/local/hadoop/hadoop-2.5.2/share/hadoop/common/hadoop-lzo-0.4.20-snapshot.jar' work-around. 15/05/12 17:42:01 warn spark.sparkconf: setting 'spark.driver.extraclasspath' ':/usr/local/hadoop

json - RethinkDB filter on nested objects -

i need solution filter data nested objects. so, json data: { "create_datetime": 1431000977 , "creator": { "company": { "id": 0 , "name": "some name" } , "manager": { "id": 0 , "name": "" } } , "finished_datetime": 1431615600 , "id": "00949296-cbea-4d4a-a780-7c8d918a7fd6" , "participants": [ ], "status": "created" , "tender_categories": [ 1285 ] , "views": [ ] }, { "create_datetime": 1431416740 , "creator": { "company": { "id": 70922233 , "name": "some company name" } , "manager": { "id": 1003546168 , "name": "some manager name" } } , "finished_datetime": 1432857600 , "id": "28e0936b

javascript - Setting height of a rect by form input -

i have make can manually fill in height of rect form. so means: if change amount of first form imput 10, first rect must have height=10. for (var = 0; < 5; i++) { var height = -math.random()*450; ctx.fillstyle = "#76dcdc"; ctx.fillrect(16+i*100,400,60,height); } with code generate random height every time press submit button. need code fill height in manually each of 5 different rectangles. this have far. it's still messy. var amount = []; var canvas = document.getelementbyid("canvas"); if(canvas.getcontext){ var ctx = canvas.getcontext("2d"); var hoeveelheid = 0; var emmer = new image(); emmer.addeventlistener("load",drawdrop ); emmer.src = "assets/pot_s.png"; }else{ } function draw(){ ctx.fillstyle = '#fff'; ctx.fillrect(0,0,canvas.width, canvas.height); } function amountchange(){ console.log("change amount");

java - Random Postorder traversal in neo4j -

i'm trying create algorithm in neo4j using java api. algorithm called grail ( http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.169.1656&rep=rep1&type=pdf ) , assigns labels graph later answering reachability queries. this algorithm uses postorder depth first search random traversal each time (each child of node visited randomly in each traversal). in neo4j java api there algorithm doing ( https://github.com/neo4j/neo4j/blob/7f47df8b5d61b0437e39298cd15e840aa1bcfed8/community/kernel/src/main/java/org/neo4j/graphdb/traversal/postorderdepthfirstselector.java ) without randomness , can't seem find way this. my code has traversal description in want add custom order (branchorderingpolicy) in order achieve before mentioned algorithm. this: .order(**postorderdepthfirst()**) the answer question came rather easy after lot of thinking. had alter path expander (i created own) returns relationhipss traversal takes next , there simple line of code rando

asp.net mvc - in Entity framework I want to include only first children objects and not child of child(sub of sub) -

i have these 2 classes: public class businessestbl { public string id { get; set; } public string firstname { get; set; } public string lastname { get; set; } public icollection<offerstbl> offerstbls { get; set; } } public class offerstbl { public int id { get; set; } public string name { get; set; } public int catid { get; set; } public string businessestblid { get; set; } public virtual businessestbl businessestbls { get; set; } } when try bring offers according catid field, need return businessestbls also, method return offers again per each businessestbl obj , code : public iqueryable<offerstbl> getofferstblscat(int id) { db.offerstbls.include(s => s.businessestbls); } you can see wrong result on : http://priooffer.azurewebsites.net/api/offersapi/getofferstblscat/4 as can see return offers under each business object while business object under each offer, , want return offers business object without offer un

c# - Unit test for an application -

i displaying chart in mvc. public class homecontroller : controller { mapcontext context = new mapcontext(); public actionresult index() { } } how write test case check data . new mvc you'll find hard write true unit test because you're instantiating concrete instance of mapcontext. ideally you'd use ioc/dependancy injection inject mapcontext , you'd want create interface can faked / mocked otherwise you're not testing controller you'retesting mapcontext no longer unit test intergration test..... lost yet?! controller like: public class homecontroller : controller { imapcontext _context; public homecontroller(imapcontext mapcontext) { _context = mapcontext; } public actionresult index() { var x = (from c in _context.area select c.name).toarray(); var y = (from c in _context.area select c.pin).toar

Rails/Dragonfly: is it possible to decode URL (/media/W1siZiIsInRzYW...) to get the model instance it refers to? -

this want accomplish: on extranet feed wall, users type non-formatted text (non style, \n , links recognition). but quite often, users want add link document stored in same extranet (using dragonfly). obviously, link quite awful display (ex: https://extranet.com/media/l0nguid/original_filename.pdf?sha=31310881daef1 ). document refers document instance has nice title, ex: "original filename (pdf)" links (automatically) replaced by <a href="https://extranet.com/media/l0nguid/original_filename.pdf?sha=31310881daef1">original filename (pdf)</a> problem is: how find model , document document refers to, using uid , sha. i guess possible dragonfly decodes url, can't find how (not comments in code). the variant's uid base64 encoded, when decoding uid json encoded array of dragonfly processor steps. here actual example live database: uid = 'w1siziisijiwmtuvmdcvmdkvmdkvmtmvmdivote3lze5ndg3odk0mdc1xze4ngyzmjc0mwvfay5qcgcixv0&

c# - What package does NArticleEngine belong to? -

i refactoring load of code relies on nhibernate orm. in 1 of solution files have found reference narticleengine googling brings lot "particle engines" not want. going through have been able track down dll called narticletemplateengine which once again leads me old google code page i need hands on dll or failing can confirm new implementation of castle.nvelocity contains same templating engine.

Load jinja2 templates dynamically on a Pyramid view -

i'm developing pyramid project jinja2 templating engine. following jinja2 documentation i've find out way load different templates unique view. taking account module pyramid_jinja2 configured in app default path templates. wondering if there way more elegant done. approach: from jinja2 import environment, packageloader @view_config(context=test) def test_view(request): env = environment(loader=packageloader('project_name', 'templates')) template = env.get_template('section1/example1.jinja2') return response(template.render(data={'a':1,'b':2})) can instance of pyramid_jinja2 environment somewhere don't have set again default path templates in view? the following enough: pyramid.renderers import render template = "section/example1.jinja2" context = dict(a=1, b=2) body = render(template, context, request=request) and configure loading in __init__.py : config.add_jinja2_searc

javascript - Auto click bullets on slider to make slider autoplay -

i have custom slider can rotate each image when click bullets. need make autoplay, want if page ready, it's trigger click on 1st bullet, 2nd, , 1st bullet again... the bullets using attr data-container each slide id : <nav class="thumb-nav"> <a data-container="container-1" class="thumb-nav__item" href="#"><span>1</span></a> <a data-container="container-2" class="thumb-nav__item" href="#"><span>2</span></a> </nav> and these slide contents : <div id="container-1" class="container theme-1"> <header class="intro"> <img class="intro__image" src="http://tympanus.net/tutorials/slidingheaderlayout/img/header01.jpg" alt="lava"/> </header> </div> <div id="container-2" class="container them

python - How can I change device used of theano -

i tried change device used in theano-based program. from theano import config config.device = "gpu1" however got error exception: can't change value of config parameter after initialization! i wonder best way of change gpu gpu1 in code ? thanks there no way change value in code running in same process. best have "parent" process alters, example, theano_flags environment variable , spawns children. however, method of spawning determine environment children operate in. note there no way in way maintains process's memory through change. can't start running on cpu, work values stored in memory change running on gpu , continue running using values still in memory earlier (cpu) stage of work. process must shutdown , restarted change of device applied. as import theano device fixed , cannot changed within process did import.

ado.net - "Cannot find libSQLDBCHDB.dll" when connecting to SAP HANA with .NET -

we getting error "cannot find libsqldbchdb.dll" when trying connect our aws hana instance dotnet code. we installed hana client developer edition 64 bit on our 64 bit windows machine , set path env variable application install path. this link states these errors might come not state how resolve them. anyone else facing issue? thanks, samar since microsoft visual studio operates 32-bit application, both 64-bit , 32-bit versions of sap hana client software must installed on 64-bit windows develop application uses data provider. source

c# - Find pattern and replace to another pattern string -

i tried check if string contains patterns string example: '4+3+6**4'. i want replace pattern ** pow(x,y) . so want string 4+3+pow(6,4) . i want know if there way 'regex'. trt. just capture number exists before , after ** along match ** , replace match pwo($1,$2) . regex.replace(string, @"(\d+)\*\*(\d+)", "pwo($1,$2)");

Use different method for COM- and C#-API -

i've got following class , want create c#-api , com-api same class. because i'm not able create list, want array in com-api. using system; using system.collections.generic; using system.runtime.interopservices; namespace myapi { [attributeusage(attributetargets.all), classinterface(classinterfacetype.autodispatch), guid("aebe2021-209a-4aee-9a42-04cb82bec1cf")] class dataprovider: system.attribute { int[] data = { 1, 2, 3 }; [comvisibleattribute(false)] public list<int> getdataapi() { //only method should available c#-api return new list<int>(data); } [comvisibleattribute(true)] public int[] getdatacom() //only method should available com { return data; } } } i know able hide first method comvisibleattribute com-api. there way hide or limit access of second method c#-api? (i mean normal build) best solution user-interface g

sqlplus - Pass parameters in a sql script via java -

i have sqlplus script requries external parameters. parameters should come array present in java code. want pass values sql script don't know how. please guide me. my sqlplus file shown below set echo off set heading off set feedback off set verify off set define on set trimspool on set newpage none set termout off spool &3/&2..&1..fn select text dba_source name = '&2' , type = 'function' , owner = '&1' order line / spool off exit; the java code using execute file in unix server shown below. try { string line; process p = runtime.getruntime().exec( "sqlplus -l user/pwd@sid @" + sqlfilepath); bufferedreader input = new bufferedreader(new inputstreamreader( p.getinputstream())); while ((line = input.readline()) != null) { system.out.println(line); } input.close();

java - How to get duration of audio file? -

i want duration (total time) of audio file in seconds. audio file can of format i.e. (.mp3, .wav, .wma etc.). try { file file = new file("c:/users/administrator/appdata/local/temp/" + "01 - ab tere bin jee lenge hum-(mymp3singer.com).mp3"); audioinputstream audioinputstream = audiosystem.getaudioinputstream(file); audioformat format = audioinputstream.getformat(); long frames = audioinputstream.getframelength(); double durationinseconds = (frames + 0.0) / format.getframerate(); system.out.println("duration in seconds"+durationinseconds); audiofileformat audiofileformat = audiosystem.getaudiofileformat(file); map<string, object> properties = audiofileformat.properties(); system.out.println("properties"+properties.size()+"empy::"+properties.isempty()); for(string key: properties.keyset()){ system.out.println(key +" :: "+ properties.get(key).tostring()); }

php - How to insert data into database only when input are not empty? -

i came problem made me crazy new php. problem is: below timetable submission form works on chrome (every time left email unfilled, submission cannot processed). however, when using on safari, can submit blank form database. here html form. <script type="text/javascript" src="/membership/my-form/js/jquery-2.1.1.js"></script> <script type="text/javascript" src="/membership/my-form/js/main.js"></script> <form class="mf-form floating-labels" method="post" action="timetablesubmit.php"> <div> <h1 style="text-align:center">availability form</h1> </div> <div> <p class="mf-select icon"> <select name="timetable-staff" class="user" required> <option value="">select person</option> <option value="amy"&

Comparing NaN in javascript -

this question has answer here: how test nan? [duplicate] 2 answers in javascript, if multiply string number nan : console.log("manas" * 5); // result nan why following code result in false instead of true ? console.log("manas" * 5 == nan) // results false use isnan function instead. console.log(isnan("manas" * 5)); http://www.w3schools.com/jsref/jsref_isnan.asp nan, not number, special type value used denote unrepresentable value. javascript, nan can cause confusion, starting typeof , way comparison handled. several operations can lead nan result. because there many ways represent nan, makes sense 1 nan not equal nan.

Animated Splash screen in Netbeans Java -

Image
i trying make animated gif splash screen in java netbeans doesn't works.. use jpg or png files works .. want use gif animated file in splash screen using -splash:src/images/sspp.png in vm options.. please tell solutions able use animated splash screen. i think you'll find problem comes down 2 things... 1.using command line parameter (-splash), java expects image file on file system, whereas manifest file expects embedded resource. 2.java doesn't seem capable of playing optimised gifs, gifs frames represent difference between last , current frame, instead of complete image (as far splash screen goes). i tried using and the first image failed, second worked, difference, near can tell, first optimized , second not...

php - How to select unique value randomly from a table in heavy load server -

i have single-column mysql database table ids (id integer primary key autoincrement) store pre-generated unique ids in ascending order. in order random id table use query: select id ids order rand() limit 1; and wondering how ensure id got never used again. see 2 options. 1 delete id table , other add column tracking use of id: delete ids id=?; //where id 1 got previous query or select id ids used=0 order rand() limit 1; update ids set used=1 id=?; //where used new column 0 default value there slight problem both of these. if server load heavy 2 queries random id might return same id before gets removed list (or disabled used column). would transaction help? wrapping select , update in transaction work. if want avoid transaction race condition between selecting item , marking unusable, can run update first. you'll need way each of processes identify owner of row between claiming , deletion. example, assume ids schema is id (integer) owner (strin

how to retrive stored scala mutable Set from ElasticSearch -

hi stroing 1 id field , 1 scala mutable set in elastic search way var genreidset = scala.collection.mutable.set[int]() genreidset+=1 genreidset+=2 genreidset+=3 bulkrequest.add(client.prepareindex("testdb","test","123") .setsource(jsonbuilder() .startobject() .field("uuid","123") .field("genreidset",genreidset) .endobject() ) ) now want retrieve document here code val get=client.prepareget("testdb","test","123") .setoperationthreaded(false) .setfields("uuid","genreidset") .execute() .actionget() id=get.getfield("uuid").getvalue.tostring().toint var a=get.getfield("genreidset").getvalue.tostring and getting following output id 123 genreidset set(1, 2, 3) i want traverse set , store value (eg : 1 2 3)

Perl merging columns in two text files -

i beginner perl , want merge content of 2 text files. have read similar questions , answers on forum, still cannot resolve issues first file has original id , recoded id of each individual (in first , fourth columns) second file has recoded id , information on of individuals (in first , second columns). want create output file original, recoded , information of these individuals. perl script have created far, not working. if appreciated. use warnings; use strict; use diagnostics; use vars qw( @fields1 $recoded $original $idf @fields2); %columns1; open (file1, "<file1.txt") || die "$!\n couldn't open file1.txt\n"; while ($_ = <file1>) { chomp; @fields1=split /\s+/, $_; $recoded = $fields1[0]; $original = $fields1[3]; %columns1 = ( $recoded => $original ); }; open (file2, "<file2.txt") || die "$!\n couldnt open file2.txt \n"; ($_ = <file2>) { chomp; @fields2=split /\s+/, $_;

drawer - Following classes not found: android.support.v4.widget.DrawerLayout -

i working on project in android studio in had use navigation drawer, running well. android studio updated 1.2 version , activity the nav drawer stopped rendering giving me error. i know known error , happened me before, time can´t fixed. the dependencies set this: dependencies { compile filetree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:support-v4:22.1.0' compile 'com.android.support:appcompat-v7:22.1.0' compile 'com.google.android.gms:play-services:7.0.0' } so think date , not problem. if create project navigation drawer not give error though. thanks in advance! edit: an update android studio has been released yesterday in theory resolves layout rendering problems. installed it, gradle version updated , sync , problem continues!! im upset right now, can´t create new blank nav drawer activity, says can´t find , won't render. i'm answering myself because it's been long time since question

javascript - jQuery - Scale font-size to fill parent div height -

i have 2 50% width divs inside parent div. scale font-size fill height of parent div when window resized. <div class="wrapper"> <div class="text"> <div class="left-text text-fill"> <span>paragraph of text</span> </div> <div class="right-text text-fill"> <span>paragraph of text</span> </div> </div> </div> jquery solution found function textfill(options) { var fontsize = options.maxfontpixels; var t = $("span:first", this); var maxheight= $(this).height(); console.log(maxheight); var textheight; { t.css({'font-size': fontsize}); textheight = t.height(); fontsize = fontsize - 1; } while (textheight > maxheight); return this; } $(".textfill").each(textfill({maxfontpixels: 500})); the problem have this referring outer wrapper div isn't finding span. why i

c# - boost to create guid in c++ -

i using boost::uuids::uuid create guid array of characters result compare 1 using guid in c# fatally different. c++ boost::uuids::uuid guid(char data[16]) { return { data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], data[9], data[10], data[11], data[12], data[13], data[14], data[15] }; } c# guid onguid(byte[] data) { return new guid(data); }

ruby - Cannot find git while installing foundation -

Image
i new zurb foundation , trying install through ruby cli. have installed zurb foundation , want create new project command: foundation new myfound it gives me error saying: can't find git. i have installed git on system still have error. run on windows. suggestions? you have check option during installation add git on path : use git windows command promt picture if didn't can reinstall git or add on path manually (i assume git's installation folder c:\program files (x86)\git - if doesn't, change yours). command line approach set path=%path%;c:\program files (x86)\git\bin graphical approach select computer start menu choose system properties context menu click advanced system settings > advanced tab click on environment variables select path in section system variables , edit it add ;c:\program files (x86)\git\bin @ end , save it

trouble in getting drop down values in spring mvc -

i getting trouble in getting value of drop down ,i have student entity , section entity there relation ship between them , in jsp coming com.chan.eschool.student.model.section@26552d instead of in jsp need specific bean property name sectionname @entity @table(name="section") public class section implements serializable { private static final long serialversionuid = 1l; private integer id; private string sectionname; private school school; private list<student> studentlist; public static long getserialversionuid() { return serialversionuid; } @id @generatedvalue(strategy=generationtype.identity) public integer getid() { return id; } public void setid(integer id) { this.id = id; } public string getsectionname() {