Posts

Showing posts from August, 2015

javascript - Using Onchange to Lookup Values -

i'm trying create javascript file has drop-down list select fruit out of grabbing image of said fruit , displaying price well. i'm getting error on html , don't know doing wrong. script isn't running... edited out beginning script added javascript drop-down list select private link. html: <script src='* link of table provides variable urlbase, array imagename, & array containing price'></script> <br> <br> <img id='product image' src='' height='200'> <br> <br> price <span id='price display'></span> <!-- interface objects go here. --> <!-- insert javascript here. --> <script src='js/javascript 10.js'></script> and here's javascript.... document.getelementbyid('productid').onchange = function() { var productid = this.value; productid = parseint(productid); iname = imagename[productid]; url = urlbase + iname; doc...

symfony - Sonata media validation at admin -

i'm trying validate image. saw answer @ sonata media: file not found how validate image (width , height). need on that. there no proper doc in net. to validate image dimensions using sonata media need override sonata media's imageprovider class, sonata uses class handle image manipulation.if have extended bundle of sonata media bundle in services.yml file can define own provider below ,make sure yml file included in main config.yml parameters: sonata.media.provider.file.class: application\sonata\mediabundle\provider\imageprovider now create provider , extend sonata media's imageprovider overrider validate() function , define own validation or can override buildcreateform()/buildeditform() , define asserts binarycontent field namespace application\sonata\mediabundle\provider; //... other uses classes use sonata\mediabundle\provider\imageprovider baseprovider; class imageprovider extends baseprovider { public function __construct($name...

java - Is it possible to keep SELECT... FOR UPDATE row-lock after commit? -

