Posts

Showing posts from February, 2015

angular - Angular2 calling a function in a sibling component -

component a i have form button should call service class. service returns extracted json result. compare() { this.getresults(); } getresults() { this.resultservice.getresults() .subscribe( results => this.results = results, error => this.errormessage = <any>error); } template of a: <form (ngsubmit)="compare()" #compareform="ngform"> <div class="col-md-5"> <h1>disk forensics</h1> <div class="form-group"> <label for="resourcea">disk a</label> <select ngbdropdown class="form-control" id="resourcea" required [(ngmodel)]="resourcea" name="resourcea"> <option *ngfor="let r of disks" [value]="r.id">{{r.name}}</option> </select> </div> <div class="form-gr

html - Ionic + Angular + PHP Undefined property: stdClass::$variable in insert.php -

there 3 files. when submit button clicked in ionic page, send inputs controller, , controller parse insert.php. forms input datas saved when use html(without ionic contents), form sends empty data mysql database, when use ionic. errors found firebugs are: 1. response - notice: undefined property: stdclass::$firstname in insert.php 2. post (json) - there no child objects please me, below file. page 01 - <ion-content> <form> <br><br> <center> <ion-list> <!--step 1 billing details--> <div ng-repeat="group in groups"> <ion-item class="item-stable checkout item ng-binding active" ng-click="togglegroup(group)" ng-class="{active: isgroupshown(group)}"> <i class="icon" ng-class="isgroupshown(group) ? 'ion-minus' : '

How to show "edit image" in Sitecore experience editor? -

in sitecore "content editor" can use "image editor" clicking "edit image" in data section, in experience editor not visible. there way make available editors use image editor? or behavior sitecore standard? picture field i've written in blog post . first you'll need add new button under /sitecore/system/field types/simple types/image/webedit buttons you can duplicate 1 of existing ones , change icon , text yourself. make contents of click field: chrome:field:editcontrol({command:"webedit:changeimage"}) (there's webedit:editimage can't name that). open app_config\include\sitecore.experienceeditor.config , duplicate entry webedit:chooseimage . change command name webedit:changeimage per above. change type class create below. if have access decompiler, take @ existing command sitecore.shell.framework.commands.shell.editimage existing command selecting image in experience editor sitecore.shell.applica

javascript - Trying to include PHP code in Jquery droppable -

i'm building form builder cms , i'm trying access information database on dropped elements. the problem being; index file php , draggable/droppable element fetched javascript file variable. in js file tried adding variable want code executed: txtboxedit += "<? include 'db.php' ?>"; but output when element dropped: <!--? include 'db.php' ?--> any suggestions on how fix or maybe there's better way (probably is, haha). there "force" code outputted text? thx

c# - Unboxing and casting in one statement in generic method -

i have little utility method looks so: /// <summary> /// replaces dbnull value default of type specified /// </summary> /// <typeparam name="t">resulting type</typeparam> /// <param name="p_this">object check dbnull</param> /// <returns>p_this if not dbnull.value, else default(t)</returns> public static t replacedbnullwithdefault<t>(this object p_this) { return p_this == system.dbnull.value ? default(t) : (t)p_this; } in specific scenario, taking record out of data table , taking specific field out of using weak types, , specific field i'm getting long being boxed object . example reproduces follows: var obj = 2934l; int num = obj.replacedbnullwithdefault<int>(); it fails invalidcastexception , @ (t)p_this . i understand why, boxed long cannot cast directly int , , trying fails: object mylong = 234l; int myint = (int)mylong; however, unboxing , casting works fine: object mylong =

javascript - How to decode json data to array value using jquery? -

i have below jsoncode {"0":{"category":"screensets","position":"top","rotate":"180","3d_file":"3d_deg_180.obj","height":"10","width":"10","x":"299","y":"166","current_roate":"0","comp_color":""},"width":"640","height":"640","name":"test drawing","size":"40","screen":"conference set"} how decode in array format using jquery? small example may full var j ='[{"id":"1","name":"test1"},{"id":"2","name":"test2"},{"id":"3","name":"test3"},{"id":"4","name":"test4"},{"id":"5","name

css - Using calc() in table -

this question has answer here: using calc() tables 2 answers i trying use calc fix width of th:last-child differs others 15px. i've done is: th:last-child { width: calc( (100% - 30px)/12 + 30px ); } table, tr { width:100%; border: 1px solid black; height:10px; } th { border-right: 1px solid black; width: calc( (100% - 30px)/12 ); } <table> <thead> <tr> <th>column 1</th> <th>column 2</th> <th>column 3</th> <th>column 4</th> <th>column 5</th> <th>column 6</th> <th>column 7</th> <th>column 8</th> <th>column 9</th> <th>column 10</th> <th>column 11</th> <th>column 12</th> </tr> </thead> <tbody>

php - Multiple joins with where, like and or_like CodeIgniter 3 Active Records -

