Posts

Showing posts from April, 2014

How to properly structure a python cron script for single instance execution -

this related another question here . i want create series of cron scripts, cron scripts can have 1 instance each. need implement lock files each script. decided create abstract cron class create lockfile on __init__ , destroy on __del__ . approach has proven incorrect getting unpredictable results __del__ method. it has been requested open new question asking how implement this. best approach here? 1 cron script check email, checks database, , forth. my reasoning behind using cron don't trust myself build monolithic daemon 1 script. can't afford have entire daemon breakdown if 1 unrelated part stops working. perhaps unwarranted fear proper implementation?

c++ - Parse url_encoded_fmt_stream_map -

i'm trying parse url_encoded_fmt_stream_map in c++, because i'm creating youtube downloader have hard time understand how parse it. basically want this: url_encoded_fmt_stream_map=url%3dhttps%253a%252f%252fr3---sn-oxu8pnpvo-ua8s.googlevideo.com%252fvideoplayback%253fkey%253dyt6%2526ip%253d217.132.162.185%2526pl%253d21%2526itag%253d22%2526dur%253d179.629%2526mv%253dm%2526source%253dyoutube%2526ms%253dau%2526mt%253d1505157185%2526mn%253dsn-oxu8pnpvo-ua8s%2526sparams%253ddur%25252cei%25252cid%25252cinitcwndbps%25252cip%25252cipbits%25252citag%25252clmt%25252cmime%25252cmm%25252cmn%25252cms%25252cmv%25252cpl%25252cratebypass%25252crequiressl%25252csource%25252cexpire%2526expire%253d1505178857%2526id%253do-adsbso6vmuxg9rlrwkzvyp_kttq8sji4uuzyqzui3c-k%2526beids%253d%25255b9466593%25255d%2526mime%253dvideo%25252fmp4%2526lmt%253d1502272667670502%2526signature%253d969232dfe8d6f9c52bf60808a8e5520603abc565.791784bf0dfb1e074e9c5f02c312d7918afbb31e%2526mm%253d31%2526ratebypass%253dy

jquery - opening multiple divs with javascript -

i'm trying open div on right side, , change animation div on same time, works when use same div id, gives me problems css positions. when press 1 intro animation disappears , animation div loads data_1.json appears. http://bolink.eu/demo/ current js code : <script src="http://code.jquery.com/jquery-latest.js"></script> <script> $(document).ready(function(){ $('a').click(function () { var divtitle= this.title; $("#"+divtitle).show("slow").siblings().hide(1000); }); }); </script> <script> $(function() { $("#slideshow > div:gt(0)").hide(); setinterval(function() { $('#slideshow > div:first') .fadeout(1000) .next() .fadein(1000) .end() .appendto('#slideshow'); }, 3000); });

java - HttpResponseCache not caching urls without Content-Length header -

using stock android examples httpurlconnection , httpresponsecache, have created bare bones app calls 2 urls, twice. first 1 without content-length , second 1 content-length . i can see in charles endpoint without content-length not cached. removed content-length caching url , confirmed prevents caching well. unfortunately there no way have gzipping , content-length in restify according gzip plugin docs . is there way force httpresponsecache cache url when content-length missing? logic behind not caching urls without content-length? (ios caches without content-length) *using volly or restify last resort due large existing codebase. ended moving retrofit had no issues caching without content-length header.

python - What is the most efficient & pythonic way to recode a pandas column? -

i'd 'anonymize' or 'recode' column in pandas dataframe. what's efficient way so? wrote following, seems there's built-in function or better way. dataset = dataset.sample(frac=1).reset_index(drop=false) # reorders dataframe randomly (helps anonymization, since order have meaning) # make dictionary of old , new values value_replacer = 1 values_dict = {} unique_val in dataset[var].unique(): values_dict[unique_val] = value_replacer value_replacer += 1 # replace old values new k, v in values_dict.items(): dataset[var].replace(to_replace=k, value=v, inplace=true) iiuc want factorize values: dataset[var] = pd.factorize(dataset[var])[0] + 1 demo: in [2]: df out[2]: col 0 aaa 1 aaa 2 bbb 3 ccc 4 ddd 5 bbb in [3]: df['col'] = pd.factorize(df['col'])[0] + 1 in [4]: df out[4]: col 0 1 1 1 2 2 3 3 4 4 5 2

Android: vector asset distortion -