i have select statement use lock selected row resultset -updates. in particular, stmt = conn.preparestatement("select name, in_use, done test limit 1 update;", resultset.type_forward_only, resultset.concur_updatable); resultset rs = stmt.executequery(); if ( rs != null && rs.last() ) { name = rs.getstring(1); system.out.println(name); thread.sleep(60_000); // --- possible keep row-lock here? --- rs.updateint(2, 1); rs.updaterow(); } i realized can kind of change selected row during 1 minute sleep-period. hints of how keep row locked until close resultset appreciated. thanks ton in advance.

android - use invalidateOptionsMenu inside BaseAdapter -

i've searched net answers wasn't able find solution need. question how recreate menu again update cart count icon inside base adapter. app i'm working right app count items user ordered, has item categories. when go activity displays categories, cart updates can't in item adapter. code simple. this line @ end of ordering item. setnotifcount(db.getcartcount()); and function. private void setnotifcount(int count){ mnotifcount = count; invalidateoptionsmenu(); } it shows invalidateoptionsmenu(); error because cannot resolve method. tried using activitycompat.invalidateoptionsmenu() throws npe. you cant call invalidateoptionsmenu() there no such method in base adapter. can pass activity context base adapter , call below. ((youractivity)context).invalidateoptionsmenu(); also calling activitycompat.invalidateoptionsmenu() through npe calling invalidateoptionsmenu on class , not object.

html - Dynamic Bootstrap Well -

i have template gets of information generated external program. attempting make template bit more modern , less 1992. the page used work table. didn't nice attempting remove table , have on screen fluid. for containers of text have used bootstrap well class. problem if 1 bit longer other, looks odd. need both of <div class="well"> height if tallest one. i have tried lot of different css. don't want have go table. the code below. <div class="col-md-12"> <div class="col-md-6"> <div class="well"> <h3>heading</h3> info <br> <br> </div> </div> <div class="col-md-6"> <div class="well"> <h3>heading</h3> info <br> <br> </div> </div> </div> ...

How can I use "git describe --match" sensibly in combination with a shallow clone? -

i using git describe driver versioning in application @ build time. looks like: git describe --always --dirty --match version* i tag versions pattern version.1.2.3 , build figures out version of application based off last commit tagged version.* was. if haven't tagged given commit, version number ends version.1.14.3-24-ged66bf5 , based of recent tag, how many commits since tag , git commit id. this works me personally, i'm having problem doing builds off of shallow clone on ci server. when using "shallow clone" option on git build in jenkins (i'm guessing it's doing "--depth=1"), "git describe" command no longer doing want do. version number ends being commit id - guess because there no tagged versions in shallow clone, --always parameter describe command ends spitting out commit id. i can deal moment not doing shallow clone. but driving versioning off of git describe - how can keep using shallow clones? think need able ...

javascript - Trouble returning value of nested function using an ajax call -

this question has answer here: how return response asynchronous call? 21 answers i'm trying append results ajax call paragraph using jquery. i return variable "myresult" inner getresult function , pass outer buildparagraph function, value returned undefined . how append value of myresults <p> tag indicated below? function buildparagraph () { function getresult(url) { $.getjson(url, function(data) { var myresult = data.results; return myresult; } } var myurl = 'www.mywebsite.com'; getresult(myurl); $('<p>').html(myresult); } you need have callback function inside ajax success,or easiest way move below code ajax success function $('<p>').html(data.results);

apache - Raspberry PI Web server - Local connection good - outside local no connection -

i don't have ton of experience routers or port forwarding, have new raspberry pi , wanted see if set simple hello world page educational purposes. have quite bit set apache2 installed , web page works great on local area network, can't connect using lte phone, telling me thing not connect internet. i using rasbian under default settings pi. my router in 1 modem , router, xfinity. after sifting through countless sites trying solve issue, following 2 closest thing particular issue. reputation not high enough put more 2 links, put important ones.. so best of knowledge way ... 1) set web server work locally 2) go router ipv4 or ipv6 (shouldn't matter which) , forward port 80 traffic to, say, port 8080 pi 'should' listening, send web page down through port 80 client calling web page. under 10.0.0.1 find this... this http://i66.tinypic.com/fpaz35.png then go 'advanced' settings http://i68.tinypic.com/2qn6w45.png i have tried start port 80 end ...

gblinear xgboost in R -

Image
let's data has both numeric & catagoricial feature, , i've created xgboost model using gblinear. i've analyzed xgboost model xgb.importance, how can express categorical variable weights? while xgboost considered black box model, can understand feature importance (for both categorical , numeric) averaging gain of each feature split , trees. this represented in graph below. # feature real names names <- dimnames(trainmatrix)[[2]] # compute feature importance matrix importance_matrix <- xgb.importance(names, model = bst) # nice graph xgb.plot.importance(importance_matrix[1:10,]) in feature importance above, can see first 10 important features. this function gives color each bar. k-means clustering applied group each feature importance. alternately, represented in tree diagram (see link above).

ggplot2 - Reducing line thickness / size in multiple qplot graphs in R -

i wish create 24 line plots on a4 page in high resolution png. i'm trying using qplot , grid.arrange function in gridextra library. problem can't reduce thickness of lines in each plot, below threshold. setting size=0 or size=0.0001 or whatever makes no difference; there seems minimum can't crossed, , it's thicker i'd like. increasing size of plot area works have rescale resulting image. can please suggest alternative? minimal example below. library(ggplot2) library(gplots) library(gridextra) <- c(0,1,2,3,4,5) b <- a^2 plot1 <- qplot(a, b, geom = c("point", "line"), pch=10) + geom_point(size=0) + geom_line(size=0) png("filename.png", width=15, height=22, units = "cm", res = 900) grid.arrange( plot1,plot1,plot1,plot1, plot1,plot1,plot1,plot1, plot1,plot1,plot1,plot1, plot1,plot1,plot1,plot1, plot1,plot1,plot1,plot1, plot1,plot1,plot1,plot1, ncol=4) dev.off()

c - Atoi return value -

i have question regarding atoi. trying use atoi check if can convert character number, however, if number 0 how around that? understand atoi returns 0 if fails, returns value of number if works, in case 0 fall under both categories. if use strtol instead, there way check if character in array >= 0, or isn't/doesnt exist @ all. for instance, if dynamic array consisted of {1 40 500}, , try strtol @ position 8 (just out of bounds), return null or indication atoi/strtol failed you instead use sscanf read out integer, way check return value of sscanf see if found integer or not char a[] = "12"; char b[] = "abc"; int n = 0; assert(sscanf(a, "%d", &n ) == 1); assert(sscanf(b, "%d", &n ) == 0);

javascript - AngularJS: How to set an attribute to a custom directive -

i have custom directive holds <textarea> element along other html elements in template using templateurl . directive should allow user type indian language (using writing script devanagri , others) . user select input language. this directive used in html: <keybuddy></keybuddy> now problem is, in main code, how should retrieve text entered in textarea located in template.html specified templateurl ? have text available in scope of link function since used ng-model on textarea . <textarea id="inputfield" placeholder="start typing....." ng-model="inputtext" rows="5"> </textarea> in index.html , should able this: <keybuddy></keybuddy> <button onclick="printtext()">show text</button> <script> var printtext = function () { console.log($("keybuddy").value); } </script> how do it? there other better wa...

Generate PDF based on Particular Div id in Rails -

is there way generate pdf in rails based on div id. sample code: <div id="pdf_download"> <h1>hello welcome pdf </div> <div id="seconf_pdf"> <h2>second pdf</h2> </div> now want download div id "pdf_download" pdf, possible? can explain how achieve it? there seems gem - wicked_pdf . internally seems depend on wkhtmltopdf , should able install on production environment.

sql - How to know that MERGE operation was INSERT or UPDATE? -

let have, merge share_ad_group using ( select share_ad_group_id, share_id, ad_group, share_permissions share_ad_group share_id = @shareid , ad_group = @ownerid ) b on (a.share_ad_group_id = b.share_ad_group_id) when matched update set a.share_permissions = b.share_permissions when not matched insert (share_permissions) values(@sharepermissions); -- in here how know insert or update how know merge operation insert or update after insert or update? please refer here declare @summaryofchanges table(change varchar(20)); merge tbltarget target using (select col1,col2 tblsource) source on (target.col1 = source.col1) when matched update set target.col2 = source.col2 -- need affected rows here when not matched target insert (col1,col2) values (col1,col2); -- need affected rows here output $action @summaryofchanges; select change, count(*) countperchange @summaryofchanges group change;

python - dulwich's NotCommitError when trying to resolve tags -

i'm working dulwich on project need clone repositories commit id, tag, branch name. i'm having trouble tag case seems work repositories, not others. here's " clone " helper function wrote: from dulwich import index dulwich.client import get_transport_and_path dulwich.repo import repo def clone(repo_url, ref, folder): is_commit = false if not ref.startswith('refs/'): is_commit = true rep = repo.init(folder) client, relative_path = get_transport_and_path(repo_url) remote_refs = client.fetch(relative_path, rep) k, v in remote_refs.iteritems(): try: rep.refs.add_if_new(k, v) except: pass if ref.startswith('refs/tags'): ref = rep.ref(ref) is_commit = true if is_commit: rep['head'] = rep.commit(ref) else: rep['head'] = remote_refs[ref] indexfile = rep.index_path() tree = rep["head"].tree in...

jquery - break-word on inline-block elements -

this may seem odd request, need set width of individual characters , have them act normal text in flowing paragraph. here's example: http://jsfiddle.net/tgz3k/8/ ugliness aside, fine except fact words being split in half when wrapping. ideas on how work around this? if change display "inline", wrapping works inline elements can't given width. using letter-spacing instead of width might suffice, i'd need calculate like: width = letter-spacing - (actual character width rendered) but again, getting real width of inline element seems tricky. the html/text side of things can't modified (e.g. solution such adding manual line breaks , setting css nowrap), it's being sent separate service, processing of needs automated. note: font must arial, not fixed-width font , need support ie8+ edit: sorry, needs support inner formatting tags, strong or em (example updated). isn't supported in letteringjs, i'm using fork prevent these tags being...

javascript - Multiple string and number range filters - google visualization -

i wish include multiple string , number range filters in database. letting put 1 of each @ moment though , can't figure out why. below current code using. html: <div id="dashboard"> <div id="string_filter_div"></div> <div id="position"></div> <div id="numnber_range_filter_div"></div> <div id="height"></div> <div id="table_div"></div> </div> javascript: function drawtable() { var data = new google.visualization.datatable(); data.addcolumn('string', 'name'); data.addcolumn('string', 'team'); data.addcolumn('string', 'nationality'); data.addcolumn('number', 'height'); data.addcolumn('number', 'weight'); data.addcolumn('number', 'age'); data.addcolumn('string', 'foot'); dat...

angularjs - Giving unique id to each item in `ng-repeat` for DOM manipulations -

.div(ng-repeat='item in items') button(id='id{{$index}}') no hi button(id='anotherid1') hi inside relevant angular directive $('#id1').on('click', function() {alert('hi');}); // not work $('#anotherid1').on('click', function() {alert('hi');}); // works i performing dom manipulations need unique id ng-repeat elements. please suggest if dom manipulation can performed in other way too. edit: @tymejv:- style. .ques { height: 50px; overflow:hidden; } <div ng-repeat='item in items'> <div class='ques'> {{item.ques}} </div> <button id='id{{$index}}'> no hi </button> </div> // directive code:- increase height of <div class = 'ques'> first of all, if using angular, recommended stick standard angular directives listeners rather reverting jquery. instead of jquery's on , use ng-click attri...

mvvm - WPF DataGrid with DataGrid in RowDetailsTemplate -

my previous post detecting property changes in vm wasn't in depth enough, i'm posting this i have grid of jobs. each job can have 1 or more employees. the datagrid's rowdetailstemplate contains grid show employees. parent grid bound list of jobs. inner grid bound list of employees on job model. the job model: public class job : _base { private string _jobname = string.empty; public string jobname { { return _jobname; } set { if (_jobname != value) { _jobname = value; raisepropertychanged("jobname"); } } } private string _jobnumber = string.empty; public string jobnumber { { return _jobnumber; } set { if (_jobnumber != value) { _jobnumber = value; raisepropertychanged("jobnumber"); } } } private observablecol...

xml - Where can I find CDA MIF and RMIM -

i'm evaluating model-based mapping , transformation tools mapping application data 1 type of consolidated cda. idea of tool build emf class model using cda rmim, mif (model exchange format) , c-cda schematron. in way can simplify mapping creating simplified model , transform. wonder if had experience tool , share me. can find guide , samples in download, what's lacking part related cda. i'm particularly interested in how build emf model, there's description (hard follow) no example. have been searching info on cda rmim , mif, there're plenty info on describing are. couldn't find sample files. based on reading, mif seems particularly meaningful tooling. wonder if there's existing tool deal mif file. i have not used tool in while cda rmim , mif should available on hl7 site part of download package specification mdht has series of uml capturing constraints , corresponding ecore models here link page https://www.projects.openhealthtools.org/sf/p...

python - plot values from bidemensionnal arrays -

i have got bidimensionnal array containing values plot on y axis, , bidimensionnal array, of datetime values plot in x axis, , 2 lines of values against date arrays. these structures used as-is don't work expected, have got different kind of graph line graph. values x axis (dates): [[datetime.datetime(2011, 1, 1, 0, 0, 25, 135000), datetime.datetime(2011, 2, 1, 0, 0, 57, 386000), datetime.datetime(2011, 3, 1, 0, 0, 59, 579000), datetime.datetime(2011, 4, 1, 0, 0, 27, 676000), datetime.datetime(2011, 5, 1, 0, 0, 25, 135000), datetime.datetime(2011, 6, 1, 0, 0, 26, 414000), datetime.datetime(2011, 7, 1, 0, 0, 28, 145000), datetime.datetime(2011, 8, 1, 0, 0, 26, 432000), datetime.datetime(2011, 9, 1, 0, 0, 27, 301000), datetime.datetime(2011, 10, 1, 0, 0, 27, 643000), datetime.datetime(2011, 11, 1, 0, 0, 27, 673000), datetime.datetime(2011, 12, 1, 0, 0, 28, 294000)], [datetime.datetime(2011, 1, 1, 0, 0, 25, 135000), datetime.datetime(2011, 2, 1, 0, 0, 57, 386000), d...

c# - How to use reflection to add a new item to a collection -

i'm trying use reflection add unknown object unknown collection type, , i'm getting exception when perform "add". wonder if can point out i'm doing wrong or alternative? my basic approach iterate through ienumerable retrieved through reflection, , adding new items secondary collection can use later replacement collection (containing updated values): ienumerable businessobjectcollection = businessobject ienumerable; type customlist = typeof(list<>) .makegenerictype(businessobjectcollection.gettype()); var newcollection = (system.collections.ilist) activator.createinstance(customlist); foreach (entitybase entity in businessobjectcollection) { // area code causing exception newcollection.gettype().getmethod("add") .invoke(newcollection, new object[] { entity }); } the exception is: object of type 'eclipsys.enterprise.entities.registration.visitlite' cannot converted type 'system.collections.ge...

c# - Unfounded compilation error in VisualStudio 2012 -

visual studio's c# compiler propmts error has no base: "no overload 'itemselection' matches delegate 'onitemselected' in mainpage.xaml" (or blind , can't see error) earlier project compiled, despite fact error appeared, doesn't (what strange). thank help. //mainpage.xaml <listbox.itemtemplate> <datatemplate> <local:wordblock word="{binding}" onslideoccured="onslide" onitemselection="itemselection"/> </datatemplate> </listbox.itemtemplate> //mainpage.xaml.cs private void itemselection(string word) { tosearch = word; (panorama.items[0] panoramaitem).visibility = visibility.collapsed; panorama.setvalue(panorama.selecteditemproperty, panorama.items[0]); panorama.measure(new size(double.positiveinfinity, double.positiveinfinity)); (panorama.items[0] panoramaitem).visibility = visibility.visible; } //wordblock.xaml.cs public delegate void onitemselect...

