Posts

Showing posts from February, 2015

Solving Implicit function in MATLAB without for loop -

i experiencing problem , guys might of me. in matlab, trying solve implicit function, see following: cp = cpi / ( sqrt(1 - m^2) + (m^2 / (sqrt(1-m^2))) * cpi/2 ) here, know values of both m , cp , want know value of cpi. also, due computational time considerations, avoid using loops in approach. finally, know not hard solve, example 1 can use ''golden bi-section'' method find answer, not know how code in matlab. know, or has piece of code able solve cpi? thank guys! appreciated help this quite done using fzero . if move cp part on rhs, , try find root using fzero , cpi variable, can solve this: m = 0.4; cp = 3; f = @(cpi) cp - (cpi / ( sqrt(1 - m^2) + (m^2 / (sqrt(1-m^2))) * cpi/2 )); fzero(f,0) ans = 3.7250 of course, don't need assign anonymous function first, in opinion, makes easier read.

javascript - jQuery: Refresh page with fadein and fadeout -

i have snippet make page refresh every minute. however, want page fade out specific color, refresh , fade in again. easy way that? this code use; setinterval("refresh();",60000); function refresh(){ window.location = location.href; } i found code while searching solution, unsure on how can use in interval; $("body").fadeout( function(){ location.reload(true); $( document).ready( function(){$(body).fadein();}); }); demo add css hide body on page load. body{display:none}; then on load, fade body in. after 60 seconds fade out, trigger page reload putting inside callback executes after fadeout finishes. $(function(){ $('body').fadein(1000); settimeout(function(){ $('body').fadeout(1000, function(){ location.reload(true); }); }, 60000); }); no need use setinterval page gets reloaded; settimeout fine.

java - Implementing Endless scrolling in Recycler View -

i have recycler view uses asynctask populate ui. currently retrieves data db , displays in 1 shot, i want retrieve 15 records in 1 go , after scroll ends want load more 15 records , on...can please help. have pasted code below: feedactivity.java package com.bbau.ankit.test_splash; import android.app.activity; import android.graphics.color; import android.os.asynctask; import android.os.bundle; import android.support.v7.widget.linearlayoutmanager; import android.support.v7.widget.recyclerview; import android.util.log; import android.view.window; import com.yqritc.recyclerviewflexibledivider.horizontaldivideritemdecoration; import org.json.jsonarray; import org.json.jsonexception; import org.json.jsonobject; import java.io.bufferedreader; import java.io.inputstream; import java.io.inputstreamreader; import java.net.httpurlconnection;import java.net.url; import java.util.arraylist; import java.util.list; /** * created ankit on 8/14/2015. */ public class feedlistactivit

php - Joomla! Need to make linkable banner images with Camera Slideshow -

need make linkable images camera slideshow. url must received url_a in material. in _item.php <div class="camera-item" data-src="<?php echo htmlspecialchars($images->image_intro); ?>"> i tried do <?php $urls = json_decode($item->urls); ?> <a href="<?php echo $urls->urla;?>"> <div class="camera-item" data-src="<?php echo htmlspecialchars($images->image_intro); ?>"> </div></a> but got error. novice please! , sorry bad english :) 21.08 full code of _item.php changes <?php defined('_jexec') or die; $images = json_decode($item->images); $urls = json_decode($item->urls); $slider_img = htmlspecialchars($images->image_intro); ?> <div class="camera-item" rel="<?php echo $urls->urla;?>" data-src="<? echo $slider_img; ?>"> <?php if ($params->get('show_caption')):

c++ - Static assertion of `is_base_of` in templated class fails with unexpected type in MSVC -

i want make sure 1 of template parameters of class derived of specific (abstract) class. intention wrote this class abstract_record {}; template<typename record, typename container = std::vector> //requires sequencecontainer<container> //see iso/iec prf ts 19217 class mddb_adapter : public wt::wabstracttablemodel { static_assert(std::is_base_of<abstract_record, record>,"record must derived of mddb_service::mddb_web::abstract_record"); ... but compiler error: error c2226: syntax error : unexpected type 'std::is_base_of<abstract_record,record>' is problem of msvc (i'm using visual studio 2013 express) or did got wrong, e.g. how solve this? the result of is_base_of verification accessible via static nested value data member: static_assert(std::is_base_of<abstract_record, record>::value // ~~~~~~^ , "record must derived o

javascript - foreach loop with link to 'this' in CoffeeScript -

