Posts

Showing posts from May, 2010

asp.net mvc - Object value is not preserved from view to controller -

i using model pass values controller model. have first controller action method : public actionresult createadform(sitedirectionmodel model){ mymodel mymodel= new mymodel{ id = model.id, name = model.name, //an on sitedirection = model //a sitedirectionmodel object }; return view(mymodel); } the point of method preload values , pass view form : @model myproject.models.mymodel @using (html.beginform("validateform", "create", formmethod.post)) { @html.antiforgerytoken() <hr /> @html.validationsummary(true, "", new { @class = "text-danger" }) <div class="form-group"> @html.labelfor(m=>m.name, new { @class= "col-md-2 control-label" }) <div class="col-md-10"> @html.textboxfor(m => m.name, new { @class =

React-native-maps: Change MapView.Marker child component MapView Image on Select -

i'm working on implementation of react-native-maps . there mapscreen component , on component mapview of react-native-maps there many mapview.marker rendered out mapping through list of items in props. each mapview.marker have custom child component mapmarker of current item of list of items in props passed. essentially, each item have both current image default , selected image when mapmarker selected. i change image of mapmarker when mapmarker selected , when mapmarker selected should changed default image. default, map markers rendered on mapview default images. mapscreen component this.props.items .map(i => <mapview.marker key={i.id} onpress={() => this.handlelocationpush(i)} coordinate={i.location} > <mapmarker item={i}

javascript - how to prevent repetitive shuffle of my array using onClick -

i need fresh eyes me. i have set of answers in array shuffle on first render. my problem here, know if clicking on 1 of answer, setstate re-render , consequently re-shuffle array dont want. you can have @ code below: export default class extends react.component { constructor(props) { super(props) this.state = { user: this.props.user, token: this.props.token, data: this.props.data, count: 0, select: undefined } this.changequestion = this.changequestion.bind(this); this.oncorrect = this.oncorrect.bind(this); this.onfalse = this.onfalse.bind(this); } static async getinitialprops({req, query}) { const id = query.id; const authprops = await getauthprops(req, 'country/questions?theory=' + id) return authprops } componentdidmount() { if (this.state.user === undefined) { router.push('/login') } } changequestion() { this.setstate(

database - How to pass data to Online Excel workbook using C# -

for desktop excel client , add-in, able prepare data, create excel object , open new workbook data pre-populated in same. similarly, trying develop excel online add-in, need pass data online excel worksheet , open worksheet external (c#) application url. data should prepopulated or minimum clicks, should able fetch data database. currently, workaround, saving data(that has exported) database, , open workbook in online excel, have click-open add-in , further coded logic fetches data database , of office.js , populate sheet. it great if me in implementing better approach achieve same. thanks in advance! wiki

If loop in C not iterating properly -

writing word counter on c. i'm counting number of spaces in string determine number of words. i'm guessing there's wrong if statement. counts number of words , other times it's throwing random numbers? instance "my red dog" has 3 words "i drink rum" has 1 word , "this code makes no sense" has three. it's printing length of strings fine each. here's part of code in question: void wordcounter(char string[]) { int counter = 1; int = 0; int length = strlen(string); printf("\nthe length of string %d", length); for( i=0;i<length;i++){ if (string[i] == ' ') { counter+=1; ++i; } else { counter +=0; ++i; } } printf("there %d words in sentence , equal to: %d", counter, i); } the biggest problem posted code incorrectly increments i should not. for( i=0;i<length;i++

c# - Filtering combobox by other combobox -

when want combobox combobox other filter message shows non-static method requires target the way have database table each combobox's values linked foreign keys. when selection made, query other table based on id of combox value. wiki

php - Yii relation STAT with multiple columns -

i'm trying stat relation review table. code public function relations() { return array( 'avaragerating' => array(self::stat, 'reviews', array('make_code'=>'make_code', 'model_code'=>'model_code', 'year'=>'year'), 'select' => 'avg(overall_rating)'), } the table this make_code | model_code | year | overall_rating 01 | 02 | 2015 | 4.2 01 | 03 | 2014 | 4.0 01 | 02 | 2015 | 3.0 i want overall_rating average rows have same make_code , model_code , year example, make_code 01, model_code 02 , year 2015. (4.2+3.0 / 2) , $model->avaragerating should give me 3.6 right now, when call relation using $model->avaragerating; error preg_match() expects parameter 2 string, array given any idea i'm doing wrong? edited: function getavaragerating() { $criteria = new cdbcriteria(); $c

indexing - Notice: Undefined index: status in C:\xampp\htdocs\gameserver\pre.php on line 40 -

when code executes work command error show notice : undefined index: status in c:\xampp\htdocs\gameserver\pre.php on line 40 notice : undefined index: stats in c:\xampp\htdocs\gameserver\pre.php on line 46 why problem need help.. here code / $command = (isset($_post['command']) ? $_post['command'] : ''); / if($command=$_post["name"]){ $command='kick'; var_dump( $query->rcon( $command ) ); } else if($command=$_post["status"]){ $command='status'; var_dump( $query->rcon( $command ) ); } else if($command=$_post["stats"]){ /* / $stats='stats';*/ $command='stats'; var_dump( $query->rcon( $command ) ); } else if($command=$_post["map"]){ $map='map *'; var_dump( $query->rcon( $command ) ); } else{ $command= "say &

debugging - Can i print the information of the locals window in my application visual studio? -

i wondering, if there way let print variables , values displayed on locals window. to clearer ,i want create application works same locals window in visual studio during process execution. can know how acheived? thankyou in advance. not found possible solution it. if want variable value, 1 workaround use immediate window instead of local window. or customer debugging watch window output view lists want native extension. output watched visual studio variable file but not found way achieve using local windows. i submit feature request product team here: https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/30957622-can-i-print-the-information-of-the-locals-window-i if possible, vote , add comment there. wiki

cypher - Erratic behavior of Neo4j while loading datas -

we're loading data in neo4j server represents (almost) k-ary trees k between 2 , 10 in case. have 50 node types possible, , same amount of type of relationships. server online , data can loaded several instances (so, unhappily, can't use neo4j-import) we experience slow loading 100 000 nodes , relationships, take 6mn load in machine. experience loading of same datas takes 40mn ! looking @ neo4j process, sometime doing nothing.... in case, have messages : warn [o.n.k.g.timeoutguard] transaction timeout. (overtime: 1481 ms). beside don't experience problems query execute despite complex structures we load data follow : a cypher file loaded : neo4j-shell -host localhost -v -port 1337 -file mygraph.cypher the cypher file contains several sections : constraints creations : create constraint on (p:mynodetype) assert p.uid unique; index on little set of nodes (10 @ more) we select these avoid counter performance behaviours. create index on :mynod

javascript - YouTube Live Embedded Chat CustomError -

i embedding youtube live chat, like in jsfiddle , , getting error when try chat: "customerror @ new vh (https://www.youtube.com/yts/jsbin/live_chat_polymer-vflcywebp/live_chat_polymer.js:1035:32) @ htmlelement.onytaction_ (https://www.youtube.com/yts/jsbin/live_chat_polymer-vflcywebp/live_chat_polymer.js:2996:141) @ htmlelement.fire (https://www.youtube.com/yts/jsbin/live_chat_polymer-vflcywebp/live_chat_polymer.js:194:144) @ htmlelement.sendaction_ (https://www.youtube.com/yts/jsbin/live_chat_polymer-vflcywebp/live_chat_polymer.js:662:41) @ htmlelement.sendaction (https://www.youtube.com/yts/jsbin/live_chat_polymer-vflcywebp/live_chat_polymer.js:660:254) @ htmlelement.sendservicerequestaction (https://www.youtube.com/yts/jsbin/live_chat_polymer-vflcywebp/live_chat_polymer.js:665:79) @ htmlelement.sendmessage (https://www.youtube.com/yts/jsbin/live_chat_polymer-vflcywebp/live_chat_polymer.js:3529:468) @ htmlelement.handler (https://www.youtube

php - how select a table value with different table with where clause in there -

i want ask php queries. want select under select data clause condition in there. in 1st queries have select data in table wjm condition (date between $a , $b) , kode=$c , user='borongan' . nah in queries of data. problem want change data kode wjm name in data material . change need clause again checking kode value data wjm check table material condition select nama kode='the code wjm' the query have made wjm table this select * wjm (date between '$date_awal' , '$date_akhir') , kode ='$kode' , uses='borongan' order no asc and want make select again inside them kode have got query. queries want make this select nama material kode='the code got wjm' can that. mean posible that? wiki

angularjs - 1 service - 2 ctrl - how to bind value of the service -

i'm new angularjs. try make little explorer game angularjs here problem: when click on button, inventory should showed. when console.log function, can see change of value of showedinventory inventoriesctrl don't. service angular.module('inventoryservice', []) .factory('inventoryservice', function(){ var showedinventory = false; return{ getshowinventory: function(){ console.log('getshowinventory'); return showedinventory; }, showinventory: function(){ console.log('showinventory'); showedinventory = true; return showedinventory; } } }) ctrl 1 & 2 app.controller('navigationsctrl',['$scope', 'inventoryservice', function($scope, inventoryservice){ $scope.showinventory = function(){ inventoryservice.showinventory(); }}]); app.controller('inventoriesctrl',['$scope', 'inventoryse

c++ - Not able to write image SimpleElastix (Python) -

i'm trying run following example part of simpleelastix library: import simpleitk sitk elastiximagefilter = sitk.elastiximagefilter() elastiximagefilter.setfixedimage(sitk.readimage('1.jpg', sitk.sitkfloat32)) elastiximagefilter.setmovingimage(sitk.readimage('2.jpg', sitk.sitkfloat32)) elastiximagefilter.setparametermap(sitk.getdefaultparametermap('rigid')) elastiximagefilter.execute() sitk.writeimage(elastiximagefilter.getresultimage()) when try run above code, following error (i'm showing part of output): traceback (most recent call last): file "rigid_transform.py", line 8, in <module> sitk.writeimage(elastiximagefilter.getresultimage()) file "/usr/local/lib/python2.7/dist-packages/simpleelastix-1.0.1rc1.dev331+gd756f-py2.7-linux-x86_64.egg/simpleitk/simpleitk.py", line 8015, in writeimage return _simpleitk.writeimage(*args) notimplementederror: wrong number or type of arguments overloaded function '

use gitgraph for existing GIT project -

i want view commits on git project graphically, have downloaded gitgraph.js package git when see documentation, creating gitgraph object , adding master, creating branches, commiting , merging. but want view project have cloned remote graphically. can please tell me how ? thanks. gitgraph.js simple javascript library meant visually presenting git branching stuff git workflow, tricky git command or whatever git tree you'd have in mind. which means cannot use gitgraph represent actual repository. used explain git concepts. you can try sourcetree or other git gui programs. wiki

I have a rails app , and using delayed_job and R interpreter. it give"RinRuby::EngineClosed " -

i using rails version 4.2.2 , ruby 2.2.4 , delayed_job 4.1.1, delayed_job_active_record-4.1.0, r version-3.4.1, rinruby 2.0.3 when delayed_job run ruby script , gives below error. "rinruby::engineclosed /home/ubuntu/.rvm/gems/ruby-2.2.4/gems/rinruby-2.0.3/lib/rinruby.rb:241:in `eval' " wiki

angular ui router - How can I remove #! from url in angularjs? -

i want remove #! url , used $locationprovider.html5mode(true); for , works when refreshes page can't able find page , give error. what should this? index.html <!doctype html> <html dir="ltr" lang="en" ng-app="myapp"> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <base href="/"> </head> <body class="product-product-82 responsive full default layout_2"> <script type="text/javascript" src="bower_components/angular/angular.js"></script> <script type="text/javascript" src="app.js"></script> <script type="text/javascri

asp.net web api - ASP .NET Web API ADFS SAML Token -

i trying achieve same in link in case have relaying party trust registered in adfs (adfs 3.0). an external application (mobile) authenticates adfs , encoded saml token (base64 encoded). i have web api on on-premise iis. have webconfig.cs follows : public static class webapiconfig { public static void register(httpconfiguration config) { // authentication configuration identity controller var authentication = createauthenticationconfiguration(); config.messagehandlers.add(new authenticationhandler(authentication)); // web api routes config.maphttpattributeroutes(); config.routes.maphttproute( name: "defaultapi", routetemplate: "api/{controller}/{id}", defaults: new { id = routeparameter.optional } ); } private static authenticationconfiguration createauthenticationconfiguration() {

excel - Parsing an array over multiple worksheets -

i trying breakdown array of tickers on 1 sheet multiple sheets. trying loop through multiple sheets using "i" variable both worksheet identifier , multiplier how many tickers go on each sheet. can spot error i'm making here? or other ways you'd recommend attack this? "breakdowncount" = user inputted grouping size...in case 200 test. thanks! for = 1 breakdowncount upperrange = 8 + (i - 1) * 200 lowerrange = 8 + * 200 msgbox upperrange msgbox lowerrange worksheets("data " & i).range(cells(8, 2), cells(207, 2)).value = worksheets("scanner - all").range(cells(upperrange, 2), cells(lowerrange, 2)).value next you need qualify all range object parent sheet. includes cells() inside range(): for = 1 breakdowncount upperrange = 8 + (i - 1) * 200 lowerrange = 8 + * 200 msgbox upperrange msgbox lowerrange worksheets("data " & i).range(worksheets("data &

Java 8, how to compose (Bi)Function from (Bi)Predicate -

i don't believe question specific bi versions of these java 8 classes, hence parens in question title. i composed function create apache commons lang3 pair object following requirements: if both left , right null, pair should null if left , right equal 1 another, pair should null otherwise, pair should created, either side of may null i did within method follows: bipredicate<string,string> valuesexist = (pre, post) -> pre != null || post != null; final bipredicate<string, string> valuesdiffer = valuesexist.and((pre, post) -> (pre != null) ? ! pre.equals(post) : true); bifunction<string, string, pair<string,string>> createpair = (pre, post) -> (valuesdiffer.test(pre, post)) ? immutablepair.of(pre, post) : null; // usage looks like: pair<string, string> mypair = createpair.apply(myvalue1, myvalue2) i had 3 questions: is there way avoid 2 bipredicates?

javascript - Return value from custom async function -

this question has answer here: how return response asynchronous call? 21 answers i need return lat-lng coordinates google geocode api, , it. so, code seems this: async function getjson(url){ try { const response = await fetch(url); return await response.json(); } catch (err) { console.error(err.message); } } function getlocationforname(address){ getjson(geocodeurl+address+apikey).then(function(location){ return location.results[0].geometry.location; }); } somefunc(){ f['location'] = getlocationforname(city+f['street']+'+'+f['house']); } but f['location'] alwais have undefined value you need use callback function: function getlocationforname(address, callback){ getjson(geocodeurl+address+apikey).then(function(location){

c# - ASP.net Web API Unauthorised Access -

i have set new asp.net mvc , web api application default individual accounts authentication system, , have working regular controllers authorise attribute, when try same web api controller, hit unauthorised access, despite having access initial index page. once logged in , on index page, click button fires off request api, reason receives unauthorised request. missing? does work: [authorize] public class homecontroller : controller { public actionresult index() { return view(); } } doesn't work: public class taskscontroller : apicontroller { [authorize] [httpget] public ienumerable<usertask> getalltasks() { using (var db = new testdb()) { var tasks = db.usertasks.where(o => o.createdbyuser == user.identity.name).tolist(); return tasks; } } } wiki

transliteration - Transliterate Devnagri script to English using python transliterate package throwing 'ascii' codec error -

i need transliterate hindi text english maintaining pronunciation e.g प्रेम कथा should converted prem katha . using python indic_transliterate library. sanscript.transliterate("टॉयलेट एक प्रेम कथा",_from=sanscript.devanagari,_to=sanscript.iast) but throwing error 'ascii' codec can't decode byte 0xe0 in position 0: ordinal not in range(128) though tried converting hindi string unicode , still issue same. can guide me how resolve this. wiki

oracle - Java backend RESTful server application with CDI -

my task create javaee application restful services using cdi . have data oracle database. i have researched on internet on how make this, couldn't find project/guide using needed. have created entity class, can't figure out how deal data database, crud database. my entity class: @entity @table(name = "books") public class book implements serializable { private int id; private string author; private string title; @id @generatedvalue(strategy = generationtype.identity) @column(name = "id", unique = true, nullable = false) public int getid() { return id; } public void setid(int id) { this.id = id; } @column(name = "author", unique = true, nullable = false) public string getauthor() { return author; } public void setauthor(string author) { this.author= author; } @column(name = "title", unique = true, nullable = false) public

python - custom template tag with multiple arguments -

i want format date in future based on time delta: from django import template datetime import datetime, timedelta, time register = template.library() @register.simple_tag def tomorrow(format): tommorow = datetime.now() + timedelta(days=1) return tommorow.strftime(format) def dayfuture(dday, format): dayfuture = datetime.now() + timedelta(days=dday) return dayfuture.strftime(format) this works: {% tomorrow "%a, %d %b, %y" %} but i've had no luck dayfuture . also, possible have multiple custom template tags in same file. i've had no luck registering second one. i'm using django 1.11 pythone 3.4 this not work because did not register it. possible have multiple template tags inside single file. def dayfuture(dday, format): dayfuture = datetime.now() + timedelta(days=dday) return dayfuture.strftime(format) you have put decorator on register it @register.simple_tag def dayfuture(dday, format): dayfuture = da

ide - How to fix keyboard issues? -

windows 10 dell inspiron 5520.i got usa india. used cloud9 ide recently. onwards keyboard functioning weird unusual symbols turned on on-screen keyboard see what's wrong. found altgr key right alt key. cloud 9 rds? microsoft claims problem altgr key when using rds. problem persists after stopped using cloud9. there weird currency symbols showing up. correct letters show if hold spacebar , type keys in? how fix it? updated keyboard drivers too. wiki

python - Multiple Login Field Options for Django Rest Framework (JWT) -

how can override django-rest-framework-jwt jsonwebtokenserializer allow user login via either email, username or password. i see suggested option in github issue not sure how i'd override default jsonwebtokenserializer not among jwt_auth settings. i want able provide functionality seen in question can allow django user login via field may have in custom user table for using django allauth, adding these settings in settings.py file solves this. account_authentication_method=“username_email” account_email_required = true account_unique_email = true account_username_required = true all configurations can found here . wiki

PowerShell not working on Windows 2008 R2 -

i have accidently installed .net 4.5 on windows server 2008 r2 powershell 5.1, have reverted .net 4.0 version , powershell not working. gives below error. windows powershell terminated following error: method not found: 'system.threading.tasks.task system.threading.tasks.task.run(system.action)' what should resolve this? you need download windows management framework 3.0 or install microsoft .net framework 4.5 correct issue. windows management framework 3.0 - link microsoft .net framework 4.0 - link or can windows management framework 4.0 - link microsoft .net framework 4.5 - link wiki

javascript - Combine associative array/object in JS without erasing numerically indexed values $.extend() -

when using $.extend(true, {}, obj1, obj2) , resulting object erases numerically-indexed data number of results in obj2 . a sample call $.extend() this: then take sample data instance: var base_json_obj = { 'regions': [ 'nc', '-greensboro', 'va', '-richmond' ], 'vehicles': [ 'ford:escape', 'nissan:altima' ], 'turnover': { 'min': '0d', 'max': '5d' } }; var new_json_obj = { 'regions': [ 'fl', '-miami' ], 'vehicles': [ 'hyundai:sonata' ], 'turnover': { 'min': '1d', 'max': '6d' } }; var resulting_object = $.extend(true, {}, base_json_obj, new_json_obj); the resulting object { 'regions': [ 'fl', '-miami', 'va', '-richmond' ], 'vehicles': [

javascript - Is it possible to dynamically close or open a Jqgrid column search? -

is possible open , close search function of columns after loading jgrid? the underlying code allows hide search part, not affect search function it works fine hide haven't found need show it this code not affect search function i have influence search $("#gs_name").closest(".ui-search-table").hide(); sample jsfiddle update the desired combination in client name column search = hidden -> search = false search = show -> search = true $("#columnhide").click(function(){ $("#gs_name").val("") $("#gs_name").closest(".ui-search-table").toggle(); }); the hidden property in double click property of colmodel. in case should use jquery selector :hidden job. the code can changed this: ondblclickrow: function(rowid, irow, icol, e) { var cm = $(this).jqgrid("getgridparam", "colmodel"); var cmvalues = $(this).jqgrid("getrowdata", rowid); $.

groovy - Maintain HTTP session in a Jenkins pipeline -

i want use alm rest api inside jenkins pipeline. use api need follow steps : authentication + sign-in (session cookie created) get need sign-out i need maintain session : although restful applications ideally stateless, alm platform requires sessions manage locking, client lifetime, , perform other basic tasks. using http request plugin , i'm not able maintain session. i have working solution using curl , pipeline step "sh" cleaner, using step plugin/jenkins or groovy/java solution. wiki

javascript - CORS issue with aws-sdk S3 on Firefox -

o/s: mac os sierra 10.12.16 browser: firefox 54.0.1 i have bug firefox javascript site when uploading pdfs s3 using aws-sdk node . works on chrome, ie11 , safari. update: it seems work ok when upload pdf's under 500kb. when upload files on 500kb works 1 time out of 10. i signed request pdf by: client: $.ajax({ cache: false, type: 'get', mimetype: 'text/plain', url: '/gets3url?file-name=' + annexurefilename + '&file-type=' + validatedfile.type + '&url-folder=' + index.s3urlfolder, success: function (data, textstatus, request) { const response = json.parse(data); putlocalfiles(validatedfile, reference, response.signedrequest, annexurefilename, response.url, callback); }, error: function (err, textstatus, request) { _errorcallback(err.responsetext); } }); server: exports.gets3url = (req, res) => { const filename = req.query['file-name']; const folderna

Google maps won't load in angular project because of Error: No provider for MapsAPILoader? -

Image
i have angular project , trying google maps module ( googlemaps library ) working. have used library before , not had issue. reason having issue now. 1 difference between situation , previous usecases time lazy loading module, uses google maps. although admin.module file imports google maps module in same way have done when have gotten work. have tried provide mapsapiloader in admin.module. not work because typescript error thrown. typescript error looks like, error in console when running app, , package.json . because have had working in app. feel dependency issue. suggestions why error thrown in console helpful. thanks! i have edited include admin.module.ts , app.module.ts. admin.module.ts imported in app.module.ts , lazy loaded in app-routing.module.ts { "name": "admin-guest", "version": "0.0.0", "license": "mit", "scripts": { "ng": "ng", "start": "ng

browser - Mobile Site is zoomed in a little on-loading -

so i'm trying figure out why site isn't loading on mobile correctly, zooming in slightly, can zoom out finger , looks correctly, have @ 100% width. when @ in chrome , safari developer mode on responsive mode looks correct looks bad on actual mobile browser. the site @ http://risewomensconference.org , ideas appreciated. tried multiple viewport meta changes , think have correct. wiki

apache spark - How to refresh a table and do it concurrently? -

i'm using spark streaming 2.1. i'd refresh cached table (loaded spark provided datasource parquet, mysql or user-defined data sources) periodically. how refresh table? suppose have table loaded by spark.read.format("").load().createtempview("my_table") and cached by spark.sql("cache table my_table") is enough following code refresh table, , when table loaded next, automatically cached spark.sql("refresh table my_table") or have manually with spark.table("my_table").unpersist spark.read.format("").load().createorreplacetempview("my_table") spark.sql("cache table my_table") is safe refresh table concurrently? by concurrent mean using scheduledthreadpoolexecutor refresh work apart main thread. what happen if spark using cached table when call refresh on table? in spark 2.2.0 have introduced feature of refreshing metadata of table if updated hive or external too

curl - Error for REST API in nifi -

when start executestream prosessor src.bat file shows me execution code 0 doesn't stop processor , insede outputstream flowfile shows errors this: execution.error % total % received % xferd average speed time time time current dload upload total spent left speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 299 0 0 100 299 0 1472 --:--:-- --:--:-- --:--:-- 1472 i use commands this: curl -x put --data-binary "@c:\users\user\desktop\nifi-1.3.0\conf\stop.json" "http://localhost:8080/nifi-api/processors/ea5db028-015d-1000-5ad5-80fd006dda92" and json file this, should do?: { "status": { "runstatus": "stopped" }, "component": { "state": "stopped", "id": "f511a6a1-015d-1000-970e-969eac1e6fc5" }, "id": "f511a6a1-015d-1000-970e-969eac1e6fc5", "revision": { "version": 30, "clientid&quo

javascript - How to filter two data set from one selection in VueJs -

i'm building small application in vuejs 2.0 i'm having 2 select options select2 plugin such: <div class="form-group"><label class="col-sm-2 control-label">categories:</label> <div class="col-sm-4"> <v-select multiple :options="selecttable" placeholder="categories" v-model="categories"></v-select> </div> </div> <div class="hr-line-dashed"></div> <div class="form-group"><label class="col-sm-2 control-label">sub-categories:</label> <div class="col-sm-4"> <v-select multiple :options="selectsubtractedtable" placeholder="subtracted categories" v-model="subtractedcategories"></v-select> </div> </div> now i've computed property list these elements inside, like: computed: { selecttable() {

How can i loop on each row and apply a specific function on it using sql-server -

enter image description here i need loop on each resulted row xml code. applied function want taking details in first row , search in data base reference information, once found need update row information , on. here code takes information , returns table of rows numbers required information data base: alter procedure [dbo].[multi_valued_user_input_parameter](@productkey varchar(max)) begin declare @xml xml,@str varchar(100),@delimiter varchar(10) set @str = @productkey set @delimiter =',' set @xml = cast(('<x>'+replace(@str,@delimiter ,'</x><x>')+'</x>') xml) select n.value('.', 'varchar(10)') value @xml.nodes('x') t(n) end update !! here multi_valued_user_input_parameter function ' alter procedure [dbo].[multi_valued_user_input_parameter](@productkey varchar(max)) begin declare @xml xml,@str varchar(100),@delimiter varchar(10) set @str = @productkey set @delimiter =',' se

java - Add listener to ArrayList -

i have arraylist add objects dynamically, , have jbutton. arraylist empty when running program , jbutton set setenabled(false). want enable button whenever there 2 elements in arraylist or more , disable again if arraylist has 1 item or empty. how can achieve this? arraylist doesn't have sort of notification mechanism. i suggest write own list implementation delegates private arraylist storage, adds ability listen notifications... or find similar within java itself. defaultlistmodel may work you, although doesn't implement list itself. wiki

jquery - Using Bootstrap DatetimePicker with Sweet Alert 2 - Display calendar over alert -

i using sweetalert2 dialog form inside. want use bootstrap datetimepicker widget. the calendar widget popup displayed within sweetalert window instead of on top of it. makes alert expand , contract - , must scroll inside alert see calendar. desired behavior calendar display child of primary page , display on top of alert. https://jsfiddle.net/ghr2bwoc/13/ swal({ title: 'date picker', html: '<input id="datepicker">', showconfirmbutton: false, onopen: function() { $('#datepicker').datetimepicker({}); }, }).then(function(result) { }); create additional class in style sheet: .swal2-overflow { overflow-x: visible; overflow-y: visible; } add new class sweet alert code using customclass attribute. swal({ title: 'date picker', html: '<input id="datepicker">', showconfirmbutton: false, customclass: 'swal2-overflow', onopen: function() {

node.js - Express dynamic include route based on user type -

need or clue including/requiring dynamic routes @ runtime in express, confusing try best. this example of app routes configuration right now app.use('/', require('./routes/public')); app.use('/u', require('./routes/user')); app.use('/a', require('./routes/admin')); for example require('./routes/public') include router.get('/', home.index); router.get('/faq', faq.index) also require('./routes/user') include this router.get('/dashboard', user_home.index); router.get('/accounts', user_acc.index) also require('./routes/admin') router.get('/dashboard', adm_home.index); router.get('/accounts', adm_acc.index) i have installed passportjs easy check if user authenti

windows - Executing SC command with a "/" in the Service name -

i want execute following command in cmd start / stop services on remote computer getting error. c:\>sc testpc query "i/my service" the problem here service name having forward slash in it. how can solve this? this has nothing sc command itself. documentation openservice : forward-slash (/) , backslash (\) invalid service name characters. the documentation createservice contains same restriction. service names not allowed contain forward or backward slashes. wiki

c# - Is it possible to store RSACryptoServiceProvider in X509Certificate2 or X509Store? -

i have keypair provided me hardware device in form of rsaparameters can convert cryptoserviceprovider using following code , encrypt/decrypt/sign. rsacryptoserviceprovider rsaprivkey = new rsacryptoserviceprovider(2048) { persistkeyincsp = false }; // rsaparameters rsaparam = rsaprivkey.exportparameters(true); // testing rsaprivkey.importparameters(rsaparam); i'm not allowed use file system store certificate , hardware device not available sometimes, store certificate in machine certificate store (certificates -> local computer -> personal) as x509certificate2.privatekey document suggests, should able set private key of certificate , save store following x509certificate2 cert2 = new x509certificate2(); cert2.privatekey = rsaprivkey; x509store cstore = new x509store(storename.my, storelocation.localmachine); cstore.open(openflags.maxallowed); cstore.add(cert2); cstore.close(); however error m_safecertcontext invalid handle according this answer happening b

django - Generic Foreign Key with computed content type instead of fk to content type model -

the simplest case of creating generic foreign key this: class modelwithgfk(models.model): content_type = models.foreignkey(contenttype, on_delete=models.cascade) object_id = models.positiveintegerfield() content_object = genericforeignkey('content_type', 'object_id') but in case there other fields wich can infer content type from, adding content_type fk both redundant , prone cause inconsistency on time. tried this: class modelwithgfk(models. object_id = models.positiveintegerfield() content_object = genericforeignkey('content_type', 'object_id') @property def content_type(self): # figure out wich content type instance should have fk return contenttype.objects.get(..........) but seems gfk class accepts content type argument foreign key: def _check_content_type_field(self): """ check if field named `field_name` in model `model` exists , valid content_type field (is fo

c# - Autofac DI in Using statements -

i have update method in class contains using statement create new instance of unitofwork, because i'm sending emails asynchronously , ef , dbcontext not thread safe have create new dbcontext each request. have used autofac di in unitofwork don't know how use new unitofwork constructor in using statement make sure creates new instance. please note console application. thanks unitofwork.cs public class unitofwork : iunitofwork { private ieventloggerservice mailcheckerlog; private readonly bbentities ctx = new bbentities(); private iemailrepository emailrepository; public unitofwork(ieventloggerservice malog, iemailrepository emailrepo) { emailrepository = emailrepo; mailcheckerlog = malog; } public iemailrepository emailrepository { { if (this.emailrepository == null) { this.emailrepository = new emailrepository(ctx); } return emailrepositor

react native - Flatlist row with items of different size -

Image
i using flatlist create grid of items containing images, videos, blogs , audios. there 2 columns in flatlist. have added button add dummy posts in flatlist. problem height of items. when add blog in flatlist , has text, images in , item beside . i.e image or video gets height of blog item. possible give variable height every item in row. on adding blog flatlist video item has taken height qual blog item. according official document , when flatlist has multy cols, items should same height - masonry layouts not supported. but think can try add wrapper view on each column item avoid rule. flatlist's height set on wrapper, item's height can still config you. wiki

python - Tkinter Drop down Menu -

i trying add entry fields based on tkinter dropdown menu not sure doing correctly. when select option on 1 of drop down menu not getting new entry fields popping up. code have far. have tried putting if statements in external function , putting command inside optionmenu , still did not work. tkinter import * def callback(): numques = int(e1.get()) = 0 while <= numques: variable = stringvar(top) variable.set("questions type") # default value w = optionmenu(top, variable, "short answer", "multiple choice", "fill in blank", "true of false", "matching", "ordering") w.grid(row = i*2+2, column=0) ques = stringvar(top, value='question') ans = stringvar(top, value='answer') choice = stringvar(top, value='answer choices') if variable.get() == "short answer": q = entry(top

vba - Sheet7 is an Excel Object, but I have no Worksheet7 -

i have workbook 9 worksheets, 10 sheet object in vba. somehow, sheet7 created in ide not removed when worksheet deleted (i think). is, tabs @ bottom of workbook show: sheet1 sheet2 sheet3 sheet4 sheet5 sheet6 sheet8 sheet9 sheet10 however, project window of vba ide shows microsoft excel object of plus sheet7 . cannot remove sheet7 object, , trying .activate gets error 429: activex can't create object. adding new worksheet results in sheet11 being created. deleting worksheets 6, 8, 9, , 10 leaves sheet7. creating new worksheets after results in worksheets 6, 8, , 9 being created, skipping sheet7. list of methods , properties suggested intellisense shorter methods , properties available "real" worksheet. example, there no .visible property, sheet7.visible = xlsheetvisible returns error method or data member not found. how fix this? wiki