Posts

Showing posts from March, 2011

indexing - Excel index or vlookup? -

Image
i'm trying report shows top 10 senders of emails each month. on worksheet 1, have in column date jan-2015, feb-2015 etc, in column b list of email addresses, , in column c total number sent users in each month. on worksheet 2, i'd results show have date ddl, jan-2015, feb-2015 select , on. what (if it's possible) when select date on worksheet 2, pull top 10 highest amount of emails sent , corresponding user , when change date i'd information update. an example of spreadsheet this. 1 i'm working on has alot more information should give general idea. date sender amount sent jan-15 john@email.com 12 jan-15 david@email.com 23 jan-15 claire@email.com 45 jan-15 paul@email.com 56 jan-15 ross@email.com 78 feb-15 dayna@email.com 89 feb-15 ben@email.com 65 feb-15 gary@email.com 32 feb-15 jim@email.com 15 mar-15 james@email.com 48 mar-15 luke@email.com 78 mar-15 rebecca@email.com 96 then on worksheet 2, a1 ddl select date ranges. a

convert one factor to another in R -

i have dataframe division | category | tools | work b | tools b | tools both columns factor variables. how convert tools tools? i tried df$category <- as.character(df$category) df$category <- lapply(df$category, function(x) { tolower(x) } ) df$category <- as.factor(df$category) but last command get: error in sort.list(y) : 'x' must atomic 'sort.list' have called 'sort' on list? what mean? the error means you've tried factor list, although not in words. triggered because used lapply() , returns list. , in situation as.factor() calls factor() , in turn calls sort.list() here: ## factor() if (missing(levels)) { y <- unique(x, nmax = nmax) ind <- sort.list(y) ... } which error occurs. as.factor(list(1, 2)) # error in sort.list(y) : 'x' must atomic 'sort.list' # have called 'sort' on list? long story short, can use tolower() without la

python - Searching and counting dictionary key value pairs -

if have dictionary dict = {'brown dogs':3, 'dog of white':4, 'white cats':1, 'white cat':9} how a) search key substrings b) sum values of selected so result: ('dog', 7) , ('cat', 10) you can use collections.counter . from collections import counter d = {'brown dogs':3, 'dog of white':4, 'white cats':1, 'white cat':9} substrings = ['dog', 'cat'] counter = counter() substring in substrings: key in d: if substring in key: counter[substring] += d[key] print(counter.items()) output: [('dog', 7), ('cat', 10)]

java - Why I cannot declare obj class as public? -

i'm trying declare obj class public says class obj public should declared in file named obj.java . public class obj { string name; public void show() { system.out.println (name ); } } public class objects { public static void main (string args[]){ obj object 1=new obj (); object1.name="sam"; object1.show(); } } the answer in question. file not called obj.java. have classes in separate files: obj.java , objects.java. by way, java convention start class names uppercase, e.g. obj instead of obj. also, want pick more descriptive names.

java - How to automatically display a foreign keyboard instead of default English keyboard on the type panel? -

i'm making questions , answers game in language other english. questions in nepali (similar indian) , user needs type answers in same script. when run app english keyboard gets displayed , i've switch nepali keyboard before typing. there anyway when user taps type panel, automatically displays nepali keyboard instead of english (as english keyboard primary keyboard in every phone)? upon searching on net found this: private void showinputmethodpicker() { inputmethodmanager imemanager = (inputmethodmanager) getapplicationcontext().getsystemservice(input_method_service); if (imemanager != null) { imemanager.showinputmethodpicker(); } else { toast.maketext(this, r.string.not_possible_im_picker, toast.length_long).show(); } } but i'm not sure does. please help! you can do, in activity want have keyboard in different language. if have many activities want have keyboards in language. resources res = context.getresources();

linux - Command not working in EC2? -