there following code: user.prototype.convertfrompermissionstoscopes = -> this.scopes = {} scopesnames = ['create', 'delete', 'update', 'show'] groupname of this.permissions this.scopes[groupname] = {} scopesnames.foreach (scopename) -> this.scopes[groupname][scopename] = this.permissions[groupname].indexof(scopename) isnt -1 i got error 'this.scopes undefined' @ last line. how can fix it? thanks! use fat arrow pass outer this context of foreach : scopesnames.foreach (scopename) => that ensure outer scope passed context of method. just sidenote can use :: prototype , @ this : user::convertfrompermissionstoscopes = -> @scopes = {} scopesnames = ['create', 'delete', 'update', 'show'] groupname of @permissions @scopes[groupname] = {} scopesnames.foreach (scopename) => @scopes[groupname][scopename] = @permissions[groupna

android making layout scrollable when soft keyboard open, but not shifting it upwards -

Image
this screen, 1 button hidden behind keyboard. i want this, scrollable. - whenever, keyboard gets opened, want make same in image. but, instead make scrollable, user can scroll view bottom part of screen (including button), when keyboard open. i tried - android:windowsoftinputmode="adjustresize" but, shifts bottom part upwards, whenever keyboard opened. as in image - i don't want this - (shifting of create account button upwards, when keypad opened) create account button must visible after scrolling. here layout - <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/root_layout" android:fillviewport="true" > <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:or

PHP 5.6.12 - Return of integer incorrect -

previously have been developing app using php 5.6.7 in linux, i've switched windows environment using wamp 64 bit , upgraded php 5.6.12 , been running few issues. 1 issue in backend php have array of integers. when print return front prints return array console different format. is: $permission->fk_org_id = [24053826281537536,24051529749102626,111]; print json_encode($permission->fk_org_id); returns following console: 0:24053826281538000 1:24051529749103000 2:111 why happening? those numbers large fit in (32-bit) integer. interpreted float, see documentation : if php encounters number beyond bounds of integer type, interpreted float instead. also, operation results in number beyond bounds of integer type return float instead. a float has precision of 14 significant digits, that's why see zeroes. unfortunately, php on windows not support 64 bit integers, according this answer : on windows x86_64, php_int_max 2147483647. because in under

c# - vs 2013 update 5 crash after open projects, Microsoft.VisualStudio.Web.Host.exe -

after open project in visual studio 2013, have several errors, regarding microsoft.visualstudio.web.host.exe component. event data event viewer microsoft.visualstudio.web.host.exe 12.0.21005.1 524fa105 ntdll.dll 6.1.7601.18939 55afd843 c0000005 00039dde 2a24 01d0da7d260d9944 c:\program files (x86)\microsoft visual studio 12.0\common7\ide\microsoft.visualstudio.web.host.exe c:\windows\syswow64\ntdll.dll 63da8de8-4670-11e5-8a9c-0019999f62f2 here .mdmp file i found in activitylog.xml 771 2015/08/19 12:46:04.829 error extension manager extension not loaded because extension same id 'microsoft.windows.developmentkit.desktop' loaded @ c:\program files (x86)\common files\microsoft\extensionmanager\extensions\microsoft\windows kits\8.0\desktop sdk... c:\program files (x86)\common files\microsoft\extensionmanager\extensions\microsoft\windows kits\8.1\desktop sdk\ vs version is microsoft visual studio ultimate

postgresql - How to update a table in postgis using ST_Intersects -

i have 1 2 tables in postgis. 1 bank point , indiastate polygon. both of tables having column named state. bank state column empty , indiastate table state column having name of state. want populate state column in bank table using st_intersects. able select bank points falling under particular state select st_intersection("indiastate".geom, tn_bank.geom) inter "bank_name", "lat" "indiastate" inner join tn_bank on st_intersects("indiastate".geom, tn_bank.geom) "indiastate".state='kerala' the above sql returning 66 rows correct. but update command not working properly update tn_bank set "state"='kerala' (select st_intersection("indiastate".geom, tn_bank.geom) inter "bank_name", "lat" "indiastate" inner join tn_bank on st_intersects("indiastate".geom, tn_bank.geom) "indiastate".state='kerala')x it updating of rows in ba

flash - Actionscript ExternalInterface syntax error -

i have created simple container app purpose to: play embedded flv clicking button onscreen activate external interface call (this records fact person has watched video) that's it. i have working partially. have button on scene 1 "click , go next scene" code snippet attached it. click , happily moves on scene 2 flv video plays beautifully. problem happens when try insert code external developer told me use make connection between flash file , it's end work. here recommended code: externalinterface.call("recordscore()”); unfortunately, enter code, there syntax error , movie no longer plays. added code on frame @ end of movie. i no sure syntax developer sent correct, nor know insert code proper place. it looks there closed double quotes (”) in pasted: externalinterface.call("recordscore()”); assure quotation marks, , not need () on javascript function you're calling: externalinterface.call("recordscore"); whe

weblogic - controlling the thread count of a web app -

i'd control how many threads can used web application. far thought can set creating application-scope workmanager (deployments -> [application] -> configuration -> workload) , setting maximum thread constraint. have feeling not true workmanager should referenced code has used explicitly application. i'd need configure on xyz application can use max 5 threads no more. can done on global level want control 1 application. as far know, if define workmanager in app's weblogic.xml or weblogic-application.xml , it's sure work on application level instead of config.xml domain-level config. if create , configurate workmanager's max-threads-constraint , reference in app’s web.xm l file this: <init-param> <param-name>wl-dispatch-policy</param-name> <param-value>your_workmanager_name</param-value> </init-param> i'm pretty sure, constraint apply on app's level. i have feeling not true workmana

sql - Group By with Window Function instead of two Window Functions -

i have table 2 columns: time , id . think of rows sorted first id, time. ╔════════╦══════════╗ ║ time ║ id ║ ╠════════╬══════════╣ ║ 9:10 ║ 1 ║ ║ 9:20 ║ 1 ║ ║ 10:10 ║ 1 ║ ║ 11:30 ║ 1 ║ ║ 11:50 ║ 1 ║ ║ 10:20 ║ 2 ║ ║ 10:30 ║ 2 ║ ║ 11:20 ║ 3 ║ ║ 11:50 ║ 3 ║ ╚════════╩══════════╝ i want select rows id same 'previous' row id , time difference previous row less hour. this can done first creating table there 3rd column of time differences previous row , 4th column of id differences, , selecting rows id_diff 0 , time_diff above 1 hour. but method seems inelegant because want @ each id separately , inside each id @ times , check if consecutive difference above hour. that'll reflect better logic of looking @ each id separately, because different entities. so how can done grouping on id, instead of using window functions twice? i'm aware of group by 's existence. the code wor

c++ - Append multiple hex numbers to QByteArray simultaneously -

i have bunch of hex numbers, don't feel doing qbytearray ba; ba.append(0x01); ba.append(0x02); ba.append(0x7a); ... can in 1 line? maybe qstring manipulation? i'm sending messages via serial communication qextserialport , need store hex commands in qbytearray can use qint64 write(const qbytearray &data) the first point is: there no such thing hex numbers. numbers numbers. we're talking of integers here. whether 16, 0x10, 020, etc., it's same number. 0x10 "hex" in sense write out in hexadecimal notation. doesn't change number itself, doesn't make "hex"! it's still number incrementing 0 sixteen times. the reason hexadecimal device's documentation gives command packets in hexadecimal. it's arbitrary choice. can copy numbers in hexadecimal documentation, or convert them base if makes more sense you. so, hexadecimal representation of course you, don't need explicitly use it. need use c constant arrays i

asp.net mvc 3 - Login Page not showing for unauthenticated user (MVC) -

i'm trying redirect users login page if they're aren't logged in. using areas in mvc, have admin area holds login view. in root web config set authentication mode forms , url point login.cshtml in admin area. browser show default aunthorised page, instead of redirecting login page. root web config <system.web> <authentication mode="forms"> <forms loginurl="~/areas/admin/views/account/login" /> </authentication> </system.web>

java 8 - Instantiate list of objects with CDI -

i refactoring legacy code , came across snippet below. how avoid instantiation of 'companyauditor' class , use cdi hanldle it? return compdao.getall() .stream() .map( companyauditor::new ) .collect( collectors.tolist() ); the way define constructor without arguments companyauditor, create new instances using javax.enterprise.inject.instance.get. , afterwards pass arguments using public methods. therefore constructor argument must separated 1 without arguments , additional public method set argument. also, must write own lambda expression, more complicated companyauditor::new. full example: @inject @new // javax.enterprise.inject.new request new object private instance<companyauditor> auditorinjector; public list returnallwrappedauditors() { return compdao.getall() .stream() .map( ca -> { companyauditor auditor = auditorinjector.get();

javascript - Take height of parent and assign to child with jQuery -

i have css , html structure: .body_wrapper { height: 100%; } .forumcontents { width: calc(100% - 290px) !important; float: left; } .sidebar_container { width: 270px; float: right; height: 100%; } .clearfix { zoom: 1; clear: both; } <div class="body_wrapper clearfix"> <div class="forumcontents"></div> <div class="sidebar_container"></div> </div> unfortunately, need float .sidebar_container, float, div doesn't take 100% of height of .body_wrapper , reasons can't use absolute positioning. i tried display: table-cell .sidebar_container doesn't work, thought solution take .body_wrapper height after page loading ad assign .sidebar_container. how can jquery? here jquery $(function () { $(".sidebar_container").height($(".body_wrapper").height()); }); here fiddle showing in action (i added borders sho

angularjs - What scenarios force me to setup workarounds for ng-model in angular? -

typically in situations, able setup ng-model on element in standard fashion follows. <textarea ng-model="messagetext"></textarea> but ng-model not update within scope. have force work doing this <textarea ng-model="messagetext" ng-change="updatemessagetextscope(messagetext)" ></textarea> $scope.updatemessagetextscope = function (messagetext) { $scope.messagetext = messagetext; } in above setup, if leave out ng-change, ng-model appears buggy. adding {{messagetext}} html seems indicate messagetext updating, when comes time submit data api, messagetext contain different data {{messagetext}} on ui showing me. different data, mean updates ng-model value 1 time... if type new data textarea, ui output indicates updated new value, scope stuck using original value. it's not frequent (1% or less), confused causes in first place.

C - Storing a char array multiple times in a 2d char* array -

the problem here whenever change contents of studname contents inside studarr change too. if input looks (aaa,bbb,ccc) first store aaa inside studname , store studname studarr . i'm trying make: studarr[0][1] = "aaa" studarr[0][2] = "bbb" studarr[0][3] = "ccc but when use code of them equal ccc . there way can fix this? for (j = 0; j < numcourses + 1; j++){ = 0; k = 0; while ((c = fgetc(ifp)) != ')'){ if (c == ','){ studname[3] = '\0'; // ends sting null char studarr[j][k+1] = studname; k++; = 0; } else{ studname[i] = c; i++; } } studname[3] = '\0'; // ends sting null char studarr[j][k+1] = studname; // store studname in studarr } with assignment: studarr[j][k+1] = studname; you store pointer char[] studname. should allocate memory every instance, here: stud

