Posts

Showing posts from February, 2013

algorithm - Knight's Tour on a 5 x 5 Board Start from any Square? -

i'd check logic here... i wrote code solve knight's tour , works 8x8 boards starting knight @ square. but... on 5x5 board show no solution possible when starting @ square (0, 1). what tried 5x5 starting knight @ row 0, col 1: warnsdorff's path added roth (tie breakers based on euclidean distance center). since did not produce solution did code basic recursion backtracking test every possible path -- no solution found when starting 5x5 on 1, 0. i looked everywhere list of exhaustive solutions 5x5 board found none. is there no solution 5x5 when starting @ square 0, 1? thank you! correct, there no solution when start @ of squares adjacent corner square.

javascript - how to resize images inside a div inside another div with css? -

i want resize images in div specific class, inside other div other specific class. images inside div inside other div should not resized. this works if want resize images inside classed div: div.classname>img { width:something; } but doesn't work: div.classname2 > div.classname > img { width:something; } markup <div class="classname2"> <div class="classname"> <img> </div> </div> but can't refer inside class name. so, make clear, need resize these images: <div class="classname2"> <div class="classname"> <img> </div> </div> but not these: <div class="classname"> <img> </div> i feel css rule should work div.classname2 > div.classname > img { width:something; } does fiddle show you're trying illustrate? if so, perhaps have overriding css rules somewhere?

jquery - Rails, How to mark an order as completed -

i need way apply method made order select. or find way mark complete. this tried far. don't mind trying new. have these orders display in view so: .col-md-12 .admindash %h1 admin dashboard .text-norm welcome admin dashboard here can see incoming , outgoing orders. .row .col-md-8 - order in @order %h2 = order.user.name .orderpanel .clientarea client name: = order.user.name %br client email: = order.user.email %br client address ... -->: %br = order.user.address_line_1 %br = order.user.address_line_2 %br = order.user.postcode %br = order.user.city %br = order.user.country .delivarea %br delivery_name: = order.delivery_name %br company_name: = order.company_name %br deli

oop - Generic interface inheritance Java -

first of show code. have generic interface: basewebservicecool: public interface basewebservicecool<i extends sessionpeticionbasebean, o extends wsrespuestabasebean> { o create(i wsrequest); o read(i wsrequest); o update(i wsrequest); void delete(i wsrequest); } sessionpeticionbean: public class sessionpeticionbasebean implements serializable { private string token; private string uuidusuariologado; } wsrespuestabean: public class wsrespuestabasebean implements serializable { private string codigorespuesta; private string mensajerespuesta; private boolean error; private map<string, string> errors; } getters , setters skipped. have specific interface extends above base interface that: wspersonasinterface: public interface wspersonasinterface<i extends sessionpeticionbasebean, o extends wsrespuestabasebean> extends basewebservicecool<i, o> { } the point web controller must impleme

c# - TCPIP Socket Listener Performance Issue -

i have straightforward windows service implements c# tcpip socket listener service. service proprietary simple protocol. works accurately , reliably under heavy load. however, performance inadequate purpose has serve, , have been working fix this. i don't know architecture officially called. basic asynchronous implementation (iasyncresult state objects, acceptcallback(), readcallback(), etc.). here basic performance issue: part of response request, service has make call out remote service (operated independent service provider). typically, responses operation take (approximately) 1 second. however, if load 20 test clients (running independent consumers multiple machines), 1 second responses remote service stretch out 5 seconds or more. have used tracing confirm of 5 seconds "within code conducts remote transactions". tracing confirms server handling requests concurrently expected , not stacking them up. that said, have done independent testing proves r

replace - In Python, how could I convert a whitespace-delimited log output to a Markdown-formatted table? -

