Posts

Showing posts from May, 2010

c# - How to stop loading browser page in selenium webdriver -

i using seleninum web driver in c# , facing weird problem. while automating encountered problem page continuously loading although dom content has been loaded. have way go forward until not stop, why driver throws timeout exception. so, need know there way stop page load webdriver. i have googled no luck. you can 2 things. use actions class press esc key stop page loading, code shown bellow: actions actions = new actions(driver); actions.sendkeys(keys.escape); or user javascriptexecutor samething: ((ijavascriptexecutor)driver).executescript("return window.stop();");

How to loop a string without `times` in Ruby -

i'm trying use loop print "¡ruby!" 30 times. done 30.times{print "¡ruby!"} , or using while learning loop . here code: word = "¡ruby!" loop print word * 30 break if word.count < 30 end after printing 30 times wanted,i errors: "wrong number of arguments (at least 1)", "invalid multibyte char (utf-8) (syntaxerror)" , "syntax error, unexpected tfid, expecting end-of-input word = "�ruby!"" thanks. i = 0 loop print "¡ruby!" += 1 break if > 29 end this print out string 30 times. => ¡ruby!¡ruby!¡ruby!¡ruby!¡ruby!¡ruby!¡ruby!¡ruby!¡ruby!¡ruby!¡ruby!¡ruby!¡ruby!¡ruby!¡ruby!¡ruby!¡ruby!¡ruby!¡ruby!¡ruby!¡ruby!¡ruby!¡ruby!¡ruby!¡ruby!¡ruby!¡ruby!¡ruby!¡ruby!¡ruby! for more legible output change print puts

JQuery detect if div is visible during scroll -

i'm using jquery mouse wheel in project manipulate scroll on specific div. var viewwidth = $(window).width(); var temoignageswidth = $('#temoignages .container-fluid').width(); var maxscrolltemoignages = temoignageswidth - viewwidth; var scrollval = 0; var temoignagesdiv = gettemoignagesdiv(); $(window).mousewheel(function(event){ if (temoignagesdiv.top <= $(window).scrolltop() + navbarheight && $(window).scrolltop() + $(window).height() < temoignagesdiv.bot){ scrollval += math.round(event.deltay * event.deltafactor); var scrollup = function(scrollval){ return scrollval <= 0; }; var scrolldown = function(scrollval){ return math.abs(scrollval) <= maxscrolltemoignages; }; var condition = null; if (event.deltay > 0){ scrollval = scrollup(scrollval) ? scrollval : 0; condition = scrollup(scrollval); } else{ scrollval = s

linux - Why compile time address binding? Can anyone explain with example? -

i going through link , found definition compile time address binding. the compiler translates symbolic addresses absolute addresses. if know @ compile time process reside in memory, absolute code can generated (static). does type of address binding available in modern operating systems linux or windows? where can useful or applications? examples helpful.

c# - Reading Json without a property name -

we have following invalid json being returned customer of ours, there way can convert valid json object using newtonsoft library ? tried load invalid json using jtoken in jsonconverter throwing exception invalid character after parsing property name. expected ':' got: }. path 'description[0]' //invalid json { "description": [{"apple"}]} //valid json { "description": [{"type": "apple"}]} thanks in advance -nen as said before, it's better fix source of invalid json response patch code, here's suggestion: string invalidresponse = @"{ ""description"": [{""apple""}]}"; string validrespone = invalidresponse.replace(@"""description"": [{", @"""description"": [{""type"":");

javascript - express TypeError: undefined is not a function -

i'm noob node , express , when run app have error. solutions? thing error here "app.use(express.static(user));" don't sure. var express = require('express'); var http = require('http'); var path = require('path'); var app = express(); // modulos var home = require('./controllers/home'); var model = require('./models'); var user = require('./controllers/user'); // environments app.set('port', process.env.port || 3005); app.set('views', __dirname + '/layouts'); app.set('view engine', 'jade'); app.use(express.favicon()); app.use(express.logger('dev')); app.use(express.bodyparser()); app.use(express.methodoverride()); app.use(app.router); app.use(express.static(path.join(__dirname, 'public'))); app.use(express.static(user)); // development if ('development' == app.get('env')) { app.use(express.errorhandler()); } // rutas app.use(home); err

c# - Optimize pixel image comparison using emgu cv libraries instead of for loops -

