Posts

Showing posts from January, 2011

.htaccess - mod_rewrite - change top level domain -

im trying find out issue following mod_rewrite rule: on account on "strato" (hoster) rule working, not working on "1und1" (another hoster). there wrong rule? # rewrite rule rewriteengine on rewritebase / rewritecond %{http_host} ^.*original-domain.de [nc] rewriterule /* http://new-subdomain.anotherdomain.de%{request_uri} [p] # end rewrite rule is there perhaps or better way redirect done? the goal user visiting http://www.original-domain.de (with or without www.) should see content of http://new-subdomain.anotherdomain.de original-domain adress still stays in adressbar of browser. in other words, user won't recognize got redirected. and, question: stands [p] after rewrite rule? if change [l] redirect works new-subdomain.anotherdomain.de adress beeing displayed in browser? couldn't find website describes properly. thanks in advance!

android - How to show Toolbar's logo, icon, title, subtitle when wrapped in a CollapsingToolbarLayout? -

Image
after android support design library released, wanted implement effect page of twitter profile , in toolbar 's title , subtitle changed screen scrolled vertically. tried use coordinatorlayout , appbarlayout , collapsingtoolbarlayout , toolbar android support design library achieve effect. worked expected except toolbar 's content couldn't showed or changed wanted. should have been wanting display collapseicon , navigationicon , title , subtitle of toolbar , didn't show though had set them in layout , programmatically. blog said, note in cases, should call settitle() on collapsingtoolbarlayout, rather on toolbar itself. if have checked doc , find out collapsingtoolbarlayout focus on settings of title , can nothing collapseicon , navigationicon , subtitle . so tell me how achieve effect toolbar , collapsingtoolbarlayout ? if couldn't able, other things be? has ideas this? any tips appreciated. in advance. this issue reported here ...

ios - Reset background in UIPageViewController -

i have uipageviewcontroller displaying uiimageview . i can swipe , displayed correctly: image 1 there "edit" button pushes viewcontroller on screen: self.navigationcontroller!.pushviewcontroller(editpictureviewcontroller, animated: true) when editpictureviewcontroller closed: either clicking button or calling done button navigationcontroller?.popviewcontrolleranimated(true)) the background of uipageviewcontroller not white anymore: it's "image 1" (the image displayed before editpictureviewcontroller pushed). if swipe see previous image, background not white. see here: image 2 what's problem background? ok found issue... initiating uipageviewcontroller in viewwillappear instead of viewdidload :-/

c# - How to put generic Type (T) as parameter? -

i have error: severity code description project file line error cs0246 type or namespace name 't' not found (are missing using directive or assembly reference?) on method signature method: public static void sendmessage(string queuname, t objeto) { queueclient client =queueclient.createfromconnectionstring(connectionstring, "empresa"); brokeredmessage message = new brokeredmessage(objeto); message.contenttype = objeto.gettype().name; client.send(new brokeredmessage(message)); } you forgot specify type parameter. can in 2 ways: either define them @ method definition (which way go in case, because method static): public static void sendmessage<t>(string queuname, t objeto) or can specify them on class definition (for instance methods): class myclass<t>{ public void sendmessage(string queuname, t objeto){} }

java - Does it make sense to Unittest wrapper methods -

