Posts

Showing posts from May, 2012

java - How to get the 3rd element of an Arraylist as the sum of first two elements in an ArrayList in Android -

i pretty new programming world, kindly me in solving solution. kindly consider suppose have x , y values. need add arraylist , z third element z's initial value 0 , next iteration onward z's value becomes sum of ((x[1] - x[0])+ (y[1]-y[0]))? how add values z , how sum of z? try this, you can add x values , y values in arraylist of integer or type , this, int xsum, ysum, totalsum; arraylist<int> zsumlist; zsumlist = new arraylist<int>; zsumlist.add(0,0); for(int = 1; < numberoftimes;i++) { xsum = x[i] - x[i-1]; ysum = y[i] - y[i-1]; totalsum = xsum + ysum; zsumlist.add(i,totalsum); } hope helps.

matlab - Generate ramp audio signal of frequencies within specific duration -

i wanted generate frequencies of 10hz 1000hz step of 10hz, let's within 5s (all frequencies equally distributed within time frame). how achieve individual frequency generator function below? function [ ] = producefeq( frequency, duration, amplitude, freqsampling ) if ~exist('freqsampling', 'var'), freqsampling = 44100; end if ~exist('amplitude', 'var'), amplitude = 1; end if nargin <2, error('not enough input arguments'); end % frequency argument case above 10:10:1000 t = 0:(1/freqsampling):duration; y = amplitude*sin(2*pi*frequency*t); sound(y, freqsampling); end thanks in advance! you can call producefeq multiple times , use pause wait between multiple executions. totalduration = 500; frequencies = 10:10:1000; duration = totalduration/length(frequencies); = 1:length(frequencies) producefeq( frequencies(i), duration) pause(duration) end

python - "is" operator behaves unexpectedly with integers -

why following behave unexpectedly in python? >>> = 256 >>> b = 256 >>> b true # expected result >>> = 257 >>> b = 257 >>> b false # happened here? why false? >>> 257 257 true # yet literal numbers compare i using python 2.5.2. trying different versions of python, appears python 2.3.3 shows above behaviour between 99 , 100. based on above, can hypothesize python internally implemented such "small" integers stored in different way larger integers , is operator can tell difference. why leaky abstraction? better way of comparing 2 arbitrary objects see whether same when don't know in advance whether numbers or not? take @ this: >>> = 256 >>> b = 256 >>> id(a) 9987148 >>> id(b) 9987148 >>> = 257 >>> b = 257 >>> id(a) 11662816 >>> id(b) 11662828 edit: here's found in python 2 documentation

javascript - Use jquery ajax in my Ruby on Rails app to refresh and text_field -