i'm working on invisible watermarking c# project. requirement embed watermark image cover image based on comparing each watermark image pixel each cover image pixel based on threshold value. i have used 4 for-loops iterating through watermark image and cover image. works smaller image (ie: 30x30 pixels), need optimize bigger images , find best fitting place of watermark pixel in cover image location. i know not optimum way, instead of loops need suggestion of best library use in emgu cv in c# these easily. please suggest way optimize piece of code bigger images. thanks. // iterate through watermark_img (int x = 0; x < watermark_img.height; x++) { (int y = 0; y < watermark_img.width; y++) { //iterate through cover image (int = 0; < cover.height; i++) { (int j = 0; j < cover.width; j++) {

tsql - CFQuery Getting GeneratedKey from Multiple Insert into SQL Server -

i trying generated keys (or identitycol) of rows inserting using multiple insert syntax. <cfquery> create table tempperson ( personid int not null identity (1,1) primary key, lastname varchar(20), firstname varchar(20) ); </cfquery> <cfquery result="qrresult"> insert tempperson( lastname, firstname ) values( 'smith', 'michael' ), ('jones','ricky') </cfquery> <cfdump var="#qrresult#"> i ran in both cf10 , railo 4.2 in combination both sql server , mysql. cf10 sql server - no generatedkey returned. recordcount variable recordcount = 2 cf10 mysql - identity columns list, wrong recordcount generatedkey = 1,2 recordcount = 1 railo 4.2 sql server - gets last identity column generatedkey = 2 recordcount = 2 railo 4.2 mysql - identity columns list, , right recordcount generatedkey = 1,2 recordcount = 2 so

android - How to send an image to Chromecast using NanoHTTPD -