javascript - Selectable rows for more than one Datatable a page? -

i need option choose rows on 2 different datatables independently few pages. these tables have different buttons manipulate tables according selected row. here code select row 1 table: https://datatables.net/release-datatables/examples/api/select_single_row.html cannot work more 1 table, if duplicate of code , use different ids. http://jsfiddle.net/bwcbx/ ideas? var otable; $(document).ready(function() { /* add click handler rows - used callback */ $("#example tbody tr").click( function( e ) { if ( $(this).hasclass('row_selected') ) { $(this).removeclass('row_selected'); } else { otable.$('tr.row_selected').removeclass('row_selected'); $(this).addclass('row_selected'); } }); /* add click handler delete row */ $('#delete').click( function() { var anselected = fngetselected( otable ); if ( anselected.length !== 0 ) { ...

android - Painting texture in cocos2d-x -

Image
i working on baby app , there bath scene in user applies soap baby's body. drags soap bar on body painting , soap bubbles appear on body wherever soap applied painting soap texture brush (soap bar). i have soap bar sprite , texture sprite , baby sprite. how can achieve effect ? edit: have bubbles sprite. , want wherever user touches, opacity of point in sprite becomes 1 or 255. in start opacity 0 won't visible , when user drags soap on baby's body opacity become 255 every point user drags soap over. i think achieve following way: place "baby bubbles" in cclayer (as sprite). background. create second layer in front of first , put cctexture2d it, filled white. whenever user touches screen, @ point, draw brush sprite texture. brush sprite must draw transparency. this reference may help. was helpful?