i trying this: $location = 'a'; $this->db->select('l.id, d.guests, l.city, l.country'); $this->db->from('offers o'); $this->db->join('location l', 'l.id = o.id', 'left'); $this->db->join('desc d', 'd.offer_id = o.id', 'left'); $this->db->where('d.guests', $guests); $this->db->where('o.completed', 1); $this->db->where('l.country like', $location.'%'); $this->db->or_where('l.city like', $location.'%'); $this->db->limit(5); and have offer 3 guests , country albania (1 row per table it). but, if $guests = 2; have result 1 row. same, if use like , or_like instead where , or_where . if comment line: $this->db->or_where('l.city like', $location.'%'); all works fine, have no results if $guests != 3 , 1 row

Raising my own Exception in Python 2.7 -

i copied , pasted these lines of code pyhton tutorial book. why code not work when try run in pycharm? def inputnumber (): x = input ('pick number: ') if x == 17: raise 'badnumbererror', '17 bad number' return x inputnumber() this got when run code: pick number: 17 traceback (most recent call last): file "c:/users/arman/desktop/scribble/hello.py", line 153, in <module> inputnumber() file "c:/users/arman/desktop/scribble/hello.py", line 151, in inputnumber raise 'badnumbererror', '17 bad number' typeerror: exceptions must old-style classes or derived baseexception, not str you can use standard exceptions: raise valueerror('17 bad number') or can define own: class badnumbererror(exception): pass and use it: raise badnumbererror('17 bad number')

javascript - How to hide table rows based on child class name using jquery? -