my ruby on rails application it’s construction company , in part of have 2 models, 1 called item (rubro) , other called budget . each item created has own price. in budget form have option add different items quantity using nested form. in first column have collection_select works items id select item add, in second column complete quantity, , in third column idea display subtotal value (item price * quantity). my question how can item_id selected in collection_select use item price , show (item price * quantity) in subtotal text_field? it possible that? know using ajax , jquery, new these. or give me other idea of how it? this part of form want said: _form.html.erb <%= f.fields_for :budget_details, :wrapper => false |form| %> <tr class="fields "> <td class="col-md-4"> <div class="col-md-9"><%=form.collection_select(:rubro_id, rubro.all, :id, :name, {prompt:

Laravel 5.3 no .env only .env.dev -

hi i'm new team development. if add .env file works fine if remove there error the supported ciphers aes-128-cbc , aes-256-cbc correct key lengths. . how make work? thank you your .env file (or environment) need have app_key variable, laravel uses encryption. can generate key php artisan key:generate --show .

Pickle class which create dynamically -

i use py2.7 have read pickle dynamically parameterized sub-class .it places similar question problem more complex. here more detail code , why use pickle ? or have idea replace apscheduler i have simplify code.please me. example : class base(object): base = none # has more method , more params in class def run(self): print self.base class a(base): params = none def run(self): print self.base + self.params class b(base): params = none def run(self): print self.base * self.params def _create(base_class, p): class c(base_class): params = p return c() def factory(base_class): class_list = [] in xrange(0, 500): class_list.append(_create(base_class, i)) return class_list try: import cpickle pickle except importerror: import pickle a_class_list = factory(base_class=a) b_class_lsit = factory(base_class=b) in a_class_list: o = pickle.dumps(a, pickle.highest_protocol)

objective c - iOS Load image from URL specifying size -

recently our app needs replacement in image fetching logic, such client should request image size (image built server dynamically). image url has following format: http://image.server.url/path?width={{width}}&height={{height}} most of custom views built in following pattern: - (instancetype)initwithframe:(cgrect)frame { if (self = [super initwithframe:frame]) { // initializations } return self; } - (void)setimageurl:(nsurl *)url { // image fetching } and instantiated as: someview *view = [[someview alloc] init]; view.imageurl = [nsurl urlwithstring:@"..."]; [self addsubview:view]; this not problem (as images' size static), when requesting image having dynamic size unavailable because, image fetching run before -layoutsubviews called, target image container's size zero. after all, need figure out timing when layout finished (using observer image containers), or have static size image containers. what best solution this?

java - Printing each elements of one row on separate lines? -

this question: assume two-dimensional array of ints called 'myints'. write code snippet print each of elements of row m on separate line. may assume m not out of bounds. this work have done not sure going in right direction... for (int = 0; < myints.length; i++) { (int j = 0; j < myints[i].length; j++) { system.out.print (myints[i][j]); if(j < myints[i].length - 1) { system.out.print(" "); } } system.out.println(); } because requirement print values of given row m , think need single for loop, iterate on single row: public void printrow(int[][] array, int m) { (int i=0; < array[m].length; ++i) { system.out.println(array[m][i]); } } i didn't bother checking bounds of input m , because said don't need to. in case, printrow() throw arrayindexoutofboundsexception should index m out of bounds.

laravel - How to redirect all wrong URL to login page? -

i want redirect wrong urls people type in (e.g., www.website.com/xwfkjdf, pages don't exist), login page (if they're not logged in) , dashboard if they're logged in. currently, "notfoundhttpexception" error. change render function inside app\exceptions\handler.php to public function render($request, exception $exception) { //redirect if route not found if ($exception instanceof \symfony\component\httpkernel\exception\notfoundhttpexception){ return redirect('/'); } return parent::render($request, $exception); }

c# - How to use language’s parser to get the tokens to populate the completion list in VS SDK? -

[environment]:vs2017+c# i want extend intellisense, reorder completion list. read doc: walkthrough: displaying statement completion doc say: the completion source responsible collecting set of identifiers , adding content completion window when user types completion trigger, such first letters of identifier. in example, identifiers , descriptions hard-coded in augmentcompletionsession method. in real-world uses, use language’s parser tokens populate completion list . void icompletionsource.augmentcompletionsession(icompletionsession session, ilist<completionset> completionsets) { list<string> strlist = new list<string>(); strlist.add("addition"); // ☹hard coded !!! strlist.add("adaptation"); strlist.add("subtraction"); strlist.add("summation"); m_complist = new list<completion>(); foreach (string str in strlist) m_complist.add(new completion(str, str, str, null, null

php - In My WP Site I want Push Notification -

server should automatically send 1 push notification every hour. news selected should latest news added within last 1 hour. might need define off hours (eg 12am 5 am) whereby no notification should sent during time. can suggest me how do? it hard give specific answer, since did not explain setup. however, suggest have @ implementing cronjob. this, can execute php file on server, performs desired action on interval (and off hours) specified.

php - Database Seeder cannot find class with Laravel 5.2 -

when running php artisan migrate --seed , error appears: [symfony\component\debug\exception\fatalthrowableerror] class 'createcharacterstable' not found. here that class: <?php use illuminate\database\seeder; use illuminate\database\eloquent\model; class characterseeder extends seeder { public function run() { db::table('characters')->delete(); db::table('characters')->insert([ 'user_id' => 999, 'name' => 'susan strong', 'race' => 'orc', 'class' => 'assassin', 'image_location' => null, 'combat_level' => '0', 'base_str' => 6, 'base_int' => 4, 'base_apt' => 5, 'mod_str' => 9, 'mod_int' => 5, '

c++ - can we create object of class based on condition statement? -

i creating bank program if acc_type current obj should created of currentclass(derived bank class) or else object should created of savingclass(derived bank class).can use this?i used showing error somelike 'obj' not declared in scope. enter image description here if(condition) { derivedclass1 obj; //first object } else { derivedclass2 obj; //second object } the simple solution is: baseclass *obj; if(condition) { obj = new derivedclass1; //first object } else { obj = new derivedclass2; //second object } there's other ways of doing (i'd use std::unique_ptr ), easiest understand.

android - How to get the activity which called the BroadcastReceiver? -

i have broadcastreceiver checks networkchange, whether connected internet or not. so in application when network disconnected or connected, want know activity has called broadcastreceiver , can go previous activity after showing alert informing network. my code, public class networkchangereceiver extends broadcastreceiver { private android.widget.toast toast; @override public void onreceive(final context context, final intent intent) { try { boolean isvisible = myapplication.isactivityvisible(); context appcontext = context.getapplicationcontext(); if (isvisible == true) { if (checkinternet(context)) { /*intent = new intent(context, mainactivity.class); i.addflags(intent.flag_activity_new_task); context.startactivity(i);*/ toast.maketext(context, "network available operations", toast.length_long).show(); } else { intent = new inten

Integrated deployment with profile management for set of Spring Boot microservices with maven -

i have 7-8 microservices, in future number can grow 25-30. these services spring boot rest services. what best practice have integrated build all? also, deployment purpose have switch between test , dev profile. how can make centralized instead of doing each service? as microservices should independent should not build or deployed together. switching between test , dev profile performed checking service deployed use of environment variables. more information e.g. here .

spring security - What is the User class for? -

i've read information documentation didn't understand when should subclass class or use directly. also don't understand when it's practice create own userdetails. usually, create userdetailsservice , retrieve userdetails there. do need add functionality 2 classes isn't there? if yes, that's when need create subclasses them. usually, create userdetailsservice , retrieve userdetails there. to me looks you're answering question yourself. not need subclass.

php - Select Random and unique rows from database on button click -

Image
i trying develop quizz app in php , mysql. have case have 1 random row database on button click. , question appeared once should not appear next time. what did was, selected random row database stored id on session variable array. , next time while fetching data of random row checked if questions id lies on array or not. if question id on array reload page new question else display question. the code have used follows code select random , unique row code display value , save value on array sorry!, couldn't put code in here due format problem. using way, when every question on database shown user, page enter infinite redirection loop. might use query this: select * tbl_question question_id not in ([previously shown ids]) , is_active='yes' order rand() limit 1 this way, if don't result, you'd assume questions have been shown user, , won't need page refresh switch question when question exists in session variable. in code,

angular - By default the 1st accordion should be set to open without clicking on it in Angular2? -

hey guys need in solving problem. have made use of *ngfor loop accordion , in need first accordion open default. can please me this. here angular2 code. <div class="today col-lg-9 col-md-12 col-sm-12 col-xs-12"> <md-card *ngfor="let value of timer_entries.entries" style="padding:0px !important;margin-bottom: 10px;margin-top: 15px;"> <div class="accordion-section"> <accordion> <accordion-group #group> <div accordion-heading> {{value[0]}} <i class="pull-right glyphicon glyphicon-triangle-right" [ngclass]="{'closearrow': group?.isopen, 'openarrow': !group?.isopen}"></i> <span class="pull-right padding-right-20 color-primary">{{value[2]}}</span> </div&g

dependency cycle on spring WebSocket interceptor and spring cloud stream -

i trying create websocket interceptor send message using messagechannel spring cloud stream . facing dependency cycle ┌─────┐ | mychannelinterceptor defined in file [/users/shahbour/ideaprojects/proxy/target/classes/com/xxxxx/proxy/broker/mychannelinterceptor.class] ↑ ↓ | com.xxxx.proxy.service.xxxxxbinding (field private java.util.map org.springframework.cloud.stream.binding.bindableproxyfactory.bindingtargetfactories) ↑ ↓ | org.springframework.cloud.stream.config.bindingserviceconfiguration (field private java.util.list org.springframework.cloud.stream.config.bindingserviceconfiguration.custommessageconverters) ↑ ↓ | org.springframework.web.socket.config.annotation.delegatingwebsocketmessagebrokerconfiguration ↑ ↓ | websocketconfig defined in file [/users/shahbour/ideaprojects/proxy/target/classes/com/xxxx/proxy/config/websocketconfig.class] └─────┘ my problem need inject messagechannel websocket interceptor i receiving below error if use @autowire or

OSB 12c: Disable offline endpoint URI's -

i have question regarding easier way uncheck offline endpoint uri's checkbox in osb business service. using loadbalancer url's part of endpoint uri , want disable offline endpoint functionality of osb i able using wlst script wanted know if can achieved using customization file also? regards, pavan

javascript - Cannot read property 'undefined' of undefined?how can i push the numbers to first drop down list ? using java script? -

var select = document.getelementbyid("source"); var select2= document.getelementbyid("status"); var option = ["1", "2", "3", "4", "5","6","7","8","9"]; var option2= []; function moveright() { var = source.options[source.selectedindex].value; var option = document.createelement("option"); option.text = a; select2.add(option); select.remove(i); } function moveleft() { var b = status.option2[status.selectedindex].value; var option2 = document.createelement("option"); option2.text = b; select.add(option2); select2.remove(i); } for(i = 0; < option.length; i++) { var opt = option[i]; var = document.createelement("option"); a.innerhtml = opt; a.value = opt; select.appendchild(a); } for(i = 0; < option2.length; i++) { var opt2 = option2[i]; var = document.createelement("option"); a.innerhtml = opt2

javascript - jQuery sortable to find parent of the dropped div? -

how find parent of dropped div $(".someclass").sortable ({ connectwith: ".someclass", cancel: '.cart_header', receive: function(e, ui) { var drag_id = ui.item.attr("id"); var parent_id = ui.item.parent().attr("id"); alert("hi"+parent_id); var re_id = $(this).attr('id'); alert(drag_id,re_id); } }).disableselection(); lets assume, list1 div contain following div1 , div2 , div3 (id). and list2 not contain divs. now i'm moving div1 list1 div list2 div. in above code give result div1 , list2 . need find parent div left from.

Change default login pages from admin panel in Laravel -

i have admin panel has various function. there 2 login forms on front end of site: http://example.com/login http://example.com/login2 the default login form http://example.com/login there button on user can click if he/she want use second login form. those routes them route::get ('/users/login', ['uses' => 'userscontroller@login', 'before' => 'guest']); route::get ('/users/no_login', ['uses' => 'userscontroller@no_login', 'before' => 'guest']); what options have switcher in admin panel can switch default page login page e.g. switch between login , login2 . if put them in database need change in routes current active form or there way? edit public function login() { $login = preferences::all(); if ($login->preferences_login == 0){ return view::make('users.login'); } return view::make('users.no_login'); } error

gplots - 100 plots in 1 multi page pdf in R -

i have r script creates 100 plots. how create 1 single pdf 50 pages? 2 plots on each page.i tried using par(mfrow=(50,2)) giving error in plot.new() : figure margins large you want 2 plots per page, need par(mfrow=c(2,1)) . r automatically switch next page if ask plot more 2 plots. pdf("myoutput.pdf") par(mfrow=c(2,1)) (i in 1:100) { plot(runif(10) } should produce 50 pages pdf, 2 plots per page.

java - Prepared statement not working, resultset.next() has no records -

running below java code final string qry = queryconstants.query; connection con = null; preparedstatement stmt = null; resultset rs = null; try { con = getdatasource().getconnection(); stmt = con.preparestatement(qry); stmt.setstring(1, abc1); stmt.setlong(2, abc2); stmt.setstring(3, abc3); long st = system.currenttimemillis(); rs = stmt.executequery(); long end = system.currenttimemillis(); logger.error("retrialdaoimpl.fetchfailedmessagefromdb:: time taken fetch failed messages::" + (end - st) + "|likepattern::" + likepattern); while (rs.next()) { system.out.println(rs.getstring("version_number")); } query below select max(version_number) version_number, tlo_type, tlo_id msg_xml status ='n' , recoverable_flag ='y' , pattern =1 , rownum

visual studio code - VSCode: workspace specific settings excluded from source control -

we share team-specific settings vs code including .vscode git. want in resharper: workspace specific private config excluded source control , can override common settings. how can achieve that? thanks. you can share user settings using vscode extension: settings sync if remove workspace settings git repository ( .vscode/setting.json ) can locally overwrite settings per workspace.

php - How to merge array in one array under foreach loop -

i have array want merge under foreach loop please provide solution how can it. array ( [0] => array ( [id] => 377556 [name] => 8 ball pool ios app - * ) ) array ( [0] => array ( [id] => 377555 [name] => test data ) ) i want below result please provide solution how can merge data in 1 array . array ( [0] => array ( [id] => 377556 [name] => 8 ball pool ios app - * ) [1] => array ( [id] => 377555 [name] => test data ) ) php code demo <?php $array1=array ( 0 => array ( "id" => 377556, "name" => "8 ball pool ios app - *" ) ); $array2=array ( 0 => array ( "id" => 377555, "name" => "test data" ) ); $newarray=array($a

java - Codename one calendar UpdateButtonDayDate() issue -

Image
i working on project want show when application starts calendar display, date contain events, instance if date contain events, day button contains * symbol , day, , if date doesn't contain event displays day. wrote following code, displays * symbol when clicking on button, how can manage code display * symbol on date contain events when application starts or page gonna loaded. following code:- public class customised extends calendar{ arraylist<string[]> data = new arraylist<>(); int i,j,columns; @override protected void updatebuttondaydate(button daybutton,int currentmonth, int day) { daybutton.settext(""+day); daybutton.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent evt) { //check date having how many number of events=============================================================== try{ showe

Php Telegram Bot Get userid -

how can usernames of members of telegram robot? robot written in php. $user_lastname=$mybot->message->from->?????; here simple code, should lookup official document details. $user_firstname=$mybot->message->from->first_name; $user_lastname=$mybot->message->from->last_name; $user_username=$mybot->message->from->username; $user_uid=$mybot->message->from->id; you can try @rawdatabot debug.

typescript - AngularJS Unknown provider - For Controllers -

i know there lot of these question, specific. using typescript angularjs. want variable multimediacontroller multimediaalbumcontroller. getting "[$injector:unpr] unknown provider: multimediacontrollerprovider <- multimediacontroller <- multimediaalbumcontroller". how can prevent it? multimediaalbumcontroller export class multimediaalbumcontroller{ $scope; albums : albumdto[]; $popupmanager; $state; $element; mutlimediacontroller; static $inject = ['$injector', '$scope', '$stateparams', '$state', '$popupmanager', '$element','multimediacontroller'] constructor( $injector : ng.auto.iinjectorservice, $scope, $stateparams, $state, $popupmanager, $element, mutlimediacontroller: multimediacontroller ) { super(); $injector.invoke(this.init, this, {$scope});

c++ - Can't solve because it need *.dll -

Image
i new deploy me first app in qt , c++. when doubleclick in me exe of debug folder, have message. but don't need .dll me app. add time ago trying deploy , find error. i review me project.pro , comment lines type cgal. i detect has problem when comment 1 of lines. libs += -l$$pwd/../../../libs/cgal/bin libs += -l$$pwd/../../../libs/cgal4.9/auxiliary/gmp/lib could tell me, need review more , if need check part of configuration on tools of qt program. thanks probably doesn't find dll of qt libs's dependencies. either need deploy needed dll same executable output folder: like such config in .pro config: qmake_post_link += windeployqt $$destdir/$${target}.exe $$escape_expand(\n\t) either need configure windows path env variable add needed dll path in it.

sql server - Linq query fetches different value than sql query view -

i have created view in sql server joining 3 tables , using entity framework , accessing in application. i have following code value view table. tapdatacontext.taptimesheetviews. where(timesheet=>timesheet.userid==userid && timesheet.workdate==dates); this fetches duplicate values. but, sql query gives proper values. i had referred this link here , added [key, column(order = 0)] public long tapstartstopdataid { get; set; } as key value. still, don't proper result when execute application. finally, found solution used row_number() on (order id) rownum, create new column , gave key.i deleted edmx diagram , added again new column populate there , got desired result

css - Possible to make video responsive while having a max-width and max-height? -

i trying place video on page, has responsive (16:9 time). found lot of examples, same (applying 56.25% padding @ bottom). however, apply max-height , max-width iframe (because don't want fill out entire page), content underneath starts move away (because of padding). https://jsfiddle.net/12npu2zu/ #video-container { position: relative; padding-bottom: 56.25%; padding-top: 25px; height: 0; } iframe { position: absolute; top: 0; margin: 0 auto; left: 0; right: 0; width: 100%; height: 100%; max-width: 1000px; max-height: 563px; } is there way keep doing that? maximum width 1000px , maximum height 563px (16:9). is looking for, wrapped in 1 more div , added same style. <div class="video-holder"> <div id="video-container"> <iframe width="1000" height="563" src="https://www.youtube.com/embed/u4ob28ksiio" frameborder="0" allowfullscree

jsf - Injecting commonly used CDI beans in abstract parent class -

this more of practice question... we're converting jsf managed beans cdi beans in jsf 2.2 . while doing this, seems in lot of beans, need few sessionscoped beans. we intended @inject those, option inject them protected variable in parent "facesbean" class. would practice? does @inject work in @managedbean classes not yet converted cdi? so 1 one: 1) practice? if have class hierarchy, suggest @inject private field in parent , create getter method minimum needed visibility (probably protected). stick general practice rules around encapsulation in java. 2) @managedbean , @inject ? as long use bean discovery mode all (use empty beans.xml ), classes automatically picked managed beans - including annotated @managedbean . , bean, injection works. yes, injection work long class can become bean automatically (e.g. not @vetoed or unproxyable etc.)

java - RxJava computation explosion -

i'm facing tricky issue combinelatest. i'm building huge chain of combinelatest , starting second item main observable, there explosion of computation. import org.testng.annotations.test; import rx.observable; import rx.observers.testsubscriber; import rx.subjects.publishsubject; import rx.subjects.subject; import java.util.list; import java.util.concurrent.atomic.atomicinteger; public class rxtest { private atomicinteger ai = new atomicinteger(0); private atomicinteger ai2 = new atomicinteger(0); @test public void explosion() { subject<integer, integer> sub = publishsubject.create(); observable<integer> ret = getobservable(2, sub); testsubscriber<integer> testsubscriber = new testsubscriber<integer>(); ret.subscribe(testsubscriber); sub.onnext(1); sub.onnext(2); // may commented sub.oncompleted(); testsubscriber.assertnoerrors(); list<integer> num

mysql - Quering database in real time -

i retrieving data database having specific date , hour. supposing see data in real time. there way automatically extract data without specifying exact data , time? here query: select store, count(bananas) database_name date_hour between '2017-04-06 07:00:00' , '2017-04-07 07:00:02' group sore select data last hour: select store, count(bananas) table_name date_hour > date_sub(now(), interval 1 hour) group store

asp.net web api - Enterprise Application with MVC and Mobile app - Is IdentityServer required? -

here scenario enterprise application developing: there angular-based asp.net mvc core web application there native mobile apps android , ios both 1 , 2 invoke web api endpoints (part of same enterprise application, not 3rd party). the user shown login page in both web application , mobile app. in case of web based application, once user authenticated, mvc serve ui templates , angular call web api endpoints browser. of course, in case of native app, mvc not serving pages. access different parts of application based on user roles (example: user can authenticated may not authorized view dashboard unless manager). calls web api require authorized (example, can't dashboard data unless call coming manager). is identityserver4 choice here? or can use asp.net core identity of this?

wildfly - Use Arquillian With Port Offset -

i have working arquillian setup starts wildlfy , runs tests: <container qualifier="wildfly" default="true"> <configuration> <property name="jbosshome">../target/wildfly-8.1.0.final/</property> <property name="serverconfig">it.xml</property> </configuration> </container> i wanted change port-offset of wildfly , added: <property name="javavmarguments">-djboss.socket.binding.port-offset=100 -djboss.management.native.port=9054</property> <property name="managementport">9154</property> which results in following exception (both when run in ide , via maven): org.jboss.arquillian.container.spi.client.container.lifecycleexception: not start container caused by: java.util.concurrent.timeoutexception: managed server not started within [60] s even though server.log shows server started correctly, , in way

php - Wordpress loop return value have no html -

i add shortcode wordpress theme functions.php file have, problem. code "[logos]" return only: http://mydomain.pl/wp-content/uploads/2017/04/file1.pnghttp://mydomain.pl/wp-content/uploads/2017/04/file2.pnghttp://mydomain.pl/wp-content/uploads/2017/04/file3.pnghttp://mydomain.pl/wp-content/uploads/2017/04/file4.png form custom field, not return html code. function subscribe_link_shortcode() { $html = '<div> <h3>' . $mastertitle . '</h3> <div class="cmsms_clients_slider" id="cmsms_clients_slider553e45022ef2d"> <script> jquery(document).ready(function() { jquery(\'#cmsms_clients_slider553e45022ef2d\').cmsmsclientsslider({ sliderblock : \'#cmsms_clients_slider553e45022ef2d\', slideritems : \'.cmsms_clients_items\', clientsinpage : 5

c# - MVC RouteLink URL format -

i have following routelink : @html.routelink("accept offer", new { controller = "case", action = "accept", id = item.caseid, offerid = item.pxofferid }, new { @class = "btn btn-success" }) which formats url as: http://localhost:54644/clients/case/accept/15847?offerid=3103 how format url be: http://localhost:54644/clients/case/accept/15847/3103 thanks. default route: context.maproute( "clients_default", "clients/{controller}/{action}/{id}", new { controller = "login", action = "index", id = urlparameter.optional } ); route works if put first in defined routes: context.maproute( name: "accept offer", url: "clients/{controller}/{action}/{id}/{offerid}", defaults: new { controller = "case", action = "accept", id = 0, offerid = urlparameter.optional } ); but causes errors on other pag

ios - DJI SDK throws the error "Application is not registered" Code=-1001 after calling the method DJIMissionManager.prepare -

after adding 5 djiwaypoints djiwaypointmission call following method. djimissionmanager.prepare(djiwaypointmission, withprogress: {(progress: float) -> void in } , withcompletion: {(error: error?) -> void in }) at runtime method throws error domain=djisdkerrordomain code=-1001 "application not registered.(code:-1001)" userinfo={nslocalizeddescription=application not registered.(code:-1001)} in code first check in callback method sdkmanagerdidregisterappwitherror whether application registered , call preparemission . impossible application not registered. particularly because video streaming works fine. i appreciate hints on how can solve problem or more detailed error message. the problem initialized djimissionmanager object directly inside viewcontroller using djimissionmanager.init() constructor. solution: moved object initialization viewdidload() , used djimissionmanager.shar

arrays - Android Studio: Need to add several edit text and an image to a file in external storage -

i got showroom application admin can add car show. design ready. need store values given in simple file file going stored in external storage of device. code: i declared buttons , edit text: public edittext make; public edittext model; public edittext year; public edittext price; public edittext trans; public edittext color; public button addcar; public button uploadimg; public button cancel; string[] toaddcar = { make.gettext().tostring(), model.gettext().tostring(), year.gettext().tostring(), price.gettext().tostring(), trans.gettext().tostring(), color.gettext().tostring() }; public string path = environment.getexternalstoragedirectory().getabsolutepath() + "/listcars"; in oncreate method add : make = (edittext)findviewbyid(r.id.txtmake); model = (edittext)findviewbyid(r.id.txtmodel); year = (edittext)findviewbyid(r.id.txtyear); price = (edittext)findviewbyid(r.id.txtprice); trans = (edittext)

Python - Keeping text file in one line? -

i'm making code shows product list in ordered way, , user can input gtin-8 code , select amount wish 'purchase'. when user inputs gtin-8 code, fullline should product description etc in product list , show amount. however, amount appearing on new line don't want. i've tried putting newline after product list, before , under it, won't stay on same line. here code: nl="\n" products=open("productsfile.txt","w") products.write(nl+"23456945, thorntons chocolate box, £10.00") products.write(nl+"12376988, cadburys easter egg, £15.00") products.write(nl+"76543111, galaxy bar, £1.00") products.write(nl+"92674769, cadury oreo bar, £1.00") products.write(nl+"43125999, thorntons continental box, £12.00") products.close() products=open("productsfile.txt","r") print(products.read()) receipt=open("receiptfile.txt","w") receipt.write("here purchas

reactjs - How to form a uri string in Javascript or in React Native? -

when hardcode username , password in uri works fine, webview opens required page , logs user in, when try append variables uri not work, gives error in login , credentials wrong. hardcoded , works fine: import react, { component } 'react'; import { webview,asyncstorage } 'react-native'; export default class test extends component { async getusername(){ var username; try { username = await asyncstorage.getitem('username'); console.log('username'+username); return username; } catch (error) { // error retrieving data username =""; console.log('username'+username); return username; } } async getpassword(){ var password; try { password = await asyncstorage.getitem('password'); console.log('password'+password); return password; } catch (error) { // error retrieving data password=""; return password; } } render() { let pic = { uri: 'http://www.userlogin.php?username=react&password=react@123

apex code - Salesforce visualforce save button doesnt save -

i new salesforce environment , trying achieve simple thing. want create new lead screen custom lead questions , save lead. i created apex form, overridden new lead button page, when press save button on page, dont error doesnt save lead. cancel button seems working. do need write custom code save or apex:pageblockbuttons default action should work ? i show short snippet of code, of setting input fields <apex:form id="mysection"> <apex:pageblock title="new lead: {!lead.name}"> <apex:pageblocksection title="lead information" columns="1" > <apex:inputfield value="{!lead.firstname}" taborderhint="1"/> <apex:inputfield value="{!lead.lastname}" taborderhint="2"/> <!-- other fields skipped --> <apex:inputfield value="{!lead.project_value__c}" taborderhint="3"/> </apex:pageblocks

php - The right way of starting Behat feature/story -

i'm starting bdd , after readings found out goes ddd. now have domain, institution have places , added institution assignee user assigned manager of organization. i still can't wrap head around how should be, feature sounds like: as assignee of institution must able add places organization the code i'm thinking (sorry code-first approach) this: if ($institution->isassignee($user)) { $institution->addplace(/* properties*/); } now how should write feature , scenarios? should leave as assignee part , leave it? or should there multiple scenarios? how scenario like? edit: so left user permission check , started first feature followed specifications of implementation. code found here . isn't feature simple? of course core of domain does, did not mentioned case in feature place same location not added, have done in institutionspec ? moving forward: if edit place of institution, better approach: $place = $institution->getplace($placeid

ios - Fetching http request with query in Alamofire in Swift -

i'm trying fetch data mlab service mongodb database. can make request browser , data code below. https://api.mlab.com/api/1/databases/mysignal/collections/ctemp?q={"member_id":2}&apikey=2abdhqty1gawiwfvskfjyezvfrheloqi i need change "member_id" \"member_id\" not sytax error. rest of same. however, doesn't fetch alamofire in swift in ios. (i tried without alamofire, usual http request still doesn't work) if try without {"member_id":2} working. i'm doing fetching below code (not working one); alamofire.request("https://api.mlab.com/api/1/databases/mysignal/collections/ctemp?q={\"member_id\":2}&apikey=2abdhqty1gawiwfvskfjyezvfrheloqi") i try add parameters let parameters: parameters = ["member_id": "3"] alamofire.request("https://api.mlab.com/api/1/databases/mysignal/collections/ctemp?q={\"member_id\":3}&apikey=2abdhqty1gawiwfvskfjyezvfrheloqi&quo

php - Uncaught exception 'ReflectionException' with message 'Class App\Console\Kernel does not exist' -

i getting below error after ran command composer dump-autoload . however, before running command, working fine. uncaught exception 'reflectionexception' message 'class app\console\kernel not exist' in vendor/laravel/framework/src/illuminate/container/container.php:719 check path: /your_root/app/console see if have kernel.php file there. file registers commands. maybe somehow have deleted file , thats why getting error.

How to handle id element when mapping mongoDB document to C# class -

i want deserialize document looks this: { "_id" : objectid("58e67bd8df79507aa3f8a6b6"), "value" : 10, "stack" : [ { "id" : "49ccbadf-5964-11e6-b1e9-549f3520935c", "value" : 0 }, { "id" : "49ccb5cc-5964-11e6-b1e9-549f3520935c", "value" : 0 } ] } to c# class. class name entry , definition looks this: public class entry { public bsonobjectid _id { get; set; } public int value { get; set; } public list<stack> stack { get; set; } } and stack class looks this public class stack { public string id { get; set; } public int value { get; set; } } when querying following exception 'an error occurred while deserializing stack property of class consoleapp4.entry: element 'id' not match field or property of class consoleapp4.stack.' i can de

python - trouble about using pil 1.1.7 ImageFont with ttc font file -

i want use notosanscjk fonts unicode characters, choose font files notosanscjk-[wiehgt].ttc instead of ttf files languages. from pil import image, imagedraw, imagefont font = imagefont.truetype('notosanscjk.ttc', size=20) # font = imagefont.truetype('notoserifcjk.ttc', size=20) im = image.new('rgba', (1024, 1024), color=(0,0,0,0)) im_draw = imagedraw.draw(im) text = u'\u0e16\u0e12\u0e2c\u0e28\u0e0b\u0e1b\u0e01\u0e02\u0e0f\u0e17\u0e2b\u0e1f \xe7in ger\xe7ek ki\u015fili\u011finizi ke\u015f1' im_draw.text((0, 0), text, font=font) im.save('test.jpg') but code can not draw unicode characters although there glyphs in ttc font file. what's problem? , how can fix it...?

Kibana JSON input -

i having kibana 5.3. use json input , change result. have notice if set aggregation "count" ignores json input. if set "sum" or whatever alter result weird way. should set aggregation display result script? kibana

django - How to skip using MEDIA_ROOT and MEDIA_URL in a single specific case -

i have question overriding media_root in cases. in case importing xml files large e.g. more 100 mb. using aws uploaded media files. when upload xml file parsing it's contents uploads aws , needed download again. so, there way override , not upload aws , use local file storage. succeeded overriding storage parameter below in model: fs = filesystemstorage(location=settings.static_root + '/xml_uploads/') class importerfile(models.model): ... ... file = models.filefield(storage=fs) .... it uses overriden path when upload file. problem when check in admin interface shows wrong location path. still shows path "/media/filename.xml" . in case must /static/filename.xml i not find way how overcome issue. appreciated. media_root & media_url different, media_root means storing media files there.. media_url url through can access file extend filesystemstorage class , set base_url value class mystorage(filesystemstorage): bas

java - Are static variables inherited -

i have read @ 1000's of locations static variables not inherited. how code works fine? parent.java public class parent { static string str = "parent"; } child.java public class child extends parent { public static void main(string [] args) { system.out.println(child.str); } } this code prints "parent". also read @ few locations concept of data hiding. parent.java public class parent { static string str = "parent"; } child.java public class child extends parent { static string str = "child"; public static void main(string [] args) { system.out.println(child.str); } } now output "child". so mean static variables inherited follow concept of data-hiding ? please have documentation of oracle: http://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html#d5e12110 static variables inherited long not hidden static variable s

view - generator tree like augury angular 2 -

Image
i documenting project , add docs easier in future begginers understand structure of project. using angular2 , documenting typedocs. question is: there solution, plugin, etc... creates tree view of components (parent-child relation) augury does? here let image augury realize show this: any suggestion appreciated it! thank you! there compodoc ( https://github.com/compodoc/compodoc ) seems want, in opinion, it's still ugly is...

How I could make a temperature sweep in comsol? -

i make structure using comsol want make structure subjected temperature variation ( t(begain)=25c temperature ramp (100 c/min) till t=250c , lasts 30 min temperature ramp (-100 c/min) till t=25c ).how make these temperature sweep? you can define function (e.g foo) follows desired temperature time profile. in place specify temperature (whether boundary condition or domain condition) insert foo(t), t being comsol's exclusive variable name time. you can other variables too, space instance. easiest way define foo through 1d interpolation option. unfortunately, not have comsol license check think can enter time , temperature values in 1d interpolation table, choose name , interpolant style , use in later part of program.

unity3d - Check if a player is still online or gone offline by power-off or Gameroom exit -

i have player playing game in facebook gameroom. in database there flag telling me player logged in facebook can tell online. in unity have script implementing monobehaviour.onapplicationquit() flag player offline , monobehaviour.onapplicationfocus(bool) flag player nofocus or afk. case 1: let's electricity problem shuts down player's pc. how can flag player offline? there anyway detect player shut down? case 2: player closes gameroom window. there anyway detect action? onapplicationquit() didn't work on this. the standard way handle set timeout lastseen datetime stamp. game should refresh time stamp regularly (such on timed interval, or on event such sending chat message or accomplishing something)... then set job on database (such agent job in mssql server) pull records logged in timestamp has expired. job changed loggedin flag user logged out. also, job's agent program runs in background on 1 of servers handles this... but, basic method handle sit

java - How and where to set the property "AWT.DnD.flavorMapFileURL" for custom mime types -

when jvm starts prepares map of native mime type vs. java data flavors. mapping present in jdk/jre/lib/flavormap.properties . according comments in file, 1 can augment mapping specifying awt.dnd.flavormapfileurl property in appropriate awt.properties file. i struggled bit work no success. want know can locate awt.properties , format set property awt.dnd.flavormapfileurl .

What does mysql -u root -p do? -

i trying figure out mysql -u root -p command does. i have googled command can't find results. mysql -u root -p means, trying connect mysql shell parameters - -u parameter specified mysql user name. -u, --user=name user login if not current user. in case it's root user. -p, --password[=name] password use when connecting server. if password not given it's asked tty. you can type mysql --help command line more information available parameters. good luck.