none of commands working in ec2 machine. -bash: id: command not found -bash: id: command not found -bash: id: command not found -bash: tty: command not found -bash: mktemp: command not found -bash: $tmp: ambiguous redirect -bash: rm: command not found -bash: vim: command not found i guess did changes in /etc/environment setting path of java , after time not able run of commands in next login. anyone please help, should in order run these commands again? i screwed appending path using export path=$path: in /etc/environment file, not aware $path not work there in /etc/environment. how found problem ? a- used command "which ls" showed me ls command location , /usr/bin , shows path not contain this. how solved problem ? a- none of command working not vi command there option left : path=$path:/usr/bin export path and after doing , able sudo on machine. i hope ,it can helpful other person mistakenly screwed his/her environment.

fortran - Not reading Input file to run stress autocorrelation function -

i trying run stress autocorrelation function code calculate stress autocorrelation function,then there calculate viscosity using green -kubo equation. fortran code have not read out stress data in order calculate stress auot-correlarion function. can please me this. have attached code , data want correlate. hope here soon. here error ./a.out **** program stress_autocorrelation **** calculation of time correlation functions enter data file name dfile enter results file name rfile 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 @ line 106 of file main.f95 (unit = 10, file = 'dfile') fortran runtime error: bad value during floating point read code , below input data: ! program claculate pressure autocorrelation function program stress_autocorrelation implicit none common / block1 / stora, storb, storc, stord,store,storf,storg, storh, stori common / block2 / pa, pb, pc, pd, pe, pf, pg, ph , pi commo

java - tomcat remote debug mode in linux -

i setting tomcat in debug mode. tomcat server running on different machine , working on different machine. before starting tomcat executing following linux command. iptables -i input -m state --state new -m tcp -p tcp --dport 9003 -j accept export jpda_address=9003 export jpda_transport=dt_socket export jpda_suspend=n bin/catalina.sh jpda start in eclipse providing ip address of remote machine , port number 9003. my ./catalina.sh file given below. still not able see green color debug pointers @ breakpoint. ? eclipse doesn't throw exception while connecting remote machine. earlier throwing 'connection failed' once executed following command rectified, not able see breakpoints after have given breakpoints. iptables -i input -m state --state new -m tcp -p tcp --dport 9003 -j accept my cataline.sh file. #!/bin/sh # licensed apache software foundation (asf) under 1 or more # contributor license agreements. see notice file distributed # work additional in

oauth 2.0 - AeroGearOAuth2 Swift Retrieve Google Contacts -

i trying make contact management/social network application , using aerogearoauth2 after following tutorial ray wenderlich website . have modified try , first authenticate user, using closure in swift attempting retrieve user's contacts. have used google oauth2 playground play around scopes , url's keep receiving value of 'nil' on inner response. feel must jsut forgetting painfully obvious. wasn't entirely sure how attach header of 'gdata-version:3' winged that. problem. here function retrieve contacts: @ibaction func getgooglecontacts(sender: anyobject) { let googleconfig = googleconfig( clientid: ${my_client_id}, scopes:["https://www.googleapis.com/auth/userinfo.email","https://www.google.com/m8/feeds/contacts/default/full"]) let gdmodule = accountmanager.addgoogleaccount(googleconfig) self.http.authzmodule = gdmodule let header

c - My Circular Queue implementation is not working properly -

i have created program implement circular queue insert, delete , display. insertion working fine , deletion once try enter numbers after deletion, nothing displayed. here source code: #include<stdio.h> #include<conio.h> #define size 5 int front = -1; int rear = -1; int queue[size]; void enqueue(int item); int dequeue(); void display(); void main() { int item, choice, cont = 1; clrscr(); while(cont == 1) { printf("\n1.enqueue queue.\n"); printf("\n2.dequeue queue.\n"); printf("\n3.display quesue elements\n"); printf("\nenter choice: "); scanf("%d",&choice); switch(choice) { case 1: printf("\nenter value of item: "); scanf("%d",&item); enqueue(item); break; case 2: item = dequeue(); if(item != null)

javascript - continue in js program after finishing ajax calls -