i created vector asset in android studio can see correctly once launch app gets distorted. original vector asset distorted in app <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="45dp" android:height="79dp" android:viewportwidth="45.9" android:viewportheight="79.2"> <path android:fillcolor="#ff000000" android:pathdata="m22.9,1.5c42.1,1.6 41.7,3 41.7,3s1.2,-1.1 -0.7,-1.9s28.7,0 22.9,0s6.7,0.4 4.8,1.1s4.1,3 4.1,3s3.7,1.6 22.9,1.5"/> <path android:fillcolor="#ff000000" android:pathdata="m22.9,3c19.2,0.1 18.5,1.4 18.5,1.4s41,4.9 42.1,7c1.1,2.2 3.4,6.7 3.4,6.7s-7.6,-1 -22.6,-0.9c-15.2,-0.1 -15,-0.1 -22.6,0.9c0,0 2.4,-4.5 3.4,-6.7c0.2,-0.4 1.6,-1.7 0.7,-2.6c4.4,4.4 3.7,3.1 22.9,3"/> <path android:fillcolor="#ff000000" android:pathdata="m22.9,71.4c22,0 22.9,-1.7 22.9,-1.7l0.1,-54.4c0,0 -

flask - Using Zappa as a conda user -

i trying create api , looking use flask/aws lambda so. best can tell, zappa looks best (only?) deployment option. the problem use conda manage environments , zappa not have version can work in conda. requires virtualenv. my questions are: how other conda users deploying flask/aws lambda apps? can run both virtualenv , conda on same machine? risks/challenges?

Image Sizes Tensorflow Object Detection using pretrained models -

i see tensorflow object detection api allows 1 customise image sizes fed in. question how works pretrained weights, trained on 224*224 images, or 300*300 images. in other frameworks used, such caffe rfcn, , yolo , keras ssd, images downscaled fit standard size coming pretrained weights. are pretrained weights used tf of 300*300 input size ? , if so, how can use these weights classify customised image sizes ? tf downsize respective weights size ? for understanding input size affects input layer of network. please correct me if wrong, i'm still quite new whole deep learning paradigm. i have used 3 models of tensorflow object detection api. faster r-cnn , r-fcn, both resnet101 feature extractor , ssd model inception v2. ssd model reshapes images fixed m x m size. mentioned in paper "speed/accuracy trade-offs modern convolutional object detectors" huang et al., whereas n faster r-cnn , r-fcn, models trained on images scaled m pixels on shorter edge. re

Create multiple records at once ruby on rails -

this seemed straightforward, proving not be. i have 2 models: authors , books. authors has_many books, books belong_to authors. i'd able add many books in single form different authors , information each. class bookscontroller < applicationcontroller def new @books = [] 5.times @books << book.new end end i'm not sure if that's correct way form controller. view follows: <%= form_tag(books_path(@books)) %> <% @books.each |book| %> <%= text_field_tag(:title) %> <%= text_field_tag(:author) %> <%= text_field_tag(:pages) %> <% end %> <%= submit_tag("submit") %> that's far i've gotten, can't @books end in params, haven't gotten trying create method yet. i'm getting :title, :author , :pages of last record, , aren't in book param. form_tag doesn't know model object. won't wrap params under appropriate key. should instead use form_for save trouble

jquery - $ is not defined when sending data with ReactJS -

i'm tryin send data reactjs form php: handlesubmit(event){ $(function () { $('form').on('submit', function (e) { e.preventdefault(); $.ajax({ type: 'post', url: 'register.php', data: $('form').serialize(), success: function () { alert('form submitted'); } }); }); }); } i got error message '$' not defined <script src="https://code.jquery.com/jquery-3.2.1.js" integrity="sha256-dzankj/6xz9si04hgrsxu/8s717jcizly3oi35eouye=" crossorigin="anonymous"></script> i install jquery npm npm install jquery --save then add jquery componement app import $ 'jquery'; and works.

php - Select a random value from file while limiting selection to first 5 entries -

i have text file contains 50 lines/entries. want select random value first 5 lines/entries not whole file. example, if file had 7 entries: 1. orange 2. banana 3. apple 4. peach 5. mango 6. berries 7. pineapple the output should 1 of first 5 items. my code far selecting random whole file, not limiting selection. $filename = file("/home/file.txt"); echo $read_filename = $filename[rand(0, count($$filename) - 1)]; you over-complicated it. simply: <?php $lines = file("/tmp/fruits.txt"); echo $lines[rand(0, 4)]; // display 1 of first 5 lines.

php - Correct unit testing -

