Posts

Showing posts from July, 2011

android - Animating Fragment causes other view to "jump" -

short question: when using animation on fragmenttransactions, how can animate other views animation? long question: hi, i new fragments , on, , trying animate them single activity created following xml file activity: <linearlayout android:id="@+id/run_select_fragment_container" android:layout_width="match_parent" android:layout_height="match_parent" android:keepscreenon="true" android:orientation="vertical"> <framelayout android:id="@+id/activity_run_search_fragmentheaderplaceholder" android:layout_width="match_parent" android:layout_height="wrap_content" /> <framelayout android:id="@+id/activity_run_search_fragmentplaceholder" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"/> </linearlayout> then de

android - Is there any way to differentiate "Normal Purchase" from "Promo code purchase"? -

i have inapp products android app. when inapp product purchased, checking purchase bundle of product id - tells purchase successful. developerpayload validation - tells purchase data recieved valid. so far inapp purchases made in app working since i'm recieving matched purchase bundle matched paylaod. when purchase via promo code, i'm recieving matched purchase bundle inapp product empty developerpayload. since i'm having above 2 checks every inapp prodcut, verification failed @ validating developers payload. after research came know that, when promo code used in-app purchase (the purchases_updated intent) bypass purchase flow app can't supply "developerpayload", used remote verification. https://github.com/googlesamples/android-play-billing/issues/7 if promo code purchase, can't receive "developerpayload"? if ans not question (1), there way differentiate if purchase happend "normal" or "promo code&quo

php - Issue with pathinfo symfony2 -

i follow tips here symfony2 internal route in twig render function helpfull when send on server, request.pathinfo null. have ever had issue ? here codes {% render(controller('projetchmauleonbundle:mauleon:menu', {'request': app.request})) %} my controller public function menuaction($request) { $em=$this->getdoctrine()->getmanager(); $repositoryequipe = $em->getrepository('projetchmauleonbundle:equipe'); $tabequipes = $repositoryequipe->findall(); return $this->render('projetchmauleonbundle:mauleon:menu2.html.twig', array('tabequipes'=>$tabequipes, 'request'=>$request)); } and view : {% if request.pathinfo|slice(1,5) == 'ehpad' or request.pathinfo|slice(1,7) == "equipe" %} <a id="fontdrop" href="{{path('projetch_mauleon_admissionehpad')}}">votre admission</a> {% elseif request.pathinfo|slice(1,3) == 'ssr' %} <

ios - Creating animation for images from small to large when scrolling vertical using Objective c -

for reference please see link given below. want feature ios using objective. creating animation images small large when scrolling vertical thanks in advance

subscribe in Angular 2 -

