Posts

Showing posts from March, 2012

environment variables - spark.executorEnv doesn't seem to take any effect -

according spark docs , there way pass environment variables spawned executors: spark.executorenv.[environmentvariablename] add environment variable specified environmentvariablename executor process. user can specify multiple of these set multiple environment variables. i'm trying direct pyspark app use specific python executable(anaconda environment numpy etc etc), done altering pyspark_python variable in spark-env.sh . although way works, shipping new config cluster nodes every time want switch virtualenv looks huge overkill. that's why tried pass pyspark_python in following way: uu@e1:~$ pyspark_driver_python=ipython pyspark --conf \ spark.executorenv.pyspark_python="/usr/share/anaconda/bin/python" \ --master spark://e1.local:7077 but doesn't seem work: in [1]: sc._conf.getall() out[1]: [(u'spark.executorenv.pyspark_python', u'/usr/share/anaconda/bin/python'), (u'spark.rdd.compress', u'true'), (u'spar...

android get last active intent before screen lock -

i have been creating secure data android application, therefore dont want application viewed without login through valid password. so need land on login page, in case, phone locked, other application viewed,etc. have achieved using http://www.mediafire.com/download/mb6o7mtbg1cucx9/alwayslogin.zip . now need after login, application resumes same activity last loaded. currently, main menu loaded after login button click.

c# - Best way to have two versions of a dependency per application part using Unity? -

i using unity , mvc5 .net 4.6 i have data service. it depends on repository. which in turn depends on connection. the connection requires username/token make connection or user/application guid make connection data source. both mvc controllers , web api use data service, data service should not care how being used. when used mvc controller username , token is in claim. when connected application uses api must pass in user guid , application gui. when inject data service controller unity news dependencies, data service repository injected , repository connection injected. the question best pattern getting variables user connection current controller? you can configure 2 different containers, 1 mvc , 1 web api. or, if have service needs shared between mvc , web api (e.g. singleton service), can create 2 child containers (call container.createchildcontainer() ) of container have , register connection in child containers. can make distinction between connect...

javascript - Add hyperlink with click event to Dojo grid -

my question similar implementing hyperlink within dojo datagrid , , i'm able add markup hyperlinks dojo grid using formatter . however, need wire click events on these hyperlinks, trigger function within dijit containing grid. i have formatter following: var createeditlinks = function (data) { return '<a class="my-css-class" href="#" onclick="myfunctioninsidethedijit()">' + data.title + '</a>' } while works (i markup inside grid cell), myfunctioninsidethedijit function unavailable (unless declare on global scope). i've looked little @ dom-construct , can't figure out how add hyperlink invokes dijit function when clicked. any appreciated! thanks! a more modern way dojo.behavior use on , event delegation . dgrid instances expose own on function make easier: grid.on('a.my-css-class:click', function (event) { ... });

jquery - header nav links menu changes slightly between different pages -

i'm trying out build own website scratch after learning bootstrap. use classes nav navbar-nav bootstrap build menu links go horizontally. example, home expertise contact i've noticed after creating second page called about-me.html using same header (i saved header in separate file called header.html , called via jquery script in about-me.html page), linked menu items on list change in terms of width of each boxes below home expertise contact (in comparison above example) it's not worse showed can notice @ least bare eye. if clicked "back arrow" button on browser go index.html page , clicked next arrow button, saw there visible discrepancy between 2 pages in regard top menu links navigation bar. don't think normal please correct me. i hope haven't confused explanation of problem. thank much

python - zlib.error: Error -3 while decompressing: invalid distance code -

i trying create model using tensorflow using mnist dataset . have installed tensorflow , when try create model using command . python convolutional.py i getting error message on console : successfully downloaded train-images-idx3-ubyte.gz 9912422 bytes. downloaded train-labels-idx1-ubyte.gz 28881 bytes. downloaded t10k-images-idx3-ubyte.gz 1648877 bytes. downloaded t10k-labels-idx1-ubyte.gz 4542 bytes. extracting data/train-images-idx3-ubyte.gz traceback (most recent call last): file "convolutional.py", line 316, in <module> tf.app.run() file "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/default/_app.py", line 30, in run sys.exit(main(sys.argv)) file "convolutional.py", line 128, in main train_data = extract_data(train_data_filename, 60000) file "convolutional.py", line 75, in extract_data buf = bytestream.read(image_size * image_size * num_images) file "/usr/lib/python2.7/gzip.p...

java - Replacing multiple occurrences of characters -