this question philosophical. given have method this: public list<string> getstuffbyname(@notnull string name) throws someexception { return somedependency.createquery().byname(name).list().stream() .map(execution -> execution.getprocessinstanceid()) .collect(collectors.tolist()); } basically call dependencies method , process using stream api. a unittest - in strict understanding(?) - testing 1 isolated unit. mock dependencies, assume tested units themselves. if go through this, end method exclusively consists of stuff tested elsewhere. eg jmockit test this: public void test_get_processes_for_bkey_2(@mocked executionquery query, @mocked list<string> processes, @mocked list<execution> executions, @mocked stream<execution> e_stream, ...

opencart - Open cart edit checkout functionality -

i new opencart. want add functionality in open cart site. want create pdf file text , order number after check out process. know it's possible edit check out model , controller files. have doubt lose when upgrade opencart? if there other solution requirement? please me you can create function in checkout/order.php model, handle pdf generation operations. before upgrading, can save pdf generator function file keep it. i can recommend http://dompdf.github.com/ html pdf generator.

java - How to force View to recalculate it's position after changing parent -

Image
it has been days since have problem. this reformulation of this question considering behavior describe on this answer . please, note question states less specific case, , answer useful many different scenarios. i'm moving 1 chip left point right point, , writing original , new coordinates: so failing: public void ontouch(view view) { int[] aux = new int[2]; //get chip view movingchip = findviewbyid(r.id.c1); //write it's coordinates movingchip.getlocationonscreen(aux); ((textview)findviewbyid(r.id.p1t1)).settext("(" + aux[0] + "," + aux[1] + ")"); //move ((linearlayout)findviewbyid(r.id.p1)).removeview(movingchip); ((linearlayout)findviewbyid(r.id.p2)).addview(movingchip); movingchip.requestlayout();//#### adding didn't solve //write it's coordinates movingchip.getlocationonscreen(aux); ((textview)findviewbyid(r.id.p2t4)).settext("(" + aux[0] + "," + au...

javascript - Jquery infinity scroll loops over and over using Mysql/PHP -

i'm trying implement jquery infinity scroll found @ ( http://infiniteajaxscroll.com/ ) mysql , php. , works, sort of. i found similar example here quite different anyway ( http://www.w3bees.com/2013/09/jquery-infinite-scroll-with-php-mysql.html ) the loading more works fine results being looped on , on again. mean display results in first page , when scroll down @ bottom , infinity scroll fires same results being showed instead of splitting first results in different pages. here code, quite long :) <?php $page = (int) (!isset($_get['s'])) ? 1 : $_get['s']; // shoutbox $sql = "select * shoutbox order id desc limit 20"; //prepare statement $statement = $dbconn->prepare($sql); //execute statement $statement->execute(); //count shouboxes $number_of_shoutbox = $statement->rowcount(); $number_of_posts_per_page = '10'; $total_pages = $number_of_shoutbox / $number_of_posts_per_page; ?> <div class="ba...

ruby on rails - Inject attribute from association table into the associated record? -

i have following model in rails app: class course < activerecord::base has_many :memberships has_many :members, through: :memberships, class_name: 'user' end while course.members returns course's members, don't access membership model has role attribute. how find user role without having find membership given course , user ? can inject role attribute user somehow in context association? user model: class user < activerecord::base has_many :memberships, dependent: :destroy has_many :courses, through: :memberships end here's solution, not beautiful , idiomatic though class course < activerecord::base has_many :memberships def members user.joins(:memberships).where(id: memberships.ids).select('users.*, memberships.role') end end a better approach, suggested through comments: has_many :members, -> { select('users.*, memberships.role') }, class_name: 'user', through: :memberships, ...

java - When I am running my first android app using Genymotion emulator its giving error unfortunately "app name" has stopped. Please help me -

i giving details of files below.please check them , let me know doing mistake due error "unfortunately "app name" has stopped" error coming when running first android app using android sdk. since beginner in android development please explain solution nicely. my mainactivity.java file : package com.example.sunny.myfirstapp; import android.app.activity; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.textview; public class mainactivity extends activity { textview textview; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); textview=(textview)findviewbyid(r.id.greetings_view); } public void showgreetings(view view) { string message= "welcome app"; textview.settext(message); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds ...

adobe - Receiving unexpected server calls -

in adobe analytics try implement link tracking links can found in page using this: $(document).on('click', 'a', function() { s.tl(this, 'e', 'external', null, 'navigate'); return false; }); try test using page the calls coming how have adobe analytics configured. there handful of config variables cause requests depending on how set them (on own and/or in relation each other). here listing of adobe analytics variables reference. these ones at: s.trackdownloadlinks - if enabled, standard links href value ending in value(s) specified in s.linkdownloadfiletypes trigger request on click. generally, enable automatic tracking links prompt visitor download (e.g. pdf file). s.trackexternallinks - if enabled, standard links href not matched in s.linkinternalfilters or matched s.linkexternalfilters trigger request on click. generally, enable automatic tracking links count visitor navigating off site(s). s.linkinte...

javascript - JQuery/AJAX update DIV from MYSQL - Get values from different input 2 inputs -

i bit new jquery , have script values text input on onchange event , send data external php file can data db in fetch div id "txthint3". the whole script works fine problem have need values 2 different text input fields , send 2 values php file. essentially if 1 of 2 input text changes, need push 2 values jquery , php script. i have tried few different ways without significant result. help/ideas appreciated!! here jquery code wrote far : <script> function recordtrans(str) { if (str == "") {`enter code here` document.getelementbyid("txthint3").innerhtml = ""; return; } else { if (window.xmlhttprequest) { // code ie7+, firefox, chrome, opera, safari xmlhttp = new xmlhttprequest(); } else { // code ie6, ie5 xmlhttp = new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange = function() { if (xmlhttp.readystate == 4 && xmlhttp.status ...

javascript - unable to read respone from python server -

i writing simple python server , using do_get return html following from basehttpserver import httpserver, basehttprequesthandler class requesthandler(basehttprequesthandler): def _writeheaders(self): self.send_response(200) self.send_header('content-type', 'text/html') self.end_headers() def do_head(self): self._writeheaders() def do_get(self): f = open("/full/path/to.html") self._writeheaders() self.wfile.write(f.read()) serveraddr = ('localhost', 7070) srvr = httpserver(serveraddr, requesthandler) srvr.serve_forever() in html have <html> <head> <title>mychart</title> <meta charset="utf-8"> </head> <div > ...divs... </div> <script> ...js functions... </script> <body> <script src="js/jquery-1.8.2.min.js" type="text/javascript"></script> </body> ...

java - Difficulty with Caesar Cipher Chi-Squared -

in case unfamiliar cipher. idea able encode message shifting letters in alphabet. ex. d shift 3 -> a. able decode message using crack method. crack method makes array full of chi square values (compared natural alphabetical frequencies in table) every possible shift (its index) , checks see shift has smallest value. takes value , decodes using shift amount. the problem, getting smallest chi square value in wrong address of array able decode accurately. i'm not looking give me answer, should in code make correction. thanks in advance. import java.util.arrays; public class cipher { //alphabet frequency static double[] table = {8.2, 1.5, 2.8, 4.3, 12.7, 2.2, 2.0, 6.1, 7.0, 0.2, 0.8, 4.0, 2.4, 6.7, 7.5, 1.9, 0.1, 6.0, 6.3, 9.1, 2.8, 1.0, 2.4, 0.2, 2.0, 0.1}; //convert letter number static int let2nat(char c) { return ((int) c) - 97; } //convert number letter static char nat2let(int code) { return (char) (code + 97); } //shift letter letter shftamt spaces away...

django - Do not require authentication for GET requests from browser -

this question closely related do not require authentication options requests my settings.py rest_framework = { 'unicode_json': true, 'non_field_errors_key': '__all__', 'default_authentication_classes': ( 'rest_framework.authentication.tokenauthentication', ), 'default_permission_classes': ( 'platformt_core.something.permissions.djangoobjectpermissionsoroptions', ), 'default_renderer_classes': ( 'rest_framework.renderers.jsonrenderer', ), 'allowed_versions': ['v1'], 'default_versioning_class': 'rest_framework.versioning.namespaceversioning', 'test_request_default_format': 'json', 'test_request_renderer_classes': ( 'rest_framework.renderers.jsonrenderer', ) } platformt_core/something/permissions.py from rest_framework.permissions import djangoobjectpermissions...

linux - Getting sec_error_reused_issuer_and_serial while doing curl -

i trying curl aws instance using client certificate authentication. although certificates generated , shared correctly across boxes, getting sec_error_reused_issuer_and_serial error. curl -i -v --cert /pathtocert --key /pathtokey http://ip.to.aws.box

SQL Server : Bulk Insert 0 Rows Affected -

i'm new sql , i'm attempting bulk insert view, however, when execute script message says (0 row(s) affected). this i'm executing: bulk insert vwdocgeneration '\\servername\data\doc\test.csv' ( fieldterminator = '|', rowterminator = '\r\n' ) i've confirmed row terminators in source file , end crlf. view , file being imported have same number of columns. i'm stuck! ideas appreciated! per mike k 's suggestion started looking @ key constraints , after adjusted on of them able use bulk insert! fyi did insert view because table had additional field wasn't included in csv file. confirming possible @gordon linoff.

javascript - Audio src saved on cookie but not playing -

i have 5 songs in playlist , when click on next song see current src has saved on cookie when reload browser current src not auto playing.in browser console network tab - initiator i've found other . var song = document.getelementsbytagname('audio')[0]; var played = false; var runsrc = $.cookie("savesrc"); function update() { if(!played){ if(runsrc){ song.addeventlistener("canplay",function(){runsrc&&(song.src=runsrc,runsrc=null); }); song.play(); played = true; } else { song.play(); played = true; } } else { $.cookie('savesrc', song.src); } } setinterval(update,0);

jquery - Posting images from src to server -

i have form below, want post image file src of img, should do? <form style="width: 205px; height: 205px; float: left;" method="post" action="/3/edit_profile/" enctype="multipart/form-data"> <input type="hidden" name="csrfmiddlewaretoken" value="uw4ryssp..."> <img id="cropped_0" src="data:image/png;base64,ivbo..."> </form> so think want store image in database. can pass src of image django view(using hidden input). in django view import requests img = requests.get(src) then can access image content img.content , store in database

unity3d - Xcode 6.1.1 UIKit framework -

i working on project on xcode 6.1.1 , build successfully, accidentally removed uikit framework file. still had xcode 5 on computer , copied framework file xcode 5 xcode 6.1.1 framework directory. after can't build project , gives me error on displaymanager.mm file "property nativescale not found" . project generated unity , file unity generated file. guess right on error on uikit framework have xcode 5. i'll appreciate if has xcode 6.1.1 , can give me uikit framework file can test again. much you can download desired xcode version anytime here: https://developer.apple.com/downloads/ and direct link xcode 6.1.1: http://adcdownload.apple.com/developer_tools/xcode_6.1.1/xcode_6.1.1.dmg

PHP Timezone incorrect When using time() -

i using time() record current time in php application. i based in uk use utc timezone. means in summer/winter switch gmt timezone bst (which gmt +1). problem that, time() still uses gmt timezone means 1 hour behind. how make shows bst time 1 hour ahead of gmt? when echo out time, 1 hour behind. what have tried: adding following pieces of code: date_default_timezone_set("europe/london"); ini_set("date.timezone", "europe/london"); re-installing php 5.5 extensions storing timezones updated. thanks found solution. the problem not time() seconds past date. when coming show date, instead of using gmdate() instead use date() . this take account default timezones set in document/ini file.

raspberry pi - mySQL InnoDB tables damaged after clean system restart -

i have problem small (it's raspberry pi) mysql installation. point it's sure innodb system files corrupted/damaged after system (debian linux like) reboot or halt. logs show innodb engine shotdown mysql not start after because of damaged innodb files. just explain, raspberry pi small computer running debian linux. file system sd card based. hardware small use collect real world sensors data, it's not unusual have dozen of thousands rows in main table. i asked question on rpi forum seems need more experienced mysql people solve :) i did 2 things , appears have helped: made sure debian-sys-maint user still there server shut down: grant privileges on *.* 'debian-sys-maint'@'localhost' identified '[password /etc/mysql/debian.cnf]' grant option; flush privileges; then, added sync in /etc/init.d/mysql script in stop case before ; i had problem after complete reimage (due power failure corrupting filesystem) , it's behav...

angularjs - Not able to click the Matched Row button in the repeater in protractor Test Case? -

this test code when run test click last row button, not able click matched row button. it('repeater element check',function(){ browser.get('http://test.worker.mondaz.com/#/company/select'); browser.sleep(1000); var result = element.all(by.repeater('co in colist')); result.then(function(arr) { (var = 0; < arr.length; ++i) { arr[i].element(by.binding('co.nm')).gettext().then(function(text) { if(text=="monday ventures private limited") { console.log(text); console.log("mathced"); console.log(i);//this giving total row count element(by.repeater('cocolist').row(i)).element(by.name('customradio')).click(); } }); } }); } i beginner angular protractor test case. instead of using for-loop on array of promises returned element.all , should use element.all(locator).filter(filterfn) filter out "monday" element. if understand present code corr...

multithreading - OpenCL program running on CPU -

i want compare performance of single-core cpu , multi-core cpu. wrote program , let iterate 1000 times on single-core cpu see running time. in multi-core case, used opencl launch kernel code same inside iteration in first case. considered multi-core run 8 concurrent threads, theoretically, running time of multi-core case should above t(single-core)/8. results t(multi-core) 1/20 of t(single-core). i wonder why happen? did opencl compiler optimization multi-core cpu ? if single core code scalar, chances opencl runtime used sse or avx , multiplier.

c# - The property " MandatID " is part of the key information of the object and can not be changed -

i'm working on asp.net mvc 4 project , i'm using entityframework connect database. have 4 table : mandat: primarykey mandatid commande: composite primarykey commandeid, mandatid , foriengkey mandatid references mandat article: composite primarykey articleid, mandatid , foriengkey mandatid references mandat lignecommande (association table) : composite primarykey commandeid, articleid, mandatid , foriengkey commandeid, mandatid --> commande articleid, mandatid --> article mandatid --> mandat when try add or modify lignecommande had folowing exception: the property " mandatid " part of key information of object , can not changed.

maya - Wavefront (OBJ) Surface Rendering Issue -

Image
i have wavefront (obj) files i've created molecular simulations. models in file created same way. however, of them have odd transparency (best word can find describe it) them when opened in editors (motionvfxs mobject , versions of maya, example). i've poured through docs , forums , can't find answer. if export .obj .dae (or convert original .obj number of ways), problem persists. missing simple? you can see in screenshot: both blue model , big white model should rendering same (except color) as, far can tell, settings identical. appreciated! i posted links original files in comments (i don't have 10 rep, yet). the normals second blob reversed. causes renderers , viewports interpret blob being "inside-out". all have fix is: import maya select blob switch "polygons" menu-set. in menu, select normals -> reverse normals. export obj again. if curious see normals, select blob , in menu click display -> polygons ->...

VB.net Same Data Splitting Differently Between Browser Control Scrape and Webrequest -

so have browser control in vb.net open, scrape table lines , parse data splitting on environment.newline. i load same site webrequest , data there (not hidden behind js or anything) , row scrapes same data without line breaks in between time. little puzzled one. i've searched around , related thing saw encoding webrequest defaults utf-8 top of page i'm trying read is: <meta charset="utf-8"> so i'm not sure why there difference between browser seeing , webrequest seeing. browser scrape: each element htmlelement in me.bookie.document.getelementsbytagname("tr") if element.getattribute("class") = "row" which works great. the webrequest scrape: for each node htmlnode in smarkdocument.documentnode.selectnodes("//tr[@class='row']") reads same data seems ignore line breaks. the string split same syntax not removing line breaks or , far i'm aware there's no option in we...

location - How android will know towhich provider it must connect if it is already connected to WiFi and after some time WiFi disappeared? -

code switching best locationproviders in android maps https://developers.google.com/android/reference/com/google/android/gms/location/fusedlocationproviderapi check , answer. using can switch provider in regular intervals according availability , accuracy. :)

java - Error 404 while looking maven-downloaded javadoc with External Documentation in IntelliJ -

Image
i have attached maven library project. has javadoc , file present unfortunately, when trying invoke external documentation on of library classes, getting 404 error: note, actual location of jar file apparently different: file located local repository located, while referred located inside project tree. update if invoke quick documentation same class, shows. probably, generates content code comments. simultaneously, displays sort of warning above: following external urls checked: http://localhost:63342/myprojectpath/commons-lang3-3.4-javadoc.jar/org/apache/commons/lang3/arrayutils.html documentation element not found. please add needed paths api docs in project settings.

algorithm - Python: group list items in a dict -

i want generate dictionary list of dictionaries, grouping list items value of key, such as: input_list = [ {'a':'tata', 'b': 'foo'}, {'a':'pipo', 'b': 'titi'}, {'a':'pipo', 'b': 'toto'}, {'a':'tata', 'b': 'bar'} ] output_dict = { 'pipo': [ {'a': 'pipo', 'b': 'titi'}, {'a': 'pipo', 'b': 'toto'} ], 'tata': [ {'a': 'tata', 'b': 'foo'}, {'a': 'tata', 'b': 'bar'} ] } so far i've found 2 ways of doing this. first iterates on list, create sublists in dict each key value , append elements matching these keys sublist : l = [ {'a':'tata', 'b': 'foo'}, {...

shell - Questions about the new auto-backup feature of Android M -

background google has introduced nice new feature on android m allows backup , restore apps, using adb , shown on this video . it seems have use adb shell bmgr command backup , restore apps, such: backup: adb shell bmgr fullbackup package_name restore app: adb shell bmgr restore package_name and works well. the problem the docs quite in new phase, can't find answers questions new tool. what i've tried when typing adb shell bmgr , clues how use it, can't find answers questions. not having device android m , emulator instead, guess work differently. here's what's written when typing command: usage: bmgr [backup|restore|list|transport|run] bmgr backup package bmgr enable bool bmgr enabled bmgr list transports bmgr list sets bmgr transport bmgr restore token bmgr restore token package... bmgr restore package bmgr run bmgr wipe transport p...

r - Check if a column is na in a list -

i trying check if of data frame in list has column entries na. i tried lapply(df,function(x)all(is.na(df))) , works fine check columns. how can check if in below list, first column na. i tried lapply(df[,1],function(x)all(is.na(df[,1]))) not correct way do [[1]] id mas5.signalintensity detectioncalls p.value 1 1007_s_at 3242.90209 p 0.000218932 2 1053_at 377.81481 p 0.017000453 3 117_at 114.88743 0.066864977 4 121_at 8739.03257 p 0.000218932 [[2]] id mas5.signalintensity detectioncalls p.value 1 na 134.40764 p 0.000561751 2 na 453.34875 p 0.002227740 3 na 706.34996 0.066864977 4 na 102.51459 0.089405078 [[3]] id mas5.signalintensity detectioncalls p.value 1 1007_...

javascript - how to send database value from jsp to jsp without using submitting form -

i trying send database value jsp jsp not working this code in js file } xmlhttp.open("get","st_proedit.jsp?pro_id="+ str2 , true); xmlhttp.send(); } } this code in sending jsp onclick="showhint1('st_proedit.jsp', <%=rs.getstring("pro_id")%>)"/> this code in receiving jsp <%request.getparameter("pro_id");%> can me please

Python: how to generate a unique identifier for an XML document? -

xslt has generate-id( xml-document ) function. can create unique identifier xml document. in python how generate unique identifier xml document? note: unique identifier should based on content of xml document, not file name of xml document. example, xml document <root> <comment>hello, world</comment> </root> and xml document <document> <test>blah, blah</test> </document> must generate different identifiers, if file names identical. i have graph of xml documents. need way recognize, "hey, i've seen xml document." don't want compare entire xml documents. instead, want compare uuids correspond xml. a colleague sent me answer: for mapping text id, we’ve used md5 1 hash digest. give md5() function xml document (string) , return 32-character identifier. more details: genid.py import sys import stdio hashlib import md5 def digest_md5(obj): if type(obj) unicode: ...

java - How can I get a Specific Item Out of a List<Map<String, Object>> -

when run code: list<map<string, object>> beforedelete = query("select count(*) wp_announcement announcement_id =" + announcementid, null); system.out.println("this count : " + beforedelete.get(0)); i result: this count : {c1=1} how can 1 , instead of {c1=1} ? if know structure of returned map going show, value inside c1 key this: int val = ((integer)beforedelete.get(0).get("c1")).intvalue(); add safety checks ensure result has 1 element, , initial element has key of "c1" maps java.lang.integer . this should safe long query fixed. if query comes source outside of control, need work out other way access result. note: assuming query makes rdbms, should parameterize query avoid injection attacks.

perl - Installing cpanm in a bash script -

i'm writing script installs , configures nagios requirements. requires cpanm , perl modules. it's using step/try/next function here: https://stackoverflow.com/a/5196220 step "downloading cpanm installer" try `wget -q http://cpanmin.us -o $swrepo/cpanm.install` next step "installing cpanm" try echo '{ exec </dev/tty; cat $swrepo/cpanm.install | perl - app::cpanminus; }' | bash # try bash -c "$(cat $swrepo/cpanm.install | perl - app::cpanminus)" # try cat $swrepo/cpanm.install | perl - app::cpanminus next step "installing perl module nagios config" try `cpanm nagios::config` next my problems here are: whichever way attempt run install cpanminus, fails script, , won't install properly. can't seem make function outside of step/try/next functions (not want to.) the cpanm command fails too. if isolate , run part of script, still fails, "cpanm command not found." can run manually @ command li...

scala - Overloaded method value createDirectStream in error Spark Streaming -

when making call val kafkaparams: map[string, string] =... var topic: string = .. val input2 = kafkautils.createdirectstream[string, string, stringdecoder, stringdecoder](ssc, kafkaparams, topic.toset) i error: overloaded method value createdirectstream alternatives: (jssc: org.apache.spark.streaming.api.java.javastreamingcontext,keyclass: class[string],valueclass: class[string],keydecoderclass: class[kafka.serializer.stringdecoder],valuedecoderclass: class[kafka.serializer.stringdecoder],kafkaparams: java.util.map[string,string],topics: java.util.set[string])org.apache.spark.streaming.api.java.javapairinputdstream[string,string] (ssc: org.apache.spark.streaming.streamingcontext,kafkaparams: scala.collection.immutable.map[string,string],topics: scala.collection.immutable.set[string])(implicit evidence$19: scala.reflect.classtag[string], implicit evidence$20: scala.reflect.classtag[string], implicit evidence$21: scala.reflect.classtag[kafka.serializ...

node.js - Node get posted variables via body-parser -

Image
i'm trying retrieve posted variables in node application. i'm using postman form-data (like have in many other api testing situations) post message node application. when console.log request.body , empty object. here entire node app: var express = require('express'); var app = express(); var bodyparser = require("body-parser"); app.use(bodyparser.urlencoded({ extended: true })); app.use(bodyparser.json()); app.post('/foo',function(request,response){ console.log(request.body); }); app.listen(3000, function(){ console.log('listening on *:3000'); }); after posting data, here shows in console: listening on *:3000 {} here package.json: { "name": "api", "version": "0.0.1", "description": "api", "dependencies": { "express": "^4.12.4", "socket.io": "^1.3.5", "body-parser": "~1.12.0...

java - jsonschema2pojo-maven-plugin:0.4.13:generate failed: trying to create the same field twice -

i getting below error stack while parsing json schema , converting in java pojo. [error] failed execute goal org.jsonschema2pojo:jsonschema2pojo-maven-plugin:0.4.13:generate (default) on project xxxxxxxxxxxx: execution default of goal org .jsonschema2pojo:jsonschema2pojo-maven-plugin:0.4.13:generate failed: trying create same field twice: xxxxxxx -> [help 1] org.apache.maven.lifecycle.lifecycleexecutionexception: failed execute goal org.jsonschema2pojo:jsonschema2pojo-maven-plugin:0.4.13:generate (default) on pro ject xxxxxxxxxxxx: execution default of goal org.jsonschema2pojo:jsonschema2pojo-maven-plugin:0.4.13:generate failed: trying create same field twice: xxxxxxx below maven plugin details using. <plugin> <groupid>org.jsonschema2pojo</groupid> <artifactid>jsonschema2pojo-maven-plugin</artifactid> <version>0.4.13</version> ...

c# - Most efficient way to bin an array of geographic points? -

term(s): binning: in maps-based ui, objective of binning make spatial data more visible user. rather render each geographical point individually, easier digest 'bin' (e.g. hexagonal or rectangular shape, in below example) simpler information instead (e.g. number of points bin contains). i trying bin set of geographic points (example: http://a.tiles.mapbox.com/v3/devseed.map-hw6ew799/page.html#9/-0.3246/35.8887 ). i'm unsure if approach efficient implementation. thoughts on 'algorithm' or pointers appreciated. i implementing in c#. say have csv each line ( lat , lon ) point . read n of them , must render these points in bins make data easier view on map. for implementation try bin points rectangular shapes (so in example, except more square-y because it's simpler calculations). here is: determine maximum , minimum latitude , longitude total of 4 different values. these values form overall bounding box of possible points . cost: n=> o(n)...

excel - Batch Convert TXT to XLS Using VBA -

i trying convert directory full of .txt files .xls using vba. using following code: sub txtconvertxls() 'variables dim wb workbook dim strfile string dim strdir string 'directories strdir = "\\xx\xx\xx\xx\desktop\test\test1\" strfile = dir(strdir & "*.txt") 'loop while strfile <> "" set wb = workbooks.open(strdir & strfile) wb .saveas replace(wb.fullname, ".txt", ".xls"), 50 .close true end set wb = nothing loop end sub the issue is: when run it, states there file name it's trying save in directory. name shows has .xls extension, if there assuredly no .xls's in directory yet! appreciated - thanks! you seem missing strfile = dir before loop . without reprocessing same txt file. while strfile <> "" set wb = workbooks.open(strdir &...

winforms - How to modify a form property for more than one forms in c# -

i want know if can modify form property 1 time , have apply forms (design-time). i have 25 forms in c# project. need change size, same value. takes long time change size 1 one. thus, looking way change sizes 1 time , apply forms using visual studio. for winforms, vs designer write piece of code that's run in constructor (within initializecomponent ), , code in turn saved in "formname.designer.cs" file. based on comment enigmativity , need edit file , replace line of code gives forms sizes. can done "replace in files" function. line: this.clientsize = new system.drawing.size(269, 77); in .designer.cs files (of course actual size different, cautious search expression). replacing numbers new size trick. make sure forms' designers closed don't overwrite changes.

angularjs - Changing value of a boolean using ng-click used inside a ng-repeat -

i displaying data on html page inside div using ng-repeat. inside div have button in order hide content of each div seperately.here simplified version of html file. <body ng-app="task" ng-controller="repeat"> <div ng-repeat='x in array' ng-show="{{ x.show }}"> <p>{{ x.text }} </p> <button ng-click="toggle()">hide</button> </div> </body> the code in .js file follows var app = angular.module('task'); app.controller('repeat',function($scope){ $scope.array = [{ show: true, text:'sample text 1'}, { show: true, text:'sample text 2'}, { show: true, text:'sample text 3'}]; $scope.toggle = function(){ $scope.array.show = false ; }; }) can suggest me required changes on clicking button inside div , particular div gets hidden. i think committ...

vectorization - how to efficiently/conveniently compute A-inner product (ie. a bilinear form) of many vectors in Matlab? -

i want compute thing v'*m*v in matlab v taken columns of given matrix a , square , potentially large. ie. v=a(:,j) what convenient , computationally efficient way this? thinking of using bsxfun , possibly reshape not sure how work. i remember reading similar post long time ago. can't locate it. the fastest way came loop, not elegant way. maybe else think of better. function compare(s, v) m = rand(s); = rand(s, v); %method 1: loop tic r1 = zeros(1, size(a,2)); = 1:size(a,2) r1(i) = a(:,i)'*m*a(:,i); end dt = toc; disp(['for loop ', num2str(size(a,2)), ' vectors of length ', num2str(size(a,1)), ' ', num2str(dt), ' s.']) %method 2: cell functions anonymous function tic ap = num2cell(a, 1); r2 = cell2mat(cellfun(@(x) x'*m*x, ap, 'uni', 0)); dt = toc; disp(['cell functions using anonymous function ', num2str(size(a,2)), ' vectors of length ', num2str(size(a,1)), ' ', num2str(dt), ...

symfony - Translations doesn't work -

i'm using symfony2.6 , catalogue of translation doesn't work message.en.yml #src/appbundle/resources/translations/message.en.yml app: menu: home: home message.fr.yml #src/appbundle/resources/translations/message.fr.yml app: menu: home: accueil and twig {{ 'app.menu.home'|trans }} this output app.menu.home your translation namespace not correct (the final s of message missing), files should named: #src/appbundle/resources/translations/messages.en.yml #src/appbundle/resources/translations/messages.fr.yml or call trans helper message namespace: {{ 'app.menu.home'|trans({},'message') }

section508 - Can I manipulate HTML with javascript in the head in order to make a page 508 compliant? -

i looking @ using 3rd party application part of bi tool must 508 compliant , not have direct access 3rd party tool. do, however, have access head , can put javascript in head. can done make 3rd party tool 508 compliant? there gotcha's manipulating html being 508 compliant javascript in head?

vagrant asks password at only the first time 'vagrant up' -

i made custom vagrant box centos 6.6. question why vagrant requires password when 'vagrant up' @ first time. here console log: $ vagrant bringing machine 'ns' 'virtualbox' provider... ==> ns: clearing set forwarded ports... ==> ns: clearing set network interfaces... ==> ns: preparing network interfaces based on configuration... ns: adapter 1: nat ns: adapter 2: hostonly ==> ns: forwarding ports... ns: 22 => 2222 (adapter 1) ==> ns: running 'pre-boot' vm customizations... ==> ns: booting vm... ==> ns: waiting machine boot. may take few minutes... ns: ssh address: 127.0.0.1:2222 ns: ssh username: vagrant ns: ssh auth method: private key ns: warning: connection timeout. retrying... ns: warning: connection timeout. retrying... ns: warning: remote connection disconnect. retrying... text echoed in clear. please install highline or termios libraries suppress echoed text. vagrant@127.0.0.1's p...