Posts

Showing posts from June, 2015

c# - My WPF ContextMenu is not dismissing when I click elsewhere -

i have wpf contextmenu instance declared in xaml this <window.contextmenu> <contextmenu> <menuitem header="do nothing"/> <separator/> <menuitem header="{x:static p:resources.menuexit}" click="iconmenu_exit"/> </contextmenu> </window.contextmenu> i'm using winforms notifyicon display tray icon this _notifyicon = new system.windows.forms.notifyicon(); _notifyicon.icon = properties.resources.mainicon; _notifyicon.visible = true; _notifyicon.mouseclick += new system.windows.forms.mouseeventhandler(ontrayiconmouseclick); the implementation of mouse click handler this private void ontrayiconmouseclick(object sender, system.windows.forms.mouseeventargs e) { if (e.button == system.windows.forms.mousebuttons.right) { contextmenu.isopen = true; } } this displays context menu , clicking on menu items dismisses it, if click away on window, context menu

php - Laravel executes the POST route upon loading page -

so have form on front page: {{ form::open(array('url' => url::to('', array(), true))) }} <p> {{form::label('author') }} {{form::text('author') }} </p> <p> {{form::label('title') }} {{form::text('title') }} </p> <p> {{form::label('message') }} {{form::text('message') }} </p> <p> {{ form::submit() }} </p> {{ form::close() }} then these routes: route::get('/', function() { /* unrelated stuff here */ }); route::post('/', function() { /* testing */ print_r("done!"); exit; }); so trying test whether form submission works or not. , doesn't. reason post method being executed once load front page instead of when form submitted. why , how can fix this? your form url shou

scala.js - Resolving ScalaJSPlugin from Build.scala and plugins.sbt -

i'm trying make "scalajsplugin" work, resolved in: project/build.scala object buildproject extends build { .. lazy val scalarx = project(id = "scalarx", base = file("scalarx")).enableplugins(scalajsplugin).settings( version := "0.1", scalaversion := "2.11.7", librarydependencies ++= scalarxdependencies ) ... in project/plugins.sbt file, put. addsbtplugin("org.scala-js" % "sbt-scalajs" % "0.6.8") it fails with compilation error in build.scala trying resolve "scalajsplugin" there links repo 1 , 2 for keep changes commented.

html - Using Javascript to subtract two dates given from form entries -

i'm trying use javascript subtract 2 dates. date values come form fields. i'm using formidable pro on wordpress site form. the form 1 allow business pay taxes. taxes due on 20th of each month. business may pay taxes late, @ beginning of form specify month paying taxes for. the first date current date. it's populated form field using formidable short code in format mm/dd/yyyy. the second date calculated from entries year , month. values concatenated "20" form full date value 20th of month paying taxes. if paying taxes on or before 20th, there no penalty. if it's after 20th, there's penalty. want subtract dates , determine whether payment late based on difference being greater zero--and difference value being populated form field. this code i've been using. you'll see commented out 1 method of calculating , returning difference value form. with code below, script returns "nan" error difference field. why? how fix error ,

gluon - Android back button closes app -

