Posts

Showing posts from September, 2012

scala - How to end an infinite akka stream -

i'm new akka streams have case want use permutations infinite source. simplified example finite source this. val future = source(1 100) .map { => if (i % 20 == 0) println(i); } .filter(_ == 42) .runwith(sink.fold[int, int](0)(keep.right)) this exemple outputs: 20 40 60 80 100 i'm fine source getting past 42 don't want exhaust entire stream before being able result. val result: int = await.result(future, 1.second) result should be(42) question is, how should end stream when i've found i'm looking for? val future = source(1 100) .map { => if (i % 20 == 0) println(i); } .filter(_ == 42) .runwith(sink.head)

arrays - Python ValueError -

so keep receiving error: valueerror: mixing iteration , read methods lose data and 1) don't quite understand why i'm receiving it, , 2) people similar problems seem doing things code more complex beginner (like myself) can adapt with. the idea of code read data_file.txt , convert each line own individual array. so far have this: array = [] #declaring list name '**array**' open('file.txt','r') input_file: line in input_file: line = input_file.readlines() array.append(line) print('done 1') #for test purposes return array and keep recieving error. "value error: mixing iteration , read methods lose data "message while extracting numbers string .txt file using python the above question seemed doing similar, calling in items array, code skipping lines , using range call in parts of it, don't need that. need call in lines , have them made array. python: mixing files , l

Internal working of Netlfix Zuul with Netflix Eureka -

how netflix zuul work along eureka routing & service discovery? understanding, service instance registers/deregisters eureka ip , port. when request arrives @ zuul (which gateway end user requests), checks filters if request has routed (pre/post/route filters). if filter particular request present, send request eureka asking list of ip addresses , ports service instance serves filter? if how works, kind of requests reach zuul ? if filter name “example”, http ipaddr:port/example ? (ip add:port of zuul instance) i haven’t been able find article describes exact flow of messages between 2 services in terms of kind of messages passed. great if share resources me better understanding.

reporting services - SSRS stacked data bar with variable number of data points -

Image
we've been trying come flexible design stacked data bar in ssrs allow visualizing percentage of viewed video material in 100% filled tablix column cell. the goal display parts of video clip user has viewed. example - host 1 hour long episode of tv show, users don't watch entire episode beginning end , want know parts of video watched. users may jump around - watch little bit in beginning, skip middle , watch more, go end. streaming video system use provides detailed reports viewing began , ended. our job put information concise, fixed length databar in order show how of given video clip particular user has watched. here's desired of report. in first row, you'll see user has viewed 20% of video, jumped 49% , watched till 54% , stopped. resulted in 25% of total length of video viewed. can achieved using stacked data bars? suggestions appreciated. i able solve creating custom ssrs assembly generates bitmap image , returns byte array, used in image ex

modelsim - System task or function '$value$plusarg' is not defined -> Warning : Verilog -

i trying learn how use $value$plusarg . have picked following code somewhere. module test; integer i, r; initial begin r = $value$plusarg("myint=%d", i); $display("value %0d", i); end endmodule when tried run it, getting warning as: system task or function '$value$plusarg' not defined. i have used modelsim. commands have used follows: vlog test_genvar.v +define+myint="22" vsim work.test run -all i not sure if problem code or commands have used. in advance :) very silly mistake. system task name $value$plusargs , not $value$plusarg (missing 's'..!!!). moreover, may use $test$plusargs detect/test whether given switch available @ run-time or not. follows: if($test$plusargs("myint")) begin $value$plusargs("myint=%d",i); end one more thing, using vcs, , provide these kind of switches, use "./simv +myint=5" (of course simv compiled-executable file). so, no need of +define+myint

javascript - Angular ui-bootstrap datepicker change theme -

Image
i have angular datepicker shows - this datepicker huge , covers 30% of screen , also, dates have huge gaps among them. now suspect happening because have styled tables , buttons whole project. how change/style datepicker table , button styling not affect datepicker. p.s : tried styling .datepicker syntax, did not work. thanks. you need css tricks. like: be sure custom styles loaded after bootstrap codes. make selector more powerful, #somecontainer div.uib-datepicker {...} or #somecontainer div.uib-datepicker > table > tbody > tr > td {...} (well, doing css-preprocessors quite easy) easily edit ui-boostrap js code , add class template, , follow above structure by way, adm-dtp module might more helpful.