i have function 3 ajax calls var loadeditmodaladdressdata(){ loadcountries(); loadstates(); loaddistricts(); }; i want js wait, until ajax calls finished. part of code loadeditmodaladdressdata(); $(document).ajaxstop(function(){ // functionality using requested data .... } this worked fine, until added features , figured out $(document).ajaxstop called after every complete request(or bunch of requests),not in function scope, mash code functionality. how do that? the dirty way use counter in ajaxstop make sure 3 calls have returned. better way add callbacks each of calls , launch treatment when last received. however, best way use promises. if use jquery calls, can stuff like: $.when(call1, call2, call3).then(function(results){ // stuffs }); where callx returns $.get (or other jquery promise). have here .

javascript - Bad scrolling behavior specially due to dispatchOnMessage -

Image
i'm experiencing bad scrolling behavior in site, & when trying investigate using chrome's dev tools & recorded happening, found bad performance hit in calling function dispatchonmessage (which called multiple times while scrolling) chrome's extensions::messaging file, don't know how related code in first place! & here function itself: i've upgraded knockout 3.3.0, & when downgrading previous 3.1.0, problem still exists. i've noticed performance hit due using enscroll jquery plugin (although smaller dispatchonmessage function), after disabling it, problem still exists. i'm investigating on chrome version 44.0.2403.157 (64-bit), & when trying firefox 40.0.3, problem still exists. is there anyway investigate more on how happening?

A* algorithm vs uninformed search -

in case a* algorithm becomes same uninformed searching algorithm. a* search algorithm decays dijkstra's algorithm admissible heuristic function h(v) = 0 v , since in case f(v) = g(v) + h(v) = g(v) + 0 = g(v) , , chose best first. pretty equivalent dijkstra's algorithm. for unweighted graph, dijsktra's algorithm variant of bfs , can (a*) decays bfs in unweighted graphs h(v) = 0 .

Grails 3.0 How to use Javascript in GSP's? -

the documentation says, < r:script > right way this, part of resources plugin , not available in grails 3.0, think in single gsp right way use javascript @ end of <body> < g:javascript >-tag. is there better way this? you can use <asset:javascript src="example.js" /> @ bottom of gsp file. however, sitemesh inserts body <g:layoutbody /> in layout gsp, there end being other tags between <script> , end of <body> . cleaner create separate layout gsp. also, sure not include example.js in application.js or else special js file end on every page default. 1 option create assets/javascripts/public folder else. grails-app/assets/javascripts/application.js //= require_tree ./public

android - How to create software applications in Python? -

how go creating software applications in python? went on github taste of how design code software application on android. don't understand how multiple programs work in bundle 1 software application run. also, modules need, besides tkinter, distutils ? this impossible question answer open ended. however, let me try answer couple of questions. when "i don't understand how multiple programs work in bundle 1 software application run", getting @ idea have seen several scripts / files of code combine run piece of software? if seeing various 'programmer created' modules of code called main program (a 'central' script file) when main program requires it. in terms of 'standard library' modules need, depends on wish create. if gui might use tkinter, or if wish have database in software may wish use sqlite3. if wish create android software python, read on 'kivy' library. you may stick question open, however, advice ignore , g

angularjs - AJAX GET from S3 CORS fails on preflight OPTIONS with 403 -

i saw several issues , talk on this, still couldn't find answer. i'm trying simple file s3 ajax get. bucket configured cors: <?xml version="1.0" encoding="utf-8"?> <corsconfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <corsrule> <allowedorigin>*</allowedorigin> <allowedmethod>get</allowedmethod> <maxageseconds>3000</maxageseconds> <allowedheader>*</allowedheader> </corsrule> </corsconfiguration> here curl snippet call (omitted file..): curl 'https://s3.amazonaws.com/mybucket/myfile.tar.gz -x options -h 'access-control-request-method: get' -h 'origin: http://0.0.0.0:9000' -h 'referer: http://0.0.0.0:9000/' -h 'access-control-request-headers: accept, x-longtostring' -h 'pragma: no-cache' -h 'accept-encoding: gzip, deflate, sdch' -h 'accept-languag

php - Load layout once in Fat-Free Framework -

i think should have pretty simple explanation i'm still learning fat-free framework (f3): how render once header , footer , switch out content code selected route? have code: $f3->route('get /', function($f3) { $f3->set('content','views/welcome.htm'); $f3->set('page_head', 'welcome'); } ); and if add line: echo view::instance()->render('layouts/header+footer.htm'); either after f3->set calls in route or after $f3->run(); @ end of index.php file, whole page refreshes on route change. can't call echo line above before route code without throwing error in content box. is there way disable page refreshing? being refreshed because links being interpreted separate pages browser? help! your question little hazy. try answer in way understand. first index.php $f3->route('get /', function($f3) { $f3->set('content','views/welcome.htm'); $f3

javascript - Conditional evaluation of callback arguments -

recently i've been getting javascript ecosystem. after sometime javascript's callbacks started asking myself if javascript interpreters capable of doing conditional evaluation of callback arguments. let's take following 2 example: var = 1; var b = 2; // example 1 abc.func(a, b, function (res) { // res }); // example 2 abc.func(a, b, function () { // }); from understand, javascript uses arguments object keep track of passed function. regardless of function definition is. assuming that: abc.func = function (a, b, cb) { // stuff var res = {}; // expensive computation populate res cb(res); } in both examples (1, 2) res object passed arguments[0] . in example 1 res === arguments[0] since res parameter defined. let's assume computing res expensive. in example 1 it's ok go through computation since res object used. in example 2, since res object not used, there no point in doing computation. although, since arguments object needs populat

javascript - Hybrid mobile apps -

so i'm looking javascript interpreter both ios , android. don't want compile code because javascript code won't available until in runtime. let me explain better: basically, i'm looking hybrid application written in obj-c , java ios , android, respectively, , using tools nativescript, titanium, etc, small part of app. know it's not possible using nativescript (i asked) i'm not sure titanium. possible have 1 page in app using titanium (or other tools know) , leave rest native code? no, don't think can titanium, sorry.

angularjs - I can't select a default value from a select option -

Image
i have problem in selecting default value of select option when try load page,this code: <select ng-model="sortkey" class="ng-valid ng-pristine"> <option value="lastname" selected="selected">nom</option> <option value="firstname">prenom</option> <option value="class">classe</option> </select> i have used selected="selected" attribute have problem thanks help this demo: <select ng-model="sortkey" style="border-radius: 20px;width: 135px;height: 32px;margin-left: 0px;margin-right: 22px;" class="ng-valid ng-dirty ng-pristine"> <option selected value="lastname" >nom</option> <option value="firstname">prenom</option> <option value="class">classe</option> </select>

jquery - Mobile Drop Down Menu -

my menu works fine in browsers , under mobile preview in chrome. if load site on mobile device menu expands display submenus. when click on submenu, instead of clicking on link collapses menu menu. css /* nav */ .nav { padding-top: 50px; margin-bottom: -2px; } .nav ul { list-style-type: none; } .nav ul li { font-size: 15px; line-height: 1.6; text-transform: uppercase; font-family: 'myriad'; float: left; position: relative; } .nav ul li { color: #687074; display: block; padding: 5px 25px; border-bottom: 2px solid #e5e5e5; transition: color .2s, border-color .2s; } .nav ul li .fa { margin-left: 5px; } .nav ul li.current a, .nav ul li a:hover { color: #d35400; border-bottom: 2px solid #d35400; } .nav .open > a, .nav .open > a:hover, .nav .open > a:focus { background-color: #fff; border-bottom: 2px solid #d35400; } .nav ul li .dropdown-menu { box-shadow: 0 3px 3px rgba(0, 0, 0, .15); border: 0; border-radius: 0; margin-top: 0; padding: 0; } .nav ul li .dro

esper - Nesper engine/C#: issue in internal current time -

i'm using nesper engine ( http://www.espertech.com/esper/nesper.php ) in c# , i'm facing issue. when trying retrieve engine's internal time, date returned seems wrong date of yesterday. the code below dummy sample reproduced problem. understand 'enginetime' , 'datetime.utcnow' should equal, not case. using com.espertech.esper.client; using system; namespace nesperdate_bug { class program { static void main(string[] args) { epserviceprovider _espersvc = epserviceprovidermanager.getprovider("test", new configuration()); datetime enginetime = nesper2datetime(_espersvc.epruntime.currenttime); console.writeline("esper engine time:\t" + enginetime); console.writeline("system utc time:\t" + datetime.utcnow); console.readkey(); } private static datetime nesper2datetime(long millisec) { return new

parse.com - Parse GCM push notifications not working on Android 6.0 Marshmallow Developer Preview 3 -

i have registered necessary permissions, services, , broadcast receivers in androidmanifest.xml , have parse push notifications working on pre android m devices. getting error (posted below) in android 6.0 marshmallow developer preview 3 running on nexus 5. user registering , can view in parse dashboard on parse.com, pushtype , devicelasttokenmodified undefined . can't think issue parse sdk considering working fine on pre android m devices. issue android m's permission changes, except none of permissions requesting fall under category ask user grant it. here error:: 08-30 19:29:19.671 11848-11848/com.example.app v/com.parse.manifestinfo﹕ cannot use gcm push because app manifest missing required declarations. please make sure these permissions declared children of root <manifest> element: <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state" /> <u

java - I cannot access Robots.txt in Spring-MVC -

i trying give access robots.txt in spring-mvc. test code, put robots.txt in webcontent , root , web-inf cannot access of them. i've applied answers of these questions 1 , 2 , 3 no avail. mycode <mvc:resources mapping="/resources/**" location="/resources/" /> <mvc:resources mapping="/robots.txt" location="/robots.txt" order="0" /> <mvc:annotation-driven /> this works me: put robots.txt directly under webapp in mvc-dispatcher-servlet.xml have: <mvc:default-servlet-handler/> <mvc:resources mapping="/resources/**" location="/, classpath:/meta-inf/web-resources/" /> use maven build war

jquery - How to make an array of arrays from a javascript object? -

i have object this: {"peppermint":"50","chocolate":"50"} i want turn this: [['peppermint', '50']['chocolate', '50']] using jquery map function so: var array = $.map(data, function(value, index) { return [value]; }); gives me without keys: ["50", "50"] you have return inner array both values in , has embedded in array. need level of array because jquery doc $.map : a returned array flattened resulting array. so, need code working snippet: var data = {"peppermint":"50","chocolate":"50"}; var array = $.map(data, function(prop, key) { return [[key, prop]]; }); document.write(json.stringify(array)); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

jquery - How to mask out a section of a div to see behind it? -

i'm looking way mask out part of div behind visible. looking @ example, replace black circle sort of mask, slides down text being revealed (or background image) can seen behind it. jsfiddle jquery(document).ready(function() { $('.img').click(function() { $('.mid').slidetoggle('slow'); }); }); if want use css, there creative solution problem. seperate horizontal part "black hole" others 3 parts: left of circular hole, hole, , right part. in hole part put div no background , border suitable border radius. fixed width , height measurements, further seperation should no trouble. best example how whale : http://www.subcide.com/experiments/fail-whale/ this applicable chomre 4.0+, ie 9+, firefox 3+, safari 3.1 , 5 opera 10.5 make sure include corresponding prefixes (-moz- , -webkit-)

Getting a HTTP 404 error when doing app.post in Node.js -

i newbie node.js trying learn through tutorials found online using netbeans. when do: http://localhost:9080/ see date , color expected. when try http://localhost:9080/add , see app.post part, http 404 error. could let me know doing wrong. thanks in advance, ind.ejs <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> </head> <body> <h1> app </h1> <%= new date() %> color is: <%= test %> </body> </html> index.js: 'use strict'; module.exports = require('./lib/express'); var http = require('http'); var express = require('express'); var path = require('path'); var ejs = require('ejs'); var app = express(); var tropo_webapi = require('tropo-webapi'); var bodyparser = require('body-parser'); var test; var app = express(); //app.use(bodyparser()); app.set('

jquery - How to work with a single instance of an object in javascript? -

so attempting apply several different animations single class ".box". in code have single animation , i'm going add more , create array applies animations in order, current code i'm not sure how apply each animation each instance of ".box" class without making ".box 1, .box 2, .box 3" , looping through. if i'm wrong in thinking please let me know, feel there way this. here current code: <html> <head> <meta charset="iso-8859-1"> <title>css animation practice</title> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> </head> <style> html,body { height: 100%; width:100%;} body{ margin:0px; padding:0px; } div{ } .container{ text-align: center; } #dancebutton{ position:relative; font-size: 2.0em; margin-top:100px; margin-bottom:100px; left: 50%; right: 50%; } .boxborder{

android - Using AsyncTask in PreferenceFragment -

i tring create sharedpreference save authentication info third party service. in preferences.xml there login , password fields check if values valid (authenticate) when edited. approach? so far, have this: on create findpreference("sync_service_enabled").setonpreferencechangelistener(this); findpreference("sync_service_user").setonpreferencechangelistener(this); findpreference("sync_service_pwd").setonpreferencechangelistener(this); my listener public boolean onpreferencechange(preference preference, object newvalue) { if (preference.getkey().contains("sync_service")){ new authenticationremoteasynctask(this.getactivity(), user, password, service).execute(); } return true; i need save token generated remote service need wait aynstask finished. any sugestion? i resolved problem criating custom dialogpreference. replaced positive button onclicklistener dont close dialog automatically , start remote task. a

java - Finding a specific nibble in an integer -

how go finding nibble in integer using bitwise operations? i need extract given nibble, specifically. the method looks this private int nibbleextract(int x, int whichnibbletoget) and example on method return nibbleextract(0xff254545, 7); // => 0xf you can shifting number 4 times nibble index, , masking 0xf : int nibbleindex = 7; int data = 0xff254545; int nibble = (data >> 4*nibbleindex) & 0xf; how without multiplication? like this: int nibble = (data >> (nibbleindex << 2)) & 0xf; modern optimizers convert 4*x x << 2 you, 2 alternatives turn out give same performance (while first 1 of course more readable).

apache - .htaccess conversion of directories (and sub-directories) to query string -

i'm sure has been asked here before, can't find answer. it's quite simple, i'm sure. want take url like example.com/article/3xamp1e/some-sort-of-title and convert example.com/article?handle=3xamp1e through htaccess rewritecond in apache. this should work : rewriteengine on rewritecond %{the_request} /article/([^/]+)/([^\s]+) [nc] rewriterule ^ /article?handle=%1 [nc,l,r]

haskell - What's the difference between `stack install NAME` and `NAME` in the build-depends of project.cabal file? -

what difference between adding package_name under build-depends: section in project's .cabal file , versus doing stack install package_name within project's directory? stack install install package appropriate place (the current snapshot database libraries in stackage, sandbox in ./.stack-work other libraries, ~/.local/bin or system's equivalent thereof executables). adding library build-depends specifies dependency of project, , leads library being installed next time stack build . if using library in project must add build-depends , otherwise won't able build project (or play library using stack ghci ). n.b.: of stack-0.1.3.1, stack install name synonym stack build --copy-bins name . --copy-bins option tells stack copy executables ~/.local/bin . if package library no executables, stack install name same stack build name .

Matching multiple attribs with elasticsearch -

so have bunch of records {a: x, b: y} . i construct search query match both a , b attrib. however, adding 1 more criteria match , query fail parse. this works. { "query" : { "match": { "a": "x" } } } this doesn't. { "query" : { "match": { "a": "x", "b": "y" } } } it should this: { "query": { "bool": { "must": [ { "match": {"a": "x"} }, { "match": {"b": "y"} } ] } } } use must and match clauses, use should or match clauses.

javascript - String replace from JSON -

i have json response not formatted , has speical characters coming in , want clean removing special characters using string.replace(). reason not working. here json result [{"user::newpassword":["password not changed. request can't validated"]},[]] and here expression. resp.replace(::g, ''); but doesn't seem work. advice on appreciated there nothing can on backend. you cannot use replace() on json. if you're working strings :: should in quotes if want replace first occurrence of it. resp.replace('::', ''); if want replace occurrences, use / delimiter of regex. resp.replace(/::/g, ''); if you're working json convert json string using json.stringify() use replace on string convert string json using json.parse() using object methods you can change key remove :: it var newkey = key.replace('::', ''); // create new key replacing `::` obj[newkey] = obj[k

python multiprocessing: processes don't work -

i want assign computing jobs more 1 cpu, choose multiprocessing. however, result not want. import numpy np multiprocessing import process def func(begin,end): print('*'*5) print('begin=%d' %(begin)) in range(begin,end): j in range(10): myarray[i][j]=1 myarray=np.zeros((12,10)) print(myarray) in range(4): begin=i*3 end=(i+1)*3 p=process(target=func,args=(begin,end,)) p.start() print('*'*5) print(myarray) i think myarray should ones. doesn't change @ all. why? func function not change elements of myarray? tried example link enter link description here from multiprocessing import process def f(name): print('hello',name) p=process(target=f,args=('bob',)) p.start() it shows nothing on screen. why? how should finish computation python? can give way of take advantage of multi-cpus? there 2 problems there: when print array @ end, how know processes have finished? need in

c# - Datatables columnfilter date-range not working (undefined~undefined) value on date -

i'm having problem jquery datatables date range filtering. i'm getting ( ssearch_0 = undefined~undefined ) value bootstrap datepicker. when put null value on first column instead of type: "date-range" , 3rd column filter working fine. (function ($) { $(document).ready(function () { // implements datatables plugin on html table var otable = $('#transactionhistorydatatable').datatable({ "bjqueryui": true, "spaginationtype": "full_numbers", "bserverside": true, "sajaxsource": "api/sitecore/account/dataprovideraction", "bprocessing": true, "aocolumns": [ { "sname": "date", "bsortable": false }, { "sname": "name", "bsortable": false }, { "sname": "bracket", "bsortable": false }, { "sname

sql - What's the best way of using Case When Statement for 100 or more products -

here table "sellers" +------------+---------+----------+ | seller_id | product | units | +------------+---------+----------+ | seller_123 | a1 | 10 | | seller_123 | b2 | 20 | | seller_123 | c3 | 70 | +------------+---------+----------+ from here can see "seller_123" main product group c3 because units focus in c3 70 units. here trying achieve +------------+-------------+ | seller_id | main_product| +------------+-------------+ | seller_123 | c3 | +------------+-------------+ here current sql query with temp ( select seller_id ,sum(case when product = 'a1' units end) a1_units ,sum(case when product = 'b2' units end) b2_units ,sum(case when product = 'c3' units end) c3_units sellers group s

javascript - refactoring working recursion code (hasFiveDIVs) for traversing the DOM -

@oriol provided amazing 2 line recursive solution problem working on today. function numoccurencesrecursive(arr, val) { if (!arr.length) return 0; return (arr[0] === val ? 1 : 0) + numoccurencesrecursive(arr.slice(1), val); } i inspired refactor spagetti-ish code wrote yesterday: //returns boolean function containsfiveormoredivs(domelement) { var count = 0; function docount(domelement) { if (domelement && domelement.tagname === "div") { count++; } if (count >= 5) { return true; } if (domelement.haschildnodes()) { var children = domelement.childnodes; (var = 0; < children.length; i++) { if (docount(children[i])) { return true } }; }; return false; } return docount(domelement) } containsfiveormoredivs(document); here's attempt: function containsfiveormoredivspurerecursion(domelement) { if (!domelement && domelement.tagname !== &