Posts

java - Internal Implementation of ServerSocket.accept() method? -

everyone aware of socket programming in java. write code below: serversocket serversocket = new serversocket(1234); socket server = serversocket.accept(); we know create object of serversocket , next write serversocket.accept(); code receive client request. know serversocket.accept(); wait until new request comes. but question : serversocket.accept(); method internally? might running in while loop ? how server identify new request came serve ? internal implmentation of serversocket.accept(); method? 1 has idea this? on linux, serversocket.accept() (in native code) accept syscall (see man 2 accept ) blocks waiting suitable incoming connection. there no while loop in java code or in native code. i've no idea happens inside linux kernel, @ point no longer java question. the same apply java on windows, , c# or other programming language cared consider.

SVN to Git using svn-migration-scripts -

clone of svn repo git repo works fine. have problem java -dfile.encoding=utf-8 -jar c:\svn-migration-scripts.jar clean-git --force command listed above should convert remotes tags local ones. recieve: # creating annotated tags... tag has diverged: 1.0_rc1 creating annotated tag '1.0_rc1' @ refs/remotes/tags/1.0_rc1. # creating local branches... # checking obsolete tags... svn: e215004: authentication failed , interactive prompting disabled; see t --force-interactive option svn: e215004: unable connect repository @ url 'http://127.0.0.1/svn/dri velearner/tags' svn: e215004: no more credentials or tried many times. authentication failed deleting git tag '1.0_rc1' not in subversion. deleted tag '1.0_rc1' (was d200bf6) # checking obsolete branches... svn: e215004: authentication failed , interactive prompting disabled; see t --force-interactive option svn: e215004: unable connect repository @ url 'http://127.0.0.1/svn/dri velearner/branches...

ssis - How to apply lookup transformation column wise multiple times -

i need compare 2 data sets - excel , db. while comparing need check 4 fields say, a, b c & d columns both data sets. output should tell field not matching mismatch a, mismatch b etc. how can implement in ssis? tried implementing using lookup transformations multiple times. 1st time column , non matching records mismatch , send matching records 2nd lookup column & column b comparison. no match output 2nd lookup mismatch b this.. not working after 1st lookup. use merge join transformation. sort both inputs on join key. once merged, use derived column component evaluate columns. i.e. excelcolumna == dbcolumna ? "" : ("excel: + "excelcolumna + "; db: " + dbcolumna ) name each column mismatcha, etc.

javascript - How to create a custom scrollbar to scroll the document vertically? -

i'm running out of ideas here. i'm trying make side scroll bar control slide of whole document. can see on jsfiddle i've been experimenting couldnt work. here markup , css. can see more elaborate version @ link on bottom. welcome. html <div id="sidescroll"> <div id="sidescrollbtn"></div> </div> css #sidescroll{height:80px;width:10px;background:grey;border:1px solid black;margin:0 auto;} #sidescrollbtn{height:10px;width:10px;background:red;margin-top:10px;} http://jsfiddle.net/vinicius5581/33fx6dpr/ here's updated fiddle addresses few of issues comments. firstly, here's fiddle link: http://jsfiddle.net/dlbbntwz/ one of things wanted clean code , reduce duplication in individual up/down event handlers before. instead, have 1 function _scroller passes 1/-1 actual _scroll logic. in addition, demonstration of mouse wheel logic added. syncs up! there ugly bug, mentioned, occur if clicked do...

vb.net - DateTime : Month Diffenece Formula in VB? -

i mean, how write formula this: dec2013-feb2014, result = 3 (from december february, jump 3 time) jan2014-feb2014, result = 2 (from january february, jump 2 time) feb2014-feb2014, result = 1 (in same month 1 time) then have textbox1.text -> month before textbox2.text -> month after textbox3.text -> result button1.text, button result in textbox3.text if write textbox1.text = "20-may-2012", textbox2.text = "20-feb-2014", wanna textbox3.text = 22. if write textbox1.text = "20-may-2013", textbox2.text = "20-feb-2014", wanna textbox3.text = 10. if write textbox1.text = "20-dec-2013", textbox2.text = "20-feb-2014", wanna textbox3.text = 3 if write textbox1.text = "20-jan-2013", textbox2.text = "20-feb-2014", wanna textbox3.text = 2 if write textbox1.text = "10-feb-2013", textbox2.text = "20-feb-2014", wanna textbox...

How do I configure `Access-Control-Allow-Origin` with rails, nginx and passenger? -

Image
i cannot access-control-allow-origin show in chrome - ultimate goal configure cors fonts rails, works in production cloudfront. though, want work in development . can see header via curl , not chrome. i using rails 4.0 , , have tried of following... i have configured gemfile , application.rb per the rack-cors example rails 4 : gemfile gem 'rack-cors', '~> 0.2.9', require: 'rack/cors' config/application.rb config.middleware.insert_before 'actiondispatch::static', 'rack::cors' allow origins '*' resource '*', :headers => :any, :methods => [:get, :options, :head] end end rails console 2.0.0-p481 :001 > rails.env => "development" 2.0.0-p481 :002 > hello::application.config.serve_static_assets => true bash curl -i http://localhost:5000/assets/opensans-regular-webfont.woff content-type: application/font-woff content-length: 22660...

arrays - Dual variable assignment in JavaScript -

this question has answer here: unpacking array separate variables in javascript 7 answers if have javascript function returns 2 values, possible assign values 2 variables in single statement? for example, in python might like: (var1, var2) = function() i have tried few things tres this: this.(var1, var2) = function(); i tried along lines of: this.var1, this.var2 = function(); and this.var1 = this.var2 = function(); i attempted using single array instead of multiple variables, complicate i'm trying accomplish later on because 2 variables used story x , y coordinates. the answer yes can, works in browsers experimental technology, part of harmony (ecmascript 6) proposal, it's not recommended @ time of posting answer . see destructuring assignment docs function foo(){ return ["one", "two", "three"...