Posts

Showing posts from August, 2012

javascript - Working with a separate js file in asp.net mvc application -

i creating asp.net mvc application. want separate js code razor code in view. i've got file path "~/scripts/searchproductsscript.js" _layout.cshtml: <head> ... <script src="@url.content("/scripts/jquery-1.10.2.min.js")"></script> @if (issectiondefined("javascript")) { @rendersection("javascript", required: false) } ... </head> _someview.cshtml: @section javascript { <script type="text/javascript" src="@url.content("~/scripts/searchproductsscript.js")"></script> } and searchproductsscript.js: var uri; function test() { alert("test"); } $(document).ready(function () { doing here $(':radio').change(function () { doing here }); }); i'm not sure how use separate js file. none of functions working , trying call them _someview.cshtml doesn't work: <script> $(doc

python - Avoid oscillations of the curve fitting -

Image
i have got experimental data (orange points). data not have oscillations nature. curve fitting (polynomial) , obtain green points. may see there oscillations closer beginning of x-axis. i came idea of dividing initial data several parts (based on derivations example) , curve fitting of each part additional conditions on boundaries (equivalent of first , second derivations). before start implement find out if there implementation of similar algorithm? or maybe can advice me method of avoiding oscillations?

javascript - How to display multiple returned values in suggestion in twitter typeahead/bloodhound? -