i found string seq = "123456789"; string regex = seq.replaceall(".", "(?=[$0-9]([a-z]))?") + "[0-9][a-z]"; string repl = seq.replaceall(".", "\\$$0"); which turns 4a aaaa, 3b bbb , on... need opposite , couldn't figure out. need turn aaaa 4a, bbb 3b , on. lot here example of run-length encoding/decoding implementation in java: import java.util.regex.matcher; import java.util.regex.pattern; public class runlengthencoding { public static string encode(string source) { stringbuffer dest = new stringbuffer(); (int = 0; < source.length(); i++) { int runlength = 1; while (i+1 < source.length() && source.charat(i) == source.charat(i+1)) { runlength++; i++; } dest.append(runlength); dest.append(source.charat(i)); } return dest.tostring(); } public static ...

c++ - How can I print whatever I see in Yacc/Bison? -

Image
i have complicated yacc file bunch of rules, of them complicated, example: start: program program: extern_list class class: t_class t_id t_lcb field_dec_list method_dec_list t_rcb the exact rules , actions take on them not important, because want seems simple: print out program appears in source file, using rules define other purposes. i'm surprised @ how difficult doing is. first tried adding printf("%s%s", $1, $2) second rule above. produced "��@p�@". understand, parsed text available variable, yytext . added printf("%s", yytext) every rule in file , added extern char* yytext; top of file. produced (null){void)1133331122222210101010--552222202020202222;;;;||||&&&&;;;;;;;;;;}}}}}}}} valid file according language's syntax. finally, changed extern char* yytext; extern char yytext[] , thinking not make difference. difference in output made best shown screenshot i using bison 3.0.2 on xubuntu 14.04. if want ec...

javascript - Unable to stop form from submitting when validating an email -

i making simple form takes value text input, checks if characters in email address there , returns true or false. according lot of different resources, if returns false, form shouldn't submitted. however, when test in js bin, submits it. here's code: function validateemail(x) { console.log(x); var email = x.mytext.value; console.log(email); var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-za-z\-0-9]+\.)+[a-za-z]{2,}))$/; console.log(re.test(email)); } <form name="myform" onsubmit="return validateemail(this)"> <input name="mytext" type="text"> <input type="submit" value="submit"> </form> you need return false if validation fails, replace console.log(re.test(email)); with return re.test(email); demo

javascript - reader.onload callback issue with typescript -

i building simple file upload using angular2. have following code. in code callback assigned onload. after context changes reader , not class in present. can't access other objects in overview class export class overview { change() { var reader = new filereader(); reader.onload = this.uploadfile; reader.readasdataurl($("input[name='image']")[0].files[0]); } uploadfile() { console.log(this); //"this" refers reader obj,how can overview object this.api('upload'); //this not work because api undefined } } the keyword takes new context based on it's caller. can override default behaviur constructor class , explicitly bind context of methods. constructor() { (var name in this) { if ($.isfunction(this[name])) { this[name] = this[name].bind(this); } } } this function loops through properties of class, , uses jquery ...

amazon web services - InvalidParameterException while confirming SNS notification using Java spring cloud aws -