Viewscoped JSF and CDI bean -

i'm using java ee 6 on jboss eap 6, , jsf beans annotated this: @managedbean @viewscoped (both javax.faces.bean package) however, cdi beans (default constructor, use of @inject @predestroy etc). i'm reading time can't mix these annotations (jsf , cdi), it's apparently working fine: injections working, predestroy called on view change etc). missing something? problem? why not use? the cdi @inject works "everywhere" , inside jsf @managedbean . jsf counterpart @managedproperty works inside @managedbean only. can't @inject true jsf managed bean in cdi managed bean (instead, cdi managed instance). perhaps reading about. general consensus, however, indeed preferably not mix them avoid confusion among starters. jsf utility library omnifaces has cdi compatible @viewscoped jsf 2.0/2.1. the @predestroy way not specific cdi, neither counterpart @postconstruct . should work fine in both cdi managed beans , jsf managed beans.

php - mod_rewrite not working when page exists with same name -

i have page shirts.php lists shirts, , have page product.php?id=x, displays individual product information. if write rule this: rewriterule ^mens_shirts/([0-9]+)$ product.php?id=$1 [l] and input url mens_shirts/22 displays product page correctly clean url. however, if write rule follows: rewriterule ^shirts/([0-9]+)$ product.php?id=$1 [l] and input url /shirts/20 , instead of displaying product page, displays shirts.php. give try: options +followsymlinks -multiviews rewriteengine on rewritebase / rewriterule ^shirts/([0-9]+)$ product.php?id=$1 [nc,l] i believe happens because have multiviews enabled, disabling it, should let want. why, read here. followsymlinks - server follow symbolic links in directory.

