Posts

Showing posts from May, 2010

tachyon - Running HBase on top of Alluxio -

has succeeded running hbase on top of alluxio? there no wiki on alluxio's webpage related matter...no lucky google result neither! my environment is: hadoop 2.6 hbase 0.98.20 alluxio 1.1.0 edit java.io.ioexception: alluxio.exception.filedoesnotexistexception: path /hbase/data/hbase/meta/.tabledesc not exist best got far...

XSLT - moving nth first child as first and placing the rest of its childrens -

iam trying transform reference xml other dtd specific input: <ref> <a>text</a> <b>text</b> <c>text</c> <d>text</d> </ref> xslt: <xsl:template match="ref"> <ref> <h> <xsl:apply-templates select="./a"/> </h> <g> <xsl:apply-templates /> </g> </ref> </xsl:template> <xsl:template match="ref/a"> <a> <xsl:apply-templates /> </a> </xsl:template> output derived: <ref> <h> <a>text</a> </h> <g> <a>text</a> <b>text</b> <c>text</c> <d>text</d> </g> </ref> desired output: <ref> <h> <a>text</a> </h> <g> <b>text</b> ...

java - Not able to DEBUG on JBoss -

i have application in upon hitting url, need debugging do. after long struggle(but once) able debug. again tried second time local server giving me following logs!! can tell me went wrong second time? , how can fix it? edit: using red hat jboss enterprise application platform - version 6.4.0.ga 14:36:28,583 warn [org.jboss.modules] (http-/0.0.0.0:8080-1) failed define class com.mmm.common.util.io.mmmurlstreamhandlerfactory$myhttphandler in module "deployment.snaps-ear-prod-3.13.1.1-snapshot.ear.snaps-web-prod-3.13.1.1-snapshot.war:main" service module loader: java.lang.linkageerror: failed link com/mmm/common/util/io/mmmurlstreamhandlerfactory$myhttphandler (module "deployment.snaps-ear-prod-3.13.1.1-snapshot.ear.snaps-web-prod-3.13.1.1-snapshot.war:main" service module loader) @ org.jboss.modules.moduleclassloader.defineclass(moduleclassloader.java:487) [jboss-modules.jar:1.3.6.final-redhat-1] @ org.jboss.modules.moduleclassloader.loadclass...

sql - Big query to find row count for unique visit where purchase is null -

i have table visit_num visid_high visid_low visit_page_num purchase 1 123 456 1 null 1 123 456 2 12 2 123 556 1 null 2 123 556 2 null 2 123 556 3 null 2 123 556 4 null and wanted count of rows unique visit_num+visid_high+visid_low purchase null. here, visit_page_num id of page user visited , visit defined concatenation of visid_high, visid_low , visit_num. have written query row count purchased null, below big query statement select count(unique(concat(string(visid_high), string(visid_low), string(visit_num)))) visits, table_name purchased null and found row count 2, wrong, should 1. query gives row count below row well. visit_num visid_high visid_low visit_page_num purchase 1 123 456 ...

swift - Set UIView height to fit UILabel subview using autolayouts -

Image
what try do i have custom uiview uilabel subview in it. want uiview wrap uilabel height , set it´s height depending of text length. uilabel resizing it´s height correctly when adding text label.text. far good. problem the uiview not adjusting height uilabel content. text should inside white uiview below. should possible solve constraints, correct? can´t right though. can done purely storyboard or have manually set uiview height in code? the result: try setting content hugging property of uilabel superview in interface builder 1000:

Use a KNN-regression algorithm in R -

i working on using k nearest neighbours variable identified(test) determining value of same variable of individual value non-identified(test). 2 possible approaches can done then: first(easy one), calculate mean value of variable of k individuals; second(best one), calculate weighted distance value according proximity of individuals. my first approach has been using knn.index function in fnn package identifying nearest neighbours, , using indexes, values in dataset mean. working slow, dataset quite big. there algorithm implemented calculation faster, , possible add weights according distance? after week of trying solve problem, found function in r solving question, might others have strugled same issue. the function named kknn , , in package kknn . lets knn regression, weigthing points distance.

