Posts

Showing posts from May, 2015

python - NLTK Relation Extraction - custom corpus in relextract.extract_rels -

i learnt there built-in function in nltk extract relations ner-tagged sentences according following: import re in = re.compile(r'.*\bin\b(?!\b.+ing\b)') fileid in ieer.fileids(): doc in ieer.parsed_docs(fileid): rel in relextract.extract_rels('org', 'loc', doc, corpus='ieer', pattern = in): print(relextract.rtuple(rel)) it seems me promising general purpose, understood relextract.extract_rels accepts 'ieer' or 'conll2002' parameter corpus . in case, usage restricted these 2 corpora, isn't it? how 1 utilize own corpus (presuming, of course, ner-tagged). this should more of comment don't have enough reputation. you can pass custom corpus doc argument after it's been pos-tagged , converted list of chunked trees. custom corpus, should use corpus='ace' . for example, in this answer , use extract_rels tag custom corpus.

bluetooth lowenergy - osx 10.11.5 - BTLE manufacturer data missing in advertisementData? -

it seems upgrading osx 10.11.5 may causing manufacturerdata field of advertisementdata missing when reported centralmanager: diddiscoverperipheral: advertisementdata: rssi: . it tends there if device turns on while scanning, if device advertising when scanning starts, it's unlikely present. edit, more details: what i'm seeing in cbcentralmanagerdelegate callback centralmanager: diddiscoverperipheral: etc dictionary passed method lacking key kcbadvdatamanufacturerdata if application launches after peripheral has been on (and therefore advertising) while. if peripheral turned on after application launches, key sporadically present approximately 1/3 of time 30 seconds, , disappears forever. (forever = @ least 6 minutes) any ideas ?

javascript - What happens if you just define a new tag on a page? (no webcomponents) -

i thinking experimenting custom stylesheet. 1 big issue i've seen long time simple fact have h1 , p tags typography. it make lot more sense (me to) have descriptive tags such <hero>, <copy>, <micro>, <mini> etc can used instead of doing weird things <h1 class='hero'> . what happens evergreen browsers & ie 10+ if define new tag? work in general @ least in chrome define new tag , assign css properties it. however, there limitations on how use javascript on tag defined this? there big downsides? i not considering defining webcomponent <hero> since need register component whenever gets attached i'm sure heavy on performance simple heading hero tag. last time remembered html5shiv did ie8 or ie9. when wouldn't know tag convert tag block level element think standard properties. happening in evergreen browsers of now, meaning long don't need special events, methods , properties defined on tag ok write tags such <her

expression - Is there a shorthand for smaller than AND greater than, in C#? -

is there shorthand this: bool b = (x > 0) && (x < 5); something like: bool b = 0 < x < 5; in c#? nope. can remove brackets: bool b = 0 < x && x < 5 or play math: bool b = x*x < 5*x

How to use a macro variable to be lagged like a date in SAS -

i'm using sas . have more datesets , 1 per month , have compute variations, means etc. considering more datasets (months) @ same step of macro because example var1 have 1 value in dataset of january (month x) , 1 value in dataset of february (month x+1). the datasets named in way: xxxxxx_yearmonth (for example yearmonth=201512 december 2015) so have create macro variable called yearmonth can lagged more months can recall them. i thought recall datasets macro variable yearmonth , do: yearmonth - 1 ... yearmonth - 2 ... yearmonth - n . there problem because if january 2015 yearmonth=201501 , yearmonth-1=201500 , not 201412 . fact sas doesn't recognize yearmonth date treat simple number. how can manage problem? thanks in advance. convert string date , use intnx() function. %let current=201501; %let prev=%sysfunc(intnx(month,%sysfunc(inputn(&current.01,yymmdd8)),-1),yymmn6); %put &=prev;

c# - ASP.NET MVC Core/6: EF 6 scaffolding error -

i using ef 6 mvc core/6. models , db context in separate project , use di inject db context controllers. when try scaffold controller using ef 6 data context class getting following error: error there error running selected code generator: 'a type name myproject.dal.modeis.mymodel not exist microsoft.visuaistudio.web.codegeneration.actioninvokerb__6_0() microsoft. extensions.commandlineutiis.commandlineappiication.exe cute(string[] args) microsoft.visualstudio.web.codegeneration.codegencommand.execu te(string[] args)' rc2 first release allows include non-asp.net core projects in solution. experience i've learned works if both projects created in visual studio 2015 update 2 , both use .net framework 4.6.1. there long running issue on github this. i've struggled workarounds presented in thread , couldn't waste anymore time messing it. decided wait until functional release comes out. put shared c