Image
im trying use bloodhound , typeahead create autocomplete. data being returned correctly displayed in options undefined code is: html: <form class="typeahead" role="search"> <div class="form-group"> <input type="search" name="q" class="form-control search-input" placeholder="search" autocomplete="off"> </div> </form> javascript: var engine = new bloodhound({ remote: { url: '{{ route('search') }}?query=%query', wildcard: '%query' }, datumtokenizer: bloodhound.tokenizers.whitespace('name'), querytokenizer: bloodhound.tokenizers.whitespace }); $(".search-input").typeahead({ hint: true, highlight: true, minlength: 1

r - Assign names to data frame with as.data.frame function -

i trying convert matrix data frame, , assign names in 1 line. as used ?as.data.frame there parameter called col.names doesn't seem work me, doing wrong? as.data.frame(matrix(c(1:4), nrow=2), col.names=c("a","b")) output: v1 v2 1 1 3 2 2 4 expected output: b 1 1 3 2 2 4 i know can assign later `colnames(matrix) = c("a,"b), wondering if possible in 1 line. ( we can use dimnames argument in matrix , return column names such when converting data.frame as.data.frame(matrix(1:4, nrow=2, dimnames = list(null, c("a", "b")))) # b #1 1 3 #2 2 4 while in op's code, matrix output didn't have column names, as.data.frame creates column names 'v1', 'v2' default. col.names argument not as.data.frame class matrix , didn't have effect if quote documentation of ?as.data.frame s3 method class 'matrix' as.data.frame(x, row.names = nu

kendo ui - How to highlight the axis? -

Image
i have many axes in chart. how highlight axis when hovering on line(axis-value)? it necessary highlight axis line(axis-value) belongs (when hovering on line(axis-value)) (highlight = make bold or change color) sorry bad english :) you use serieshover event: serieshover: function(e) { var axis = e.sender.getaxis( e.series.axis); (var i=0; i<e.sender.options.valueaxis.length; i++){ if (i ==axis._axis.axisindex){ e.sender.options.valueaxis[i].line.width = 3; } else { e.sender.options.valueaxis[i].line.width = 1; } } e.sender.refresh(); } from series can theassociated axis, set axis line width , refresh chart. demo

How to access native Android sensor signal processing algorithms? -

i'm looking find native android algorithms' codes used process signals comming sensors. i want know algorithms used in processing sensor signals , how signals of software sensors generated such gravity , linear acceleration. the way google calculates linear acceleration not part of aosp. information proprietary of google , not available

How to use functions/methods in SWITCH CASE statement in Java -

i have 3 types of array: controltype controlname controlvalue when control type "clickbutton", have pass corresponding controlname , controlvalue. code: public class stringswitchdemo extends stringswitchdemohelper { public static int getmonthnumber(string controltype) { int controlvalue = 0; int controlname = 0; if (controltype == null) { return controlvalue; } switch (controltype.tostring()) { case clickbutton: return controltype(controlvalue, controlname); break; } return controlvalue; } private static int controltype(string controlvalue, string controlname) { // todo auto-generated method stub return 0; } } you can use constants (final variables) , literals in switch statements. public static final string my_const = "foo"; public static int getmonthnumber(string controltype) { int control

android - RecyclerView - Horizontal LinearLayoutManager create / bind methods called way too often -

Image
currently i'm @ end of ideas on following issue linearlayoutmanagers , recyclerviews on android: what scenario wanted achieve a horizontal recyclerview on user can swipe fast without limitations on fling. items being fullscreen sized making them big recyclerview itself. when fling has stopped or user stops manually, recycler should scroll 1 item (mimicing viewpager bit) (i'm using support revision 25.1.0) code snippets the pager-class itself public class velocitypager extends recyclerview { private int mcurrentitem = 0; @nonnull private linearlayoutmanager mlayoutmanager; @nullable private onpagechangelistener monpagechangelistener = null; @nonnull private rect mviewrect = new rect(); @nonnull private onscrolllistener monscrolllistener = new onscrolllistener() { private int mlastitem = 0; @override public void onscrolled(recyclerview recyclerview, int dx, int dy) { if (monpagechangelist

html - Switch Column Placement Bootstrap 4 Using CSS -

see sample code: http://www.bootply.com/kp2iv3uj4j simply, want change left right columns using css. there way using css without having change html? for example, if there logo in first column , text in second column, can make them switch places speak using css? thank time! warren give row row-reverse follows: .row { flex-direction:row-reverse; } here example: bootply or if want change html better option: <div class="row flex-row-reverse"> <div class="col-md-6 first"> <img src="http://placehold.it/350x150?text=first"> </div> <div class="col-md-6 second"> <img src="http://placehold.it/350x150?text=second"> </div> </div> here example bootply

javascript - Updating AngularJS from 1.5.0 to 1.5.8 -

i have following bower.json file: { "private": true, "dependencies": { "angular": "~1.5.0", "angular-mocks": "^1.5.7", "bootstrap": "^3.3.6", "bootstrap-rtl": "^3.4.0", "font-awesome": "^4.6.3", "moment": "^2.13.0", "angular-animate": "^1.5.6", "angular-sanitize": "^1.5.6", "angular-ui-router": "~0.2.15", "angular-translate": "^2.11.0", "angular-touch": "^1.5.7", "angular-messages": "^1.5.6", "angular-cookies": "^1.5.8", "angular-ui-grid": "^3.1.1", "angular-ui-sortable": "^0.14.2", "angular-bootstrap-affix": "^0.2.2", "theia-sticky-sidebar": "^1.4.0",

What is the equivalent of db.UnprocessedDocuments in Lotus Notes Formula Language -

i want hold of selected document view. have use formula language. using lotus script can access document(s) e.g, way: set dcselecteddoc = db.unprocesseddocuments and can access individual fields. want same using formula language. tried no luck: @getfield ( "crmpath" ). please help! set agent property "target" = "all selected documents" , can access fields of selected document, @prompt([ok]; "crmpath value"; crmpath)

Multiple inheritance in Java example -

this question has answer here: implementing 2 interfaces in class same method. interface method overridden? 7 answers consider following scenario: have 2 interfaces a , b . both interfaces have member function display() . public interface { public function display() { } } public interface b { public function display() { } } class c implement a, b { public function display{ //definition here } } i want know how many display() functions available in class c ? if there 1 member function, how possible? a brilliant explanation at: implementing 2 interfaces in class same method. interface method overridden? if type implements 2 interfaces, , each interface define method has identical signature, in effect there 1 method, , not distinguishable. if, say, 2 methods have conflicting return types, compilation error. general rul

Redmine: Docker failures -

i want install redmine in docker. followed this tutorial. when tried postresql docker run --name=postgresql-redmine -d \ --env='db_name=redmine_production' \ --env='db_user=redmine' --env='db_pass=password' \ --volume=/srv/docker/redmine/postgresql:/var/lib/postgresql \ sameersbn/postgresql:9.6-2 docker run --name=redmine -d \ --link=postgresql-redmine:postgresql --publish=10083:80 \ --env='redmine_port=10083' \ --volume=/srv/docker/redmine/redmine:/home/redmine/data \ sameersbn/redmine:3.3.2-1 i got following error message: docker: error response daemon: cannot link non running container: /postgresql-redmine /redmine/postgresql-redmine. and when try mysql : docker run --name=mysql-redmine -d \ --volume=/srv/docker/redmine/mysql:/var/lib/mysql \ sameersbn/mysql:latest docker run --name=redmine -it --rm \ --env='db_adapter=mysql2' \ --env='db_host=192.168.1.100' --env='db_name=redmine_prod

Speed up parsing XML documents with DOMDocument class in PHP and with namespaces -

i have 6 xml documents need parse php. every file has 50000 elements therefore need fast parser chose domdocument class. example of xml file is: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <ns2:pinscountrycodeids xmlns:ns2="http://apis-it.hr/umu/2015/types/kp"> <ns2:pincountrycodeid> <ns2:countrycodeid>hr</ns2:countrycodeid> <ns2:pinprimatelja>000000000</ns2:pinprimatelja> </ns2:pincountrycodeid> <ns2:pincountrycodeid> <ns2:countrycodeid>hr</ns2:countrycodeid> <ns2:pinprimatelja>000000001</ns2:pinprimatelja> </ns2:pincountrycodeid> <ns2:pincountrycodeid> <ns2:countrycodeid>hr</ns2:countrycodeid> <ns2:pinprimatelja>000000002</ns2:pinprimatelja> </ns2:pincountrycodeid> </ns2:pinscountrycodeids> the best come code: $input_file=scand

javascript - Wordpress site hacked - phantom url -

my wordpress website hacked recently, i've cleaned backdoor scripts left there there seems kind of phantom url doesn't exist in database @ if type site opens up. for example: mysite.com/needs-more-tuition something of sort when page opens, not 404 page instead see js script being run before html generated in full , page redirects shady online tuition homework site. i've looked high , low , have identified javascript code havent been able find in wordpress site install, nor in theme or plugin files. i'm bit perplexed here , don't know - understanding echoing javascript before opening html tag of page - run before header compiled or so. where should this? need cleaned up. google has penalized website , have coming placeholder there in meanwhile. htaccess here htaccess file: # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filena

r - How to calculate matrix based on two vectors -

i'm sure simple one. have 2 vectors 'd' , 'r'. calculate t=(d+r)/d combinations of d , r. thus, end matrix t calculated each d using each value of r. output should this: https://www.dropbox.com/s/hf74s4jz2qe3st7/table.jpg?dl=0 i've tried for loop , looked @ apply far unsuccessfully. i hope can help. edit: for loop tried: t<-matrix(nrow=length(d), ncol=length(r)) for(i in 1:length(r)){ t[i]=(d+r[i])d } didn't work :( here 3 solutions: d <- 1:5; r <- 11:15 outer(d,r, fun=function(d,r) 1+r/d) 1 + matrix(r, 5, 5, byrow=true)/matrix(d, 5, 5) sapply(r, function(rr) 1 + rr/d) and here result benchmarking (+ additional solutions): library("microbenchmark") d <- 1:5; r <- 11:15 microbenchmark( o= outer(d,r, fun=function(d,r) 1+r/d), o2= outer(d,r, fun=function(d,r) (d+r)/d), m= 1 + matrix(r, 5, 5, byrow=true)/matrix(d, 5, 5), m2= 1 + matrix(r, 5, 5, byrow=true)/d, s= sapply(r, function(rr) 1 + r

drupal 8 and link to file -

i installed drupal 8.2.7, no plugins or themes. have added in "base page" (structure / type) field (file1) upload files. if add new page (drupal / node / add / page) , load file in file1 (test.txt), new page displays me link file. then add new field called file2 entity reference (file type). if add new page (drupal / node / add / page) , put in file2 reference test.txt, see new page, label name of file, not link you can test error on: https://r20kx.ply.st/node/1 https://r20kx.ply.st/node/2 you can edit fields of content type , manage display tab change format settings field file2 url file . check screen: http://prnt.sc/epnh4n

sql - Select data from columns in multiple tables with php and sqlite -

i creating login multiple tables. have checked answers here . but can't seem understand how works? below php select statement select export.uname exportname, export.pword exportpword, import.uname importname, import.pword importpword, lba.uname lbaname, lba.pword lbapword exportname = '$username' , exportpword = '$password', importname = '$username' , importpword = '$password'; but error: warning: sqlite3::query(): unable prepare statement: 17, near ",": syntax error in c:\xampp\htdocs\xport\login.php on line 15 warning: sqlite3::querysingle(): unable prepare statement: 1, ambiguous column name: uname in c:\xampp\htdocs\xport\login.php on line 17 information incorrect i don't know error coming because don't understand how select multiple tables. if 1 table type: select * table uname = '$username' , pword = '$password'; all asking how multiple tables. advance.

android - play m3u8 file from internal storage using NanoHTTTPD -

i have downloaded m3u8 , .ts files in internal directory of app , when try play m3u8 file using nanohttpd shows dialog "can't play video". have added code below. possible play app storage or need store in files in storage can accessed other apps. public class videoplayeractivity extends activity { @bindview(r.id.video_view) videoview videoview; private mediacontroller mediacontroller; string url = ""; server server; @override protected void oncreate(@nullable bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_video_player); butterknife.bind(this); mediacontroller = new mediacontroller(this); videoview.setmediacontroller(mediacontroller); url = getintent().getstringextra("url"); uri uri = uri.parse(url); server = new server(); try { server.start(); } catch (ioexception e) {

javascript - What does $(window).stellar do? -

i have code (it's not written me): $(window).stellar({ horizontalscrolling: false, responsive: true }); now, i'm curious does. did comment didn't see changes, before ruin something, i'd know can decide whether keep in or not. it seems activating plugin: http://markdalgleish.com/projects/stellar.js/ its documentation says options do: configuring offsets stellar.js' powerful feature way aligns elements. all elements return original positioning when offset parent meets edge of screen—plus or minus own optional offset. allows create intricate parallax patterns easily. confused? see how offsets used on stellar.js home page. modify offsets elements @ once, pass in options: $.stellar({ horizontaloffset: 40, verticaloffset: 150 });

shell - How to reference bash variables depending on a value of a second variable (dynamic variable usage)? -

this question has answer here: assigning variable values on fly in bash 1 answer i kind of stuck on one. i have 3 preset variables declared in config file defaults.cfg: android_4.4=android-4.4.4_r1 android_6.0=android-6.0.1_r79 android_7.0=android-7.1.1_r28 each of these variables contains preferred branch-name building specified android version. how access value of depending on value of android_version. example how tried it: #!/bin/bash source defaults.cfg android-version=4.4 `repo init -u https://android.googlesource.com/platform/manifest -b ${android_{$android_version}}` i can not override indirect value because, should work on jenkins, , jenkins gets 4.4, 6.0, 7.0 , on. thanks in advance you can use awk config file value per version: android_version='4.4' awk -f= -v ver="$android_version" '$1=="android_&

protractor - Angular 2 e2e respect test execution order? -

how make angular 2 e2e tests executes in same order declared ? i use angular-cli. when write test cases in order this. test 1 test 3 test 2 test 4 this execute in 1, 3, 2 , 4 in linear fashion. or can fifo. until unless following test case doesn't have dependency on earlier one. eg. test 3 dependent on test 2. so whatever order write execute in order.

javascript - How to disable background div scroll temporary while the front div can still be scrolled? -

Image
i have 2 div, 1 in front , 1 in back. front popup when button pushed. if front div isn't displayed, background div can scrolled. in contrary, if front div displayed, background div scroll disable. front div can still scrolled. i have tried using css applying no-scroll css background div. .no-scroll { position: fixed; overflow: hidden } but every time applied no-scroll class element, bounced top top. i followed this article but disable entire window scroll , font div too. suggestion? i think should wrap both divs in container , toggle class on that. this var btn = document.queryselector('button'), wrapper = document.queryselector('.wrapper'); btn.addeventlistener('click', function(){ wrapper.classlist.toggle('modal-is-visible'); }); html, body { height: 100% } .wrapper { height: 500px; overflow: scroll; border: solid 2px black; padding: 2rem; } .lower_div { background: red;

Laravel Spark Token -

in installations doc, before installing or creating new spark project, there's need register api token. spark register token-value i know purpose of registering token , possible change or update token after installed spark project. it necessary register token again when moving project different machine? thanks!

php - Laravel Form Facade For Select with extra Tag on one option -

i have select option in html form select. <select name="position" id="position" class='position metadata form-control' data-parsley-required data-parsley-required-message="please select 1 position"> <option value="">select position</option> {{ $options = app\metadata::all()->where('category','position') }} @foreach($options $option) <option value="{{$option->item}}">{{$option->item}}</option> @endforeach <option value="1" mytag='position'>define new</option> </select> the form facade work this $options = app\metadata::where('category', 'department')->orderby('item')->pluck('item', 'item'); $options->prepend('define new', '1'); $options->prepend('select department

How to parse Complex JSON data of spreadsheet in android? -

i new android, trying parse google's spreadsheet data , complex me, have fetch $t of gsx$tag , $t of gsx$datetime, this link can json data https://spreadsheets.google.com/feeds/list/1_ar0zx6jv0ni_r1hbulbpeiuuj2mqvblohvvlqowu1i/1/public/values?alt=json data { "version":"1.0", "encoding":"utf-8", "feed":{ "xmlns":"http://www.w3.org/2005/atom", "xmlns$opensearch":"http://a9.com/-/spec/opensearchrss/1.0/", "xmlns$gsx":"http://schemas.google.com/spreadsheets/2006/extended", "id":{ }, "updated":{ }, "category":[ ], "title":{ }, "link":[ ], "author":[ ], "opensearch$totalresults":{ }, "opensearch$startindex":{ }, "entry":[ { "id":{ }, "updated":{ }, "category":[ ],

c++ - Advantages of a bit matrix over a bitmap -

i want create simple representation of environment represents if @ position object or not. i need big matrix filled 1 's , 0 '. important work on matrix, since going have random positioned , set operations on it, iterate on whole matrix. what best solution this? approach create vector of vectors containing bit elements. otherwise, there advantage of using bitmap? note while std::vector<bool> may consume less memory slower std::vector<char> (depending on use case), because of bitwise operations. optimization questions, there 1 answer: try different solutions , profile properly.

android - adding a second youtube video -

how add second video in different webview in same fragment ? i've tried add second video reason both web views played same video , stopped after 2 seconds of playing. public class fragmentvideo extends fragment { private fragmentactivity mycontext; private youtubeplayer yplayer; private static final string youtubedeveloperkey = "developerkey"; private static final int recovery_dialog_request = 1; @override public void onattach(activity activity) { if (activity instanceof fragmentactivity) { mycontext = (fragmentactivity) activity; } super.onattach(activity); } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.fragmentvideo, container, false); youtubeplayersupportfragment youtubeplayerfragment = youtubeplayersupportfragment.newinstance(); fragmenttransaction transaction = getchildfragmentmanager().begintransaction(); trans

javascript - Transfer list item data from one page to another -

Image
i using ionic 2 , trying transfer data 1 page another. more 1 list item on first page(quicksearch) page(quicksearchdetail). have picture below demonstrate this. when click on list should transfer data next page, having issue first list item being transferred irrespective of item click (over writing local storage data). quicksearch template list item <ion-item *ngfor="let item of items" (click)="gotoquicksearchdetail(item._id)"> <p id="clusternameformvalue">{{ item.clustername }}</p> <p id="currentbunameformvalue">{{ item.currentbuname }}</p> <p id="technologyformvalue">{{ item.technology }}</p> <p id="customerformvalue">{{ item.customer }}</p> <p id="clusterheadnumberformvalue">{{ item.clusterheadnumber }}</p> </ion-item> quicksearch.ts gotoquicksearchdetail(){ var clustername: = clustername = document.getelementbyid(

javascript - Fullcalendar js add a filter -

i use fullcalendar.js on project , have : $(document).ready(function () { $('#calendar').fullcalendar({ lang: 'fr', header: { left: 'prev,next today', center: 'title', right: 'today prev,next' }, nextdaythreshold: '10:00:01', events: { url: '{{ 'feed'|url_route }}' }, timeformat: '', eventdrop: function (event, delta, revertfunc) { $.ajax({ type: 'post', url: '{{ 'url_sortable'|url_route({'action': 'move'}) }}', data: { database_id: event.database_id, movement_days: delta.get('days') }, success: function (data, textstatus, jqxhr) {

c# - Handle navigation keys in TextBox inside DataGridView -

we have datagridview data in form. enable quick search added textbox datagridview.controls , highlight cells contain text textbox. however there issue. datagridview "swallow" left arrow, right arrow, home , end (with or without shift ) keys even if cursor in textbox , , user cannot change caret position or select text keyboard. textbox generates previewkeydown event , nothing more happens simplified code: public partial class testform : form { public testform() { initializecomponent(); var txt = new textbox { dock = dockstyle.bottom }; var dgv = new datagridview { dock = dockstyle.fill, columncount = 3, rowcount = 5 }; dgv.controls.add(txt); controls.add(dgv); dgv.previewkeydown += dgvonpreviewkeydown; dgv.keydown += dgvonkeydown; txt.previewkeydown += txtonpreviewkeydown; txt.keydown += txtonkeydown; }

Rubrics using Markdown -

is possible citate book or article using markdown ? for example: wrote [misterknow][1], not possible. [1]: mister know, book of markdown syntax, 2015 this render link in [misterknow][1] , when click on it, move [1]. this not supported standard markdown feature. additionally, not aware of non-standard extensions support such feature. i see 2 ways address this: if markdown implementation using supports footnotes, use footnote. note while footnotes non-standard (they not officially defined in rules), feature has been supported many implementations many years , rather consistent across implementations support it. use example: as wrote *mister know*[^1], not possible. [^1]: *mister know*, book of markdown syntax, 2015 if markdown implementation using supports it, write own extension implements custom feature fits specific needs. without more information, hard whether possible or required accomplish this.

java - Convert HTML to PDF - Instantiated Object not visible -

i'm trying develop converter in java converts html file pdf file , found this site . on bottom of first page , second page there code examples on how realize such program libraries named on page 1 (jtidy, xalan, fop). i created new maven project in spring tool suite , added library dependencies pom.xml. i've copied code parts newly created test program see if works. fine last code part. public static byte[] fo2pdf(document fodocument) { documentinputsource fopinputsource = new documentinputsource( fodocument); try { bytearrayoutputstream out = new bytearrayoutputstream(); logger log = new consolelogger(consolelogger.level_warn); driver driver = new driver(fopinputsource, out); driver.setlogger(log); driver.setrenderer(driver.render_pdf); driver.run(); return out.tobytearray(); } catch (exception ex) { return null; } } at first spring sho

c# - Input field which is not visible to user -

i load asp.net page, receive user input , base on action. problem don't want let user see he/she typing , input should not visible well. want process postback if length of input of length 6. closest can textbox backgroud-color:transparent , no border. autopostback enabled. textbox gets focus, when user presses enter, postback called, text lenght checked , stuff in code behind. unfortunately user can see text he/she types , enter has pressed. any ideas how can achieve this? //for of wonder why want this: page loaded, user sees empty page. she/he put rfid card on rfid reader. reader sends input + enter (should easy setup on reader itself) page. postback appears, length checked, information written on page. not want user see (text textbox especially) before postback. don't have reader , way how hide input need test it. if figure out how postback without sending enter better. in asp.net there 'visible' property, may disable input. maybe give try. yo

c# - Unexpected results with HashSet.Contains and custom IEqualityComparer -

i must have sort of misunderstanding respect using custom comparer hashset . collect lot of different types of data store intermediately json. in order operate on using json.net, jobject , jarray , , jtoken . generally add bit of metadata inline stuff @ collection time, , prefixed "tbp_". need know if particular bit of data, represented jobject , has been collected before (or not). in order have custom iequalitycomparer extends implementation provided json.net. strips out metadata before checking value equality using provided implementation: public class entrycomparer : jtokenequalitycomparer { private static string _excludedprefix = "tbp_"; public jobject cloneforcomparison(jobject obj) { var clone = obj.deepclone() jobject; var propertiestoremove = clone .properties() .where(p => p.name.startswith(_excludedprefix)); foreach (var property in propertiestoremove) { prope

Getting cookie value from cookie string javascript -

i'm trying reload page when cookie (userinfo) value includes pagecount=1. this cookie value userinfo: lastbranchvisitedname=no branch set&mostrecentbranchid=&pagecount=4&lastpageurl=/personal/life-health/over-50s-insurance/&allocatedbranchid=70&allocatedbranchtelephone=01993 894 700&allocatedbranchname=motor direct&locationlatitude=51.8969248&locationlongitude=-2.0758525999999997&lastpagedatetime=28/03/2017 14:37:26 what trying achieve once geolocation allowed, if pagecount=1 reload page once. page reloading regardless of pagecount=. here current javascript: // hide / show notification depending on cookie window.onload = function () { if (setcookievalue("geopopupcompleted") == undefined) { if (navigator.geolocation) { navigator.geolocation.getcurrentposition(setposition); } else { alert("unfortunately we're unable find location"); } } // page count var pagecount = getcookie(&q

python - Remove Multiple Blanks In DataFrame -

how remove multiple spaces between 2 strings in python. e.g:- "bertug 'here multiple blanks' mete" => "bertug mete" to "bertug mete" input read .xls file. have tried using split() doesn't seem work expected. import pandas pd , string , re dataframe = pd.read_excel("c:\\users\\bertug\\desktop\\example.xlsx") #names1 = ''.join(dataframe.name.to_string().split()) print(type(dataframe.name)) #print(dataframe.name.str.split()) let me know i'm doing wrong. i think use replace : df.name = df.name.replace('\s+', ' ', regex=true) sample: df = pd.dataframe({'name':['bertug mete','a','joe black']}) print (df) name 0 bertug mete 1 2 joe black df.name = df.name.replace('\s+', ' ', regex=true) #similar solution #df.name = df.name.str.replace('\s+', ' ') print (

symfony - handlebars template can't fill with data -

Image
i need output data , fill template throught custum function this imports <script src="{{ asset('bundles/.../handlebars/handlebars.js') }}"></script> <script src="{{ asset('bundles/.../handlebars_helpers.js') }}"></script> this template twig page <script id="di_template" type="text/x-handlebars-template"> {% verbatim %} <h1>title </h1> invoice {{ invoice.invoice_number }} {% endverbatim %} </script> this build template function function buildtemplate(){ context = { invoice: { invoice_number: 'val1', invoice_date: 'val2', invoice_due_date: 'val3', invoice_from_company: 'val4' } }; template = $('#di_template').html(); template_compiled = handlebars.compile(template); thecompiledhtml = template_compiled(context); $invoi

javascript - Rendering Limited Number of Object in Mustache.js -

i geting nested json object want render on html page. length , content of object can vary , want show part of it. not know how using mustache.js my object looks this: { "success": [ { "stopid": "123", "stopname": "abc", "lines": [ { "lineref": "3", "destinationid": "987", "destinationname": "def", "arrivals": [ 1490279520000, 1490279460000, 1490280180000 ] } ] }, { "stopid": "331", "stopname": "tvc", "lines": [ { "lineref": "3", "destinationid": "128", "destinationname": "njh", "arrivals": [ 1490279160000, 1490280180000 ] }, { "l