javascript - How Can I Include a Typescript Generated js.map File as a WebResource in a Web Control? -

i have javascript source file, generated typescript, include in asp.net web control using webresource attribute. generated javascript file includes reference generated js.map file. if map file included webresource in web control, resource url going compiler generated url. while find out is, , attempt modify js file manually, overwritten on build. is there better solution use case? you can access resources via var file = <appnamespace>.properties.resources.<jsfilename> or load stream var stream = assembly.getexecutingassembly().getmanifestresourcestream("<fullname>"); in both cases should able modify (not sure). if not possible, have write small service returns script, read resource, modify , return back...

flat file - SSIS Convert Blank or other values to Zeros -

Image
after applying unpivot procedure, have amount column has blanks , other characters ( "-"). convert non-numberic values zero. use replace procedure converts 1 @ time. also, tried use following script /** public overrides sub input()_processinputrows(byval row input()buffer) if row.columnname_isnull = false or row.columnname = "" dim pattern string = string.empty dim r regex = nothing pattern = "[^0-9]" r = new regex(pattern, regexoptions.compiled) row.columnname = regex.replace(row.columnname, pattern, "") end if end sub **/ but i'm getting error.i don't script maybe placed in wrong place. bottom line need convert non-numberic values. thank in advance help. i @ regular expressions great way introduce problem existing one. what did simulate problem write select statement added 5 rows. 2 valid numbers, rest empty string, string spaces , 1 hyphen....