C++ Containers of pointers -

i have been pondering issue today , it's difficult find answer on google. i'm trying understand stl container behaviour when dealing pointers both objects allocated on heap, , on stack. so, start objects, no pointers ... imagine have ... std::vector<int> myvec; while(true) { int myint = 5; myvec.push_back(myint); myvec.pop_back(); } my understanding pop_back() method ensure integers contained in vector deleted, not removed container. if ran , did billion iterations, should not expect leak memory. insert, deleted. memory check shows behaviour. now consider use vector of pointers (to objects on heap) ... std::vector<int*> myvec; while(true) { int * myintp = new int(5); myvec.push_back(myintp); myvec.pop_back(); } in case, pointer ought removed each time pop_back() called, , underlying object remains un-deleted, causing memory leak. after billion iterations have quite significant memory being used, though have no entries in vec

php - TinyMCE wrong element path with multiple editors -

Image
i building sort of blogging platform , use tinymce editor platform, problem have multiple editors on same page , work fine element_paths show under wrong editor. as can see paths under editors aren't working correctly: text in top editor strong , element path tells me em correct bottom editor, these element paths swapped. think might have loading in content dynamically php here page code. in advance, hope can figure out.

sql - Error using Oracle Ref Cursor -

i'm trying simple, trying automate removal , of tables personal table space. have 100 tables , want rid of of them (except table i'm using store table names), want keep data tables in case need them sometime in future. below code trying use accomplish this. getting error on ref cursor, i'll include below code. half expect tell me i'm idiot , explain easier way this. if not, please tell me i'm doing wrong way doing it, thanks. declare v_folder_name varchar2(100) := 'my_folder'; type qry_cursor ref cursor; v_qry_cursor qry_cursor; v_file_name varchar2(320); v_file sys.utl_file.file_type; v_max_buffer_length constant binary_integer := 32767; v_qry_str varchar2(4000); --i've tried 32767, made no difference v_drop_string varchar2(4000); v_dynamic_record varchar2(4000); --tried 32767 cursor get_table_names select * temp_backup_table table_name

qt - How to detect when a QDockWidget is moved out of a QMainWindow? -