i want serve file, image example, chromecast. used nanohttpd can reach content via url , here code use url: private class webserver extends nanohttpd { public webserver() { super(8080); } @override public response serve(string uri, method method, map<string, string> header, map<string, string> parameters, map<string, string> files) { file rootdir = environment.getexternalstoragedirectory(); file[] fileslist = null; string filepath = ""; if (uri.trim().isempty()) { fileslist = rootdir.listfiles(); } else { filepath = uri.trim(); } fileslist = new file(filepath).listfiles(); string answer = "<html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"><title>sdcard0 - tecno p5 - wifi file transfer pro</title>"

ios - AnyObject property in Swift -

i have question property of anyobject in swift. have method anyobject variable. can check type it, example want perform operation on property regardless of type of variable (all possible types have same property). possible call varaiable? in cases, anyobject property mistake. protocol or generic right tool. example, if want perform operation "regardless of type" mean type has characteristic allow perform operation. characteristic (for instance, existence of property) best expressed protocol.

ember.js - Send multiple parameters from ember component -

i want send 2 parameters action in ember component. documentation suggests how send 1 parameter eg {{#each todos |todo|}} <p>{{todo.title}} {{confirm-button title="delete" action="deletetodo" param=todo}}</p> {{/each}} how send multiple params? thanks same way sent first one: {{confirm-button title="delete" action="deletetodo" param=todo param2=myotherparam}}

java - AsyncTask dont show me message from server (HttpUrlConnection) -

so i'm trying read message server httpurlconnection in asynctask class. problem is, when send request read data server, keeps displaying progresssdialog, doesn't read data server: public class mainactivity extends activity{ edittext name, password; button login; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); name = (edittext) findviewbyid(r.id.name); password = (edittext) findviewbyid(r.id.password); login = (button) findviewbyid(r.id.login); login.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { string serverurl = "http://192.168.1.1/my/text.php"; longoperation longoperation = new longoperation(); longoperation.execute(serverurl); } }); } private class longoperation extends asynctask<string, void, void> { private string

Timer logic on AVR -

i trying understand piece of code, not able understand how interrupt routine works ocr1a getting updated. using avr series of controller run code. void timerinit(void) { disable_timer_int; // disable timer interrupt m_nglobaltime = 0; // reset system time ocr1a += ticks_per_msecond; // set first clock period tccr1a = 0;// set timermode normal tccr1b |= (1 << cs10);// clckio, no pre-scaler; set timermode enable_interrupts; enable_timer_int;// enable send timer interrupt (1 ms) } isr( timer1_compa_vect) { uint16_t ntemp; ntemp = tcnt1; // current time ntemp -= ocr1a; // subtract interrupt time if (ntemp < (ticks_per_msecond / 2))// if more half period left { ocr1a += (ticks_per_msecond);// add offset ocr1a relative } else { ocr1a = tcnt1 + (ticks_per_msecond);// set ocr1a 1 ms absolute }

How to make Ubuntu Mate headless, and auto-login on a Raspberry Pi? -

i know how auto login raspberry pi on start graphical interface using lightdbm. i know how make raspberry pi "headless". i know how run script @ start up. (~/.bashrc) my problem is: don't know how make script runs @ start can auto login raspberry pi while disabling graphical interface in order make run headless. i have found few articles, people use /etc/inittab file not seem there on ubuntu mate version. have looked file in /etc/init/tty1 it's not there neither.

ios - Push notification custom sound not played instead of default sound -

my problem here: i use parse push notifications services, works fine, receive local notifications on device, works, problem @ point: custom sound isn't played, instead, default ios notification sound played. all done in rules, have supported packaged sound in ".wav" verified quicktime player confirmed custom sound file in "pcm linear" format. the sound file, correctly present in main bundle of application , copied if needed in copy bundle resources (furthermore, code in appdelegate looking correct) i show code more details: nsdictionary *data = [nsdictionary dictionarywithobjectsandkeys: @"you have received coin !", @"alert", @"increment", @"badge", @"custom_bell.wav", @"sound", nil]; pfpush *push = [[pfpush alloc] init]; [push setdata:data]; [push sendpushinbackground]; what missing setting ? why wrong ? changed in ios 8 ? yes changed in ios 8 because in ios 8

javascript - How can I call the jQuery function: animate from outside the html? -

i making website , have picked few things jquery. the problem when want put function out of index file nothing. this in index file: <head> <script src="js/scripts.js" type="text/javascript"></script> <script src="js/jquery-1.11.3.js" type="text/javascript"></script> <script> $(right()) </script></head> and scripts.js contains: function right() { $("#right").animate({right: '0'}, 800);} the #right div inside index file. try calling script tag inside body rather head. alternatively, if want within head, call within block this: $( document ).ready(function() { right(); }); for javascript execute, either needs inside body of document, or needs set trigger on event (in case, event "when document ready").

Generating GitHub wiki pages from Doxygen style XML comments in c++ -

i have doxygen style xml comments c++ project working on, , take , make github wiki page these comments. best way so? cannot use github pages. have tried pandoc, pages generates not wind looking nice, not sure if because using wrong or other reason.. any appreciated. thanks!

html - Stop list from also moving/shrinking when resizing screen -

whenever resize screen, on screen stays , scroll bar appears... except horizontal list. keeps moving along screen , becoming multiple layers , messing up. there way me keep list moving? tried adding {white-space: nowrap} #primary_nav_wrap ul item. however, causes drop down under "committee" become horizontal drop down rather vertical drop down menu. there way make entire list not move , same time not cause drop down change? affect parent , not child? here's css #topbar{ background-color: #636363; height:2.4em; position:absolute; width:81.8em; margin: auto; top:0; } #topbar2{ background-color: #636363; height:2.4em; position:absolute; width:81.8em; margin:auto; top:10em; z-index:-1; } #title{ font-family:basic title font; color:#ffffff; position: absolute; top:-0.6em; font-size:1.6em; left:17.4em; z-index:1; white-space: nowrap;} #logo { position:absolute; top:2.6em; left:36.5em; z-index:1; width:9

ios - How can I signup with Username + Email + Password [Swift + Deployd]? -

how can make alamofire(swift-ios) , deployd accept third parameter (property) i.e., email? it's working fine need add email textfield too. swift code: let user = "root" let password = "root" //let email = "root@root.com" (the third parameter) let credential = nsurlcredential(user: user, password: password, persistence: .forsession) let parameters = ["username" : user, "password" : password] alamofire.request(.post, "http://localhost:2403/users", parameters: parameters) .authenticate(usingcredential: credential) .response { request, response, _, error in } from deployd's docs: //create user dpd.users.post({ username: "jeffbcross", password: "secret" }, oncreateuser); add custom properties , roles users, , write custom event scripts control access users of app. i have no idea how can write custom event script. don't know language

apache - custom php.ini not taking effect -

the php.ini file used take effect before july 23rd (2015) (new build date of php version), after build date, php.ini file no longer takes effect. had tried renaming php.ini .user.ini no change. had chat godaddy server support team don't know this. can me solve this? its starts working fine now. think changes in settings might reason.

c# - How to pass dictionary as part of the payload in POST request in Advanced Rest Client -

i trying use advanced rest client chrome extension testing webapi locally , pass dictionary part of payload post request trying make. while debugging found out dictionary though passing in json format doesn't deserialize correctly , count dictionary remains zero. payload example : { "dictionaryforevaluationtelemetries" :{ "b":"{\"counter\":\"500\"}"} } this simple code object part of dictionary [datacontract] class class1 { private int counter; [datamember] public int counter { { return counter; } } public void increment() { interlocked.increment(ref counter); } } [datacontract] public class telemetrypayload { [datamember] public concurrentdictionary<string, class1> dictionaryforevaluationtelemetries { get; set; } } [httppost] public void logevaluationtelemetry() { // internally below method :

Dailymotion url shows adds before starting video -

i using dailymotion partner program uploaded video form application showing advertisement before actual video starts. there way avoid it? avoid info info=0. also autoplay=1 not playing video automatically on android devices? here url video. http://www.dailymotion.com/embed/video/k5i37tfoyjxdgub0oyu?related=0&logo=0&info=0 this url avoid related video , video information important avoid advertisement. thanks help. it not possible remove advertisement dailymotion video. dailymotion, other video sharing platforms, has need cover expenditure in order offer service you. why advertisments automatically displayed videos. about autoplay issue: mobile devices prevent videos being played automatically, why autoplay parameter may not work on devices. devices require user interaction first play video. please read following more detailed info: dailymotion embedded player on ios devices (html5) (and next time, please remember should ask 1 question per post)

javascript - ng-repeat on select is overriding content -

i have code: <select> <div class="arrow-up"></div> <option data-ng-repeat="x in y">{{x}}</option> </select> the output hides arrow div like: <select class="ng-pristine ng-valid"> <option data-ng-repeat="x in y">x1</option> <option data-ng-repeat="x in y">x2</option> </select> is built-in operation or missing something? thanks according official documentation of <option> can declare <option> , <optgroup> tags inside it. quote docs. html select <select> element permitted content: 0 or more <option> or <optgroup> elements.

How Do i translate command line curl commang into PHP curl call? -

here command line command: curl -h "authorization: bearer api_key" -x put https://graph.api.smartthings.com/api/smartapps/installations/device_id/lock here have uptill now, wrong code: $headers = array('authorization: bearer ' . $st_api_token); $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_httpheader, $headers); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_verbose, true); curl_setopt($ch, curlopt_customrequest, 'put'); $response = curl_exec($ch); curl_close($ch); output var_dump(curl_getinfo($ch)); is, still unable find real error or doing wrong in translating code php: <?php array (size=26) url => string 'https://graph.api.smartthings.com/api/smartapps/installations/c8137097-8532-43b8-b516-0573cb91ecee/setlockcode/20/3333' (length=118) 'content_type' => null 'http_code' => int 0 'header_size' => int 0 'request_size'

asp.net mvc - MVC 4.0 Routing Issue -

i building out custom section in site, , has multiple routes, have controller set follows: controller - exporttoexcel action eomspreasheet parameters eomdate, siteid in routeconfig have following set up. routes.maproute(name: "eomcoversheet", url: "{controller}/{action}/{eomdate}/{siteid}", defaults: new { controller = "excelexport", action = "eomspreasheet", eomdate = urlparameter.optional, siteid= urlparameter.optional }); when make call controller, , in code stepping through it, values eomdate , siteid null. when @ routedata can see action , controller, parameters route have in routeconfig file. i have done numerous times in past, first time have seen behavior , not sure how resolve it. ye can provide appreciated. two things note .net routing are: the routes executed in order first registered last, , first match wins. route tokens (such {controller} ) match url segment unless put constraint on

android - toolbar actions triggering settings menu -

Image
i have toolbar typical settings activity attached 3 dot menu. in 1 of fragments change toolbar add couple of icons, when these icons pressed runs method , launches typical settings activity, heres how call settings in main activity @override public boolean oncreateoptionsmenu(menu menu) { if (!mnavigationdrawerfragment.isdraweropen()) { // show items in action bar relevant screen // if drawer not showing. otherwise, let drawer // decide show in action bar. getmenuinflater().inflate(r.menu.main, menu); return true; } return super.oncreateoptionsmenu(menu); } @override public boolean onoptionsitemselected(menuitem mitem) { // handle action bar item clicks here. action bar // automatically handle clicks on home/up button, long // specify parent activity in androidmanifest.xml. int id = mitem.getitemid(); intent intent = new intent(mainactivity.this, settings.class); startactivity(intent); //noins

nginx - 502 error when trying to authorize Gitlab CI as an Application in Gitlab -

so have gitlab , gitlab-ci server running on separate machines. trying authorize ci application via oauth, when hit authorize button, 502 error. i've confirmed i'm using correct app id , secret application i've created ci server in gitlab, , unfortunately, nginx , unicorn logs gitlab aren't providing me useful information. has seen sort of behaviour before? did add gitlab server certification gitlab-ci server? best.

ios - Style UIPageControl when using AlzheimerPageViewController -

there's documented bug in ios uipageviewcontroller transitionstyle: .scroll not track index due internal caching (on swipe, it'll skip index == 1). person kindly solved problem following gist: https://gist.github.com/paul-delange/5582394 . question: how style uipagecontrol when using alzheimerpageviewcontroller rather uipageviewcontroller? following (swift) code works normal uipageviewcontroller, if put in appdelegate application/didfinishlaunchingwithoptions function, not apply alzheimerpageviewcontroller. goal style pagecontrol (aka dots) gray, on white background. let pagecontrol = uipagecontrol.appearance() pagecontrol.pageindicatortintcolor = uicolor(nethex: 0xdddddd) pagecontrol.currentpageindicatortintcolor = uicolor(nethex: 0x666666) pagecontrol.backgroundcolor = uicolor.whitecolor() this how instantiate alzheimerpageviewcontroller in viewdidload(): var pageviewcontroller = alzheimerpageviewcontroller(transitionstyle: .scroll, navigation

java - How to send an object from a mousePressed event in a Frame/Panel in ViewA to ViewB in eclipse 3.x RCP? -

in viewa, have panel within frame being displayed. when click on object within panel, send object function in viewb. public class viewa extends viewpart{ public void createpartcontrol(composite parent) { composite swtawtcomponent = new composite(parent, swt.embedded); java.awt.frame frame = swt_awt.new_frame( swtawtcomponent ); javax.swing.jpanel panel = new javax.swing.jpanel( ); ... } } public class viewb extends viewpart{ ... public void foo(object o){ } } i have seen many questions here regarding communicating between 2 views, using iselectionlistener, , link vogella tutorials on commands such as; eclipse rcp let 2 views communicate , eclipse rcp update view after changes in editor etc. however, every question's solution assumes triggering event selection within tableviewer (or viewer) , not within frame/panel mousepressed event. please help.

Call google analytics method _trackEvent() from php -

i need call methode _trackevent() php when execute route. it's possible in php ? me please. exist solution. thx in advance. _trackevent a) javascript , b) deprecated. can't call php, can use google measurement protocol same results. the measurement protocol standard api forms basis data collection universal analytics (across devices). specify client id , hit type (in case "event") , necessary parameters depending on hit type. the api endpoint www.google-analytics.com/collect . parameter list event looks this: v=1 // version. &tid=ua-xxxx-y // tracking id / property id. &cid=555 // anonymous client id. &t=event // event hit type &ec=eventcategory // event category. required. &ea=evenaction // event action. required. &el=eventlabel // event label. &ev=1 // event value. this example uses placeholders (so replace values after equal sign own variables), event label , event

Bootstrap panel unwanted right and left margins on smaller sizes -

Image
i created panel using bootstrap , codes below: <section class="container-fluid" id="stats"> <div class="panel panel-default col-md-6"> <div class="panel-heading"> <i class="fa fa-bar-chart fa-lg"></i> <strong>statistics</strong> </div> <div class="panel-body"> ... </div> </div> </section> but output have gap left , right in panel heading. if remove col-md-6 , problem became solved. need have 6 cols. please me ... edit: can take @ sample http://codepen.io/mbsmt/pen/enxmoy you have padding on left , right because default bootstrap adds gutter padding columns. gutter width 15px . here's mixin creates .col-md- classes: // located within less/variables.less //** padding between columns. gets divided in half left , right. @grid-gutter-width: 30px; // located within less/mixins/grid.less .ma

ui select2 - Disable form submit on multiple ui-select for Angularjs -

when using multiple version of ui-select angularjs form submitted once user presses enter. many users start typing tag , press enter select , search new one. once users presses enter form submitted. what best 'angular' way disabled this? see example <form ng-submit="submit()"> <ui-select multiple ng-model="multipledemo.colors" theme="select2" style="width: 300px;"> <ui-select-match placeholder="select colors...">{{$item}}</ui-select-match> <ui-select-choices repeat="color in availablecolors | filter:$select.search"> {{color}} </ui-select-choices> </ui-select> <p>selected: {{multipledemo.colors}}</p> <div style="height:500px"></div> </form> if understand requirement, solution work you. please leave comment if want achieve else. index.html <ui-select ng-keypress="selec2_keypress

java - Equivalent of matcher.start and matcher.end in c# -

i new c# , trying convert below code c# can not find api in c# so. please explain equivalent of matcher.start() , matcher.end(). what equivalent of matcher.group() in c#. private string getfinalvariant(string strinputword) { pattern pat = pattern.compile("[aeiouhy]+"); matcher mat = pat.matcher(strinputword); int lenghtofinputword = strinputword.length(); while (mat.find()) { if (mat.start() == 0) { int index = '1'; map<string, string> temp = rulelist[index]; if (temp.containskey(mat.group())) { strinputword = strinputword.replacefirst(mat.group(), temp.get(mat.group())); } } else if (mat.end()== lenghtofinputword) { int index = '3'; int lastindex = strinputword.lastindexof(mat.group()); map<string, string> temp = rulelist[index]; if (temp.containskey(mat.group())) { string tail = strinputword.substring(lastindex).replacefirst(mat.group(),

delphi - When is Length evaluated for a static array? -

this question has answer here: how length() function in delphi work? 5 answers type tmyarray = array [0..255] of integer; var arr: tmyarray; .... writeln(length(arr)); when length() evaluated in context, when passed static array? evaluated @ runtime, or @ compile time? when length() evaluated in context, when passed static array? it evaluated @ compile time, , therefore carries no runtime overhead.

asp.net mvc - I want to make multi tenant site in identity 2.0 but not using user table. Can anyone give any demo project -

public void configureauth(iappbuilder app) { startup.dataprotectionprovider = app.getdataprotectionprovider(); app.createperowincontext(applicationdbcontext.create); app.createperowincontext<applicationusermanager>(applicationusermanager.create); app.createperowincontext<applicationrolemanager>(applicationrolemanager.create); app.createperowincontext<applicationcustommanager>(applicationcustommanager.create); } i need custom manager code identity 2.0 in asp.net mvc. here need tenant not user have table named site. want site curd handle owin context. i need example of custom application manager code other entity except user , role. hope gets started public class applicationcustommanager : idisposable { public applicationcustommanager(applicationdbcontext _applicationdbcontext) { //do operations per requirements _applicationdbcontext } public static applicationcustommanager create(identityfactoryoptions

computer vision - How to calculate the mean IU score in image segmentation? -

how compute mean iu (mean intersection on union) score in this paper? long, jonathan, evan shelhamer, , trevor darrell. "fully convolutional networks semantic segmentation." for each class intersection on union (iu) score is: true positive / (true positive + false positive + false negative) the mean iu average on classes. regarding notation in paper: n_cl : number of classes t_i : total number of pixels in class i n_ij : number of pixels of class i predicted belong class j . class i : n_ii : number of correctly classified pixels (true positives) n_ij : number of pixels wrongly classified (false positives) n_ji : number of pixels wrongly not classifed (false negatives) you can find matlab code compute directly in pascak devkit here

Facebook API batch request with Google Apps Script -

i'm struggling building batch request in apps script change multiple facebook ad set budgets in 1 api call. facebook gives me following example (curl): curl -f 'access_token=____' -f 'batch=[ { "method": "post", "relative_url": "<api_version>/6004251715639", "body": "redownload=1&bid_info={\"clicks\":100}" }, { "method": "post", "relative_url": <api_version>/v6004251716039", "body": "redownload=1&bid_info={\"clicks\":100}" }, { "method": "post", "relative_url": "<api_version>/6004251715839", "body": "redownload=1&bid_info={\&q

java - How to get date in this format Sun May 17 2015 09:31:49 -

this question has answer here: converting date format 5 answers i getting date in calender object 1 of client api in format "2015-05-17t09:31:49" want displayed in "sun may 17 2015 09:31:49" . tried below code giving me output in format sun may 17 00:00:00 ist 2015 simpledateformat ft = new simpledateformat ("yyyy-mm-dd"); string input = "2015-05-17t09:31:49"; date t = ft.parse(input); system.out.println(t.tostring()); someone please guide me how this. check can you: simpledateformat ft = new simpledateformat ("yyyy-mmm-dd hh:mm:ss"); string input = "2015-05-17 09:31:49"; date t = ft.parse(input); system.out.println(t.tostring());

algorithm - Working through nested loops -

is there way find primes between 0 100 without using nested loops, i.e. time complexity of less n^2. did try recursion still same same complexity. can please. thanks a useful implementation pre-calculate list. my @primes = ( 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, ); @primes; obvious? maybe, bet many people post far more complex, , slower solutions.

java - Session bean returns the wrong value -

i have following html page, servlet class , bean class implemented in eclipse project runs on wildfly 8. the problem have every time call servlet values add operation in bean class returns zero . know i'm not doing trivial thing correct. should change correct value add operation. addservlet.java import java.io.ioexception; import java.io.printwriter; import javax.ejb.ejb; import javax.servlet.servletexception; import javax.servlet.annotation.webservlet; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; import ejb.addejb; @webservlet("/addservlet") public class addservlet extends httpservlet { private static final long serialversionuid=1l; @ejb addejb bean; public addservlet() { super(); } protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { printwriter out=response.getwriter();

javascript - D3 axis and bar transition not working -

lost on since i've done before. code below within function called on click. first example works fine: y.domain([1, get_max(data)]); svg.select('.y.axis') .call(yaxis); svg.selectall('.bars') .attr('y', function (d) { return y(d); }) .attr('height', function (d) { return height - y(d); }); this second example doesn't anything: y.domain([1, get_max(data)]); svg.select('.y.axis') .transition() .duration(80) .call(yaxis); svg.selectall('.bars') .transition() .duration(80) .attr('y', function (d) { return y(d); }) .attr('height', function (d) { return height - y(d); }); no javascript errors produced. doesn't anything. appreciated. thank you! note: get_max(data) special function max of oddly formatted data. when replace hard coded value of 10,000 problem persists. again works fine until add transition. edit: function render(parent, data, brands){ v

android - ListView does not change elements at scrolling -

i have several markers on google map , in each marker listview several entries. each entry can liked user , if has liked, there stored entry in sqlite database marker id, entry id , if has liked (1) or took (0) , activity reloaded. want filled heart shown below each list item user has liked. problem is: if there many entries, there randomly filled hearts, if user liked 1 entry. these falsely filled hearts appear @ scrolling assume, listview not update elements @ scrolling... here code: @override public view getview(final int position, view convertview, viewgroup parent) { final listcell cell; if (convertview == null) { convertview = inflater.inflate(r.layout.pinboard_list_view_cell, null); cell = new listcell(); cell.likes = (textview) convertview.findviewbyid(r.id.listviewlikes); cell.note = (textview) convertview.findviewbyid(r.id.listviewnote); cell.img = (imageview) convertview.findviewbyid(r.id.listviewimg); cell.likei

list - Comparing tuple elements against integers with Python -

i having hard time converting data. select data database, returned in tuple format. try convert them using list() , list of tuples. trying compare them integers receive parsing json. easiest way convert , compare these two? from dbconnection import db import pymssql data import jsonparse db.execute('select id party partyid = 1') parse = jsonparse.parse() row in cursor: curlist = list(cursor) = 0 testdata in parse: print curlist[i], testdata['data'] += 1 output: (6042,) 6042 (6043,) 6043 (6044,) 6044 (6045,) 6045 sql results come rows , sequences of columns; true if there 1 column in each row. next, executing query on db object (whatever may be), iterating on cursor; if works @ more down luck. you'd execute query on cursor object. if expect 1 row returned, can use cursor.fetchone() retrieve 1 row. for row in cursor loop skipping first row . you use: cursor = connection.cursor() cursor.execute('select id party pa

angularjs - Angular toast directive seems to ignore options attribute -

working angular, wanted toast messages... per questions chose angular toast fire notification toaster in controller angularjs but when try set location thusly <toaster-container toaster-options='{ "time-out": 15000, "animation-class": toast-bottom-right, "position-class": toast-bottom-right }'></toaster-container> it's ignored... unless modify actual source 'position-class': 'toast-bottom-right', // options (see css):// changed manually work around bug ingnored setting - ewb // 'toast-top-full-width', 'toast-bottom-full-width', 'toast-center', // 'toast-top-left', 'toast-top-center', 'toast-top-right', // 'toast-bottom-left', 'toast-bottom-center', 'toast-bottom-right', at time settings here used, if conflict modified source. what doing wrong setting options on directive markup? is the

numerical methods - sRGB's linear segment to avoid infinite slope - why? -

in article srgb ( https://en.wikipedia.org/wiki/srgb ) stated, gamma transformation has linear portion near zero, "avoid having infinite slope @ k = 0, can cause numerical problems". i'd know what's problem that. there 2 answers, usual gamma. modern variant is: the problem infinite slope need "infinite" resolution (many bits of storage) in order arrive @ linear representation invertible gamma-encoded without loss. in other words, allows small lookup table produce invertible linear encoding (8bit -> 10 bit -> 8 bit). the numerical problem understood on first step (8 bit -> 10 bit). infinite slope near zero, need bigger encoding range stay faithful , reversible, i.e. you'd need more 16 bit (assuming integer coding, halfs not have problem). the linear equivalent of #010101 or 1/255th square (gamma = 2.0) coding 1/(255*255)th. need 16 bits represent faithfully, , using 2.2 not 2.0 exponent make worse. these quite small numbers cor

php - Why does this function return zero? -

i have function triggered via jquery ajax. within function, stop via return . example: if ($processed_total < 3) { echo 'post approved. '; return; } the problem output be: post approved. 0 note 0 @ end. why there? doing wrong? edit: here js used calling function: jquery('.voteapproveform').submit(ajaxsubmit_voteapproveform); function ajaxsubmit_voteapproveform(){ var voteapproveform = jquery(this).serialize(); jquery(this).parent().fadeout(); // hide approve , reject button prevent further voting jquery.ajax({ type:"post", url: siteparameters.site_url+"/wp-admin/admin-ajax.php", data: voteapproveform, context: this, success:function(data){ jquery(this).fadeout(); // hide approve box on submit jquery(this).parent().next().html(data); // empty div .modboxfeedback show returned data } }); return false; } retu

Pop up menu with icons in android -

Image
is there way use icons pop menu. have searched lot , seen several examples. none of them good. there alternative use pop icons. actually, have implement things shown in picture

php - How to make border for container in ZingChart -

Image
how make border around chart , title bar on in zingchart. tried plotarea border around graph not complete chart. want black border , title able make red border in image. here code { "type":"bar", "plotarea":{ "border-color" : "#0ff", "border-width" : "2px" }, "series":[ { "values":[11,26,7,44,11] }, { "values":[42,13,21,15,33] } ] } accomplishing can achieved using border attributes specific sides of different objects. in case, setting borders right , left of chart, , bottom of title. here example shows approach in action, key parts use in own code. var myconfig = { type: "bar", borderright: "6px solid #000", borderleft: "6px solid #000", borderbottom: "6px solid #000", title: { text: "my title", height: 40, borderbottom: "6px solid #000

Filter AdSense Report by Site Name using Management API -

Image
is there way create filter using site name? have looked in here , many other sites not find desired filter: https://developers.google.com/adsense/management/reporting/filtering?hl=en this site filter in adsense front-end: i figured domain_name dimension can used filter on specific site.

java - Binary Search Tree : Insertion -

i working on exercise binary search tree : insertion on hackerrank. here problem statement: you given pointer root of binary search tree , value inserted tree. insert value appropriate position in binary search tree , return root of updated binary tree. have complete function. i submitted following solution , passed 4 of 6 test cases , failed 2 of 6 test cases problem not able see 2 test cases failed not sure why failing. have tried create own test cases , seemed working correctly. can think of test cases solution not work for? hoping point me in right direction /* node defined : class node int data; node left; node right; */ static node insert(node root,int value) { if (root == null){ root = new node(); root.data = value; return root; } arraylist<node> list = new arraylist<node>(); list.add(root); getnode(list,value); return root; } static void getnode(arraylist<node> list,int value){ arraylist<node> new

amazon web services - AWS SDK PHP Class Not Found -

when use aws sdk php error stating class cannot found. <?php require_once '/var/www/html/aws.phar'; use aws\common\aws; use aws\common\enum\region; echo "test"; $awsregion = region::us_east_1; $aws = aws\common\aws::factory(array('key'=>'key', 'secret' => 'secret_key', 'region' => $awsregion)); $client = $aws->get('sqs'); ?> the exact error message receive php fatal error: class 'aws\common\enum\region' not found in /var/www/html/sendsqs.php any appreciated. thanks! i had same issue using sdk in wordpress. installed sdk via composer,but sdk won't work. please try zip version,and include sdk "aws-autoloader.php". https://github.com/aws/aws-sdk-php/releases

Role a 6 to win! PHP Code -

i'm learning how use do/while loops in php through codeacademy. i'm working on challenge create six-sided die , continue rolling until six. here's i've come far: <?php $roll = 1; { echo “roll number " . $roll . ". begin rolling 6."; } while ($roll != 6); { ($rollnumber = 1; $roll != 6; $roll ++) { $roll = rand(1, 6); echo "on roll number " . $rollnumber . "you got " $roll ".\n"; };} ?> i though best way started creating roll variable can use once loop check if it's working: $roll = 1; i set value 1 instead of zero, because there's no 0 number on die, , we'll assume player first rolls one. next want check if loop working echo following: do { echo “roll number " . $roll . ". begin rolling 6."; } after making sure loop worked, create while condition: while ($roll != 6) { then want create rollnumber variable keep track of roll i'm on , increment it: for ($rollnumb