Posts

Showing posts from February, 2011

regex - Combining a Variable and Regular Expression in Perl -

i have code: $temp =~ s/\#name\#/$customername/g; where replacing #name# value in $customername using regex. want append variable onto end of name . so want like: $temp =~ s/\#name . $appendvalue\#/$customername/g; so be: $temp =~ s/\#name_1\#/$customername/g; would work or there proper way handle this? test cases: hello #name# this intended #name# the pattern interpolates variables, no concatenation operator needed: $temp =~ s/#name$appendvalue#/$customername/g; you might need protect special characters in variable, though, use \q...\e : $temp =~ s/#name\q$appendvalue\e#/$customername/g; # not special in regex, no backslash needed (but doesn't hurt).

vba - How do I differentiate between placeholders (Tags, Id, Name) on a template and have the label stay once the template is used in the presentation -

i creating custom slide template 8 picture placeholders , 4 text placeholders. idea user "fill-in" template text , images , once macro run, values of placeholders collected , added json file. ideally, 2 picture placeholders (big_screen_i , small_screen_i) , 1 text placeholder (caption_i) collected 1 json object. set repeated 4 times on same slide. here problems: 1) name of placeholder set in slide master view changes when more 1 of same template used (haven't pinpointed exact trigger). names change once image inserted placeholder. locating object name becomes unstable. 2) using .type of placeholder (picture vs text) doesn't differentiate between big_screen_i , small_screen_i. 3) tags , keys change or disappear when using template more once (because of repeated name). 4) unable group objects because not possible group placeholders. is there way identify each shape/placeholder , connect added content? note: using powerpoint 2016 .potm file thank you! ...

javascript - p5.js Shape Adjustments Leaving Previous Outlines Visible -

i trying adjust shape of object using value derived slider on screen using p5.js. the issue having outline of drawn shapes remain, giving after-trail effect. i have tried nostroke() modifier not draw shape. nofill() gives weirder, yet still incorrect, behavoir. code example: https://codepen.io/galleywest/pen/oejxyy var slider function setup() { createcanvas(600, 600) slider = createslider(0, 50, 0) } function draw() { rect(10, 10, 80, 80, slider.value()) } how can mitigate behavior? you need call background() function clear out old frames. var slider function setup() { createcanvas(600, 600) slider = createslider(0, 50, 0) } function draw() { background(255, 0, 0); //draws red background rect(10, 10, 80, 80, slider.value()) } more info can found in the reference .

arrays - Bash - need help splitting a string by colon -

i having trouble using ifs (as internet has led me issue) - keep getting error saying "ifs: command not found" trying split string ':' , store in array, looks a:b:c:d:x:y:z stored in array holds, a, b, c, d, x, y, z elements. have written is ifs = ':' read - r -a arr <<< "$info" where info string being read in file containing multiple strings in aforementioned format reading them in way: while read info lastly when try assign first element in array variable, getting error: export name = $info[0] the 2 errors here export: '=' not valid identifier , export: '[0]: not valid identifier i relatively newcomer bash, suggests great. thank in advance. the basic problem here code contains spaces in places aren't allowed. instance, following fine syntax (though fails comply posix conventions on variable naming , advises lowercase characters used application-defined names): info_string='a:b:c:d:x:y:z...

assembly - What's the purpose of "AND AL,0xFF"? -

i'm reading through disassembled win32 c++ program , see quite few: and al,0xff is pointless or why compiler generate these? here longer example: movsx eax, byte ptr [ebx] shl eax, 18h movsx edx, byte ptr [ebx+1] shl edx, 10h add eax, edx movsx ecx, byte ptr [ebx+2] shl ecx, 8 add eax, ecx movsx edx, byte ptr [ebx+3] add eax, edx xor edx, edx call sub_43b55c mov ecx, eax mov edx, eax sar ecx, 10h , al, 0ffh # <---- sar edx, 8 , cl, 0ffh # <---- mov [esi], cl , dl, 0ffh # <---- mov [esi+1], dl mov [esi+2], al add ebx, 4 add esi, 3 inc ebp cmp ebp, 6 jl short loc_43b5e4 the flags aren't being checked after these operations can't purpose. after and , values in al , cl , , dl being moved [esi + n] . as @fuz suggested, fault of optimizer not recognizing foo & 0xff being no-op in context in used in original function. i compiled...

