Posts

Showing posts from July, 2011

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"

javascript - jqPlot legends for donut chart not displaying color-swatches/box -

Image
i have simple problem code : $(document).ready(function(){ var s1 = [['status',600], ['pictures',800], ['starred',140], ['comments',200]]; //var s2 = [['a', 8], ['b', 12], ['c', 6], ['d', 9]]; var plot3 = $.jqplot('chart3', [s1], { seriesdefaults: { // make donut chart. renderer:$.jqplot.donutrenderer, rendereroptions:{ // donut's can cut slices pies. slicemargin: 3, // pies , donuts can start @ arbitrary angle. startangle: -90, showdatalabels: true, // default, data labels show percentage of donut/pie. // can show data 'value' or data 'label' instead. datalabels: 'label' } }, grid: { drawgridlines: true, // wether draw lines across grid or not. // *color of grid lines. background: 'white', // css color spec background color of grid. bo

ios - Where find contactPoint between 2 physics bodies ? -

i'm trying display label contact between physics bodies occurred can't find it. can me? thank you i find myself how display label on contact position between 2 physics bodies. secondbody.node called 'balloon' can follow , use position. if ((firstbody.categorybitmask & flechettecategory) != 0 && (secondbody.categorybitmask & bluecategory) != 0) { flechedidcollidewithblueballoon(firstbody.node skspritenode, balloon: secondbody.node skspritenode) } return function : func flechedidcollidewithblueballoon (fleche: skspritenode, balloon: skspritenode) { self.runaction(skaction.playsoundfilenamed("eclate.mp3", waitforcompletion: false)) println("blue") fleche.removefromparent() balloon.removefromparent() bluedestroyed++ //dysplay +1 labelscoreb.position = balloon.position addchild(labelscoreb) let moveaction = skaction.moveby(cgvector(dx: 0, dy: 3), duration: 0.3)

Perl API for MongoDB (MongoDB::Async) does not have a callback argument? -

i want benchmark mongodb perl async api. (mongodb::aysnc). when insert 70k times asynchronously in loop, receive 30%-40% response against queries mongodb. while mongodb inserts 5k times in second synchronously. can please guide me how can improve performance. and functions provided mongodb::async not have callback argument, like: #!/usr/bin/perl # # traditional first program. # strict , warnings recommended. use strict; use warnings; use benchmark; use mongodb::async; use mongodb::async::pool; use coro; use ev; use coro::ev; use coro::anyevent; $id; $pool = mongodb::async::pool->new( { host => 'localhost', port => 27017 }, { timeout => 0, max_conns => 50 } ); $it = 10; $t0 = benchmark->new; $revents; # io ( $i = 0; $i < $it; $i++ ) { async { # parallel query $id = $pool->get->mydb->users->insert( { "first_name" => "talha", "last_name" => "umair", "age" => $i

javascript - How to add Elements to DOM -

i need function creates element , adds text element , adds new element location in dom. noob this. find function don't know how automaticaly specify location can call function , example specify third argument element want append new element. function appendelement (elemnode,textnode) { var element = document.createelement(elemnode); var text = document.createtextnode(textnode); element.appendchild(text); document.body.appendchild(element); } appendelement("b","lorem"); here's way in 1 line: function appendelement (elemnode, textcontent, parent) { parent.appendchild(document.createelement(elemnode)).textcontent = textcontent; } appendelement("b","lorem", document.getelementbyid("container")); div { background-color: aqua } <div id="container"></div>

ios - CMSampleBufferRef to Audio Video for RTMP streaming -

i using ios librtmp connect rtmp server. problem is, how can send audio , video rtmp server? i've seen cmsamplebufferref used processing , sent server. data being processed flash video metadata. i tried videocore fails server using( evostream ) works other servers. medialibs works need open source option. how convert cmsamplebufferref format rtmp understands?

Android Fragments - How to change the ActionBar on a different fragment? -

i have 3 page fragment in app, need each fragment have different actionbar. 1 fragment have set current code in oncreateview method adds in edittext actionbar: //mainactivitycontext context main activity (this fragment file) actionbar actionbar = mainactivitycontext.getactionbar(); // add custom view action bar actionbar.setcustomview(r.layout.actionbar_view); search = (edittext) actionbar.getcustomview().findviewbyid(r.id.searchfield); actionbar.setdisplayoptions(actionbar.display_show_custom | actionbar.display_show_home); yet edittext stays persistent throughout of actionbar menus. want on one. have tried everything, menu.clear(); , sethasoptionsmenu(true); , inflater.inflate(r.menu.different_file, menu); , nothing has worked. any help? there approach go situation: on each fragment's onactivitycreated() method call sethasoptionsmenu(true); @override public void onactivitycreated(bundle savedinstancestate) { super

Create OpenGL object that always stays in GPU memory -

is there method create opengl object stays in gpu memory (texture or buffer)? opengl can unload objects ram memory. purpose fill gpu memory. example: have 1 gb gpu memory , app needs fill 512 mb of gpu memory. is there method create opengl object, stay in gpu memory always no. but purpose fill gpu memory. in other words try denial-of-service gpu. doesn't work. os/driver decide make space other stuff, needs drawn there , now. many oss these days rely on gpus 3d acceleration draw userinterfaces. gpu must responsive. also modern gpus have mmus , can fetch subsets of data in larger object.

separation of concerns - Rails logic best practices -

i had calculations on controller this @travel.food_expenses.map { |e| e.value * e.amount }.sum i know shouldn't have application logic on controller, created method on travel model def self.sum_food_expenses self.food_expenses.map { |e| e.value * e.amount }.sum end but return me undefined method sum_food_expenses travelscontroller as workaround put methods on applicationcontroller as: def sum_food_expenses(travel) travel.food_expenses.map { |e| e.value * e.amount }.sum end it works very messy, how should proceed? on travel model, def self.sum_food_expenses defined class method, not instance method. want def sum_food_expenses . in controller can call @travel.sum_food_expenses . edit: also, not stickler, self.food_expenses.map { |e| e.value * e.amount }.sum o(2n) , written food_expenses.sum { |e| e.value * e.amount } , o(n) .

Eclipse: Hotkey to toggle tab maximize/minimize -

often when i'm working in eclipse, i'll in perspective (say debug) , doing stuff there, want maximize file i'm looking at. double-click it, , work on it, double-click again minimize debug perspective. is there hot-key keyboard? ctrl + m maximize/restore editor area. if can't remember shortcuts, learn ctrl + shift + l . show list of available shortcuts. also: http://www.shortcutworld.com/en/win/eclipse.html#link_11 link http://www.vogella.com/tutorials/eclipseshortcuts/article.html link: maximize code tab in eclipse shortcut

String Handling in Java -

i need add 1 more predicate no_car(x),that true if worker x has no cars,i.e,if input query ?:- no_car(x). prolog should answer since using swi-prolog, can use string-based functionality: word_four_last_two(two) :- read_string(user_input, "\n", "\r", _, string), split_string(string, " ", " ", [_,_,_,word4|_]), sub_string(word4, _, 2, 0, two).

c++ - what will happen to the alloacted memory in a constructor if I throw exception from constructor? -

this question has answer here: constructor finishes throwing exception ? there memory leak? 2 answers if allocating memory pointer using new in constructor , if throw exception after allocating memory form constructor, memory reclaimed or memory leak? class { public: a() { p = new int(4); throw 1; } ~a() { delete p; } private: int *p; }; the memory not reclaimed. if correctly had destructor (and copy/assignment operator) still leak memory. any constructed sub-objects destructed after throw. in case p destructed, not confused memory pointed p being free: 2 different things , memory in fact leaked.

xml - How to append one file that includes '< >' to another in bash script -

is there way append 1 file in bash script without complaining < > characters? i'm trying append file contains xml keeps throwing syntax error near unexpected token 'newline' '<mytag>' the operation myfile.txt >> otherfile.xml i know they're placeholder characters haven't been able turn results on making them interpreted literals you need use cat : cat myfile.txt >>otherfile.xml otherwise, you're trying run myfile.txt executable; problem has nothing arrow-bracket characters embedded within file's contents. by way -- xml documents can legally contain single root, , not allowed have content outside of root, new file isn't valid xml.

html - Fonts so big in mobile <p> and other tags -

my fonts in mobile bigger desktop! (iphone 5c). i'm test em font size , nothing... , others pages h2, h4... diferents sizes in mobile css same... used reset.css , never can problem... sorry english! rsrs example: <h4 class="sub-titulo">texto</h4> ( http://visibilita.com.br/teste01/missao-visao-valores.php ) you must use css properties: text-size-adjust: 100%; -webkit-text-size-adjust: 100%;

html5 - Create fixed header table html -

i creating fixed header table, header , data not seem aligned. table created dynamically. here sample of generated html - what think should ? <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <style> /*spreadsheet*/ .row:nth-child(odd) { background: rgba(0,0,0,0.05); } /* can define rule */ .bodytable td { white-space: normal; /*text-overflow: ellipsis;*/ overflow: hidden; word-spacing: normal; font-family: sans-serif; font-size: 14px; text-align: right; } .bodytable tr { height: 20px; } .bodytable tr:hover { background-color: rgba(0,0,0,0.3); } .headertable { text-align: justify; vertical-align: middle; word-spacing: normal; bor

node.js - How to test node - ember app -

i'm wondering how can make tests simulate user interactions in app. 1.- should separately? (client side - server side) 2.- in ember's official web page notice they're using qunit make test, best option? can use one? can use in server side too? i have many questions on head right now, hope can explain me, or maybe helpful link. thanks you! use capybara. can simulate real user.

php - wp_set_object_terms() taking long execution time -

i'm working custom wordpress importer importing posts , other metadata using large csv file(may 40000 plus records in file). fine wp_set_object_terms() taking long time during import process. there may multiple terms single post category,tags or custom taxonomy. i'm using wordpress cron due large csv file , importing data after every 2 minute. cron executes after every 2 minutes , process records in chunks, pick 0-200 records 2nd time pick 200-400 records 400-600 , on. but due wp_set_object_terms() process taking more 2 minute , increases after each cron. 1st 200 records take 90 second 2nd 200 records take 93 , goes , after each cron. foreach($terms_to_set $tax => $ids ){ wp_set_post_terms( $post_id, $ids, $tax, false ); } the hosting guys told wp_set_object_terms() query time consuming , is. after disabling process goes super fast. so please let me know thoughts if have idea. thanks in advance.

c# - How to return response as Content-Type: application/x-www-form-urlencoded; from WCF service? -

after spending insane amount of time make wcf service accept requests content-type: application/x-www-form-urlencoded; (using stream suggested here best way support "application/x-www-form-urlencoded" post data wcf? ) it works. however response content-type: application/xml; charset=utf-8 <string xmlns="http://schemas.microsoft.com/2003/10/serialization/">result</string> but want content-type: application/x-www-form-urlencoded; charset=utf-8 result where can set / hacked? currently method looks this: [webinvoke(uritemplate = "generate_license", bodystyle = webmessagebodystyle.bare, method = "post")] [operationcontract] string generatelicense(stream period); ok, resolved it seems: public stream generatelicense(stream period) { stream result = new memorystream(); streamwriter sw = new streamwriter(result); sw.write("license"); sw.flush();

c++ - Ball passing through paddle from certain angles -

i'm creating pong clone school c++ , sfml 2.1 , i'm having little problem when ball hits left paddle @ sharp angles (it goes through). the right paddle works fine @ angles, , far can remember they're using same code. this code i'm using collision: (auto& : collisionpaddles) { if (this->ballshape.getglobalbounds().intersects(it->getglobalpaddlebounds())) { float deltadistance = (this->y + this->radius) - (it->y + it->height / 2); bool fromleft = true; if ((ballangle < (3*mymath::my_pi/2) && ballangle > mymath::my_pi/2)) { fromleft = false; } else { fromleft = true; } ballangle = static_cast<float>(deltadistance * (mymath::my_pi/180)); if (fromleft) { ballangle = static_cast<float>(mymath::my_pi - ballangle);

python - Django collectstatic no such file or directory -

in django 1.7 collectstatic throws exception me: oserror: [errno 2] no such file or directory: '/static' i've performed lot of collectstatic -calls , worked fine, today have issue. settings.py base_dir = os.path.dirname(os.path.realpath(__file__)) installed_apps = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'fxblog', 'rest_framework', ) static_url = '/static/' static_root = os.path.join(base_dir, static_url.strip("/")) staticfiles_dirs = ( '/static/', '/upload/', ) base_dir correct, checked it. directory base_dir/static/ exists , static files there. traceback: traceback (most recent call last): file "../manage.py", line 10, in <module> execute_from_command_line(sys.argv) file

iphone - Select an appropriate iOS version from simulators list in XCode 6.0.1 -

Image
i've installed xcode 6.0.1 complete version , came default ios 8 simulators. current project targeted ios 6 , did copy old ios simulators new xcode (as did before old versions of xcodes ). in simulators' list can't distinguish appropriate ios version. don't know of them ios 6 or ios 8 . below paths copied old simulators , respectively /applications/xcode 5.1.1.app/contents/developer/platforms/iphonesimulator.platform/developer/sdks /applications/xcode 6.0.1.app/contents/developer/platforms/iphonesimulator.platform/developer/sdks wow... why did that? simulators supported xcode 6 ones ios 7.0, 7.1 & 8.0. delete simulators , go xcode > preferences > downloads , download available simulators. afterwards simulators list should this:

c# - Serilog.Extras.AppSettings and complex objects -

i'm using serilog.extras.appsetting package, configure serilog. i'm attempting use email sink (serilog.sinks.email), can't figure out how configure network credentials property via appsetting. <add key="serilog:using" value="serilog.sinks.email" /> <add key="serilog:write-to:email.mailserver" value="localhost" /> <add key="serilog:write-to:email.fromemail" value="test@google.com" /> <add key="serilog:write-to:email.toemail" value="test@google.com" /> <add key="serilog:write-to:email.restrictedtominimumlevel " value="error" /> <add key="serilog:write-to:email.networkcredential" value="???" /> how can specify/represent networkcredential object using appsettings? possible, or limitation of appsetting approach configuration in serilog? there isn't nice way this, unfortunately. whe

javascript - AngularJS project configuration -

i'm trying make first angularjs project. i'm having problems project configuration. first created java project angularjsexample. converted angularjs project.i have configured script paths tern projects. hello.html doesn't know greeting. can please tell me why? these files: <html ng-app> <head> <script src="angular.js"></script> <script src="controllers.js"></script> </head> <body> <div ng-controller='hellocontroller'> <p>{{greeting.text}}, world</p> </div> </body> </html> var mycontroller = angular.module('myapp',[]); mycontroller.controller('hellocontroller', ['$scope', function($scope) { $scope.greeting ={ text : 'hello' }; }]); assuming you're using current stable version of angularjs, 1.2.25, need add app name ng-app directive. so, markup must be: <html ng-app="myapp">

histogram - SVM for HOG features on Matlab -

i doing svm classification problem on matlab. features hog features (length = 4356). my procedure follows. 1.extract 200 positive windows , 200 negative windows. 2.extract hog features of above samples. 2. scale features , remove nan features. (this gives 2904 features) 3. grid search , 3-fold cross validation find c , g values 4. train whole training set using best c , g 5. extract test data set hog features , scale same parameters training set. 5. test test data set i have large test data set (3000 samples) test , know inside test samples should have few (~10) positive samples. however, above process gives me 0% prediction accuracy. in fact, none of positive samples detected. detected negatives. where doing wrong? having small no of training samples (400) , large no of testing samples (3000) problem?

windows - How to configure Atom to use proxy file (pac) settings? -

Image
on windows, possible configure atom use system default proxy instead of manually specifying proxy settings in .apmrc file? i started using atom-editor windows ( windows 7 pro ) , far it. i've been searching time try , editor able connect outside world , haven't met success. our network (i'm not network expert) configured use proxy server (internal) access internet. on system, accomplished in proxy settings 'automatic configuration script', example: http://internal-server-name/sub-dir/file-name.pac . many resources have suggested manually setting proxy information in .apmrc file: not able connect atom.io themes , packages here: https://discuss.atom.io/t/is-there-any-proxy-settings/710/19 https://github.com/atom/atom/issues/1807 these not answer question need system defaults work i tried configure atom same thing when change .apmrc file have: http-proxy = http://internal-server-name/sub-dir/file-name.pac https-proxy = https://internal-se

ruby on rails - Setting Multiple Variables to Result of Query -

i have query below, return city , state shortest distance between inputted set of points , rows of table metros : @lat = row[latitude] @long = row[longitude] metros.select( "major_city , major_state ,(latitude - " + @lat + ")**2 + (longitude - " + @long + ")**2 'distance'") .group("major_city,major_state").limit(1).order('distance asc') what need set result 2 variables row[major_city] , row[major_state] major_city set row[major_city] , major_state row[major_state] . how can accomplish task 2 allow setting 2 variables independently? it comes out activerecord::relation type if 1 piece of result, use .first , take single record may work.

centos - vagrant synced_folder file permissions -

vagrant version 1.6.3 virtual box 4.3.12 vboxguestadditions-4.3.2 host os -> windows 8 guest os -> centos 6.4 this content of vagrantfile ( developer username ) config.vm.synced_folder ".", "/vagrant", disabled: true config.vm.synced_folder ".", "/var/www" # # comments-> tried many combinations # :owner=> 'developer', # :group=> 'developer' # :mount_options=> ['dmode=777', 'fmode=777'] now when try change access permissions of synced_folder(/var/www) or sub directories or files of synced_folder chmod command,the result not expected for example 1) vim testfile.php 2) ls -al testfile.php -rwxrwxrwx 1 developer developer 12 sep 23 15:52 testfile.php 3) chmod 700 testfile.php -rwxrwxrwx 1 developer developer 12 sep 23 15:52 testfile.php 4) chmod 000 testfile.php -r-xr-xr-x 1 developer developer 12 sep 23 15:52 testfile.php 5) chmod 111 testfile.

python - Odd results from simple group by -

the code below returning information not expecting. issue or missing something? import pandas pd df = pd.dataframe({'symbol':['a','b','c'], 'volume':[561,56,8]}) group = df.groupby('symbol') def f1(group): print group return group group.apply(f1) i getting: symbol volume 0 561 symbol volume 0 561 symbol volume 1 b 56 symbol volume 2 c 8 as can see issue print statement. getting group "a" twice , not sure if bug. can confirm? pandas version : '0.14.1' from pandas documentation : warning: in current implementation apply calls func twice on first group decide whether can take fast or slow code path. can lead unexpected behavior if func has side-effects, take effect twice first group. that's why method called once on first group. it's by-implementation.

MySQL Error 1064 (42000) when running UPDATE query -

can tell me wrong mysql query? query: update material_master set mst_name='xxx' mat_desc='yyy' mat_type='raw material' mat_grp='h' uom='kg' currency='inr' entity_assembled='a' idmaterial_master=3; error: 1064 (42000): have error in sql syntax; check manual corresponds mysql server version right syntax use near 'mat_desc='yyy' mat_type='raw material' mat_grp='h' uom='kg' currency='inr' entit' @ line 1 in this: update material_master set mst_name='xxx' mat_desc='yyy' mat_type='raw material' mat_grp='h' uom='kg' currency='inr' entity_assembled='a' idmaterial_master=3; you're missing commas between fields in set zone. the correct query is: update material_master set mst_name='xxx', mat_desc='yyy', mat_type='raw material', mat_grp='h', uom='kg',

java - How to add a double with a variable only using one double -

public static void main(string[] args) { scanner in = new scanner(system.in); system.out.println("insert value year (ez = 2014): "); double year = in.nextdouble(); system.out.println("insert value day (ex = 12): "); double day = in.nextdouble(); system.out.println("insert number month (ex = 3): "); double month = in.nextdouble(); double totaldays = day; if (month == 1) { } else if (month == 2) { double totaldays = (totalday + 31); } } i'm trying take totaldays double , use in if statement. want add variable without using anymore doubles. how? your code incorrectly re-declares totaldays inside conditional. re-declaring variables in inner scope not want do, though. should use same variable. use compound add-assign operator, this: totaldays += 31;

java - How to access removable storage dcim directory on android? -

i understand difference between external , removable storage. i'm making app can access pictures (so far file browser). pictures save on removable storage. when use environment.getexternalstoragedirectory(), giving me sdcard0- external. removable storage sdcard1- how can access this? thanks help!

API for C# for video to frames converstion -

aoa , hii i searching api can used in c# , extract frames video. i developing multimedia player need api. anyone can send me link or helpful info this? ? thanks in advance. you can use ffmpeg wrapper aforge framework in aforge.video.ffmpeg assembly. the class reading video frames videofilereader here sample: using system; using aforge.video.ffmpeg; namespace tef { static class program { private static void main() { var reader = new videofilereader(); reader.open(@"your video here"); // video attributes console.writeline("width: " + reader.width); console.writeline("height: " + reader.height); console.writeline("fps: " + reader.framerate); console.writeline("codec: " + reader.codecname); // read video frames while (true) using (var videoframe = reader.re

What is the recommended way to work with multiple (nested) SQL Server queries using C#? -

i have scenario query sql server db, obtain results, , based on results, make subsequent queries db again. following how i've structured code same: what i'm interested in knowing is, correct way deal such scenarios? should doing else alternatively? like, make first call db, load results in dictionary, make next calls , use result stored in dictionary make these next calls (if feel need context on code - want add uniqueness constraint , index on columns cola, colb, , colc on mytable, can't directly apply uniqueness constraint. there existing violations on these columns. first resolve these violations changing value of colc entries cause violation, , after fixing violations, add constraint) void main() { using(sqlconnection connection = new sqlconnection(@"data source=localhost; initial catalog=mydatabase; integrated security=true; multipleactiveresultsets=true")) { connection.open(); //check if index exists on columns cola_col

c# - "00000000000000000000000000000" matches Regex "^[1-9]|0$" -

in .net4.5, find result of system.text.regularexpressions.regex.ismatch( "00000000000000000000000000000", "^[1-9]|0$") is true. the result expect false. don't know why. can me? update : in beginning, validating regular expression ^-?[1-9]\d*|0$ used match integer found on internet , find string multiple 0 matches regular expression. the issue alternator's binding behavior. default (i.e. without using grouping), expression containing alternator ( | ) match either value left of alternator, or value right. so in expression, you're matching either 1 of these: ^[1-9] 0$ your call ismatch method returns true because second of 2 option matches string 00000000000000000000000000000 . to restrict alternator's binding specific part of expression, need group using parentheses, follows: ^([1-9]|0)$ putting together, strict expression validate integers, disallowing leading zeroes , negative zero, this: ^(-?[1-9][0-9]

linux - Bypass the use of Domain in WinEXE -

is there way bypass use of domain in winexe command?: winexe -u domain/username%password //hostname "cmd.exe" i have 2 pcs. 1 running on windows , other in linux. these 2 machines not have domain server. simple local area network. both pcs have administrative accounts please help. thanks after exploring, resolved issue using .\ variable domainname. .\ default value local area network.

c++ - Eigen multi-thread operations -

eigen c++ template library linear algebra ( site ). according documentation, newer eigen versions support usage of openmp take advantage of multi-threading characteristics. official documentation mentions some operations can ran in paralell ( documentation ). however, -concrete- operations susceptible of these advantages not mentioned in place. place have been able find states matrix , vector multiplication can ran in parallel, no more information provided ( here ). i appreciate if share bit of knowledge uncertainty. from eigen's source directory: $ find eigen -type f | xargs grep -i openmp ...shows general matrix matrix product (gemm) using openmp (for now!).

jquery - AngularJS - Styles not applying on appended html -

i want inject html result of rendering django template. django template: class cview(view): def get(self, request): return render_to_response('my_template.html', {},content_type="application/json") the resulted html displays correctly when hardcoded. want inject received html code div. problem bootstrap accordion component doesn't display. text. code in angular controller: $scope.myhtml = '<div>loading..<div>'; $scope.to_trusted = function (html_code) { return $sce.trustashtml(html_code); } dataservice.getmyhtml().success(function (data) { $timeout(function () { $scope.$apply(function () { $scope.myhtml = data; }) }, 0); }).error(); html code: <div ng-bind-html="to_trusted(myhtml)"></div> myhtml holds this: <div class="col-sm-3 col-md-2 sidebar"> <accordion close-others="true"> <accordion-group>

android - Convert Key object to PrivateKey -

i need use following method keystore class: public key getprivatekey(string alias) but on end need privatekey object, not key. how can convert key object privatekey? thanks! after key key key store create key pair , pub , priv key pair key following: key prvkey = keystore.getkey(_alias,_keypass.tochararray()); publickey pubkey = certificate.getpublickey(); keypair keypair = new keypair(pubkey, (privatekey)prvkey); privatekey privkewy = keypair.getprivate();

javascript - Something wrong with my toggleclass -

there wrong jquery script. kinda works, when try toggle between classes works @ first. script changes classes it's supposed to. when try again, have click link , somewhere else, , works again. want able repeat whole procedure on , on without having click 2 times. var clickonsettings = true; $(".settings_link").click(function () { event.preventdefault(); if (clickonsettings) { $("#coverup").toggleclass("cover1"); $("#settingani").toggleclass("settings1"); clickonsettings = false; } }); $("#coverup").click(function () { if (!clickonsettings) { $("#coverup").toggleclass("cover2"); $("#settingani").toggleclass("settings2"); clickonsettings = true; } }); created jsfiddle: http://jsfiddle.net/5dzt1v6f/13/ if toggle 'cover1', toggle between having , not having 'cover1' on element. not impl

java - ArcGIS GeoEvent Processor - javax.xml.ws.soap.SOAPFaultException: Unmarshalling Error -

background i'm using wsimport create java webservice client, connecting .net webservice returning datasets (unfortunately). more specific i'm working on project (inbound transport) geoevent processor suite of esri arcgis server 10.2, think might answered on more general terms in relation jaxb , wsdl bindings. bear me haven't touched java since college (10+ years). for purposes of wsdl, .net dataset polymorphic type actual layout isn't determined until run time, after dataset has been filled data. causes problems when want use webservice .net. after research i've managed use wsimport generate webservice wsdl. able put basic proof of concept program gets results webservice dom, walks dom nodelist. reference: jax-ws error on wsdl file: "error resolving component 's:schema'" https://weblogs.java.net/blog/vivekp/archive/2007/05/how_to_deal_wit_1.html the section on toolkit bindings , figure 6 in http://msdn.microsoft.com/en-us/m