i want ngoninit function next things: - make http request data using this.structurerequest.sendrequest(),which works fine, , after data have been received start view using this.viewnodes() function. use subscribe , not work, think wrong subscribe function. please help:) homecomponent.ts import {component} '@angular/core'; import {observable} 'rxjs/observable'; import {structurerequestservice} './structurerequestservice'; export class content { ok: boolean; content = []; } @component({ providers: [structurerequestservice], styleurls: ['app/home/home.css'], templateurl:'./app/home/homepagetemplate.html' }) export class homecomponent { contentarray = []; myres: content; showassigned:boolean = false; showsubitems:boolean = false; showusers:boolean = false; constructor(private structurerequest: structurerequestservice) {} ngoninit() { this.structurerequest.sendrequest().subscribe( this.viewnodes()); } viewnodes() { this.myres = th

c++ - Which container should I use for random access, cheap addition and removal (without de/allocation), with a known maximum size? -

i need lighter container must store till 128 unsigned int. must add, edit , remove each element accessing quickly, without allocating new memory every time (i know max 128). such as: add int 40 @ index 4 (1/128 item used) add int 36 @ index 90 (2/128 item used) edit value 42 element @ index 4 add int 36 @ index 54 (3/128 item used) remove element index 90 (2/128 item used) remove element index 4 (1/128 item used) ... , on. every time can iterate trought real number of elements added container, not , check if null or not. during process, said, must not allocating/reallocating new memory, since i'm using app manage "audio" data , means glitch every time touch memory. which container right candidate? sounds "indexes" queue. as understand question, have 2 operations insert/replace element value @ cell index delete element @ cell index and 1 predicate is cell index occupied? this array , bitmap. when insert/replace, stick value in a

mongodb - Create promises from 2D array in node.js -

to import several unrelated csv files mongodb, parse files client side , send "import maps" node. there passed function upsert them mongoose/mongodb. function works , similar following (less promises parts). import.prototype.saveimport = function (importarray) { var writes = []; //promises (var = 0; < importarray.length; i++) { //loop models var model = mongoose.model(importarray[i].model); (var j = 0; j < importarray[i].objects.length; j++) { //loop objects writes.push(function () { return new promise(function (resolve, reject) { var obj = importarray[i].objects[j]; var searchobj = {}; (var k = 0; k < importarray[i].importindex.length; k++) { var index = importarray[i].importindex[k]; searchobj[index] = obj[index]; } model.update(searchobj, {

php - Count specific array values with same part -

i found lot of samples how count positions or occurrences in arrays actualy doesnt solve problem. my array looks like: $foo = array( "foo"=>"bar", "bar"=>"foo", "hello"=>"world", "world"=>"hello", "grt1"=>"a", "grt2"=>"b", "grt3"=>"c", "grt4"=>"d", "grt5"=>"e", "gr1"=>2, "gr2"=>0, "gr3"=>, "gr4"=>5, "gr5"=> ) what want achive count how many gr{i} in array. the thing is, dont want count grt{i} . result sample should 5 . array_count_values not me in case. my try atm is: $count = 0; for($i=0;$i<count($foo);$i++){ if(array_key_exists("gr".$i, $foo))

bash - Change spaces with underscore in filename -

i have multiples files space, , want replace underscore command line (mac) xxx xxx.jpg -> xxx_xxx.jpg it's possible line command? for files in current directory for in *;do mv "$i" "${i// /_}";done if want match files spaces (to prevent tons of error messages when tries move files themselves) though use extended glob shopt -s extglob in +(* *);do mv "$i" "${i// /_}";done

How to chunk updates to SQL Server? -

i want update table in sql server setting flag column 1 values since beginning of year: table date id flag (more columns...) 2016/01/01 1 0 ... 2016/01/01 2 0 ... 2016/01/02 3 0 ... 2016/01/02 4 0 ... (etc) problem table contains hundreds of millions of records , i've been advised chunk updates 100,000 rows @ time avoid blocking other processes. i need remember rows update because there background processes flip flag 0 once they're done processing it. does have suggestions on how can this? each day's worth of data has on million records, can't loop using date counter. thinking of using id assuming date column , id column sequential simple loop. mean if there record id=1 , date=2016-1-1 record id=2 date=2015-12-31 not exist. if worried locks/exceptions should add transaction in while block , commit or rollback on failure. change @batchsize whatever feel right after experimentation. decl

javascript - Getting user location with form submit -

hello im using html5 geolocation , after user submits form want store longtitude , latitude problem has appeared i made onclick="" event on submit button , when button pressed js coordinations , put them hidden fields in form , form sent php , whenever submit form , small popup come out , asks permission location , imediately dissapears thats because of php refreshed page , should ? said when click submit form button js triggered , ask permission after permission accepted hidden fields filled coordination data , form sent server , after press button popup allowing location go out 1 second , imediately dissapear , page refresh no result , how can fix ? one simple way solve run js code detects location , asks permission when form first loads in page, not when it's submitted . your issue you're trying execute javascript simultaneously form submits. unless override default behaviour, form submit anyway regardless of scripts run in onclick event, , not wa

reactjs - React.js How can have an onClick function apply to all component divs -

i have handleclick function console.logs initindex state. want work on secondcomponent div too. @ moment, though have handleclick function in secondcomponent not fire event. ideally don't want repeat handleclick function again in secondcomponent . missing? i still quite new react , it's baffling me. var playappcomponent = react.createclass({ getinitialstate : function(){ return { initindex : true }; }, handleclick: function() { console.log("is "+ this.state.initindex) }, render: function(){ return ( <div> <h2 classname="visible" onclick={this.handleclick}>true</h2> <secondcomponent /> </div> ); } }); var secondcomponent = react.createclass({ getinitialstate : function(){ return { initindex : true }; }, render: function(){ return ( <div> <

html - Checkbox and Radio buttons behaviour -

this question has answer here: how uncheck checked radio button [duplicate] 5 answers i using set of checkboxes have drop-down menus switching display:none; display:block when box or radio checked. this checkbox version : https://jsfiddle.net/hw207q2l/ and radio version : https://jsfiddle.net/3xzuw47x/ i'd combine both when opening new part closes other ones (radio behaviour) ; while @ same time being able close part opened clicking again (checkbox behaviour). any ideas wouldn't involve javascript ? i'd restrain using js, if it's not possible tell me. it requires functionality prevents default behavior, it's unlikely make happen without using of additional framework or javascript. this not duplicate, please check how uncheck checked radio button [duplicate] . just use javascript in second version of code: var allradios = d

javascript - Redux - Why normalize? -

i have been trying learn how better structure redux stores , stumbled upon lesson dan. https://egghead.io/lessons/javascript-redux-normalizing-the-state-shape#/guidelinesmodal although understand how go normalizing data in way, not understand motivation behind it. particularly, have 2 questions. why wont simple arrays sufficient? dan mentions - "in complex apps, might have more single array , todos same ids in different arrays might out of sync". did not understand this, may have example? benefit see using object improved efficiency not need map on entire array, in case want delegate todo reducer. why need maintain list of allids? why maintain additional state, when can map on list of todos , obtain it? i know normalizr us, why should normalize in first place? make sense normalize if responses not nested? edit 1: thanks answer, christopher. let assume state tree looks this { user: { byid: { 1: { id: 1,

git - temporary commit on complex merge -

i have 2 branches master main branch , feature_branch_1 old , many commits behind master. need merge feature_branch_1 master, did: git pull --rebase origin master as expected there tons of conflicts, after there need develop feature on new feature_branch_2 , against head of master , needs worked on before feature_branch_1 . being more or less in middle of complex merge, how do temporary commit on feature_branch_1 can come later. know can a: git add <things-that-are-done> git commit -m 'intermediary commit between merges' ... come later git checkout 'that-temp-commit-hash' ... after finishing git add . git commit -m 'done feature_branch_1' git rebase --interactive head~1 making temporary commit rebasing squash afterward. is best way handle this? git not let make commit index contains unmerged entries. using git add resolve away unmerged entries, can commit, approach may unsatisfactory several reasons. without going detail

api - c# Webrequest Webresponse getting 403: forbidden -

i'm trying more experience c# want make small app using windows forms in visual studio. app should rocket launch times https://launchlibrary.net , use them in countdown. have no experience in getting data internet using c#, have no idea if i'm doing right. code came after research. the problem @ line: webresponse response = request.getresponse(); i'm getting below error- "the remote server returned error (403) forbidden" if me or point me in right direction happy. thank you // create request url. webrequest request = webrequest.create("https://launchlibrary.net/1.2/agency/5"); request.method = "get"; // response. webresponse response = request.getresponse(); // display status. messagebox.show(((httpwebresponse)response).statusdescription); // stream containing content returned server. stream datastream = response.get

html - Keep elements in place when resizing browser or changed resolution -

Image
there seems problem when resize browser window or use computer different screen resolution. e.g browser in full window , default resolution browser either resized or in different screen resolution how can prevent happening?

javascript - How to color point in HighCharts -

hey know if want color specific point, can using fillcolor attribute of current marker. but when hover point, color return default color of graph,how can prevent such effect? i want point red in both situation(onhover event , not onhover event), what attribute per point need change effect happen? i have added demo below, demo act this: when click canvas of graph,a new graph being generated , first point red when hover , return default color. $(function () { $('#container').highcharts({ chart: { type: 'spline', margin: [70, 50, 60, 80], events: { click: function (e) { // find clicked values , series var x = e.xaxis[0].value, y = e.yaxis[0].value, series = this.series[0]; var chart = this; this.addseries({ data: [{ x:x, y:y, marker:{radius: 5

multithreading - Using timer object in python to call a function after certain invertal -

i have used following technique call function after interval. problem is being called twice @ interval of 5 seconds. after every 5 seconds function being called twice. how resolve this? code part of class. self.t=timer(5,self.checktimeout) self.t.start() def checktimeout(self): print("game over") timer(5,self.checktimeout).start() this timer wrote while ago. try out this. me works perfectly! def countdown(t): while t: mins, secs = divmod(t, 60) #print timeformat #timeformat = '\r{:02d}:{:02d}'.format(mins, secs) #sys.stdout.write(timeformat) #sys.stdout.flush() time.sleep(1) t -= 1 call this: def main(): minutes = 1 cnttime = minutes * 60 while(true): countdown(cnttime) yourfunction()

javascript - How to access Angular 2 object's attribute -

export class dashboard { checked: object = {users: false, device: false} boxclicked(){ if(checked.users){ console.log("clicked users"); } } } property 'users' not exist on type 'object'. why? you saying checked: object = {users: false, device: false} means members defined 'object' (the interface) visible. can not access 'users'. you should checked: = {users: false, device: false}

java - Gson custom deserialization but only one field -

this question has answer here: how decode json unknown field using gson? 1 answer i'm receiving api long json, e.g.: { "field1": "val1", "field2": "val2", ... "some_field": " abc ", ... "fieldx": "valx" } i deserialize gson. works fine field's "some_field" value annoying spaces. trim() field value (api can't changed). know can use jsondeserializer have manually read fields. possible edit 1 interesing field while deserializing use auto deserialization rest of them? here writing demo class convert json class ignoring of non-used property embedded in json . here have used objectmapper class deserialize jsonobject object . //configuration enables ignore non-used unknow properties. mapper.configure(deserializationfeature.fail_on_unknown

xml - XSL Add year to current date -

i want add year current date in xsl 2.0 know how current date: <applin_dt><xsl:value-fof select="format-date(current-date(), '[y0001]-[m01]-[d01]')"/></applin_dt> the current date must formatted 'yyyy-mm-dd' in other element need currentdate + 1 year. best solution this? thanks! robert as using xslt 2.0, try this... <applin_dt> <xsl:value-of select="format-date(current-date() + xs:yearmonthduration('p1y'), '[y0001]-[m01]-[d01]')"/> </applin_dt> where namespace xs prefix http://www.w3.org/2001/xmlschema

java - Traversing a sibling node in JSOUP based on a search text -

consider below html url. need first perform search on text "student 1" , pick corresponding school in case 'mit school'. how do in jsoup ? <table> <tbody> <tr> <td valign="top"> <div style="border-width:1px;border-color:#cccccc;border-style:solid;"> <table bordercolor="#483d8b"> <tbody> <tr> <th colspan="2" bgcolor="#483d8b" height="25"><font face="verdana" size="2" color="white">mit school</font></th> </tr> <tr> <td width="120" height="15"><font face="arial" size="2" color="black"> <b>student 1</b> </font></td> </tr> </tbody> </table> so far have been able perform successful search text. system.out.println("this :"+

sql server - Strange things SSIS does on the data journey -

in execute sql task. have column called lasteditedby varchar in source system 1. in execute sql task, is: select cast ( lasteditedby int) table1 all values null @ moment. store in variable of type int called lasteditedby. i run stored procedure in second execute sql task insert source system 2, requires input of data type int. watching in ssis via watch window, takes null , sets variable 0 instead of '', empty string. is defect? how can ensure instead of getting 0 nulls, ''? int variables in ssis convert nulls zeros, can recommend in case declare variable string , conversion int in later stage, in sp.

java - Sorting cusom type in Set (Set<MyType>) -

this question has answer here: is collections.sort method used list type of collections? 7 answers why can't collections.sort set<mytype> ? code below. when use arraylist this code works perfectly, when use kind of set , error. set<auto> set = new hashset<auto>(); set.add(auto1); set.add(auto2); set.add(auto3); set.add(auto4); set.add(auto5); collections.sort(set, new comparator<auto>() { @override public int compare(auto o1, auto o2) { return o1.getmarka().compareto(o2.getmarka()); } }); hashset not ordered collection; in other words, not contain elements in order. you can see hashset bag contains objects. when stick hand in , pull out objects 1 one, don't know in order elements out. can't sort elements in bag - because bag doesn't keep them in order sorted them in. the order of elements

java - Unable to run the Regression group in testng.xml file for different browsers -

i have configured testng.xml file run regression group in different browsers.below testng.xml code same. <?xml version="1.0" encoding="utf-8"?> <!doctype suite system "http://testng.org/testng-1.0.dtd"> <suite name="seleniumsuite" verbose ="1" thread-count = "1" parallel="false"> <**test** name="firefoxtest"> <groups> <run> <include name="regression"></include> </run> </groups> <parameter name="browser" value="firefox" /> <classes> <class name="testscript.program111_redifflogin" /> </classes> </test> <test name="ietest"> <groups> <run> <include name="regression"></include> </run> </groups> <parameter name="browser" value=

html - How do I edit the div:hover property? -

fixed i have been tweaking position , display elements of css code , can't seem figure out how edit code. don't understand how div should edited. want allow hover of div box size of button is. when hover on horizontal space buttons aligned, drop-down list appears when not hovered directly on button. newbie in css editing here. please me. #container { margin: 0px auto; /* width: 1815px; height: 820px; */ padding: 100px; } /*button style*/ .collegebtn { width: 100px; color: white; display: block; padding: 25px; font-size: 30px; border: none; cursor: pointer; background-color: transparent; font-family: 'play', sans-serif; box-shadow: 0 2px 4px 0 rgba(0, 181, 91, 0.74), 0 3px 10px 0 rgba(0, 181, 91, 0.74); } /*button effects*/ .collegebtn:hover { background-color: #a10f31; opacity: 0.6; } /*position <div> content*/ .listdrop { width: 100px; position: relative; display: block; ma

angularjs best exercises -

i new angularjs , want practice exercises can provide online stuff or exercises list of exercises...... for beginners, recommend angularjs official link. have made sample app learn angularjs basics , think 1 of best methods helpful in learning new stuff. angular js tutorial link

java - One upstream event with multiple items, how to set up spring integration pipeline transaction-wise -

let's imagine situation have incoming upstream message contains multiple items. each item contains information participates in business logic implemented part of pipeline. difficulties can see: message has split & converted multiple internal events, processed further , if 1 of them fails, internal events should rolled if had 1 upstream message = 1 item, easier how should 1 cater such situation architecture point of view? best pattern employ here? how should 1 set transactions? thanks! looks question isn't clear , transaction word used different subjects... anyway let me guess want. if going (and can) roll part of business request, should ensure global xa transaction of them , splitted sub-tasks in same thread. because let keep , track transaction , roll backs afterwards, if that. if can't deal xa , single thread, should take solutions compensation transaction or acknowledge claim-checks. but outside of spring integration scope.

Not able to drag and drop element to another element using Selenium-Webdriver -

Image
i writing demo tests following drag , drop functionality.[refer attached screenshot] have written following code: @test public void draganddroptest() { commonsteps(); webelement drag = driver.findelement(by.xpath("html/body/div[1]/div[3]/div[2]/div[1]/div[4]/div[3]/div[1]/div[1]/div/div[1]")); webelement drop = driver.findelement(by.xpath("html/body/div[1]/div[3]/div[2]/div[1]/div[4]/div[3]/div[1]/div[2]/div/div[1]")); actions builder = new actions(driver); action draganddrop = builder.clickandhold(drag).movetoelement(drop).release(drop).build(); draganddrop.perform(); } webelement drag "right now" & webelement drop "quick press". my code able find these elements, not drag , drop "right now" frame "quick press" frame. also tried click on drag, click not working on it. think these collapsible drag , drop panels of jquery. how handle collapsible drag , drops using webd

php - Dingo API add metadata to all responses -

i trying add user-specific metadata every api response using dingo api , thought best way in addmetadata middleware: <?php namespace app\http\middleware\api; use closure; use dingo\api\http\request; class addmetadata { public function handle(request $request, closure $next) { $response = $next($request); /* * dingo api response has ability modify metadata responses */ if ($response instanceof \dingo\api\http\response) { $oldmeta = $response->getmeta(); $meta = array_merge($oldmeta, $request->user()->metadata()); $response->setmeta($meta); } return $response; } } what finding response @ point no longer dingo api response , such, unable add metadata. have tried using dingo\api\http\response::makefromexisting() method create new response old request, i've tried instantiating new response appears dingo api response processed before getting middleware.

operating system - What's the best language to start write OS -

what's language more suitable write own os windows better only. java or c#, or else. , how many take days? p. s. friend asked me question :) c best choice. it take rest of days, , some.

c++ - Difference in template functions -

this question has answer here: difference of keywords 'typename' , 'class' in templates? 5 answers what's difference between template<typename t> , template<class t> ? i use "typename" version, came across class 1 , need know difference.. there no difference. can use either typename or class designate type parameter in template.

To create a Tree Grid Structure from the JSON input using nestedSortable jquery plugin -

i have following json file: [{ "parent 1": [{ "child 1.1.1": 1, "child 1.1.2": "w1t1", "child 1.1.3": 1.5, "child 1.1.4": [{ "child 1.1.4.1.1": 1, "child 1.1.4.1.2": "w1t1c1", "child 1.1.4.1.3": 0.75 }, { "child 1.1.4.2.1": 2, "child 1.1.4.2.2": "w1t1c2", "child 1.1.4.2.3": 0.5 }] }, { "child 1.2.1": 2, "child 1.2.2": "w1t2", "child 1.2.3": 3, "child 1.2.4": [{ "child 1.2.4.1.1": 1, "child 1.2.4.1.2": "w1t2c1", "child 1.2.4.1.3": 1 }, { "child 1.2.4.2.1": 2, "child 1.2.4.2.2": "w1t2c2", "child 1.2.4.2.3": 1.5 }] }] }, { "parent 2": [{ "child 2.1.1": 1, "chi

Different between two type of adapter syntax in android -

model 1 : private context mcontext; public view getview(final int position, view convertview, viewgroup parent) { layoutinflater inflater = (layoutinflater) mcontext .getsystemservice(context.layout_inflater_service); convertview = inflater.inflate("layout name",parent, false); } model two: private context mcontext; public view getview(final int position, view convertview, viewgroup parent) { layoutinflater inflater = (layoutinflater) mcontext .getsystemservice(context.layout_inflater_service); convertview = inflater.inflate("layout name", null); } difference between 2 snippets: convertview = inflater.inflate("layout name" , null); and convertview = inflater.inflate("layout name", parent, false); inflate 2 prams : inflate(int resource, viewgroup root) inflate 3 prams : inflate(int resource, viewgroup root, boolean attachtoroot) resource: int: id xml layout resource load (

java - Failed to create 'E:\HashMap\workspace\YbyUser\bin\YbyUser.apks': Access denied -

description resource path location type error generating final archive: failed create 'e:\hashmap\workspace\ybyuser\bin\user.apks': access denied。 ybyuser unknown android packaging problem each time run eclipse appear mistake.i want know how solve it? run program administrator. make sure file permissions configured correctly on e: drive. if mobile phone or tablet, may need unlocked pin/password/pattern.

Python datetime comparison is incorrect in case of compare two time like: 12:00 and 11:59 -

so below example of code: >>> datetime import datetime >>> future = datetime.strptime('12:00', '%i:%m') >>> past = datetime.strptime('11:59', '%i:%m') >>> future < past >>> true # expected false, because '12:00' > '11:59' >>> past_2 = datetime.strptime('11:58', '%i:%m') >>> past < past_2 >>> false why datetime compare operation returns true instead of false ? %i hours twelve hour clock. unless supply or pm ( %p ), takes choice. 12:00 (i.e. midnight) before 11:59 am. if use %h 24 hour clock, in 12:00 noon instead of midnight. https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior

java - Apply Button on Filter with cssSelector or xPath Selenium Web Driver? -

i have part in source: <div class="cfapplybuttoncontainer" style="height: 21px;"> <button class="tab-button tab-widget disabled" style="max-width: 67px;" disabled="" type="button"> <span class="icon"></span> <span class="label">cancel</span> </button> <button class="tab-button tab-widget disabled" style="max-width: 67px;" disabled="" type="button"> <span class="icon"></span> <span class="label">apply</span> </button> </div> and java part this: // detect type of filter if (type.equals("")) { elementlist = driver.findelements(by.xpath("//div[@id='" + id + "_menu']//a[@class='fitext']")); if (elementlist.size() > 0) { if (driver.findelements(

c++ - Tuning background subtraction with OpenCV -

Image
my question final paragraph. i trying use 1 of opencv's background subtractors means of detecting human hands. code tries follows: cv::ptr<cv::backgroundsubtractor> pmog2 = cv::createbackgroundsubtractormog2(); cv::mat fgmaskmog2; pmog2->apply(input, fgmaskmog2, -1); cv::namedwindow("fg mask mog 2"); cv::imshow("fg mask mog 2", fgmaskmog2); when ran program on own test video greeted (ignore name of right window): can see mask not detected moving hand @ all, given background in video stationary (there maybe 1 or 2 white pixels @ time showing in mask). tried using different video, 1 many examples seemed use moving traffic. you can see picked on moving car -very- slightly. have tried (for both these videos) setting "learning threshold" apply method many values between 0 , 1 , there not variation @ results can see above. have missed regards setting background subtraction or videos particularly hard examples deal with? can adjust se

sequelize.js - Sequelize group by with association includes id -

so when requesting group sequelize follows: return models.workingcalendar .findall({ attributes: [ 'workingcalendar.periodid', 'workingcalendar.date', 'period.name' ], include: [ { model: models.period, attributes: [] } ], where: { getsudoid: currentgetsudo.id, unitplantid: unitplantid }, group: ['workingcalendar.periodid', 'workingcalendar.date', 'period.name'], }); sequelize run query: select [workingcalendar].[id], [workingcalendar].[periodid], [workingcalendar].[date], [period].[name] [workingcalendars] [workingcalendar] left outer join [periods] [period] on [wor

knockout.js - knockout html binded form cannot be changed to show validation error -

hi have viewmodel contains form string in observable var viewmodel = { form: '<label>name</label>' + '<input type="text" name="name">' '<label>name</label>' + '<input type="text" name="class">', }; in html have used viewmodel this; <em data-bind="html: form"></em> here want append validation error msg after label tag using jquery. not able form attribute of view model constant. if change html goes again constant state. how can solve problem please help. not answer may want hear, posting nonetheless... you need rethink approach. the html binding suited inserting (trusted) snippets of html content application, e.g. sanitized bit of content cms. it's not suited loading more parts of application, not in least because bindings not applied new dom bits. it seems you're trying load parts of app

sql server - Using DbContext dynamically -

i have multiple dbs with identical schema. in code, query 1 of dbs parameter, change dynamically. now looks this: public void savenewuser(user user, string type) { if (type == "a") { using (var db = new aentities()) { db.users.add(user); db.savechanges(); } } else { using (var db = new bentities()) { db.users.add(user); db.savechanges(); } } } instead, this: public void savenewuser(user user, string type) { using (var db = new generalentity(type)) { db.users.add(user); db.savechanges(); } } any ideas? in experience, have 1 dbcontext solve similar problems. modify connection string @ runtime. entity framework supports allowing call constructor connection string. i allow administrators maintain settings profiles, given mod

java - Byte Code vs Stream of bytes(Serialization) -

this question has answer here: serialization vs. byte code translation 1 answer i have question regarding byte code , serialization. bytecode - every java class converted bytecode compilation , stored on memory (disk) stream of bytes / bytecode. serialization - serialization process of saving object's state sequence of bytes. can't bytecode used send through network ? so exact difference between 2 ?? thanks in advance. the concepts unrelated. every java class converted bytecode compilation no, isn't converted for compilation. bytecode result of compilation. is, well, code run virtual machine (jvm in java's case) machine code run directly cpu. binary (a sequence of bytes instead of characters) because it's more compact representation. doesn't contain state of objects (except constants). serialization stores state

javascript - Counter in smarty -

i assign values variable depending on counter's value inside each loop. if counter=1, assign value 'a', if counter not 1, assign value 'b'. this how far have gotten code breaking once add conditions , counter change... [{foreach from=$orderarticles item="currorderarticle"}] [{if $counter == 1}] products_info.push(["transaction_id='a'"]); [{assign var="counter" value=2}] [{else}] products_info.push(["transaction_id='b'"]); [{/if}] [{/foreach}] smarty has iteration counter foreach loops [{foreach $orderarticles $currorderarticle}] [{if $currorderarticle@iteration == 1}] ... ... [{else}] ... else ... [{/if}] [{/foreach}] read more in smarty documentation foreach

google apps script - Count number of email sent to a person -

i trying number of times person has been sent email, can keep track of leads, example user@domain.com emailed 5 times user2@domain.com emailed 3 times from reading docs cannot figure 1 out is possible? edit: function myfunction(e) { e = "someemail@gmail.com"; var threads = gmailapp.search("to:" + e + ""); var count = 0; (var = 0; < threads.length; i++) { count++; } logger.log(count) //1 } this gives me threads no number of messages i think on right lines using search() find sent items. snippet use scan through unread emails in inbox, , processing email. you'll want similar: var totalthreads = gmailapp.getinboxthreads().length // read in read_at_once pages of email @ time (var pageindex = 0; pageindex < totalthreads; pageindex += read_at_once) { var threads = gmailapp.getinboxthreads(pageindex, read_at_once) var msgs = gmailapp.getmessagesforthreads(threads) var numthreads =

Laravel blade pass Javascript variable in php -

how can pass javascript variable variable in php loop: something this(obviously not work): var myjsvar = 100; @for ($i = 0; $i<myjsvar; $i++) ... code @endfor further tried solving ajax: /** * slider value */ $.ajax({ type: 'get', url: myurl, data: myjsvar, success: function (option) { console.log(myjsvar); } }); it returns me success function, further did in controller: public function prod(request $request) { if ($request->ajax()) { $ajax = "ajax"; dd($ajax); } else { $ajaxn = "no ajax"; dd($ajaxn); } } it did not work. i not sure how proceed, hope help. php has finished doing work before page hits browser, passing variable javascript php without doing request impossible. consider a) moving loop javascript. consider usin

javascript - How can I convert a UTC date to ISOString format without changing the date/time? -

here's code have far. current utc time = 1:22pm var = new date(); var now_utc = new date(now.getutcfullyear(), now.getutcmonth(), now.getutcdate(), now.getutchours(), now.getutcminutes(), now.getutcseconds()); var isodate1 = now_utc.toisostring(); >>> wed jul 06 2016 21:22:20 gmt+0800 now_utc >>> wed jul 06 2016 13:22:20 gmt+0800 (malay peninsula standard time) isodate1 >>> "2016-07-06t05:22:20.000z" my problem expected , need, isodate1 this: 2016-07-06t13:22:20.000z it seems now_utc correct when converted iso format changes. can give me advice on this? new date(...) construct date/time passed being local time, , toisostring gives both iso format, utc equivalent of local time constructed, hence behaviour you're seeing - note how output of now_utc showing gmt+0800 - means it's local time, offset gmt/utc +8 hours. you should able current utc time iso string: (new date()).toisostring(); //"2016-07-06t1

c# - Intro activity is too slow to close -

i have intro activity contains view pager sliding intro page, picture above intro activity slides i have 3 slides and, in third slide, have button "done" close activity , redirect app login page. my problem when click in done, activity slow close. can me? here code: [activity (nohistory = true, mainlauncher = true)] public class introview : fragmentactivity { private viewpager _viewpager; private controleexibicaointro _controleexibicaointro; protected override void oncreate(bundle bundle) { base.oncreate(bundle); _controleexibicaointro = new controleexibicaointro(this); if (!_controleexibicaointro.deveexibirintro()) { fechaapresentacao(); } setcontentview(resource.layout.introview); _viewpager = findviewbyid<viewpager>(resource.id.viewpager); _viewpager.adapter = new introadapter(supportfragmentmanager); _viewpager.addonpagechangelistener(new introindica

c# - SOAP in php doesn't return values from MySql -

i working on webservice developed in php , mysql. application developed in c# , wpf consuming services. my soap server using pdo access database records. problem when try access webservice application no results database. here example of c# application trying retrieve info: bool result; try { padr_api.padr_apiwsclient client = new padr_api.padr_apiwsclient(); string friends = client.getfirendslist(8); } catch (exception ex) { string = ex.message;//excuse attempt desperate find cause throw; } return result; however in response test message. here php code soap server: public function getfirendslist($id){ $response = new getfreindslistresponse(); $response->return = 'test of message following '; $response->return .= 'friends: '; $pdo = new pdo('mysql:host=localhost;dbname=****', $user, $pwd); $pdo->setattribute(pdo::attr_errmode, pdo::errmode_exception); $stmt = $pdo->prepare(&quo

cordova - Telerik - Uploading Videos to Everlive, Unexpected Error -

Image
i'm trying develop app in want able record video , i'm testing @ moment teleriks everlive service. takes me video camera on phone correctly after recording far i'm aware file should upload instead tells me upload everlive has failed , err.message "unexpected error". if tell me i'm doing wrong i'd appreciate it. thanks. var capturesuccess = function (mediafiles) { mediaadded = true; var i, path, len; (i = 0, len = mediafiles.length; < len; += 1) { path = mediafiles[i].fullpath; alert(mediafiles[i].size); var file = { filename: math.random().tostring(36).substring(2, 15) + ".mp4", contenttype: "video/mp4", base64: mediafiles[i] }; el.files.create(file, function (response) { alert("photograph added."); }, function (err) { navigator.notification.alert("unfortunately upload failed: " + err.mes