Posts

Showing posts from May, 2011

Android prepare Resume Ability to download manager -

this below code simple download manager , i'm trying add resume ability that. @daniel nugent share code. public class mainactivity extends actionbaractivity { private imageview image; private bitmap bmp; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); image = (imageview) findviewbyid(r.id.imageview); new postasync().execute(); } @override protected void onresume() { super.onresume(); //put on resume functionality here.... } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.menu_main, menu); return true; } @override public boolean onoptionsitemselected(menuitem item) { // handle action bar item clicks here. action bar // automatically handle clicks on home...

python - No response in ssh.exec_command in paramiko -

i trying use python paramiko execute commands on remote server. when run following commands prompt , appears have succeeded prompt back >>> import paramiko >>> ssh = paramiko.sshclient() >>> ssh.set_missing_host_key_policy(paramiko.autoaddpolicy()) >>> ssh.connect('a.b.c.d', username='server', password='xyz') >>> the response when try execute command [] >>> stdin, stdout, stderr = ssh.exec_command("host") >>> stdout.readlines() [] almost command gives same output. command "host" when ssh executed shell gives several lines of usage output i error if don't give password >>> ssh.connect('a.b.c.d', username='server') traceback (most recent call last): file "<stdin>", line 1, in <module> file "build\bdist.win32\egg\paramiko\client.py", line 307, in connect file "build\bdist.win32\egg\paramiko\client.py...

php mysql video upload not successfully functioning -

