Posts

Showing posts from July, 2011

javascript - The button is not added via a variable in the TEXT method -

i'm doing task sheet. dynamically add items list along delete button, button not displayed. why? can write code differently, why code not work? $(function() { $("#button").click(function() { var text = $("#text").val(); if(text != "") { var del = $("<input type='button' value='x'></input>").text(); //var item = $("<li></li>").text(text + del); var item = $("<li></li>").text(text + del); // dont work! why? $("ul").append(item); } }); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div> Введите текст: <input id="text" type="text"></input> <input id="button" type="submit"></input> </div> <div class="ul"> <

ios - userNotificationCenter willPresentNotification Overriding application didRecieveNotifiction in Dev but not Prod -

very odd problem i've been stuck @ while. im working on code base has notification center handles remote notifications, appdelegate handles remote notifications. // notification center handler @available(ios 10.0, *) func usernotificationcenter(center: unusernotificationcenter, willpresentnotification notification: unnotification, withcompletionhandler completionhandler: (unnotificationpresentationoptions) -> void) { log.debug("@appdelegate: willpresentnotification: \(notification)") } // app delegate notification handler func application(application: uiapplication, didreceiveremotenotification userinfo: [nsobject : anyobject], fetchcompletionhandler completionhandler: (uibackgroundfetchresult) -> void) { log.debug("@appdelegate: didreceiveremotenotification: \(notification)" } the strange behaviour having push notifications seem work on production (when build app store). however, when send push notifications in dev, usernotificatio

frameworks - IOS Porting from Android -

i have working android app i'd port ios. i've started working through apple api references , hopeful can quick assistance. based on specific time of day, i'd ideally toggle airplane mode user cannot send or receive emails or calls. appreciate can accomplished using private apis want avoid. such, other options available mimic end result closely possible? app turn off notifications, or turn screen off, or set brightness zero, or disable pop-up keyboard. knowing apple has locked down system wide settings, there creative idea could employ? no. apple not allow 3rd party apps alter global settings airplane mode. apps operate in limited "sandbox" have limited access system resources. what describe not possible unless app running on jailbroken (rooted, in android terms) device. wiki

c# - Remove Spaces from SQL Results When Searching -

i have access database contains fields spaces in them. i'm trying allow user search matches spaces in results returning no information. var dtcustomers = new datatable(); var adapter = new oledbdataadapter("select * devices [serial number]='" + textbox1.text + "'", conn); adapter.fill(dtcustomers); datagridview1.datasource = dtcustomers; foreach (datagridviewrow row in datagridview1.rows) { row.cells[0].style.forecolor = color.blue; row.cells[28].style.forecolor = color.red; } the code above return results database if database has field that's entered '1z 4568 29z4h' won't returned unless user types that. results displayed in datagridview. there different query should using? you can use sql's replace function replace spaces in [serial number] column nothing, , use textbox1.text.replace(' ','') make sure user's input doesn't have spaces too: var dtcustomers = new datatable(); var ad

javascript - How to dynamically get the dynamically created ID in a li -

i've been trying learn js (and tad of jquery) , have run 2 difficulties when trying find way combine solutions find. just little warning code mix of few tutorials have done. new js. so start basic html few li. <body> <ol id="liste"> <li class="active"> </li> <li> </li> <li> </li> </ol> <div id="main_ima"> </div> <script src="js/main.js"></script> </body> i want create ids each "li" in main.js add this: var idvar = $("#liste").find("li").each(function(index){ $(this).attr("id","num-li-"+index); }); this works great far. everytime add new li, gets new id. put var because need use later. in th console, if type idvar, gives me whole list of li. if type idvar[3]. gives me li associated [3]. perfect. now want appear when 1 of li clicked. example, use [3]. add main.js var

python pandas loc - filter for list of values -

this question has answer here: how implement 'in' , 'not in' pandas dataframe 4 answers this should incredibly easy, can't work. i want filter dataset on 2 values. #this works, when filter 1 value df.loc[df['channel'] == 'sale'] #if have filter, 2 separate columns, can df.loc[(df['channel'] == 'sale')&(df['type]=='a')] #but if want filter 1 column more 1 value? df.loc[df['channel'] == ('sale','fullprice')] would have or statement? can in sql using in? there exists df.isin(values) method tests whether each element in dataframe contained in values. so, @maxu wrote in comment, can use df.loc[df['channel'].isin(['sale','fullprice'])] to filter 1 column multiple values. wiki

