Posts

Showing posts from July, 2015

powershell - MDT Module Updating Media through JEA Endpoint fails adding BCD entry -

i running issue remotely updating mdt offline media on jea endpoint. error has permissions passed bcdedit , virtual account created jea (winrm user...). bcdedit returns an error occurred while attempting specified create operation. security id may not assigned owner of object. when trying update bcd file x64 boot config. command: invoke-command -computername $deploymentservername -configurationname mdtupdate -scriptblock { new-psdrive -name "ds002" -psprovider mdtprovider -root "$using:localdeploymentsharefolder" -erroraction stop update-mdtmedia -path "ds002:\media\media001" -verbose } -credential $mdtcreds -erroraction stop command mdt module runs: 'c:\program files (x86)\windows kits\10\assessment , deployment kit\deployment tools\amd64\bcdboot\bcdedit.exe' -store "c:\myvms\mdt\usb\content\boot\bcd" /create "{f31cce1a-e314-4481-9ac9-e519f65dff65}" -d "litetouch boot [media001] (x

python 3.x - How to save a list into different column of a csv file -

a loop iterating on column in numpy , after having several operation final column value have save in csv file. if there 8 column loop rotate 8 times , each time result have write in different column of csv file. how write csv writer ? so assume you're saying have numpy array so: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 and each column, math: 10 20 30 40 20 40 60 80 30 60 90 120 40 80 120 160 then need save csv file: 10,20,30,40 20,40,60,80 30,60,90,120 40,80,120,160 in case i'd numpy , pandas (psuedocode): import numpy import pandas pd array = numpy.array([[0,0,0,0]]*4) domaths(array) pd.dataframe(array).to_csv("maths.json")

c# - UWP app cannot establish Bluetooth connection to Arduino Uno -

i have button on uwp app function establish bluetooth connection arduino uno. but nothing happens when click it. there have missed in code? no error message appears. here code: private void buttonstart_click(object sender, routedeventargs e) { bluetoothserial connection; remotedevice arduino; connection = new bluetoothserial("rnbt-9d4f"); arduino = new remotedevice(connection); arduino.deviceready += ondeviceready; connection.begin(115200, serialconfig.serial_8n1); }

date - Keep 2 years of records in table when reference column is in a string format -

