Posts

Showing posts from April, 2013

java - Jaxb: Generate constant value for fixed-value attribute -

i'm working on xsd uses following contruct: <xs:attribute name="listversionid" type="xs:normalizedstring" use="required" fixed="1.0"> while not problematic per se, rather annoying work with, since fixed-value of definition increases between releases of xsd spec, , need modify values in seperate constants-class keep them valid, although little if of interest in xsd has changed. xsd maintained elsewhere, changing no option. thus asking myself wether there jaxb-plugin or similar turn fixed-value attributes constants ala @xmlattribute(name = "listversionid") @xmljavatypeadapter(normalizedstringadapter.class) @xmlschematype(name = "normalizedstring") protected final string listversionid = "1.0"; instead of just @xmlattribute(name = "listversionid") @xmljavatypeadapter(normalizedstringadapter.class) @xmlschematype(name = "normalizedstring") protected string listversionid; whi...

ios - nil while unwrapping an optinal value SWIFT -

this question has answer here: what “fatal error: unexpectedly found nil while unwrapping optional value” mean? 5 answers i have downloaded project https://github.com/doberman/speaker-gender-detect--ios . followed instructions when run app, message says: fatal error: unexpectedly found nil while unwrapping optional value. how can fix crash app works. the app crashes here: let genderequalityratios = self.calcgenderequality (string (response.result.value!)) this code: import avfoundation import alamofire import swiftyjson protocol audiorecorderdelegate { func audiorecorder(audiorecorder: audiorecorder?, updatedlevel: float) func audiorecorder(audiorecorder: audiorecorder?, updatedgenderequalityratio: (male: float, female: float)) } class audiorecorder: nsobject { static let sharedinstance: audiorecorder = audiorecorder() private let...

javascript - Prevent window height change when mobile address bar appears / disapears -

i use jquery height of devices displaying website, make sure homepage has height of 100%, , when scrolled thru, header menu go fixed top. that, measure window innerheight functiun, called on document ready, , window resize events (to keep design clean when user changes portrait / landscpae mode on mobile, or resizes window on desktop). problem on mobile : adress bar on android displayed on page load, , hides on scroll down, reappears on scroll up. makes page elements change sizes on evey opportunity , moves contents in page. not pleasant user. function setheight() { windowheight = $(window).innerheight(); $('.home-intro').css('min-height', windowheight); } $( window ).resize(function() { setheight(); }); is there way window size, not affected adress bar being displayed or not ? i know answer year late, i've struggled issue well. i've found using "window.document.documentelement.clientheight" instead of "$(window).innerheight();...

php - Asserting a drop down menu in selenium IDE -

so using selenium ide , must assert field drop down menu, commands can use? this have tried till no success: command: assertselectedvalue select: *name of drop down* value: ? use assertvalue() . page: <select name="select_example"> <option value="my_1">text1</option> <option value="my_2">text2</option> </select> command: command: assertvalue target: name=select_example value: my_1

java - Use of numofreducers in map reduce -

i have simple doubt in map reduce. why have set numofreducers in map reduce driver class.if not set,the default value 1.if set 100,100 reduce tasks run.what advantage of that.is reduce effort of single node.(if reduce task 1,the task running in 1 node).is there other advantages? thanks help the right number of reduces seems be: 0.95 or 1.75 multiplied (<no. of nodes> * <no. of maximum containers per node>). with 0.95, of reduces can launch , start transferring map outputs maps finish. 1.75 faster nodes finish first round of reduces , launch second wave of reduces doing better job of load balancing. increasing number of reduces increases framework overhead, increases load balancing , lowers cost of failures. the scaling factors above less whole numbers reserve few reduce slots in framework speculative-tasks , failed tasks. so main advantage load balancing , running tasks in parallel on cluster.

r - How to use .ico images in plots programmatically with/without conversion -

how use .ico image files in plots programmatically with/without conversion? my question follow-up of how convert .ico .png? , targeted r , , following specific details: i not asking methods involving transcluding icons within html , e.g. inside shiny app (author: rstudio). of course possible. can icons .ico files used directly in base-r plot, ggplot object (author: hadley wickham) , lattice plot (author: deepayan sarkar)? , approach robust printing output pdf ? how convert ico icons png or without dedicated r library. method careful handle icon's image size, depth, transparency, , other potentially important properties. the motivation there many open-source libraries of icons 1 use inside plot objects, e.g. inserting image ggplot2 , display custom image geom_point , inserting image ggplot outside chart area . in question cite @ top, how convert .ico .png? , there examples of code in c# , in python , none in r . install imagemagick on system ( your s...