reactjs - React-router "Cannot GET /*" except for root url -

i willing use react-router application, , trying the example given in doc first, copied below. when go localhost:3000/ , see "app" expected, every other page, such localhost:3000/inbox returns "cannot /inbox". missing here ? var = react.createclass({ render: function () { return <h2>about</h2>; }}); var inbox = react.createclass({ render: function () { return <h2>inbox</h2>; }}); var app = react.createclass({ render () { return ( <div><h1>app</h1> <routehandler/> </div> )}}); var routes = ( <route path='/' handler={app}> <route path="about" handler={about}/> <route path="inbox" handler={inbox}/> </route> ); i believe issue making http resource request: get /inbox http/1.1 host: localhost:3000 but using client-side routing. intending on doing server side rendering too? might need change rou

javascript - Accessing the controller associated with a directive instance -

i have associated controller directive so: return function mydirective() { return { scope: {}, restrict: 'e', template: template, controller: 'mycontroller', replace: true, }; }; if want access method on controller template, need add controller property on scope? template: <div> <div> <button ng-click="dosomething()">do something.</button> </div> </div> controller: function mycontroller() {} mycontroller.prototype.dosomething() { window.alert('foo'); } you should avoid scope: {} directive access controller functions because of scope: {} in directive create isolate scope controller. that's why may can not access controller functions directive template. after avoid scope: {} use functions normal controller functions. like: <button data-ng-click="myfunction()">call function</button> you can use s

