Posts

Showing posts from June, 2014

c# - MEF. Enforce PartCreationPolicy to be CreationPolicy.Shared in custom ExportAttribute -

i have following custom attribute inherits mef's exportattribute: [attributeusage(attributetargets.class)] public class definesettingsattribute : exportattribute { public definesettingsattribute() : base(typeof(definesettingsattribute)) { } } i enforce shared creation policy in classes decorated attribute. can achieve with: [definesettings] [partcreationpolicy(creationpolicy.shared)] public class foo { } this way import explicit non-shared fail. nevertheless need no make custom attribute, final code looks this: [definesettings] public class foo { } the way have made work discovering decorated types , add them partcreationpolicy attribute using reflection. wonder if there more elegant , better way.

angular - Ionic 2 calendar does not pick ion-datetime from html -

i trying creat event in native/device calendar. have created html form allows enter start , end date. now, ionic create event understands start , end date date type. do? how convert string datetime ot so? see code below: <ion-content> <ion-item> <ion-label>title</ion-label> <ion-input type="text" name="title" [value]="" (input)="title= $event.target.value"></ion-input> </ion-item> <ion-item> <ion-label>details</ion-label> <ion-input type="text" name="details" [value]="" (input)="details= $event.target.value"></ion-input> </ion-item> <ion-item> <ion-label>start date</ion-label> <ion-datetime displayformat="mmm dd, yyyy hh:mm" pickerformat="mmm dd, yyyy hh:mm" name="startdate" (input)="startdate = $event.target.value&

mediawiki - Media Wiki Embed File History -

Image
is possible embed wiki file's history on page? i want embed file's history on page related file can download older versions without having click file's page. nice if can show history section of file. how can done?

c++ - What's the purpose of the void cast here? -

this question has answer here: c++ purpose of casting void? [duplicate] 2 answers i have been looking @ journalctl code , came across following block of code. it seems shorthand way of exiting out of series of condition tests if there non-zero result conditions being tested. pretty clever. but i'm unsure purpose of void cast. suppress compiler output? g++ not care either way -wall , -pedantic -pedantic-errors . m1 = strjoina("_systemd_unit=", unit); m2 = strjoina("coredump_unit=", unit); m3 = strjoina("unit=", unit); m4 = strjoina("object_systemd_unit=", unit); (void)( /* messages service */ (r = sd_journal_add_match(j, m1, 0)) || /* coredumps of service */ (r = sd_journal_add_disjunction(j)) || (r = sd_journal_add_match(j, "message_id=fc2e22bc6ee647b6b90729ab34a250b1", 0)) || (r = sd_jou

angular - ng-bootstrap Typeahead selected object -

i have https://ng-bootstrap.github.io/#/components/typeahead/api component folowing declaration: <ng-template #rt let-r="result" let-t="term"> <span class="device"> <span class="grayout">{{r?.manufacturer.name}}</span> {{ r?.modelname}}, <span class="grayout"> {{ r?.year}}, {{r?.operatingsystemversion.operatingsystem.name}} {{r?.operatingsystemversion.name}}, {{ r?.note}} </span> </span> <span class="devicestats"> <span class="grayout">{{r?.blockedcount}}x blocked</span> </span> </ng-template> <input id="typeahead-template" type="text" class="form-control" [(ngmodel)]="model" [ngbtypeahead]="search" [resulttemplate]="rt" [inputformatter]="formatter" placeholder="search mo

java - Trouble Configuring Activities that are Opened based on EditText User Input -

