Posts

javascript - if statement with more than one condition -

i need check 3 conditions, sheet_exists = 1 recalc = 1 qty_total , new_qty_total not equal the if statement works if first 2 arguments used: if(sheet_exists === 1 && recalc === 'yes'){ //do } but when try add 3rd argument fails, actions in if statement ignored. i've tried: if((sheet_exists === 1) && (recalc === 'yes') && (qty_total !== new_qty_total)){ //do } and: if(sheet_exists === 1 && recalc === 'yes' && (qty_total !== new_qty_total)){ //do } and: if(sheet_exists === 1 && recalc === 'yes' && qty_total !== new_qty_total){ //do } where going wrong? considering happy behavior of first 2 conditions, , not last one, problem must in last one. pay attention, qty_total !== new_qty_total return true when value or type of qty_total , new_qty_total different. if 1 integer 100 , other string '100' condition evaluates true because dif...

php - creating zip of big folder with pdf files -

i'm creating zip of folder pdf , txt files, working well. creating zip of folder above 30 files ( 389 kb each file) getting empty zip. why? here's code: include("include/zip_min.inc"); if($_get['create_zip']) { include("include/zip_min.inc"); $zipfile = new zipfile(); $files_arr=scandir($_get['path']); foreach ($files_arr $folder) { if(( strpos("-".$folder,".pdf") || strpos("-".$folder,".txt") ) )//&& $k<30 { $k++; $fileonserver = $_get['path']."/".$folder;//"path/to/file/oldfilename.txt"; $filename =$folder; $zipfile -> addfile(file_get_contents($fileonserver), $filename); } } // force download zip header("content-type: application/octet-stream"); header("content-disposition: attachment; filename=test.zip"); echo $zipfile -> file(); }

artificial intelligence - Connect 4 and neural networks -

i'm trying code connect 4 - ia based on neural networks. but it's first time use ann, i'm lost... i found looks great, need explanations... structure i'm ok input, don't understand number of hiddens. also, output should number of colomn put coin next turn, means value between 1 , 7. but how these values, using sigmoid function ?

date - How to format brushed time axis (with context-dependent values) -

Image
i have x axis years 2009 - 2016 tickvalues. when select time period time widget, tick values become combination of month names , years (thank this, d3!). have 'december, 2014, february' example. selecting narrower range gives me week names , dates e.g. 'june 14'. i month names appear shortened format, e.g. dec, feb. know d3.time.format('%b'), can't set tickformat without impacting years (which come out 'jan'). how apply context-dependent tickformat d3 time scale axis? i believe looking d3.time.format.multi: for example: var customtimeformat = d3.time.format.multi([ [".%l", function(d) { return d.getmilliseconds(); }], [":%s", function(d) { return d.getseconds(); }], ["%i:%m", function(d) { return d.getminutes(); }], ["%i %p", function(d) { return d.gethours(); }], ["%a %d", function(d) { return d.getday() && d.getdate() != 1; }], ["%b %d", function...

algorithm - What is the fastest way to join multiple subsets that have similar elements? -

i have list 500+ thousand subsets each having 1 500 values (integers). have like: {1, 2, 3 } {2, 3} {4, 5} {3, 6, 7} {7, 9} {8, 4} {10, 11} after running code get: {1, 2, 3, 6, 7, 9} {4, 5, 8} {10, 11} i wrote simple code [here] compares each subset each subset, if intersect joined together, else not. ok on small scale, big amount of data takes forever. please, advise improvements? p.s. not strong in maths or logics, big o notation greek me. sorry. you're trying find connected components in graph, each of input sets representing set of nodes that's connected. here's simple implementation: sets = [{1, 2, 3 },{2, 3},{4, 5},{3, 6, 7},{7, 9},{8, 4},{10, 11}] allelts = set.union(*sets) components = {x: {x} x in allelts} component = {x: x x in allelts} s in sets: comp = sorted({component[x] x in s}) mergeto = comp[0] mergefrom in comp[1:]: components[mergeto] |= components[mergefrom] x in components[mergefrom]: c...

ibm mobilefirst - Worklight : Can we create different version of desktopwebapp -

is there way in workight can create different version of desktopwebapp can other enviornment android, ios ignore risk. there no "versioning" support mobile web , desktop browser environments in mobilefirst platform. workaround create app in project , add environment, copy/paste contents of previous app , use "version".

coffeescript - Can not load "coffee", it is not registered! Karma error message -

i trying use karma coffeescript. following preprocessor line there in karma config file: preprocessors: { '**/*.coffee': 'coffee' } but getting error - can not load "coffee", not registered! perhaps missing plugin? karma-coffee-preprocessor available devdependencies in package.json. has faced issue? thanks. i figured out solution. because of not installing karma-cli. though installing karma globally enough. after installing karma-cli fine.