Posts

Showing posts from March, 2014

jquery - how to animate from left to right? -

demo : animates right left movement.but need use animation left right . basically, i'm using script: var counter = 1; var thisw = $('.btn.close').parent().outerwidth(); var thish = $('.btn.close').parent().outerheight(); $('.btn.close').on('click',function(){ counter = !counter; if(counter){ $(this).parent().animate({width: '5em', height: '2em'},1000); } else{ $(this).parent().animate({width: thisw, height: thish}, 1000); } }).click();//click trigger added because on first click doesn't animate //the reason is not getting actual width , height value set in em jquery px value. i think script can written better using ternary operator. i'm stacked on this. question: so what's better way write jquery of above code? is possible animate left right without using position absolute? use this:

android - popup dismiss on touch outside of popup -

i have 2 layouts 1 layout 80% of screen , other 20% of screen(lanscape mode), on 20% of screen layout have few buttons vertically.on click of each button popup window come on 80% screen layout,on touch outside popup window, popup window dismiss. problem on touch 80%screen popup should dismiss not on 20% screen. ref_channel.setonclicklistener(new onclicklistener() { @suppresswarnings("deprecation") public void onclick(view v) { display display = getwindowmanager().getdefaultdisplay(); point size = new point(); display.getsize(size); width_device = size.x; x = (width_device - ref_channel.getwidth()); layoutinflater = (layoutinflater) getbasecontext() .getsystemservice(layout_inflater_service); popupview = layoutinflater.inflate(r.layout.refchannel_popup, null); popu

Ideal Replication Filter for JSON based Databases Like Couchbase, CouchbaseLite, CouchDB, etc.? -

i write filter function on couchdb server side to filter documents specific user . filter allow replication few selected documents particular user has access rather whole database of tbs of size. here found similar question couchdb: restricting users replicating own documents not provide me info need. so questions remain: what can best approach specify such filter? how should write such filter function, written example? what should include in every doc filter work way: in context of social network, suppose want fetch user data pictures server, in case document containing pictures holding userid in it. can case when friends of person visit profile , able view photos. in case whenever friend visits profile picture doc replicated friend , able view pictures also. how can accomplish such filter? more info : on mobile platform side using couchbaselite , on server side using couchdb. want filtered documents on mobile platform. a couchdb filter function has acc

javascript - How to set a value of hyperlink text from a hyperlink to a hidden field on a jQuery dialog pop-up when user clicks on that hyperlink? -

i'm using php, smarty, jquery(jquery-1.7.1.min.js), javascript, ajax, etc. in website. there multiple hyperlinks containing different question ids present on webpage. instance i'm showing html code 1 hyperlink follows: <a class="que_issue" href="#">que38552</a> <!--there many other hyperlinks present on same page different question ids.--> now i've html code dialog pop-up on same web page set style="display:none;" in div when page loads. done hide dialog box when page loads. when user clicks on of hyperlinks dialog pop-up appears. script functionality working fine. html of dialog pop-up follows: <div id="searchpopcontent" class="c-popup" style="display:none;"> <div id="pop-up"> <div class="error_msg" id="report_error" style="text-align:center; margin-top:5px;"> </div> <div class="clear"></di

go - Traversing nested JSON structs -

i want traverse nested json struct , each key , value interface{} http://play.golang.org/p/b-b3pejgjw so want following struct { "tg": { "a": { "e": 100, "h": 14 }, "b": { "d": 1 }, "c": { "d": 1, "e": 1 }, "d": { "f": 1, "g": 1, "h": 1 }, "e": { "g": 1 } } } i able following a := js.get("tg").get("d").get("f") fmt.println(*a) // {1} but having trouble type assert integer. invalid type assertion: (*a).(int) how would traverse whole struct , each integer mapped characters? thanks! your value

Javascript: window.saveAs in android Webview -

i using code save client-generated png files: my_canvas.toblob (function (blob) {window.saveas (blob, my_filename)}, 'image/png') i'm using these cross-browser compatibility: javascript canvas blob 2.0.5 sebastian tschan, https://github.com/blueimp/javascript-canvas-to-blob . filesaver.js eli grey, http://eligrey.com . works in ie10+, chrome, firefox, chrome android, breaks down in base web view engine in 4.3. since i'm trying lightly use phonegap here , make compatible non-new current devices mobile, need work in android webview 4.3, @ least. q & a: q: how break down? a: sends me non-existent url instead of making image , opening it. i've had many problems canvas, blobs , old versions of android. on version have use blobbuilder, on others webkitblobbuilder (on versions blobbuilder there not correctly implemented), canvas.todataurl not present before android 3 , not work correctly before 4.x... for reasons used canvas2imageplugi

php - getting data from database as a json response -

here trying data database , want display json response user can fetch each field. here how user can perform query http://localhost/safari/index.php?getbranch=true this should give branch details tables. here php code it <?php if(isset($_get['getbranch'])) { $getbranch = $_get['getbranch']; if($getbranch == 'true') { getbranch($getbranch); } } function getbranch($getbranch) { $con = mysqli_connect('127.0.0.1', 'root', '', 'safari'); if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); return; } $today = date("ymd"); $result = mysqli_query($con,"select division, branch,branchofficename,branchofficecode,status tbl_branchoffice"); while ($row = @mysqli_fetch_array($result)) { $res

mysql - Retrieving mutiple row data from sql by php executed under joomla -

i have sql query working fine. after execution (php form in joomla inserted sourcerer plugin) resulting array stays empty. sql code: select `comid`,`comname`,`comlogo` ffd_companies,ffd_comusercon,ffd_users companyid=comid , userid=id , id=1; code in joomla->customhtmlmodule->sourcerer: {source} <?php $user = jfactory::getuser(); echo $user->id; $db = jfactory::getdbo(); $query = $db->getquery(true); $query->select($db->quotename(array('comid','comname'))); $query->from($db->quotename(array('ffd_companies','ffd_comusercon','ffd_users'))); $query->where($db->quotename('companyid').' = '.$db->quotename('comid').' , '.$db->quote('userid') .' = '. $db->quote('id').' , '. $db->quote('userid') .' = '.$db->quote($user->id)); $db->setquery($query); $row = $db->loadrowlist(); print_r($row); ?>

android - Dragging objects using ACTION_MOVE -

i trying make drawn sprites dragable little game. should able touch anywhere , sprites should move same distance, finger moves. with following method move on action_move event, slow, shorter distance , dont: addtox/y adds gap coordinates of sprites @override public boolean ontouchevent(motionevent evt){ switch(evt.getaction()){ case motionevent.action_down: break; case motionevent.action_move: if(gethistorysize() > 0){ for(int = 1, n = evt.gethistorysize(); < n; i++){ int calcx = (int) gethistoricalx(i) - (int) gethistoricalx(i-1); int calcy = (int) gethistoricaly(i) - (int) gethistoricaly(i-1); for(sprite sprite : spritelist) { sprite.addtox(calcx); sprite.addtoy(calcy); } } } return true; } any ideas on this? assuming sprite class (potentially-indirect) extension of android.view.view , ca

Azure copyBlob Node.js API Error -

does use copyblob node.js api copy blob 1 container other? tried use copyblob api in server scripts, gives me error such "error: container name format incorrect." my code structure this: blobservice.copyblob(uri, containername, blobname, function (error) { if (error != null) { console.log(error); } else { request.respond(); } }); my code provided below: 10 var blobservice = azure.createblobservice('mystorage', accountkey, 'mystorage.blob.core.windows.net'); 11 12 blobservice.copyblob("http://mystorage.blob.core.windows.net/e0f57621-20a3-4e17-b418-c0139c6daef8/myimage.jpg", "container1", "myimage.jpg", function (error) { 13 if (error != null) { 14 console.log(error); 15 } else { 16 console.log("success"); 17 } 18 }); and error message received is error in scrip

java - How to kill a process running on server -

i using run_command shell program run commands on servers client machine, shell program runs particular command on server socket communication. in server side use java program run command on server, commands ls , pwd working , commands "tail -f" though pressing ctrl^c stop command, not stopping in server side. is there way to capture ctrl^c send msg kills running command on server to kill command on server , how can kill particular command run client not other use kill command. more information please refer url kill command unix

java - Modifying installed apps permissions (Android) -

i want develop application android to: list installed applications in phone. show list of permissions granted each app. have ability disable permission granted specific app or enable later on. till have done first 2 points. searched web know how modify permissions couldn't find useful. so can give me clue on how implement ? because think doable since there apps can modify permissions (e.g. permission manager). there various apps in play store call permission manager i'm not sure 1 have looked at. at least 1 of them works pulling installed app apart, , reforming changed androidmanifest file (and since don't have access original private key, new signature). run reformed app have uninstall old one, , install new one, has 2 significant downsides all data of old app lost since have effective pirate version of app, app no longer update new versions play store. other apps claim manage app permissions expose hidden app ops permission screen in andro

how could this git "merge commit" can have 1 parent only -

we had issue strange merge happened branch master saw conflicts should never have been there. i found root cause of problem: "merge commit" wasn't one. mean: commit message, looked merge commit: merge remote-tracking branch 'origin/master’ branchname conflicts: file1 file2 the problem? commit had 1 parent! so, i'm pretty sure person created commit didn't type hand. came real merge commit @ point. but how did end 1 parent? rebased? that's possibility, since person did has "pull --rebase" set default. can't reproduce problem. any ideas?

ios - How to run the same block of code - Cocos2d -

i using cocos2d , have 2 ai sprites called theevilone , theeviltwo. these 2 sprites call same bloc of code same class sending sprite parameter. game gets buggy run code 1 of sprites preforms actions , code stops working. question is possible call same bloc of code multiple sprites simultaneously or there wrong code. below example of running on program. -(void)loadingevilactions:(id)sender { //this getting called if(loaded == no) { theevilone = [ccsprite spritewithfile:@"evil_alt_idle_00.png"]; //these sprites have been declared in .h file [self addchild:theevilone z:200]; theeviltwo = [ccsprite spritewithfile:@"evil_alt_idle_00.png"]; [self addchild:theeviltwo z:200]; loaded = yes; } [self checkcollision:theevilone]; [self setcenterofscreen:theevilone]; [self stayonscreen:theevilone]; [self aicharacter:theevilone]; [self checkcollision:theeviltwo]; [self setcenterofscreen:theeviltwo]; [self stayonscreen

android - InflateExceptionError- line 40 -

so every time switch 1 activity has listview component, keep getting inflateexception when tries load list view. here code activity list view: public class userindexactivity extends activity { private accountdao accountdatasource; public static final string prefs_name = "mypreferencefile"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_user_index); accountdatasource = new accountdao(this); accountdatasource.open(); sharedpreferences settings = getsharedpreferences(prefs_name, 0); string userid = settings.getstring("userid", "default"); list<account> acclistquery = accountdatasource.getallaccounts(userid); list<string> list = new arraylist<string>(); for(account : acclistquery) list.add("account name: " + a.getdisplayname() + " \t b

email - IMAP/POP Service with API -

i work web design company , we're looking streamline provision , changes of email hosting organise our customers. we'd use api can create postoffice (users@domain) , add/edit/delete users forwarding/aliases etc. etc. anyone come across hosting company provides imap/pop services featured api? i suspect going heavily dependent on email service you're using. example, google apps offers email management part of admin sdk api: https://developers.google.com/admin-sdk/email-settings/ if you're looking full-fledged email service, google apps may it. however, it's bit spendy: http://www.google.com/enterprise/apps/business/pricing.html other alternatives might check out fusemail: https://www.fusemail.com/support/api-documentation/requests if you're self-hosting , don't mind cpanel, have api well: http://docs.cpanel.net/twiki/bin/view/apidocs/api2/apiemail#email::addforward

plpgsql - Postgresql CREATE TABLE AS INSERT RETURNING -

i trying perform like create temp table tblname ( insert tbl2 select(1,1) returning a,b ); but i've got error: syntax error @ or near "insert"; is possible combine create table select , insert select returning clauses? create temp table tblname ( insert tbl2 (a, b) select 1, 1 returning a,b ) select a, b

java - can't insert utf-8 characters in mysql database using crontab to automate the program -

Image
i had asked question before because didn't receive guide, i'm asking again. here's original question: fail insert non-english characters database using crontab run program i wrote java program reads utf-8 file , insert contents mysql database. can call jar file in terminal , works fine. after used crontab automate running program time english chars , numbers insert db. my database encoding "utf8-general-ci" , server i'm running program centos 6.3. i should mention have program functionality similar , works fine. i have tested many things none of them fixed problem. don't know what's problem. i'm looking solution or clue continue , solve problem. i'll appreciate help. edit: mysql version :5.1.69 and here 2 images. 1 time run program crontab , other when running program in terminal i'm not realy expert on here goes nothing. think related what's documented in http://dev.mysql.com/doc/refman/5.6/en/alter-table

Open 2 windows of team explorer in visual Studio 2012 Ultimate -

is possible open 2 team explorer windows in visual studio? i want have pending changes , work item windows open in tabs, server explorer , team explorer opened. thank you! you can't open multiple team explorer windows, in visual studio 2013 can undock pending changes , builds tabs using breakout button in top right. more information here: http://blogs.msdn.com/b/bharry/archive/2013/11/03/team-explorer-everywhere-2013-is-available.aspx

html - @media query responsive CSS diplay table to block or inline disappearing with small screen -

in example responsive css, display:table block or inline makes div's disappear. updated: simplified code: http://jsfiddle.net/sebababi/434ja/1/ @media(max-width:767px){ #sidebar, #map_canvas, #main, #header,#nav { display:block !important; } } updated: shouldn't disappear, instead should act div blocks, , pile up. so, doing wrong. when check console, says still display:table. once media rule kicks in , removes table display, position: absolute kicks in , moves elements off screen. remove position: absolute or this: @media screen , (max-width:767px){ #sidebar, #map_canvas, #main, #header,#nav { display:block !important; position: static; } }

How to play an audio file continuously in java? -

i making small program needs play file continuously. following code wrote play file once, not aware how continuously. please. public class tanpuraaudio { audiostream = null; string filename = "c://s.wav"; inputstream in = null; public void play() throws ioexception, interruptedexception { try { in = new fileinputstream(filename); } catch (filenotfoundexception e) { system.out.println("media file not present in c drive."); } try { = new audiostream(in); } catch (ioexception e) { } audioplayer.player.start(as); } public void stop() throws ioexception, interruptedexception { audioplayer.player.stop(as); } } you may looking clip.loop_continuously , illustrated in playing clip .

How to open AccessibilityService by default in Android -

how open accessibilityservice default in android ? don't know how . <service android:name=".notificationfetcherservice" android:permission="android.permission.bind_accessibility_service" > <intent-filter> <action android:name="android.accessibilityservice.accessibilityservice" /> </intent-filter> <meta-data android:name="android.accessibilityservice" android:resource="@xml/haotingmetadata" /> </service> <accessibility-service xmlns:android="http://schemas.android.com/apk/res/android" android:accessibilityeventtypes="typenotificationstatechanged" android:accessibilityfeedbacktype="feedbackallmask" android:notificationtimeout="200" /> accessibilityservices can headless (no ui), if mean how "start" service, short answer is: can't. th

export wordpress posts in xls or csv format within a specified date range -

i have wordpress site has lot of posts , want export posts in xls or csv format within specified date range. there calendar option shows posts no export functionality. there tools export in xml format. i found various plugins export posts in xls format none of them lets me filter date range if using wordpress version 3.5.2 can try use plugin. http://wordpress.org/plugins/export-to-text/ even using updated version can check once.

r - <-, [[<-, $<- and := with environments -

i curious know if behavior of data.tablea respect environments inconsistent. when working data.tables, expectation assigning new variable data.table not copy data makes new pointer existing table. not appear true true when source data.table exists in environment. example, > attach( new.env(), name="dt" ) > e <- as.environment("dt") > > assign( "mydata", data.table( x=1:3, y=1 ), e) > mydata x y 1: 1 1 2: 2 1 3: 3 1 > ls() [1] "e" if try , assign new name mydata , don't expected behavior of having pointer same data. mydata2 <- mydata # makes _copy_ mydata2[['y']] <- 5 # change data identical( mydata2, mydata ) > false mydata2 not point (the same value) mydata . has made copy. not have expected data.table . expect data.tables behave more singletons in 1 copy of data exists unless explicit copy made. in addition, $<- , [[<- cause copies made on global environment

How to find Difference between to time durations in java? -

please me on this. i had 2 duration times in string format: ex: "10" , "0.30"(actually there in minutes) i parsed values double , find find difference? but getting output 9.7 wrong want 9.30.. please suggest thanks in advance! you can use joda-time library.use period class can difference between 2 times in terms of hours , minutes.for example refer second answer question

vb.net - Error converting string to Custom Date Format -

in application got error when trying convert date string date format shown below: dateformat = format(cdate("2014-mar-06"), "mm/dd/yyyy") error conversion string "2014-mar-06" type 'date' not valid this problem comes when region , language setting spanish(mexico) (or spanish not others) in windows 7 . problem , how solve this? avoid vb6 functions ctype , use .net methods tryparse instead. cultureinfo.invariantculture gets cultureinfo object culture-independent (invariant) try this dim datestring = "2014-mar-06" dim datevalue datetime if datetime.tryparseexact(datestring, _ "yyyy-mmm-dd", cultureinfo.invariantculture, _ datetimestyles.none, datevalue) dim mydate = datevalue.tostring("mm/dd/yyyy") 'your date stored in mydate else 'unable parse datestring end if

c - using getenv and env doesn't give the same results: -

i have c program prints every environmental variable, name given stdin. prints variables such $path, $user doesn't see environmental variables defined myself in linux shell... instance, in ~.bashrc exported mytest=test_is_working, sourced bashrc (source ~/.bashrc). expected program return test_is_working getenv doesn't. #include <qcoreapplication> #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { qapplication a(argc, argv); char* my_env= getenv("mytest"); if(my_env!=null){ printf("my env : %s \n", my_env); } else { printf("can't find env \n"); } return a.exec(); } it return : can't find env while when open terminal , enter “env”, have mytest=test_is_working i saw similar post: using getenv function solution launch program shell. can't because i'm running , debugging in qtcreator. i don't know i'm in wrong, explain me? tha

Mirror Eclipse P2 with dependencies ... how? -

we mirror eclipse update site completely, dependencies mirrored completely. at moment creating mirror of update site, can use mirror in network, has no access internet. when want download , install plugins of mirrored update site, error eclipse can not resolve dependencies, because these dependencies on different repository in internet. is there possibility create mirror ant, dependencies downloaded automatic? how doing mirroring? mirror whole updatesite can do: path\to\eclipse.exe -nosplash -application org.eclipse.equinox.p2.metadata.repository.mirrorapplication -source {original location} -destination {destinationofnewrepo} of course these commands made local repositories. upload them updatesite. hope helps

find pages that have been 'redirected' on mediawiki -

i have many redirect pages on wiki. hidden search default, way admin see list of them. how can that? there special page called special:listredirects that. the list limited 1000 redirects, wikimedia wikis can show 5000 results, there seem exist way around limitation.

github - Multiple Proxy in Gradle -

currently developing small poc. project in github. want simultaneously work home pc , office pc. office network runs behind proxy. have mentioned proxy configuration in gradle.properties file. now while running home pc gradle failed download dependencies due proxy. home pc doesn't have proxy configuration. i have workaround of issue commenting out proxy configuration in properties file. but there permanent solutions application automatically detect , choose corresponding proxy settings. if these different machines, can declare proxy settings in per-user properties file ( user_home/.gradle/gradle.properties ). if it's same machine, can use tool switches out user_home/.gradle/gradle.properties depending on current location.

javascript - Issues with serialize -

my problem when submit form click event. click event triggered in click event use $('#form_id').serialize(); fetch form details. just before serialize function called update form fields using javascript/jquery. after call serialize , call ajax post. but when check post values in console. noticed form fields updated before call of serialize event not reflected in serialize variables. therefore question how can refresh serialize variable latest values on form. update - have added bind event on events. if use set timeout event , call serialize functions. changes updated in form returned correctly in serialize event. is there way can make bind event return value not have call set time out event. ,

function - Javascript convert date format from "yyyy-mm-dd" to "December 11th, 2013"? -

how make sintax convert date format default format (yyyy-mm-dd) english format december 11th, 2013 using javascript function? thank you var str_date = "1983-24-12", arr_date = str_date.split('-'), months = ['', 'january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december']; var new_date=months[arr_date[2]] + ' ' + arr_date[1] + ', ' + arr_date[0]); http://jsfiddle.net/tn7ne/ edit you can add ordinal using following: function addordinal(n) { var ord = [,'st','nd','rd']; var = n%100; return n + (ord[a>20? a%10 :a] || 'th'); } e.g. addordinal(1); // 1st

process - How to use reg add in java code -

how change control panel windows update setting using java code. final string reg_add_cmd ="cmd /c reg add \"hkey_local_machine\\software\\microsoft\\windows\\currentversion\\windowsupdate\\auto update\" /v auoptions /t reg_dword /d 1 /f"; process objprocess; objprocess = runtime.getruntime().exec(reg_add_cmd); above code not disabling update in control panel.please me

javascript - How can a parameter exist when no argument is passed? -

i'm new javascript, although have .net background. typically in .net (as many other languages), if method requires parameter passed, have pass (or else compiler error due incorrect signature). appears case in javascript, not cases appear. this doesn't appear case in javascript. as working example, please refer line 61 http://www.humblesoftware.com/flotr2/#!basic-axis line 61 tickformatter: ticksfn, i understand tickformatter calling function called ticksfn line 29 shows function ticksfn(n) { return '(' + n + ')'; } 'ticksfn' requires value (n) passed, yet, never pass it. despite that, javascript still gets right , can't find out how, nor can work/understand search more research you never call @ all. pass function argument (or rather value of property of object argument). graph = flotr.draw(container, [ /* ... */], { xaxis : { noticks : 7, // display 7 ticks. tickformatter : ticks

frameworks - Yii Clistview only print once -

i want echo div once in clistview, items order status, so, want print status 1 -> items, , status 2 -> items status, tried viewdata, dont know how change value of flag. index view: <div class="modal-body"> <?php $activos_flag = 1; $inactivos_flag = 1; ?> <?php $this->widget('zii.widgets.grid.clistview', array( 'id'=>'incs', 'summarytext'=>'', 'dataprovider'=>$dataproviderinc, 'itemview'=>'_incidencias', 'viewdata'=> array('activo'=> $activos_flag,'inactivo'=>$inactivos_flag), )); ?> </div> _incidencias view: <?php if ($data->activo == 1 , $data->incidencia_estado == 1){ echo ('<label class="incidencias">activos</label

html - jQuery addClass to ul children only -

i have this <ul> <li class="quiddam"> <a href="">lorem</a> <ul> <li><a href="">ipsum</a></li> <li><a href="">dolores</a></li> </ul> </li> </ul> if use jquery add class of "brimsom" children of class "quiddam" this: $(".quiddam").children().addclass("brimsom"); both tag , ul tag children class of "brimsom". how can add class of "brimsom" children of "quiddam" ul tag only? both tag , ul tag children class of "brimsom". that's not correct. the following code snippet add class "brimson" elements have "quiddam" class, not children elements. $(".quiddam").addclass("brimsom"); therefore: <li class="quiddam brimson"> the following script add the

python - Regex - how to capture many words -

i have simple regex question: given string "test-class" regex should use ['test','class'] (in python context) you don't need regex; use str.split() : >>> 'test-class'.split('-') ['test', 'class'] a regex solution still split: >>> import re >>> re.split(r'-', 'test-class') ['test', 'class']

Maven Git Repository -

i'm newbie both git , maven. i need in building war file through maven buy getting maven project in git repository. currently have maven project in local git repository , i'm running mvn tomcat7:deploy command on project root directory bulid , deploy on tomcat server , succeded in that. but wanted know how maven project remote git repository , update local git repository , build war file. my current pom.xml this <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <version>2.4</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> <plugin> <groupid>org.apache.tomcat.maven</groupid> <artifactid>tomcat7-maven-plugin</artifactid> <version>2.0</version> <configuration> <url>http://local

c++ - why a vector of cv::mat always return the first image? -

i'm reading video frames webcam , storing them in std::vector < cv::mat > variable. each time want calculate frame difference between 2 consecutive frames, use following code result 0 , 0 matrix !! have 2 threads in program, 1 reading video frames , 1 processing video frames. whenever i'm going write vector use mutex in order prevent further problems in pushing or removing frames. here pseudo code : std::vector<cv::mat> image_vec; qmutex image_vec_mutex; main_thread() { while(1) { cv::mat frame,reserved_frame; camera.read(frame); frame.copyto(reserved_frame); qmutexlocker locker(&image_vec_mutex); image_vec.pushback(reserved_frame); locker.unlock(); cv::imshow("frame",frame); cv::waitkey(); } } and process thread is: process_thread() { (; image_vec.size() > 1 ;) { cv::mat frame1; image_vec[0].copyto(frame1); cv::mat frame2; image_vec[1].copyto(frame2); cv::subtract(frame1,frame2,result);

ajax - any config for rundeck to cross-domian api call from other domain -

i'm using jquery ajax , call rest api of rundeck like $.ajax( { url:"{rundeck_url}/api/1/job/5?authtoken=d4cuk8dd5dp4sovsr7p9uund5dnvu3do" } ); but error brower doing xmlhttprequest different domain xmlhttprequest cannot load {rundeck_url}/api/1/job/5?authtoken=d4cuk8dd5dp4sovsr7p9uund5dnvu3do. no 'access-control-allow-origin' header present on requested resource. origin '{site_url}' therefore not allowed access. is there config set header cross-origin in rundeck ? thanks env: rundeck:1.4.2 api reference version: 3

canvas - Android translate MotionEvent coordinates when drawing -

Image
hello try make drawing after user zooms view , have issue. ive got zoomview (custom view) contains subview imageview image (custom view), zoomview working good, im able zoom/pan/drag , imageview (custom) responds gesture, when try draw on imageview after zoomed/dragged/panned zoomview drawn on touch gets little messed. first top line drawn when zoomview not zoomed, line looks good. second line drawn when zoomview @ middle zoom. third drawn @ full zoom. the issue when zoomed , touching finger, line draws faster normal, , cant line, add other line in case (second line: line going top , , third line: line going bottom) while try draw line. im asking help: how can translate touch point zoomview when zoomed imageview touch points draw canvas. here classes: public class ownzoom extends framelayout { /** * zooming view listener interface. * * @author karooolek * */ public interface ownzoomlistener { void onzoomstarted(float zoom, float zoomx, float zoomy); vo

c# - Can't update Xml file -

i'm trying update xml file using code. int i; xmlnodelist list = xdoc.selectnodes("sale/saleslines/salesline"); foreach (xmlnode node in list) { (i = 0; < count; i++) { node.selectsinglenode("vatamount").innertext = convert.tostring(datagridview.rows[i].cells[10].value); xdoc.save(path); } } so first of i'm trying update xml file using integer data grid. there 2 salesline nodes in xml file. above code update values in node sets both elements value last element read using loop. reads both(there 2 values read , updated in file) values updates last read value in both nodes vatamount element. btw count holds count of rows in grid. can me fix this. need solved. ok. guys please forgive me. co-employee saw code , said not use code use this. devexpress.xtragrid.views.grid.gridview view = (devexpress.xtragrid.views.grid.gridview)gridcontrol1.focusedview; view.posteditor(); view.refreshdata(); datatable

node.js - Deploy DocPad to Gandi.net Simple Hosting -

i'm trying deploy first docpad website gandi.net hosting provider, service : https://www.gandi.net/hebergement/simple?language=nodejs&grid=a my code here : https://github.com/nylnook/nylnook-website it's running fine locally on computer. technically seem 'vhost', , i'm supposed write "server.js" file deploy docpad in production gandi server, after used : git push gandi master ('gandi' being git remote repo @ server) , used custom command (xxx instead of login) : ssh xxxxx@git.xxx.gpaas.net 'deploy default.git' they have guide node.js instance : http://wiki.gandi.net/en/simple/instance/nodejs?s[]=node , guide git usage on servers : http://wiki.gandi.net/en/simple/git that suggest use code : https://github.com/visionmedia/express/blob/master/examples/vhost/index.js but newbie node.js, learning docpad, can't figure how ! last link, docpad guide deployment followed far : http://docpad.org/docs/deploy thanks !

php - Restrict websocket connection to one per user -

is there way, that?. basically, want restrict logged user (login sessions in php) 1 tab / browser window. if has 1 connection (opened tab/ window), don't wanna allow opening one. maybe when open websocket, record in session indication websocket session open ($_session['websocket_is_open'] = true), , check every time user tries open new websocket.

c# - Delete a Temp File after FileStream Pop-Up response -

i use interop saveas(d:/temp) template excel sheet after changes made. use filestream send user pop-up save file. file in d:\temp still exists. there way delete file on pop-up response? //save excel file saveexcelfile(exportpath, sourcefile, excelworkbook, excelapllication, excelworksheet); #region pop , file open if (system.io.file.exists(sourcefile)) { filestream fssource = new filestream(sourcefile, filemode.open, fileaccess.read); return file(fssource, "application/vnd.ms-excel", "filename" + .xls"); } else { return view(); } #endregion instead of creating temp file, loading stream, , trying delete it, suggest create file directly in memory stream (i.e. system.io.memorystream ) in first place, don't have load , delete it. if cannot create directly in memory stream, main issue cannot delete temp file while you're using in filestream. in case, copy filestream memorystream, close , dispose file

javascript - Show HTML class on first tab when you do not know which tab will display first as it is dependent on whether data exists in that field -

i have web page tabbed content. information each tab pulled database. tab displays if content exists. js requires class="active" set on first tab allow load , change colour of tab show active tab. the problem have don't know tab first, there may not information first tab, not display , tab 2 or 3 show first. how can 'make tab have class="active" if first'? html: <nav class="filters"> <ul class="tabs"> <li class="active"><a href="#" data-tab="uniquename-tab-1">content 1</a></li> <li><a href="#" data-tab="uniquename-tab-2">content 2</a></li> <li><a href="#" data-tab="uniquename-tab-3">content 3</a></li> </ul> </nav> <article class="tab-content has-aside wysiwyg active" id="uniquename-tab-1"> <h1&

javascript - Disabling enter with angular in a content-editable -

i want nothing happen if press enter while in content-editable: this tried inside directive: element.on('blur keyup change', function (e) { if(e.which == '13') e.preventdefault(); here entire directive: .directive('contenteditable', function () { return { restrict: 'a', // activate on element attribute require: '?ngmodel', // hold of ngmodelcontroller link: function (scope, element, attrs, ngmodel) { if (!ngmodel) return; // nothing if no ng-model // specify how ui should updated ngmodel.$render = function () { element.html(ngmodel.$viewvalue || ''); }; // listen change events enable binding element.on('blur keyup change', function (e) { if(e.which == '13') e.preventdefault()

javascript - Performance of $rootScope.$new vs. $scope.$new -

my current controllers $scope kind of thick with: $watch , event handlers. on 1 point need create new scope modal, not have own controller, because quite simple. still needs property of current $scope . wondering of following solutions better, , why? a) var modalscope = $rootscope.$new(); modalscope.neededvalue = $scope.neededvalue; b) var modalscope = $scope.$new(); // modalscope.neededvalue there should worried created modalscope watch expressions , events? other aspects should aware of? option a) copies value once , doesn't keep in sync $scope , may cause confusing bugs. if modal has deep scope hierarchy there cases option a) might give slight performance advantage (calling $broadcast on $scope means needs cover smaller scope tree), in i'd option b) way go. your $watch es won't benefit location of scope unless you're $digest ing particular scope. edit: see modal light, in case, go option b), performance advantage a) negligible.

angularjs - How to call a function in "ng-src" -

i need able call function in order run code dynamically retrieve source of image. following code snippet shows example of want: <!-- "myfunction" exists in current scope --> <img ng-src="myfunction()" /> i'm sure has simple can't find in ng-src documentation ! else ever hit this? thanks in advance! the directive (example based on answers) others recommended directive. can't post client code wrote short example of in plunker ( see here ). core directive is: app.directive("imagesource", function (){ return { link: function (scope, element, attrs){ element.attr("src", scope.imageurlarray[attrs.imagesource]); } }; }); i know have here example done ng-repeat using variable in ng-src serves example of directive would if 1 necessary. <img ng-src="{{myfunction()}}" /> fiddle

jquery - Form fill up with check box -

i want set of form user input billing address , checking check box user able fill next part. i want jquery. if possible, how can it. or, if not possible jquery. then, how can it? <form role="form" class="form-horizontal"> <div class="form-group"> <h2>billing address</h2> <p><span>address 1</span><input type="text" placeholder="name" id="billing_addres_1"></p> <p><span>address 2</span><input type="text" placeholder="name" id="billing_addres_2"></p> <p><span>city</span><input type="text" placeholder="name" id="billing_city"></p> <p><span>country/region</span><input type="text" placeholder="name" id="billing_country"></p> </div> <div class="form-group"> <div class=&

ios6 - How to Set Default splash image for both iOS 6 & iOS 7 version in same App -

Image
i re-skinning application make ios 7 compatible & work ios 6 old layout. have different layouts ios 6 & 7. now want set default splash screen both version separate images. can suggest me best way it. thanks. if use asset manager, have list of possible images use ios 7 ios 5 , 6. can set these will. if create new launch image given placeholders possible devices , sizes.