Posts

Showing posts from 2014

How to find Nal header in h.264 RTP packet -

i need find nal header parsing rtp packet each nal unit encapsulated 1 rtp packet, parse nal header know whether it's pps unit or not. tried following got no result: databuffer = (char*)message_returnpacket(msg); byte * hdr = (byte*)databuffer + rtp_hdr_size; //databuffer contains rtp packet rtpparsing((byte*)databuffer,rp,hdr); if (rp.nal_type == 8 ) { printf("\n pps found \n"); } else { printf("\n no pps found\n"); } where int rtpparsing(byte *pdata,rtppacket_t &rp, byte *hdr) { if ((pdata[0] & 0xc0) != (2 << 6)){ printf("[rtp] version incorrect! dump = 0x%x 0x%x 0x%x 0x%x \n",pdata[0], pdata[1], pdata[2], pdata[3]); return 0; } /* parse rtp header */ rp.v = (pdata[0] & 0xc0) >> 6; /* protocol version */ rp.p = (pdata[0] & 0x40) >> 5; /* padding flag */ rp.x = (pdata[0] & 0x20)

uialertview - Get the top ViewController in iOS Swift -

i want implement separate errorhandler class, displays error messages on events. behavior of class should called different other classes. when error occurs, have uialertview output. display of alertview should on top. no matter error gets thrown, topmost viewcontroller should display alertmessage (e.g. when asynchronous background process fails, want error message, no matter view displayed in foreground). i have found several gists seem solve problem (see code below). calling uiapplication.sharedapplication().keywindow?.visibleviewcontroller() return nil-value. extension gist extension uiwindow { func visibleviewcontroller() -> uiviewcontroller? { if let rootviewcontroller: uiviewcontroller = self.rootviewcontroller { return uiwindow.getvisibleviewcontrollerfrom(rootviewcontroller) } return nil } class func getvisibleviewcontrollerfrom(vc:uiviewcontroller) -> uiviewcontroller { if vc.iskindofclass(uinavigationcontroller.self) { let navigationcontroller = vc a

How to install and use php-pushwoosh on Ubuntu 12.04 LTS Linux OS with/without using Composer? -

i want install , use php-pushwoosh on system running on ubuntu 12.04 lts linux os. for went link php-pushwoosh website . there come know can install php-pushwoosh using composer: the easiest way install library use composer , define following dependency inside composer.json file. but i've no idea composer , how install software using composer. ultimate goal install php-pushwoosh on machine , execute code. install composer or not, doesn't matter me. if explain working code example of php-pushwoosh send push-notification iphone great. composer tool dependency management in php. allows declare dependent libraries project needs , install them in project you. if php developer profession recommend getting composer, love piece of software. it's not complicated looks @ first glance, read composer's introduction , should able install composer , require packages. start new project create new folder my-project-name/ following composer

php - Constructor argument not inheriting down to children? -

i new php , in particular oop. have piece of test code thought return: what result?8 result?8 but, instead getting: what result?5 result?8 the arguments passed instance of class seem not getting assigned x. have tried echo $second->x returns nothing. have got code wrong, misunderstanding inheritance or misunderstanding constructors ? here code: <?php class first{ public function __construct($x){ $this->x = $x; echo "what result?"; } } class second extends first{ public function calculation(){ $z=5; return $x+$z."<br />"; } } class third extends first{ public function calculation(){ $z=5; $x=3; $y=$x+$z; return $y."<br/>"; } } $second = new second('3'); echo $second->calculation(); $third = new third('3'); echo $third->calculation(); ?> just little updation

Color Transfer: What's wrong with my code in OpenCV C++ -

i want implement color transfer algorithm in paper , refer tutorial transfer algorithm in opencv c++. but got strange result, example: this source image , this target, combined result this . part of result strange. this source code mat src; mat tar; mat result; class imageinfo{ public: double lmean, lstd, amean, astd, bmean, bstd; }; /// function header void image_stats(mat img,imageinfo *info); /** @function main */ int main(int argc, char** argv) { vector<mat> mv; imageinfo srcinfo, tarinfo; src = imread("images/autumn.jpg"); tar = imread("images/fallingwater.jpg"); imshow("src", src); imshow("tar", tar); cvtcolor(src, src, cv_bgr2lab); cvtcolor(tar, tar, cv_bgr2lab); image_stats(src, &srcinfo); image_stats(tar, &tarinfo); split(tar, mv); mat l = mv[0]; mat = mv[1]; mat b = mv[2]; /*pixel color modify*/ (int = 0; i<l.rows; i++){

javascript - Convert a 2D PHP array to a 2D Json object to plot on a graph -

i'm working on part of code since weeks , i'm unable solve issue. i'll try explain code deeply. i'm fetching values mysql database. using code below i'm able create 2d php array: ($i=2, $k=2; $i<11, $k<11; $i++, $k++) { $roe_array[] = array( $date_y[$i] => $roe[$k]); } the output of code following array ( [0] => array ( [2006] => 13.83 ) [1] => array ( [2007] => 16.43 ) [2] => array ( [2008] => 14.89 ) [3] => array ( [2009] => 18.92 ) [4] => array ( [2010] => 22.84 ) [5] => array ( [2011] => 27.06 ) [6] => array ( [2012] => 28.54 ) [7] => array ( [2013] => 19.34 ) [8] => array ( [2014]

eclipse plugin - Toolbar disappears when hiding the perspective bar -

in application don't want show perspective bar in prewindowopen() method set configurer.setshowperspectivebar(false); whole toolbar disappears too. set configurer.setshowcoolbar(true); and toolbar: <menucontribution locationuri="toolbar:org.eclipse.ui.trim.command2"> <toolbar ... </toolbar> i don't know why happen leave question here. the main toolbar org.eclipse.ui.main.toolbar must use id in locationuri .

git - Fast-forward merge two branches ignoring specific character pattern -

is there way merge commits other branches ignoring specific character pattern namespace/package using fast forward merge? for example want merge few lines in com.company.client1.custom ...public class bicycle { // bicycle class has // 3 fields public int cadence; public int gear; public int speed; } into banch have in file: com.company.client2.custom ...public class bicycle { // bicycle class has // 3 fields public int cadence; public int gear; } i want merge last code line in snippet, don't want overwrite package way now.

linux - Some kernel ARM code -

i reading through arm kernel sources till stumbled upon following function :- 314 #define __get_user_asm_byte(x, addr, err) \ 315 __asm__ __volatile__( \ 316 "1: " tuser(ldrb) " %1,[%2],#0\n" \ 317 "2:\n" \ 318 " .pushsection .fixup,\"ax\"\n" \ 319 " .align 2\n" \ 320 "3: mov %0, %3\n" \ 321 " mov %1, #0\n" \ 322 " b 2b\n" \ 323 " .popsection\n" \ 324 " .pushsection __ex_table,\"a\"\n" \ 325 " .

Repeat Javascript Function in PHP foreach loop -

i have javascript function within row in foreach loop. i'd have repeat each row , have tried code. each row has element id baserate converted using code below. my problem works on first row , doesn't rest. need solve this, , appreciated. php: foreach ($alllocs $allrows) - no need put complete code here. javascript: <script> (var = 0; < <?php echo $alllocs; ?>.length; i++) { var = document.getelementbyid("baserate").value; var e = number(a).tofixed(2); var b = number(forex.rates.krw).tofixed(2); var c = e * b; document.getelementbyid("welkomet").innerhtml = (c).tofixed(2); } </script> i consider foreach loop this foreach ($alllocs $allrows) where should replace $alllocs $allrows in javascript code code this <?php foreach ($alllocs $allrows){ ... ... ?> <script> (var = 0; < <?php echo $allrows; ?>.length; i++) { var = document.getelemen

has and belongs to many - How to show associated data in add form in cakephp 3.x -

i have 2 tables create table `user_roles` ( `id` int(11) not null auto_increment, `role_name` varchar(20) default null, primary key (`id`) ) engine=innodb auto_increment=39 default charset=latin1 create table `users` ( `id` int(11) not null auto_increment, `username` varchar(20) default null, `email` varchar(255) default null, `password` varchar(255) default null, `user_role_id` int(11) default null, `status` int(11) default null, primary key (`id`) ) engine=innodb default charset=latin1 i created insertion , deletion user roles . no have add users user roles. in user adding form user role displaying empty. here code: usertable.php: namespace app\model\table; use cake\orm\table; use cake\validation\validator; class userstable extends table { public function initialize(array $config) { $this->hasmany('userroles', [ 'foreignk

javascript - Jquery ajax call not working on android -

i have jquery ajax calls i'm making cross domain using jsonp. code is: $.support.cors = true; $.allowcrossdomainpages = true; $.ajax({ datatype: 'jsonp', type: "post", url: "http://my-url.com/getsearchresults.php", data: { userid: localuserid, searchlocation: decodeuricomponent(searchlocation), searchcategory: searchcategory } }) .done(function(items) { alert(items); }); when run in normal browser in alert box [object object] should, when run on android mobile browser returns blank alert box. my php contains headers allow cross domain. the actual resonse ajax call (the object) this: [{ "address": "london road, brighton, united kingdom", "details": { "id": "1", "name": "kav 2", "logo": "user_content\/1167327737_images.jpg", "favorite": "0",

javascript - Sharepoint: Is there a way to replace the popup with jquery? -

is there anyway replace javascript popup window dispfrom, editfrom or newform jquery popup plugin popup.js? i managed forms work : /_layouts/listform.aspx?pagetype=4&listid=' + listgudi + '&id=' + itemid + pagetype=4 # can repleaced depending of if it's display,edit or new - forms. sharepoint provide view out masterpage adding &isdlg=1 end of link great. does have idea? i'm using sharepoint 2010 , spservices.

jquery - Copy to clipboard multiple items -

i doing copy clipboard picking first id. understand because can't have multiple id's when change code document.getelementsbyclassname doesn't work? following code function copytoclipboard() { var input = document.getelementbyid("toclipboard"); var texttoclipboard = input.value; var success = true; if (window.clipboarddata) { // internet explorer window.clipboarddata.setdata("text", texttoclipboard); } else { // create temporary element execcommand method var forexecelement = createelementforexeccommand(texttoclipboard); /* select contents of element (the execcommand 'copy' method works on selection) */ selectcontent(forexecelement); var supported = true; // universalxpconnect privilege required clipboard access in firefox try { if (window.netscape && n

Error (#200) The user hasn't authorized the application to perform this action facebook graph api php codegniter -

here permissions $config['facebook']['permissions'] = array( 'email', 'user_location', 'user_birthday', 'publish_actions', 'manage_pages', 'public_profile', ); i can not post on facebook page admin.it gives me error exception occured, code: 200 message: (#200) user hasn't authorized application perform action if remove 'access_token' => $pagelist['access_token'], can post on page not admin.but when add line gives me above error can tell me why here function pagepost using post on page public function pagepost() { if ( $this->session ) { try { $pageaccesstoken; $request_page = new facebookrequest($this->session, 'get', '/1420447421611683?fields=access_token,name,can_post'); $pagelist = $request_page->execute() ->getgraphobject() ->asarray(); $request = ( new facebookrequest( $this->session

Converting flat structure to typical parent-child tree in Java -

for reason i'm drawing blank on this, maybe brain overloaded lately can't seem right. i'm trying convert structured list of unique values tree structure. i have list of unique values set in apache multikey classes, wrapper number of objects make key. list looks this: list<multikey> _data = new arraylist<multikey>() and data inside looks this: multikey[abc] multikey[abc, 111] multikey[abc, 111, chf] multikey[abc, 111, chf, at000b049432] multikey[abc, 111, chf, ch0012814965] multikey[abc, 111, chf, ch0018550399] multikey[abc, 111, chf, ch0020626773] multikey[abc, 111, eur] multikey[abc, 111, eur, at0000a001x2] multikey[abc, 111, eur, at0000a0u3t4] multikey[abc, 111, usd] multikey[abc, 111, usd, ch0002497458] multikey[def] multikey[def, 222] multikey[def, 222, chf] multikey[def, 222, chf, at000b049432] multikey[def, 222, chf, ch0012814965] multikey[def, 222, eur] multikey[def, 222, eur, at0000a001x2] the class makes tree node classic parent-child tre

android - gradle dependency can't be resolved -

i included dependencies android app. works on own computer. if try build on company computer cause error coulnd't resolve dependency. assume due proxy server. tried configure gradle adding gradle.properties: systemprop.proxyset=true systemprop.http.proxyhost=[proxy] systemprop.http.proxyport=[port] systemprop.http.proxyuser=[username] systemprop.http.proxypassword=[password] systemprop.http.nonproxyhosts=localhost systemprop.http.auth.ntlm.domain=domain systemprop.https.proxyhost=[proxy] systemprop.https.proxyport=[port] systemprop.https.proxyuser=[username] systemprop.https.proxypassword=[password] systemprop.https.nonproxyhosts=localhost systemprop.https.auth.ntlm.domain=domain this works except com.afollestad:material-dialogs:0.7.5.1. if remove dependency builds works , other dependency fetched. the developer states on github page shall add repo if having issues: maven { url ' https://dl.bintray.com/drummer-aidan/maven ' } so have repositories added: repos

jsf 2 - Print data from dynamic table in JSF -

i have screen dynamic table contains inputtext feild , selectnemenu beside there's (+) button, when user should press button form should add row below ,i want print on console(eclipse) data user enter , want add validation (+) button user cant add new row until user enter data in cells in previous row iam newbie jsf programming.can tell me basic example. you may use f:setpropertyactionlistener h:commandbutton values of current row in backing bean. , in backing bean may apply validation check values of inputtext , selectonemenu. if values non empty can add new object (row) list below : jsf code: <h:datatable id="dt" var="element" value="#{bean.list}"> <h:column> <h:inputtext value="#{element.inputval}" > </h:inputtext> </h:column> <h:column> <h:selectonemenu value="" > </h:selectonemenu> </h:column> <h:column> <h:commandbutton value="plus but

How to Make an executable Linux Binary run at startup in Yocto Linux on Intel Galileo -

i trying implement lwm2m client ( eclipse/wakaama · github ) on intel galelio board. have implemented feature in client ( galileo board) restart once executed restart server, on restart client should automatically restart executable binary. tried option available on various forums didn't work. gave proper permission, updated rc.d , visible in run level 3, binary not executed. can 1 please me this? i have tried steps in link it's had tell distance. ideas working: you shouldn't link executable directly; files in /etc/init.d should scripts invoke executable correct options. after installing script, try run command line make sure works. select number between 2 scripts run in runlevel. if have scripts numbers 10 , 20 , give script 15 . if see 20 script run during boot, can pretty sure script run before that. add logging script check whether fails @ point. simple echo "1" >> /tmp/l2m.log is enough see how far script gets. add -x has

emacs - Result value of elisp code stored in a file? -

looking way how evaluate elisp code stored in external file , pass result function argument. example demonstrating i'd achieve follows: ;; content of my_template.el '(this list) ;; content of .emacs result of my_template.el has used (define-auto-insert "\.ext$" ;; bellow attempt retrieve resulting list object ;; getting nil instead (with-temp-buffer (insert-file-contents ("my_template.el")) (eval-buffer)))) probably looking eval-like function besides side-effect returns result of last expression. any idea ? using variable share data easier , more common, example: ;; content of ~/my_template.el (defvar my-template '(this list)) ;; content of .emacs result of my_template.el has used (load-file "~/my_template.el") (define-auto-insert "\.ext$" my-template) update function eval-file should want: ;; content of ~/my_template.el '(this list) (defun eval-file (file) "execut

.htaccess - https 301 redirect and sub domains not working -

i use following code redirect http https in htaccess. following code works fine in redirecting me https version. rewriteengine on rewritecond %{https} off rewriterule ^ https://www.domain.com%{request_uri} [ne,r=301,l] but when create sub domain, http://example.domain.com redirecting https://www.domain.com .. how solve ? try : rewriteengine on rewritecond %{http_host} !^sub\.domain\.com$ rewritecond %{https} off rewriterule ^ https://www.domain.com%{request_uri} [ne,r=301,l]

python - TypeError: __init__() got an unexpected keyword argument 'image_field' -

i've profiles clinics , add images each of them. i'm trying use django-imaging , getting error. i've followed documentation , did following: settings.py installed_apps = ( 'm1', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.sites', 'django.contrib.sitemaps', 'imaging', models.py from imaging.fields import imagingfield class clinic(models.model): name = models.charfield(max_length=500) slug = models.charfield(max_length=200, unique = true) photos = models.imagingfield() urls.py url(r'^imaging/', include('imaging.urls')), i tried doing syncdb and got following error: traceback (most recent call last): file "manage.py", line 10, in <module> execute_from_comma

xsd - Tableau workbook XML schema -

does know can xml schema tableau workbooks, data extracts , data sources? i know reverse engineer using existing report files not possible values different complex data types. aware tableau software not encourage edit files directly, it's experiment trying do. you can use python parse xml... i have coded retrieve information example code you can iterate through required elements.... example loop through required element import xml.etree.elementtree et tree = et.parse(filename) xml_datasources = tree.findall('datasources') xml_val = xml_datasources[0].iter('datasource') item in xml_val: name = item.get('name') there multiple nested items luck parsing

SharePoint 2013: How to filter search documents based on stamp property on document library -

currently, documents shown in search result i have stamped property on document library level across site collection example: document library having stamp property ‘mydocumentlibrary: true” my requirement show documents document library stamp property present on document library i.e. wanted filter out documents other document library not sure if possible in sharepoint online. first need find crawled property containing word "...mydocumentlibrary..." based on property need create managed property. provide name (e.g. "mydocumentlibrary") , check queryable option. full crawl. need open search result page edit. edit search result webpart. click "change query" , add: mydocumentlibrary=true. save & publish.

Symfony 2: knppaginator does not allow left join -

i use knppaginator getting paginated results. when use left join statement in query, following error: cannot count query selects 2 components, cannot make distinction the code in controller looks this: public function paginationaction() { $em = $this->get('doctrine.orm.entity_manager'); $dql = "select p.name, c.name mybundle:products p left join mybundle:categories c c.id = p.categoryid"; $query = $em->createquery($dql); $request = $this->getrequest(); $paginator = $this->get('knp_paginator'); $pagination = $paginator->paginate( $query, $request->query->getint('page', 1), 10 ); $viewdata['pagination'] = $pagination; return $this->render('mybundle:results.html.twig', $viewdata); } how can make left join statement work? when l

asp.net - How can I use DirectoryEntry in SignInManager? -

i've create company web using asp.net using directoryentry method authenticated user logged in member of company. in case of admin didn't allow iis server join domain, cannot use direct windows authentication method. by using simple function i've got stackoverflow (thanks original coder) function authenticateuser(user string, pass string) boolean dim de new directoryentry("ldap://xxx.xxx.xxx.xxx", user, pass, authenticationtypes.secure) try 'run search using credentials. 'if returns anything, you're authenticated dim ds directorysearcher = new directorysearcher(de) ds.findone() return true catch 'otherwise, crash out return false return false end try end function after tried moving c# asp.net mvc. don't have ideas how modify simple directoryentry applicationsigninmanager method ? var result = await signinmanager.passwordsigninasync(model.email, model.password,

How to get last date of the month in Jasper Report date parameter input control? -

i working on jasper report using ireport , in taking 2 input dates start_date , end_date user. now want end_date should last date of month start_date. searched on internet couldn't write/get condition can write in default expression end_date parameter. can please suggest me way this? i tried sql query additional parameter date_diff retrieve data 1 month only. sql query looks this: select ead_pgm_cash_sw, ead_pgm_fs_sw, ead_pgm_mcl_sw,count(*) cnt ead_case a, ead_program b a.unique_trace_hi = b.to_ead_case_lnk_hi , a.unique_trace_lo = b.to_ead_case_lnk_lo , a.ead_case_id = b.ead_pgm_case_num , a.ead_cs_batch_dt >= $p{start_date} , a.ead_cs_batch_dt <= $p{end_date} , $p{start_date}< $p{end_date} , $p{date_diff} <= 30 , (b.ead_pgm_cash_sw, b.ead_pgm_fs_sw, b.ead_pgm_mcl_sw) in (('n','y','n'),('y','y','y'),('n','n','y'),('n','y','y'),('y','n',&

javascript - How to show value bottom of angular gauge chart in fusion chart? -

Image
i'm trying find option show dial value @ bottom of angular gauge chart. i'm using fusion charts xt. don't find option show dial value @ different places. default it's showing in middle of angular gauge chart. refer below images you can see in left image, want dial value 87 @ bottom of chart. i'm trying achieve gradient color of gauge chart same image can see @ right side. i'm trying understand how gaugefillmix , gaugefillratio works. here jsfiddle on i'm working. any appriciated. to show value below dial can use "valuebelowpivot" attribute , set 1. refer fiddle: http://jsfiddle.net/moonmi/577w5/46/ "valuebelowpivot":"1" for gaugefillmix , fillratio can check out gauges fusioncharts gallery, can find json/xml of chart. link: http://www.fusioncharts.com/charts/gauges/ hope help. thanks.

Need to write an AND regex in ruby -

i need regex check if string starts "v " , if has word 'bench' or 'earcx' in it. my current expression written as: v\s|bench|earcx realized taking 'v ' or bench or earcx . there and condition regular expressions in ruby? if so, how can check both 'v ' , bench or earcx any appreciated! if order matters (as say, "starts v"), can write simply: /v.*(bench|earcx)/ if not, can wrap in alternation: /v.*(bench|earcx)|(bench|earcx).*v/ but getting unwieldy (especially if have several different , factors, better use lookaheads: /(?=.*v)(?=.*(bench|earcx))/ this match vbench , earcxfoov ... , solution general case , anywhere in string.

javascript - jQuery: How to show a checkbox value on mouseover (without title attribute) -

i pretty new jquery , need following. i have html page large, dynamic number of checkboxes , show checkbox' value on mouseover without having add title attribute in code each of them. also, value of checkbox can different text shown next (label). checkboxes in div class '.divcheck' , above applies checkboxes in these divs (all set same way). so far have following works intended seems slow (at least in test environment). is there faster / better way achieve or can written different (either jquery or html) make run faster ? my html (simplified): <div class="divcheck"> <input type="checkbox" name="language" class="checksingle" id="language1" value="de - german" /> <label for="language1">de</label> <input type="checkbox" name="language" class="checksingle" id="language2" value="en - english" />

javascript - Dealing with returned JSON data -

i'm querying database using ajax (jquery) data i'm getting proving difficult deal with. did notice others have posted similar issues , identified php code (specifically how data being allocated array) being issue. couldn't find solution. contents of returned data (when transform returned data string) looks this: [{"id":"1","username":"admin","userpassword":"admin","useremail":"admin@admin.com","userregistrationip":"","registrationdatetime":"2015-05-28 21:22:54","userlastlogin":"2015-05-28 21:22:54"}] i'd able pull individual element returned data, such userlastlogin field. my ajax query: $.ajax({ url: 'authenticate2.php', type: 'post', datatype: 'json', data: { username: $('#username').val(), }, success: function (res) { $('#resultbox

PHP - cURL + strpos Issues -

i have script in checks if tested netflix account works. reason refuses work dont know im doing wrong. the checker page's php edit: added if statement doesnt post blank going page: <?php if(isset($_post['e']) && isset($_post['p'])){ $e = @$_post['e']; $p = @$_post['p']; $url = 'myapi.php?e='.$e.'&p='.$p; $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_useragent, 'mozilla/5.0 (windows nt 6.3; wow64) applewebkit/537.36 (khtml, gecko) chrome/39.0.2171.95 safari/537.36'); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_ssl_verifypeer, false); curl_setopt($ch, curlopt_followlocation, 1); $page = curl_exec($ch); $haystack = $page; $needle = 'profilesgatewrapper'; if(strpos($needle, $haystack) !== true) { file_put_contents('working.txt','test', file_append); } else { echo $page; } } ?> myapi.php: <?php $

java - How to read a text from a page using Helium? -

Image
i want read text showing in picture , want print text using helium. tried following code import org.openqa.selenium.webdriver; //import com.heliumhq.selenium_wrappers.webdriverwrapper; import static com.heliumhq.api.*; public class mainclass { public static void main(string[] args) { webdriver ff = startfirefox("http://172.16.0.200:8001/"); waituntil(text("streams tech, inc.").exists); streamstech lg = new streamstech(); lg.login(ff); if (getdriver().getvalue().contains("you have not purchased product yet. please visit our product list try out different products!")) system.out.println("you have not purchased product yet. please visit our product list try out different products!"); else system.out.println("test failed :("); //string text = getvalue("you have not purchased product yet. please visit our product list try out d

opencv - Scilab Image Processing Toolboxes .How to pass 3 dimensional matrix from C++ code to scilab console? -

i working on implementing image processing toolbox in scilab .for implementing opencv functions in scilab through c++ using functions defined in scilab api "api_scilab.h". problem facing unable return 3 dimensional matrix (which returned opencv function) through c++ code scilab console.solution found problem converting 3 dimensional matrix 1 dimensional matrix , return , convert 1 dimensional matrix 3 dimensional matrix whenever required. want ask there function in scilab api "api_scilab.h" can directly return or pass 3 dimensional matrix argument . thank in advance

c# - Remove Authentication from Web api on Localhost -

Image
i have odata web api on visual studio using ado.net framework. getting authentication window on chrome, removed authorize parts controllers , web.config file, yet window asking username , password coming. how remove ? my web.config file has <system.web> <authentication mode="windows"> <forms requiressl="true" /> </authentication> <authorization> <allow roles="myservice" /> <deny users="*" /> </authorization> which removed still authentication window opening. lot help. use none mode authentication-element . default value when not specify windows . more information asp.net authentication can found here <authentication mode="none"> <!--<forms requiressl="true" />--> </authentication>

r - plotting; adding own x-axis does not work -

Image
i plot time-series data. illustrate dates on x-asis, first removed values on axis add on axsis correct dates: set.seed(1) r <- rnorm(20,0,1) z <- c(1,1,1,1,1,-1,-1,-1,1,-1,1,1,1,-1,1,1,-1,-1,1,-1) data <- as.data.frame(na.omit(cbind(z, r))) series1 <- ts(cumsum(c(1,data[,2]*data[,1]))) series2 <- ts(cumsum(c(1,data[,2]))) d1y <- seq(as.date("1991-01-01"),as.date("2015-01-01"),length.out=24) plot_strategy <- function(series1, series2, currency) {x11() matplot(cbind(series1, series2), xaxt = "n", xlab = "time", ylab = "value", col = 1:3, ann = true, type = 'l', lty = 1) axis(1, at=as.posixct(d1y),labels=format(d1y,"%y")) title(ylab = "value") title(xlab = "time") legend(x = "topleft", legend = c("tr", "ba"), lty = 1,col = 1:3) dev.copy2pdf(file= currency, width = 11.69, height = 8.27)} plot_strategy(series1

oracle - No more data to read from socket while copy data form one database to another using Hibernate -

in application using multiple databases. 1 database load object , in database save object. used different databases , different errors each time. in 1 case got sql error 0600 . in case got table or view not exist . in 1 case got no more data read socket . this error occurs in case of 1 table. others works well. select query working on specific table update , insert query causes error. i using hibernate this.

jpa - Transaction : Data retrieval needs transaction? -

wildfly 8.2 hibernate 4.3.7 jpa 2 hi, i using ejb 3 , working on reporting requirement retrieves data db , hands on highcharts. do need transaction when query database. aware having no transaction speeds things know inputs in terms of shortcomings. thanks in advance, rakesh update: checkout pro jpa 2 book. discusses same thing , recommends use @transactionattribute(transactionattributetype.not_supported) on session bean methods. logical jpa provider has lot less when there no transaction. took bit long squeeze-in time bit of performance testing. initial post states, question using no transaction @ ejb level. found searching @ http://www.javaperformancetuning.com/tips/j2ee_ejb.shtml . in order make sure comments, there in, relvant ejb 3.1, did testing , having no transaction (never or notsupported) speeds things extent of 30-40%. seems there no side effects of either. inputs.

mysql - retrieving null date from database to vb.net -

i having problem in recovering null date database datepicker in vb.net. i able save datein mysql null value can't retrieve datepicker. i tried code doesn't work. if reader.isdbnull(0) return else refdate.text = reader.getstring("refdate") end if my code retrieving is try if e.rowindex >= 0 dim row datagridviewrow row = me.datagridview1.rows(e.rowindex) forid.text = row.cells("id").value.tostring try connection.open() dim sel string sel = "select * recordtracker id ='" & forid.text & "'" com = new mysqlcommand(sel, connection) reader = com.executereader while reader.read

Best way to store a script in Mysql workbench -

let's have series of tables in mysql, , of them dependent on other tables (so if didn't want force delete, have delete them in order). let's had little script delete them in order...now let's wanted run in mysql workbench, , better yet have function took in parameter (like userid) , did above... how such thing in mysql workbench in way retrieve , run code (like example if wanted delete user , other objects associated user.) you can use stored procedure delimiter // create procedure delete_user(in _user_id int) begin start transaction; delete user_data user_id = _user_id; -- other delete statements go here in proper order delete users id = _user_id; commit; end// delimiter ; sample usage: call delete_user(2); -- delete user id = 2 here sqlfiddle demo

scala - Validate Datatype of Json Nodes (Jackson) -

i using jackson parsing parse json , saving hbase . prior save have validate datatype of nodes against list of datatypes mysql. following approach: def validatenode(node:jsonnode, datatype : string) :any = { val nodevalue = node.tostring() datatype.tolowercase() match { case "double" ⇒ { try{ d.todouble } catch{ } } case "int" ⇒try { node.getvalueasint } catch{} case "string" ⇒ try{ node.gettextvalue }catch{} } } which looks ugly me. a) catching exceptions in every case block see whether datatype correct. can suggests me elegant code this? further, have handle datatypes array , vector too. eg : jsonnode {"a":[[1,2],[2,4],[4,5]]} (==>vector of integer) .

java - Is my code thread safe? -

in java application, have string ( mysingleton.getinstance().mystring ) gets updated based on user actions. in application, there tcp server sends value of string connected clients whenever value of string changes. each client socket gets own thread. here thread code. public void run() { try { printstream printstream = new printstream(hostthreadsocket.getoutputstream(), true); while (true) { synchronized (mysingleton.getinstance()) { printstream.println(mysingleton.getinstance().mystring); try { mysingleton.getinstance().wait(); } catch (interruptedexception e) { e.printstacktrace(); } } } } catch (ioexception e) { e.printstacktrace(); } } and here code writes mysingleton.getinstance().mystring . public void updatestring(string newstring

node.js - Mongoose embedded document update not persisting -

i'm working mean stack , i'm trying update embedded document. appears work on execution, data not persist after refresh: // update answer exports.updateanswer = function(req, res) { var ansid = req.params.aid; var result; poll.findbyid(req.params.id,function(err, poll){ if(err) { return handleerror(res, err); } poll.answers.foreach(function(answer){ if(ansid == answer._id) result = answer; }) var updated = _.merge(result, req.body); poll.markmodified('answers'); updated.save(function (err) { if (err) { return handleerror(res, err); } return res.json(200, poll); }); }); }; my schema: 'use strict'; var mongoose = require('mongoose'), schema = mongoose.schema, objectid = schema.objectid; var answerschema = new schema({ answer: string, votes:{type: number, default: 0} }); module.exports = mongoose.model('answer', answerschema); var pollschema = new schema({ author:

Do Monitors have apis to change input source -

i have 2 monitors benq rl2450h , soniq i want able change source of input these 2 monitors.. would piece of software able change this. there open source alternatives this.. i'm happy code if there no alternative. use case 2 different cables connected 1 monitor eg. 1 hdmi other vga source. i want able let software decide input source used on particular monitor... limitations i cannot use switch d-link (or other companies) because not publicly accessible pc ... needs done using software approach .. additionally, change monitor input source suggests c# method prefer cross platform can coded multiple os's .. python eg.

javascript - Is it possible to pass object as parameter? -

var obj = { name1: 1, name2: 2 } function myf(obj) { console.log(obj.name1) // idea must return 1 }; myf(obj) does know how pass object in function? yes objects make great parameters. var p1 = { name: "tom", age: 23, ismale: true }; var p2 = { name: "alicia", age: 21, ismale: false }; var p3 = { name: "landon", age: 1, ismale: true }; function greeting(person) { var str = ''; str += 'hello name '; str += person.name + ' '; str += 'i'm ' + person.age + ' year old '; if (person.ismale) { str += age > 18 ? 'man' : 'boy'; } else { str += age > 18 ? 'woman' : 'girl'; } if (person.age < 3) { str = 'bah' } console.log(str); }; greeting(p1); // 'hello name tom i'm 23 year old man'; greeting(p2); // 'hello name alicia i'm 21 yea

Rails app Time to first byte very high using heroku -

when loading rails app in production (hosted on heroku) takes 10 seconds load. happens on first time site loaded. subsequent page views load normally. view @ kurtiselliott.com this because heroku lazily spin dyno means first request take ~10 seconds. if leave app idle little while heroku spin down dyno. see article full explanation https://devcenter.heroku.com/articles/dynos#dyno-sleeping

python - How to download previous version of Werkzeug -

how download previous version of werkzeug trusted site? here have tried: 1) went link: http://werkzeug.pocoo.org/docs/0.9/installation/#installing-a-released-version , clicked on "download page" link. it took me 0.10.4 download page. 2) googled "werkzeug download 0.9" , got references 0.10. there download link versioneye.com site don't know if can trust. i need download previous version because 0.10.x dropped support support openssl. [edit] have download rather install pip because don't have access pip on old machine installing on. old, hence complications. [edit] had use older version because 0.10.x dropped support openssl package in favor of ssl built python 2.7.9. stuck on python 2.7.5 wanted continue use openssl package. think made right decision drop support majority of people can upgrade 2.7.9. you can install old package pip: pip install werkzeug==0.9.6

python - Conditional maths operation on 2D numpy array checking on one dimension and doing different operations on diff dimensions -

i have 2d numpy array column 0 pan rotation of device , column 1 tilt rotation. each row different fixture. want run following logic on each row: if(pantilt[0] > 90): pantilt[0] -=180 pantilt[1] *= -1 elif pantilt[0] < -90: pantilt[0] += 180 pantilt[1] *= -1 i understand basic conditional operations on 1d myarray[condition] = something. can't extrapolate more dimensions. i calculate mask, or boolean index, , use if each column: construct sample array: pantilt=np.column_stack([np.linspace(-180,180,11),np.linspace(0,90,11)]) = pantilt[:,0]>90 # j = pantilt[:,0]<-90 pantilt[i,0] -= 180 pantilt[i,1] *= -1 = pantilt[:,0]<-90 # use j instead pantilt[i,0] += 180 pantilt[i,1] *= -1 before: array([[-180., 0.], [-144., 9.], [-108., 18.], [ -72., 27.], [ -36., 36.], [ 0., 45.], [ 36., 54.], [ 72., 63.], [ 108., 72.], [ 144., 81.], [ 180.,

javascript - div resize according to browser window in height -

http://boosterdomains.com/svoge/index_register_2.html hello friends, struggling 1 problem. click in menu top right button, yellow one. open modal window. fine. if clients window/browser horizontally half , uses notebook without scroll? unable register. questions is, how make: modal window automatically resize vertically browser window resizes. want run away scrolling. how make it? currently can suggest several options: you can use fixed height modal window , change media query different devices. you can change javascript getting window height after firing resize event of window object: window.addeventlistener('resize', function (e) { // resize here. }); read how use height in percentage , set around 70-80%.

c++ - What did the author mean with his comment about the input of a user-defined type? -

this example extracted section 10.3.3 input of user-defined types book "the c++ programming language" second edition, b. stroustrup. code old still compiles minor changes. example: #include <istream> #include <complex> using namespace std; istream& operator>>(istream& s, complex<double>& a) { // input formats complex; "f" indicates float: // // f // (f) // (f, f) double re = 0, im = 0; char c = 0; s >> c; if( c == '(' ) { s >> re >> c; if( c == ',' ) s >> im >> c; if( c != ')' ) s.clear(ios::badbit); // set state } else { s.putback(c); s >> re; } if( s ) = complex<double>(re, im); return s; } despite scarcity of error-handling code, handle kinds of errors. the local variable c initilized avoid having value accidentally '(' after fai

Rails 4 Customize ActiveAdmin batch action collection form labels -

i using on rails 4 , activeadmin, batch action collection form capture input user perform batch action ( in case batch mailer). there way customize labels inputs? say example: batch_action :email, priority: 1 , form: {main_subject: :text, message: :textarea } |ids, inputs| batch_action_collection.find(ids).each |user| contactbatchmailer.contact_batch_email(main_subject, message,... instead of having "main_subject", display better formatted text, "main subject", or better, more descriptive variable name itself. i dug in documentation https://github.com/activeadmin/activeadmin/blob/master/docs/9-batch-actions.md#batch-action-forms not able to. suggestions appreciated. the form rendered modal_dialog.js.coffee, should possible override , customize, example see declined pull request @mmustala

How to create Swift variable with JSON literal string? -

i want create string variable json string. swift doesn't seem allow me this, use ` or ' wrap json string escape it. var json = '{"variable":"hello world"}' var json = `{"variable":"hello world"}` thanks swift string literals always enclosed in double quotes " — see here in documentation . there no alternative syntax string literals (like there in ruby example)… @ least of swift 1.2. so if need put quotes in string literal, need escape them. let json = "{\"variable\":\"hello world\"}" (the other alternative if have lot of quotes escape load json string resource file example. that's not string literal anymore)

mysql - inner join display list of sales by customer -

Image
i need display list of sales customer, showing customer id, customer’s name, name of product bought customer, , date of sale , sorted customer id.. here customer table structure create table customer (cust_id int not null auto_increment primary key ,forename char(10) not null ,surname char(10) not null ,phone char(15) null ); here sales table structure create table sales (cust_id char(6) not null ,prod_id char(8) not null ,quantity smallint null ,date_of_sale null ,primary key(cust_id,prod_id) ); thank you. products table this give list of customers, uses left joins - means results show customers have no sales customers sales - information want know. select c.cust_id, c.forename, c.surname, p.prod_name, s.date_of_sale customers c left join sales s on s.cust_id = c.cust_id left join products p on p.prod_id = s.prod_id order c.cust_id asc if want see customers have sales - change left inner . select c.cust_id, c.forename, c.surname, p.prod

jquery - How to use an inline animation of a svg with a javascript on click? -

i working svg on web project. making buildings out of polygons (45 polygons exact) idea change points of polygons when click on button. make animation in between, making building switch different building. i managed make animation inline on svg animate when open page (with delay now). trying when click button inline animation fire. this 1 line of code 1 polygon. <polygon class="b1" fill="#dcdddb" points="555,114 552.5,416 568.5,413.004 "> <animate begin="8000ms" attributename="points" dur="5000ms" to="473.999,335.287 470.845,482.398 461.808,325.766" fill="freeze"/> </polygon> i hope can me. tried doing css3 -webkit-clip-path takes long time create polygons. it's not entirely necessary have svg inline need responsive. when button clicked, animation element want (easier if you've given id can use document.getelementbyid) , call element.beginelement()