i started using unit , functionality test project , because of have questions: im working symfony php framework. , have doctrine ldap orm service. furthermore have user repository (as service) depends on ldap orm service, logger , validation service. now want write unit test adduser function of userrepo. internally call: getnewuidnumber, usertoentities, doesuserexist , getuserbyuid. my question is: should mock these internal function test adduser function? against unit test idea (just test api). or should mock ldap orm service, logger, , validation service, class calls internal functions? cause huge test function lot of mocking because have mock repositories internal repositories calls. or should start symfony kernel , use servicecontainer use orm ldap service real test database. wouldn't functionally test , not unit test? heard bad have many dependencies in test. thought bad use whole servicecontainer. adduser: public function adduser(user $user) { $pbnlac

angularjs - Ionic V1 Side Menu Content strange behaviour -

Image
i working on ionic 1 project have 2 language arabic rtl , english ltr. i added 2 menus handle this, 1 side="right" arabic , other 1 side="left" english every thing working fine @ start when change language side menu content draggable left , right !! it should draggable left when left menu displayed , right when right menu displayed trials i tried drag-content='false' [disable both directions]. i trired add event listener on ionic-side-menus-content on drag check if direction left preventdefault , return false; [didn't worked] here screenshot of issue. accepted direction wrong behaviour app.html code <ion-side-menus enable-menu-with-back-views="false"> <!-- left menu --> <ion-side-menu side="left" ng-if="$root.lang=='en'"> <div ng-include="'tpls/side-menu.html'"></div> </ion-side-menu> <ion-side-menu side="right" n

java - Android activity Lifecycle does not work properly -

i'm developing android 2d game in android studio. i have problem activity lifecycle. my question this: i have 2 activities. 1 named launcheractivity, , other named mainactivity. when first launch app, launcheractivity launches, , works fine.then, when go the mainacitivty, activity hold game, meaning has line : setcontentview(new gamecontroller(this)), still works fine. when go launcher activity, still works fine, when i'm trying go game, mainactivity, in second time, lifecycle follow: oncreate(),onstart(),onresume(),onpause(),onstop(),onresume(). this ruining game, because have specific things in onstop() method, can not allow them executed when activity launch. does know how fix ? doing wrong ? if not clear, please ask me , explain. android call onstop when the activity no longer visible . please review document. https://developer.android.com/guide/components/activities/activity-lifecycle.html i hope can you.

r - Knitting progress in shiny -

i have shiny application used call rmarkdonw::render() function. want able show knitting progress using withprogress() function here: https://gallery.shinyapps.io/085-progress/ the problem don't know how progress status 'render()' function. ideas?

Facebook API Javascript SDK Upload Photo and Mention Tag Without Link -

the situation trying create is: 1) have photo want upload facebook via page feed. 2) want tag ( not friend ) along photo. right using following code opens window can create post , tag someone: fb.ui({ method: 'feed', link: '', }, function(response){}); however, when try create post, says "href or media required". how can create post photo without sharing link , can still tag people not friends? thanks in advance to upload photo, need use /page-id/photos endpoint. have authorize user , use taggable_friends endpoint friends tagging. can´t tag people not friends , have let facebook review use of taggable_friends .

Getting an 'ERROR in Unexpected reserved word' when running webpack -