Python the Hard Way ex48 -

i'm having trouble getting code below test correctly. test_errors() function isn't working correctly, feel i've set code right. line 25 thought work, i'm not having luck. line25: elif not in direction or verb or stop or noun: scan_result = scan_result + [('error', i)] whole code: direction = ('north', 'south', 'east', 'west', 'up', 'down', 'left', 'right', 'back') verb = ('go', 'stop', 'kill', 'eat') stop = ('the', 'in', 'of', 'from', 'at', 'it') noun = ('door', 'bear', 'princess', 'cabinet') lexicon = {direction: 'direction', verb: 'verb', stop: 'stop', noun: 'noun', } def scan(user_input): words = user_input.split() scan_result = [] try: in words: if i.isdigit(): ...

aws lambda - Can Amazon Redshift Autofeed INTO a Kinesis Firehose? -

i want amazon redshift push new rows inserted amazon kinesis firehose transform data lambda function. can done? if so, can point me example , documentation? no. there no trigger mechanism within amazon redshift cause other things happen (either within redshift or external it).

python - How to use pandas dataframe to plot point and figure chart -

i using pandas dataframe manipulate financial time series consists of closing prices , time. display results in point , figure chart of xs , os. however, can't find visualization package in python so. does have experience in plotting point , figure charts python? thanks in advance. pandas has pandas.dataframe.plot enables plot dataframe. can find documentation here: https://pandas.pydata.org/pandas-docs/stable/generated/pandas.dataframe.plot.html the pandas doc provides excellent tutorial on visualization of pandas dataframe , series in link: https://pandas.pydata.org/pandas-docs/stable/visualization.html

html agility pack - Closing anchor tags with HtmlAgilityPack -

i using htmlagilitypack scrape crummy html , links, raw text, etc. i'm running few pages have inconsistently closed <a> tags, this: <html> <head></head> <body> <a href=...>here's great link! <a href=...>here's one!</a> here's unrelated text. </body></html> hap parses this, , helpfully closes open <a> tag, @ end of document: <html> <head></head> <body> <a href="...">here's great link! <a href="...">here's one!</a> here's unrelated text. </a></body></html> in practice means innertext of unclosed link contains text rest of page, gets exciting when parsing page may contain thousands of unclosed tags , megabytes of text. so, how can make hap close tags immediately, ideally putting close before next open there never overlap <a> ? i've played around optionfixnestedtags , optionautocloseonend ...

php - Custom server environment variables without .htaccess -

what other options available setting environment variables? many cloud platforms such heroku/cloudways/do etc have gui set environment variables, typically php frameworks symfony or lavavel. an example app_env=production although can set these via .htaccess file using setenv app_env "production" looking find other ways these can persistently set. e.g don't things export app_env=production on cli or putenv() in php? i ideally ideas work on shared hosting or cpanel servers if possible. thanks

sql - count and repetive structure -

we have 490 students have capacity of 20 students per classroom ie have 490/20 = 24.5 ie 25 sections first want arrange students in alphabetical order secondly want make table containing id_classroom , id_student attributes problem in id_classroom , how populate how can automatically give students 1 20 === id_classroom = 1 students 21 40 === id_classroom = 2 , on thank in advance in sql resquest, function floor friend. reduce number largest integer less or equal expression. let's have student id 46. operation this: 46-1= 45 //index starts @ 1 instead of 0. 45/20=2.25 floor(2.25)=2 2+1=3 so sql have such in it: id_classroom=floor((id_student-1)/20)+1

swift - How to disable UITabBarItem without greying the item -

Image
is possible disable uitabbaritem without greying out image , text? i'm disabling item when item becomes disabled it's image , text dimmed. there way keep default selected appearance while having disabled? this image bar looks when item disabled. this image bar looks when item enabled. you can tweak customize uitabbarcontroller , tabbaritems , update image

Does the number of records per partition in Kudu have a significant impact on performance? -

does number of records per partition in kudu have significant impact on performance? i hoping performance testing of impala / apache kudu vs impala parquet formats, , wondering if there optimal number of records include per partition? there way set dynamically table may change in size on time? i see in docs create 8 partitions ~800k records. 100k per partition reasonable when have millions or billions of records?

python 3.x - Define function that reads from Lists of lists -