i'm showing local html file in webview center node of glisten view . when presss android button, instead of going previous view, app gets closed. when use appbar button switch previous view works fine. tried attach event filter both, webview , scene, doesn't triggered. javafxports version: 8.60.6 update: the issue occures when webview focused. public class importhelppresenter extends basepresenter { @fxml private webview web; @override protected void initialize() { super.initialize(); web.setcontextmenuenabled(false); loadhelppage(); } private void loadhelppage() { string htmlcontent = null; try { htmlcontent = readcontent("importhelp.html"); } catch (ioexception e) { e.printstacktrace(); } web.getengine().loadcontent(htmlcontent); } string readcontent(string filename) throws ioexception { inputstream = getclass().getresour

What can I do if I lose my Chrome extension private key? -

the hard drive stored private key (needed uploading chrome web store) got erased. option delete extension web store , recreate it? tips salvaging have? yes, i'm aware stupid not keep backup of key. the moment when including key has effect first time upload extension chrome web store, determine extension id. after that, don't need private key update extension.

regex - Extracting last-names from a vector of names in R -

i have dataframe contains u.s. senator names , need extract last names can fuzzy match them dataframe has other information senators, (and column contains last names.) the problem names contain middle initial or middle name , have senator's party @ end. how can write gsub command extract senator's last name? apologies, i'm new regex , bad @ it. snippet of data here: names <- c("john kerry (d)", "john h chafee (r)", "chris dodd (d)", "joe lieberman (d)", "frank r lautenberg (d)", "daniel patrick moynihan (d)", "alfonse m d'amato (r)", "arlen specter (r)", "jay rockefeller (d)", "carl levin (d)") you can use strsplit() along lapply() on resulting list: > unlist(lapply(strsplit(names, " "), function(x) { return(x[length(x)-1]) })) [1] "kerry" "chafee" "dodd" "lieberman" "

node.js - How to use mongoose to save multiple documents? -

i have 2 models here user , blog . when user write blog, router invoke them this. promise.all([ node.save(), user.save() ]).then(function (values) { //do }).catch(function (err) { //print error }) as may notice immediately, there's no guarantee save() . either of them fails , no rollback rest. how can make sure both of them saved or rollbacked? people suggest put blogs collection inside users in single document, that's hard blog ranking, isn't it? i'm not sure if it's practice putting things in mongodb. if documents large, cause performance issues(say requests/second)? thanks. you can't use promise.all, you'll have chain promises individually. node.save().then(user.save).then(function(){//do else}); you'll have work little harder entities in array promise.all. need that? have acces

unix - Awk formatting by field separators -

to start prefer not using sed remove last part; reason because file has lot of variables have with. echo $new it display jack: grow far away. loves food hotdogs, hamburgers, , steak. has lot more text. metro filer: so it's 1 lone line of text need break, rid of metro filer: generically possible can use other variables (100+ other variables). also, says it has lot more text means there lot more text there, don't want make massive string. there colon @ beginning , end. what is jack: grow far away. loves food hotdogs, hamburgers, , steak. has lot more text. i tried couple things awk -f ":" , couldn't seem include jack: , great! awk $ echo "$new" | awk '{a=$1;for(i=2;i<nf-1;++i)a=a fs $i;print a}' jack: grow far away. loves food hotdogs, hamburgers, , steak. has lot more text. it assigns first field a , appends space , next field last 2 fields, , prints variable. more readable: { string = $1 (i = 2;

wordpress - How to fix undefined offset error in post-template.php -

i trying small business wordpress site unable figure out why site generating error. here details: the error this: undefined offset: -1 in /home/sojour15/public_html/wp-includes/post-template.php on line 278 and here's code post-template.php - starting line 275 - line 278 "$content = $pages[$page - 1];" if ( $page > count( $pages ) ) // if requested page doesn't exist $page = count( $pages ); // give them highest numbered page exist $content = $pages[$page - 1]; if ( preg_match( '/<!--more(.*?)?-->/', $content, $matches ) ) { $content = explode( $matches[0], $content, 2 ); if ( ! empty( $matches[1] ) && ! empty( $more_link_text ) ) $more_link_text = strip_tags( wp_kses_no_null( trim( $matches[1] ) ) ); $has_teaser = true; } else { $content = array( $content ); } i have read undefined offset errors , understand means code referring in array doesn't exist not php coder - trying small business - , i&

date - why do I keep getting the same answer with this conditional, python pandas -

this might dumb problem i've been stuck on awhile. here's csv date,time,open,high,low,close,volume 02/03/1997,09:30:00,3045.00,3045.00,3045.00,3045.00,28 02/04/1997,09:30:00,3077.00,3078.00,3077.00,3077.50,280 02/05/1997,09:30:00,3094.00,3094.50,3094.00,3094.00,50 02/06/1997,09:30:00,3106.00,3107.50,3106.00,3107.50,53 02/07/1997,09:30:00,3144.00,3144.00,3143.50,3143.50,15 02/06/1997,16:20:00,3126.50,3126.50,3126.00,3126.00,24 02/06/1997,16:21:00,3126.50,3128.00,3126.50,3128.00,169 02/06/1997,16:22:00,3128.00,3128.00,3126.00,3126.00,243 02/06/1997,16:23:00,3125.50,3126.50,3125.50,3125.50,26 this example made original cause original long. moved "09:30:00" top make easier. but here's code. df = pd.read_csv('example.txt', parse_dates = [["date", "time"]], index_col=0) b930 = df.high.at_time("09:30:00") a=0 if 'b930 < 3044.00': = 7 else: = 10 print if

Making an active link in PHP -

i've created blog site php. there's section can make comment. wondering how make url active when post 1 in comment. i've noticed when make comment url in it, link not active or can't hover on it. there code make active? you need convert part of string url link. // regular expression filter $reg_exurl = "/(http|https|ftp|ftps)\:\/\/[a-za-z0-9\-\.]+\.[a-za-z]{2,3}(\/\s*)?/"; // text want filter urls $text = "the text want filter goes here. http://google.com"; // check if there url in text if(preg_match($reg_exurl, $text, $url)) { // make urls hyper links echo preg_replace($reg_exurl, "<a href="{$url[0]}">{$url[0]}</a> ", $text); } else { // if no urls in text return text echo $text; }

javascript - dropdown values hide show -

i have 2 dropdowns, here fiddle, https://jsfiddle.net/oqsf7gjq/1/ <select id="ddloption"> <option value="">- select option -</option> <option value="1">yes</option> <option value="2">no</option> </select> <br/><br/> <select id="ddlcar"> <option value="">- please select name -</option> <option value="1">volvo</option> <option value="2">saab</option> <option value="3">mercedes</option> <option value="4">audi</option> </select> when user selects "yes" "ddloption" dropdown, want show 2 values (saab , audi) dropdown "ddlcar" , when user selects "no", want see values "ddlcar" dropdown. please suggest me possibilities jquery code. thanks! tested in edge, chrome, firefox , internet explorer 11

visual studio 2012 - TFS: Check In throws Error -

Image
i can latest version tfs, cannot check in changes. visual studio 2012 throws below error one or more of pending changes no longer exists or modified. list of pending changes has been refreshed , current. please inspect list of pending changes , try operation again. tried below, back project , undo pending changes, , again merged changes , tried check in, not working. deleted project folder manually , open solution source , again tried check in, not working. till yesterday evening check in worked fine me, today it's not working. but still check in working 1 of colleague. i found 2 projects in workspace not in tfs server. did undo pending changes of 2 projects. check in working fine :)

vector - insert object to set c++ -

i have following fucntion handle points (among set of points) type start_vertex: void handlestartvertex(vertex vi) { cout << "start vertex begins ######################################################################################" << endl; cout << "handling start " << vi << vertextype[vi.type] << endl; halfedge *ei = vi.incidentedge; std :: vector<halfedge > :: iterator it,itprev; cout << "origin of incident edge " << *(ei->origin) << endl; //insert ei in tow , set helper vi ei->sethelper(&vi); tow.push_back(*ei); cout << "content of tow in start_vertex" << endl; for(it = tow.begin();it != tow.end();it++) cout << "origin of edge " << *((*it).origin) << " helper " << *((*it).helper) << endl; cout << "start vertex stops ########################

java - cannot find symbol when I tried build project (maven+lombok) -

i use lombok in spring mvc project. , have problems maven . when tried run clean/install in maven have errors [error] \gitprojects\src\main\java\com\springapp\mvc\successcontroller.java:[62,24] error: cannot find symbol [error] \gitprojects\src\main\java\com\springapp\mvc\successcontroller.java:[63,24] error: cannot find symbol [error] \gitprojects\src\main\java\com\springapp\mvc\successcontroller.java:[64,24] error: cannot find symbol [error] \gitprojects\src\main\java\com\springapp\mvc\successcontroller.java:[65,24] error: cannot find symbol [error] \gitprojects\src\main\java\com\springapp\mvc\successcontroller.java:[66,24] error: cannot find symbol [error] \gitprojects\demirbank\src\main\java\com\springapp\mvc\successcontroller.java:[67,24] error: cannot find symbol [error] \gitprojects\src\main\java\com\springapp\mvc\successcontroller.java:[68,24] error: cannot find symbol [error] \gitprojects\src\main\java\com\springapp\mvc\successcontroller.java:[69,24] error: cannot find

ruby on rails - Capybara warning: ignoring the provided expectation [...] since it is not a string or a proc -

i use rspec , capybar test applicaiton. in 1 of feature spec want assert field has value. when use capybara's find_field strange behavior. (the below code runs capybara-webkit since field value rendered angularjs, if of importance). this code works fine: expect(find('input[name=ordered_quantity]').value).to eq '0' but rather use find_field ..., with: ... method, think bit cleaner find(...).value . following code passes, warning, indicates ignoring with filter: is_expected.to have_field('ordered_quantity'), with: '0' # => warning: ignoring provided expectation message argument ({:with=>"0"}) since not string or proc. the following code ( input[name=ordered_quantity] added) both fails , gives me warning: is_expected.to have_field('input[name=ordered_quantity]'), with: '0' # => warning: ignoring provided exptheectation message argument ({:with=>"0"}) since not string or proc. there 1

.net - ADO.net SqlDataAdapter.Update bulk insert how to detect primary key violations? -

i looking @ problem have older data access code uses sqldataadapter bulk insert operations. destination table has primary key constraint, , need identify rows try insert violate primary key (i.e. detect duplicates) , take action on these rows. most of time, inserts not have duplicates, need handle cases when there is. via experimentation, found doing bulk insert , looking violations faster individually checking each row it's existence before adding. the code follows. foreach (datatable datatable in dataset.tables) { try { list<string> columns = new list<string>(); foreach (datacolumn column in datatable.columns) columns.add(column.columnname); string commandtext = "select " + string.join(",", columns.toarray()) + " " + datatable.tablename; sqlcommand sqlcommand = new sqlcommand(commandtext, conn); sqldataadapter dataadapter = new sqldataadapter(sqlcommand); dataadapter.cont

html - How do I append a string to a selected option in a drop down list without having it shown in the list itself? -

i have drop down list follows: <select id='list'> <option value='1'>1</option> <option value='2'>2</option> <option value='3'>3</option> </select> however, on selection of 1 of these options, need see option selected "option selected / number of options". example, if select 1, need drop down show "1/3" , not "1". essentially, need "/3" part appended option selected. have ideas this? because seem have run out of mine. i think must looking this, can done using simple jquery. html: <select id='list'> <option value='1/3'>1</option> <option value='2/3'>2</option> <option value='3/3'>3</option> </select> <div> </div> jquery: $("select").change(function(){ var str = $("#list").val(); $("div").html(str); }); fiddle: https:/

maven - Add dependency to android library -

base on tutorial http://inthecheesefactory.com/blog/how-to-upload-library-to-jcenter-maven-central-as-dependency/en i'm trying upload android library jcenter/maven colleague can add project following dependencies { compile 'com.mycompany.dev:library-name:1.0.0' } problem is, 1 of library depending on other library such ormlite or glide. when run run ./gradlew install i got error package com.bumptech.glide not exist import com.bumptech.glide.glide; .. package com.j256.ormlite.support not exist import com.j256.ormlite.support.connectionsource; .. 15 errors 100 warnings :core:javadoc failed failure: build failed exception. do have idea how resolve issue? either own dependencies should shipped jar files inside of apk (which might licence infringement), or clients should add additional dependencies in build script.

c - Moving the content of a RingBuffer to a LinearBuffer -

i copy ringbuffer linearbuffer. let's assume ringbuffer dealing of type ringbuff_t buf , : typedef struct { ringbuff_data_t buffer[buffer_size]; /**< internal ring buffer data, referenced buffer pointers. */ ringbuff_data_t* in; /**< current storage location in circular buffer */ ringbuff_data_t* out; /**< current retrieval location in circular buffer */ ringbuff_count_t count; } ringbuff_t; it looks need devide 2 cases : when "in" after "out" pointer or when it's before. i'v wrote code i'm not sure it's quite : memset(linearbuffer,0,linear_buffer_size); ringbuff_data_t* tempin = buf.in; if (buf.out < tempin){ memcpy(linearbuffer,buf.out,tempin-buf.out); } else if (buf.out > tempin){ strcpy(linearbuffer,buf.out); strncpy(linearbuffer+strlen(buf.out),buf.buffer,buf.in-buf.buffer); } your basic idea right, should use memcpy throug

c# - Add connection to a database in visual studio that is already created on another computer -

we group working on project database , on computer have done connection database via ado.net entity data model. issue several people working on same project (via github) unsure on how make connection on other computers. i have shared database flash drive others how connect them database have done. if same ado.net create helper classes again , not want how go that? 1) need restore database sql server. 2) go config file in project root directory might web.config or app.config depending on project type. 3) there connectionstring section created ado .net datamodel. 4) change "username", "password" , "catalog" specified in sql server when restoring db.

javascript - Multipe JQuery Searches in a single page -

i have page have 10 different ul's multiple div's in each li should have each div inside li's searchable. each searchbox should searching it's own ul individually without affecting other ul's in page. solution using replicate search code while incrementing selectors numerically. creates lot of redundancy. how can limit redundancy , have each search still affect it's own ul? the following incremented code (only twice instead of 10 sake of brevity): the html: <h1>search one</h1> <input type="text" id="search1" value="" placeholder="enter search text" /> <div id="results1"> <ul> <li> <div class="listing-three">apple</div>| <div class="listing-three">banana</div>| <div class="listing-three">cherry</div> </li> <li> <div class="listing-three"&

android - setOnScrollListener() of Expandable Listview under scrollview -

i using around 27 expandable listview(that scroll inside scrollview, not 1 has parent, child relation) inside scrollview(one visible @ time, after selecting text). want add load more on this, while user reached last item while scrolling listview. setonscrolllistener() return me last item instantly while loading data instead of scrolling. please suggest way use load more in condition. listviewssearchresults[i].setonscrolllistener(new abslistview.onscrolllistener() { @override public void onscrollstatechanged(abslistview view, int scrollstate) { } @override public void onscroll(abslistview view, int firstvisibleitem, int visibleitemcount, int totalitemcount) { if (firstvisibleitem + visibleitemcount == totalitemcount && totalitemcount != 0) { //call api log.d("listview ", alphabets

Integrate over an integral in R -

i want solve following in r: ∫ 0 h [Ï€( t ) ∫ t h a ( x ) dx ] dt where Ï€(t) prior , a(x) function defined below. prior <- function(t) dbeta(t, 1, 24) <- function(x) dbeta(x, 1, 4) expected_loss <- function(h){ integrand <- function(t) prior(t) * integrate(a, lower = t, upper = h)$value loss <- integrate(integrand, lower = 0, upper = h)$value return(loss) } since Ï€(t), a(x) > 0, expected_loss(.5) should less expected_loss(1). not get: > expected_loss(.5) [1] 0.2380371 > expected_loss(1) [1] 0.0625 i'm not sure i'm doing wrong. in integrand , lower = t not vectorised, call integrate not doing expected*. vectorising on t fixes issue, expected_loss <- function(h){ integrand <- function(t) prior(t) * integrate(a, lower = t, upper = h)$value vint <- vectorize(integrand, "t") loss <- integrate(vint, lower = 0, upper = h)$value return(loss) } expected_loss(.5) # [1] 0.7946429

android - How to alert the users that there is a new Updation available in google play store -

this question has answer here: how notifiy users android app update? 14 answers i have application on play store , first time have updated it. how alert users there new updation available in google play store through app when open it,just notification or alert , redirect linked apk page. startactivity(new intent( intent.action_view, uri.parse(" https://play.google.com/store/apps/details?id=com.novtory.provider ") )); i think above code may link page want know how send notification when there new update available without using third party library.please me out. in first screen or splash screen call web api return latest version code. , compare current app's version code. if not latest show user alert dialog needs update app. , redirect user play store app using intent. note have update latest version code on server every time upload update.

state - How can I know if the client has closed the connection? -

i checked stream3.c example , found when closed page in browser, servlet, i.e. stream3.c , still running 2 rounds terminated. that means, data of last 2 rounds lost. who can explain how confirm connection status before sending data? obviously, gwan knows connection status, otherwise not terminate stream3.c , gwan may not know in real time. if there no way know in real time, important data cannot sent without double checking through way. how confirm connection status before sending data? the reliable way try sending data client socket. if connection has been closed call fail. if socket has been recycled (re-used new connection) session_id (and possily client ip address) different. if connection "cleanly" closed (if client used shutdown() , waited bit before closing) g-wan know status of connection before servlet, otherwise, g-wan know when sending reply (or after read/write timeout). to kind of cases described question, new state called

angularjs - ng-click is not working in partial using ui-router -

i starting angularjs , have routing issue ui-router . have partial displays button sign in. issue clicking on button not call corresponding method in controller. the module definition: var myapp = angular.module('myapp', ['ui.state']); myapp.config(function($stateprovider, $routeprovider) { $stateprovider.state('signin', { url : "/", // root route views : { "signinview" : { templateurl : 'signin.html' } }, controller: function($scope) { $scope.auth = function() { console.log("clicked"); }; } //controller: 'logincontroller' }).state('signedin', { views : { "signinview" : { templateurl : 'partials/signedin.html' } } }); }); the signin.html : <button class="btn" ng-click="auth(

css3 - Fireworks kern value into css -

i have text in fireworks kerned @ "12". not trying translate value css. translate 12%? .12em... how convert it? my colleague found great article: http://justinmarsan.com/css-letter-spacing-in-photoshop-and-browsers/ the calculations in fireworks. fireworks or photoshop em formula: x / 1000 = y where x value of letter-spacing in photoshop , y value in em use in css fireworks or photoshop px formula: x * s / 1000 = p where x equal letter-spacing value in photoshop, s font-size in pixels (which equal value in point provided you’re working in 72dpi) , p resulted value in px use in css

join - SPARK - Joining two data streams - maintenance of cache -

it evident out of box join capability in spark streaming not warrent lot of real life use cases. reason being joins data contained in micro batch rdds. use case join data 2 kafka streams , enrich each object in stream1 it's corresponding object in stream2 in spark , save hbase. implementation maintain dataset in memory objects stream2, adding or replacing objects , when recieved for every element in stream1, access cache find matching object stream2, save hbase if match found or put on kafka stream if not. this question on exploration of spark streaming , it's api find way implement above mentioned. a start mapwithstate . more efficient replacement updatestatebykey . these defined on pairdstreamfunction , assuming objects of type v in stream2 identified key of type k , first point go this: def stream2: dstream[(k, v)] = ??? def maintainstream2objects(key: k, value: option[v], state: state[v]): (k, v) = { value.foreach(state.update(_)) (key, state

ruby - Indent multiline string in ERB -

i have string external library looks this: s = " things.each |thing|\n thing += 5\n thing.save\n end\n\n" this input string isn't going change. need insert file using erb. e.g.: erb = erb.new("<%= s %>") file.write("test.txt", erb.result(instance_eval('binding')) my problem indentation. without making changes string, file written this: things.each |thing| thing += 5 thing.run end note indentation. want do, however, insert text uniformly indented 2 spaces in, so: things.each |thing| thing += 5 thing.run end if this: erb = erb.new(" <%= s %>") then first line indented. things.each |thing| thing += 5 thing.run end i can achieve modifying initial string.. erb = erb.new("<%= s.gsub(/ (\w)/, " \\1") %>") .. feels bit messy. don't want in view. there way indent entire string in erb, or out of luck? think might

fusioncharts - fusion charts x axis values issue -

Image
i rendering chart using fusion charts free: var strxml = "<graph caption='ideation' shownames='1' decimalprecision='0' canvasborderthickness='0' labeldisplay='auto'>"; strxml += "<set name='submitted' value='" + idsub+ "' color='2595ff'/>"; strxml += "<set name='under review' value='" + idundr+ "' color='ffc000'/>"; strxml += "<set name='approved' value='" + idapp+ "' color='00b050'/>"; strxml += "<set name='rejected' value='" + idrej+ "' color='990000'/></graph>"; var chart4 = new fusioncharts("fusionchartsfree/charts/fcf_bar2d.swf", "chartid", "300", "200"); chart4.setdataxml(strxml

javascript - jQuery: how to check if a specific element is already in an array -

this question has answer here: jquery, checking if value exists in array or not [duplicate] 5 answers how can check if var element exists or not in array sites ? var sites = array['test','about','try']; var element = 'other'; you can use indexof() method following. if(sites.indexof(element) > -1) { //exist }

sql - Oracle - single-row subquery returns more than one row , Need to fetch all the rows -

the following query returns "single-row subquery returns more 1 row" select * sampletable status = 'a' , (select substr(some_code_column, 1, 4) sampletable) = 9999 i need fetch rows of table status , rows substr(some_code_column, 1, 4) = 9999 how change query fetches required result? no need sub-select, , conditions: select * sampletable status = 'a' , substr(some_code_column, 1, 4) = 9999

android - Shadow Image distortion for Custom Underline Spinner -

Image
facing problem higher version phones , tabs. foe lower versions spinner correct higher version (lollipop), showing below issues: i have resolved issue statelistanimator lollipop version as android:statelistanimator="@null"

php - Redirect whole website to one url -

i have multiple views in website, code: $this->load->view('templates/header'); $this->load->view('main'); $this->load->view('templates/footer'); i have div in main load view when click on button. js code: $("#side").load("/admin/side/loadnewcontact", function(e) { $("#side").removeclass('hide'); }); a separate function checks if user stil valid , logged in everytime request done. when user not valid system needs go login page. have code it: redirect('/', 'location'); this works. problem. when load page inside main js, , user not valid. system redirects / (the login page). view loaded in side, not want. want whole system redirected login instead of specific view. if understand problem corectly, need if else wraps current jquery code: //pseudo code var valid_user = <?php echo $valid_user;//this should value or false/null?> if (valid_user) {

python - How to find the cumulative sum of numbers in a list? -

time_interval = [4, 6, 12] i want sum numbers [4, 4+6, 4+6+12] in order list t = [4, 10, 22] . i tried following: for in time_interval: t1 = time_interval[0] t2 = time_interval[1] + t1 t3 = time_interval[2] + t2 print(t1, t2, t3) 4 10 22 4 10 22 4 10 22 if you're doing numerical work arrays this, i'd suggest numpy , comes cumulative sum function cumsum : import numpy np = [4,6,12] np.cumsum(a) #array([4, 10, 22]) numpy faster pure python kind of thing, see in comparison @ashwini's accumu : in [136]: timeit list(accumu(range(1000))) 10000 loops, best of 3: 161 per loop in [137]: timeit list(accumu(xrange(1000))) 10000 loops, best of 3: 147 per loop in [138]: timeit np.cumsum(np.arange(1000)) 100000 loops, best of 3: 10.1 per loop but of course if it's place you'll use numpy, might not worth having dependence on it.

visual studio - Create 2 different click once publish from the same project -

Image
i have application running on machine production database,i need quick test against test database, need create second publish start new installation instead of updating production application. i tried changing product name, update product name. there setting available in publish, forces second publish start new installation instead of updating old first one? creating copy of project solve problem, nice create 2 different publish same project. for changing assembly name , product name trick. wonder if possible publish both production , test simultaneously different app , publish settings!!

java - Android: Get Textview value of Spinner on Button click -

i have spinner , populating custom simplecursoradapter . spinner item layout contains 2 textview s, 1 textview item id , not visible other item name. want item id on button click event insert sqlite database. id on setonitemselectedlistener of spinner as companyspinner.setonitemselectedlistener(new adapterview.onitemselectedlistener() { @override public void onitemselected(adapterview<?> parent, view view, int position, long id) { // selected row data show on screen string companyid = ((textview) view.findviewbyid(r.id.spinneritemidtv)).gettext().tostring(); toast.maketext(getactivity(), companyid, toast.length_long).show(); log.w(tag, "companyid:" + companyid); } @override public void onnothingselected(adapterview<?> parent) { } }); and spinner item layout <linearlayout xmlns:android="http://sche

perl - File::Temp pass system command output to temp file -

i'm trying capture output of tail command temp file. here sample of apache access log here have tried far. #!/usr/bin/perl use strict; use warnings; use file::temp (); use file::temp qw/ :seekable /; chomp($tail = `tail access.log`); $tmp = file::temp->new( unlink => 0, suffix => '.dat' ); print $tmp "some data\n"; print "filename $tmp\n"; i'm not sure how can go passing output of $tail temporoy file. thanks i use different approach tailing file. have file::tail , think simplify things.

python - Send data from django views to angularjs controller -

i trying send data django views.py file angularjs controller.js file unable send it. problem unable send data views file controller. , when run code value {%steps%} doesn't change value have assigned in views file. don't want use django rest framework doing this. there other way of achieving this? if yes, please me out. views.py : from django.shortcuts import render django.conf import settings user_data.models import getdata import json def home(req): return render(req, 'index.html') def userdata(req): if req.method == 'get': user_data = getdata().getalldata() context_dict = {'user_data1' : json.dumps(user_data[0]), 'user_data2' : json.dumps(user_data[1]), 'user_steps' : json.dumps(2000)} return render(req, 'index.html', context_dict) controller.js : 'use strict'; metronicapp.controller('dashboardcontroller', function

sql - Find time period in list of status changes (per status) -

i have list of moments specific user on specific workstation: station timestamp tc61879 2016-03-25 09:34:40.000 tc61879 2016-03-25 09:38:36.000 tc61879 2016-03-25 10:01:17.000 tc61879 2016-03-25 10:02:10.000 tc61879 2016-03-25 10:04:01.000 tc61879 2016-03-25 10:04:43.000 tc61879 2016-03-25 10:05:49.000 tc61879 2016-03-25 10:06:00.000 tc61878 2016-03-25 10:08:05.000* tc61879 2016-03-25 10:09:41.000 tc61879 2016-03-25 10:10:40.000 tc61879 2016-03-25 10:35:50.000 tc61879 2016-03-25 10:37:57.000 tc61879 2016-03-25 10:38:21.000 tc61879 2016-03-25 10:39:34.000 tc61879 2016-03-25 10:40:59.000 tc61879 2016-03-25 10:41:20.000 tc61879 2016-03-25 10:42:21.000 tc61879 2016-03-25 10:44:05.000 tc61879 2016-03-25 10:44:17.000 tc61879 2016-03-25 10:46:25.000 tc61879 2016-03-25 10:47:48.000 tc61879 2016-03-25 10:49:03.000 tc61879 2016-03-25 10:51:31.000 tc61879 2016-03-25 10:51:58.000 tc618

php - Check if MySQL Column is empty -

i'm working on page, users post betting picks. in mysql have table bets (id, event, pick, odds, stake, analysis, status, profit). i check if 'status' empty in mysql, if() statement not working. if it's empty, should output bets user. code posted in loop. so wrong if() statement? , there better way this? $result = querymysql("select * bets user='$user'"); $row = mysqli_fetch_array($result); if ('' !== $row['status']) { echo "status: " . $status . "</div>" . "published by: " . $user . "<br>" . "pick: " . $pick . "<br>" . "odds: " . $odds . "<br>" . "stake: " . $stake . "<br>" . nl2br($analysis) ; } if it's empty , should output bets user. code posted in loop. since checking if it's empty, if statement should other way round: if ($row['status

vba - Email body replace * with numbers -

i have email * , ** in body , check boxes in userform. if select check boxes, put in email body : * text1 ** text2 ... * text24 ** text25 when want reply want replace * 1,2,3.... , delete ** . thank you. not quite sure mean 1,2,3 this...? function removestars(strinput string) string dim intcount integer intcount = 1 stop removestars = replace(strinput, chr(42) & chr(42), "") while instr(removestars, chr(42)) <> 0 removestars = replace(removestars, chr(42), intcount, 1, 1) intcount = intcount + 1 loop end function

bash - Print Record Number with a prefix -

i have shell script creates csv output file below (on separate lines) : aaa,111 bbb,222 ccc,999 i want have record number first column in above output such as, dm1,aaa,111 dm2,bbb,222 dm3,ccc,999 how create variable dm within shell script? use awk : awk '{print "dm" nr "," $0}' input.csv >output.csv or ... | awk '{print "dm" nr "," $0}' >output.csv

tsql - SQL Select Columns.. IF NULL then Select other Columns -

i have view this: id| key | product | item | block | source | title | text | type | h1 | h2 | h3 | ------------------------------------------------------------------------------- 1 | 456 | abcd | def | 1 | tp | qwert | yuip | tgr | a1 | a2 | a3 | 2 | 567 | fhrh | klo | 1 | gt | trewq | itgf | trp | a1 | a2 | a3 | 3 | 891 | ufheu | yut | 2 | fr | werty | mnbv | uip |null|null|null| i want export of these columns existing, empty table. want select first 6 columns , select other columns hierarchy going right left. if h1, h2 , h3 not null, should come in output , title, text , type should null (even though contain values). if h1, h2 , h3 null, want thet title, text , type in output. it should this: id| key | product | item | block | source | title | text | type | h1 | h2 | h3 | ------------------------------------------------------------------------------- 1 | 456 | abcd | def | 1 | tp | null | null | null | a1 | a2 | a3 |

asp.net - Keyword not supported: 'server(local); database' -

my web.config is <connectionstrings> <add name="taraznegarconnectionstring" connectionstring="data source=.;initial catalog=taraznegar;integrated security=true" providername="system.data.sqlclient" /> </connectionstrings> and code: namespace taraz { public class dal { string connection = "data source=.;initial catalog=taraznegar;integrated security=true"; sqlconnection con; sqlcommand cmd; sqldataadapter da; datatable dt; public dal() { con = new sqlconnection(); con.connectionstring = connection; cmd = new sqlcommand(); cmd.connection = con; da = new sqldataadapter(); da.selectcommand=cmd; dt = new datatable(); } public datatable executereader(string sql) { connect(); da.selectcommand.connection = con;

java - Failed to execute goal org.apache.maven.plugins:maven -

i getting error on running maven test failed execute goal org.apache.maven.plugins:maven-plugin-plugin:3.2:descriptor (default-descriptor) on project amsframeworok: error extracting plugin descriptor: 'no mojo definitions found plugin: ams5.0:amsframeworok.' -> [help 1] below pom.xml <?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>ams5.0</groupid> <artifactid>amsframeworok</artifactid> <version>1.0-snapshot</version> <packaging>maven-plugin</packaging> <name>amsframeworok</name> <url>http://maven.apache.org</url> <properties> &l