c++ - Boost Asio UDP Daytime Server Async receive -

i've been learning boost asio recently, udp. familiar basics, had question regarding how udp handles incoming messages. in tutorial (see source code here: http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/tutorial/tutdaytime6/src.html ), udp server operates (very pseudo-code): startreceive(){ async_receive(boost::bind(handler),...other params); } handler(){ dostufftodatareceived(); startreceive(); //start receiving process on again allow receive more data } my question is, if data arrives server during time in "dostufftodatareceived()", before startreceives on again, data lost, or sit there , wait startreceive happen again , retrieved? thanks! udp stack has buffer, data in above example wouldn't lost. note however, udp allowed drop packets under various circumstances. so, throughput of udp server grows, timings of dostufftodatareceived might become more critical.

javascript - jQuery .on() syntax and passing multiple arguments to function -

i have following script not work on firefox seems work on google chrome. <script> $(document).ready(function(){ $('#btn_2').on('click', function () {addselectable(event, 7)}); $(function() { $( "#selectable" ).selectable(); }); }); </script> function addselectable (event, size) { event.preventdefault(); event.stoppropagation(); alert('hello'); var s = size; var p = $('<ol>').attr('id', 'selectable'); var count = 0 (var = s; >= 0; i--) { count = count + 1; var li = $('<li>').attr('class', 'ui-state-default').text(count); $(li).appendto(p) p.append(li); } $(p).appendto('body'); alert('i done'); //}; } how can pass multiple arguments function 'addselectable' in ...

c# - instantiate a generic class using reflection -

this question has answer here: how dynamically create generic c# object using reflection? [duplicate] 5 answers [ note: don't believe question duplicate of 1 linked above, explain in update below.] is there way define/instantiate generic class using reflection? so have bunch of classes, each of owns instance of generic class shares type of owner: public class genericclass<t> { t owner { get; set; } public genericclass(t owner) { owner = owner; } } public class myclass { private genericclass<myclass> mygenericobject; public myclass() { mygenericobject = new genericclass<myclass>(this); } } this works, of course have explicitly specify "myclass" argument in genericclass definition. i'd able this: private genericclass<typeof(this)> mygenericobject; // error: invalid token is there anyway dynamically ...

xslt - XPath selector not working during PDF transformation -

i have dita bookmap storing image paths: <bookmap> <bookmeta> <data id="productlogo"> <image href="images/_notrans/frontcover/productlogo.svg" /> </data> <data id="productphoto" > <image href="images/_notrans/frontcover/productphoto.jpg" /> </data> </bookmeta> </bookmap> then attempt grab href values data[@id]: <xsl:variable name="productlogo"><xsl:value-of select="//data[@id='productlogo']/image/@href" /></xsl:variable> <xsl:variable name="productphoto"><xsl:value-of select="//data[@id='productphoto']/image/@href" /></xsl:variable> (these xpath expressions match href when test against bookmap in oxygen.) during transformation output: <xsl:message>productphoto: <xsl:value-of select="$productphoto"/...

ios - "Invalid image path" error while trying to upload a binary via XCode -

Image
i'm getting following error while trying upload binary itunes connect: even though images specified in plist: they added project , project directory: what can problem? the problem solved pressing "use asset catalog" in project menu.

knockout.js - pagerjs - sharing view model with enclosing pages -

if have nested pages <div data-bind="page: {id: 'top', withonshow: topvm}"> <div data-bind="page: {id: 'sub1', withonshow: sub1vm}"> <span data-bind="text:sub1property"></span> </div> </div> topvm = function(callback) { callback({topproperty: xxx}); } sub1vm = function(callback) { // how can access topvm here? callback({sub1property: xxx}); } how can access outer page's view model inner page's view model? <span data-bind="text:$root.topvmproperty"></span> the link here explains knockout contexts http://knockoutjs.com/documentation/binding-context.html according example this: <span data-bind="text:$parent[1].topvmproperty"></span>

Android: change color of rectangle at runtime -

i have linearlayout , have custom view: public class myview extends view { rect rects = new rect(30,30,80,80); canvas mycanvas; @override public void ondraw(canvas canvas) { mycanvas = canvas; paint.setcolor(color.red); canvas.drawrect(rects, paint); } void changecolor() { paint.setcolor(color.blue); mycanvas.drawrect(rects, paint); mycanvas.invalidate(); } } in mainactiviy have: linearlayout lv = (linearlayout) view.inflate(this, r.layout.activity_main, null); drawview = new myview(this); lv.addview(drawview); setcontentview(lv); button button3 = (button) findviewbyid(r.id.button3); button3.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { drawview.changecolor(); } }); after clicking button want change color of rectangle calling changecolor. new rectangle in other place created! can please me? ...