heres quick example:- setup = [['dog','red','big','ears'], ['cat','blue','small','tail']] def do_it(dummy_parameter): if do_it [0][0] == 'dog': print 'dog' elif do_it [0][0] == 'cat' print 'cat' do_it(setup) basically looking go through list of 4 lists, make action depending on each of list contents.. bit vague assistance appreciated! :) getting error typeerror: 'function' object has no attribute '__getitem__' here example how values list , list of list :) recursion :) test = [['a', 'b', 'c'],['d', 'e'], 'f'] def separate(item): try: in item: if type(i) == list: separate(i) else: print(i) except indexerror: pass separate(test)

How to change the state of a CheckBox from an EditText that are in a RecyclerView? -

i have recyclerview follows: private class productadapter extends recyclerview.adapter<productholder> { private list<product> listproductsrecyclerview; public productadapter(list<product> products){ products = product.getlistproduct(true); listproductsrecyclerview = products; amount = new string[products.size()]; } @override public productholder oncreateviewholder(viewgroup parent, int viewtype) { layoutinflater layoutinflater = layoutinflater.from(m_actorder); view view = layoutinflater.inflate(r.layout.act_item_product_adapter,parent,false); return new productholder(view, new mamountedittextlistener()); } @override public void onbindviewholder(final productholder holder, final int position) { final product product =listproductsrecyclerview.get(position); ho...

decidable - Given the encoding of a specific Turing machine, can it be decided if it will halt on a specific input? -

say have universal turing machine encoding of specific turing machine t. have encoding of specific input s. question of whether t halts on s decidable? can simulating running t on s used reach answer? this problem decidable in instances. specific, fixed tm either halts or doesn't on specific, fixed input, assuming moment excluded middle not want challenge here. specific instance of problem fixing tm , input, tm should either halt-accept inputs (not specific, fixed input parameterizing problem, typical input tm solve our parameterized problem) if specific instance if problem has tm halting on supplied input, or should halt-reject if specific instance has tm fails halt. the difficulty specific instance of problem, know specific tm either halts or doesn't given specific input , don't have computationally effective way know case. 1 or other (again, whether accept excluded middle larger discussion) , therefore specific instance of problem decidable -...

java - How to optimize duplicate parts in multiple methods -

i have old validation methods,and have common part. @service public class validator implements ivalidator { @resource private companyrepository companyrepository; @override public void valida(string parama, long id) { //do logic processing of parama company company = companyrepository.load(id); //convert company companydto companydto companydto = companyparser.fromcompany(company); //do logic } @override public void validb(string paramb, long id) { //do logic processing of paramb company company = companyrepository.load(id); //convert company companydto companydto companydto = companyparser.fromcompany(company); //do logic } @override public void validc(string paramc, long id) { //do logic processing of paramc company company = companyrepository.load(id); //convert company companydto companydto companydto = companypars...

html - ASP Radio button will not select when calling JavaScript function onClick -

my javascript working perfectly, though radio buttons not display checked when clicked. when alt+tab away web page , alt+tab back, shows shaded circle around radio button, still no proper check fill. why this? i'm hoping easy fix. updated asp radio button call javascript function asp codebehind issuing postback , clearing controls on page. needless say, asp c# code behind functionality, radio buttons checking when clicked. need see checks on radio buttons when clicked javascript functionality in place. here radio control html: <div class="col s12 form-section" id="crimeinsurance"> <h4 class="section-heading">crime insurance</h4> <p> <asp:radiobutton id="radllcrimeins" runat="server" groupname="crimeinsurance" clientidmode="static" cssclass="with-gap" onclick="return crimeinsurancetoggle();" autopostback="true"...

python - Iterating over string to create array of Lat Long coordinates -

elements of list represent pairs of x , y decimal degree coordinates space between respective x , y coordinates formatted strings: '34.894127 29.761515', '32.323574 30.166336', '32.677296 31.961439', '35.298668 31.559237', '34.894127 29.761515 thus far can pick out first element , set x value: x = mystring[0:mystring.find(' ')] how can iterate on string make array consisting of pairs of x , y coordinates string? where mystring = mystring = "'34.894127 29.761515', '32.323574 30.166336', '32.677296 31.961439', '35.298668 31.559237', '34.894127 29.761515" list of pairs so: x = [pair.lstrip().strip("'").split(' ') pair in mystring.split(',')] # gives: [['34.894127', '29.761515'], ['32.323574', '30.166336'], ['32.677296', '31.961439'], ['35.298668', '31.559237'], ['34.894127', ...

.htaccess - wordpress plugin development to add in htaccess file -

i'm developing plugin in wordpress needs add htaccess code used insert_with_markers it's writing htaccess adds on bottom of htaccess file need add code on top of htaccess file. how do this? you have prepend htaccess rules want add exisiting rules. the: function my_htaccess_contents( $rules ) { $my_content = <<<eod \n # begin added content # protect wpconfig.php <files wp-config.php> order allow,deny deny </files> # end added content\n eod; return $my_content . $rules; } add_filter('mod_rewrite_rules', 'my_htaccess_contents');

Scrapy/Python: Processing values in a yield -

i trying write crawler using scrapy/python, reads values page. i want crawler store highest , lowest values in seperate fields. so far, able read values page (please see code below), not sure how calculate lowest , highest value , store in separate fields ? for example, crawler reads page , returns these values burvale-score = 75.25 richmond-score = 85.04 somano-score = '' (value missing) tucson-score = 90.67 cloud-score = 50.00 so want populate .... 'highestscore': 90.67 'lowestscore': 50.00 how do ? need use array ? put values in array , pick highest/lowest ? also, please note there 2 yield in code .... bottom yield providing urls crawl, , first yield crawl/collects values each url provided bottom yield any appreciated. please provide code examples if can. here code far .... storing -1, in case of missing values. class myspider(basespider): name = "courses" start_urls = ['http://www.example.com/all-...

laravel - Get related posts based on common tag? -

i have posts table has many-to-many relationship tags table, connected using pivot table called tagspivot . show post using following method : public function showpost($titleslug) { $post = post::where('titleslug','=',$titleslug)->first(); return view('posts/show', compact('post', $post)); } then load post tags in view : @foreach($post->tags $ptags) <li><a href="{{route('showtag', $ptags->titleslug)}}" class="button smallgrey">#{{$ptags->title}}</a></li> @endforeach my question is, how list of posts has same tags current showing post ? doesn't have exact same tags, other post has 1 or 2 common tags. if possible list sorted post has common tags current showing post. that's all, sorry bad english posts table : public function up() { schema::create('posts', function (blueprint $table) { $table->increments('id'); ...

sql server - Randomly shows The remote name could not be resolved: "<hostname>" after deploying in azure -

our web api based app has lot of external service calls including keyvault , azure sql database. after deploying in azure appservice randomly getting lot of exception saying "the remote name not resolved:" . getting exception keyvault , other external call used httpclient. sql database getting exception "the underlying provider failed on open." innerexception a network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: tcp provider, error: 0 - no such host known.)", in local machine(iis) not gets exceptions , occurs randomly. badly stucked this. have idea? for sql database possibly caused connection timeout. should increase connection timeout 30 seconds (can set in connection string or connection object) , should include retry logic in app.

Multithreading (in Java) -

Image
i trying understand multithreading , confused how timing of execution of multiple threads causes problems race conditions. read in article: "when introduce concept of multithreading, opening possibility of 2 threads accessing/modifying same object in memory @ same time." mean "at same time"? mean memory location can read multiple threads @ same instance of time example, 2 threads read value of variable @ 1.1 second mark? if yes, diagram java concurrency in practice imply thread b read value 9 tad later thread a? how should interpret it? i try clear , short possible. let's have variable stored in part of memory adress 0x101010. let's variable counter counts how many times function (x) called. there 2 threads (a , b) call function x. has called x , 0.0001 ms later b did well. let's initial value of counter 0. has read value 0 @ time 0s , incremented @ time 0.0002 ms. @ time 0.0002 ms value 1. however, b has read value @ time 0.0001ms (0.00...

xml - How to label chemical structure (images) with continuing numbers in a docbook text? -

in chemical literature structure images labelled numbers according appearance in text independently of figures. these numbers used refer chemicals. please point me instructions how numbering (automatically, not predefined numbers). have google "chemical", "numbering", "count", "docbook", "xml" did not reasonable results. numbering works flawlessly in latex appropriate packages.

c++ - 'make' command error when building cpp program [Oracle- undefined reference to `LdiDateCheck'] -

i tried build c++ program using make command in redhat 5.4 (tikanga) , got following errors /usr/lib/oracle/12.1/client64/lib/libclntsh.so: undefined reference ldidatecheck' /usr/lib/oracle/12.1/client64/lib/libclntsh.so: undefined reference to orameminit' /usr/lib/oracle/12.1/client64/lib/libclntsh.so: undefined reference lxkregexpcountlob' /usr/lib/oracle/12.1/client64/lib/libclntsh.so: undefined reference to lxmdigx' /usr/lib/oracle/12.1/client64/lib/libclntsh.so: undefined reference ztchi' /usr/lib/oracle/12.1/client64/lib/libclntsh.so: undefined reference to sltsmxi' /usr/lib/oracle/12.1/client64/lib/libclntsh.so: undefined reference ons_shutdown_wtimeout_ctx' /usr/lib/oracle/12.1/client64/lib/libclntsh.so: undefined reference to lxhebc' /usr/lib/oracle/12.1/client64/lib/libclntsh.so: undefined reference lhtstrsearch' /usr/lib/oracle/12.1/client64/lib/libocci.so: undefined reference to ldiintertostring' /usr/lib/...

codeigniter - Can't get Another field from session -

i got problem session data, in web, want make different view based on previledge user, here code in controller : $previledge = $this->session->userdata['previledge']; $data['previledge']=$previledge; if($data['previledge'] == 'admin'){ $this->load->view("app_admin/global/header",$d); $this->load->view("app_admin/materi/home"); $this->load->view("app_admin/global/footer"); } else { $this->load->view("app_admin/global/header2",$d); $this->load->view("app_admin/materi/home"); $this->load->view("app_admin/global/footer"); } } if run code above, previledge admin can't go right view. if there suggestion, please inform, thanks its syntax error. $previledge = $this->session->userdata('previledge'); th...

winobjc - Not found 'AppKit/AppKit.h' when build converted iOS project using Windows Bridge for iOS -

with windows bridge ios , converted ios project windows app using vsimporter (follow microsoft's guide: https://github.com/microsoft/winobjc ) but when try build project, shows fatal error: 'appkit/appkit.h' file not found at #import <appkit/appkit.h> what should solve problem?

amazon web services - Failed: IIS Web App Deployment to AWS running Windows Server 2016 Using WinRM -

error msg: 2017-07-28t02:43:40.5075567z deployment failed on machine xxx.amazonaws.com following message : system.management.automation.remoting.psremotingtransportexception: connecting remote server xxx.amazonaws.com failed following error message : winrm cannot complete operation. verify specified computer name valid, computer accessible on network, , firewall exception winrm service enabled , allows access computer. default, winrm firewall exception public profiles limits access remote computers within same local subnet. more information, see about_remote_troubleshooting topic. 2017-07-28t02:43:40.5075567z @ system.management.automation.runspaces.asyncresult.endinvoke() 2017-07-28t02:43:40.5075567z @ system.management.automation.runspaces.internal.runspacepoolinternal.endopen(iasyncresult asyncresult) 2017-07-28t02:43:40.5075567z @ system.management.automation.remoterunspace.open() 2017-07-28t02:43:40.5075567z @ microsoft.visualstudio.services.devtestlabs.deploymen...

android - Same JAVA file for two layouts (XML) in Andorid Studio -

Image
i have 2 layouts application have written logic in mainactivity.java i want use mainactivity.java other layout(xml) file also how can ? this mainactivity.xml (layout file) now want blue button on right resize new layout that new xml (with no java file) layout file now want use same java file (mainactivity.java) new layout file

elixir - Hashtags extraction using regex -

test string: str = "#www #soulmusic #50_shades_of_blue # ##worldwideweb #okie_dokkie #fr!ends #!alpacino #wonderfulride #good#club #rhônealpes #trèsbon #øypålandet http://example.com/#comment #moretags #www nobody #h3y!boy #email" this tried: string.split(str, ~r/\b(#[á-úÁ-Úä-üÄ-Üa-za-z0-9_]+)/, trim: true, include_captures: true) but not exclude hashtag in url receive: ["#www", " ", "#soulmusic", " ", "#50_shades_of_blue", " # #", "#worldwideweb", " ", "#okie_dokkie", " ", "#fr", "!ends #!alpacino ", "#wonderfulride", " ", "#good", "#club ", "#rhônealpes", " ", "#trèsbon", " ", "#øypålandet", " http://example.com/", "#comment", " ", "#moretags", " ", "#www", ...

python - "Dodge" overlapping points in matplotlib? -

i want plot hundred or points on world map. of points close together, able separate them, still approximately in correct position, not overlapping neighbouring points. something this might useful in cases, in others it's going make non-overlapping neighbours overlap. is there nice way in matplotlib, or have manually code kind of force-sprung separator before plotting?

java - addign a existing handler method with setOnAction -

i want assign existing handlemodellaction method generated hyperlink setonaction method, don't know how this. here code example:- @fxml private void handlemodellaction(actionevent event) throws ioexception{ fxmlloader load = new fxmlloader(getclass().getresource("inex.fxml")); parent root = (parent) load.load(); stage stage = new stage(); stage.setscene(new scene(root)); stage.show(); link = (hyperlink) event.gettarget(); model = link.getid(); stage.settitle(model); } public void addneuesmodell(string bauart, string modelname){ modelhyperlink = new hyperlink(); modelhyperlink.setid(modelname); modelhyperlink.settext(modelname); modelhyperlink.setonaction(#handlemodellaction); } does know how this? thanks lot :) you try call setonaction method on modelhyperlink , pass parameter anonymous class handler, in transfer logic of handlemodellaction method. below can find example: hyperlink link = new ...

javascript - Jquery Organization Chart -

Image
my organization chart has testing , developing teams. 1 employee(tester) working in both teams combine developing team tree testing team tree. worked out this no use please me html <div class="tree"> <ul id="testing"> <li parent-id=0 emp-id=1>rao</li> <li parent-id=1 emp-id=2>venkat</li> <li parent-id=2 emp-id=3>ragava</li> <li parent-id=3 emp-id=4>basha</li> <li parent-id=3 emp-id=5>tester1</li> <li parent-id=5 emp-id=6>tester1a</li> <li parent-id=5 emp-id=7>tester1b</li> </ul> <ul id="development"> <li parent-id=0 emp-id=8>vengal</li> <li parent-id=8 emp-id=9>naren</li> <li parent-id=9 emp-id=5>tester1</li> </ul> </div> jquery var $ul = $('ul'); $ul.find('li[parent-id]').each(function() { $ul.find('li[parent-id=...

angular - Same form for creating and editing data Angular4 -

here form 2 way-binded input fields. goal create same form edit , create data. accomplished, pretty sure there better way (like using abstractcontrol features). miss 1 fix here - if clickedit() being clicked need update form values object user wants edit. , explanations abstractcontrol , ngmodel .. <div> <form (ngsubmit)="clicked ? oneditsubmit($event) : onregistersubmit($event)" [formgroup] = "form"> <div class="form-group"> <label>full name</label> <input type="text" [(ngmodel)]="fullname" formcontrolname="fullname" class="form-control" > </div> <div class="form-group"> <label>username</label> <input type="text" [(ngmodel)]="username" formcontrolname="username" class="form-control" > </div> <div class="form-group"> <label>email</lab...

debugging - Idea debugger don't work (or stop?) with Meteor app -

i use intellij idea 2017.2 meteor project. debug starts without problems, ignores breakpoints , works simple run. os: ubuntu 16.04 it's known issue unfortunately, please follow web-25102 updates

Excel VBA Run time error 450: Selection.Style = "Comma" -

i have received error 450 line of coding of selection.style="comma" , don't know what's going on. can teach me how fix it? possibly using older version of excel? range("e65536").end(xlup).offset(1, 0).select activecell.formula = "=sum(e2:e" & activecell.row - 1 & ")" activecell.copy range(activecell, activecell.offset(0, 2)).select ' <---------selecting e50:g50 selection.pastespecial paste:=xlpasteformulas, operation:=xlnone, >skipblanks:=false, transpose:=false selection.borders(xledgetop) ' borders sum results .linestyle = xlcontinuous .colorindex = xlautomatic .tintandshade = 0 .weight = xlthin` end selection.borders(xledgebottom) .linestyle = xldouble .colorindex = xlautomatic .tintandshade = 0` .weight = xlthick` end selection.style = "comma" ' <--------------------error occur in line selection.numberformat = "_(* #,##0_);_(* (#,##0);_(* ...

javascript - Google distancematrixservice response.rows[i].elements.status is zero_results but variable undefined -

i'm using example code google api distance matrix service. want catch zero_results return, if i'm trying check response.rows[i].elements.status, console.log() says it's undefined. if dump response.rows[i].elements console see value set "zero_results". function calcdistance() { var finaldistance = ""; var service = new google.maps.distancematrixservice(); service.getdistancematrix( { origins: [autocomplete.getplace().geometry.location], destinations: [autocomplete2.getplace().geometry.location], travelmode: 'driving' }, callback); function callback(response, status) { if (status == 'ok') { var origins = response.originaddresses; var destinations = response.destinationaddresses; (var = 0; < origins.length; i++) { var results = response.rows[i].elements; console.log(response.rows[i].elements); console.log(res...

c# - Concurrent access approach in .NET 3.5 -

this question has answer here: return value style question 4 answers returning values 2 answers .net return value optimization 4 answers ... private static readonly object syncroot = new object(); private dictionary<int, string> mydict = new dictionary<int, string>(); private dictionary<int, string> mydict { { dictionary<int, string> dict = null; lock (syncroot) { dict = mydict; // <- ?? return dict; } } set { lock (syncroot) { mydict = value; } } } .... var test = mydict; foreach(var t in test) { .... } in .net 3.5 project found approa...

WorkItemStore.Query("YourQuery") Getting Error when fetching data from TFS in .Net c# -

i'm getting problem when i'm fetching data vstf server using following code. can me how can extend collection size or else achieve more records. uri tfsuri = new uri(uri); tfsteamprojectcollection tfs = new tfsteamprojectcollection(tfsuri, tfscredential); workitemstore workitemstore = new workitemstore(tfs); var query = workitemstore.query(projectquery); i'm getting error in last row of code. please follow following error given below: processing team project "[myproject]" error occurred while processing team project "[myproject]": vs402337: number of work items returned exceeds size limit of 50000. change query return fewer items. microsoft.teamfoundation.workitemtracking.client.verbatimmessageexception: vs402337: number of work items returned exceeds size limit of 50000. change query return fewer items. ---> system.web.services.protocols.soapexception: vs402337: number of work items returned exceeds size limit of 50000....

node.js - How does exactly Express.js handle errors? -

so, trivial thing. know express has built-in default error handler expect 4 arguments (err, req, res, next) handle "synchronous exceptions" referenceerror, typeerror, etc: update: question express-specific, not how catch unhandled exceptions/etc. want know how in first code block express can handle user-defined exception. second example async. exception doesn't directly belongs question. const express = require('express')(); express.all('*', (req, res) => { throw new error('my own error'); res .send('okay?'); }); express.use((err, req, res, next) => { console.error(err.stack); res .status(503) .send('express still , running'); }).listen(3000); but not this: const express = require('express')(); express.all('*', (req, res) => { process.nexttick(() => { throw new error('my own error'); }); res .send('okay?'); }); express.use((err, req, re...

groovy - How to use IgnoreIf in Spock, when I check the variable? -

i need skip functions in program, should depend on variable defined in same program. how can it? def skip = true @ignoreif({ skip }) def "some function" () { .. } another way using spock 's configuration file include/exclude tests or base classes. first create own annotations , place on tests. write spock configuration file. when run tests can set spock.configuration property configuration file of choice. way can include/exclude tests , base classes want. example of spock configuration file: runner { println "run tests" exclude enva } your test: @enva def "some function" () { .. } you can run : ./gradlew test -pspock.configuration=myspockconfig.groovy here github example

android - How to enable and disable radiobutton inside Radiogroup items in dialog -

i have alert dialog, consist of radio-group, question how enable &disable radio button, when click on 1 radio button, should disable till, click on next radio button. please me out. public class adddriverstatedialog extends dialogfragment { private static adddriverstatedialog adddriverstatedialog; // data references private int driver_state = 0; private calendar calendar; private int year, month, day, hours, minutes; private simpledateformat dateformat = new simpledateformat("eee, d mmm yyyy"); private simpledateformat timeformat = new simpledateformat("h:mm a"); // ui references private view view; public linearlayout editabledetails; private radiorealbuttongroup radiobuttongroup; private radiorealbutton radiobutton_offduty,radiobutton_onduty,radiobutton_sleeper,radiobutton_driving,radiobutton_yard,radiobutton_personal; private edittext note, et_date, time, odoreading, location; private checkbox i...

android - cursor.getLong(1) not throwing Exception -

i have field in database null when retrieve in cursor null. can tell cursor.isnull(1) true when cursor.getlong(1) should throw exception according documentation. retrieves 0 without , exception. ideas why? if take @ implementation of method getlong() in matrixcursor , can see following code: @override public long getlong(int column) { object value = get(column); if (value == null) return 0; if (value instanceof number) return ((number) value).longvalue(); return long.parselong(value.tostring()); } if value null, 0 returned.

How can I get my last input (float) data in C? -

i input here example 101-name-3.4 3.4 not input. it's not showing in output. how can solve this? for(i=0; i<n; ++i){ printf("enter id-name-cgpa receptively: "); scanf("%lld-%[^-]s-%f", id[i], name[i], cgpa[i]); } you need remove trailing s scanset directive in format string: scanf("%lld-%[^-]-%f", id[i], name[i], cgpa[i]); the s not part of scanset directive, , scanf() attempting, , failing, match s in input. detected if code checking return value call scanf() , practice. also, no declarations shown, if id[] declared array of long long int s, , cgpa[] declared array of float s, address operator should used: int ret_val = scanf("%lld-%[^-]s-%f", &id[i], name[i], &cgpa[i]); /* ret_val should 3 */

c - OpenSSL 1_1_0e BN_print_fp not working -

i using openssl 1_1_0e , cannot figure out what's wrong code: #include <openssl/rsa.h> int main(){ bignum *bne = null; unsigned long e = rsa_f4; rsa *r = null; bne = bn_new(); bn_set_word(bne,e); r = rsa_new(); bignum *n = null; bignum *d = null; rsa_get0_key((const rsa *) r, (const bignum **) &n, null, (const bignum **) &d); bn_print_fp(stdout, n); rsa_free(r); bn_free(bne); return 0; } valgrind says there invalid read of size 4: ==8066== invalid read of size 4 ==8066== @ 0x4ef603e: bn_print (in /home/roman/dropbox/uni/rsa/my_work/library/lib/libcrypto.so.1.1) ==8066== 0x4ef662d: bn_print_fp (in /home/roman/dropbox/uni/rsa/my_work/library/lib/libcrypto.so.1.1) ==8066== 0x40093b: main (in /home/roman/dropbox/uni/rsa/my_work/sharedlibrarytest) ==8066== address 0x10 not stack'd, malloc'd or (recently) free'd what wrong code? looks fine me. i cann...

Angular 2 Reactive form make both select dropdowns required if one has had one of its options selected -

i have 2 select dropdowns. both optional fields. need them both required if 1 of 2 has had 1 of options selected. i'm looking everywhere , know custom validator have no idea begin examples online don't come close need. let assume if enter pin , confirmpin must ( vice versa ) else no need of required validations both. code: this.userform = this.fb.group({ .... .... security: this.fb.group({ pin: [this.securityobj.pin], confirmpin: [this.securityobj.confimrpin] }, {validator: abhimatcher}) }); customvalidator export const customvalidator= (control: abstractcontrol): { [key: string]: boolean } => { const initaltext = control.get('pin'); const requiredtext = control.get('confirmpin'); if (initaltext || requiredtext) return null; else return { customvalidate: true }; } html <form [formgroup]="userform" novalidate (ngsubmit)=...

codenameone - Codename one:Copy msg to clipboard -

i have developed application using codename one.i have copy message clipboard application. there default functionality in codename 1 that? if not there other solution in codename 1 ? in advance. the display class has copy clipboard api call isn't implemented on ios currently. have 2 options: use share intent "really" want when offering copy clipboard. place data in text area or text field , open editing using start edit. allow user use native copy & paste functionality of device.

javascript - getElementByClassName isn't work -

i have problem why not want work tired time. started learning js. great help <!doctype html> <html> <head> <title></title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <img class="test" src="https://storage.googleapis.com/gweb-uniblog-publish-prod/static/blog/images/google-200x200.7714256da16f.png"> <img class="test" src="https://storage.googleapis.com/gweb-uniblog-publish-prod/static/blog/images/google-200x200.7714256da16f.png"> <script> var test = document.getelementsbyclassname("test"); test.onclick = function () { alert("test"); }; </script> </body> </html> you need add eventli...