Posts

Showing posts from July, 2014

Unable to have a secure and non secure endpoint in a single Oauth secured Spring controller -

i putting rest api using spring boot secured via oauth2. have security application built working fine managing jwt tokens. i putting separate application handle general user profile resource requests such forgot password, registration , profile operations. annotated enableoauth2resource correctly adding oauth2authenticationprocessingfilter filter chain. @springbootapplication @enableoauth2resource public class profileapplication extends springbootservletinitializer { public static void main(string[] args) throws ioexception { springapplication.run(profileapplication.class, args); } @override protected springapplicationbuilder configure(springapplicationbuilder application) { return application.sources(profileapplication.class); } } the challenge facing cannot find way configure security post requests /profiles endpoint unsecured while requests or put pass in derived @authenticationprincipal provided bearer token. i want have following i

python - Pyramid and Cassandra don't work properly -

i using pyramid (1.5.7) , waitress (0.8.9) cassandra (2.2.0) . seems waitress , cassandra driver using both asyncore , somehow stepping on each others toes. code on app/__init__.py file: import logging.config .action.context import root_factory pyramid.config import configurator cassandra.cluster import cluster cassandra.query import named_tuple_factory def main(global_config, **settings): """ function returns pyramid wsgi application.""" # support logging in python3 logging.config.fileconfig( settings['logging.config'], disable_existing_loggers=false ) config = configurator(settings=settings, root_factory=root_factory) # retrieves connection cassandra (non sql database) def get_non_sql(request): cluster = cluster(['127.0.0.1'], port=9042) session = cluster.connect('app') def disconnect(request): cluster.shutdown() request.add_finished

php - how to save date for the second run of my application -

here did: $time1 = date('h:i'); $time2 = null; $time_array = array($time1, $time2); $time1 current time. every time run script, shows moment. i explain want do: at t=0 (initial) (first time run code) $time1 = 10:14:26; (the date value want saved use of second run of code) i think want use session variables. remember, if user has cookies or private browsing enabled not work. session_start(); if (isset($_session['time_1'])) { $time2 = $_session['time_1']; } $_session['time_1'] = date('h:i'); $time_array = array($_session['time_1'], $time2);

python - How to I hide my secret_key using virtualenv and Django? -

i using django, python, virtualenv, virtualenvwrapper, , vagrant. so far have left secret_key inside of settings.py file. works file local files. have placed files in git. know not acceptable production(apache). what correct way go hiding secret_key? should use virtualenv hide it? there's lot of different methods hide secrets. use another, non-versioned file. create new file secrets.py or have , put secrets in that. place alongside settings file , place secret in there; in settings file put from secrets import * @ top. then, rahul said, add .gitignore file , add secrets.py file won't committed. the disadvantage of approach there no source control @ on file; if lose you're sol. use environment variables. use apache setenv or passenv directives pass environment variables process, retrieve them os.environ() in settings file. has advantage in in development, can set new variables (as var1=whatever var2=whatever ... ./manage.py runserver .

visual studio - Object reference not set to an instance of an object error on updating NuGet package -

hi have updated manage nuget package , vs 2013 give "object reference not set instance of object" error whenever run program. tried find solution failed. uninstalled vs , reinstall. error same on making new project. i had same issue , forced revert earlier version of nuget. v2.8.6 has imposed dependency on .net 4.5+ in point release - bad behavior imho. see nuget 2.8.6 causing dependency on .net 4.5+?

ruby on rails 4 - ec2 instance unreachable from browser with rails4 -

Image
first, read found problem still stuck, launch ec2 instance, security group port 80 open, ssh (22) , icmp (-1) i can ping ip, works well, can ssh, no problem, when wget http://localhost on instance it's working well it's rails application launch sudo rails s -p80 (to on port 80) have err_connection_refused when nstat on instance got : so guess port 80 not open have no idea how fix this. anyhelp ? thx are using rails 4.2.x? defaults listen on localhost interface. can use sudo rails s -b 0.0.0.0 -p80 tell listen on interfaces , should accessible externally.

