Posts

performance - Prepending to mutable.LinkedList without copying in Scala -

i need build list quickly. idea use mutable.linkedlist , grow prepending. found operator +: prepending , produces copy of list, surprising, given list mutable. is there way prepend , modify list in place? i think how supposed use it, quick glance: val newlist = new linkedlist(newelem, existinglist) note though deprecated in scala 2.11 , might removed in future.

static - C++ shared library export function -

i want write plugin application. application brings plugin header- , c-file written exported functions fill. make development easier want create c++ "api". created base classes virtual functions (required functions abstract) , call functions plugin c-file. "api" should in static library file. the real plugin (a shared library) should include static library, derive , implement needed classes. now problem: how export function included static lib in shared lib (so application calls functions static lib)? possible? usually if want have plugin mechanism c++ common way of doing it: // plugin file extern "c" baseclass* create() { return new derivedclass; } extern "c" void destroy(baseclass* base) { delete base; } then in code uses plugin you're dealing baseclass without caring derivedclass pointing to. methods need export plugin should put in baseclass , make them virtual. note1: make sure call destroy function i...

c# - Register an interface with Autofac? -

i have class based on dbcontext , it's generated automatically ef designer (currently using database first). dbcontext in own assembly called 'model'. public partial class mycontext : dbcontext {} i have code in partial class , implementing interface: public interface imycontext { int commit(); task<int> commitasync(cancellationtoken ct); } public partial class mycontext : imycontext {} i have unit of work , generic repository. these classes in separater assembly called 'dal' public interface iunitofwork<tcontext> : idisposable tcontext : imycontext { int commit(); task<int> commitasync(cancellationtoken ct); } public interface irepository<t> t : class {} public abstract class repository<tcontext, t> : irepository<t> tcontext : imycontext t : class, ientity and have services, in yet assembly called 'services'. public class loginservice : baseservice, iloginservice { public loginserv...

javascript - Avoid triggering multiple click events -

i'm trying make input field disabled/enabled when click on sibling link. here code. $('a').on('click',function(){ var inp=$(this).siblings('input'); inp.prop('disabled', false); $(this).click(function(){ inp.prop('disabled', true); }); }); when click first time works fine, next time won't work. because both click functions, triggers. i'm unable overcome issue. please me. see fiddle. just negate disabled prop on every click. elem.disabled = ! elem.disabled . demo fiddle: http://jsfiddle.net/abhitalks/2a2ajbnb/1/ snippet: $('a').on('click',function(){ var $inp = $(this).siblings('input'); $inp.prop('disabled', !$inp.prop('disabled')); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input type="text" name="x" value="22" disabled/...

oracle11g - Java block when execute Oracle Procedure -

i have problem can not solve ,i use ojdbc7 libraries connect java database oracle11g @ launch of procedure when ends java application not go forward without responce. tried change driver ojdbc nothing know give me ideas ? attaching code : private static hashmap<string, connection> connessioni = new hashmap<>(); .... public static connection getconnectionistance(string connessione){ connection connection=null; try{ if((connection=connessioni.get(connessione))==null){ class.forname("driver"); connection=drivermanager.getconnection("urldb","userdb","pwddb"); connection.setautocommit(false); connessioni.put(connessione, connection); } }catch(sqlexception e){ e.printstacktrace(); }catch(classnotfoundexception e){ e.printstacktrace(); }ca...

java - How do I get files of particular extension? -

i'm creating program upload backup files cloud server, want use wildcard characters upload files "*.txt" or ".jpg". my code is: string filewacrypt = environment.getexternalstoragedirectory().getpath() + "/backup/dmg122.jpg"; but want string filewacrypt = environment.getexternalstoragedirectory().getpath() + "/backup/*.jpg";

backbone.js - requireJS in multiple context -

i'm having bit of trouble contexts in requirejs. have 2 js project based on requirejs , backbone. work perfect if work on own page. context conflict each others if put them same page. both projects follow similar module name convention. project a: main.js: require.config({ baseurl : "javascript/app1/", waitseconds : 20, paths : { jquerypb : "jquery-1.10.1.min", underscore : "underscore", backbone : "backbone-min", }, shim : { underscore : { exports : "_" }, backbone : { deps : [ "underscore", "jquerypb" ], exports : "backbone" } } }); require([ "app" ], function(app) { app.startup(); }); app.js define([ "jquerypb", "backbone", "underscore", "models/app", "views/app" ], function($jpb, backbone, _, ...