c# - Cannot render correct URL for my MVC Areas -

just starting delve route areas . i'm attempting basic stuff first before fancy. when type physical route address bar works great. however, when try use @url.action or @html.actionlink create link mvc cannot figure out how calculate correct route. typing works: so, know routes setup correctly... http://localhost:51515/intro/tutorials/one my controller looks like: again, resolves correctly when type address bar... [routearea("intro")] [routeprefix("tutorials")] [route("{action}")] public class introtutorialscontroller : controller { public actionresult one() { var path = @"~/views/tutorials/intro/one.cshtml"; return view(path); } } my sad attempts @ url: obviously, problem here... @html.actionlink("intro", "one", "tutorials", new { area = "intro" }, null) <a href="@url.action("one", "tutorials", new { area = "intro"

Boolean operators (and, or) in Clojure -

here quote http://www.braveclojure.com/ : clojure uses boolean operators or , and . or returns either first truthy value or last value. and returns first falsey value or, if no values falsey, last truthy value. why build language? how come across use cases it? it bit different other languages, handy default values. example: (defn print-it [x] (println (or x :unknown))) > (print-it 5) 5 > (print-it "hi") hi > (print-it false) :unknown > (print-it nil) :unknown so normal value 5 or "hi" , result of or expression supplied value. if value nil (or false ), default value :unknown returned.

php - Does file type relies on file extension? -

the file type relies on file extension? mean php's finfo analyze file data detemine file type or relies on file extension? change of .png file extension .txt not affect change of file type niether finfo nor email mime data attachment? googled , found nothing. please advice. thanks, php's fileinfo functions use local copy of libmagic. can @ php source code under "ext/fileinfo/" , see folder called libmagic. unix command "file" uses libmagic, running "file myfile.txt" should produce same output php function finfo_file(). https://en.wikipedia.org/wiki/file_%28command%29 libmagic examines portion of file, first few bytes , not rely on extension. file's position-sensitive tests implemented matching various locations within file against textual database of magic numbers (see usage section). differs other simpler methods such file extensions , schemes mime.

android - how to check if url exist or not to fetch json data -