in python, how convert whitespace-delimited log output markdown-formatted table? i have output log contains printouts of following form: - e_jets cutflow: cut events 1 initial 13598 2 grl 7250 3 el_n 25000 >= 1 326 4 el_n 25000 == 1 313 5 mu_n 25000 == 0 313 6 jetclean loosebad 313 7 jet_n 25000 >= 1 113 8 jet_n 25000 >= 2 26 9 jet_n 25000 >= 3 8 10 jet_n 25000 >= 4 2 11 mva_btag mv2c20 -0.4434 2 12 variables 2 13 save 2 - mu_jets cutflow: cut events

delphi - TMetaFileCanvas and DrawTextEx with DT_RIGHT flag and Arial font -

Image
my program must use tmetafile objects draw text on timage. call system function "drawtextex". when assign "arial" font , right alignment (flag dt_right) text truncated @ end if string contains lots of "1" chars (i.e.: "111111111111111112" string). the white square far smaller timage canvas. i've posted question topic answer didn't work tmetafile. following code reproduce issue: procedure tform2.test2click(sender: tobject); var rc: trect; s : string; oldbrushcolor: tcolor; oldbrushstyle: tbrushstyle; metacanvas: tmetafilecanvas; begin // in example, image1 size w:585, h:225 metacanvas := tmetafilecanvas.create(image1.picture.metafile, 0); rc := rect(10, 10, 200, 200); oldbrushcolor := metacanvas.brush.color; oldbrushstyle := metacanvas.brush.style; metacanvas.brush.color := clwhite; metacanvas.brush.style := bssolid; metacanvas.rectangle(rc.left, rc.top, rc.right, rc.bottom); metacanvas.b

javascript - Why Python datetime and JS Date does not match? -