ios - Custom font being clipped in UITabBarItem title -

when using custom fonts in uitabbaritem i'm seeing of characters being clipped @ bottom. saw occuring on uibutton's found fix subclass uibutton , override following method: custom font on uibutton title clipped on top of word -(void)layoutsubviews { [super layoutsubviews]; cgrect frame = self.titlelabel.frame; frame.size.height = self.bounds.size.height; frame.origin.y = self.titleedgeinsets.top; self.titlelabel.frame = frame; } unfortunately layoutsubviews isn't available override on uitabbaritem. has experienced problem , found fix it? you can customize title (including color) attributes dictionary ( settitletextattributes:forstate: , inherited uibaritem), , can adjust title’s position settitlepositionadjustment(_:forbarmetrics:) property.

pdf - iText setting Creation Date & Modified Date in sandbox.stamper.SuperImpose.java -

Image
i'm trying set creation date & modified date in superimposing content 1 pdf pdf example sandbox.stamper.superimpose.java. the principle (i think) clear: use getinfo() & do info.put(pdfname.creationdate, new pdfdate(calendar)); or info.put("creationdate", "d:20160508090344+02'00'"); depending on whether hashmap<string, string> or pdfdictionary available. but where? can't quite seem find right place insert code... i'm having trouble overwriting original title attribute. please take @ following files state.pdf , state_metadata.pdf . the metadata of former looks this: the metadata of latter looks this: you can see title , dates have changed. now take @ changemetadata example find out how done: public void manipulatepdf(string src, string dest) throws ioexception, documentexception { pdfreader reader = new pdfreader(src); pdfstamper stamper = new pdfstamper(reader, new fileoutputstrea...

r - Can I pool imputed random effect model estimates using the mi package? -

it appears mi package has had pretty big rewrite @ point within past couple of years. the "old" way of doing things well-outlined in following tutorial: http://thomasleeper.com/rcourse/tutorials/mi.html the "new" way of doing things (sticking leeper's simulation demo) looks this: #load mi library(mi) #set seed set.seed(10) #simulate data (with observations missing) x1 <- runif(100, 0, 5) x2 <- rnorm(100) y <- 2*x1 + 20*x2 + rnorm(100) mydf <- cbind.data.frame(x1, x2, y) mydf$x1[sample(1:nrow(mydf), 20, false)] <- na mydf$x2[sample(1:nrow(mydf), 10, false)] <- na # convert missing_data.frame mydf_mdf <- missing_data.frame(mydf) # impute mydf_imp <- mi(mydf_mdf) although function names have changed, pretty similar "old" way of doing things. the biggest change (from vantage) replacement of following "old" functions lm.mi(formula, mi.object, ...) glm.mi(formula, mi.object, family = gaussian, ...) bay...

timeout - Varnish stops waiting after 1 second -

