Posts

Showing posts from September, 2015

eclipse - OleClientSite addKeyListener seems not working in swt in java -

i opening word document in swt in java using oleclientsite . want save document when user press ctrl+s . have added keylistener oleclientsite . code follows : public class swtmenuexample { static oleclientsite clientsite; static oleframe frame; static file file; static shell shell; static keylistener keylistener; public static void main(final string[] args) { final display display = new display(); shell = new shell(display); shell.setsize(800, 600); shell.settext("word example"); shell.setlayout(new filllayout()); try { frame = new oleframe(shell, swt.none); // esto abre un documento existente // clientsite = new oleclientsite(frame, swt.none, new // file("doc1.doc")); // esto abre un documento en blanco // clientsite = new oleclientsite(frame, swt.none, "word.document"); addfilemenu(frame);

php - Remove header value from the response -

i have laravel system , storing 1 of response in particular file : $objfile = new filesystem(); $path = "files/filename.php"; $string = $this->getslides(); if ($objfile->exists($path)) { $objfile->put($path,"",$lock = false); $objfile->put($path,$string,$lock = false); $objfile->getrequire($path); } else return getcwd() . "\n"; now contents using following lines: $objfile = new filesystem(); $path = "files/filename.php"; if ($objfile->exists($path)) { return response::json([$objfile->getrequire($path)],200); } else return getcwd() . "\n"; now what's happening when store file on server adds header : http/1.0 200 ok cache-control: no-cache content-type: application/json date: thu, 10 nov 2016 05:38:08 gmt followed stored file , when call f

command line interface - SOAPUI CLI Testrunner -

i running script through testrunner cli. want result's saved new folder each run instead of overwriting. don't want manually change root folder everytime. how do it? testrunner.bat -r -j -j "-fc:\users\xxxxxx\desktop\reports\xxx\xxx" "-rproject report" "-edefault environment" -i "c:\tcoe\automated_smoke_and_regression_soapui_tests\xxx\xxx_production-soapui-project.xml" right script looks above pasted one. declare root location report explicitly. what do ensure each run saves report in new loc? thanks sandip

Adding an Fragment id to auto-generated fragment from android studio -

i have created auto generated fragment android studio. when tagdatafragment fragment = (tagdatafragment) getsupportfragmentmanager().findfragmentbyid(r.id.tagfragment); fragment.fillvalues(); fragment returns null . have googled , found id not added fragment. how , add fragment id . import android.support.design.widget.tablayout; import android.support.v4.app.fragmenttransaction; import android.support.v7.app.appcompatactivity; import android.support.v7.widget.toolbar; import android.support.v4.app.fragment; import android.support.v4.app.fragmentmanager; import android.support.v4.app.fragmentpageradapter; import android.support.v4.view.viewpager; import android.os.bundle; import android.view.layoutinflater; import android.view.menu; import android.view.menuitem; import android.view.view; import android.view.viewgroup; import android.widget.edittext; import android.widget.textview; public class mainactivity extends appcompatactivity { /** * {@link android.suppo

asp.net - Entity Framework Core: issue with Contains method -

there simplified model of db: public class chat { public icollection<applicationuser> users {get; set;} //nav property - represents participants of chat } public class applicationuser : identityuser // represents net-identity user; not have references chats {...} so, in controller's class try chats such contain current user participant: var user = getuser(); _context.chats.where(chat => chat.users.contains(user)).tolist(); this code throws exception: you can not use type of expression ...applicationuser parameter's type "microsoft.entityframeworkcore.storage.valuebuffer" of method "boolean contains[valuebuffer](system.collections.generic.ienumerable`1[microsoft.entityframeworkcore.storage.valuebuffer], microsoft.entityframeworkcore.storage.valuebuffer)" what problem here? you need use any(), this var chatslist =_context.chats.where(chat => chat.users.any(u => u.id== user.id)).tolist();

javascript - Polymer - two way binding inside dom-repeat -

is possible acheive of sort. have element my-element.html here trying use template repeate generate paper-buttons feeding object controlbuttons , works in generating buttons name , id . the disabled binding not working , on-click listeners not registered approach. my question is, right way of doing ? or, not possible add such type of bindings in polymer. p.s.- sample example, in app there lot of buttons , elements , hence trying use template repeater purpose. <dom-module id="my-element"> <template> <div id="top_container" class="layout vertical center-justified"> <div id="controls" class="horizontal layout"> <template is="dom-repeat" items="{{controlbuttons}}" as="button"> <paper-button id="{{button.id}}" class="button" on-click={{button.onclickbinding}} disabled$="{{button.disablebinding

PHP Calendar table -

hi im trying make calendar table displays months in year , days in week. i able make 1 month(nov 2016). want loop through out year , coming years. can me? <?php /* set default timezone */ date_default_timezone_set("asia/hong_kong"); /* set date */ $date = strtotime(date("y-m-d")); $day = date('d', $date); $month = date('m', $date); $year = date('y', $date); // $nextyear = strtotime('+1 month', $date); $firstday = mktime(0,0,0,$month, 1, $year); $title = strftime('%b', $firstday); $dayofweek = date('d', $firstday); $daysinmonth = cal_days_in_month(0, $month, $year); /* name of week days */ $timestamp = strtotime('next sunday'); $weekdays = array(); ($i = 0; $i < 32; $i++) { $weekdays[] = strftime('%a', $timestamp); $timestamp = strtotime('+1 day', $timestamp); } $blank = date('w', strtotime("{$year}-{$month}-01")); ?> <table class='ta

d3.js - D3 axis ticks and grid lines do not align -

Image
i make plot 1 vertical , 1 horizontal grid line cross (0,0) point. have following script unfortunately axis ticks , origins of grid lines not align properly. source of discrepancy , how can fix this? <!doctype html> <meta charset="utf-8"> <script src="d3.min.js"></script> <body> </body> <script> var margin = {top: 60, right: 60, bottom: 60, left: 70}, width = 550, height = 550; var svg = d3.select('body').append('svg') .attr('width', width) .attr('height', height); var xscale = d3.scalelinear().domain([-1,1]).range([0+margin.left, width-margin.right]); var yscale = d3.scalelinear().domain([-1,1]).range([height - margin.bottom, 0 + margin.top]); // add x axis svg.append("g") .attr("transform", "translate(0," + (height - margin.top) + ")") .attr("class", "axis&

Manipulate highcharts bar -

Image
i'm exploring highcharts api , used stacked grouped bar charts. came on idea on changing bar's look. wanted pointed bar. possible? in advance! image below: changing column series shape might difficult because logic behind column series meant work rectangles, require extend/change highcharts internal code. instead, can use polygon series . little of configuration, should able desired effect. $(function() { var labels = { 1: 'apples', 4: 'bananas' }; highcharts.chart('container', { chart: { type: 'polygon' }, xaxis: [{ min: -0.5, max: 6, tickpositions: [0, 2, 3, 5], labels: { enabled: false } }, { offset: 0, linkedto: 0, tickpositions: [1, 4], ticklength: 0, labels: { formatter: function () { return labels[this.value]; } } }], yaxis: { min: 0, max: 100 }, series: [{ name: 'series 1', id

jquery - Delete data on base of selected checkbox ids laravel 5.3 -

i getting id's alert want post these id's destroyall method in usercontroller here method through getting id's in alert function deleteall () { var checkedvalues = $('input:checkbox:checked').map(function() { return this.value; }).get(); alert(checkedvalues); } i want post these values through ajax , delete there route as route::post('/user-management/user/destroyall', 'usercontroller@destroyall'); in destroyall method want explode , , minus head checkbox value you need use ajax: $.ajax({ type : "post", url : "{{ url('/user-management/user/destroyall') }}", data : {ids: checkedvalues, _token: "{{ csrf_token() }}"}, success : function (response) { console.log('success', response); }, error : function (response) { console.log('error', response); }, dat

Why does Spark not run locally while it should be possible according the documentation? -

the aim started spark executing examples , investigate output. i have cloned apache spark repository , built following instructions in readme , ran ./bin/spark-shell results in: using spark's default log4j profile: org/apache/spark/log4j-defaults.properties setting default log level "warn". adjust logging level use sc.setloglevel(newlevel). sparkr, use setloglevel(newlevel). 16/11/10 08:47:48 warn nativecodeloader: unable load native-hadoop library platform... using builtin-java classes applicable 16/11/10 08:47:48 warn utils: service 'sparkdriver' not bind on port 0. attempting port 1. 16/11/10 08:47:48 warn utils: service 'sparkdriver' not bind on port 0. attempting port 1. 16/11/10 08:47:48 warn utils: service 'sparkdriver' not bind on port 0. attempting port 1. 16/11/10 08:47:48 warn utils: service 'sparkdriver' not bind on port 0. attempting port 1. 16/11/10 08:47:48 warn utils: service 'sparkdriver' not bind on port 0

c# - How to split a string by multiple chars? -

this question has answer here: c# split string string 8 answers i have string this: string ip = "192.168.10.30 | somename" . want split | (including spaces. code not possible unfortunately: string[] address = ip.split(new char[] {'|'}, stringsplitoptions.removeemptyentries); as leads "192.168.10.30 " . know can add .trim() address[0] right approach? simply adding spaces( ' | ' ) search pattern gives me unrecognized escape sequence you can split string, not character: var result = ip.split(new string[] {" | "}, stringsplitoptions.removeemptyentries);

reactjs - What is the difference between react-fetch and whatwg-fetch -

i'm new reactjs , i've been reading on how , post data api. i've seen these two, i'm not sure use , what's difference between two? read i'm not sure use. thanks! react-fetch whatwg-fetch react-fetch allows use component(jsx) instead of writing specific js code. under hood, uses original fetch function(or isomorphic-fetch, not relevant question). i suggest reading fetch on mdn before getting decision. which should use? depends on personal preferences. if don't have experience fetch, i'd use whatwg-fetch understand how works better. once have better understanding of it, can choose between 2 libraries. if have simple ajax request, consider using react-fetch. if situation requires mutating state, or other complex logic, i'd suggest using whatwg-fetch.

push - fcm reciving two notification -

in fcm reciving 2 notification. how stop notification tag android devices? { "to" : "bk3rnwte3h0:ci2k_hhwgipodkcizvvdmexudfq3p1...", "priority" : "normal", "notification" : { "body" : "this week's edition available.", "title" : "newsmagazine.com", "icon" : "new" }, "data" : { "volume" : "3.21.15", "contents" : "http://www.news-magazine.com/world-week/21659772" } } change way: { "to" : "bk3rnwte3h0:ci2k_hhwgipodkcizvvdmexudfq3p1...", "priority" : "normal", "data" : { "body" : "this week's edition available.", "title" : "newsmagazine.com", "icon" : "new", "volume" : "3.21.15", "contents" : "http://www.ne

How to synchronously call multiple functions angularjs -

for example, have 4 functions: var f1 = function() {...}; var f2 = function() {...}; var f3 = function() {...}; var f4 = function() {...}; var fmain = function() {...}; the main function loop: var fmain = function () { angular.foreach(question_list, function (question, key) { f3(); //i want execute f4() after f3() returned! f4(); }); }; in f3() , f2() called! var f2() = function(){ //there's timeout function check if dynamic value equals expected value //if so, return true; otherwise, keep calling f2() until dynamic value equals expected value } in f2() , f1() called! var f1() = function(){ //there's timeout function check if dynamic value equals expected value //if so, return true; otherwise, keep calling f1() until dynamic value equals expected value } so, f3 depends on f2 , f2 depends on f1 . i want have them return synchronously (need code not proceed next line if previous line not returned yet). how can implement this?

Range query elasticsearch -

i have written following query data elasticsearch searchrequest requestquery = requests.searchrequest(constantsvalue.indexname) .types(constantsvalue._type) .source("{size:999999," + "\"_source\" : " + "[\"dtcreated\", \"status\"]" + ",\"aggs\": " + "{\"group_by_status\": {\"terms\": {\"field\": \"status\"}," + "\"aggs\" : " + "{\"group_by_date\" : {\"date_histogram\" : " + "{\"field\" : \"dtcreated\", \"interval\" : \"day\"," + "\"format\" : \"yyyy-mm-dd\" }," + "\"aggs\" : "

angular - html select not clickable -

i'm converting <select> more angular 2 in syntax. i'm using angular 2 using jquery <select> bad practice worked. clicking not make happen (no dropdown appears). possible see why nothing happens looking @ output html? html: <select _ngcontent-iwn-11="" class="form-control ng-untouched ng-pristine ng-valid" id="find-category-select" multiple="" name="categories" required="" disabled="" ng-reflect-required="" ng-reflect-name="categories" ng-reflect-model=""> <!--template bindings={ "ng-reflect-ng-for-of": "[object object],[object object]" }--><optgroup _ngcontent-iwn-11="" ng-reflect-label="grocery products" label="grocery products" style=" width: 400px; height: 100px; "> <!--template bindings={ "ng-reflect-ng-for-of": "meat,dairy,confectionary,

javascript - Windows builds of an Electron app on Cent OS 64 bit with electron-packager fails with error -

i'm trying set build on remote cent os server , stuck error. installed wine, since server has 64-bit architecture, wine command wine64 , not wine . each time try make windows build, could not find "wine" on system... make sure "wine" executable in path. error. seems it's trying execute "wine" command, have "wine64" instead, , according various guides, it's ok. making alias didn't help. suggest how can workaround issue? thanks. as turned out, built 64-bit version, had build , install 32-bit version well. though compilation , installation went warning 32-bit stuff missing, electron builds seem ok , work ok. the tutorial followed is here .

sql - TSM command to get the count of backup in GB's? -

can 1 please provide me tsm command count of backup in gb's last 30 days? an example of sql command can execute on tsm data size last 24 hours: select substr(entity,1,20) "node", cast(sum(bytes/1024/1024) decimal(8,2)) "mb bkp" summary activity = 'backup' , start_time>=current_timestamp - 24 hours group entity order 2 desc i haven't worked on tsm many years, can not change number of hours in clause 24 hours * 30 days? select substr(entity,1,20) "node", cast(sum(bytes/1024/1024) decimal(8,2)) "mb bkp" summary activity = 'backup' , start_time>=current_timestamp - 720 hours group entity order 2 desc to gb, divide bytes again 1024 in select clause.

getting specific xml data using c# -

i have xml file: <address> <data2> <person> <empl_num>>100</empl_num> <name>carl</name> <id_num>1</id_num> <isrequired>0</isrequired> </person> <person> <empl_num>200</empl_num> <name>mark</name> <id_num>2</id_num> <isrequired>0</isrequired> </person> <person> <empl_num>300</empl_num> <name>tanner</name> <id_num>3</id_num> <isrequired>0</isrequired> </person> </data2> </address> i have textbox , button. when type "1" , press button problem how can display xml data datagridview value of textbox show data has id_num = textbox.text expected output datagrid: if txtbox1.text = 1: empl_num | name | id_num | isrequired 100 | carl | 1

c++ - Erasing a struct element within a list -

what trying remove element list. elements structs. having difficult time this. examples online not struct elements. tried set key/values default values once iterate through data prints white space meaning element still there. need remove completely. below code. .h file #include<list> #include<queue> using namespace std; template <typename k, typename v, int cap> class hashtable { public: hashtable(int(*)(const k&)); bool hashtable<k, v, cap>::containskey(const k& key) const; hashtable<k, v, cap>& operator=(const hashtable<k, v, cap>&); v& operator[](const k&); // setter v operator[](const k&) const; // getter queue<k> keys() const; int size() const {return siz;}; void deletekey(const k&); private: int getindex(const k& key) const; struct node{k key; v value;}; int(*hashcode)(const k&); list<node> data[cap]; int cap; int siz; };

ios - Confirm purchase in affiliate program -

i'm developing mobile application affiliate links. want track users transaction status, example: a user browsing store, clicks on affiliate link , makes purchase on site, user leaves application. after transaction complete want have user return application seeing message of transaction status (succes or failure). i've searched around, haven't found regarding answer question. is possible?

ios - tableview cell not clicking -

uitableviewcell sub class: class menudrawertableviewcell: uitableviewcell { @iboutlet weak var label3: uilabel! @iboutlet weak var image30: uiimageview! override func awakefromnib() { super.awakefromnib() // initialization code } override func setselected(_ selected: bool, animated: bool) { super.setselected(selected, animated: animated) // configure view selected state }} i have class, got viewcontroller has table. class openmenu: uiviewcontroller, uitableviewdelegate, uitableviewdatasource { @iboutlet weak var tablev: uitableview! @iboutlet weak var label1: uilabel! @iboutlet weak var label2: uilabel! var selected = 0 override func prepare(for segue: uistoryboardsegue, sender: any?) { print("prepare") var destvc = segue.destination as! checkincontroller var indexpath: nsindexpath = self.tablev.indexpathforselectedrow! nsindexpath let menuitem = menulist[indexpath.row] destvc.varview = menuitem.index } let newswiftc

angularjs - How to preform the JOIN FETCH query to get the correct result? -

ok guys, got this: a student id, name , last name... now created new java class called accounts id, name , value there this: @onetomany(cascade = { cascadetype.all}) private set<bankaccout> accounts; public student() { accounts= new hashset<bankaccout>(); } public set<bankaccout> getaccounts() { return accounts; } public void setaccounts(set<bankaccout> accounts) { this.accounts= accounts; } now, have site, on site there table data of students... unique then had write new class, , have add listbox site, shows selected students accounts... my old query calling student looked this: @get @path("/getall") @produces(mediatype.application_json) public list<student> getall() { return em.createquery("from student s").getresultlist(); } and controller looks this: $http.get('http://localhost:8080/creditcardweb/rest/cc/getall').success( function(data) { $scope.result = dat

vb.net - How to create group alpabet gridview devexpress? -

Image
can 1 me create group alphabet gridview picture? i've tried code, rows not grouped alphabet. private sub gridview1_customcolumndisplaytext(sender object, e customcolumndisplaytexteventargs) handles gridview1.customcolumndisplaytext if e.column.fieldname = "companyname" andalso e.isforgrouprow dim rowvalue string = gridview1.getgrouprowvalue(e.grouprowhandle, e.column) dim val string = microsoft.visualbasic.left(rowvalue, 1) e.displaytext = val end if end sub there no need handle customcolumndisplay text event handler extract first letter of "companyname" value. instead, set gridcolumn.groupinterval property "companyname" gridcolumn " alphabetical ". instance: mygridview.columns("companyname").groupinterval = columngroupinterval.alphabetical

javascript - Never image with a custom ListView in appcelerator -

Image
i'm building app appcelerator show listview custom template. code of xml file: <listview id="elementslist" defaultitemtemplate="elementtemplate"> <templates> <itemtemplate name="elementtemplate" class="itemtemplate"> <view id="atomproperties"> <label bindid="name" id="name" /> <view id="secondline"> <label class="line2 fieldlabel" text="from: " /> <label class="line2" bindid="datestart" id="datestart" /> <label class="line2 fieldlabel" text=" to: " /> <label class="line2" bindid="dateend" id="dateend" /> </vi

c# - How many string objects are created by below code? -

string s = ""; for(int i=0;i<10;i++) { s = s + i; } i have been these options answer question. 1 11 10 2 i have simple code, want know how many string objects created code. i have doubt, string s = ""; creates no object. dont think so, please make me clear. if append string + operator, creates new string, think new object created in every iteration of loop. so think there 11 objects created. let me know if i'm incorrect. string result = "1" + "2" + "3" + "4"; //compiler optimise code below line. string result = "1234"; //so in case 1 object created?? i followed below link, still not clear. link1 please cover string str , string str = null case too. happens if dont initialize string , when if assign string null. object or no object in these 2 cases. string str; string str = null; later in code, if do. str = "abc"; is there programming way calculate number of o

azure - Install packages in Create R Model - AzureML -

is possible install packages in 'create r model'? huge limitation of azureml. i know possible in 'execute r script' in 'execute r script' can't save model. on using execute r script module of microsoft azure machine learning, there preloaded packages available, , can call/use them using require() or library() command. to view list of supported r packages of azure machine learning, may refer on this link . alternatively, if r package using not included in default r packages of azure machine learning, may refer on this link learn how use external r package azure machine learning .

python - convert datetimeindex to Qx-YY format -

i have csv file table looks like date open 11/1/2016 59.970001 10/3/2016 57.41 9/1/2016 57.009998 8/1/2016 56.599998 7/1/2016 51.130001 6/1/2016 52.439999 5/2/2016 50 4/1/2016 55.049999 i need quarterly date rows (mar, jun, sep, dec) , convert date columns q1-16/ q2-16/ q3-16 etc. code: df_sp = pd.read_csv(shareprice, index_col = 'date', parse_dates =[0]) df_q= df_sp.groupby(pd.timegrouper('q')).nth(-1) df_q['qx-yy'] = ???? you can use series.dt.to_period , dt.quarter dt.year , first need convert index.to_series : df = df.groupby(df.date.dt.to_period('q')).open.mean() print (df) date 2016q2 52.496666 2016q3 54.913332 2016q4 58.690000 freq: q-dec, name: open, dtype: float64 df.index = 'q' + df.index.to_series().dt.quarter.astype(str) + '-' + df.index.to_series().dt.year.astype(str).str[2:] print (df) date q2-16 52.496666 q3-16 54.913332 q4-16 58.69000

ionic framework - App Rejected with iOS IPv6 network -

Image
yesterday, submitted app review, got message apple: we discovered 1 or more bugs in app when reviewed on ipad iphone running ios 9.3.2 on wi-fi connected ipv6 network. specifically, upon review have found application still experiences loading issue , unable review application content. my app uses ionic framework, how can fix problem? i used domain access server, problem still exists. yes. according apple's policy , application must supports ipv6. so, please check application supports ipv6. supporting ipv6 in ios 9 to test, if application supports ipv6 or not please check , supporting ipv6 dns64/nat64 networks to check creating follow steps , indicate on apple's page . to set local ipv6 wi-fi network using mac 1) make sure mac connected internet (with ethernet), not through wi-fi . 2) launch system preferences dock, launchpad, or apple menu. 3) press option key , click sharing . don’t release option key yet. (don't forget

docker compose issue while creating cassandra cluster -

i doing simple example of creating cassandra cluster using docker compose. after running docker-compose up, can see 2 cassandra containers getting created. these not created part of cluster. since when 1 container , run 'nodetool describecluster' , shows me 1 ip. here docker-compose.yml using. please me find out doing wrong. have spent lot of time in checking logs , figuring out. cass0: image: cassandra:3.9 ports: - "9042:9042" - "9160:9160" cass1: image: cassandra:3.9 links: - cass0:seed environment: seeds: seed here nodetool cluster output: cluster information: name: test cluster snitch: org.apache.cassandra.locator.dynamicendpointsnitch partitioner: org.apache.cassandra.dht.murmur3partitioner schema versions: 86afa796-d883-3932-aa73-6b017cef0d19: [172.17.0.3] thanks in advance. seems, using wrong keyword. please replace in file. environment: cassandra_seeds

Uninstall a eclipse Plugin Programmatically before startup of eclipse -

i have rcp based product. , want uninstall eclipse plugins on start of rcp on checking license file , depending on license type. i have achieved through subclass of workbenchadvisor , overriding prestartup() method. below workbenchadvisor class. public class applicationworkbenchadvisor extends workbenchadvisor { boolean islicenseavailable = true; /** * {@inheritdoc} */ @override public void prestartup() { licensemanager.getinstance(); } private static final string perspective_id = "com.example.perspective"; //$non-nls-1$ @override public workbenchwindowadvisor createworkbenchwindowadvisor(final iworkbenchwindowconfigurer configurer) { return new applicationworkbenchwindowadvisor(configurer); } @override public string getinitialwindowperspectiveid() { return perspective_id; } } then below snippet uninstalls plugins in licensemanager class depending on licensetype. bundle plugin = platform.getbundle("com.exam