Posts

Showing posts from March, 2011

bash - Quickly detect added/removed files inside git repository -

let's have git repository .gitignore. i want 'snapshot' repository @ point in time, , save sort of digest in location outside of repository (i mustn't change repository). then, want able detect if there files added or removed (but don't care changes) inside git repository aren't in .gitignore since last snapshot. want check fast (it's editor plugin - response time crucial). if cared committed files solution trivial: store head commit hash in snapshot, , compare commits. do care uncommitted , untracked files - files not care ones in .gitignore . basically want store output of git ls-files -c -o --exclude-standard point in time, , see if changed @ later point, without processing entire output. i prefer pure git solutions, otherwise i'd cross-platform bash/batch solution.

ruby on rails - How to run method with Delayed Job? -

i tried run methods delayed_job keep getting error job failed load: allocator undefined method... delayed_job stores task in table can't run it. mailer working fine delayed_job. tried method_name.delay , handle_asynchronously :method_name getting same error.

Wildcard in powershell string for call operator -

in powershell script need call funcion this $specruncall = "./packages/specrun.runner.1.2.0/tools/specrun.exe" $mstestarguments = @('run', 'default.srprofile', "/basefolder:.\testresults", '/log:specrun.log') if($tag) { $mstestarguments += '/filter:@' + $tag } & $specruncall $mstestarguments but have put there version of specrun runner, thinking of putting wildcard , find whichever version have (provided have 1 there) i'm struggling find working solution it. thanks, assuming version exists, resolve-path ...specrun.runner.*... should work: $specruncall = resolve-path ./packages/specrun.runner.*/tools/specrun.exe

scala - Akka Future Respose to a Sender -

i came across following sip: http://docs.scala-lang.org/sips/pending/spores.html as reading through, came across example: def receive = { case request(data) => future { val result = transform(data) sender ! response(result) } } there description below in article: > capturing sender in above example problematic, since not return stable value. possible future’s body > executed @ time when actor has started processing next > request message originating different actor. > result, response message of future might sent > wrong receiver. i not understand line "capturing sender in above example problematic...." isn't case in each request actor (request(data)) create future block? the creating of future block synchronous mean sender reference known @ time. execution of future block somehow scheduled happen @ later point in time. is understanding correct? def receive = { case request(data) => future {...

c# - Register External Login Web API -

i don't understand why isn't clear tutorial or guideline on this, hope question can answered here. so, trying register users facebook or google, via web api. the problem is, @ registerexternal method, on line: var info = await authentication.getexternallogininfoasync(); it returns null, , returning badrequest() what got far: in startup.auth.cs i've hadded id's , secrets, note have tried using microsoft.owin.security.facebook var facebookoptions = new microsoft.owin.security.facebook.facebookauthenticationoptions { appid = "103596246642104", appsecret = "1c9c8f696e47bbc661702821c5a8ae75", provider = new facebookauthenticationprovider() { onauthenticated = (context) => { context.identity.addclaim(new system.security.claims.claim("urn:facebook:access_token", context.accesstoken, clai...

Storage capacity of in-memory database? -

is storage capacity of in-memory database limited size of ram? if yes, there ways increase capacity except increasing ram size. if no, please give explanations. as mentioned, in-memory storage capacity limited addressable memory , not amount of physical memory in system. simon correct os swap memory page file, really want avoid that. in context of dbms, os worse job of if used persistent database large of cache have physical memory support. iow, dbms manage cache more intelligently os manage paged memory containing in-memory database content.

javascript - How to do Natural sorting in angularJs? -

i have object below: scope.obj=[{option :"option 1" },{option :"option 2" },{option :"option 3" },{option :"option k" }] and html <a ng-repeat="item in obj | orderby :'option':false">{{item.option}}</a> and expecting display object list in ascending order below: option k option 1 option 2 option 3 but getting output option 1 option 2 option 3 option k i have tried many solution given in stackoverflow , other sites nothing working. pls me solve issue my expectation if character after "option" string (like option k,option l etc) there should come first in ascending order number should come(option k,option l,option 1,option 2,etc) the angular documentation says sorts numbers (using natural order) or strings (alphabetically, numbers smaller letters), think should sort array before ng-repeat: myarray.sort(function mycustomsortfunction(a,b) {...})

javascript - Detecting the button click on z-index -1 -

hi jsfiddle code. there animation right left , left right when animation stops car image appear bottom. want detect if car image clicked have open new window. car image z-index set -1 close button visible if not able detect click functionality. can make work. when clicked on close button hides , shows single div. #car_slider { position:fixed; bottom:-10px; width:300px; height:0; border:2px solid #000; z-index: -1; } i tried using line of code not detect click. $("#car_slider").click(function() { window.open('//www.google.com', '_blank'); }); put z-index:1; #car_slider { position:fixed; bottom:-10px; width:300px; height:0; border:2px solid #000; z-index: 1; } demo

vb.net - ADODB connection state property -

i working on old project of company, written in vb.net (with no try catch block in whole app * sigh *). basic problem leaves zombie process behind. what suspecting db call using i.e. adodb connection object query sql database. adoconn.open("dsn=nameofdatabase;uid=nameofsa;pwd=password") what thinking introduce simple check db state. using adoconn.state (int) but not sure possible values adoconn.state. have checked on https://msdn.microsoft.com/en-us/library/adodb._connection.state%28v=vs.90%29.aspx no information such. i versed c# though 0: closed 1: connecting 2: connected etc. any such information (with proper citation) helpful. state property (ado) indicates applicable objects whether state of object open or closed. if object executing asynchronous method, indicates whether current state of object connecting, executing, or retrieving. returns long value can objectstateenum value. default value adstateclosed . constant va...

html - How to make a horizontally scrolling panel or carousel? -

i'm looking similar on steam (horizontal scrolling, if mouse hover stops): just like this the feature called carousel , can find many samples on internet. ( here , here ) carousels, commonly referred “slide shows” or “sliders”, display series of content items 1 @ time; example, series of news headlines. carousels use animations move slide slide can distracting users. may move fast automatically content hard or impossible grasp, why every carousel should have function pause animation.

Efficient dynamic Jackson configuration using Spring GET Parameters -

i have spring boot set serve json. i'd build feature user can provide white-listed parameters passed jackson objectmapper examples: json?indent_output=true json?write_dates_as_timestamps=false however can't find way without creating instance of objectmapper in each spring mvc controller method, configuring according parameters , returning pure strings. is there way reusing 1 objectmapper?

python - Update/uninstall with Pip packages installed with apt (and vice versa) -

there number of resources compare , contrast advantages , disadvantages of using apt-get , pip install, update, , uninstall python packages. what cannot find resource indicates happens if installed 1 package manager updated or uninstalled other. when run pip list , lists lot of packages installed, of on system installed apt-get , not pip . so, these 2 package managers able manage packages installed other? or, pip able manage package installed apt-get , apt-get messed afterwards. apt-get able manage package installed pip ? i recommend try , avoid using 2 (or more) package managers @ same time. it's not cooperate correctly , smoothly. if possible, pick 1 of them , use it. combine them if need to. don't. there ways of avoiding conflicts such as pip install --user <package> installs package user's directory only virtualenv allows have packages installed per application/project - idea since various projects might need different versions o...

java - Benefits of using ReentrantLock over synchronized -

this question has answer here: side effects of throwing exception inside synchronized clause? 2 answers i find out 1 more benefit of using reentrantlock on synchronized below code shows if exception occurs in critical section lock released(using reentrantlock ) void somemethod() { //get lock before processing critical section. lock.lock(); try { // critical section //if exception occurs } { //releasing lock other threads can notifies lock.unlock(); } }//end of method now using synchronized void somemethod() { //get lock before processing critical section. synchronized(this) { try { // critical section //if exception occurs } { //i don't know how release lock } } }//end of method by comparing both code see there 1 more disadvantage in using synchronized block i.e...

css - Floating Image Interrupts Hover -

i having issue image interrupting hover state. have menu mega menu drop down wordpress. have company's logo z-indexed above menu covers part of top menu , part of drop down menu. when mouse scrolls on z-indexed logo, breaks hover state , closes drop down menu. there way make image not register on hover? you can add pointer-events: none; to .top-menu-logo. works in modern browsers not necessarly html structure recommend.

r - How to make multiple file .txt from spesific column in data frame -

i have data frame contained 2 column, docs , text docs text 1 tanaman jagung seumur jagung 2 tanaman jagung kacang ketimun rusak dimakan kelinci 3 ladang diserbu kelinci tanaman jagung kacang ketimun rusak dimakan 4 ladang diserbu kelinci tanaman jagung kacang ketimun rusak dimakan 5 ladang diserbu kelinci tanaman jagung kacang ketimun rusak i want make multiple files .txts many number of id , every file containing different contents (every 1 txt file containing 1 row text in column of text). if have 5 docs-> 5 file .txt different content i have tried code for (j in 1:nrow(dataframe)) { mytitle <- format("docs") myfile <- file.path(getwd(), paste0(mytitle, "_", j, ".txt")) write.table(dataframe$text, file = myfile, sep = "", row.names = false, col.names = false, quote = false, append = false) } but, results contained 5 file.txt each file has same cont...

arrays - async.series nested in async.eachSeries loop terminates early sending POST response -

i on recieving end of post call contains array of objects (requestarray). before respond post, need pass array's objects through series of functions, in sequence. chose async library me task i'm having difficulty controlling code's execution flow. i using global array store results of each function (responsearray). of functions depend on result of prior functions. don't want use async.waterfall() because 1. i'll have rewrite code , 2. may encounter same loop termination issue. below code problematic code. app.post('/test', function(req, res) { var importarray = req.body; var iteration = 0; async.eachseries(importarray, function(data, callback) { var index = importarray.indexof(data); var element = data.element; exportarray[index] = []; async.series([ function(callback) { process1(data, index, callback); }, function(callback) { process2(element, index, callback); }, function(callba...

php - the nested while loop do not work, instead it displays unexpected '}' -

i used nested while loop retrieving data 2 different tables in sql using php browser displays unexpected '}'. tried setting nested while loop comment, executes in browser fine. checked every "}" , ";" ," " ", , "'", because think problem, don't see wrong code. can me please. thank you. <?php include '../connect.php'; $sql=mysql_query("select * subscribers order name"); while($row=mysql_fetch_array($sql)) { ?> <body> <div id="page-wrap"> <textarea id="header">sariaya cable network</textarea> <div id="identity"> <textarea id="address">name: <?php echo $row['name']; $name = $row['name']; ?> street: <?php echo $row['street']; ?> brgy/sitio/subd: <?php echo $row['brgy/sitio/subd']; ?> </textarea> ...

javascript - Making Browserify bundle play nice with ReactDevTools -

react 0.13.3 i started using browserify organize frontend react code. i'm using react developer tools chrome extension debugging. however, i'm having trouble simple react code. var react = require('react/addons'); //react dev-tools requires react on global scope. scope hidden when bundling window.react = react; var app = react.createclass({ render: function(){ return ( <div> <p>hello world</p> <!-- renders fine --> </div> ) } }); react.render( <app />, document.getelementbyid('content') ); the following code works, , "hello world" renders fine. trouble starts when start react debugger in console. expect following: <top level> <app>...</app> </top level> but instead, says: <top level></top level> how can <app> rendered without react devtools recognizing them? it seems en...

Compilers: Register Allocation Against Complex Branching/Jumps -

i've taken side interest optimizers , how work, particularly respect register allocation. have of background in writing high-level interpreters didn't bother generate efficient machine code, parts revolving around compiler construction relate parsing, constructing asts, etc. straightforward me. as learning project, i've been trying hand @ toy compiler higher level machine-level main difference being works variables rather registers. where i'm confused low-level optimizer parts, respect register allocation ir , how affected branching/jumps, basic of heuristic algorithms excluding advanced topics ssa , phi nodes. basic example: a = ... b = ... c = ... d = ... e = ... f = ... g = ... jump_if x == 1, section1 jump_if x == 2, section2 jump_if x == 3, section3 etc = + b - c * 2 jump end section1: ; kinds of stuff happens here of above variables jump end section2: ; kinds of stuff happens here of above variables jump end section3: ; kinds of stuff happens here...

php - Lightbox Next/Previous Buttons missing? -

i built dynamic gallery html , php , i'm using lightbox display images. functions when click image next , previous buttons missing , way cycle through images close current open image , open one. i found dynamic implementation here: http://www.fatbellyman.com/webstuff/lightbox_gallery/ this code of yet: <?php function lightbox_display($dir_to_search, $rel){ $image_dir = $dir_to_search; $dir_to_search = scandir($dir_to_search); $image_exts = array('gif', 'jpg', 'jpeg', 'png'); $excluded_filename = '_t'; foreach ($dir_to_search $image_file){ $dot = strrpos($image_file, '.'); $filename = substr($image_file, 0, $dot); $filetype = substr($image_file, $dot+1); $thumbnail_file = strrpos($filename, $excluded_filename); if ((!$thumbnail_file) , array_sea...

vb.net - call sub to change USERname color -

Image
i want change username color inside ritchtextbox, using code below call sub text in red? update sub addmessage(txtusername string, txtsend string) box.selectioncolor = color.red box.appendtext(vbcrlf & txtusername & "$ ") box.selectioncolor = color.black box.appendtext(txtsend) end sub private sub button1_click(byval sender system.object, byval e system.eventargs) handles cmdsend.click ' shell("net send " & txtcomputer.text & " " & txtmessage.text) try if txtpcipadd.text = "" or txtusername.text = "" or txtsend.text = "" msgbox("wright message!", "msgbox") else client = new tcpclient(txtpcipadd.text, 44444) dim writer new streamwriter(client.getstream()) txttempmsg.text = (txtsend.text) writer.write(txtusername.text + " @ " + txtsend.text) addmessage...

Regarding List<> declaration in C# -

i'm trying learn list<> in c#. made test program takes result of 3 textboxes , inputs in multiline textbox, after put them in list (to later save list file). here class declaration: public class film { public film (string num, string title, string categ) { this.numero = num; this.titre = title; this.categorie = categ; } public string numero; public string titre; public string categorie; } now instantiate list: list<film> listefilms = new list<film>(); and here event: private void btsavemovie_click(object sender, eventargs e) { var mymovie = new film(txtnum.text, txttitre.text, cbcateg.text); listefilms.add(mymovie); foreach (film x in listefilms) { txtaffichage.appendtext(x.tostring()); } } now when run, written in text box is: test_1.form1+film what did wrong? you have override to...

c# - How do I make a custom editor in visual studio 15 RC? -

i'm trying make visual studio extension custom editor in vs 15 rc , i've followed msdn tutorials , vspackage option not show under extensibility. know i'm missing or workaround this? update: appears - i've heard on msdn - issue vs 15 rc sdk. here link bug report please vote. you need visual studio sdk build own extension. you can have own extension designated preferred vs editor clicking right button , open with...-> on visual studio solution explorer. if wish have different text editor beside vs ones, same on windows explorer. edit: since ron beyer claims link provided inappropriate because of version difference(my intended purpose link latest page describes though), here page can download visual studio 2015 rc sdk . https://www.visualstudio.com/en-us/downloads/visual-studio-2015-downloads-vs.aspx

Vibration on a tablet running Windows, is it possible on .net? -

is there api or there way access vibrate controller of kind on windows based tablet? as testing device got lenove thinkpad 8 know vibrates when home button tapped. have been trying find api exposing functionality , can't find it. does has suggestion of how expose on windows? cheers! there no exposure of vibrationdevice windows @ point in time (only windows phone).

java - Unable to send large Array of parcelable objects in another actvity -

i have 2 activity first activity activity1 gets data server filters , saves in arraylist of parcelable objects while displaying loading screen. after that, activity1 passes data gathered acitivty2 displays 2 child fragments. my problem when list of data in activity1 few passed activity2 when not, acitivity 2 wont display , starts other acitivty mainacitivty instead. here function used start activity2 activity1 bundle mbundle = new bundle(); intent intent = new intent(activity_viewdata_loader.this, activity_viewdata.class); mbundle.putparcelablearraylist("mylist", sneardatalist); intent.putextras(mbundle); and here activity2 receiver bundle mbundle = getintent().getextras(); sneardatalist= mbundle.getparcelablearraylist("mylist"); and parcelable class looks this public class sentdata implements parcelable { private int _id; private string _data=""; private string _lat=""; private string _long="...

php - Multiple sessions depending on type of login? -

what i've attempted make when log in website reference type of account in database , depending on type set session variable link appropriate page work session login. issue i'm having no matter sends me login page should occur else condition when user type not detected. i'm using oracle apex database , i'm not sure why happening @ appreciated. <?php //include connection titan include 'oci_connect.php'; session_start(); $query_str = "select type_of_account user_account user_name = '".$_post["username"]."' , password = ('".$_post["password"]."')"; $stid =oci_parse($connection, $query_str); oci_execute($stid); $type =$info['type_of_account']; if($type == "customer") { $_session['type']=1; //redirect user page found through matching user id , display details, can accessed if logged in echo '<script>window.location="user.php"</...

ruby on rails - How to test log content with RSpec? -

for example, generated log(my_work.log) content as: i, [2015-05-14t00:00:00.000000 #5590] info -- : work started. i want test if my_work.log has content work started. , how do? i don't want match line include datetime, because contains #5590 , can't stub it. you can pass in instance of stringio when initializing logger capture output , match on expected content: require 'logger' describe "log" let(:log) { stringio.new } let(:logger) { logger.new(log) } let(:expected) { "work started" } "should add expected content log" logger.info(expected) log.rewind expect(log.read).to match(/.+#{expected}$/) end end

c# - AngularJS request to ASP.NET Web API 2 CORS errors -

i have set ionic framework app (running in chrome browser) , asp.net web api 2 project. have token acquisition working /token, can no longer register. i trying make request web api controller following error: xmlhttprequest cannot load http://[web api 2 project]/api/values. no 'access-control-allow-origin' header present on requested resource. origin 'http://[ionic framework app]' therefore not allowed access. response had http status code 500. i have set startup.cs file such: public partial class startup { public void configuration(iappbuilder app) { app.usecors(microsoft.owin.cors.corsoptions.allowall); configureauth(app); } } i have set webapiconfig.cs such: public static class webapiconfig { public static void register(httpconfiguration config) { // web api configuration , services // configure web api use bearer token authentication. config.suppressdefaulthostauthen...

Opening a Text File using PHP - Fixing the Format -

basically, text file contains info: with parallel , serial ----- [system info] ----------------------------------------------------------- property value machine type at/at compatible infrared (ir) supported no dmi system uuid 809ec223-dad7dd11-a2f33085-a993ffac uuid 23c29e80-d7da-11dd-a2f3-3085a993ffac disk space disk c: 89 gb available, 97 gb total, 89 gb free disk space disk d: 355 gb available, 368 gb total, 355 gb free disk space disk f: 274 mb available, 3837 mb total, 274 mb free physical memory 1724 mb total, 1173 mb free memory load 31% virtual memory 3619 mb total, 3184 mb free pagefile name \??\c:\pagefile.sys pagefile size 2046 mb in use 35 mb max used 35 mb registry size 3 mb (current), 120 mb (maximum) profile guid {bef54e40-80cb-11e2-a600...

jQuery reverting CSS back to original state -

i have added click event using jquery change css. click works , css changes, jquery continues run , reverts css original state. jquery code: $('.myclass').click(function(){ $('.myclass').css({"visibility":"hidden"}); }); css code: .myclass { height: 10px; width: 10px; background: red; visibility:visible; } like said, click works , element gets hidden. however, reverts instantly when jquery finishes running through code. using google chrome's debugger tool, see point in jquery code reverts css having element visible. jquery's code (line 4116): if ( !(eventhandle = elemdata.handle) ) { eventhandle = elemdata.handle = function( e ) { // discard second event of jquery.event.trigger() , // when event called after page has unloaded return typeof jquery !== strundefined && jquery.event.triggered !== e.type ? line 4116 jquery.event...

c++ - Overloading an operator as a member function -

i'm working on vector class , trying overload operators. i've looked @ countless examples, tried every alteration can think of, , still g++ complaining include/vector.cpp:9:38: error: no ‘vec vec::operator+(const vec&)’ member function declared in class ‘vec’ obviously g++ telling me i'm defining member function haven't declared operator member function. here code (i've omitted of working fine , not relevant): vec.h #ifndef _ben_vector #define _ben_vector #include <math.h> #include <string> #include <sstream> class vec{ public: /* constructor */ vec(double x, double y); /* operators */ vec operator+( const vec& other); private: int dims; double x; double y; }; #endif /* _ben_vector */ vec.cpp: #include "vector.h" /* constructors */ vec::vec(double x, double y){ x = x; y = y; dims = 2; } /* operators */ vec vec::operator+( const vec& other ){ vec v(this->gety() + other-...

r - Grouping data by ID or seed -

i have 100 patient's data (1 total file rbind) 2 columns (time,var1). need group data (100 groups) in order able plot 100 patient's data. i added column patientid @ end whole data, should grouped in order generate 100 plots each patient. since need data dont want split total data. i tried , didn't work: data1$id <- 1 # third column has id total <- rbind(data1,data2,....) total <- grouped.data(xdata = xdata, ydatalog = ydatalog, seed = total$id) plot(total) as example, data r works properly: str(loblolly) classes ‘nfngroupeddata’, ‘nfgroupeddata’, ‘groupeddata’ , 'data.frame': 84 obs. of 3 variables: plot(loblolly) # 1 plot each patient since data grouped solution: total.new <- # create new copy object groupeddata( ydatalog ~ xdata | id, data = as.data.frame( total ),.

c# - Create new Visual Studio MySQL MVC Project; input string was not in the correct format -

Image
i tried search how solve problem, issue happened others after have code. and error after clicking "create new mysql mvc project" in mysql tool tab, don't have code. reinstalled mysql, didn't help, so, thinking error deep, did factory reset on pc, installed visual studio , mysql, , didn't help, either. here screenshot (i don't think can understand how solve problem, if wrong?):

ios - Swift 1.2 and Parse: Issue with retrieving images to populate PFQueryCollectionViewController -

i'm working on application displays images @ locations. issue following: when user clicks on location in mapview goes empty collection view. if user pulls refresh, spinner active images not load. however, if user goes mapview , clicks on location again, images loaded in collection view. of course trying images loaded when user first goes collection view. i think small issue, after hours of trying different various recommendations different sources cannot work properly. any appreciated. thank you. here code pfquerycollectionviewcontroller : import uikit class photogridcollectionviewcontroller: pfquerycollectionviewcontroller { var savedpics: [uiimage]? func loadimages() -> pfquery { var query = pfquery(classname: "userphoto") query.orderbydescending("timetaken") return query } override func viewdidappear(animated: bool) { } override func viewdidload() { super.viewdidload() loadimages() } ove...

c++ - Simulating a mouse button press on Qt 5.3 only works the first time -

i've written @ qt5/qml application wish able control remotely web browser. i'm sending screen shot out browser , receiving position x,y in return. i've written c++ class this. when start application, image comes , first click browser works. second not work. if click anywhere in application, see button press happen on screen, , remote press work 1 more time. suspect problem focus changes , it's not being reset until click on actual application. i'm using qguiapplicatiop , far haven't been able anythong useful out of itemat or widgetat can send event appropriate object. here's code snippet show i'm doing. void wremote::mclick(int x, int y ) { qpointf *pos = new qpointf((qreal)x,(qreal)y); qwindowlist wl = qguiapplication::allwindows(); _mwindow = wl[0]; qmouseevent pevent(qevent::mousebuttonpress, *pos, qt::leftbutton ,qt::leftbutton, 0); qmouseevent revent(qevent::mousebuttonrelease, *pos, qt::le...

ios - CoreFoundation __exceptionPreprocess crash -

i getting fatal exception: nsrangeexception *** -[__nsarraym objectatindex:]: index 0 beyond bounds empty array but there no call removeobjectatindex, , happens in different view controllers. looking ideas since in lines 3-5 app given control there no symbols. the crash log fabric/crashlytics , occurred around ~30 days app release instance or number of crashes relevant. thread : fatal exception: nsrangeexception 0 corefoundation 0x00000001830502d8 __exceptionpreprocess + 132 1 libobjc.a.dylib 0x00000001948740e4 objc_exception_throw + 60 2 corefoundation 0x0000000182f3385c -[__nsarraym removeobjectatindex:] 3 appname 0x00000001000875b8 4 appname 0x000000010008698c 5 appname 0x00000001000867c4 6 libdispatch.dylib 0x0000000194ec5994 _dispatch_call_block_and_release + 24 7 libdispatch.dylib 0x0000000194ec5954 _dispatch_client_cal...

javascript - How to change first view position -

i use openseadragon 1.2.1. i want show wide image(4096 x 2160), , change first view position. x: 640px; y: 320px; width: 1024px; height:768px; crip(320px, 1664px, 1088px, 640px); html code <div id="mycanvas" style="width:1024px;height:768px;"></div> <script src="./openseadragon.min.js"></script> <script> var viewer = openseadragon( { id: "mycanvas", prefixurl: "./images/", tilesources: "./dzc_output_images/datas.xml" }); viewer.addhandler('open', function() { // want change first view position. // viewer.??? // viewer.viewport.applyconstraints(); } </script> use "class:rect / class:displayrect" or other classes ? https://openseadragon.github.io/docs/openseadragon.rect.html https://openseadragon.github.io/docs/openseadragon.displayrect.html how use these classes ? ...

Which design pattern to use on Java workflow -

i want implement code executing workflow, i'd avoid chains of if-else statements. design pattern should use? looked @ of them, couldn't find appropriate one example of workflow. a-> if(b) c, if(!b) d-> e -> if(f) g, if(!h) i-> j-> k , on.. the obvious choice consider here chain of responsibility . problem cor in cases don't know paths in advance, , laying out possible paths can painstaking. of course, use builder construct chains (remember maze building examples gang of four). the great thing cor code not become 1 big god object has powerless pawns doing each 'step.' also, cor affords lot of flexibility. if client comes , says 'omg, there 2 crucial steps missing,' can add them without destabilizing lot of other stuff. single-sourced orchestration archetypal god object antipattern, maybe start cor , plan evacuate if runs out of rope.

c++ - C++11 lambda can be assigned to std::function with incorrect signature -

the following compiles , runs (under apple llvm version 6.1.0 , visual c++ 2015): #include <functional> #include <iostream> struct s { int x; }; int main(int argc, char **argv) { std::function<void (s &&)> f = [](const s &p) { std::cout << p.x; }; f(s {1}); return 0; } why doesn't assignment std::function<void (s &&)> f = [](const s &p) { std::cout << p.x; }; generate error? function accepting rvalue reference should not have same signature function accepting const lvalue reference, should it? dropping const lambda's declaration generate error expected. to expand on existing comment , answer: the point of std::function<r(a...)> can wrap function or functor can called a... , have result stored in r . so, example, std::function<int(int)> f = [](long l) { return l; }; is peachy. so have ask when see this: if have lambda taking const t & , , have expression of ty...

xcode6 - Store related files in Xcode project? -

if have xcode project version controlled , want keep related files together, ok if added them separate group in project long files don't included in target? thinking photoshop files , like... there no technical reason why couldn't this. however, should aware if using git (which since sounds using xcode integration), git doesn't deal binary files. cause repository bloated, fact won't able merge these files @ later date. that said, tools git-annex can around some of these limitations.

c - Can't synchronize more than 2 threads with pthread_mutex_lock -

so i'm doing homework c class , came across problem. want sync acess global array pthread_mutex_lock() seems when 2 or more threads try lock @ same time bugs. here's code: #include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <time.h> #include <string.h> #include <unistd.h> #define num_threads 10 #define val 10 int numbers[49]; pthread_mutex_t mutex; typedef struct { int start; int* vec; } dados; void* threadfunction(void *arg){ dados* d = (dados*) arg; int = 0; int j = 0; int count[49]; memset(count, 0, 49); for(i = 0; < 49; i++){ for(j = d->start; j < (d->start + val); j++) { if(d->vec[j] == i+1) count[i] = d->vec[j]; } } pthread_mutex_lock(&mutex); for(i = 0; < 49; i++) { numbers[i]+= count[i]; } pthread_mutex_unlock(&mutex); free(d); pthread_exit(null); } in...

How to connect activities (android studio 1.2) -

the biggest problem of tutorials earlier version of android - , solutions don't work on as1.2. , word "deprecated" confusing android newbie. i'm trying simple app - mainactivity 1 menu option - settings. so create new project (template blank activity) , new -> activity -> settings activity. when run app main activity appears on screen, menu has 1 option setting - doesn't work - expected, because didn't add code mainactivity. after 5 days of digging , copy pasting "solutions" i'm still on same point. no reaction - still have 2 not connected activities. i'm sure have add code here: public boolean onoptionsitemselected(menuitem item) { // handle action bar item clicks here. action bar // automatically handle clicks on home/up button, long // specify parent activity in androidmanifest.xml. int id = item.getitemid(); //noinspection simplifiableifstatement if (id == r.id.action_set...

github - I have run into a Git Snafu -

i forked wrong repository , made changes want keep on local machine. (i've staged, committed , pushed on branch well). well deleted remote repo , forked correct one. i need know how can push changed on local machine new forked repo. open new tracking branch remote branch on forked repo wanted work on. use git cherry-pick , cherry-pick each 1 of commits, individually, branch made on, correct branch.

android - Viewpager PageScrollStateChanged called multiple times -

i wondering if it's normal pagescrollstatechanged, event of viewpager, called 3 times when swiping viewpager yes normal behavior. meanings of arg0 @ 3 times follows. 1 begins dragging 2 when pager automatically settling current page 0 stopped/idle. you can write code inside " if(arg0==1) " block, if want execute code if scrolling.

php - How to create a permutation of two dimensional array -

this question has answer here: finding cartesian product php associative arrays 10 answers initially, afraid, not find better title question. i have 2 dimensional array looks this, example: [0] => array ( [0] => 10,00 ) [1] => array ( [0] => 3 [1] => 4 ) [2] => array ( [0] => true [1] => false ) i'd convert/parse 2 dimensional array looks this: [0] => array ( [0] => 10,00 [1] => 3 [2] => true ) [1] => array ( [0] => 10,00 [1] => 4 [2] => true ) [2] => array ( [0] => 10,00 [1] => 3 [2] => false ) [3] => array ( [0] => 10,00 [1] => 4 [2] => false ) i hope see, result should provide sort ...

c# - XAML show which installed printer is the default -

<usercontrol x:class="myapp.printerselection" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:printing="clr-namespace:system.drawing.printing;assembly=system.drawing" xmlns:local="clr-namespace:myapp" mc:ignorable="d" d:designheight="300" d:designwidth="300"> <grid> <listbox x:name="displayinstalledprinterlistview" horizontalalignment="left" height="311" margin="10,0,0,0" verticalalignment="top" width="499" itemssource="{x:static printing:printersettings.installedprinters}" sele...

jsf - How to pass an object from a ViewScoped ManagedBean to another one? -

i'm starting work primefaces 5.2, ide eclipse luna 4.4.2, java 1.7 , jsf 2.1. i have view datatable , there's column called holding 2 commandbuttons , 1 editing , 1 deleting. when edit button pressed show modal dialog filled external xhtml file has own managedbean . i want pass selected object datatable external xhtml's managedbean fields filled information it. my excepciones.xhtml looks this: <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui" template="/web-inf/facelets/templates/plantillaprincipal.xhtml"> <ui:define name="mainbody"> <h:form id="form"> <p:datatable var="excepcion" value="#{excepcionesview.lazymodel}" paginat...