Posts

Showing posts from March, 2012

AngularJS UI Bootstrap pagination control off by one page -

i trying angular ui boostrap pagination control work table populated web api controller. i have directive used on pagination control: app.filter('pagination', function () { return function (input, start) { start = +start; return input.slice(start); }; }); i have following in angular controller: $scope.currentpage = 0; // max items per page $scope.pagesize = 10; // number of pagination buttons display $scope.numberbuttons = 5; // total items in array $scope.totalitems = 0; // number of pages $scope.numberpages = 0 in view, have following (truncated brevity): ... <tr data-ng-repeat="assettype in assettypes | filter:searchfilter | pagination: currentpage * pagesize | limitto: pagesize | orderby:sorttype:sortreverse"> <td><a href="#/asset-type-details/{{assettype.assettypeid}}">{{ assettype.assettypeid }}</a></td>--> <td>{{ assettype.assettypename...

visual c++ - Problems writing a plugin to ida pro in c++ Because of different versions -

i'm trying write plugin ida , i'm pretty stuck. im using newest ida pro version (6.1). turns out used things not in use on version. how solve problem in code commands ht_graph? command changed in new version? , if there experience in writing plugins i'd love tips. thank :)

html - How to make a div span two rows (only on mobile layout)? -

Image
i have responsive web layout based on bootstrap. have glyphs, titles , text. these 2 layouts: [1a]          [1b]        [1c] [2a]          [2b]        [2c] [3a]          [3b]        [3c] this layout small screens. [1a] [2a]        [3a] [1b] [2b]        [3b] [1c] [2c]        [3c] this code makes first layout, how achieve second responsively? edit: i have this: from code: css: .green-box { background: #3dbeaf; border: 5px solid #e7e7e7; border-radius: 20px; margin-top: 10%; margin-bottom: 10%; padding-top: 10px; padding-bottom: 15px; margin-left: 2.77778% } @media (max-width: 769px) { .mob-hide{ display: none...

angularjs - How to get the active tab In Angular Material -

i want find active tab in material , save in cookie: var activetab = $cookiestore.get("active"); $cookiestore.put('active',$scope.selectedindex); console.log(active); how can find active tab in angular material here codepen example using md-on-select="ontabchanges(tabnumber)" can "watch" tab changes. example in codepen: angular material selected tab

Parse value out of XML using MSSQL -

i have following xml structure in column in table: <font class="nav"> <a onmouseover="showmenu( event, '107349267', 'yes', '431539056')" href="#" onmouseout="delayhidemenu()"> <b>107349267</b> </a> </font> i comfortable parsing parent child nodes failing see how can : select cast(transactionid xml).value('(/font class//b/node())[1]', 'nvarchar(max)') transid dbo.tablea any help? figured out: create function [dbo].[parsehtmlfromstring] ( @html_string varchar(max) -- variable string ) returns varchar(max) begin declare @string varchar(max) declare @xml xml set @xml = cast(('<a>'+ replace(replace(replace(replace(@html_string ,'<','@*'),'>','!'),'@','</a><a>'),'!','</a><a>') +'</a>') xml) ;with cte (selec...

c++ - Using ListControl in a Dialog window -

can listcontrol used in dialog in non-mfc project? using visual c++ 2010. the examples have seen far uses mfc, seems me listcontrol part of mfc. code working on not mfc based, however, visual studio still allows adding listcontrol dialog in resource view, , generates rc code list control. guess should able use it. however, not use standard method found online add variable listcontrol , use it. how can use listcontrol in case? e.g. adding column or write cell? code example help. the clistctrl class mfc class. can used within mfc project. however, clistctrl wrapper around listview common control , , listview control can used in windows application—no mfc required. the resource editor included visual c++ (confusingly) refers listview control "list control". can insert 1 on dialog, , insert listview control. if you're using mfc, can choose create member variable corresponding control. type of member variable clistctrl , because encapsulating access l...

Compute similarity between columns in a fast manner MATLAB -

given (rather) big matrix : [m*n] (m = 7, n = 15000) where columns items , rows attributes, compute similarity between each 2 items , store in array. similarity matrix sim each row contains [item1_id,item2_id, similarity] . process needs done fast. i considering options @bsxfun uses multi-threading purpose. others ideas appreciated (i totally open other efficient approaches). appreciated if suggest approaches , report timing takes perform operation. process may scaled in future. thank much.

java - XML conversion by using XStream : not able parse date of format 2016-02-04T18:01 -

i converting xml using xstream. my xml looks below. <reportunit> <creationdate>2016-02-04t18:01</creationdate> <description>days late report</description> <label>days late report</label> <permissionmask>2</permissionmask> <updatedate>2014-10-31t19:45</updatedate> </reportunit> my java code converting xml xstream xstream = new xstream(); xstream.alias("reportunit", reportunit.class); xstream.registerconverter( new com.thoughtworks.xstream.converters.basic.dateconverter("yyyy-mm-dd hh:mm", new string[] {"dd/mm/yyyy hh:mm"},new gregoriancalendar().gettimezone()){ public boolean canconvert(class type) { return type.equals(date.class) || type.equals(timestamp.class); } public string tostring(object obj) { return new simpledateformat("yyyy-mm-dd hh:mm").format...

python - Exporting superscript notation in pandas dataframe to csv or excel -

i write foll. csv file: df.loc[0] = ['total (2000)', numpy.nan, numpy.nan, numpy.nan, 2.0, 1.6, '10^6 km^2'] is there way while writing '10^6 km^2' in format such 6 superscript 10 , 2 superscript km. if not possible in csv, can export excel? one possible way change actual contents of dataframe before writing csv (but can automate somewhat). as proof of concept, using '\u2076' unicode representation of superscript 6: in [21]: df out[21]: b c d e f g 0 total (2000) nan nan nan 2 1.6 10^6 km^2 in [30]: df['g'] = (df['g'].str.replace("10\^6", u"10\u2076") ...: .str.replace("km\^2", u"km\u00b2")) in [31]: df out[31]: b c d e f g 0 total (2000) nan nan ...

javascript - Dealing with live js scrolltop values on ios -

i know 1 asked much, i've been struggling 2 days now, , haven't got idea of how achieve goal. i have header, it's absolute , default it's top property equal window height. since have hamburger website, it's header positioned on bottom of landing slide, or @ top of first info slide. when user scrolls first slide, header must stick top. on desktop, did: $(window).on('scroll', function () { if ($(window).scrolltop() >= h && !header.hasclass('sticky')) { header.addclass('sticky'); } else if ($(window).scrolltop() < h) { header.css('top', h); header.removeclass('sticky'); } else { // return false; }; }); and it's working nice. on iphones/ipads header gets it's "sticky" state when scrolling finished. means if user swipes on it's ios device hard, scroll last section , when scroll animation end, user see header. any solution achieve desktop behavior on mobile?...

ms access - VBA add parameters to new query def -

this code works fine: dim db dao.database, rs dao.recordset, qd dao.querydef set db = currentdb set qd = db.querydefs("query1") qd.parameters("[cou]").value = "be" set rs = qd.openrecordset until rs.eof debug.print rs!title, rs!country_fk rs.movenext loop rs.close but when try achieve same result creating querydef instead of using existing one, error on qd.parameters line. set db = currentdb set qd = db.createquerydef qd.sql = "parameters [cou] text ( 255 ); select top 10 title, country_fk dbo_client country_fk=[cou];" qd.parameters("[cou]").value = "be" set rs = qd.openrecordset until rs.eof ... i noticed qd.parameters.count = 0 , qd.parameters.add not allowed. solution ? thx your second example should work if give querydef name. if want temporary querydef , use empty string name ... 'set qd = db.createquerydef set qd = db.createquerydef(vbnullstring)

html - Define height of select box -

Image
i have problem select box height. possible make select list shorter css property or other way? see attached screenshot maybe can try trick: <select onmouseover="this.size=10;" onmouseout="this.size=1;"> see demo : http://jsfiddle.net/h9skm/

pip - Develop an Existing Python Package -

i trying fix bugs of open source package on github. git clone fork local directory. question how can override installed version version developing. note: 1. particular package not support setup.py develop command 2. particular package managed anaconda's conda. have other packages in same situation managed pip when install package resides in <env dir>lib/python3.4/site-packages/<any package> or can place in app , import in code. if have mongoengine code in my_lib directory can import from my_lib import mongoengine

Can I search/get file by using File ID in Dropbox V2 API? -

i'm using dropbox v2 apis (c#) files/folders dropbox account. able fetch particular file/folder using specific path. wanted know whether there way can fetch file/folder using id? this depends on operation(s) you're referring to. example, downloading files , getting metadata files or folders support specifying file ids: https://www.dropbox.com/developers/documentation/http/documentation#files-download https://www.dropbox.com/developers/documentation/http/documentation#files-get_metadata you specify path string "id:a4ayc_80_oeaaaaaaaaaya". searching , listing folders not support though: https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder https://www.dropbox.com/developers/documentation/http/documentation#files-search the same applies corresponding methods in sdks.

url rewriting - .html is not getting appended in the URL in new AEM set-up -

we setting aem first time , facing issue urls fail have .html in it. example if url should be http://dev.alfaromeousa.com/cars/usa/en.html it coming http://dev.alfaromeousa.com/cars/usa/en/ for temporary solution added below rewrite rule rewriteengine on rewritecond %{request_filename} \.(gif|jpe?g|png|js|css|swf|php|ico|txt|pdf|xml)$ rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^ - [l] rewritecond %{request_uri} !^.*.html$ rewriterule ^(.*)$ $1.html [l,r=301]  but fails when url like http://dev.abc.com/cars/usa/ by adding .html. url turns http://dev.abc.com/cars/usa/.html . can please me figuring out if missed out in set-up or did wrong the issue resolved below rewite rule : rewritecond %{request_uri} !^/aemusaerror/(.*) [nc] rewritecond %{request_uri} !^/content/dam(.*) [nc] rewritecond %{request_uri} !^/etc/designs(.*) [nc] rewritecond %{request_uri} !^/vl/(.*)json [nc] rewritecond %{request_uri} !^/timestamp...

c# - Read data from excel including the style applied to it -

Image
i trying write c~ console application read data excel sheet. have seen couple of tutorial tells how can read data excel sheet, 1 thing not find how read style if applied text. . if see excel image word green in green colour , yellow bold. want c# should able pick style can convert html style. i open third party library well you should able use cellformat.font property in order font object can color , style of font in cell. https://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.cellformat.font.aspx

c++ - Qt create a dialog that waits for a network event -

i writing client client/server application. clients supposed login using login window. if login successful, "waiting" window appears (this window contains label). on server side there barrier waits n clients logged in; when happens, message broadcasted, waiting window supposed close , new window appears every client. the networking interface implemented me, using low-level functions, not functionality provided qt. the actual waiting loop this: char buffer[256]; while (strcmp(buffer, "proceed")) read(sockfd, buffer, 256); the problem if start loop in main thread, application blocks, obvious reasons. how can make loop run , not block application, , close dialog when ends? later edit: did attempt use qthreads, but, reasons don't understand yet, application still crashes: class waitloop : public qthread { public: waitloop(networkhandler &network) : network(network) {} private : networkhandler &network; void run() { t...

Jira Greenhopper Rapid Board client-side update event -

i created javascript solution show story points on rapid board. see comment in: https://jira.atlassian.com/browse/ghs-6755 . i want process issues on rapid board when dynamically loaded or updated. possible receive event (javascript) when greenhopper finishes updating rapid board? found it: jquery().ready(function() { ajs.$(gh).bind('workmodeuiready', function() { // code here }); });

html - Printing a username by id via php from MySQL -

i trying print username database via id. want id choosen entering input form, not work. clues why? <div> <p><u>anzeigen eines users mit eingebafeld für die id</u></p> <form method="post1" > <p>zu suchende id:</p> <input type="text" name="id" class="form-control"><br> <input type="submit" name="buttonid" value="suchen" class="btn btn-primary" > </form> </div> <div> <?php /*ini_set('display_errors', 0);*/ $mysqli = new mysqli("localhost", "test", "test", "test"); if ($mysqli->connect_errno) { print "failed connect mysql: " . $mysqli->connect_error; } $id = @$_post1; $res = $mysqli->query("select username user id = $id"); $row = $res->fet...

php - Redirecting to a data-toggle tab using the Zend Framework -

currently have page has projects , families. project index page root of application, if go / have list of projects, data-toggle tab list of families. i using zend framework, when want redirect list of projects, it's simple: return $this->redirect()->toroute('home'); however, seems more complicated redirect families tab. ideas on how this? my homepage setup follows: <div class="container-fluid"> <div class="tabbable"> <ul class="nav nav-pills"> <li class="active"><a href="#projects" data-toggle="tab">projects</a></li> <li><a href="#families" data-toggle="tab">families</a> </li> </div> </div> <div class="tab-content"> <div id="projects" class="tab-pane active" style="margin-bottom: 80px;"> ...

grails - Hibernate operation exception -

i running grails project. maybe question beginner, still important. i have domain object, order. in order class model have declared datecreated datetime type using joda-time. i using:'joda-time:joda-time:2.9.2' however moment when order.save() called following error: exception in thread "main" org.springframework.dao.dataintegrityviolationexception: hibernate operation: not execute statement; sql [n/a]; data truncation: data long column 'date_created' @ row 1; nested exception com.mysql.jdbc.mysqldatatruncation: data truncation: data long column 'date_created' @ row 1 can give me hint going on? check out solution : in domain class: import org.joda.time.* import org.joda.time.contrib.hibernate.* datetime datecreated datetime lastupdated localdate birthday static mapping = { datecreated type: persistentdatetime lastupdated type: persistentdatetime birthday type: persistentlocaldate } in config.groovy: grails.g...

Issues with select date from the datepicker with Appium for Android Driver -

Image
i facing issues selecting date datepicker appium android driver. please check screenshot of calender looking for. i have tried element.clear() followed element.sendkey("text") , it's not working. also tried work scroll followed touchaction , it's working until year selected, after fails select date , month should selected screenshot:

swift - How to call REST API from iOS code using Couchbase Lite -

i have tried call rest api mobile site. using following url http://ip_address:8091/bucket_name/document_name/ the response "not found" i have refer below link: http://developer.couchbase.com/documentation/mobile/1.1.0/develop/references/couchbase-lite/rest-api/document/get---db---doc-/index.html#example my question is, how can json response using rest api? you mixing 2 different things here. 1. couchbase lite - embedded database similar idea sqlite - document - key/value database. 2. couchbase server - fledged enterprise nosql\kv\document database. you have 2 approaches: when using couchbase lite mobile app may need sync gateway in order talk couchbase server. sync gateway deals online updates of data, while couchbase lite acts offline - online repository of data. preferred way - have greatest support app. when using couchbase server - can use sdk create calls - or use rest api available in rest service - such views. http://docs.couchbase.com/admin/ad...

python - saving pyspark rdd to hbase raises attribute error -

i trying write spark rdd using pyspark hbase table. rdd looks following using print rdd.take(rdd.count()) command [decimal('0.39326837'), decimal('0.03643601'), decimal('0.06031798'), decimal('0.08885452')] when try write rdd hbase table using function saverecord def saverecord(tx_fee_rdd): host = 'localhost' #sys.argv[1] table = 'tx_fee_table' #needs created before hand in hbase shell conf = {"hbase.zookeeper.quorum": host, "hbase.mapred.outputtable": table, "mapreduce.outputformat.class": "org.apache.hadoop.hbase.mapreduce.tableoutputformat", "mapreduce.job.output.key.class": "org.apache.hadoop.hbase.io.immutablebyteswritable", "mapreduce.job.output.value.class": "org.apache.hadoop.io.writable"} keyconv = "org.apache.spark.examples.pythonconverters.stringtoimmutablebyteswr...

mysql - Codeception dump not running -

hi try run dump sql. working fine on cli actor: tester paths: tests: tests log: tests/_output data: tests/_data support: tests/_support envs: tests/_envs settings: bootstrap: _bootstrap.php colors: true memory_limit: 1024m extensions: enabled: - codeception\extension\runfailed # - codeception\lib\driver\db modules: enabled: [db] config: db: dsn: 'mysql:host=127.0.0.1;dbname=mydb' user: 'root' password: 'mypass' dump: codeception/_data/dump.sql populate: true cleanup: false how can debug it?

c# - What exactly do socket's Shutdown, Disconnect, Close and Dispose do? -

it's surprisingly hard find simple explanation on these 4 methods actually do, aimed @ network programming newbies. people state believe proper way close socket in particular scenario, not happens in background behind each step. going teach-a-man-to-fish philosophy, can explain shutdown , disconnect , close , dispose methods? an answer on stackoverflow made me think have reached glimpse of understanding. went testing bit , here's summary of newbie's view. please correct me if i'm wrong because based on inference, not expertise. shutdown shutdown disables send and/or receive methods, depending on provided argument. doesn't disable underlying protocol handling , never blocks. if send disabled, queues zero-byte send packet underlying send buffer. when other side receives packet, knows socket no longer send data. if receive disabled, data other side might trying send lost. if receive disabled without disabling send , prevents socket re...

xaml - Binding image to data -

i have list of products, , want them have diferents images, how bind image each of products in list have diferent image? <pivotitem header="lista"> <listview x:name="list1" itemssource="{x:bind produtoviewmodel.produtos}"> <listview.itemtemplate> <datatemplate x:datatype="list:produto"> <listview> <stackpanel> <textblock text="{x:bind nome, mode=oneway}" margin="100,10,10,10"/> <textblock text="{x:bind preco, mode=oneway}" margin="100,10,10,10"/> <textblock text="{x:bind disponivel, mode=oneway}" margin="100,10,10,10"/> <textblock text="{x:bind fornecedor, mode=oneway}" margin="100,10,10,10"/> <textblock ...

jsp - BootStrap/ JQuery Call method on page load or render -

i attempting sort list of programs, "checked" or included programs listed first. however, having hard time bootstrap , getting method call when page loads. .jsp file , utilizing backbone , bootstrap. here existing function works fine, if sort button clicked. onsortcheckedclick : function(e) { e.preventdefault(); var anchor = $(e.currenttarget); var li = anchor.parent("li.sortchecked"); if (li.hasclass("active")) { return; } var sortdirectionorder = anchor.attr("data-direction"); var sortdirectioncolumn = anchor.attr("data-sortbycheck"); var attributesnames = sortdirectioncolumn.split('.'); var sortedprograms = this.programs.sortby(function(program) { var answers = program.tojson(); var unchecked = new array(); var selectanswers, uns...

javascript - Sharing localStorage between web app and extension -

i have "notifications" system which, user permission, pops new notification complete optional sound effect inform users of things happening. however there limitation means notifications won't appear when there no browser tabs open, since there no instances of "check notifications" javascript code running. to remedy this, want make browser extension, first chrome , potentially other browsers. multiple tabs handled using localstorage negotiate mutexes , pass data across tabs. result update simultaneously , 1 of them triggers desktop notification / sound effect. is possible browser extension (again, chrome first, other browsers considered less important this) read same localstorage web app, , thereby join in communications? is possible browser extension (again, chrome first, other browsers considered less important this) read same localstorage web app, , thereby join in communications? yes, while page open. content script share localst...

PHP - Checking for empty element in 2D array -

i have array looks following array:2 [▼ 0 => array:1 [▼ "input1" => "something" ] 1 => array:1 [▼ "input2" => "" ] ] now first element have data. second element interested in. @ moment, trying this if(!empty($clientgroup[0][1]) || !empty($clientgroup[1][1])) var_dump("some data"); } else { var_dump("both empty"); } the else should triggered if both elements empty e.g. array:2 [▼ 0 => array:1 [▼ "input1" => "" ] 1 => array:1 [▼ "input2" => "" ] ] if 1 of them have data, if should triggered (so first array showed, if should triggered). how go doing this, empty not seem work. thanks the 2nd level keys not exist told values empty. change line if(!empty($clientgroup[0][1]) || !empty($clientgroup[1][1])) to, if(!empty($clientgroup[0]['input1']) || !empty($clientgroup[1]['input2'...

c++ - Intel TBB parallel loop thread id -

how determine thread id in tbb parallel loop body? essentially need per-thread copies of object thought i'd have in array indexed thread id. i'm looking portable tbb way of doing this, not os native services. the search term looking "thread-local storage". since using tbb, should use facilities provides: https://www.threadingbuildingblocks.org/docs/help/reference/thread_local_storage.htm

posixct - how do you convert to datetime in R -

i trying convert t field datetime in r. vector: dput(t) "01-dec-15 04.50.14.000000000 pm" i tried this: tt<-as.posixct(t, format="%d-%b-%y %i.%m.%s %p") when print out tt, na. ideas i'm doing wrong? r> strptime("01-dec-15 04.50.14.000000000 pm", + "%d-%b-%y %i.%m.%s.000000000 %p") [1] "2015-12-01 16:50:14 cst" r> you using wrong qualifier year, , not sure am/pm toggle have gotten way.

java - Null pointer exception on list view -

this question has answer here: what nullpointerexception, , how fix it? 12 answers i creating dynamic views. want add views list , remove them onactivityresult. but getting nullpointerexception on list view when adding view list. where should add view in list view? here code : public class mon extends fragment { private framelayout fab; private eventtablehelper mdb; private intent i; private viewgroup dayplanview; private int minutesfrom,minutesto; private list<eventdata> events; private list<view> list; private eventdata e; private layoutinflater inflater; public boolean editmode; private relativelayout container; relativelayout parent; view eventview; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); inflater = (layoutin...

Finding numbers after a certain keyword using Python -

i have form (a string) want process. form can contain occurrences of this, example: >>1244 . i need grab every number after every occurrence of >> , i'm not sure how. i'm thinking regex, i'm terrible @ it. i've read several similar questions, answers wildly different, don't apply (they find next word after keyword) or use contradicting approaches. what's best way this? thanks. you can use findall() positive behind : >>> import re >>> >>> s = ">>1244" >>> re.findall(r"(?<=>>)\d+", s) ['1244'] >>> >>> s = ">>1244 >>500" >>> re.findall(r"(?<=>>)\d+", s) ['1244', '500'] here (?<=>>)\d+ expression match 1 or more digits ( \d+ ) go after >> .

sql - Joining computed column with its uncomputed version to show another column with a name -

i'm not sure how it, let me try simple example. have 3 tables following columns: table1 id_transaction id_product sales_data table2 id_product product_data id_category table3 id_category name_category code_category level categories in table2 have different levels, each level adds 3 digits. level 1 one starts '001', level 2 has 6 '001001' level 3 '001001001' etc. need query give me sales_data, product data , name_category level 2, if product on higher level. product has code_category 002005021, need name_category of 002005, not name_category of full 002005021. know how extract digits: substring(tree.kod_tree,1,6) but how make show name_category connected 6-digit code_category not 9-digit one? the code without like: select table1.sales_data table2.product_data table3.name_category lvl2_name_category /* (here put name_category lower level) */ db.table1 inner join db.table2 on table1.id_product = table2.id_product inner join db.table3 on table...

javascript - Filter an array based on an object property -

this question has answer here: get javascript object array of objects value or property 14 answers i have array of objects, follows: var events = [ { date: "18-02-2016", name: "event a" }, { date: "22-02-2016", name: "event b" }, { date: "19-02-2016", name: "event c" }, { date: "22-02-2016", name: "event d" } ]; and have date, example "22-02-2016". how can array object date same given date? in example events b , d. you use array's filter() function: function filter_dates(event) { return event.date == "22-02-2016"; } var filtered = events.filter(filter_dates); the filter_dates() method can standalone in example reused, or inlined anonymous method - totally choice =] a quick / easy alternative straightforward loop: var filtered = [...

asp.net mvc - choose between asp identity claims and sessions data -

i trying make choice between storing user specific data in mvc application either identity claims or session data reduce number , frequency of database round trips on requests. however, considering performance, security , other best practice considerations, don't know route go. i appreciate suggestions on this. imo (and opinion) based on know claims, cookies , storage rules: performance wise have never seen difference between claims , session storage (unless cookie gets large lot of claims) both seem same performance hit far speed goes (they both have go lookup data someplace (claims = cookie, session = server drive storage) best pratice fall along lines of how data need store. from have seen in experience (correct me if i'm wrong) session data stored on disk on server , has servers hard drive free space size limits etc whereas cookies have hard coded data size limit , more claims store larger cookie gets, if maxing out cookie, client may see performance hit ...

r - Discrete value/continuous scale error in ggplot2 even when I use a numeric -

i'm trying plot cumulative sum line plot in this stack overflow answer . here data: example = structure(list(date = structure(c(16594, 16611, 16612, 16616, 16686, 16702, 16723, 16772, 16825, 16827), class = "date"), endorse = c(13, 1, 1, 3, 2, 1, 2, 5, 1, 1)), .names = c("date", "endorse"), row.names = c(8l, 10l, 12l, 14l, 26l, 34l, 40l, 53l, 68l, 69l), class = "data.frame") and here ggplot2 command trying execute: ggplot(data = example, aes(x = date, y = cumsum(endorse))) + geom_line() + geom_point() + theme(axis.text.x = element_text(angle=90, hjust = 1)) + scale_x_discrete(labels = example$date) + scale_y_continuous(limits=c(0,30)) + xlab("date") i "error: discrete value supplied continuous scale" error. endorse variable (supposed y variable) numeric, i'm not sure what's problem. date discrete. one suggestion use scale_x_date instead of scale_x_discrete . example: ggplot(data =...

How to determine if Javascript array contains an object with an attribute that equals a given value? -

i have array like vendors = [ { name: 'magenic', id: 'abc' }, { name: 'microsoft', id: 'def' } , on... ]; how check array see if magenic exists? don't want loop, unless have to. i'm working potentially couple thousand records. updated since has been popular post, thought i'd share new found. , appears @cafxx has shared this! should read these more often. came across https://benfrain.com/understanding-native-javascript-array-methods/ . vendors.filter(function(vendor){ return vendor.name === "magenic" }); and ecmascript 2015 simpler using new arrow functions: vendors.filter(vendor => (vendor.name === "magenic")); there no "magic" way check in array without loop. if use function, function use loop. can break out of loop find you're looking minimize computational time. var found = false; for(var = 0; < vendors.length; i++) { if (vend...

ember.js - EmberJS 2.3 link-to issues -

i using ember.js 2.3. have {{link-to}} works on parts of app , not other parts. here {{link-to}} {{#link-to 'leads'}}leads{{/link-to}} on parts not work, link still generated. if inspect element, see: <a id="ember397" href="/leads" class="ember-view">leads</a> however, link not clickable browser. connected {{outlet}}? link works modifying {{outlet}} , link isn't working in template generated inside outlet. i new ember , not sure of terminology or if asking correctly. it else going on in code causing page not have links work.

php - Remove Parallax background on brooklyn theme -

i have index.php file need use custom page have use of themes styles , elements navigation, footer, contact form, etc.... default header seems calling body , difficult find parts of header. have been making considerable amount of changes file in drive should kept updated until resolved. currently have page/code working @david , advice given in question: run php application within wordpress (links , files removed privacy, , search engine listings removal) there few files missing cant test template itself. but case of replacing php code calls variable actual output (from view source) create template want. go using default index.php (remove header/footer calls). create new template code below , link (using rewrite code previous q linked above) there quite bit of code in header.php calls variables set db below code remove parallex classes, if not copy header file , call header-custom.php. can replace get_header('custom') call header instead. anywhere see ...

Load the php file Content with in php -

i'm try access php file, when use below code if(is_file('template1.php')){ $return = file_get_contents("template1.php?content=1"); } it'showing error : failed open stream: no such file or directory thank you i suppose want content generated php , if use: $yourdata = file_get_contents('http://example.com/template1.php?content=1'); otherwise if want source code of php file , it's same .txt file: $yourdata = file_get_contents('/template1.php?content=1'); file_get_contents() not work if server has allow_url_fopen turned off. shared web hosts have turned off default due security risks. also, in php6, allow_url_fopen option no longer exist , functions act if permenantly set off. bad method use. your best option use if accessing file through http curl

javascript - PDF.js How do you print a multi-page pdf? -

i'm trying add print functionality multi-page pdf embedded in web page using pdf.js library. it's problematic because have 1 page rendered @ time when user viewing , page rendered image in canvas element. this question not in case because single page pdf printing current contents of canvas acceptable. same this question . want avoid opening pdf in tab/window , telling user print themselves, defeats purpose of embedding page. looking through documentation mozilla, haven't found native functions print pdf, however, start playing around renderingintent seems can set 'print'. edit: redingintent doesn't seem affect , pdf stills renders same way whether set 'display' or 'print'. remember pdf.js web page. atm, @ least not in standard html5 apis, there no way web page push random information directly printers (but can push cloud printing service) -- can print "see". "see" means what's in dom, , css can used ...

gitignore - Why does git not have a 'git ignore' command? -

i understand how setup git use .gitignore file ignore files wondering why has not been command feature makes task less tedious. post question git-scm mailing list later wondering if here might have valid reason lack of ... 'git ignore <pattern>' ... feature. sure there other developers find feature useful. probably because it's quick open .gitignore in text editor or $ echo <pattern> >> .gitignore .

node.js - geoNear() is not working as expected when using mongoose -

i'm using mongodb , mongoose odm app. have document holding location restaurant. model (schema) this: var locationschema = new mongoose.schema({ name: {type:string, required:true}, address: string, coords: {type:[number], index:'2dsphere', required:true}, }); and here sample data: "_id" : objectid("56b39d9673ff055a098dee71"), "name" : "holycow steakhouse", "address" : "somewhere", "coords" : [ 106.7999044, -6.2916982 ] then use mongoose restaurant location somewhere within approximately 2 km restaurant. read mongodb doc have supply maxdistance param in radiance , distancemultiplier earth radius, put following code controller: var point = { type: "point", coordinates: [106.8047355, -6.2875187] // test data, approximately 2 km restaurant } var geooptions = { spherical: true, num: 10, maxd...

Inline script task Powershell/ batch in bamboo deployment project does not fail the deployment project when errored out or during any exceptions -

i using below script connect remote server , shut cluster service , deploy packages. cluster service shut down script. $svcname = '${bamboo.servicename}' $svrnames = '${bamboo.deploy.hostname}' #$svcname = "'" + $svcname + "'" $svrname = $svrnames[0] try { $services = get-wmiobject -computer $svrname -authentication packetprivacy -namespace 'root\mscluster' mscluster_resource | {$_.type -eq "generic service"} | {$_.name -eq $svcname} if (-not $services) { $svcname + " not installed on computer." } else { switch($services.state) { '2' { write-host "cluster service $svcname online" $svcname = "'" + $svcname + "'" $cmd = "cluster res" + ' ' + $svcname + ' ' + "/off" $cmd1 = [scriptblock]::create($cmd) invoke-command -computername $svrname -scriptblock $cmd1 ...

git - Working with multiple repository in BitBucket -

on laptop, have bitbucket key configured. on bitbucket, part of 2 teams. 1 team teama , other 1 teamb . i worked on 1 of project teamx teamx.project1 . did commits, pushed etc. 1 thing note origin configured team. now here steps did teamb create new directory somewhere else in system executed git init created new readme.md file echo "first time" > readme.md added new team repo directory git remote add team2_origin git@bitbucket.org:myusername/team2_project1.git and did git push -u personal_origin --all what expecting have readme.md file in project however, surprise, teamb.prject_1 had history of teama.project1 . also, showed me readme.md (which newly created) has been changed since tracking teama .readme.md previous version. i didn't want that. want keep both teams , project totally isolated. how edit path teama.project1 : /users/myname/documents/dev/repos/project_1 path teamb.project1 : /users/myname/documents/dev/teamb/project_1 ...

javascript - Setting Value for Dynamic ngModel inside ngRepeat -

how set value of dynamically created ng-model inside of ng-repeat? i'm trying set each dynamic ng-model true or false html file <md-list-item ng-repeat="awayteamplayer in ulineup.awayteamplayerslineup "> <md-checkbox ng-model="ulineup.awayteamplayersplayed[awayteamplayer.player]"></md-checkbox> {{awayteamplayer.player}} </md-list-item> controller file (function() { angular .module('app') .controller('updatelineupcontroller', ['$routeparams', '$firebasearray', 'firebase_url', function($routeparams, $firebasearray, firebase_url) { var vm = this; var gameid = $routeparams.gameid; var lineupid = $routeparams.lineupid; var awayteamplayerslineupref = new firebase(firebase_url + 'games/' + gameid + '/lineup/' + lineupid + '/awayteamplayerslineup'); ...

c++ - How does std::cin works? -

i int doing following: int num; cin >> num; i string doing following: string word; cin >> word; my question is: how cin conversion internally? ever output error if enter unexpected? example: "ɔool ʇǝxʇ ƃǝuǝɹɐʇoɹ oulıuǝ". safeguard cin uses? i'm new c++ note >> operator. c++ provides ability define functions give functionality built-in operator. (note, cannot create new operators don't exist in language.) in particular case, >> operator has been overloaded use cin , either int or string . these functions carry out conversion. in case of int version, set error flag in cin if input cannot converted int .

linux - Multiple crontabs needed -

so have looked solution everywhere , never got answer. how make multiple crontabs? running scripts interfere , 110% sure if able run multiple crontabs solve issue. (yeah tried everything). can perhaps make multiple users each have own crontab? , crontabs run @ same time? thanks! there's no exclusivity inherent in multiple crontabs. if 2 separate crontabs each run script every monday @ 4am, cron run both scripts more or less @ same time, on mondays @ 4am. at guess, need locking, 1 or other of interfering scripts runs @ time. flock(1) convenient tool use in shell scripts. #!/bin/bash exec 3> /path/to/lock flock 3 # useful here exit 0 # releases lock the above acquires advisory lock, or waits until lock freed , acquires it. try once without waiting, can following: #!/bin/bash exec 3> /path/to/lock flock -n 3 || exit 1

windows - Adding Entries to HKCU for all users -

i trying run registry file each users when first log in. looking @ different options add hkey_current_user couldn't definitive answer. need direct me right direction. so have following commands reg add "hkey_local_machine\software\microsoft\active setup\installed components\foo.reg" /v "version" /d "1" /t reg_sz /f add hkey_current_user\c:\mykit\foo.reg /v "enablerpcencryption" /d "1" /t reg_dword /f" /f ican execute them , reg_key doesn't run when first login new user. i running windows 2012 server add appropriate registry settings within hku.default using same relative paths. log in new user , check see settings present. you can create group policy object (gpo) runs users , checks see if hkcu registry key present , adds if necesary. if not keen on gpo, can write batch file , place in within startup folder of users start menu.

php - facing error as soon as I load session library in my codeigniter 3.0.4 controller -

i have seen , checked other stackoverflow questions , common answer problem make sure there's no whitespace before <?php tag even after browsing other blogs , articles regarding issue, still facing same error. if remove load of session, works normal. my error: a php error encountered severity: warning message: mkdir() [function.mkdir]: no such file or directory filename: drivers/session_files_driver.php line number: 117 backtrace: file: /home/content/97/8248497/html/dvjtest/application/controllers/home.php line: 9 function: library file: /home/content/97/8248497/html/dvjtest/index.php line: 292 function: require_once php error encountered severity: warning message: cannot modify header information - headers sent (output started @ /home/content/97/8248497/html/dvjtest/system/core/exceptions.php:272) filename: core/common.php line number: 568 backtrace: uncaught exception encountered type: exception message: session: configured save path ''...

ios - Update UICollectionView Width on Device Rotate in Swift -

i have custom keyboard uicollectionview. cells not have defined size. when rotating device portrait landscape keyboard resizes appropriately uicollectionview stays @ original width. what best way tackle updating width expand full available with? how can update constraints available space? the uicollectionview created programmatically , i'm not using storyboard implement autolayout way. override func viewdidappear(animated: bool) { let layout: uicollectionviewflowlayout = uicollectionviewflowlayout() layout.sectioninset = uiedgeinsets(top: 5, left: 5, bottom: 5, right: 5) collectionview = uicollectionview(frame: self.view.frame, collectionviewlayout: layout) collectionview.datasource = self collectionview.delegate = self collectionview.registernib(uinib(nibname: "collectionviewcell", bundle: nil), forcellwithreuseidentifier: kbreuseidentifier) collectionview.backgroundcolor = uicolor.whitecolor() self.collectionview.translatesau...