Posts

Showing posts from May, 2014

excel - VBA - Loop specific childnodes from XML code -

i'm trying scrape following xml excel sheet. however, want loop through specific childnodes show name , priceeffectivestart , priceeffectiveend , price , , currency each index summary. xml code <indexprices> <indexpricesummary> <id>1</id> <uri>www.example.com</uri> <index> <id>3</id> <name>same day index</name> <uri>www.example.com.xml</uri> </index> <priceeffectivestart>2015-06-26</priceeffectivestart> <priceeffectiveend>2015-06-26</priceeffectiveend> <price> <amount>2.4806</amount> <currency>cad</currency> </price> <duration>1</duration> <quantitytraded> <amount>474</amount> <unit>gj</unit> <contractunit>day</contractunit> </quantit

When redirect Rails is not rendering html response on browser -

Image
when try use method def create @ticket = current_user.creator.build(ticket_params) if @ticket.save! flash[:success] = "thanks! i'll in touch soon!" redirect_to @ticket else render :root end end it saves perfect ticket record in database. , return 'show' page's html response, but in browser still in same page . the response , 2 request created method is: my form: = simple_form_for(@ticket, html: { class: 'form-horizontal', multipart: true }, remote: true) |f| #..... = f.submit 'criar ticket', class: 'btn btn-primary' you setting remote true in form, therefore making javascript request. controller responding if html request redirecting. why setting remote true? if there's not reason remove remote: true , things work.

c# - Custom context menu for WPF WebBrowser Control -

hi need create custom context menu web browser control in wpf. here xaml code not working: <webbrowser x:name="emailbox" ap:browserbehavior.htmlstring="{binding message, mode=oneway}"> <webbrowser.contextmenu> <contextmenu> <menuitem header="copy" command="applicationcommands.copy"/> <menuitem header="copy customer reference id" command="{binding copyid}" commandparameter="{binding relativesource={relativesource findancestor, ancestortype={x:type contextmenu}}, path=placementtarget.selection.text}"> <menuitem.icon> <image source="{staticresource copyimagesource}" width="16" /> </menuitem.icon> </menuitem> <menuitem header="copy comments" comm

php - Set default radio button in Cakephp -