i getting error when using webpack build, , have tried search different forms answer havent had luck. not sure if have provided required information: performing development build: node_modules/webpack/bin/webpack.js /eslint-loader/index.js:16 class eslinterror extends error { ^^^^^ hash: af98f85dfff823cafe5b version: webpack 1.15.0 time: 1965ms asset size chunks chunk names commonui.js 750 kb 0 [emitted] main [0] multi main 40 bytes {0} [built] [1 error] + 326 hidden modules error in unexpected reserved word @ multi main webpack.js "use strict" var assign = require("object-assign") var loaderutils = require("loader-utils") var objecthash = require("object-hash") var pkg = require("./package.json") var createcache = require("loader-fs-cache") var cache = createcache("eslint-loader") var engines = {} /** class representing eslinterror. @extends error */ cla

blender - UV/Texture pixels crossed by Seam edge are not painted as expected -

Image
unwrapped object filled out gradient color. illustrated in below image, pixels in uv/texture view on seamed edges boundaries not filled expected color. looks edge has cross more half of pixel colorized. is there way force pixels crossed seam edge colorized properly? found solution. navigate texture paint given object , open options, modify bleed property, defines how many pixels colorized in uv texture outside seamed edges. default 2px.

python - Pysparkling 2 reset monotonically_increasing_id from 1 -

i want split spark dataframe 2 pieces , defined row number each of sub-dataframe. found function monotonically_increasing_id still define row number original dataframe. here did in python: # df original sparkframe splits = df.randomsplit([7.0,3.0],400) # add column rowid 2 subframes set1 = splits[0].withcolumn("rowid", monotonically_increasing_id()) set2 = splits[1].withcolumn("rowid", monotonically_increasing_id()) # check results set1.select("rowid").show() set2.select("rowid").show() i expect first 5 elements of rowid 2 frames both 1 5 (or 0 4, can't remember clearly): set1: 1 2 3 4 5 set2: 1 2 3 4 5 but got is: set1: 1 3 4 7 9 set2: 2 5 6 8 10 the 2 subframes' row id row id in original sparkframe df not new ones. as newbee of spark, seeking helps on why happened , how fix it. first of all, version of spark using? monotonically_increasing_id method implementation has been changed few times. can reprodu

python - Find Position of Value in numpy Array -

i trying find position in array called imagearray from pil import image, imagefilter import numpy np imagelocation = image.open("images/numbers/0.1.png") #creates array [3d] of image colours imagearray = np.asarray(imagelocation) arrayrgb = imagearray[:,:,:3] #removes alpha value output print(arrayrgb) #rgb output print(round(np.mean(arrayrgb),2)) colourmean = np.mean(arrayrgb) #outputs mean of values rgb in each pixel this code searches each point individually in array , if above mean supposed become 255 if less 0. how can find position in array can edit value. for row in arrayrgb: pixelrgb in row: #looks @ each pixel individually print(pixelrgb) if(pixelrgb > colourmean): pixelrgb[positionpixel] = 255 elif(pixelrgb < colourmean): pixelrgb[positionpixel] = 0 as example, let's consider array: >>> import numpy np >>> array([[0, 1, 2], [3, 4, 5], [6, 7,

Sumifs() function in excel second condition is not working? -

Image
i want able use sumifs() 2 conditions. if section groceries , month september, want sum it. if take away second condition, sums 286.55, if leave second condition in sumifs() gives me 0. i can think of 1 of 2 issues... 1 trying match date string. check =b2*1 & =i2*1 . if both of them give error ok. 2 strings different(one of them has trailing space etc.) try =len(b2) & len(i2) . i'm sure 1 of them >9 . you know yourself

carouFredSel Buttons are not going inline -

Image
<ul class="portfolio-nav"> <li id="prev">&lt;</li> <li id="next">&gt;</li> </ul><!-- unordered list portfolio nav closing tag --> jsfiddle so, here's deal: i making caroufredsel slider, , want attach next , prev button it. have problem li tags won't go inline. i going provide image know what's problem.

java - Updating a JLabel with a Static Integer -

so i'm new java, took class in highschool last year , want try , make own little 2d game im working on. have stats.java filled variables want stored, such cash, name, level, etc. right im trying add cash cash jlabel using button. jbutton btnaddcash = new jbutton("add 10,000"); btnaddcash.addactionlistener(new actionlistener() { public void actionperformed(actionevent e) { stats.cash = (stats.cash + 5000); } }); jlabel lblcash = new jlabel("cash: " +stats.cash); lblcash.setforeground(color.white); lblcash.setbounds(10, 649, 162, 14); contentpane.add(lblcash); lblcash.setfont(new font("airbusmcdua", font.bold, 15)); jbutton debugbtn = new jbutton(""); any awesome! your problem here @ (a) , (b) jbutton btnaddcash = new jbutton("add 10,000"); btnaddcash.addactionlistener(new actionlistener() { public void actionperformed(actionevent e) { stats.cash = (stats.cash + 5000); // (a) } }

Testing a signup confirmation with Rspec/Factory Girl/Rails -

trying create rspec/factory girl test make sure devise's confirmation on signup covered - site has 3 languages (japanese, english, chinese) want make sure nothing breaks signup process. i have following factories: user.rb << has needed general user mailer tests signup.rb has: factorygirl.define factory :signup token "fwoefurklj102939" email "abcd@ek12o9d.com" end end the devise user_mailer method want test is: def confirmation_instructions(user, token, opts={}) @user = user set_language_user_only mail to: @user.email, charset: (@user.language == user::language_ja ? 'iso-2022-jp' : 'utf8') end i cannot life of me figure out how token part work in test - advice or ideas? i have been trying along these lines (to check email being sent) without success: describe usermailer, type: :mailer describe "sending email" after(:all) { actionmailer::base.deliveries.clear } context "

c++ - How do I identify the correct type parameter with SWIG/OCaml? -

my problem is, have c++ library need access within ocaml, , believe having difficulty working uniformly homogenous type of generated interfaces. i getting following error: (failure "no appropriate conversion found.") ... raised primitive operation @ file... i found exactly occurs , , appears pointer argument. i using c++ library libdai have upgraded have more recent swig bindings works on osx, along ocaml, oasis , opam. in ocaml, i'm trying create vector , push instance it, , done in ocaml_swig/src/test.ml , here . replicate, clone branch of opam-repository , , pin folder with: cd packages/libdai/libdai.1.0.0/ && opam pin add libdai ./ -y or, alternatively build dockerfile available at packages/libdai/libdai.1.0.0/dockerfile just mark out part particular image start from, pick ubuntu:16.04 or something, , specify user have in yours. it's not long dockerfile @ all, should easy, , i've tested myself too. this should correctly fail durin

Xcode: replace a file that is under SVN version control -

i have xcode project under svn version control. through xcode, deleted files , replaced them updated ones. svn has marked files 'd' means marked deletion. not sure if new files included in next commit, or if deletion committed? it seems best way through finder. first reverted changes using svn revert -r . replaced files through finder. when hit svn status, showed few files modified. these files there differences ones deleted. files did not have differences did not appear on status list. can safely commit.

haskell - Constrained heterogeneous list -

i searched hackage , couldn't find following seems simple , useful. there library contains sort of data type? data hlist c (:-) :: c => -> hlist c nil :: hlist c all hlists found have type, , weren't constrained. if there isn't i'll upload own. i'm not sure data type useful... if want a existentially qualified, think should use regular lists. more interesting data type here exists , although i'm there variants of on package hackage already: data exists c exists :: c => -> exists c then, hlist c isomorphic [exists c] , can still use of usual list based functions. on other hand, if don't want a in (:-) :: c => -> hlist c existentially qualified (having such sort of defies point of hlist ), should instead define following: data hlist (as :: [*]) (:-) :: -> hlist -> hlist (a ': as) nil :: hlist '[] then, if want require entries of hlist satisfy c , can make type class witness injecti