i have sns http end point written using spring-aws-cloud. followed below tutorial . while request confirmation sns topic following error application console. seems status.confirmsubscription() failing. error getting : zonaws.services.sns.model.invalidparameterexception: invalid parameter: topicarn (service: amazonsns; status code: 400; error code: invalidparameter; request id: d47581bd-789f-58f0-b976-ced91fec6929) @ com.amazonaws.http.amazonhttpclient.handleerrorresponse(amazonhttpclient.java:1383) ~[aws-java-sdk-core-1.10.61.jar:na] @ com.amazonaws.http.amazonhttpclient.executeonerequest(amazonhttpclient.java:902) ~[aws-java-sdk-core-1.10.61.jar:na] @ com.amazonaws.http.amazonhttpclient.executehelper(amazonhttpclient.java:607) ~[aws-java-sdk-core-1.10.61.jar:na] @ com.amazonaws.http.amazonhttpclient.doexecute(amazonhttpclient.java:376) ~[aws-java-sdk-core-1.10.61.jar:na] @ com.amazonaws.http.amazonhttpclient.executewithtimer(amazonhttpcli...

javascript - How can I extend the date display of the Gantt chart using DHTMLX Gantt? -

i creating planner , included gantt chart in it. problem trying create schedule start in march 31, 2016 , ends in april 15, 2016. problem graph doesn't display next month. my process is, default graph load current month first , last day , displayed days. here's sample code: //get first , last day of current month var parsed = date.parse("today"); var firstofmonth = new date(parsed.getfullyear(),parsed.getmonth(), 1); var lastofmonth = new date(parsed.getfullyear(),parsed.getmonth()+1, 0); var f_firstofmonth = firstofmonth.tostring("yyyy-mm-dd"); var f_lastofmonth = lastofmonth.tostring("yyyy-mm-dd"); //assign empty gantt $(".mygantt").dhx_gantt({ data: '', start_date: f_firstofmonth, end_date: f_lastofmonth, scale_height: 50, scale_unit: "day", }); can me this? using this example here . so want display current month default, , adjust displayed range new tasks added? t...

python - CPython - How to create and add a method attribute to an object with __dict__? -

this can tricky question... in short creating , adding method follows: static pyobject *ret_arg(pybvhtree *self, pyobject *arg) { /* demonstrate */ return arg; } static pymethoddef my_meth = {"ret_arg", (pycfunction)ret_arg, meth_o, 0}; ... pyobject* func = pycfunction_new(&my_meth, my_object); py_decref(my_object); pyobject_setattrstring(my_object, "ret_arg", func); py_decref(func); return my_object; } it works! having problems :( eg.: if del my_object. , use new method, crash . when close program python. error: exception_access_violation. , no problem refcount so question is: what correct way this?

spring cloud - Scaling out the zuul proxy -

we have scaled out sevices in our system having more 1 instance of them registered in eureka service registry. also, proxied zuul server in front. my question how can ensure scalability of zuul proxy when accessed clients. one solution can think of having multiple instances of proxy registered in eureka registry. if done how decide on of instances exposed clients. we faced same issue in our application, having multiple instances of multiple types of micro-service-type applications on our backend. servers registered eureka. problem had multiple security gateways configured (based on architecture described in excellent tutorial: https://spring.io/guides/tutorials/spring-security-and-angular-js/ ). eventually decided use hardware http load balancer calls our security gateways in round-robin approach (our solution on-prem). we use redis @enablehttpredissession annotation have spring session synced across servers, http load balancer not have deal sticky sessions or ...

c - How bits of this register is set in u-boot -

i trying figure out how "sram_ctl1_cfg" register's 4th , 5th bit set using following statement in u-boot: /* map sram emac */ setbits_le32(&sram->ctrl1, 0x5 << 2); http://git.denx.de/?p=u-boot.git;a=blob;f=drivers/net/sunxi_emac.c;h=11cd0ea06888ba8e271b0c10376306df5291a3e2;hb=head#l503 as per datasheet if bit 4:5 of "sram_ctl1_cfg" become "01" sram mapped emac peripheral. http://linux-sunxi.org/sram_controller_register_guide shouldn't setbits_le32(&sram->ctrl1, 0x5 << 2) setbits_le32(&sram->ctrl1, 0x4 << 2) ? so, answer yes, (0x5 << 2), 20 decimal 010100 in binary , set '4:5' '01' emac setting bit 2 1. setting bit 2 1 magic value we're setting because it's being set (presumably, didn't trace of history back) in sources allwinner provides, without further explanation. setting (0x4 << 2) set claimed registers have hidden breakage on other boar...

Matrix vector multiplication CCS c++ -

i trying multiply matrix , vector matrix in compressed column storage . matrix : 0 3 0 4 0 0 2 0 0 here ccs form: [ 4 2 3 ] [ 2 3 1 ] [ 1 3 4 4 ] the vector is: [ 1 3 4 ] so product should be [ 9 4 2 ] here function trying create vector<int> multiply(vector<int> val,vector<int> col,vector<int> row,vector<int> v, int r){ vector<int> x(v.size()); (int j=0; j<r; j++) { (int i=col[j]-1; i<col[j+1]-1; i++) { cout<<"\n"<<val[i]<<"*"<<v[j]<<"\n"; x[j]+= val[i]*v[j]; } } return x; } but returns [ 6 9 0 ] this closest i've gotten real solution, how can fix this? i think driven col_ptr vector. 1.) wasn't sure value(s) r take, removed it, don't need information solve problem 2.) should note have not compiled this, believe algorithm correct 3.) there obvious ways optimize m...

java - Cannot access spring boot application after deployment in tomcat -

i have created rest api using spring boot. using gradle build tool. have tested application using embedded container , working fine. able access application @ localhost:8080/foo/bar . now have deployed tomcat without error. mar 17, 2016 1:58:47 pm org.apache.catalina.startup.hostconfig deploywar info: deploying web application archive /usr/local/apache-tomcat-7.0.65/webapps/foo.war mar 17, 2016 1:58:48 pm org.apache.catalina.startup.tldconfig execute info: @ least 1 jar scanned tlds yet contained no tlds. enable debug logging logger complete list of jars scanned no tlds found in them. skipping unneeded jars during scanning can improve startup time , jsp compilation time. mar 17, 2016 1:58:48 pm org.apache.catalina.startup.hostconfig deploywar info: deployment of web application archive /usr/local/apache-tomcat-7.0.65/webapps/foo.war has finished in 623 ms but unable access application @ localhost:8080/foo/bar . can see tomcat running @ localhost:8080 here build.gradle file...

java - Libgdx AndroidLauncher FATAL EXCEPTION ClassNotFoundException -

i trying implement admob android project libgdx, , somehow messed entire project. think has libraries. reset of code, still won't work. using eclipse don't have gradle. here logcat: 03-06 19:16:13.481: e/androidruntime(26583): fatal exception: main 03-06 19:16:13.481: e/androidruntime(26583): process: com.techybite.sportsball, pid: 26583 03-06 19:16:13.481: e/androidruntime(26583): java.lang.runtimeexception: unable instantiate activity componentinfo{com.techybite.sportsball/com.techybite.sportsball.androidlauncher}: java.lang.classnotfoundexception: didn't find class "com.techybite.sportsball.androidlauncher" on path: dexpathlist[[zip file "/data/app/com.techybite.sportsball-1/base.apk"],nativelibrarydirectories=[/data/app/com.techybite.sportsball-1/lib/arm, /vendor/lib, /system/lib]] 03-06 19:16:13.481: e/androidruntime(26583): @ android.app.activitythread.performlaunchactivity(activitythread.java:3023) 03-06 19:16:13.481: e/androidruntime(2...

java - Mockito Error when initializing instance variables from within a contructor -

i writing unit tests spring application using mockito , following unit test service class. service class: @service class myserviceimpl implements myservice{ @autowired private externalservice externalservice; myserviceimpl () { int value = externalservice.getvalues(); } } as can notice initialize instance variable inside constructor using method service class called externalservice autowired. test class: public class lotteryserviceimpltest { @injectmocks private myserviceimpl myservice; @mock private externalservice externalservice; @before public void init() { mockitoannotations.initmocks(this); } @test public void testgetlotteryresult() { //test specific code } } when run test gives error: org.mockito.exceptions.base.mockitoexception: cannot instantiate @injectmocks field named 'value' of type 'myserviceimpl'. haven't provided instance @ field declarati...

java - Populate ListView with an arrayList<String> with data obtained from a cursor -

Image
helo trying populate listview data stored in sqlite. after select product want reference of product go on same line drew in picture. can make arrayadapter put records in same xml? my code looks this: cursor returns records: public cursor getallrows() { string = null; // query dbadapter cursor cursor = db.query(true, table_name, all_keys, where, null, null, null, null, null); if (cursor != null) { cursor.movetofirst(); } return cursor; } adding data arraylist: public arraylist<string> fromcursortoarrayliststring(cursor c){ arraylist<string> result = new arraylist<string>(); c.movetofirst(); for(int = 0; < c.getcount(); i++){ string row_product = c.getstring(c.getcolumnindex(key_product)); string row_price = c.getstring(c.getcolumnindex(key_price)); string row_type = c.getstring(c.getcolumnindex(key_type)); result.add(row_product); result.add(row_price); ...

php - odbc_pconnect works but PDO gives error -

i set connection sybase db through unixodbc , freetds on centos server. (i don't own sybase server , have account read permissions) tl;dr: can connect both odbc_pconnect , pdo when execute same query odbc_pconnect works while pdo returns error full story: created simple test using odbc_pconnect $query = "select count(*) table_name"; $conn = odbc_pconnect("mydsn", 'myusername', 'mypassword'); if(!$conn) die("connection failed"); if($result = odbc_exec($conn, $query)) { odbc_result_all($result); } the above code works , obtain count want. then tried using pdo $connectionstring = "odbc:mydsn;"; try { $db = new \pdo( $connectionstring , 'myusername', 'mypassword'); } catch (pdoexception $e) { echo 'connection failed: ' . $e->getmessage(); } $rs = $db->query($query); debug($db->errorinfo()); the connection estabilished (no "connection failed" e...

ios - spotify playlistsForUserWithSession call returns invalid array -

when calling playlistsforuserwithsession on latest beta ios sdk spotify, appears proper array, can 'po pl.items' , shows list of playlists in debug window. however, if try pl.items.count "member reference base type 'void *' not structure or union" , if try pl.items[0] returns error "subscript of pointer incomplete type 'void'" here's code. thanks: sptauth *auth = [sptauth defaultinstance]; //get list of current playlists [sptplaylistlist playlistsforuserwithsession:auth.session callback:^(nserror *error, id object) { if (!error) { nsurl *playlisturl = nil; pl= object; //at point, pl object isn't playing nice if(pl != nil && pl.items != nil && pl.items.count > 0) { playlisturl = [pl.items[0] uri]; } else { //snipped code } nsstring * theresult = [playlisturl absolutestring]; //snipped code } else { n...

lua - Sublime ?Text 2 and 3 on Windows 8 for Corona -

for life nor money can make work on pc, mac have no problems. installed per instructions running simple. print ("hello world") inside simple main dot lua when compile this. ideas appreciated, i'm give up. i've tried both st2 , 3. path variable, i've tried adding corona sdk ? [winerror 2] system cannot find file specified [cmd: ['lua', 'c:\\users\\kids pc\\desktop\\main.lua']] [dir: c:\users\kids pc\desktop] [path: c:\users\kids pc\appdata\roaming\corona labs\corona simulator\plugins;c:\programdata\oracle\java\javapath;c:\windows\system32;c:\windows;c:\windows\system32\wbem;c:\windows\system32\windowspowershell\v1.0\;c:\program files (x86)\ati technologies\ati.ace\core-static] [finished]

python - Errors occur when I import matplotlib and seaborn in OSX -

this question has answer here: ipython notebook locale error [duplicate] 4 answers i installed matplotlib , seaborn successfully, however, when import them in python shell, many errors occur. python 2.7.11 |anaconda 2.5.0 (x86_64)| (default, dec 6 2015, 18:57:58) [gcc 4.2.1 (apple inc. build 5577)] on darwin type "help", "copyright", "credits" or "license" more information. anaconda brought continuum analytics. please check out: http://continuum.io/thanks , https://anaconda.org traceback (most recent call last): file "<stdin>", line 1, in <module> file "/users/guanqingliang/anaconda/lib/python2.7/site-packages/matplotlib/__init__.py", line 1131, in <module> rcparams = rc_params() file "/users/guanqingliang/anaconda/lib/python2.7/site-packages/matplotlib/__init__.py"...

c++ - Undefined reference to function when linking -

Image
this question has answer here: what undefined reference/unresolved external symbol error , how fix it? 27 answers trying make c++ program splitting line , creating 2 std::vector save elements said line. function call: void readconf(const char *name, std::vector<t_objectlibrary> libs, std::vector<iobject *> &objs, std::vector<iobject *> &timer) i placed in inside config.hpp has it's prototype : void readconf(const char *name, std::vector<t_objectlibrary> libs,std::vector<iobject *> &objs, std::vector<iobject *> timer); and in main call : int main(int ac, char **av) { std::vector<iobject *> objs; std::vector<iobject *> timer; std::vector<t_objectlibrary> libs; libs = lib_read("./src/objectlibrary"); readconf("config.txt", libs, objs, timer); .....

javascript - Use first $(this) in second forEach() -

i've been looking on web issue i'm facing.. i can't find way use, in second nested loop, first $(this). php aliases ? does knows if it's possible ? you can see code below represent problem. $(".btn-labeled").click(function() { var uid = $(this).parent().prev("td").html(); $.get( "?what="+uid, function( data ) { var parsedjson = json.parse(data); $(".rule").each(function() { var serviceaccount = $(this).children("td").html(); parsedjson.foreach(function(iteration) { if(iteration["service_account"] != serviceaccount) { //i want attached first loop :p $(this).children("td").next("td").children("div").children("input").removeattr("checked"); } }); }); }); }); thanks in advance create variable element reference in inner loop: $(".btn-labeled").click(function() {...

oracle - Import data using sqoop with $ on the table name -

i encountering error importing data oracle database hive using sqoop: sqoop command below: sqoop import \ --connect jdbc:oracle:thin:@connectionstring/database \ --username username \ --password-file /path/password/file \ --query "select * \"dbo.log$_test_table\" \$conditions" \ --hcatalog-database hive_db \ --hcatalog-table log__test_table \ -m 1; here's error message after running command: error manager.sqlmanager: error executing statement: java.sql.sqlsyntaxerrorexception: ora-00942: table or view not exist the table exist in oracle database, sql statement used (printed in screen) info manager.sqlmanager: executing sql statement: select * dbo.log (1=0) the table name has been cut after '$' of specified table name. already solved issue adding \$ in columns or table name has $.

sitecore8 - Sitecore Multilist with search returns nothing on the second page -

i having problem "multilist search" field. sitecore 8 instance. field using query fetch list lucene search index named "agents_master_index" : templatefilter={3ea2cb30-0d04-4d73-9282-0103d8f34074} & startsearchlocation={95a07c68-36b6-4d0d-aae3-a2bfbf40c2c6}&sortfield=agent name i have multiple issues: 1) when open item based on template, slow returns results on first page of list, pagination , go-to-item buttons not working , field not showing number of pages. 2) if try template's standard values' item, above problem doesn't happen if click on "next page" button, returns nothing. looked search log file see what's going on. turns out on when returns first page results, executing following query: 4832 12:32:34 info executequeryagainstlucene (agents_master_index): +_datasource:sitecore +(+(+_path:11111111111111111111111111111111 +_latestversion:1) +(+_path:95a07c6836b64d0daae3a2bfbf40c2c6 +_template:3ea2cb300d044d739282010...

knime - How can I get all the data from separated large files in R Revolution Enterprise? -

i'm using revor entreprise handle impoting large data files. example given in documentation states 10 files (1000000 rows each) imported dataset using rximport loop : setwd("c:/users/fsociety/bigdatasamples") data.directory <- "c:/users/fsociety/bigdatasamples" data.file <- file.path(data.directory,"mortdefault") mortxdffilename <- "mortdefault.xdf" append <- "none" for(i in 2000:2009){ importfile <- paste(data.file,i,".csv",sep="") mortxdf <- rximport(importfile, mortxdffilename, append = append, overwrite = true, maxrowsbycols = null) append <- "rows" } mortxdfdata <- rxxdfdata(mortxdffilename) knime.out <- rxxdftodataframe(mortxdfdata) the issue here 500000 rows in dataset due maxrowsbycols argument default 1e+06 changed higher value , null still truncates data file. since importing xdf maxrowsbycols doesn't matter. also, on last line read da...

Binding Ajax response to jquery nested array -

i'm trying bind ajax response jquery nested array (arrays inside main array). example explanation of requirement ajax response : {1,2,3,4,5,6,7,8,9} i want convert jquery arrays mentioned below. [[1,2,3],[4,5,6],[7.8.9]] please let me know possible way. for example case, work : var ajaxresponse = [1, 2, 3, 4, 5, 6, 7, 8, 9]; var resultarrays = []; (var = 0; < ajaxresponse.length; = + 3) { var tmparray = []; (var j = 0; j < 3; j++) { tmparray.push(ajaxresponse[i+j]); } resultarrays.push(tmparray); }

extjs - Calculate the grid column value with total value in extjs4.1 -

i have grid 2 columns: target , target percentage. getting target value store. need calculate total , target percentage value using jan/total jan*100. want summary target %. can tell me how this? i need calculate total manually e.g month target target % jan 50 **50/100*100** mon 50 50/100*100 total 100 thanks probably want in model. { name : 'target %', convert : function( value, record ) { var target = (record.get('target')/total)*100; return target; } type: 'number' },

flash - what kind of effects were used for that visual particle swirl effect? -

one of client asks me such effect interactive presentation : http://vimeo.com/36466564 can give me tips kind of effects (particles, swirl, displacements) done ? (it must done using flash ) the simulation of such effects animation difficult , takes lot of time. to know more particle effect visit : http://www.csit.parkland.edu/~dbock/class/csc233/lecture/particlesintroduction.html http://platinumplatypus.com

multithreading - Retrieve list of yielded threads in java -

in java there api helps retrieval of yielded threads, trying prepare sample program learn , see yielding listing yielded threads, couldn't. 1 more doubt have once yielded thread run again or runs point stopped. per observations starts same stacktrace run not called on , on again. correct ? yielding makes thread state runnable can differentiated other threads in runnable state. or other program states yielded threads. putting sample working on too.. public class threadyielddemo implements runnable { thread t; threadyielddemo(string str) throws interruptedexception { t = new thread(this, str); system.out.println(" state = "+t.getstate()+" "+str); t.start(); system.out.println(" state-1 = "+t.getstate()+" "+str); } public void run() { system.out.println("entry = "+thread.currentthread().getname()+" state = "+thread.currentthread().getstate()); rand...

retrieving the data from firebase database and manipulate it in swift -

it's been while have started working firebase database. here code : let fbref = firebase(url: "https://mylogin-fb.firebaseio.com") var gatherdata = fbref.observeeventtype(.childadded, withblock: { snapshit in print(snapshit.value) }, withcancelblock: { error in print(error.description) }) and here results : { "detail " = swift; "title " = programming; } how can "swift" or "programming" ???? use objectforkey retrieve data. in case : let title = snapshot.value.objectforkey("title") let detail = snapshot.value.objectforkey("detail") print("title : \(title), detail : \(detail)")

java - getting error org.springframework.web.context.ContextLoaderListener -

i getting error in org.springframework.web.context.contextloaderlistener : java.lang.classnotfoundexception: org.springframework.web.context.contextloaderlistener @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1701) @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1546) @ org.apache.catalina.core.defaultinstancemanager.loadclass(defaultinstancemanager.java:525) @ org.apache.catalina.core.defaultinstancemanager.loadclassmaybeprivileged(defaultinstancemanager.java:507) @ org.apache.catalina.core.defaultinstancemanager.newinstance(defaultinstancemanager.java:124) @ org.apache.catalina.core.standardcontext.listenerstart(standardcontext.java:4715) @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5273) @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150) @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1566) @ ...

javascript - How to add input field using jQuery and call Ajax into new input field -

i using table input fields. use jquery adding new row/ input field, , want call ajax new row/input field. not working. because it's not filling condition of document.ready() function.. here html form: <table> <thead> <tr> <th>account name:</th> <th>branch:</th> </tr> </thead> <tr> <td> <div> <input type="text" name="ac_name" class="auto-search-ac"> </div> </td> <td> <div> <input type="text" name="branch"> </div> </td> </table> script add new row in table ( working perfectly) : <script> $(document).on("focus",'#table tr:last-child td:last-child',function() { //append new row here. var table = $("#table"); table.append('<tr>\ <td style=...

I am unable to publish post on user facebook wall using Spring Social -

i logged app using spring social facebook. unable post on user facebook wall. got below error post request " https://graph.facebook.com/197550980606288/feed " resulted in 403 (forbidden); invoking error handler {"error":{"message":"(#200) user hasn't authorized application perform action","type":"oauthexception","code":200,"fbtrace_id":"dqhublkycoo"}} 2016-03-07 11:03:17,040 - error [qtp696479026-23] - coach - exception occurred while posting link on facebook user id : {}, exception : {} org.springframework.social.insufficientpermissionexception: insufficient permission operation. @ org.springframework.social.facebook.api.impl.facebookerrorhandler.handlefacebookerror(facebookerrorhandler.java:120) @ org.springframework.social.facebook.api.impl.facebookerrorhandler.handleerror(facebookerrorhandler.java:65) @ org.springframework.web.client.resttemplate.handleresponseerror(res...

I am not able to read a image from Java Code which is hosted in Amazon Cloudfront -

Image
we have image processing server running in amazon ec2. have n-number of instances running our image processing server. reads image origin server hosted in amazon cdn. the problem here image loading in browser directly hitting in java code getting nullpointer exception bufferedimage null. after time able read image take weeks view. rare occurrence stuck totally . please advice on this via:1.1 abc.cloudfront.net (cloudfront), 1.0 amazon-instnce-a.com:8080 (squid/2.6.stable21) here amazon-instnce-a.com:8080 terminated , no longer available why routed request here. what way can code in java 6 retrieve image ? using below snippet retrieve image. static httpclient httpclient; static void getimage(string uri){ httpget = new httpget(uri); try { httpclient = httpclientbuilder.create().build(); httpresponse response = httpclient.execute(get); httpentity entity = response.getentity(); bufferedi...

Resolving dependecies of salt grains -

we're using saltstack , write custom grain depends on python library - netifaces in case. as minions should able execute grain need ensure library available. what best practice achieve this? recommended write state , apply state minions. feels bit messy have dependency between grain , state. there way define dependency inside of grains itself? grains not responsible manage own dependencies. based on seems straight forward me write state resolves dependencies of grain. grains shipped in saltstack/salt/salt/grains/core.py report missing modules that: log = logging.getlogger(__name__) has_wmi = false if salt.utils.is_windows(): # attempt import python wmi module # windows minion uses wmi of grains try: import wmi # pylint: disable=import-error import salt.utils.winapi has_wmi = true except importerror: log.exception( 'unable import python wmi module, core grains ' 'will missing...

php - How to use array_slice in this type $_POST['MetaData']['video_title'][$index] -

how use array_slice in type of array $_post['metadata']['video_title'][$index] //gets first 3 elements $array2 = array_slice($_post['metadata']['video_title'], 0, 3); like other array

quickfixj - QuickFIX/J: Experiencing period disconnects at midnight -

when running our initiator app through night, session gets disconnected brief period of time @ midnight. info: mina session created fix.4.4:initiator->acceptor: local=/10.50.100.130:13565, class org.apache.mina.transport.socket.nio.socketsessionimpl, remote=remoteaddr mar 17, 2016 01:00:00 quickfix.mina.initiator.initiatoriohandler sessioncreated info: mina session created fix.4.4:initiator->acceptor: local=/10.50.100.130:13570, class org.apache.mina.transport.socket.nio.socketsessionimpl, remote=remoteaddr our counterparty indicated not perform daily disconnects, weekly ones when entire market closes. our quickfix/j config: # default settings sessions [default] connectiontype=initiator reconnectinterval=60 sendercompid=sendercompid ########################################################################### # market data connection ########################################################################### [session] # inherit connectiontype, reconnectinterval , sender...

javascript - sortby using Underscore -

i trying sort records using underscore _.sortby() function . requirement give higher priority names starting _ . eg . if code var patients = [ [{name: 'john', roomnumber: 1, bednumber: 1}], [{name: 'lisa', roomnumber: 1, bednumber: 2}], [{name: '_a', roomnumber: 2, bednumber: 1}], [{name: 'omar', roomnumber: 3, bednumber: 1}] ]; var sortedarray = _.sortby(patients, function(patient) { return patient[0].name; }); i want have record _a, roomnumber: 2, bednumber: 1 on top . in sense want sort ignore strings starting _ try code. var patients = [ [{name: '_john', roomnumber: 1, bednumber: 1}], [{name: 'lisa', roomnumber: 1, bednumber: 2}], [{name: '_a', roomnumber: 2, bednumber: 1}], [{name: 'amar', roomnumber: 3, bednumber: 1}] ]; var sortedbychar = _.sortby(patients, function(patient) { return (patient[0].name.indexof('_') != 0) ? patient[0].na...

linux - Debian Partitions - Which partition is the Database in? -

we have debain server, , have our database on server. see partition database resides in. there way can this? mysql default running of /var/lib/mysql . find partition, run df /var/lib/mysql from shell. if it's not there error , have search little more. lets start lazy long shot.

java - find local path to getUnlockedImageUri -

i able show achievement images using imagemanager uri method getunlockedimageuri reasons, need find local path image because don't want use imageview , need actual file path image the uri of google play games achievement looks content://com.google.android.gms.games.background/images/d2bbfba4/61 , hoping able convert file object below: file myfile = new file(ach.getunlockedimageuri().getpath()); log.i(exconsts.tag, "myfile.exists() = " + myfile.exists()); // returns false! but not work! idea why? or else should try? or tell me if it's possible? a content:// uri clear sign either there no local file you not have direct access local file as stated in getrevealedimageuri() javadoc : to retrieve image uri, use imagemanager . you can use imageloader.loadimage(onimageloadedlistener, uri) drawable can drawn onto canvas using drawable.draw(canvas) . you can convert drawable bitmap using similar this answer if you'd like. ...

momentjs - Javascript date convert to timezone with format -

how can create date object, convert timzone datestring timezone , format below var date="20160317t073000"; var format = "yyyymmddthhmmss"; var timezone ="america/new_york" var newtimezone="asia/kolkata" i want date convert newtimezone, tried moment.js, converting browser timezone date=moment(date,format); date.tz(timezone); console.log(moment(date).format()); moment.js seems have : http://momentjs.com/timezone/ convert dates between timezones var newyork = moment.tz("2014-06-01 12:00", "america/new_york"); var losangeles = newyork.clone().tz("america/los_angeles"); var london = newyork.clone().tz("europe/london"); newyork.format(); // 2014-06-01t12:00:00-04:00 losangeles.format(); // 2014-06-01t09:00:00-07:00 london.format(); // 2014-06-01t17:00:00+01:00 to convert format, should : '20160317t073000'.replace(/([0-9]{4})([0-9]{2})([0-9]{2})t([0-9]{2})([0-9]...

objective c - Handle Paginated api on the client side -

i've created api following 3 parameters page , longitude , latitude . when doing request pass users location , given page , api return page of organizations sorted users location. data saved/updated on client side in mobile database. question when trying populate data in view, how on client side know data updated , not since paginated api update/save number of objects on page? so far i've tried populate number of objects retrieved on page, objects in api might switch page depending on how user changes position? i've thought making kind of flag in mobile database objects when requesting data, not quite sure in case? i'm inclined think local database relevant current location of user, defined it's longitude , latitude. suggest clean local database if user changes position, , repopulate server new position. that simplistic approach. if, mention, nearby location organizations appeared in different page in previous location, possible optimisation store i...