i have code, returns utc offset given date: >>> import datetime >>> import pytz >>> cet = pytz.timezone("europe/moscow") >>> cet.localize(datetime.datetime(2000, 6, 1)) datetime.datetime(2000, 6, 1, 0, 0, tzinfo=<dsttzinfo 'europe/moscow' msd+4:00:00 dst>) >>> int(cet.localize(datetime.datetime(2000, 6, 1)).utcoffset().seconds/60) 240 ok, in js using code ( http://jsfiddle.net/nvn1fef0/ ) new date(2000, 5, 1).gettimezoneoffset(); // -180 maybe doing wrong? , how can plus-minus before offset (like in js result)? on system both python , javascript produce same result (modulo sign): >>> datetime import datetime, timedelta >>> import pytz >>> tz = pytz.timezone('europe/moscow') >>> dt = tz.localize(datetime(2000, 6, 1), is_dst=none) >>> print(dt) 2000-06-01 00:00:00+04:00 >>> dt.utcoffset() // timedelta(minutes=1) 240 and new date(200

How do I convert a text file into a list while deleting duplicate words and sorting the list in Python? -

i'm trying read lines in file, split lines words, , add individual words list if not in list. lastly, words have sorted. i've been trying right while, , understand concepts, i'm not sure how exact language , placement right. here's have: filename = raw_input("enter file name: ") openedfile = open(filename) lst = list() line in openedfile: line.rstrip() words = line.split() word in words: if word not in lst: lst.append(words) print lst if you're splitting text file words based on whitespace, use split() on whole thing. there's nothing gained reading each line , stripping it, because split() handles that. so initial list of words, need this: filename = raw_input("enter file name: ") openedfile = open(filename) wordlist = openedfile.read().split() then remove duplicates, convert word list set: wordset = set(wordlist) and sort it: words = sorted(wordset) this can simplified 3 lines, so: filenam

office365 - Upgrade MS Access 2010 Solution to Office 365 MS Access version -

we have application front end built on ms access vb.net code have ms access db , backend sql db. in process of upgrading ms access 2010 solution office 365 version. took free trail subscription office 365 enterprise e3 version , don't see ms access module in cloud. do need settings make visible in cloud? or office 365 doesn't support ms access in cloud? if ms access available in cloud, have solution deployed in cloud users can work cloud version without installing access on local desktops/mobile device (like ms excel , word). please let me know if solution feasible , office 365 has ms access in cloud? thanks, there feasible solution, access application can deployed sharepoint in office 365. access app hosted in sharepoint app. sharepoint users able run access app after publish sharepoint. here link on how step step: http://zimmergren.net/technical/building-apps-for-sharepoint-in-office-365-using-access-2013 hope helps :)

image - how to add a new field to an array of structures in Matlab -

i have large array of structures fields a(1:10000).image , a(1:10000).size , ... i need add new field, let's a.number . need see a.image in order assign new field value a.number (an integer value). this pseudo-code of need: for k=1:10000 imshow(a(k).image) enter number keyboard assigned a(k).number load next image end i guess gui/script best. code in fast way? how input ? for k=1:10000 imshow(a(k).image) a(k).number = input('enter value'); end

ruby - Run/exclude specs where tag is present -

i know can run specs given some_tag value --tag some_tag:value or tag added, doesn't have value (defaults true ) --tag some_tag . know can exclude specs above syntax , ~ . how run specs tag present/missing? for example: if have specs marked slow: :external_service , slow: :manual_confirmation or slow: :some_other_reason (these made names), want like: rspec --tag ~slow and run specs not slow. the above doesn't work since filters out specs slow == true instead of !slow.nil? is there way achieve or without configuration? what idiomatic way such thing? guess add 2 tags, 1 boolean , 1 containing value (for example :slow, pending_on: :external_service ) this should help. call rspec --tag ~slow:external_service and won't run tests tagged slow: :external_service

php - pecl install pecl_http not working. -

i have installed http extension php using following command, **pecl install pecl_http** its successfull, cannot find http.so extension in /usr/lib/php5/20121212+lfs folder. there have do? i ve acheived http posting using following function. found in internet. function http_post_lite($url, $data, $headers=null) { $data = http_build_query($data); $opts = array('http' => array('method' => 'post', 'content' => $data,'header' => "content-type: application/x-www-form-urlencoded\r\n")); if($headers) { $opts['http']['header'] = $headers; } $st = stream_context_create($opts); $fp = fopen($url, 'rb', false, $st); if(!$fp) { return false; } return stream_get_contents($fp); }

session - Java HttpSession timeout not changing from no timeout to 10 minutes timeout doesnt work -

using java code , not in web.xml, need ensure session created @ particular page no time out. once user goes past page, same session needs have timeout of 10 minutes. //i using set no time limit: session.setmaxinactiveinterval(-1); //and using same code different value set 10 minute limit: session.setmaxinactiveinterval(ten_minutes); however, session never times out.. makes me think once sessions inactive interval set no limit, cannot undone. i need working described. thanks...

ruby on rails 4 - Show filterrific form in different controller view -

i want show filterrific form in landing page of application. how make form respond different controller action? the code below filterrific sample application. want search , filter student model. , want users of application able search students home page of welcome controller. <%# app/views/students/index.html.erb %> <h1>students</h1> <%= form_for_filterrific @filterrific |f| %> <div> search <%# give search field 'filterrific-periodically-observed' class live updates %> <%= f.text_field( :search_query, class: 'filterrific-periodically-observed' ) %> </div> <div> country <%= f.select( :with_country_id, @filterrific.select_options[:with_country_id], { include_blank: '- -' } ) %> </div> <div> registered after <%= f.text_field(:with_created_at_gte, class: 'js-datepicker'

docusignapi - Docusign Void Envelope Notification -

when void envelope through rest api, docusign notifies customer void. there anyway change this? thanks. you change recipient remote signer embedded signer adding clientid , void envelope. embedded signers repress e-mail notifications default. following specifies how create embedded signer: link other post describes how make sure embedded signing notifications disabled: link

android - avoid unnecessary volley requests on orientation change -

i have android app i'm displaying results restfull webservice in activity recyclerview (wrapped in swiperefreshlayout). in oncreate set adapter etc. , start request volley. when change orientation of device same request started. how can prevent app unnecessary web requests on orientation change? i mean data loaded no request necessary. edit: try in avoiding requests, after change of orientation there still requests: private arraylist<item> mdataset; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); //... if (mdataset== null){ mdataset = new arraylist<>(); } if (mdataset.size() == 0) { startrequest(); } //... } you can try using loader works in background , survives orientation change.

python - Why do classes with no constructor arguments need parenthesis -

i started off learning programming/oop in php. best of knowledge of best practices in php, can instantiate class without parenthesis if not take arguments. such $class = new class; as opposed to: $class = new class(); i starting expand skills python , wasted 5 hours yesterday trying figure out why function wouldn't pass argument though ridiculously simple. code: class mainviewwidgets(mainviewcontainer): def __init__(self): # instantiating prevents mainviewcontroller.getheaderitems returning arg passed it, code still "works" in sense self.controller = mainviewcontroller #this works self.controller = mainviewcontroller() def createheaderoptioncheckbox(self, pane): self.header_string = stringvar() header_checkbox = ttk.checkbutton(pane, text='data contains headers', variable=self.header_string, onvalue='headers', offvalue='keys') self.header_string.trace('w', s

ios - How to convert current date to a specific 24h format? -

i'd convert current date following 24h format: 2015-07-14t14:43:30,727 tried following: nsdateformatter *dateformatter = [[nsdateformatter alloc] init]; [dateformatter setdateformat:@"yyyy-mm-dd't'hh:mm:ss,sss"]; nsstring *datestring = [dateformatter stringfromdate:[nsdate date]]; the problem doesn't work if 24-hour time turned off in phone's (iphone 6) settings (i.e. phone set 12h format). what doing wrong? try following code : nsdateformatter *dateformat = [[nsdateformatter alloc] init]; [dateformat setdateformat:@"yyyy-mm-dd hh:mm:ss"]; hh means 24 hour format hh means 12 hour format.

android - In Google Playstore search app is not visible -

Image
the app published successfully.it's showing in google playstore app search in devices. it's showing me warning sign after app name. as said, need wait. app on store before searchable. process takes few hours update. within few hours, apps become available users , product page appear in google play browsing, searching, or linking promotional campaigns.

c++ - GCC 4.2.2 unsigned short error in casting -

this line of code isn't compiling me on gcc 4.2.2 m_pout->m_r[i][j] = min(max(unsigned short(m_pin->m_r[i][j]), 0), ((1 << 15) - 1)); error: expected primary-expression before ‘unsigned’ however if add braces (unsigned short) works fine. can please explain type of casting (allocation) being done here? why isn't lexical parser/compiler able understand c++ code in gcc? can suggest "better" way write code? supporting gcc 4.2.2 (no c++11, , cross platform) i think bathsheba's answer @ least misleading. short(m_pin->m_r[i][j]) cast. why unsigned messing things up? it's because unsigned short not simple-type-specifier . cast syntax t(e) works if t single token, , unsigned short 2 tokens. other types spelled more 1 token char* , int const , , therefore these not valid casts: char*(0) , int const(0) . with static_cast<> , < > balanced type can named sequence of identifiers, static_cast<int const*c

javascript - SFTP-Nodejs create folder in remote location -

i had used following node module sftp implementation. https://www.npmjs.com/package/ftps my target create folder in remote location , save file. in see available session( http://lftp.yar.ru/lftp-man.html ) in documentation shows mkdir option. have no idea how use it. kindly me create folder in remote location. new server development , confuses me. or possible create folder? it seems in documentation not in actual source code index.js you have use libary.

Mysql Limit Offset not working -

here query, using pagination select distinct email_list.*, email_counter.phone e_phone,email_counter.email e_email,email_counter.marketing e_marketing data_tls_builders email_list left join wp_pato_email_list_counters email_counter on email_counter.email_id = email_list.urn limit 120 offset 150 rather starting @ 120 , finishing @ 150, should display 30 results, mysql returning 120 results , ignoring offset. have tried limit 120,150 , still same? any idea how solve? select distinct email_list.*, email_counter.phone e_phone,email_counter.email e_email,email_counter.marketing e_marketing data_tls_builders email_list left join wp_pato_email_list_counters email_counter on email_counter.email_id = email_list.urn limit 30 offset 120 limit specifies number of records. offset specifies upto how many records should skip. the above query returns 30 records 121.

typo3 - BE AJAX request delivers empty repository -

i want build extension reading repository extension , delivers data csv/xsl/xslx without saving on server. e.g outputs data in blank window modified headers. the ajax request fired with $typo3_conf_vars['be']['ajax']['tx_myext::ajaxid'] = 'filename:object->method'; the repository if called backend work fine too. public function ajaxaction() { ... $this->extrepository =& t3lib_div::makeinstance('tx_mysecondext_domain_repository_datarepository'); ... } but when called domain.tld/typo3/ajax.php?ajaxid=tx_myext::ajaxid doesnt find tx_mysecondext_domain_repository_datarepository if call repository of second repository findall() methode directly ajax. return null. also when setting querysettings hand public function findallexport() { $query = $this->createquery(); $query->getquerysettings()->setrespectstoragepage(false); return $query->execute(); } also fyi on 4.5 edit: calling repos

java - Activity instance changing per tick in JNI -

i have android lifecycle question can't find answered anywhere else. (this not question making activity class global ref) i'm using standard jni->native init() , tick() calls run game on native side. similar san angeles demo. i pass both of these calls instance of java activity object. can call java in order (for example, turn adverts off, interact java twitter, etc). q1 : when call tick() call native calls, create new thread, if so, why don't have call detachcurrentthread native side? q2: i've tried caching activity instance on native init() function , storing in static. works on devices, on pre-android 5.0 device stale reference jni error when use instance in tick() function. making global 'reference' activity 'class' in onload() function sort this? q3: when user closes interstitial adverts, callback on java side, pass native side (eg, restart music). create new native thread? cached activity instance still valid? many thanks, st

ruby on rails - time out error in nested form submitting on edit page -

i using 3 model festival ,event , venue . relationship between these modes blow festival has_many events festival has_many venues when create festival 100 events , 100 venues, time time out error occurred in edit festival find same issue . thanks.

python - How to remove parentheses only around single words in a string -

let's have string this: s = '((xyz_lk) stuff (xyz_l)) (and more stuff (xyz))' i remove parentheses around single words obtain: '(xyz_lk stuff xyz_l) (and more stuff xyz)' how in python? far managed remove them along text using re.sub('\(\w+\)', '', s) which gives '( stuff ) (and more stuff )' how can remove parentheses , keep text inside them? re.sub(r'\((\w+)\)',r'\1',s) use \1 or backreferencing.

java - HTTP Status 500 - Servlet.init() for servlet appServlet threw exception (spring4 hibernate4) -

i finished this tutorial (spring4 , hibernate4) , got msg: javax.servlet.servletexception: servlet.init() servlet appservlet threw exception org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:502) org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:79) org.apache.catalina.valves.abstractaccesslogvalve.invoke(abstractaccesslogvalve.java:617) org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:518) org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1091) org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:668) org.apache.tomcat.util.net.jioendpoint$socketprocessor.run(jioendpoint.java:277) java.util.concurrent.threadpoolexecutor.runworker(unknown source) java.util.concurrent.threadpoolexecutor$worker.run(unknown source) org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61) java.lang.thread.run(unknown source)

