Posts

Showing posts from January, 2013

change viewpage swipe direction in RTL layer in android -

i try use rtl layerdirection in activity viewpager , tablayout.but in rtl layer viewpager swipe direction reversed , set currentitem viewpager , tablayout changed. i try after , before setupwithviewpager dose not work. any idea..!! i try : mviewpager = (viewpager) findviewbyid(r.id.mviewpager ); mviewpager.setadapter(adapter); mviewpager.setcurrentitem(mviewpager.getadapter().getcount() - 1,false); tablayout = (tablayout) findviewbyid(r.id.tabs); tablayout.setupwithviewpager(mviewpager); and : mviewpager = (viewpager) findviewbyid(r.id.container); mviewpager.setadapter(msectionspageradapter); tablayout = (tablayout) findviewbyid(r.id.tabs); tablayout.setupwithviewpager(mviewpager); mviewpager.setcurrentitem(mviewpager.getadapter().getcount() - 1,false); you can create custom pager adapter: public class custom_pageradapter extends fragmentpageradapter{ /* * attributes: * * class attributes * * */ private arraylist<

Error while calculating sum of two matrices in c -

so i'm new c , trying write program add 2 matrices program 1 #include <stdio.h> int main(){ int m,n,o,p,i,j; int mat1[m][n]; int mat2[m][n]; int result[m][n]; printf("enter number of rows , columns matrix "); scanf("%i%i",&m,&n); printf("enter elements of matrix 1 :"); for(i=0;i<m;i++){ for(j=0;j<n;j++){ scanf("%i",&mat1[i][j]); } } printf("enter elements of matrix two:"); for(i=0;i<m;i++){ for(j=0;j<n;j++){ scanf("%i",&mat2[i][j]); } } for(i=0;i<m;i++){ for(j=0;j<n;j++){ result[i][j]=mat1[i][j]+mat2[i][j]; } } printf("the sum of matrices are"); for(i=0;i<m;i++){ for(j=0;j<n;j++){ printf("%i",result[i][j]); } } return 0; } this produced no error method two when used function enter values in 2 matrix, produced following error 25 24 c:\users\hp\my-programs\matrix-entry-function

android - Unable to login with Facebook , Gmail after shifting project to another environment -

i have shifted android project different laptop. able login facebook , login gmail fine when application built previous laptop. not able login these after building current laptop. application in under development. firebase working perfectly. please suggest me now. it related device keyhash(fb) , sha1(google) used while registering app on facebook , google platform . these keys varies device device , unique. need regenerate them on new machine , reconfigure project on facebook , google platform. go project on google , facebook , follow instructions generate , replace previous one

apache kafka - MirrorMaker Cross DC Deployment Setup -

i have question regarding mirrormaker. see in official documentation (see https://cwiki.apache.org/confluence/pages/viewpage.action?pageid=27846330 ), mirrormaker placed on destination data center. there reason why can't placed on source data center instead? i'm asking because in our current setup, mirrormaker placed on destination data center , seeing owning partitions on startup or rebalance takes long time. our setup so: 6 total kafka clusters across 4 data centers each data centers has local kafka cluster 2 aggregate kafka clusters in 2 of data centers 400+ topics in each local kafka cluster 2 groups of mirrormakers on same data center respective destination aggregate kafka clusters consumes 4 local kafka clusters mirrormaker instances configured pull 400+ topics with catch regex 4 local kafka clusters aggregate clusters our kafka versions 0.8.2.1 offsets stored in zookeeper our issue on mirrormaker restart / consumer-rebalance partition ownership takes

JSON object in json array in Android -

i want put objects in array , in spinner (caracteristici) response gets information. project stoped when should put them in array. try { jsonobject jobj = new jsonobject(response); jsonarray caracteristiciarray = jobj.getjsonarray(constants.tag_caracteristici); caracteristici.clear(); (int = 0; < caracteristiciarray.length(); i++) { jsonobject c = caracteristiciarray.getjsonobject(i); caracteristici.add(new caracteristici(c.getstring(constants.tag_caracterizare), c.getstring(constants.tag_statistica))); response: {"clasa_caracterizare":[{"denumire_caracterizare":"adezivi si lacuri"},{"denumire_caracterizare":"materiale"},{"denumire_caracterizare":"altele"}]}.... you try extract constants.tag_caracterizare , constants.tag_statistica - objects have 1 string el

mysql - Sample datasets for practice - Oracle pl/sql -

i new user of sql, use oracle pl/sql programming software. have done introductory course sql included datasets. i'd continue practicing, real life problems include requests of querying simple statements difficult ones include indexes, etc. does have links/sites can further pursue sql training free? i've done stakexchange , google search not luck. as know, oracle ussually comes sample schemas hr, sh... listed here also, can install hammerora benchmarking tool. it's commonly used test tpc-c , tpc-h on different rdbms. install schemas on db variable size. can install virtual appliances . there more there, think coolest stackoverflow db , bad mssql.

How to use Google map poly-line API by passing array of coordinates dynamically? -

enter image description here new google api. please me use google map poly-line api passing array of coordinates dynamically? make array of latlng , use array path in polyline obj var latlngarray = [[lat,lng],[lat,lng],[lat,lng],[lat,lng]]; var patharray = []; (var = 0;i<latlngarray .length ;i++){ patharray.push(new google.maps.latlng(latlngarray[i][0],latlngarray[i][1])); } var tourplan = new google.maps.polyline({ path : patharray , strokecolor : "#0000ff", strokeopacity : 0.6, strokeweight : 2, }); tourplan.setmap(map)

c# - How do I run a comparison using only one class twice? -

i have model : public class parameter { [key] public int paramid { get; set; } [display(name = "no.")] public int paramno { get; set; } [required] [display(name = "title")] public string parameter { get; set; } [display(name = "meaning")] public string description { get; set; } [display(name = "synonym")] public string synonym { get; set; } public int catid { get; set; } public virtual icollection<compareparameter> compareparameters { get; set; } } i need add model compares objects in parameter each of other objects in parameter. far have this: public class compareparameter { [key] public int compareid { get; set; } public int paramid1 { get; set; } public int paramid2 { get; set; } public virtual parameter parameters { get; set; } public virtual parameter parameters2 { get; set; } } where paramid1 takes key parameter , paramid2 same. not appear work

Concat two columns from different MySQL tables -

i trying concat list of usernames 1 column in mysql. 2 lists of usernames coming 2 different tables. (select cast(group_concat(concat(usr.username, ' ' ,cc.username)separator ',') char(200)) messagejobrecipients mr left join chatusers cur on mr.chatuserid = cur.id left join users usr on cur.tableuserid=usr.user_id left join customer_contacts cc on cur.tableuserid=cc.id jobid = j.id) membersincluded the code works fine if try display concat(usr.username) or concat(cc.username) when try display both concat(usr.username, ' ' ,cc.username) returns null.

angularjs - Fail to npm install specific commit of angular library from github -

im using angular 2.0.0-beta.15 , cant upgrade it, had find specific commit github library ( ng2-dnd ). so found commit support 2.0.0-beta.17 should work me: "ng2-dnd": "git://github.com/akserg/ng2-dnd.git#87a6cc0d395ebc2d14734769a3190836c8af6e1a" but when go npm install error: npm err! addlocal not install /var/folders/n6/3vqr57k94_z7ynl99yvvtv1r0000gn/t/npm-9640-99198f21/git-cache-fef0b17f/87a6cc0d395ebc2d14734769a3190836c8af6e1a npm err! darwin 15.3.0 npm err! argv "/usr/local/cellar/node/5.6.0/bin/node" "/usr/local/bin/npm" "install" npm err! node v5.6.0 npm err! npm v3.6.0 npm err! no version provided in package.json npm err! npm err! if need help, may report error at: npm err! <https://github.com/npm/npm/issues> does knows how can on this? thanks! you can use ng2-dnd version 1.5.0 update package.json with: "ng2-dnd" : "1.5.0"

angular - How to call ViewChild in runtime? -

in angular2 , want find children components , declared in template in run time. how can it? example: @component({ template: ` <cmp1 *ngif=expression></cmp1> <cmp2 *ngif=!expression></cmp2> ` }) export class component3{ findchild(){ // how find cmp2 } } not sure mean "at runtime" how it's done: @component({ template: ` <cmp1 #cmp *ngif=expression></cmp1> <cmp2 #cmp *ngif=!expression></cmp2> ` }) export class component3{ @viewchildren('cmp') cmp:querylist; findchild(){ return this.cmp.toarray()[0]; } } component1 needs imported. see angular 2 / typescript : hold of element in template

PHP Twig Error: Object of class __TwigTemplate_XYZ could not be converted to string -

hey , morning :). i'll start error message , explain afterwards i've tried , did: catchable fatal error: object of class __twigtemplate_[64chars] not converted string in /somefolder/lib/twig/loader/filesystem.php on line 139 the full error message image: the php error message the call stack text: call stack # time memory function location 1 0.0001 123400 {main}( ) ../handleoop.php:0 2 0.0107 1269656 oophandler::runpage( ) ../handleoop.php:7 3 0.0107 1269768 anweisungeingeben->stepkontrolle( ) ../oophandler.php:62 4 0.0108 1271536 anweisungeingeben->ausgabe( ) ../anweisungeingeben.php:77 5 0.0383 1669484 twig_environment->render( ) ../anweisungeingeben.php:442 6 0.0383 1669484 twig_environment->loadtemplate( ) ../environment.php:347 7 0.0383 1669512 twig_environment->gettemplateclass( ) ../environment.php:378 8 0.0384 1669512 twig_loader_filesystem->getcachekey( ) ../environment.php:312 in anweisunge

Get a text beside a qoute using regex -

this text "this quote" the output must be "this quote" so getting word beside qoute so far regex code "\s*(.*?)\s*" but getting string inside quote you can use regex match word next or before double quote: "\s*\s+|\s+\s*" regex demo your regex "\s*(.*?)\s*" match text between quotes , optional whitespaces.

c++ - Why fstream doesn't work with excel.csv -

i trying add data excel fstream csv doesnt work, don't know if doing wrong. here code #include <iostream> #include <fstream> using namespace std; int main() { ofstream file; file.open("test.csv"); file << "one,two" << endl; file << "three" << " , " << "four\n"; file.close(); return 0; } the results one,two in cell a1 , three,four int cell b1 edit: expected a1 = 1 a2 = 2 b1 = 3 , b2 = four

javascript - AngularJS modal popup dropdown not working -

<a href="" ng-click="open_pop()">open popup</a> controller.js $scope.open_pop = function() { var modalinstance = $uibmodal.open({ template: '<div id="order-flow-modal" class="inmodal" ng-controller="orderlistingctrl">\n\ <div class="modal-header">\n\ <button aria-hidden="true" data-dismiss="modal" id="reg_close" class="close reg" type="button" ng-click="cancel()"><i class="fa fa-times"></i></button>\n\ <h4 class="modal-title">courier form</h4>\n\ </div>\n\ <form class="form-horizontal" ng-submit="shippedform()">\n\ <div class="modal-body">\n\

python - Arrange the multi-similar data efficiently -

Image
the datafile showed here measuring record exported instrument. i uploaded here , interested can download it. background sample record-1 fid1, fid2, front_temperature, laser, laserlow, pressure, mode -925 284 1452 315 143 16653 -28500 -924 281 1462 322 136 16641 -28628 -920 281 1455 311 139 16649 -28756 -923 279 1454 312 139 16636 -28884 ...... sample record-2 fid1, fid2, front_temperature, laser, laserlow, pressure, mode -925 284 1452 315 143 16653 -28500 ...... ...... generally, there several record different samples in order of testing routine. , data record these samples in same format. my attempt if there 1 sample in datafile( in *.txt format), can arrange datafile pandas. dataframe, can handle data more analysis process in python. my code shown here: # whole datafile several samples record inside open("record.txt") f: mylist = f.read().splitlines() ## record each sample length in 80

Limit update rows for MySQL CLI client only in configuration -

sometimes have use mysql cli client make changes on production database. know these changes should ideally go database migration files, not practical or desirable when couple of rows have changed. prefer use migration files structural changes only, not data fixes. i know can add limit clause update queries, won't solve problem since responsibility still on user add limit clause. to reduce potential damage want limit, in config file, max number of rows can updated cli client query. limit should not apply other database connections made application code. is possible?

android - Why my activity reCreate and not reStart -

i start activity this intent window = new intent(mcontext, popup.class); window.addflags(intent.flag_activity_new_task |intent.flag_activity_reorder_to_front|intent.flag_activity_multiple_task); mcontext.startactivity(window); my activity started , log oncreate onstart onresume now want stop activity use this movetasktoback(true); //i don't know if best way stop activity and log onpause onstoped ondestroy not called now want restart same activity use intent window = new intent(mcontext, popup.class); window.addflags(intent.flag_activity_new_task |intent.flag_activity_reorder_to_front|intent.flag_activity_multiple_task); mcontext.startactivity(window); here not restart activity make new one oncreate onstart onresume and activity in manifest <activity android:name=".activity.popup" android:taskaffinity=".mydialog" android:configchanges="orientation|screensize" a

java - How to split URL? -

this code split url, code have problem. link appear double word, example www.utem.edu.my/portal/portal . words /portal/portal double in link appear. suggestion me extract links in webpage? public string crawlurl(string strurl) { string results = ""; // return string protocol = "http://"; // assigns input inurl variable , checks add http string inurl = strurl; if (!inurl.tolowercase().contains("http://".tolowercase()) && !inurl.tolowercase().contains("https://".tolowercase())) { inurl = protocol + inurl; } // pulls url contents web string contecturl = pullurl(inurl); if (contecturl == "") { // if fails, try https protocol = "https://"; inurl = protocol + inurl.split("http://")[1]; contecturl = pullurl(inurl); } // declares variables used inside loop string atagattr = ""; string href = "&quo

git - Configure GitLab with open LDAP -

Image
i trying configure gitlab openldap authenticate users. have configured openldap , working fine jenkins . gitlab giving error could not authenticate ldapmain because "invalid credentials". below gitlab.rb configs: gitlab_rails['ldap_enabled'] = true gitlab_rails['ldap_servers'] = yaml.load <<-'eos' # remember close block 'eos' below main: # 'main' gitlab 'provider id' of ldap server label: 'ldap' host: 'localhost' port: 389 uid: 'uid' method: 'plain' # "tls" or "ssl" or "plain" bind_dn: 'cn=admin,dc=ldap,dc=com' password: 'waqas' active_directory: false allow_username_or_email_login: true #block_auto_created_users: false base: 'cn=appliance,dc=ldap,dc=com' user_filter: '' # attributes: # username: ['uid', 'userid', 'samaccountname'

jsf 2.2 - Filtering children in a composite component -

when writing composite component, there way insert subset of component's children? <cc:insertchildren/> inserts children - if wanted insert, say, children <myns:specialcompositesubtag .../> tags @ specific point , others @ other point? like: <composite:implementation> <h:outputlabel value="my special composite sub tags:" /> <composite:insertchildren condition="#{type == myns:specialcompositesubtag}" /> <h:outputlabel value="all other child tags:" /> <composite:insertchildren condition="#{type != myns:specialcompositesubtag}" /> </composite:implementation> is possible? if not, alternative solution?

visual studio code - how to refresh images in HTML Preview? -

i showing html preview containing image in vscode. if html content supposed change, call update method of textdocumentcontentprovider. result in html preview see updated text, image still old one, though changed image file in meantime. when closing preview , reopening new image displayed. how can force html preview reload images? update code: provider = new heapprovider(); //heapprovider extends textdocumentcontentprovider previewuri:string; method updatepreview(){ this.provider.update(this.previewuri) vscode.commands.executecommand('vscode.previewhtml', this.previewuri, vscode.viewcolumn.two).then((success) => { }, (reason) => { vscode.window.showerrormessage(reason); }); }

ruby on rails - print information to page using yml data file using Middleman / ERB -

given data file containing title, age, , description tag how go printing these out individually? i've tried using simple; <% data.folder.to.file.example.title %> and blank should be, no error. whereas using loop on list defined in same data file works fine; <% data.folder.to.file.example.list.each |l| %> <li> <%= f %> </li> <% end %> i guess put list, want know how better use these data files middleman setup. aim able create static pages via middleman's proxy generate pages end using data in yml files of same name. i'm halfway there think - taking looping example add [proxyname] after example , selects correct yml file. help , pointers appreciated! in example used <% data.folder.to.file.example.title %> evaluate expression not print out. instead using <%= print out expression output file e.g. <%= data.folder.to.file.example.title %>

c++ - Is there any way to avoid code replication across different constructors of a class? -

is there way avoid code replication across different constructors of class? class sample { int a, b; char *c; public: sample(int q) : a(0), b(0), c(new char [10 * q]) { } sample() : a(0), b(0), c(new char [10]) { } } it's called delegating constructor. in case this: sample(int q) : sample(q, 10 * q) { } sample() : sample(0, 10) { } sample(int q, int d) : a(q), b(q), c(new char [d]) { }

ios - parsing JSON with Swift -

i'm coming android programming swift ios programming , have hard time parsing json here's string try parse : {"response":[{"uid":111,"first_name":"somename","last_name":"somelastname","photo_100":"http:someurl/face.jpg"}]} here how try parse : if let dict = utils.convertstringtodictionary(response)! as? [string: anyobject]{ // part yet doing ok if let response = dict["response"] as? [string: anyobject]{ nslog("let response \(response)") if let first_name = response["first_name"] as? string { nslog("first_name = \(first_name)") } } else { nslog("not []") } the log message gives me "not []" can't make response object. far understand, i'm doing right [string: anyobject] in "response" body of json just in case,

javascript - Accessing properties from inside callback ES2015 -

this question has answer here: how access correct `this` inside callback? 6 answers i'm using classes in es2015 identical snippet below: class profilemanager{ constructor($http){ this._http = $http; this.profile = {}; } getuser(profile){ this._http(`/api/users/${user.id}`).then(function(response){ this.profile = response.data; /* * results in exception because "this uses function's * "this" instead of class' "this" */ }); } i know can remedy creating profile variable outside of class , using in class, wondering if there cleaner or more preferred way use class properties inside of nested function or callback. es6 arrow functions not override this class profilemanager { constructor($http) { this._http = $http; this.profile = {};

c# - Achieving realtime 1 millisecond accurate events without suffering from thread scheduling -

problem i creating windows 7 based c# wpf application using .net 4.5 , , 1 major features call functions interface custom hardware set of user defined cycle times. example user might choose 2 functions called every 10 or 20 milliseconds , every 500 milliseconds. the smallest cycle time user can choose 1 milliseconds. at first seemed timings accurate , functions called every 1 millisecond required. later noticed 1-2% of timings not accurate, functions called 5 milliseconds late, , others reach 100 milliseconds late. cycle times greater 1 msec, faced problem thread slept @ time should have called external function (a 20 msecs function called 50 msecs late because thread sleeping , didnt call function) after analysis concluded these delays sporadic, no noticeable pattern, , main possible reason behind these delays os scheduling , thread context switching, in other words our thread wasn't awake time need be. as windows 7 not rtos, need find if can work around problem som

python - Define range for index for lists in for loops -

i'm complete beginner in python . coding "minimum difference between array elements" problem. idea sort array , find difference between adjacent elements, find 1 minimum difference. however, wonder how define range index of list in loops index doesn't exceed size-2 . import sys a=[34,56,78,32,97,123] a,size=sorted(a),len(a) min=sys.maxint i,x in enumerate(a): # need range index 0 size-2 if(abs(a[i]-a[i+1])<min): min=abs(a[i]-a[i+1]) print min if want use manual indexing, dont use enumerate() , create range() (or xrange() if python 2.x) of right size, ie: for in xrange(len(a) - 2): # code here now don't have manually take care of indexes @ - if want iterate on (a[x], a[x+1]) pairs need zip() : for x, y in zip(a, a[1:]): if abs(x - y) < min: min = abs(x - y) zip(seq1, seq2) build list of (seq1[i], seq2[i]) tuples (stopping when smallest sequence or iterator exhausted). using a[1:] second sequence

python - Escape string within % -

this question has answer here: how escape % python mysql query 1 answer i use pymysql query mysql database in python: filter = "pe" connection = pymysql.connect(host="x", user="x", password="x", db="x", port=3306, cursorclass=pymysql.cursors.sscursor) cursor = connection.cursor() sqlquery = "select * usertable name '%%s%'" cursor.execute(sql, (filter)) response = cursor.fetchall() connection.close() this returns nothing. write: sqlquery = "select * usertable name '%" + filter +"%'" and execute: cursor.execute(sql) , lose escaping, makes program vulnerable injection attacks, right? is there way insert value without losing escape? ...where name '%%%s%%'" not work. think %s adds ' on both sides of replaced escaped string part of function within p

android - How update UI (ListView) when DB data recieved or button pressed -

i have listview represents order list , , listadapter sets recieved data db listview, , want dynamically do: paint white if item not selected or started paint green if item selected (but not started) paint orange if item selected started (button pressed) delete item if finish button pressed *(with paint mean setbackground color of item) **(order have atribute "state" know if started or not) currently i'm doing when buttons pressed, , want update ui , repaint items when orders received , if 1 order started paint it some code of ordersactivity: private void updateorders() { if (!listitemisselected) { orderadapter.clear(); orderadapter.notifydatasetchanged(); populatelistview(); } else { debuglog("item selected, list not updated"); } } private void populatelistview() { try { // read items server log.d("lso", "reading

Solving simultaneous equations in python -

i have following test program. query 2 folded: (1) how solution giving 0 , (2) appropriate use x2= np.where(x > y, 1, x) kind of conditions on variables ? there constrained optimization routines in scipy ? a = 13.235 b = 70.678 def system(x, a,b): x=x[0] y=x[1] x2= np.where(x > y, 1, x) f=np.zeros(3) f[0] = 2*x2 - y - f[1] = 3*x2 + 2*y- b return (x) func= lambda x: system(x, a, b) guess=[5,5] sol = optimize.root(func,guess) print(sol) edit: (2a) here x2= np.where(x > y, 1, x) condition, 2 equations becomes 1 equation. (2b) in variation requirement is: x2= np.where(x > y, x^2, x^3) . let me comments on these 2 well. ! first up, system function identity, since return x instead of return f . return should same shape x had better have f = np.array([2*x2 - y - a, 3*x2 + 2*y- b]) next function, written has discontinuity x=y, , causing there be problem initial guess of (5,5). setting initial guess (5,6) allows t

asp.net - amCharts with Angularjs showing undefined object in the value field of the chart -

i new both angularjs , amcharts. trying sending data in json controller (asp.net core). data sent angularjs controller suppose create basic chart using amcharts. in category field of chart getting "undefined" written instead of names of countries. code seems running fine cannot find error. following code. the following class , controller sending data written in asp.net core. public class tempcountry { public string country { get; set; } public int visits { get; set; } } [httpget] public iactionresult charts_json() { list<tempcountry> tempcountry = new list<chartcontroller.tempcountry>(); tempcountry tobj = new tempcountry(); tobj.country = "pakistan"; tobj.visits = 500; tempcountry.add(tobj); tobj = new tempcountry(); tobj.country = "japan"; tobj.visits = 1000; tempcountry.add(tobj); tobj = new tempcountry();

ssh - Cannot resize boot disk in Google compute engine -

i newbie google cloud engine , facing issue when trying ssh instance. “could not update /home/name/.ssh/authorized_keys due disk full” the disk has important files , cannot risk losing them. tried increase disk size 10g 250g still have issue. have not done disk repartitioning because os image, ubuntu, supports automatic resizing. i have not restarted instance yet because when press stop, receive message: "stop shuts down instance. if shutdown doesn't complete within 2 minutes, instance forced halt. can lead file-system corruption. ". not sure if normal message? finally, noticed there option called “reset”. restart instance? afraid erase on disk. p.s. there answers full disk problem not relevant anymore since google announcement .

How to pass line item names without saving in inventory in quickbooks API PHP -

i using quickbooks v3 following package. https://github.com/consolibyte/quickbooks-php is possible add line item invoice without creating in inventory/non-inventory? is possible add line item invoice without creating in inventory/non-inventory? no. quickbooks requires associate each line item on invoice item/service/product.

sql - Cannot update the view or function 'cte' because it contains aggregates, or a DISTINCT or GROUP BY clause, or PIVOT or UNPIVOT operator -

i want delete using having . so try execute following statement : ;with cte ( select emp_num, [from_date],[to_date],[ req_ser], [ req_year] empmission group emp_num, [from_date],[to_date],[ req_ser], [ req_year] having count(*) >2 ) delete cte but following exception : cannot update view or function 'cte' because contains aggregates, or distinct or group clause, or pivot or unpivot operator. use window functions: with todelete ( select em.*, row_number() on (partition emp_num, [from_date],[to_date],[ req_ser], [ req_year] order (select null)) cnt empmission em ) delete todelete cnt > 2; note deletes all rows duplicate values. often, want keep 1 of values. if case, ask question.

html - when i am clicking on left accordion its creating space in the right accordion -

i m trying following code displaying accordion. when clicking on left accordion creating space in right side not want. please me in way when click on left accordion should not affect on right side below contain should not affect. <html> <head> <script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script> <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.0/themes/base/jquery-ui.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> </head> <body> <div class="container"> <div class="row"> <div class="col-md-6"> <div class="ac

How to index a recursion loops in java -

my code has recursive method ( generating_circles ) generates 3 circles randomly ( c1 , c2 , c3 ), each circle represented 3 parameters p1 , p2 , p3 , circles tested 1 one according specific condition, let me say, if circle c1 didn't satisfy condition test, method ( generating_circles ) called again generate new 3 circles ( c4 , c5 , c5 ) inside circle c1 , , same procedure carried on new 3 circles , on more circles generated recursively until condition satisfied, moving work second original circle c2 , on. my problem can't retrieve proper indexes of nested circles , parameters related each circle. so thankful if gives me idea of how index circles , parameters future work.

ruby on rails - Replication(master/slave) in Rails5 -

i trying upgrade rails 5 rails 4. i use octopus gem make master-slave db in rails 4. i guess octopus may not upgrade in rails5 & ruby 2.3.1. so, find other master-slave gems. don't find. how can make master-slave db in rails 5?

node.js - How to test (by jasmine) that a collection exist in my mongo db? -

i'm trying write spec test collections, have, in db. i'm using jasmine test , working on mean stack. eg: let says have staff, client, commission, ... et cetera. , wanted test collection exists. thanks time , suggestion (in advance). create test using mongoose example ( https://github.com/klokoy/jasmine-node-mongo-test/blob/master/spec/test.spec.js ) , check if collection not contain document ( do if nothing found .find() mongoose ). i don't know if test relevant, can it.

python - Conversion from U3 dtype to ascii -

i reading data .mat file. data in form on numpy array. [array([u'abt'], dtype='<u3')] this 1 element of array. want value 'abt' array. unicode normalize , encode ascii functions not work. encode string method, can't work directly on array of strings. there several ways of applying each string here i'm working py3, default unicode. in [179]: a=np.array(['one','two']) in [180]: out[180]: array(['one', 'two'], dtype='<u3') plain iteration: in [181]: np.array([s.encode() s in a]) out[181]: array([b'one', b'two'], dtype='|s3') np.char has functions apply string methods each element of array: in [182]: np.char.encode(a) out[182]: array([b'one', b'two'], dtype='|s3') but looks 1 of conversions astype can handle: in [183]: a.astype('<s3') out[183]: array([b'one', b'two'], dt

SWI Prolog Java interface Unsatisfied Link Error -

i attempting run swi prolog java , set environment variables instructed, double checked make sure using 64-bit version 64-bit machine , installed jar file in correct place. however, still getting following error: exception in thread "main" java.lang.unsatisfiedlinkerror: jpl.fli.prolog.thread_self()i @ jpl.fli.prolog.thread_self(native method) @ jpl.query.open(query.java:286) @ jpl.util.texttoterm(util.java:162) @ jpl.query.<init>(query.java:198) @ prologtest.prologtest.main(prologtest.java:20) java result: 1 can me figure out missing here?

ios - How To Get Image With Correct Direction From Asset -

how rotate image correction direction i have placed below code , not working uiimage *images = [uiimage imagewithcgimage:[rep fullscreenimage] scale:[rep scale] orientation:0]; uiimageorientation specifies possible orientations of image: typedef enum { uiimageorientationup, uiimageorientationdown , // 180 deg rotation uiimageorientationleft , // 90 deg cw uiimageorientationright , // 90 deg ccw uiimageorientationupmirrored , // above image mirrored along // other axis. horizontal flip uiimageorientationdownmirrored , // horizontal flip uiimageorientationleftmirrored , // vertical flip uiimageorientationrightmirrored , // vertical flip } uiimageorientation; in code passing 0 , means uiimageorientationup enum value, looks default image of course. need specify parameter kind of orientation want. e.g. following code vertical image flip: uiimage *images = [uiimage imagewithcgimage:[rep fullscreenimage] scale

.net core - buildOptions in project.json: how to calculate the files to compile, embed or copy -

for buildoptions in project.json, there similar configurations set files compiled, embedded assembly resource files , copied output directory. { include:"..", includefiles: "...", exclude: "...", excludefiles: "...", builtints:{ include: "...", exclude: "..." } } i know priority order first 4 is: excludefiles >includefiles>exclude>include. but have higher priority comparing 2 builtins? or algorithm used calculate final files?

if statement - Python - Parameter checking with Exception Raising -

i attempting write exception raising code blocks python code in order ensure parameters passed function meet appropriate conditions (i.e. making parameters mandatory, type-checking parameters, establishing boundary values parameters, etc...). understand satisfactorily how manually raise exceptions handling them . from numbers import number def foo(self, param1 = none, param2 = 0.0, param3 = 1.0): if (param1 == none): raise valueerror('this parameter mandatory') elif (not isinstance(param2, number)): raise valueerror('this parameter must valid numerical value') elif (param3 <= 0.0): raise valueerror('this parameter must positive number') ... this acceptable (tried , true) way of parameter checking in python, have wonder: since python not have way of writing switch-cases besides if-then-else statements, there more efficient or proper way perform task? or implementing long stretches of if-then-else statements option?

python - How to mock object attributes and complex fields and methods? -

i have following function needs unit tested. def read_all_fields(all_fields_sheet): entries = [] row_index in xrange(2, all_fields_sheet.nrows): d = {'size' : all_fields_sheet.cell(row_index,0).value,\ 'type' : all_fields_sheet.cell(row_index,1).value,\ 'hotslide' : all_fields_sheet.cell(row_index,3).value} entries.append((all_fields_sheet.cell(row_index,2).value,d)) return entries now, all_fields_sheet sheet returned xlrd module(used read excel file). so, need mock following attributes nrows cell how should go abput it? just mock calls , attributes directly on mock object; adjust cover test needs: mock_sheet = magicmock() mock_sheet.nrows = 3 # loop once cells = [ magicmock(value=42), # row_index, 0 magicmock(value='foo'), # row_index, 1 magicmock(value='bar'), # row_index, 3 magicmock(value='spam'), # row_index, 2 ] mock_sheet.cell.side

jquery - Multiple variables using same value for different IDs -

i'm using window location , div id of includecmscontent1, includecmscontent2, includecmscontent3 on single page application. when conditions met external content injected @ id. however, i'm finding 1 of 3 variables firing, first 1 actually, because if includecmscontent3 present on page, id won't fire because includecmscontent1 taking precedence. how can solve this? page same, value same, id of includecmscontent1/2/3 swap on same page. var tceapplicationnowaiver = "tceapplication.aspx" var tceapplicationwaiver = "tceapplication.aspx" var tceapplicationnoteligible = "tceapplication.aspx" if (window.location.href.tolowercase().indexof(tceapplicationnowaiver.tolowercase()) >= 0) { $("#includecmscontent1").load("http://www.example.com/tce-application-nowaiver.htm #externalcontent"); } else if (window.location.href.tolowercase().indexof(tceapplicationwaiver.tolowercase()) >= 0) { $(&quo

github show commits on a specific date -

i can show/search list of commits on specific branch on github this https://github.com/username/repository/commits/branch_name i can filter author name like https://github.com/username/repository/commits/branch_name?author=author_name but looking way can search commits on specific date or date range. tried find existing answer not find. tried queries before=2016-07-27 or after=2016-07-27 did not work. appreciated. in advance when click on network (the number next fork) can @ least browse date. for easier navigation use cursor keys (shift left first commit). click on bullet go commit.

Comparing user input to a randomly selected list item - Python -

i creating rock, paper, scissors game class. part of game need have weapon menu display screen user select from. computer randomly select weapon list. problem facing (i believe) list items range [0,2] menu items list [1,3]. have searched around hours, don't understand complex things have been reading online i'm not how apply them. # random integer random import randint # list weapon weapon = ["rock", "paper", "scissors"] # 1 player mode def oneplayer(): scorep = 0 scorec = 0 again = "" player = false print("---------------------------------------------") print("\n\tplayer vs computer") while player == false: print("weapons:") print("1. rock") print("2. paper") print("3. scissors") print("4. quit") player = input("\nselect weapon: ") if player == "quit" or player == "q" or player == "4":

Javascript to print with wifi printer -

i´m making simple webapp, want when open in mobile phones print data using user´s wifi printer of cases epson l355. can give me clue or sample achieve this? thank all. you won't able because don't have access user's printer. instead, can generate pdf , redirect user on it. the user able download / print pdf via inline pdf viewer. you can following : how force files open in browser instead of download (pdf)?

javascript - Rails Stripe Gem - page needs to be refreshed before payment will process -

i'm building events site using rails. i'm using stripe gem process payments. seems working fine other whenever want make payment (in test/development mode @ present) have refresh page , re-enter payment details before payment process. there's no error code coming happens every time. what causing this? here's relevant code - bookings_controller.rb class bookingscontroller < applicationcontroller before_action :authenticate_user! def new # booking form # need find event we're making booking on @event = event.find(params[:event_id]) # , because event "has_many :bookings" @booking = @event.bookings.new # person booking event? @booking.user = current_user #@booking.quantity = @booking.quantity #@total_amount = @booking_quantity.to_f * @event_price.to_f end def create # process booking @event = event.find(params[:event_id]) @booking = @event.bookings.new(booking_params) @booking.user = current_