django - How to create a new model (kind) in google cloud Datastore -

Image
i using google cloud datastore(not ndb) project. python2.7 , django. i want create new model, lets tag model. class tag(db.model): name = ndb.stringproperty() feature = ndb.stringproperty(default='') i have added property model many times, not yet created new model. my question when have changed model schema in django project using mysql, executed manage.py migrate. do have execute migration command datastore well? or defining model have do? thanks in advance! unlike sql databases mysql, cloud datastore doesn't require create kinds (similar tables) in advance. other defining in code, no admin steps required create kind. when write first entity of kind, it's created implicitly you. you can query kinds don't exist yet without error, you'll no entities back:

javascript - Apply Opacity to Sibling Paragraphs One at a Time During Scroll Animation -

i have figure wraps few paragraphs so: i have following style rules scroll paragraphs upon figure:hover ... figure p { opacity:0; } figure:hover p { opacity:1; -webkit-transition: opacity 0.35s; transition: opacity 0.35s; margin: 0; line-height: 50px; text-align: center; -webkit-transform:translatey(100%); transform:translatey(100%); -webkit-animation: scroll-up 5s linear infinite; animation: scroll-up 5s linear infinite; } @-webkit-keyframes scroll-up { 0% { -webkit-transform: translatey(100%); } 100% { -webkit-transform: translatey(-100%); } } @keyframes scroll-up { 0% { -webkit-transform: translatey(100%); transform: translatey(100%); } 50% { opacity:1; } 100% { -webkit-transform: translatey(-100%); transform: translatey(-100%); opacity:0; } }

php - Debian + Nginx open_basedir not set but having restriction -

i have test environment running php-based application. i have checked , confirmed open_basedir not enabled via phpinfo() , nginx.conf. but reason, application still having these issues, "fopen(directory): failed open stream: no such file or directory in" "ziparchive::close(): failure create temporary file: no such file or directory in" is there other possible settings causing this? thanks!

java - Find name in Arraylist, then transfer contents to an array? -