there signal allows user know qdockwidget has been moved inside qmainwindow : void docklocationchanged(qt::dockwidgetarea area) the problem signal not fired when qdockwidget moved out of qmainwindow (either dragging or double-clicking dockwidget's title bar). is there way detect event, without reimplementing moveevent() ? there floating property purpose, , toplevelchanged signal.

Can a spring ldap repository project access two different ldap directories? -

i trying create spring rest application return values may come 2 different ldap directory servers. possible using spring ldap repositories? possible create more 1 ldaptemplate , contextsource can query both directories? you can configure separate ldaptemplate , contextsource beans each ldap directory. you can refer following basic configuration (javaconfig); @configuration @enableldaprepositories(basepackages = "com.foo.ldap1.repositories", ldaptemplateref="ldaptemplate1") public class ldap1configuration { @autowired environment env; @bean public ldapcontextsource contextsource1() { ldapcontextsource contextsource= new ldapcontextsource(); contextsource.seturl(env.getrequiredproperty("ldap1.url")); contextsource.setbase(env.getrequiredproperty("ldap1.base")); contextsource.setuserdn(env.getrequiredproperty("ldap1.user")); contextsource.setpassword(env.getrequ

c# - JqGrid - SubGrid not display data -

after try every thing stackoverflow, run out of ideas. problem is: have jqgrid 1 subgrid. grid workly perfect, subgrid not display data. js code: $(document).ready(function () { $("#tbljqgrid").jqgrid( { url: '@url.action("getdataforgrid", "validator")', datatype: "json", mtype: 'get', colnames: ['archive name', 'upload by', 'upload date', 'size in mb'], colmodel: [ { name: 'archivename', index: 'archivename', width: 150, stype: 'text' }, { name: 'uploaduser', index: 'uploaduser', width: 150 }, { name: 'uploaddate', index: 'uploaddate', width: 150 }, { name: 'size', index: 'size', width: 150 } ], sortname: 'archivename', rownum: 10, autowidth: true, height: "auto&qu

c++11 - how to handle double free crash in c++ -

deleting double pointer cause harmful effect crash program , programmer should try avoid not allowed. sometime if doing how take care of this. delete in c++ noexcept operator , it'll not throw exceptions. , written type void. how catch kind of exceptions. below code snippet class myexception: public std::runtime_error { public: myexception(std::string const& msg): std::runtime_error(msg) { cout<<"inside class \n"; } }; void main() { int* set = new int[100]; cout <<"memory allcated \n"; //use set[] delete [] set; cout <<"after delete first \n"; try{ delete [] set; throw myexception("error while deleting data \n"); } catch(std::exception &e) { cout<<"exception \n"; } catch(...) { cout<<"generic catch \n"; } cout <<"after delete second \n"; in case tried catch exception no success. pleas provide

Search string field in elasticsearch -

i have device_model field, example this: lenovo ideatab a3000-h[graphicsdevicename: powervr sgx 544mp; graphicsdevicevendor: imagination technologies; graphicsdeviceversion: opengl es 2.0 build 1.9@2204701; graphicsmemorysize: 60; operatingsystem: android os 4.2.2 / api-17 (jdq39/a3000_a422_003_026_130823_ww_sms_fuse); processorcount: 4; processortype: armv7 vfpv3 neon; systemmemorysize: 974; maxtexturesize: 4096] i want aggregate know devices: "aggs" : { "devices" : { "terms" : { "field" : "device_model", "size": 0 } } } but returns me 1 words aggregation this: "aggregations": { "user-ids": { "doc_count_error_upper_bound": 0, "sum_other_doc_count": 0, "buckets": [ { "key": "android", "doc_count": 2

asp.net mvc - AngularJS hash url and MVC routing -

i facing issue in navigating url. default page set login , application url http://localhost:12345/#/ . this works there 2 ways user can login application direct through application. getting username , password trough query string. when application logging through query string url http://localhost:12345?auth=123654654656564/#/ . i remove auth value url. tried map routing doesn't work. routes.maproute( name: "default", url: "{controller}/{action}", defaults: new { controller = "account", action = "login"} ); and tried create 1 more action result return view routes.maproute( name: "actualdefault", url: "{controller}/{action}", defaults: new { controller = "account", action = "loginquery" } ); controller: public actionresult login() { if (request.querystring.count > 0 && request.query

c++ how to read a cfg file more complex? -

i changed c# c++. ive been watching tutorials on how read config file. asking wrong, mean is: making program, it's multiple users. every user have prefence on in textfile. example: in textfile ("items.txt"), have default "ints" , configurable "ints". 10=5 90=2 50=9 in c#, if remember correctly, read lines , if line started example "10=", splitted text line configurable int left , can use easly in program, like: string[] lines = file.readalllines(path); string str; foreach (string line in lines) { if (line.startswith("10")) { str = line.split('=')[1]; //i have need (str); } } i did needed. so, what's best way in c++? also: need specific line them, can use them later on in program. thanks lot in advance! this code c++ equivalent of c# code posted. code compile, of course have fill in path instead of empty string. if need somewhere in method instead of program on itself, abandon int main() , retur

javascript - Which jQuery libary should i include in my website? -

in website have few jquery because have few funcions (sticky header, anchors , animations). want know neccessery include of or can include 1 or 2 ? here included jquerys <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script> <script src="http://ajax.aspnetcdn.com/ajax/modernizr/modernizr-2.7.2.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script src="http://s.codepen.io/assets/libs/modernizr.js" type="text/javascript"></script> <script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.0.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script> you should include following: <script src="//ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js">&l

gtk3 - Python Gtk 3 window is not defined, class instancing confusion -

i starting python , utterly confused how object creation works. trying create user interface gtk. here example of problem having: from gi.repository import gtk def button_clicked(self, button): self.button_label = button.get_label() if self.button_label == "login": window.quit() window2.start() class loginwindow(gtk.window): def __init__(self): gtk.window.__init__(self, title="amok cloud") self.connect("delete-event", gtk.main_quit) self.set_position(position = gtk.windowposition.center) # button self.loginbutton = gtk.button(label="login") self.loginbutton.connect("clicked", button_clicked(self, self.loginbutton)) self.add(self.loginbutton) self.show_all() gtk.main() def quit(self): self.close() gtk.main_quit() class mainwindow(gtk.window): def __init__(self): gtk.window.__init__(self, title=&

javascript - Fullcalendar, I can't change allDayText -

i'm trying change text of "all day" in agendaweek , agendaday views. have set alldaytext property during initialization, it's ignored. noticed problem occurs if set specific language; if set lang='en' works correctly, instead other languages not. here's jsbin: http://jsbin.com/sapifojevo/edit?js,output thank much! fullcalendar uses undocumented option alldayhtml agenda view, has higher priority alldaytext . languages (including italian) localize via alldayhtml option , alldaytext value ignored in case.

android - Getting date difference in sqlite -

i want date difference between today , expiring day. code implemented. not returning right output. public string[] getdayslist(){ cursor cursor = db.query("coupon", null, null, null, null, null, null ); if(cursor.getcount()<1){ cursor.close(); return null; } string[] array = new string[cursor.getcount()]; int i=0; while(cursor.movetonext()){ string days = "(julianday('now') - julianday(expired_date))"; array[i] = days; i++; } return array; } this returns (julianday('now') - julianday(expired_date)) . please me date difference string array here. the now modifier returns not date time. to change timestamp start of date, use date() function : select julianday(date('now')) - julianday(expired_date) ... (if expired column contains time values, have use date() it, too.) and execute this, have give database: public string[] getdayslist() { st

Formatting tab argument completion powershell -

i'm using tabexpansion2 in powershell 3 , when tab complete argument brings string want wrapped in syntax don't want. for instance when hit tab after -binname : use-bin -binname @{name=5.0} what need is: use-bin -binname 5.0 i'm using script: https://www.powershellgallery.com/packages/powershellcookbook/1.3.6/content/tabexpansion.ps1 with these adjusted options: $options["customargumentcompleters"] = @{ "binname" = {get-childitem -path $global:th_bindir | select-object name} "dbname" = {get-childitem -path $global:th_dbdir\rt5.7\ | select-object name} "patchsubdir" ={get-childitem -path $global:th_bindir\patches\ | select-object name} "hmisubdir" = {get-childitem -path $global:th_hmidir | select-object name} "modulescript" = {get-childitem -path $global:th_modpaths | select-object name} "items" = {"bins", &

forms - How to set curl into php -

this form. <form action="mail.php" method="post"> <label class="form-label" for="name">full name</label> <input class="user" type="text" name="name" id="name"> <label class="form-label" for="email">email id</label> <input class="email" type="email" name="email" id="email"> </form> how can set curl code php form? create new user users can created or updated via post method https://api.intercom.io/users , accepts json object describing user. example request: curl https://api.intercom.io/users \ -x post \ -u app_id:api_key \ -h 'accept: application/json' \ -h 'content-type: application/json' -d ' { "email": "hello@projectmap.io" }' i hope work, if(isset($_post['email'])) { $url = 'https://a

Doing a very specific equation with calc in less -

i need specific equation using calc in less. namely this padding: 0 calc((100% - 1280px)/2 + 30px); it works when try in editor in chrome i'm not sure parts of equation need encapsulated in ~"". currently i'm doing below doesn't yield correct sum padding: 0px ~"calc((100% - 1280px)/2 + 30px)"; less , calc try: padding: 0px calc(~"100% - 1280px)/2 + 30px"); its known issue less : less aggressive compilation css3 calc

osx elcapitan - Mac C++/Mars eclipse gdb debug launching stuck at 96% -

Image
i trying setup gdb on mac os x el capitan. have set path in eclipse (preference->c/c++->gdb-> /usr/local/bin/gdb). trying debug simple hello world program. stuck @ 96% (refer image bottom right side). ] 3 i'm running sierra 10.12.4, , apple has destroyed ability run gdb far can tell. after poking around seems lldb support in eclipse, though still labeled experimental (in neon 3), works enough. so this: http://wiki.eclipse.org/cdt/user/faq#how_do_i_get_the_lldb_debugger.3f and can debug. basically, install lldb support, , set launcher type lldb setting in debug configs , works. it's kinda slow, works.

java - Error:incompatible types: DeviceCheckCallback is not a functional interface -

i have interface once functional. i'd have more abstract methods added them interface , changed implementations override methods. use retrolambda in project. when run app following error: error:incompatible types: devicecheckcallback not functional interface multiple non-overriding abstract methods found in interface devicecheckcallback why seeing this? don't want interface functional anymore? the interface trying provide lambda has more 1 method. lambda's can used interfaces have single method (which call "functional interface")

Kernel compilation in Yocto, what to define? -

i trying compile kernel yocto (jethro). kernel 1 can fetch here (commit 4561d2504e8ea562674070350d27c19357f0d7f0) git clone --depth 1 --branch pine64-hacks-1.2 --single-branch https://github.com/longsleep/linux-pine64.git linux-pine64 i tried compile it, , success integrating in yocto system gives compilation errors. looking @ logs, 1 can think modules don't work can compiled if not integrated in yocto. parameter has not been set, sure, don't know how proceed have similar behaviour in yocto. parts of log can understand. + oe_runmake image cc=aarch64-poky-linux-gcc -fuse-ld=bfd --sysroot=/home/dbensoussan/new_poky/poky/build/tmp/sysroots/pine64 ld=aarch64-poky-linux-ld.bfd --sysroot=/home/dbensoussan/new_poky/poky/build/tmp/sysroots/pine64 + bbnote make -j 8 image cc=aarch64-poky-linux-gcc -fuse-ld=bfd --sysroot=/home/dbensoussan/new_poky/poky/build/tmp/sysroots/pine64 ld=aarch64-poky-linux-ld.bfd --sysroot=/home/dbensoussan/new_poky/poky/build/tmp/sysroots

function - Pyqt 50+ Checkboxes --- How to go about this -

if checkbox checked append value list, , remove if unchecked. the documentation little confusing --- there clicked() toggled() toggle() statechange() , bunch of others. these should work adding value list, how remove when unchecks rather addin again. this list passed function. i having trouble figuring out best way this, there around 50 checkboxes , checkbox gui 1 function.... maybe use dictionary values strings passed list , put keys in statechange() , or need write entire process out every single checkbox? i guess weird because used debugging in canopy, canopy doesn't work pyqt, i'm on sublime. thanks you can connect clicked() signal function contains if -statement looks if checkbox checked or not. example: self.checkbox.clicked.connect(checkbox_state_fu) def checkbox_state_fu(self): if self.checkbox.checkstate() != 0: # checkstate() false 0. state = true else: state = false inside if -statement can add/remove it

mysql - Cannot run a database restore on Powershell because of < character -

i'm trying run following command: &$parameterhash["mysql"] -u $parameterhash["user"] -p"$($parameterhash['password'])" -h $parameterhash["host"] $parameterhash['database'] `< $parameterhash['backup-path'] pay attention part of whole command: $parameterhash['database'] `< $parameterhash['backup-path'] this syntax of mysql command-line restore backup (i.e. a sql script ) file system location given database name. first of all, had escape > in powershell backtick. the issue entire command isn't recognized mysql command line when run powershell. once run it, mysql outputs help. if output command string , try run in regular cmd (i.e. cmd.exe ) works expected. for now, can't figure out what's going on. update i've tried this: $restoreargs = "-u $($parameterhash["user"]) -p""$($parameterhash['password'])"" -h

java - Eclipse Mars How to add plugin DERBY database -

Image
i know how use derby using cmd, followed tutorials in apache website . use derby in eclipse requires core , ui zip files. watched tutorial on youtube when open eclipse directory there no plugin folder still extracted core , ui zip files , created own plugin folder when run eclipse , create new java project , hit right click there no "apache derby" menu shown while in youtube tutorial there is. found guide confused @ step 1. here files downloaded (already extracted in eclipse directory).

javascript - Loop on a promise indefinitely until rejection -

i have function async work , returns promise , , want execute function indefinitely until promise reject ed. something following : dosomethingasync(). .then(dosomethingasync) .then(dosomethingasync) .then(dosomethingasync) // ... until rejection i made little codepen can test potential solutions : http://codepen.io/jesmodrazik/pen/pbaovz?editors=0011 i found several potential answers nothing seems work case. if has solution, i'd glad, because can't find ! thanks. you can do (function loop(){ dosomethingasync().then(loop); })(); but looking @ pen it's not clear rejection should come from. if want stop repeating operation when user clicks button, can change state in button handling , do (function loop(){ dosomethingasync().then(function(){ if (!stopped) loop(); }); })();

swift - Firebase / iOS: runTransactions sometimes doesn't work -

i working on chat app, users should notified new messages contacts. notification message should include number of unread messages. because both sender , receiver can update information runtransaction preferred. unfortunately doesn't work. feels "stuck" , starts working after while again. privatechats node (see below) gets updated latest message, not openchatmessages node. can happen if many messages sent in short period of time, i.e. runtransactions performed same ref ? my data structure: privatechats $userid $chatid $messageid text timestamp senderid senderemail sendername // node contains information open chats // last message , counter unread messages openchatmessages $userid $chatid text timestamp senderid senderemail sendername counter my code: class chatviewcontr

sql - Can I Insert a Particular Value to Replace the First Non-NULL Value in Each Row -

Image
have table above. insert particular value, called i1,i2,i3,...,i10. first non-null value. value want insert vary based on duration first non-null value lies. for example, first non-null value id1 duration 3, insert "i3" particular cell. id 2, want insert i2 cell,etc. there result expect i1,i2,i3,...,i10 industrial value have @ hand, numbers not characters. is there way that? thank you. you can simple update using case expressions: update mytable set duration1 = case when duration1 not null i1 else duration1 end , duration2 = case when duration1 null , duration2 not null i2 else duration2 end , duration3 = case when duration1 null , duration2 null , duration3 not null i3 else duration3 end -- continue in same boring way , duration10 = case when duration1 null , duration2 null , duration3 null , duration4 null , duration5 null , duration6 null , duration7 null , duration8 null , duration9 null , duration10 not null i10 else duration10 end

sequelize.js - sequelize oneToMany create nested associations -

is there way have sequelize create nested associations via single create call? example if have model data hasmany of model user , , each user hasmany of model permission . there way call data.create data containing user , permission , , sequelize create nested associations? the thing i've found on sequelize docs using include pull in nested associations on find call, or calling setter after data.create , e.g. data.setusers(...) . as far know, can done if records new. in case means having new data new user s have new permission s. otherwise, you'll have "manual" way. for more info, see documentation here: http://docs.sequelizejs.com/en/latest/docs/associations/#creating-with-associations

Integration of ruby on rails with AngularJS -

i trying create ruby on rails application angularjs. tried following how wire ror angularjs article mysql database , not able benefit. new angularjs integration ror faced following terminal command problems while trying above mentioned link, , problems like: first problem in while trying rails g rspec:install second problem due npm install -g yo command , third npm install -g generator-angular please me sending article , can go ahead this. in advance. you can use gem 'angularjs-rails' integration of rails app angularjs.

sql - Calling stored procedure from other stored procedure -

this stored procedure #1: alter procedure [dbo].[sp1] begin declare @test varchar(255) exec @test = dbo.sp2 set nocount on; select cms_org.description, @test cms_org end this stored procedure #2: alter procedure [dbo].[sp2] begin set nocount on; select cms_mas.description + '' + convert(varchar(50), cast(cms_org.amount money), 1) cms_org inner join cms_mas = cms_org.guid = cms_mas.guid end the problem here not able execute @test in stored procedure #1 calling stored procedure #2. when execute sp1, got null values instead when execute query of sp2 in sp1, got correct value. may know possible solution or similar examples can solve issue? your stored proc sp2 outputs result of select, stored procs, returns integer using return statement. don't have return statement, sql server generates 1 you: return 0 . purpose of return code give feedback

regex - Using the JavaScript regular expression flavour, how to match a specific tag only when inside another specific tag? -

Image
i want match <br> tags inside <main> tag , not of them: is possible js regex? i'm trying find , replace (with regex) in files in project. here's raw text: <br> <main> <input> <br> <hr> <br> <etc> </main> using dom better parsing html text. if reason cannot use dom here regex solution match <br> tags between <main> , </main> . /<\s*br\s*\/?>(?=.*?(?:(?!<main>)[\s\s])*?<\/main>)/gi regex breakup: <\s*br\s*\/?> # matches <br> or <br /> (?= # start of lookahead .*? # arbitrary text, lazy (?: # start of non-capturing group (?! # start of negative lookahead <main> # literal text <main> ) # end of negative lookahead [\s\s]*? # match 0 or more of char including newline, lazy ) # end of non-capturing group <\/m

unix - How to find jar does not have a given string in linux -

i want list of jar archives not have particular string in contents. i used following command find jar archives containing files matching string "hello" : find . -iname '*.jar' -printf "unzip -c %p | grep -q 'hello' && echo %p\n" | sh. i tried following command find jar archives containing no files matching string "hello" , not working: find . -iname '*.jar' -printf "unzip -c %p |!( grep -q 'hello') && echo %p\n" | sh basically may change && || operator: find . -iname '*.jar' -printf "unzip -c %p | grep -q 'hello' || echo %p\n" | sh. and , or lists sequences of 1 of more pipelines separated && , || control operators, respectively. , and or lists executed left associativity. , list has form command1 && command2 command2 executed if, , if, command1 returns exit status of zero. an or list has

android - How to create exactly square buttons that fill in width of screen -

Image
i've activity fill buttons dynamically base on tablelayout , tablerow this: private tablelayout buttontablelayout; //----- (int row = 0; row < buttontablelayout.getchildcount(); ++row) ((tablerow) buttontablelayout.getchildat(row)).removeallviews(); layoutinflater inflater = (layoutinflater) getsystemservice(context.layout_inflater_service); (int row = 0; row < 5; row++) { tablerow currenttablerow = gettablerow(row); (int column = 0; column < 5; column++) { button newguessbutton = (button) inflater.inflate(r.layout.my_button, currenttablerow, false); newguessbutton.settext(string.valueof((row * 5) + column + 1)); currenttablerow.addview(newguessbutton); } } } //---- private tablerow gettablerow(int row) { return (tablerow) buttontablelayout.getchildat(row); } i want make 5*5 list of buttons 1:all of them has same width , height

dictionary - how to print Map[String, Array[Float]] in scala? -

i using word2vec function inside mllib library of spark. want print word vectors getting output "getvectors" function code looks this: import org.apache.spark._ import org.apache.spark.rdd._ import org.apache.spark.sparkcontext._ import org.apache.spark.mllib.feature.{word2vec, word2vecmodel} object word2vec { def main(args: array[string]) { val conf = new sparkconf().setappname("word2vec") val sc = new sparkcontext(conf) val input = sc.textfile("file:///home/snap-01/balance.csv").map(line => line.split(",").toseq) val word2vec = new word2vec() val model = word2vec.fit(input) model.save(sc, "mymodelpath") val samemodel = word2vecmodel.load(sc, "mymodelpath") val vec = samemodel.getvectors print(vec) } } i getting " map(balance -> [f@2932e15f) " try : vec.foreach { case (key, values) => println("key " + key + " - " + values.mkstr

system verilog - Is there a way to exclude some coverpoints from coverage collection in systemverilog? -

my coverage contains lot of complex crosses , built coverpoints don't care them when stand alone. coverpoints appearing on final report , affecting coverage percentage. there way include tree leaves in coverage report? ( i.e crosses , , coverpoints not included in cross ) done when writing code? or there way change options , settings of shown? ( i'm using dve. if familiar else, helpful too. ) for coverpoints, can use option.weight feature: from ieee 1800-2012 , table 19-3: weight = constant_number default = 1 comment = if set @ covergroup syntactic level, specifies weight of covergroup computing overall cumulative (or type) coverage of saved database. if set @ coverpoint (or cross) syntactic level, specifies the weight of coverpoint (or cross) computing cumulative (or type) coverage of enclosing covergroup. specified weight shall nonnegative integral value. you can set weight 0 coverpoints want mask. add following line in cover

java - What is the idiomatic way for printing all the differences in XMLUnit? -

i'm trying override default xmlunit behavior of reporting first difference found between 2 inputs (text) report includes differences found. i've far accomplished this: private static void reportxhtmldifferences(string expected, string actual) { diff ds = diffbuilder.compare(input.fromstring(expected)) .withtest(input.fromstring(actual)) .checkforsimilar() .normalizewhitespace() .ignorecomments() .withdocumentbuilderfactory(dbf).build(); defaultcomparisonformatter formatter = new defaultcomparisonformatter(); if (ds.hasdifferences()) { stringbuffer expectedbuffer = new stringbuffer(); stringbuffer actualbuffer = new stringbuffer(); (difference d: ds.getdifferences()) { expectedbuffer.append(formatter.getdetails(d.getcomparison().getcontroldetails(), null, true)); expectedbuffer.append("\n----------\n"); actualbuffer.append(formatter.getdetails(d.getcomparison().gettestdetails(), null, true)); actua

regex - How to validate email address in JavaScript? -

how can email address validated in javascript? using regular expressions best way. can see bunch of tests here (taken chromium ) function validateemail(email) { var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-za-z\-0-9]+\.)+[a-za-z]{2,}))$/; return re.test(email); } here's example of regular expresion accepts unicode: var re = /^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i; but keep in mind 1 should not rely upon javascript validation. javascript can disabled. should validated on server side well. here's example of above in action: function validateemail(email) { var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0

c++ - why __thread gives linker error when printf statement is used? -

here sample program, int main() { static __thread int a; printf("\n %d",a); return 0; } in program, when printf statement removed, linking fine. when printf statement included, gives following linker error ld: fatal: relocation error: r_sparc_tls_le_hix22: file /var/tmp//ccwb2cxc.o: symbol <unknown>: bad symbol type sect: symbol type must tls processor: sun-sparc os: unix to knowledge known issue of sun linker since 2006. work if copy integer local (non-thread)?

Entity Framework Returns NULL linked object C# -

i use entity framework in program, , have problem when record being removable table, table linked objects come null. instead of doing waittravel = db.waittravels .where(w => w.suggesttravelid == suggesttravelid && w.wantedtravelid == wantedtravelid) .first(); if (waittravel.wantedtravels.statustravelid != 1) i should that: if (db.wantedtravels.where(w => w.id == waittravel.wantedtravelid).first().statustravelid != 1) know me? i believe asking why waittravel.wantedtravels null in if statement. because missing include statement , not have lazy loading enabled. see ef documentation on loading related entities additional options on how can accomplish this. easiest, , imo best way, explicitly use include when know want retrieve related property/collection. waittravel = db.waittravels .where(w => w.suggesttravelid == suggesttravelid &&

java - Mapping nested object with mapstruct -

i create mapping below. how map flat dto object properties (street, city, etc) nested address in domain object. when try i've got error: [error] diagnostic: unknown property "address.postalcode" in return type. @mapping(source = "city", target = "address.city"), @mapper(componentmodel = "spring", uses = {}) public interface companymapper { @mappings({ @mapping(source = "id", target = "id"), @mapping(source = "street", target = "address.street"), @mapping(source = "city", target = "address.city"), @mapping(source = "postalcode", target = "address.postalcode"), @mapping(source = "province", target = "address.province"), }) domainobject map(dtoobject dto); and classes... public class address { private string street; priv

osx - Starting Neo4j failed: Address localhost:7474 is already in use, cannot bind to it -

i'm trying install neo4j server on localhost (mac osx - el-capitan) , i'm getting error - starting neo4j failed: address localhost:7474 in use, cannot bind it. i tried stop port running , install throw neo4j install app, still give error when try start neo4j server gives me error : ./usr/local/bin/neo4j: line 229: [: many arguments try kill java processes : sudo killall -9 java then restart neo4j server : ./bin/neo4j restart

python 3.x - Anaconda does not work on python3? -

i downloaded anaconda packaged installer(for python3.5 , 64bit) osx el capitan. after installed anaconda, can use matplotlib , other modules on python2. however, cannot use these modules in python3. so, googled , found similar 1 ( how run conda? ) checked .bash_profile , found automatically created code anaconda # added anaconda3 4.0.0 installer export path="/users/username/anaconda/bin:$path" this .bash_profile code python3 path="/library/frameworks/python.framework/versions/3.5/bin:${path}" however, still cannot import module on python 3, , cannot use command conda on command shell. what should need run conda , import modules on python3?? in advance. i found simple solution(?). close opened terminal windows, , reopen try conda or import modules. works!

bulkinsert - SQL Server BULK INSERT: why "The FIRSTROW attribute is not intended to skip column headers"? -

here https://msdn.microsoft.com/en-us/library/ms188365.aspx can read that: the firstrow attribute not intended skip column headers. skipping headers not supported bulk insert statement. when skipping rows, sql server database engine looks @ field terminators, , not validate data in fields of skipped rows. but this. why not intended? can expect problems when skip headers firstrow = 2? the sql server database engine looks @ field terminators that's answer. if column headers have names include field terminators, system find wrong number of fields in first line, , great hilarity ensue. can imagine in world's files, column had years, since 1970 as header. clear enough human, machine has rules . in case you're not aware, bulk insert fail in general case csv files. csv format quite variable, , more complex bulk insert can interpret correctly. specifically, there quoting rules allow commas included among data. sql server won't