eclipse - What's the fastest way to get all build errors in a Java project? -

currently i'm looking @ integrating build processes source control (git hooks specifically). i'm trying write pre-commit hook checks build errors in java project (a medium-large test development project) , fails allow commits contain errors in build. turning out rather challenging. the approach here uses command-line eclipse tool build , output warnings , errors. technically work, it's slow , may cause problems eclipse ide (i've had heap allocation errors). i've looked @ solutions using ant these approaches don't seem simple one-line solution, , may still slow. my main question: what's fastest (run-time compilation speed) way build , validate java project, command line? i'd solution returns 0 no errors , else if errors present, i'm willing @ other things. let's start basics: pre-commit hooks run on server , not client. there no working directory default. have make sure javac available, , correct version. your pre-commit h...

Rails 4.0.0 strong parameters don't seem to work as documented -

the example used in documentation ( http://guides.rubyonrails.org/action_controller_overview.html#strong-parameters ) strong parameters is: params.require(:person).permit(:name, :age) however, doesn't work because require() returns value of parameter, not parameter object permit() can called on. $ rails console 1.9.3p286 :005 > params = actioncontroller::parameters.new(person: 1, name: "joe", age: 30) => {"person"=>1, "name"=>"joe", "age"=>30} 1.9.3p286 :006 > params.require(:person).permit(:name, :age) nomethoderror: undefined method `permit' 1:fixnum (irb):6 /users/jeremyburton/.rvm/gems/ruby-1.9.3-p286/gems/railties-4.0.0/lib/rails/commands/console.rb:90:in `start' /users/jeremyburton/.rvm/gems/ruby-1.9.3-p286/gems/railties-4.0.0/lib/rails/commands/console.rb:9:in `start' /users/jeremyburton/.rvm/gems/ruby-1.9.3-p286/gems/railties-4.0.0/lib/rails/commands.rb:64:in `<top...

php - Laravel return Response::view -

simple question, think. i have route calls function in controller. in controller, have call controller function. for example: $_testing = with(new testingcontroller)->prepwork($variable1,$variable2); inside of testingcontroller prepwork(), if condition matches, return response::view(...); question - how come isn't enough? return returns control calling function (which makes sense), how tell laravel - stop doing , output view. to make work, have to: $_testing = with(new testingcontroller)->prepwork($variable1,$variable2); return $_testing; that doesn't work prepwork designed heavy lifting , output result model. view kicked off when there error. and yes - know can this: if ($_testing->whatimcheckingforerrors) { return response::view(...); } i'm trying understand why return response::view doesn't end processing... if makes sense. only last return end processing, because application receive last return , render whatever send ...

database design - mysql handling nested data for a known number of levels -

now have hierarchical structure looks this: .stage ...grade .....semester .......subject .........unit ...........lesson at first stored inside same table id parent relationship; however, each level of 6 levels has own data. example, lesson has featured_video_id , subject has language_id . now i'm thinking of creating 6 tables: 1 each level , connect them foreign keys. i'm thinking of possibilities , thought professional opinion help. division of or regret in future? i t makes lot of sense have separate tables stages, grades, semesters, ... you have mentioned best reason this, can add individual data each of these levels. can name foreign keys in sensible way (i.e. stage_id in table grades). , doubt ever need list of subjects mixed in lessons or semesters.

java - Multiple Range Random Number Generator -

please me out generate random numbers based on user input %'s. example, input of 60,10 , 30, output should be: 60% of random numbers of 0-70 range 10% of random numbers of 70-80 30% of random numbers of 80 above range should use multiple range generator? or possibilities? here code: import java.util.arraylist; import java.util.list; import java.util.random; class randominranges { private final list<integer> range = new arraylist(); randominranges(int min, int max) { this.addrange(min, max); } final void addrange(int min, int max) { for(int = min; <= max; i++) { this.range.add(i); } } int getrandom() { return this.range.get(new random().nextint(this.range.size())); } public static void main(string[] args) { randominranges rir = new randominranges(1, 200); rir.addrange(50, 60); system.out.println(rir.getrandom()); } } ...

Jquery toggle class on click -

i have following div, <div id="mainoutput"> <img src="/img/preloader.gif" alt="loading" class="preloader" /> </div> the beginning of ajax/jquery , $(document).ready(function() { $(".preloader").hide(); $("#button").click(function() { $(".preloader").slidetoggle( "slow" ); var host = $("#hostinput").val(); var record = $("#recordinput").val(); $.ajax({ url : "/cachecheck_ajax", type : "post", datatype: "json", data : { hostinput : host, recordinput : record, csrfmiddlewaretoken: '{{ csrf_token }}' }, ...

html - Need help figuring out why I can't get the content of a certain textarea element with Javascript for my code playground -

i'm building code playground using code mirror. issue i'm not able content textarea elements have html, css, , js. created textarea aside textarea elements see if code getting content textarea had issues. in html, of course have textarea tags. gave new textarea class name "txtb" , created link onclick attribute function called "alertcontent()". here javascript function: function alertcontent(){ alert(document.getelementsbyclassname('txtb')[0].value); } and guess what, works. when type textarea element has class "txtb", , click link calls function alertcontent() created, see message box appear displaying text typed textarea. works. however, when try give classes textarea elements i'm using code mirror, , use same function value or content textarea elements, end getting blank message box though there's text (html, css, js) in textarea elements. want do, create function content of textarea elements (html, css, js) can save...