this problem gonna make me crazy: varnish istance stops waiting backend response after 1 second. every first call page 503 backend daemon configured way: daemon_opts="-a :80 \ -t localhost:6082 \ -f /etc/varnish/default.vcl \ -s /etc/varnish/secret \ -p thread_pool_add_delay=2 \ -p thread_pools=4 \ -p thread_pool_min=200 \ -p thread_pool_max=4000 \ -p timeout_linger=50 \ -p connect_timeout=300 \ -p first_byte_timeout=300 \ -p between_bytes_timeout=300 \ -p send_timeout=900 \ -s malloc,3g" and vcl backend: backend default { # define 1 backend .host = "127.0.0.1"; # ip or hostname of backend .port = "8080"; # port apache or whatever listening .probe = { .url = "/"; .timeout = 1s; .interval = 1s; .window = 10; .threshold = 8; } .first_byte_timeout = 60s; # how long wait b...

python - Update/append serializer.data in Django Rest Framework -

how can update/append serializer.data in django rest framework? data = serializer.data.update({"item": "test"}) not working return response(serializer.data, status=status.http_201_created) serializer.data <class 'rest_framework.utils.serializer_helpers.returndict'> unfortunately, serializer.data immutable . instead of adding items serializer.data can copy serializer.data dict . can try this: newdict={'item':"test"} newdict.update(serializer.data) return response(newdict, status=status.http_201_created)

Select Drop-down List using Selenium 1 or 2 -

Image
i need navigate frames clicking drop-down list using selenium. need select links on menu , drop-down list. selenium.click doesn't work. on manual execution: mouse-over subscriber link/menu list dropped down click selected link/menu drop-down list i need automate through selenium. here element inspector firebug: <!doctype html public "-//w3c//dtd xhtml 1.0 frameset//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-frameset.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <!-- generated python html module ($revision: 1.6 $). --> <!-- charset : iso-8859-1 --> <head> … </head> <frameset rows="78,62,32,*" frameborder="no" border="0"> <frame scrolling="no" src="/html/header_frame.html" noresize="1" name="head_frame"></frame> <frame scrolling="no" src="/cgi-bin/main/title.cgi" noresi...

java - Build Failure: Compiling Storm with Maven -

i've been creating storm topology , tested eclipse, it's working. i'm testing cluster, , when package jar comes messages: .................................................................. [info] scanning projects... [info] [info] ------------------------------------------------------------------------ [info] building storm.prova 0.0.1-snapshot [info] ------------------------------------------------------------------------ [info] [info] --- maven-clean-plugin:2.5:clean (default-clean) @ storm.prova --- [info] deleting /home/amnor/baixades/v0.10.0/workspace/storm.prova/target [info] [info] --- maven-resources-plugin:2.3:resources (default-resources) @ storm.prova --- [info] using 'utf-8' encoding copy filtered resources. [info] skip non existing resourcedirectory /home/amnor/baixades/v0.10.0/workspace/storm.prova/src/main/resources [info] [info] --- maven-compiler-plugin:2.0.2:compile...

json - Javascript: if an array has object or is no empty -

this question has answer here: how test empty javascript object? 40 answers i have json data below: { "errorcode": null, "message": "success", "result": { }, "totalrecord": 0, "checkaccess": true, "token": "fb8904acf4dbf0406ac3fd16acd9b84807d2a0e2913aecc3f39e90ca4b53161af6058ca5ee46b9877b75292e5ca9b8df969a325fa3b40c0e4acde546a431f55f6c07de8a854b9e0bf6aeba314d239267" } in json can find "result" empty, how can identify if statement? tried use !== "undedined" , !==null statment still executes. if(trend1_data[0].result !== 'undefined'){ var resultone = trend1_data[0].result; var chartval1 = resultone.mention30d.chartvalues; for(var i=0; < chartval1.length; i++){ vol1.push(chartval1[i].value);//a loop generate value ...

c - GCC program undefined reference to function (multiple folders) -

i'm running undefined reference function during compilation. program: main.c: #include <stdio.h> #include "ssd/ssd.h" int main(void) { printf("%d\n",f()); return 0; } ssd/ssd.h: #ifndef ssd_h #define ssd_h int f(); #endif // ssd_h ssd/ssd.c: #include "ssd.h" int f(){ return 4; } files ssd.h , ssd.c in folder ssd , file main.c , folder ssd in same folder. during compilation get: [miku@mikutoshiba lab5]$ gcc main.c -o run /tmp/cc9x2i1h.o: in function `main': main.c:(.text+0xa): undefined reference `f' collect2: error: ld returned 1 exit status i'm running fedora23 you build main.c , though ssd/ssd.c contains code well. include in building process: gcc ssd/ssd.c main.c -o run

web services - Access Siemens S7-1200 through C# Application -

Image
i'm trying access siemens s7-1200 database set , read tags through c# executable run on windows. intention have desktop app can establish connection plc on wi-fi / ethernet. app allow user read data off device (and save in sql database or .csv, etc.) , send commands device (via setting tags , plc executes instruction). siemens s7-1200 , s7-1500 devices host webserver allows users create websites , set / read data via that. i've got working successfully. intend bypass website , pull data directly device. instead of pulling data website. i've looked @ following already: snap7 writing s7-1200 plc reading json structure web server page on siemens s7 1500 plc along lot of siemens tutorials , manuals. any ideas on how set connection in c# appreciated. i have got work. please first read pdf in this siemens link . unfortunately, can't attach pdf's on stack overflow. implement c# code on this microsoft link . according pdf (not explicitly said), plc...

internationalization - Terminate the i18n key in fxml -

i separate internationalization key normal text in labeled javafx element using fxml. element looks this: <button text="%select..." onmouseclicked="#selectdatalocation" /> and properties file contains entry: select=select the resulting text of button should select... , exception javafx.fxml.loadexception: resource "select..." not found. is there way terminate internationalization key, following text interpreted normal text? edit: i'm aware use work around: public class controller { @fxml private button selectbutton; @fxml private void initialize() { selectbutton.settext(selectbutton.gettext() + "..."); } } but think overkill, add dots internationalized string.

css - HTML tag wrapping screen (by default) + content (if overflows) -

i have learnt if want make webpage wrap content of webpage, should leave width property of html tag alone height adapt automatically content. the problem that, in case, need content dynamic depends on how items have on webpage, webpage needs wrap of them. if there enough items overflows 100% of screen of computer there not problem because webpage automatically adapts content when have less items 100% of screen of computer, adapts content html tag leaves space without covering it. i in cases content more 100% of screen, webpage adapt , in cases content less 100%, html tag cover full screen(as if had set height: 100%; ). here examples: example 1 : covering content. > ok . example 2 . covering content, not full screen. > not ok . example 3 . covering full screen when content less 100% screen. > ok . example 4 . covering full screen not full content. > not ok . notice example 1 , example 2 not have height: 100%; property , example 3 , example 4 ha...

branch.io redirects to empty content in app, if app is not running in background -

Image
implemented branch.io in application. working fine except if app not running in background , branch.io link clicked. open app , redirect screen shared content shown showing empty screen or no content on screen.if app running in background works fine. why limitation or missing something. please guide, in advance. posting code clarity. - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { sleep(5); articlesdetailviewcontroller *controller = [[uistoryboard storyboardwithname:@"main" bundle:[nsbundle mainbundle]] instantiateviewcontrollerwithidentifier:@"articlesdetail"]; branch *branch = [branch getinstance]; [branch registerdeeplinkcontroller:controller forkey:@"screenarticle"]; [branch initsessionwithlaunchoptions:launchoptions automaticallydisplaydeeplinkcontroller:yes]; } // controller redirected. - (void)configurecontrolwithdata:(nsdictionary *)data { nsstring *pictureurl = data[@...

c++ - detect blue line with if statement -

i have made blue line using opencv , houghlines (in c++) , wondering include in if statement supposed detect if blue line exists , if perform action. i trying cv::inrange function detect blue, cannot use in if statement. here code draw blue lines: vector<vec2f> lines; houghlines(dst, lines, 1, cv_pi/180, 100, 0, 0 ); for(size_t = 0;i < lines.size();i++) { float rho = lines[i][0], theta = lines[i][1]; //scan horizontal line) if(theta > cv_pi/180*80 && theta < cv_pi/180*100){ point pt1, pt2; double = cos(theta), b = sin(theta); double x0 = a*rho, y0 = b*rho; pt1.x = cvround(x0 + 1000*(-b)); pt1.y = cvround(y0 + 1000*(a)); pt2.x = cvround(x0 - 1000*(-b)); pt2.y = cvround(y0 - 1000*(a)); //draw line in blue cvline(m_image, pt1, pt2, scalar(255,0,0), 3, cv_aa); } ...

reading xml file and parsers in java -

i trying read xml file using fileinputstreamreader class. but, when try read large xml files, problems occur. java class more suitable read large xml files , efficient parsers parse xml files? i think dom parsing way parse xml files documentbuilderfactory factory = documentbuilderfactory.newinstance(); documentbuilder docbuilder = factory.newdocumentbuilder(); document doc = docbuilder.parse(yourfile); in way start parsing of xml document, can modify nodes , change want change transformerfactory tf = transformerfactory.newinstance(); transformer transformer = tf.newtransformer(); domsource source = new domsource(yourdoc); streamresult result = new streamresult(yourfile); transformer.setoutputproperty(outputkeys.indent, "yes"); transformer.setoutputproperty("{http://xml.apache.org/xslt}indent-amount", "2"); transformer.setoutputproperty(outputkeys.indent, "yes"); transformer.transform(source, result); and second parte save...

maven 2 - Jenkin not able to pick Test cases -

Image
i using maven project testng, project contains 1 testcase when run maven manually using cmd, test suite gets executed properly. mvn test -e i dont errors when manually. i have configured jenkins maven project. have correctly configured maven & jdk. have correctly passed path pom.xml goal: test -e jenkins somehow not able run test case. doesn't find test cases. pom.xml : <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>jenkin_demo_project</groupid> <artifactid>jenkin_demo_project</artifactid> <version>0.0.1-snapshot</version> <build> <sourcedirectory>src</sourcedirectory> <plugins> <plugin> <artifactid>maven-compil...

c# - Upload Images while creating new Model -

i'm going create profile users in asp.net mvc application. users creation controller this: [httppost] [validateantiforgerytoken] public actionresult create(userprofileviewmodel userviewmodel) { if (modelstate.isvalid) { .... } return view(userviewmodel); } besides, each user model got several properties including 1 photo. goes till want add input field accept photo. @html.textboxfor(model => model.imageurl, new { type = "file" }) and add below field userprofileviewmodel : [display(name = "profile photo")] public httppostedfilebase imageurl { get; set; } among snippets upload photo , answers my previous question , seems uploading photo considered separate task. i.e. need individual form , controller upload photo ( like first part of answer ). i want know there methods can create whole user profile in 1 form , pass photo same controller (which included photo in userprofileviewmodel )? i need note don't know use j...

php - Slim Framework - Getting "500 Internal Server Error" for a simple "$request->get" -

i'm new slim framework , i'm getting error in basic call $request->get . provision/hosts - ok provision/hosts/28e34748b48e - ok provision/hosts/search?hostname=acaca - nok although var_dump($_get) returns: array(1) { ["hostname"]=> string(5) "acaca" } contents of index.php file: <?php require 'vendor/autoload.php'; //with default settings $app = new \slim\app; $app->get('/hosts', function ($request,$response,$args) { require_once 'db.php'; $query= "select * hosts"; $result = $mysqli->query($query); while($row=$result->fetch_assoc()) { $data[]=$row; } if(isset($data)) { header('content-type: application/json'); echo json_encode($data); } }); $app->get('/hosts/search', function ($request,$response,$args) { require_once 'db.php'; //echo va...

How to search and replace with in 2d array in android -

i have sqlite db 4 columns. i.e. id , rule body, cons , bool. can insert data , retrieve using cursor , store in 2d array. example row can like id rule body cons bool 1 jogging(?x) athelete(?x) 0 2 athelete(?x) runsfast(?x) 0 3 athelete(?x),runsfast(?x) champion(?x) 0 same structure of array without columns heading. want user has give input in following format jogging(alan) it has replace ?x in 2darray , enter alan in ?x place. 1 jogging(alan) athelete(alan) 0 2 athelete(alan) runsfast(alan) 0 3 athelete(alan),runsfast(alan) champion(alan) 0 if jogging(alan) found copy cons of jogging(alan) newarray[]. newarray[athelete(alan)] newarray[] carry athlete(alan). newarray[] has been updated search again athlete(alan) if found save runsfast(alan) newarray[]. again updated , have athelete(alan),runsfast(alan) in newarray[...

.net - app.config not working when adding DbProviderFactories entry for ODP.NET -

i try use oracle.manageddataaccess.client in application. added app.config (embedded resource): <system.data> <dbproviderfactories> <remove invariant="oracle.manageddataaccess.client"/> <add name="odp.net, managed driver" invariant="oracle.manageddataaccess.client" description="oracle data provider .net, managed driver" type="oracle.manageddataaccess.client.oracleclientfactory, oracle.manageddataaccess, version=4.121.2.0, culture=neutral, publickeytoken=89b483f429c47342"/> </dbproviderfactories> </system.data> the dbfactories list not contain oracle.manageddataaccess.client. when add same entry maschine.config (c:\windows\microsoft.net\framework\v4.0.30319\config) works fine. <add name="odp.net, managed driver" invariant="oracle.manageddataaccess.client" description="oracle data provider .net, managed driver" type="oracle.managedd...

How can I create a dropwizard (jersey) resource which accepts a nullable representation? -

i trying create action on resource within dropwizard accepts representation, allows null, ie. no post data client. currently, client, have post "{}" otherwise http 415, unsupported media type returned. assume because client not sending content-type header content-length = 0. i tried define resources follows, "producing media type conflict" jersey both methods consume same path , jersey cannot differentiate between them: @path("/interview") @produces(mediatype.application_json) @consumes(mediatype.application_json) @log class interviewresource { @post @timed interview advancenewinterview() { // processing... } @post @timed enquiry advancenewinterview(@valid advanceinterviewrepresentation advanceinterview) { // processing... } } any ideas on how represent this? you use optional parameter show below: @post @timed enquiry advancenewinterview(@valid optional<advanceinterviewrepresent...

asp.net - HTTP Error 500.23 after adding dotless to my local website -

hi i'm trying run dotless on local .net4 web site my web config looks this: <?xml version="1.0" encoding="utf-8"?> <configuration> <configsections> <section name="dotless" type="dotless.core.configuration.dotlessconfigurationsectionhandler, dotless.core" /> </configsections> <system.web> <compilation debug="true" targetframework="4.0" /> <httphandlers><add path="*.less" verb="get" type="dotless.core.lesscsshttphandler, dotless.core" /></httphandlers></system.web> <dotless minifycss="false" cache="true" web="false" /> <system.webserver> <handlers> <add name="dotless" path="*.less" verb="get" type="dotless.core.lesscsshttphandler,dotless.core" resourcetype="file" precondition="...

fabric twitter - twitterLoginButton.performClick(); not working in android -

i tried perform click programmatic way, app getting crash everytime. twitterloginbutton = (twitterloginbutton) findviewbyid(r.id.twitterlogin); twitterloginbutton.performclick(); twitterloginbutton.setpressed(true); twitterloginbutton.invalidate(); //adding callback button twitterloginbutton.setcallback(new callback<twittersession>() { @override public void success(result<twittersession> result) { //if login succeeds passing calling login method , passing result object twitterlogin(result); } @override public void failure(twitterexception exception) { //if failure occurs while login handle here log.d("twitterkit", "login twitter failure", exception); } }); twitterloginbutton.setpressed(false); twitterloginbutton.invalidate(); given below error. manual button clicks working fine, cannot figure_out problem... fatal exce...

google cloud messaging - Confusion with Gcm Token using InstanceId -

i fetching id , token using instanceid , store somewhere in app. after reinstalling app, got new token , id. when i'm using old token , id sending message through gcm, shows success. if use token sending message, shows canonical. can explain in details? example -> result : 1) "oldid:oldtoken" -> success 2) "oldtoken" -> success , canonical new token 3) "newid:newtoken" -> success 4) "newtoken" -> success i have issue in 1st example: why not showing canonical , new token? check link: click here be noted canonical id returned in response when send message server google's gcm server. canonical registration id registration token of last registration requested client app . id server should use when sending messages device. from thread : when receive canonical registration id in response google, message accepted gcm server , gcm server attempt deliver device. whether sent ...

_doPostBack added twice. one by manual and one by gridview in asp.net -

i have page rendering gridview. in gridview have checkbox , once check , uncheck , jquery dialog appears , need postback event on dialog. adding manual postback on page. fine till gridview has 1 page. gridview has more records, add _dopostback method on page. have 2 _dopostback method on page , nothing works because of this. how can define in page not want add _dopostback method controls because have defined manually? here html <html xmlns="http://www.w3.org/1999/xhtml"> <head id="head1"> <title>store management</title> <script src="/js/jquery-1.9.1.min.js" type="text/javascript"></script> <script src="/js/jquery-ui.min-1.10.1.js" type="text/javascript"></script> <link href="/assets/styles/storeportal/style-22012013.css" rel="stylesheet" type="text/css" /> <link href="/assets/styles/storeportal/jque...

WPF C# - Get inline formated bold Text from TextBlock -

i'm adding textblock elements border elements in stackpanel . i'm adding , formating text of textblock adding inlines . when clicked, want formated text of textblock .here code. public void addtext() { textblock mytext = new textblock(); mytext.inlines.add(new bold(new run("hello "))); mytext.inlines.add("world!"); border myborder = new border(); myborder.child = mytext; myborder.mousedown += new mousebuttoneventhandler(border_clicked); mystackpanel.children.add(myborder); } private void border_clicked(object sender, mousebuttoneventargs e) { //border senderbox = (border)sender; //textblock sendertext = (textblock)senderbox.child; //bold inline = (bold) sendertext.inlines.elementat(0); // how output "hello "? } border_clicked should output "hello ". can see i'm able bolded text how can ouput it? @helen, there way text textpointer using textrange. try code void myb...

How to display values inside pivot table using eloquent in laravel -

i have enrollment project, student choose subjects he/she wants enroll. subject fetch automatically , displayed on table. see image. after student click on add button of enrollment form, subject added added subjects form. having problem displaying values of sections , subjects define on pivot table section_subject. how can achieve this? define belongstomany relationships on section model , subject model. here's code. subject.php class subject extends model { public function sections() { return $this->belongstomany(section::class); } } section.php class section extends model { public function subjects() { return $this->belongstomany(subject::class); } } reservationcontroller class class reservationcontroller extends controller { public function create($id) { $subjects = subject::with('sections')->get(); return view('reservation.form',compact('subjects')); } } for...