Posts

Showing posts from May, 2013

physics - Create a ring body in PhysicsJS -

i working on project requires circular ring shaped body. how can achieve this? have tried use convex-polygon body vertices similar of circle getting the vertices specified not match of _convex_ polygon. error. how else can make ring shape? here current attempt: var ring = physics.body('convex-polygon',{ x: renderer.width* 0.35, y: renderer.height *0.75, vertices : [ { x: -5, y: 0}, { x: -3, y: 4}, { x: -4, y: 3}, { x: 0, y: 5}, { x: 3, y: 4}, { x: 4, y: 3}, { x: 5, y: 0}, { x: 3, y: -4}, { x: 4, y: -3}, { x: 0, y: -5}, { x: -3, y: -4}, { x: -4, y: -3} ] }); thanks in advance! a ring shaped body not convex, reason model (assuming vertices correct) not work. this old answer seems suggest concave objects such yours not implemented in physicsjs. might have changed, if not want not possible. edit: link seems have been broken. fixed.

xamarin.ios - Xamarin ios archive crash after signed -

i have ios project, link binding library , correctly works without issues. when send xarchive customer (so xarchive signed him), app crashes @ launch seem miss during xarchive build? using external library maybe have check additional options in xamarin studio build tab? update: pluggin ipad , launching xcode devices windows, error is: runtime error: assembly mscorlib.dll not found or not loaded searching found this: https://developer.xamarin.com/guides/ios/troubleshooting/questions/error-mscorlib-not-found/ this issue occurs when hidden .monotouch-32 , .monotouch-64 folders missing .xcarchive signing / ipa creation, triggering runtime error. how can fix it? i confirm issue related https://developer.xamarin.com/guides/ios/troubleshooting/questions/error-mscorlib-not-found/ my archive uploaded owncloud company. owncloud client doesn't upload hidden files/folders (as .monotouch-32 , .monotouch-64 ), xarchive received customer different , smalle...

asp.net - Nonlinear least squares curve fitting using SQL Server or .NET -

i'm reconstructing matlab based application web based. @ specific point (of matlab's implementation), user uploads set of data consisting of 2 columns (x, y) depicted dots using scatter plot. subsequently "best fitted" curve passes through points estimated , designed using matlab's build-in non-linear least squares function , trust-region optimization algorithm. is there way implement function either sql server or in .net code respectively? looking simple example understand algorithm (step-by-step) hard me find pseudocode or implementation in language concerning non-linear regression. have found solutions linear fitting in case specific algorithm work because have produce same results (as matlab's application does).

ios - Saving Contact Address to Unified Contact results in (CNErrorDomain error 500) -