javascript - Dynamically changing angular-tooltips content on form errors -

i trying integrate angular-tooltips input form. want change tooltip text on registrationform.email.$error object change. html: <input tooltips tooltip-html="{{ emailtooltip }}" tooltip-show-trigger="focus" tooltip-hide-trigger="blur" tooltip-side="right"/> <div>{{emailtooltip}}</div> controller: $scope.emailtooltip = 'initial tooltip'; $scope.$watch('registrationform.email.$error', function (newval) { $scope.emailtooltip = 'updated tooltip'; }}, true); above code changes <div> value doesn't change <input> 's 'tooltip-html' attribute value. missing or bug? i using angular-tooltips library https://github.com/720kb/angular-tooltips you should use tooltip-title="{{ emailtooltip }}" instead of tooltip-html="{{ emailtooltip }}"

JavaScript constructs/patterns to avoid on iOS Safari? -

i have web app contains huge amount of generated javascript. memory consumption differs factor 6 between running web app in chrome on desktop compared running web app in uiwebview on (updated) ipad. what constructs or patterns should avoid memory consumption on ios on par of chrome? characterisation of generated javascript: the code generated haxe . the code "object oriented" in makes heavy use of prototype , in civilized way . the code makes heavy use of named indexes on javascript objects implement hash tables. there lot of strings, hardly string concatenations. there not appear memory leaks; excessive memory consumption on ios shows upon construction of (fixed set of) javascript objects. since code run on desktop underlying quirk in ios. doubt can fix using more object oriented way of programming. sure might reduce memory footprint bit not factor of 6. uiwebview quite notorious creating memory leaks try use newer (ios 8+) wkwebview has much

Python List Comprehension Setting Local Variable -