c++ - uniqueness of struct names -

while name of structure must unique in set of structures within namespace, such name can "shared" variables , functions. example, following code compiles fine: // code 1 struct h{}; int h{ 8 }; similarly, there no collision in: // code 2 struct h{}; void h(){} 1) reasoning allow name sharing? moreover, if throw templates mix, have strange situations. code // code 3 template< class h > void h(){} struct h{}; template< class h > struct j{}; void j(){} does compile; following code fails: // code 4 struct h{}; template< class h > void h(){} void j(){} template< class h > struct j{}; 2) why reasoning allowed code 2 not enough allow code 4? not asking rules in standard. asking reason behind rules. 1) reasoning allow name sharing? according "the design , evolution of c++", bjarne stroustrup , section 2.8.2 "structure tags vs. type names", feature introduced maintain compatibility c. c language requires

html - <video> in Markdown -

using <video> in jekyll markdown parsing raw text, how can <video> work? <div class="row post-image-bg" markdown="1"> <video width="99%" height="540" autoplay loop muted markdown="1"> <source src="/images/posts/send-cancel.mp4" type="video/mp4" markdown="1" > <source src="/images/posts/send-cancel.webm" type="video/webm" markdown="1"> </video> </div> explanation you have markdown="1" attribute in every single element, tells markdown processor parse contents of element. now contents of element indented in normal html style. however, markdown parses indentation as.. guessed it: code blocks. markdown sees is: ... <video ...> ... </video> ... note 4 spaces before video tags here. stackoverflow.com , these markdown code blocks. solutions there seve

java - dynamically adding hyperlinks to rtf file in JEditorPane -

