Posts

Showing posts from September, 2013

javascript - how to add multiselect checkbox by clicking on button -

i want add multiselect checkbox clicking on button.i using bootstrap multiselect.if other bootstrap multiselect ok. functionalities not working mutiselct checkbox after clicking on button. $('#addsupplierbtn').click(function(){ $('#webhost').html($('#multiplesupplier').html()); }); <div id="multiplesupplier" > <select multiple="multiple" size="10" name="checked[]" id="chked" class='multiselect' > <option value="option1">option 1</option> <option value="option2">option 2</option> <option value="option3" selected="selected">option 3</option> <option value="option4">option 4</option> <option value="option5">option 5</option> <option value="option6" selected="selected">option 6</option> <...

why c++ does not accepts static keyword in function defnition? -

i have program class t has static function. static void t::func() { m_i=10; cout<<m_i<<endl; } when try add static in function definition, compiler throws error error: cannot declare member function ‘static void t::func()’ have static linkage. why not accepting static keyword in definition? the problem keyword static means different things depending on context. when declare member function static, in class t { ... static void func(); ... }; then static keyword means func class function, it's not bound specific object. when define function in source file, like static void t::func() { ... } then set function linkage different using static in declaration inside class. static when defining function function available in current translation unit , , contradicts declaration function available knows class. it's not possible make member function (declared static or not) have static linkage . if want "hide...

python - Concatenate required arguments and optional args in function? -

i want define function accepts , arbitrary number of dictionaries @ least 2 , want iterate on of them. i'm creating list of first 2 , append optional ones: def func(dict1, dict2, *dicts): dicts = [dict1, dict2] + list(dicts) d in dicts: # stuff but feel that's bit unnecessarily complicated. wondered if 1 alternative checking length of *dicts might better because don't need create new iterable: def func(*dicts): if len(dicts) < 2: raise valueerror('too few dictionaries, must give function @ least 2.') d in dicts: # stuff but still don't feel that's convenient since need explain somewhere because function signature looks accept arbitrary number of dicts (even 0 or 1). there way have signature of first option without having create complete new iterable in function? the first approach seems fine me, can simplify tiny bit using tuple instead of list first pair don't need list call: all_dicts...

java - "non-zero exit value 42" -

i having issue adding custom images app. when do,i gradle errors. searched on here , seen solution add: android: { usenewcruncher false } but didn't help. still getting "non-zero exit value 42 error". here gradle apply plugin: 'com.android.application' android { compilesdkversion 23 buildtoolsversion "23.0.2" aaptoptions { usenewcruncher false } defaultconfig { applicationid "net.androidbootcamp.techgadgets" minsdkversion 16 targetsdkversion 23 versioncode 1 versionname "1.0" multidexenabled true } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) testcompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.2.0' compile 'com.android.suppo...

Spring Swagger UI: what is difference between io.swagger, io.springfox, and com.mangofactory -

i working on integrating swagger ui spring boot mvc app , curious differences between these libraries. i looked @ each on mvnrepository.com , done different groups seem same thing. hoping clear idea of differences between these , if 1 recommended on others. notice swagger-core module io.swagger has usages. thanks! here an explanation of different libraries. springfox in sense v2 of swagger library used packaged mangofactory . happened transitioned using private repo creating github organization support development team. in short mangofactory evolved springfox supports 2.0 version of swagger spec (in addition 1.2). clear springfox , predecessor supports spring mvc. io.swagger mother ship if will. has great support spring , jax-rs. if you're looking support jax-rs based services using spring or otherwise that's great option.

c - Is it possible to treat a zip file as a documentRoot in apache? -

i trying modify apache source code in order let read files inside zip file instead of getting directly www folder. example: instead of having www/index.htm i want have zip file contains index.htm i've been working on days. possible or wasting time? you may indeed wasting time, doesn't mean it's not possible. apache doesn't have native capacity treat zipfile filesystem, there solutions can pursue. the simplest option use archivemount expose archive filesystem on host. let apache -- , else -- treat directory tree.

ruby on rails 4 - Kaminari : undefined method total_pages -

i have problem on kaminari rails 4. here renters_controller.rb def search @location = params[:search] @distance = params[:km] @renters = renter.near(@location, 30000).order("distance") @renters = @renters.page(params[:page]) if @renters.empty? @renters = renter.all search_map(@renters) else search_map(@renters) end end and view search.html.haml. .row = paginate @renters and error message started "/search?utf8=%e2%9c%93&search=" ::1 @ 2016-03-17 09:37:59 +0100 processing renterscontroller#search html parameters: {"utf8"=>"✓", "search"=>""} (0.5ms) select count(count_column) (select 1 count_column "renters" (false) limit 25 offset 0) subquery_for_count renter load (0.9ms) select "renters".* "renters" rendered renters/search.html.haml within layouts/application (8.2ms) completed 500 internal server error in 23ms (activerecord: 1.5ms) actionvi...

