Posts

Showing posts from June, 2014

security - Memory corruption attacks in c -

i reading this article . it's how attackers can produce memory errors (dangling pointers , pointers going out of memory) lead memory corruption , possible attack on program/system. different methods being described how make programs more memory safe , prevent attacks. however have difficulties understanding things. thought have fair knowledge of c (pointers, dangling pointers, memory allocation, data encapsulation, , couple of things more) reading article makes me question knowledge of c. , couple of c sources have had , reading have done have not pointed out vulnerabilities. how can attacker take control of programs pointers? read it's connected dangling pointers or pointers gone out of memory or double freeing, how? , how 1 know for? for example if take care of dangling pointers: int *ptr = malloc(1000 * sizeof *ptr); // stuff here free(ptr); ptr = null; can attacker still take control? and authors point printf(user_input) // input "%3$x" prints ...

swift - syntax, == operator when not in if statement. -

Image
i came across line of code let shouldexpandwindow = self.itemsoffset + self.items.count == self.windowoffset + self.windowcount i'm not used seeing == outside of if statement. know it's meant comparisons. how work in case. thank == function takes 2 values of same type (such int ) , returns bool . example, if comparing 2 int s, function signature is: func ==(lhs: int, rhs: int) -> bool the result of comparison assigned shouldexpandwindow swift infers have type bool . you can find out option -clicking on == :

c# - How to consume Azure REST API App with Azure Active Directory authorization On -

