Posts

Showing posts from January, 2014

javascript - Node.js FileSystem access returns ENOENT despite the file existing -

Image
i have node.js function uses fs.access check if file exists, readable , writable: function stackoverflowfunction() { try { fs.accesssync(`file://${__dirname}/config/config.ini`, fs.constants.f_ok | fs.constants.r_ok | fs.constants.w_ok); } catch (err) { console.log(err); } despite file existing, { error: enoent: no such file or directory, access 'file:///home/callcenter1/bookgenerator/config/config.ini' @ error (native) @ object.fs.accesssync (fs.js:248:11) @ object.fs.accesssync (electron_asar.js:420:27) @ getconfig (/home/callcenter1/bookgenerator/main.js:12:12) @ object.<anonymous> (/home/callcenter1/bookgenerator/main.js:18:10) @ module._compile (module.js:541:32) @ object.module._extensions..js (module.js:550:10) @ module.load (module.js:458:32) @ trymoduleload (module.js:417:12) @ function.module._load (module.js:409:3) errno: -2, code: 'enoent', syscall: 'access', path: 'file:///home/callcenter1/bookgenerator/config/confi

Get object from array of objects in Javascript -

i have array: var arrayexample = [ {productid: 1, quantity: 2, name: example, description: example}, {productid: 1, quantity: 2, name: example, description: example}, {productid: 1, quantity: 2, name: example, description: example}, {productid: 1, quantity: 2, name: example, description: example}]; my question how items of array taking in every object productid , quantity ? having array contains objects 2 values? number of objects of array variable result: var arrayexamplenew = [ {productid: 1, quantity: 2}, {productid: 1, quantity: 2}, {productid: 1, quantity: 2}, {productid: 1, quantity: 2}]; sorry english you map var arrayexample = [{ productid: 1, quantity: 2, name: 'example', description: 'example' }, { productid: 1, quantity: 2, name: 'example', description: 'example' }, { productid: 1, quantity: 2, name: 'example', description: 'example' }, { productid

android - adb Key event for Keyboard next key -

please click image link hi all, i have login page shown in attached image. native app login page. when try log in, keyboard hides password textbox/ sign in button, need click on next key have marked black circle. the clicking of button wanted using automation. can precisely tell me key event key. need adb command send key event device. adb shell input keyevent <keycode> events can passed 0 keycode_unknown 1 keycode_menu 2 keycode_soft_right 3 keycode_home 4 keycode_back 5 keycode_call 6 keycode_endcall 7 keycode_0 8 keycode_1 9 keycode_2 10 keycode_3 11 keycode_4 12 keycode_5 13 keycode_6 14 keycode_7 15 keycode_8 16 keycode_9 17 keycode_star 18 keycode_pound 19 keycode_dpad_up 20 keycode_dpad_down 21 keycode_dpad_left 22 keycode_dpad_right 23 keycode_dpad_center 24 keycode_volume_up 25 keycode_volume_down 26 keycode_power 27 keycode_camera 28 keycode_clear 29 keycode_a 30 keycode_b 31 keycode_c 32 keycode_d 33 keycode_e 34 keycode_f 35 keycode_g 36 keyco

bash - How to use unix command 'cat' in android to concatenate two video files from sd card? -

i have split video file 2 files 'part1' , 'part2' via git bash. both these files individually unreadable. need concatenate these 2 files , play video. works fine via git bash since new android, can't seem programmatically. did come across answer here said : string[] command = {"ls","-al"}; processbuilder builder = new processbuilder(command); builder.directory(new file(/ngs/app/abc)); p = builder.start(); however, don't know how write command 'cat part1 part2 > new.mp4' using technique. great! thanks! you have invoke shell , pass command line script parameter. example bash shell run following bash -c 'cat part1 part2 > new.mp4' given template work out following string[] command = {"bash", "-c", "cat part1 part2 > new.mp4"}; processbuilder builder = new processbuilder(command); builder.directory(new file(/ngs/app/abc)); p = builder.start(); of course cat con cat

python - Using regex, extract quoted strings that may contain nested quotes -

Image
i have following string: 'well, i've tried "how doth little busy bee," came different!' alice replied in melancholy voice. continued, 'i'll try again.' now, wish extract following quotes: 1. well, i've tried "how doth little busy bee," came different! 2. how doth little busy bee, 3. i'll try again. i tried following code i'm not getting want. [^\1]* not working expected. or problem elsewhere? import re s = "'well, i've tried \"how doth little busy bee,\" came different!' alice replied in melancholy voice. continued, 'i'll try again.'" i, m in enumerate(re.finditer(r'([\'"])(?!(?:ve|m|re|s|t|d|ll))(?=([^\1]*)\1)', s)): print("\ngroup {:d}: ".format(i+1)) g in m.groups(): print(' '+g) if really need return results single regular expression applied once, necessary use lookahead ( (?=findme) ) finding position goe

extjs5 - How to Abstract a base container with some default items in Sencha Extjs 6? -

i trying develop base container extending ext.container, have default items in it. subclass should add items child component of base class , not directly container instead. how this? may override setitems / applyitems method add items navigationview.add(items); ?? i'm unsure how works. since i'm new extjs, unable identify way generically won't affect subclass add n number of items either using inline or add(item) method. abstractclass ext.define('myapp.container.abstractmaincontainer', { extend: 'ext.container', xtype: 'abstractmaincontainer', requires: [ 'myapp.container.navigationview', 'myapp.control.navigationbar' ], config: { layout: { type: 'vbox', pack: 'start', align: 'stretch' }, flex: 1, height: '100%', width: '100%' }, controller: 'maincontroller'

Difference- ApplicationContext() VS. Activity Context in ANDROID..? -

possible duplicate: difference between activity context , application context i want know actual difference between application context , activity context in android ..? these 2 confusing me time. please find me difference two.?? to have gist on application context , activity context read below: the application context live long application alive , not depend on activities life cycle. if plan on keeping long-lived objects need context, remember application object. can obtain calling context.getapplicationcontext() or activity.getapplication(). in summary, avoid context-related memory leaks, remember following: 1.do not keep long-lived references context-activity (a reference activity should have same life cycle activity itself) 2.try using context-application instead of context-activity reference & more info

java - Decrypt difference integer values 1 and 2, using AesCrypto -

what causes results below different? -------------- if value = 1 : -------------- string key1 = "123456"; string key2 = "654321"; string x = aescrypto.encrypt(key1, string.valueof(1)); string y = aescrypto.decrypt(key2, x); result --> y = ���8��vw&�s -------------- if value = 2 : -------------- string key1 = "123456"; string key2 = "654321"; string x = aescrypto.encrypt(key1, string.valueof(2)); string y = aescrypto.decrypt(key2, x); result --> y = null why not produce null value 1, not equal value of 2? although both failed decrypt. i don't know library when encrypting 1 key, , decrypting expect undefined results.

aws iot - Kinesis shard with many producers -

i need collect data lots of data sources (e.g., mobile phones). example, 1,000 phones, each uploading batch of 1mb every 20 minutes. thinking use kinesis stream single shard ingest data (the total throughput 1mb/s). make sense individual phones directly access kinesis api, or should put own frontend (e.g., web server) in front? main limits/considerations keep in mind when making decision? p.s. alternative use aws iot infrastructure considerably more expensive you should have web service receives data clients , send them kinesis. web server can use kinesis producer library (kpl) offer best performance in terms of message rate delivery, timeout, policy retry , scalability. kpl can create many workers , can tuned optimize message rate , not exceed write limit imposed kinesys shards. have every single client sends data kinesis overkill in terms of performance, mainenantce costs , delivery. happen if client start sends data @ high rate traffic? shard has rate limit write o

vb.net - How can I add/subtract to one axis on a control's location in a form? -

i know can .location = new point(x,y) how can add or subtract value of strictly x or y coordinate? something this? lbltester.location.x = lbltester.location.x + 100 lbltester.location = new point(lbltester.location.x + 100, lbltester.location.y)

Angular 2 ngFor first occurence undefined -

Image
i'm trying angular 2 , i'm facing weird issue don't understand. i make simple todo list , when execute app have error message : i don't understand why first occurence iterated undefined. array hardcoded don't find out why there issue. here code application : app.module.ts import { ngmodule } '@angular/core'; import { browsermodule } '@angular/platform-browser'; import { todonavcomponent } './app.todo-nav'; import { todolistcomponent } './app.todo-list'; import { todocomponent } './app.todo'; @ngmodule({ imports: [ browsermodule ], declarations: [ todonavcomponent, todolistcomponent, todocomponent ], bootstrap: [ todonavcomponent, todolistcomponent, todocomponent ] }) export class appmodule { } app.todo-list.ts import { component } "@angular/core"; import { todoservice } "./app.service"; @component({ selector: "todo-list", template: ` <

How to run an IPython magic from a script (or timing a Python script) -

the ipython %timeit magic command job measuring time required run python code. now, want use analogous in python script. know timeit module, however, has several disadvantages, example, how select number of runs adaptively? i.e., default code import timeit t=timeit.timer("code(f)", "from __main__ import code,f") t.timeit() runs code million times. %timeit ipyhton magic command automatically. suggest use matlab code http://www.mathworks.com/matlabcentral/fileexchange/18798 that job automatically (and tells if overhead of function large). how can call %timeit magic python script (or maybe there better timing solution) ? it depends bit on version of ipython have. if have 1.x: from ipython import get_ipython ipython = get_ipython() if have older version: import ipython.core.ipapi ipython = ipython.core.ipapi.get() or import ipython.ipapi ipython = ipython.ipapi.get() once that's done , run magic command this: ipython.magic(&

save - Problems with plotly_IMAGE -

i saving several graphs have created with: plotly_image(graph, format = "png", out_file = filename) but: error in process.image(append_class(resp, "image")) : internal server error (http 500). i have provided user name , api key, don't know problem is. furthermore, code worked stopped working.

regex - Regular expression exclude one word -

i want write regular expression find strings looks "animals.* " on '*' place can symbols, not 'elephant'. result should be: input: animals.fox => result: animals.fox input: animals.kitten => result: animals.kitten but input: animals.elephant => result: none i write regular expression, not work properly. how fix it? animals\.(?!elephant) it seems problem matching word after . . lookahead used zero-width assertion not put matched chars output, checks if text right of current location not match pattern. if matches, match failed. else, returns true . so, need consume word after . . add [a-za-z]+ or \w+ @ end of pattern (depending on need match, letters or letter/digits/underscore): animals\.(?!elephant)\w+ see regex demo

Nesting JSON query result in SQL server 2016 -

i have following test data: create table #t (meterid int,[description] varchar(255),[status] varchar(55),date datetime2(0),reading int) insert #t select 4201544,'home test','active','2016/03/23 06:13',105678 insert #t select 4201544,'home test','active','2016/03/23 06:14',105682 insert #t select 4201544,'home test','active','2016/03/23 06:15',105684 insert #t select 4201544,'home test','active','2016/03/23 06:16',105685 insert #t select 4201544,'home test','active','2016/03/23 06:17',105686 insert #t select 4201544,'home test','active','2016/03/23 06:18',105688 insert #t select 4201544,'home test','active','2016/03/23 06:19',105688 insert #t select 4201544,'home test','active','2016/03/23 06:20',105689 insert #t select 4201544,'home test','active','2016/03/23 06:21',1

PHP: set @deprecated annotation for annotated @method -

i can set @deprecated annotation php method: /** * @deprecated */ public function deprecatedmethod() { } how can mark annotated @method deprecated? /** * @method deprecatedmethod() */ class foo {...}

xml - Date Field Validation failed for type xsd:gYear type in SOAP ui -

i having trouble identify validation logic soapui implements. there 1 date field type xsd:gyear defined in local xsd used in wsdl. when validating value "20161411" failed in soapui, same field passing in java framework, have same xsd , same wsdl . field : <date>20171210</date> it's type xsd:gyear defined in xsd below :- <xsd:simpletype name="date_noid"> <xsd:union membertypes="xsd:gyear"/> </xsd:simpletype> when providing value 20171210 8 digit, it's throwing me error in soapui , doing right click --> validate . the error message "union value '20171210' not match members of 'date in namespace http://www.acord.org/standards/pc_surety/acord1/xml/ '". if give value "201615" 6 digit it's passes validation in soapui . so want understand how soapui, setting maxlength feild i.e of type xsd:gyear the same field passing in java, having same xsd

change color according to day night time in android -

Image
i want develop sample app can continuously track time , can update app ui respect time. i.e. if time 9:00 image showing morning , after time interval image looking different. may not able explain question properly, want achieve in image, i tried google it, not getting specific method achieve this, suggestion great me. thanks here code may solve purpose.the concept simple.just take time want validate calendar class , compare current time , take appropriate action. textview textview = (textview) findviewbyid(r.id.text); calendar cal = calendar.getinstance(); cal.settimeinmillis(system.currenttimemillis()); cal.set(calendar.hour_of_day, 3); cal.set(calendar.minute, 00); cal.set(calendar.second, 0); long noon_start = cal.gettimeinmillis();//3.00 cal.set(calendar.hour_of_day, 5); cal.set(calendar.minute, 30); long noon_end = cal.gettimeinmillis();//5.30 long = system.currenttimemillis();//current time if(now > noon_start && < noon_end) { //set bac

how to change image in Recycler View in android (like a radio button)? -

i having recycler view. it's grid view. total of 9 images in grid layout. if click image in 1 of above, image have change image. if click image. last 1 want reset. clicked image alone change highlighted image. here code... holder.mlayout.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { //for (int = 0; < data_collection.size(); i++) { holder.mlayout.setvisibility(view.visible); holder.mhighlighted.setvisibility(view.gone); if (position == i) { } //} holder.mlayout.setvisibility(view.gone); holder.mhighlighted.setvisibility(view.visible); mhighlight.onhighlight(position, view); } }); remove dont need. @override public void onbindviewholder(final simpleviewholder holder, final int position) { holder.textview.settext(elements.get(position).getname()); holder.textview.se

Multiple value checks using 'in' operator (Python) -

if 'string1' in line: ... ... works expected if need check multiple strings so: if 'string1' or 'string2' or 'string3' in line: ... ... doesn't seem work. if any(s in line s in ('string1', 'string2', ...)):

Javascript/Jquery change class of Select after selecting option -

so have select box color grey after selecting option color of box should turn black. using following code accomplish event $('.change_color').on("change",function() { $(this).removeclass('grey_color'); $(this).addclass('black_color'); }); .grey_color{ color: #999; } .black_color{ color: #000; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <div> <select class="change_color grey_color"> <option>12th standard</option> <option>high school</option> <option>first year</option> </select> </div> i can't seem figure out error. seems working per requirement. here link code: http://codepen.io/anon/pen/rrjgeo markup: <!doctype html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset=&quo

javascript - Finding all combination sequences from array in JS -

disclaimer: know part of question has been asked , answered here before , yes, have helped me point far. let's have array contains 2 elements , want find possible combinations made of these elements. order of sets not matter. var myarr = ['a','b']; desired result var result = [ [a], [a,b], [b], [b,a] ] at first thought looking power set not want null set , want treat [a,b] , [b,a] unique sequences not equals. more info sets, null set, , equal sets here . so far have written function recursively loop through array, create new arrays each possible combinations , push them results array. function getcombinations() { var myarr = ['a','b'], result = []; var recurfn = function(prefix, myarr) { (var = 0; < myarr.length; i++) { var newarray = prefix !== '' ? [prefix, myarr[i]] : [myarr[i]]; result.push(newarray); recurfn(prefix + myarr[i], myarr.slice(i + 1)); }

selection - Gimp python-fu how do I select a polygon? -

problem i have need make polygonal selection on image hundreds of times. help, have been trying use python console create script in calculated fashion (same size area, hundreds of different start points). using gimp 2.8.18 on windows 10 machine. the problem function pdb.gimp_image_select_polygon not seem function. code here bare bones of trying in python console: theimage = gimp.image_list()[0] op_add = 0 point_count = 5 x = 0 y = 0 points = [0.0 in range(0,10)] points[0] = 64.0 + (128.0 * x) points[1] = 64.0 * y points[2] = 128.0 * x points[3] = 32.0 + (64.0 * y) points[4] = 64.0 + (128.0 * x) points[5] = 64.0 + (64.0 * y) points[6] = 128.0 + (128.0 * x) points[7] = 32.0 + (64.0 * y) points[8] = 64.0 + (128.0 * x) points[9] = 64.0 * y pdb.gimp_image_select_polygon(theimage, op_add, point_count, points) when runs, nothing happens. otoh, if use selection function, selection: pdb.gimp_image

php - Javascript and Cross Origin -

i've been working on lookup using third party api, completes form, submits it, looks record @ third party , returns array. i've got working on 2 seperate pages i'd roll 1 page , remove need refresh, looked @ converting code , using , xhr request data thrid party have said wont work because don't support cross origin data/lookups. i know tha php , javascript totally different , php executed server side there way use onclick on button pass form data using php results pass javascript? any or pointers appreciated so in short wanted able condense these 2 pages 1 enter lookup details, click submit, runs lookup page 2 , fills in second form. code follows: page 1: <?php //login , authtoken $curl = curl_init(); curl_setopt_array($curl, array( curlopt_url => "https://thirdpartyurl.com", curlopt_returntransfer => true, curlopt_encoding => "", curlopt_maxredirs => 10, curlopt_timeout => 30, curlopt_http_version =>

sql server - Update row entries using Transact-SQL -

i have sql server 2014 database called database.main has columns type , code . i need modify existing transact-sql script select rows have type equal myobject.main , change code integer 1000. how can in transact-sql? begin try begin tran update_table; commit; end try begin catch print 'error encountered updating entries' print error_message() rollback; end catch answer based on answer raul below solution this: begin try begin tran update_table; update database.main set code = 1000 type = 'myobject.main'; commit; end try begin catch print 'error encountered updating entries' print error_message() rollback; end catch a simple update command do? update table_name set code = 1000 type = 'myobject.main';

javascript - Not able to replace all occurence of a json key correctly -

hi have nested json object. i want rename occurrences of total_exec_qty_buy & total_exec_qty_sell total_exec_qty ; total_num_ords_buy & total_num_ords_sell total_num_ords i'm doing in following way: newarray = json.stringify(newarray).split('"total_exec_qty_buy":').join('"total_exec_qty":'); when 1 statement(above one) output fine. when this: newarray = json.stringify(newarray).split('"total_exec_qty_buy":').join('"total_exec_qty":'); newarray = json.stringify(newarray).split('"total_exec_qty_sell":').join('"total_exec_qty":'); newarray = json.stringify(newarray).split('"total_num_ords_buy":').join('"total_num_ords":'); newarray = json.stringify(newarray).split('"total_num_ords_sell":').join('"total_num_ords":'); then output: "\"\\\"[{\\\\\\\"tota

sql server - Entity Framework 6 query generates NullReferenceException -

edit: not problem ignorance of basic programming (such trying dereference null object reference). edit: added stack trace ef within linqpad. using ef6, have simple query : var menu = dbcontext.tree.where(t => t.left > 2 && t.right < 10).tolist(); this worked right until mysteriously stopped. dbcontext.tree view in sql server 2012. using linqpad5, results expect using built-in connection. setting ef connection project, nre. checking sql, can copy , paste sql query window , proper results. nre without call, also. i've tried updating model database refresh anything. i've tried removing view model , updating. i've tried deleting model entirely , recreating it. i've restarted visual studio , computer. same nre query. don't know else can try, , nre makes no sense me @ all, given results expect using ef. i'd chalk bug ef if didn't see working previously. has dealt this? searching online specific set of circumstances has produced no

MongoDB aggregation framework to get frequencies of fields' values -

i have collection populated documents conform following schema: { _id, name: string, actiontime: date, n1: number, // 1<=n1<=10 n2: number, // 1<=n2<=10 n3: number // 1<=n3<=20 } i want frequencies of each possible numbers of n1,n2,n3. so, example if have following documents: { _id: 1, name: 'label1', actiontime: date.now, n1: 4, n2: 9, n3: 18 }, { _id: 2, name: 'label2', actiontime: date.now, n1: 1, n2: 6, n3: 11 }, { _id: 3, name: 'label3', actiontime: date.now, n1: 4, n2: 2, n3: 5 } i have result document of form (or this): { "n1": { "_id": 1, "total": 1, "_id": 2, "total": 0, ... "_id": 4, "total": 2, ... }, "n2": { "_id": 1, "total": 0, "_id": 2, "total": 1, ... "_id": 6, "total": 1, ...

Vertical page swipe feature in tizen wearable(only using TAU) -

i couldnt find default animation features supported tizen other data-transition="slideup" anchor tag or popups . didnt explore or tizen(using tau) gives limited support animation reasons performance? can use page swiper in wearable? as per knowledge tizen don't have vertical swipe control till now. can find horizontal swipe online sample, new project>online sample> tauuicomponents from app goto controls>page indicator horizontal swipe. if want use vertical swipe, think have developed own. can use tau or can external library jquery. i suggest use dragend js purpose. can source code here . -thanks

python - Selecting all records id's from Odoo Contacts listview -

i have written python code in .py file display wizard class displaywindow(models.model): _inherit = 'res.partner' wizard_id = fields.many2one('sale.example_wizard') def result_to_search(self, cr, uid, active_ids): wizard = self.pool['sale.example_wizard'].create(cr, uid, vals={ 'partner_ids': [(6, 0, active_ids)] }) return { 'name': _('account search'), 'type': 'ir.actions.act_window', 'res_model': 'sale.example_wizard', 'res_id': wizard, 'view_type': 'form', 'view_mode': 'form', 'target': 'new', } and here .xml file <openerp> <data> <!--this xml file responsible server action of displaying wizard--> <record model="ir.actions.server" id="action_search_for_result"> <field name="nam

UItextField restrict user to enter number only IOS app on ipad -

i'm developing app ipad. i'm designing forgot password screen allow user enter password uitextfield . design, password allow numeric input. can set uitextfiled keyboardtype phonepad in iphone option seem not working ipad (ipad show full keyboard layout). how can achieve keyboard ipad app have number? do have design own keyboard layout? appreciate. thanks! the keyboard type not dictate sort of input textfield accepts, if use custom keyboard displays numbers, user can paste or use external hardware keyboard. to that, need observe input, example, becoming uitextfielddelegate , then: example in swift: func textfield(_ textfield: uitextfield, shouldchangecharactersin range: nsrange, replacementstring string: string) -> bool{ // non decimal digit character set, better save property instead of creating each keyboard stroke let non_digits = nscharacterset.decimaldigits.inverted // find location non digits let range = string.rangeofcharacter(from:

c - Days between dates will not compile -

i have been trying work. need input 2 dates (mm dd) , have program tell me amount of days between 2 dates. reason when try use month 2 (february) dont think registering indicated having 28 days. when enter same date cant "0". please thank you #include <stdio.h> #include <stdlib.h> //constructs dates calculation struct date{ int month; int day; };//end date int main() { struct date first, second; //creates 2 dates calculate int finaldays = 0; int total = 0; int = 0; int valid=0; printf("enter first date \n"); scanf("%d %d", &first.month, &first.day); //user input: first date if (first.month == 1||3||5||7||8||10){ if(first.day > 31){ printf("invalid day\n"); valid += 1; } } else if (first.month == 4||6||9||11 ){ if (first.day > 30){ printf("invalid day\n"); valid += 1; } } else if (firs

python - Creating combinations from a tuple -

i take data database. database come in form of tuple: [('test1', 'test12', 'test13', 'test14'), ('test21', 'test22', 'test23', 'test24'), ('test31', 'test32', 'test33', 'test34'), ('test41', 'test42', 'test43', 'test44'), ('test51', 'test52', 'test53', 'test54'), ('test61', 'test62', 'test63', 'test64'), ('test71', 'test72', 'test73', 'test74'), ('test81', 'test82', 'test83', 'test84'), ('test91', 'test92', 'test93', 'test94'), ('test11', 'test12', 'test13', 'test14')] and that's want: make combinations of these input... output had combination of 4 parameters (such in example) and... 1) importantly, new combinations,the values in place, i.e. if in o

VB.NET DirectorySearcher Won't retrieve AD users with empty properties -

i using code retrieve user ad datagridview on windows form. works long none of properties empty. private sub button9_click(sender system.object, e system.eventargs) handles button9.click dim direntry system.directoryservices.directoryentry dim mysearcher system.directoryservices.directorysearcher dim domainname string = system.net.networkinformation.ipglobalproperties.getipglobalproperties().domainname try direntry = new system.directoryservices.directoryentry("ldap://" & environment.userdomainname) mysearcher = new system.directoryservices.directorysearcher(direntry) mysearcher.filter = "(samaccountname=" & textbox8.text & ")" mysearcher.propertiestoload.add("samaccountname") mysearcher.propertiestoload.add("displayname") mysearcher.propertiestoload.add("description") mysearcher.propertiestolo

interpolation - Matlab spline function in Julia -

i trying interpolate 2 points in julia, using same approach of matlab ( https://uk.mathworks.com/help/matlab/ref/spline.html ). have tried interpolations ( https://github.com/tlycken/interpolations.jl ) library, having several issues in creating working script. i have dataarrays.dataarray{float64,1} 2 points (let's 1.5 , 10.5) , 5 na between them: using dataframes using interpolations = @data([1.5, na, na, na, na, na, 10.5]); in matlab sufficient run spline function. in julia, interpolate function allows cubic interpolations. however, seems not working nas. how can it? also, use same / analogous algorithm interpolate points? if make assumption evenly spaced, assuming linear interpolation can use linspace. need start, end, , number of values inbetween: linspace(a[1],a[end],sum(isna(a))) more generally, interpolation between nas, can find non-na values with idxs = find(~isna(a)) and do for in 1:length(idxs)-1 tmpidxs = idxs[i]:idxs[i+1] a[idxs[i]+1

for loop - Use set.seed() with foreach() in R -

i running simulation using loop in r, want switch on foreach loop since faster. use set.seed() in loop, , use again foreach can obtain identical results. for example, suppose have x <- c() (i in 1:10){ set.seed(i) x[i] <- rnorm(1) } how can same thing using foreach? don't think works: x <- foreach(i = 1:10, ...) %dopar% {set.seed(i) ... } this works: library (foreach) fn<-function(i) { set.seed(i) y <- rnorm(1) return(y) } x<-foreach(i=1:10) %do% fn(i) print(x)

Why have a 1:1 Relationship - Database Design? -

i'm looking @ existing database schema , i'm bit confused regarding 1:1 realtionship in example below: event ----- id int (pk) title varchar description varchar organizerid int (fk) eventschedule ------------ id int (pk) eventid int (fk) start datetime end datetime repeatrule varchar (ical format repeating events) venue ----- id int (pk) eventid (fk) name varchar address1 varchar address2 varchar city varchar region varchar postcode varchar latitude float longitude float an event ever takes place @ 1 location there 1:1 relationship between event , venue. event has 1:1 relationship eventschedule - ical repeat rule captures repeating events. would there reason or instance separating tables this? wrong in having single table follows: event ----- id int (pk) title varchar description varchar organizerid int (fk) start datetime end datetime repeatrule varchar (ical format repeating events) venue varchar address1 varchar address2 varchar city varchar region

sql server - can't abbreviate in SQL? -

i'm trying update across 2 tables. update agr_admin.apiaries_20160920_updatetest sde join agr_admin.apiariestempfromplants plants on sde.locationid = plants.locationid set sde.longtitude = plants.longtitude sde.locationid = plants.locationid , sde.objectid = 1; i'm getting: msg 102, level 15, state 1, line 1 incorrect syntax near 'sde'. what what? why abbreviation problem? in advance! based on error message,i believe sql server modify query below update sde set sde.longtitude=plants.longtitude agr_admin.apiaries_20160920_updatetest sde join agr_admin.apiariestempfromplants plants on sde.locationid=plants.locationid sde.locationid=plants.locationid , sde.objectid=1; you not using right syntax ,that's it..below syntax update { { table_alias | <object> | rowset_function_limited } | @table_variable } you using join

Configure spring cloud contract and Zuul proxy in the same project -

i have problem integrating spring-cloud-contract service on consumer side. in service use feign (to call other services) , zuul (for routing) spring-cloud. problem happens when try run test annotated @autoconfigurestubrunner. simple class: @runwith(springrunner.class) @springboottest @autoconfigurestubrunner(ids = {"group:artifact:+:stubs:8080"}, workoffline = true) public class withcontracttests { @test public void test() {} } in output can see stubs started properly: o.s.c.c.stubrunner.stubrunnerexecutor : stubs running runningstubs [namesandports={group:artifact:1.0.0-snapshot:stubs=8080}] and have error while creating spring context: caused by: java.lang.unsupportedoperationexception: null @ java.util.abstractlist.add(abstractlist.java:148) ~[na:1.8.0_91] @ java.util.abstractlist.add(abstractlist.java:108) ~[na:1.8.0_91] @ java.util.abstractcollection.addall(abstractcollection.java:344) ~[na:1.8.0_91] @ org.springframework.cloud.contract.stubrunne

java - NoClassDefFoundError: org/testng/TestNG -

this error noclassdeffounderror: org/testng/testng appears when i'm trying run test testng.xml file using intellij idea. running test 1 one works running whole gradle project points testng.xml , grade core-test:test ( on project i'm using appium + intellij + testng ) but when i'm running testng.xml using intellij i'm getting message after pressing run: exception in thread "main" java.lang.noclassdeffounderror: org/testng/testng @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.defineclass(classloader.java:763) @ java.security.secureclassloader.defineclass(secureclassloader.java:142) @ java.net.urlclassloader.defineclass(urlclassloader.java:467) @ java.net.urlclassloader.access$100(urlclassloader.java:73) @ java.net.urlclassloader$1.run(urlclassloader.java:368) @ java.net.urlclassloader$1.run(urlclassloader.java:362) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlcl

JSCH Channel Is Not Opened (New) -

problem: connecting remote site sftp using jsch library results in "channel not opened". code works fine 1 internet connection, fails another. done via proxy. nevertheless, can connect sftp another, using filezilla client. research: tried increasing connection timout , setting usedns: false similar questions. i've got session , channel opned it. still, after timout, channel connection fails. question: how connection. below code , error stack trace extracts: jsch jsch = new jsch(); userinfo userinfo ; jsch.setknownhosts(known_hosts); session = jsch.getsession( menue.site_login, menue.site_host, menue.site_port); session.setpassword( menue.site_password); if (menue.use_proxy) { session.setproxy( new proxyhttp( menue.proxy_host, menue.proxy_port)); } session.setconfig( "stricthostkeychecking", "yes"); session.connect(); channel = session.openchannel("sftp");

Share common definition between Delphi and C++ projects -

is there elegant way share common symbol definition between delphi , c++ (visual studio) project? the symbol might defined or not defined depending on circumstances. possible define symbol in both projects, might comment out in 1 project , forget in other (or vice versa). if possible, i'm guessing symbol need put .h or .inc file , included in both projects. // delphi {$define common_symbol} //... some_constant = {$ifdef common_symbol} 80 {$else} 40 {$endif}; // c++ #define common_symbol //... #ifdef common_symbol #define some_constant 80 #else #define some_constant 40 #endif in above code, if common_symbol defined, some_constant 80, otherwise 40. here links may help: if need convert c++ header files delphi may try jedi api library . if need convert delphi sources c++ header files may need create such utility yourself. think delphiast start it.

Amazon AWS cost of small basic web -

i need place host small basic static web site made of bunch of file , folders (html, css, images, etc.) non-profit. i've looked @ amazon aws bit , looks done small cost. is possible host web site @ amazon aws under $1.00/month? is there way use free aws , determine cost have been if 1 used paid option? is possible host web site @ amazon aws under $1.00/month? if have static files, can host site on s3 low price. if have dynamic website (php, ruby, python, java, etc.) need actual server run on, , more $5 month minimum. note pay data transfer, if site gets popular price start go up. is there way use free aws , determine cost have been if 1 used paid option? you can enable detailed billing on aws account. punch numbers aws cost calculator see charges have been if not in free tier period.

ScrollPanes in JavaFX 8 always have gray background -

when upgraded javafx app javafx 2 javafx 8, noticed scrollpanes showed gray rectangles, background color set or background set transparent. i found solution in discussion: https://community.oracle.com/thread/3538169 first needed this: .scroll-pane > .viewport { -fx-background-color: transparent; } then set background color whatever like. in case, i'm making scrollpane backgrounds transparent: .scroll-pane { -fx-background-color: transparent; }

database - MS ACCESS 2007: Limiting subform requery to specific tab -

my database utilizing metrics dashboard put together, there's 5 comboboxes used parameters requery subforms in tabs below it. have functional, 5+ subforms based on multiple queries using same paramters, performance starting take hit. how go limiting requery selected tab? i can't paste code, it's consisting of bunch of me.[subform].requery's each query/subform references same parameters across multiple tabs. thanks in advance! so ended finding answer own question, took time respond. ended using select case code tab in parameter combobox after updates. private sub cbomonth_afterupdate() select case me.tabctrl.pages(me.tabctrl).name case "analysis" me![sfrm_analysis].requery case "travel" me![sfrm_travel].requery case "sharing" me![sfrm_sharing].requery end select end sub ...and on 3 different comboboxes , 2 text boxes (fy, quarter, month, date-range), didn't post screenshot because

python - How to convert the string '1.000,0.001' to the complex number (1+0.001j)? -

the best come is s = '1.000,0.001' z = [float(w) w in s.split(',')] x = complex(z[0],z[1]) is there shorter, cleaner, nicer way? there's more concise way, it's not cleaner , it's not clearer. x = complex(*[float(w) w in '1.000,.001'.split(',')])

Xamarin android format string onkey pressed -

i have edittext in want user type credit card number, want format string while user typing it, want string have space every 4 numbers, this: xxxx xxxx xxxx xxxx i found use textwatcher , onkeyup couldn't understand how use in edittext, if 1 explain me appreciate it, thanks. create class implements itextwatcher interface. add instance of class text changed listener... public class creditcardformatter : java.lang.object, itextwatcher { private edittext _edittext; public creditcardformatter(edittext edittext) { _edittext = edittext; } public void aftertextchanged(ieditable s) { } public void beforetextchanged(icharsequence s, int start, int count, int after) { } public void ontextchanged(icharsequence s, int start, int before, int count) { } } in activity.. (or oncreateview in fragment) public override void oncreate() { // other code.. myedittext.addtextchangedlistener(new creditcardformatter(

delphi - Disable and change color of node in Treeview -

Image
i looking way of disabling proper nodes . let's have created simple treeview structure below: parent 1 (disable) parent 2 child 1 child 2 (disable) so far have found workaround how that, still doesn't work @ all. use onchanging event handler: procedure tform1.treeviewchanging(sender: tobject; node: ttreenode; var allowchange: boolean); begin if (node.text = 'parent 1') or (node.text = 'child 1') allowchange := false; end; it works, because can't click on node, issue after 'disabling' node way, color of parent 1 , child 1 nodes same other. way change color of nodes (grey)? or maybe know way disabling nodes in ttreeview component? to disable node, set enabled property false . disabled item displayed in gray color. to change normal color of nodes text, change ttreeview.font.color . to change color of disabled nodes text, use oncustomdrawitem event: procedure tform2.treeview1customdrawitem(sender: tcu