i have lot of rows , want hide tr doesn't have specific class. example: <tr id="game-22590" class="game"> <td class="pos left-edge"> <div>2</div> </td> <td class="cost"> <input class="dollars-paid uncorrected" type="text" value="19,99" tabindex="4"> </td> </tr> <tr id="game-22591" class="game"> <td class="pos left-edge"> <div>3</div> </td> <td class="cost"> <input class="dollars-paid" type="text" value="23,99" tabindex="4"> </td> </tr> the td.cost has input class or two. want hide rows doesn't have uncorrected class. use .filter() selecting rows has uncorrected class. $("tr.game").filter(function(){ return $(this).

mysql - Could not connect access denied -

i installed pre configured mysql , after getting working made myself db , user preveilages whenever try use account in installer, keeps telling me don't have access , friend did same thing me , worked him doing wrong?? use phpmyadmin. use 127.0.0.1 host name , error code says : not connect access denied user '[username]@localhost' (using password: yes)

How to detect when an Android app minimized? -

how detect when android app goes background? onpause() works called when orientation changed. if orientation changes app call through life cycle once again means oncreate you can avoid writing following code manifest <activity android:name="" android:configchanges="orientation|keyboardhidden|screenlayout|screensize" android:label="@string/app_name" /> this tell system when orientation changes or keyboardhidden or screenlayout changes handle myself no need re create it. then write code on on pause

javascript - Getting info of live http request in application -

is there way in javascript fetch info http request in progress state now. with jquery can use ajax events api .ajaxsend() http://api.jquery.com/ajaxsend/ .ajaxcomplete() http://api.jquery.com/ajaxcomplete/ complete list of jquery ajax events: https://api.jquery.com/ajax_events/ example: $(document).ajaxsend(function(){ alert('sending ajax request.'); })

java - Servlet context get real path returns null -

this question has answer here: what servletcontext.getrealpath(“/”) mean , when should use it 3 answers i ma trying access resource src/main/webapp/ i using java 1.8.0_101 , maven 3.0.3 unfortunately, working in 1 environment , not in unix environment @named @applicationscoped public class testclass { private static final string resource = "/resources/css/test.css"; private string css = ""; public void init(@observes @initialized(applicationscoped.class) servletcontext servletcontext) throws ioexception { string pathstring = servletcontext.getrealpath(resource); system.out.println("path string: " + pathstring); byte[] data = files.readallbytes(paths.get(pathstring)); css = new string(data, "utf-8"); } public string getcss() { return css; } public stri

javascript - Variable exchange between directive and controller in Angular -

i know has been asked loads of times can't seem find appropriate answer case. at moment have form "invite more people" takes name , email. underneath form button "invite more friends" trigger directive "add-more-person" add form. i want people not able invite more 10 friends. when there 10 'invite-a-friend-forms' want button hidden. so added counter in directive won't able add more forms after there 10, , boolean "addfriends" controller. now want boolean addfriends changed false whenever directive's counter reaches amount. i can't achieve using $watch since i'm not using $scope , other things tried have failed aswell. this code looks like: <div class="row"> <div class="column medium-6"> <button ng-show="post.addfriends" class="btn-grey" type="button" add-more-person add-friends="post.addfriends"

Python Unit Test Dictionary Assert KeyError -

i wasn't sure how create python unittest check if dictionary returned keyerror. thought unit test call dictionary key this: def test_dict_keyerror_should_appear(self): my_dict = {'hey': 'world'} self.assertraises(keyerror, my_dict['some_key']) however, test error out keyerror instead of asserting keyerror occurred. to solve used lambda call dictionary key raise error. def test_dict_keyerror_should_appear(self): my_dict = {'hey': 'world'} self.assertraises(keyerror, lambda: my_dict['some_key'])

c++ - Get Orientation Histogramm from Pixel Patch OpenCV -

i try orientation histogramm out of result of phase() method cv. try rounded orientation of each pixel , divide 10. example 5x5 pixel patch: { 1 36 20 3 14 5 16 11 6 9 7 12 34 22 0 34 5 9 21 4 5 21 28 30 1} my problem is, dont know how scan each pixel of patch , orientationvalue of calculate value histogram. my code getting orientation mat looks this: mat patch = src(rect(px,py,15,15)); mat sx; sobel(patch, sx, cv_32f, 1, 0, 3); mat sy; sobel(patch, sy, cv_32f, 0, 1, 3); mat mag, ori; magnitude(sx, sy, mag); phase(sx, sy, ori, true); int** hist; in variable hist want add values through method. hope understands i'm thinking of , can me. i have plan now, how iterate through given orientation image use loop shown in documentation opencv docu for( = 0; < ori.rows; i++){ for( j = 0; j < ori.cols; j++){ cout << ori.at<uchar>(i,j) << endl; } } but accessing values wont give me orientation value. clues? ori

javascript - Nested GET request Nodejs Expressjs -

i have problem code. want create nested request using nodejs , expressjs, use reuqest like: http://localhost/zigbee/zi?name='hello' http://localhost/zigbee/zs?name='hello' it possible create main route /zigbee/ e , 2 subroute /zi/ /zs/ ? i think implementation like: app.get('/zigbee/',function(req,res){ ... app.get('/zi',function(req,res){ ... app.get('/zs',function(req,res){ ... }}} it possible do? all ew, no. this: app.get('/zigbee/:routeparam',function(req,res){ var param = req.params.routeparam; //do stuff })

jinja2 - how to access pillar data with variables? -

i have pillar data set this; vlan_tag_id: nginx: 1 apache: 2 mp: 3 redis: 4 in formula sls file this; {% set tag = pillar.get('vlan_tag_id', 'u') %} so have variable tag dictionary {'apache': 2, 'nginx': 1, 'redis': 4, 'mp': 3} at run time pass pillar data app value either 1. apache 2. nginx 3. redis 4. mp so if @ run time pass apache want me value 2 i cant {{ salt['pillar.get']('vlan_tag_id:app', '')}} because app variable. i tried doing {{ salt'pillar.get'}}, throws error. how can ? since tag dictionary, can on well: {%- set tag = pillar.get('vlan_tag_id', 'u') %} {%- set app = pillar.get('app') %} {{ tag.get(app) }} # note lack of quotes if want use colon syntax, can append contents of app key string: {%- set app = pillar.get('app') %} {{ salt['pillar.get']('vlan_tab_id:' + app) }} i find simpler follow

ios - CoreWLAN in swift -

Image
i want use corewlan in swift project when write import corewlan module not known. is corewlan existing default? if not how can add in project? corewlan not available on ios. as can been seen on documentation page, states sdk macos.

c - Error compiling - makefile - include header -

i have problem can't seem resolve. i'm trying -i flag add includes list of compiler at. instead of directly looking in /usr/include directory contains standard library, first in include directory header files. doesn't seem find files since long list of kind of error appears when compile: src/termcaps/termcapbis.c:13:10: fatal error: 'termcaps.h' file not found #include <termcaps.h> (that 1 example out of multiple errors same thing.) so i'm wondering if there wrong makefile or if have else compiler understand header files are. here's makefile: name = 42sh src_dir = "src" src_dirs = $(shell find $(src_dir) -type d -follow -print) src_files = $(shell find $(src_dirs) -type f -follow -print | grep "\.c") obj_dir = "obj" obj_dirs = $(src_dirs:$(src_dir)%=$(obj_dir)%) obj_files = $(src_files:$(src_dir)%.c=$(obj_dir)%.o) flags = -wall -wextra -werror include = -iinclude -ilibft/include lib = -llibft -lft -l

javascript - Google Maps trigger Google Analytics Events wen map controls are used -

how fire google universal analytics events every time google maps (v3) controls used: zoom in, zoom out, terrain, satellite, street view... this standard universal analytics event: ga('send', 'event', 'event category', 'event action', 'event label'); you'd need add standard google maps event listeners following on map: zoom_changed maptypeid_changed e.g. function doyouranalytics(event) { // or whatever need call here ga('send', 'event', 'event category', event, 'event label'); } map.addlistener('zoom_changed', function() { doyouranalytics('zoom_changed'); }); map.addlistener('maptypeid_changed', function() { doyouranalytics('maptypeid_changed'); }); you don't give indication want 'event category', 'event action', 'event label', can pass event data need function. e.g. zoom maybe want check map's current zoom

java - Modifying first pivot to median pivot for quicksort trouble -

i'm stuck on should trivial. i'm trying modify code uses first index pivot in quicksort, code uses median. professor said easiest way go doing send median value first index, , send first index value median index. i'm trying @ top of code whenever run average array, out of bounds exception. my code. sorry, i'm working on ipad in vi taking picture easier me.

tvos - How to implement authentication in Apple TV with TVML -

i'm developing apple tv app. it's done, need add authentication function in app. youtube , hbo, tv show digit code, , user needs go activate website in pc link own account. this apple tv app using tvml templates build. i'm confused this, , don't know should work on first. anyone has ideas? thank you! it depends on subscription model. if cable based subscription service allows access content on tv based on cable packages, need use adobe's service called adobe pass. more details on adobepass can found here: http://www.adobe.com/marketing-cloud/primetime-tv-platform/authentication.html advantage of adobepass on tvos devices allows single sign on across different apps , once authenticated, user doesn't need go through authentication across apps using adobepass. if similar hbo now, youtube, hulu, netflix, etc, standalone subscriptions , not tied cable packages, can directly have login viewcontroller in tvos app communicates backend , authenti

c - How to register events using libxcb-xinput -

i'm trying listen touch events (touch_begin, touch_update, touch_end , touch_ownership) on root window. touch events aren't directly integrated xcb, have use input extension (libxcb-xinput). i managed set event listener events coming input extension, can't figure out how register events want listen to. i tried using xcb_input_xi_select_events(), function takes parameter of type xcb_input_event_mask_t, while enum containing event masks of type xcb_input_ xi _event_mask_t , there no obvious way cast them. for reason think xcb_input_xi_select_events() wrong function, have no idea function use instead. my non working code looks that: xcb_input_event_mask_t mask[] = { xcb_input_xi_event_mask_touch_begin | xcb_input_xi_event_mask_touch_end | xcb_input_xi_event_mask_touch_update | xcb_input_xi_event_mask_touch_ownership }; xcb_input_xi_select_events(dpy, root, 4, mask); the core throws "large integer implicitly truncated unsigned type" wa

etl - Which is the best approach for a dimension (SCD-2 or a SCD-1 + a whole new dimension) -

Image
let´s have following situation: a dimension product attributes aren't volatile (description , diameter - can changed scd-1 change correction) , attribute can volatile (selling group, can change on time same product). so, when change occurs in these volatile attributes of 1 product, need somehow track them. i have come these 2 approaches: for both: keep using scd-1 non-volatile attributes. approach #1: use scd-2 in product_dim volatile attributes. approach #2: make selling group whole new dimension , every sell track current value in moment of etl. no need scd-2 here. i new in data warehousing , i'm trying understand better , why. 1 of aims use olap software read of stuff. it comes business needs of model. don't know business enough question, rule of thumb if wanna analysis selling group (i.e: total quantity of products sold selling group x) should create separate dimension. in case approach#2 correct. considering general concepts , assuming

estimation - RESTful API Transaction Costs -

i've been tasked coming per transaction/request cost use in pricing api developing , wondering if doing correct or if there better way?! our api runs on aws using variety of services (rds, ec2, elb, s3 etc...). need come baseline can work from. example, working on following assumption... aws monthly cost estimate: 500 for amount performance tested system , can handle 1000 concurrent requests per second (per apache bench). there approximately 2.5 million seconds in month. 2.5m * 1000 requests = 2500000000 requests per month making assumption full load (1000 requests) used per second entire month equate to... 500 / 250000000 = 0.0000002 per transaction/request is valid analysis , figure use? or better way of estimating type of cost? thanks!

c# - WPF Groups of controls -

for example have such xaml code: <window x:class="switchingcontrol.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="350" width="525"> <grid> <grid> <grid.rowdefinitions> <rowdefinition height="auto"/> <rowdefinition/> </grid.rowdefinitions> <grid.columndefinitions> <columndefinition/> <columndefinition/> </grid.columndefinitions> <grid grid.columnspan="2"> <stackpanel orientation="horizontal"> <radiobutton content="first"></radiobutton> <radiobutton content="second

memory management - C++, Leak or not? what can be done -

we have program crashes @ 4gb due insufficient memory after running long period of time. project in c++, opensuse11,12, including linking various shared memories , other libraries. monitoring heap increase , total memory increase pmap of pid, totally analogous. meaning process starts 2.5gb , heap ~0 , , before crashing total = 4 gb , heap = 1.5 gb . we have made runs valgrind , result quite puzzling. below can see summaries running 20 minutes. ==30042== heap summary: ==30042== in use @ exit: 706,413 bytes in 3,345 blocks ==30042== total heap usage: 1,770,240 allocs, 1,766,895 frees, 173,813,303 bytes allocated ==30042== leak summary: ==30042== lost: 96 bytes in 3 blocks ==30042== indirectly lost: 27 bytes in 3 blocks ==30042== possibly lost: 344 bytes in 2 blocks ==30042== still reachable: 705,946 bytes in 3,337 blocks ==30042== of reachable via heuristic: ==30042== stdstring : 62 bytes in 2 blocks =

java - User input calculation -

i have task create calculation based on users puts in: scanner reader = new scanner(system.in); int num = 0; system.out.print("write number: "); int k = reader.nextint(); the purpose if user keys in 5 should print out of if select 5 should print out: 5 6 7 8 9 10 11 12 13 14 and can't figure out how that. i did import import java.util.scanner ; am not sure questions though. add piece code below, if need print ever user inputs, 14 for(int = k; <= 14 ; i++) { system.out.print(i); } hope helps

openerp - No backend menu in odoo 9 -

when working optimize seo website have constructed in odoo 9, declared keyword seems long, or wrong because don't have option removed (delete it) list of keywords. all odoo got blocked after declaring keyword, , cannot see menu in odoo, website. i tried backup data base, command not executed, returns same page, without doing anything. errors i've got can find out enclosed picture. hope came across kind of issue , can me tips. thank in advance! enter image description here as par opinion menu not display because of css not loaded properly. can may solved delete attachments if has not important. first of restore database in new database , perform following query in database. delete ir_attachment; i hope work you. thanks.

angularjs - Angular2 HashLocationStrategy and SEO -

i have angular 2 app @ www.tilecase.com i'm wondering seoand hashlocationstrategy used router. if input urls # google url register says urls not valid, hence guess google doesn't index them in case. i want index urls such https://www.tilecase.com/#/forbusiness how can urls indexed? i've read angular universal. main strategy people using? also why angular 2 use hashlocationstrategy? isn't older way of doing urls , defined routes separated / favoured now?

create df column name by adding global variable name and a string in Python -

i have global variable split_ask_min = 'minimum_spend' i create new variable in df , name 'minimum_spend_sum' , make sum of minimum_spend. var_programs['split_ask_min+ _sum'] = var_programs[split_ask_min].groupby(x['name']).transform('sum') having trouble creating variable name. should split_ask_min+ '_sum' equal minimum_spend_sum but if code var_programs['split_ask_min+ '_sum''] i got error unless need create variable, use dictionary store value. df = {} split_ask_min = 'minimum_spend' df[split_ask_min + '_sum'] = ... print(df) otherwise can use globals() globals[split_ask_min + '_sum'] = ... # minimum_spend_sum => ...

Matlab: mean and stddev in a cell -

in single array it's pretty simple mean or standard deviation ( std ) of numbers, in cell, data doesn't have same size in each of positions couldn't mean2 or std2 . i know it's possible if copy of data in single row or single column wanted ask if knows if there single formula it? thanks you can use cellfun compute per-cell mean , std : cell_mean = cellfun(@mean, my_cell); cell_std = cellfun(@std, my_cell); for example: >> my_cell = {[1,2,3,6,8], [2,4,20]} >> cellfun(@mean, my_cell) ans = 4.0000 8.6667 >> cellfun(@std, my_cell) ans = 2.9155 9.8658 if want mean and/or std of elements in cells, can: >> mean([my_cell{:}]) ans = 5.7500 >> std([my_cell{:}]) ans = 6.2048 and, if cell elements of different sizes, can use cell2mat assist you: >> mean(cell2mat(cellfun(@(x) x(:)', my_cell, 'uni', 0))) ans = 5.7500 >> std(cell2mat(cellfun(@(x) x(:)', my_cell, 'uni'

better implementation of on click toggle class jquery -

hello wondering if me out. have jquery code adds class specific divs in page. wondering if there better way implement code, because glitchy. have 5 div ids add visible class to. have 1 class applies div elements should toggle active class. new jquery , not sure if proper way implement it, please see code below: $('.graph-button').click(function() { $(this).toggleclass("active"); }); //get circles show text boxes adding class $('#value_button').click(function(){ $('#value_text').toggleclass("visible"); }); $('#history_button').click(function(){ $('#history_text').toggleclass("visible"); }); $('#vision_button').click(function(){ $('#vision_text').toggleclass("visible"); }); $('#offering_button').click(function(){ $('#offering_text').toggleclass("visible"); }); $('#future_button').click(function(){ $('#future_text').toggleclass(

docusignapi - Add carbon copy to completed DocuSign envelope -

is there rest api method add carbon copy completed envelope? i'm able achieve in manage section of docusign interface, selecting "forward" on completed envelope , adding carbon copy recipient. there api method same thing? here's scenario: using rest api send envelope 2 signers , carbon copy. halt process between signer 2 , cc, , send cc after external event in our system. possible through api? one possible alternative prevent envelope completing in first place, adding dummy signer after signer 2 , before cc, deleting when our event triggers. ideally i'm looking simpler, if exists. the recommended technique halting envelope's progression add dummy signer indicated. delete signer enable envelope continue.

Cannot add MSCOMCTL.OCX to VB6, no issues with Office -

i know, there countless threads control , i've been reading them hours. can't add ocx load vb6, running 64 bit win 7. things have tried: 1. unregistering , re-registering (used regsvr32 syswow64) 2. did regtlib msdatsrc.tlb thing i've found 3. reinstalled sp6 4. installed cumulative update saying latest version i haven't reinstalled vb6, don't have media @ work or have, has shown never solution problem on successful fixes i've read these past few days i've been working on this. things note people aren't talking in other threads: can add ocx office without issue, add controls (treeview, imagelist, etc) , use them fine. can't add ocx new, empty vb6 project. users trying open existing project, fails me well, never whether can add ocx new project. can't. i hate create 1 of these threads further muddy water, solutions in other threads haven't been working me , no 1 mentioning can add office or new project. this used work fine m

video streaming - Displaying RTSP on website -

i have rtsp link camera want display on web page. since video tag not support rtsp, , google chrome not support vlc , quicktime plugins anymore, best way display camera using rtsp link? if latency not great consideration can use ffmpeg generate hls playlist , serve clients via http server - see this . otherwise need solution output live fragmented mp4 stream.

angularjs - $rootScope seemingly updating too slowly in an asynchronous call -

i'm attempting achieve sliding left/sliding right effect (like navigating flow in app) ui-router , nganimate. to achieve effect, adding css class on container of ui-view elements follows: <div class="ui-view-container" ng-class="navigationdirection"> @renderbody() </div> then on run, listeing $statechangestart broadcasted ui-router: $rootscope.$on('$statechangestart', (event, to, toparams, from, fromparams) => { // determine if navigation in flow , set correct navigation direction // on rootscope applied ui-view-container transition if (typeof from.params !== 'undefined' && typeof from.params.backstate !== 'undefined' && to.name === from.params.backstate.name) { $rootscope.navigationdirection = "back"; } else { $rootscope.navigationdirection = "forward"; } }); the problem code doesn't apply first state entering ( ng-enter ). afte

python - Django: Link a field of one model to a field of another -

i'm working through tango django book , have decided add of own functionality have issue. i have 2 models, category , page class category(models.model): name = models.charfield(max_length=128, unique=true) views = models.integerfield(default=0) likes = models.integerfield(default=0) slug = models.slugfield(unique=true) class page(models.model): category = models.foreignkey(category) title = models.charfield(max_length=128) url = models.urlfield() views = models.integerfield(default=0) now i'm trying make category "views" field sum of views of of pages within category in test database population script doing way: cats = {"python": {"pages": python_pages, "views": sum(page["views"] page in python_pages), }, "django": {"pages": django_pages, "views": sum(page["views"] page in django

swift - Is it possible to make 1 layout and stretch it depending on the screen size? -

as title says: possible in xcode make 1 view, lets make app without auto layout iphone 5, , stretch depending on how big screen size get? whole app in landscape. yes using constraints control drag items (buttons , labels , uiimageview ) view , select constraint

ssas - DAX. Previous year Amount -

i have single table in powerpivot. my columns account, amount , date. want calculate prevyearamount, can't fin correct formula. sample data: account amount date prevyearamount 1 100 01/01/2016 90 1 120 02/01/2016 200 2 130 01/01/2016 108 2 103 01/01/2015 2 105 01/01/2015 1 90 01/01/2015 1 200 02/01/2015 tried =calculate(sum(hoja1[amount]);filter(hoja1;dateadd(hoja1[date];-1;year));filter(hoja1;hoja1[account])) but returns 350 rows. also tried: =calculate(sum(hoja1[importe]);datesytd(sameperiodlastyear(hoja1[fecha]))) but returns blank this should trick: calculate(sum('table1'[amount]);sameperiodlastyear('table1'[date])) hope helps. but, please consider create date table, idea, use relationships, makes expanding/collapsing part of dax easier.

javascript - Laravel ajax request not working for a foreach loop -

i have collected data in controller.now in view,i have showed them inside unordered list (ul) link. <ul> <li><a>....</a></li> </ul> now when trying fire ajax request,only last data (i.e,last link in listed items) responding ajax request.the ajax script not inside foreach loop.do have place ajax script inside foreach loop.then,for each data there script.won't create problem? <ul> @foreach ($brands $brand) <li class='n1'><a href="{{$brand->id}}" id="{{$brand->brand}}">{{$brand->brand}}</a></li> @endforeach </ul> my ajax script: <script> $('#{{$brand->brand}}').on('click',function(e){ e.preventdefault(); $.ajaxsetup({ headers: { 'x-csrf-token': $('meta[name="csrf-token"]').attr('content') } }); $.ajax({ type:"post", url:'/userprodu

c# - Whitelist for Microsoft bot connector service -

in order make bot secure possible, i'd disallow inbound traffic unless it's coming ms bot connector. there whitelist of ips/domains somewhere? you don't need ips/domains, because microsoft bot connector sdk has security functionality built in . just keep in mind each api controller should have [botauthentication] attribute, , should use https protocol. [botauthentication] attribute validates each request using microsoftappid password: microsoftapppassword define in web.config file , bot connector can hit apis, else unauthorized result.

python - Dynamic database selection based on URL in Django -

let's first page of app has 2 links. possible pick database depending on link clicked? databases both have same models, different data. example, let's application contains students different colleges a , b . if link a clicked, database a used contains students college a . entire application after point should use database college a . i understand there ways work around problem designing databases differently, i.e. having college field, , filtering out students particular college affiliation. hoping find solution using django use 2 different databases. so need store chosen database in session or smth , can pick database. docs >>> # run on 'default' database. >>> author.objects.all() >>> # this. >>> author.objects.using('default').all() >>> # run on 'other' database. >>> author.objects.using('other').all()

io - Segmentation Fault when writing to a file in C -

whenever attempt write file, getting segmentation fault. don't have access software can tell me it's coming since i'm @ school. if me out great. //olmhash.c #include <stdio.h> #include <stdlib.h> #include <string.h> #include "olmhash.h" int main() { createaccount(); return 0; } struct account createaccount() { struct account *newaccount; newaccount = (struct account *)malloc(sizeof(struct account)); printf("enter userid: "); scanf("%s", newaccount->userid); printf("\nenter password: "); scanf("%s", newaccount->password); char *output = malloc(sizeof(char) * 255); strcpy(output, newaccount->userid); strcat(output, "\t"); strcat(output, newaccount->password); file* fp; fp = fopen("accountslist.txt", "r"); fputs(newaccount->userid, fp); free(output); } - //olmhash.h struct account

I'm trying to create a dynamic menu on a HTML web page using JavaScript, but keep having trouble -

okay here html code <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>menus</title> <script type="text/javascript" src="cities.js"> </script> </head> <body> <select id="countries" name="countries" onchange="populate('countries','cities')"> <option value="">country</option> <option value="ireland">ireland</option> <option value="romania">romania</option> <option value="england">england</option> <option value="spain">spain</option> <option value="germany">germany</option> </select> <select id="cities" name="cities"> <option value="">cities</option> </select> </form> </body> </ht

mysql - Removing Null Values from Multiple Columns -

how remove rows columns have null values? table example: custid dob order1 order2 order3 order4 1 xxx null null null null 2 xxx 25 32 27 5 3 xxx null 6 null 3 4 xxx 1 null null null 5 xxx null null null null i delete rows custid 1 , 5. value in of 4 order columns should kept. can achieve in statement? you this: delete 'your_table' 'order1 null , 'order2' null , 'order3' null , 'order4' null , 'order5' null

javascript - How to implement a dynamic reducer creator for API service call in React with Redux project? -

since may have many api services call, have write many reducers these services, there way implement reducer creators dynamically below? const pending = 'pending' const rejected = 'rejected' const fulfilled = 'fulfilled' const companies = 'companies' let createreducer = (name) => (state, action) => { switch (action.type) { case name + '_' + pending: return {...state, isloading: false } case name + '_' + fulfilled: return {...state, companies: action.payload, isloading: false } case name + '_' + rejected: return {...state, isloading: false, err: action.payload } default: return state } } let comapnyreducer = createreducer(companies) which can equivalent below explicit implementation: const comapnyreducer = (state={isloading: false}, action) => { switch (action.type) { case 'companies_pending': r

javascript - How to add a recurring Interest rate onto a recurring and growing amount -

i trying add given percentage onto number repeatedly on few months has percentage added on previous month. i.e, user defines 25% (this not set number of percent) add 25% onto amount invested start with, example: customer invests £10,000, add 25% onto £10,000, equals £12,500. and then following month add 25% onto £12,500 month before, should equal £15,625. it should case of simple maths, yet cannot figure out using javascript. keep getting value of £15,000, , cannot work out how store given percentage in variable , add percentage onto total amount. here code. // set values... num = prompt("enter percentage using decimal number..."); interestrate = num*100; startcash = 10000; total = startcash*interestrate/100+startcash; month = 1; // inputting text... starttext = "starting money: £"; inttext = "interest earned: "; totaltext = "total amount: £"; monthtext = "month: "; displaystar

python 3.x - understanding behavior of mapping to an array -

when map modify array in place? know preferred way iterate on array list comprehension, i'm preparing algorithm ipyparallel, apparently uses map function. each row of array set of model inputs, , want use map , in parallel, run model each row. i'm using python 3.4.5 , numpy 1.11.1. need these versions compatibility other packages. this simple example creates list , leaves input array intact, expected. grid = np.arange(25).reshape(5,5) grid array([[ 0, 1, 2, 3, 4], [ 5, 6, 7, 8, 9], [10, 11, 12, 13, 14], [15, 16, 17, 18, 19], [20, 21, 22, 23, 24]]) def f(g): return g + 1 n = list(map(f, grid)) grid array([[ 0, 1, 2, 3, 4], [ 5, 6, 7, 8, 9], [10, 11, 12, 13, 14], [15, 16, 17, 18, 19], [20, 21, 22, 23, 24]]) but when function modifies slice of input row, array modified in place. can explain behavior? def f(g): g[:2] = g[:2] + 1 return g n = list(map(f, grid)) grid array([[ 1,

twitter - Remove "semi-duplicate" rows in R -

i have dataset looks this: text id screenname retweetcount isretweet retweeted longitude latitude 1 xx 778980737861062656 0504traveller 0 false false <na> <na> 2 xx 778967536167559168 iz_azman 0 false false <na> <na> 3 yy 778962265298960384 iz_azman 0 false false <na> <na> 4 yy 778954988122939392 travelindtoday 2 false false <na> <na> 5 zz 778948691969224705 umtn 2 false false <na> <na> 6 zz 778942095843135493 flyinsider 0 false false <na> <na> these tweets package twittr in r. tweets have same text different retweetcount . want keep unique tweets (by text ), keeping highest retweetcount amongst duplicates. (in case above, tweets 1, 4, , 5.) how do that? you can

jquery - Javascript - replacing a div with another random div (buttons not working in the new div) -

my overall objective create test based on images. stuck @ stage. idea image appears , user has click on button choose correct answer. ever button click, image replaced randomly image. problem having, when image replaced randomly new image, buttons (in same div new image) not work. user can use buttons in first div , when div replaced, can't past new random div. new forum.. grateful if can me. here html. <div id = 'suitcase'> <img src ='https://upload.wikimedia.org/wikipedia/commons/c/ce/suitcase_750x500.jpg' width = '400'/> <ul> <button id = 'correct1'> suitcase </button> &nbsp; &nbsp; <button class = 'incorrect1'> backpack </button> &nbsp; &nbsp; <button class = 'incorrect1'> handbag </button> </ul> </div>; <div id = 'printer'> <img src = 'http://cdn2.pcadvisor.co.uk/cmsdata/reviews/3598061/hp_envy_5640_e-all-i

javascript - How to pass a route parameter to the main View? -

i use simple router route page requests. start app instantiating bvapp. recently, added in routing , use first parameter page1 . how can pass parameter bvapp code. i know should not pass in via constructor parameters allowed backbone uses _.pick . see here can call method on bvapp perhaps? i looked @ so post ideas after googled search pulled nothing obvious. perhaps entry point application should not backbone view @ all? // brmain var brmain = backbone.router.extend({ name: 'brmain', routes: { "*page1(/:supertag)(/:tag)": "main" } }); var router = new brmain(); // matches // domain.com // domain.com#page1 // domain.com#page1/supertag // domain.com#page1/supertag/tag router.on('route:main', function (page1, supertag, tag) { var app = $a.mod.add(new bvapp()); }); backbone.history.start(); // bvapp var bvapp = backbone.view.extend({ name: 'bvapp', el: window, initialize: funct

node.js - Creating an HMAC with an existing password hash and salt -

for migration reasons need take existing password & salt , place firebase. i'm uploading accounts firebase using google identity kit. kit allows me create users , requires sha-1 password salted. var user1 = { localid: userid, email: email, salt: new buffer('salt-1'), passwordhash: crypto.createhmac('sha1', this.hashkey).update('a password' + 'salt-1').digest() }; above uploaded server. there way crypto.createhmac existing sha-1 hash , salt? i've tried replacing passwordhash , salt values, need encoded same way createhmac encodes them. see hmac implementation . the key hmac code is: hash(o_key_pad ∥ hash(i_key_pad ∥ message)) so seems answer no since padded key needs concatenated message.

java - generating .docx with aspos -

i'm trying convert file .docx using aspose however,eventhough file generated in microsoft word identical md5 of generated file different each time run same program. there way ensure file integrity using aspose? here snippet of code: system.out.println(digestutils.md5hex(bytes)); bytearrayinputstream bis = new bytearrayinputstream(bytes); document doc = new document(bis); doc.save("newfile.docx"); bis.close(); bytes= fileutils.readfiletobytearray(new file("newfile.docx"); system.out.println(digestutils.md5hex(bytes)); //<-- generates md5 different each time run program...why?? my question is, there way ensure identical md5 hash after each run aspose.words mimics same behavior ms word does. if re-save input document multiple times using ms word, md5 hex value each output document different. i work aspose developer evangelist

node.js - npm returning 404 and 405 errors when connecting to Nexus 3 -

background: i have new installation of nexus oss 3 have configured repository proxy official npm repo. have added users , added 'npm bearer token realm' list of active realms. repository status "online - remote connection pending..." , user i'm trying connect has admin access. problem: i attempting login repo 2 different systems, each using different versions of node 0.10.x (currently required dev needs) , npm (one came packaged node, 1 updated current). on 1 system 405 error following output: ~$ npm login --loglevel verbose --registry=https://repo.xxx.com/repository/xxxx-npm/ npm info worked if ends ok npm verb cli [ '/usr/local/bin/node', npm verb cli '/usr/local/bin/npm', npm verb cli 'login', npm verb cli '--loglevel', npm verb cli 'verbose', npm verb cli '--registry=https://repo.xxx.com/repository/xxx-npm/' ] npm info using npm@1.4.28 npm info using n