json - "TypeError" simple get method in python tornado to access record from Mongodb -

hi have started programming in python (i newbie python programming). have small collection of data in mongodb.i have written simple method find data collection. have error returning fetched value. here code: import bson bson import json_util bson.json_util import dumps class typelist(apihandler): @gen.coroutine def get(self): doc = yield db.vtype.find_one() print(doc) = self.write(json_util.dumps(doc)) return def options(self): pass it gives me fetched data. but when replace these lines a = self.write.... return a with return bson.json_util.dumps({ 'success': true, 'mycollectionkey': doc }) it gives me type error. typeerror: expected none, got {'success': true, 'mycollectionkey': {'type': 1, 'item': 'cookie'}} can explain me why error , there anyway solve problem. thanks in advance. requesthandler.get() not supposed return anything. error warn

exception - java.lang.nullpointerexception attempt to invoke method 'int java.util.List.size()' -

main activity trying add google map please u can import java.util.arraylist; import java.util.hashmap; import java.util.list; import org.json.jsonobject; import android.app.actionbar; import android.content.intent; import android.graphics.color; import android.os.asynctask; import android.os.bundle; import android.support.v4.app.fragmentactivity; import android.util.log; import android.view.menu; import android.view.menuitem; import com.google.android.gms.maps.cameraupdatefactory; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.supportmapfragment; import com.google.android.gms.maps.model.latlng; import com.google.android.gms.maps.model.markeroptions; import com.google.android.gms.maps.model.polylineoptions; import com.parse.parseanalytics; import com.parse.parseuser; public class onscreenactivity extends fragmentactivity { private static final latlng sydney = new latlng(30.8894669, 75.8246729); private static final latlng connct = n

xml - Insert a new element in between elements in KML using JDOM in java -

i using jdom create , modify kml file. every 5 seconds receive new values of latitude,longitude , time client application. need modify existing file , add latest values of latitude, longitude , time it. the xml file given below <?xml version="1.0" encoding="utf-8"?> <kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2"> <document> <folder> <placemark> <name>devicea</name> <gx:track> <when>2015-06-28t17:02:09z</when> <when>2015-06-28t17:02:35z</when> <gx:coord>3.404258 50.605892 100.000000</gx:coord> <gx:coord>3.416446 50.604040 100.000000</gx:coord> </gx:track> </placemark> <placemark> <name>deviceb</name> <gx:track> <when>2015-06-28t17:0

Android : Fragments and Activities interconnections -

this question has answer here: what nullpointerexception, , how fix it? 12 answers i facing problem in sending data fragment activity.....(always struggled fragments though)....i getting nullpointerexception here: process: com.projects.techinfini.contricenter, pid: 3142 java.lang.nullpointerexception: attempt invoke virtual method 'void com.projects.techinfini.contricenter.mainactivity.onclick(java.lang.string)' on null object reference @ com.projects.techinfini.contricenter.bottombar.onclick(bottombar.java:56) @ android.view.view.performclick(view.java:4780) @ android.view.view$performclick.run(view.java:19866) @ android.os.handler.handlecallback(handler.java:739) @ android.os.handler.dispatchmessage(handler.java:95) @ android.os.looper.loop(looper.java:135) @ android.app.activitythread.main(activityt

c# - How to implement OAUTH 2.0 to access Google Analytics -

Image
i've read google discontinued previous authentication method access google api, have use oauth2 authentication method. i've read have go developer console , clientid , client secret can perform authentication. i'm having big troubles code necessary changes login. i'm searching guidelines changes @ login level. tried apply code found on web, wasn't successful. developer console have project clientid , secret didn't generated new 1 used clientid , secret generated. this working code, before google change: { /// <summary> /// summary description googleanalytics /// </summary> [webservice(namespace = "http://tempuri.org/")] [webservicebinding(conformsto = wsiprofiles.basicprofile1_1)] [system.componentmodel.toolboxitem(false)] [system.web.script.services.scriptservice] public class googleanalytics : system.web.services.webservice { [webmethod] public string getanalyticspageviews(

ios - How to mock data in UITest on Xcode 7? -

someone has tried include mock data new xcode 7 ui tests? have used specific framework? how have managed targets? i think there lot of ways approach 1 - difficulty apple has intentionally designed uitests run entirely separate app under test. said, there few hooks can use coordinate logic in app logic in tests feed in mock data or alter behavior of app in way. 2 have found useful launchenvironment , launcharguments . in test - xcuiapplication().launcharguments corresponds nsprocessinfo.processinfo().arguments in app code likewise: xcuiapplication().launchenvironment -> nsprocessinfo.processinfo().environment launchenvironment straight forward dictionary whereas launch arguments array. in test can feed values either of these parameters before launch app: let app = xcuiapplication() app.launchenvironment["-fakedfeedresponse"] = "success.json" app.launch() then in application logic can switch on these values like. like: func fet

templates - c++ Templated Matrix class multiplication -

i'm kind of new c++, want understand why following doesn't work or i'm doing wrong. i'm trying make matrix class using templates size , apply maths matrix or matrices. in main.cpp have following within main method. mat<4, 4> m = mat<4, 4>(1.0f); // identity matrix mat<2, 3> = mat<2, 3>(2.0f); // matrix 2 rows & 2 columns mat<3, 2> b = mat<3, 2>(3.0f); // matrix 3 rows & 2 columns mat<3, 3> c = * b; // multiplication. std::cout << c << std::endl; with matrix class stated beneath multiplication works when both matrices have same size both number of rows , columns (ie 3x3, 4x4, etc.). it's legit multiply 2 matrices of different sizes long number of columns matrix same number of rows matrix b (ie a<2, 3> * b<3, 2> = c<3, 3>). matrix class needs able multiply matrices same size both number rows , columns (4x4 matrices 3d maths). know i'm doing wrong or understand why isn't

xamarin.forms - How to set FontAttributes within XAML to both Bold and Italic? -

in xamarin.forms, how set fontattributes within xaml both bold , italic ? example: <style targettype="label"> <setter property="fontattributes" value="bold" /> <setter property="fontattributes" value="italic" /> </style> <style targettype="label"> <setter property="fontattributes" value="bold, italic" /> </style> fontattributes flag, can pass multiple values.

java - how to give image input to neural network for pattern recognition -

i working on pattern recognition of plant disease image using propagation neural network(in java). knew different binary features can given input neural network. totally confuse how compare output of neural network in scenario. mean not have output defined. , in case of image how can define output can find error between defined out , calculated output network adjust weight.i serious, please me. thank this no means complete answer, not fit in comment box. should provide guidance could do. what encode image series of byte values ranging [0,255] . should yield vector of bytes size should same amount of pixels within image. you pass on vector neural network, meaning input layer of neural network need big vector itself. lastly, assign different vector values denote different diseases. instance, given input vector [1,55,201,44,258,...] expected vector [0,0,0,0,0,1] . vector map particular disease. if colour not important you, reduce input vector vector of binary values

c++ - Adding and listing an array of structs -

i've been having few problems using array of structs , listing them , adding them. not sure what's happening, i've had search around , asked few friends , they've suggested memory allocation , has said memory allocation not needed , there problem in code. i have been unable locate problem , wondering if able point me in direction of going wrong. i apologies if code doesn't right - not sure on how implement on site. #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct data{ int testone; int testtwo; }data; struct data _datastore[25]; int datacount = 0; int adddata(struct data __datastore[datacount]){ printf("\n\t\t\tpacket source - "); scanf("%i", &_datastore[datacount].testone); printf("\t\t\tpacket destination - "); scanf("%i", &_datastore[datacount].testtwo); system("cls");

c++ - Size of a class increases if destructor is included -

class myclass { int data; public: myclass() : data(0) { /*cout << "ctor" << endl;*/} void* operator new(size_t sz) { cout << "size in new: " << sz << endl; void* s = malloc(sz); return s; } void* operator new[] (size_t sz) { cout << "size: " << sz << endl; void* s = malloc(sz); return s; } void operator delete(void* p) { free(p); } void operator delete[](void* p) { free(p); } ~myclass() {} }; int main() { // code goes here myclass* p = new myclass[1]; delete[] p; cout << "size of class: " << sizeof(myclass) << endl; return 0; } here overloading new , delete operator. strange behaviour observe here if include destructor size passed new operator increased 4 , size of myclass still 4 obvious. the output getting destructor: size: 8 size of class: 4 the output getting w