the below code creates radio buttons , html go them, works want set first radio button default selected 1 , im not sure needs added. <?php ($i =0; $i < count($packages); $i++){ echo "<div class='package-outter'>"; echo "name: ".$packages[$i]['package']['name']."<br>"; echo "number of campaigns (per month): ".$packages[$i]['package']['quantity']."<br>"; echo "price: ".$packages[$i]['package']['price']."<br>"; if ($i == 0){ echo $this->form->input('package', array( 'type' => 'radio', 'options' => array($packages[$i]['package']['id'] => $packages[$i]['package']['name'],), 'class' => &#

java - Using two LocalDateTime instances to calculate a duration -

i trying calculate duration between 2 instances of localdatetime . special thing here each instance of localdatetime anywhere in world: localdatetime start nevada , localdatetime end tokyo . each "time" associated localdatetime is, enough, local location. so if said... localdatetime start = localdatetime.parse("2015-07-14t10:00:00"); , said start represented chicago, mean 10:00 in chicago time. say... localdatetime end = localdatetime.parse("2015-07-14t03:00:00"); , end represents moscow, 3:00am in moscow time. can create robust enough solution allow start , end represent any cities in world , still correctly calculate duration between two? "localdatetime" not mean particular locality i think misunderstand purpose of localdatetime . "local" means any locality, not specific locality . in "christmas starts @ midnight on december 25, 2015" mean any locality’s midnight. christmas starts in pa

android - How to scroll two-columns buttons in Activity -

Image
i can include 6 buttons , displays correctly . now want include more 6 buttons in scrollable view, can't handle matching available space, creating 2 rows (or columns if portrait). can provide way achieve this? references: i have composed button created using following code: public class imagebuttontext extends relativelayout { imagebutton button; textview label; holder holder; private void init() { layoutinflater li = (layoutinflater) getcontext().getsystemservice(context.layout_inflater_service); li.inflate(r.layout.big_button, this, true); button = (imagebutton) findviewbyid(r.id.button); label = (textview) findviewbyid(r.id.label); /*initialise button , label*/ } } and following xml: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" andr

java - What is the best approach? Binary Search Tree : Lowest Common Ancestor using only if statements -

Image
i have solved problem if statements. can solved in various other ways. have started programming, not think of using other data structure solving this. my question : how choose best approach among various ways? , advantages/disadvantages of best approach compared direct naive approach. not problem, in general. how arrive @ possible approach problem? problem statement you given pointer root of binary search tree , 2 values v1 , v2. need return lowest common ancestor (lca) of v1 , v2 in binary search tree. need complete function. my code: static node lca(node root,int v1,int v2) { node r = root; if( r == null){ return null; } else if(r.data == v1 || r.data == v2){ return r; } else if(r.data > v1 && r.data < v2){ return r; } else if(r.data > v2 && r.data < v1){ return r; } else if( r.data > v1 && r.data > v2){ lca(r.left, v1, v2); } else if

Need help to finish a drop down to be active only when clicked. (HTML and CSS) -

tried hard figure out. nothing. take look: http://liveweave.com/vdqjtf i need simple activation on click, work on mobile. this minimal example, uses css , html. /* start praveen's reset fiddle ;) */ * {font-family: 'segoe ui'; margin: 0; padding: 0; list-style: none; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;} /* end praveen's reset fiddle ;) */ nav ul {display: block;} nav > ul > li {display: inline-block; border: 1px solid #999; padding: 5px; position: relative;} nav ul ul {position: absolute; left: 0; padding: 5px; border: 1px solid #999; margin-top: 5px; margin-left: -1px; width: 100px; background-color: #fff; display: none;} nav ul input {display: none;} nav ul ul li {display: block;} nav ul input:checked + ul {display: block;} <nav> <ul> <li> <label> item 1 <input type="radio" name="menu"> &l

javascript - I have issue with setTimeout/clearTimeout -

i have following js document.addeventlistener("domcontentloaded", function() { document.queryselector("#pageredirect").addeventlistener("change", changehandler); }); function changehandler() { var timer; if (pageredirect.checked) { timer = settimeout(function() { window.location.href = 'http://www.google.com'; }, 3000); console.log(pageredirect.checked); } else { //dont redirect cleartimeout(timer); console.log(pageredirect.checked); } } <input type="checkbox" id="pageredirect" name="pageredirect" /> i dont redirect when checkbox uncheck is. where's fault ? thanks. the issue location of variable declaration timer id. it's inside function, when attempt clear it, it's not got id assigned in settimeout . need move declaration outside of function can keep handle of timer between invocations: var timer; function

javascript - How can I keep this table header fixed? -

i'd keep table header fixed, problem when set thead position fixed loses size. basically, want keep thead moving rest of table original shape , size . thanks in advance. table { margin: 100 0 100 0; width: 100%; } th, td, table { /*word-wrap: break-word;*/ border: 1px solid black; border-radius: 3px; } body { overflow: hidden; } .scrollable { height: 100%; display: flex; flex-direction: column; overflow-y: scroll; } thead { position: fixed; width: 100%; } .myhead { width: auto; border: 11px solid blue; } <!doctype html> <html> <head> <title>mytable</title> </head> <body> <div class="scrollable"> <table> <thead> <tr class="myhead"> <th class="header" align="center">title</th> <th class="header" align="center">t

sql server - Shrink database or DB files not reducing size although I dropped biggest table - Database Administrators Stack Exchange

our mdf file 580gb in size, , biggest table had [hourlycounters] 140 million rows 580 columns (varchar[50]). it's table inefficient schema, there's nothing can that. anyways, after moving data around, able drop [hourlycounters] . now, new table (with same name) has 50k rows. ran shrinkdatabase , shrinkfile, mdf went down 40gb. know that's decent chunk, know fact dropped table larger (the current backup of table 7m rows 63gb). how can sql server release free space? new version of [hourlycounters] doesn't have indexes, know old 1 did have them. it's worth mentioning how went dropping table: rename original table [hourlycounters] [hourlycounters_old] right-click in ssms , rename . table had indexes. create new table [hourlycounters] no indexes processes stored in table not affected. create table [hourlycounters_new] store recent data [hourlycounters] (now called [hourlycounters_old] ). table has 7m rows. drop [hourlycounters_old] thanks.

html - JavaScript - collapse element by changing class name -

i have made grid of 9 boxes. on clicking of 9 boxes, 1 clicked, occupies space of entire grid, , displays information within it. now, have made cross @ top right of every grid, which, on being clicked, meant collapse grid original size , occupy previous position. have written pure javascript code it, , inspecting code in browser suggests there nothing wrong code. but, cross button doesn't seem work. below, have mentioned js functions have written. here jsfiddle : https://jsfiddle.net/ag_dhruv/wx7en2kx/ , here folder containing page : goo.gl/qiafc7 function expand (x) { var tester = x.classname.substr(5,7); if(tester != "ex"){ x.classname = x.classname+"ex"; var cross = x.getelementsbyclassname('cross'); (var = 0; < cross.length; i++) { cross[i].classname = "crossshown"; }; var icon = x.getelementsbyclassname('boxfortitle'); (var j = 0; j < icon.length; j++) { icon[j].classname = "boxfortitlebig"; }; var i

Javascript - maintain key order when going from object -> array -

i know key order isn't guaranteed in js objects, however, data structure comes backend have no control over. there can preserve key order when going from: var obj = { foo: 'bar', bar: 'foo' }; to: object.keys(obj); // hoping ['foo', 'bar'] it's of utmost importance keep key order unfortunately... no. wrote: i know key order isn't guaranteed in js objects if want order need use array. if have object, there no defined order properties.

ios - Segue From UIScrollView to Other View In Swift -

Image
i doing image gallery in swift xcode. gallery it's this: (see botton of post) i view called item has image view , title (xib+controlview) inserted in horizontal view, , view inserted in scroll view. i need actions views when user touch image or title, example go other view data of album. the question: how correct method of doing this? there way going other views view inserted in scrollview ? how can segue story board or code other view?(and wich of 2 method better) thanks answers!! jo! i recommend implementing collection view 1 row. then, can have prototype collection view cell in storyboard, , control-drag cell next view create segue.

javascript - Add class selected relative URL -

i'm trying make highlight class selected category: this code : <div id="category"> <ul> <a href="category.php?c=electronic"> <li>electronic</li> </a> <a href="category.php?c=fashion"> <li>fashion</li> </a> </ul> </div> css: .selected {border-bottom:3px solid red; } script: $("#category ul a").each(function(){ if ($(this).attr("href") == window.location.href){ $(this).addclass("selected"); } }); when click on electronic category, show highlight class .selected , but, problem came when url page change category.php?c=electronic&page=2 highlight class .selected not showing anymore, how modify jquery, so, show again? found javascript split url article, work problem? use .indexof instead. var url = $(this).attr("href"); var wi

c# - Asynchronously wait for Task<T> to complete with timeout -

i want wait task<t> complete special rules: if hasn't completed after x milliseconds, i want display message user. , if hasn't completed after y milliseconds, i want automatically request cancellation . i can use task.continuewith asynchronously wait task complete (i.e. schedule action executed when task complete), doesn't allow specify timeout. can use task.wait synchronously wait task complete timeout, blocks thread. how can asynchronously wait task complete timeout? how this: int timeout = 1000; var task = someoperationasync(); if (await task.whenany(task, task.delay(timeout)) == task) { // task completed within timeout } else { // timeout logic } and here's a great blog post "crafting task.timeoutafter method" (from ms parallel library team) more info on sort of thing . addition : @ request of comment on answer, here expanded solution includes cancellation handling. note passing cancellation task , timer means there

arrays - Add element to FORTRAN pointer? -

i have array arr in fortran going 1 n need test each element against elements preceding , succeeding (i.e. i against i-1 , i+1 ) - problem being elements 1 , n have n or 1 predecessor or successor, respectively (i.e. loops). instead of testing first , last elements separately, i'd rather run loop like: do i=1,n call testi(i-1,i,i+1) end and define pointer (in order not use dummy array , twice memory) like arrpointer(0) => arr(n) arrpointer(1:n) => arr(1:n) arrpointer(n+1) => arr(1) to "simulate" loop in array. (note each array element vector - arr(i)%vec(1:m) ) the above not work each new definition of pointer overwrite previous. question arises: is there way add element pointer array without deleting previous definitions? ps: as current workaround, use allocatable type array pointers: type :: pointerarray real, pointer :: elementpointer(:) end type pointerarray type(pointerarray), allocatable :: arrpointer(:) arrpointer(0)

debian - Cannot run svn update as www-data in post-commit hook -

i'm using svn under debian , commit web files using user, different www-data. commit process ok, want write post-commit hook capable perform svn update www-data working copy of svn repository, testing live updates of code. i'm trying write post-commit hook in way: sudo -u www-data /usr/bin/svn update unfortunately, working copy not updated when commit process completed. when try execute former sudo statement in cli, statement succeeds , working copy updated correctly. have clue this? i've configured /etc/sudoers in such way not necessary type user password execute sudo. post-* hooks in subversion executed in empty environment svn up without parameters uses . target, , can't recall current dir (if exist) hook-process, not live-wc, suppose, better way /usr/bin/svn update /path/to/live you can redirect stdout|stderr file in order see details later (or marshall output of hook svn-client , see hooks operations in real-time - add 1>&2 trailin

RabbitMQ Priority Queues not working in MULE -

i'm trying use priority queues mechanism provided rabbitmq within mule esb. i have created queue x-max-priority = 3 , in new mule proyect, i've set 3 amqp:connectors, 1 each priority, this: <amqp:connector name="amqplocalhostconnector0" host="${amqp.host}" port="${amqp.port}" fallbackaddresses="${amqp.fallbackaddresses}" virtualhost="${amqp.virtualhost}" username="${amqp.username}" password="${amqp.password}" priority="0" ackmode="amqp_auto" prefetchcount="${amqp.prefetchcount}" /> /* values within ${} taken properties file. * priorities are: "0", "1", "2" */ then, there simple flow sends messages every second queue containing priority string in body, besides property priority used in connector. <flow name="rabbitmqflow1" doc:name="rabbitmqflow1"> <poll f

javascript - d3 donut chart multy ring with text -

i create multi ring donut chart following examples on web , ok till try display text ring , got stuck different errors. think @ point can access data when comes create rings, got nan values path , text. here code: var dataset = { ringone: [{"label":"70%", "value":70}, {"label":"10%", "value":10}, {"label":"20%", "value":20}], ringtwo: [{"label":"70%", "value":70}, {"label":"10%", "value":10}, {"label":"20%", "value":20}], }; var width = 460, height = 300, cwidth = 45, outerr = 100, color = d3.scale.ordinal().range(["#07e", "#00aced", "#e32"]); var svgdonut = d3.select("#donut") .append("svg") .attr("width", width) .attr("height", height) .ap

php - How to declare unlimited parameters in Laravel? -

is there way declare unlimited number of parameters in routes of laravel 5 similar codeigniter? i going build large application , declaring each , every parameter in route file each function not possible. tried searching lot didn't got solution. you can use this //routes.php route::get('{id}/{params?}', 'yourcontroller@action')->where('params', '(.*)'); remember put above on end (bottom) of routes.php file 'catch all' route, have have 'more specific' routes defined first. //controller class yourcontroller extends basecontroller { public function action($id, $params = null) { if($params) { $params = explode('/', $params); //do stuff } } }

c++ - Sprite tracking touch -

i want implement tracking (following) touch sprite rotation in cocos2d-x. can see effect here: https://www.youtube.com/watch?v=rzoumyyngg8 (2:10). here's code in touchmove: _destinationx = touchpoint.x; _destinationy = touchpoint.y; _dx = _destinationx - draggeditem->getpositionx(); _dy = _destinationy - draggeditem->getpositiony(); _vx = _dx; _vy = _dy; float d = sqrtf((_dx*_dx)+(_dy*_dy)); //nice easing when near destination if (d < 50 && d > 3){ _vx *= d / 50.0f; _vy *= d / 50.0f; } else if(d <= 3){ _vx = _vy = 0; } draggeditem->setposition(draggeditem->getposition() + point(_vx, _vy)); float rad = atan2(_dy, _dx); float rotateto = cc_radians_to_degrees(-rad); if (rotateto > draggeditem->getrotation() + 180) rotateto -= 360; if (rotateto < draggeditem->getrotation() - 180) rotateto += 360; draggeditem->setrotation(rotateto); it works, sprite destination point on it's center, if on touchbegin won't

IPC connection to browser process is lost - loadrunner -

i using loadrunner 12.02 - truclient ie - on set of virtual machines. machines hosted on esxi 5.5 (tested e1000 , vmxnet3 interfaces). load generator: windows 2012 r2 (also tried windows 2008 r2) web server: windows 2012 r2 testing scenario pretty simple - 4 users login , start execute set of steps (loading submissions , submitting them). however, on every test-run, after 2-15 minutes of running @ least 1 of threads gets "ipc connection browser process lost" , stops. in resource monitor can see 2 threads of loadrunner have entered deadlock. there not anti-virus software on of servers , ipv6 disabled famous triggering strange issues. happy hear guys! thanks! this issue related microsoft updates kb3049563 & kb3038314. initial measure suggest uninstalling updates. please contact hp support, published hotfix issue. regards, shlomi nissim hp truclient r&d manager

javascript - jQuery selector problems -

i have tabs' info rendered handlebars , here html: <ul class="nav nav-tabs" id="tabsid"> <script id="tabs-template" type="text/x-handlebars-template"> {{#each tabs}} <li data-tab-content={{id}}><a href="#">{{name}}</a></li> {{/each}} </script> </ul> <div id="tabscontentid"> <script id="tabs-content-template" type="text/x-handlebars-template"> {{#each tabs}} <div class="tab-content" data-tab-content="{{id}}">{{content}}</div> {{/each}} </script> </div> and i'm writing function fill future form when double click on tab. i've managed how id , don't understand how name , content values. i've tried use jquery .text() function, i've failed. here function: $(function() {

c# - Checkbox inside Update Panel causing full post back -

i have registration form users fill up. in there, 1 field there if user checks on button text box shoulld enabled enter number. have used following code : <asp:updatepanel id="upmsme" runat="server"> <contenttemplate> <tr> <td colspan="2"> <asp:label id="lblmsme" runat="server" text="whether covered under msme (tick whichever applicable)"></asp:label> <asp:checkbox autopostback="true" checked="true" id="chbmsme" runat="server" oncheckedchanged="chbmsme_checkedchanged" clientidmode="autoid"/> </td> </tr> <tr id="trmsmeno" runat="server"> <td> <asp:label id="lblmsmeno" runat="server" text="msme number&

google apps script - UI to HTML, conversion will not write a date to the sheet -

i trying replicate question posed pieter jaspers regarding conversion of form uiapp html. original question is: original question pieter jaspars answered sandy good if replicate code correct result, when try recreate inline form , amalgamate 2 not getting result. inline form question here: html inline form formatting question answered mogsdad the code have far in requisite number of parts, form , 2 .gs sheets. have checked spelling mistakes , have tried editing out each line see , get, limited experience drawing blank. minor success if run function insertinss() within code editor. posts word "undefined" in correct cell in correct spreadsheet, not date trying do! form: <!-- use templated html printing scriptlet import common stylesheet. --> <?!= htmlservice.createhtmloutputfromfile('stylesheet').getcontent(); ?> <html> <body> <div> <!-- page header title & 'completion warning --> <span class="

java - how to send post request and get response in big5 using Apache HttpClient 4.5 -

it send post request encodeing in big5 using apache httpclient 4.5. java code follows, , result shows unreadable code ???. please give suggestions fix it. hpr803.getresps1("http://web-reg-server.803.org.tw/tre/stepb1.asp"); //the method send post request , response public void getresps1(string param) throws ioexception{ arraylist<namevaluepair> pairlist = new arraylist<namevaluepair>(); // post request example hospital 803 pairlist.add(new basicnamevaluepair("syear", "104")); pairlist.add(new basicnamevaluepair("smonth", "7")); pairlist.add(new basicnamevaluepair("sday", "20")); pairlist.add(new basicnamevaluepair("eyear", "104")); pairlist.add(new basicnamevaluepair("emonth", "8")); pairlist.add(new basicnamevaluepair("eday", "5")); pairlist.add(new basicnamevaluepair("hospno", "1&q

php - Laravel - Mailer Service? -

i'm bit of noob laravel i'm setting bug tracking system , have question how remove multiple instances of sending mails. let me show how i've got set currently: public function store(usersrequest $request) { $user = user::create($request->all()); mail::queue('emails.master', ['user' => $user], function($message) use ($user) { $message->to('someone@somewhere.com') ->subject('new user created'); }); return redirect('/users'); } so have method in controller creates new user in system, send mail out. i'd strip mail call out 1 line of code. what's best way achieve this? what i've found far, setting service handle - this: http://lukefair.com/create-a-mailer-service-with-laravel-and-a-basic-working-example-of-dependency-injection/ this seems idea noob brain , achieve need to. there better way creating service? making use of events perhaps (although, guess i'd still ne

python - Why can't I call read() twice on an open file? -

for exercise i'm doing, i'm trying read contents of given file twice using read() method. strangely, when call second time, doesn't seem return file content string? here's code f = f.open() # year match = re.search(r'popularity in (\d+)', f.read()) if match: print match.group(1) # names matches = re.findall(r'<td>(\d+)</td><td>(\w+)</td><td>(\w+)</td>', f.read()) if matches: # matches none of course know not efficient or best way, not point here. point is, why can't call read() twice? have reset file handle? or close / reopen file in order that? calling read() reads through entire file , leaves read cursor @ end of file (with nothing more read). if looking read number of lines @ time use readline() , readlines() or iterate through lines for line in handle: . to answer question directly, once file has been read, read() can use seek(0) return read cursor start of file (docs here ).

Express server crashing due to MongoDB connection loss -

i having issues http node.js server built with: ubuntu 14.04 mongodb 3.0.4 iojs v2.3.3 express=4.10.* mongodb=1.4.34 the following middleware being used: app.use(response_time()); app.use(body_parser.urlencoded({extended: true})); app.use(body_parser.json()); var mongoclient = require('mongodb').mongoclient; app.use(function (req, res, next) { var connection_options = {auto_reconnect: false}; mongoclient.connect(config.server.db, connection_options, function (err, db) { if (err) { log.error(err); // logging error. return next(err); } req.db = db; next(); }); }); the server started running @ 20:40:10 , handled multiple requests. at 02:59:02, following error started logged on every request: 02:59:02.114z error crowdstudy: failed connect [127.0.0.1:27017] error: failed connect [127.0.0.1:27017] @ null.<anonymous> (/home/ncphillips/projects/crowdstudy/node_modules/mongodb/li

date - How do you check a field in a query for specific values if and only if another field had a specific value? -

i want write expression in access query check see if item running next week has run in 4 weeks before date. i'm having trouble understanding how can check in same query , use returned value of check check few more things. method i've tried write make query use results of first query (where items 7/20/2015 isolated) check dates of items, run problem because have tie query original table, duplicates data. written in pseudo-code, following: if item has job_date of 7/20/2015 , check instances of item prior 7/20/2015 , if there no instance weeks 7/13/2015 , 7/6/2015 , 6/29/2015 , or 6/22/2015 , return item . written in more visual way: item job_date 6/22/2015 6/29/2015 7/6/2015 7/13/2015 7/20/2015 item job_date b 6/15/2015 b b b b b 7/20/2015 item job_date c 6/22/2015 c c

java - Prevent instantiation of a class from a library -

i developing application depends on library. not have control on library code. i have extended class library in application. want application able create instances of extended class, not parent class. is there way prevent object creation of parent class? i don't think there way in can restrict creation of parent instance, if see architecture "initializer" make sure instance created , @ same time allocate heap space. at end memory has allocated , instances has created.

opengraph - How does Facebook Sharer select Images and other metadata when sharing my URL? -

Image
when using facebook sharer, facebook offer user option of using 1 of few images pulled source preview link. how these images selected, , how can ensure particular image on page always included in list? how tell facebook image use when page gets shared? facebook has set of open-graph meta tags looks @ decide image show. the keys 1 facebook image are: <meta property="og:image" content="http://ia.media-imdb.com/rock.jpg"/> <meta property="og:image:secure_url" content="https://secure.example.com/ogp.jpg" /> and should present inside <head></head> tag @ top of page. if these tags not present, older method of specifying image: <link rel="image_src" href="/myimage.jpg"/> . if neither present, facebook @ content of page , choose images page meet share image criteria: image must @ least 200px 200px, have maximum aspect ratio of 3:1, , in png, jpeg or gif format. can specify

angularjs - Error: [$compile:tplrt] Template for directive 'header' must have exactly one root element -

i want implement angular header , footer directives layout(index.html) page. getting error: [$compile:tplrt] template directive 'header' must have 1 root element. this index.html (requirejs included) <div> <div header ></div> <div>main content here{{1+2}} </div> <div footer></div> </div> header.html : <!--- angular header--> <div> stuff </div> <div> other stuff </div> <!--- angular header--> header.js (directive) angular.module('header', []) .directive('header', function () { return { restrict: 'a', //this menas used attribute , not element. don't creating custom html elements replace: true, //scope: {user: '='}, // 1 of cool things :). explained in post. templateurl: base_url+"angular/js/directives/admin/header.html", controller: ['$scope', '$filter&

r - How do I split data into 4 groups with even amounts of time? -

this data frame result of video analysis of 11 subjects under 2 separate conditions: vigil vs. video. have start , stop columns time measured in seconds. grouped data frame subject(sbj) , cognitive load (condition) , found amount of time of each video subtracting last stop time , first start time of each subject each condition. divided overall time of video 4 see how long each quartile (in seconds). here example of data looks like, although actual data bit more complex: library(dplyr) start <- c(35, 44, 53, 62, 71, 80) stop <- c(42, 50, 59, 70, 77, 85) condition <- c('video', 'vigil', 'video', 'vigil', 'video', 'vigil') sbj <- c(1, 1, 2, 2, 3, 3) df <- data.frame(start, stop, condition, sbj) df1 <- group_by(df, sbj, condition) df2 <- summarize(df1, time = last(stop)-first(start)) hd2 <- transform(df2, quartile = time/4) hd3 <- inner_join(df1, hd2) hd3 start stop condition sbj time quartile 1 35 42

python - Identify wx.BitmapButton created by wxformbuilder -

i have little python question. created gui using wxformbuilder . in gui, there multiple bitmap buttons. binded same function. in main program, want separate them depending on name. geteventobject() doesn't work here. i manually edit automated gui code, prefer not that. there function use in order retrieve lets btn_forwardleft name gui file? in automatic generated gui.py self.btn_forwardleft = wx.bitmapbutton( self, wx.id_any, wx.bitmap( u"button_upleft.png", wx.bitmap_type_any ), wx.defaultposition, wx.defaultsize, wx.bu_autodraw ) self.btn_forwardleft.setbitmapselected( wx.bitmap( u"button_upleft_p.png", wx.bitmap_type_any ) ) self.btn_forwardright = wx.bitmapbutton( self, wx.id_any, wx.bitmap( u"button_upright.png", wx.bitmap_type_any ), wx.defaultposition, wx.defaultsize, wx.bu_autodraw ) self.btn_forwardright.setbitmapselected( wx.bitmap( u"button_upright_p.png", wx.bitmap_type_any ) ) self.btn_forwar

php - Create an array from other 2 -

i have following array: array ( [aflashparties] => array ( [2015-07-07] => 20 [2015-07-08] => 48 [2015-07-09] => 42 [2015-07-10] => 94 [2015-07-11] => 0 [2015-07-12] => 0 [2015-07-13] => 6 [2015-07-14] => 0 ), [arapidesparties] => array ( [2015-07-07] => 62 [2015-07-08] => 6 [2015-07-09] => 3 [2015-07-10] => 17 [2015-07-11] => 0 [2015-07-12] => 0 [2015-07-13] => 241 [2015-07-14] => 0 ) ) i'd turn array this: array ( [0] => array ( [date] => 2015-07-07 [flash] => 20 [rapide] => 62 [total] => 82 ), [1] => array ( [date] => 2015-07-08 [flash] => 48 [rapide] => 6 [total] => 54 ), ..... ) so idea create array has date, flash (number [aflashparties]), rapid - um

python - Converting txt file to list and returning line after user input search -

i'm trying have user input telephone number, program open text file, convert list, search list , if phone number found return rest of line (which contains address phone number. i can return either "phone number not found" or line every single line end output this: phone number not found phone number not found 0121 254132 18 springfield road phone number not found phone number not found for line in phonenumbers: if number in line: print (line) else: print ("phone number not found") i know it's because i've put line in phonenumbers don't know how not every line. try following: for line in phonenumbers: if number in line: print (line) break else: print ("phone number not found") the else part of for loop , execute if didn't break out of for loop.

How do I get brown text in a batch file? -

Image
i wondering if knows how change color of text in batch file brown can use make dirt in batch games. you can use command color followed 1 of values shown in screenshot: brown not available color in command-prompt have chose alternative color 8 gray . to color specific parts of text need use api-function, not possible within batch-scripts. however, have this tool provide way work around limitation

c++ - Design advice -- avoiding "invalid covariant return type" when returning subclass -

i have following situation: i specify pure virtual function: virtual predictedmatch predictmatch(const match &match) const = 0; i have: class impactpredictedmatch : public predictedmatch now, wanted do: impactpredictedmatch predictmatch(const match &match) const; in class implements pure virtual function earlier. i'd assumed compiler cast returned type necessary, get: impact_predictor.h:18:24: error: invalid covariant return type ‘virtual impactpredictedmatch impactpredictor::predictmatch(const match&) const’ impactpredictedmatch predictmatch(const match &match) const; i accept doesn't work in c++, advice on best instead. have return pointer? i'd rather not because i'd automatic memory management, way? thank help! when return instance of more-derived class, calling code can expect store in variable of base type. in doing so, result may sliced , losing data , possibly leaking memory (at best). if need covariant return

java - Want to specify jar name and version both in build.gradle -

i want o specify jar name , version in build.gradle, build.gradle looks below. apply plugin: 'java' version = "1.00.00" dependencies { compile files('../../lib/abc.jar') } jar{ manifest{ attributes ("fw-version" : "2.50.00", "${parent.manifestsectionname}") } archivename 'abc.jar' } so when gradle clean build , expecting generated jar name abc-1.00.00.jar but not happening, output jar name getting abc.jar , ignoring version. want specify both jar name , version, how can achieve that. archivename 'abc.jar' in jar configuration forcing name 'abc.jar'. default format jar name ${basename}-${appendix}-${version}-${classifier}.${extension} , basename name of project , version version of project. if remove archivename line in configuration you'll have format you're after. if want name of archive different project name set basename instead, e.g.

javascript - Calling function from another scope -

i have following function in javascript: function jscontroller() { this.foo = function() { $("body").click(function() { $(this).externalfunction(); } }; this.externalfunction = function() { alert('a'); }; } it doesn't work, says externalfunction() undefined. how can solve this? in case: $(this).externalfunction() this object scoped $("body") element. solve it: function jscontroller() { var self = this; this.foo = function() { $("body").click(function() { self.externalfunction(); } }; this.externalfunction = function() { alert('a'); }; }

angularjs - Why Unknown function "getJalse" in factory Angular JS -

i trying make ajax request php angular js. not getting data have sent php file. an error unknown function "getjalse" exist in factory my source: file app.js: (function () { var app = angular.module('myapp', ['ngroute']); app.config(function ($routeprovider) { $routeprovider .when('/', { controller: 'contentsctrl', templateurl: 'views/contents.php' }) .when('/jalse/:jalseid', { controller: 'recordsctrl', templateurl: 'views/jalse.php' }) .otherwise({redirectto: '/'}); }); }()); file jalsefactory.js: (function () { 'use strict'; var jaslefactory = function ($http, $q) { var factory = {}; factory.getjalses = function () { var deferred = $q.defer(); $http({method: 'get', url: 'includes/records.php'}).