Posts

Showing posts from June, 2010

Node.js module install location -

is possible install node_module outside of node_modules folder? for example: i'm trying install gulp , have gulp in separate folder in workspace workspace |-gulp |-node_modules | |- ... | |- ... this possible , extremely ill-advised. you hypothetically fork github repository , require('./gulp') instead of require('gulp') , doing give following fun , exciting challenges face: you no longer have power of semantic versioning available through npm . , consumers of application locked exact (and arbitrary) commit of gulp decide fork, and... you have make pull-request , updates application's gulp dependency. you have commit dependency project. 1 serves unnecessarily bloat application. when loading application onto remote service limited resources (such limitation of memory or disk space), you'd wasting valuable real-estate potential performance enhancements such caching, etc. if of above okay you, means feel free organize appl...

c# - Automapper custom object -

how have configure automapper map this: class source { guid id; double price; } to this: class destination { guid id; destinationdifference difference; } class destinationdifference { decimal amount; } first: should read faqs on how post question , information should added. (no, i'm not downvoter) here example how mapping work. please note, i've changed classes bit, because automapper needs properties. source source = new source(); source.id = guid.newguid(); source.price = 10.0; mapper.initialize(x => x.createmap<source, destination>() .formember(a => a.difference, b => b.mapfrom(s => new destinationdifference() { amount = (decimal)s.price }))); destination destination = mapper.map<source, destination>(source); classes: class source { public guid id { get; set; } public double price { get; set; } } class destination { public guid id { get; set; } public destinationdifference difference { get; s...

c# - Deserialize xml into class having string values in xml -

let me explain, there database table has 1 xml column named audits , other common types of column. so possible deserialize below xml class. <?xml version="1.0"?> <entity type="order"> <id type="system.int64">146</id> <ordernumber type="system.string">od555</ordernumber> <audits type='system.string'> <audit> <item> <create timestamp='2017-07-19 10:02:13' userid='23' /> </item> <invoice> <create timestamp='2017-07-19 10:03:37' userid='45' /> </invoice> </audit> </audits> </entity> class: public class order { public long id { get; set; } public string ordernumber { get; set; } public string audits { get; set; } } modifying model attributes xmltype , xmlanyelement (requires xmlelement type) ...

java - Find file in external jar not in my classpath -

i´m running test , need path of file it´s in jar lib have in project dependency. this jar not part of classpath run. if try like val path = getclass.getresource("h2-1.3.161.jar").getpath in test not work. any idea how find file inside jar without jar part of classpath? regards. using solution of astrograph manage route java -cp //file:/d:/users/nb38tv/workspace/f2e-core/f2e-mock/f2e-test-framework/target/f2e-test-framework-1.8.3-snapshot.jar!/h2/sakila-h2-master/h2-1.3.161.jar -ifexists -tcp -web -tcpallowothers but java complain since cannot find jar. if remove ! path receive error unrecognized option: -ifexists error: not create java virtual machine. error: fatal exception has occurred. program exit. any idea? regards is file .class file? can open file in test? can instantiate class jar file? to location of class can use following method: system.out.println(this.getclass().getprotectiondomain().getcodesource().getlocation().tou...

javascript - Modify Menu - modify the file min.js -

i'm having little difficulty modifying menu. currently finds in following order: popular albums popular genres top 50 new releases but wanted add button called home. menu this: home popular albums popular genres top 50 new releases but besides modifying page contains menu, have modify file min.js - thing not minina idea begin. i'll attach 2 codes. left-panel.html <section id="left-panel" class="togglable-sidebar" ng-class="{ closed: isphone }"> <div ng-controller="playlistmodifycontroller" class="left-panel-inner"> <div class="content" pretty-scrollbar> <a ui-sref="home" class="logo hidden-phone"><img ng-src="{{ utils.getlogourl('light') }}" alt="logo"></a> <div class="search-bar"> <input type="text" placeholder="{{:: ...

javascript - Filter markers to display on google maps from search results -

i'd display on google maps markers after having search database elements. database made of restaurants latitude, longitude, address , restaurant's title. user searches restaurant based on city name, i'd display corresponding markers. my problem can't figure out how link search results google markers. idea ? hereafter code : index.html.erb <div id="map"></div> <% content_for(:after_js) %> <script> $(function() { var handler = gmaps.build('google'); handler.buildmap({ internal: { id: 'map' } }, function() { markers = handler.addmarkers(<%= raw @hash.to_json %>); handler.bounds.extendwith(markers); handler.fitmaptobounds(); if (markers.length == 0) { handler.getmap().setzoom(2); } else if (markers.length == 1) { handler.getmap().setzoom(14); } }); }); </script> <% end %...

oauth 2.0 - What is the difference between these 2 google auth code approaches? -

https://developers.google.com/identity/sign-in/web/build-button and https://developers.google.com/identity/protocols/oauth2useragent or https://developers.google.com/identity/protocols/oauth2 in general the first 1 authenticates? if so, means can use google api data want? then whats second 1 for? which 1 use if want gmail messages of calendar events? thanks.

android - Are upgrades within the same major version guaranteed to be compatible for the device? -

is reasonable assume devices running android 4.1 upgraded android 4.4? or system requirements change minor upgrades? is reasonable assume devices running android 4.1 upgraded android 4.4? imho, no, because "all" rather expansive term. within confines of google play ecosystem, there changes in compatibility definition document (cdd) requirements between 4.1 , 4.4 (e.g., minimum available storage raised 1gb). need create detailed diff of requirements, decide subset of requirements care about, determine devices meet requirements 4.1 , 4.4. and devices outside of google play ecosystem, goes. likely, non-play devices shipped 4.1 did not meet cdd requirements 4.1, non-play devices not obligated comply cdd. such devices less able run 4.4 successfully.

scala - Spark Structured Streaming not restarting at Kafka offsets -

we have long running spark structured streaming query reading kafka, , query pick left off after restart. however, have set startingoffsets " earliest " , see after restarts query reads start of kafka topic again. our basic query looks this: val extract = sparksession .readstream .format("kafka") .option("kafka.bootstrap.servers", "server:port") .option("subscribe", "topic") .option("startingoffsets", "earliest") .load() val query: streamingquery = extract .writestream .option("checkpointlocation", s"/tmp/checkpoint/kafka/") .foreach(writer) .start() we see checkpoint directory getting created correctly , offsets expect in offset files. when restart see message like: 25-07-2017 14:35:32 info consumercoordinator:231 - setting newly assigned partitions [kafkatopic-2, kafkatopic-1, kafkatopic-0, kafkatopic-3] group spark-kafka-s...

ios - return from initializer without initializing all stored properties (self.ref is not initialized) -

when input code twitter app error return initializer without initializing stored properties code var ref: firdatabasereference! saying self ref not initialized import foundation import firebasedatabase struct meme { var ref: firdatabasereference! var key: string! var username: string! var name: string! var tweetid: string! var tweettext: string! var tweetimageurl: string! var tweeterimageurl: string init(username: string, memeid: string, memetext: string, memeimageurl: string, memerimageurl: string, name: string, key: string = ""){ self.username = username self.name = name self.memeid = memeid self.memeimageurl = memeimageurl self.memetext = memetext self.memerimageurl = memerimageurl } init(snapshot: firdatasnapshot){ self.name = snapshot.value!["name"] as! string self.memerimageurl = snapshot.value!["memerimageurl"] as! string self.memetext = snapshot.value!["memetext"] as! string sel...

javascript - Leaflet popup on each marker using Leaflet playback -

i have geojson such { "type": "feature", "geometry": { "type": "multipoint", "coordinates": [ [ -123.77252789, 44.37857221 ], [ -123.77317087, 44.37864694 ], [ -123.77383407, 44.37875853 ], [ -123.7744676, 44.37886305 ] ] }, "properties": { "time": [ 1369786338000, 1369786340000, 1369786342000, 1369786344000 ], "temp":[70f,60f,72f,80f], "title": "car1" } } using leaflet playback , able make marker moving, want each marker has there own popup showing time , temp while moving. have tried : var playbackoptions = { marker: function (featuredata) { return { getpopup: function (feature) {...

python - getting ValueError: operands could not be broadcast together with shapes (3,224,224) (3,) when trying to subtract from channel wise mean in Caffe -

this follow-up question this . want subtract each image mean. based on issue on github , this other similar question , , this classification example when feed cropped version of images network, need subtract mean pixel using sth : mu = mean_file.mean(1).mean(1) but irony when want this: .. = (img[:,0:224,0:224] - mu) i valueerror: operands not broadcast shapes (3,224,224) (3,) i'm not well-versed @ python , numpy , can't figure out error message trying convey, appreciated. currently, i'm cropping mean file! not ideal! better nothing! .. = (img[:,0:224,0:224] - mean_image[:,0:224,0:224]) replace mu = mean_file.mean(1).mean(1) with mu = mean_file.mean(1).mean(1)[:,none,none] it seems trying subtract 1d vector ( shape of (3,) ) 3d array ( shape of (3,224,224) ). in order numpy needs broadcast 1d vector dimensions of 3d array (much matlab's bsxfun ). numpy understand dimensions broadcast, 1 needs add singleton dimensions 1d vector:...

mongodb - Group by day with Multiple Date Fields -

i have documents stored mongodb : { "_id" : "xbpnkbdgsggfnc2mj", "po" : 72134185, "machine" : 40940, "location" : "02a01", "indate" : isodate("2017-07-19t06:10:13.059z"), "requestdate" : isodate("2017-07-19t06:17:04.901z"), "outdate" : isodate("2017-07-19t06:30:34z") } and want give sum, day, of indate and outdate. i can retrieve of both side sum of documents indate day and, on other side, sum of documents outdate , sum of each. currently, use pipeline : $group: { _id: { yeara: { $year: '$indate' }, montha: { $month: '$indate' }, daya: { $dayofmonth: '$indate' }, }, count: { $sum: 1 }, }, and give : { "_id" : { "year" : 2017, "month" : 7, "day" : 24 }, "count" : 1 } { "_id"...

vsts - How do you integrate Visual Studio Web tests in TFS 2017 U2? -

installed tfs 2017 u2 , can see 1 of new features visual studio test 1 of available tasks in release management can not find guidance how integrate visual studio webtests that. possible incoporate webtest straight tfs ui? no, visual studio test task using vstest.console.exe execute tests documented @ vstest.console.exe command-line options . to run web test need use visual studio , mstest.exe . more tutorial integration of web test , tfs, refer below links: guide started visual studio web load testing , automation running webtests part of vsts vnext release pipeline

angularjs - Jekyll trying to post with angular js -

This summary is not available. Please click here to view the post.

PrestaShop 1 Click Upgrade Access Denied -

Image
please me in upgrading prestashop 1.6 1.7 new . when tried click on "1 click upgrade" admin says "access denied" . what's problem ? this screenshot :

java - Change dataset according to url path -

i have java spring boot project 3 webservices each uses different databases. databases work fine, , using annotations have managed switch databases according services. thing need change connection according 1 of path parameters. my service: @service public class clientservice { @autowired @qualifier("client") // set client db private jdbctemplate jdbctemplate; @transactional(readonly=true) public list<clientdto> findclient(string clientnum) { string sql = "select * client cli_number = ? "; return jdbctemplate.query(sql, new object[] {client}, new clientdtorowmapper());} in controller have: @requestmapping("/client") and @requestmapping(value = "/{clientnum}/", method = requestmethod.get) i need pass countryid on path, , change db according countryid, without having declare different webservices each country,as use same query. path should be: @requestmapping(value = "/{clientnum}/{countryid}'", m...

ASP.NET MVC Login through database -

i have code here login, it's working can see, hard coded username , password, database accounts, preferably using raw sql not entity framework, please help. [httppost] public actionresult login(loginviewmodel login) { if (!modelstate.isvalid) { viewbag.error = "form not valid; please review , try again."; return view("login"); } if (login.username == "bpradmin" && login.password == "admin123") formsauthentication.redirectfromloginpage(login.username, true); viewbag.error = "credentials invalid. please try again."; return view("login"); } i recommend entity framework. should choose between code first or database first. framework easy understand , can pretty cool things once have understood order of events. link tutorial entity framework http://www.entityframeworktutorial.net/

Javascript/DOM: How to remove all events of a DOM object? -

just question: there way remove events of object, e.g. div? edit: i'm adding per div.addeventlistener('click',eventreturner(),false); event. function eventreturner() { return function() { dosomething(); }; } edit2: found way, working, not possible use case: var returnedfunction; function addit() { var div = document.getelementbyid('div'); returnedfunction = eventreturner(); div.addeventlistener('click',returnedfunction,false); //you have take here var , not direct call eventreturner(), because function address must same, , change, if function called again. } function removeit() { var div = document.getelementbyid('div'); div.removeeventlistener('click',returnedfunction,false); } i not sure mean remove all events . remove handlers specific type of event or event handlers 1 type? remove event handlers if want remove event handlers (of type), clone element , replace clone: var clo...

Maven: Build different WAR files of same project including different module dependencies -

i have maven project consisting of parent project , several modules, foo , bar , foobar , web . <modules> <module>foo</module> <module>bar</module> <module>foobar</module> <module>web</module> </modules> web has foo , bar , foobar dependencies , built war. several reasons need build war contains foo , bar not foobar . best way achieve this? there possibility use maven profiles define different dependencies? or best solution add second war-building module (e.g. web2 ) without foobar dependency answer suggests: maven generating 2 different war files same project (see "multi module structure" in answer) assuming artifact type of top level pom "pom", modules node aggregator , specifies build execution order - doesn't specify dependencies each child module are. you can add web2 module @ bottom in parent pom, , in web2's pom can specify artifact type of war , dep...

javascript - Capture video frame on chrome -

i have problem chrome, so, have script can take image video on server x seconds. works on firefox, not chrome. script , this one doesn't work, video timer doesn't change (0 seconds) so, have x images, same. note : script works great local source. thank ! var = 0; var video = document.createelement("video"); var thumbs = document.getelementbyid("thumbs"); video.addeventlistener('loadeddata', function() { thumbs.innerhtml = ""; video.currenttime = i; }, false); video.addeventlistener('seeked', function(){ generatethumbnail(i); i++; if (i <= video.duration) { video.currenttime = i; } else { alert("done!") } }, false); video.preload = "auto"; video.src = "myvideolinkonserver"; function generatethumbnail() { var c = document.createelement("canvas"); var ctx = c.getcontext("2d"); c.width = 160; c.height = 90; ctx.dra...

Error in cordova run android -

Image
unable run cordova app in android device getting error while connecting android device , running command "cordova run android" the error because there no android device detected though connected. should connect android device , enable developer options in settings . further enable usb debugging let cordova install app device. u need select ok on pop message comes after enabling usb debugging. check this step step procedure if are not getting developer options in settings. you can list of available devices , emulators configured using command - cordova run android --list hope helps.

database - Jmeter java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended -

i trying delete record database using jmeter , having difficulties. can query fine, when comes delete, getting error. enter following code in jmeter: delete data_records data_records_id = (select id data_records_store resource_identifier='somevalue'); delete data_records_store resource_identifier='somevalue'; after running test in jmeter following error: java.sql.sqlsyntaxerrorexception: ora-00933: sql command not ended however when enter same code in sqldeveloper, sql runs script , deletes appropriate data. the query type set to: update statement , have nothing in remaining fields: parameter values, parameter types, variable names, etc. mention running jmeter 3.2 gui mode. if me out appreciated. thanks! separate 2 jdbc requests: delete data_records data_records_id = (select id data_records_store resource_identifier='somevalue') delete data_records_store resource_identifier='somevalue'

python - NOT NULL constraint failed: news_comment.post_id -

i bounced error. models.py file is class post(models.model): user = models.foreignkey(user,related_name='posts') created_at = models.datetimefield(auto_now=true) message = models.textfield() message_html = models.textfield(editable=false) def __str__(self): return self.message def save(self,*args,**kwargs): self.message_html = misaka.html(self.message) super().save(*args,**kwargs) def get_absolute_url(self): return reverse('news:single',kwargs={'username':self.user.username,'pk':self.pk}) class meta(): ordering = ['-created_at'] class comment(models.model): post = models.foreignkey('news.post',related_name='comments') aurthor = models.charfield(blank=false, max_length=100) comment = models.textfield(blank=true) created_date = models.datetimefield(auto_now = true) comment_html = models.textfield(editable = false) def save(sel...

GridView: Attempt to invoke virtual method.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup)' on a null object reference -

i have listview , i'm trying go gridview onitemcliclick listener. have exception on adapter put can't solve it. the list view fragment , works well! the exception is: java.lang.nullpointerexception: attempt invoke virtual method 'android.view.view android.view.layoutinflater.inflate(int, android.view.viewgroup)' on null object reference @ com.rt_no.myprogect.ui.adapter.careerimageadapter.getview(careerimageadapter.java:52) at line in gridview adapter: convertview = layoutinflater.inflate(r.layout.career_grid_view, null); the listview: public class citiesfragment extends fragment { private static final string tag ="citiesfragment"; private listview citylist; private arraylist<city> cities; private citiesadapter citiesadapter; private citiesfragmentlistener listener; private context context; private gridview gridview; @override ...

python - Scrapy: crawl multiple spiders sharing same items, pipeline, and settings but with separate outputs -

i trying run multiple spiders using python script based on code provided in official documentation. scrapy project contains multiple spider ( spider1, spider2, etc.) crawl different websites , save content of each website in different json file ( output1.json, output2.json, etc.). the items collected on different websites share same structure, therefore spiders use same item, pipeline, , setting classes . output generated custom json class in pipeline. when run spiders separately work expected, when use script below run spiders scrapy api items mixed in pipeline. output1.json should contain items crawled spider1 , contains items of spider2 . how can crawl multiple spiders scrapy api using same items, pipeline, , settings generating separate outputs? here code used run multiple spiders: import scrapy scrapy.crawler import crawlerprocess web_crawler.spiders.spider1 import spider1 web_crawler.spiders.spider2 import spider2 settings = get_project_settings() process = crawl...

regex - How to rename multiple directories into corresponding file names in bash -

i need bash script rename directory: i want rename 6 directories first in order conduct analysis: this original directory name rename: mcia-1-control_20170509 mcia-2-control_20170509 mcia-03-timesport_20170717 mcia-04-timesport_20170717 mcia-05-timesport_20170717 mcia-6-timesport_20170717 i need rename following: subj-1-control subj-2-control subj-3-timesport subj-4-timesport subj-5-timesport subj-6-timesport i declared several variables below: $fnids #e.g.mcia-1-control_20170509... $ren #e.g. 1-control... $raw_dir #data directory then run loop, results did not expect: for fn in ${fnids}; echo "+++this folder name rename: fnids:${fnids}+++" echo "+++renameing folder: fn:${fn}+++" rn in ${ren}; echo "=======add "subj" rename subj folder===========" refn=subj-"$rn" #e.g. subj-1-control... echo "refn:$refn" echo "rename folder $fn $refn" if ( ...

javascript - Using Ajax to insert data to mysql -

i want insert data mysql using ajax. however, not able save database. can suggest mistakes is? the html , ajax code below: <div class="modal fade" id="addjoint2" role="dialog" action="handle.php"> <table id="01"> <tr> <th></th> <th>joint applicant2</th> </tr> <tr> <td>occupation</td> <td><input type="text" id="occupationjoint2" name="occupationjoint2" type="text" value="<?php echo $occupationjoint2; ?>"></td> </tr> </table> <div class="modal-footer"> <button type="button" class="btn btn-success btn-lg" data-dismiss="modal" style="width: 100%;"><span class="glyphicon glyphicon-ok-sign"></span>i...

rss - Facebook instant article feature have any negative impact on alexa rank? -

i have sports article based website developed in codeigniter. use facebook instant article feature had develop rss feed , connect our facebook fan page. facebook instant article feature in review process facebook. our visitor source facebook , our sports group (largest football community of bangladesh). , maximum of our visitors visiting via mobile platform. now if facebook approve our request of instant article feature have impact on alexa ranking? ranked 8 million 15-20 days ago on alexa. @ 3 million rank. what understand is, in facebook instant article fetch data website , save copy in facebook. url visit wont count website visit. correct me if i'm wrong. if i'm right, wise use facebook feature?

react native - Sticky footer button for form is not shown when keyboard pops up -

i have sticky footer button in form component. when opening keyboard button should on top of keyboard. tried use keyboardavoidingview in many ways didn't help. my current code: //... <view style={styles.container}> <animated.view style={[styles.line, { left: this.state.progressbar }]} /> <kheader hasborderbottom={false} left={ <iconbutton onpress={onpreviousstep} style={styles.backicon} name="back" size={20} /> } /> <animated.view style={[styles.body, { left: this.state.stepcontainerposition }]}> {react.cloneelement(this.props.children[step], { aftersubmit: onnextstep, submittedfieldswitherrors, updatefocus, shouldwaitanimationtofocus: true, })} </animated.view> <footerbutton caption={this.props.children[step].props.buttonlabel} onpress={this.onsubmit} ...

How to replace the exported products with the result of an assembly in SBT? -

i using sbt 0.13.15 , sbt-assembly 0.14.5. i'm using assembly task create uber jar contains shaded version of asm no problems. have multi-project build , want other projects in build depend on resulting uber jar instead of compiled class files. my approach looks this: exportjars := true exportedproducts in compile := seq(attributed.blank(assembly.value)) unfortunately, sbt hangs indefinitely after output this: > exportedproducts [info] updating {file:***}... [info] resolving *** ... [info] done updating. [info] compiling ??? java sources ***... [info] packaging *** ... [info] done packaging. using jvisualvm can see sbt's main thread waiting elements in queue appear, never happens. what doing wrong? edit: here's complete example. in build.sbt : lazy val root = project .in(file(".")) .aggregate(foo, bar) lazy val foo = project .in(file("foo")) .settings(seq( exportjars := true, exportedproducts in compile := seq(at...

mysql - TCL mysqltcl for 64bit windows platform -

i need updated few field of mysql database using result tcl program. downloaded mysqltcl http://www.xdobry.de/mysqltcl/windows.html read note here dlls ( libmysqltcl.dll & libmysql.dll ) not compatible 64 bit windows. i gave try , gives error when tried use load throws below error. couldn't load library "libmysqltcl.dll": invalid argument i googled bit , many had similar problems. tried modifying pkgindex.tcl didn't work. need write here see if can guide install mysqltcl package on windows 64bit.

c++ - Error using boost::bind for subscribe callback -

we're getting compile error followed many more errors showing attempts match subscribe parameters possible candidate functions when using boost::bind callback subscribe. error: no matching function call ‘ros::nodehandle::subscribe(const char [18], int, boost::_bi::bind_t<void, void (*)(const geometry_msgs::wrenchstamped_<std::allocator<void> >&, moveit::planning_interface::movegroup&), boost::_bi::list2<boost::arg<1>, boost::_bi::value<moveit::planning_interface::movegroup*> > >)’ our code follows. commented lines show code works when movegroup context (object pointer) not passed. #include <stdio.h> #include <boost/bind.hpp> #include <geometry_msgs/wrenchstamped.h> #include <moveit/move_group_interface/move_group.h> using namespace eigen; using namespace std; //void contact_callback(const geometry_msgs::wrenchstamped& msg) { void contact_callback(const geometry_msgs::wrenchstamped& msg, moveit::...

html5 canvas - Qt (QML) Dashed Circle -

Image
is there way draw half dashed circle in qml? drawn half circle in way var circle = getcontext("2d"); circle.save(); var circlegradient = circle.createlineargradient(parent.width/4,parent.height,parent.width/4,0); circlegradient.addcolorstop(0, firstgradientpoint); circlegradient.addcolorstop(1, secondgradientpoint); circle.clearrect(0, 0, parent.width, parent.height); circle.beginpath(); circle.linecap = "round"; circle.linewidth = 10; circle.strokestyle = circlegradient circle.arc(parent.width/2, parent.height/2, canvas.radius - (circle.linewidth / 2), math.pi/2, canvas.value); circle.stroke(); circle.restore(); result but how can make dashed this. i need i know qml little bit never coded. can solve problem logic. here logic- code below pseudo, n...

php - Extract block of consecutive alphanumeric characters from a line of text -

imagine have list of products, such as: branded hgt15k51b item words describe it named cdgl-56 product description fancy item tr64gqe350 added gizmo another branded 106110 110cm sized green item fan i trying extract product code only. this large block of consecutive text. may contain a-z 1-9 _ -. it's uppercase. end space. has unknown length. may numeric only. it's largest consecutive block in string. my regex skills weak, possible extract regex? there better way? thanks you can try (?<!\s)[a-z0-9-]{5,}(?!\s) https://regex101.com/r/zhe8nc/2 (?<! \s ) # whitespace boundary [a-z0-9-]{5,} # allowed characters, minimum 5 (?! \s ) # whitespace boundary

appkit - Why doesn't overriding `intrinsicContentSize` in `NSView` work for `NSScrollView`? -

i have placed instance of custom class bigview subclass of nsview inside nsscrollview in ib. content size of bigview computed @ runtime. best practices setting content size? overriding intrinsiccontentsize , suggested in the big nerd ranch guide, not seem work -- frame remains @ original size: class bigview: nsview { ... override var intrinsiccontentsize: nssize { // doesn't work?! return nssize(width: 10000, height: 10000) } ... } setting frame programmatically (or in ib) work: class bigview: nsview { ... override func awakefromnib() { ... self.frame = nsrect(x: 0, y: 0, width: 10000, height: 10000) } ... }i or controller: class viewcontroller: nsviewcontroller { @iboutlet weak var bigview: bigview! ... override func viewdidload() { super.viewdidload() bigview.frame = nsrect(x: 0, y: 0, width: 1000, height: 1000) } ... } this can done throughout scrollview's documentview prope...

Drag-and-drop of a mail window in Outlook 2016 -

is possible drag window of mail m1 , drop window of mail m2 in outlook 2016 in order attach m1 m2 ? if so, how ? any appreciated you can drag-and-drop 1 stored email email being drafted opening draft in window, having list stored email open in outlook menu window, , dragging , dropping stored email onto email being drafted, saving stored email attachment.

wordpress - Contact Form 7 Regular Expression Validation -

i'm trying add regular expression validation contact form 7 'last-name' field allow hyphenated names. have researched , written function allow this, doesn't seemed working. appreciated. here function have written , placed in functions.php file... add_filter('wpcf7_validate_text', 'custom_text_validation', 20, 2); add_filter('wpcf7_validate_text*', 'custom_text_validation', 20, 2); function custom_text_validation($result, $tag) { $type = $tag['type']; $name = $tag['name']; if($name == 'last-name') { $value = $_post[$name]; if(!preg_match('[a-za-z\-]', $value)){ $result->invalidate($tag, "invalid characters"); } } return $result; } so first thing think need @ on 5 th , 6 th lines. according cf7 documentation , $tag argument returns object , not array. which means $tag['name'] , $tag['type'] should $t...

Network singleton with retrofit in android - null reference exception -

i have following singleton public class apishared { public string api_base_url = "http://url.com/"; public static apishared instance; public apimanager client; private context context; private retrofit retrofit; private apishared (context context) { this.context = context; retrofit = new retrofit.builder() .baseurl(api_base_url) .addconverterfactory(gsonconverterfactory.create()) .build(); client = retrofit.create(apimanager.class); } public static apishared init(context context){ if (null == instance){ instance = new apishared(context); } return instance; } } and in mainactivity inside oncreate call call<list<category>> call = apishared.instance.client.categories(); and when start app java.lang.nullpointerexception: attempt read field 'com.example.me.fooder.apimanager com.example.me.fooder....

Modifing SMS before sending in android -

i wondering if it's possible modify sms before sending in android, not if it's send application, if it's being send other applications. application work in background , wait sms sending, , when occurres prevents doing so, modifies , sends it. for example, default sms application(built-in or otherwise) sends sms , want catch before does, modify body(like add new receiver or text inside message itself). i think this: can modify sms_body before sending sms built-in sms application? might answer question, i'm not sure, , it's kind of old. let me know if unclear in something. thanks. let me try simple example- have account in bank , wish deposit should come in account. here account refers app , bank refers mobile device. in short, can't achieve on non-rooted device. yes possible on non-rooted device if user send messages app , surely can modify messages written user.

visual studio - How to fix Virtual directory error when asp.net .sln file open? -

Image
i trying open asp.net project warning shows. after warning have clicked yes , responding error. how can handle virtual directory problem ? this error shown in image below

single sign on - How to control HTTP navigation step by step? -

in google chrome, can see http navigation using developer tools > network > preserve log. using cannot control navigation step step. there way with/without developer tools wherein can control http navigation step step better investigation? http have 2 options communicate server request (httprequest) response (httpresponse) the browser send request , wait response. nothing happens in between them. once request processed, returns response code, header, response. browser tracks how time took, kind of header send request etc.

multithreading - Calling an FnMut callback from another thread -

i writing phoenix client library rust, taking advantage of async websocket client rust-websockets . right having trouble figuring out how pass callback functions in thread handling websocket traffic. have simplified struct: pub struct socket { endpoint: string, connected: arc<atomicbool>, state_change_close: option<box<fnmut(string)>>, } this struct has connect function laid out follows: pub fn connect(&mut self) -> result<(), string> { if self.connected.load(ordering::relaxed) { return ok(()) } // copy endpoint string, otherwise error on thread::spawn let connection_string = self.endpoint.clone(); let (usr_msg, stdin_ch) = mpsc::channel(0); let connection_thread = thread::spawn(move || { // tokio core running event loop let mut core = core::new().unwrap(); let runner = clientbuilder::new(&connection_string) .unwrap() ...

Spark read avro results from a previous write results in "Not an avro data file" due to _SUCCESS file -

i'm using great databricks connector read/write avro files. have following code df.write.mode(savemode.overwrite).avro(somedirectory) problem when try read directory using sqlcontext.read.avro(somedirectory) it fails java.io.ioexception: not avro data file due existence of _success file in directory. setting sc.hadoopconfiguration.set("mapreduce.fileoutputcommitter.marksuccessfuljobs", "false") solves issue rather avoid doing it. this sounds quite generic problem may doing wrong?

Javascript - comparing two arrays by specific value and create a new array filled with matches -

please assume have 2 arrays filled objects this: var arr1 = [{dog: "bark", cat: "meow", cow: "muh"}, {dog: "barking", cat: "meow", cow: "muhing"}] var arr2 = [{cat: "meow", dog2: "barked"}, {cow: "muhed", savage: "phew", cat: "meowed"}] i wish such output: var arr3 = [{dog: "bark", cat: "meow", cow: "muh", dog2: "barked"}] i.e arr1 , arr2 have common key value pair in objects, it's cat: "meow" , want these objects merged , pushed array, arr3 in case. possible? in advance! please try this: var _ = require('lodash'); var = [{a:1, b:2}]; var b = [{a:1, b:2, c:3}]; _.merge(a, b); //output: {a:1, b:2, c:3} see if works you.

ios - XPC connection interrupted for Xcode 9 -

i newcomer xcode , swift. trying build tic-tac-toe app, when run it, nothing happens. screen black. in debugging area says: "xpc connection interrupted." tried restarting simulator , computer. same thing still happened. in case need it, here code: // // viewcontroller.swift // tictactoe // // created kaminski on 7/17/17. // copyright © 2017 kaminski. rights reserved. // import uikit class viewcontroller: uiviewcontroller { @iboutlet weak var webview: uiwebview! @iboutlet weak var winner: uilabel! //buttons @ibaction func buttonbr(_ sender: any) { } @iboutlet weak var buttonbr1: uibutton! @ibaction func buttonbm(_ sender: any) { } @iboutlet weak var buttonbm1: uibutton! @ibaction func buttonbl(_ sender: any) { } @iboutlet weak var buttonbl1: uibutton! @ibaction func buttonmr(_ sender: any) { } @iboutlet weak var buttonmr1: uibutton! @ibaction func buttonm(_ sender: any) { } @iboutlet weak var buttonm1: uibutton! @ibaction func buttonml(_ sender: any) { } @...