Posts

Showing posts from July, 2011

c - CAN Stack implementation on Rh850 -

i working on can stack , using rh850 controller, having 16 rx buffers , 8 tx buffers per channel. have around 70-75 rx frame , 30-35 tx frames handle. there resource issue in implementing many frames? kindly reply experience/thought on this. in advance! everything depends environment. anyway should avoid analyzing can message during interrupt handler directly these hardware buffers because takes time. recommend check if dma supports can messages transfers. if yes, can have larger space in ram , don't limited hw buffers. biggest advantage of solution don't need analyze frame can focus on more critical tasks.

algorithm - c++ comparing sum of arrays -

i have 2 arrays each 5 integers, how can compare both of array array larger array b, following code return 0: #include <iostream> using namespace std; int main() { const int amax = 5, bmax = 6; int i; bool c1 = true, c2 = false; int a[amax] = { 1, 2, 3, 4, 5 }; int b[bmax] = { 6, 7,8, 9, 1}; (i = 0; < bmax; i++) if (b[i] == a[i]) cout << c1 << endl; else cout << c2 << endl; return 0; } what missing here? update: #include <iostream> using namespace std; int main(){ int a[] = {6,7,29}; int b[] = {3,2,11}; int acc1=0; int acc2 = 0; (int i=0;i<3;i++){ acc1+=a[i]; } for(int j=0;j<3;j++){ acc2+=b[j]; } if(acc1 < acc2){ printf("array b greater array b "); } else{ printf("array b greater array a"); } return 0; } you can use built-in algorithm std::equal compare 2 arrays. example: #include <iostr

perl - $array can't print anything -

this program , want let user type matrix line line , print while matrix , can't see matrix the user type 1 2 3 4 5 6 7 8 9 like this and want let show 1 2 3 4 5 6 7 8 9 perl program $num = 3; while($num > 0 ) { $row = <stdin>; $row = chomp($row); @row_array = split(" ",$row); push @p_matrix , @row_array; @row_array = (); $num = $num - 1; } for($i=0;$i<scalar(@p_matrix);$i++) { for($j=0;$j<scalar(@p_matrix[$i]);$j++) { printf "$d ",$p_matrix[$i][$j]; } print "\n"; } i change expression => printf "$d ",$p_matrix[$i][$j]; print $p_matrix[$i][$j] still don't work. to create multi-dimensional array, have use references. use push @p_matrix, [ @row_array ]; to create desired structure. also, chomp not return modified string. use chomp $row; to remove newline $row. moreover, chomp not ne

angularjs - Function return different response using $q.defer in controller and resolve -