i getting following errors: warning: mysql_connect() [function.mysql-connect]: access denied user 'a5467268_andrew'@'10.1.1.19' (using password: yes) in /home/a5467268/public_html/andrew/fileupload.php on line 2 warning: mysql_select_db(): supplied argument not valid mysql-link resource in /home/a5467268/public_html/andrew/fileupload.php on line 3 <?php $con=mysql_connect("","",""); mysql_select_db("login",$con); extract($_post); $target_dir = "test_upload/"; $target_file = $target_dir . basename($_files["filetoupload"]["name"]); if($upd) { //$imagefiletype = pathinfo($target_file,pathinfo_extension); $imagefiletype= $_files["filetoupload"]["type"]; if($imagefiletype != "video/mp4" && $imagefiletype != "video/avi" && $imagefiletype != "video/mov" && $imagefiletype != "video/3gp" && $i...

javascript - Reinvoke function on model update in AngularJS -

first off, apologize in advance if terminology or approach off - come structural engineering background , trying learn javascript , angularjs through small pet project. my question is: how re-invoke function updateme() within service whenever model updates. sample code , plunker below. initially, code run fine , result calculated. if a or b updated, updated values propagated controllers, value of result not updated. i've tried playing around $scope.$watch() couldn't work, nor sure right approach. in actual project, function in question depends on several properties of myservice object, , generates json data plotted n3-charts . want make plot interactive regenerating data when user updates property of myservice object. angular .module('app', []); //some function evaluated when data in myservice changes function updateme(x, y) { return x * y; } //define service (to provide data multiple ctrls) function myservice() { var myservice = this; m...

c# - Binding SelectedItems of ListView to ViewModel -

i have list view binding items property in viewmodel. <listview height="238" horizontalalignment="left" name="listview" verticalalignment="top" width="503" itemssource="{binding businesscollection}" selectionmode="multiple" > <listview.view> <gridview> <gridview.columns> <gridviewcolumn> <gridviewcolumn.celltemplate> <datatemplate> <checkbox ischecked="{binding relativesource={relativesource ancestortype={x:type listviewitem}}, path=isselected}" /> </datatemplate> </gridviewcolumn.celltemplate> </gridviewcolumn> <gridviewcolumn displaymemberbinding="{binding id}" he...

linq - Concatenating Two Different IEnumerable Objects in C# -

i have got 2 different ienumerable objects, properties similar in both classes,now want concatenate/merge them, both results can assigned repeater datasource, below sample code. ienumerable<icacheditem> cacheold = cache<string>.cacheditems; //my old cache class, here fetching cached items ienumerable<caching.icacheditem> cachenew = caching.cache<string>.cacheditems; //my new class cached items var combined = cachenew.cast<icacheditem>().concat(cacheold); //trying concat both repeater.datasource = combined.orderby(entry => entry.region + ":" + entry.prefix + ":" + entry.key); //assigning datasource repeater.databind(); combined object coming blank, suggestions. update: have got these in class public class cacheditem<t>: icacheditem { public cacheditem(string key, string prefix, t value) : this(cacheregion.site, prefix, key, value) { } } do need modify class? you can use select ...

ios - Working with the AppDelegate file to create a single shared iAd banner in Swift -

Image
i trying follow steps here create shared iad banner view controllers in application. couldn't understand how do in app delegate since i've never touched app delegate before. the instructions were: has worked before?

apache spark - Scala:case class runTime Error -

this demo ran ok. when move class function(my former project) , call function, compiles failure. object dfmain { case class person(name: string, age: double, t:string) def main (args: array[string]): unit = { val sc = new sparkcontext("local", "scala word count") val sqlcontext = new org.apache.spark.sql.sqlcontext(sc) import sqlcontext.implicits._ val bsonrdd = sc.parallelize(("foo",1,"female"):: ("bar",2,"male"):: ("baz",-1,"female")::nil) .map(tuple=>{ var bson = new basicbsonobject() bson.put("name","bfoo") bson.put("value",0.1) bson.put("t","female") (null,bson) }) val t...

android - ViewPager AutoScroll not Working Properly -

android viewpager autoscroll not working using scheduleatfixedrate. this code,is right ? protected void startautoscroll() { swipetimer=new timer(); swipetimer.scheduleatfixedrate(new timertask() { @override public void run() { new handler(looper.getmainlooper()).post(new runnable() { @override public void run() { if(currentposition==shalombannerslist.size()) { currentposition=0; } viewpager.setcurrentitem(currentposition,true); currentposition=currentposition+1; } }); } }, 100, 4000); } please me. try code : int page=0; public void pageswitcher() { timer timer = new timer(); timer.scheduleatfixedrate(new remindtask(), 1000, 3000); } class remindtask extends timertask { @override public void run() { ...

php - Sort issue- Orderby non db column -

i have database zipcodes, latitude , longitude. other database have has cars zipcodes of location. have function return distance between user location (pulled ip address) , and cars location (based on zipcode, latitude , longitude). want order cars closest user. not sure best method. i imagine orderby(distance asc), distance isn't in db , obtained on per user basis. language: php, mysql framework: yii2 if function in mysql (e.g. stored function) can order function fine using say, order user_distance(user, distance) or similar. if function within php code (not-mysql) need sort results after got query back. php has various functions this: you want 1 of user-defined sort functions found here: http://php.net/manual/en/array.sorting.php

android - TranslateAnimation with RelativeLayout and SurfaceView -

straight question, have surfaceview inside relativelayout follows: <relativelayout android:id="@+id/surfaceframe" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#ff000000" android:visibility="visible" > <surfaceview android:id="@+id/surface" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true" android:visibility="visible" /> </relativelayout> i have requirement make relativelayout along surfaceview move. easy. mplayerframe.settranslation(distance); this mplayerframe variable relativelayout. however, have support api level 10. client insists on doing so. came chunk of code after browsing here , elsewhere. translateanimation anim = new translateanimation(0,0,distance,distance); anim.set...

php - Call row 10 to 20 in decended order -

i'm using pdo. need call data row 10 20 after it's sorted using desc? how can this? $sql = "select item, price, availability items category = :category order item desc"; $stmt= $connect->prepare($sql); $stmt->execute(array(':category'=>"fruits")); $rslt = $stmt->fetchall(pdo::fetch_assoc); foreach ($rslt $val){ $data[] = $val; } so guess post answer because comments guess arose confusion , there typo (quote , link had no error). mysql has function called limit , https://dev.mysql.com/doc/refman/5.0/en/select.html . per documentation the limit clause can used constrain number of rows returned select statement. limit takes 1 or 2 numeric arguments, must both nonnegative integer constants (except when using prepared statements). 2 arguments, first argument specifies offset of first row return, , second specifies maximum number of rows return. so return rows 10 through 20 can ...

Passing C++ character array to Fortran -

i have been trying pass character array c++ fortran subroutine seems fortran not receive characters properly. have been searching web find solution proposed ideas seem complicated. interesting (and concise) solution proposed steve @ intel fortran forum cannot work in code. so, appreciate suggestion me out resolve issue. the following function c++ routine makes call fortran subroutines: extern "c" void __stdcall f_validate_xml(const char* buffer, int len); void cudmeditordoc::onvalidatexml() { cstring filename = "test.udm"; const char* buffer = filename.getbuffer(); int len = filename.getlength(); f_validate_xml(buffer, len); } and here fortran subroutine supposed receive character array: subroutine validate_xml(file_name, len) !dec$ attributes decorate, stdcall, alias:"f_validate_xml" :: validate_xml use xml_reader_structure use, intrinsic :: iso_c_binding integer(c_int), value, intent(in) :: len character(len, kind=c_char), ...

python - Append a tuple to a list - what's the difference between two ways? -

i wrote first "hello world" 4 months ago. since then, have been following coursera python course provided rice university. worked on mini-project involving tuples , lists. there strange adding tuple list me: a_list = [] a_list.append((1, 2)) # succeed! tuple (1, 2) appended a_list a_list.append(tuple(3, 4)) # error message: valueerror: expecting array or iterable it's quite confusing me. why specifying tuple appended using "tuple(...)" instead of simple "(...)" cause valueerror ? btw: used codeskulptor coding tool used in course the tuple function takes 1 argument has iterable tuple([iterable]) return tuple items same , in same order iterable‘s items. try making 3,4 iterable either using [3,4] (a list) or (3,4) (a tuple) for example a_list.append(tuple((3, 4))) will work

dataframe - R: Insert multiple rows (variable number) in data frame -

i have data frame with, say, 5 rows, 2 observables. need insert "dummy" or "zero" rows in data frame number of rows per observable same (and can bigger n rows longer one). e.g.: # have: x = c("a","a","b","b","b") y = c(2,4,5,2,6) dft = data.frame(x,y) print(dft) x y 1 2 2 4 3 b 5 4 b 2 5 b 6 here's i'd get, i.e. add n rows per observable 4. mock df x1 = c("a","a","a","a","b","b","b","b") y1 = c(2,4,0,0,5,2,6,0) dft1 = data.frame(x1,y1) print(dft1) x1 y1 1 2 2 4 3 0 4 0 5 b 5 6 b 2 7 b 6 8 b 0 i started getting n rows in original data frame per observable ddply , know how many rows need add each observable. library(plyr) nr = ddply(dft,.(x),summarise,val=length(x)) print(nr) x val 1 2 2 b 3 # n extras 2 , 1 reach 4 per obs. repl = 4 - nr$val repl_name = nr$x repl_x = rep(repl...

regex - Excel macro to replace part of string -

Image
i'm having trouble replacing part of string in range of data includes comments. where id numbers appears, need replace middle of id numbers xs (e.g. 423456789 become 423xxx789 ). ids ever start 4 or 5 , other number should ignored may necessary other purposes. sadly, because these comments data inconsistently formatted adds level of complexity. representative data following: 523 123 123 523123123 id 545 345 345 mr. jones primary id 456456456 mrs. brown mr. smith's id 567567567 i need code replace middle 3 digits of id number , leave rest of cell intact id 545 345 345 mr. jones primary id 456456456 mrs. brown becomes (with or without spaces around x s) id 545 xxx 345 mr. jones primary id 456xxx456 mrs. brown the regex have finding lines ids successfully, , works nicely cells no other text. sadly, other cells not replace 3 digits need replacing , makes mess of data cell. code below works first 2 cells above, doesn't work remainder. please help. s...

c++ - Libclang don't follow include statement -

i'm trying use libclang programatically analyse opencv library, when try import main header opencv opencv.hpp , libclang won't follow path. previously, reading quite beautifully, figured following $path 's headers, , want follow these specifics ones. opencv.hpp file containing lots of #include statements so: #include "core/core_c.h" #include "core/core.hpp" #include "flann/miniflann.hpp" // ... , on but, when try open libclang , or either clang ./opencv.hpp , won't follow: clang ./header_example/opencv.hpp ./header_example/opencv.hpp:46:10: fatal error: 'core/core_c.h' file not found #include "core/core_c.h" ^ 1 error generated. but i'm sure on right directory (a bit of tree output): ── header_example │   ├── opencv.hpp │   ├── opencv2 │   │   ├── # more directories │   │   ├── core │   │   │   ├── affine.hpp │   │   │   ├── core.hpp │   │   │   ├── core_c.h │   │   │   ├── types_c.h │   ...

c++ - Allocating an array in a templated class -

the template i'm using is template<typename t, size_type max_dim = 500> i trying figure out how allocate correctly. variable t ** array_ declared in constructor. have right now, i've tried few different kinds of syntax no avail. array_=new value_type*[dim1_]; ( long = 0u; < dim1_; i++) array_[i] = new value_type[dim2_]; i don't understand why using value_type when template argument t use it: template<typename t, size_t max_size = 500> class myarray { t** array_; public: myarray(size_t dim1_, size_t dim2) { array_ = new t*[dim1_]; (size_t = 0; < dim2; ++i) array_[i] = new t[dim2]; } }; mind since not using std::vector nor std::array need release memory manually through delete [] in destructor.

xcode - AppDelegate unknown issue that allows to build app but then crashes it, how to fix? -

Image
i'm new @ coding swift language , developing ios , os x languages in general. writing simple program, know basic features, syntax, etc of language, , got weird problem in appdelegate.swift file of project: then tried make empty app, , reinicialize xcode, neither of these worked. started blank new project , kept having error. reinstalled xcode , create new projects, same problem hasn`t let me work since then!! can me please? know might ridiculous fix, don`t know how. any great. thanks. i had same problem once , guess kind of bug in xcode. disabled global breakpoints toggle global breakpoint state(blue arrow symbol in lower pane) , press continue execution.

javascript - jQuery UI droppable not over -

code: $("div.layout.lo-content > div.content").droppable( { over:function(e,ui) { alert("yes"); $(this).css("background-color","#ffffff"); }, drop: function(e, ui) { $(ui.draggable).appendto($(this)); if($(this).hasclass("ui-sortable")) { $("div.content").sortable('refresh'); } } }); as can see, when element dragged on top of above element, background colour change. is there way make background colour transparent if element not on droppable container? such as: { notover: function(e,ui) { } } try css div.layout.lo-content > div.content { background-color:transparent; } js $("div.layout.lo-content > div.content").droppable( { over:function(e,ui) { alert("yes"); $(...

svn - SharpSVN - SvnLookClient.GetPropertyList - Show Inherited Properties? -

the svnlook command has --show-inherited-props option include inherited properties of path specified. with sharpsvn, svn command wrapped method in svnlookclient class called getpropertylist . 1 of arguments svnlookpropertylistargs object, there doesn't seem property can set equivalent of --show-inherited-props . i see in svnclient class there getinheritedpropertylist method, cannot use performing operation on repository itself, , not working copy because being used in pre-commit hook application. is there way svnlookclient.getpropertylist return inherited properties? i can confirm points. i'm checking can implement missing pieces. the next 1.9 build have option of using repository location svnclient.inheritedpropertylist adding missing overloads svntarget arguments. after add similar function svnlookclient, current function doesn't allow same property multiple paths. once i'm done i'll backport these changes 1.8.x.

python - KeyError: u'no item named 0' comes up with histogram -

i've seen similar questions on here, none seem having exact same problem me. i'm trying create histogram of chemical data. error in other instances seemed related missing column, data doesn't (and shouldn't) have column named "0". here code , error message: %pylab inline import matplotlib.pyplot plt import pandas pd plt.figure() #importing data genesis = pd.read_csv(r'c:\connors temp\...... (878-15g)\task_4 (genesis)\genesis_mwmp.csv') arsenic = genesis[['code','arsenic']] antimony = genesis[['code','antimony']] plt.hist(antimony) keyerror traceback (most recent call last) <ipython-input-7-c537deba42d9> in <module>() ----> 1 plt.hist(antimony) c:\python27\lib\site-packages\matplotlib\pyplot.pyc in hist(x, bins, range, normed, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, stacked, hold, **kwargs) 2655 ...

google maps - Finding distance using place id -

as per documentation, retrieve distance between set of origins , destinations in following manner (server api). https://maps.googleapis.com/maps/api/distancematrix/json?origins=washington%20dc&destinations=new%20york&mode=walking&key= instead of passing place names, better if pass place_id origin or destination. give more accurate results. possible ? for eg. possible perform api call like: https://maps.googleapis.com/maps/api/distancematrix/json?origins=<place_id>&destinations=<place_id>&mode=walking&key= ??? thankyou there no ways let google use place_id origins, or destinations in google maps direction api. so way lat/lng or address place_id first. can by: 1) reverse geocoding: https://developers.google.com/maps/documentation/geocoding/ https://maps.googleapis.com/maps/api/geocode/json?place_id=chij2eugeak6j4arbn5u_wagqwa&key=mykey 2) place details: https://developers.google.com/places/webservice/details ...

apache - AWS SDK PHP .aws/credentials configuration -

i have web application have built , using aws sdk php , pull of credentials in external config file located within /etc/aws/creds.php (returns php array of param values). works fine default php.ini settings (being loose , open). begin locking things down struggling error: php fatal error: uncaught exception 'aws\common\exception instanceprofilecredentialsexception' message 'error retrieving credentials instance profile metadata server. when not running inside of amazon ec2, must provide aws access key id , secret access key in "key" , "secret" options when creating client or provide instantiated aws\common\credentials credentialsinterface object. this gets picked in /var/log/httpd/error_log. documentation on aws sdk api says have use .aws/credentials file given user. user http (for apache) , home directory /srv/http/. cannot put credentials in file publicly available on site. the question have how change location credentials file? need c...

Javascript: Basic for loop is not working -

is there reason why following not work: for (i=0;i < somearray.length;i++) { if (somearray[i].indexof("something") !== -1) { //do here } } the basic "for" loop possible. doesn't work. on first line (declaration of loop, not inside loop), "uncaught reference error; not defined." i have page open in 1 chrome tab, , earlier version of page open in tab. in other tab, loop works fine; in first tab, code throws error. edit - july 2 2015 the response strict mode helpful. after reading bit , going through code i've got handle on what's going on. the confusing bit both versions of code this, minor differences (requirejs module): define( 'viewmodels/someviewmodel', ['dependency1', 'dependency2', 'dependency3'], function(dep1, dep2, dep3) { "use strict"; function someviewmodel(arg1, arg2) { var self = this; self.initialize()...

php - For apphp framework i need to preform ajax request -

apphp framework , have datatable when click on action button "edit", need populate modal form whit data db. jquery not option because fw blocked ajax request. if on click call windows.location="controller/action", action reload page , close modal. need call controller view on button click, without reloading page. prepare data each edit link while loading page, please in javascript array , use when call popup clicking on [edit] link

c++ - What to use instead of `qt5_use_modules`? -

the qt 5 cmake manual states qt5_use_modules macro deprecated: this macro obsolete. use target_link_libraries imported targets instead. ... qt5_use_modules more specify link libraries: specifies include directories, necessary compile flags, , more (see full description in linked documentation above). assuming, then, variable qtmodules contains list of qt modules should used project, "recommended" way replace following "deprecated" cmake line? qt5_use_modules(${myprojectname} ${qtmodules}) the following not work, because not add qt include paths: target_link_libraries(${myprojectname} imported ${qtmodules}) does qtmodules variable need manually iterated over, include_directories can called each individual module name? seems major step backward qt5_use_modules , simple , "just works." missing something? the message using imported targets refers generated targets qt5's cmake modules provide you, not should setting ...

dcevm true Hot Swap in Java vs JRebel/LiveRebel stability -

i installed dcevm on dev machine hotswap agent , seems work well. dcevm looks alternative jrebel/liverebel. on production systems. is dcevm , hotswap agent production ready? what production-problematic issues? both dcevm , jrebel meant development environments only. dcevm works fine in many use cases, can load of class changes , perfect if on budget , need basic reload capability. in comparison jrebel works on 100 frameworks spring, hibernate etc configuration dcevm not able reload. difference in support. while dcevm community supported on basis commercial jrebel has professional support team trouble might have.

maven - Error when using groovy-eclipse-plugin and @Grab -

getting following error when running mvn clean compile on new system. works fine on local (windows) environment. [error] failed execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project visa-threatintel: compilation failure: compilation failure: [error] /path/to/class.groovy:[2,2] 1. error in /path/to/class.groovy (at line 2) [error] @grab(group="javax.mail", module="mail", version="1.5.0-b01", type="jar"), [error] ^^^ [error] groovy:ambiguous method overloading method org.apache.ivy.core.settings.ivysettings#load. both local , new system use maven 3.2.5 , pom identical. relevant excerpts below: <groovy.version>2.2.1</groovy.version> <ivy.version>2.4.0</ivy.version> <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</art...

POST request to ASP.NET page using the Python requests module -

i trying submit post request pwreset.seattleu.edu/change.aspx can change account password on command line. think have set request properly, after reading various other similar questions, response being returned exact same page , password not being changed. valid response should redirect me pwreset.seattleu.edu/change_success.aspx code from bs4 import beautifulsoup import requests pwreset_url = "https://pwreset.seattleu.edu/change.aspx" headers = { 'accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'user-agent': 'mozilla/5.0 (windows nt 6.1) applewebkit/537.17 (khtml, gecko) chrome/24.0.1312.57 safari/537.17', 'content-type': 'application/x-www-form-urlencoded', 'accept-encoding': 'gzip,deflate,sdch', 'accept-language': 'en-us,en;q=0.8', 'accept-charset': 'iso-8859-1,utf-8;q=0.7,*;q=0.3' } session = requests.session() se...

c# - Parsing XML file for element nodes then storing text in different arrays for loading into Excel -

i want parse xml file receive amazon, take data , input custom invoice in excel , print. i've completed of task, i'm running difficulties when customer has 2 parts address component such <adressline1> , <addressline2> field, 2 array's don't equal , throws error in loop in excel_create when try write values excel cell. here's sample xml file: <listordersresponse xmlns="https://mws.amazonservices.com/orders/2013-09-01"> <listordersresult> <nexttoken>m1jyahctnbyajqjyldm0zifvkjjppovr78ndw9jqj1q/69u0e9w5/rqzazhyyvylqbxdlk4iogxpjasl2bere8j0nx3cifzqqmzu4ky1kpoexaruvti0tsj0wmvlylzkwqwpqglbsnpaepjjlwtrc+qj10z22+qvy/7negx36m2lpnv+vctnkbuzif9n45mtnrz4abbdbtfk25icwjklgzc1ikmk90pcwrowryef9tc5hmwx5iamwkfxnqm3jqvzfwylpi5qzh51nmrpm18pb5gesrwkzoqct2ijh+oabglthhfbgj6dwqjzszeq+rf525news0zc1z2pvv1ggto2jcae56fkgloaresiody6+vu4dey78hetutyjmqwzuehtk8n/ypwqr6cgigtv6ig1zzbuizaoiz5q2qzkessbbjrvhubqn8uebbkt14gsegjxrejaohxheou88cbt+gncoc...

r - Replacing consecutive zeros with a desired value -

let's have matrix (or vector) of form >set.seed(1) >x=ifelse(matrix((runif(30)),ncol = 2)>0.4,0,1) [,1] [,2] [1,] 1 1 [2,] 1 1 [3,] 0 1 [4,] 0 0 [5,] 1 1 [6,] 0 0 [7,] 0 0 [8,] 0 0 [9,] 0 1 [10,] 1 0 [11,] 1 0 [12,] 1 0 [13,] 0 1 [14,] 1 0 [15,] 0 0 ... etc how can count number of consecutive zeros between ones in each column , replace zeros 1 these have count less predefined constant k. or @ least start index , number of elements in each sequence of zeros. there more zeros ones in data set, , of time length of sequence greater k so, example, if k=1, [4,2];[13,1] , [15,1] going replaced 1. if k=2 in addition [4,1];[13,1] , [15,1], zeros in [3,1],[4,1], [14,2], , [15,2] going replaced 1 in example. of course, can run loop , go through rows. wonder if there package, or neat vectorization trick can it. update: desired output example k=1 ...

c# - GetCustomAttributes from dynamically loaded Assembly -

i want this: appdomain domain = appdomain.createdomain("dataspecdomain"); assembly dataspecassembly = domain.load(fullassemblyfilepath); object[] dataspecattrcollection = dataspecassembly.getcustomattributes(typeof(dataspecificationattribute), true); actually, didn't have appdomain portion , using assembly.loadfrom() evidently not recommended these days in lieu of security. problem code assemblies loading new domain built own references third-party api. in fact, third-party api references shell-representation of actuals lie in third-party exe directory. when referencing these, copy local set false. end result fileloadexception. if add shell references debug folder, works. there way can attribute instances without having deal loading assembly's dependencies? or there way resolve loading assembly's dependencies without having place third-party api references in same folder. just reference, third-party product designed special directory used auto-loa...

multithreading - Python - multiprocessing threads don't close when using Queue -

this python 3.x i'm loading records csv file in chunks of 300, spawning worker threads submit them rest api. i'm saving http response in queue, can count number of skipped records once entire csv file processed. however, after added queue worker, threads don't seem close anymore. want monitor number of thread 2 reasons: (1) once done, can calculate , display skip counts , (2) want enhance script spawn no more 20 or threads, don't run out of memory. i have 2 questions: can explain why thread stays active when using q.put() ? is there different way manage # of threads, , monitor whether threads done? here code (somewhat simplified, because can't share exact details of api i'm calling): import requests, json, csv, time, datetime, multiprocessing test_file = 'file.csv' def read_test_data(path, chunksize=300): leads = [] open(path, 'ru') data: reader = csv.dictreader(data) index, row in enumerate(reader): ...

java - Getting text from inside editText that is contained in a Recyclerview -

i have recyclerview contains edittext, when button pressed outside recyclerview, retrieve text each view inside recyclerview. can't seem find best way that. have tried use callback, , have tried external class store data both ways seem should work have not had luck either. best practice geting text out of each edittext indivdual can added array or database. in recycle view, list view etc, there view recycling mechanism reduce memory consumption. so iterating through recycle view childs won't give whole data. for example if there 10 items in recycle view , if 5 items shown on screen, if go iterating through recycle view childs, data associated few children, 6 or 7. because others view reused. so in case need save data edittext model or bean class @ time of view reusing in recycle view adapter. when button clicked, can iterate through childs , data , put data again model or bean class. bean list can whole edited data.

sockets - Python Script Fails to Get IP from a List of Hostnames -

here code: import socket import csv open('afile.csv','r') csv: a_csv = csv.reader(csv) next(a_csv) csvlist = list(a_csv) count = 0 row in csvlist: if count == len(csvlist): count = len(csvlist)-1 hostname = socket.gethostbyname(csvlist[count][0]) count += 1 the error i'm getting through interpreter: socket.gaierror: [errno 11001] getaddrinfo failed the purpose of little python script loop through list generated form csv file, extract hostname , lookup ip address. once it's done should add list right after original hostname (i have open "space" within csv this). question maybe causing error occur?

php - Display CKEditor's saved Data in user page -

i have used ckeditor in textarea. textarea submits data in php file , later saved in database. now want display data (render) format. when display saved data in page, stylesheet of data won't applied because of page uses different stylesheet. <div class="displayck reset-this"> <?php /* ck editor data */ $visible = $con->prepare("select text test id = 1"); $visible->execute(); $data = $visible->fetchcolumn(); echo $data; ?> </div> how can output data stylesheet formatting.