jquery - Making a Web Banner Responsive -

so created web banner using divs , jquery. wondering if there way make more responsive. uses % , scale default letters "hf" drawn in different color. if scales word hf , banner height changes. there solution make more scalable. right works 2736 x 1824. i don't think code if want please ask, thanks! jsfiddle showing problem . my js: $(function() { $('body').hide().fadein('slow'); $('.squarecolour').hover( function(){ $(this).animate({'backgroundcolor': 'rgb(207,3,114)'},400); }, function(){ $(this).animate({'backgroundcolor': 'rgb(78,76,80)'},400); } ); $('.squarecolourhf').hover( function(){ $(this).animate({'backgroundcolor': 'rgb(202,212,0)'},400); }, function(){ $(this).animate({'backgroundcolor': 'rgb(253,198,0)'},400); } ); }...

node.js - trying to use lucene search with nodejs and mongodb -

i trying learn lucene build robust search mechanism mean stack application but have understood conceptual part apache solr these series of videos https://www.youtube.com/watch?v=zh_ayqkg0wc&index=3&list=pljbe6j2eg1pz7yfu05bcqdv5bdkko75nq but not sure how start implement it as of source have refereed use java , have few confusions like *what lucene , solr ie both mean same *if want build search mechanism how should use them *do have npm module in performing search can please refer source search mongodb nodejs , lucene stack how build module (mechanism) perform search on mongodb collections what lucene , solr ie both mean same lucene search library built in java. solr web application built on top of lucene. solr = lucene + added features. lucene: apache lucene high-performance, full-featured text search engine library written entirely in java. technology suitable application requires full-text search. solr: solr major features include powerfu...

amazon web services - How do I find the password for root user in EC2 instance? -

some permissions broken on server, , have lost ability use sudo . need su , change permissions, when su , asked password. never set password root user... can find password? most of ami's not use passwords on root user i've noticed. your best bet detach ebs file system , mount on instance can go in , fix authorized_keys files or /etc/sudoers or whatever appropriate resolve problem. once fixed, can unmount , detach it, reattach old instance mounts / again. see answer info how access filesystem fix things: add keypair existing ec2 instance

php - how to implement escrow with paypal EURO currency in codeigniter? -

i new in paypal escrow. try use escrow in website.for seller , buyer freelancer work. so how implement escrow in codeigniter website? using paypal , currency euro check here adaptive payments fit use case, flow consider " delayed chained payments ", implement escrow , fund release once service delivered.

c# - Create drop down list from List ASP.NET MVC -