perl - index is not visible to DBIx::Class -

i have small perl code going add record table confused why dbic not able see primary key? i not able find answer anywhere. first names of table , columns camelcase, changed underscore won't run :( $ ./test.pl dbix::class::resultsource::unique_constraint_columns(): unknown unique constraint node_id on 'node' @ ./test.pl line 80 code: sub addnode { $node = shift; $lcnode = lc($node); $id = $schema ->resultset('node') ->find_or_create ( { node_name => $lcnode }, { key => 'node_id' } ); return $id; } table details: mysql> desc node; +------------+-----------------------+------+-----+---------+----------------+ | field | type | null | key | default | | +------------+-----------------------+------+-----+---------+----------------+ | node_id | mediumint(5) unsigned | no | pri | null | auto_increment | | node_name | varchar(50)

bitbake - How to format partitions for Yocto sdcard image for Variscite iMX6 -

i looking @ generating own image_fstypes=sdcard image freescale variscite var-som-mx6. have copied meta-fsl-arm/classes/image_types_fsl.bbclass class , modified there 3 partitions rather two. looking include third partition formatted fat (vfat) files can added onto sdcard not sit alongside files in boot partition or root file system. i have made additions generate_imx_sdcard() function create new partition: generate_imx_sdcard () { # create partition table parted -s ${sdcard} mklabel msdos parted -s ${sdcard} unit kib mkpart primary fat32 ${image_rootfs_alignment} $(expr ${image_rootfs_alignment} \+ ${boot_space_aligned}) parted -s ${sdcard} unit kib mkpart primary $(expr ${image_rootfs_alignment} \+ ${boot_space_aligned}) $(expr ${image_rootfs_alignment} \+ ${boot_space_aligned} \+ $rootfs_size) # line below new partition have added parted -s ${sdcard} unit kib mkpart primary fat32 $(expr ${image_rootfs_alignment} \+ ${boot_space_aligned} \+ $rootfs_size) $(expr ${image_ro

c++ - Detect idiom with function failing static_assert -

is there way use detection idiom (or method) test whether function valid given template arguments, if fails due static_assert ? the example below illustrates validity of foo (failing return type computation) detected intended, of bar (failing static_assert ) not. #include <iostream> #include <type_traits> template <typename... t> using void_t = void; template <class alwaysvoid, template<class...> class op, class... args> struct detector: std::false_type { }; template <template<class...> class op, class... args> struct detector<void_t<op<args...>>, op, args...>: std::true_type { }; template <template<class...> class op, class... args> constexpr bool is_detected = detector<void, op, args...>::value; template <typename t> std::enable_if_t<!std::is_void<t>::value> foo() { std::cout << "foo" << std::endl; } template <typename t> void bar() { static

c# - How to hide desktop icons programatically? -

how can show/hide desktop icons programatically, using c#? i'm trying create alternative desktop, uses widgets, , need hide old icons. you can using windows api. here sample code in c# toggle desktop icons. [dllimport("user32.dll", setlasterror = true)] static extern intptr findwindow(string lpclassname, string lpwindowname); [dllimport("user32.dll", setlasterror = true)] static extern intptr getwindow(intptr hwnd, getwindow_cmd ucmd); enum getwindow_cmd : uint { gw_hwndfirst = 0, gw_hwndlast = 1, gw_hwndnext = 2, gw_hwndprev = 3, gw_owner = 4, gw_child = 5, gw_enabledpopup = 6 } [dllimport("user32.dll", charset = charset.auto)] static extern intptr sendmessage(intptr hwnd, uint32 msg, intptr wparam, intptr lparam); private const int wm_command = 0x111; static void toggledesktopicons() { var toggledesktopcommand = new intptr(0x7402);

python - NoReverseMatch at /password_reset/done/ -

i have learned tutorial reset password in django. not able resolve the error:noreversematch @ /password_reset/done django.contrib.auth import views auth_views urlpatterns = [ url(r'^password_reset/$', auth_views.password_reset, name='password_reset'), url(r'^password_reset/done/$', auth_views.password_reset_done, name='password_reset_done'), url(r'^reset/(?p<uidb64>[0-9a-za-z_\-]+)/(?p<token>[0-9a-za-z]{1,13}-[0-9a-za-z]{1,20})/$', auth_views.password_reset_confirm, name='password_reset_confirm'), url(r'^reset/done/$', auth_views.password_reset_complete, name='password_reset_complete'), ] your password_reset_done.html template incorrect. includes following url tag causing error. {% url 'password_reset_confirm' uidb64=uid token=token %} however url belongs in password_reset_email.html template rendered , emailed user. the password_reset_done.h

python - Combining columns in pandas -

i have script output of multiple columns put beneath each other. columns merged , drop duplicates. i've tried merge, combine, concatenate , joining, can't seem figure out. tried merge list, doesn't seem well. below code: import pandas pd data = pd.excelfile('path') newlist = [x x in data.sheet_names if x.startswith("zzz")] x in newlist: sheets = pd.read_excel(data, sheetname = x) column = sheets.loc[:,'yyy'] any appreciated! edit some more info code: data excelfile loaded. @ newlist , sheetnames start zzz shown. in for-loop, these sheets called. @ column , columns named yyy called. these columns put beneath each other, aren't merged yet. example: here output of columns now , them 1 list 1 17. i hope more clear now! edit 2.0 here tried concat method mentioned below. however, still output picture above shows instead of list 1 17. my_concat_series = pd.series() x in newlist: sheets = pd.read_excel(data, sheetnam

javascript - How to pass arguments to a function with one passed? (ES6) -

there function 3 arguments set default: function func( = 1, b = 2, c = 3 ) { console.log(a, b, c); } how pass arguments function 1 passed? example: func(10, , 30); you use undefined , value undefined variables default parameters : in javascript, parameters of functions default undefined . the default check works like b = b !== undefined ? b : 2 function func(a = 1, b = 2, c = 3) { console.log(a, b, c); } func(10, undefined, 30); wiki

Can a Python script enter commands on the command line -

i have executable script, let's call script.py. trying run series of commands within terminal starting python3 ./differentscript.py console which allow me type in additional commands. however, wondering if can automated i.e. have script somehow output , execute commands? edit: took @ links commented below; can provide example of like? @chen xie if want call few commands @ once, can call below: subprocess.popen('echo first&echo second&echo third', stdout=subprocess.pipe, shell=true).stdout.read() it's not pythonic solution, works. wiki

google maps api 3 - What is wrong in this Polygon in MYSQL 5.7.19? -

so, trying save polygon in mysql using geospatial functions... found several examples online following: select st_geomfromtext('polygon(( 13.517837674890684 76.453857421875, 13.838079936422464 77.750244140625, 14.517837674890684 79.453857421875, 13.517837674890684 76.453857421875, 13.517837674890684 76.453857421875 ))'); select st_geomfromtext('polygon(( -98.07697478272888 30.123832577126326, -98.07697478272888 30.535734310413392, -97.48302581787107 30.535734310413392, -97.48302581787107 30.123832577126326, -98.07697478272888 30.123832577126326 ))') the problem when tried make own, returns following error: error code: 3037. invalid gis data provided function st_geometryfromtext. this code used... select st_geomfromtext('polygon(( -99.16939973831177 19.42468828496807, -99.16710376739502 19.424607339789876, -99.16712522506714 19.422907481732416, -99.168541431427 19.421996836172347, -99.16989326477051 19.422947954749972 ))'); these longitude-latitud

What is the best way to code a full Dojo web application? -

Image
i trying code medium sized full web application based off dojo. i have basic bordercontainer placed @ document.body. in order make code maintainable , easy read, want put contained widgets/modules in each of sections. can added couple lines such as... var toptabs = new toptabs(); top.addchild(toptabs); and want stitch them can invoke work in each of other widgets, in order follow mvc model. so instance, 1 example insert following widget contained top section looks like... so question is.... what best way create these defined , encapsulated widgets/modules? since widgets contain other dijits, template based widgets route go? or better create widgets/modules purely programmatically defined? thanks depends how familiar / comfortable declarative/html (templated) versus programmatic/javascript. can go both routes; i seldom use templates, static nature , mean 2 set of entities in 2 languages, 2 files, account for. besides, dojo/dom-construct

java.sql.SQLException: ORA-06502: PL/SQL: numeric or value error: character to number conversio -

i trying insert record oracle database using procedure. record inserted exception occurs. public class myproc extends storedprocedure { public thresholdoperationssp(jdbctemplate jdbctemplate, string sql) { super(jdbctemplate, sql); // declare in params declareparameter(new sqlparameter("i_unique_col", types.varchar)); declareparameter(new sqlparameter("i_action", types.varchar)); declareparameter(new sqlparameter("i_table", types.varchar)); declareparameter(new sqlparameter("i_columns", types.varchar)); declareparameter(new sqlparameter("i_values", types.varchar)); declareparameter(new sqlparameter("i_where_col", types.varchar)); declareparameter(new sqlparameter("i_where_values", types.varchar)); declareparameter(new sqlparameter("i_connection", types.varchar)); // declare out params declareparameter(ne

sql - Using LIMIT within GROUP BY to get N results per group? -

the following query: select year, id, rate h year between 2000 , 2009 , id in (select rid table2) group id, year order id, rate desc yields: year id rate 2006 p01 8 2003 p01 7.4 2008 p01 6.8 2001 p01 5.9 2007 p01 5.3 2009 p01 4.4 2002 p01 3.9 2004 p01 3.5 2005 p01 2.1 2000 p01 0.8 2001 p02 12.5 2004 p02 12.4 2002 p02 12.2 2003 p02 10.3 2000 p02 8.7 2006 p02 4.6 2007 p02 3.3 what i'd top 5 results each id: 2006 p01 8 2003 p01 7.4 2008 p01 6.8 2001 p01 5.9 2007 p01 5.3 2001 p02 12.5 2004 p02 12.4 2002 p02 12.2 2003 p02 10.3 2000 p02 8.7 is there way using kind of limit modifier works within group by? you use group_concat aggregated function years single column, grouped id , ordered rate : select id, group_concat(year order rate desc) grouped_year yourtable group id result: ----------------------------------------------------------- | id | grouped_year

java - How do i make an repeat button that cycles through repeat all and repeat one for an android music player? -

this code have got repeat 1 working want able repeat songs not stop playing music, want able repeat 1 single song. have tried find documentation me haven't found anything. appreciated import android.manifest; import android.app.activity; import android.content.pm.packagemanager; import android.media.mediaplayer; import android.os.bundle; import android.os.handler; import android.support.v4.app.activitycompat; import android.support.v4.content.contextcompat; import android.support.v7.widget.linearlayoutmanager; import android.support.v7.widget.recyclerview; import android.util.log; import android.view.view; import android.widget.adapterview; import android.widget.imagebutton; import android.widget.seekbar; import android.widget.textview; import java.io.ioexception; import java.util.collections; import java.util.comparator; import java.util.list; import java.util.locale; import java.util.concurrent.timeunit; import static android.r.drawable.ic_media_play; public class mainac

Filtering multiple model values in Django -

i using django 1.11.4 , python 2.7 so have models class vehicle(models.model): auto_maker = ( (‘chevy’, ‘chevrolet’), (‘ford’, ‘ford’), (‘nissan’, ‘nissan’), (‘lamborghini’, ‘lamborghini’), (‘ferrari’, ‘ferrari’), (‘dodge’, ‘dodge’), (‘tesla’, ‘tesla’), (‘jeep’, ‘jeep’) ) auto_maker_brand = models.charfield(max_length=12, choices=auto_maker) model_name = models.charfield(max_length=100) release_year = models.datetimefield() added_to_db_date = models.datetimefield() image_url = models.urlfield(max_length=500) description = models.textfield() default_value = models.positivesmallintegerfield(default=0) and want able have filter able have last n records of added_to_db_date , of auto_maker_brand objects filtered can use in template <h1>car maker</h1> <h2>chevy:</h2> <!— last 10 added chevy list each 1 in div along image—> <h2&g

Excel VBA getting captcha - bad version of image -

i'm getting captcha image webpage , inserting excel cell, manually proceding captcha writing inputbox in excel, excel pass captcha text opened ie window. so every element of code works fine, i'm getting 1 version of captcha image on opened ie window , diffrent 1 inserted excel. why ? looks diffrent instance of ie opened , diffrent instance of ie used inserting captcha image excel. sub get_captcha() dim ie new internetexplorer ie.visible = true ie.navigate activecell doevents loop until (ie.readystate = 4 , not ie.busy) dim doc htmldocument set doc = ie.document dim myinput string captcha = doc.getelementbyid("maincontent_ctrlcaptcha").getattribute("src") activecell.offset(0, 2).value = captcha activesheet.pictures .insert (doc.getelementbyid("maincontent_ctrlcaptcha").getattribute("src")) end end sub diffrent approach screen capturing sub get_captcha() application.displayalerts = false: application.screenupdating =

php - How to pass 2 array in foreach using $_POST -

i trying insert dynamic form filed values database. insert these values in database,i trying apply foreach loop in mysql query code goes this: if (isset($_post['submit_val'])) { if ($_post['elements'],$_post['quanity']){ foreach($_post['elements'] $elements){ foreach($_post['quantity'] $quantity){ $sql[] = "insert create_campaign (elements, quantity) values ('{$elements}','{$quantity}')"; } } foreach($sql $query){ mysql_query($query); } } } <div class="row col-md-12" ng-app="angularjs-starter" ng-controller="mainctrl"> <fieldset data-ng-repeat="choice in choices" name="records"> <label for="inputpassword3" class="col-md-1 control-label">elements</label>

Is there a change in the lazy identifier of the new Scala? -

def maybetwice(b:boolean,i: =>int) = { val j = if (b) j+j else 0 } def maybetwice(b:boolean,i: =>int) = { lazy val j = if (b) j+j else 0 } val x=stream.maybetwice(true,{println("hi");41+1}) the above code execution same result, not described in functional programming in scala book. how differ read in book? lazy val delays evaluation until first usage. code may same, different. when send false, j never evaluated. may clarify: def maybetwice(b:boolean, i:int) = { lazy val j = { println("hi"); } if (b) j+j else 0 } from repl: scala> maybetwice(true,10) hi res10: int = 20 scala> maybetwice(false,20) res11: int = 0 in second case, j never evaluated. wiki

angularjs - How to convert a child state to parent state or vice versa dynamically based on screen width? -

i have kind of situation need nest child state when screen size desktop , convert child state parent state when screen mobile. desktop <div ui-view="parent"> <div ui-view="child"></div> </div> mobile <div ui-view="child"></div> what best way that? i'm thinking of creating separate state desktop , mobile same controller , template , navigate state based on screen width wiki

.net - Setting a date and revision number as variables in tfs 2017 -

i want create variable named nugetversionnumber value date format of $(date:yyyy.mm.dd)$(rev:.rr) revision @ end. e.g. 2018.8.23.1 how set process variable construct format without changing build.buildnumber variable? it's not able directly use $(date:yyyy.mm.dd)$(rev:.rr) user-defined variables . (date:yyyymmdd) token of build number format not general variable. the way setting build number (date:yyyy.mm.dd)$(rev:.rr) format. , directly use $(build.buildnumber) variable . since going use nuget package version. directly check use build number version package in nuget package task . to use build number, check use build number version package box , follow line's instructions (hover on blue i icon) set build version format string. must set build version format string have @ least 3 parts separated periods avoid error in nuget packaging. default build version format string $(date:yyyymmdd)$(rev:.r) , simple change add 0 @ end , period

Spring - No qualifying bean of type -

just started learning spring. trying learn jpa creating person class, personrepository , persondao , main . i've looked on stackoverflow answers think did right... exception: exception in thread "main" org.springframework.beans.factory.nosuchbeandefinitionexception: no qualifying bean of type 'beans.persondao' available @ org.springframework.beans.factory.support.defaultlistablebeanfactory.getbean(defaultlistablebeanfactory.java:353) @ org.springframework.beans.factory.support.defaultlistablebeanfactory.getbean(defaultlistablebeanfactory.java:340) @ org.springframework.context.support.abstractapplicationcontext.getbean(abstractapplicationcontext.java:1090) @ com.example.srpingdatajpa.main.main(main.java:15) this classes: person.class: package beans; import javax.persistence.column; import javax.persistence.entity; import javax.persistence.id; import javax.persistence.table; @entity @table(name="workers&quo

python - Filter numpy array if elements in subarrays are repeated position-wise in the other subarrays -

unluckily terribly similar to: filter numpy array if list within contains @ least 1 value of previous row question asked minutes ago. in case have list b = np.array([[1,2], [1,8], [2,3], [4,2], [5,6], [7,8], [3,3], [10,1]]) what want different now. i want start @ beginning of list , each subarray . want check whether element in position (with respect subarray ) encountered in position i in other subarrays . hence, removing such elements. for instance: look @ [1,2] : eliminate [1,8] cause 1 in position 0, eliminate [4,2] cause 2 in position 1. not eliminate [10,1] or [2,3] since 1 , 2 in different positions. look @ [2,3] ,eliminate [3,3] since 3 in position 1. look @ [5,6], nothing eliminate. look @ [7,8], nothing eliminate so result b = np.array([[1,2], [2,3], [5,6], 7,8], [10,1]]) my try can see in previous post tried different things. now, noticed a==b gives useful array, used filtering, can't quite decide how put together. edit: m

python - Travis jobs reporting success, even though tests fail (using tox) -

i'm looking @ following build: https://travis-ci.org/ababic/wagtailmenus/builds/267670218 all jobs seem reporting successful, though have single, deliberately failing test, , has been happening on different builds on same project @ least last 2 days. the configuration in .travis.yml hasn't changed in while, apart switching 'trusty' 'precise' - , changing seems not fix issue. my tox.ini hasn't been changed in while either. i tried forcing tox earlier version already, didn't seem help. i know it's got tox or travis, that's knowledge ends. @ appreciated. i had @ project , has nothing either tox or travis. problem runtests.py used in tox returns exitcode 0 whatever happens. tox (and in extension travis) needs exitcode != 0 able know went wrong. relevant code in runtests.py: [...] def runtests(): [...] try: execute_from_command_line(argv) except: pass if __name__ == '__main__': r

vectorization - Conditional instructions in AVX2 -

can give list of conditional instructions available in avx2? far i've found following: _mm256_blendv_ * selection a , b based on mask c are there conditional multiply , conditional add, etc.? also if instructions taking imm8 count (like _mm256_blend_ *), explain how imm8 after vector comparision? avx512 introduces optional zero-masking , merge-masking instructions. before that, conditional add, mask 1 operand (with vandps or vandnps inverse) before add (instead of vblendvps on result). why packed-compare instructions/intrinsics produce all-zero or all-one elements. 0.0 additive identity element, adding no-op. (except ieee semantics of -0.0 , +0.0, forget how works exactly). masking constant input instead of blending result avoids making critical path longer, conditionally adding 1.0 . conditional multiply more cumbersome because 0.0 not multiplicative identity. need multiply 1.0 keep value unchanged, , can't produce , or andn compare

css text position styling not aligned -

i trying implement text width identical 1 or close example. have few div tags text unchangeable react component injecting variable div tag example {reactvar} however text returned aligns mr following divs. test test test tets tetstetetse all of text not aligned accurately on place. suggestions have them same width , aligned? have tried text align center , margin auto , none work. wiki

python - pyspark udf rlike condition in if error -

i using spark 2.1 scripting pyspark scripting my dataframe given below dataframe name:df a naveen naveen123 now output should a naveen i using below udf this def fn(a): if((a==rlike("[0-9]"))|(a==' ')): return s df.withcolumn("flg",fn("a")).show() i getting error :global name 'rlike' not defined please me in crossing hurdle you want filter not withcolumn adds column. if want strictly alphabetical : import pyspark.sql.functions psf df = df.withcolumn("ischarstring", df.a.rlike("^[a-za-z]+$")) if want keep strings don't have numbers df = df.withcolumn("ischarstring", ~df.a.rlike("[0-9]")) the error you're getting using function because use rlike as standalone function not, attribute class pyspark columns. rewrite function in spark: df = df.withcolumn("ischarstring", psf.when( df.a.rlike("[0-9]")| (df

php - Trying to create a query with Symfony that allows me to access object of foreign key -

so have 3 entities: supermarket: | id | supermarket_name | category: | id | category_name | product: | id | product_name | supermarket_id | category_id | supermarket_id , category_id both many 1 with id's of supermarket , category respectively. i when select supermarket of categories listed underneath supermarket. have been attempting data query product entity via supermarkets id has been passed query method in productrepository.php file works if have following: public function findallcategoriesbysupermarket($supermarketid) { return $this->getentitymanager() ->createquery( "select p appbundle:product p p.supermarketid = $supermarketid" ) ->getresult(); } i can display products in loop in view with: {{ product.categoryid.categoryname }} the problem though because query products end more 1 of same category because several products can assi

function - C++ request for member (blank) in (blank) , which is of non-class type (blank) when calling method -

i'm trying learn artificial neural networks using page(it's in processing i'm converting c++ while changing minor parts): http://natureofcode.com/book/chapter-10-neural-networks/ when run code down below error: main.cpp: in function ‘int main()’: main.cpp:36:7: error: request member ‘feedforward’ in ‘idk’, of non-class type ‘perceptron()’ idk->feedforward({1.0, .5}); i've looked around dont think can find gets error while calling method. code: #include <stdio.h> #include <math.h> #include <time.h> #include <stdlib.h> #include <vector> const double e = 2.71828182845904523536; float s(float in){ return 1 / (1 + pow(e, -(in))); } double frand(double fmin, double fmax){ double f = (double)rand() / rand_max; return fmin + f * (fmax - fmin); } struct perceptron{ perceptron(int n); std::vector<double> weights; int feedforward(float inputs[]); }; perceptron::perceptron (int n){ weights.assign(

java - Get data from MQ and add id number for it -

i new java. need receive data mq, each time receive data give id number, 1, 2, 3..... question when restart program, how can make id number keep adding, not start 1. example, received 3 data mq, ids 1, 2 , 3, close program. next time run program , recieve data, want id number start 4, not 1. know can done record id number text file, worry safety, because every 1 can change it. there better way this? thanks in advance , sorry english wiki

vb.net - PInvokeStackImbalance was detected in my program -

i try coordinates left mouse clicked during timer working. had error "pinvokestackimbalance detected" . how rid of error? partial program following. enter code here private declare function getasynckeystate lib "user32" (byval vkey long) integer declare sub mouse_event lib "user32" alias "mouse_event" (byval dwflags integer, byval dx integer, byval dy integer, byval cbuttons integer, byval dwextrainfo integer) public const mouseeventf_leftdown = &h2 public const mouseeventf_leftup = &h4 public const mouseeventf_middledown = &h20 public const mouseeventf_middleup = &h40 public const mouseeventf_rightdown = &h8 public const mouseeventf_rightup = &h10 dim mouse_leftclick boolean private sub timerrec_tick(sender object, e eventargs) handles timerrec.tick mouse_leftclick = getasynckeystate(keys.lbutton) ' **error occured here!** if mouse_leftclick messagebox.show(mouseposition.x.tostring & &quo

java - Deleting old log4j files without onstartupriggeringpolicy -

i wondering why log4j2 cant delete old log files without using onstartuptriggeringpolicy. this 1 log4j configuration works: <rollingfile name="configlog" append="true" filename="../log/config.log" filepattern="../log/config-%d{yyyy-mm-dd}.log"> <patternlayout pattern="%d %-5p %c{3} [%t]: %m%n" /> <policies> <onstartuptriggeringpolicy/> <timebasedtriggeringpolicy /> <sizebasedtriggeringpolicy size="100 mb" /> </policies> <defaultrolloverstrategy> <delete basepath="../log" maxdepth="1"> <iffilename glob="config-*.log"> <iflastmodified age="30d"/> </iffilename> </delete> </defaultrolloverstrategy> </rollingfile> but when try witho

python - Displaying of values on barchart -

Image
i've found couple of similar postings topic. wasn't helpful me. i'm relatively new python , seaborn. this code: import seaborn sns import matplotlib.pyplot plt %matplotlib inline x_axis = ["a", "b","c","d","e","f"] y_axis = [78.5, 79.6, 81.6, 75.4, 78.3, 79.6] plt.ylabel('accuracy') plt.title('accuracy of classifier') g=sns.barplot(x_axis, y_axis, color="red") i'm trying display values y_axis on top of every bar. loop through patches , annotate bars. import seaborn sns import matplotlib.pyplot plt %matplotlib inline x_axis = ["a", "b","c","d","e","f"] y_axis = [78.5, 79.6, 81.6, 75.4, 78.3, 79.6] plt.ylabel('accuracy') plt.title('accuracy of classifier') g=sns.barplot(x_axis, y_axis, color="red") ax=g #annotate axis = seaborn axis p in ax.patches: ax.annotate(

reactjs - Integrating Dispatch Actions in Container Component Pattern -

so i'm confused on how integrate container , component pattern. i've been reviewing examples morning , nothing seems clicking. how have been worked react on first project fetch data within view components , pass data down props using @connect works, in "automagically" way me @ time. import react; ... import {action} 'path/to/action.js'; @connect((store) => {return{ key: store.property}}); export class component{ componentwillmount(){ this.props.dispatch(action()); } } as i'm working more react want learn more "correct" way of building out redux , understand on deeper level happening. what have setup index.jsx (this renders of hocs) | app.jsx (container) | auth.jsx (component) | layout.jsx (component) - contains app content --or-- autherror.jsx (component) - 401 unauthenticated error page authentication handled through outside resource app not control logging in or out. there no