Posts

kotlin - private visibility modifier and subpackages -

so started experimenting kotlin , stumbled upon this: if top-level declaration marked private, private package it’s declared in ( see visibility modifiers ). since packages nest in kotlin, i.e. package foo.bar considered member of foo, if private in package, visible subpackages. note members of outer packages not imported default, i.e. in file in package foo.bar can’t access members of foo without importing them. from: visibility , package nesting so let's consider following example: file1.kt package foo private fun bar() = println("this bar!!!") and file2.kt package foo.baz import foo.bar fun main(args: array<string>) = bar() from understand function bar() should visible in package foo.baz , callable main(). when try compile above following error message: error: kotlin: cannot access 'bar': 'private' in 'foo' is bug or has spec of language been updated , documentation hasn't? missing somet...

javascript - How can I get all text in an SVG document that's exactly within a rectangular region? -

i have complex svg document generated pdf research paper via pdf.js, , want find text within rectangular area. in support of web-based labeling tool users can draw rectangles on top of arbitrary regions of rendered svg file (basically treating image) , need see corresponding text. first approach thought of iterating through each of svg's svg:text or svg:tspan elements , checking whether intersects rectangle in question, perhaps using checkenclosure() ( unsupported ff , btw). however, won't work cases rectangle annotates characters subset of svg:text or svg:tspan . example, imagine want annotate individual keywords in line: keywords: heusler alloys; pressure effect; curie temperature the svg in case breaks 2 's (because 'keywords ' italics): 'keywords: ' and 'heusler alloys; pressure effect; curie temperature' if 1 rect drawn around words 'pressure effect', program need scan each character in each , intersec...

java - return Statement from each branching -

this question has answer here: java error missing return statment 6 answers some times found compilation error - public static boolean returntruefalse(){ if(someconditions) return true; if(someconditions){ //do return true; } if(someconditions){ //do return false; } //got compilation error here } in above situation got compilation error @ commented portion saying - missing return statement . how can avoid situation? thanks well, message of compile error pretty clear : code must encounter return statement of every possible execution path because method has non-void return type. add return statement last case, or throw exception if should not reach state in normal execution.

java - Best way to represent set of string values in DB and UI -

i'm looking opinions guess 'which better' question. have webapp build in javascript/jquery , struts uses hibernate access data in relational db (mysql). when object/database field has limited set of strings values, better use full string in object/db or 'code' string, single char instead of entire string? class user { int id; string username; string type; // values of 'administrator', 'regular' or char type // values of 'a', 'r' or char type // values of 'a', 'r' string typestring; // can returned on fly based on 'type' or db in sql case statement } if database has full text string, easy coding way around, wasting space (in db, data transfer) on has few values. if database has 'code' when presenting field user ( in grid of existing users, or dropdown selection list when creating new user ) char value must converted full string. question s...

c# - Which part of the code shows validation errors after Post in asp.net MVC? -

let's have 1 view model. has 1 required name property. , have disabled client-side validation. have code in action method: if (!modelstate.isvalid) { return view(model); } so, works fine. highlight required field after post. but, can't understand jquery validaion function process? how, jquery validation detects form has been submitted once? i want find code, because want change slightly. example, have own helpers, has custom validation logic. now, custom helper validation not showing after invalid post. and, want add logic built-in function, can not find anywhere. firstly, if have disabled client side validation, jquery validation has nothing (you have disabled it!). briefly explain happens when post , return view. the defaultmodelbinder initializes new instance of model the defaultmodelbinder reads form data (name/value pairs) , if property name matches 1 of form data values, property set (assuming valid) , value adde...

Get a string with HTML tags inside a larger string with ColdFusion regex -

i'm new regular expressions , use help. i attempting use coldfusion rereplace scrape data , desired content. this have far: <cfoutput> #rereplace("remove please <p>make display please</p> remove please", "", "", "all")# </cfoutput> what regular expression take string , return "make display please"? in order subtext longer string, need match need, capture need capturing group (...) , , match rest of string end. replacement \1 back-reference references text captured capturing group. so, use #rereplace("remove please <p>make display please</p> remove please", ".*<p>(.*?)</p>.*", "\1", "all")# the regex matches: .* - matches character newline beginning last </p> <p> - literal <p> (.*?) - 0 or more characters other newline symbol few possible (it means closest </p> here) </p> - matc...

c# - Checking who accessed a directory last time -

main purpose i'm trying create program defends user personal files being accessed hacker. programming environment c# microsoft visual studio 2013 concept the program loops through directories of file system continously. checks file accessed it if none of users accessed modified or read, sounds alarm my question how check accessed file last time? my ideas i tought maybe check through directory security fileinfo class thanks in advice solution hi all, have solution, thank answers. here's code if needs in his/her project: public static string getspecificfileproperties(string file, params int[] indexes) { string filename = path.getfilename(file); string foldername = path.getdirectoryname(file); shell32.shell shell = new shell32.shell(); shell32.folder objfolder; objfolder = shell.namespace(foldername); stringbuilder sb = new stringbuilder(); foreach (shell32.folderitem2 ...