i have typed view model , in 1 of class object passing list of options need present in @html.dropdownlist view model public class createcampaign_vm { public marketingcampaign marketingcampaign { get; set; } public list<marketingcampaigntype> marketingcampaigntype { get; set; } } controller method private createcampaign_vm getcampaignobject() { createcampaign_vm _campaignobject = new createcampaign_vm(); _campaignobject.marketingcampaigntype.add(new marketingcampaigntype { campaigntypeid = 1, campaigntypetitle = "email", description = "email" }); _campaignobject.marketingcampaigntype.add(new marketingcampaigntype { campaigntypeid = 2, campaigntypetitle = "text", description = "text" }); _campaignobject.marketingcampaigntype.add(new marketingcampaigntype { campaignty...

linux - When should the option RemainAfterExit needs to be set true when creating new systemd services? -

i trying write few services. of them have 'type' option set oneshot. still confused when option 'remainafterexit' needs set true. (not service needs active after exiting). use remainafterexit=yes services, somehow change state of system. when want state reverted, stop service. can start again, not without first stopping it. example service creates flag in filesystem used other application. on start, create flag file, exists, service kept active systemd. can stop , remove flag file. use remainafterexit=no services, action, not change state of system. example service cleanup /tmp . start it, work , inactive (no need stop it). , can start again anytime , again work (cleanup).

sql - Sum of similiar columns for each row -

i have table below doctor_id forename surname email ... 1 jon doe jon@doe.com ... 2 john dove john@dove.com ... 3 jane dane jane@dane.com ... 4 foo bar foo@bar.com ... 5 bar foo bar@foo.com ... please consider table has 10 more columns. i have set of data (forename = "jon", surname="doe", email="foo@bar.com", etc.) i want check each row number of columns have same value columns in set of data doctor_id forename surname email ... similiarities 1 jon doe jon@doe.com ... 2 2 john dove john@dove.com ... 0 3 jane dane jane@dane.com ... 0 4 foo bar foo@bar.com ... 1 5 bar foo bar@foo.com ... 0 and choose rows number of similiarities greater 3. does want? select t.*, ((cas...

asp.net web api - Webapi and Sessions -

i trying add sessionstate existing asp.net application. have added httpcontext.current.setsessionstatebehavior(sessionstatebehavior.required) to global.asax file each time make call api, new session created. here how trying view session var session = httpcontext.current.session; if (session != null) { if (session["testsession"] == null) { session["testsession"] = "session exists" } return "testsession: " + session["testsession"]; } return ("no session"); just wondering if else has encountered problem, using session state sqldatabase store session

Spring Security: disable https for some urls -

i have 3 maven modules: "controller a" - spring boot web app, "/a/*" urls "controller b" - spring boot web app, "/b/*" urls "common" - shared spring security configuration and want "/a/ " use https , x509 , "/b/ " use http without security (or kind of security - jwt example). my current version is: public class securityconfig extends websecurityconfigureradapter { @override protected void configure(httpsecurity http) throws exception { http.authorizerequests() .antmatchers("/a/**").authenticated() .and() .x509() .and().csrf().disable(); } @override public void configure(websecurity web) throws exception { web.ignoring().antmatchers("/b/**"); } } it still runs b on https , required auth. possible configure want without creating separate security configuration? when us...

android - How to Access newly added view from linearlayout manager -

i making chat application . have layout manager extends linearlayoutmanager , want compute height of view added adapter when call smoothscrolltoposition() change scroll speed. for more height make milliseconds_per_inch smaller value , less height make large. but not able calculate height of newly added view. public class smoothlinearlayoutmanager extends linearlayoutmanager { private chatadapter mchatadapter; private context mcontext; private final float milliseconds_per_inch = 250f; public smoothlinearlayoutmanager(context context,chatadapter adapter) { super(context); mcontext = context; mchatadapter = adapter; } public smoothlinearlayoutmanager(context context, int orientation, boolean reverselayout) { super(context, orientation, reverselayout); mcontext = context; } public smoothlinearlayoutmanager(context context, attributeset attrs, int defstyleattr, int defstyleres) { super(context, attrs, defstyleattr, defstyleres); mcontext = context; }...

javascript - Explode textbox comma seperated into individual textbox's -

hi i'm trying explode text box 5 individual text box's. current result <input name="textfield" type="text" id="textfield" value="2, simon feld, 1968, tas" size="40"> desired result <input name="textfield" type="text" id="textfield" value="2" size="40"> <input name="textfield" type="text" id="textfield" value="simon feld" size="40"> <input name="textfield" type="text" id="textfield" value="1968" size="40"> below can find working example , fiddle function makeseperateinputs() { var arrofvalues = $('#textfield').val().split(','); for(var i=0, len = arrofvalues.length; < len; i++) { $('body').append('<input name="textfield" type="text" id="textfield' + + '" value...

SilverStripe CMS custom css -

when set css class cmsfield ->addextraclass("my-class"); , css file can edit set styling new css class? the way see editing either css files in framework or cms folder, rather avoid doing. is possible include link custom css stylesheet in cms area can place css code? you can load custom stylesheet cms adding following config.yml file: leftandmain: extra_requirements_css: - mysite/css/mystyle.css

onclick not working on Android Emulator (ionic framework) -

steps: 1. ionic start hello blank add button index.html <ion-content> <button class="button" onclick="javascript:alert('x');">try click</button> </ion-content> inside hello dir: ionic run android click 'try click' button. nothing happens. info: emulator: android 4.4.2 api 19 change ng-click , in general better call function. you should separate logic views. example html <div ng-controller="logincontroller"> <ons-button ng-click="yourfunction()">click me!</ons-button> </div> js .controller('somecontroller', function () { $scope.yourfunction = function () { console.log("x triggered"); alert('x'); } }

angularjs - Add an element in angular js -

i looking way insert items inside elements in angular js. ill try show how is. <item1> </item1> insert item this <item1> <item2> </item2> </item1> it should insert data require (it means must execute template of item2 when initialize). i want insert items dynamically , while press button new element inserted item1. new 1 of different type type2 , should inherit propertys , attributes of it's kind (item3, item3.. , on). you can achieve using ng-include . <item data-ng-include="'partials/your-template.html'"></item> and attach own controller if needed. <item ng-controller="yourctrl" data-ng-include="'partials/your-template.html'"></item> you can create custom directive floribon advice, use ng-repeat, ng-bind-html... update comment use ng-show in case <item ng-show="isclicked">{{data}}</item> <button ng-click=...

r - Labelling issue after using gap.plot to create an axis break -

Image
i've been struggling plot shows data accurately, , spent while getting gap.plot , running. after doing so, have issue labelling points. just plotting data ends this: plot of abundance data, 2 different tiers of data @ ~38,000, , between 1 - 50 as can see, doesn't show either top or bottom sections of plots enough distinguish anything. using gap plot, managed get: gap.plot of abundance data, 100 - 37000 missed, labels appearing on lower tier the code 2 plots pretty simple: plot(counts.abund1,pch=".",main= "repeat 1") text(counts.abund1, labels=row.names(counts.abund1), cex= 1.5) gap.plot(counts.abund1[,1],counts.abund1[,2],gap=c(100,38000),gap.axis="y",xlim=c(0,60),ylim=c(0,39000)) text(counts.abund1, labels=row.names(counts.abund1), cex= 1.5) but don't know why/can't figure out why labels (which letters points denote) not being applied same in 2 plots. i'm kind of out of depth trying bit, little idea how p...

php - Symfony form theme flat items -

i have nested object collectiontypes , subforms needed database mapping. in frontend want output fields on same html tree. add div around subforms , collection types. here theme {% block form_row %} <div class="form-item" {{ block('widget_container_attributes') }}> {{- form_label(form) -}} {{- form_errors(form) -}} {{- form_widget(form) -}} </div> {% endblock %} {%- block form_widget_compound -%} {%- if form.parent empty -%} {{ form_errors(form) }} {%- endif -%} {{- block('form_rows') -}} {{- form_rest(form) -}} {%- endblock form_widget_compound -%} example object: username email contact (one-to-one) firstname lastname contactaddresses (one-to-many) address ( many-to-many ) street number zip as have multiple object in project , want use same form theme all. how can detect if subform or collectiontype not render added div in form_row . first thought compound parameter looked compo...

cryptography - Import issue with Python six library -

inside virtualenv have lot of libraries use six dependency paramiko , python-keystoneclient raise import error: error:paramiko.transport:unknown exception: cannot import name urllib_parse error:paramiko.transport:traceback (most recent call last): error:paramiko.transport: file "/.../lib/python2.7/site-packages/paramiko/transport.py", line 1772, in run error:paramiko.transport: self.kex_engine.parse_next(ptype, m) error:paramiko.transport: file "/.../lib/python2.7/site-packages/paramiko/kex_group1.py", line 75, in parse_next error:paramiko.transport: return self._parse_kexdh_reply(m) error:paramiko.transport: file "/.../lib/python2.7/site-packages/paramiko/kex_group1.py", line 111, in _parse_kexdh_reply error:paramiko.transport: self.transport._verify_key(host_key, sig) error:paramiko.transport: file "/.../lib/python2.7/site-packages/paramiko/transport.py", line 1617, in _verify_key error:paramiko.transport: key = self._k...

google project tango - ADF Inspector results -

i'm looking @ analysing quality of area learning project tango. there anyway save results of adf inspector (quality , number of successful matches) or method of obtaining results of how effective area learning is? currently, there's no api let query quality of adf. can sort of derive quality of adf based on user's movement. if user has observed directions of environment, consider adf decent. unity areadescriptionmanagement example shows how achieve application level.

javascript - Object length in typescript? -

this question has answer here: length of javascript object 30 answers is there way in typescript can length of object: something this: say have object: public customer:any={ "name":"bhushan", "eid":"879546", "dept":"it" } now trying length in typescript. ie. when doing customer.length() , should able value 3 has 3 elements. i tried object.getownpropertynames(customer.value) returning 2 whereas have 3 elements in object. any inputs? you try following: object.keys(customer).length

javascript - Webpack cannot find module -

i'm new on webpack , i'd use third party react component in project. installed componet need , dir node_modules created , project's tree like: reactcalendar |--node_modules | |--.bin | |--babel-cli | |--babel-core | |--babel-preset-es2015 | |--babel-preset-react | |--babelify | |--file-loader | |--moment | |--react | |--react-big-calendar (the third party component) | |--react-dom | |--webpack |--.babelrc |--bundle.js (empty) |--index.html |--index.js |--package.json |--webpack.config.js some file used browserify gave me same error... my index.html this: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>react calendar</title> <script src="bundle.js" type="text/javascript"></script> </head> <body> <div id="content"></div> </body> </html...

VB.Net Datagridview Add quantity existing value -

i have indexed unbound datagridview. i'm trying add quantity + , stands existing quantity plus . eg.:- itemcode 001 luxsoap quantity 10 . again, want add same product quantity 10. if added cells total become 20. how achieve functionality? i'm using vb.net unbound datagridview. here code:- dim rnum integer = dgvsale.rows.add() dgvsale.rows.item(rnum).cells("itemcode").value = txtsalebarcode.text dgvsale.rows.item(rnum).cells("prname").value = txtsaleitemname.text dgvsale.rows.item(rnum).cells("price").value = txtsaleprice.text dgvsale.rows.item(rnum).cells("grqty").value = txtsaleqty.text dgvsale.rows.item(rnum).cells("amnt").value = txtsaleamount.text dgvsale.rows.item(rnum).cells("invnum").value = txtinvno.text dgvsale.rows.item(rnum).cells("gstamnt").value = gstcollect.text 'dgvsale.rows.item(rnum).cells("qtyinhand").value = lbldisplayqtyinhan...

scala - Is there a way to forbid overriding a member in a mixin? -

so, have bunch of stackable traits defined, this: trait base { val prefix: string = "" def foo = "" } trait foo extends base { override def foo = prefix + "/foo" + ";" + super.foo } trait bar extends base { override def foo = prefix + "/bar" + ";" + super.foo } class bat extends foo bar { override val prefix: string = "bat" } new bat().foo the above returns bat/bar;bat/foo , want. now, problem is, of course, there can 1 instance of prefix , and, if 1 of mixins tries override it, won't work, because 1 defined in bat "trumps" it. ok, except, "won't work" thing explicit. can think of kind of trick, make attempting override prefix in trait rather in class inheriting cause compilation error? you can split trait in 2 , leverage explicitly typed self-references , this: trait base { def foo = "" } trait prefix { val prefix: string = "...

javascript - jQuery TimeSlider refreshing cells -

i using timeslider component: https://github.com/v-v-vishnevskiy/timeslider demo: http://v-v-vishnevskiy.github.io/timeslider/demo/demo.html i trying change start_timestamp of slider: <div id="c1" class="timecell" start_timestamp="1468231842698" stop_timestamp="1468239761464" style="left:503.0011225231481px;width:167.63221081018517px;background-color:#76c4ff;">2:11:58</div> by using $('#c1').attr('start_timestamp', '14682310000'); but problem slider won't update until move dragging. anyone have idea on how update slider same time update attribute? you can add/edit cell doing: $("#slider123").timeslider("edit", cell); also adding, toggling, editing, removing, removing cells , shifting time slider starts. using "add", "toggle", "edit", "remove", "remove_all" , "new_start_timestamp" respecti...

xml - Android: Changing layout in same activity -

in application's main layout have button of search task. when user clicks button want change layout xml file search_layout.xml. don't want create new activity search task , want use activity_main.java class coding. how inflate search_layout existing activity_main.xml . my activity_main layout coordinating layout collapsing toolbar , recycler view. in search_layout.xml have simple relative layout. so how deal ? i searched everywhere how inflate view adding existing view. in case want totally change view. thanks you can have @ this question , but, not practice follow , should consider using fragment or other mechanism. doing cluttering activity 's logic search logic.

javascript - Are these 2 lines of code the same ? JS vs Ruby -

in ruby: -> { 10.times {|i| puts i} }.call javascript: (function (){ (i = 0; i<10; i++){ console.log(i); } })() im coming js background , peaked interest when learning lambdas , procs says function without names called. reminded me of anonymous functions or iife in javascript. are these 2 examples same? if not difference ? these 2 lines different in every aspect. the closest ecmascript equivalent ruby snippet: -> { 10.times {|i| puts i} }.call would this: (() => { 10.times(i => puts(i)) }).call() unfortunately, numbers can't have methods in ecmascript, have resort this: (() => { times(10, => puts(i)) }).call() obviously, in order work, need add ruby library support code: (() => { times(10, => puts(i)) }).call() function times(i, f) { if (i-- === 0) return; else { times(i, f); f(i) }} function puts(s) { console.log(s) } that's still not alike original ruby seman...

java - Selenium: -browser.helperApps.neverAsk.openFile and savetodisk is not working -

i have critical issue on here. please find scenario below: login click on link after click, new tab opens i have switched focus new opened tab following code arraylist<string> newtab = new arraylist<string>(driver.getwindowhandles()); driver.switchto().window(newtab.get(1)); the issue when try click on excel download link on newly opened tab, "open with" popup appearing , automation fails. after adding following preference firefoxprofile.setpreference("browser.helperapps.neverask.openfile", "text/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); firefoxprofile.setpreference("browser.helperapps.neverask.savetodisk", "text/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); please, can suggest feasible solution possible? thank you please manually set these preferences in firefox's( about:config ) section, visit application, click link , see if file gets downloaded without prompt. ...

androidhttpclient - How to send and receive data from ASP.NET server to Android -

i want make biometric e-voting system.a voter register , cast vote through android app , other activities handled in asp.net server.here want know how send , receive data asp.net server android simply put: set restful api in asp.net server. , in android app, consume java (native app) or javascript (html app).

Python to SQL Server connection -

i'm using python 3.5.1 anaconda package 2.4.0 , try make connection local sql server (2008 r2) so doing next things: import pypyodbc connection_string =pypyodbc.connect('driver={sql server};server=pc\mssqlserver,1433;database=localbase;uid=name;pwd=pass') connection_string=connection_string.decode(encodind='utf-8',errors='replace') after manipulations, receive error: 'utf-32-le' codec can't decode bytes in position 0-1: truncated data why's , should perform avoid , run connection properly? you seem have misunderstood "connection string" is. text string pass to .connect method, not returned from .connect method. (what gets returned connection object.) so, need more this: import pypyodbc connection_string = "driver={sql server};server= ...(and on)..." conn = pypyodbc.connect(connection_string) crsr = conn.cursor() crsr.execute("select stuff tablename") # etc.

excel - Add-in SelectChange() event -

i created add-in has user form. in user form have display info selected cell, when add selectchange() event works, when create add-in version doesn't work because add in "has own workbook", select change working in add-in file , not in active workbook or worksheet... so, right? there way use selectchange() event in add-in reads info active sheet? something this, not tested public withevents objexcel excel.application public withevents objwb excel.workbook private sub workbook_open() set objexcel = application set objwb = activeworkbook end sub private sub objexcel_newworkbook(byval wb workbook) set objexcel = application set objwb = wb end sub private sub objws_sheetselectionchange(byval sh object, byval target range) msgbox target.address end sub

python - Nested dictionary from pandas data frame -

i have following data (see below) in pandas data frame. i'd covert dict looks this: my_dict = { 'ab': { 'city1': (0.000000, 0.000000), 'city2' : (0.100000, 0.200000), 'city3' : (0.200000, 0.400000) } 'bc': { 'city4': (0.300000, 0.600000), 'city5' : (0.400000, 0.800000), } } i aware of pandas' to_dict() method have been unable coerce perform this. iso city lat lng 0 ab city1 0.000000 0.000000 1 ab city2 0.100000 0.200000 2 ab city3 0.200000 0.400000 3 bc city4 0.300000 0.600000 4 bc city5 0.400000 0.800000 you can first create column zipped zip lat , lng , groupby double to_dict : #python 3 need convert list df['zipped'] = list(zip(df.lat, df.lng)) print (df) iso city lat lng zip...

java - does google play automatically creates shortcut of our app on home screen? -

i'm launch first app in week,and want know if google play automatically adds shortcut home-screen or if have code. have question this there's nothing creating shortcut on install. i launched app found google play automatically creates shortcut on homescreen , don't have in our code,although don't know if works same way in amazon app store. hope helps trying find answer same question.

php - laravel accessors in controller? -

i've add accessors , mutators in laravel model. public function getamountattribute($amount) { return ($amount) / 100; } public function setamountattribute($amount) { $this->attributes['amount'] = $amount * 100; } these working fine me. @ 1 place facing issue : issue want apply aggregate function in controller amount field. accessors not working. model::with(['xxx'])->where('parent_id', $id)->sum('amount') value of $id fine checked. it's giving me sum of amount field parent_id equals $id. should give results after diving 100. thanks in advance. accessors , mutators allow format eloquent attributes when retrieving them model or setting value. ... not while querying table. model::with(['xxx']) ->addselect(db::raw('sum(`table`.amount/100) sum_of_amounts')) ->where('parent_id', $id) ->get();

How to search for multiple variables within javascript file and concat? -

here code; function concatvar(data) { (var data in window) { if (window[data]== data.match(data+(/\[[0-9]+\]/))) return data; } } var data1 = [{ x: 290, y: 160}, {x: 391, y: 160}, {x: 391, y: 160}] var data2 = [{x: 200, y: 160}, {x: 193, y: 160}, {x: 421, y: 260}] var data3 = [{x: 200, y: 160}, {x: 193, y: 160}, {x: 421, y: 260}] var data = data1.concat(data2, data3) concatvar(); i able search through javascript file , find variable named data[+numbers] , concat them 1 variable. i'm struggling find way done? , i'm not sure if using loop within window advisable? any advice appreciated! cheers the regex should use more /var\s+data\d+\s+=\s*[\w\w]+;/ig (which attempt match variables ones provided). i'd personally try replace not match , use regex extract actual assigned values after doing splitting treat them 1 @ time: oneofthosematchedvariables.replace(/data\d+\s+=\s*/i, '') . oneofthosematchedvariables should...

Showing error for MODE_PRIVATE within fragment in android -

showing error while using mode_private sharedpreferences within oncreateview @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view layout = inflater.inflate(r.layout.activity_package_categories, container, false); sharedpreferences pref = getactivity().getsharedpreferences("packagetype", mode_private); sharedpreferences.editor editor = pref.edit(); editor.putstring("package_categories_id", position); editor.commit(); return layout; } you should use context.mode_private . @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view layout = inflater.inflate(r.layout.activity_package_categories, container, false); sharedpreferences pref = getactivity().getsharedpreferences("packagetype", context.mode_private); ...

android - Xamarin.forms Build Error "aapt.exe" exited with code -1073741819 -

i using xamarin.forms , updated android sd manager eclipse following error: xamarin.forms build error "aapt.exe" exited code -1073741819 error occurred on following file: \msbuild\xamarin\android\xamarin.android.common.targets <!-- run aapt generate r.java --> <aapt condition="'$(_androidresourcedesignerfile)' != ''" importsdirectory="$(_libraryprojectimportsdirectoryname)" outputimportdirectory="$(intermediateoutputpath)__library_projects__\" useshortfilenames="$(useshortfilenames)" javaplatformjarpath="$(javaplatformjarpath)" manifestfile="$(resgentemporarydirectory)\androidmanifest.xml" packagename="$(_androidpackage)" applicationname="$(_androidpackage)" resourcedirectory="$(monoandroidresdirintermediate)" javadesigneroutputdirectory="$(resgentemporarydirectory)...

%run Python function in IPython -

i'd run function ipython , load of data interactive namespace, how %run filename.py it. e.g., here's file scratch.py : def foo(x): = x*2 in ipython, i'd run function , able access name a . there way this? in order make variable available globally (or in interactive ipython session), first have define global: def foo(x): global = x*2 otherwise a remains local variable within function. more infos e.g. here: use of “global” keyword in python

android - Put ArrayList in ContentValues -

i'm using couchbaselite in android, want use contentprovider , contentvalues insert documents in db. 1 property of documents arraylist, conentvalues can't put directly arraylist. here code: contentvalues valuestour = new contentvalues(); valuestour.put(dbfields.column_progress_perc,completionpercentage); valuestour.put(dbfields.column_steps, new arraylist()); //here need put arraylist update(dbfields.content_uri, valuestour, 1234, null); is there workaround that? thanks in advance you cannot put arrays directly in database. in code, saving address of array useless. easy solution convert array string either using own implementation of tostring() or using third party library (i.e. gson).

Error jquery function while loading XPages -

Image
i have been trying same file upload page of bootstrap. error when try. copied of components, css, images , of js files in database. work on demo database not on application db :( i think cannot call jquery file or js file , code may not communicatate earch other :( not know miss. :( here code below.. (i put resoursces in have be) <?xml version="1.0" encoding="utf-8"?> <xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xc="http://www.ibm.com/xsp/custom"> <xp:this.data> <xp:dominodocument var="document1" formname="contact"></xp:dominodocument> </xp:this.data> <xp:this.resources> <xp:script src="/jqueryxsnippet.js" clientside="true"></xp:script> </xp:this.resources> <script type="text/javascript" src="bootstrapfileinput4/js/fileinput.js"></script> <link rel...

clojure - How to make manifold stream with dropping buffer? -

using core.async i'm able create channel dropping buffer: (async/chan (async/dropping-buffer 10)) is possible create manifold stream dropping buffer? you can same result creating (s/stream 10) , , using (try-put! msg 0) instead of put! , such puts full stream time out.

html - Overriding inline style not working in Edge -

Image
a site have created behaving strangely in ms edge browser (and ie too): http://bristolenergynetwork.org/ on element header#fancy-header stylesheet css of background-size: intial !important should overriding inline style of background-size: cover. edge developer tools show latter crossed out, suggesting being overridden not banner should appear below logo , menu on chrome. if uncheck crossed out style site looks should suggesting override not taking place developer tools suggests. is bug in edge or else causing behaviour? thanks! try changing property inherit , works me. body.home header#fancy-header { background-size: inherit !important; } you can find different background size property @ http://www.w3schools.com/cssref/css3_pr_background-size.asp

php Codeigniter and jquery ajax -

i want call codeigniter controller ajax after login. when execute it, login page refreshed , ajax url isn't calling controller function of codeigniter. i don't understand happened. please help? below code function validatereg() { var username = document.getelementbyid("inputname").value; var password = document.getelementbyid("inputpassword").value; $.post("<?php echo site_url('panel/login') ?>", {checkuser: username, checkpassword: password, action: "validateuser"}, function (data) { var result = data + ""; if (result.lastindexof("success" > -1)) { $.ajax({ url: "<?php echo site_url('dashboard/state'); ?>", type: 'post', complete: function (done) { console.log("finished.") } ...