i have deployed api app azure, having problems creating api client if authentication (with aad) set on. when try generate service client (when authentication off), client code generated (it's done autorest) , code working, when switch authentication on (and action take when request not authenticated set login azure active directory ), then 1) service call returned 401 unauthorized (without redirecting aad login page) 2) tried generate service client once more (from project's context menu -> add -> rest api client -> in dialog box chose "select azure asset" , pressed ok , got message "failed download metadata file microsoft azure api app: ...app name..." (and "no additional information available") i implementing aad according azure manual (using express settings): https://azure.microsoft.com/en-us/documentation/articles/app-service-mobile-how-to-configure-active-directory-authentication/ was working according video, , sho...

Parsing a text file in Java - need help understanding NullPointerException -

i'm new java , i'm having difficult time understanding scanner , exceptions. it's showing nullpointerexception @ "while (! line.matches("[\n\r]+"))". i'm not sure why happening. i've initialized line variable , i'm assuming if next line of scanner break line, while loop should end. if next line null entire outer loop should end. why returning nullpointerexception? public class readfile { private static int inputs = 0; public void main(string filename) throws exception { url url = getclass().getresource(filename); file file = new file(url.getpath()); parsefile(file); } void parsefile(file file) throws exception { arraylist<string[]> inputs = new arraylist<string[]>(); bufferedreader br = new bufferedreader(new filereader(file)); string line = br.readline(); while (line != null){ linkedlist currentinput = new linkedlist(); if (line.contains("input")){ while (...

WPF drag rectangle with touch -

i have wpf app canvas inside scrollviewer. on canvas have rectangles drag along timeline (left-right). works fine mouse, on touch screen weird behavior if canvas wider main form. first, when begin drag rectangle, canvas pans until has scrolled limit, rectangle starts move. doesn't when using mouse. another strange if pan/drag canvas (using touch) limit of scrollviewer, main form compresses 20-50 pixels on side opposite of pan direction. springs shape stop dragging. what's going on here , how disable this? it seems has manipulationboundaryfeedback, don't understand how... edit: able little further setting scrollviewer panningmode panningmode.none in rectangle touchdown handler , setting panningmode.both in touchup handler. solved problem of canvas panning limit before rectangle move. well, got app work touch. mentioned above, setting panningmode none on touchdown event eliminated problem scrollviewer. setting both in touchup event re-enabled it. means can...

CREATE PROCEDURE in mySQL -

i'm creating mysql procedure in phpmyadmin , keeps throwing error: #1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near '' @ line 18 i've tried code below , without delimiter, without avail. can point what's wrong code? thank you! delimiter \\ create procedure orderbooks(in store varchar(10), in title varchar(50)) begin declare order_num varchar(100); declare tod date; select @ordered_qty := qty customer_sales customer_sales.store_id = store , customer_sales.title_id = title; select @in_stock := qty store_inventories store_inventories.stor_id=store , store_inventories.title_id = title; select @threshold := minstock store_inventories store_inventories.stor_id=store , store_inventories.title_id = title; set order_num = concat(store, title); set tod = getdate(); if (@ordered_qty < (@in_stock - @threshold)) update store_inventories set qty = (@in_stock - @ordered_qty) store_inve...

python - how PCA fit transform on test set -

i using from sklearn.decomposition import pca library, incrementalpca reduce dimensionality of problem follows: training_data = [...] training_target = [...] test_data = [...] test_target = [...] ipca = incrementalpca(n_components, batch_size) new_training_data = ipca.fit_transform(training_data) to run tests given classifier, need fit test set information obtained in training set (something eigenvalues , eigenvectors), reduce same size of new training set. how can this library (or other), since ipca.fit_transform(data) not return me eg eigpairs or value resize dimension of test set? the transform internal incrementalpca object after call fit or fit_transform . when call icpa.fit_transform , telling determine principal components transform given data , apply transform data. transform data set, use transform method of trained incrementalpca object: new_test_data = icpa.transform(test_data)

java - Passing an array of Strings from inside a Static Function in a different class to another class -

i trying arrays 't','p' , 's' class 'buildorder' class. here code reference: i tried create methods return them , retrieve them in class out of ideas how it. trying add decorator pattern base code of composite pattern component here interface composite pattern package composite; public class buildorder { public static component getorder() { composite order = new composite( "order" ) ; order.addchild(new leaf("crispy onion strings", 5.50 )); order.addchild(new leaf("the purist", 8.00 )); //composite customburger = new composite( "build own burger" ) ; string[] t={"bermuda red onion","black olives","carrot strings","coleslaw"}; string[] p={"applewood smoked bacon"}; string[] s={"apricot sauce"}; /*customburger.addchild(new leaf("beef, 1/3 lb on bun",9.50 )); // base price 1/3 lb custombur...

javascript - Error when repeating information from array in a new array -

error console: error: [ngrepeat:dupes] duplicates in repeater not allowed. use 'track by' expression specify unique keys. repeater: m in diff, duplicate key: object:131, duplicate value: {"title":"diamond push up","vid":"img/3mm.mp4","time":60,"cal":3,"reps":20} any workarounds above error? $scope.moves = [ {title:"jumping jacks", length:"30", difficulty: "5 stars"}, {title:"push ups", length:"40", difficulty: "4 stars"}, {title:"mountain climbers", length:"60", difficulty: "2 stars"} ]; this works $scope.workoutone =[ $scope.moves[0], $scope.moves[1], $scope.moves[2], ]; this not work, obvious difference repeating information $scope.workouttwo =[ $scope.moves[2], $scope.moves[1], $scope.moves[2], $scope.moves[0], $scope.moves[1], $scope.moves[2], ]; is there work around using same inf...

jsf 2.2 - JSF: Mojarra vs. OmniFaces @ViewScoped: @PreDestroy called but bean can't be garbage collected -

Image
this question specific omnifaces @viewscoped bean (however of interest wider discussion memory leakage , resource disposal jsf @viewscoped). based on results of netbeans8.1 test web app available on github: investigation of undesirable holding of references various forms of jsf @viewscoped beans navigation type https://github.com/webelcomau/jsfviewscopednav that test web app has comprehensive readme complete instructions, annotated test web pages comparing obsolete jsf2.0-style @managedbean @viewscoped , jsf2.2-style cdi-friendly @named @viewscoped , , omnifaces @named @viewscoped beans. the results using jvisualvm diagnosis summarised in downloadable spreadsheet (see screenshot below), , indicate while omnifaces-2.5.1 @viewscoped bean invokes @predestroy methods under get-based navigation cases when leaving view (giving opportunity release resources), not seem permit garbage collection of actual bean (at least not current context parameter settings). in web.xml appli...

java - Serialization overwrites -

i got problem serialization , deserialization in java. in program whenever create file creating fileinfo object , serializing in secure_store.dat file , after deserializing file also.for example can create test1.txt new fileinfo object , serialize fileinfo object can create test2.txt again different fileinfo object , serialize without problem. whenever deserialize secure_store.dat can see 2 objects problem whenever close program , reopen program , create test3.txt fileinfo object , try serialize, deletes 2 old object in secure_store.dat file , whenever deserialize file can see last object others deleted(which created before program closes). how can solve problem , return 3 objects ? below can see code... public static void serialization(arraylist<fileinfo> allfiles) { try { fileoutputstream fileout = new fileoutputstream("secure_store.dat"); objectoutputstream out = new objectoutputstream(fileout); out.writeobject(allfi...

android - Using ContextMenu in ViewPager the previous page context menu overriding the first one -

i have created few pages using same fragment class in viewpager , have registered context menu fragment. problem: whenever contextmenu operation on current page, change data in previous page. i suspect might due using same fragment pager , context menu overridden. have got stuck here long time. please share if have solution, thank you! @override public void oncreatecontextmenu(contextmenu menu, view v, contextmenu.contextmenuinfo menuinfo) { super.oncreatecontextmenu(menu, v, menuinfo); menuinflater inflate = getactivity().getmenuinflater(); inflate.inflate(r.menu.longpressmenu, menu); } @override public boolean oncontextitemselected(menuitem item) { adapterview.adaptercontextmenuinfo info = (adapterview.adaptercontextmenuinfo) item.getmenuinfo(); int position = info.position; if(item.getitemid()== r.id.deleteitem){ //log.d("img", "del"+ urilist.size()); urilist.remove(position); //log.d("img",...

Apache frontend URL access -

i have url called services.abc.com. url load balanced through apache tomcat application servers. problem url embedded in html/jsp pages of site , want hide url whenever 1 visits directly means backend calls through embedded pages allowed. there way it?

clang++ - Declaration in if statement weird behaviour (C++) -

this question has answer here: using variable same name in different spaces 4 answers i have following code: int x = 1; if (int x = x) { printf("%d\n", x); if (int x = x) { printf("%d\n", x); } } my expectation x should 1, 1. however, output is: 1818935350 32767 anyone know what's going on here? compiled clang-800.0.42.1 edit: tried following code bit tweak, , behaves expected. int x = 1; if (int y = x) { printf("%d\n", y); if (int z = x) { printf("%d\n", z); } } one guess when use variable on rhs of declaration inside if statement, might not refer variable same name declared @ parent scope, instead it's referring variable that's being defined... when int x = x , both x's refer same int . is, 1 declaring right there in line. initializing x i...

android - How to get turn by turn details real-time to my app -

i'm doing arduino project end year project.i'm making smart glove bike riders can notify phone calls,health tracking,geo tracking , navigation. want know there method can details turn turn navigation app. i.e :if google navigation said "turn left" details , display in app. p.s:there product called sneakair easy jet shoes auto vibrate when turn arrived. if impossible tell me idea can embed project appreciated. you should aware restrictions regarding google maps apis. terms of service, paragraph 10.4 c says: no navigation. not use service or content or in connection (a) real-time navigation or route guidance; or (b) automatic or autonomous vehicle control. https://developers.google.com/maps/terms#10-license-restrictions so, cannot use maps api real-time applications.

c# - Optimize procedurally generated rectangle map position updates -

i procedurally-generating 2d cavern made of rectangles in c# usign monogame. generation process works right, i'm having problems amount of operations , processing power taking move such cavern (updating position). here's how update caverns's position: the cavern class constructor: i parametrize viewport's rectangle, tiles dimensions, , percentage of 'fillness' of cavern. i use viewport's dimensions create container rectangle, twice big viewport. i generate new map storing in (basicsprite)arraylist. basicsprite class specified below. resulting cavern same size , in same place container. public cavern(rectangle viewport, int tilewidth, int tileheight, int randomfillpercent) { this.viewport = viewport; container.x = viewport.x - (viewport.width / 2); container.y = viewport.y - (viewport.height / 2); container.width = 2 * viewport.width; container.height = 2 * viewport.height; supercontainer.x = container.x - (container.w...

python - How can I execute JavaScript in Selenium and grab data? -

Image
hello , thank time. my purpose make parser, follow hundreds of sites , check if site has module (special plugin) or not. main problem, way make sure, a lunch javascript site. so, don't know how lunch javascript , grap data for example: driver = webdriver.chrome('d:\chromedriver_win32\chromedriver') driver.get("https://lieman.com/") tag = driver.execute_script("document.getelementsbyclassname('arsenal_title')") driver.close() print(tag) tag prints none. can helps me receive data or tell me other way check javascipt === def main(): driver = webdriver.chrome('d:\chromedriver_win32\chromedriver') driver.get("http://redhelper.ru/") morn = driver.execute_script("return redhlpsettings()") driver.close() print(morn) if __name__ == '__main__': main() you don't need execute javascript, use find_elements_by_class_name(class_name) or find_element_by_class_nam...

python - How to subset pandas DataFrame whose column values are lists? -

i have pandas dataframe df looks this: a b 0 ['a','b'] 1 ['c','d'] 2 ['a','c'] 3 ['b','d'] 4 ['a','d'] now, wish subset df selecting rows in 'a' belongs list in b , desired output being: a b 0 ['a','b'] 2 ['a','c'] 4 ['a','d'] naively, tried df['a' in df['b']] , doesn't seem work. how go doing this? using apply 1 way filter. in [39]: df[df['b'].apply(lambda x: 'a' in x)] out[39]: b 0 0 [a, b] 2 2 [a, c] 4 4 [a, d]

python - Sorting within each subgroup and summing first three values -

i have pandas data frame , there 3 columns, state_name, county_name, population. population numeric data. question want answer looking @ 3 populous counties each state, 3 populous states. think first need groupby state_name , county_name. can that. after confused how proceed. new pandas, guidance help here's dummy data (please include sample of data in future). state_name,county_name,population state1,state1_a,100 state1,state1_b,8000 state1,state1_c,75 state1,state1_d,876 state1,state1_e,2938 state2,state2_a,200 state2,state2_b,16000 state2,state2_c,75 state2,state2_d,876 state2,state2_e,5876 let's set index state_name , county_name, , select 'population' column return multiindexed pandas.series df = pd.read_clipboard() # have done index_col=[0,1] here df = df.set_index(['state_name','county_name']) s = df.population now can series.groupby , use nlargest on (wouldn't work on dataframe, that's why use series): s.groupby(le...

neural network - How to write a custom MXNet layer with learned parameters -

i'm following documentation in http://mxnet.io/how_to/new_op.html how define new neural network layer in mxnet in python subclassing the mx.operator.customop class. example of loss layer has no learned parameters. how learned parameters forward , backward methods? i figured out. learned parameters configured other input op. they're configured in list_arguments method. docs page on writing custom symbols : note list arguments declares both input , parameter , recommend ordering them ['input1', 'input2', ... , 'weight1', 'weight2', ...]

express - Unable to serve expressjs app from subfolder -

i new express , nginx. i have made simple express app , configure nginx: location /exapi { proxy_pass http://localhost:8010; proxy_http_version 1.1; proxy_set_header upgrade $http_upgrade; proxy_set_header connection 'upgrade'; proxy_set_header host $host; proxy_cache_bypass $http_upgrade; } my expressjs app is: var express = require('express') var app = express() app.get('/', function (req, res) { res.send('hello world!') }) app.listen(8010, function () { console.log('example app listening on port 8010!') }) when access vps vps_ip/exapi, response cannot /exapi , when use http://vps_ip:8010 working expected. how can access express app vps_ip/exapi ? try rewrite in nginx: location ~* ^/exapi { rewrite ^/exapi/(.*) /$1 break; subfilter /exapi /; proxy_set_header host $host; proxy_redirect off; proxy_pass http://localhost:8010; }

Global configuration of http proxy in camel -

so far, have learned ways set http proxy camel. first 1 append proxy information destination uri <to uri="http://sample.com?proxyauthhost=proxy.example.com&amp;proxyport=8080"/> other approach setting proxy global camelcontext <properties> <property key="http.proxyhost" value="proxy.example.com"/> <property key="http.proxyport" value="8080"/> </properties> other these approaches, there way can configure proxy globally that, don't have repeat procedure each uri or each camelcontext ? example, if configure proxy in properties file, how can use it(other using property using {{key}} approach)? you should edit setenv file of karaf, located in bin/ folder under jboss fuse installation. in file, add properties linked claus' answer extra_java_opts variable. on linux edit bin/setenv extra_java_opts="-dhttp.proxyhost=10.0.0.100 -dhttp.proxyport=8800" expor...

javascript - manage splitterSide for use it as reusable component -

hi guys want create new sidemenu component based on onsenui splitterside demo try don't know how can manage sates , props. i'm new in react.js. can me improve (fix) this? this component code now: import react, { proptypes, component } 'react'; import { page, icon, list, listitem, splitter, splitterside, splittercontent} 'react-onsenui'; import page1 '../pages/page1.jsx'; import page2 '../pages/page2.jsx'; class sidemenu extends component { constructor(props) { super(props); this.hide = this.hide.bind(this); this.show = this.show.bind(this); this.page1 = this.page1.bind(this); this.page2 = this.page2.bind(this); }; hide() { this.props.isopen = false; }; show() { this.props.isopen = true; }; goto_page1() { this.props.navigator.resetpage({ component: page1, key: 'page1_index' }); }; goto_page2() {...

ios - UIDatePicker strange behaviour with Islamic calendar -

Image
note: bug reported apple radar number: 29265429 ( link ) i using uidatepicker. when give gregorian calendar works fine. days starts 1 31 however, when give islamic islamicummalqura gives me strange behaviour. days starts 1 30 there '2' above 1 , below 30 such days follows 2,1,2,3,4 ... 30 i have created new empty ios project , placed following code viewdidload method: let picker = uidatepicker(frame: cgrect(x: 0, y: 30, width: 0, height: 0)) picker.datepickermode = .date picker.date = date() picker.calendar = calendar(identifier: .islamicummalqura) picker.autoresizingmask = uiviewautoresizing.flexiblerightmargin picker.frame.size.width = 300 view.addsubview(picker) screenshot: it not hard make own uipicker looks uidatepicker, have careful because bug in nscalendar nsdatepicker . just clear '2' not selectable, 30 not selectable in short month. nsdatepicker not hide invalid days or months, makes them unselectable. in gregorian calendar i...

HTML/CSS - How do I fix width:100% cutting off when the content creates a horizontal scroll bar? -

i've looked solution , have never found one. maybe didn't hard enough, i've tried doesn't work. problem has bothered me forever , i've never been able fix it. my problem occurs when trying make div or other element take 100% of width of page. container of content on page 960px. when in fullscreen browser there no problem, when adjust browser window size smaller width of content create horizontal scroll bad , 100% elements not retain 100% width, creating cutoff. here example page: http://www.yenrac.net/ does know how fix this? element in case red header banner @ top of website. html (actually little php wordpress): <body> <div class="header"> <div class="clearfix" id="header"> <h1><?php bloginfo('name'); ?></h1> <h3>a spooky site</h3> </div> </div> css : body { margin: 0px; } .header { height: 100px; width: 100%; background: #8f...

relative path - How to save generated file temporarily in servlet based web application -

i trying generate xml file , save in /web-inf/pages/ . below code uses relative path: file folder = new file("src/main/webapp/web-inf/pages/"); streamresult result = new streamresult(new file(folder, filename)); it's working fine when running application on local machine (c:\users\username\desktop\source\myproject\src\main\webapp\web-inf\pages\myfile.xml). but when deploying , running on server machine, throws below exception: javax.xml.transform.transformerexception: java.io.filenotfoundexception c:\project\eclipse-jee-luna-r-win32-x86_64\eclipse\src\main\webapp\web inf\pages\myfile.xml i tried getservletcontext().getrealpath() well, it's returning null on server. can help? never use relative local disk file system paths in java ee web application such new file("filename.xml") . in depth explanation, see getresourceasstream() vs fileinputstream . never use getrealpath() purpose obtain location write files. in depth ex...

linuxmint - Qobject::connect: invalid null parameter when running Kate application in Linux Mint -

i using linux mint sarah , receiving error whenever use command "kate file_name". updated kate , believe @ latest version. qobject::connect: invalid null parameter qobject::connect: invalid null parameter qobject::connect: cannot connect (null)::returnpressed() kurlrequester::returnpressed() qobject::connect: cannot connect (null)::returnpressed(qstring) kurlrequester::returnpressed(qstring) setting name of 0x10e71d0 "org.kde.activitymanager.activitytemplates" setting name of 0x11130a0 "org.kde.activitymanager.runapplication" setting name of 0x11019c0 "org.kde.activitymanager.resources.scoring" creating directory: "/root/.local/share/kactivitymanagerd/resources/" kactivities: database connection: "kactivities_db_resources_139836748884160_readwrite" query_only: qvariant(qlonglong, 0) journal_mode: qvariant(qstring, "wal") wal_autocheckpoint: qvariant(qlonglong, 100) ...

WinAPI Thread unable to write to memory mapped file -

i trying make 2 threads, 1 writes mapped memory location, , other reading location. far have made threads , annexed functions them, main problem when first process want write mapped file, throws me error value 6, meaning invalid_handle_exception , can't figure out why since have made program write mapped location in same manner. code, , error thrown @ write_in_mapped function: #include <iostream> #include <string> #include <windows.h> using namespace std; handle hmutex = createmutex(null, false, null); int write_in_mapped(handle memoryfile) { cout << memoryfile << endl; waitforsingleobject(hmutex, infinite); string message = ""; (int = 0; < 200; i++) { int = rand() % 10000; int b = * 2; message.append(to_string(a)).append(",").append(to_string(b)).append(";"); } handle mapfile = mapviewoffile(memoryfile, file_map_all_access, 0, 0, 1024); if (mapfile == invalid_handle_value) {...

clojure - How do functions get into different namespaces in the Duct framework? -

when fire new clojure project based on duct web framework, main.clj file contains following require clause: :require ... [duct.util.system :refer [load-system]] ... but when inspect duct source, src/duct/util/system.clj doesn't define load-system function. in fact, load-system appears defined in lein-template/resources/leiningen/new/duct/base/dev.clj , in dev namespace. so: how function end in duct.util.system namespace? i guess issue looked @ duct.util.system source on master branch has been changed since version using in project: master latest version doesn't have load-system var 0.8.2 version have load-system var

c# - Wrong version of System.Runtime being packaged -

Image
we have written service deployed azure. consists of dll "worker role" class, , azure cloud service project, shown below: the build steps are: build ccproj in "release" configuration. run nuget "spec", "pack" .nupkg file deploy .nupkg file azure cloud service this has been working fine while, until upgraded .net 4.6.2 , upgraded several other references, including system.runtime (now v4.3.1). now, despite fact have (probably unnecessarily) added nuget reference every single project in solution, pointing system.runtime 4.3.1, version of system.runtime.dll gets deployed older version, resulting in dll hell on service, fails run. if manually copy on correct version of system.runtime.dll, works again. where incorrect version of system.runtime coming from? , how convince offending software/hardware use correct version? update: trail getting warmer. on development machine, bin folder of eventworker project contains correct vers...

java - Show Toast if no results were found -

quickly trying do. creating script scans looks wi-fi connection. if finds it, returns startingactivity string. but how make display toast if scanned connections , didn't found right one. because right now, sits there , nothing. , have explain user found nothing. button btnhit; textview txtjson; string urlfinal; string fssid; intent intent; private static final string tag = "my activity"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_find_connection); btnhit = (button) findviewbyid(r.id.request); txtjson = (textview) findviewbyid(r.id.results); if (build.version.sdk_int > 22) { final string coarselocation = manifest.permission.access_coarse_location; final string accesswifi = manifest.permission.access_wifi_state; final string changewifi = manifest.permission.change_wifi_state; if (checkselfpermission(coarselocation) !=...

java - JavaFX - Drawn shape that follows mouse stutters when moving small distances -

i'm attempting make triangle shape drawn using graphicscontext2d follow mouse, while facing towards it. it works nice , nifty when you're moving on 10+ pixels of distance. however, shape stutters when you're moving small precise distances , doesn't correctly face mouse. game: public class game extends application { final static private string game_name = "trigon"; final static private int window_width = 960; final static private int window_height = 640; private playership ply; @override public void start(stage thestage) throws exception { // set title of window & make root, canvas, graphics context thestage.settitle(game_name); group root = new group(); scene thescene = new scene(root, window_width, window_height); canvas canvas = new canvas(window_width, window_height); graphicscontext gc = canvas.getgraphicscontext2d(); thestage.setscene(thescene); root.ge...

kotlin - Generate KDoc for methods in Android Studio -

when commenting methods java in android studio, can type /** , generates javadoc method parameters , return type me. seems doesn't work kotlin. is there way teach generate method docs in kotlin kdoc format automatically? edit: yes, question same thing possible duplicate, question isn't "why?", understand kdoc has different format. question if there way same kotlin in as? maybe there way add/edit template or this? as bug intellij, i've taken liberty of filing bug report here . can choose watch issue notified of updates.

algorithm - matching a sequence of text files one by one upto a certain limit in c++ -

i have made program in c++ generates 20 text files 1.txt 100.txt. each text files contains random 5 numbers between 1 , 10. example: 1.txt 2.txt 3.txt 4.txt 5.txt 6.txt 7.txt 8.txt .... 1 4 3 3 1 7 1 8 4 7 4 4 4 1 3 9 6 6 8 5 3 4 4 6 7 3 1 1 7 3 7 1 8 9 7 2 9 2 10 3 i want check percentage of similarity previous files 1 one starting 2.txt. in above files example: numbers 1,3,4 , 7 arising till 7.txt in 8.txt it's different. can 8.txt dissimilar previous files. actual target stop checking files when dissimilarity appears need not check 20 text files. in word, i want find out file number until which, percentage of similarity remains same or increases . when starts decreasing, stop checking. how in coding us...

sql - Truncate multiple select and update clauses into a single clause -

the below query seems inefficient, doing swapping out 1 variable (cobrand) each query. there way consolidate query 1 clause , same result? update temp_08.members set distinct_count= (select distinct_count temp_08.members cobrand='10001372' , month = '2016-09') cobrand='10001372' , month = '2016-10' or month = '2016-11'; update temp_08.members set distinct_count= (select distinct_count temp_08.members cobrand='10006164' , month = '2016-09') cobrand='10006164' , month = '2016-10' or month = '2016-11'; update temp_08.members set distinct_count= (select distinct_count temp_08.members cobrand='10005640' , month = '2016-09') cobrand='10005640' , month = '2016-10' or month = '2016-11'; update temp_08.members set distinct_count= (select distinct_count temp_08.members cobrand='10005244' , month = '2016-09') cobrand='10005244' , month = ...

python - Outputting a Seaborn heatmap chart of a pandas DataFrame using Bokeh -

i'm trying plot seaborn heatmap chart , output using bokeh. here's how plot chart: in [1]: import pandas pd ...: import seaborn sns ...: ...: df = pd.dataframe([['item1',1,2,3,4,'sept'], ...: ['item2',5,6,7,8,'oct'], ...: ['item3',9,10,11,12,'sept'], ...: ['item1',13,14,15,16,'oct'], ...: ['item2',17,18,19,20,'sept'], ...: ['item3',21,22,23,24,'oct']], ...: columns = ['itemname','metric1', ...: 'metric2','metric3','metric4','month']) ...: df out[1]: itemname metric1 metric2 metric3 metric4 month 0 item1 1 2 3 4 sept 1 item2 5 6 7 8 oct 2 item3 9 10 11 12 sept 3 i...

json - Angular2 how to correct put request -

ok then, have single problem, request url: http://.../rest/1.0/brand/test145 request method:put status code:500 internal server error remote address:... request payload ok { "name": "test145" } addbrand(name : string){ let body = json.stringify(name) let url = this.baseurl + '/brand/' + name; return this.http.put(url, { name } ). map(res => res.json()); } addbrand(name:any){ if(!name){return;} this.brandservice.addbrand(name) .subscribe( name => this.name.push(name), error => this.errormesage = <any>error); } but put should http://.../rest/1.0/brand/ , then, should request payload. when remove "name" from, doesn't load payload. stricly put update, url should in format: http://.../rest/1.0/brand/test145 last part unique id (you need indicate mean update) if expect create record, should rather post http://.../rest/1.0/brand but can choose deviate conventions. in order put ....

SQL Server Mgmt Studio Change Back to Windows Auth -

Image
1st time user sql server , after logged in 2012 management studio using windows authentication worked expected. while open, attempted change sql sever auth within properties. want go windows auth, cannot connect server management studio. i don't want have go through painful process of uninstalling , reinstalling, option? not understood question, believe first logged in ssms using windows authentication , when open changed sql server authentication , want connect again windows, if case click on highlighted area , in authentication click windows authentication provided in screenshot below. please correct me if understanding wrong!! if connecting not problem go through following links , may useful https://msdn.microsoft.com/en-in/library/ms188670.aspx http://blogs.adobe.com/livecyclehelp/2013/08/sql-server-in-windows-authentication-mode.html

objective c - iOS - realtime color determination from camera -

i'm writing app fot color determination. used avfoundation framework access camera, didn't find notification changing capturing image. thought grabbing color after camera focused. read checking video stream , using opengl library. so, better way reach goal?

rest - JWT stored in cookie - security concerns -

i'm building spa app server side rendering, using jwt-based authentication. current implementation is: jwt token issued , transferred client after successful username , password verification token stored in cookie (not httponly ) - purpose of avoid need login again after full refresh or closing page logging out deleted cookie token authorization header attached every api request if token exists full ssl traffic i can't store token in localstorage because of server side rendering, there no httponly because need access cookie in order construct authorization header. what possibilities of stealing token in such architecture? one major risk single cross-site scripting vulnerability in application used steal token cookie, because it's not httponly (while understand why case). xss in javascript-heavy application spa common , hard avoid. also you're saying token kept in cookie after closing browser, user still logged in. on 1 hand, that's ba...