asp.net - The localhost page isn’t working. localhost redirected you too many times -

i got problem when debugging mvc program , want acces db called "useractivity". on browser, saying "the localhost page isn’t working localhost redirected many times." but without showing specific error location. here useractivtycontroller, /useractivity/index code: public class useractivitycontroller : basecontroller { //get /useractivity/index public actionresult index(string returnurl, int page = 1, string sort = "id", string sortdir = "asc", string filter = null) { string query = @" select id ,createdby ,createdon ,modifiedby ,modifiedon ,contactid ,entityname ,entityid ,activitytype ,activitystatus ,duedate ,actualenddate ,masqueradeon ,masqueradeby useractivity -- order createdon desc -- offset (@pagenumber -1) * 3...

java - Switching mobile network programmatically -

is there way switch between mobile networks (umts -> gsm,...) code? when possible without rooting device. thank you! you can not switch between 2g, 3g or 4g, there no api available in android telephony manager allows so. if there different wifi network available can switch between those. i hope, have answered question. thanks,

javascript - Embed AngularJS Page in Ember Application -

there 1 massive ember application running. want embed angularjs feature in ember context. onclick of button in emberjs, angularjs feature(html page) has open new tab in ember page or dialog box. tried see different ways how can embed angularjs page in ember. please let me know if there way angularjs page can embedded in ember. i think bad idea include js framework another. it's including php js spa framework (ember, angular...) or whatever else... if want use angularjs, should think migrating ember angular.

c# - Passing void as out parameter -

this question has answer here: is there way of not bothering out parameter in c#? 8 answers is there way ignore out parameter? i.e. bool myintisvalid = int.tryparse(stringvalue, void); or bool myintisvalid = int.tryparse(stringvalue, out new int()); no, have pass variable, you're free ignore afterwards.

c++ - Char and string types, what should I use? -

at work i'm using c# want learn c++ , chars/strings confusing. example, know tchar can either regular char or, if i'm using unicode, wchar_t . so, use tchar ? find questions is tchar still relevant? . ok, let's use else...? far i've used char , std::string , @ point have no idea if approach or not, i'm bit lost. what should use if i'm writing program not translated antother language? what should use if i'm writing program translated antother language? what should use if i'm writing program used in countries use latin characters, not have english native language (hello ä, ö, ü, ß, æ, Ø, ï ...)? there anthing can safely ignore because it's outdated? heavily opinionated based on experience answer before begin, let me state i've been working on c++ software 5 years, millions of users globally - in doing i've learned hell-of-a-lot how things work in real world . the first thing understand windows inherently uses it's ( o...

javascript - auto populate date-time from the selection of location in html field -

i have 2 html fields 1 location(country) drop down , other field date-time drop down. when user selects country location drop down want current date time auto populated respect country selected dropdown. how can done? html code: <html> <body> <form> <tr> <td> <label for="location">location :</label> </td> <td> <select name="location"> <option value="india">india</option> <option value="us">us</option> <option value="japan">japan</option> </select> </td> </tr> <tr> <td> <label for="date">date & time :</label> </td> <td> ...

java - Sorting 5 generated numbers from lowest to highest -

this question has answer here: int[] array (sort lowest highest) 10 answers i have project in school make simplified yatzy program , i've hit road bump. have generated 5 random dice throws , printed them out in 1 window, need sort them lowest highest , don't know how. i've looked in forums 1 don't understand, feel free ask questions if don't understand. btw i'm swedish text in "" lines in swedish if don't understand. code: import javax.swing.*; public class projekt1 { public static void main(string[] args) { joptionpane.showmessagedialog(null, "välkommen till johans yatzy"); joptionpane.showconfirmdialog(null, "vill du starta spelet?"); int[] tar = new int[5]; string output = ""; for(int i=0; i<5; i++){ tar[i] = (int)(math.random()*6+1); output = output + t...

java - How to implement google maps in a Fragment correctly? -

i have searched on stackoverflow , looked @ many solutions example, here here i have looked @ more none of them robust in terms of performance. here got far this 1 works once when fragment first created after returning map fragment gives me layout inflation exception @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view=inflater.inflate(r.layout.fragment_public_maps,null,false); googlemap= (supportmapfragment) getchildfragmentmanager().findfragmentbyid(r.id.pub_map); googlemap.getmapasync(this); return view; } i have tried 1 , works makes app slow , crashes @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { try { view=inflater.inflate(r.layout.fragment_public_maps,null,false); } catch (inflateexception e) { googlemap= (supportmapfragment) getchildfrag...

c# - MVC4 EF5 My Context won't show up when I'm creating a controller -

my context shows when entity framework 6.1.3 installed since scaffolding isn't supported in entity framework 6 had downgrade version 5.0.0. when try create new controller context isn't listed in drop down list in data context class: is sort of bug ? image here what's more surprising works on copied version of same solution. i fixed rebuilding solution, reinstalling entity framework 5.0.0 manually type in context data context list when adding controller.

java - Recursion wrong output -

i given following code int go(int x){ if (x<1) return 1; else return x + go(x-2) + go(x-3); } the answer 7 calling go(3) but everytime (i have hand) 8. logic: 3 + go(1) + go(0)/1 = 3 + go(1) + 1(because 0 less 1) then, 3 + go(-1) = 3 + 1 therefore, 3 + 4 + 1 = 8. what doing wrong? it sounds made mistake go(1) = 3 + go(1-2) actual formula go(1) = 1 + go(1-2) + go(1-3) . go(3) = 3 + go(1) + go(0) = 3 + go(1) + 1 = 3 + (1 + go(-1) + go(-2)) + 1 = 3 + (1 + 1 + 1) + 1 = 7

c++ - Cross-Compiling xnu for 5s -

whilst trying build cross toolchain i've come across error trying compile xnu ios: $ make sdkroot=iphoneos target_configs=armv7a xcrun: error: unable find utility "embedded_device_map", not developer tool or in path xcrun: error: unable find utility "embedded_device_map", not developer tool or in path /usr/local/src/xnu/makedefs/makeinc.kernel:14: *** unsupported current_arch_config . stop. make[1]: *** [build_setup_bootstrap_armv7a^^] error 2 make: *** [all] error 2 i cannot find information on tool @ all, let alone methods install or cross compile cortex-a9 (apple a5) thus, i'd ever grateful if provide hint of insight. on earth can find tool?

ajax - Facilitate downloading partial blob from azure with javascript -

i uploading azure storage collection of files, single "entity". have requirement provide collection option download each individual file separately, or bundled zip of files. i'd files served directly azure if possible. firstly, there few alternate undesirable options i've considered: upload of individual files azure separate blobs, plus upload separate zip file containing of them. undesirable, duplicate files in azure storage, minimal server load (only needs upload files twice, files served strictly azure) upload them separate file, , have them pass through external server bundle them, or vice versa. undesirable, uses server bandwidth , cpu cycles every time, potentially slower serving bundle depending on server load ideally, i'd upload them pre-packaged zip, include custom blob deflate header (to hint browser these files served compressed), , in metadata specify starting offset , compressed length of each file. if there way specify range header in pa...

sql server - SQL error Subquery returned more than 1 value -

i got following error when change planningdate period. because of 1 planningtime has more 1 "programmetitle, title". tried change join, can't expect result. please help msg 512, level 16, state 1, line 1 subquery returned more 1 value. not permitted when subquery follows =, !=, <, <= , >, >= or when subquery used expression. select pt.planningtime, (select (ltrim(rtrim(programmetitle+':'+title))) planning channelid = '34' , convert(char(8),planningdate,112) between '20130101' , '20130107' , pt.planningtime = planningtime , datepart(dw,planningdate)=1) title1, (select (ltrim(rtrim(programmetitle+':'+title))) planning channelid = '34' , convert(char(8),planningdate,112) between '20130101' , '20130107' , pt.planningtime = planningtime , datepart(dw,planningdate)=2) title2 plann...

Pass a Javascript Object to an HTML iframe (as an Object) -

i'm not sure of way this, have html page mainwindow , have iframe childwindow. i need mainwindow create javascript object childwindow can utilize. my mainwindow.html looks @ moment <html> <style> body { background-color:#333333; } </style> <body> <script> var varobject = {type:"error", message:"lots"}; console.log( "(main window) " + varobject.type + " : " + varobject.message ); </script> <iframe class="child" src="childwindow.html"></iframe> </body> </html> the childwindow.html looks this <html> <style> body { background-color:#666666; } </style> <body> <script> console.log( "(main window) " + varobject.type + " : " + varobject.message ); </script> </body> </html> the childwindow trying use object created in mainwindow of c...

xml - Reading text in python weird error [Solved] -

i'm opening file looking this: http://pastebin.com/uch5ayha and trying read using simple python: f1 = open("goldstandard-answer-utf-8.txt", "r") print f1.readline(); line in f1: print line f1.close() neither print line prints entire document. both readline , loop separately prints: </file> this weird. has tags in document both attempts @ parsing either lmxl etree or beautiful soup gave similar results. there way force python print lines , disregarding tags, if makes sense? edit: (suggested comments include) expected output same pastebin entry: 2028.htm.txt mäkitalo, Östen mäkitalo, Östen mäkitalo, jessica lindbäck, Östen mäkitalo, Östen mäkitalo, robert brännström etc... if file encoded in utf-8, name suggests, try opening such: import codecs f = codecs.open('goldstandard-answer-utf-8.txt', 'r', encoding='utf-8')

sql - Stored Procedure Update no Common Field Table -

i have 2 tables, table a has order no , order line , receiving no , receiving date , receiving qty . order order line receiving no receiving date receiving qty 1 455555 12/01/2013 10 1 455556 12/01/2013 15 1 455557 15/01/2013 7 1 455558 16/01/2013 10 1 455559 16/01/2013 10 1 455560 16/01/2013 15 1 455561 31/01/2013 7 table b has order no , order line , invoice no , invoice qty , invoice date . order order line invoice no invoice date invoice qty 1 333331 13/01/2013 32 1 333332 15/01/2013 10 1 333333 01/02/2013 32 how create stored procedure update invoice no , invoice qty , invoice date table b table a ? i'm new stored procedure, appreciated. desired output : order order line receiving no receiving date ...

java - how to avoid blank page at the end of pdf report in BIRT? -

i using current birt version 4.5. have 2 master pages in report. have huge data display on report have set data display on 1 master page , remaining on master page due reason. problem when there no data display on 1 of master page rendering blank page header , footer of master page want avoid. in pdf report how can avoid blank page? hi, pointing hide tables or other components requirement here is, need hide page itself. dont think there visibility option page. if there not useful. kindly understand dont want display page not components in it.so can expect now? i guess added tables directly on masterpage? that's not how works. birt render (master)page , maybe hide elements on them (for example table has no data. can setting visibility property). problem approach masterpage cannot 'unrenderred'. the proper way fix this, add each element on normal layout. in properties each table, grid, etc. can set pagebreak properties. here can select masterpage want use. ...

amazon web services - AWS Billing for Data transfer -

Image
we using aws , using s3 service only. need pay data transfer service ? how stop data transfer service ? thanks if expand each section see more detail. outbound data transfer amazon service incurs bandwidth cost. inbound data free in cases. pricing varies region. the way can stop data transfer cost not download data s3.

android - How do I make my app visible on PlayStore? -

i have app, called dreamtors physics, uploaded 5months now, not visible when full name not being searched. for example, won't show on playstore if search dream, dreamtor, physics. shows if 1 search dreamtors, physics, or dreamtors physics. please help. thanks in advance. if know seo is, might want know aso - app store optimization is. according wikipedia app store optimization (aso) process of improving visibility of mobile app (such iphone, ipad, android, blackberry or windows phone app) in app store (such itunes ios, google play android or blackberry world blackberry). search engine optimization (seo) websites, app store optimization (aso) mobile apps. specifically, app store optimization includes process of ranking highly in app store's search results , top charts rankings. aso marketers , mobile marketing companies agree ranking higher in search results , top charts rankings drive more downloads app. you may need use keywords app relates impr...

parse.com - iOS badge not incrementing when sending a push -

starting last thursday (03/03/2016), ios badge not updating when sending push using parse. badge stays @ "1" no matter how many pushes sent. once app opened, badge reset. when next push arrives count "1" again , stays there future pushes till app opened. we using correct format of badge: "increment" in data push notification. behavior same if sending "campaign" push parse dashboard. strange badge count incrementing correctly till wednesday last week (03/02/2016). did not make changes code whatsoever. it can't complete increment client self when did'nt stay active. need server change badge value.

angularjs - $Scope doesn't work on subpage -

this controller, .state('tabs.urunler',{ url:'/urunler', views:{ 'urunler-tab':{ templateurl:'pages/urunler.html', controller:'myctrl' } } }) .state('tabs.detail',{ url:'/urunler/:aid', views:{ 'urunler-tab' : { templateurl:'pages/urunlerdetail.html', controller : 'myctrl' } } }) this post method. $http({ url : apiaddress + 'geturunler', method : 'post', data : {type} }).then(function successcallback(response){ $scope.urunler = response.data; console.log($scope.urunler); },function errorcallback(response){ console.log("error"); }); this urundetails.html <ion-item ng-repeat="urun in urunler"> {{urun.title}} <div class...

php - Can't pick up a field created with Advanced Custom Fields -

i have situation where: i need create custom link per image on image gallery. did via acf . have created text field html outputing hyperlinks converted automatically. the user populating field link every time new post created. i using custom post type (post-portfolio). each post has cover image thumbnail when looking @ gallery. those links later on displayed link on thumbnail of image - not on image's lightbox or single-post page. the gallery's default behavior have 2 font-awesome icons acting buttons/links: lightbox view , single post permalink. have added new font awesome link/button have text field acting link's target. the code on functions.php: if(function_exists("register_field_group")) { register_field_group(array ( 'id' => 'acf_sponsorer-lank', 'title' => 'sponsor hyperlänk', 'fields' => array ( array ( 'key' => 'field_56...

node.js - Nodejs check to see if client is still connected -

i using v0.10.37. logic set detection code not correct. if (typeof(socket.to(key).connected[key]) ==='undefined') is i'm using detect, tried typeof(socket.to(key).connected[key].connected threw undefined error (reason why changed code above). need code work clients array when adding new clientid client removes invalid clientids notifications can pushed smoothly client. var http = require('http'); var io = require('socket.io'); server = http.createserver(function(req, res){}); server.listen(8082); var socket = io.listen(server); var clients = {}; socket.on('connection', function(client) { client.on('setuserid',function(userid) { console.log("add"); if(typeof(clients[userid[0]])==='undefined') clients[userid[0]] = {}; clients[userid[0]][userid[1]] = userid[1]; console.log(clients); for(var key in clients[userid[0]]) { if (typeof(socket....

Regex with backreference won't match in C++ -

i'm trying match 4 equal characters in c++. these supposed match = kqqqq, zzzzq this i've tried far: std::string mano_to_reg = "kqqqq"; std::regex pokar("(.)\1{3}"); std::smatch match; std::cout << "match = " << std::regex_match(mano_to_reg, match, pokar) << "\n"; but won't match. i've tried std::regex_search , won't match either. i've tried using basic , extend syntax i've tried changing pattern "(.)\1{4}" , "((.)\1{3})" , every other combination of these. i've tried matching other patterns other strings , of them work. seems problem backreference, i've looked everywhere , can't find why wont match. i'm using clang++ 7.0.2 on os x 10.11.3 -std=c++11 -stdlib=libc++ flags. i've tried g++ 5.3.0 -std=c++11 -std=gnu++11 flags. you've got 2 problems: you need escape \ . regex (.)\1{3} correct, in order store in string lite...

myeclipse - Creating maven-archetype-webapp -

the problem occurred when created maven project myeclipse9, don't know what's wrong. know how solve it? thanks. 'creating maven-archetype-webapp' has encountered problem. failed create project. this appears have been problem identified in myeclipse 9 , fixed in myeclipse 10. if install release 10 or release 2013, shouldn't problem. myeclipse licenses time based, not release based, can install release under license.

mysql - PHP Message History (Two tables, two same colums.) -

i'm posting here today because i'm in conundrum. i'm trying make messaging history custom website i'm having trouble identifying mistakes making. i have 2 different tables, 1 named messages , other named messages_sent , both share same columns mess_by , mess_to , , mess_id . when member trying view history display as: member 1: hey - id 2 memeber 2: how you? - id 1 the code attempting use replicate said function is: select * messages mess_by = x , mess_to = y union select * messages_sent mess_by = y , mess_to = x order mess_id desc x = who's from. y = receiver. unfortunately above code not seem work accurately, next plan use: select * messages mess_to= y , mess_by= x or mess_by= y , mess_to= x order mess_id desc x = who's from. y = receiver. which "sorta" worked, doesn't bring history messages_sent . if me this, appreciated, thank & have great year!

r - How to generate counts of positive values by column in data.table -

i have data tables consist of several columns , many thousands of rows. data looks like: iteration v1 v2 v3 v4 1 -2 3 -4 1 2 -2 3 -3 4 3 -2 3 7 -8 4 -2 3 -4 2 5 -2 3 -4 -3 i have been trying figure out how calculate counts of positive values in each column, , proportion of positive counts counts in column. this seems simple can't figure out how output data.table has counts column in it. i can combining bunch of following statements, there has better way- advice tired mind? nrow(dat[v2>=0]) assuming dataframe called df : df <- data.frame('v1'=c(-2, -2, -2, -2, -2), 'v2'=c(3, 3, 3, 3, 3), 'v3'=c(-4, -3, 7, -4, -4), 'v4'=c(1, 4, -8, 2, -3)) you start defining number of rows as: nrows <- dim(df)[1] then, can define auxiliary function such: calcstats <- function(x) { pos <- sum(df[, x] > 0) c("number of positives" = pos, ...

ibm bluemix - open report created in embeddable report service -

i have created report studio report in bluemix using embeddable reporting service. can display report going through bluemix login process , through embeddable report service don't want users following path - ideally have thought there url give display final report. url see when run report https://erservice.ng.bluemix.net/viewer/viewer.jsp if copy/paste new chrome tab following error - error 404: java.io.filenotfoundexception: srve0190e: file not found: /null/reports/phtml. is there endpoint add url users can open report or other url give report consumers? the endpoint bluemix application name. please refer instructions on how ersfit sample app deployed ( https://console.ng.bluemix.net/docs/services/embeddablereporting/index.html#gettingstartedtemplate )

facebook graph api - Java Proxy Server Settings at JVM Level -

i have developed java application connect facebook rest api , perform various tasks. it has run corporate proxy server, have tried various jvm level proxy settings did not work me. have tried following 1. system.setproperty("http.proxyhost", gethttphost()); system.setproperty("http.proxyport", gethttpport()); system.setproperty("https.proxyhost", gethttphost()); system.setproperty("https.proxyport", gethttpport()); 2. $> java -dhttp.proxyhost=proxyhosturl -dhttp.proxyport=proxyportnumber -dhttp.proxyuser=someusername -dhttp.proxypassword=somepassword helloworldclass can tell me working recipe?

java - Set actionbar backgroung when using toolbar -

i have been learning android programing last weeks , have question. how can configure background color of action bar along status bar color when using theme.appcompat.light.noactionbar theme , setting toolbar in activity? in xml , not programmatically. i following error when use theme.appcompat.light.darkactionbar as parent of custom style. this activity has action bar supplied window decor. not request window.feature_support_action_bar , set windowactionbar false in theme use toolbar instead. this works me: <resources> <!-- base application theme. --> <style name="custommaterialtheme" parent="theme.appcompat.light.noactionbar"> <!-- customize theme here. --> <item name="colorprimary">@color/colorprimary</item> <item name="colorprimarydark">@color/colorprimarydark</item> <item name="actionmodebackground">@color/colorprimary</item> <item na...

python - How to store this type of values in odoo? -

i have following requirements class a: _name='a' _columns={ 'store'=fields.one2many('b','link1','history'), } class b: _name='b' _columns={ 'name'=fields.char('employee names'), 'age'=fields.char('age'), 'link1': fields.many2one('a','link'), } this module has one2many field has 2 fields 'name','age' .this values stored below module class y: _name='y' _columns={ 'detail': fields.one2many('z','link','details'), } class z: _name='z' _columns={ 'name1': fields.char('name'), 'age2': fields.char('age'), 'link': fields.many2one('y','link'), } in module store few names , age . , wanted button in module has function store value 'a...

javascript - Why do I get "X is not a function" in the following recursive function? -

i'm using following code animate opacity of element: var opacity = 0 // starting opacity var step = 0.1 // step size var target = 1 // target value var time = 50 // delay in milliseconds // start timer loop, , record it's index var increaseopacity = setinterval(function () { // assuming selector works, set opacity $(`#pano-${index}`).attr({ opacity: opacity }) // increment opacity step size opacity += step // if reached our target value, stop timer if (opacity >= target) { clearinterval(increaseopacity) } }, time) $('.pano').attr({ opacity: 0 }) increaseopacity() it works. however, uncaught typeerror: increaseopacity not function every time run function. why , how fix it? however, uncaught typeerror: increaseopacity not function every time run function. increaseopacity not function object, identifier timer clearinterval...

Wordpress - created tabbed information in a single post -

i know best method add tabbed information inside post. i want able create these in single post template easy update via cms (dashboard) see example here: overview | atractions | maps | not included what best approach structure content? plug-ins? custom fields? or meta tags? look @ plugin : types , allows create custom posts types fields want

java ee - @Stateless not injected via @Inject in a JSF @ManagedBean -

i trying read horoscope json url , save database , using jsf 2.2. i getting null pointer exception: java.lang.nullpointerexception @ com.horoskop.android.controlor.horoscopebean.savetodayhoroscope(horoscopebean.java:40) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ javax.el.elutil.invokemethod(elutil.java:332) @ javax.el.beanelresolver.invoke(beanelresolver.java:537) @ javax.el.compositeelresolver.invoke(compositeelresolver.java:256) @ com.sun.el.parser.astvalue.getvalue(astvalue.java:136) @ com.sun.el.parser.astvalue.getvalue(astvalue.java:204) @ com.sun.el.valueexpressionimpl.getvalue(valueexpressionimpl.java:226) this managedbean code: @managedbean @applicationscoped public class horoscopebean { horoscopeparser horoscopeparser; @in...

android - slide views which are within view animator from right to left for previous views -

i want slide views within viewanimator right left previous views. this layout <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <linearlayout android:id="@+id/btn_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:orientation="horizontal"> <button android:id="@+id/btn_previous" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="previous" /> <button android:id="@+id/btn_next" ...

git - Setting up BitBucket so you can use pull from it on your server -

i have setup repository , have working locally can push/pull bitbucket; trying working can git pull host server. i have setup ssh key , , well, when do: cat .git/config all is: [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true whilst config file on local environment contains: [core] repositoryformatversion = 0 filemode = false bare = false logallrefupdates = true symlinks = false ignorecase = true hidedotfiles = dotgitonly [remote "origin"] url = git@bitbucket.org:git-username/my-repo.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/master [gui] wmstate = normal geometry = 887x427+25+25 171 192 so not sure why different? assume need add remote origin unsure how go it? assume follow same instructions when setting repository via bitbucket i'm not sure if all? ....and can...

php - OOP eficiency when using a class in another class -

afternoon, have class called db (class.pdo.php) handling on mysql queries using pdo , class called user use manage login system. my question relates having instantiate $db in every public function of users can use db. efficient? shouldn't instantiating db inside __construct() of users? this code require_once("../../class.pdo.php"); class user { private $db = null; public function __construct(){ /* empty? */ } public function find_by_email($email){ $db = new db(); $db->query('select * users email = :email limit 1'); $db->bind(':email',$email); $result = $db->single(); return $result; } public function create($email,$password,$first_name,$last_name){ $db = new db(); $db->query("insert users(email,password,first_name,last_name,created_at) values (:email,:password,:first_name,:last_name,now())"); $db->bind(':email',$email); $db->bind(':password',$password); ...

Update Option of Theano Function -

i using theano tutorials of deep learning , have doubt regarding how theano function's update works. whatever parameters update defined take new value if of parameters changed? theano.function( [i], cost, updates = updates, givens = { self.x: trainx[i*self.mbsize: (i+1)*self.mbsize], self.y: trainy[i*self.mbsize: (i+1)*self.mbsize] } ) updates defined updates = [ (param, param-learnrate*grad) param, grad in zip(self.params, gradients) ] here learnrate not theano variable. question if change learnrate @ point of time theano function take changed value of learnrate or continue old value? learnrate changed as learnrate = learnrate/10 initially learnrate 0.05 it continue old value. numbers immutable in python changing value of learnrate won't affect value being used in updates list, , guess once theano functi...

objective c - NSLayoutConstraint.constraintsWithVisualFormat align bottom right -

Image
i want put indicator view in bottom right of container view, have code insert view var img:uiimageview? img = uiimageview(frame: cgrect(x: 0, y: 0, width: singlecheckviewwidth, height: singlecheckviewheight)) img!.image = uiimage(named: "check") img!.tag = 21 img!.translatesautoresizingmaskintoconstraints = false img!.backgroundcolor = uicolor.redcolor() //aggiungo la vista al fumetto cell.textview!.addsubview(omg!) the problem code have icon in top left 10px margin , works fine: let iconverticalconstraints = nslayoutconstraint.constraintswithvisualformat( "v:|-10-[indicator(\(singlecheckviewheight))]", options: [], metrics: nil, views: views) allconstraints += iconverticalconstraints let horizontalconstraints = nslayoutconstraint.constraintswithvisualformat( ...

amazon web services - dynamodb - scan items by value inside array -

i'm doing table scan. table has array 1 of fields, "apps" field (apps not key of kind). want select rows, apps array contains value "myapp". tried of kind, syntax incorrect: comparisonoperator = "#apps contains :v", expressionattributenames = { '#apps': 'apps' }, expressionattributevalues = { ":v": "myapp" } thanks. the documentation condition expressions states appropiate syntax is: contains(#apps, :v) the correct request be: filterexpression: "contains(#apps, :v)", expressionattributenames: { "#apps": "apps" }, expressionattributevalues: { ":v": "myapp" }

python - How do I find all possible permutations of a string with only single swap? -

the complexity should o(n) n length of string. ex: 'abc', answer 'bac', 'cba', 'acb'. 'bca' , 'cab' should not in list 2 swaps required convert 'abc'. i have made o(n 2 ) algorithm slow. def f(s): temp=list(s) l=[] in range(len(s)): j in range(len(s)): temp=list(s) temp[i],temp[j]=temp[j],temp[i] l.append("".join(str(i) in temp)) print set(l) the number of possible outcomes string (with distinct characters) of length n nc2 = n * (n-1) / 2 , since can choose 2 letters @ 2 indices , swap them. hence, if plan print of outcomes, complexity o(n^2) , o(n) solution not possible. for duplicate characters, reasoning becomes more complex. suppose there 1 duplicate character repeated k times. there n-k swaps identical. if there 1 character repeated, , repeated k times, number of possibilities nc2 - (n-k) . can extended more repeated characters us...

html - Scaling a div with background image to fit screen size -

most of pages has full width banner @ top under menu. created div background image image sprite file reduce page load time. problem div not resize when screen gets smaller, cuts div of. div 100% wide , height scaling keep proportions of background image (1300px × 300px). here' code , jsfiddle: <div class="entry-content"> <div class="banner"></div> </div> .entry-content { max-width: 1300px; width: 100%; padding: 0 20px 0 20px; } .banner { margin: 0 -20px 0 -20px; max-width: 1300px; height: 300px; background: url("http://renservice.dk/wp-content/uploads/2016/02/banner-sprites.jpg"); background-position: 0 -900px; } https://jsfiddle.net/fy2zh4vm/1/ i have added code resize div proportionally width. don't think sprite image background solve problem. here fiddle link https://jsfiddle.net/fy2zh4vm/3/ $(window).on('load resize', function(e){ $('.banner').h...

css - sass in rails 4 not reading -

this simple. i'm not rails. i set new project , controller called "say" , it's working fine. when write plain css in app/assets/stylesheets/say.scss reads fine. however, when write sass, error message : invalid css after " font": expected selector or at-rule, ": $font-stack" how compile sass - compass in rails 4 ? thanks !

python - Is it pythonic to write decorators that doesn't return a callable? -

i observed python decorator need not return callable. tried below example in django queryset. how bad practice? class myqueryset(models.queryset): ... def each(self, save=false, func=none): if hasattr(save, '__call__'): func = save save = false obj in self: func(obj) if save: obj.save() mymodel.objects.each(lambda x: x.delete()) # delete mymodels database @person.objects.each(save=true): def make_older(person): ''' increase age of people ''' person.age += 1 ps: are there situations technique can used more useful purpose? from python glossary : decorator a function returning function, applied function transformation using @wrapper syntax. common examples decorators classmethod() , staticmethod(). edit: decorator not return callable not fall under official defnition of term 'decorator'. unpythonic.

mysql - need query to find sum and count of transactions on daily basis for a month -

select s.merchant, s.tran_amount, s.tran_count, s.date, a.mid, m.sales_person, m.mercinfo_legalname, m.mercinfo_dba_name, c.codedesc, ad.phoneno, ad.city, ad.state, ad.contact_name, tid (select t.merchant merchant, sum(t.f_txn_amount) tran_amount, count(t.id_v2_wc_transaction) tran_count, t.f_txn_datetime date bijlipay.bij_v2_wc_transaction t t.f_txn_amount > 10 , date(t.f_txn_datetime) = '2016-03-08' , t.f_trx_type = '1240/110' group merchant) s, bijlipay.bij_merchant m, bijlipay.bij_address ad, bijlipay.bij_codeset c, bijlipay.bij_device_allocation m.id_merchant = s.merchant , ad.id_address = m.mercinfo_permanent_address , c.codename = m.mercinfo_mcc , a.merchant_id = s.merchant group s.merchant; this query result need sum , count day-wise month

java - JFrame ContentPane listener -

is there kind of listener (and best use) triggers after content pane of jframe set? so every time call myjframeclass.setcontentpane(somejpanel) start doing stuff? i wondering containerlistener or ancestorlistener ? i'm not sure should use.

asp.net core - No authentication handler is configured to handle the scheme: Microsoft.AspNet.Identity.Application -

i using asp.net core asp.net identity , have following: user user = await _usermanager.findbyemailasync(myemail); signinresult result = await _signinmanager.passwordsigninasync(user, mypassword, true, false); i user when try sign in user error: [error] unhandled exception has occurred while executing request system.invalidoperationexception: no authentication handler configured handle scheme: microsoft.aspnet.identity.application on web project startup file have: public void configure(iapplicationbuilder applicationbuilder, ihostingenvironment hostingenvironment, iloggerfactory loggerfactory) { // other configuration code lines applicationbuilder.useiisplatformhandler(options => options.authenticationdescriptions.clear()); applicationbuilder.useidentity(); } // configure public void configureservices(iservicecollection services) { // other configuration code lines services .addidentity<user, role>() .addentityframeworkstores<context...

java - Hibernate many-to-one delete only child -

where lot of similar topics still can't handle myself, sorry. so, have object "bank" parent of "office" . trying delete single office, it, offices of parent bank being deleted. here's code: bank @entity @table(name = "banks") public class bank { public bank() { } public bank(string name) { this.name = name; } @id @column(name = "id") @generatedvalue private int id; @column(name = "name") private string name; @onetomany(mappedby = "bank", cascade = cascadetype.all, fetch = fetchtype.eager, orphanremoval = true) @joincolumn(name = "bank_id") private list<office> officelist; office @entity @table(name = "offices") public class office { public office() { } public office(string city, string address, string workinghours, bank bank) { this.city = city; this.address = address; this.wor...