Posts

Showing posts from May, 2011

javascript - http request and convert to json with comparision of json -

i want make http request url lets http://test1.com/info give me xml i want convert xml 1 json lets json 1 now make rest request url lets http://test2.com/myweb returns json lets json 2 json 1 [ { "id": "123", "testname": "test123", "name": "john doe", "active": true, "type": "test6" } { "id": "456", "testname": "test564", "name": "ship therasus", "active": true, "type": "test7" } .... 100 entries ] , json 2 below [ { "id": "123", "country": "usa", "state": "ka", "age": 24, "group": "g1...

migration - Error occurred after migrating application from COldFusion 8 to ColdFusion 10 -

xxx search engine application searches documents contained in various applications including app yyy. issue when app yyy document searched in xxx , clicked view same, not opening. both applications in cf10 , issue observed after migration of xxx cf8 cf10, earlier xxx on cf8 , yyy on cf10 , both applications working fine. this code snippet - <!--- check response application 1 , react accordingly ---> <cfif left(trim(ucase(cfhttp.filecontent)), 4) "true"> <cfset request.moleculelibraryuser = true> <cfcookie name="cookie.mollib_id" expires="now"> <cfelse> <cfset request.moleculelibraryuser = false> <cfset flag = setdisplayerror("you did not come valid molecule library session. please go molecule library , log in again."...

html - Inline Block Elements Overflowing Parent Container -

i have list of 4 menu items sitting side side using display:inline-block;. each item 120px, therefore should able set parent container 480px wide, sends last item next row, why ?? here jsfiddle : http://jsfiddle.net/htdgdhxn/ my html: <section id="nav"> <div id="nav-wrapper"> <ul id="nav-list"> <li id="nav-home"><a href="index.php">home</a> </li> <li id="nav-clothes"><a class="category all">clothes</a> </li> <li id="nav-about"><a href="aboutus.php">about us</a> </li> <li id="nav-contact"><a href="contactus.php">contact us</a> </li> </ul> </di...

spring - DI framework for Android -

i looking open source dependency injection framework android , after doing search found there multiple frameworks available e.g robospring , roboguice ,tinnyspring. can please suggest option better 1 in terms of simplicity , future support?

perl - Can't install Clownfish from cpan under Cygwin -

i not understand goes wrong here: cpan[1]> install clownfish going read '/home/y/.cpan/metadata' database generated on wed, 26 nov 2014 running install module 'clownfish' running make c/cr/creamyg/clownfish-0.4.1.tar.gz checksum /home/y/.cpan/sources/authors/id/c/cr/creamyg/clownfish-0.4.1.tar.gz ok scanning cache /home/y/.cpan/build sizes ............................................................done ---- unsatisfied dependencies detected during ---- ---- creamyg/clownfish-0.4.1.tar.gz ---- clownfish::cfc::perl::build [build_requires] running make test make had problems, won't test delayed until after prerequisites running make install make had problems, won't install delayed until after prerequisites the error message says "make had problems". have make in cygwin: $ make --version gnu make 4.0 built i686-pc-cygwin copyright (c) 1988-2013 free software foundation, inc. it bug in perl prior version 5.18....

image processing - Record screen in real time using MATLAB? -

i using optical microscope , camera record videos post-processed in matlab. real time acquisition , pixel statistics extremely helpful, because of looking @ absorbs little light (i using transmission mode). example blank (background) sample give me an average pixel value across 512x512 ccd array of 144 (grayscale). actual sample might have average value of 140 or so. subtle shift in pixel intensity useful in helping me focus microscope. unfortunately, camera setup not supported matlab, cannot use image acquisition toolbox real time. wondering, there way 'fake' real time image acquisition selecting rectangle of current desktop (the rectangle video output of microscopes camera), matlab record in real time? thanks

join - how to subtract two column in mysql where clause? -

i have query want subtract 2 column. here query select field_data_field_max_pax_allowed.`field_max_pax_allowed_value` m, field_data_field_bookable_item.`entity_id`, node.nid hotel_id, field_data_field_rooms.`field_rooms_target_id` room, field_data_field_quantity.`field_quantity_value` number_of_rooms, node.title, max(ifnull(quan.`field_quantity_value`,0)) maxs, dr.`field_datetime_range_value`, dr.`field_datetime_range_value2` node node left join field_data_field_rooms on node.nid = field_data_field_rooms.entity_id inner join node n on field_data_field_rooms.field_rooms_target_id = n.nid left join field_data_field_max_pax_allowed on field_data_field_rooms.`field_rooms_target_id` = field_data_field_max_pax_allowed.`entity_id` left join field_data_field_quantity on field_data_field_quantity.`entity_id` = field_data_field_rooms.`field_rooms_target_id` left join field_data_field_bookable_item on field_data_field_bookable_item.`field_bookable_i...

c++ - how to overcome runtime error signal:25? equivalently, floating point error: core dumped? -

so i've made function printing big primes between interval l,u: 1. function runs correctly small numbers. 2. when try print primes between 2 big numbers(for example, 100000000 , 100100000), on ideone.com, says: runtime error signal:25 on linux(using terminal) says: floating point exception (core dumped) what might have gone wrong in process of translation small numbers big numbers? //primes[] stores primes between 2 , sqrt(1000000000) void check(long long l,long long u,long long primes[]) { long long g=0,i=0,d; if(l==1) l++; long long v=sqrt(1000000000); for(long long k=l;k<u+1;k++) { i=0; d=sqrt(k); while(i<=v) //this statement... { if(primes[i]<=d) { if(k%primes[i]==0) {g=1;break;} ++i; } else break; }...

c++ - Conversion of a recursive function -

the following program recursive function computes value 2 positive integers. int riddle (int i, int j) { if (j==0) return i; return riddle(j, i%j); } i wondering how 1 while-loop can convert program non-recursive function without if -statement? thank help assuming i>j, prog find hcf of 2 no.s using recursion can done using while. try : int i=val1,j=val2; while (j != 0) { int t; t = j; j = % j; = t; }

android - Failed to open database -

sorry beating horse again- i'm testing app runs on smaller devices fails create or open database on tab. app runs on samsung s3 mini, i'm trying out on samsung tab. relevant code snippets private static string db_path = "/data/data/com.example.squashbotv2/databases/"; private static string db_name = "squashbot.db"; string mypath = db_path + db_name; checkdb = sqlitedatabase.opendatabase(mypath, null, sqlitedatabase.open_readonly); logcat 11-27 10:46:21.772: d/dalvikvm(3733): gc_for_alloc freed 103k, 4% free 6830k/7047k, paused 20ms 11-27 10:46:21.788: d/dalvikvm(3733): gc_for_alloc freed 2k, 4% free 7130k/7367k, paused 16ms 11-27 10:46:21.795: i/sqlitedatabasecpp(3733): sqlite returned: error code = 14, msg = cannot open file @ line 27862 of [ed759d5a9e], db=/data/data/com.example.squashbotv2/databases/squashbot.db 11-27 10:46:21.795: i/sqlitedatabasecpp(3733): sqlite returned: error code = 14, msg = os_unix.c: open() @ line 27862 - ...

javascript - How should I use a window.confirm dialog box with a form? -

i have tried window.confirm on submit button saying "are sure" if click on no submits itself? wrong way of using it? <button type="submit" class="btn btn-primary" onclick="window.confirm('are sure want transfer user?')"> transfer </button> use this <form onsubmit="return confirm('are sure want transfer user?')"> </form>

cbind subsets into one column in r -

i have have created subsets of dataframe, used calculations. left numberous subsets want combine 1 column. subsets this: > e $`1` [1] "aaaaaa" "tttaaa" "cccaaa" "gggaaa" "aaattt" "tttttt" "cccttt" "gggttt" [9] "aaaccc" "tttccc" "cccccc" "gggccc" "aaaggg" "tttggg" "cccggg" "gggggg" $`2` [1] "ataata" "tatata" "cgcata" "gcgata" "bbbata" "atatat" "tattat" "cgctat" [9] "gcgtat" "bbbtat" "atacgc" "tatcgc" "cgccgc" "gcgcgc" "bbbcgc" "atagcg" [17] "tatgcg" "cgcgcg" "gcggcg" "bbbgcg" "atabbb" "tatbbb" "cgcbbb" "gcgbbb" [25] "bbbbbb" i have tried: a=vector() cbind(a,exonjunct...

java - Repository history in log files -

there little project me make java app analyzes yours svn repository files (history), in other words, need make project. using app should history of changes made repository. tried examples (f.e. http://svn.svnkit.com/repos/svnkit/branches/sgk/doc/examples/src/org/tmatesoft/svn/examples/repository/history.java ) , error : "... cannot resolved". http://svnkit.com/kb/javadoc/org/tmatesoft/svn/core/io/svnrepository.html i can't import libraries. svnkit installed.

actionscript 3 - Is letter spacing supported in Spark Label? -

i can't seem adjust letter , character spacing in spark label. i've tried setting tracking left , right , letter spacing. supported? use trackingleft (the amount of tracking (manual kerning) applied left of each character) or trackingright (the amount of tracking (manual kerning) applied right of each character). spark theme, letterspacing not supported.

yii extensions - Detail documentation to implement Role based access control in yii from initial? -

i newbie in yii framework , go through various documentation role based access control in yii simple rbac ,rights extension ,user extension ,rbam. i confused how implement role based access control in yii , based ? my requirement manage 3 types of roles only? learn how filter function work ? find detail documentation roles ? an answers of questions can find in role-based access control guide.

javascript - How to add bootstrap popover to angular ng-repeat -

i have angular ng-repeat : <tr data-ng-repeat="employee in employees" ng-class="getclassforemployee(employee.redrow)" > <td>{{employee.last_name}}</td> <td>{{employee.first_name}}</td> <td>{{employee.departmentname}}</td> <td>{{employee.datecontractend}}</td> <td><a class="btn btn-success btn-sm" href="#employeecorrect/{{employee.id}}">Редактировать</a></td> </tr> and js code in angularjs controller: $scope.getclassforemployee = function (employeeredrow) { if (employeeredrow) { return "alert alert-danger"; } }; i want add bootstrap popover red <tr> . example: <tr id="popover" data-content="something" title="something"> and initialize popover: $("tr[id=popover]").popover({placement:"top",trigger:"hover"}); how dinamic add id, d...

One line if statement in Ruby -

i have following piece of code: if day > 31 day -= 31 month = "april" end can write in 1 line different than: if day > 31 day -= 31 , month = "april" end ? i've tried like: if day > 31 {day -= 31; month = "april"} but doesn't work (day -= 31; month = "april") if day > 31 alternate way (as suggested @mudasobwa in comments below) : day, month = day - 31, "april" if day > 31

css - The Items navigation design -

Image
can me achieve style items of navigation menu while respecting width of each 'li' element design image attempt: .nav_list ul li { text-decoration: none; text-transform: uppercase; font-size: 14px; color: #4d4d4d; border-right: 2px solid #c79c60; padding-right: 15px; margin-right: 15px; display: inline-block; height: 12px; line-height: 11px; border-bottom: 1px solid orange; box-sizing: border-box; } thanks you can add triangle on :hover :before :pseudo-element , use calc(50% - 5px) ( 5px width of triangle) position triangle in center. body { background: url(http://s25.postimg.org/b6q25p4p7/black_thread.png) repeat black; } .nav-container { top: 20px; position: relative; width: 100%; height: 30px; } .nav { width: 100%; height: 30px; maring: 0 auto; text-align: center; } .menu-item { display: inline-block; width: 67px; padding-left: 10px; padding-right: 10px; padding-top: 10px; padding-bottom: 10px...

Is it worth to make a constant for an empty array in Java? -

sometimes need return empty arrays fulfill classes contracts. instead of creating empty array: @override public string[] getdescriptiontexts() { return new string[0]; // no texts } i think may better re-use empty array constant: public class strings { public static final string[] empty_array = new string[0]; } @override public string[] getdescriptiontexts() { return strings.empty_array; // no texts } is kind of optimization worth it? they semantically equivalent, readable, using constant array (very slightly) more efficient performance , memory wise. so go constant. a quick micro benchmark shows difference 1 cpu cycle in terms of performance (0.3 nanoseconds, i.e. nothing really) , gc activity higher empty array creation (~10ms per 1000ms test or 1% of time spend in gc). benchmark mode samples score error units c.a.p.so27167199.constant avgt 10 3.165 ± 0.026 ns/op...

fragmentmanager.class not found during debugging in eclipse for android -

Image
im trying debug android app during "step over" click eclipse jumps fragmentclass.class , shows source not found , can't continue debugging. what problem ? project properties java build path - libraries set source attachment (here set path sources of sdk) also, this

Issue in draw route with waypoints with passing origin and destination address android -

hello friends want draw route origin , destination address including waypoints in android below code string url="https://maps.googleapis.com/maps/api/directions/json?origin=toronto&destination=mississauga&waypoints=2970%20drew%20rd,%20suite%20211%20mississauga%20l4t%200a6%20ontario%20canada|6665%20tomken%20road,%20suite%20201%20mississauga%20l5t%202c4%20ontario%20canada"; downloadtask downloadtask = new downloadtask(); downloadtask.execute(url); private class downloadtask extends asynctask<string, void, string>{ // downloading data in non-ui thread @override protected string doinbackground(string... url) { // storing data web service string data = ""; try{ // fetching data web service data = downloadurl(url[0]); }catch(exception e){ log.d("background task",e.tostring()); } return data; } // executes in ui thread, after execution of // doinbackground() @overr...

ios - how to right way in call webservice with json and without json in iphone? -

i have included 2 way of webservice have not sure way right or worng 1)with json //create 2 class variable nsmutabledata *receiveddata; nsurlconnection *firstconnection; nsmutabledictionary *userdata=[[nsmutabledictionary alloc]init]; //add data in userdata nsdictionary *senddata=[nsdictionary dictionarywithobject:userdata forkey:@"data"]; nserror *error; nsdata *jsondata = [nsjsonserialization datawithjsonobject:senddata options:kniloptions error:&error]; nsstring *urlstring=@"www.example.com/user_register.php"; nsurl *url = [nsurl urlwithstring:urlstring]; nsmutableurlrequest *req = [nsmutableurlrequest requestwithurl:url]; [req setvalue:@"application/json" forhttpheaderfield:@"accept"]; [req setvalue:@"application/json" forhttpheaderfield:@"content-type"]; [req setvalue:[nsstring stringwithformat:@"%d", [jsondata length]] forhttpheaderfield:@"content-length"]; [req sethttpmethod:@"post...

MySQL 5.1 Is not enforcing FK constraint, when i delete a row from the parent, -

mysql 5.1 : 2 tables (parent , child); fk in child links primary of parent. when go mysql command line , delete on parent. allowing me delete. when same test on on mysql 5.6. error "cannot delete or update parent row: foreign key constraint fails" expect. how possible ? how come mysql not enforcing foreign key constraint ? one other point both these tables part of replication setup. both these tables replicated similar space on db server on different box.. you have set foreign key on delete cascade . means deleting parent forces child delete itself. error getting because foreign key stops parent deleting because child cannot delete itself. constraint `child_table` foreign key (`parent_id`) references `parent_table` (`id`) on delete cascade on update cascade

unit testing - Mocking a val of a trait with scala-mock -

i'd mock val of trait. example, in code, mock val baz : trait foo { def bar(): int val baz: int } val foomock = mock[foo] (foomock.bar _).expects().returning(5) (foomock.baz _).expects().returning(6) //doesn't compile dosomething(foomock) to solve in test, i've extended foo, , implemented baz in following manner: trait footest extends foo { override val baz: int = 5 } val foomock = mock[footest] (foomock.bar _).expects().returning(6) dosomething(foomock) but ugly, , hoping there more standard way of doing scala mock. i've seen answer question , requires changing val def in trait, , i'd keep baz val this isn't supported scalamock's macro-based mocks things stand. 1 of things hope address when scala.meta becomes available. if want track this, might want follow: https://github.com/paulbutcher/scalamock/issues/40 there option might of interest - scalamocks's proxy-based mocks support mocking vals. example, see scal...

python - How to exclude certain parameters in dynamic urls? -

i mapping dynamic url parameter such pagename in application myapp.com/[pagenamehere] urls.py looks like: url(r'^(?p<pagename>[a-za-z0-9_.-]*)/$', views.all_pagenames, name='all_pagenames') however, urls myapp.com/login, myapp.com/register, myapp.com/about etc mapped in urls.py file so, example: url(r'^about/$', views.about, name='about') how can revise dynamic url pagenames words such ‘login’ ‘about’ etc excluded possible pagename parameters , don’t forward “all_pagenames” function in views , instead goes appropriate function? django try each url pattern in definition order, don't have worry "exluding" other urls, need make sure define them before catch-all "pagename" url pattern: url(r'^about/$', views.about, name='about') url(r'^login/$', views.login, name='login') # etc # , last: url(r'^(?p<pagename>[a-za-z0-9_.-]*)/$', views.all_pagena...

c++ - How to Ransac cpp -

i have matrix (vector of vectors) several points (measurements sensors) supposed represent walls. walls parallel/perpendicular. i want fit these points respective walls. thought of using ransac can't find easy way implement on matrix in cpp, without having visualization code, point cloud library. do have write own ransac or exist? you may try ransac in opencv library. if not enough, take it's code (it open source) , modify according problem details. or may add pictures here better understanding of issue details.

sql select on multiple db's -

i got around 18 db's. these db's have same structure. want query these db's once results. example: shopa shopb shopc these db's got table article (and same rows). how articles in 1 result where? i thought: select * shopa.dbo.article shopb.dbo.article shopc.dbo.article color = 'red' did got idea? have considered doing union all ? so like: select 'a' shop, * shopa.dbo.article color = 'red' union select 'b' shop, * shopb.dbo.article color = 'red' union select 'c' shop, * shopc.dbo.article color = 'red' or, cte (if rdbms supports it) ;with allstores ( select 'a' shop, * shopa.dbo.article union select 'b' shop, * shopb.dbo.article union select 'c' shop, * shopc.dbo.article ) select * allstores colo...

Magento Event Observer to Change Prices -

i looking event triggered when user, via adminhtml or api/soap, change prices of product. i have been check this, unsuccessfully: https://www.nicksays.co.uk/magento-events-cheat-sheet-1-7/ if event looking not exist, think doing overridden core, @ time product safe. think of idea? any idea welcome, thank you. hope doing well. beside safe on ride product. , link have give in question useful file required on ride. take , half way there. thanks , waiting comments :) :) ;)

php - CodeIgniter 2.2-Stable Session Keeps On Expiring -

this has been common issue on last 2-3 years appears, fixes i've been able wrestle don't seem work. using ci 2.2-stable (pulled of oct 29/2014) they've been able prevent session expiring frequently? this how i'm setting , checking session: login // user session data $user_session = array( 'user' => $user, 'start_time' => $_server['request_time'] ); // create user session $this->session->set_userdata( $user_session ); my_controller inherited controllers redirected if session not found: function __construct() { parent::__construct(); // perform base check make sure user authenticated if( !$this->session->userdata( 'user' ) ) { // if not logged in return server response 403 allowing redirect // on client-side using angularjs interceptor show_error('no valid authenticated session', 403); } } // end function __construct so i'm checking existe...

javascript - JS Refrencing "this" when in callback -

this question has answer here: retaining “this” inside callback function 2 answers part 1: how 1 dynamically reference parent property within callback? for example if had structure. var someclass = { htmlclass : 'afunclass', bindevents: function(){ jquery(function(){ alert( this.htmlclass ); }); }); } currently return "undefined" refrencing jquery function, rather parent. part 2: what dynamic way of doing this? supports next following condition. var someclass = { htmlclass : 'afunclass', bindevents: function(){ var self = this; jquery(function(){ if( !jquery('body').hasclass( self.htmlclass ) ){ self = {}; } }); }); } currently if - someclass remains same, , doesn't become empty object. assigning directly variable doe...

For loop won't end. Don't know why -

i'm writing loop project prompts user input number , keeps prompting, continually adding numbers up. when string introduced, loop should stop. i've done while loop, project states must loop also. problem prompt keeps running when 'a = false'. explain javascript's thinking process? want understand why keeps running through loop though condition isn't met. thank you var addsequence2 = function() { var total = 0; var a; (; = true; ) { var input = prompt("your current score " +total+ "\n" + "next number..."); if (!isnan(input)) { = true; total = +total + +input; } else if (isnan(input)) { = false; document.write("your total " + total); } } }; there difference between a = true , a == true . your for-loop asking "can set 'a' true?", an...

Optimization in Z3: removing the epsilons -

optimizing real value subject strict constraints (e.g. max x s.t. x < 4 ) produces epsilon value in call z3_optimize_get_upper . in example above, returned value 4 - epsilon . is there way rid of epsilon, is, instantiate particular value? e.g. set 0 , or 1 or 0.1 ? thanks! edit: in code of opt_context.cpp , see constant called epsilon created: if (!eps.is_zero()) { expr* ep = m.mk_const(symbol("epsilon"), m_arith.mk_int()); actually, have figured out: using substitute further call simplify seems trick.

symfony - How to set the default value of a form Combobox field as the value in the database in Symfony2? -

i know how set default value of form combobox field value in database in symfony2. explanation below: this code of entity dealing with: <?php namespace ikproj\homebundle\entity; use doctrine\orm\mapping orm; /** * user * * @orm\table(name="user") * @orm\entity(repositoryclass="ikproj\homebundle\entity\userrepository") */ class user { /** * @var integer * * @orm\column(name="id_user", type="integer") * @orm\id * @orm\generatedvalue(strategy="auto") */ private $id; /** * @var string * * @orm\column(name="name", type="string", length=255) */ private $name; /** * @var string * * @orm\column(name="username", type="string", length=255) */ private $email; /** * @var string * * @orm\column(name="pseudo", type="string", length=255) */ privat...

javascript - AngularJS orderBy filter not working in currency -

angularjs orderby filter not working when use orderby : 'rate' , rest date , product works fine (function(){ var app = angular.module('tableapp',[ ]); app.controller('tablecontroller', function($scope){ $scope.items = [ { product: 'lorem ipsum', date: '12-march-2013', rate:'12.35'}, { product: 'dolor sit', date: '1-january-2011', rate:'60.54'}, { product: 'consectetur', date: '12-december-2014', rate:'12.56'}, { product: 'adipisicing', date: '14-noveber-2014', rate:'0.99'}, { product: 'do eiusmod', date: '2-noveber-2014', rate:'4.001'}, { product: 'magna aliqua', date: '16-february-2014', rate:'06.54'}, { product: 'exercitation', date: '30-noveber-2014', rate:'60.32'}, { product: 'consequat', date: '5-may-2014', rat...

ios - NSDate Issue While Creating it from NSString -

i have seen many solutions , tried since last 2 hours. posting code. seeing log fine nsstring contains date. but when tried convert nsdate. it's return , logging null. here code nsdateformatter *formatter = [[nsdateformatter alloc]init]; nsstring *str = @"2014-10-28 00:00:00 am"; nslog(@"date %@",str); ////showing string date [formatter settimezone:[nstimezone timezonewithname:@"gmt"]]; [formatter setlocale:[[nslocale alloc] initwithlocaleidentifier:@"en_us"]]; [formatter setdateformat:@"yyyy/mm/dd hh:mm:ss"]; nsdate *dater = [formatter datefromstring:str]; nslog(@"dater %@",dater); ////showing null log thanks in advance. change one: [formatter setdateformat:@"yyyy-mm-dd hh:mm:ss a"];

Elasticsearch indexing not working and error message: node null not part of the cluster Cluster [elasticsearch], ignoring -

i downloaded elastic search distribution , ran it. curl 'localhost:9200' { "status" : 200, "name" : "cbs", "cluster_name" : "elasticsearch", "version" : { "number" : "1.4.1", "build_hash" : "89d3241d670db65f994242c8e8383b169779e2d4", "build_timestamp" : "2014-11-26t15:49:29z", "build_snapshot" : false, "lucene_version" : "4.10.2" }, "tagline" : "you know, search" } and trying access using spring-data. added following lines in application-context (as per spring data documentation) xml namespace: <elasticsearch:repositories base-package="com.cbs" /> <elasticsearch:transport-client id="client" cluster-nodes="127.0.0.1:9300" cluster-name="elasticsearch" /> <bean name="elasticsearchtemplate" class="org.s...

Extending two related queries on same model in Django -

consider django model forms connection between 2 other model instances: class user(models.model): pass class meeting(models.model): user_a = models.foreignkey(user, related_name='a_meetings') user_b = models.foreignkey(user, related_name='b_meetings') now suppose want define function returns of user s meetings, regardless of if side a or b . naive implementation be: class user(models.model): @property def meetings(self): return list(self.a_meetings.all()) + list(self.b_meetings.all()) what's 'right' way have function return matching queryset instead of list? bonus points elegant solution doesn't use ugly q query ;) i think qs inevitable here. the main principle these things start model want get: since want meetings, start there. return meeting.objects.filter(q(user_a=self) | q(user_b=self))

mpi p2p send receive communication between c and c++ codes -

does 1 need special when communicating between 2 code parts/function sources written in different languages (c , c++)? i have injected c++ code send used parallel slave tasks different ranks: if (rank != 0) { const long bufferlength = 1000000; char filename[300]; double array[bufferlength*4]; mpi_send(filename, 300, mpi_char, 0, rank, mpi_comm_world); mpi_send(array, bufferlength*4, mpi_double, 0, rank, mpi_comm_world); } in c source corresponding receive placed , called master 0 process only, many times slave tasks exist (here num_process ): if (rank==0) { typedef struct array_s { char filename[300];//text file name identifier double *t;//time buffer double *x;//x coordinate buffer double *y;//y coordinate buffer double *z;//z coordinate buffer } arraystruc; arraystruc arraybuffer; double array[bufferlength*4]; for(i=1;i<num_process;i++) { mpi_recv(arraybuffer.filen...

Create image from included PHP file -

i create image included php file, there error of undefined variable: index.php <?php // servers , domains $sersel = 'select * servers'; $serreq = $connexion->query($sersel); $serres = $serreq->fetchall(); $totalser = count($serres); foreach($serres $serv) { $s_global_size = $serv['s_global_size']; $s_used_size = $serv['s_used_size']; $s_creation = $serv['s_creation']; $s_expiry = $serv['s_expiry']; $diskspace = ($e_name == 'domain') ? '-' : format_bytes($s_global_size); echo $diskspace; $diskusage = ($e_name == 'domain') ? '-' : format_bytes($s_used_size); echo $diskusage; $s_left_size = ($s_global_size - $s_used_size); $sleftsize = ($e_name == 'domain') ? '-' : format_bytes($s_left_size); echo $sleftsize; } echo '<img src="idara/statistics/webdata_circle.php">'; ?> webdata_circle.php <?php // create image $imag...

c# - Resize the canvas after zooming -

i'm performing zooming canvas using matrix. code below: void zoom_mousewheel(object sender, mousewheeleventargs e) { point p = e.mousedevice.getposition(clipborder); matrix m = canvaspanel.rendertransform.value; if (e.delta > 0) m.scaleatprepend(1.1, 1.1, p.x, p.y); else m.scaleatprepend(1 / 1.1, 1 / 1.1, p.x, p.y); canvaspanel.rendertransform = new matrixtransform(m); // canvaspanel.rendertransformorigin = new point(0.5, 0.5); } i want resize canvas when click button in main window. can 1 plz, me out. regards, viswa private void btn_original_click(object sender, routedeventargs e)//---------------------------------------> event getting original size of canvas { matrix m = canvaspanel.rendertransform.value; m.setidentity(); canvaspanel.rendertransform = new matrixtransform(m); } this makes canvas set original size of , comes it'...

ios - Trying to decode HTML characters in objective C is taking forever and 100% cpu usage -

Image
i using piece of code decode few html special characters in xml data +(nsstring *)getnsstringformhtmlstring:(nsstring *)html { if(system_version_greater_than_or_equal_to(@"7.0")) { nsmutableattributedstring* attrdisplaystring = [[nsmutableattributedstring alloc] initwithdata:[html datausingencoding:nsunicodestringencoding]options:@{nsdocumenttypedocumentattribute: nshtmltextdocumenttype} documentattributes:nil error:nil]; return [attrdisplaystring string]; } return html; } this code works in handy if using few number of times. but, my use case is, need parse junk xml has lot of encoded characters. like this <filter name="added_time"> <displayname><![cdata[added&#x20;time]]></displayname> <value display="dec - 2013"><![cdata[added_time&#x3a;dec&#x20;-&#x20;2013]]></value> <value display="feb - ...

vsto - MS Outlook add-in. How to get trigger when "To:" or "Cc:" fields are changed in email? -

i developing outlook add-in. need notified when "to:" or "cc:" fields changed. how trigger event? mailitem.propertychange event fire to, cc, , bcc properties. can see event in outlookspy - open new message, click currentitem on outlookspy ribbon, go events tab. add recipient, see event fire @ bottom of events tab in outlookspy window.

c# - Selenium webdriver (tested ChromeDriver) cant find option by text containing umlauts? -

Image
i have dropdown structure one: now, want use selenium webdriver select last option text (i cannot rely on option being last 1 actually). trying this: var text = "&nbsp;&nbsp;&nbsp;undersida"; var option = new selectelement(browser.findelement(by .cssselector("#menu_parentmenuid"))).selectbytext(text); gives me nosuchelementexception. why? here list of values have tried text : "&nbsp;&nbsp;&nbsp;undersida" " undersida" "undersida" i don't know if still issue, i'd contribute. i think problem lies in nature (or understanding) of "no-break space". not regular space in " " or string " &nbsp; " want c# unicode representation of it so string test should like: "\u00a0\u00a0\u00a0undersida" take here: http://www.fileformat.info/info/unicode/char/a0/index.htm

c# - Prevent player from goes through the wall -

Image
i want ask question. first of all, can detect player while player hit wall, not make player not goes through wall. how make player stop moving while player hit wall? here screenshot (red capsule player): the first image capsule collided brown wall imported object 3ds max , applied collider ticking check box shown on above image. here code using: using unityengine; using system.collections; [requirecomponent(typeof(charactercontroller))] public class checkplayer : monobehaviour { public float movespeed = 5.0f, rotationspeed = 5.0f; // define , set movement , rotation of player private void update() { // call movement , rotation function movement(); rotation(); } private void ontriggerenter(collider col) { // if game object collided tag if (col.gameobject.tag == "inn's objects") { // debug debug.log("you have collided object"); } //...

vb.net - Error Occur while debugging -

i developing winform application using vb.net ms-access database engine. either of following error message displays while debugging. didn't happen before, first time, these new errors have occurred. , displays time time. error while trying run project: object has been rundown stub manager while there external clients. or error while trying run project: unable start debugging. object invoked has disconnected clients.

lucene - Elasticsearch - Term Aggregation In Theory -

imagine random term aggregation on specific field: "aggs":{ "top_terms": { "terms": { "field": "any.specific.field" } } } my question here is: how es aggregate terms? if inverted & fielddate index looks this: es: inverted index & fielddata index , fact unique terms stored per document, not per field, how es aggregate terms per field? happening behind scenes aggregate them? can shed light me/us? thanks in advance

java - How to automatically scroll up a wicket panel when wicket feedbackpanel is trigged? -

im using feedbackpanel show errormessage during validation controlls in wicket form. when message occurs occur in top of form(page). , problem might scrolled down when making input , cant see errormessage if dont croll form top of page. know how can set focus on feedbackpanel everytime errormessage shown form scrolls top automatically. i assume use ajax-submit? then can add javascript / jquery ajaxrequesttarget . example this: string myscript = " $('html, body').animate({scrolltop:$('#element_id').offset().top - 20}, 'slow');"; ajaxrequesttarget.appendjavascript(myscript); where need set #element_id form. or alternatively, if set html anchor (#) function scrollto(hash) { location.hash = "#" + hash; }

iOS AssistiveTouch slow animation when using custom keyboard -

i'm building custom keyboard, fine now, except when i'm using assistivetouch during custom keyboard enabled, animation of assistivetouch little bit laggy (slow zoom in , zoom out) when tap open it. i tested on iphone 4s , iphone 6 , same trouble, think not device hardware or resource consume. anyone having same trouble or know reason? , how solve ? i found reason myself. because of shadow. added shadow each button, after remove shadow, lag didn't appear anymore. so suggest better way add shadow button without laggy? this way add shadow button: button.layer.maskstobounds = false button.layer.shadowcolor = uicolor(rgb: 0x000000, alpha: 0.5).cgcolor button.layer.shadowopacity = 1.0 button.layer.shadowradius = 0 button.layer.shadowoffset = cgsizemake(0, 1.0)