Posts

OpenCv Python frame empty in mjpeg stream from webcam -

i'm creating program displays 4 mjpg cameras in grid, problem happens frame empty , stream freeze, capture error checking size of each frame, , if equal 1 continue cycle, problem remain in control loop, seems stream flow not able obtain valid frame, suggestion? import socket import numpy np import cv2 cap = cv2.videocapture("http://85.90.40.19/mjpg/video.mjpg") cap2 = cv2.videocapture("http://85.90.40.19/mjpg/video.mjpg") cap3 = cv2.videocapture("http://85.90.40.19/mjpg/video.mjpg") cap4 = cv2.videocapture("http://85.90.40.19/mjpg/video.mjpg") cv2.namedwindow('frame', cv2.wnd_prop_fullscreen) cv2.setwindowproperty('frame', cv2.wnd_prop_fullscreen, cv2.window_fullscreen) while true: try: ret, frame = cap.read() ret2, frame2 = cap2.read() ret3, frame3 = cap2.read() ret4, frame4 = cap2.read() except: print("try catch") continue size = np...

php - laravel 5 rawurlencode not encoding slashes -

i have laravel 5 project filters products category names , displays them. category names contain slashes(/) , dots(.) , when use rawurlencode() encode names retrieved database in order generate urls, slashes , dots not encoded rawurlencode() , leads 404 , internal errors when try click generated links. code in view: @foreach($info['categories'] $cat) <a href="{{ route('listbycategory', rawurldecode($cat->description)) }}" class="list-group-item sidebar-menuitem">{{ $cat->description }}</a> @endforeach here routes file: route::get('/cat/{cat}', ['as' => 'listbycategory', 'uses' => 'productscontroller@display']); and here's controller: class productscontroller extends controller { public function display($category) { $info = []; $info['title'] = $category; $info['products'] = db::select('....); return view('myview); } ...

javascript - How do I prevent duplicate Angular keys in ng-repeat? -

having trouble duplicate keys in ng-grid. search tim click on ng grid column in gridoptions1 see duplicates in gridoptions2. ideas? here's plnkr $scope.gridcolumndefs2 = [ {displayname:'phone', celltemplate: '<div data-ng-repeat="(key, ngclickresult) in ngclickresults track $index">{{ngclickresult.phone}}</div>'}, i use track by solve this, unless there reason should not, try track $index - trick! <div data-ng-repeat="(key, ngclickresult) in ngclickresults track $index"> or if you're trying remove items data can filter , answer here - angularjs remove duplicate elements in ng-repeat although if use second method, unless stuck recommend trying modify data coming in before hits repeat - maybe on server if have access that.

osx - Xcode-beta and updated/new frameworks -

i run xcode-beta 7 on 10.10.3. has new gameplaykit framework , updated scenekit framework. can use them (or new features) in current project, or must have 10.11 beta? you can write code on os x 10.10.3 using xcode 7β. can compile , export app since xcode can build against included 10.11 sdks. you can not , however, run app on mac under 10.10.3. app run need update 10.11β. make sure always use the same beta version xcode , os x always use latest beta if try run app links against sdk not available app crash before started error similar to dyld: library not loaded: /system/library/frameworks/metal.framework/versions/a/metal that because app configured tell dyld search in system's frameworks directory framework , directory not contain framework on version of os x. for unknown symbols in existing (updated) frameworks there 2 options depending on language: swift: swift 2.0 compiler automatically warns api want use not available , makes guard st...

java - Custom DaoAuthenticationProvider doesn't send correct exception to custom AuthenticationFailureHandler -

in application, use spring security, , try customize it... i have custum daoauthenticationprovider : @component("authenticationprovider") public class limitloginauthenticationprovider extends daoauthenticationprovider { ... @override public authentication authenticate(authentication pauthentication) throws authenticationexception { if (stringutils.isblank(pauthentication.getname())) { throw new usernamenotfoundexception("login required"); } if (stringutils.isblank(pauthentication.getcredentials().tostring())) { throw new authenticationcredentialsnotfoundexception( "password required"); } ... } } and custum authenticationfailurehandler : @component("authenticationfailurehandler") public class myauthenticationfailurehandler implements authenticationfailurehandler { @override public void onauthenticationfailur...

python - Why is Button parameter "command" executed when declared? -

this question has answer here: why button parameter “command” executed when declared? 4 answers i'm new python , trying write program tkinter. why hello-function below executed? understand it, callback executed when button pressed? confused... >>> def hello(): print("hi there!") >>> hi=button(frame,text="hello",command=hello()) hi there! >>> it called while parameters button being assigned: command=hello() if want pass function (not it's returned value) should instead: command=hello in general function_name function object, function_name() whatever function returns. see if helps further: >>> def func(): ... return 'hello' ... >>> type(func) <type 'function'> >>> type(func()) <type 'str'> if want pass argument...

lua - Error: attempt to index global 'playerBul' (a nil value) -

the error saying: game.lua:171: attempt index global 'playerbul' (a nil value) sorry if put unnecessary code, not know causing error. here files game: menu.lua: local menu = {} local bannermenu; local selection; menu.name = 'menu' local function play() mode = require('game') mode.load() end local options = { {['text'] = 'play', ['action'] = play}, {['text'] = 'exit', ['action'] = love.event.quit} } function menu.load() bannermenu = love.graphics.newimage(banner) selection = 1 pointer = love.graphics.newimage(pointer) mode = menu end function menu.update() return mode end function menu.draw() love.graphics.draw(bannermenu, 200,10) = 1,#options if == selection love.graphics.draw(pointer, 300, 200 + *20) end love.graphics.printf(options[i].text,0,200 + * 20, love.graphics.getwidth(), 'center') end end function menu.keypressed(key) if key == "u...