Posts

Showing posts from July, 2012

regex - C++ regexp to parsing nested struct -

i have string formatted follows permanent way: { first nested string; { second nested string; } } nesting may arbitrary depth. each sub-element formatted closing brace, adding 2 spaces previous level of nesting , closing brace. want receive regular expression allows obtain nested data. example, above example result should be: first nested string; { second nested string; } i wrote following code allows parse strings in 1 line, symbol '.' character except newline. regex regex("\\s*\\{\\s*(.*?)\\s*\\}\\s*"); string testinput = "{\n" " first nested string;\n" " {\n" " second nested string;\n" " }\n" "}\n"; smatch match; if (regex_search(testinput, match, regex)) { auto result = match[1].str(); } what regular expression make can receive nested data? in advance. the regex implementation c++ standard library not support recursion, needed match nested structures. like...

android - How to inject different client for retrofit when testing? -

is there way change way inject, dagger, retrofit module different client restadapter on instrumentation tests? @provides @singleton public apiservice getapiservice() { restadapter restadapter = new restadapter.builder() .setendpoint(buildconfig.host) .build(); return restadapter.create(apiservice.class); } but, want set new client when executing instrumentation tests. @provides @singleton public apiservice getapiservice() { restadapter restadapter = new restadapter.builder() .setendpoint(buildconfig.host) .setclient(new mockclient()) .build(); return restadapter.create(apiservice.class); } is there way this? thanks i did in project. can find sample here . app code written in kotlin , uses dagger 2. master branch contains java code , dagger 1 implementation. hope :)

How to get List of IP address inside the LAN connection ( Host name + Ip address) in Java? -

how list of ip address inside lan connection ( host name + ip address) in java ? need example code. enter following code in application. process process = runtime.getruntime().execute("net view"); inputstream in=process.getinputstream(); read lines input stream , list of host names in current lan or wifi network.

Sharing scope between nested directives and controllers in Angularjs -

