Posts

Showing posts from July, 2012

Refactoring using Java 8 -

i want refactor code using java 8, thought instead of using setter method this: class myservice{ user user = new user(); user.setname(response.getname()); user.setid(response.getid()); user.settype(response.gettype()); user.setdesignation(response.getdesignation()); } in service class. i made method in user pojo class user{ public static user create(response response){ user user = new user(); user.setname(response.getname()); user.setid(response.getid()); user.settype(response.gettype()); user.setdesignation(response.getdesignation()); return user; } } and in service class, wrote: list<user> userlist=reponselist.stream().map(user::create).collect(tolist()); is right way or better solution other this? have lot of setter methods in service. instead of creating static create method, define user constructor takes response , initializes that. class user{ public user(response response) {

javascript - Jquery on click function only works for the first row of data. -

i have table auto-generated data database , created using jquery. created using following tr variable appended main tbody : below code : var list = " <tr id='order_no_tr'><td id='order_no_td" + item.documentno + "'>" + item.documentno + "</td><td>" + item.progressstatus + "</td><td>" + newdate + "</td>\n\ <td><button type='button' id='cnfrmd_rcvd" + item.c_order_id + "' class='btn btn-default btn-sm cnfrmd_rcvd" + item.c_order_id + "' >confirm received</button>\n\ <input type='hidden' name='order_no_txt' id='order_no_txt" + item.c_order_id + "' value='" + item.c_order_id + "' class='order_no_txt" + item.c_order_id + " btn btn-primary'/>\n\ </td></tr>"; $("#order_no_tbody&quo

python view not working after deploying django app -

i attempting deploy new app using apache , mod-wsgi. app takes date provided in post request , plots graph , table specific time range. date appears set correctly using python internal (development) web server, fails when using apache/wsgi. issue appears view; # set initial date custom_date = [1, 1, 2015] def getcustomdata(request): global custom_date form = dateform() if request.method == 'post': custom_date[0] = (str(request.post['custom_date_day'])) custom_date[1] = (str(request.post['custom_date_month'])) custom_date[2] = (str(request.post['custom_date_year'])) date_reformat = datetime.datetime.strptime(str(custom_date[0]+' '+custom_date[1]+' '+custom_date[2]), '%d %m %y') chart_date = date_reformat.strftime('%-d %b %y') return render(request, 'custom_results.html', {'cdate': chart_date}) else: date_reformat = datetime.date

java - Project creation of silk4j getting "interface SpringProxy is not visible from class loader" -

Image
i got following error during creation of new silk4j project in eclipse. interface org.springframework.aop.springproxy not visible class loader looks indirect dependencies not imported can add explicitly in pom , try again <import-package> ... org.aopalliance.aop, org.springframework.aop, org.springframework.aop.framework, ... </import-package>

ios - App is rejected by apple -

my application been reject apple . have message me during review, app crashed on ipad running ios 9.2.1 , iphone running ios 9.2.1 when we: -launch app -logged in this occurred when app used: - offline - on wi-fi - on cellular network but working fine on simulator , ios devices . it dont know whats wrong . here crash reports http://a697.phobos.apple.com/us/r30/purple69/v4/f4/65/c0/f465c0c1-0261-7798-dca8-9b48c0de869a/temp..lfhkdwhz.crash?downloadkey3=1454075117_e097b43bf35613b18c897f3917dcd353 http://a401.phobos.apple.com/us/r30/purple49/v4/cb/6c/c8/cb6cc858-d47a-aba8-0a7c-1bf304c4c56f/temp..rhzbnjqi.crash?downloadkey3=1454075117_556853386b65ca6d799acd6f6ce64fac i dont know these crashes , how resolve them ? if have read apple instructions, said crashed on offline test. means while there no internet connection there not available. simply follow these steps: check internet reachability @ every place in app used after adding test app on device in app

jsf - <f:setPropertyActionListener> Parent is not of type ActionSource -

i pass value when click on table row: <h:outputlink id="lnkhidden" value="datacenterprofile.html" style="text-decoration:none; color:white;"> <f:setpropertyactionlistener target="#{datacenterscontroller.selectedid}" value="#{item.componentstatsid}" /> </h:outputlink> i error: <f:setpropertyactionlistener> parent not of type actionsource, type is: javax.faces.component.html.htmloutputlink@aa25b91 is there appropriate jsf tag can used replace <h:outputlink> ? the f:setpropertyactionlister works actionsource components h:commandlink , h:commandbutton . should use 1 of these if want way. see

Calculate the mean of specific cells of multiple csv files -

i have multiple csv files, same format. there columns object , columns values. example: .....animals | age .... dog 2 cat 4 dog 6 ....etc. and want calculate mean age of dogs in csv files. language easier use calculation? regarding implementation? done java , opencsv library.

html - How can I make a page with css,which the background image is cover , with scrolling and also responsive? -

i want make page,which scroll down ,the content div ,cover ground image.so put background image body , create 2 divs, works in big window size, when change size of window, , make smaller (to test responsive), there white gap between image , content div. would please me remove it? <html> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>first</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"> <link href="css/first.css" rel="stylesheet"> <style> body{ background: url("https://kalamarie123.files.wordpress.com/2012/03/img_

recursion - Oracle recursive hierarchical query with condition on the leaf level -

i want hierarchical query condition on leaf level. i query filter father - child relationships leaf level statisfies condition : id '3%' the table t : parentid,id insert t values ('vte', 'vtp'); insert t values ('vtp', '202'); insert t values ('ser', '606'); insert t values ('ser', '609'); insert t values ('gif', '301'); insert t values ('ech', '302'); insert t values ('pub', 'mer'); insert t values ('mer', '312'); insert t values ('mer', '313'); insert t values ('mer', '314'); insert t values ('mes', '318'); insert t values ('pub', 'pre'); insert t values ('pub', 'pap'); insert t values ('sta', '317'); insert t values ('niv', 'ans'); insert t values ('znm', '497'); insert t values ('znu', '496'); ins

Database design for junior football two divisions east/west with four teams in each division -

current design: gamestable : gameid, dmy, starttime, dayplayed, weeknumber, hometeamdivisionid, hometeamid, awayteamdivisionid, awayteamid, hometeampointsscored, awayteampointsscored, win-loss hometeamdivisiontable : hometeamdivisionid hometeamtable : hometeamid awayteamdivisiontable : awayteamdivisionid awayteamtable : awayteamid do need more tables, or different tables? initial observations you not need separate tables 'home team' , 'away team'. think it: have teams; these organized divisions; play games. in given game, 1 team home team , 1 team away team, different games, given team can home team or away team. given team belongs 1 division @ time. need design this: division : division id, name (...) team : team id, division id, name (...) game : game id, date played, start time, home team id, away team id, home team score, away team score (...) clearly, there constraints on values in game table, such 'home team id' not eq

How to block specific human looking user agent in nginx -

i have been having few problems spam , bots registering , these anti captcha systems not seem working. i have analyzed access logs , discovered user agents not used humans maybe because old... noticed there has been head / / post / attacks coming in web server using exact same string on user agents. possibly booters using same user agents spam/add bots. 216.151.139.172 - - [24/mar/2013:00:58:20 +0000] "get /index.php?action=verificationcode;vid=register;rand=12c64196f4558b2dff00db7ed3ee8ad9 http/1.1" 200 2189 "index.php?action=register" "mozilla/4.0 (compatible; msie 7.0; windows nt 5.1; trident/4.0; .net clr 1.1.4322)" "-" in nginx without blocking user agents, there anyway block string contained in useragent these bots can stop registering , advertising. "mozilla/4.0 (compatible; msie 7.0; windows nt 5.1; trident/4.0; .net clr 1.1.4322)" thanks reading. you can try this if ($http_user_agent = &qu

java - Sort a List by attribute but keep order of same attributes -

i have list this: {a[1], a[2], b[1], a[3], b[2], b[3], a[4]} whereas a,b attribute of object in list. numbers indicate the order of objects related each other same attribute. now, want sort list have following result: {a[1],a[2],a[3],a[4],b[1],b[2],b[3]} in concrete, means order of objects related each other object same attribute should stay same, general order should attribute. problem order related each other not determinable additional attribute, specified order in root list. how this? just use list.sort method sort elements based on attribute value. elements same attribute value remain in same order have been inserted. for instance: @test public void testsortlist() { list<element> list = new arraylist<>(); list.add(new element("a", 1)); list.add(new element("a", 2)); list.add(new element("b", 1)); list.add(new element("a", 3)); list.add(new element("b"

java - Syntax Error in PHP API -

i developing android app , need have php api in order app talk sql database. i having error parsing json on getjarrayfromstring(); i tried log actual error , follows: 03-24 15:41:12.175: e/justdealsutils(480): error parsing json on getjarrayfromstring(); org.json.jsonexception: value database of type java.lang.string cannot converted jsonarray 03-24 15:41:12.175: e/log_tag(480): failed data was: 03-24 15:41:12.175: e/log_tag(480): database query failed have error in sql syntax; check manual corresponds mysql server version right syntax use near 'bcode` '%%' , `btitle` '%%' , `bmodule` '%%'' @ line 1 now above log clarifies error lies in books.php api follows: <?php include("mysqlconnection.php"); header('content-type: application/json'); $from = $_post["from"]; $nr = $_post["nr"]; // variables search $title = $_post["title"]; $code = $_post["code"];

jquery jtable custom click event -

i have implemented jtable of jquery. want perform operation on row click , want put separate image , want add own click event on image. i want pass row's id custom event. how can add jquery table? i tried stuffs. loadgrid = (function () { //prepare jtable plugin $('#gridtablecontainer').jtable({ title: 'assets', paging: true, pagesize: 10, sorting: true, defaultsorting: 'modelname asc', actions: { listaction: '/adminsec/manageassets.aspx/list', createaction: '/adminsec/manageassets.aspx/createorupdate', updateaction: '/adminsec/manageassets.aspx/createorupdate', deleteaction: '/adminsec/manageassets.aspx/deletes' }, updaterecord: (function() { alert("my custom action.");

c++ template function overlading argument deduction with const argument -

i having following setup: template <typename t> void foo(t& t); void foo(const int& t); void f() { int i; foo(i); //unresolved reference "void foo<int>(int &)" foo(const_cast<const int&>(i)); //unresolved reference "void foo(int const &)" } in first call foo, compiler tries call template version, since argument of non-template 1 not match type of i . in second call non-template version called. using microsoft c++ compiler version 10. standard behavior? if type not matched, if has const modifier, template function called? edit: know 2 functions don't have definition, pointing out linker complains about, make more clear compiler wants call. is standard behavior? if type not matched, if has const modifier, template function called? yes, well-defined standard. if there no exact match, template used, because instantiated template version better match 1 requires conversion (even int &

Hibernate criteria with subquery in join -

is there way use criteria api sub query in join clause. have sql select ud.email email,ul.last_login last_login, ul.login_count login_count, fb_count, m_count user_details ud left outer join user_logins userlogins1_ on ud.user_id=ul.user_id left outer join (select count(feedback_id) fb_count,user_id user_feedback group user_id) uf on ud.user_id=uf.user_id left outer join (select count(mapid) m_count,user_id maps group user_id) m on ud.user_id=m.user_id order ud.email asc i saw criteria not support subquery in join support in select or clause. true? i not finding way form above rewrite other way. please help/suggest me how proceed simple answer is: can't. problem doing hibernate not know how map resultmof join since didn't created it.

asp.net - Is it possible to store an image in oracle 11g express edition? -

Image
is there other datatype allows image stored database? the list of data types appears in oracle 11g express edition shown in picture below. please help!! use blob. not legacy long raw.

android - SQLite: Getting value 0 from a query when insertions work correctly -

i have table notes (_id, title, body, category) , table categories (_id, name) , referencing category categories._id. with method create note in sqlite database. /** * create new note using title , body provided, , associated * category row id provided. if note created * return new rowid note, otherwise return -1 indicate failure. * * @param title title of note * @param body body of note * @param category category associated note * @return rowid or -1 if failed */ public long createnote(string title, string body, string category) { if (title == null || title.equals("") || body == null) { return -1; } else { contentvalues initialvalues = new contentvalues(); initialvalues.put(note_key_title, title); initialvalues.put(note_key_body, body); // if has associated category if (!category.equals("no category")) { cursor idcategory = fetchcategory(category); long catid = id

vb.net - How to calculate crc32 in psi/si packet -

we working on sending udp packets psi si. developing psi si generator. stuck on checksum crc32 - not able find check sum. tried on few code internet . comes checksum checksum doesnt match wireshark check sum . we have wireshark dump of psisi packets working correct checksum . can anyoone me in calculating checksum psi si ? regards, vipul i developing dvb-s head station , manipulating si-data ran same problem. solution read iso/iec 13818-1 , use right algorithm. iso/iec 13818-1 describes beginning of section of psi-table indicated pointer field in same transport stream packet payload. means, there pointer field in front of section data , pointer field must not put in checksum calculation. first byte of pointer field length of field data. in cases there no field data , find simple 0 in front of section data starts table id of section. don´t take 0 checksum calculation. mpeg´s crc 32 cyclic unreflected redundancy check starts 0xffffffff , takes highest bits first.

html - Delaying :hover using CSS? -

this question has answer here: delay :hover in css3? 3 answers i have menu in onhover apears infobox, telling button does. how can apply delay box apears let's 1 second after put mouse on button? html: <td class="info"><a id="login-edit_account" href="../login-edit_account.php">edit account<span><div id="pointer"></div><p style="font-size:11px">edit user's information.</p></span></a></td> css: td.info { position:relative; /*this key*/ z-index:24; background-color:#ccc; color:#000; text-decoration:none } td.info:hover { z-index:25;

PHP call to WCF - soap header issue -

i making php application , want use wcf service, working good. need make soap call, , set header this: <s:header> <a:action s:mustunderstand="1">getpage</a:action> <a:messageid>1</a:messageid> <a:replyto> <a:address>http://www.w3.org/2005/08/addressing/anonymous</a:address> </a:replyto> <a:to s:mustunderstand="1">http://someurl.com</a:to> in php file want make call have: $ns = 'http://www.w3.org/2005/08/addressing'; //namespace of ws. //body of soap header. $headerbody = array('messageid' => '1', 'action' => 'getpage', 'to' => 'http://someurl.com'); //create soap header. $header = new soapheader($ns, $headerbody); //set headers of soap client. $soapclient->__setsoapheaders($header); $getpageresponse = $soapclient->getpage($getpagerequest); when go logs of service, see mess

c++ - vc++ + QT translation of UI is not working -

i have project qt in vc++ , need locate string in ui different languages. created ui through qtdesigner in visual studio add in of visual studio 2012 , have installed qt plugin use qt features well. i have created .pro file , added: sources += main.cpp translations += languagefileqt_es.ts after generate linguist file sources emminensmultiportqt_es.ts , detected correctly strings in iu. after that, generate .qm file using release function of qtlinguist. my resources file is: <rcc> <qresource prefix="myappqt"> <file>languagefileqt_es.qm</file> </qresource> </rcc> then have added main.cpp: qtranslator translator; bool loaded = translator.load("languagefileqt_es"); qdebug() << "loaded " << loaded; a.installtranslator(&translator); and loaded returns true in cases. problem ui not translated when application executed. weird because has no effect. any clue missing or ch

java - Printing a 2D Array Combinations Without Duplicates -

i'm struggling print unique combinations 2d array hold same value. example 2d array [4, 4, 4, 4] [4, 4, 4, 4] possible unique combinations 0,1 0,2 0,3 1,2 1,3 could give pointers on how tackle this? you can avoid looping through array correctly: for (int = 0; < array.length; i++) { (int j = i+1; j < array.length[i]; j++) { // start j = i+1 avoid comparing same cells } }

Need to implement timer (with nature of variable time intervals) in an android application -

my edited code.here interval vector stores delays required , index initialized 0.i got mistake.this have been doing, public class mainactivity{ private int index; //some code , initializations public void starttimer{ index=0; private timer timer=new timer(); private timertask timertask=new mytimertask(); // timer.schedule(timertask,0,1000); //this line causing trouble } private class mytimertask extends timertask { public void run() { handler.postdelayed(new runnable() { int limit = interval.size(); @override public void run() { if (index < limit) { integer seconddelay = interval.get(k); log.e(tag, "index= " + index + " interval= " + seconddelay + " seconds"); //some code long delay = seconddelay * 1000; index++; handler.postdel

.htaccess RewriteRule is not working -

rewriterule new/$ /search.php?category=1 rewriterule new/\?(.+)$ /search.php?category=1&$1 i'm trying this, if following address link accessed, http://onlineshop.com/new/ http://onlineshop.com/new/?price_max=30 then open link, http://onlineshop.com/new/search.php?category=1 http://onlineshop.com/new/search.php?category=1&price_max=30 unfortunately not working way. a rewriterule won't naturally catch query string parameters, must use kind of .htaccess : rewritecond %{query_string} ^(.*)$ rewriterule ^new/$ /search.php?category=1&%1

uwp - Does x:uid work at design time or not? -

please tell us, possible load strings , other properties of control @ design time using x:uid in uwp? thanks & regards not possible, resource file values not applied @ design time.

How to change font style in Mediaroom PF application? -

in mediaroom pf application how can change font. in below code <mrml:tvlabel id="value1" runat="server" **fontstyle="reg16"** foreground="argb(255,235,235,235)" padding="rect(10,0,0,0)" style="position: absolute; top: 45px; left: 0px; height: 88px; width: 250px;" text="-" > you can't. can use predefined fonts available on stb/simulator. full list in files styles.xml , skin.xml. you can find definition this: <!-- fonts in system --> <constant name="tvreg" value="fonts/segoealtmrsb.ttf"/> <constant name="tvbold" value="fonts/segoealtmrb.ttf"/> <constant name="tvitalic" value="fonts/segoealtmrsbi.ttf"/> <constant name="tvbolditalic" value="fonts/segoealtmrbi.ttf"/> <constant name="tvheader" value="fonts/segoealtmrb.

pywin32 - Cannot get python scripting working under WSH -

i'm trying wsh run python .pys scripts , i'm hitting wall - i've tried on 2 machines now, w7x64 , server2012, same result both time, cscript comes with: cscript error: can't find script engine "python" procedure (all happening under local admin account): installed python 3.5.1 (x86) installed pywin32 (x86) mark hammond's sourceforge ran \site-packages\win32comext\axscript\client\pyscript.py, returns 'registered: python' check registry/hkcr - lots of references pys , python, expected try run >cscript hello.pys get cscript error: can't find script engine "python" any clues? don't want use activepython.

maven - ServerConfig is unsupported by arquillian -

using arquillian unittest , integration test of ejb in wilfly 8 application server. arquillian fails recognize property "serverconfig" choose server start configuration , missing in supported property names, starting configuration of "standalone.xml" in need run "standalone-full.xml", below warning capture while start test , supplied pom.xml , arquillian.xml, there dependency missing overcome this? warning [org.jboss.arquillian.container.impl.mapobject] configuration contain properties not supported backing object org.jboss.as.arquillian.container.embedded.embeddedcontainerconfiguration unused property entries: {serverconfig=standalone-full.xml} supported property names: [managementaddress, modulepath, password, bundlepath, managementport, jbosshome, managementprotocol, cleanserverbasedir, username] arquillian.xml <arquillian xmlns="http://jboss.org/schema/arquillian" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"

php - How can solve fetal error while adding action? -

Image
how can remove fatal error applying following code controller.php public function actionuser() { $model= new userform(); if($model->load(yii::$app->request->post()) && $model->validate()) { //lates wirite later }else{ return $this->render('userform',['model'=>$model]); } and userform models code: class userform extends model { public $name; public $email; public function rules() { return[ [['name','email'],'required'], ['email','email'], ]; } } and views code: use yii\helpers\html; use yii\widgets\activeforms; $form=activeform::begin(); echo $form->field($model,'name'); echo $form->field($model,'email'); echo html::submitbutton('submit',['class'=>'btn btn-success']); }

Finding midpoint between one observation and another in R -

i have data on bird parental care , cannot work out how information require them. i need take midway between last observation parent (4) , first observation when parent not family (3 = female care only, 2 = male care only), eg: date parent chick age 509 4 0 510 2 1 515 3 6 516 3 7 517 no chicks so above set of data find: duration of male care duration of female care can me understand how go doing this? in advance , please feel free ask me clarify things if way i've worded doesn't make sense, i'm new r! assuming there's single dataframe per chick , there's 1 care transition family male or female, calculation done follows: male_care_duration = min(chicks[chicks['parent']==2,]$datestamp, na.rm=true) - max(chicks[chicks['parent']==4,]$datestamp, na.rm=true)

c# - Multiply value from textbox with combobox and display in label in WPF -

i'm pretty new programming in wpf xaml , c# , i've searched forum similar problem, couldn't find solution problem. i've made combobox of 3 items, each item has text content. when 1 of these items selected, want multiply value in textbox number , display result in label. here code: public mainwindow() { initializecomponent(); int = int32.parse(weight.text); double b; if (this.wcf.selecteditem==weighing) { b = * 1.03; wll.content = b.tostring(); } else if (this.wcf.selecteditem == uptodate) { b = * 1.1; wll.content = b.tostring(); } else if (this.wcf.selecteditem == lessupdated) { b = * 1.2; wll.content = b.tostring(); } } "weight" name of textbox, "wcf" name of combobox, "weighing", "uptodate" , "lessupdated" name of combobox items , &qu

amazon dynamodb - Error when creating items AWS Lambda to DynamDb with python -

i trying create new item in table , every time run following code: from __future__ import print_function decimal import * import boto3 import json def my_handler(event, context): marker = event['m'] latitude = decimal(event['lat']) longitude = decimal(event['lon']) tableminfo = 'minfo' client = boto3.client('dynamodb') client.put_item( tablename = tableminfo, item = { 'marker':{'n' : marker}, 'latitude':{'n' : latitude}, 'longitude':{'n' : longitude}, } ) success = "success" return {'success' : success} with following test parameters in lambda { "m": 1, "lat": 52.489505, "lon": 13.389687 } i receive error on following lines: 17, "my_handler", "'longitude':{'n' : longitude}," you must update value

r - Replace all numbers in a df by median -

i replace numbers in df median of row, maintaining na values. input: df <- 'pr_id sample1 sample2 sample3 median ax-1 na 120 130 125 ax-2 na na na na ax-3 na na 196 196' df <- read.table(text=df, header=t) this expected output: df <- 'pr_id sample1 sample2 sample3 ax-1 na 125 125 ax-2 na na na ax-3 na na 196' df <- read.table(text=df, header=t) some idea accomplish that? a possible base solution indx <- which(!is.na(df[-1]), arr.ind = true) # find non-na incidents df[-1][indx] <- df$median[indx[, "row"]] # replace them while subsetting accordingly df$median df # pr_id sample1 sample2 sample3 median # 1 ax-1 na 125 125 125 # 2 ax-2 na na na na # 3 ax-3 na na 196 196 and bonus, if don't have medians y

c# - datagrid binding not working for one datagrid but is for another -

Image
i have datagrid (image below). you see in row details there 3 other datagrids. bindings work 2 of them not 1 rather annoying. the datagrid isn't working a) not showing value column sedol when should & b) doesn't allow me edit or click cells. object bound isn't null datagrid working bound same object. don't see why datagrid binding isn't working? class holdingeq please note have stripped out of code. class implements inotifypropertychanged interface , properties have public class holdinglogeq : inotifypropertychanged { public datetime dateeffective { { return _dateeffective; } set { _dateeffective = value; onpropertychanged("dateeffective"); } } public secruityid security { { return _security; } set

onclick - html div: opaque, but allowing click to reach element behind -

i want make flicking div (alternating display:none) in front (z order) of element, if user clicks element in exact moment div appearing, div receives click, not element. how can make div transparent clicks? is, can ignore clicks onclick event goes element behind div? use pointer-events: none; : div {width: 150px; height: 150px; background: #eee; position: relative; margin: 0} div:hover {border: 1px solid black} #over {width:50px; height: 50px; position: absolute; background: red; top: 55px; left: 55px; pointer-events: none} <div onclick="alert('click caught')"></div> <div id="over"></div>

Learning to rank using Lenskit -

i using lenskit framework learning rank problem. have issue have never seen reporting. when compare performance of funksvd , popularity baseline on whole universe of items, popularity baseline outperforms funksvd. think cased fact popular items rated more often, while not mean users popular items. limited number of candidate items evaluation n popular ones. result, performance of funksvd increased, since algorithm has less opportunity make mistake. funksvd outperformed popularity. however, have issue. random baseline beats both funksvd , popularity! guess that's because chance make mistake low, conduced. there way make funksvd perform better popularity , random? doing wrong? problem in framework? has encountered problem? how measuring performance? key thing make significant difference. also, funksvd has number of parameters must tuned in order have performance. default values may not data set. diagnosing going wrong specific experiment seems better handled in le

ruby on rails - ActiveModelSerializer conditional association rendering -

in spree api application, want render associated comments of product if user admin . else render product detail. i'm using 0.10.0.rc2 of active_model_serializers gem 'active_model_serializers', '~> 0.10.0.rc2' i'm overriding product serializer of spree follows: spree::productserializer.class_eval attributes :stock_available has_many :comments, serializer: myapplication::commentserializer # http://www.rubydoc.info/gems/active_model_serializers#associations def filter(keys) # <--- option 1 keys.delete(:comments) unless scope.admin? keys end def include_comments? # <--- option 2 scope.admin? end end here comments polymorphic table. none of 2 option seems working. idea whats wrong here? i went through railscast episode on active-model-serializer. doesn't seems working here. also strange thing is, when put binding.pry in either of these 2 methods, request @ /api/products/:id doesn't pause @ bindi

html - css background-image doesn't work on table object -

in django app put background image in table. problem image doesn't show. code: <table style="background-image: url('/static/assets/img/myimage.png') ;background-position: 0 100% !important;background-repeat: repeat-x ;background-size: 40px 3px"> hello! </table> if put same css style in div object work. eg: <div style="background-image: url('/static/assets/img/myimage.png') ;background-position: 0 100% !important;background-repeat: repeat-x ;background-size: 40px 3px"> hello! </div> where mistake? lot help edit1 i insert email html file in django template. use 'include' , works image doesn't works background-image style. image location correct (if use 'div' , not 'table' works). have bootstrap edit2 this complete code. in table don't see background image <!-- ======= section ======= --> <table border="0" width="100%" cellpadding="0&q

javascript - Changing global Variable from within function -

here im having bit of issue simple script ive written up. aim script reduce given number 1 each time button clicked. cannot appear this.. global variable being number=100 doesnt appear change, or change more once.. apologies not being able explain well. here part im working on..: <script> var number = 100; // number want changed , keep changing each button click function outcome() { // button calls function number = number - 1; // tries change global number.. :/ } document.write(number); // has number written in document </script> yes, conceptually right. not calling function, @ least not before writing number document. btw, number global reference number constructor should use variable name, lowercase @ best. var num = 100; function outcome() { num--; } outcome(); document.write(num); // 99 or <script> var num = 100; function outcome() { num--; alert(num); } </script> <button onclick="ou

phpmailer - Can not send email with php mailer using gmail account -

here cannot send email phpmailer using gmail account. sample code: <?php require_once('phpmailerclass/class.phpmailer.php'); $mail = new phpmailer(); $mail->issmtp(); $mail->mailer = 'smtp'; $mail->smtpauth = true; $mail->host = 'smtp.gmail.com'; $mail->port = 568; $mail->smtpsecure = 'ssl'; $mail->username = "myemail@gmail.com"; $mail->password = "mypassword"; $mail->ishtml(true); // if going send html formatted emails $mail->from = "ramalingam.p@pickzy.com"; $mail->fromname = "ramalingam"; $mail->addaddress("yoursramalingam@gmail.com","luu van minh"); $mail->subject = "testing phpmailer localhost"; $mail->body = "hi,<br /><br />this system working perfectly."; if(!$mail->send()) { echo "message not sent <br />phpmailer error: " . $mail->errorinfo; } else { echo "mes

javascript - ng-repeat track by id working,how to filter in ng-repeat -

this js code list of json array, kept in scope model , used in html binding.. var app = angular.module('starter', []); app.controller('customersctrl', function($scope) { $scope.response = [{ "__type": "corstest.salesvisit", "empid": null, "svid": "1", "svtargetcrowd": null, "svcompanyname": "software solutions", "svservice": null, "svdomain": null, "svownname": "name", "svcontactno": "9882563143", "svemailid": null, "svstatus": "prospective", "svnvdate": null, "svcomments": null, "svvisitname": "brand", "status": null }, { "__type": "corstest.salesvisit", "empid": null, "svid": "2", "svtarg

Argument of Enum type only Python -

i have simple piece of python code, have number of enums defined this: import sys time import sleep enum import enum class bw(enum): lte1p4 = 0 lte3 = 1 lte5 = 2 lte10 = 3 lte15 = 4 lte20 = 5 i want member functions of class accept enum type argument , script should not run otherwise, here main class: class breithorn: def __init__(self): self.rx_settings = {} self.tx_settings = {} def rx_bw(self,bw): self.rx_settings['bw'] = bw i want member function accept these kind of calls: breithorn.rx_bw(bw.lte5) and reject (syntax error) these kind of calls: breithorn.rx_bw(44) can explain how this? you cannot make syntax error, discovered in parsing process, @ point parser has no idea symbols bound to. you can check type @ runtime in function , raise exception. python uses duck typing, discover these kind of problems need unit or