i have created state using state provider , used resolve , called api using factory. .state('test', { url: '/test/:testid', templateurl: template_url + 'test/test.html', controller: "testcontroller", resolve: { gettest : function($stateparams,testfactory){ return testfactory.gettest($stateparams.testid); }, testid: ['$stateparams', function ($stateparams) { return $stateparams.testid; }] } }); }) i have created factory having function(gettest ) return object gettest : function(parmtestid){ var deferred = $q.defer(); $http.get(api_url + "test/testbyid?testid="+parmtestid).success(deferred.resolve) .error(deferred.resolve); return deferred.promise; } i have created controller, inject provider .controller("testcontroller", function($scope,$rootsco

java - OWASP ZAP: Active Scanner in Continuos Integration -

trying use zap (2.4.3) in continuos integration (ci) setting. can run zap daemon, run selenium tests (in java) using zap proxy, , being able use rest api calling htmlreport final report of passive scanner. works fine, use active scanner. using active scanner in ci mentioned several times in zap's documentation, haven't found working example or tutorial it... exist? what achieve like: run active scanner on pages visited selenium regression suite, once finished run. trying @ zap's rest api, undocumented: https://github.com/zaproxy/zaproxy/wiki/apigen_index ideally, great have like: start active scan asynchronously on visited urls poll check if active scan run completed in rest api seems there related, but: ascan/scan needs url input. call core/urls see selenium tests have visited, how set right authentication (logging credential)? if order in urls visited important? if page accessable specific credential? there ascan/scanasuser , unclear how contex

c++ - extern template & incomplete types -

recently when trying optimize include hierarchy stumbled upon file a.hpp : template<class t> class { using t = typename t::a_t; }; class b; extern template class a<b>; which seems ill-formed. in fact seems if extern template statement @ end causes instantiation of a<b> causes compiler complain incomplete type. my goal have been define a<b> in a.cpp : #include <b.hpp> template class a<b>; this way avoid having include b.hpp a.hpp seems idea reduce compile time. not work ( a.hpp on doesn't compile!) there better way of doing this? note: of course not use explicit template instantiation not want! "precompile" a<b> save compilation time if used, if a<b> not used don't want include b.hpp in every file uses a.hpp ! from http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1448.pdf the extern specifier used declare explicit instantiation of class template suppresses explicit insta

Exclude Google Analytics data from outside a Chrome extension -

i created google analytics account chrome extension. use faked website url in parameters because ga doesn't accept protocol chrome-extension://... as ga isn't linked specific domain own, doesn't block data outside. there solution ? can ga use chrome-extension:// or extension id ? thx one of solutions create real web page on host, example http://example.com/analytics.html . , insert in page google analytics script. inject page iframe using content scripts websites need. trigger google analytics without problems.

Perl win32::GUI text more than the window -

my script print output in label. window size 100 lines length. please let me know how show more window data in lable. ex: 200 lines output. i have problem textfield output. using label. there way of scroll text in lable?? thanks sri what label? better response if tag question question concerned with. this may or not of help; special variable $= holds output page-size line. might able localise print. (if still in use). my $perlvar = 'hello'."\n" x 150; { local $= = 200; # set page-size 200 on default output filehandle print $perlvar; } # $= returns default page-size on default output filehandle perlvar name of perldoc tells perl variables

java - Custom query in Spring Data Neo4j not retrieving relationships -

so few complex operations, using custom cypher queries using @query annotation on custom finder methods in graph repositories. however, while retrieves node, not retrieve direct relationships (i.e. 1 level). @query("match (node:t) return node order node.requestedat desc limit 100") list<t> last100t(); @query("match (node:t) node.status = \"requested\" , timestamp() - node.requestedat >= 60000 return node") list<transit> findunmatchedandexpiredt(); i using them - (code in groovy): def nodes = trepository.findunmatchedandexpiredt() nodes.foreach({ node -> node.status = tstatus.declined node.neighboura.status = neighbourastatus.barred def neighbourbqueue = client.queue(node.neighbourb.username) neighbourbqueue.push(mapper.writevalueasstring(node)) trepository.save(node) }) they related so: @nodeentity class t{ public t(){ } @graphid long i

ecmascript 6 - Use JavaScript object destructuring for default values and rebuild -

it's won't positive answer question, i'll ask anyway. i have function taking object parameter. function myfunc(options) {} this object contains properties i'd assign default values to. using destructuring, can this: function myfunc({ mandatory_field, // without default value = 1, j = 2, k = 3, obj: { prop1 = 'val', prop2 = 2 } = {}, str: 'other val' } = {}) {} now, inside function, have these variables either default value or ones passed, great. howevever, need pass options object other functions, in end, i'll need rebuild way: function myfunc({ mandatory_field, // without default value = 1, j = 2, k = 3, obj: { prop1 = 'val', prop2 = 2 } = {}, str: 'other val' } = {}) { let options = { mandatory_field, i, j, k, obj: { prop1, prop2 }, str }; otherfunc1(options); otherfunc2(options); } but feels redundant. i thought aliasi

c# - How to substitute synchronization context / task scheduler to another one inside TaskCompletionSource.Task for ConfigureAwait(false)? -

this question has answer here: how can prevent synchronous continuations on task? 6 answers assume created library containing such method: task mylibrarymethodasync() { var taskcompletionsource = new taskcompletionsource<object>(); action myworkitem = () => { // simulate work. // actual work items depend on input params. thread.sleep(timespan.fromseconds(1)); taskcompletionsource.setresult(null); }; // next 2 lines simplification demonstration. // not have access workerthread - created // , managed me lib. // can - post short work items it. var workerthread = new thread(new threadstart(myworkitem)); workerthread.start(); return taskcompletionsource.task; } any user of lib can call mylibrarymethodasync this await mylibrarymethodasync().config

What's the difference between "mvn spring-boot:run" and "Add to Tomcat server" in Eclipse? -

i downloaded sample of spring-boot cxf web services here . able run sucessfully in eclipse using: right click on project> run as>maven build...> , setting goals: spring-boot:run the server starts, logged console. next tried deploy on tomcat server in eclipse (see screenshot.png ) when server started spring not started. no spring info logged console according line log bellow knows spring should start. why won't start properly? info: spring webapplicationinitializers detected on classpath: [org.springframework.boot.autoconfigure.jersey.jerseyautoconfiguration@4ed48c2] the whole log: led 07, 2016 3:39:18 odp. org.apache.tomcat.util.digester.setpropertiesrule begin warning: [setpropertiesrule]{server/service/engine/host/context} setting property 'source' 'org.eclipse.jst.jee.server:spring-boot-sample-ws-cxf' did not find matching property. led 07, 2016 3:39:18 odp. org.apache.catalina.startup.versionloggerlistener log info: server version:

python - to test the save statement in the views.py -

i designed test initialy, because idea apply tdd, test should test register saved , can executed correctly(the save()), test should fail, because obviously, code in views module doesn't exist save, me complete test adequately test save. this test file: from django.test import testcase django.http import httprequest django.conf import settings## django.utils.importlib import import_module## django.core.urlresolvers import reverse key_process_indicator_bsc.views.views_process_indicator import * key_process_indicator_bsc.models import * class processindicatortestcase(testcase): fixtures = ['test_data_key_process_indicator_bsc.json'] def setup(self): pass def test_pi_insert_basic(self): #user = auth_user.objects.get(username="lruedc") indicator_type = indicatortype.objects.get(name="eficacia") unite_measure = unitemeasure.objects.get(name="horas") periodicity_indicator = periodicityind

validation - WPF Datagrid: Can't add row when the previous row is invalid -

i have view quantity (zero or more) of entity objects loaded somewhere external (file, web service, etc). need user able edit loaded entities add new rows before saved in 1 transaction. @ time loaded, entities not valid; require user input before ready persisted. in order accomplish this, view contains wpf datagrid itemssource bindinglist<entity> , , entity class implements idataerrorinfo provide per-cell error messages displayed in tooltips in grid. the default behavior datagrid when currently-selected cell has validation errors disable editing other rows adding new rows until issue resolved. not want; user should able takes make rows valid in whatever order he/she chooses. can make existing rows editable inheriting datagrid , overriding oncanexecutebeginedit : class editabledatagrid : datagrid { protected override void oncanexecutebeginedit(canexecuteroutedeventargs e) { e.canexecute = true; e.handled = true; } } this works desired allo

tfs power tools - Importing new process definition with "witadmin importprocessconfig" in TFS has no effect, and no error message -

after customized wit definitions of agile process template, got tf400917 error trying access backlogs in tfs. according https://msdn.microsoft.com/library/hh500413.aspx have update process config (which makes sense), got issues. updated , imported process config file witadmin importprocessconfig . operation completed , got no error messages after few tries. though process definition still not updated on server. can see it's still old file exporting witadmin exportprocessconfig . can give me tip on wrong, or can next try update file? see categories xml below. creating new wit's, changing states , working queries work fine. i have updated categories definition see if help. worked fine import file did not solve problem. i'm running vs 2015 power tools, , think tfs server 2013. best regards qanik new process config xml (which did not work) <?xml version="1.0" encoding="ibm850"?> <projectprocessconfiguration> <bugworkite

ghostscript - Merging PDFs skipping corrupted PDFs -

currently using ghostscript merge list of pdfs downloaded. issue if 1 of pdf corrupted, stops merging of rest of pdfs. is there command must use skip corrupted pdfs , merge others? i have tested pdftk facing same issue. or there other command line based pdf merging utility can use this? thanks in advance you try mupdf, try using mupdf 'clean' repair files before try merging them. if pdf file badly corrupted ghostscript can't repair won't work either. there no facility ignore pdf files badly corrupted can't repaired. hard see how work in current scheme, since ghostscript doesn't 'merge' files anyway, interprets them, creating brand new pdf file sequence of graphic operations. when file badly enough corrupted provoke error abort because may have written parts of file could, , if tried ignore , continue both interpreter , output pdf file in indeterminate state.

python - Unable to generate network data in tree format while retaining node attributes -

Image
i'm trying generate network graph visualises data lineage (cluster graph such this ). please keep in mind i'm new networkx library , code below might far optimal. my data consist of 2 pandas dataframes: df_objs : df contains uuid , name of different items (these become nodes df_calls : df contains calling , called uuid (these uuids references uuids of items in df_objs ). here's initialise directed graph , create nodes: import networkx nx objs = df_objs.set_index('uuid').to_dict(orient='index') g = nx.digraph() obj_id, obj_attrs in objs.items(): g.add_node(obj_id, attr_dict=obj_attrs) and generate edges: g.add_edges_from(df_calls.drop_duplicates().to_dict(orient='split')['data']) next, want know lineage of single item using uuid: g_tree = nx.digraph(nx.bfs_edges(g, 'f6e214b1bba34a01bd0c18f232d6aee2', reverse=true)) so far good. last step generate json graph can feed resulting json file d3.js in order perfor

hadoop - java.io.EOFException: Premature EOF: no length prefix available -

i inserting table's data table dynamic partitions in hive. insert table x partition(c) select a,b,c y distribute c; i error while inserting data 1 of input tables. org.apache.hadoop.hive.ql.metadata.hiveexception: java.io.eofexception: premature eof: no length prefix available is problem data? or problem while saving data blocks in datanode? how fix this? thanks

ibm mobilefirst - Worklight - SOAP adapater uanble to parse <soapenv:Envelope> request -

i trying create soap adapter uses soapenv:envelope request. when invoke adapter eclipse produces following error - { "errors": [ "ecma error: typeerror: cannot read property \"body\" undefined (c%3a%5cdevelopment%5cmywork%5cworklight%5cworklightapp lications%5cadapters%5csoapadapter/soapadapter-impl.js#40)" ], "info": [ ], "issuccessful": false, "warnings": [ ] } it seems saxparser issue therefore googled , got solution ibm developers forum ( http://www.ibm.com/developerworks/forums/thread.jspa?threadid=454988 ) - after -vmargs line in eclipse.ini, add line , restart eclipse: -dorg.xml.sax.driver=com.sun.org.apache.xerces.internal.parsers.saxparser i did still getting same error. here soap request - "<soapenv:envelope xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"+ "xmlns:xsd="http://www.w3.org/2001/xmlschema&quo

SQL Server - How to perform a calculation based on a dynamic formula -

i have case need perform dynamic calculation based on particular entry in column. the table looks like: declare temp table ( id int, name nvarchar(255), const1 decimal(18,10), const2 decimal(18,10), const3 decimal(18,10), const4 decimal(18,10) ); i want add in field called "calculation". user has specify in field how constants applied (i.e. "const1 * const2 + (const3 - const4)"). i've got function has formula hard coded want able dynamically map table columns "calculation" field. possible? if i'm getting table entry like: id| name | const1 | const2 | const3 | const4 | calculation 1 | calculation1 | 5 | 3 | 2 | 9 | const1 * const2 + (const3 - const4) then in function, can dynamically make calculation , return output? approaching problem correct way? thanks in advance! you'll need use dynamic sql sp_executesql or exec . don't recall if

c# - Anything like SqlBulkCopy for Update statements? -

this application i'm developing read in bunch of records, validate / modify data, send data db. i need "all or none" approach; either update of rows, or don't modify of data in db. i found sqlbulkcopy class has method writing of rows in datatable database unacceptable purposes. wrote quick app that'd write few rows db, populate datatable database, modify data, call writetoserver(datatable dt) again. though datatable has of primary key information, added new rows data , new primary keys rather updating data rows have matching primary keys. so, how can bulk update statements mssql database c# winforms application? i don't think relevant, i'll include code anyways. i'm not great when comes interacting databases, it's possible i'm doing dumb , wrong. static void main(string[] args) { using (sqlconnection conn = new sqlconnection("myconnectioninfo")) { //datatable dt = maketable(); datatable dt =

jquery - How can I avoid that a Spring controller method return a logical view name and return a String value used to handle and AJAX request? -

i pretty new in spring mvc , ajax , have following doubt. using jquery performing ajax request: $.ajax({ type : "get", url : "salvaappuntiministeriale", data: { 'codiceprogetto': codiceprogetto, 'appuntiministeriale': appuntiministeriale } }).done(function(response) { showsuccessmessage('nota inserita'); document.open(); document.write(response); document.close(); }).error(function(xhr) { manageerror(xhr); }); as can see, perform request toward salvaappuntiministeriale resource passing 2 values (that retrieved page, works fine). then, spring mvc controller class, have controller method handle previous ajax request: @requestmapping(value = "salvaappuntiministeriale", method=requestmethod.get) public string salvaappuntiministeriale(@requestparam string codiceprogetto, @requestparam string appuntiministeriale, model model) throws e

java - Hibernate insert query -

during insertion in hibernate query i'm passing fields table class objects i've mapped corresponding tables, query works fine query becoming large because each of these mapped objects getting updated individually corresponding tables. can please tell me whether correct way of insertion , why i'm getting update queries. hibernate: insert ortms.tool_modified_his_tbl (tool_desc, old_tool_desc, connec1, old_connec1, connec2, old_connec2, landed_cost, old_landed_cost, acqui_date, old_acqui_date, manuf_date, old_manuf_date, price_ref, old_price_ref, op_rate_cost, old_op_rate_cost, stb_rate_cost, old_stb_rate_cost, day_rate1_cost, old_day_rate1_cost, day_rate2_cost, old_day_rate2_cost, packermilling_cost, old_packermilling_cost, sale_value, old_sale_value, status, created_date, modified_date, tool_id, tool_modi_reas_id, tool_modi_usr_id, supplier_id, old_supplier_id, tc_status_id, old_tc_status_id, pricing_type_id, old_pricing_type_id, old_ownership_id, ownership_id, unit

instance - What would happen if an object is created in non-static method of class in java? -

class data { int x = 20; // instance variable public void show() // non-static method { data d1 = new data(); // object of same class data int x = 10; system.out.println(x); // local x system.out.println(d1.x);// instance variable x } public static void main(string... args) { data d = new data(); d.show(); // "10 20" } } so question when object created in show() namely 'd1' , must have own set of data members , must have allocated new stack show() method , in return should create new object , cycle should go on , stack-overflow occurs?? working fine?? data d1=new data(); this statement not allocate new stack show(). show()'s stack allocated when gets called, example, when gets called in main.

html - CSS: '+' selection operator not working -

the background color of span not change after radio button changed should. why happening? how fix it? div { margin: 0 0 0.75em 0; } .formgroup input[type="radio"] { display: none; } input[type="radio"], label { color: brown; font-family: arial, sans-serif; font-size: 14px; } input[type="radio"], label span { display: inline-block; width: 19px; height: 19px; margin: -1px 4px 0 0; vertical-align: middle; cursor: pointer; -moz-border-radius: 50%; border-radius: 50%; } input[type="radio"], label span { background-color: brown; } input[type="radio"]:checked + p + span{ background-color:orange; } input[type="radio"] + span, input[type="radio"]:checked + span { -webkit-transition:background-color 0.4s linear; -o-transition:background-color 0.4s linear; -moz-transition:background-color 0.4s linear; transition:background-color 0.4s l

regex - Find string between two sets of string (python / urllib2 / beautiful soup) -

i have following source code of web page web trying parse data from <span class="reviewcount"> <a href="...reviews-whatiwant-city..." target="_blank" onclick="xx;">1,361 reviews</a> </span> edit (with beautiful soup): to extract information parse data using beautiful soup. use following code: spans = soup.findall('span', attrs={"class":u"reviewcount"}) span in spans: = span.find('a') print re.search('(?<=reviews-)(.*?)(?=-city)', a.get('href')) but information <_sre.sre_match object @ 0x7f84fce05300> <_sre.sre_match object @ 0x7f84fce05300> <_sre.sre_match object @ 0x7f84fce05300> <_sre.sre_match object @ 0x7f84fce05300> and not bytes between "reviews-" , "-city". assist me in finding right syntax? thanks. re.search() returns "match" object . need saving group value if there match: spa

Groovy: add a method to a closure -

i have following closure def closure = { println ("closure code") } and add method it. if try closure.metaclass.fun = { c-> c.call(); println ("extra code"); } i exception groovy.lang.missingpropertyexception: no such property: fun class: org.codehaus.groovy.runtime.metaclass.closuremetaclass reading answer, blindly tried call expandometaclass.enableglobally() but it's not working. is there way achive want? you can do: def closure = { println "closure code" } closure.getmetaclass().fun = { -> delegate.call() println "extra code" } closure.fun() which prints: closure code code

imageview - How to pass a jpg id between activities Android -

i have gridview imageviews in 1 activity , want load 1 of them in other activity on new imageview when select it, have no results activity 1: public class level extends activity{ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.level); gridview gridview = (gridview) findviewbyid(r.id.gridviewlevel); imageadapter ia = new imageadapter(this); gridview.setadapter(ia); gridview.setonitemclicklistener(new onitemclicklistener() { public void onitemclick(adapterview<?> parent, view v, int position, long id) { toast.maketext(level.this, "" + position, toast.length_short).show(); initimagecheck( v.getid()); } }); } public void initimagecheck(int id){ intent intentic = new intent(this, imagecheck.class); intentic.putextra("id", id); startactivity(intentic); } } activity 2: public class imagecheck extends

Passing Id attribute from a (JQuery) selector into (JavaScript's) document.getElementById() -

i'm trying use solution here submit form using link contains (instead of using standard input submit button) <form id="form-id"> <button id="your-id">submit</button> </form> var form = document.getelementbyid("form-id"); document.getelementbyid("your-id").addeventlistener("click", function () { form.submit(); }); the form table of records each have 'e' link in left-most column used load record editing <td style="text-align:center;"> <a id="a_edit_btn_#recordid#">e</a>&nbsp;&nbsp; </td> and fire off following when clicked document.getelementbyid( $("a[id^='a_edit_btn_']").get(0).getattribute("id") ).addeventlistener("click", function () { ... form.submit(); }); but following error uncaught typeerror: cannot read property 'getattribute' of undefined is pos

grammar - Understanding precedence of assignment and logical operator in Ruby -

i can't understand precedence of ruby operators in following example: x = 1 && y = 2 since && has higher precedence = , understanding + , * operators: 1 + 2 * 3 + 4 which resolved as 1 + (2 * 3) + 4 it should equal to: x = (1 && y) = 2 however, ruby sources (including internal syntax parser ripper ) parse as x = (1 && (y = 2)) why? edit [08.01.2016] let's focus on subexpression: 1 && y = 2 according precedence rules, should try parse as: (1 && y) = 2 which doesn't make sense because = requires specific lhs (variable, constant, [] array item etc). since (1 && y) correct expression, how should parser deal it? i've tried consulting ruby's parse.y , it's spaghetti-like can't understand specific rules assignment. simple. ruby interprets in way makes sense. = assignment. in expectation: x = (1 && y) = 2 it not make sense assign 1 && y .

javascript - Three.js Globe camera tweening on button click -

im trying tween camera movement 1 place can't seem work out. im using globe chrome experiments , added function on it function changecountry(lat,lng){ var phi = (90 - lat) * math.pi / 180; var theta = (180 - lng) * math.pi / 180; var = { x : camera.position.x, y : camera.position.y, z : distance }; var = { posx : 200 * math.sin(phi) * math.cos(theta), posy : 200 * math.cos(phi), posz : distance }; var tween = new tween.tween(from) .to(to,2000) .easing(tween.easing.linear.none) .onupdate(function () { camera.position.set(this.x, this.y, this.z); camera.lookat(new three.vector3(0,0,0)); }) .oncomplete(function () { camera.lookat(new three.vector3(0,0,0)); }) .start(); console.log(to,from,lat,lng);} i've console printed values , works getting lat&long , converting them right values, x,y,z values great don't move camera @ all. in console errors: uncaught typeerror: n not function , 90tween.js:4 uncaught

java - Android string comparison to EditText string value -

i know should easy don't know i'm doing wrong. i want pseudocode: if edittext == "ed" {show.message "hi"} else {show.message "nope"} //--[boton sumar 2]-- public void onbt_sumar2click(view v) { edittext e1 = (edittext)findviewbyid(r.id.et_1); edittext e2 = (edittext)findviewbyid(r.id.et_2); textview t1 = (textview)findviewbyid(r.id.tv_resultado); if (e1.gettext().equals("ed")){ context context = getapplicationcontext(); charsequence text = ":v / hi :v /" ; int duration = toast.length_long; toast toast = toast.maketext(context, text, duration); toast.show(); } else { context context = getapplicationcontext(); charsequence text = "nope"; int duration = toast.length_long; toast toast = toast.maketext(context, text, duration); toast.show(); } } you should converting value of e1 string use

web services - Error in deserializing body of request message for operation. C# -

im trying consume soapwebservice using c# when tried consume web service service.findresrequest request = new service.findresrequest(); request.codeservice = "1010502"; service.findresresponse response = portclient.findservice(headers, request); but show error message: error in deserializing body of request message operation inside of system.servicemodel.communicationexception > innerexception > [system.invalidoperationexception] "error on xml document (1,1879)" inside of system.servicemodel.communicationexception > innerexception > innerexception > [system.formtexception] {"the string" not valid boolean"} but if change property of request works, example if make request codestatus. service.findresrequest request = new service.findresrequest(); request.codestatus = "1010502"; service.findresresponse response = portclient.findservice(headers, request); why works request.codestatus , doesn

Capture and play voice with Asterisk ARI -

there channel ari demo in wich can control channel state: ring, answer, play silence, play tone or audio-file ( https://github.com/asterisk/ari-examples/tree/master/channel-state , https://wiki.asterisk.org/wiki/display/ast/ari+and+channels%3a+manipulating+channel+state ) possible receive chunks (parts, buffers, etc.) of call voice (which created remote subscriber) or write chunks of voice, example array of bytes (not file) in audio format (alaw, ulow etc). you can use asterisk eagi interface voice data. other option use record or mixmonitor app record channel(channel have put stasis allow dialplan control ari) "write chunks of voice" can done application playback also can create own application using c/c++, compile asterisk , result want. no, can't redirect voice directly using ari.

php - WordPress - Select query on specific page -

Image
i want select query in specific page. created table in database: first, added phpexec on plugin using php on page. then, tested select query , ok. finally, want create form checking serial number. here code: <html> <head> <title></title> </head> <body> <form action="<?php echo $_server['php_self']; ?>" method="post"><br><br> serial number: <input type="text" name="num1"><p> <input type="submit" value="calculate"> </form> <phpcode> <?php if (count($_post) > 0 && isset($_post["num1"]) { $servername = "localhost"; $username = "******"; $password = "*******"; $dbname = "******"; $serialnum = $_post["num1"]; // create connection

php - issue with date() function. Need it to calculate from the first of the month -

ok, have code. else if($_post['sdate'] == 'this month') { $startdate = date("m/d/y"); $newdate = datetime::createfromformat("m/d/y",$startdate); $dpicker = $newdate->format("y-m-d"); echo $dpicker; $enddates = date("m/d/y"); $newedate = datetime::createfromformat("m/d/y",$enddates); $newedate->modify('-20 day'); $edpicker = $newedate->format("y-m-d"); echo $edpicker; $thdate = $dpicker; $thdates = $edpicker; $sql = "select * orders loggedtime between :times , :time"; $q=$con->prepare($sql); $q->bindparam(":ti

Mysql Percentages with multiple Group By -

i'm getting stuck on seems easy mysql task: counting data percentages of subtotals, given "with rollup" instruction. i've searched internet lot, couldn't find works when have calculate partial percentages (that is, percentages when have grouped multiple columns) here query: select elements.*, plans.*, workers.*, count(action) counter elements join plans on elements.id_piano = plans.id_piano join workers on plans.id_collaboratore = workers.id_collaboratore group id_agency, category, action rollup how can calculate each "counter" percentage of relative subtotal "with rollup" instruction gives?? really sorry trivial question, cannot done. thanks in advance! edit: here now: agency | category | action | counter alfa | skill | e-learning | 3 alfa | skill | coaching | 2 alfa | skill | null | 5 alfa | attitude | on-the-job | 2 alfa | attitude | null | 2 alfa | null

ios - NSPredicate filter array using all characters before delimiter -

i filtering using self.searcharray.removeall(keepcapacity: false) let searchpredicate = nspredicate(format: "self contains[c] %@", searchcontroller.searchbar.text!) let array = (array(examplearray) nsarray).filteredarrayusingpredicate(searchpredicate) self.searcharray = array as! [string] it filtering whole string, however, want filter using characters exist before delimiter. example: each array value has delimiter "$%^" example array contains [abc$%^12], [efg$%^32], [tyh$%^77] i want filtering include on characters before $%^ abc, efg, , tyh you can without using nspredicate . stub : let searchbartext = "h" let examplearray = ["abc$%^12", "efg$%^32", "tyh$%^77"] let searchresults = examplearray.filter { let components = $0.componentsseparatedbystring("$%^") return components[0].containsstring(searchbartext) }