i have created controller , directive in angular application defined following: app.controller('crudctrl', ['$scope', '$http', function($scope, $http) { $scope.isloading = true; $scope.pagechanged = function(){ $http({ method: 'get', url: 'http://localhost:8080/rest/repository'+$scope.repository.path, params: { size: 3, page: $scope.currentpage } }). success(function (data, status){ $scope.rowcollection = data._embedded['rest-original-product']; $scope.totalpages = data.page.totalpages; $scope.currentpage = data.page.number + 1; $scope.totalelements = data.page.totalelements; $scope.pagesize = data.page.size; $scope.isloading = false; $scope.numpages = 5; }). error(function (data, st...

c# - Excel exception HRESULT: 0x800A03EC from ChartArea.Copy() -

i'm working on c# application thats interacts excel instance using excel interop.dll v11.0. i'm using following code copy chart excel worksheet clipboard: public image readchart(chart chartaccess) { try { microsoft.office.interop.excel.worksheet sheet = workbook.sheets[chartaccess.sheet.name]; microsoft.office.interop.excel.chartobject chart = sheet.chartobjects(chartaccess.name); chart.chart.chartarea.copy(); // exception gets thrown here return system.windows.forms.clipboard.getimage(); } catch (comexception) { // display error dialog etc... } this worked fine excel 2007. since switching excel 2013 function chartarea.copy() results in following comexceptions being thrown: message: "dimension not valid chart type" stack trace: system.runtimetype.forwardcalltoinvokemember(string membername, bindingflags flags, object target, int32[] awrappertypes, messagedata& msgdata) microsoft.of...

networking - Mininet / python cannot assign requested adress [Errno 99] -

i using host.cmd() command of mininet execute script networking: print h1.cmd('cd ../src/; sudo ./script.py -r tcm -i h1-eth0 -a fd07::1 &> ../mininet/test.txt &') the problem script cannot assign network adress fd07::14! tried other addresses, localhost not working. but when run exact same command directly in mininet cli works. think there context problem? know how solve it?

php - Inserts about 30 times MYSQL -

this php supposed insert "d2" based on if day selected in "d1". inserts 30 times each row in "d1". use while time , never run problem, idea why happen? $query = mysqli_query($connection, 'select * '.$settings["d1"]); while($query_array = mysqli_fetch_array($query)){ $connection_main = mysqli_connect($settings["hostname"], $settings["mysql_user"], $settings["mysql_pass"], 'u_db_main_'.$query_array['id']); $dayofweek = strtolower(date('l')); $query2 = mysqli_query($connection_main, 'select * '.$settings_main["d1"].' '.$dayofweek.' ="1"'); while($query2_array = mysqli_fetch_array($query2)){ mysqli_query($connection_main, "insert ".$settings_main["d2"]." (c1) value ('".$query2_array['data_1']."')"); $id = mysqli_insert_id($connection_main); ...

Compose Functions in Scala typeclass -

i have following simple scala typeclass: sealed trait printable[a]{ def format(v: a): string } object printdefaults{ implicit val intprintable = new printable[int] {def format(v: int): string = v.tostring} implicit val stringprintable = new printable[string] {def format(v: string) = v.tostring} } object print { def format[a: printable](v: a): string = implicitly[printable[a]].format(v) def print[a: printable](v: a): unit = println(format(v)) def print2[a: printable](v: a): unit = format(v) andthen println } import printdefaults._ print.format(3) // returns "3" print.print(3) // prints 3 print.print2(3) // nothing why print.print2 not printing ? "compose" method called print allows me not have call println(format(v)) rather chain println after calling format(v) that's not how works. f andthen g returns function, not call function. calling function (f andthen g)(x) return (or have effect of) g(f(x)) . print2 compiles because ...

ruby on rails - Changing cloudinary file default url per uploader -

i have rails 4 app ruby 2.2.0 . i building app need store quite bit of images. app exists , managing images on local server, want change that. the app deployed on heroku , want use cloudinary service upload(using carrierwave ) new images store existing ones. the issue comes fact can't seem able adopt current folder structure platform using. start uploaded files via media manager in cloudinary dashboard. created 2 folders header , logo . in case refer header folder example. class banneruploader < carrierwave::uploader::base include cloudinary::carrierwave def store_dir "uploads/header/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end end the model: class companyimage < activerecord::base mount_uploader :file_name, banneruploader belongs_to :company end and last not least, here view: <% work_advantages = company.presentation.work_advantages banner = company.company_images.where(header: true).first %> <%...

java - create method not available in ArrayListMultimap -

Image
i trying use guava library's implementation of multimap. according guava api docs has static create() method, eclipse ide thinks doesn't though have imported required jar. it suggests the method create() undefined type arraylistmultimap screen shot same: so google collections not same guava, although share many of same classes. create method available if use guava jar rather google-collections-0.8.jar you can download guava jar (of version) http://mvnrepository.com/artifact/com.google.guava/guava , or alternatively maven/gradle config same place.

python - Django Time_Zone not saving correct values -

i have following settings in settings.py regarding time zones. time_zone = 'asia/kolkata' use_tz = true using datetime field, save particular time date: 2015-04-01 time: 22:00:00 it still gets stored 2015-04-01 16:30:00 in database on querying returns 04:30 pm 01/04/2015 in admin still shows date: 2015-04-01 time: 22:00:00 how fix error? there setting i'm missing in settings.py ? with windows, have change operating system timezone able reliably work: https://docs.djangoproject.com/en/1.7/ref/settings/#time-zone note django cannot reliably use alternate time zones in windows environment. if you’re running django on windows, time_zone must set match system time zone.

Installing LPSolve for Matlab on Windows -

i'm stuck , need help. i'm trying install lpsolve use matlab. i've tried following instructions on lpsolve webpage don't find them helpful. i've downloaded: lp_solve_5.5.2.0_matlab_exe_win64 lp_solve_5.5.3.0_dev_win64 i'm running 64bit windows 7 , using matlab 2014b. i've unzipped both downloads. contents of lp_solve_5.5.3.0_dev_win64 in folder has been added matlabs path. lp_solve_5.5.2.0_matlab_exe_win64 has been extracted folder in system 32 folder. folder has been added matlabs path also. when type mxlpsolve in matlab, get: mxlpsolve driver not found !!! check if mxlpsolve.dll on system , in directory known matlab. press enter see paths matlab looks driver. the file lpsolve55.dll in lp_solve_5.5.2.0_matlab_exe_win64 not mxlpsolve.dll. i'm confused. any give me appreciated. many thanks.

python 3.x - How do I get the Entry Widget to pass into a function? -

i'm sure simple mistake , i've localized specific spot in code: class newproduct(tk.frame): def __init__(self, parent, controller): tk.frame.__init__(self, parent) tlabel = ttk.label(self, text="title: ", font=norm_font).grid(row=0, padx=5, pady=5) qlabel = ttk.label(self, text="quantity: ", font=norm_font).grid(row=1, padx=5, pady=5) plabel = ttk.label(self, text="price: $", font=norm_font).grid(row=2, padx=5, pady=5) te = ttk.entry(self).grid(row=0, column=1, padx=5, pady=5) # add validation in future qe = ttk.entry(self).grid(row=1, column=1, padx=5, pady=5) pe = ttk.entry(self).grid(row=2, column=1, padx=5, pady=5) savebutton = ttk.button(self, text="save", command=lambda: self.save(self.te.get(), self.qe.get(), self.pe.get())) #why wrong!!!!!???!?!?!?!?!? savebutton.grid(row=4, padx=5) cancelbutton = ttk.button(self, t...

security - YouTube API v3 - Do I really need to use OAuth for basic read operations? -

i have system user can add content profile, such youtube videos, validate video url , call api video details such title, description , details. nothing else, no update\edit operations. for i'm using public api key authorize requests, put system domain whitelist $http.get(' https://www.googleapis.com/youtube/v3/videos?id= ' + videoid + '&key={{my_key}}' + '&part=snippet') regarding security issues, need use oauth 2.0 issue token used authenticate requests? if tracked request , capture key, need prevent via oauth, or there's way google developer console make read operations only. thanks. you don't need oauth2 read public information. as can see videos.list , there no authorization scope listed it.

php - sql query to merge data of two table and display output -

below 2 table . i need join both table data , fetch result accordingly... for ex - in scheme master table there 8 rows different receipt no. in receipt entry table there 2 receipt created ... so need display balance receipt scheme master table book , receipt not present in receipt entry table. table name - scheme_master book_no2 receipt_no createddate 401 10 15-03-2015 401 11 15-03-2015 401 12 15-03-2015 401 13 15-03-2015 403 25 15-03-2015 403 26 15-03-2015 403 27 15-03-2015 403 28 15-03-2015 405 35 15-03-2015 405 36 15-03-2015 405 37 15-03-2015 405 38 15-03-2015 table name - receipt_entry book_no receipt_no 401 10 403 26 i need receipt not present in receipt entry table. expected output ...

c# - How to determine if an element is matched by CSS selector? -

given selenium webdriver element instance, check if element matched given css selector. functionality similar jquery's is() function. i'm using .net bindings. example (suppose method called is ) var links = _driver.findelements(by.cssselector("a")); foreach (var link in links) { if (link.is(".myclass[myattr='myvalue']")) // ... else // ... other thing } is there kind of built-in stuff achieve this, or if not, can suggest possible implementation? i'm new selenium, , have no idea yet. update i see there no built-in way this. final goal implement methods jquery's parents(selector) , closest(selector) , suggestions appreciated more special case. there no selenium method equivalent of jquery's $(...).is(...) . however, dom offers matches . not complete replacement $(...).is(...) since not support jquery's extensions css selector syntax but, again, selenium not support these extensions either. yo...

python - Pandas appending .0 to a number -

i'm having issues pandas i'm little baffled on. have file lot of numeric values not need calculations. of them coming out fine, have couple getting ".0" appended end. here sample input file: id1 id2 age id3 "sn19602","1013743", "24", "23523" "sn20077","2567897", "28", "24687" and output being generated: id1 id2 age id3 "sn19602","1013743.0", "24", "23523" "sn20077","2567897.0", "28", "24687" can explain why not of numeric values getting .0 appended, , if there way can prevent it? problem when perform next step of process csv output. i have tried convert data frame , column string did not make impact. ideally not want list each column convert because have large number of columns , manually have go through output file figure out ones getting .0 appended , code it....

delphi - TPanel does not AutoSize when containing a TPanel -

Image
i have panel inside another: the inner panel aligned altop : and outer panel set autosize=true : and sizes. if changes height of inner panel @ design time, outer panel auto sizes accommodate it: and runtime now need change height of inner panel @ runtime : procedure tform2.button1click(sender: tobject); begin pnlinner.height := pnlinner.height + 50; lblpointer.top := pnlouter.top + pnlinner.height; end; except when change height of inner panel @ runtime , autosize panel not autosize : this of course worked in delphi 5, 7, , probably xe2 - xe5 . what's fix? the workaround is, of course, bypass alignment / autosize , during various onresize events. that's distinctly not rad. i'm sure it's small bug in vcl somewhere. , since have two-dozen xe6 vcl bugs we've patched, better fix nobody else has think it. bonus chatter i love line: and, please attach sample project? it's if nobody bothered try reproduce it. ...

gcc - Determine if compiled ELF object is 32-bit or 64-bit -

i want verify if object has been compiled in 32-bit or 64-bit: % readelf -h my_obj elf header: magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00 class: elf32 data: 2's complement, big endian version: 1 (current) os/abi: unix - system v abi version: 0 type: exec (executable file) ... since elf32 displayed, guarantee object in 32-bit mode? fat binaries aren't common or standard elf, class reliably indicate 32 vs 64 bit. figure out whether you're looking @ 32-bit x86, arm, mips, or whatever, have inspect machine field right below type field.

arrays - Delete the content of a int * in C -

if have array one: int * array = ... and if want delete it's content, fastest , efficient way in c ? if "deleting content" mean zeroing out array, using memset should work: size_t element_count = ... // defines how many elements array has memset(array, 0, sizeof(int) * element_count); note having pointer array , no additional information insufficient: need provide number of array elements well, because not possible derive information pointer itself.

java - Comparing two set of strings -

here problem. i'm trying compare 2 different string using && , .equals seems cannot give me result should be. here code (starting think problem is) : for(int = 0; < datalist.size(); i+=3) { string temp1 = datalist.get(i); string temp2 = datalist.get(i+1); system.out.println(temp1); system.out.println(temp2); if (temp1.equals(dataquery1)) { system.out.println("true"); if (temp2.equals(dataquery2)) { system.out.println("true"); array2.add((datalist.get(i))); array2.add((datalist.get(i+1))); array2.add((datalist.get(i+2))); } } } system.out.println("\n\narray2 size : " + array2.size()); (int j = 0; j < array2.size(); j++) { system.out.println("array2 : " + array2.get(j)); } this array : [0] lipase b [1] x-33 [2] ppicz?a [3] candida ...

css - How to override chrome input box border when clicked? -

how can avoid border chrome puts on input box, different color when user clicks on it? you can use css outline property remove that: input { outline:none; }

c++ - no graphics visible on LCD on running qt application -

i trying cross compile , run qt application on arm board has lcd connected it. used below code , cross compiled arm. when run application executes no graphics visible on lcd. can me. need export something. #include <qapplication> #include <qpushbutton> int main(int argc, char *argv[]) { qapplication app(argc, argv); qpushbutton hello("hello world!"); hello.show(); return app.exec(); } i have done project "rfid based authorization system" had run qt application on lcd interfaced raspberry pi (arm board). please provide more information can of more you. make sure had done: correct qt package (qt on arm embedded system) every time port program intel (your computer) arm based, need configure project on qt creator. make sure graphics environment enabled on arm board working. default, command line interface enabled on arm board , need enable gui separately.

domain driven design - Entity Framework Fluent API and MultiBoundedContext -

i have applied multi bounded context principle of domain driven design , have 3 different objects (in 3 different domain contexts) pointing same table in database. julie lerman suggested, have shared database model has objects. shared database model used code-first migrations. have fluent api configurations represent foreign key relationships , column constraints on shared database model. question is, should let 3 domain specific contexts know of these fluent api configurations. validate object graph in each of these contexts. should worry string lengths, required etc etc on these separate domain contexts? necessary/good practice configure these relationships on each of 3 separate domain contexts? yes, have repeat fluent api configurations in smaller domain specific models.

javascript - Why is my function not returning accurate count? -

expanding code i've been working on supplement tracker current function not returning accurate count of numbers greater average 'mean' nor count of integers below mean average. i've commented out 2 questions within code because don't quite understand why array set index[0]. i've learned comments , searching answers here. thankful site exists! looking learn bit more question. function supparray() { var nums = new array(); //create array var sum = 0; //variable hold sum of integers in array var avg = 0; //variable hold average var i; var count = 0; var count2 = 0; var contents = ''; //variable hold contents output var dataprompt = prompt("how many numbers want enter?", ""); dataprompt = parseint(dataprompt); for(i = 0; <= dataprompt - 1; i++) { //loop fill array numbers nums[i] = prompt("enter number",""); nums[i] = parseint(nums[i]); contents += nums[i] + " ...

access vba - Reset password subform -

i come today ask advise coding in still have issues. working @ beginning in normal form, decided adapt real situation base analytics on subform elements. would mind taking @ , tell wrong ? thanks lot help: public function resetpassword() 'on error goto macro1_err dim frm form set frm = screen.activeform if dlookup("[user login]![password]", "[user login]", "[user login]![username]= [textlogin]") = frm.forms.navigationsubform.textpass.value if frm.forms.navigationsubform.textnewpass.value = frm.forms.navigationsubform.textnewpassconfirmation.value strsql = "update [user login]" _ & "set [user login].[password] =" & frm.forms.navigationsubform.[textnewpass].value _ & "where ((([user login].[username])=" & frm.forms.navigationsubform.[textlogin].value & "));" docmd.runsql strsql beep ...

ios - Converting UTC date format to local nsdate -

i getting server string date in utc time zone , need convert local time zone. my code: let utctime = "2015-04-01t11:42:00.269z" let dateformatter = nsdateformatter() dateformatter.timezone = nstimezone(name: "utc") dateformatter.dateformat = "yyyy-mm-dd't'hh:mm:ss.sss'z'" let date = dateformatter.datefromstring(utctime) println("utc: \(utctime), date: \(date)") this prints - utc: 2015-04-01t11:42:00.269z, date: optional(2015-04-01 11:42:00 +0000) if remove dateformatter.timezone = nstimezone(name: "utc") it prints utc: 2015-04-01t11:42:00.269z, date: optional(2015-04-01 08:42:00 +0000) my local time zone utc +3 , in first option utc in second option utc -3 i should get utc: 2015-04-01t11:42:00.269z, date: optional(2015-04-01 14:42:00 +0000) so how convert utc date format local time? something along following worked me in objective-c : // create dateformatter utc time format ns...

jasper reports - how to upload jrxml file in jaspersoft studio? sftp -

Image
after editing jaspersoft template in studio version 6.0.3 possible export or upload jrxml file server via sftp directly jaspersoft studio? currently after edits made , saved have go ftp client upload files. try use eclipse rse installing dedicated feature. it's possible jaspersoft studio. need add update site it. suggest use indigo one, because juno (dedicated 4.2.x) may screw ui , other jss capabilities. if eclipse 3.8.2 version, platform used jss product, referred juno, can more bug-fix version of indigo 3.7.x. so add indigo update site: http://download.eclipse.org/releases/indigo/ later can select feature "remote system explorer end-user runtime", install , free try if suits needs. see screenshot below: personally installed, didn't play it. anyhow suggest give following blog post: http://rays-blog.de/2012/05/05/94/use-winscp-to-upload-files-using-eclipses-autobuild-feature/ maybe it's better set-up custom script, user did because not...

node.js - Populating field values for referred documents in aggregate call in Mongoose -

i have 2 base schemas user , course //user model var userschema = new schema({ userid: { type: string, default: '', required: 'please provide userid.', index : true }, name :{ type: string, default: '', trim : true } }); //course schema var courseschema = new schema({ title: { type: string, default: '', required: 'please fill course title', trim: true, index: true }, description: { type: string, default: '', trim: true }, category: { type: string, ref: 'category', index: true } }); and usercourseprogress schema storing each user's course progress. var usercourseprogress= new schema({ userid: { type: string, ref:'user', required: 'please provide user id', index:true }, ...

Adding Files view on Ambari 1.7.0: ClassNotFoundException -

i'm trying add views on ambari 1.7.0. for files view available here: https://github.com/apache/ambari/tree/trunk/contrib/views/files i error after trying launch instance of view: 500 hdfsapi connection failed. check "webhdfs.url" property with following stack trace (just first lines): java.lang.runtimeexception: java.lang.classnotfoundexception: class org.apache.hadoop.hdfs.web.webhdfsfilesystem not found @ org.apache.hadoop.conf.configuration.getclass(configuration.java:1720) @ org.apache.hadoop.fs.filesystem.getfilesystemclass(filesystem.java:2415) @ org.apache.hadoop.fs.filesystem.createfilesystem(filesystem.java:2428) @ org.apache.hadoop.fs.filesystem.access$200(filesystem.java:88) @ org.apache.hadoop.fs.filesystem$cache.getinternal(filesystem.java:2467) i add following property during configuration of view: webhdfs.url webhdfs://mycluster1:50070 i'm not sure perhaps it's issue during building part version conflict, i'm working...

html - Trying to get my website to fit all resolutions -

okay trying website fit resolutions or screen sizes because working on 17" 1920x1080 screen size , website looks fine when try run on 10" or 15" screen etc website screws up, content goes everywhere (mainly drops down) wondering how can fixed? thanks first of should use percentage values (e.g. width:20%; instead of width:200px; ) whenever can, don't rely on absolute pixel resolutions (which screw whole design/layout). for other things , tuning should take onto css media query (e.g. w3schools ): @media screen , (min-width:1024px) { /* ... */ }

database - Partitions by null values with MySQL -

i have table: create table `newtable` ( `iblock_element_id` int(11) not null , `property_1836` int(11) null default null , `description_1836` varchar(255) character set cp1251 collate cp1251_general_ci null default null , `property_1837` int(11) null default 0 , `description_1837` varchar(255) character set cp1251 collate cp1251_general_ci null default null , `property_1838` decimal(18,4) null default null , `description_1838` varchar(255) character set cp1251 collate cp1251_general_ci null default null , `property_3139` int(11) null default 0 , `description_3139` varchar(255) character set cp1251 collate cp1251_general_ci null default null , `property_3173` decimal(18,4) null default null , `description_3173` varchar(255) character set cp1251 collate cp1251_general_ci null default null , primary key (`iblock_element_id`), index `ix_perf_b_iblock_element_pr_1` (`property_1837`) using btree , index `ix_perf_b_ibloc...

css - Two media queries, same stylesheet, both work on Chrome, only on Firefox -

i have started designing media queries responsive design of page. have written 2 media queries follows: @media screen , (min-device-width : 320px)and (max-device-width : 480px) { #logintable { margin-left: 27%; } .slider-wrapper { margin-left: 23%; margin-top: 5%; width: 52%; } .descriptiontext1 { margin-left: 12%; font-size: 59%; margin-top: 13%; } .header { margin-bottom: 4%; } .descriptiontext2 { margin: 5% 0px 15% 12%; font-size: 61%; } } @media screen , (min-device-width : 768px) , (max-device-width : 1024px) { #logintable { border-color: rgb(204, 24, 24); margin-top:2%; margin-left: 2%; } .slider-wrapper { margin-left: 47%; margin-top: -31%; } .descriptiontext1 { ...

asp.net web api2 - Get AuthorizeAttribute to work roles with start and expiration date in web api 2 application ? -

i need modify user roles in web api 2 project using identity 2 adding additional properties: datetime startdate , datetime enddate . required able grant users roles limited period of time. what need authorize attribute such [authorize(role="poweruser")] etc. understand role dates? according source ( https://github.com/asp-net-mvc/aspnetwebstack/blob/master/src/system.web.http/authorizeattribute.cs ) filter calls iprincipal.isinrole : protected virtual bool isauthorized(httpactioncontext actioncontext) { ... if (_rolessplit.length > 0 && !_rolessplit.any(user.isinrole)) { return false; } return true; } looks need subclass implementation of iprincipal in httpactioncontext.controllercontext.requestcontext.principal , somehow inject somewhere in life cycle instead of default implementation. how do this? just create custom implementation of of authorizeattribute userauthorize , instead of using [authorize(role...

data structures - Skip list on java extending AbstractMap -

i need implement skip list in java. know how skip list works, need extend abstractmap. class skiplist like public class skiplist<k extends comparable<k>,v> extends abstractmap<k,v> { public skiplist(int levels) { // ... } // ... } i don't understand how need extend abstractmap skiplist used fast search, o(logn) time complexity. standard jdk has no implementation of it. while concurrentskiplistmap implemented using skiplist data structure, can refer source code: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8-b132/java/util/concurrent/concurrentskiplistmap.java#concurrentskiplistmap here example: https://codereview.stackexchange.com/questions/71432/custom-skiplist-implementation-in-java

java - Collections in POJOs -

i generating pojos database using different tools , noticed generate collections fields, getters , setters, 1 many relationships , others didn't. let's have order , product table. each order can have 1 or many products. collection<product> list = new arraylist<>(); list.add(product1); list.add(product2); method 1: order order = new order(); order.setdate(...); orderdao.add(order); orderdao.addproductbatch(list) method 2: order order = new order(); order.setdate(...); order.setproductcollection(list); orderdao.add(order); and in add method, include addproductbatch call. which method prefered? 1 many relationships adding multiple objects in single transaction never occurs - in case wouldn't need of these collections - correct? it depends on implementation of dao... in method 2, build order , products in business model, pass complete , consistent order (order + list of products) saved dao. transaction implementation internal dao. in...

Android flavors, Gradle sourceSets merging -

i try make application multiple partners , each partner test , prod version. each flavors create specific folder res/values in documentation said. my gradle file : apply plugin: 'com.android.application' android { packagingoptions { exclude 'meta-inf/license' exclude 'meta-inf/notice' } compilesdkversion 14 buildtoolsversion "21.1.2" defaultconfig { versioncode 1 versionname 1 minsdkversion 14 targetsdkversion 19 } productflavors { prodpartner1 { applicationid "com.partner1" } testpartner1 { applicationid "com.partner1.test" } prodpartner2{ applicationid "com.partner2" } testpartner2{ applicationid "com.partner2.test" } } sourcesets { testpartner2 { res.srcdirs = [...

java - Charset in JTextPane which using AdvancedRTFEditorKit -

Image
i'm having problems charset encodings. i'm using advancedrtfeditorkit (free closed source library: http://java-sl.com/advanced_rtf_editor_kit.html ). if copy special characters (ěščřžýáíé) ms word , paste them sample delivered advancedrtfeditorkit library, works fine. if same simple sscce uses advancedrtfeditorkit, appear rectangles. know i'm doing wrong? this problem occurs ms office products. libreoffice works fine. my sscce: public static void main(string[] args) { jframe frame = new jframe(); frame.setsize(350, 300); frame.setdefaultcloseoperation(jframe.exit_on_close); jtextpane pane = new jtextpane(); pane.seteditorkit(new advancedrtfeditorkit()); frame.add(pane); frame.setvisible(true); } after many changes in code figured out there isn't problem app. problem running app directly netbeans ide. don't know why, ide somehow encode/decode interaction os.

CodePro Analytix: Where to find the plugin now the link http://dl.google.com/eclipse/inst/codepro/latest/3.6 is not working -

i need set codepro analytix plugin . link http://dl.google.com/eclipse/inst/codepro/latest/3.6 not opening. please me out. there other way install codepro analytix or there other tools same functionality. also if 1 downloaded codepro analytix please share. email: chanduram7@gmail.com that eclipse update site, can't open in web browser. instead install eclipse opening 'help > install new software...'. in 'work with:' field enter update site url example https://dl.google.com/eclipse/inst/codepro/latest/3.7 still works eclipse oxygen. eclipse show can installed update site. note: code not appear have been updated while.

dynamic table name in redshift -

i have few tables similar names different prefixes: us_cities, ca_cities , uk_cities. each 1 of tables consist 1 column (city_name). want union tables , result that: select 'us' country, city_name us_cities union select 'ca' country, city_name ca_cities union select 'uk' country, city_name uk_cities in future have more city tables more countries , want dynamic query/view identify relevant tables (*_cities) , add them in union query. how can in redshift? you can use information_schema.tables table list of tables match naming convention. need external process replace view. select * information_schema.tables table_name '%_cities'; imho, you'd better off having single cities table , using views create country specific versions. :)

Is C++ pointer aliasing a threat if the pointers are exactly the same? -

consider function intended vectorization: void addsqr(float* restrict dst, float* restrict src, int cnt) { (int i=0; i<cnt; i++) dst[i] = src[i] * src[i]; }; this work if src & dst not aliased of course. if src == dst? extreme cases such src == dst+1 not allowed of course. if pointers same, there shouldn't problem, or missing something? edit: restrict intel c++ compiler keyword, msvc has __restrict. my point question don't see way how kind of vectorization go wrong: since every dst value dependent on single src value @ either different (without aliasing) or same address, when dst changed, src value never needed anymore, because fact has been written means output has been calculated. case if compiler used dst temporary buffer, don't think correct. in c, code causes undefined behaviour violating restrict definition because writes 1 object through dst reads same object through src . it doesn't matter whether or not there offset between ...

javascript - How to show JSON data with jQuery? -

i want show data onclick json. using different functions each button 3. working now html <div class="map"> <div class="bullets"> <div class="pin" id="pin3" name="ct3" type="" value="" onclick="ct3"></div> <div class="pin" id="pin2" name="ct2" type="" value="" onclick="ct2"></div> <div class="pin" id="pin1" name="ct1" type="" value="" onclick="ct1"></div> </div> </div> <div class="content"> <img class="cover" src = "" id = "img" /> <div class="title"> <p id="header"></p> </div> <div class="copy"> ...

jsonschema - "required" keyword in JSON schema -

i got below schema http://json-schema.org/examples.html , want know if required keyword can come @ top level. or can come within properties if there property of type object.i not find thing related in specification http://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.4.3 . { "title": "example schema", "type": "object", "properties": { "firstname": { "type": "string" }, "lastname": { "type": "string" }, "age": { "description": "age in years", "type": "integer", "minimum": 0 } }, "required": ["firstname", "lastname"] } so below example valid schema { "title":"example schema", "type":"object...

ios - presentViewController gives Error -

this first question here might not in best format. in app want show next screen, 1 working fine when alone, there should no problem here. using following code make transition let dataviewcontroller = self.storyboard?.instantiateviewcontrollerwithidentifier("data") self.presentviewcontroller(dataviewcontroller, animated: true, completion: nil) on second line self.presentviewcontroller error message: cannot convert expression's type '(anyobject?, animated: booleanliteralconvertible, completion: nilliteralconvertible)' type 'booleanliteralconvertible' the answer found, 1 having same error, function presentviewcontroller , not presentedviewcontroller . have admit had problem. after fixing error in code error message did not disappear. show me right direction search or got answer. you need specify expected type instantiateviewcontrollerwithidentifier use following line when getting view controller: let dataviewc...

r - add image in title page of rmarkdown pdf -

i attempting create rmarkdown document. have figured out way approach this, although has taken quite time. last thing able add image title page of pdf document. the trouble have title page defined top section of yaml. below contents of example.rmd file. use knit pdf button in rstudio turn pdf. --- title: "this document" author: "prepared by: dan wilson" date: '`r paste("date:",sys.date())`' mainfont: roboto light fontsize: 12pt documentclass: report output: pdf_document: latex_engine: xelatex highlight: tango --- r markdown document. markdown simple formatting syntax authoring html, pdf, , ms word documents. more details on using r markdown see <http://rmarkdown.rstudio.com>. when click **knit** button document generated includes both content output of embedded r code chunks within document. can embed r code chunk this: ```{r} summary(cars) ``` can embed plots, example: ```{r, echo=false} plot(cars) ``` note `echo = f...

javascript - How to 'cut' DOM element and display it in other place? -

i have website, , want "cut" every div#id .tab-content , add every div every li when viewport width less 768px. my html page: <section id="menu"> <div class="container"> <div class="row"> <div class="col-xs-12"> <ul id="menu-nav" class="nav nav-pills text-center"> <li class="active"><h2><a href="#about" data-toggle="tab">about</a></h2></li> <li><h2><a href="#services" data-toggle="tab">services</a></h2></li> <li><h2><a href="#contact" data-toggle="tab">contact</a></h2></li> </ul> </div> </div> <div class="row"> ...

How can I modify a Jenkins job environment variable value using Groovy? -

im using groovy postbuild plugin , trying modify exists job environment variable test im running on jobs log: def map = ["x":"", "y":"", "z":""] map.each{ it.value = (manager.getlogmatcher("$it.key(.*)\$")).tostring().split(':')[1] } if(map.get('x') == ""){ job_environment_variable = foo } else { job_environment_variable = boo }

c# - How to bind crystal report with linq to entities Method -

i facing error while binding crystal report class library's method using linq entities.please me .error is:dataset not support system.nullable<>.following code. reportdocument customerreport = new reportdocument(); customerreport.load(server.mappath("sample.rpt")); ilist<customer> cs; cs = databasebase.getallcustomers(); customerreport.setdatasource(cs); crystalreportviewer2.reportsource = customerreport; crystalreportviewer2.databind(); working fine ado.net code need using entity framework..code of ado.net : dscustomer dscs = new dscustomer(); string conn = system.configuration.configurationmanager.connectionstrings["crmconnectionstring"].connectionstring; string statement = "select * customer"; sqldataadapter dastatement = new sqldataadapter(statement, conn); dastatement.fill(dscs._dscus...

c# - File Upload path needed -

hi trying save path of file using fileupload . on clicking button want complete path user has selected file upload stored database. testing purposes using labels in code below connect data base.i need store path selected user , not file. html c# have been trying not working protected void button1_click(object sender, eventargs e) { string g = fileupload1.filename; string b =convert.tostring(fileupload1.postedfile.inputstream); //string filepath = path.getfullpath(fileupload1.filename.tostring()); label1.text = g; label2.text =b; } change code below: protected void button1_click(object sender, eventargs e) { string g = server.mappath(fileupload1.filename); string b =convert.tostring(fileupload1.postedfile.inputstream); //string filepath = path.getfullpath(fileupload1.filename.tostring()); label1.text = g; labe...

javascript - Getting a display:none div to toggle (so that it displays) when a button is pressed, and then *stay* displayed? -

i have div set display:none. i have button that, using jquery code, displays div. i when user hits button again, nothing happens -- div remains displayed regardless. how can achieved? the code i'm using: http://jsfiddle.net/el2au/ js: $('#mybtn').click(function() { $('#mydiv').toggle(); }); html: <div id="mydiv" style="display: none"> hello div </div> <button id="mybtn">toggle div</button> css: #mydiv { background-color: red; color: blue; height: 50px } thank you. if want show #mydiv only, replace .toggle() .show() if want show/hide, please use following code. $('#mybtn').click(function() { if ($('#mydiv').is(":visible")) { $('#mydiv').hide(); } else { $('#mydiv').show(); } }); #mydiv { background-color: red; color: blue; height: 50px } <script src="https://ajax.go...

objective c - NSPredicate expression to filter on count of a to-many relationship -

i have core data model one-to-many relationship e.g.: @interface person : nsmanagedobect @property (nonatomic, retain) nsset *children; @end i want create predicate gives me person s have @ least 1 child: i tried: [nspredicate predicatewithformat:@"person.children.count > 0"] but nspredicate to-many key not allowed . ok, found documentation on realm.io site nspredicate collection queries has answer: you have use @count instead of count : so: [nspredicate predicatewithformat:@"person.children.@count > 0"] pity apple doesn't document (at least not find).

vb.net - Hot to use more socket? -

i have form called frmmsg. following warning when open new frmmsg : only 1 usage of each socket address (protocol/network address/port) permitted. how can open form using more socket? this code i'm using: imports system.io imports system.threading imports system.net.sockets public class frmmsg dim listener new tcplistener(8000) dim client tcpclient dim message string private sub frmmsg_load(sender object, e eventargs) handles mybase.load dim thread new thread(new threadstart(addressof listening)) listener.start() end sub private sub listening() listener.start() end sub private sub btnnewform_click(sender object, e eventargs) handles btnnewform.click dim fnew new frmmsg fnew.show() end sub end class where problem , how can solve it? as apparent message can open 1 listening socket per port (in general). therefore, must ensure there 1 instance of tcplistener(8000) @ same time...

Memory management issue in google map IOS -

i'am working on locate app, using google map locate. , issue is; our app consumes huge amount of memory while i'am doing on map zoom in or zoom out or while plotting marker on map , not releasing memory. trouble, have searched on , in didn't find proper solution. says to these stuffs: self.mapview.delegate = nil; [self.mapview clear]; [self.mapview removefromsuperview]; [self.mapview stoprendering]; //deprecated in ios8 tried of above codes except last line deprecated in ios8 , no use. i'am sure there'll solution since lot of similar famous apps there in appstore working cool. hope 1 expert in can me.

postgresql - Data miss match in citusDB with jdbc driver -

i try insert data citusdb using same code postgresql ( java jdbc connection ). insertion success , display values in select query(in java code). can't able list rows in citusdb postgresql console. , same happen when insert in citusdb postgresql console (insertion success , values listed in console, values not list using java code).

jquery ui - Is there any knockout plugin for showing a nested context menu? -

is there knockout plugin showing nested context menu? my specific need show contextmenu list items, has "sendto" menuitem , possible subitems have set @ runtime. in apparent lack of suitable plugins went more direct knockout approach. i'm sure code can more elegantly packed in custom binding solution came with, if need similar. in case menu build each time it's opened because makes sense in usecase. i'm sure code can customized other scenarios. so... markup: <li data-bind="event: { contextmenu: $root.showsendtomenu }/> used show popup menu, item on right click. , markup menu itself: @*the send popup menu*@ <ul class="context-menu" data-bind="visible:contextmenu.activeelement, style:{left:contextmenu.left, top:contextmenu.top}, template: { name: 'menu-item-template', foreach: contextmenu.items }, event: { mouseleave: contextmenu.contextmouseleave }"></ul> @*template menu item*@ <script t...