Posts

Showing posts from June, 2014

javascript - Add right-click menu to tabs -

Image
i know chrome api extensions can create right-click menu items when right-clicked on page . there way add right-click menus when user right-clicks on top of tab ? i'm thinking of making extension allows copy tab url when tab not in focus. thanks it useful, extensions limited can modify in chrome's ui, besides context menu , page\browser actions, cannot access non-client areas.

Some Browsers do not load CSS and Layout of Components[Joomla] -

the problem have responsive site, based on joomla framework. works fine on browser , custom components load have noticed has problem on mobile browsers (as: asus device, browser integrated on facebook app , more) load css of page, linked mijoshop component. in fact component work fine , loads css in mobile browser other show text , blank page. for , better understanding have attached video demo: video link1 video link2 how can fix? thanks!!! , first support :) the first idea came mind viewport in browser doesn't load(or load doesn't show, check in devtools responsive mode) css file differs bottom value of pixels in media query. mean design without base.css file, css rules work example 320px , browsers have viewport value less 320 px, nothing displayed.

Javascript synchronous functions - chrome extension -

this question has answer here: how return response asynchronous call? 24 answers i have lot of problems in code because not synchronous. here example of problem have in chrome extension. function function gettranslation(a_data, callback) { var apikey = '####' var json_object = {}; var url = '###'; var xmlhttp; var json_parsed = {}; storage.get('data', function(items) { json_object = { 'text': a_data, 'from' : items.data.from, 'to' : items.data.to }; var json_data = json.stringify(json_object); if (window.xmlhttprequest) { xmlhttp=new xmlhttprequest(); } else { xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.ope...

sas - Optmodel create data with 2 key-columns Optmodel -

i have vector x 3 sets [origin, destination, product] has value, , want create table has key columns origin , destination , every product column saying how transport. so like: origin dest. producta productb... a.........ab.......10......0 a.........ac.......5.......4 i'm trying this, in optmodel: create data ctrl3.transport [origin destination] = {fab, cities} {k in product} <col('product_'||k) = x[origin, destination, k]>; run; but sas doesn't seem it tldr; the fix use {fi in fab, ci in cities} instead of {fab,cities} . use fi , ci instead of origin , destination . comments in code below explain further. more details after code. code example proc optmodel; set fab init /rdu/; set cities init /bcn mel/; set product init /planes trains automobiles/; num x{fab,cities,product} init [ /* bcn */ 3 4 5 /* mel */ 6 7 8]; put x[*]=; /* verify declarations */...

ruby - Installing Rails on Mac OS X El Capitan v10.11.1 -

error: while executing gem ... (gem::remotefetcher::fetcherror) errno::econnreset: connection reset peer - ssl_connect ( https://api.rubygems.org/quick/marshal.4.8/loofah-2.0.3.gemspec.rz ) ^keep getting above. note i'm in china , have tried both with/without vpn. have gone https://ruby.taobao.org/ not know how install this. it great firewall causes this. (see, e.g., this issue .) @ https://ruby.taobao.org/index_en.html information in english on how use ruby.taobao.org.

html - Zero indent for list items -

my code structured this: <article style="font-size:16px;text-indent:40px;line-height:1.5em;"> <ul> <li><a title="egypt" href="#egypt" style="text-indent:0px;padding-left: -25cm;">egypt</a></li> </ul> </article> and yes, terrible css has lie upon html , let's not worry now . this make egypt text-indent property of <article> . however, not happen. egypt, list item, have 0 text indentation! how it? check js-fiddle . move text-indent: 0px li instead of a in below snippet. the text-indent property applies block containers . li block container whereas a not , hence setting on a has no effect. also, property inherited property , reason why li gets 40px value article . you'd notice if inspect li , have @ "computed" styles section. <article style="font-size:16px;text-indent:40px;line-height:1.5em;"> <p> goal...

r - Selecting the pairs of numbers in a vector which difference is equal to a predetermined value -

i have vector of numbers select pairs 2 units apart. if have vector p defined follows: p<-c(2,3,5,7,11,13,17,19,23,29,31,37,41,43,47) i select following pairs: 3,5; 5,7; 11,13; 17,19; 29,31; 41,43 i tried unsuccessfully select @ least these numbers in vector j<-null for(i in seq(p)) if (p[i+1]-p[i]==2) j<-c(j,i,i+1) but not give desired output. help. there better way this, here idea expand.grid , df <- expand.grid(p, p) unname(apply(df[df[,1]-df[,2] == -2,], 1,paste, collapse = ',')) #[1] "3,5" "5,7" "11,13" "17,19" "29,31" "41,43" if want data frame simply, df[df[,1]-df[,2] == 2,] # var1 var2 #18 5 3 #34 7 5 #66 13 11 #98 19 17 #146 31 29 #194 43 41

java - No suitable driver found on connect to Amazon MySQL Database -

i'm trying connect amazon rds mysql db hibernate using following properties: <prop key="hibernate.connection.driver_class">com.mysql.jdbc.driver</prop> <prop key="hibernate.dialect">org.hibernate.spatial.dialect.mysql.mysqlspatialdialect</prop> <prop key="hibernate.show_sql">false</prop> <prop key="hibernate.generateddl">true</prop> <!-- aws rds mysql instance --> <prop key="hibernate.connection.url">jdbc:mysql:mysqlinstance.cdlzan3wpebb.eu-central-1.rds.amazonaws.com/database:3306/database?usessl=false</prop> <prop key="hibernate.connection.username">{user}</prop> <prop key="hibernate.connection.password">{password}</prop> unfortunately leading no suitable driver found sqlexception. see following stack trace more information: org.springframework.beans.factory.beancreationexception...

c - thread synchronization for two threads using one semaphore -

i want synchronize threads print 1 20 odd numbers printed thread1 , numbers printed thread2 i achieved 2 semaphores. questions: 1) can achieved using 1 semaphore ? 2) there efficient way achieve ? if possible please provide example too. sem_t bin_sem1, bin_sem2; int count = 1; int main() { int ret; pthread_t a_thread, b_thread; ret = sem_init(&bin_sem1, 0, 1); if (ret != 0) { perror("semaphore1 initialization failed\n"); exit(exit_failure); } ret = sem_init(&bin_sem2, 0, 0); if (ret != 0) { perror("semaphore2 initialization failed\n"); exit(exit_failure); } ret = pthread_create(&a_thread, null, thread_fun1, null); if (ret != 0) { perror("thread1 creation failed"); exit(exit_failure); } ret = pthread_create(&b_thread, null, thread_fun2, null); if (ret != 0) { perror("thread2 creation failed...

performance - IS MySQL logical operator XOR equivalent OR with negation -

is there difference in results , performance between queries ? select a.id table (c1 = 'value' xor c2 = 'value'); select a.id table (c1 != 'value' or c2 !='value'); xor not equivalent or negation. xor equivalent following logic: where ((c1 = 'value' , c2 = 'value') or (c1 <> 'value' , c2 <> 'value') ) interestingly, second expression same as: where not (c1 = 'value' , c2 = 'value') i think should review boolean logic , truth tables.

java - Error: more than one library with package name 'com.google.maps.android' -

i added library in project encounter error : error:execution failed task ':app:processdebugresources'. > error: more 1 library package name 'com.google.maps.android' can temporarily disable error android.enforceuniquepackagename=false however, temporary , enforced in 1.0 how avoid error? tried solution found on internet : add android.enforceuniquepackagename=false eclude group {com.google.maps.android} but no success. here app build.gradle : apply plugin: 'com.android.application' android { compilesdkversion 23 buildtoolsversion "23.0.0" defaultconfig { applicationid "me.eazypark.eazypark" minsdkversion 15 targetsdkversion 23 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile project(':library...

ios - UIButton border on right and left sides -

Image
i've been having trouble getting border or shadow between 3 buttons show separation. have tried getting border or shadow on left , right side of middle button shadow on 1 side. appreciated. what have tried user shadow shows on right side: middlebutton.layer.backgroundcolor = uicolor.whitecolor().cgcolor middlebutton.layer.bordercolor = uicolor(red: 208/255, green: 208/255, blue: 208/255, alpha: 1.0).cgcolor middlebutton.layer.borderwidth = 0.0 middlebutton.layer.maskstobounds = false middlebutton.layer.shadowcolor = uicolor(red: 208/255, green: 208/255, blue: 208/255, alpha: 1.0).cgcolor middlebutton.layer.shadowoffset = cgsizemake(0.5, 1.0) middlebutton.layer.shadowopacity = 1.0 middlebutton.layer.shadowradius = 1.0 below current view 3 buttons trying add separator between: the hierarchy have in table cell: swift 3 answer you can make extension uibutton extension uibutton { func addrightborder(bordercolor: uicolor, bo...

javascript - How to get a value from controller.js file to html file in angularjs -

i have stored value in scope on controller.js.how scope value in html file. controller.js myappcont.controller('listvalue',['$scope','$rootscope','$http', function($scope,$rootscope,$http){ city=$scope.val; }]); html <div class="col-md-10" ng-controller="listvalue"> <table class="table table-bordered table-style" id="statustable"> <thead> <tr> <th>values</th> </tr> </thead> <tbody class="align-center"> <tr> <td>{{city}}</td> </tr> </tbody> </table> </div> you need have $scope variable inside controller, other way myappcont.controller('listvalue',['$scope','$rootscope','$http', function($scope,$rootscope,$http){ $scope.city=val; }]); then evaluated , shown in view <td>{{city}}</td> w...

java - Connecting an android app to my local server -

i new in android , got tutorial on how use , sqllite. the problem: i have mysql server on local pc , using android studio develop android application. application have listing of pharmacies in database, , pharmacies in server database. how can connect mysql android local pc , pharmacies' details database? i created java class pharmacies in application , http request function list database , return json object, couldn't connect local database. should put connection string ip of pc? can provide tutorial me? couldn't find replica of problem on internet. try this!!! localhost/yournamefile/..... or see tutorial http://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/ hope. !!!!

xquery help to query products and users from a different element node -

please me understand how write kind of query xquery. have .xml: <auctions xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <products> <product id="1"> <name>name1</name> </product> <product id="2"> <name>name2</name> </product> <product id="3"> <name>name3</name> </product> <product id="4"> <name>name4</name> </product> </products> <users> <user username="kukuk1"> </user> <user username="kukuk2"> </user> <user username="kukuk3"> </user> </users> <bids> <product id="1"> <bid user="kukuk1">400</bid> <bid user="kukuk2">410</bid> <bid user="kukuk1">450</bid> </product> <product id="...

Rails view passes wrong parameters in delete link -

Image
below server log. i passing user_id , id delete link view. when it's passed, value of user_id 15067 , id 1010 while check params putting pry method, value of id replaced user_id i.e. 15067. here whole workflow: routes delete "users/delete_role_sub_field" => "users#delete_role_sub_field" controller: def delete_role_sub_field // code destroy end view: <% @user.roles.each_with_index |role, i| %> <tr> <td> <a class="delete remove-description-field" href="/users/delete_role_sub_field?user_id=<%= @user.id %>&id=<%= role.id %>" data-method="delete" method="delete" data-confirm="are sure want delete role field?"> delete </a> </td> </tr> <% end %> any appriciated! thanks in advance. can post link_to function? u passing params, because application works fine, if...

mongodb - Using $set to nest value in Meteor using dot notation doesn't work -

i'm having trouble setting nested value in meteor collection. have: programs.update({ _id: progs[i]._id }, { $set: { "year.roommwk1": room }}); my console giving error: "minimongoerror: cannot use part 'roommwk1' traverse c16" c16 value of current year field. want nest value of roomwk1, '21a', under year field value 'c16'. not sure i'm going wrong. edit: current structure of documents is: { "_id" : objectid("56ce676c082e64f956411a3c"), "recordid" : 8514, "fullname" : "aidan anderson", "year" : "c16", "campyear" : "ssipc16", "week1" : "1", "week2" : "2", "week3" : "0", "week4" : "0", "week5" : "0", "week6" : "", "notes" : "", "roomaterequest" : "per, ...

jquery - Change opacity of button/s over mouse hover -

i have 4 button s. trying lighten opacity upon hover . problem: every time hover , 4 button s change opacity lighten , 1 button @ time change opacity upon hover . here's i've tried: $(document).ready(function() { $('button').mouseenter(function() { $('button').fadeto('fast', 1); }); $('button').mouseleave(function() { $('button').fadeto('fast', 0.5); }); }); not working need solutions smart peoples! you can use $(this) $(document).ready(function() { $('button').mouseenter(function() { $(this).fadeto('fast', 1); }); $('button').mouseleave(function() { $(this).fadeto('fast', 0.5); }); }); button { background: red } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <button id="button1">button1</button> <bu...

javascript - isConnected failed: ECONNREFUSED (Connection refused) -

i try transfer data between phones via wifi-direct , code works fine everyfirst time run through it. however, after close sockets in both client , server , try connect socket again, gives me exception. also, after lock screen of server phone , unlock it, can built connection once again. can familar socket give me advice? shouldn't wrong ip address/port right? code client phone protected void onhandleintent(intent intent) { context context = getapplicationcontext(); if (intent.getaction().equals(action_send_file)) { if(!socket.isconnected()) { string host = intent.getextras().getstring( extras_group_owner_address); int port = intent.getextras().getint(extras_group_owner_port); try { socket.bind(null); inetsocketaddress myaddress = new inetsocketaddress(host, port); socket.connect(myaddress...

spring - org.springframework.dao.DuplicateKeyException during delete -

i using spring = 3.2.3.release , hibernate-annotations = 3.5.6-final i have bean : @entity public class step implements serializable, comparable<step> { private static final long serialversionuid = -5345848109844492261l; @id @generatedvalue private integer id; @column private string description; @column(nullable = false) private boolean active; @column(nullable = false) private int steporder; @column(nullable = false) private string command; @manytoone @joincolumn(name = "elementid") private element element; @column private string arg1; @column private string arg2; @manytoone @joincolumn(name = "testcaseid", nullable = false) private testcase testcase; @manytoone @joincolumn(name = "releaseid", nullable = false) private releaseentity releaseentity; @manytoone @joincolumn(name = "updatedby", nullable = false) private user updatedby; @temporal(temporaltype.timestamp) @column(columndefinition = "timestamp", inser...

html - Select different pictures in jquery/js -

i'm trying make simple photo viewer, , want know how select src of image, in order change big image (.big-t) this html+js code part far: $("#imagefound").click(function(e){ var bigthumb = $("#imagefound").attr("src"); alert(bigthumb); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="diaporama-thumbs" id="wabi3-slider"> <div class="thumb-preview"> <img id="big-thumb" class="big-t" src="big-image1.png" /> </div> <div class="small-thumbs"> <div class="thumbs-container"> <div class="small-pre"> <a id="findimage" href="#"><img id="imagefound" src="image1.png"/></a> </div> <div class...

winforms - Randomly Generate Numbers for Bubble Sort Algorithm without Duplicates in Windows Forms C#? -

i practicing bubble sort algorithm in windows forms. have gotten program point algorithm works, , can generate numbers in listbox 1-100 in non-numerical order, , run bubble sort algorithm sort numbers. problem i'm having don't want duplicate numbers generating in listbox. basically, have radio button produces 100 integers in listbox when clicked. have "sort" button sort through numbers in listbox. using arrays this, array easiest use when writing bubble sort algorithm , creating random numbers in listbox (that's why i'm not creating new list , attempting shuffle way). if has suggestions prevent duplicates, i'd appreciate it. here excerpt of code below. int[] array; int smallmaxsize = 101; #region sort button click private void button1_click(object sender, eventargs e)//bubblesort code { bubblesortalgorithm(smallmaxsize); } #endregion #region swap numbers private void swap(int one, int two)//swaps larger number ...

Custom SharePoint app shows nothing -

i created sharepoint app using visual studio 2015 , added custom list within it. when deploy application through sharepoint hosted, deployment seems successful without errors when open it, shows page contains: "page title" , "hello [username]" had experienced such problem.. to see custom list have make url http://'server url'/'app name'/lists/'list name' or in app.js can add below mention code var x = "'a href=" + _sppagecontextinfo.webabsoluteurl + "/lists/' list" + ""; $('#message').text('hello ' + user.get_title()); $('#message').append(x); please replace single quotes brackets , actual value server url, app name, list name.

php - ZF2 Routing with Special Characters -

i have little question regarding routing zend framework 2. urls "normal" letters working fine , sides, example url characters á or whitespaces /test/some characters /test/héllo won't work , 404-error. when remove whitespaces in url or replace special character é normal "e" url too. so think problem in module.config.php constraints. how can define these special characters reach urls? hope can me! module.config.php url segment 'chemistry' => array( 'type' => 'segment', 'options' => array( 'route' => '[/:id[/:name]]/chemistry/page[/:page]', 'constraints' => array( 'id' => '[0-9]*', 'name' => '[a-za-z][a-za-z-]*', 'page' => '[0-9]*' ), 'defaults' => array( 'action'=> 'chemistry', 'id' ...

python - NameError: name 'addTimeInterval' not defined -

i'm trying run code on hull-white 1 factor model , @ point in time: today = datetime.date(2014,10,24) spot_rate = 0.02 fardate = today + addtimeinterval(10.0, 'y') i error message: nameerror traceback (most recent call last) <ipython-input-61-e46904f6da74> in <module>() 59 60 spot_rate = 0.02 ---> 61 fardate = today + addtimeinterval(10.0, 'y') 62 year_fraction = yearfractionfactory.create_istance(day_count_basis.basis_lin_act_365) 63 df = 1.0 / ((1.0 + spot_rate / 365.0) **(year_fraction(today, fardate) * 365.0)) nameerror: name 'addtimeinterval' not defined i dont'know how fix :( answer or hint appreciate. thank all, really.. stef edit: think found problem. i'm using , modifying code our professor provided (we attended workshop in used code , told use if need it). think imported module called calendar.pyc ha...

HTML Form Values PHP and Spaces -

i working on various projects organization started developer. portion of work involves form processing php. i rather surprised see many of form values, previous developer used spaces (for example <input type="radio" value="do not enroll" name="proceed" /> ) . think know why did - sends email , makes easy display values in human readable format without additional processing, but, used 'typical' programming naming conventions (no spaces, camel case, pascal case, , on), make me little uneasy. whenever have processed html forms , assigned values, believe tried following "typical" variable naming conventions, have habit rather necessary practice. now, not saying wrong, tried little research on topic , have not reached definite conclusion. question - there wrong including spaces in values assigned html form input elements - particularly when sent on email? if so, complications may result, , there way process them, or recommend ke...

java - Create link to a resource file in the browser -

good evening! i developing small rest server in spring. faced following problem: i need open resource folder , send link files of following form: http: // localhost: 8080 / myprojectname / resurses / 2.jpg but take type of link: file: / d: /apache-tomcat-7.0.69/webapps/root/web-inf/classes/2.jpg the dispatcher-servlet.xml file added:   <mvc: resources mapping = "/ resources / **" location = "/ resources /" /> in controller declared method: @requestmapping("/get_photo") public @responsebody requestuserinfofull get_photo(@requestbody string body, httpservletrequest request, httpservletresponse response) throws ioexception { requestuserinfofull result = new requestuserinfofull(); userfullinformation usf = new userfullinformation(); resource anotherresource =context.getresource("2.jpg"); usf.setphoto(anotherresource.geturl()); result.setprofile(usf); return result; please proble...

c# - Display Count (Inc. Disabled Displays) -

hello new stackoverflow.com. not sure how question asked here, doing best. done, quite research on subject, couldn't find single thing resolve detection. example case: trying identify count of active , disabled displays in windows 7-10 systems. code gpu[availability]: private int moncount; [dllimport("user32.dll")] private static extern bool enumdisplaydevices( string lpdevice, int idevnum, ref display_device lpdisplaydevice, int dwflags); [structlayout(layoutkind.sequential)] public struct display_device { public int cb; [marshalas(unmanagedtype.byvaltstr, sizeconst = 32)] public string devicename; [marshalas(unmanagedtype.byvaltstr, sizeconst = 128)] public string devicestring; public int stateflags; [marshalas(unmanagedtype.byvaltstr, sizeconst = 128)] public string deviceid; [marshalas(unmanagedtype.byvaltstr, sizeconst = 128)] public ...

c# - Translate query with operator 'IN' in Linq -

select * enfants enfants.id in ( select enfantparents.enfant_id enfantparents enfantparents.parent_id in ( select parents.id parents parents.id in ( select reservations.parentid reservations reservations.crecheid = 1 ) ) ) the enfantparents hidden table. i have enfants *-----* parents 1-----* reservations thank . the enfantparents hidden table from above assume using ef auto "link" table, enfant entity has parents navigation property , parent entity has reservations navigation property. then can achieve same result sql query linq query this: var query = db.enfants .where(e => e.parents.selectmany(p => p.reservations).any(r => r.crecheid == 1));

Adding a second Github Custom Domain -

i created repository username.github.io redirected username.io brought namecheap. got domain username.me, wondering how use github pages add content domain without having create github account. github pages supports one domain per user. way use 2 domains is set redirects through dns provider. you can contact dns provider , ask redirect options supported.

python - Saving an error exceptions to file erroring out -

i'm having issues simple bit of code not working correctly , i'm totally baffled why... errors = open('error(s).txt', 'w') try: execfile("aeaper.py") except exception e: errors.write(e) errors.close() i following error: traceback (most recent call last): file "c:\sator.py", line 45, in <module> periodically(2, -1, +1, callscripts) file "c:\sator.py", line 27, in periodically s.run() file "c:\python27\lib\sched.py", line 117, in run action(*argument) file "c:\sator.py", line 36, in callscripts errors.write(e) typeerror: expected character buffer object what wrong code , why doing that? unlike print statement, file.write function takes strings. so, need convert string explicitly: errors.write(str(e)) of course in real-life code, want formatting, forget this. example: errors.write('failed exec {} {}'.format(filename, e)) here, we're ...

c - typedef'd struct not found by header -

i'm sure foolish, i'm stumped: i have typedef'd struct declared in 1 header: firstheader.h typedef struct pin { uint8_t a; uint8_t b; } pinstruct; i want use typedef'd struct in function declaration in header: secondheader.h #include "firstheader.h" void foo (const pinstruct *mypin); despite typedef'd struct being defined in first header, , including first header in second header, compiler complains "identifier pinstruct undefined". please smack me , tell me i'm missing. edit: comments guys. compiler marking function declaration in second header source of error. exact error wrote: error[pe020]: identifier "pinstruct" undefined. what's strange if copy struct definition secondheader.h header file, compiler complians re-definition of struct. knows there. your code should work fine (tested both gcc , clang ). you defining structure within typedef , aliasing pinstruct -- no errors. yo...

java - Pig Latin translator -- finding consonant clusters. -

i'm making pig latin translator translates user's input pig latin. have figured out when word starts vowel , when doesn't putting first letter in middle. however, when comes consonant clusters (the group of characters before first vowel in word), can't figure out how lump them own variable. i'm using loop scan letter first variable, , trying clump strings it's own variable put middle of word. here's code have far: import java.util.scanner; public class mission4 { public static void main(string[] args) { scanner in = new scanner (system.in); system.out.println("please enter word convert piglatin:"); string userinput = in.nextline(); int firstv = 0; char firstch = character.tolowercase(userinput.charat(0)); { if (firstch == 'a' || firstch == 'e' || firstch == 'i' || firstch == 'o' || firstch == 'u') //if userinput starts vowel { ...

android - Firebase realtime database crashes on Amazon Kindle Fire devices -

i'm getting following error when trying access realtime database google firebase on amazon kindle fire device. caused by: java.lang.runtimeexception: com.google.android.gms.internal.zzqi$zza: no acceptable module found. local version 0 , remote version 0. i believe because google play services missing. mean firebase won't work on kindle fire devices? they both have "fire" in names, count nothing!? edit: i think may related proguard. getting error in log files. failed load module descriptor class: didn't find class "com.google.android.gms.dynamite.descriptors.com.google.android.gms.firebase_database.moduledescriptor" on path from firebase android setup documentation ( https://firebase.google.com/docs/android/setup#prerequisites ): prerequisites a device running android 2.3 (gingerbread) or newer, , google play services 9.0.1 or newer so firebase not work on kindle fire devices without google play services. ...

javascript - how to do data-bind for complex model knockout -

i newbee knockout, i'm trying move mvc viewmodel binding. i have complex model: searchstudentsmodel has 2 properties collection of students (subset of students) number of students overall note length of collection isn't equal number overall. i need implement search functionality student have regular properties plus isactive indicator. use ul , li tags data-bind details. the search screen should facilitate user in marking active flag indicator (on , off) , data should saved in database. all examples referred talk 1 level of model. have searchstudent model , within have collection of students. how should binding hierarchy of models? i have refactored jsfiddle. hoping can understand knockoutjs better. not whole page/knockout, think snippet problem can solved . the markup: <button id="searchemployees" type="button" data-bind="click: search">search</button> <li data-bind="foreach: employees...

javascript - getter setter Maximum call stack size exceeded Error -

i trying learn , set in javascript object tried function ab(n){this.name=n;}; var c= new ab("abcde"); console.log(c); object.defineproperty(c, 'name', { get: function() { return name; }, set: function(name) { this.name = name; } }); c.name="xyz"; console.log(c.name); here first making object using constructor , using , set. getting error "maximum call stack size exceeded". not getting reason of error . i think has been explained, this.name = name in setter calls again setter, wich leads infinite recursion. how aproach: function ab(_name){ object.defineproperty(this, "name", { //enumerable: true, //maybe? get: function(){ return _name }, set: function(value){ _name = value } }); } var c = new ab("abcde"); console.log(c, c.name); or prototypal-approach downside: private property _name public function ab(n){ this.name = n; } ...

java - AsyncTask in Android with return interface -

i'm using asynctask in android request server , recive data class. know asynctask don't return used code made other people return strings using interface. here have asynctask class code: public class webrequest extends asynctask<string, void, string> { //data public string mfilecontents = "false"; //api-info public webrequestresponse delegate = null; public webrequest(webrequestresponse asyncresponse) { delegate = asyncresponse;//assigning call interfacethrough constructor } @override protected string doinbackground(string... params) { mfilecontents = downloadfile(params[0]); if(mfilecontents == null) { log.d("downloaddata", "error downloading"); } return mfilecontents; } protected void oonpostexecute(string result) { super.onpostexecute(result); delegate.processfinish(mfilecontents); log.d("downloaddata", "result was: " + result); //result } private string downloadfil...

android - Login Error when using library googleplay-api -

i using googleplay-api module download sample android apps research project. in past, use library using gmail account name, password, , android id/google service framework (gsf). few days ago, got error below when ran same code. wondering if else using library gets same problem. in advance. traceback (most recent call last): file "search.py", line 36, in <module> api.login(config['google_login'], config['google_password'], config['auth_token']) file "/users/chihwu/desktop/test/googleplay-api/googleplay_api/googleplay.py", line 179, in login raise loginerror("server says: " + params["error"]) googleplay_api.googleplay.loginerror: u'server says: unknown_err' try login play.google site , open application. you, chance, have "you don't have devices" error message? instead of "this app compatible device".