there odd error in application can't find workarounds/fixes for. reason, i'm able save address contact isn't unified social profile (facebook, twitter, etc). however, when try add address contact unified facebook or twitter weird save error: the operation couldn’t completed. (cnerrordomain error 500.) here of code i'm using: if mutablecontact.iskeyavailable(cncontactpostaladdresseskey) { var postaladdresses = [cnlabeledvalue<cnpostaladdress>]() address in self.contactaddresses { let postaladdress: cnlabeledvalue<cnpostaladdress> = cnlabeledvalue(label: cnlabelother, value: address) postaladdresses.append(postaladdress) } mutablecontact.postaladdresses = postaladdresses } let saverequest = cnsaverequest() if isnewcontact { saverequest.add(mutablecontact, tocontainerwithidentifier: nil) } else { saverequest.update(mutablecontact) } { try c...

javascript - Make single MobX autorun or reaction for observable property of all objects in array -

i have class @observable (all examples typescript/pseudocode) class page { id: number = 0; @observable isvisible: boolean = false; } let array = [new page(), new page(), new page()]; and functions like: changevisibility(obj) { //ajax call .post("/api/changevisibility/", {id:obj.id, isvisible:obj.isvisible}) } and want react on isvisible change on object. i can enumerate array , make like: array.foreach(el => { reaction( () => el.isvisible, isvis => changevisibility(el); }); }); but can 1 function? kind of "array observer reacts element's property change". something this: reaction(array, //source (el) => el.isvisible, //observable react (el) => changevisibility(el) //callback object ) if reaction responsible sending the update of individual page, setup reaction in page constructor or have utility function in page that, don't have keep pages array in sy...

php - Wordpress Customizations Dont work except in admin view -

Image
i have problem, used following set of code in functions.php make changes on customization api. have customize features implemented when use them works me, admin. change make colors or pictures doesn't show on public site. admins. in public not green , have defualt pictures any or there designed code that? nevermind, wordpress decided fix , dont know how. anyway, works now.

php - How to display all orders for a single product showing the most recent first? Woocommerce -

i have password protected page on frontend. on page, want display full list of purchases associated single woocommerce product id. option 1: i've looked through woocommerce docs , , found: wc_cli_order , list_( $args, $assoc_args ) function lists orders. presumably, orders can filtered product id [--=] filter orders based on order property. line item fields (numeric array, started index zero): line_items.0.product_id option 2: i found article , based on customer id. i've modified code based on guesses meta_key , meta_value. $customer_orders = get_posts( array( 'numberposts' => -1, 'meta_key' => '_product', 'meta_value' => get_product_id(), 'post_type' => wc_get_order_types(), 'post_status' => array_keys( wc_get_order_statuses() ), ) ); how display orders single product showing recent order first? here solution put based on these articles: http://www.w...

How to create Minimal List of two Lists in R? -

i trying create minimal list of 2 lists in r based on thread how make great r reproducible example? not cover list of lists basic example. wanted minimum data sample of following structure b length can minimised must heterogeneous list of 2 $ :'data.frame': 541650 obs. of 2 variables: ..$ v1: num [1:541650] -0.21 -0.205 -0.225 -0.22 -0.21 -0.19 -0.205 -0.205 -0.205 -0.205 ... ..$ v2: num [1:541650] -0.245 -0.22 -0.2 -0.2 -0.195 -0.2 -0.19 -0.185 -0.18 -0.185 ... $ :'data.frame': 426098 obs. of 2 variables: ..$ v1: num [1:426098] -0.285 -0.285 -0.185 -0.285 -0.385 -0.305 -0.305 -0.125 -0.015 -0.285 ... ..$ v2: num [1:426098] -0.445 -0.6 -0.815 -0.665 -0.49 -0.68 -0.555 -0.755 -0.795 -0.405 ... doing dput(files) , big example data. doing reproduce(files) , same case. tried dput(head(files, 5)) 1 list , returns 5 digits. pseudocode structure list of 2 lists b(1,2) length of b(1,2) varies such length(b(1)_i) = length(b(2)_i) minimise len...

javascript - Openexchangerates API for currency conversion (JS/JQuery), Error: Load unsafe script -

github pages: https://sagarnpatel.github.io/exchange-rates/ my repository: https://github.com/sagarnpatel/exchange-rates when run code first need select 'load unsafe scripts' in browser(chrome) after runs! how can solve permanently in web browsers?

Error in C Program (not fully exiting loop?) -

this program supposed read digits of number entered user , check repeated digits. program keeps asking numbers until user enters less or equal 0. works in sense if enter repeated digit, tell you. if enter same digit number call, considered repeat digit. example, if 23 entered in 1 instance , 52 entered in another, considers there duplicate (even though there isn't in new number entered). ideas on how fix it? #include <stdio.h> #include <stdbool.h> //as per c99 standard int main (void) { bool digit_seen[10] = {false}; int digit; long n; while (1){ printf("enter number (enter 0 terminate program): "); scanf("%ld", &n); if (n == 0){ break; } while (n > 0){ digit = n % 10; if (digit_seen[digit]){ break; } digit_seen[digit] = true; n /= 10; } if (n > 0){ printf("repeated digit\n"); } else { printf("no repeated dig...

perl - Test::More is_deeply does not pretty-print array/hashrefs when comparing against strings -

when test::more compares arrayrefs , hashrefs each other, corresponding diagnostic message informative , shows first index structures differ, regardless of nesting depth. however, when comparing arrayref or hashref simple scalar, produces stringified scalar (with memory address , reference type) in diagnostic message, harder interpret. is there way configure test::more pretty-print array or hashrefs in custom way (such using data::dumper)? here's example 2 test cases. first gives insight present in program unexpected. second informs user of type mismatch between string , arrayref, not print items in arrayref. #!/usr/bin/env perl use strict; use warnings; use test::more tests => 2; is_deeply( { => [5], }, { => [5, 6, 8], }, 'compare 2 hashrefs structurally (very informative output)', ); is_deeply( [5, 6, 8], "", 'compare 2 "incompatible" values structurally (uninformative output)...

perl - Check if a patteren contains more than. one string( type array) -

how check if pattern array( contains more 1 string) or single string? consider following example, if ( $_ =~ /#define\s+(\s+)\s*(.*)/gi ) .. #check if $2 array or single string if ( $2 if it's array split them patterns else keep ? please suggest. regards, div a few basic rules , terminology. regex match done on string, in single-valued variable, scalar . array variable associated collection of items, representing list of values. perhaps can start perl-variable-types in perlintro , , regex perlretut . in example show, variable $_ contains string checked pattern. the match operator returns list of matches captured parentheses in pattern. /g modifier behavior more complex, , depends on whether regex used in scalar or list context . see under regexp-quote-like-operators in perlop . in short, assign list of matches array (no need /g then) my @matches = $_ =~ /#define\s+(\s+)\s*(.*)/i; and can check number of elements in array if (@matches ==...

How to get from n to n items in mongodb -

i'm trying create android app pulls first 1-10 documents in mongodb collection , show item in list, later when list reaches end want pull 11-20 documents in mongodb collection , goes on. def get_all_tips(from_item, max_items): db = client.mongotip tips_list = db.tips.find().sort([['_id', -1]]).limit(max_items).skip(from_item) if tips_list.count() > 0: bson import json_util return json_util.dumps(tips_list, default=json_util.default), response_ok else: return "please move along nothing see here", response_invalid pass but above code not work way intended rather returns from_item max_items example: calling get_all_tips(3,4) it returns: document 3, document 4, document 5, document 6 i'm expecting: document 3, document 4 in code specifying 2 parameters. from_item: starting index of documents return max_items: number of items return therefore calling get_all_tips(3,4) return...

html - Photosets fall behind regular pictures and tumblr posts? -

when @ theme photosets fall behind eachother instead of showing directly on page, seems happen side side pictures 4 or 5 posts show in same place layered , behind 1 post. photoset code have , i've tried changing width hasn't done anything {block:photoset} {block:indexpage} <div class="permalink2"> <a href="{permalink}">{notecount} notes &infin;</a> <a href="{permalink}">{timeago} &infin; </a> <a href="{reblogurl}" target="_blank">reblog</a></div> {/block:indexpage} <center>{block:ifnot1column}<div class="photoset_photo" width="250px">{photoset-250}</div>{/block:ifnot1column}{block:if1column}<div class="photoset_photo" width="400px">{photoset-400}</div>{/block:if1column}</center> <p style="text-align: right;"> {/block:photoset}

r - rgexf error: duplicate 'row.names' are not allowed -

i'm trying convert igraph object gexf object r package rgexf . i have large igraph object subset different igraph objects using subgraph.edges function in igraph . g<-subgraph.edges(g_large, which(e(county)$score==2)) all 1 of these subset igraph objects has been converted gexf objects. 1 subset igraph object produces following error: g_gexf <- igraph.to.gexf(g, position=null) error in `row.names<-.data.frame`(`*tmp*`, value = value) : duplicate 'row.names' not allowed what row.names error code refers to?

ionic not finding android -

i have tried use ionic lab. tried build simple blank app using lab when go build android app says need have android sdk. have android sdk , platform tools already. added path in case wondering. graciously sent here ask after trying research issue looking @ "ionic android build error - failed find android_home".(which when checked environment path). took screen shot of both(environment , error ionic lab console). error , environment for windows:-- set android_home=c:\<installation location>\android-sdk-windows set path=%path%;%android_home%\tools;%android_home%\platform-tools android sdk download not include specific android platforms. run code in guide, need download , install latest sdk platform. using android sdk , avd manager installed in previous section. open android sdk manager window: android note: if command not open android sdk manager, path not configured correctly. select tools checkbox. select checkbox latest android sdk. extras folder, ...

java - Parsing PHP data from HTML webpage with jsoup -

i'm not entirely sure how phrase question or title here goes. using jsoup parse webpage ( http://champion.gg/statistics/ ) , i'm trying grab stats table using code. public void connect(string url) { try { document doc = jsoup.connect(url).useragent("mozilla/5.0 (macintosh; intel mac os x 10_9_2) applewebkit/537.36 (khtml, gecko) chrome/33.0.1750.152 safari/537.36").get(); system.out.println(doc.tostring()); element table = doc.select("table[class=table table-striped]").first(); element tbody = table.select("tbody").first(); iterator<element> rows = tbody.select("tr").iterator(); rows.foreachremaining(row -> { system.out.println(row.tostring()); }); } catch(ioexception exception) { if(settings.debug) { program.logger.log(level.severe, "there error reading document supplied url!", exception); } program.ale...

python - Error "Can't convert 'int' object to str implicitly" -

this question has answer here: typeerror: can't convert 'int' object str implicitly 1 answer i started automate boring stuff , i'm @ chapter 1. myname = input() print ('it nice meet you,' + myname) lengthofname = len(myname) print ('your name many letters:' + lengthofname) i ran this, gave me can't convert 'int' object str implicitly . reasoning @ line 3 want variable myname converted integer , plugged line 4. why erroneous way of coding? you have problem because + can add 2 numbers or concatenate 2 strings - , have string + number have convert number string before can concatenate 2 strings - string + str(number) print('your name many letters:' + str(lengthofname)) but can run print() many arguments separated comma - in other functions - , python automatically convert them string before print(...

algorithm - Understanding asymptotic notation when given asymptotic performance, time and number of elements -

2nd year computer science student here. in class covering asymptotic notation, sorting algorithms , such. need understanding asymptotic notation , how values relate 1 another. have been @ little while can't seem arrive @ reasonable conclusion. imagine answer simple eludes me. professor provided hand-out goes pretty detail asymptotic notation , how used. so, hand out asks following questions: what distinction between big-o , big-theta asymptotic performance? my conclusions hand-out are: -big-o performance means algorithm can finish , asymptotic performance worst case scenario. -big-theta performance means algorithm cannot finish , asymptotic performance best case scenario. if these assumptions incorrect can sesame street me? -and- a wood-chuck requires 20 seconds chuck 60 chucks of wood, , wood-chuck’s wood-chucking algorithm has temporal asymptotic performance theta(n^2). how wood wood-chuck chuck (if wood-chuck chuck wood) in 5 minutes? i understand since alg...

How to get the absolute coordinate of a specific elements in DotNetBrowser? -

anyone know how absolute coordinate of specific elements using dotnetbrowser? thankyou!! this functionality not present in dotnetbrowser dom api yet. possible workaround case using javascript. update : functionality added in dotnetbrowser 1.8.3. possible obtain absolute or relative domelement position via dom api.

No menu button in phone , cannot use settings options in Android app -

i have developed app , uses settings using preference activity , action title bar . when press 3 dots-> settings button , displays not responding , can u . manifest file code is <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="demoproject.swatygupta.com.demoproject_actionbar"> <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsrtl="true" android:theme="@style/apptheme"> <activity android:name=".activity2_2preferenceactivityscreen" /> <activity android:name=".mainactivity" android:label="@string/app_name" android:theme="@style/apptheme.noactionbar"> <intent-filter> <action android:name="an...

php - How to match the whole word when we have a sub-string of it? -

here code: $txt = 'this text'; $word = 'is'; echo str_replace($word, '<b>'.$word.'</b>', $txt); //=> th<b>is</b> <b>is</b> text as see, sub-string is in example above , matches is part of this . while need select whole of word. expected result: //=> <b>this</b> <b>is</b> text so need check both left , right side of sub-string , match until either first of string ^ or end of string $ or white spage \s . how can that? you can use preg_replace achieve regex http://php.net/manual/en/function.preg-replace.php

Managing high dimensions in Numpy -

i want write function of 4 variables : f(x1,x2,x3,x4) , each in different dimension. this can achieved f(x1,x2[newaxis],x3[newaxis,newaxis],x4[newaxis,newaxis,newaxis]) . do know smarter way ? you're looking np.ix_ 1 : f(*np.ix_(x1, x2, x3, x4)) for example: >>> np.ix_([1, 2, 3], [4, 5]) (array([[1], [2], [3]]), array([[4, 5]])) 1 or equivalently, np.meshgrid(..., sparse=true, indexing='ij')

Passing elements between pages in C# Xaml -

first pass content of button mainpage menu2: private void button2click(object sender, routedeventargs args) { // create passdata object passdata passdata = new passdata(); // set initializedata property button's content passdata.data = firstelement.content; // pass object navigate this.frame.navigate(typeof(menu2), passdata); } then retrieve data within menu2 page: // pulling data first page selection protected override void onnavigatedto(navigationeventargs args) { // object passed second argument navigate passdata passdata = args.parameter passdata; // use initilize button firstelement.content = passdata.data; base.onnavigatedto(args); } at point button's content passed without problems. then want pass data mainpage again: menu2 code: private void button1click(object sender, routedeventargs args) { // create passdata object pas...

email - why did not display My blade.php file in laravel 5.2 -

going send invitations emails in laravel app. problem when click blade.php emai send input, not open view file , automatically send email without open email input. view file link email input <p> <a href="/invs/invitationemail">invitations</a></p> emailscontroller <?php namespace app\http\controllers; use illuminate\http\request; use app\http\requests; use illuminate\support\facades\mail; class emailscontroller extends controller { public function send(request $request) { $email = $request->input('email'); mail::send('emails.send', ['email' => $email], function ($message) use ($email) { $message->from('somiyatabara@gmail.com', 'kurumba'); $message->to('karune@gmail.com'); }); return response()->json(['message' => 'invitation email sent!']); } // } invitationmail.blade.php @extends('layouts.app'...

Change CSS root variable with jquery or javascript -

i using css variables in webpage , making sort of theme color, :root { --themecolor: #0afec0; --hovercolor: #fff; --bodycolor: #eef1ef; } now i've used var(--themecolor) everywhere , want assign random color --themecolor @ every reload. possible? you can pretty easy like: document.documentelement.style.setproperty('--themecolor', 'red'); update: not sure if question changing color thought. i've added getrandomcolor() example. random stuff can big load of work depending if want save last used color user or ... // array colors var colors = [ "red", "green", "lime", "purple", "blue" ]; // random color array function getcolor() { return colors[ math.floor(math.random() * colors.length) ]; } // set color array document.documentelement.style.setproperty('--themecolor', getcolor()); :root { --themecolor: orange; } { ...

Defining interest rate array in python -

i trying create mortgage calculator on python can cope multiple interest rate changes. i want recalculate repayment formula every month, new interest rate. what best way define array of interest rates? say had 20 year mortgage, array need 240 entries, change @ time, seems there must quicker way typing out y=(0.01,0.01,0.01,0.015,0.015,0.02,0.015,0.02,0.02..) etc

Setting values of Numpy array when indexing an indexed array -

i'm trying index matrix, y , , reindex result boolean statement , set corresponding elements in y 0 . dummy code i'm using test indexing scheme shown below. x=np.zeros([5,4])+0.1; y=x; print(x) m=np.array([0,2,3]); y[0:4,m][y[0:4,m]<0.5]=0; print(y) i'm not sure why not work. output want: [[ 0.1 0.1 0.1 0.1] [ 0.1 0.1 0.1 0.1] [ 0.1 0.1 0.1 0.1] [ 0.1 0.1 0.1 0.1] [ 0.1 0.1 0.1 0.1]] [[ 0. 0.1 0. 0. ] [ 0. 0.1 0. 0. ] [ 0. 0.1 0. 0. ] [ 0. 0.1 0. 0. ] [ 0.1 0.1 0.1 0.1]] but get: [[ 0.1 0.1 0.1 0.1] [ 0.1 0.1 0.1 0.1] [ 0.1 0.1 0.1 0.1] [ 0.1 0.1 0.1 0.1] [ 0.1 0.1 0.1 0.1]] [[ 0.1 0.1 0.1 0.1] [ 0.1 0.1 0.1 0.1] [ 0.1 0.1 0.1 0.1] [ 0.1 0.1 0.1 0.1] [ 0.1 0.1 0.1 0.1]] i'm sure i'm missing under-the-hood details explains why not work. interestingly, if replace m : , assignment works. reason, selecting subset of columns not let me assign zeros. if explain what...

math - float value extraction in javascript -

how can extract float value (0.9) whole integer value (9) in javascript? example var total = 67.9; process var whole var dec var whole = 67; var dec = 9; the simplest way can think of this: var string = total.tostring(); var dotidx = string.indexof("."); var dec = dotidx >= 0 ? +string.slice(dotidx + 1) : 0; notice doesn't work numbers in exponential forms.

react native - TouchableOpacity swallow touch event and never pass -

i'm trying make both onpress happened touchableopacity , second 1 1 fires: <touchableopacity onpress={() => console.warn('first button')}> <touchableopacity onpress={() => console.warn('second button')}> <text> press me </text> </touchableopacity> </touchableopacity> how can make both of them fire? thanks in advance! you can fire both of them using 'ref' concept , calling props onpress. <touchableopacity onpress={() => alertios.alert('firstbutton') } ref={component => this.myfirsttouchable = component} > <touchableopacity onpress={() => { alertios.alert('second') this.myfirsttouchable.props.onpress() } }> <text> press me </text> </touchableopacity> </touchableopacity>

Javascript Append Textarea value issue -

i have created 4 textarea boxes , values when click submit button. when click submit button append text, written in textareas after submit button plain text. have tried createelement("p") , append values it's not working. here have done until now. can me find problem is? thanks. html code: <div class="container"> <div class="content-container"> <label>first content<label> <textarea id="fisrt-content" class="content-area" placeholder="insert content here"></textarea> </div> <div class="content-container"> <label>second content<label> <textarea id="second-content" class="content-area" placeholder="insert content here"></textarea> </div> <div class="content-container"> <label>third content<label> <texta...

javascript - Regexp to match words two by two (or n by n) -

i'm looking regexp able match words n n. let's n := 2 , yield: lorem ipsum dolor sit amet, consectetur adipiscing elit lorem ipsum , ipsum dolor , dolor sit , sit amet (notice comma here), consectetur adipiscing , adipiscing elit . i have tried using \b word boundaries no avail. lost trying find regex capable of giving me n words... /\b(\w+)\b(\w+)\b/i can't cut it, , tried multiple combinations. regular expressions not need here, other split input words. problem problem involves matching overlapping substrings, regexp not at, javascript flavor. instead, break input words, , quick piece of javascript generate "n-grams" (which correct term n-word groups). const input = "lorem ipsum dolor sit amet, consectetur adipiscing elit"; // array of words, generate n-grams. function ngrams(words, n) { const results = []; (let = 0; < words.length - n + 1; i++) results.push(words.slice(i, + n)); return results; ...

python selenium - how to read/store a text on a webpage -

https://gyazo.com/6f590c16fc078a0cd90fa2b0d4343d3c can see want script read text "29 dage" how locate selenium. can see under class="dbalisting listing lastlisting" and 4th want python read. how shall that? selenium provides function find_element_by_css_selector() locates first element based on provided css selector. (there's multi-item variant, find_elements_by_css_selector() , returns list of matching elements.) text = driver.find_element_by_css_selector('.dbalisting.listing.lastlisting > td:nth-child(4) > span').text css main way of styling html. css selectors how elements chosen different styling. these selector rules used other tools well-known way of selecting elements. . indicates class. (there # ids, not used here; nothing element names, used td , span ; , : or :: psuedo-selectors.) tells system want elements class. > relationship operator meaning "parent/child relationship". ( space technica...

asp.net - Filter based on annotation property in CRM WEP API -

Image
i using crm web api 2016 v8.1 . i need filter data based on annotaion property 1 _objectid_value@microsoft.dynamics.crm.lookuplogicalname anyone know how or if implemented or not? if understand correctly want filter data (for example) lookup field in record. it possible filter single record. example: get [organization uri]/api/data/v8.2/accounts(00000000-0000-0000-0000-000000000001)?$expand=account_tasks($filter=endswith(subject,'1');$select=subject) but it's not yet possible filter multiple record using $expand source: https://msdn.microsoft.com/en-us/library/mt607871.aspx?f=255&mspperror=-2147217396#bkmk_optionsonexpand

android - Dagger2 Error :component depends on scoped component in a non-hierarchical scope ordering -

can me resolve issue, i'm trying add dagger2 application getting scope issue. error:(14, 1) error: com.bmx.presentation.authentication.login.logincomponent depends on scoped components in non-hierarchical scope ordering: @com.bmx.di.scope.activityscope com.bmx.data.remote.authenticationrepositorycomponent @com.bmx.di.scope.activityscope com.bmx.presentation.authentication.login.logincomponent @module public class appmodule { private application mapplication; public appmodule(application mapplication) { this.mapplication = mapplication; } @provides @singleton application provideapplication() { return mapplication; } @provides @singleton public resources provideresources(context context) { return context.getresources(); } } --------------------------------- @module public class netmodule { string mbaseurl; public netmodule(string mbaseurl) { this.mbaseurl = mbaseurl; } @provides @...

Rails, Amazon S3 storage, CarrierWave-Direct and delayed_job - is this right? -

i've discovered heroku doesn't have long-term file storage need move using s3 or similar. lot of new bits , pieces head around have understood how direct upload s3 using carrierwave-direct , processing delayed_job should work rails app? what think should happen if code correctly following: i sign s3 account, set-up bucket(s) , authentication details etc need program in (suitably hidden users) i make sure direct upload white lists don't stop cross-domain preventing uploads (and later downloads) i use carrierwave & carrierwave-direct (or similar) create uploads avoid loading app during uploads s3 create random access ('filename') information don't need worry multiple users uploading files same name , files getting overwritten; if care original names can use metadata store them. carrierwave-direct redirects users browser 'upload completed' url after upload can either create delayed_job or popup 'sorry, went wrong' notification...

javascript - ''x'' is not a function -

the function should return "this true" doesn't appear working. telling me randomquestion not defined. what doing wrong? //questions function randomquestion() { var quest = "this true"; var string_length = 1; var randomstring = ""; (var i=0; i<string_length; i++) { var rnum = math.floor(math.random() * quest.length); randomquestion += quest.substring(rnum,rnum+1); } document.questions.questfield.value = randomquestion; } <!--questions form--> <form name="questions"> <input type="button" value="question" onclick="randomquestion();">&nbsp; <input type="text" name="questfield" value=""> </form> the name of function randomquestion , in function, write: randomquestion += ... i noticed didn't use variable randomstring in function. maybe want use randomstring += instead of using randomquestion +...

sql - Ignore error in batch insert Postgresql -

i have process runs every 5 minutes , tries insert batch of articles table. articles come web-scrapping, there cases in trying insert batch contains articles have been saved db. my primary key uuid - md5 hash of article title. checking if article exists in db filter batch kinda inefficient. is db level way in postgresql ignore attempts of inserting duplicate uuid without returning error? solution you insert using where not exists clause. for example, consider test table numeric id primary key , textual name . code db=> create table test(id bigserial primary key, name text); create table -- insertion work - empty table db=> insert test(id, name) select 1, 'partner number 1' not exists (select 1,2 test id=1); insert 0 1 -- insertion not work - duplicate id db=> insert test(id, name) select 1, 'partner number 1' not exists (select 1,2 test id=1); insert 0 0 -- after 2 insertions, table contains 1 row d...

python 2.7 - Suds Client ignores modification done by plugins into sending method -

i trying use plugin doing modification on sending. modification done, suds sends soap before modification. after long search plugin, finish looking suds sources. into client.py file, send function calls plugins: plugins.message.sending(envelope=soapenv) but after call soapenv still previous. as plugins return ctx, patch with res = plugins.message.sending(envelope=soapenv) soapenv = res.envelope and working expected. soapenv string, think python pass value don't how can work without kind of patch. why need patch ? doing wrong ? version used: python 2.7.9 (default, jun 29 2016, 13:08:31) [gcc 4.9.2] on linux2 suds (0.4) sud should not used, jurko fork better , fix issue

Gradle can't use ant optional (for example ScriptRunner in script task) -

when execute imported ant task, exception: java.lang.classnotfoundexception: org.apache.tools.ant.util.optional.scriptrunner i know use scripts in many places inside tasks. use them this: <script manager="bsf" language="beanshell" classpath="${bshjar}"><![cdata[ i guess somehow must add dependency ant-apache-bsf jar. tried buildscript { repositories { mavencentral() } dependencies { classpath 'org.apache.ant:ant-apache-bsf:+' } } // confirm classpath contains optional jar. // jar contains required class. buildscript.configurations.classpath.each { println } def sc = new org.apache.tools.ant.util.optional.scriptrunner(); println "sure able create script runner object: $sc" ant.importbuild "build.xml" no success. there article in gradle user guide promising title 42.9 ant optional dependencies . unfortunately thing understand article solution won't work. example given there doesn...

reactjs - React Native project building failure -

i getting familiar react native. after installation, tried test new project : react-native init awesomeproject cd awesomeproject react-native run-ios but indicates failure build added below: 2016-11-13 13:15:08.325 xcodebuild[2263:13925] dvtassertions: warning in /library/caches/com.apple.xbs/sources/idexcode3projectsupport/idexcode3projectsupport-11527/xcode3core/legacyprojects/frameworks/devtoolscore/devtoolscore/buildsystem/dependencygraph/xcdependencygraph.mm:688 details: unable write dependency graph: don’t have permission save file “rctactionsheet.build” in folder “debug-iphonesimulator”. object: <xcdependencygraph> method: +loadorcreateinbuilddirectory:withtargetbuildcontext:withbasepath: thread: <nsthread: 0x7fc1bef7a090>{number = 9, name = (null)} please file bug @ http://bugreport.apple.com warning message , useful information can provide. advice please.

android - Is it possible to trigger location change without battery drain? -

in application need update user's location when entering city. so example: user lives in citya user travels citya cityb a function should triggered. i see following functions provided google play services: public abstract location getlastlocation (googleapiclient client) public abstract pendingresult<status> requestlocationupdates (googleapiclient client, locationrequest request, locationlistener listener) the problem is: i need track user's city location changes continuously, not when user using app. how without draining battery fast? you can use broadcast receivers this. there documentation @ https://developer.android.com/reference/android/content/broadcastreceiver.html . private static final locationrequest request = locationrequest.create() .setfastestinterval(60000) // in milliseconds .setinterval(180000) // in milliseconds .setpriority(locationrequest.priority_low_power); '@override public v...

cakephp - Can't find intl php -

i'm running xampp on ubuntu 16.04 , i'm trying cakephp work. after uncommenting line corresponding extension in php.ini, keep getting message when running php: php warning: php startup: unable load dynamic library '/opt/lampp/lib/php/extensions/no-debug-non-zts-20131226/php_intl.so' - /opt/lampp/lib/php/extensions/no-debug-non-zts-20131226/php_intl.so: cannot open shared object file: no such file or directory in unknown on line 0 i've tried multiple ways solve such defining extension path in php.ini , downloading intl pecl can't function proprely. thanks in advance help! install intl extension if php version 7.0 apt-get install php7.0-intl if php version 5.6 run apt-get install php56-intl then restart apache. hope problem solve

java - Error in Rest Service in SpringFramework with @Controller annotation -

Image
i writing simple rest service using springframework , getting below error message while trying access rest service through chrome browser. error processing request context path:/simple_app-1.0-snapshot servlet path:/ path info:null query string:null stack trace org.springframework.web.util.nestedservletexception: request processing failed; nested exception java.lang.nullpointerexception org.springframework.web.servlet.frameworkservlet.processrequest(frameworkservlet.java:979) org.springframework.web.servlet.frameworkservlet.doget(frameworkservlet.java:858) javax.servlet.http.httpservlet.service(httpservlet.java:687) org.springframework.web.servlet.frameworkservlet.service(frameworkservlet.java:843) here pom.xml <?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" ...