i want find name in arraylist of students, transfer selection of 50 choices new array called mychoices (will later compared against others matches). student class contains name , arraylist of choices. here relevant loop: int matches[] = new int[students.size()]; int mychoices[] = new int[students.get(0).getchoices().size()]; for(int = 0; < students.get(i).getchoices().size(); i++){ if(students.get(i).getname().equals("garrett m")){ mychoices[i] = students.get(i).getchoices().get(i); } } for(int = 0; < mychoices.length; i++){ system.out.println(mychoices[i]); } in last loop, i'm trying print choices, come out this: 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (that's not 50, gist of -- in output there's 49 zeros , 1 1.) actual output should begin 1 , mixture of 0,1, , -1: 1 -1 1 1 1 1 0 1 1 0 0 0 1 1 0 1 0 0 1 1 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 0 1

c# - How to make my constructor async in UWP MVVM model? (MVVM Lighttoolkit) -

i have uwp project want reads storagefolder videoslibrary , show list of mp4 files @ views thumbnail. with mvvm ligth toolkit have setup 4 flies xaml. xaml using uwp community toolkit wrap panel. 1)viewmodellocator.cs namespace uwp.viewmodels { /// <summary> /// class contains static reference view models in /// application , provides entry point bindings. /// </summary> class viewmodellocator { /// <summary> /// initializes new instance of viewmodellocator class. /// </summary> public viewmodellocator() { servicelocator.setlocatorprovider(() => simpleioc.default); if (viewmodelbase.isindesignmodestatic) { // create design time view services , models } else { // create run time view services , models } //register services used here simpleioc.default.register<videolistmodel>(); } public videolistmodel videolistmodel

javascript - import "moment/moment" is not ignoring "moment/locale" -

i using moment.js library in angular project. , not need moment/locale entirely moment.js . imported following : import * moment 'moment/moment'; but when analyse vendor***.bundle.js.map created during build using source-map-explorer i still see moment/locale bundled in vendor file. , around ~160kb. that's huge. any suggestions improve import statement?

javascript - Confusion in using OAuth in reactjs and react-native app -

i have question, let's have website (reactjs) , app (react-native) both using oauth facebook login. should save access token provided facebook in database , if should, happen access token when user logins facebook on website , login again app? does mean access token going overwritten new login? have other suggestions practice oauth integration? the oauth token of 2 consecutive logins different. still store them in database not 1:1 relationship user bot 1:n. means every user can have multiple oauth tokens assigned. in oauth expiration of token. can store 1 , clean table if needed. for mongodb again directly in answer better readability: can design user collection this: { "_id": 42, "username": "jeger", "token": [ {"value": "abc1234", "expiration": ...} {"value": "bca4321", "expiration": ...} ] } and search user after token verific

sql server - CASE when clause using -

declare @custid varchar(50) = null select * items showitemnlycusloggedinweb = case when @custid = not null showitemnlycusloggedinweb=0 or isnull this not working me. you may looking where 1 = case when @custid not null , showitemnlycusloggedinweb = 0 1 when @custid null , showitemnlycusloggedinweb in (0,1) 1 else 0 end

Mac chrome(61.0.3163.79) inspect remote debug AndroidWebView, error 404 -

Image
i debug androidwebview chrome , there problem. the mobilephone smartisan(5.1.1) , pc chrome (61.0.3163.79) . the device in chrome://inspect/#devices , when inspect, devtools show 404 , here pic:

logging - How to filter out Jetty DEBUG messages in slf4j/log4j2? -

i added embedded jetty/jersey server application, uses log4j2 logging provider slf4j bindings. logging libraries in classpath , jetty uses them, described here: https://www.eclipse.org/jetty/documentation/9.4.x/configuring-logging.html this thing, except debug level in jetty noisy, mentioned there. i have 3 appenders (one console , 2 file) @ different levels, file name 1 of them configured programmatically, besides that, configuration specified in log4j2.properties file. setup little complicated, need. is there simple way convert jetty debug messages trace before message strings processed , / or filter out debug messages altogether based on package name? i don't expect it's easy or or possible convert logging levels, doesn't hurt ask. and far filtering concerned, in other words, i'd specify different levels depending on package, info org.eclipse.jetty , subpackages trace default, or trace package , subpackages info default. ideally, should done in

owl carousel 2 - Get the current slide element on change event in OwlCarousel2 -

i trying create effect similar (the demo uses bootstrap carousel): https://codepen.io/sitepoint/pen/bpvrxp/ bootstrap's 'slide.bs.carousel' returns relatedtarget slide element going displayed carousel moved i.e changed slide. i haven't been able find equivalent data being returned in owlcarousel2's changed.owl.carousel event. event, if any, returns element that's going in view? is there alternative way or missing something?

webpack - Path to static files after packaging -

hello guys have question https://github.com/electron-userland/electron-packager electron packager, understood correctly i've made compiled asar archive, , second thing in case packager took production build of webpack make .dmg file ( working boilerplate https://github.com/chentsulin/electron-react-boilerplate ). question is: have simple json file dummy data, after packaging have no idea path file should use. i've tried use npm module unpack asar archive , see happens inside , didn't see anything, after i've tried work extraresources didn't helps me @ all, because after compiled didn't see file in archive. can't understand i've missed. images working great , don't need change path them.

python - Crawl tweets with URL inside it and perform sentiment analysis for these tweets -

how can in python crawl tweets tweets contain specific url inside it. example: https://wikileaks.org/wikileaks-offers-award-for-labourleaks.html import tweepy import csv import pandas pd import text consumer_key = '' consumer_secret = '' access_token = '' access_token_secret = '' auth = tweepy.oauthhandler(consumer_key, consumer_secret) auth.set_access_token(access_token, access_token_secret) api = tweepy.api(auth,wait_on_rate_limit=true) # open/create file append data csvfile = open('ua.csv', 'a') #use csv writer csvwriter = csv.writer(csvfile) tweet in tweepy.cursor(api.search,q="https://wikileaks.org/wikileaks-offers-award-for-labourleaks.html",count=100, lang="en", since="2017-04-03").items(): print (tweet.created_at, tweet.text) csvwriter.writerow([tweet.created_at, tweet.text.encode('utf-8')]) above see have tried.

Android error: “Cannot load library: too many libraries” -

my application crashes error on android 4.1.2: e/android-dl: android_dlopen: error dlopen(.../lib/libmobile-tasks.so): cannot load library: alloc_info[280]: 114 many libraries when loading libmobile-tasks.so looks because of limition on number of .so files mentioned here but there way solve problem?

postgresql - Loading a timeline from a social network efficiently -

i tried attack problem using classical join operation: have table posts , table followings, given user_id retrieve followings , posts of followings joining both tables. until here it's fine. since it's timeline, need establish number of posts retrieve, let's 30. there button retrieve previous 30 posts , on, means need retrieve timeline in chunks of 30 posts. the problems comes when thinking efficiency. i'm not expert on dbs remember on mysql can (i don't know how it's in postgresql though): select * [... join ...] limit 0,30 select * [... join ...] limit 30,60 select * [... join ...] limit 60,90 i guess internally it's performing join operation, consequently obtaining rows later retrieve limited number of rows. problem in example repeating same join operation 3 times , wondering if there way force database store in cache join result join operation performed once , result limited afterwards, or, on other hand, know if there no way can avoid perfor

Fitting a parabola using Matlab polyfit -

i looking fit parabola following data. x = [-10:2:16]; y = [0.0334,0.0230,0.0145,0.0079,0.0033,0.0009,0.0006,0.0026,0.0067,0.0130,0.0213,0.0317,0.0440,0.0580]; [p,~,~] = polyfit(x,y,2); x2 = linspace(-10,16,100); y2 = polyval(p,x2); y3 = 0.0003.*x2.^2 -0.0006.*x2 + 0.0011; figure plot(x,y,'o',x2,y2,x2,y3) however, fit not match data @ all. after putting data excel , fitting using 2nd order polynomial there, nice fit. y = 0.0003x2 - 0.0006x + 0.0011 (excel truncating coefficients skews fit bit). happening polyfit data? solved. matlab checks how many outputs user requesting. since requested 3 outputs though wasn't using them, polyfit changes coefficients map different domain xhat. if instead did: p = polyfit(x,y,2); plot(x2,polyval(p,x2)); then achieve appropriate result. recover same answer using 3 outputs: [p2,s,mu] = polyfit(x,y,2); xhat = (x2-mu(1))./mu(2) y4 = polyval(p2,xhat) plot(x2,y4)

javascript - Vue removing wrong HTML node in dynamic list of components -

i'm experimenting vue.js , composing components dynamically. there's strange issue although seems updating data correctly, if remove 1 of boxes call splice() removes last item in rendered html. here's example fiddle. i'm testing in chrome. https://jsfiddle.net/afz6jjn0/ just posterity, here's vue component code: vue.component('content-longtext', { template: '#content-longtext', props: { model: { type: string, required: true }, update: { type: function, required: true } }, data() { return { inputdata: this.model } }, methods: { updatecontent(event) { this.update(event.target.value) } }, }) vue.component('content-image', { template: '#content-image', }) vue.component('content-list', { template: '#content-list-template', props: { remove: { type: function, required: true }, update: { type: function, required: true }, views: { type: array,

swift - Alamofire self-signed certificate issue -

i'm pretty new in ios development want send http request cisco server (which have self-signed certificate ) , have error in code same topic https://github.com/alamofire/alamofire/issues/819 but said, i'm beginner understand what's going on in topic so need whole code change url ip , change basic auth (username, password) , can work here's code returns "the certificate server invalid. might connecting server pretending “10.123.1.123” put confidential information @ risk." error import uikit import alamofire class indoornavvc: uiviewcontroller { override func viewdidload() { super.viewdidload() let user = "testforcisco" let password = "password" alamofire.request("myip") .authenticate(user: user, password: password) .responsejson { response in debugprint(response) } } update: i'm set info.plist to <key>n

Why Intellij Idea doesn't show the current file? -

Image
my current file servletconfig, can't show on top of tabs when there many tabs. by default, ide adds new tabs right of active tabs. if space exceeds screen width, new tabs collapses behind "show all"-button. behavior you're expecting. new tabs collapses behind "show all". you have 2 options, disable collapse-mechanism (eventually resulting in tiny tab headers not useful well) or close least used tabs automatically. there no "always show last opened tab". check editor-tab documentation check if setting fits need.

python - Fitting a closed curve to a set of points -

Image
i have set of points pts form loop , looks this: this similar 31243002 , instead of putting points in between pairs of points, fit smooth curve through points (coordinates given @ end of question), tried similar scipy documentation on interpolation : values = pts tck = interpolate.splrep(values[:,0], values[:,1], s=1) xnew = np.arange(2,7,0.01) ynew = interpolate.splev(xnew, tck, der=0) but error: valueerror: error on input data is there way find such fit? coordinates of points: pts = array([[ 6.55525 , 3.05472 ], [ 6.17284 , 2.802609], [ 5.53946 , 2.649209], [ 4.93053 , 2.444444], [ 4.32544 , 2.318749], [ 3.90982 , 2.2875 ], [ 3.51294 , 2.221875], [ 3.09107 , 2.29375 ], [ 2.64013 , 2.4375 ], [ 2.275444, 2.653124], [ 2.137945, 3.26562 ], [ 2.15982 , 3.84375 ], [ 2.20982 , 4.31562 ], [ 2.334704, 4.87873 ], [ 2.314264, 5.5047 ], [ 2.311709, 5.9135 ], [ 2.29638 , 6.42961 ], [ 2.619374, 6

How to have order by on 2 fields (belonging to 2 separate entities) using criteria builder in java? -

i have checklist instance object , inside 1 checklist instance there multiple task objects (one-to-many relationship). using criteriabuilder retrieve checklist objects(which includes tasks well). want fetch checklists in order (say on basis of it's created date, ascending order) , want fetch tasks inside each checklist in specific order (say on basis of it's due date, descending). know how fetch the checklist object in order using criteria order expressions shown in example below. want know how fetch tasks each checklist in required fashion ? return jpaapi.withtransaction(em -> { criteriabuilder cb = em.getcriteriabuilder(); criteriaquery<checklistinstance> q = cb.createquery(checklistinstance.class); root<checklistinstance> instance = q.from(checklistinstance.class); list<predicate> predicates = new arraylist<>(); predicates.add(cb.equal(instance.get(taskconstants.checklist).get("id"), criteria.getchecklist()));

javascript - How to call debounce correctly? lodash -

i working on reactnative project , having bit of trouble using _.debounce method of lodash. current code: class googleplacesautocompletemodal extends component { constructor(props) { super(props); this.getpredictions = this.getpredictions.bind(this); } getpredictions(input) { function getautocompletepredictions(input) { rngoogleplaces.getautocompletepredictions(input) .then(results => { console.log('autocomplete results: ', results); this.setstate({ predictions: results }) }) .catch(error => console.log(error.message)) } _.debounce(getautocompletepredictions, 300); } render() { return ( <textinput style={inputstyle} autocorrect={false} maxlength={40} autocapitalize={'words'} onchangetext={this.getpredictions} /> ) } } i dont see why debounce not working since followed documentation , understand function itself. welc