Posts

Showing posts from March, 2012

java - Inject entityManager into custom Hibernate Interceptor class -

i want inject entitymanager hibernate on hibernate interceptor class. i'm using ejbs , jboss. transaction jta , provider org.hibernate.ejb.hibernatepersistence. i tried that: @stateless(name = "historicinterceptor") @transactionattribute(transactionattributetype.requires_new) public class historicinterceptorimpl extends emptyinterceptor implements historicinterceptor { @persistencecontext(name = "windi") private entitymanager em; // overriden methods, etc } but reference entitymanager null. is behaviour expected? how can access entitymanager within interceptor class? i had given on exact solution. instead, i've created class has ejb annotations. interceptor call ejb using provider class lookup ejb classes on context of application. there, entitymanager correctly associated.

java - How to receive push notification in a desktop application -

i building desktop app on windows , want able receive push notification server. long search can't find way (gcm, window push, etc). developing desktop app in java javafx library. is way receive push server, service worker in google chrome or mozilla firefox implement in java ? the way found each x minute on server see if there new message display. don't think solution

android - Current menu item view is always null in navigation view -

i'm using navigation view. , reason can't view of menu item. it's null. tried viewobserver, findviewbyid, didn't work. need y coord of current menu item location while performing item selection event. possible? initializing drawer activity.drawerindicator.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { if (activity.drawerlayout.isdrawervisible(gravitycompat.start)) { activity.drawerlayout.closedrawer(gravitycompat.start); } else { activity.drawerlayout.opendrawer(gravitycompat.start); } } }); activity.drawerlayout.setdrawerlistener(new drawerlayout.drawerlistener() { @override public void ondrawerslide(view view, float v) { } @override public void ondraweropened(view view) { activity.closekeyboard(); ...

java - Tomcat memory leak warning - AS400 job threads not getting closed on shutdown/redeploy -

i have spring application running on tomcat 8.0 server following error when either stopping server or redeploying app on server. info: closing spring root webapplicationcontext jul 25, 2016 10:18:40 org.apache.catalina.loader.webappclassloaderbase clearreferencesthreads warning: web application [app_name] appears have started thread named [as400 read daemon [system:*connectionurl*;job:768339/quser/qzdasoinit]] has failed stop it. create memory leak. stack trace of thread: java.net.socketinputstream.socketread0(native method) java.net.socketinputstream.socketread(unknown source) java.net.socketinputstream.read(unknown source) java.net.socketinputstream.read(unknown source) com.ibm.as400.access.datastream.readfromstream(datastream.java:52) com.ibm.as400.access.clientaccessdatastream.construct(clientaccessdatastream.java:58) com.ibm.as400.access.as400threadedserver.run(as400threadedserver.java:357) java.lang.thread.run(unknown source) i connecting as400 db jt400 maven depe...

excel - vba to copy selected data to multiple sheets based upon criteria -

i have code below copies data 1 table 3 other existing sheets need copy selected columns of data other sheets summary , append existing data. there 9 columns in table need copy 4 of these other sheet. column 5 holds criteria used split data , need copy columns 1,2,4 , 8. sub splitdata() dim wsinput worksheet dim wsoutput worksheet dim wsnames variant dim long dim lastrow long set wsinput = sheets("input sheet") wsnames = array("output 1", "output 2", "output 3") const filtercolumn = 7 wsinput lastrow = wsinput.range("c" & rows.count).end(xlup).row = 0 ubound(wsnames) set wsoutput = worksheets(wsnames(i)) wsoutput.cells.clearcontents wsinput.range("c105:k" & lastrow) .autofilter field:=filtercolumn, criteria1:=wsnames(i) .offset(0, 0).copy wsoutput.range("a2") end next end end sub any assistance appreciated. i use code below copy other data in same wo...

mysql - java.sql.SQLException: Cannot create JDBC driver of class '' for connect URL 'null'] with root cause -

i trying establish connection database using jndi up this context.xml have defined in webapp meta-inf folder <resource name="jdbc/connectdb" auth="container" type="javax.sql.datasource" maxtotal="100" maxidle="30" maxwaitmillis="10000" username="root" password="" driverclassname="com.mysql.jdbc.driver" url="jdbc:mysql://localhost:3306/connect" /> i calling in web.xml folder using process <resource-ref> <res-ref-name>jdbc/connectdb</res-ref-name> <res-type>javax.sql.datasource</res-type> <res-auth>container</res-auth> </resource-ref> after research resolve error, have tried referencing file in catalina folder using webappname.xml. have added jar in lib folder of tomcat , still error exists. this error trace severe: servlet.service() servlet [dispatcher] in context pa...

javascript - gulp notification dependent on task completion without .pipe -

i know can use node-notifier there better way set notification dependent on task being complete (and not use .pipe) the below works there way achieve within single task? // perform data task gulp.task('imgdata1', function() { imageexport.record({ path: path.images_src, output: path.images_data, template: 'custom.hbs', breakpointdelimiter: '--' }) }); // perform notification task gulp.task('imgdata2', ['imgdata1'], function() { notifier.notify({ 'title': 'my notification', 'message': 'data task complete!' }); }); // perform data task notification task gulp.task('imgdata', ['imgdata2']); image-size-export accepts callback invoked when imageexport.record() has finished. run notifier.notify() in callback: gulp.task('imgdata', function() { imageexport.record({ path: path.images_src, output: path.images_data, template: 'cust...

SSL error between jenkins(java) and Bitbucket Plugin -

i`m using centos 6.5 in aws. java version "1.7.0_101" openjdk runtime environment (rhel-2.6.6.4.el6_8-x86_64 u101-b00) openjdk 64-bit server vm (build 24.95-b01, mixed mode) using jenkins 2.15(new installation) , last version of bitbucket branch source plugin i start branch indexing login data bitbucket these errors: connecting https://bitbucket.org using ****/****** looking ****/****for branches fatal: failed recompute children of ***** » **** » build com.cloudbees.jenkins.plugins.bitbucket.api.bitbucketrequestexception: communication error: javax.net.ssl.sslexception: java.security.providerexception: java.security.keyexception @ com.cloudbees.jenkins.plugins.bitbucket.client.bitbucketcloudapiclient.getrequest(bitbucketcloudapiclient.java:421) @ com.cloudbees.jenkins.plugins.bitbucket.client.bitbucketcloudapiclient.getbranches(bitbucketcloudapiclient.java:217) @ com.cloudbees.jenkins.plugins.bitbucket.bitbucketscmsource.retrievebranches(bitbucketscmso...

javascript - Match a list of strings using RegEx -

i have function highlights amount of single word in string in angularjs. want change highlights of words input in array instead, i'm not sure how word regexp. here current regexp: $scope.highlight = function(haystack) { return $sce.trustashtml(haystack.replace(new regexp(needle, "gi"), function(match) { return '<span class="highlightword">' + match + '</span>'; })); }; the current "needle" variable plain string, 'cats', want change includes ['cats', 'registered', 'dog'] , on. use join() method join array elements pipe | or operator in regex. also, can use $& matched string , use in replace string. $scope.highlight = function (haystack) { return $sce.trustashtml(haystack.replace(new regexp(needle.join('|'), "gi"), '<span class="highlightword">$&</span>')); }; var arr = ['cat', ...

groovy - Why doesn't calling log.info produce output? -

please @ piece of code: import java.util.logging.logger class base { logger log = new logger(base.getclass().name); static main(args) { def b = new base(); b.log.info('hello'); } } when compile don't see errors or warnings. when try execute see empty output. why? don't instantiate new logger , use logger.getlogger() retrieve/create logger want. logger logger = logger.getlogger(base.class.name) logger.info('hello') however, if want use new logger() , looks need assign handler show log output. logger logger = new logger(base.class.name) logger.addhandler(new java.util.logging.consolehandler()) logger.info('hello')

javascript - How to create a ZIP file with Gulp that contains a lot of files? -

i have gulp task add lots of files (more 2700 in 1 case, can several thousands in others cases) in zip file. code follow: const fs = require('fs'); const archiver = require('archiver')('zip'); let zip = fs.createwritestream('my-archive.zip'); return gulp.src('app/**/*') .pipe(through.obj((file, encoding, cb) => { let pathinzip = '...'; if (!isadirectory(file.path)) { // not zip directory archiver.append(fs.createreadstream(file.path), { name: pathinzip, mode: fs.statsync(file.path) }); } cb(null, file); }, cb => { // create zip file! archiver.pipe(zip); archiver.finalize(); cb(); })); this code works on small projects, when deals more 2000 files, following error: events.js:154 throw er; // unhandled 'error' event ^ error: emfile: many open files, open 'd:\dev\app\some\file' @ error (native) so understand having 2000+ files opened @ same t...

.net - Simple migrations in Realm for Xamarin -

the documentation of realm xamarin says: realm automatically perform migrations can done without processing, adding , removing classes or adding , removing properties class. more complex changes, proper migration required. not yet have api this, planned , added soon. however, when add new field model, app crash due required migration. my question is: how can make use of automatically performed migrations? it known documentation issue: https://github.com/realm/realm-dotnet/issues/669 what can explicitly increment schema version each time simple model changes: var config = realmconfiguration.defaultconfiguration; config.schemaversion = 1; // increment when model changes

python - 3D tensor input to embedding layer in keras or tensorflow? -

i want build network takes in sentences input predict sentiment. input looks (num of samples x num of sentences x num of words). want feed in embedding layer learn word vectors can summed sentence vector. type of architecture possible in keras? or tensorflow? documentation keras's embedding layer takes in input (nb_samples, sequence_length). there work around possible? i guess class resolves keras: class anyshapeembedding(embedding): ''' embedding works inputs of number of dimensions. can accomplished changing output shape computation. ''' #@overrides def compute_output_shape(self, input_shape): return input_shape + (self.output_dim,)

java - How to mock a file required by a Bean at initialization in JUnit tests -

i have bean reading file @ initialization. file environment specific , generated during installation of system. path of file hardcoded final static variable in code. private static final string file_path = "/etc/project/file.path"; private string decryptedpassword = ""; @autowired public classtobetested(@value("${pass}") string encryptedpassword) { string decryptedpassword = staticclass.decrypt(encryptedpassword, file_path); } i need somehow mock file in junit tests can test rest of functionalities. @before annotation not useful because run after initialization of beans according tests. one dirty way can used add parameter autowired function can indicate if call unit test or not. not clean way this. example: private static final string file_path = "/etc/project/file.path"; private string decryptedpassword = ""; @autowired public classtobetested(@value("${pass}") string encryptedpassword, @value("...

ubuntu - How to prevent multiple instances of HAProxy? -

i experiencing problem cited in answer below question - having multiple instances of haproxy created inadvertently, result of netstat -tulpn | grep 80 several copies of haproxy listening on single port. haproxy random http 503 errors i know can kill pid# rid of excess instances, there way prevent them? see mention of similar problem here: https://github.com/haproxy/haproxy/issues/51 but relates multiple frontends in single config. there similar solution - way tell haproxy not initiate on port occupied? looks problem this: my provisioner starting haproxy 1 user, while deployment system restarting haproxy separate user - 2 copies of haproxy ended running. so, of course solution make them both run via same user.

javascript - Get first element with condition in Angular -

i have following angular 1.0 code: <div ng-repeat="ebook in vml.ebooks"> <img data-ng-src="{{ ebook.files.filter(function (v) { return v.type === 'ebook.cover'; })[0].url }}" /> </div> but error: "error: [$parse:syntax] syntax error: token 'ebook' unexpected token @ column 55 of expression ['ebook.files.filter(function (v) { return v.type === 'ebook.cover'; })[0].url'] starting @ [ebook.cover'; })[0].url']. how can solve this? would possible convert filter? on list of objects (files) need first 1 given type. you can't use array.prototype.filter method in angular expression. however, should able angular filter. corresponding expression this: data-ng-src="{{ (ebook.files | filter:{type:'ebook.cover'})[0].url }}"

CSS - how to get position: absolute; to work well with different screen sizes -

if want element positioned @ position on screen can use: position: absolute; top: 614px; left: 215px; and on screen works perfect, element right want be. if use bigger screen wrong , if use small screen might have scroll see element @ all. how can fix this? i've tried researching , figured quite normal issue haven't found helpful. thanks! the position absolute css works placing absolutely respect parent element. if parent element doesn't exit default way html element. in short means if parent changes absolute positioning changes. it's better idea use percentages if want responsive. can use media queries adjust positions required. .my-absolute-px{ position: absolute; top: 100px; left: 100px; } .my-absolute-percent{ position: absolute; top: 50%; left: 45%; } <div class="my-absolute-px">some px content</div> <div class="m...

ruby - Chef-solo create cron based on node.name -

at moment need install staggered crons based on hostname recipe installs clamac. have small example works end product need work on hundreds of different hostnames ascending numbers. server example: myserver-db[1-12], anotherserver-acc[1-9]. cron 'clam-scan-weekly staggered 1' only_if {node.name == 'myserver-db1' || 'myserver-db3' } minute 30 hour 22 weekday 1 command '/usr/bin/clamscan --exclude-dir="/dev/|/proc/|/run/|/sys/" -l clamscan.log -r /' user 'root' end cron 'clam-scan-weekly staggered 2' only_if {node.name == 'myserver-db2' || 'myserver-db4' } minute 30 hour 22 weekday 1 command '/usr/bin/clamscan --exclude-dir="/dev/|/proc/|/run/|/sys/" -l clamscan.log -r /' user 'root' end the end goal create 3 of 4 staggered cron jobs based on hostnames. looked ruby_blocks , migh...

gcc - Is it possible to get "execution time consumption" information from gcda files? -

as know compiling code -fprofile-arcs flag makes generate .gcda file after code execution. -ftest-coverage flag , .gcno file after compilation, possible information code executed , how many times , called code coverage report. is possible in similar way .gcna files profile information similar gprof, functions calls count , execution time information? i afraid mistaking terminologies here. gprof: c/c++ program profiler. purpose generate profiling information particular execution, consists of performance statistics control flow between different functions , there relationship propagated time consumed parent function , child functions individually well. so, focus here find performance degrading points in program. where as, gcov: c/c++ coverage analysis tool. purpose counts of execution each statement, branches , blocks. so, focus here coverage stats. hence, moral of story these 2 tools have different purpose of life. ;) if wish both information can go gprof th...

scala - Preparing to use neo4j bolt with Play Framework -

i want access neo4j db play framework application in addition mysql db. mysql access working properly. in preparation code accessing neo4j via bolt, have: added reference driver in project build.sbt: librarydependencies ++= seq( jdbc, cache, ws, specs2 % test, "org.mindrot" % "jbcrypt" % "0.3m", "mysql" % "mysql-connector-java" % "5.1.38", "org.neo4j" % "neo4j-bolt" % "3.0.1" ) and restarted activator , watched apparently resolve/retrieve dependency can find in ~/.ivy2/... i have placed reference database in application.conf seen in snippet: db.default = { driver: com.mysql.jdbc.driver url: "jdbc:mysql://127.0.0.1/borg" username: "borg" password: "xxxxx" } # bolt port # defaults 7687 hope db.neo4j = { driver: org.neo4j.jdbc.driver url: "jdbc:neo4j:bolt://neo.myco.com" username: "neo4j" password: "...

python - What is the proper way to import large amounts data into a Firebase database? -

i'm working dataset of political campaign contributions ends being approximately 500mb json file (originally 124mb csv). it's far big import in firebase web interface (trying before crashed tab on google chrome). attempted manually uploading objects made csv (using csvtojson converter, each row becomes json object, , upload object firebase came). here's code used. var firebase = require('firebase'); var converter = require("csvtojson").converter; firebase.initializeapp({ serviceaccount: "./credentials.json", databaseurl: "url went here" }); var converter = new converter({ constructresult:false, workernum:4 }); var db = firebase.database(); var ref = db.ref("/"); var lastindex = 0; var count = 0; var section = 0; var sectionref; converter.on("record_parsed",function(resultrow,rawrow,rowindex){ if (rowindex >= 0) { sectionref = ref.child("reports" + section); var repo...

javascript - Grouping JSON by values -

using lever job posting api, i'm getting json results sorted location, , i'm trying figure out how group results "team" within results, shopify careers page. here codepen , here json i tried adding following on line 38 of codepen try grab team values, it's not outputting expected (i'm getting 1 letter per line, isn't helpful): for (var x in _data[i].postings[j].categories.team) i'm sure it's super simple, i'm not javascript guy. appreciated! assume , json output is outjson= [ { team: "teama", name: "ahmed", field3:"val3" }, { team: "teamb", name: "ahmed", field3:"val43" }, { team: "teama", name: "ahmed", field3:"val55" }, ] then see groupby function in demo below: demo : outjson= [ {team: "teama",name: "ahmed",field3:"val3...

how to print dictionary data in the tabular form in python -

i have nested dictionary follows.i want print data in tabular form. condition here want print data in table example : birt, name, , sex. how can that? import sys import pandas pd indi ={} indi = {'@i7@': {'birt': '15 nov 1925', 'fams': '@f2@', 'name': 'rose /campbell/', 'deat': '26 aug 2009', 'sex': 'f'}, '@i5@': {'birt': '15 sep 1928', 'fams': '@f3@', 'name': 'rosy /huleknberg/', 'deat': '10 mar 2010', 'sex': 'f'}} person = pd.dataframe(indi).t person.fillna(0, inplace=true) print(person) output birt deat famc fams name sex @i5@ 15 sep 1928 10 mar 2010 0 @f3@ rosy /huleknberg/ f @i7@ 15 nov 1925 26 aug 2009 0 @f2@ rose /campbell/ f documentation: http://pandas.pydata.org/pandas-docs/stable/generated/pandas...

7zip cmd line write a file name with underscores -

this seems simple 1 can't find anywhere! i want zip file command: @"a -tzip -mx0 -v500m -mmt -- c:\greg_folder\zippedpackage.zip d:\tmp\failedimages"; this means i'd zip folder "d:\tmp\failedimages" , move "c:\greg_folder\zippedpackage.zip" the problem: want zip "greg_folder" , not 'greg folder"... underscores seem translated spaces in cmd line. need way want underscores treated literally part of directory name. any ideas? i compressed folder on drive using command without @ , quotes. "c:\program files\7-zip\7z.exe" -tzip -mx0 -v500m -mmt -- c:\greg_folder\zippedpackage.zip k:\devkitpro\devkitarm\arm-eabi i did not put "@" sign other option (and bug seems strange side-effect), , created "greg_folder" directory , .zip.001 file inside.

html - Different column posts in tumblr theme -

i'm making tumblr theme, based on 2 columns. in left column, there entries tagged, in right 1 entries without tag. so have {block:posts} in every column div, in 1 entries tags rendered, in other 1 else. somehow both columns filled entries, no matter of type are. my code looks right now: <div class="columns"> <div class="column1"> {block:posts} <div class="post"> {block:hastags} <ul class="tags"> {block:tags} <li> <a href="{tagurl}">{tag}</a> </li> {/block:tags} </ul> {/block:hastags} </div> {/block:posts} </div> <div class="column...

c# - Read from word document line by line -

i'm trying read word document using c#. able text want able read line line , store in list , bind gridview . code returns list of 1 item text (not line line desired). i'm using microsoft.office.interop.word library read file. below code till now: application word = new application(); document doc = new document(); object filename = path; // define object pass api missing parameters object missing = system.type.missing; doc = word.documents.open(ref filename, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing); string read = string.empty; list<string> data = new list<string>(); foreach (range tmprange in doc.storyranges) { //read += tmprange.text + "<br>"; data.add(tmprange.text); } ((_docu...

c# - Rewriting a Value in a For Loop -

[ resovled. again! dunno why loops trip me up, haha. ] yet loop question. think going calling card. time, i'm working c#. trying figure out way phrase this, base code: string[] daftchildren = new string[] { "deidra", "jolie", "johnna", "kayben", "saber", "adam" }; (int = 0; < daftchildren.length; ++) { console.writeline(daftchildren[i] + " member of family."); if (daftchildren[i] == "saber") { console.write("saber part of family... now."); } } the code self explanatory: i'm using for loop list each member of family. if 1 of family members listed saber, prints "saber part of family... now." here's rub. with above code, output print "saber part of family" , "saber part of family... now." how write only if block prints. i hope asked enough. in advance! a sneaky way it: ...

android - Open keyboard hides the toolbar below fragment -

Image
i have fragment put in activity. fragment consists of videoview and edittext component. dont have problem showing video or edit text. problem occurs when try edit text. when text edited , close keyboard. panning have removed toolbar. or atleast put behind fragment reason anyone know why happening? never seen problem before add android:windowsoftinputmode="adjustresize" in manifest 'activity' element

machine learning - How does one keep track of the training error of a Neural Network when using Batch Normalization in TensorFlow? -

i wanted keep track of training error neural network trained. during testing, customary remove batch normalization layer. example: # when test # is_training determines if batch-norm off or on error = sess.run([opt, loss], feed_dict={x: bx, y: by, is_training=false}) however, want track training error of neural network number of iterations increases. simplicity assume data sets large enough train model , small enough computing error on entire data set feasible (i know possible use batches make computations more efficient or moving averages, besides point of question). in case correct way track training error turning off batch normalization follows: bx, = x_train, y_train train_error = sess.run([opt, loss], feed_dict={x: bx, y: by, is_training=false}) i.e. should use data trained turn off batch normalization? notice if doing training is_training=true should invariable true. i.e. training step is: bx, = get_batch(x_train, y_train) b_error = sess.run([opt, loss], fee...

Autodesk Forge Model Derivative API: OBJ files -

using autodesk forge model derivative api query geometry attributes revit files results in large obj files; e.g. 30-40mbs revit file transforms 1gbs obj file. is there documentation on generating optimized obj files via forge model derivative api? there other alternatives downloading optimized geometry attributes? forge viewer seems take svf fileformat input. svf recommended file format custom made webgl viewers , there documentation available on svf? yes, obj file can becomes big since describe each triangles , believe isn't optimized @ point. forge api allows request geometry individual components. example, ask specific wall, door, or others geometry. forge model derivative endpoint post job can specify objects want: see objectids array below. { "input": { "urn": "string", "compressedurn": false, "rootfilename": "string" }, "output": { "formats": [ { ...

java - Android Emulator in Android Studio does not show my app -

i'm working on android application using android studio. when run code on nexus 5 api 21 x86 emulator, emulator not show application trying debug. went applications, still cannot find app trying test. however, emulator still show app previous project working on. log doesn't show errors either when compiling gradle , starting emulator. from researching other posts, believe may have version of emulator running. not sure if case , if how fix it. have pasted copy of manifest below , gradle.build. please let me know wrong, problem has been irritating me last several days. <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.jamescho.androidgame" android:versioncode="1" android:versionname="0.5" > <uses-permission android:name="android.permission.wake_lock" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-...

javascript - How to update a div based on it's position relative to another div -

i trying find best way update div id "date" dates of divs scrolled past. thought may done through getting data-date attributes having trouble obtaining ids of divs scrolled past. in case content of date div, should start out 25 july , div id=2 passes date div, content of date div should change 25 july , on. index.html: <html> <head> <style> #comments { float:left; width:450px; } #date { position: absolute; top: 0; margin-top: 20px; border: 1px solid #a9f5f2; background-color: #a9f5f2; color: #6e6e6e; font-weight: bold; } </style> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"> </script> <script> $(document).ready(function() { $(function () { $(window).scroll(function (event) { var p = $('#date').closest('[id]'); console.log(p); }); }); }); </script> </head> <body> <div id="1" data-date="25 july"> comment 1 comment 1...

datetime - Python: os.path.getmtime() for TZ agnostic timestamps originating from SD cards with different formats -

(note: may superuser question, since deals more how computer interprets timestamp... has implications programming deals timestamps originating external device.) problem construction: format 3 sd cards in fat32, ntfs, , exfat create file on each of them using tz agnostic device (eg camera, or scientific instrument set time , date, no tz) @ precisely 12:00:00 copy 3 files computer on california time (utc-7) run python: os.path.getmtime() on each. results vary. it seems #3 critical step. here believe happens timestamps -- can confirm if correct? since fat32 records timestamps in localtime, computer assumes file created @ 12:00:00 california time (utc-7) , copies file timestamp of 19:00:00 (utc) since ntfs records timestamps in utc, computer assumes file created @ 12:00:00 utc, , copies file timestamp of 12:00:00 (utc) since exfat odd, stores in utc -- can include tz offset in master record -- assumptions go out window. does computer assume utc or utc-7 copies exfa...

ruby on rails - Karma fails to instantiate main app module -

Image
unit testing karma , jasmine...karma can't find main module of app called 'fuse' defined in app.js 'fuse':error: [$injector:nomod] module 'fuse' not available! either misspelled module name or forgot load it. if registering module ensure specify dependencies second argument. http://errors.angularjs.org/1.5.8/$injector/n i've tried moving around dependencies in karma.conf.js , i've tried specifying browserify or requirejs possible solution. not sure how proceed , use pointer in right direction. here file structure: and here karma.conf file: // karma configuration // generated on fri jul 22 2016 15:18:36 gmt-0500 (cdt) module.exports = function(config) { config.set({ // base path used resolve patterns (eg. files, exclude) basepath: '', // frameworks use // available frameworks: https://npmjs.org/browse/keyword/karma-adapter // list of files / patterns load in browser files: [ //angular mocks 'bower_comp...

python - How to get x and y coordinates from matplotlib scatter plot using plt.gca()? -

is there way x , y coordinates of scatter plot points matplotlib axes object? plt.plot() , there attribute called data , following code not work: x = [1, 2, 6, 3, 11] y = [2, 4, 10, 3, 2] plt.scatter(x, y) print(plt.gca().data) plt.show() --------------------------------------------------------------------------- attributeerror traceback (most recent call last) <ipython-input-30-9346ca31279c> in <module>() 41 y = [2, 4, 10, 3, 2] 42 plt.scatter(x, y) ---> 43 print(plt.gca().data) 44 plt.show() attributeerror: 'axessubplot' object has no attribute 'data' import matplotlib.pylab plt x = [1, 2, 6, 3, 11] y = [2, 4, 10, 3, 2] plt.scatter(x, y) ax = plt.gca() cs = ax.collections[0] cs.set_offset_position('data') print cs.get_offsets() output is [[ 1 2] [ 2 4] [ 6 10] [ 3 3] [11 2]]

Accessing a service from a different module in AngularJS -

i have code have hexafy service in 1 module want access in different module: <!doctype html> <html> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <body> <div ng-app="myapp" ng-controller="myctrl"> <p>the hexadecimal value of 255 is:</p> <h1>{{hex}}</h1> </div> <div ng-app="myapp2" ng-controller="myctrl2"> <p>the hexadecimal value of 155 is:</p> <h1>{{hex2}}</h1> </div> <p>a custom service whith method converts given number hexadecimal number.</p> <script> var app = angular.module('myapp', []); app.service('hexafy', function() { this.myfunc = function (x) { return x.tostring(16); } }); app.controller('myctrl', function($scope, hexafy) { $scope.hex = hexafy.myfunc(255); }); var app2 = angular.module('myapp2'...

ios - how to use dict inside a plist -

i have plist file like <dict> <key>horse</key> <dict> <key>level</key> <integer>2</integer> </dict> </dict> and load code bellow let path = nsbundle.mainbundle().pathforresource("test", oftype: "plist") database = nsdictionary(contentsoffile: path!) let array = nsmutablearray() member in (database.allkeys) { let level = member.valueforkey("level") as! int if () { //do } } when app runs, crash. reason think member in database can't cast nsdictionary since it's nstaggedpointerstring, don't know how make work. update: the previous question, have addressed answer @wonzigii, , got right dict using method defined validatecard(), @wonzigii said bellow. func validatecard() -> nsarray? now want randomly retrieve item inside new array use something, i'm solving issue using random index, seem can't array item index, since if...

compiler construction - Binding against LLVM 3.8.4 no getGlobalContext -

i attempting follow https://github.com/lsegal/my_toy_compiler , though has been updated llvm 3.8.0, unable compile using llvm 3.8.4 brew --with-clang --with-lld --with-jit --with-python . following error, use of undeclared identifier 'getglobalcontext' . additionally symbol getglobalcontext not appear in /usr/local/opt/llvm/include/llvm/ir/llvmcontext.h or indeed anywhere in /usr/local/opt/llvm/include directory. i expect either function has been deprecated recently, (for have not been able find evidence), or not building correctly. any tips appreciated. note have seen trouble linking against llvm project including flex , bison , did not resolve particular problem i encountered same problem llvm 4.0. solution follows. old: llvmcontext *llvmcx; llvmcx = &getglobalcontext(); new: llvmcontext *llvmcx; static llvmcontext myglobalcontext; llvmcx = &myglobalcontext;

How can set pop-up menu position in QML -

i want fix position of pop-up menu in qml. when click on setting button,i want pop-up menu display @ fixed position. did day can't. how can in qml. also, want change size of menu item(width , height). hope help! that depends on qtquick.controls version. in 2.0 can define size , position(and more - must do) import qtquick 2.7 import qtquick.controls 2.0 //import qtquick.controls 1.4 import qtquick.window 2.0 window { id: window width: 500 height: 500 visible: true mousearea { anchors.fill: parent onclicked: { menu.x = (window.width - menu.width) / 2 menu.y = (window.height - menu.height) / 2 //menu.__popup(qt.rect(200,200,100,100),0,0); menu.open(); } } menu { id: menu menuitem { text: "item1" } menuitem { text: "item2"; } menuitem { text: "item3"; height: 100 } } } in 1.4 (see commented lines...

jquery - bootstrap with DataTables not stacking properly -

html: <div class="container"> <div class="row" style="height: 512px"> <div class="col-sm-9"> <div class="firstdiv"></div> <div class="datatableswrapper"> <table id="mydatatable"> <thead></thead> <tbody></tbody> </table> </div> </div> <div class="col-sm-3 thirddiv"></div> </div> </div> i trying put datatable within col-sm-9 class responsive , stack when resized. happens though stacks above col-sm-3 class div , blocks it. can't seem find examples how structure datatables responsive. want this: col-sm-9 col-sm-3 ------------- ------------- | firstdiv | | thirddiv | | height:50%| |height:100%| ------------- | | ------------- | | ...

Hadoop shutdown, how to stop hadoop in pseudo distributed mode? -

i try use stop-dfs.sh kill hadoop process, failed. shall have use brutal force kill -9? [root@trdstorm sbin]# sudo ./stop-dfs.sh 16/07/26 10:19:56 warn util.nativecodeloader: unable load native-hadoop library platform... using builtin-java classes applicable stopping namenodes on [localhost] root@localhost's password: localhost: permission denied, please try again. root@localhost's password: localhost: no namenode stop root@localhost's password: localhost: no datanode stop stopping secondary namenodes [0.0.0.0] root@0.0.0.0's password: 0.0.0.0: no secondarynamenode stop --> no secondaryname stop, grep, has. 16/07/26 10:20:33 warn util.nativecodeloader: unable load native-hadoop library platform... using builtin-java classes applicable [root@trdstorm sbin]# ps -aef | grep secondary hadoop 7406 1 0 jul15 ? 00:09:38 /usr/java/jdk1.8.0_60/jre/bin/java -dproc_secondarynamenode -xmx1000m -djava.net.preferipv4stack=true -dhadoop.log.dir=/usr/local/hado...