i attempting create app in user navigates through series of "menus" in order access content. created menu appears upon opening app mainmenuactivity.java: public class mainmenuactivity extends appcompatactivity { listview listview; arrayadapter<string> main_adapter; string[] main_menu = { "1 intro", "2 help", "3 around world" }; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main_menu_layout); listview = (listview) findviewbyid(r.id.main_list); main_adapter = new arrayadapter<>(this, r.layout.main_list_custom_layout, r.id.main_list_item, main_menu); listview.setadapter(main_adapter); } public void opennewactivity(view view) { edittext main_edit_text = (edittext) findviewbyid(r.id.main_edit_text); string answer = main_edit_text.gettext().tostring().trim(); switch (answer) { case "1&

javascript - Executing a jQuery script when rendering -

i'd execute jquery script while rendering action in rails controller. to more precise, have function in users controller ... def create @user = user.new(user_params) if @user.save # successful save else render action: "new", layout: "signup" end end ... , want add class specific element in new.html.erb file. need when rendering because don't want class added beforehand . how can that?

javascript - How to hide an element only if it matches specific hash? -

i'm trying hide form if it's on root site, or on specific hash https://www.example.com/#uno . code below causing form not show on subpages (/#dos, /#tres, etc). can me understand happening? $(function(){ if (location.hash == "" || location.hash == "#uno"){ $("#form").hide(); } else { $("#form").show(); }; }()); this because hide form once, don't make reappear until reload page. (you check hash once, when loading entire page, not when hash changes. function showhideform() { if (location.hash == "" || location.hash == "#uno"){ $("#form").hide(); } else { $("#form").show(); }; } window.onhashchange = showhideform;

python 2.7 - Splunk query returns fewer results than expected -

i using command top 200 results splunk on my_field: q = "search index=idx host=nets* mydomain.com | top limit=200 my_field" when run in splunk, gives me 200 results. however, when run using splunk python sdk, 100 results. service = client.connect(host=host, username=user, password=pass) extra_args = {"earliest_time": "-1h", "latest_time": "now"} q = "search index=idx host=nets* mydomain.com | top limit=200 my_field" res = service.jobs.oneshot(q, **extra_args) reader = results.resultsreader(res) top_jobs = [] row in reader: top_jobs.append(row['my_field']) print len(top_jobs) # returns 100, or number less 100 specified in query. is there other way specify number of results?

ios - How do I customize ads in my app? -

i'm building ios app target special type of people, did implement admob in app problem admobs shows ads depends on location if user allow. i'm looking show ads of app type ? for example,if app gaming app show adds gaming apps or related gaming or if app educational show ads related education. i hope knows way that hello guys found answer in website after long digging here is: https://support.google.com/admob/answer/3150235?hl=en

How do I repeat a wordpress loop which contains altered design using another loop -

Image
i have achieved layout below using 2 loops, repeat layout way down page. how do this, have offset option using 2 loops already. layout repeat down page this code have used achieve this: <div class="row hidden-xs hidden-sm"> <?php $posts = get_posts('category_name=news&numberposts=3&offset=1'); foreach ($posts $post) : start_wp(); ?> <div class="col-md-4"> <a href="<?php the_permalink(); ?>"> <?php the_post_thumbnail('full', array('class' => 'img-responsive')); ?> </a> <!-- headline , excerpt --> <div class="news-story-box"> <h4 class="top-story-title"> <a href="<?php the_permalink(); ?>" class="top-story-title"><?php the_title(); ?></a> </h4> <font size="2"><i><?php echo human_time_diff( get_the_time('u'), current_ti

What is Coq's type system doing in this example? -

i'm confused behavior of coq's type system on match portion of proof term in definition of h below: set implicit arguments. definition h := fun (a b : nat) (e : = b) => (fun (x y : nat)(hc : b = y)(h : x = y) => (match h in (_ = y0) return (b = y0 -> b = x) | @eq_refl _ _ => fun hc0 : b = x => hc0 end hc)) b (eq_refl b) e. check h tells overall type "forall b : nat, = b -> b = a". since type of h x = y, looks match return term of type b = y -> b = x due return clause. after applying various terms follow, expected type h. however, fun hc0 : b = x => hc0 identity function of type b = x -> b = x. don't believe there coercion force b = x -> b = x recognized type b = y -> b = x. my best guess constructor h, being @eq_refl nat x of type x = x, unique. since h of type x = y, names x , y bind same term. thus, type system decides b = x -> b = x of type b = y -> b = x. close? kind of behavior explained or documented somew

How to render nested firebase data in listview with "react-native -

how render nested firebase data in listview react-native hi ! developing beginner project using firebase , react-native . have problem , want give me advice or code on problem. this firebase data {"users" : { "firebaserandomkey" : { "isvalid" : true, "name" : "name", "post" : { "posttext" : "lorem ipsum", "posturi" : "https://i.ytimg.com/vi/4hgrifivkqo/maxresdefault.jpg" }, "surname" : "surname", "uri" : "https://i.ytimg.com/vi/oei2sjuoweu/hqdefault.jpg" },}} this listview renderrow renderrow(rowdata) { return ( <scrollview containerstyle={styles.scrollview}> <text>{rowdata.name} {rowdata.surname}</text> <image source={{ uri: string(rowdata.uri) }} style={styles.photo} /> <text>{rowdata.posttext}</text> <image source

xml - PHP - parse webpage using SimpleXMLElement -

i have webpage i'm trying parse using simplexmlelement a#href "#3" , content of following span->a "jim": <?xml version='1.0'?> <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head>..</head> <title>this title<title> <body> <script>...</script> <div id="div1"> </div> <div id="content"> <div id="src"> <pre> <a name="1" href="#1">1</a> <span class="myclass"> <a href="somelink123">john</a> </span> <a name="1" href="#2

css - Multiple rgba borders cancels the others -

if apply multiple borders div, rgba color alpha lower 1 neither border applied. work 1 border, or 'solid' colors. div { height: 100px; width: 100px; background: lightgray; } #one { border-top: 1px solid rgba(0, 0, 0, .3); border-bottom: 1px solid rgba(0, 0, 0, .3); } #two { border-top: 1px solid black; border-bottom: 1px solid black; } #three { border-top: 1px solid rgba(0, 0, 0, 1); border-bottom: 1px solid rgba(0, 0, 0, 1); } <div id="one"></div> <br> <div id="two"></div> <br> <div id="three"></div>

javascript - How would I get the specific object in json stringify output? -

can me on how specific object in json? i want sum 3 in stringify ouput. var arr_question = [{"$1z_1":3,"$2o_1":"question 1."},{"$1z_1":3,"$2o_1":"question2."},{"$1z_1":3,"$2o_1":"question3."}]; console.log("output: "+arr_question.$1z_1); console.log("arrays: "+arr_question) you can use foreach iterate on array , add value of each object in array declared "total"variable total of values. var arr_question = [{"$1z_1":3,"$2o_1":"question 1."},{"$1z_1":3,"$2o_1":"question2."},{"$1z_1":3,"$2o_1":"question3."}]; var total = 0; arr_question.foreach(function(obj){ total += obj.$1z_1; }) console.log("output: " + total); // gives "output: 9"

One Step Checkout Magento Problems with the theme -

i trying install 1 step checkout in magento store, have license, dont have more support them i got message 1 step checkout pro: missing layout file or template folder of module. please follow install instruction @ here or can submit ticket @ here i follow steps, tried add files in different folders , still having same message any suggestion please? step 1: go folder path: app/design/frontend/default/default (or path: app/design/frontend/enterprise/default if using magento ee), see folders (/layout, /template) upload these folders directly theme path: app/design/frontend/your _package/your_theme step 2: go folder path: skin/frontend/default/default (or path: skin/frontend/enterprise/default if using magento ee), after upload folder ‘mw_onestepcheckout’ theme path: skin/frontend/your_package/your_theme /public_html/app/design/frontend/emphasis/mw_onestepcheckout /public_html/skin/frontend/emphasis/default/mw_onestepcheckout `/public_html/skin/frontend/emphasis/emphasis/m

How to start a Java process with high priority on windows system -

Image
first of question not thread priority. i have created java program let's test.java. when c:/> java test , mean when run program, windows operating system starts java process normal priority can see in windows task manager. my program needs huge system resources. if java process has normal priority may not system resources as need. can set process priority high windows task manager going process right click , set priority high. i want set process priority high either programmatically java program or while running program command prompt. your highly appreciated. it works me way: cmd start /high <app> windows version:

javascript - Fixed header/footer keep vertical scroll bar on top? -

Image
i have partly transparent fixed footer , header scrolling content: https://jsfiddle.net/ru8jgxg9/ what changes jsfiddle need made keep vertical scroll bar on top when there overflow content (but keep scroll bar whole height of window too)? i notice stackoverflow.com seems able it: html { height: 100%; } body { height: 100%; } /* fixed header */ .dvtabletop { display: table; width: 100%; border-style: solid; border-width: 0px 0px 2px 0px; border-color: #000000; top: 0px; height: 50px; position: fixed; left: 0; right: 0; opacity: 0.7; background-color: red; z-index: 1030; } /* scrollable content */ .dvcontentcontainer1 { position: fixed; top: 0; bottom: 0; padding-top: 30px; overflow: auto; left: 0; right: 0; } /* fixed footer */ .dvfootercontainer1 { position: fixed; height: 50px; background-color: yellow; bottom: 0; left: 0; right: 0; opacity: 0.7; } your fixed header , footer needs inside scrolling c

In Angular 2 Material mdTable, how can I load a dynamic number of columns? -

my data structured this, pre-known columns, number of question columns dynamic (but within 1 report have same number of columns). example has 2 question columns, 10: [ {name: "bob", results: [ {questionnumber: 1, iscorrect: true}, {questionnumber: 2, iscorrect: false}]}, {name: "charlie", results: [ {questionnumber: 1, iscorrect: false}, {questionnumber: 2, iscorrect: false}]}, ] how define mdtable can handle number of columns? i tried willshowell's example on page couldn't work. defines interface doesn't work unknown number of columns (i think): https://github.com/angular/material2/issues/5927

python - Extracting all the contents from webpage having similar xpath(contents that can be extracted in a list) -

i have scrape page, http://www.imdb.com/search/title?count=100&release_date=2016,2016&title_type=feature . while using xpath scrape movie name, 'the lost city of z'. here code: driver_t.get('http://www.imdb.com/search/title?count=100&release_date=2016,2016&title_type=feature') x= driver_t.find_element_by_xpath('//*[@id="main"]/div/div/div[3]/div[1]/div[3]/h3/a') print x.text in order scrape movies, removed [1] xpath driver_t.get('http://www.imdb.com/search/title?count=100&release_date=2016,2016&title_type=feature') x= driver_t.find_element_by_xpath('//*[@id="main"]/div/div/div[3]/div/div[3]/h3/a') print x.text but, output first movie's name('the lost city of z') this worked in 'r' not working in python(selenium webdriver). tell me going wrong? here answer question: in order scrape movies page url http://www.imdb.com/search/title?count=100&rele

html - How to handle authentication dialog while accessing the webpage from Excel macro -

Image
i trying access 1 webpage , retrieve required data excel. using excel macro cause. webpage accessing asking username , password in form of browser dialog below: this not html page not able locate username , password texts , provide values. i tried give value directly using sendkeys ie.navigate cells(rownum, 3) sendkeys "admin" sendkeys "{tab}" sendkeys "admin" sendkeys "{enter} it working fine if dialog appears. webpage ask credentials @ first instance. rest of time, webpage getting opened automatically without credentials. now, in need of way check if dialog box visible. me in resolving this? i tried appactivate appactivate(iexplore) but doesn't seem working.

Jenkins groovy post build action plugin issue -

Image
following code find job in jenkins , job find required build , addsummary using groovy post build plugin. def r = jenkins.model.jenkins.instance.getallitems().findall { it.name.contains("<myjob>") } r.each { t -> def builds = t.getbuilds() builds.each{ b -> if(b.displayname == '<myversion>'){ manager.createsummary("success.gif").appendtext("<h1>hello!!</h1>", false, false, false, "black") } b.save() } } its failing following error.. org.jenkinsci.plugins.scriptsecurity.sandbox.rejectedaccessexception: unclassified method java.lang.class createsummary java.lang.string @ org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.sandboxinterceptor.onmethodcall(sandboxinterceptor.java:113) you need go jenkins -> manage jenkins -> in-process script approval . (from jenkins script security plugin ) you able approve signature there. see full example @ " j

bash - whiptail - window resize -

i'm using whiptail menu based tool. i'm able set display current window on start : window=$(stty -a | tr \; \\012 |egrep 'rows|columns' | cut '-d ' -f3) whiptail --title "multinode main menu" --menu "\n\n\n\n\n\n\n\n" --nocancel $window 20 ... but content scrumbles when resize window. there way avoid when using whiptail ? as per this wikipedia link, eval `resize` whiptail ... $lines $columns $(( $lines - 8 )) ... explanation: resize command identifies current dimensions (lines , columns) of current window , sets 2 environment variables lines , columns . eval block helps set these 2 env variables in shell underwhich whiptail command running. way whiptail receives $lines , $columns variables. this set right dimensions whiptail ui.

javascript - Angularjs i18n disable locale on date -

hi fellow programmers, i using i18n localization provided angular js, can found here . currently, using date filter convert date 'day' in html view: {{ note.notedatetime | date:"eeee" }} this converts date day, , output converted locale. (i using netherlands). i need disable translation here , output 'default english'. thank you, parse, validate, manipulate, , display dates , times in javascript. refer link https://momentjs.com/

java - Xpath for facebook newsfeed box is not working -

i trying perform following using selenium webdriver , java : login facebook click on user name post word "how you!!" newsfeed above first 2 steps working 3rd don't. unable find newsfeed text box. i trying xpath : "//*[text()=\"what's on mind?\"]" i can not use class or id dynamic , change every time. note : have test xpath firepath , @ there says valid. try: "//*[@placeholder=\"what's on mind?\"]" because, not text attribute named placeholder .

i'm unable to substring values that i get by running a gremlin query, i've been trying to find this on google but found nothing -

Image
this gremlin query: g.v('service').has('serviceid','etha12819844').out('associatedtoservice').bandwidth result of query orientdb: i want trim out "mbit/s" string , 70 , make sum(70+70) query. appreciated. there no string manipulation steps in gremlin, can use lambda: g.v('service').has('serviceid','etha12819844').out('associatedtoservice'). map {it.get().value("bandwidth").replace("mbit/s", "").tointeger()}.sum() however, in long run consider store bandwith number.

android.database.sqlite.SQLiteException: unknown error (code 0): Unable to convert BLOB to string -

i getting error while updating name in existing contact. code: string namewhere = contactscontract.data.contact_id + "=? , " + contactscontract.data.mimetype + "='" + contactscontract.commondatakinds.structuredname.content_item_type + "'"; string[] idparam = new string[]{contacts.getcontactid()}; contentvalues values = new contentvalues(); values.put(contactscontract.contacts.data.raw_contact_id, id); values.put(contactscontract.commondatakinds.structuredname.display_name, contacts.getname()); int update = context.getcontentresolver().update(contactscontract.data.content_uri, values, namewhere, idparam); i have go through these links: sqliteexception unable convert blob string when contact have photo. android , other related problem. and logs e/androidruntime: fatal exception: main process: com.embedded.contacts, pid: 15248

Join in RethinkDB -

how join multiple conditions , use aggregate function in rethink-db r.table("yourtable").get(id).innerjoin( r.table("secondtable"),function (up, upp) { return user_profile("mid") }).map({ uid: r.row("left")("userid"), mid: r.row("left")("memberid"), pid: r.row("right")("projectid"), nodeid: r.row("right")("nodeid"), pri: r.row("right")("priority") }) .min("priority"); r.table("tblname1").get(id).innerjoin( r.table("tblname2"), function (tbl1, tbl2) { return tbl1("userid").eq(tbl2("userid")); })

authentication - How to prevent clients from retrieving my server's certificate -

i have secure api mobile clients. perform certificate pinning , achieved it. problem if run command openssl s_client -connect xxx.xxxxxxxxx.com:443 can see certificate. believe whoever have url, can see certificate , connect apis. how can prevent access certificate, mobile can access not public? anyone connects ssl / tls server can view server's certificate because public. normal behavior. but not mean can connect api. authentication mechanism added 1 connects has present credentials, example user/password . with ssl/tls possible require client certificate stablish secure channel. called two ways authentication . not used mobile devices because of difficulty of distributing electronic certificates i suggest adding authentication api if have not done so

How to use an alias type as a generic type parameter in C# -

this question has answer here: why can 1 aliased c# type not accessed another? 3 answers how pass alias type defined using generic class? i tried following code: using id = int32; // might replaced `string`. using cc = c<id>; public class c<t> { t id; } and there error: error cs0246 type or namespace name 'id' not found (are missing using directive or assembly reference?) but using directive right above line error occurs. did miss something? i not know trying achieve this, can, however, similar inheritance public class cc : c<id> { } the class cc derive c<t> concrete type. hence cc.t of type int32 (or whatever).

React Native Navigation usage in android -

for https://wix.github.io/react-native-navigation/#/ they given usage ios not android https://wix.github.io/react-native-navigation/#/usage need help! the usage provided in example reference works both android , ios. if building redux based application should use https://reactnavigation.org/ navigation according documentation react native http://facebook.github.io/react-native/releases/0.46/docs/navigation.html#navigating-between-screens

Can not deploy my rails app to heroku after getting asset not present in asset pipeline error -

my app works fine on localhost trying deploy heroku , says: we're sorry, went wrong. if application owner check logs more information. log file: 2017-07-28t06:32:05.150511+00:00 app[web.1]: f, [2017-07-28t06:32:05.150434 #4] fatal -- : [333bb637-4f97-41fa-8b90-60452df2b4fd] 2017-07-28t06:32:05.150586+00:00 app[web.1]: f, [2017-07-28t06:32:05.150519 #4] fatal -- : [333bb637-4f97-41fa-8b90-60452df2b4fd] actionview::template::error (the asset "landingherodrink.jpeg" not present in asset pipeline.): 2017-07-28t06:32:05.150803+00:00 app[web.1]: f, [2017-07-28t06:32:05.150736 #4] fatal -- : [333bb637-4f97-41fa-8b90-60452df2b4fd] 10: </div> 2017-07-28t06:32:05.150806+00:00 app[web.1]: [333bb637-4f97-41fa-8b90-60452df2b4fd] 11: </div> 2017-07-28t06:32:05.150806+00:00 app[web.1]: [333bb637-4f97-41fa-8b90-60452df2b4fd] 12: <div id="landingherodrink"> 2017-07-28t06:32:05.150808+00:00 app[web.1]: [33

bitbucket - Git: Push data on branch from different folder ? -

i have directory structure below papa.fit |__ dev i have setup git master branch pushing data except dev on master branch . created sub branch ironman want push data specific dev folder. need setup git again dev folder ?? because .git present in papa.fit , not in dev. how can push data dev branch (ironman) ??

Retrieving %data from sqlite database java -

so have 2 database table in sqlite: vendororder , newspaperorder . vendororder db table has (no,date,vendor, ...) column ( no id#). date no vendor ... 06:57:05 pm 27/07/2017 1 09:18:23 28/07/2017 2 b 09:19:08 28/07/2017 3 c newspaperorder db table has (no,newspaper,orders,subtotal, ...) column. no newspaper orders subtotal rebate... 1 bulletin 3 9 1 m times 1 5 1 philstar 2 20 2 bulletin 0 0 2 m times 3 15 2 philstar 0 0 3 bulletin 1 9 3 m times 4 20 3 philstar 5 50 i able retrieve data specific date, using code. string sql = "select vendororder.vendor,newspaperorder.newspaper,newspaperorder.orders,newspaperorder.subtotal,newspaperorder.rebate" +" vendororder,newspaperorder" +" vendororder.no = newspaperorder.no ,

Android Volley does not loop through the whole JSON Objects -

help guys, trying parse nested json objects. when checked logcat not iterate next jsonobject of pasta. shows first jsonobject of "name" : "creamy bacon mushroom", "details" : "", "price" : "", "image" : { "url" : "" } after infinitely loops on , on again. this json: [ { "food" : { "pasta" : [ { "name" : "creamy bacon mushroom", "price" : 170, "details" : "creamyyy", "image" : { "url" : "/sad/uploads/food/images/1/food_pasta_creamybaconmushroom.jpg" } }, { "name" : "vigan longganisa penne", "price" : 169, "details" : "vigannnnn",

android - How to check if data is inserted in Room Database -

i using room database new architecture components in project. adding data through dao, when trying retrieve not getting it. can please suggest me how check whether insert successful or not? below codes understand problem. adding database, checked debugger, statement executed successfully. appcontext.db.rallydao().addvehiclelistitem(vehicle) getting null database on statement after insert. val v = appcontext.db.rallydao().getvehiclelistitem(it.vehicleid) roomdatabase @database(entities = arrayof(rally::class, route::class, checkpoints::class, vehicles::class, vehiclelistitem::class), version = 1) abstract class tsdroom: roomdatabase() { public abstract fun rallydao():rallydao } inside dao @insert(onconflict = onconflictstrategy.replace) fun addvehiclelistitem(vehiclelistitem:vehiclelistitem) @query("select * vehicles_submitted vehicle_id :vehicleid") fun getvehiclelistitem(vehicleid:string):vehiclelistitem vehiclelistitem entity @entity

python 3.x - Convert string to respective data type ie. int or long (python3) -

temp=input() l=list(map(int,temp.split())) count=0 in range (1,min(l[0],l[1])+1): if l[0]%i==0 , l[1]%i==0: count+=1 print (count) above code takes 2 or more numbers , finds count of common factors. range these numbers 1 10**12. how handle both int , long data types in code? kindly help. as opposed python 2, python 3 doesn't distinguish between int , long ( long gone python 3). it's integer can longer 64-bit. from python 3 documentation integers have unlimited precision.

How do I set StyleUrls with variable in Angular 2 -

i have ts file this export const environment = { production: false, profile : './test/test.css' }; i import environment.profile , set can use in styleurls like import { component, oninit } '@angular/core'; import { translateservice } "@ngx-translate/core"; import {environment} "../../environments/environment"; @component({ selector: 'app-header', templateurl: './header.component.html', styleurls: [environment.profile] }) but getting error: error: cannot find module "." main.bundle.js:250:62 webpackmissingmodule http://localhost:4200/main.bundle.js:250:62 ../../../../../src/app/header/header.component.ts http://localhost:4200/main.bundle.js:250:29 webpack_require http://localhost:4200/inline.bundle.js:55:12 ../../../../../src/app/app.module.ts http://localhost:4200/main.bundle.js:71:83 webpack_require http://localhost:4200/inline.bundle.js:55:12 ../../../../..

vuejs2 - Vue-material Dialog : Close Dialog -

i'm using vue-material dialog show form, i've : leftsidenav.vue - template : <md-button class="list-button" id="formbtn" @click="openformdialog()"> <md-icon>description</md-icon> <span class="sidenav-item-text">{{$t('form_dialog')}}</span> <md-tooltip md-delay="100" md-direction="right">{{$t('form_dialog'')}}</md-tooltip> </md-button> <md-dialog md-open-from="#formbtn" ref="formdialog"> <md-dialog-title>title</md-dialog-title> <md-dialog-content> <form-dialog></form-dialog> </md-dialog-content> </md-dialog> leftsidenav.vue - script : methods: { openformdialog() { this.$refs.formdialog.open(); }, closeformdialog() { this.$refs.formdialog.close(); }, }, formdialog.vue : <template> <div>

serial port - hub4com OVERRUN Error -

i trying split physical serial port (com3) 2 or more virtual ports using com0com create virtual ports , hub4com split them. here commands use create virtual ports: install 0 portname=com100 portname=com101 change com100 emubr=yes, emuoverrun=yes change com101 emubr=yes, emuoverrun=yes install 1 portname=com110 portname=com111 change com110 emubr=yes, emuoverrun=yes change com111 emubr=yes, emuoverrun=yes the commands use split port: hub4com --route=0:all --baud=115200 \\.\com3 --baud=115200 \\.\com101 --baud=115200 \\.\com111 here output along error get: com3 open("\\.\com3", baud=115200, data=8, parity=no, stop=1, octs=on, odsr=off, ox=off, ix=off, idsr=off, ito=0) - ok com101 open("\\.\com101", baud=115200, data=8, parity=no, stop=1, octs=on, odsr=off, ox=off, ix=off, idsr=off, ito=0) - ok com111 open("\\.\com111", baud=115200, data=8, parity=no, stop=1, octs=on, odsr=off, ox=off

jboss - EAP 7 What is the default Quality-Of-Service of a JMS Bridge? -

the docu mentioning 3 options: https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.0/pdf/configuring_messaging/red_hat_jboss_enterprise_application_platform-7.0-configuring_messaging-en-us.pdf but default value? (i assume at_most_once please confirm) at_most_once duplicates_ok once_and_only_once yes. default value at_most_once . can verify using cli command [standalone@localhost:9990 /] /subsystem=messaging-activemq/jms-bridge=my-jms-bridge:read-attribute(name=quality-of-service,include-defaults=true,resolve-expressions=true) { "outcome" => "success", "result" => "at_most_once" }

java - Android Room Persistence Library : What is the best way to implement a many to many relation? -

Image
i used use realm , testing room in order compare both tools. i trying implement following many many relation : here entity classes : the person : @entity(tablename = "person") public final class roomperson { @primarykey public int id; public string name; } the cat class : @entity(tablename = "cat") public final class roomcat { @primarykey public int id; public int age; public string name; } and personcat class : @entity(tablename = "person_cat", primarykeys = { "personid", "catid" }, indices = { @index(value = { "catid" }) }, foreignkeys = { @foreignkey(entity = roomperson.class, parentcolumns = "id", childcolumns = "personid"), @foreignkey(entity = roomcat.class, parentcolumns = "id", childcolumns = "catid") }) public final class roompersoncat { public int personid; public int catid; public roompersoncat(int personi

Batch file to merge specific files into one? -

i newbie windows batch command please spare me irrelevant help. want merge files using type command of windows since files coming various sources need search in file name source filter , merge files. have tried writing below code it's not doing job me. @echo off set filter=%1 set final_file=%2 echo %filter% echo %final_file% %f in (*.dlt) do( echo %f if find %filter "%f ( type "%f" >> %final_file ) ) here example made merge *.bat files in 1 file; can modify needs : need modify variable set "filter_ext=dlt" , set "masterfolder=%userprofile%\desktop" yours @echo off mode 75,3 & color 9e title merge *.bat in 1 file set "masterfolder=%userprofile%\desktop" set "output=output_merged_files.txt" set "filter_ext=bat" if exist "%output%" del "%output%" echo( echo please wait while generate output file ... @for /f "delims=" %%a in ('d

ftp - C++ libcurl: curl_easy_perform() returned CURLE_OK eventhough it received response code 226 -

Image
i'm sending files linux server windows remote system using libcurl ftp. below code curl_easy_setopt(curlsessionhandle, curlopt_url, remotefileurl); curl_easy_setopt(curlsessionhandle, curlopt_upload, on); // set input local file handle curl_easy_setopt(curlsessionhandle, curlopt_readdata, localfilehandle); // set on/off wanted options // enable ftp data connection curl_easy_setopt(curlsessionhandle, curlopt_nobody, off); // create missing directory ftp path curl_easy_setopt(curlsessionhandle, curlopt_ftp_create_missing_dirs , on) ; // set progress function, in order check stop transfer request curl_easy_setopt(curlsessionhandle, curlopt_noprogress, off); curl_easy_setopt(curlsessionhandle, curlopt_progressfunction, progresscb); curl_easy_setopt(curlsessionhandle, curlopt_progressdata, this); curlcode result = curl_easy_perform(curlsessionhandle); ==================================================================== few files not transferred remote didn't receive

excel - Network path not working for xlswritefig in Matlab -

i trying open workbook located on network path using function xlswritefig . i.e. path not start traditional letter such c:\ . instead looks follows: \\networkmain\folder\to when try open excel file on folder in matlab, noticed excel adds current path in front of the path. i.e. if in folder c:\matlab\ excel tries open: c:\matlab\networkmain\folder\to how can prevent happening , redirect network path? the problem function xlswritefig . solve issue, step function , change following line of code (line 86): %**op = invoke(excel.workbooks, 'open', [pwd filesep filename]); op = invoke(excel.workbooks, 'open', filename); thus remove [pwd filesep] part.

Unable to locate a specific element using Xpath -

i've created xpath expression locate value of "genre:" in case "drama". but, running script "genre:". how rectify expression locate "drama"? i've tried with: //div[@class="mdif"]//li/b/text() elements within value is: <div class="mdif"> <ul> <li><b>genre:</b>drama</li> <li><b>quality:</b>1080p</li> <li><b>screen:</b>1920x1080</li> <li><b>size:</b>1.67g</li> <li><b>rating:</b>6.1/10</li> <li><b>peers:</b>17</li> <li><b>seeds:</b>0</li> </ul> <a href="/movie/55000/download-lake-mungo-2008-1080p-mp4-yify-torrent.html" class="small button orange" target="_blank" title="download lake mungo (2008) 1080p yify torrent">download</a> a little more

design patterns - Designing Python client for multiple different REST APIs -

we develop python wrapper rest api in our platform. right now, platform has 12 different apis , unrelated in function, don't share same base url, , have different authentication methods. related in sense, part of platform. @ moment developing client single api (out of list of twelve), it's remaining apis have python wrapper in future. to avoid headeaches down road, we've been discussing structure of package , can't 100% agree on structure one point of view creating (ultimately) 12 different packages, 1 each api. (names non-pythonic sake of clarity) $ pip install platform_apiclient_foo $ pip install platform_apiclient_bar $ pip install platform_apiclient_spam ... and in code use like: from platform_apiclient_foo import clientfoo platform_apiclient_bar import bar the argument not have common function , should separated. the second point of view creating 1 package encompassing current , possible future apis, require install single package $ pip insta

Get Root NodeRef Alfresco REST -

i'm looking find 'root' noderef of alfresco using rest. i'm using alfresco v5.1. if me on great, in advance =) (note : call 'root' folder stored 'sites', etc ...) edit : found out 'root' folder called 'company home' if want children or property of node or nodes of root,this link guide how get. https://community.alfresco.com/community/ecm/blog/2016/10/17/v1-rest-api-part-2-navigation . https://api-explorer.alfresco.com/api-explorer/#!/nodes/listnodechildren

javascript - Auto Adjust DIV content in browser - Rescale if it's necessary -

Image
i need show lot of items, div class='box', in browser. auto adjust number of elements according width of windows browser. these elements rescale if it's necessary. the width of elements it's same. i'm using bootstrap framework it. i result: according size of browser auto adjust elements , scale. body{ background-color: #f8f8f8; } /* box principal */ .box{ margin: 50px; width: 300px; height: 300px; border: 4px solid #004259; border-radius: 15px; overflow: hidden; } /* image */ .img-prod{ width: 100%; height: 100%; border-radius: 12px; align: center; max-width: 100%; -moz-transition: 0.3s; -webkit-transition: 0.3s; transition: 0.3s; } /* on hover */ .box:hover{ border: 4px solid #fde1ae; } /* .box:hover .text-link{ color: #fde1ae !important; } .box:hover .text-edicio{ color: #fde1ae !important; } */ .