i fetching json data different book_name & working fine.but in case if book not exists app collapse.i know jsonobject fetching null data want rather collapse when book not found. code is: ` public class asynctaskparsejson extends asynctask<string, string, string> { final string tag = "asynctaskparsejson.java"; // set json string url here intent po=getintent(); string bok=po.getstringextra("bookname"); string newname = bok.replaceall("\\s", "%20"); string yourjsonstringurl = "http://www.bsservicess.com/photoupload/star_avg.php?bookname="+newname; // contacts jsonarray jsonarray datajsonarr = null; @override protected void onpreexecute() {} protected string doinbackground(string... arg0) { if(exists(yourjsonstringurl)) { try { jsonparser jparser = new jsonparser(); // json string url jsonobject json = jparser.getjson

javascript - multiple clicks on protractor do not work -

i writing protractor code preforms clicks on same page. reason preforms 1 click , finishing test successfully. fyi clicks aren't redirecting browser somewhere else function hitl (i) { nodes.get(i).click().then( function(){ // browser.driver.sleep(1000); i++ if(i<nodes.length) hitl(i); } ); } i think can make simpler using each() : nodes.each(function (node) { node.click(); });

linux - Flushing tx udp socket kernel buffers to reduce latency -

i have linux based wireless network application requires pretty hard on latency. i.e., late arrival of data packet no better @ compared no data. also, old data in socket can delay newer data. i'm looking if transmit side there way detect socket piling old data , in such case flush/discard , send fresh data. i know receiver can read of old data , discard. however, still play catch , not in speeding if there sender side option evaluate. thanks help. try turning off nagle algorithm on sending side. algorithm tries collect smaller packets larger ones reduce overhead, turning off can mean each packet sent immediately. here's code snippet turn off: void nonagle (int socket) { int on = 1; if (setsockopt (socket, ipproto_tcp, tcp_nodelay, &on, sizeof(on)) < 0) bye ("can not disable nagle algorithm\n"); }

javascript - How to iterate over object sent via AJAX JSON -

Image
i have following javascript object: var parameters = { "parameters" : [ { "key": "feedbacksource", "value": "foo" }, { "key": "status", "value": "foo" }, { "key": "feedbacktype", "value": "foo" } ] }; console.log(json.stringify(parameters)) shows: {"parameters":[{"key":"feedbacksource","value":"foo"},{"key":"status","value":"foo"},{"key":"feedbacktype","value":"foo"}]} ajax: $.ajax({ type: "post", url: "mypage.aspx/mymethod", data: json.stringify(parameters), contenttype: "application/json; charset=utf-8", datatype: "json" }); method: [webmetho

c++ - Is there any good way to control the line just after manual indented line? -

i'd control indent follows: #define my_ns_macro namespace myns namespace ns1 { int a; // indent 0 expected int b; // indent 0 expected } my_ns_macro { int c; // indent 0 manually (if press tab here, indent 4) int d; // expect indent 0, indent 1... } void f() { int e = 0; // indent 4 expected. } the variables a, b, , e indented expected. variable c, emacs controls indent 4. however, i'd indent 0. remove 4 spaces hand. it's ok me. then, enter next variable d, expect line indented 0 too. however, indented 1. there way control indent? here .emacs: (defun my-c-c++-mode-init () (setq c-basic-offset 4) (c-set-offset 'substatement-open 0) (c-set-offset 'innamespace 0) (c-set-offset 'arglist-intro '+) ) (add-hook 'c-mode-hook 'my-c-c++-mode-init) (add-hook 'c++-mode-hook 'my-c-c++-mode-init) turns out, there's variable that's interfering want c-label-minimum-indentation if set so: (setq c-label-min

javascript - Fetch Response is not setting browser cookie -

i'm using fetch api set cookie in browser. request object fetch('/auth',{ method:'post', headers:{ 'accept':'application/json', 'content-type':'application/json' }, body: json.stringify({ username:this.state.username, password: this.state.password, email: this.state.email }) }) .then(function(response){ console.log(response) }) .catch(function(err){ console.log(err) }) on server side db.one('insert account(username,password,email) values ($1,$2,$3) returning * ',[req.body.username,hash,req.body.email]) .then((result) => { console.log('successfully registered: ',result) const id_token = jwtsign(result) console.log('id_token: ',id_token) res.cookie('id_token',json.stringify(id_token),{ expires: new date(date.now() + (24 * 60 * 60 * 1000 * 30 * 12 * 10)), httponly:

html - More efficient way of recreating elements with JavaScript -

i have html table, each row clickable , acts accordion. when row clicked, few elements (another table, few other div elements, etc) visible underneath each row. here fiddle functionality: http://jsfiddle.net/7dfwrje7/5/ the problem is, if had n number of rows, i'd have append code hidden elements each row in order work, is, code: <tr> <td colspan="6"> <input id="row1" type="checkbox"> <table> <tr> <th>phone number</th> <td>555-3226</td> <th>city:</th> <td>new york</td> </tr> <tr> <th>hire date:</th> <td>8/13/12</td> <th>salary:</th> <td>$48,000</td> </tr> </table> </td> </tr> in addition, have give input n

mysql - Match user IP address with sql database entry in PHP -

can't figure out what's wrong code, not returning $result: // check see if user has voted $current_user = $_server['remote_addr']; $select_query = "select * w_poll_counter user_ip = " . $current_user; echo $select_query; $result = mysql_query($select_query); echo $result; if($result) { //user voted - show results page header("location: show_results.php"); exit(); } the echo statements debugging purposes , removed once i've (or you've!) solved problem. echo $select_query returning variable how expect it, echo $result returning nothing @ all. i'm able cast multiple votes same ip address during testing. undesirable! please help! thanks try quoting query $select_query = "select * w_poll_counter user_ip = '" . $current_user ."';";

excel vba - Using VBA To Add Specific Cells In A Row Depending On The Value Of A Specific Cell -

i trying sum cells within row based on period. instance in period 4 cells b2,c2,d2,e2,and f2. need "if sum this" function run rows have data entered. can have on 200,000 rows, using excel formula doesn't work. output of summing corresponding cell in column o. below shortened version of code (i didn't figure needed post 12 periods). when run code 'range' of object'_global' failed , highlights specified range chicken. if knows cleaner way this, i'd appreciate it. sub addrowsbyselectedperiodmacro() sheets("blah").select dim lastrow long, long, period long, chicken long lastrow = activesheet.usedrange.rows.count period = range("p2") = 2 lastrow if period = "1" chicken = cells(i, 2).value + cells(i, 3).value elseif period = "2" chicken = cells(i, 2).value + cells(i, 3).value + cells(i, 4).value else: period = "12"

Rails querying with an array -

so in controller made page shows group_pages(the scaffold) in array @group_post_users contain current user so: def my_group @group_pages = grouppage.all @group_pages.each |group_page| @group_page_users = group_page.page_users.split(',') @group_page_users.push(group_page.user.email) @mg_users = user.find_by_email(@group_page_users) @gg_users = user.where(:email => @group_page_users) group_page.super_uses = @gg_users @g_pages = grouppage.where(:super_uses => @selected_posts.map(&:id)) end end now have array of users group_page in @group_page_users , want show group pages contain current user inside @group_page basically want : @g_pages = grouppage.where(:super_uses => current_user.email)

How to add a Filter with WebMvcConfigurerAdapter in Spring? -

Image
with webapplicationinitializer , can add filter servletcontext within onstartup() method. how add filter webmvcconfigureradapter ? have use xml? add 1 to others understand spring web configuration more easily, draw following illustration. now need first understand rational behind spring web configuration. , pick config class inherit , method override below. it's less painful remember many things. and article on spring web initialization: http://www.kubrynski.com/2014/01/understanding-spring-web-initialization.html add 2 based on tunaki 's reply, checked abstractdispatcherservletinitializer . filter registration happens in following code: even override green getservletfilters() method, still cannot access dyanmic result of registerservletfilter() . how can configure filter addmappingforurlpatterns() ? it seems have to override whole registerdispatcherservlet() method. webmvcconfigurer interface used customize java-based configuratio

PHP Color the lowest price in a table -

i try insert 7 price values table , color lowest price. don't know place $lowestprice . i'm aware it's poor code, worked until try add color. for ($i = 1; $i <= 7; $i++){ ${"price".$i} = preg_replace($regexp, $match, ${"rawprice".$i}); if (preg_match('/'.$article.'/i', ${"stock".$i})) { $list[$i] = ${"price".$i}; $lowestprice = min($list); if (preg_match('/^'.$lowestprice.'/i', ${"price".$i})) { echo ${"url".$i}." class=\"lowestprice\">".${"price".$i}." €</a></td>"; // lowest price in color css } else { echo ${"url".$i}." class=\"price\">".${"price".$i}." €</a></td>"; } } else

javascript - Angular select model not setting value -

i have array of strings, account numbers. when record in table clicked provide modal update record , 1 of fields account number. displays , correctly seems loss 2 way binding vm.accountnumber show value model is. vm.accountnumber has value set when table row being clicked editing. never makes select despite model. suspect im losing 2 way link , creating own variable model. <select class="ui search fluid selection dropdown" id="accountsearch" ng-model="vm.accountnumber"> <!--ng-options="account account in vm.accounts.slice(1)">--> <option ng-repeat="account in vm.accounts | limitto: vm.accounts.length : 1" value="account" ng-selected="account == vm.accountnumber">{{account}}</option> </select> here snippet of accounts array. 0:"-" 1:"0001" 2:"0002" 3:"0003" 4:"0004" i use ng-options directive

How to create derived class in c++ -

i'm confused on how deal inheritance in c++ i'd pass parameters on constructor. got run when create class without parameters. this small program: #include <iostream> using namespace std; // base class class shape { protected: int width, height; public: shape(int w, int h) { width = w; height = h; } void setdimensions(int w, int h) { width = w; height = h; } }; // new class rectangle based on shape class class rectangle: public shape { public: int getarea() { return (width * height); } }; when compile errors: $ g++ inheritance.cpp -o inheritance -g -std=c++11 inheritance.cpp:44:13: error: no matching constructor initialization of 'rectangle' rectangle r(3, 4) ^ ~~~~ inheritance.cpp:33:7: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, 2 provided class rectangle: public shape { ^ inheritance.cpp:33:7: note: candidate constructor

django - NameError name 'Views' is not defined -

from django.conf.urls import url, patterns, include django.contrib import admin django.views.generic import templateview collection import * #from collection.views import index,thing_detail,edit_thing urlpatterns = [ url(r'^$', views.index, name='home'), url(r'^about/$',templateview.as_view(template_name='about.html'),name='about'), url(r'^contact/$',templateview.as_view(template_name='contact.html'),name='contact'), url(r'^things/(?p<slug>[-\w]+)/$', 'views.thing_detail' ,name='thing_detail'), url(r'^things/(?p<slug>[-\w]+)/edit/$', 'views.edit_thing',name='edit_thing'), url(r'^admin/', include(admin.site.urls)), ] after running server there error "nameerror: name 'views' not defined" any ?? you aren't importing own views. try adding urls.py : from . import v

python - Move popup window -

the popup image window blocks stop button , other buttons in windows application. how move window in squish? tried move window using following script. squish not recognizing popup window. win = waitforobject(":_image0") mousepress(win.x, win.y - 10, mousebutton.leftbutton, 0) mousemove(win.x + 100, win.y) mouserelease(mousebutton.leftbutton) thanks pg you try using mousedrag() function, e.g. mousedrag(win, 100, 0) in upcoming squish 6.1 release, there's toplevelwindow api can used move such windows.

java - How to customize an adapter in Android? -

Image
i making simple android app takes name, email , contact number of user , saves these (including id) in phone's memory (via sqlite). "show all" page displays details of user in database in listview using custom adapter. runs this: it leaves these spaces in between rows. how remove these spaces? also, details mixed while retrieving database. first row displayed in correct format (as wanted) . second's details got mixed up. how correct this? mydbhandler.java public class mydbhandler extends sqliteopenhelper{ private static final int database_version = 1; private static final string database_name= "user.db"; public static final string table_name = "data"; public static final string column_id = "id"; public static final string column_name = "name"; public static final string column_email = "email"; public static final string column_phno = "phno"; public mydbhandler(c

python - parsing Gradle exception messages from a text file -

i have gradle build exception message 1 below in text file "error code 1\ncommand line is: output/googlesamples/android-> actionbarcompat-basic/head/gradlew --stacktrace -p output/googlesamples/android-actionbarcompat-basic/head assembledebug\n\n\nfailure: build failed exception.\n\n\n\n* where:\n\nbuild file '/...../output/googlesamples/android-actionbarcompat-basic/head/application/build.gradle' line: 12\n\n\n\n* went wrong:\n\na problem occurred evaluating project ':application'.\n\n> failed apply plugin [id 'com.android.application']\n\n > gradle version 2.10 required. current version 2.8. if using gradle wrapper are there libraries in python make use of parse exception message , obtain individual parts of ? eg: error code, command line, failure, etc ?.

python 3.x - Python3 string representation -

in python2 1 could: >>> struct.pack(">f", 125.4) >>> 'b\xfa\xcc\xcd' how can same string in python3? i've tried different encodings, can exactly. i able correct string decoding bytes 'latin1' codec. doesn't same in python3 console in python2 console, interpreted same program. python2: >>> struct.pack(">f", 125.4) 'b\xfa\xcc\xcd' python3: >>> b = struct.pack(">f", 125.4) >>> b.decode("latin1") <something cannot pasted>

java - How to edit file in resources of Spring MVC? -

i have project on spring mvc, resources folder added buildpath of spring. project structure on ui action want edit file resources/thirdparty/thirdparty.er controller. so here code tried file inputfile = new file("/home/local/<user>/desktop/workspace/<projectname>/webcontent/resources/thirdparty/thirdparty.er"); result - worked fine instead of absolute path wanted relative path tried file inputfile = new file("../../<something>/webcontent/resources/thirdparty/thirdparty.er"); result - worked fine, path relative eclipse(base path), executing code in eclipse to remove eclipse path dependency, tried file inputfile = new file("/resources/thirdparty/thirdparty.er"); result - didnot worked later on searching web, found resource resource = new classpathresource("/thirdparty/thirdparty.er"); file inputfile = resource.getfile(); result - returning /home/local//desktop/workspace/ .metadata/.plugins/org

Why is the if statement on Visual C# not being evaluated properly? -

i'm trying make times table console application in visual studio 2015 community using visual c#, if statement isn't being evaluated properly. started debug (test) console application, if statement wasn't evaluated in last 3 questions. can help? here code: using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; namespace xtables { class program { static void main(string[] args) { console.writeline("welcome xtables"); console.writeline("in application, you'll have answer questions from"); console.writeline("the times table 12"); console.writeline("good luck!"); //question 1 console.writeline("what 1 x 6"); string useranswer = console.readline(); if (useranswer == "6") { string message =

linux - How to store PostgreSQL state in Docker hosts -

postgresql's handling of it's data folder not compatible docker's host mounted folders. it might work under linux ext4 file systems mounted, on os x or windows, when running docker run -it --rm -v `pwd`/test:/var/lib/postgresql/data postgres initdb terminates in random disk write errors like: creating template1 database in /var/lib/postgresql/data/base/1 ... fatal: not write file "pg_xlog/xlogtemp.25": input/output error or fatal: not close file "base/1/1249": input/output error fatal: not close file "base/1/2603": input/output error context: writing block 0 of relation base/1/1247 when using named volumes, works well, named volumes not safe way keep data. example in docker mac hidden inside huge qcow2 virtual disk image. what strategy recommend keeping postgresql's state in non-linux hosts? should saving backup every n minutes mounted folder , check data folder on startup , restore backup if needed? or should rsy

linux - Reinstate Virtual Com Port after using libftdi on FT232RL -

i'm trying use libftdi toggle pins on ft232rl, use regular virtual com port (/dev/ttyusb0). i've got microcontroller (lpc1114) connected ft232rl programming. isp mode, has reset 1 line held low, , execute code after programming, has reset. i'm trying automate ft232. i've got libftdi working, , toggling pins correctly, once program finishes, vcp has disappeared /dev. using libftdi example programs, have physically unplug , plug in usb cable, defeats purpose. tl;dr: there way /dev/ttyusb0 after using libftdi in bitbang mode without unplugging cable. libftdi seems use libusb under hood. you clould try using libusb_attach_kernel_driver function libusb restore /dev/ttyusbx functionality.

haskell - What is the monomorphism restriction? -

i'm puzzled how haskell compiler infers types less polymorphic i'd expect, example when using point-free definitions. it seems issue "monomorphism restriction", on default on older versions of compiler. consider following haskell program: {-# language monomorphismrestriction #-} import data.list(sortby) plus = (+) plus' x = (+ x) sort = sortby compare main = print $ plus' 1.0 2.0 print $ plus 1.0 2.0 print $ sort [3, 1, 2] if compile ghc obtain no erros , output of executable is: 3.0 3.0 [1,2,3] if change main body to: main = print $ plus' 1.0 2.0 print $ plus (1 :: int) 2 print $ sort [3, 1, 2] i no compile time errors , output becomes: 3.0 3 [1,2,3] as expected. if try change to: main = print $ plus' 1.0 2.0 print $ plus (1 :: int) 2 print $ plus 1.0 2.0 print $ sort [3, 1, 2] i type error: test.hs:13:16: no instance (fractional int) arising literal ‘1.0’ in first argument of ‘plus’, nam

Unable to copy svn repo to a new branch -

i have svn repo want create branch. my current svn info gives me: user@node directory $ svn info path: . url: svn://10.169.99.170/ilab/trunk/master repository root: svn://10.169.99.170/ilab repository uuid: 065c76b3-4556-42dd-b1f2-9738222b7d84 i trying create new branch out of , using below command: user@node dir $ svn copy svn://10.169.99.170/ilab/trunk/master svn://10.169.99.170/ilab/branches/msd -m "creating msd branch" svn: path 'branches' not present on svn server, directory looks like: [root@svnnode ilab]# ls -ltrh total 28k -rw-r--r-- 1 root root 229 jun 7 14:52 readme.txt drwxr-xr-x 2 root root 4.0k jun 7 14:52 locks drwxr-xr-x 2 root root 4.0k jun 7 14:52 hooks -r--r--r-- 1 root root 2 jun 7 14:52 format drwxr-xr-x 2 root root 4.0k jun 7 14:53 conf drwxr-sr-x 6 root root 4.0k jul 15 17:08 db is there missing ? is there missing ? yes: miss understanding "what done", "what happened" , "what t

https - C# DownloadFileTaskAsync not downloading nested zip file -

please c# newbie, i'm trying download zipped files https site script task in ssis. each "external" zip file contains "internal" zip file, contains 3 txt files. after extensive search, i've enhanced downloadfiletaskasync "await", ".wait()" , "while (webclient.isbusy) still manage download empty "external" zip file. please me find way download full "external" file in way won't empty, contain "internal" zip , 3 txt files inside of it: public async void main() { webclient webclient = new webclient(); webclient.credentials = new networkcredential("myuser", "password", "https://example.com/login.htm"); webclient.downloadfiletaskasync(new uri("https://example.com/#/fromsender/external_20160706.zip"), @"c:\temp\test\external_20160706.zip").wait(); while (webclient.isbusy) thread.sleep(1000); dts.ta

ruby - What is the difference between double and spy? -

Image
i'm reading spies , can't see de difference between this: rspec.describe "have_received" "passes when message has been received" invitation = spy('invitation', deliver: "ok") invitation.deliver expect(invitation).to have_received(:deliver) end end and this: rspec.describe "have_received" "passes when message has been received" invitation = double('invitation', deliver: "ok") invitation.deliver expect(invitation).to have_received(:deliver) end end both examples passes without problem. can't see advantage using spy as @max said in comments, difference can use spy without deliver: "ok" . so, running this: rspec.describe "have_received" "passes when message has been received" invitation = spy('invitation') invitation.deliver expect(invitation).to have_received(:deliver) end end rspec.describe

ms word - Get rid of Compatibility Mode warning -

i use rtf default format. there way keep word 2013 showing “[compatibility mode]” after title of every document? taking lots of space in taskbar , title bar , makes titles of documents hard read. there's no way suppress using setting - rtf file format hasn't been "plain text" version of word document since word 2007, when word open xml format took on role. rtf file equates compatibillity mode since cannot support newer word functionality. the possibility you'd have set caption property of application object, using vba or language automating word application. need aware not permanent in way.

java - What's the dedicate way to use ExecutorService and Future? -

i have batch of items. , each item, can itemid, use id db lookup , generate transactions batch. list<batchitem> batchitemslist; // assume list have list of items list<transaction> results = new arraylist<>(); executorservice executor = executors.newfixedthreadpool(5); list<future<transaction>> tasks = new arraylist<>(); for(batchitem item: batchitemslist) { mythread worker = new mythread(item); future<transaction> future = executor.submit(worker); tasks.add(future); } for(future<transaction> t: tasks) { results.add(t.get()); } mythread.java public class mythread implements callable<transaction>{ private final batchitem batchitem; public mythread(batchitem batchitem) { this.batchitem = batchitem; } @override public transaction call() throws exception { string id = batchitem.getid(); // sql lookups.... transaction t = new transaction(sql lookup result values...); re

java - Error:(21, 8) error: class MyActivity is public - Can't edit MyActivity -

when trying edit myactivity, opens mainactivity.java. when trying change read flag error message shows up failed change read-only flag /root/androidstudioprojects/myapplication3/app/src/main/java/xyz/adamstephenson/android/myapplication/mainactivity.java i'm trying make public class outputs information when button pressed on android. the error is: error:(21, 8) error: class myactivity public, should declared in file named myactivity.java package xyz.adamstephenson.android.myapplication; import android.app.activity; import android.os.bundle; import android.util.log; import android.view.view; import android.widget.button; import android.content.intent; import static xyz.adamstephenson.android.myapplication.r.layout.activity_main; public class myactivity extends activity { protected void oncreate(bundle icicle) { super.oncreate(icicle); setcontentview(activity_main); final button button = (button) findviewbyid(r.id.button);

ios - copy CVPixelBufferRef -

the code in copypixelbuffernow long. :-( @property (nonatomic,assign)cvpixelbufferref pixelbuffernowref; - (cvpixelbufferref)copypixelbuffernow { if (_pixelbuffernowref == null) { return nil; } cvpixelbufferref pixelbufferout = null; cvreturn ret = kcvreturnerror; size_t height = cvpixelbuffergetheight(_pixelbuffernowref); size_t width = cvpixelbuffergetwidth(_pixelbuffernowref); size_t bytersperrow = cvpixelbuffergetbytesperrow(_pixelbuffernowref); cfdictionaryref attrs = null; const void *keys[] = { kcvpixelbufferpixelformattypekey }; // kcvpixelformattype_420ypcbcr8planar yuv420 // kcvpixelformattype_420ypcbcr8biplanarfullrange nv12 uint32_t v = kcvpixelformattype_420ypcbcr8biplanarfullrange; const void *values[] = { cfnumbercreate(null, kcfnumbersint32type, &v) }; attrs = cfdictionarycreate(null, keys, values, 1, null, null); ret = cvpixelbuffercreate(null, widt