i want keep 2 years of records in table client wants keep reference column(referenceperiod) in string format. so it's working when column in date format: delete dbo.gsufverification_testmylene referenceperiod < dateadd(year,-2,getdate()) but can't make work converting column upfront. feel stupid right :-( can me out please?

javascript - D3 V4, How can I have a tick mark at every data point, but a label at only select data points -

Image
as can see image i'm using monthly data. i'm trying find way display every tick mark, april month labels. example: apr 2014, apr 2015, apr 2016 , apr 2017 - , keep tick marks in between. in advance. x axis generated code g.append("g") .attr("class", "axis axis--x") .attr("transform", "translate(0," + height + ")") .call(d3.axisbottom(x).ticks(d3.timemonth.every(1)) .tickformat(d3.timeformat("%b %y") ) ); g.select('.axis.axis--x') .selectall("text") .style("text-anchor", "end") .attr("dx", "-.8em") .attr("dy", ".15em") .attr("transform", "rotate(-65)" ); thanks sira, ended with: g.append("g") .attr("class", "

Excel Web Query Results have Cell with LF/CR that creates new row for each value -

i have iqy file i'm using consume web query. however, 1 of returned columns has values have embedded cr/lf in it, results in field creating multiple rows of cells. what settings in iqy file, or in excel can use in order entire string remain in 1 cell. (note: in html page view of file, entire string between on table cell) <td> line1.... line2.... line3.... </td> view of excel section

in app purchase - Multiple PayPal accounts in one single app -

my question simple. can use more 1 paypal account in 1 single app? my app must have several merchants selling products. each 1 have paypal account. so, in app, user/buyer must choose merchant wants buy from. if not possible paypal, there payment platform permit that?

javascript - Get GPS location from the web browser -

i developing mobile based web-site, there have integrated google maps, need fill 'from' field of google maps dynamically. is possible gps location web browser , fill in 'from' field of google map dynamically? if use geolocation api , simple using following code. navigator.geolocation.getcurrentposition(function(location) { console.log(location.coords.latitude); console.log(location.coords.longitude); console.log(location.coords.accuracy); }); you may able use google's client location api . this issue has been discussed in is possible detect mobile browser's gps location? , get position data mobile browser . can find more information there.

c++ - End of WCHAR* contains junk -

i'm working on small project have manage file i/o (this i'm quit new to). i'm using win32 api unicode character-set , therefore store file-data using wide-characters, , strings in program stored using std::wstring. part of function reads , returns strings: //get string file , return //(nchars amount of characters read) wchar * resultbuffer = new wchar[nchars]; file.read(resultbuffer, nchars); std::wstring result = resultbuffer; delete[] resultbuffer; return result; however noticed result contains bunch of garbage characters @ end (the entire string read correctly file, garbage characters appended @ end). upon further inspection noticed these characters appear after resultbuffer gets allocated. wouldn't problem if over-written appear appended, , copied result aswell (meaning result gets more elements intended), leads lot of problems using them later. managed fix problem adding

gradle - How to find transitive dependencies in an Android project -

i have problem. have undesired dependency, not included explicitly in gradle file. cannot figure out how find dependency transitively includes one. how can find out dependency come ? i have tried gradlew analyze but fails compile project thanks dependencyinsight task can you. example: gradle -q lib:dependencyinsight --dependency groovy --configuration compile will show why dependency containing groovy in name included in compile configuration of lib project. see doc section details

android - FlexboxLayoutManager setFlexDirection.ROW is not working -

the problem items show 1 item per row. this: | item | | item | | item | i want show them this: | item item | | item | | | i have explicity set width of items 148dp. working fine in gridlayoutmanager when column span 2 or dynamic column per row based on width show many screen width there not center them easily. after flexlayoutmanager got problem. although when set direction column items show attached left side still on each row. have realmrecycleview: <co.moonmonkeylabs.realmrecyclerview.realmrecyclerview android:id="@+id/recycleviewdashboard" android:layout_width="match_parent" android:padding="@dimen/grid_item_offset" android:cliptopadding="false" android:layout_height="wrap_content" app:rrvisrefreshable="false" app:rrvlayouttype="linearlayout"> </co.moonmonkeylabs.realmrecyclerview.realmrecyclerview> and set layoutmanag

windows 10 - *** No rule to make target, Makefile error in Win10 -

first of all, please, don't tell me duplicate. know, many questions i've looked through have been given far specific answers assist me, , quite frankly half of went on head. i'm new using makefiles , i'm baffled why mine isn't working. i'm sure it's painfully simple please lend hand, if need more information i'll happy try find it, , bear me because i'm doing phone because university's department run apes. currently, makefile: makefile assignment 1 finish : main.o g++ -o finish main.o main.o : g++ -c -g -wall main.cpp clean : del main.o (sorry, it's not being cooperative, want make clear there necessary tab in front of commands) i'm running on windows 10, using gnu compiler. can see looks same example makefile provided, aside filenames. know i'm in right directory, nothing misspelled, source file should exist cause i'm staring @ sitting next makefile. generic fixes remember seeing. main.o c

android - How can I access React Native Bridge? -

since react native open source, want able access react native bridge, , learn or maybe tweak our own framework, don't know how access that. there can me? talking bridge between react native code , native android (java) code. you can take @ react native open source code on github. the project broken couple groups, big ones android (reactandroid), ios (react), , common (reactcommon). can find lot of android bridge code here , , ios code here . suggest picking android or ios , diving react native code.

Asp.Net MVC and Redis - Single Session per userId -

i'm looking way allow 1 session per user. differently other cases, not want prevent user logging while session still active. behavior i'm looking "substitution", e.g.: a user log's pca , right away logs pcb (or another/anonymous browser matter). logs onto pcb, whatever action performed on pca supposed treated "session expired" how can achieve behavior? ps: i'm using asp.net mvc 5 , redis cache session state store.

python 3.6 - Except statement gives syntax error -

the code same in book web scraping python according code tested on python version 3.4+. python ide using python 3.6.x, still shows syntax error. the error is except(urlerror, httperror, contenttooshorterror) e: ^ syntaxerror: invalid syntax here's code: import urllib.request urllib.error import urlerror, httperror, contenttooshorterror def download(url): print('downloading:', url) try: html = urllib.request.urlopen(url).read() except(urlerror, httperror, contenttooshorterror) e: print('download error:', e.reason) html = none return html download('https://en.wikipedia.org/wiki/main_page')

java - BlueJ: Creating an Object using another Object/Class -

so want sort of quick process initialize objects using different class . so need method makes objects if click on new [class name] when right click class of object. i tried best using [class] [objectname] = new [class]() - method e.g. bicycle mountainbike = new bicycle() but nothing pops , can't use methods object tried create (console). also: have put method?

Google Drive Api (V2) `corpora` choices -

what possible choices corpora , mean? i want list of files have access inside directory, using .files().list( ... ) https://developers.google.com/drive/v2/reference/files/list i used run following code worked: searchparameterstring = "'" + folderid + "' in parents" #note there return limit of 460 files (falsly documented 1000) drivefileitems = [] pagetoken = none while true: try: drivefilesobject = service.files().list( q = searchparameterstring, #corpora = 'domain', #'default',#searchowners, corpus = 'domain', #----> depricated!!! maxresults = 200, pagetoken = pagetoken, ).execute() drivefileitems.extend(drivefilesobject['items']) pagetoken = drivefilesobject.get('nextpagetoken') if not pagetoken: break except errors.httperror, error: print 'an

Rails 5 - Attribute update if relative model's attribute is different -

i've created attribute supposed update datetime field value of child model's attribute if it's newer (or older based on field) def update_project_record client = client.find(project.client_id) puts client project.start_date = self.task_start_date if self.task_start_date < project.start_date project.end_date = self.task_end_date if self.task_end_date > project.end_date if client.nearest_project_start.present? client.assign_attributes(:nearest_project_start => self.task_start_date, :nearest_project_id => self.project_id) if self.task_start_date < client.nearest_project_start else client.assign_attributes(:nearest_project_start => self.task_start_date, :nearest_project_id => self.project_id) end if client.furthest_project_end.present? client.assign_attributes(:furthest_project_end => self.task_end_date, :furthest_project_id => self.project_id) if self.task_end_date > client.furthe

convert xml to json for each microservice or use a converter microservice? -

i'm looking create application using several microservices. overall application can accept both xml , json formatted requests. option best: 1) accept xml , json each microservice? 2) write convertor microservice converts xml json , forwards json each microservice need handle json. 3) run 2 instances of each microservice, 1 accepts xml , 1 accepts json. 4) i'm not considering?

firebase - Check if other node has same child node value -

i'm trying implement validation rule check when new $resvs created if other $resvs contains same eventkey (which child node of object) existing reservations nodes. the following code not working, can't come better now: "reservations": { "$resvs": { ".write": "!data.exists() || newdata.child('eventkey').val() == root.child('reservations/$resvs/eventkey').val()" } } edit: firebase.database().ref('/reservations').push({ name: name, number: number, email: email, start: start, end: end, scheduleid: scheduleid, schedulename: schedulename, eventkey: eventkey, placeid: placeid }).then(function(){ $('#calendar').fullcalendar('refetchevents'); //confirmaton first? todo }).catch(function(error){ alert('err'); }); to solve problem, recomand change da

How to create a printable report using html and css -

i'm trying create form user can input data into, save data db, print report. none of reasearch online has yielded fruit. i've googled "printable html template", "how print html", "how achieve 'wysiwyp'", etc. nothing. read media queries, have yet research concept much. thoughts appreciated. regards, jon this php / html snippet trick: <?php if(isset($_post) && count($_post > 0)) { $servername = "localhost"; $username = "username"; $password = "password"; $dbname = "mydb"; $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } $sql = "insert mytable (mycol) values ('". $_post['myvar'] ."')"; $conn->query($sql) echo "successfully inserted data ". $_post['myvar'] .&qu

imputation - TypeError when using MICE algorithm from Fancy Impute in Python -

i'm trying fill missing data in dataset , mentor recommended used fancy impute package in python, , mice algorithm. first of all, read mice, it's clear it's poor option if missing data not random (which doubt since seems missing data more in specific countries/years). recommend different algorithm? (my project based on world bank gender statistics data). the technical problem: ran code on dataframe: filled = mice().complete(dfvars) but got error, , mentor has no idea it's about, , haven't found other forums discussing mice in python @ all: typeerror: ufunc 'isnan' not supported input types, , inputs not safely coerced supported types according casting rule ''safe''

c - Pointer Arithmetics and Char array -

i having trouble understanding following code. although tried debug time seems can't understand exact mechanics of code , feeling stuck. appreciated. edit: problem located on recursive function , how know when stop calling self. int main(){ char word[10]="abcdfb"; dosomethingelse(word); printf("%s",word); return 0; } void dosomethingelse(char * w){ static char * s =null; char t; if(!s){ s=w; } if(*w==0)return; dosomethingelse(w+1); if(s>w)return; if(*w -*s==1){ t=*s; *s=*w; *w=t; } s++; return; } the recursive function calls stop after dosomethingelse(w+1) gets "bcdfb", "cdfb", "dfb", "fb", "b", "" -> if(w[0] == '\0') return . places execution stack of function calls each char , going backwards. static variable s goes forward. after cleaning-up, more clear happens: #include <stdio.h> /* printf */ #include <strin

html - Update or delete SQL row based on radio button selection PHP -

i'm trying update/delete sql row based on value of radio button using php. my code looks below , far, when click submit button - nothing! <form method="post" action="?action"> <?php $stmt = $pdo->query('select * reviews approved="0" order id desc'); while ($result= $stmt->fetch(pdo::fetch_assoc)) { $reviewtitle= $result['title']; $rating= $result['rating']; $name= $result['name']; $date= $result['date']; $review= $result['review']; $id= $result['id']; $counter = ++$counter; ?> <br> <?php echo $reviewtitle; ?><br> <?php echo $rating; ?> <br> <?php echo $name; ?><br> <?php echo $review; ?> <p>posted: <?php echo $date; ?></p> <p>review id: <input type="text" name="idnumbers[<?php echo $count; ?>]" value="<?php echo $id; ?>&q

python - How can you check for specific characters in a string? -

when run program prints true. example, if enter aajj print true because checking if first letter true. can point me in right direction? thanks! squence_str = raw_input("enter either dna, protein or rna sequence:") def dnacheck(): in (squence_str): if string.upper(i) =="a": return true elif string.upper(i) == "t": return true elif string.upper(i) == "c": return true elif string.upper(i) == "g": return true else: return false print "dna ", dnacheck() you need check all of bases in dna sequence valid. def dnacheck(sequence): return all(base.upper() in ('a', 'c', 't', 'g') base in sequence)

c# - What is .AspNetCore.Antiforgery.xxxxxxx cookie in .Net Core? -

i trying use validateantiforgerytoken in .net core getting .aspnetcore.antiforgery.xxxxxxx cookie missing. what .aspnetcore.antiforgery.xxxxxxx cookie? asp.net core looks cookie find x-csrf token. the validateantiforgerytoken action filter requests made actions have filter applied blocked unless request includes valid antiforgery token. in general asp.net core may token in cookie or header. may have situation when instead of cookie header used pass token cookie token has different name asp.net core expected. by default, asp.net core generate , expect unique cookie name beginning defaultcookieprefix (".aspnetcore.antiforgery."). this overriden using antiforgery option cookiename : services.addantiforgery(options => options.cookiename = "x-csrf-token-cookiename"); if talking header, name specified by: services.addantiforgery(options => options.headername = "x-xsrf-token"); look into: preventing cross-site r

R boxplot; center the axis labels under the tick marks -

i plotted dataframe (16700 obs. of 6 variables) using following code: labels <–c("x2137_fe20","x2137_fexs","vtc1_fe20", "vtc1_fexs","vtc1c_fe20","vtc1c_fexs") #labels x axis [1]col <- c("chartreuse3", "chocolate2", "chartreuse3", "chocolate2", "chartreuse3", "chocolate2") #colors #plot boxplot(cvtable, outline = false, ylim = c(-0.5,70), main="cv replicas", ylab="rsd(%)", range = 1.5, width = c(9,9,9,9,9,9), plot = true, col = col, par (mar = c(5,4.5,5,0.5) + 0.1), par(cex.lab=2), par(cex.axis=1.7), notch = true, labels = labels) dev.off() this result i box plot, there couple of things adjust. need keep font size x axis labels, can see labels big , part of them missed. solution rotate them 45 degrees, not manage find easy code insert in script. i tried delete original axe

Writing a priority queue with a max heap structure in c++ -

i writing priority queue max heap structure assignment school. can either write array or can use vector. chose vector. assignment this, user chooses options menu either wants add,print, or view elements. when user chooses add gets ask wants added, instructor, student, or ta. can enter i,i,t,t,s,s. instructor having highest priority if user chooses option print , there instructor in queue gets go first. ta having second highest priority if there ta , student in queue, ta goes first. if there is more 1 instructor queue acts normal queue. have written of it, or tried. got max heap implementation textbook since provide one. problem this, when have more 1 item in priority queue , choose print, crashes , gives me vector subscript out of range exception. been trying fix , no luck. also, when try print elements in queue or print them, needs job# name of person. can me find way implement that. #pragma once #include <vector> struct heap { std::vector<int> m_elements;

sql server 2008 - Sql Union a number of tables together -

i'm trying total count 4 different tables using union i'm not sure how work.. my code single table count works fine, select (select count(*) (select rn, dp, dt, min(ed) mindate ecount1 group rn, dp, dt) x dt = 'str' , month(mindate) >= '07' , month(mindate) <= '09') straft i thought add union doesn't work? this? select (select count(*) (select rn, dp, dt, min(ed) mindate ecount1 group rn, dp, dt) x dt = 'str' , month(mindate) >= '07' , month(mindate) <= '09' union select rn, dp, dt, min(ed) mindate ecount2 group rn, dp, dt) x dt = 'str' , month(mindate) >= '07' , month(mindate) <= '09' union select rn, dp, dt, min(ed) mindate ecount3 group rn, dp, dt) x dt = 'str' , month(mindate) >= '07' , month(mindate) <= '09' union select rn, dp, dt, min(ed) mindate ecount4 group rn, dp

java - How to make HttpURLConnection use the PC's proxy and not via code? -

my app under development running in emulator , need route traffic through fiddler , inspect , test. how make httpurlconnection class follow pc's proxy settings instead of having set proxy in code? it easier press f12 turn fiddler on/off add code , use config file.

indexing - R: Index by group and year with similar number for same group and year -

i have data frame shows births of children parent , year. need new column indexes order of birth per child, provides same number if 2 children same parent born in same year. data follows: >df1 id year name parent1 2001 bas parent1 2002 jack parent2 1991 david parent3 1993 daniel parent3 1993 jasper parent3 1994 melany parent4 1997 john parent4 1999 gerard thus far, created index child per year per parent, children ascending numbers if born in same year. used following code: > df2 <- df1 %>% group_by(id) %>% mutate(order = row_number(year)) > df2 id year name order parent1 2001 bas 1 parent1 2002 jack 2 parent2 1991 david 1 parent3 1993 daniel 1 parent3 1993 jasper 2 parent3 1994 melany 3 parent4 1997 john 4 parent4 1999 gerard 1 what want arrive at, however, (note double "1" parent3 in year 1993): id year name order parent1 2001 bas 1 parent1 2002 jack 2 parent2 1991 da

swift - Uploading image to third party service using alamofire and auth token -

i have been trying upload image third party website using api , alamofire information regarding image has been uploaded. have pass auth token in request access resources, here instruction have provided, "image should specified url or uploaded multipart form parameter 'data'. should use, respectively, , post methods." i have been trying implement upload method in 5 different ways none of them seem work responseserializationfailed(alamofire.aferror.responseserializationfailurereason.jsonserializationfailed(error domain=nscocoaerrordomain code=3840 \"invalid value around character 2.\" userinfo={nsdebugdescription=invalid value around character 2.}))" error here 1 of functions takes care of upload: let headers: httpheaders = [ "authorization": "bearer \(authtoken)" ] let url = try! urlrequest(url: "url", method: .post, headers: headers) alamofire.upload(multipartformdata: { multipartformdata in m

Understanding the while loop in in this program Binary addition in java -

i found solution binary addition in java , struggling understand program, not program found on internet. while loop im struggling understand. thanks package java_excersises; import java.util.scanner; public class practice17 { public static void main(string args[]) { long binary1, binary2; int = 0, remainder = 0; int[] sum = new int[20]; scanner in = new scanner(system.in); system.out.print("input first binary number: "); binary1 = in.nextlong(); system.out.print("input second binary number: "); binary2 = in.nextlong(); while (binary1 != 0 || binary2 != 0) { sum[i++] = (int)((binary1 % 10 + binary2 % 10 + remainder) % 2); remainder = (int)((binary1 % 10 + binary2 % 10 + remainder) / 2); binary1 = bin

php - Create MySql query for search functions -

i have problem query search function in site. have table saving book data , in frontend page have search function find book search parameters. this database table : book_id | book_name | book_location | book_qty | book_date ----------------------------------------------------------------- 1 | triangle math | rack1 | 2 | 2017-06-12 2 | basic knowledge | rack2 | 3 | 2016-08-09 3 | legend truth | rack3 | 1 | 2014-05-17 4 | temporary brain | rack4 | 1 | 2013-01-23 and search in frontend page : 1. input field book name -- $name 2. dropdown list book location -- $location 3. search button the 4 parameters above variable use in query search result. i tried query not give me best result want. select * `book` book_name '%".$name."%' or book_location = '".$location."' when choose location in dropdown list , leave field book name empty example choo

c# - ASP.Net httpwebrequest not posting request body -

my hands in air - cry, uncle. me understand: i wrote simple httpwebrequest posting clients' https://website . has specific header requirements , json request body. getresponsestream, after receiving getresponse statuscode.ok, error provided server. checked logs , said while headers present, request body ". here code: public const string api_urilogin = "https://dev.clienturl.com/test/api/login"; private void requesttest() { loginapistruct logininfo = new loginapistruct(); logininfo.loginid = testid; logininfo.password = testpw; logininfo.vehicletype = "e"; logininfo.deviceid = "abcdef"; logininfo.clientid = "123456"; logininfo.appversion = string.empty; logininfo.ostype = string.empty; logininfo.osversion = string.empty; // call loginapi string loginstatus = loginapi(logininfo); //display results lblresults.te

ios - Swift - StackView, panGesture, CoreData -

my question / issue relates saving new position of uistackview, coredata, after moving pangesture. i’ve created uistackview via function createpersonstack() called viewdidload() , based on objects retrieved coredata. at stage, below code works in respect creating , moving objects. each uistackview has coredata person.firstname attribute text label (hopefully can used identify object save to) i pull initial xpos , ypos (starting position) uistackview (person) coredata. i new coordinates listed in print statement of guesture.state == .ended block of code. if possible, saving new x & y coordinates (after gesture state .ended) coredata against correct person. i.e. when view launches again, updated new coordinates starting position of each member family. thanks func createpersonstack() { let family = fetchedresultscontroller.fetchedobjects person in family! { _ = createpersonwithposition(name: person.firstname!, age: person.age!, xpos: cgfloat(person.

Non-prefix-based Completion Suggester in Elasticsearch -

i have mapping type follows: { "mappings": { "book": { "properties": { "title": { "type": "completion" } } } } } and index data: {"create": {"_index": "library", "_type": "book", "_id": 1}} {"id": 1, "title": "c++ how program"} my question how document id 1 of type book if query this: post /library/book/_search { "suggest": { "book-suggest": { "text": "program c++", "completion": { "field": "title" } } } }

swift - The elegant solution for function that gives everytime called different element of array(ordered and starting from new when all returned)? -

i newbie , wonder elegant/grown-up solution code be. i thankful terms can related this, seems common task. the "1,2,3" are placeholders solution shouldn't rely on them being numbers var myvalues = [1,2,3] //function, returns 1 element array, in order, , starts //from beginning when elements been returned once,twice etc. func popper() -> int { let returnvalue = myvalues.poplast() myvalues.insert(returnvalue!, at: 0) return returnvalue! popper() = 3 popper() = 2 popper() = 1 popper() = 3 ... it not important starts last, 1231231... great! edit: maybe more descriptive example: i having 1 clickbutton changes backgroundcolor array of ["red","green","blue"]. when clicking multiple times background turns red, turns green, turns blue, turns red ... not random , not ending. this process of "popping" iteration... of custom sequence. appropriate way of representing in swift type ( struct / class

sql - Oracle SELECT query to find the smallest distinct delimited string -

i have below table c1 | path --------|----------- t1 | t0/t1 t2 | t0/t1/t2 t3 | t0/t1/t2/t3 x1 | t0/x0/x1 t2 | t0/x0/x1/t2 t3 | t0/x0/x1/t2/t3 t3 | t0/y0/y1/y2/t3 y3 | t0/x0/x2/y3 y4 | t0/x0/x2/y3/y4 i need write q query or code should return smallest distinct delimited string shown below c1 | path --------|----------- t1 | t0/t1 x1 | t0/x0/x1 t3 | t0/y0/y1/y2/t3 y3 | t0/x0/x2/y3 ex: t0/t1 substring of t0/t1/t2 , t0/t1/t2/t3 . t0/y0/y1/y2/t3 not substring of other string. distinct. can please me write query in oracle try: select t1.* table1 t1 left join table1 t2 on t1.path <> t2.path , t1.path '%'||t2.path||'%' t2.c1 null demo: http://sqlfiddle.com/#!4/a3f87/3 | c1 | path | |----|----------------| | t1 | t0/t1 | | x1 | t0/x0/x1 | | t3 | t0/y0/y1/y2/t3 | | y3 | t0/x0/x2/y3 |

custom attributes - Asp.net MVC - How to check session expire for Ajax request -

we using ajax call across application- trying find out global solution redirect login page if session expired while trying execute ajax request. have coded following solution taking post - handling session timeout in ajax calls not sure why in care event "handleunauthorizedrequest" not fired. custom attribute: [attributeusage(attributetargets.class | attributetargets.method)] public class checksessionexpireattribute :authorizeattribute { protected override void handleunauthorizedrequest(authorizationcontext filtercontext) { if (filtercontext.httpcontext.request.isajaxrequest()) { var url = new urlhelper(filtercontext.requestcontext); var loginurl = url.content("/default.aspx"); filtercontext.httpcontext.session.removeall(); filtercontext.httpcontext.response.statuscode = 403; filtercontext.httpcontext.response.redirect(loginurl,

scala - check optional field to populate another field -

is there efficient way remove below if , else condition object currency { sealed trait myconstants extends mytrait[string] case object extends myconstants {val value ="abc"} case object b extends myconstants {val value = "def"} } case class test(name:string) case class mycurerncy(currency: option[myconstants]) def check (name:string):option[test] ={.....} if(check("xyz").isdefined){ mycurerncy(option(currency.a)) }else{ none } the method check return option[test] .i need populate mycurrency based on condition if test defined or not. mycurerncy(option(currency.a)) of type mycurerncy . none of type option[nothing] . so if(check("xyz").isdefined){ mycurerncy(option(currency.a)) }else{ none } will of type any (actually product serializable doesn't matter). sure prefer have any ? if prefer have mycurerncy i.e. if(check("xyz").isdefined){ mycurerncy(option(currency.a))

javascript - Changing data when click button in chart.js -

i'm working on website project, in have problem charts.js, want change data inside of chart, when click button data value changing, i'm stuck on it, don't know how it. here's example of code similar project chart.js . var data = { labels: ['january', 'february', 'march'], datasets: [ { fillcolor: "rgba(220,220,220,0.2)", strokecolor: "rgba(220,220,220,1)", pointcolor: "rgba(220,220,220,1)", pointstrokecolor: "#fff", pointhighlightfill: "#fff", pointhighlightstroke: "rgba(220,220,220,1)", data: [30,120,90] }, { fillcolor: "rgba(100,220,220,0.7)", strokecolor: "rgba(220,220,220,1)", pointcolor: "rgba(220,220,220,1)", pointstrokecolor: "#fff", pointhighlightfill: "#fff", poi

c++ - When will widgets update after widget visibility change in Qt? -

i want change visibility of 2 widgets 1 one. in case, need process sleep 1s , change visibility of widgeta. , sleep 1s chnage visibility of widgetb. code. ...// process d sleep(1000); widgeta->setvisible(true); sleep(1000); widgetb->setvisible(true); but result not want. widgeta , widgetb 's visibility have been changed in same time after more 2s after process d finished. why widgeta , widgetb's visibility have been changed in same time? don't change in realtime when widgeta->setvisible(true); have been executed? when widgets update? why more 2s ? void mainwindow::initialize() { sleep(1000); widgeta->installeventfilter( ); widgeta->setvisible( true ); } bool mainwindow::eventfilter( qobject *object, qevent *event ) { if( object == widgeta ) { if( event->type() == qevent::show ) { sleep(1000); widgetb->setvisible( true ); } } return qmainwindo

java - Spring Security url authorization for url falls under secured url ie. intercepted url /admin, how to secure urls under it ie.admin/newEmployee -

i developing application spring , hibernate. there 2 roles in system admin , user. admin can create,update,delete user of system. user can view profile , others profile only. work i've done regarding security: i have mapped /admin url intercept url , /user url well. problem i'm facing: i have put urls under admin url like/admin/newemployee,admin/editemployee i'm not able secure urls... please find me way out. spring-security.xml <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:security="http://www.springframework.org/schema/security" xmlns:p="http://www.springframework.org/schema/p" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd

Django: select_related to a table vs table's field -

i have 2 models class a(models.model): val = models.integerfield() class b(models.model): val2 = models.integerfield() = models.foreignkey(a) class c(models.model): b = models.foreignkey(b) val3 = models.integerfield() how query - c.objects.select_related('b').all() better - c.objects.select_related('b__val2').all() and if not how query 1 can optimised? try filter model need, lowcase filter of child models b.objects.filter(c__isnull=false) read more here lookups-that-span-relationships

ruby on rails - array of hashes as hash key and value as array using jbuilder -

i'm trying generate json response using jbuilder i have array of hashes this words= [ {"term": "abc", "definition": "123" } , {"term": "abc", "definition": "345" } , {"term": "xyz", "definition": "890" } ] i covert json. logic here take terms keys , push it's definitions arrays { "abc": ["123","345"], “xyz”: ["890"] } what achieved far words.each |word| json.set! word['text'] ,word['definition'] end gives me { "abc": "123" "abc": "345", "xyz": "890" } could me on this. simplest solution :) words= [ {"term": "abc", "definition": "123" } , {"term": "

Nested arguments for Ansible Module -

i developing ansible module. possible specify set of arguments required when 1 argument has value? for example, if module has 'state' argument can either 'present' or 'absent', possible require additional set of arguments 'type', 'path' when state=present? module_args = dict( name=dict(type='str', required=true), type=dict(type='str', required=false), path=dict(type='str', required=false), state=dict(type='str', required=false, choices=["present","absent"] } module = ansiblemodule( argument_spec=module_args, supports_check_mode=true ) name = module.params["name"] script_type = module.param["type"] path = module.param["path"] state = module.state["state"] as far know there no such ability in current ansible 2.3. there required_together option ansiblemodule class define parameters should supplied (but there no condit

html - How to align every two <li> next to each other -

i trying align every 2 li elements side side (like : 0-9, a-b, c-d, ...). currently, aligned one-by-one. <ul> <li class="alphabetrow"><a href="#" id="alpha_1" class="alphabet active" >0-9</a></li> <li class="alphabetrow"><a href="#" id="alpha_2" class="alphabet" >a</a></li> <li class="alphabetrow"><a href="#" id="alpha_3" class="alphabet" >b</a></li> <li class="alphabetrow"><a href="#" id="alpha_4" class="alphabet" >c</a></li> <li class="alphabetrow"><a href="#" id="alpha_5" class="alphabet" >d</a></li> <li class="alphabetrow"><a href="#" id="alpha_6" class="alphabet" >e</a><