Posts

Showing posts from February, 2011

sql server - Duplication of data in SQL Query -

i'm having issue there data duplication on query. this how issue looks like. i have view table data of: (ps_cx_finc_sf_p_vw) id | item_term | item_amt | item_type | date | item_no ------------------------------------------------------ 005976 | 1609 | 3000.00 | c | 2016-09-27 | 00010 (ps_cx_finc_sf_a_vw) id | item_term | item_amt | item_type | date | item_no -------------------------------------------- 005976 | 1609 | -50.00 | p | 2016-09-27 | 00009 005976 | 1609 | -100.00 | p | 2016-10-04 | 00011 005976 | 1609 | -50.00 | p | 2016-10-23 | 00012 what hope results: id | item_amt | date | item_no | item_amt | date | item_no ---------------------------------------------- 005976 | 3000.00 | 2016-09-27 | 00010 | -50.00 | 2016-09-27 | 00009 005976 | null | null | null | -100.00 | 2016-10-04 | 00011 005976 | null | null | null | -50.00 | 2016-10-23 | 00012 but result becoming this: id | item_amt | date

java - Limit the number of rows in SQLite Database -

this question has answer here: limiting number of records in sqlite db 1 answer i have sqlite database save list of recent searches done in app. inserting this: /** * inserts recentsearch recent searches table * * @param arecentsearch - recentsearch */ public void insertsearchintodb(recentsearch arecentsearch) { sqlitedatabase db = helper.getwritabledatabase(); try { contentvalues contentvalues = new contentvalues(); contentvalues.put(dbhelper.entity_id, arecentsearch.getentityid()); contentvalues.put(dbhelper.search_phrase, arecentsearch.getphrase()); contentvalues.put(dbhelper.search_type, arecentsearch.getsearchtype().getitemid()); contentvalues.put(dbhelper.search_category_name, arecentsearch.getcategoryname()); contentvalues.put(dbhelper.search_time, arecentsearch.getsearchtime()); contentvalues

flash - How do you remove styles from a FlowElement in TLF? -

i'm using following code apply padding inlinegraphicelement seems applying value , not removing it. imagefloat = inlinegraphicelement.float; newformat = new textlayoutformat(); if (imagefloat==float.left || imagefloat==float.start) { newformat.paddingright = 5; inlinegraphicelement.paddingright = 5; } else if (imagefloat==float.right || imagefloat==float.end) { newformat.paddingleft = 5; inlinegraphicelement.paddingleft = 5; } else { newformat.paddingleft = undefined; newformat.paddingright = undefined; } absolutestart = inlinegraphicelement.getabsolutestart(); textcontainermanager = richeditabletext.mx_internal::textcontainermanager richeditabletextcontainermanager; textcontainermanager.applyformatoperation(newformat, null, null, absolutestart, absolutestart+1); it looks ignores undefined values. i'm not sure how reset padding none. update: found clearformat method in edit manager class: editmanager = richeditabletext.textflow.interaction

Hi I tried communication between components through services in angular 2 but returning function returns empty values -

second component of page need values first component import { component } '@angular/core'; import {appservice} './app.service'; import { http,response } '@angular/http'; @component({ template: ` <h1>second component</h1> <h1>second component</h1> <p>{{myname}}</p> `, providers:[appservice] }) export class secondcomponent { constructor(private appservice: appservice) { this.appservice=appservice; this.myname=this.appservice.getdat(); console.log(this.myname); } } ** first component page need pass value second component** import { component } '@angular/core'; import { formbuilder, formcontrol } '@angular/forms'; import {appservice} '../second/app.service'; import { router } &#

javascript - Need a solution for drag divs from outside in to a graph and get coordinates which doesn't depend on screen size? -

i have set of square divs on html page , drag able , drop able in large div.but need add responsive chart ( chartist.js , chartjs , googlecharts) large div , coordinates of droped elements , coordinates should not depend on screen size. i tried saving raw pixel measurements , calculate them according screen size,but becomes complex.

docker cassandra with opscenter unable connected -

i want create 3 cassandra 1 opscenter. docker-compose.yml version: '2' services: cassandra-1: image: cassandra container_name: cassandra-1 environment: cassandra_broadcast_address: "cassandra-1" ports: - 7000 - 9160:9160 - 9042:9042 - 7199:7199 volumes: - "./test_vol_1/:/var/lib/cassandra" restart: cassandra-2: image: cassandra container_name: cassandra-2 environment: cassandra_broadcast_address: "cassandra-2" cassandra_seeds: "cassandra-1" ports: - 7000 depends_on: - cassandra-1 volumes: - "./test_vol_2/:/var/lib/cassandra" cassandra-3: image: cassandra container_name: cassandra-3 environment: cassandra_broadcast_address: "cassandra-3"

javascript - popup show on page load and set session -

i want show popup on page load. in below script works if user click popup button shows popup also want set session if popup shows 1 time should not show multiple time my.ptml <a class="vip" data-toggle="modal" data-target="#mymodal"> popup</a> <div style="display:none"> <div id="mydivid"> <div class="popup-wrap"> <div class="popup-txt-01"><img src="<?php echo $this->getskinurl('images/proxelle/txt_1.png');?>"></div> <div class="popup-txt-02"><img src="<?php echo $this->getskinurl('images/proxelle/txt_2.png');?>"></div> <form action="<?php echo $this->geturl('proxelle/index/addme') ?>" method="post" id="proxelle"> <input type="hidden&q

How to print converted SQL query from yii2 query -

i want print query: $demo = demo::find()->all(); i want see converted sql query parameters: createcommand()->getrawsql(); is showing me error message: yii2 call member function createcommand() on non-object please me see actual sql query. eg: $query = demo::find()->where(['category'=>2]); echo $query->createcommand()->getrawsql();

Cannot connect to rabbitmq -

can not connect internal rabbit mq instance. receive following error: the amqp operation interrupted: amqp close-reason, initiated library, code=541, text="unexpected exception", classid=0, methodid=0, cause=system.io.ioexception: unable read data transport connection: existing connection forcibly closed remote host. ---> system.net.sockets.socketexception: existing connection forcibly closed remote host @ system.net.sockets.socket.receive(byte[] buffer, int32 offset, int32 size, socketflags socketflags) @ system.net.sockets.networkstream.read(byte[] buffer, int32 offset, int32 size) --- end of inner exception stack trace --- @ rabbitmq.client.impl.frame.readfrom(networkbinaryreader reader) @ rabbitmq.client.impl.socketframehandler_0_9.readframe() @ rabbitmq.client.impl.connectionbase.mainloopiteration() @ rabbitmq.client.impl.connectionbase.mainloop() could firewall blocking required port? ok, problem solved. not sure if helpful someone, but

android - ionic 2: while run in emulator it shows error but running in server it works -

Image
something weird happened me after add plugins in app.. when run ionic run serve the app work find , can response server can see here but run ionic run android it show spinner , shows error can see here to http requests via ionic app, need white list urls. can use cordova whitelist plugin this. cordova plugin add cordova-plugin-whitelist and in index file <meta http-equiv="content-security-policy" content="script-src 'self' 'unsafe-eval' 'unsafe-inline' *; object-src 'self'; style-src 'self' 'unsafe-inline'; media-src *"> this code copied following tutorial, have @ it. http://www.gajotres.net/ionic-2-making-rest-http-requests-like-a-pro/ hth

css - Modal button: make the whole section clickable -

i working on website , can see have 2 modals, 1 on left , 1 on right (the icons) . what want keep modal buttons in same position make whole section (the pictures girl , texts) clickable. infos: can use "i" icon modal button :/ , can edit css not html. is possible open modal window clicking on whole section? here code: html: <div id="ts-vcsc-modal-5397504-container" class="ts-vcsc-modal-container"> <div id="ts-vcsc-modal-5397504-trigger" style="" class="ts-vcsc-modal-5397504-parent nch-holder ts-vcsc-font-icon ts-font-icons ts-shortcode ts-icon-align-center "> <a href="#ts-vcsc-modal-5397504" class="nch-lightbox-modal no-ajaxy" data-width="1024" data-title="" data-open="false" data-delay="0" data-type="html" rel="" data-effect="slideup" data-share="0" data-duration="5000" data-color=&

file upload - Video Uploading in PHP -

$valid_formats = array("mp4"); $max_file_size = ini_set('upload_max_filesize', '100m'); //100 kb $path = "uploads/"; // upload directory $count = 0; echo $_files['files']['size']; if(isset($_post) , $_server['request_method'] == "post"){ echo "hello"; print_r($_files['files']['name']);} the above written line executes while uploading other stuffs image , pdf.but fails while uploading video , shows null array i think has file trying upload large. try increase allowed upload file size changing following values in php.ini , restart webserver: post_max_size = 16m; upload_max_filesize = 16m; i enable error_reporing try find what's going on. can turn on , display errors on page, adding following top of script: error_reporting(e_all); ini_set('display_errors', 1); you can try track down problem looking in log files, instance apache log file under: /var/log/ap

sockets - How to use CFStreamCreatePairWithSocket using CFSocketNativeHandle -

i trying write socket xmpp, after connection established socket should reestablish connection updated tls settings. problem delegate methods stream.event.opencompleted called on both outputstream , inputstream stream.event.hasspaceavailable not getting called after cfstreamcreatepairwithsocket. code:- if tls{ var readstream :unmanaged<cfreadstream>? var writestream:unmanaged<cfwritestream>? reset() print("establish tls ") tlsenabled = true let socketdata = cfwritestreamcopyproperty(self.outputstream cfwritestream, cfstreampropertykey.socketnativehandle) as! cfdata let native = cfsocketnativehandle(cfdatagetbyteptr(socketdata).pointee) inputstream.close() outputstream.close() inputstream.remove(from: runloop.current, formode: .defaultrunloopmode) outputstream.remove(from: runloop.current, formode: .defaultrunloopmode) inputstream = nil outputstream = nil cfstreamcreatepairwithsocket(kcfallocatordefau

c# - Generate and Design Rdlc file programmatically -

i'm doing mvc reporting , i'm new @ it. i'm trying create report, , have done using rdlc. works well, can exported various format. problem, when using rdlc need design , bind first. how can create empty rdlc template, design , bind dataset programmatically. my work far (using empty rdlc template - created file without table), controller file, public actionresult report(string id) { db.open(); localreport lr1 = new localreport(); string path1 = path.combine(server.mappath("~/report"), "testemptyreport.rdlc"); lr1.reportpath = path1; datatable pc2a = new datatable(); pc2a = db.getdataset().tables[0]; pc2a.columns.add("product name"); pc2a.columns.add("price"); pc2a.columns.add("quantity"); reportdatasource rdc = new reportdatasource("dataset1", pc2a); lr1.datasources.add(rdc); string reporttype = id;

css - Issue regrading navbar dropdown in bootstrap -

Image
i facing problem regarding dropdown menu in website navbar. using bootstrap v 3.3.6 on hover menu name (here features), expecting should button beside (the request demo button). right side edge becomes sharper on hover. surfed lot on net did not find needful workaround yet. here code snippet <nav class="navbar navbar-default navbar-fixed-top"> <div class="container"> <div class="navbar-header"><%= image_tag("logo.png", alt: "industryprime") %></div> <ul class="navigation pull-right"> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">features <span class="caret"></span></a> <ul class="dropdown-menu"> <li><a href="#" class

php - How to show only one level sub category? -

i building real estate website have many category 3 4 level child category requirement show 1 level sub category of parent category eg sub1 ,sub2 , sub3 see structure i'm having category - cat1 - sub1 - secondsub1 - cat2 - sub2 - secondsub2 - cat3 - sub3 - secondsub3 $categories = get_terms( 'category', array('hide_empty' => 0,'parent' => 0,'number' =>3,'order'=> 'asc') ); foreach ($categories $category) { $catname= $category->term_id; <?php echo get_cat_name( $catname ); // main category ?> <!-- subcategory code starts here--> $args = array( 'type' => 'post', 'child_of' => $catname, 'parent' => get_query_var(''), 'orderby' => 'name

How Do I Pivot An Array Of Objects in JavaScript? -

i have array of object need convert table (kind of pivoting data). saying need array of objects unique titles have nested arrays of object pairs of values. please take , achiving need? please see original , desired array below: original array: [ {title: "title1", value1: "value1", value2: "value2"}, {title: "title2", value1: "value1", value2: "value2"}, {title: "title1", value1: "value1", value2: "value2"}, {title: "title3", value1: "value1", value2: "value2"}, {title: "title2", value1: "value1", value2: "value2"}, {title: "title1", value1: "value1", value2: "value2"}, {title: "title3", value1: "value1", value2: "value2"}, {title: "title1", value1: "value1", value2: "value2"}, ] desired result: [ {title: "title1", values: [{valu

neural network - euclidean distance in plotsomnd -

i facing problems in finding euclidean distan in plotsomnd.i ran 10x10 som through nnstart toolbox , want analyze output som neighbor distances plot. there way find actual values of neighboring neurons distances? example can find distance values of cluster 1 cluster 2 , cluster 11 in attached output plot (is there single value describes distance between 2 neurons?)? can please him me in . , regards,

mongodb - How to perform tasks that are related to time and dates in the database? -

i have database , api server doing data juggling in database. users can add entities, update them , crud things. some entities have fields paiduntil , expirationdate , like. i want perform actions automatically when field in database entry triggers criteria, or don't want users able action entities data doesn't comply criteria due time passing. what strategies manage these tasks? should cron tasks or check criteria on each entry query. may there event-based mechanism can use, event-based databases or addons?

tensorflow - Strange output of embedding_lookup_sparse -

consider such code: w = tf.variable(tf.constant([[1., 2], [3, 4], [5, 6], [7, 8]])) sess = tf.session() sess.run(tf.initialize_all_variables()) st = tf.sparsetensor([[0, 0, 0], [0, 1, 1], [1, 0, 0], [1, 1, 0], [2, 0, 0], [2, 1, 0]], [0, 2, 0, 1, 1, 3], [3, 3, 2]) sess.run(tf.nn.embedding_lookup_sparse(w, st, none, combiner='sum')) output: array([[ 6., 8.], [ 4., 6.], [ 10., 12.]], dtype=float32) according documentation shape of output must [3, 3, 3], since shape(sp_id) = [3, 3, 2] , shape(w) = [4, 3], doesn't :( can explain why works in way? because expected behavior simple embedding_lookup, aggregation on last axes.. edit for each object have 2 features , each represent 1 word, since want represent each object 2 concat embeddings, can by: sess.run(tf.reshape(tf.nn.embedding_lookup(w, [[0, 1], [2, 3]]), shape=(2, 4))) ou

php - Trouble Integrating to Visa Direct -

my aim have on line system people can transfer money via visa direct , pay services. for needed integrate visa network. however, having challenges doing same. well, have found steps towards integrating them: create sandbox account sample code provided on how can hit end point. problem came when found sample code provided uses phpunit hence have problem testing on browser. sample code generated can tested on terminal via ./vendor/bin/phpunit.. interest able test same on browser. can done? after done tests, request them allowed move production. yet stage since stuck @ one. a major concern email provided communication during development journey takes days before responded. makes development journey bit long. has done before in php , willing me? kind regards. your work process should that: 1- code: you have webserver , php backend. 2- visa api: download visa api via composer. test if api works (isolated backend) using phpunit. after running phpu

jboss - TomEE and legacy Entity Beans -

i'm trying migrate legacy web application running on deprecated environment based on jboss (older 2001). the project seems use entity beans since trying deploy jars on wildfly 10.0.1 returns error not deployable entity beans (because not supported anymore). i switched tomee 7.0.1 entity beans gets recognized triggers chain of errors. 00:13:57.174 info [localhost-startstop-1] org.apache.tomee.catalina.tomcatwebappbuilder.init ------------------------- localhost -> /sample 00:13:57.247 info [localhost-startstop-1] org.apache.openejb.config.configurationfactory.configureapplication configuring enterprise application: /root/apache-tomee-plume-7.0.1/webapps/sample 00:13:57.451 info [localhost-startstop-1] org.apache.openejb.config.initejbdeployments.deploy auto-deploying ejb consorzisession: ejbdeployment(deployment-id=consorzisession) 00:13:57.452 info [localhost-startstop-1] org.apache.openejb.config.initejbdeployments.deploy auto-deploying ejb consorzi: ejbdeployment(dep

C++, Boost, how to get a path name that does not exist anymore? -

i'm using boost::filesystem iterate through of directories , files under root(let c:\\ ) path given. i have used recursive_directory_iterator initialize vector<boost::filesystem::path> paths contains of paths under root. however of paths have been removed directory , i'm printing message saying "a path no longer exist, path is..". i'm not sure how path name no longer exist(as cannot access vector pathname). code added requested* for (size_t = 0; < this->paths.size(); i++) { if (boost::filesystem::exists(this->paths[i])) { /* path list of path, ps */ boost::filesystem::path p = this->paths[i]; /* convert path string */ string path = p.string(); /* check file size(should not on 10mb) */ if (get_file_size(path) > 10 * pow(10, 6)) continue; /* setting extension */ string file_extension = boost::filesystem::extension(path); /* if current path stands text

c# - EntityFramework Linq Left Join Parsing Error - DotNet Core 1.0 -

i'm attempting explicitly join 3 tables using left outer join in linq query , running linq parsing issues. performing inner join parses correctly , returns data using left outer fails. example: var query = p in databasecontext.products p.clientid == clientid join l in databasecontext.licenses on p.productid equals l.productid pl pli in pl.defaultifempty() join in databasecontext.articles on p.articleid equals a.articleid pa pai in pa.defaultifempty() select new someentitydto { somethingfromp = p.something, somethingfroml = pli.something, somethingfroma = pai.something }; as both joined tables key off of first table, can test each individually removing other join, e.g., test query p l , p a. these test queries function perfectly. it's pos

javascript - Interactjs decreases data-y attribute of an element to 0 in Safari -

i using interactjs angular js. use plugin dragging in y-axis , grid in in 1 container. works fine in chrome , firefox. however, when move grid in safari, data-y gets decreased 0 @ end. code: .draggable({ // enable inertial throwing enabled:true, inertia: true, snap: { targets: [ interact.createsnapgrid({ x: 0, y: 30}) ], range: infinity, relativepoints: [ { x: 0, y: 0 } ] }, // keep element within area of it"s parent restrict: { restriction: "parent", endonly: true, elementrect: { top: 0, left: 0, bottom: 1, right: 1 } }, // enable autoscroll autoscroll: true, // call function on every dragmove event onmove: function(event){ console.log("onmove"); var target = event.target, x = parsefloat(target.getattribute("data-x")) + event.dx, y = parsefloat(target.getattribute("data-y")) + event.dy; // t

Mysql MySQL or PHP Transform rows to two columns dynamically -

Image
i have same scenario have in mysql or php transform rows columns but have restructure table , output it's pretty same link above include as_amount.anyone can me? i want result below as_month_2016...etc in right side of each fa_mont2016 this code: create definer=`root`@`localhost` procedure `display_annualize_table`() begin set group_concat_max_len=10028; set @sql = null; select group_concat(distinct concat( 'max(if(month = ''', month, ''' , year(date) = ', year(date), ', fs_amount, null)) `', concat('fa_',month), '_', year(date), '`') order date ) @sql tmp_results; if coalesce(@sql,'') != '' set @sql = concat(', ', @sql); end if; set @sql = concat( 'select r.account account, r.region region ', coalesce(@sql,''), 'from tmp_results r left join accounts

orm - How to add multiple values to Many2many field in One2many field ?Odoo 10 -

i trying add one2many field create method , field has many2many field need fill, there can multiple values.. the color_selector many2many field, data of field color.true(1, 5) or color.true(5) location_env.sudo().create({'loc_id': loc_id.id, 'loc_name': loc_id.loc_name, 'purchase_order_line_id': line_id.id, 'color_selector': (6, 0, colors_ids)}) i have tried : 'color_selector': (6, 0, colors_ids) 'color_selector': [(6, 0, colors_ids)] 'color_selector': (6, 0, [colors_ids]) c_ids = (4, colors) 'color_selector': (6, 0, c_ids) to create one2many record in odoo should way. loc_id.your_one_two_many_field = [(0,0, {'loc_name': loc_id.loc_name, 'purchase_order_line_id': line_id.id,

angular - Where to put / configure CORS header Access-Control-Expose-Headers in WSO2 API Manager -

i having problem accessing response headers under cors scenario. doing cors call. so, configured api configuration in api manager accept cors requests (that is, cors enabled rest endpoint). but when app (angular2 app) post request (http.post) not see response headers. checked in chrome devtools browser receiving remote server , turned out expected response headers received in browser. apparently, angular not pass code , not able access headers. gunter, suggested me check cors header access-control-expose-headers my question: can tell wso2 api manager pass pass or set header when cors enabled? tried in api-manager.xml did not see expected header (in case header 'location') after restart. angular2 's http.post not returning headers in response of post method invocation apim out-of-the-box supports access-control-allow-headers not access-control-expose-headers . but can configure apim send header well. that, create sequence below , attach api. &

Kendo upload widget disappears with angularjs -

i trying use kendo upload widget, , widget disappears when select file, , file undefined, please me ? use es6 , nodejs. think there problem widget. <div class="demo-section k-content"> <div> <h4>upload files</h4> <input name="uploadfile" ng-model="vm.files" id="files" type="file" kendo-upload options="vm.options" /> </div> </div> import configglobal '../../config/env/index'; class documentcontroller { /* @nginject */ constructor() { this.name = 'document'; this.options = { select: this.test, async: { saveurl: `${configglobal.default.apiurl}/api/upload/`, removeurl: 'remove', autoupload: true }, upload: this.onupload }; } test() { $('#files').kendoupload(); console.log(this.files); } onupload(e) { $('#files').kendoupload(); console.log(this.file

angularjs - How to bind 2 models to one input field in Angular? -

is there anyway can bind 2 model values 1 input field? suppose have input field want value of 2 variables in scope like: <input type="text" model="sn_number; id" > you cannot, there workarounds. 1. use ngchange update other model <input type="text" ng-model="sn_number" ng-change="id=sn_number"/> 2. watch model, , when in changes, update another $scope.$watch('sn_number', function(v){ $scope.id = v; }); you need watch changes in id if want keep them in sync. example here

r - How to constrain duplicate removal for specific data.frame in the list more elegantly? -

i have data.frame objects in list output of custom function, , intend proceed duplicate removal first data.frame objects, while others shouldn't not effected. tried in lapply function control constrain, have subscript error instead. know easier in separately, not desired me. can point me out how make easier in functional programming ? knows useful trick of controlling constrain on specific objects in list ? mini example: mylist <- list( bar = data.frame(v1=c(12,21,37,21,37), v2=c(14,29,45,29,45)), cat = data.frame(v1=c(18,42,18,42,81), v2=c(27,46,27,46,114)), foo = data.frame(v1=c(3,3,33,3,33,91), v2=c(26,26,42,26,42,107)) ) it easy this: .first <- unique(mylist[[1l]]) res <- c(list(.first), mylist[- 1l]) but need constrain duplicate removal effect on first data.frame, while others doesn't remove duplicate, intend implement in function more elegant way. desired output: myoutput <- list( bar = data.frame(v1=c(12,21,37),v2=c(14,29,45)), cat