i building word processor use in multi-window media annotation tool, written in java. film students write essays , embed them links multimedia clips. i want user able highlight text in rtf document , create link media file in project. when clicked link display media in associated window. i know if possible dynamically create hyperlinks in rtf documents in java? possible in word, example. at moment using jeditorpane advanced rtf editor kit ( http://java-sl.com/advanced_rtf_editor_kit.html ). struggling find sort of solution. any or pointers appreciated. thanks edit: code, parts 1 & 3 @ eric's answer added `item3.addactionlistener(new actionlistener() { @override public void actionperformed(java.awt.event.actionevent e) { //use fx thread open filechooser platform.runlater(new runnable() { @override public void run() { filechooser filechooser = new filechooser(); filechooser.setti

jquery - I have some confidential pdf's they have to show in browser but they are not meant to downloaded by any means -

i have confidential pdf's (company policies etc.,) have show in browser not meant downloaded means... is there possible way please me... unfortunately, once show in browser, it becomes inevitably downloadable user . pdf has downloaded on remote computer in order viewable in browser . therefore, 1 go browser cache retrieve file, let alone possibility 1 save as file. keep in mind if don't want downloaded, have not share online uploading them on web-server publicly accessible (even if restricted credentials). this client request complete non-sense. need convince him requirement absurd , silly , goes against essence of internet. long story short, there no way accomplish want .

Mobile connectivity to other device ( IOS & Android ) -

i want make device can communicate mobile through local network . , can local internet access web(the internet) i want make circuit on/off room's light. want phone. how can ? like home security system, through user can see security on his/her phone . i know need device signal network sent phone, that. how can ? circuit available ( programmable ) ? , how android or phone can communicate them ? their 2 ways of doing it. you can either create socket server in system using python , execute script android or ios device. you can use apache server , code php scripts. in both ways, need interact com ports. highly recommend first recommendation.

Transfer ownership of Google Doc Add-on to another account? -

i have been developing add-on google docs using script editor inside of google docs. time has come team submit application store. submit 1 main account of our google-related apps come same place. i shared document i've been working with, account. when try "deploy docs add-on" account error not owner of script. i tried transferring ownership of actual google doc user did not help. how can transfer ownership of script account can submit it? thanks! i don't think there way transfer ownership of script bound document. can add owner developers console project, when tried didn't help. i recommend in future creating apps standalone apps script files, makes easier keep track of app , manage permissions. for right now, best bet going in script user want own it, open file menu , select make copy. create copy of script under ownership. downside may need reconfigure advanced google services using. if aren't using advanced api's might worth c

python - Why is my code running twice, crashing, and not printing stderr? Multiprocessing with output redirected to GUI -

i have code printing sys.stdout gui tkinter text widget. getting strange behavior program , can't figure out why; need troubleshooting. the biggest problem sys.stderr not printing gui or ide results. may result of how got sys.stdout go gui not knowledgeable enough diagnose whether that's case. followed code: python multiprocessing redirect stdout of child process tkinter text . may have why code apparently running twice. i have main program running gui , use multiprocessing run separate script imported module made. 1 of first things script check errors in inputs. if there's error, have give custom exception end process without closing python. exception uses tkmessagebox generate window alert user program needs attention. used print traceback gui no longer redirecting sys.stdout . anyway, when run script , gets exception, brings 2 windows. 1 looks windows-generated os message box message inside programmed. other empty white window title "tk&quo

c# - VMWare vix api - not logging in into Vitual machine -

while powering virtual machine: var virtualmachine = host.open("myvm.vmx"); virtualmachine.poweron(); virtualmachine.logininguest("administrator", "mypass"); everything gets stuck in log in screen of vm. possible somehow start vm, , have gui loaded , ready, because automated tests require gui of application present tests can fire off. pass vix_login_in_guest_require_interactive_environment logininguest. see remarks: https://www.vmware.com/support/developer/vix-api/vix17_reference/lang/com/functions/runprograminguest.html

IISExpress - Localhost - ASP.NET MVC - 403 Forbidden -

note: know has been covered multiple times on i've been through relevant posts find , have not been able find specific issue. sometimes when start debugging local mvc website, 403 error , way stop happening clean , build of solution , start debugging again. note: don't 403.?? , 403 no subcode. i've looked @ http://www.asp.net/web-pages/overview/testing-and-debugging/aspnet-web-pages-(razor)-troubleshooting-guide didn't help. note: updated 1 of pre-production servers code , have seen same thing happen on there (i had re-upload cleaned dlls). does have idea start debugging this? can see application_beginrequest being hit in global file don't know go there.

Visual Studio 2015 Express and Visual SourceSafe 2005 -

Image
i tried following instruction. still cannot sourcesafe appear in available plug in selection. https://msdn.microsoft.com/en-us/library/bb166193.aspx i have 2 computer. computer , computer b. computer has visual studio 2013 premium , visual sourcesafe 2005. , can see plug in in selection computer b has visual studio 2015 express , visual sourcesafe 2005. , see can please me how add plug in? thank you i install visual studio community 2015 (make sure use vs_community.exe) , sourcesafe option available. i using vs_desktop.exe previously. make sure select , download community edition instead of visual studio express desktop

html - How to inherit Image width and height to video tag -

image has width 400x400 per real image property. have sibling video should have same width , height of image. how can inherit image width , height property video tag html: <div id="holder"> <img src="http://placehold.it/400x400" > <video controls=""> <source src="mov_bbb.mp4" type="video/mp4"> browser not support html5 video. </video> </div> css: #holder { position: relative; } #stuff { position: absolute; top: 0; right: 0; bottom: 0; left: 0; } http://codepen.io/snehav27/pen/mjoypo turn stuff class , put div class="stuff" around video #holder { position: absolute; height:400px; width:auto; } .stuff { position: absolute; height:inherit; width:inherit; top: 0; right: 0; bottom: 0; left: 0; } .stuff video{position:absolute; height:inherit; width:inherit; vertical-align:top;}

android - Convert English numbers in a String to Arabic numbers -

i have multiple strings different formats need display in textviews. have no control on length or format of these strings. have numbers obly, text only, or combination of both. my goal display strings in textviews, , in process, convert english numbers arabic numbers. the following examples should clarify mean: original string >> converted string ===================================== test 123 >> test ١٢٣ test >> test 123 >> ١٢٣ i started doing this: txtview.settext(string.format(locale, "%d", fulltext)); but assumes have numbers in fulltext string. could suggest how work around this? lets fulltext string this string fulltext = "1a2b3c"; replace instances of of numbers corresponding arabic numbers fulltext = fulltext.replace("1","١").replace("2","٢").replace("3","٣"); etc. mean

java - Jackson ObjectMapper - readValue fails when target object has a Map field -

i guess might have been asked earlier, not find looking for. here goes. my json looks - { "verticals": [ { "name": "vertical1", "icon": "icon1", "children": [] }, { "name": "vertical2", "icon": "icon2", "children": [] } ], "config": { "vertical1": [ { "title": "section1", "icon": "icon1", "prefs": [ { "type": "type1", "opts": [ { "name": "pref_store_key", "value": "filter-prefix-food" } ], "icons": [

html - Can't remove white space between header and navbar when using Materializecss -

i using materializecss framework materializecss.com. have simple image place above navbar materializecss , there small white space. checked source , there no margin, padding or border @ all. space goes away if put navbar above image not sure problem is. <img id="header" src="/public/images/header.gif" alt="header"/> <nav class="grey darken-4"> <div id="navbar" class="nav-wrapper"> <ul id="nav-mobile" class="hide-on-med-and-down"> <li><a href="#">profile</a></li> <li><a href="#">skills</a></li> <li><a href="#">projects</a></li> </ul> </div> </nav> i not using other css besides materializecss css file. ideas? don't think css has margins anywhere don't see when viewing source of elements. edit: here jsfi

Does the dill python module handle importing modules when sys.path differs? -

i'm evaluating dill , want know if scenario handled. have case import module in python process. can use dill serialize , load module in different process has different sys.path doesn't include module? right import failures maybe i'm doing wrong. here's example. run script foo.py module's path in sys.path: % cat dill_dump.py import dill import foo myfile = "./foo.pkl" fh = open(myfile, 'wb') dill.dump(foo, fh) now, run script not have foo.py's directory in pythonpath: % cat dill_load.py import dill myfile = "./foo.pkl" fh = open(myfile, 'rb') foo = dill.load(fh) print foo it fails stack trace: traceback (most recent call last): file "dill_load.py", line 4, in <module> foo = dill.load(fh) file "/home/b/lib/python/dill-0.2.4-py2.6.egg/dill/dill.py", line 199, in load obj = pik.load() file "/rel/lang/python/2.6.4-8/lib/python2.6/pickle.py", line 858, in load

c = a + b and implicit conversion -

with compiler, c 54464 (16 bits truncated) , d 10176. gcc , c 120000 , d 600000. what true behavior? behavior undefined? or compiler false? unsigned short = 60000; unsigned short b = 60000; unsigned long c = + b; unsigned long d = * 10; is there option alert on these cases? wconversion warns on: void foo(unsigned long a); foo(a+b); but doesn't warn on: unsigned long c = + b first, should know in c standard types not have specific precision (number of representable values) standard integer types. requires minimal precision each type. these result in following typical bit sizes , standard allows more complex representations: char : 8 bits short : 16 bits int : 16 (!) bits long : 32 bits long long (since c99): 64 bits note: actual limits (which imply precision) of implementation given in limits.h . second, type operation performed determined types of operands, not type of left side of assignment (becaus assignments expressions). types give

c++ - opencv face detection loop parameters -

i need explanation of following loop face detection in opencv videocapture capture("dsc_0772.avi"); //-1, 0, 1 device id mat cap_img,gray_img; vector<rect> faces, eyes; while(1) { capture >> cap_img; waitkey(10); cvtcolor(cap_img, gray_img, cv_bgr2gray); cv::equalizehist(gray_img,gray_img); face_cascade.detectmultiscale(gray_img, faces, 1.1, 5, cv_haar_scale_image | cv_haar_do_canny_pruning, cvsize(0,0), cvsize(300,300)); for(int i=0; < faces.size();i++) { point pt1(faces[i].x+faces[i].width, faces[i].y+faces[i].height); point pt2(faces[i].x,faces[i].y); rectangle(cap_img, pt1, pt2, cvscalar(0,255,0), 2, 8, 0); } i don't understand faces[i].x , other loop parameters how selected face detection thanks help faces std::vector of rect . loop going through each rect in vecto r , creating 2 points. rect stores not x , y(of top left corner) height , width of rect

css - Making the leaflet layer control panel responsive with javascript -

i have many lines on leaflet layer control, such spills beyond page. how can below using javascript? .leaflet-control-layers { overflow: auto; } what i've tried this answer var controls = l.control.layers(null,overlaymaps,{collapsed: false}); controls.addto(map); controls.style.overflow="auto"; i got controls didn't have style attribute the second answer same question document.getelementbyid("leaflet-control-layers").style.overflow="auto"; nothing happens not sure got this, guess jquery wasn't being used in map $(".leaflet-control-layers").style.overflow="auto"; since printed referenceerror: $ not defined console. from accepted answer modify css classes using javascript var layercontrols = document.queryselectorall('.leaflet-control-layers'); for(var i=0; i<layercontrols.length; i++){ layercontrols[i].style.overflow="auto"; } (nothing happens)

filepath - How to change Android SDK Manager file path -

Image
i have serious disk size limitations (~64gb) need android sdk installed on disk. changed file path installation of android studio , android sdk. when start android sdk manager says sdk path on small disk (default os disk) in appdata: "c:\users\username\appdata\local\android\android-sdk". how can change this? one answer suggests changing android studio file paths in there correct. yeah got same problem if open sdk manager @ new location of path ,it set , easy use sdk manager in android studio itself. can use eclipse launch new sdk manager setting path.

css - How to customize navbar in mvc bootstrap (width) -

Image
i want customize navbar equal size container below: <div class="container jumbotron row col-sm-12" style="width: 100%; margin: 0px auto;"> <h1>asp.net</h1> <p class="lead">asp.net free web framework building great web sites , web applications using html, css , javascript.</p> <p><a href="http://asp.net" class="btn btn-primary btn-lg">learn more &raquo;</a></p> </div> i've tried everything, changed every div , none of works, wondering doing wrong. picture precise mean: you can rearrange containers, don't need 1 jumbotron. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.

node.js - Hosting API generated using loopback.io to Azure using IISNode -

so trying undocumented. built simple rest api using loopback.io in nodejs , want host azure websites. forked https://github.com/strongloop/loopback-getting-started , followed steps described on https://azure.microsoft.com/en-us/documentation/articles/web-sites-nodejs-develop-deploy-mac/ i able push files , deployment not sure how iisnode start application, because server.js located under /server/server.js iisnode fails find server.js @ root , doesn't create web.config. i came across point iisnode @ server.js file nested in folder in iis website unable make work locally well. tried create server.js on root level contents require(__dirname + '\\server\\server.js')(); noticed loopback starts application "node .", inferred uses main module define in packages.json changed main module location "/server/server.js" "server.js" { "name": "sample", "version": "1.0.0", &q

jquery - How to use the `.prop ` values for multiple elements -

how use .prop value multiple elements. .prop works fine first element. var cursorposition = $('.show1').prop("selectionstart");** thanks in advance. try following solution looping through rows class show1 : $(function(){ $('.show1').each(function(){ var cursorposition = $(this).prop("selectionstart"); // `cursorposition` }) })

python - Migrate Flask models.py to MySQL -

i'm new. bear me. i'm developing flask application using sqlalchemy orm , until today have been using sqlite convenience. i'm putting application live on digital ocean , want use mysql instead of sqlite. i have mysql installed on ubuntu vps on digital ocean , seems configured properly. however, have create database tables, can save data inside. question: there way me migrate models.py, database tables created have written in models.py or have create database tables myself manually in mysql? you can see application live here: http://workflowforum.dk/ , have made small test see if there database connection here: http://workflowforum.dk/testdb models.py (only user model): from flask import flask flask.ext.sqlalchemy import sqlalchemy flask.ext.script import manager flask.ext.migrate import migrate, migratecommand datetime import datetime, date hashlib import md5 bcrypt import hashpw, gensalt app = flask(__name__) app.config['sqlalchemy_database_uri'

c++ - Calling the event handler programmatically in an MFC application -

i working on mfc application (c++) my checkbox has event hander mapped on_bn_clicked . works fine when user check/uncheck box, i.e. event handler called. however, when check box programmatically: ((cbutton *)this->getdlgitem(x))-> ->setcheck(1); event handler not called. what should in order call event handler programmatically? this normal behavior. wm_command sent when "click" or "user entry" changed button. this not contignous child controls. other child controls edit control send wm_command en_change message when setwindowtext executed program (the mfc blocks message in dodataexchange).

Angularjs two directives on one textbox -

i have 2 directives in single textbox. 1 datetimepicker , focus directive. datetimepicker : app.directive('datetimepicker', function() { return { restrict: 'a', require : '?ngmodel', link: function(scope, element, attrs, ngmodelctrl) { element.datetimepicker({ format: "yyyy-mm-dd hh:ii:ss", autoclose: true, todaybtn: true }).on('setdate', function(e) { ngmodelctrl.$setviewvalue(e.date); scope.$apply(); }); } }; }); focus : app.directive('focus',function($timeout) { return { restrict: 'a', scope : { trigger : '@focus' }, link : function(scope, elem,attrs) { var focusables = $(":focusable"); scope.$watch('trigger', function(value) { if (value === "true") {

SQL SELECT statement in PHP -

which 1 correct? having trouble single quotes vs double quotes in php , using oracle 11g db... <?php $query1 = oci_parse($conn, 'select * schema.table_a b_id=' . $id); $query1 = oci_parse($conn, "select * schema.table_a b_id='" . $id . "'"); ?> if id numeric, should not quote value. if it's character string, should. regardless, using string manipulation create sql statement bad practice leaves application vulnerable sql injection attacks. instead, should use prepared statement: $query1 = oci_parse($conn, 'select * schema.table_a b_id=:id'); oci_bind_by_name($query1, ":id", $id); oci_execute($query1);

java - Missing tiles in osmdroid -

i've got app uses osmdroid 4.3. mode use offline. app can not render few tiles. seems missing tiles. if zoom in or zoom out, new tiles missed. following osmdroid faq , disabled hardware acceleration map activity in manifest using android:hardwareaccelerated="false" but nothing happens. tiles still missing. do? i suspect that: 1) still have tiles in osmdroid cache, older online sessions 2) offline file not working @ all. in situation, tiles when exist in old cache, , nothing when don't => missing tiles. first of all, delete osmdroid/tiles sub-directory. then closely follow this post .

WSO2 API Manager (1.9.0) - Set Expire Date/Validity Time Via cURL -

when using wso2 via store possible set validity time, access token expire time can increased/decreased. is possible set validity time via curl when generating new token? e.g. normal token generation command: curl -k -d "grant_type=client_credentials" -h "authorization: basic usertoken, content-type: application/x-www-form-urlencoded" localhost:8243/token {"scope":"am_application_scope default","token_type":"bearer","expires_in":1367,"access_token":"1234456677890"} possible token generation command setting validity time: curl -k -d "grant_type=client_credentials" -d "validity_time=99999" -h "authorization: basic usertoken, content-type: application/x-www-form-urlencoded" localhost:8243/token {"scope":"am_application_scope default","token_type":"bearer","expires_in":99999,"access_token":"

javascript - Google Maps JS API v3 - UrlAuthentication -

last few days testing google maps js api on localhost without issues. today started getting error urlauthenticationcommonerror: https://developers.google.com/maps/faq#errorcodes frankly error not described on url. guess url authentication (i know, genius). included localhost in allowed referrers. error still here. than uploaded site on azure. included url in allowed referrer , still nothing. same error again , again. unfortunately google not helpful. just in case code. direct copy/past demo page. same exact code working yesterday not today function init(params) { var mapoptions = { center: { lat: -34.397, lng: 150.644}, zoom:8 } var map = new google.maps.map(document.getelementbyid("map"), mapoptions) } <html> <head> <title>proto wars</title> <style> html, body, #map { height: 100%; margin: 0; padding: 0;} </style> </head> <body> <script type="text/javascript&qu

Update CSS of Pseudo Element with jQuery -

i've spotted number of posts stating can't manipulate pseudo element jquery i'm looking workaround? i'm looking run a/b split test in optimizely on our site search bar. design of current search bar has css creates search icon using ::before pseudo element place glyph-icon button start search. as test wanted change colour of icon. optimizely allows use jquery target elements , make these types of changes. the current css looks this: .header .form-search button:before, .header .form-search .search- button:before { content: "\f002"; font-family: "polar-icons"; color: #237cb2; font-size: 1.8rem; } this jquery attempting implement didn't work: $(".search-button::before").css({'color':'#e93826'}); any appreciated. try: $('head').append('<style>.search-button::before{color:#e93826 !important}</style>');

javascript - How do I integrate lazyload & bxslider together? -

i want lazily load images in bxslider (or slider control, allows dynamic number of slides/images). i'm using lazyload loading images lazily, images in slider isn't loading lazily. images getting loaded pages :|. here code, <link href="jquery.bxslider.css" rel="stylesheet" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="jquery.bxslider.js"></script> <script src="jquery.lazyload.js"></script> <script type="text/javascript" charset="utf-8"> $(function() { $(":not(#hcontainer) img.lazy").lazyload({ effect: "fadein" }); $("img.lazy").lazyload({ effect: "fadein", container: $("#hcontainer") }); $('.bxslider').bxslider({ minslides: 1, maxslides: 3, slidewidth

ios - CoreAudio based app stops playing if any UI is added in app -

i have coreaudio based player streams remote mp3s. it uses nsurlconnection retrieve mp3 data -> uses audioconverter convert stream pcm -> , feeds stream augraph play audio. the player works fine in demo app(it contains play button), when add player project, when coupled project makes networking calls, , updates ui, player fails play audio past few seconds. am possibly experiencing threading issue? preventative approaches can take or can prevent happening? you not mention in software architecture buffering data between receiving via nsurlconnection , when send player. data arrive in chunks inconsistent arrival rates. please see these answers posted regarding buffering , network jitter. network jitter and network jitter , buffering queue in nutshell, can receive data , send player because next data may not arrive in time. you don't mention rate mp3 file delivered. if delivered on fast connection... buffering of data received or getting los

getting lock wait timout when calling mysql proc from java -

i have below proc: create procedure updatepath() begin declare cnt, n int; update foo set a.path=a.name a.parent_id null; select count(*) cnt foo path null; while cnt > 0 update foo a, foo b set a.path = concat(b.path, '/', a.name) b.path not null , a.parent_id = b.id; select row_count() cnt; end while; end; ;; when call proc mysql workbench below: call updatepath(); executes in few milliseconds. when run same code java program takes enormous amount of time , have kill java process. code calling proc below: { jdbctemplate.execute( new callablestatementcreator() { public callablestatement createcallablestatement(connection con) throws sqlexception { callablestatement cs = con.preparecall("{call updatepath()}"); return cs; } }, new callablestatemen

Add values of previous rows for column jquery -

i trying add values of previous rows in column click using jquery. @ moment have following code : $( document ).ready(function() { $('td').click(function() { var col = $(this).parent().children().index($(this)); var row = $(this).parent().parent().children().index($(this).parent()); console.log('row: ' + row + ', column: ' + col); var val1=0; var val2=0; var t = document.getelementbyid('hours'); (i = 1; < row; i++) { var val1=$(t.rows[i].cells[col]).text(); console.log('row: ' + + ', column: ' + col); console.log($('#hours tr:eq('+i+') td:eq('+col+')').text); val2 += number(val1); } }); }); i've got right column having trouble pulling values. table id : hours http://jsfiddle.net/biggrecian/0cc2k2zg/ replace for (i = 1; < row; i++) with for( = 0 ; i<row ; i++) because otherwise ignores first row i sugge

javascript - If submenu li has more than 5 li's create a new ul and place remaining list items? -

Image
i trying check if submenu has more 5 list items, , if grab remaining list item's , place them inside new ul outside of current parent ul using jquery. gets complicated because of structure of list. here dom structure: <ul id="nav" class="se test"> <li id="menu1" class="page-1307 parent-menu parent"> <div class="nav-inner"> <a class="menulink" id="menuitem1" onclick="return false" href="#">test<span class="toggle"></span></a> <ul id="ie1" class="plain"> <li class="parent-menu parent"><a href="test">test<span class="toggle"></span></a> <div class="submenu-wrapper"> <ul class="plain"> <li><a href="test">test&l

c# get rectangle bounds from image -

Image
lets have image i find black rectangle bounds(right,left,width,height) in image(lets there's no other black pixels in image). code far is: private unsafe bitmap getdiffbitmap(bitmap bmp) { bmdata = bmp.lockbits(new rectangle(0, 0, bmp.width, bmp.height), system.drawing.imaging.imagelockmode.readonly, bmp.pixelformat); intptr scan0 = bmdata.scan0; int stride = bmdata.stride; int nwidth = bmp.width; int nheight = bmp.height; for(int y = 0; y < nheight; y++) { //define pointers inside first loop parallelizing byte* p = (byte*)scan0.topointer(); p += y * stride; (int x = 0; x < nwidth; x++) { //always complete pixel when differences found if(p[0]==0 && p[1]==0 && p[2]==0) { // p[0] =

php - Sum of all values on key with different arrays -

below 5 arrays. idea count values matching keys. , keep single appearances. these should appear in new array. so, 14855 should have value 6, , 101 value 7 etc. $arr_one = array ( [14638] => 5 [14855] => 5 ) $arr_two = array ( [101] => 4 [10141] => 4 [1015] => 4 [1020] => 4 [10353] => 4 [1048] => 4 [10582] => 4 [1060] => 4 [10675] => 4 [1068] => 4 [1084] => 4 [1098] => 4 $arr_three = array ( [101] => 3 [10141] => 3 [602] => 3 [341] => 3 [3523] => 3 [922] => 3 [2099] => 3 [7305] => 3 [222] => 3 [537] => 3 [2792] => 3 $arr_four = array ( [10141] => 2 [1232] => 2 [10909] => 2 [129] => 2 [155] => 2 [] => 2 [156] => 2 $arr_five = array ( [14855] => 1 [96] => 1 [120] => 1 [129] => 1 [155] => 1 [156] => 1 is there way this, , option can add more arrays later well? hope can me brainteaser me! this challenged question, @ same time nasty 1 ;) i enjoyed 3 hours w