i having trouble list comprehension in python basically have code looks this output = [] i, num in enumerate(test): loss_ = test_ = else output.append(sum(loss_*test_)/float(sum(loss_))) how can write using list comprehension such as: [sum(loss_*test_)/float(sum(loss_))) i, num in enumerate(test)] however don't know how assign values of loss_ , test_ you can use nested list comprehension define values: output = [sum(loss_*test_)/float(sum(loss_)) loss_, test_ in ((do something, else) i, num in enumerate(test))] of course, whether that's more readable question.

Android file chooser redirects audio files to /external -

i writing app requires user choose files of various types on phone. use code launch file chooser intent: intent intent = new intent(intent.action_get_content); intent.settype("file/*"); startactivityforresult(intent.createchooser(intent, "unhelpful text"), integer_constant); and here relevant part of onactivityresult: if (requestcode == integer_constant && resultcode == result_ok) { uri uri = data.getdata(); path = uri.getpath(); log.i(debug_tag, "path: " + path); } when choose pdf file or video on sd card, path displayed log should be: /storage/emulated/path/to/file . when choose audio file in wav format in same folder document or video (or other folder), path printed log /external/audio/media/217 . why happen, , how can retrieve actual path of file? /** * file path uri. the path storage access * framework documents, _data field mediastore , * other file-based contentproviders. * * @param cont

JAVA - How to change JTable row color after clicking on it? -

i 'm java beginner. create application jtable populated database. in database have 'news'. in jtable display titles of 'news' , when user click on row, display popup right contents of news. want colorize cell 'read' when user clicked on it. i use own tablemodel. i hope i'm clear... if need put code, tell me please... public class jtabletest extends jframe { private jtable table; private int col; private int rowz; /** * create frame. */ public jtabletest() { initcomponents(); } private void initcomponents() { /** other components */ table = new jtable();//create table table.setdefaultrenderer(object.class, new custommodel()); table.addmouselistener(new customlistener()); } public class customlistener extends mouseadapter { @override public void mouseclicked(mouseevent arg0) { super.mouseclicked(arg

javascript - AngularJS: Expression value for REST API call -

i create several dom-elements on website using angularjs ng-repeat, example image objects need loaded dynamically. iterate through json object , each element in json object correct html-output should be: <img src="/myrestimageservice/{{image.name}}"> taking closer @ rest service on server side, turns out every , value of angularjs-expression {{image.name}} not resolve appended cleartext. of course, leads error prone rest-calls like: /myrestimageservice/%7b%7bitem.name%7d%7d what reason , how can fix it? user angular directive ng-src instead of src ,so try <img ng-src="/myrestimageservice/{{image.name}}"> here further documentation ng-src : https://docs.angularjs.org/api/ng/directive/ngsrc

git revert command opens a vi session for entering additional messages I need to capture that and do it through perl -

i performing git revert , redirects vi session in need put in additional information submit. is there way achieve through perl. git respects $editor environment variable when opening editor. set $editor full path perl script, should read name of temporary file first argument. make sure save modified message temporary file , exit 0 status.

c# - How to pass a List of custom objects in a SSIS Script Task? -

i have script task creates list of custom objects , sets them ssis object variable. custom class: public class dog { public string name { get; set; } } code populate list , set ssis object variable "mydogs": public void main() { list<dog> dogs = new list<dog>(); dog dog1 = new dog(); dog1.name = "fido"; dog dog2 = new dog(); dog1.name = "roofus"; dogs.add(dog1); dogs.add(dog2); dts.variables["mydogs"].value = dogs; } in second script task, trying read "mydogs" object variable list: custom class copied on in second script task: public class dog { public string name { get; set; } } main code in second script task: public void main() { var vardogs = dts.variables["mydogs"].value; list<dog> dogs = new list<dog>(); dogs = (list<dog>)vardogs; } my vardogs object correctly loads data ssis object variable "mydogs".

r - change discrete x zoo scale in ggplot2 -

Image
i have data.frame: data<-structure(list(mesanio = structure(c(2008.25, 2008.41666666667, 2008.58333333333, 2008.66666666667, 2008.75, 2008.83333333333, 2008.91666666667, 2009, 2009.08333333333, 2009.16666666667, 2009.25, 2009.33333333333, 2009.41666666667, 2009.5, 2009.58333333333, 2009.66666666667, 2009.75, 2009.83333333333, 2009.91666666667, 2010, 2010.08333333333, 2010.16666666667, 2010.25, 2010.33333333333, 2010.41666666667, 2010.5, 2010.58333333333, 2010.66666666667, 2010.75, 2010.83333333333, 2010.91666666667, 2011, 2011.08333333333, 2011.16666666667, 2011.25, 2011.33333333333, 2011.41666666667, 2011.5, 2011.58333333333, 2011.66666666667, 2011.75, 2011.83333333333, 2011.91666666667, 2012, 2012.08333333333, 2012.16666666667, 2012.25, 2012.33333333333, 2012.41666666667, 2012.5, 2012.58333333333, 2012.66666666667, 2012.75, 2012.83333333333, 2012.91666666667, 2013, 2013.08333333333, 2013.16666666667, 2013.25, 2013.33333333333, 2013.41666666667, 2013.5, 2013.5,

html - Align spans of a list -

i have this: http://jsfiddle.net/lehqyf1t <ul class="myclass"> <li><span style="background-color:#f608ff"></span>text 1</li> <li><span style="background-color:#f608ff"></span>text 2</li> </ul> css: .myclass li span { width: 25px; height: 25px; display: block; float: left; margin-right: 10px; } no matter try cannot both lines aligned properly. how solve it? you can swap out float display:inline-block , don't have worry clearing floats @ all. li { list-style:none; } .myclass li span{ width: 25px; height: 25px; display: inline-block; vertical-align: middle; margin-right: 10px; background-color:#f608ff; } <ul class="myclass"> <li><span></span>text 1</li> <li><span></span>text 2</li> </ul>

java - Reduce verbosity of Tomcat Digester logger in log4j.xml -

from can tell, these obscure log messages associated digester logging component of tomcat. know how reduce verbosity of these logs? the following debug messages repeat seemingly indefinitely 100-10,000 lines in between messages, , has added @ least 20 minutes start-up time application working due repeated context switching (as far know). there no trace of digester messages. does obscure debug message normal anyone? 2015-08-19 10:59:30,607 debug [digester] - < fire end() setnextrule[methodname=addoperation, pa ramtype=org.apache.tomcat.util.modeler.operationinfo]> 2015-08-19 10:59:30,607 debug [digester] - <[setnextrule]{mbeans-descriptors/mbean/operation} call o rg.apache.tomcat.util.modeler.managedbean.addoperation(org.apache.tomcat.util.modeler.operationinfo@ 2f64a8b)> 2015-08-19 10:59:30,632 debug [introspectionutils] - <introspectionutils: callmethod1 org.apache.tom cat.util.modeler.managedbean org.apache.tomcat.util.modeler.operationinfo org.apache.tomcat

asp.net mvc - how to upload file with ng-file-upload in asp.mvc -

how upload file ng-file-upload in asp.mvc ? i'm using code upload file ng-file-upload in asp.mvc : public class homecontroller : controller, ihttphandler { public void processrequest(httpcontext context) { bool result; try { httppostedfile file = context.request.files[0]; if (file.contentlength > 0) { string namefile = guid.newguid().tostring("n") + path.getextension(file.filename); var path = path.combine(server.mappath(url.content("~/temp/")), namefile); file.saveas(path); } result = true; } catch (exception exception) { result = false; } context.response.write(result); } public bool isreusable { { return false;

sql - postgresql offset specific column -

how select after articleid specific offset start e.g start 28 28, 27, 26 offset = 28; limit = 3; var query = 'select * "article" order "publishdate" desc limit $2 offset $1'; articleid | publishdate 25 | "2015-08-19 15:33:37" 26 | "2015-08-19 17:05:42" 27 | "2015-08-19 17:06:05" 28 | "2015-08-19 17:06:22" 29 | "2015-07-19 17:06:46" 30 | "2015-08-19 17:08:11" since value of articleid can in where clause try this select * article articleid >= 28 , articleid <= 28 + 3 or if articleid not consecutive select * article articleid >= 28 order articleid limit 3

r - How to load an image in Shiny -

i display image in shiny app can't find path have give. my app structure following : app> server.r ui.r wwww> images> image.png and have following code : ui <- fluidpage( tags$div(img(src = "www/images/image.png")) ) server <- function(input, output) {} runapp(list(ui = ui, server = server)) it doesn't work. i tried lot of syntax path, options("shiny.port" = 8080) img(src = paste0(" http://127.0.0.1 :", getoption("shiny.port"), "/www/images/image.png")) but i'm realy struggling disply image, in html inspector have "failed load given url". if have ideas... ! nb : i'm able load css same syntax (i.e. tags$style("www/css/style.css")) it should works without "www/" prefix : img(src = "images/image.png")

office365 - Message source of Office 365 Outlook Email -

i need extract message source of email present in office 365 outlook account in javascript app. there method/api so? message source complete headers , body parts. thanks! there isn't way today using office 365 rest apis. if can explain scenario, may able suggest alternate route.

R: Summarize Data by Month and Year (Similar to pivot table) -

i trying summarize data in r month , year. using ddply function summarize data want change , doing normal transpose doesn't give me desired results. loading csv file daily river bypass data. data has following fields: date, year, month, day , bypass. use following code summarize file: summary<- ddply(file,c("year", "month"), summarise, sum = round(sum(bypass*1.9835),0)) summary the output looks like: year month sum 1946 10 1791 1946 11 1575 1946 12 1129 1947 1 823 1947 2 750 1947 3 1023 (and goes on ~61 years of data) so question... there way transform data output in following way: month year 1 2 3 4 5 6 7 8 9 10 11 12 1946 1791 1575 1129 1947 823 750 1023 i copied in sample of data goes through 2007. thanks in advance library(reshape2) dcast(df, iyear ~ month, value.var='sum') o

c++ - Access out of scope variables without passing them? -

is there way access variables outside class? class myclass1 { public: int x; }; class myclass2 { public: int get_x() { //somehow access myclass1's variable x without //passing argument , return it. } } int main() { myclass1 obj1; obj1.x = 5; myclass2 obj2; std::cout << obj2.get_x(); return 0; } one of main things making me reluctant split programs many small organized classes rather few messy huge ones hassle of passing every single variable 1 class might need another. being able access variables without having pass them (and having update both declarations , definitions should change) convenient , let me code more modually. any other solutions issue appreciated, suspect there may dangerous trying access variable way. the way can access x of myclass1 if have instance of class, because x not static . class myclass2 { public: myclass2(myclass1* c1) : myc1(c1) {} int get_x() { retu

swift - How to call an optional protocol method? -

i have class conforms own protocol has optional methods. reference class's object optional. in other words, object may present , may have implemented method in question. how call it? have code this: if let thedelegate = delegate { if let result = thedelegate.delegatemethod() { } } but xcode complains "value of optional type '(()->())?' not unwrapped". wants me change second half of line 2 in example "thedelegate.delegatemethod!()", force unwrapping defeats purpose of trying do. how supposed call method? note method has no parameters or return values. according documentation , optional methods should called this: if let thedelegate = delegate { if let result = thedelegate.delegatemethod?() { }else { // delegatemethod not implemented } } optional property requirements, , optional method requirements return value, return optional value of appropriate type when accessed or called, reflect fact optional

python - Alchemy API raise error 404 -

i'm writing python script run alchemy api. tested script on text docs , works well, problem raised when input url. of time alchemy's algorithm response ok it's response error 404. checked failed urls on alchemy's demo , algorithm works (it means url isn't broken). *i looked in old posts , tried replace in url problematic characters "\n", "\r" "" , none of them worked. do have suggestions cause error? update solved problem, used old api 'category' instead of 'taxonomy'. extract category instead of using: response = alchemy.category('text', input_data) if response['status'] == 'ok': category_name = response["category"] use: response = alchemy.taxonomy('text', input_data) if response['status'] == 'ok': category_name = response['taxonomy'][0]['label']

SAS Streaming output to Excel -

i'm running sas stored process create reports , output in excel, website returns html output instead of excel output. %let rc = %sysfunc(appsrv_header(content-type, application/vnd.ms-excel)); %let _odsdest=tagsets.excelxp; %stpbegin; ods tagsets.excelxp style=printer options(sheet_name='xxxxxxxxxx' ); ods proclabel='xxxxxxxxxxx'; proc report data= xxx --- --- --- run; ods tagsets.excelxp close; %stpend; i tried code sas support , still returns html output. what's wrong code, or sth not work in systems? thanks the function stpsrv_header not appsrv_header

java - Implicit factories in UML sequence diagrams? -

Image
the following sequence diagram models initialisation of ftp server, uses couple of factories ( ftpserverfactory , listenerfactory ) create required objects. unfortunately said interactions increase complexity of diagram without adding useful insight. i have drawn sequence diagram omitting these factories, , in opinion looks more clear. i wonder if it's possible replace <<create>> stereotype (say) <<factory>> stereotype point out objects instantiated factories. also, i'm bit dubious reply messages, if necessary show them or not. thanks you have freedom so. serves communicating thoughts fine. should in such cases add comment (if have no common document/glossary it) place note on diagram explaining use of <<factory>> stereotype.

laravel 5 - Eager loading sum from two pivot tables with Eloquent -

i have part entity has many-to-many relationship order , project . pivot tables contains quantity field might have positive or negative value, , adding sums of both pivot tables, specific part, current stock. i able this, n+1 problem. , having hard time figuring out how can eager loading. i've read post , don't understand how adapt needs. so looking way provide eager loadable stock property on part model, suggestions how can accomplish this? i able figure out of post . did: part model create 2 relationship orderpartscount , projectpartscount , add attribute calculatedstock sum them , provide easy way of retrieving. public function orderpartscount() { $a = $this->orders(); $a1 = $a->selectraw($a->getforeignkey() . ', sum(count) stock') ->where('done', '>', 0) ->groupby($a->getforeignkey() ); return $a1; } public function projectpartscount() { $b = $this->

insert function PHP mySQL -

i have function in php mysql inserts records database. take in array of decoded json data, field name, connection , db name. builds sql statement , inserts records 1 one, or @ least thats think should do. run everything, make connection, database , table when gets function, fails. feel has insert statement not sure how fix it. appreciated. function: function insertrecords($array,$fieldname, $conn, $db_name) { mysqli_select_db($conn, $db_name); $sql_insert = "insert `tbl_articles` (`" . $fieldname . "`) values ('" . $records . "')"; foreach ($array $records) { if(mysqli_query($conn, $sql_insert)) { echo "records inserted."; } else { die('error : ' . mysqli_error($conn) . "<br>"); } } echo $sql_insert . "<br>"; } it looks query string displaced there. try this: function insertrec

Git revert deleted file and preserve file history -

suppose have file a.txt . 1 day, deleted it, committed, , pushed. the next day, wanted revert last commit, bringing a.txt . tried using git revert , when did git blame , lines showing revert commit hash. original blame history lost. can recover file , preserve file history, i.e., if file has not been deleted before? note must not change history commit has been pushed. thanks! you can this! here's how: start new branch commit preceding delete want undo. merge offending change git merge <sha> -s ours . if commit had changes besides deletion want keep: reapply changes working copy git diff <sha>^..<sha> | git apply . discard deletions (many techniques available; git checkout -p may work you). merge branch main branch (e.g. master). this produces history 2 branches; 1 in file deleted, , 1 in it never deleted . result, git able track file history without resorting heroics such -c -c -c . (in fact, -c -c -c , file isn't "restor

android - As3 real-time multiplayer score -

i'm developing game android , ios using as3. problem game 99% completed i'm trying online multiplayer score. for example: player1 - 100 points versus player2 - 500 points. untill here going gratly. i'm saving scores database , loading display. problem because need set data database , load when pvp in last second (1 sec remain) can send data database, sometimes, when load back, errors , no database loaded. is there simple way share , display data without using database in as3. think if don't use database, things gonna faster, don't know how this!

javascript - Trouble getting count of table rows that contain certain text -

i trying output count of table rows contain text label. when step through javascript, count variable contains count, ends value of undefined when stepping next line. var lblpending = document.getelementbyid("lblpending"); var count = $("#match-table tr").filter(function() { return $.text([this]) === 'pending credit'; }).length; if (count > 0) { lblpending.innerhtml = count + " pending"; } else { $("#lblpending").hide(); } is return causing that? something this(using contains ): $(function(){ var myrows = $("#match-table tr:contains('pending credit')"); $("#result").html(myrows.length + " pending"); }); working fiddle: https://jsfiddle.net/robertrozas/rdesdnqm/

How do I dynamically name an element in an object in javascript? -

i creating object in function : createobject(attr) { return { attr: "test" } } i want attr named function parameter . right end object: { attr: "test" } how do this? create new object , use bracket notation set property. function createobject(attr) { var obj = {}; obj[attr] = "test"; return obj; }

git - How to stage deleted files inside a deleted folder -

i'm trying stage individual files delete, git (v1.9.1) refuses stage them because folder used reside has been deleted. i cannot use git add -u because stage all modified , deleted files. if git add -u /path/to/deleted/folder/afile or git rm /path/to/deleted/folder/afile i get: fatal: not switch '/path/to/deleted/folder/': no such file or directory which because /path/to/deleted/folder/ no longer exists. i cannot understand why git needs switch directory when being told stage deleted files , having manually recreate each deleted folder let git know, yes, file gone seems insane. is there way of forcing git stage deleted file without requiring path exist? with credit wolf , romanarmy, upgrading 2.5 allows git rm succeed. just in case else cares, here's how upgraded ubuntu 14.04 default git 2.5: $ sudo add-apt-repository ppa:git-core/ppa $ sudo apt-get update $ sudo apt-get install git $ git --version git version 2.5.0

android - How to add Button action in list view in simple cursor adapter -

i have list view shows names fetching database using simple cursor adapter this- wordsdb ob=new wordsdb(this.getactivity(),"dba",null,1); simplecursoradapter adapter=new simplecursoradapter(this.getactivity(),r.layout.list_row,c,new string[]{ob.val},new int[]{r.id.textview1},0); listview lv=(listview)v.findviewbyid(r.id.list); lv.setadapter(adapter); now, want have buttons edit , delete in front of each contact i.e in each row. added buttons in layout file list_row.xml how add listeners clicks on "edit" , "delete" buttons. tried searching alot not find suitable solution. tried using custom cursor adapter ended confusing should add data list view i.e. should use above code in newview() or bindview() method. this new list_row.xml file buttons. <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="mat