Posts

Showing posts from August, 2011

python - How to Detect event generated by USB device into raspberry pi -

hello geniuses want detect event generated usb device attached barcode scanner.now want barcode scanner plugged in usb port of raspberry pi.now when scan how can rpi detect usb device has generated event. hopefully pyusb works, , in case can follow this guide if whatever reason doesn't work, open /dev/tty device direclty standard: with open('/dev/tty4', 'rb') fh: event in fh.read(8) note /dev/tty out-of-the-hat example, device might end somewhere else. check dmsg , lsusb determine device got mounted, if @ mounted or discovered. might need specific drivers scanner.

php - check if the row exists or not in the database -

hi i'm inserting rows in database , , want check if value exists don't insert , if not insert , that's controller : <?php namespace app\http\controllers; use illuminate\http\request; use app\http\requests; use app\http\controllers\controller; use input; use auth; use app\user; use app\product; use db; class listcontroller extends controller { // public function getindex(request $request){ $user_id=auth::user()->id; $list=db::table('wishlist') ->join('products','wishlist.product_id','=','products.id') ->join('users','wishlist.user_id','=','users.id') ->select('wishlist.id','wishlist.product_id','wishlist.user_id', 'products.id p_id','products.name','products.salary','products.image_name', 'users.id u_id') ...

python - How to extract the specific contents from the html doc I grasp -

i'm new on beautifulsoup , urllib. want read data pm25.in ,which website offering atmospheric quality data of china. my attempt ### set specific city name, token public key free use city = 'zhuhai' html_doc = urllib.urlopen("http://www.pm25.in/api/querys/co.json? city=zhuhai&token=5j1znbvasnsf5xqynqyq").read().decode('utf-8') soup = beautifulsoup(html_doc) result <html> <body> <p> [{"aqi":29,"area":"珠海","co":0.591,"co_24h":0.955,"position_name":"吉大","primary_pollutant":null,"quality":"优","station_code":"1367a","time_point":"2016-01-07t20:00:00z"},{"aqi":51,"area":"珠海","co":0.913,"co_24h":1.059,"position_name":"前山","primary_pollutant":"颗粒物(pm10)","quality...

GZIP compression always 1.00x on iOS Safari? -

Image
i'm looking @ web traffic between ios 9.2 safari , our web server , see of our responses gzip-ed, factor 1.00x. we're not saving bandwidth, whole point. does know going on here? overlooking something? or misconfigured? on desktop browser content compressed @ least factor 5. thanks! pascal. actually, misinterpretation of safari webinspector. may find answer here: http://forums.tumult.com/t/turning-on-compression-enabling-gzip-on-your-server-to-speed-up-loading-times/4762/3 safari encoded, decoded, transfered, compression rate not reliable (or @ least, not have same meaning has in chrome/firefox/edge). this "safari feature" has been pinpointed in 2014 here: https://stackoverflow.com/a/21943693/7173518 without "content length", safari lost in indicators. , there no "content length" on nginx dynamic gzip activated. c.

javamail - Unable to send richtext content type mail to outlook using java mail -

i sending mail outlook using java mail api. able send plain text , html content mail when set content type text/richtext receive mail in plain text only. can body suggest how send richtext mail? here tried: // parent or main part if multipart mainmultipart = new mimemultipart("related"); // hold text , html , tells client there 2 versions of message (html , text). presumably text // being alternative html multipart htmlandtextmultipart = new mimemultipart("alternative"); // set html mimebodypart htmlbodypart = new mimebodypart(); htmlbodypart.setcontent("hi", "text/richtext"); htmlandtextmultipart.addbodypart(htmlbodypart); mimebodypart htmlandtextbodypart = new mimebodypart(); htmlandtextbodypart.setcontent(htmlandtextmultipart); mainmultipart.addbodypart(htmlandtextbodypart); message.setcontent(mainmultipart); first - try adding richtext content, not plaintext: {\rtf1\ansi\deff0 {\fonttbl {\f0 courier;}} {\colortbl;\red0\...

bash - lua os.execute doesn't work if the script runs from /etc/rc.local -

i have simple lua script listens particular event , fire post request twilio.com web service start call , send mail. #!/usr/bin/lua -- february 2015, suxsem local sock = require("socket") local mosq = require("mosquitto") local mqtt = mosq.new("sonny_lua_scattato", true) mqtt:login_set("***", "***") local call = function (from, to) os.execute([[curl -x post 'https://api.twilio.com/2010-04-01/accounts/***/calls.json' \ --data-urlencode 'to=]] .. .. [[' \ --data-urlencode 'from=]] .. .. [[' \ -d 'url=https://demo.twilio.com/welcome/voice/' \ -d 'method=get' \ -d 'fallbackmethod=get' \ -d 'statuscallbackmethod=get' \ -d 'timeout=20' \ -d 'record=false' \ -u ***:***> twiliolog.txt]]) end local call...

Run ruby script from rake task -

i have small ruby script runs fine when run manually command line. uses 3 gems have installed using "gem install x" , @ top of script file have lines "require x". works fine. now creating task in rake call ruby script. have tried both use system("/tools/myscript.rb #{foo} #{bar}") and `/tools/myscript.rb #{foo} #{bar}` but both give me error: myscript.rb:2:in `require': no such file load -- ruby-audio (loaderror) it seems gem not loaded. tried add gems gemfile of rails app after necessary gems had been added , ran bundle update ended in error mysql adapter not working script. but since script works fine command line, thought there should easy way call within rake task. any ideas? use bundle exec <script> to sure load bundled gems script want run

database - SQLITE Query For Composite Data to show in one column for the identical column value -

Image
i have implement 1 complex query in sqlite don't have proficient knowledge in sqlite. i have 1 table named pupiltestanswers in have composite primary key my schema follows: create table pupiltestanswers ( testquestionid integer not null, pupilid integer not null, testid integer not null, score integer not null default(-2), lastupdated text, ismyscore integer not null, isuploaded integer not null, primary key(testquestionid, pupilid) ); now data follows: now data want give me list of data should unique combination in result. e.g. 18 | 3 | 2 | 1 | 2016-01-06t06:13:50.000z | 1 | 0 16 | 154 | 2 | 0 | 2016-01-06t06:13:50.000z | 0 | 0 for above tow row their lastupdate values same same testid need 1 row in result follows row , rows testid , last update different need separate row them 18,16 | 3,154 | 2 | 1,0 | 2016-01-06t06:13:50.000z | 1,0 | 0,0 so aboe thing want achieve in sqlite . i have tried in sqlserver can't convert query in sqlit...

regex - Regular Expression function for maximum 15 characters -

i need regular expression reference number entered user takes maximum of 15 characters (numbers , letters only). how best implement this? here have tried date. private static final string my_account_number = ("[^a-za-z0-9]"); ^[a-za-z0-9]{1,15}$ ^ : start of string, followed by... [a-za-z0-9] : ...any alphanumeric character... {1,15} : ...1 15 times, followed by... $ : ...the end of string.

java - Complex authentication in Spring Boot -

i'm trying authentication done spring boot app external provider need code 3rd party software equipment . app issues commands on external software , user credential needed connect , operate. the authentication needs performed using username , password provided in form against active directory database (checks if user exists in company), , internal database tells app if user allowed use app , whether he's admin or not (for customizing menu bar later on). afterwards, user authenticated external software means of binary executable present on server (using processbuilder). it's bit complex that's way has because of external contraints. furthermore, once user authenticated in 3rd party software, must pick role out of list contains roles available user. after this, connection set , have redirect user main page can use app. the login page shows form username , password fields, , button trigger auth process , present user list of roles, , after picking 1 , clicking bu...

android - TaskStackBuilder not working -

i trying create synthetic stack not working. here code. intent resultintent = new intent(context, notificationlistscreen.class); resultintent.setflags(intent.flag_activity_multiple_task); taskstackbuilder stackbuilder = taskstackbuilder.create(context); // adds stack stackbuilder.addparentstack(notificationlistscreen.class); // adds intent top of stack stackbuilder.addnextintent(resultintent); // gets pendingintent containing entire stack pendingintent resultpendingintent = stackbuilder.getpendingintent(0, pendingintent.flag_update_current); // puts pendingintent notification builder builder.setcontentintent(resultpendingintent); // kills notification when user clicks on builder.setautocancel(true); manifest entry <activity android:name=".modules.notification.notificationlistscreen" and...

c# - Type or namespace could not be found error -

right now, linking 2 projects use of button. have employee registration form , list of employees. did "add existing project" list of employees. did "add reference" (list of employees). i inserted code button on employee registration in order see list of employees form private void button_view_emp_click(object sender, eventargs e) { list_employees.list_emp list = new list_employees.list_emp(); this.hide(); list.show(); } it displays list of employees form. the list of employees form has button. , if click it, should return again employee registration form. i inserted code on button: private void button_back_click(object sender, eventargs e) { frm_employee_registration.formemployee_reg ff = new frm_employee_registration.formemployee_reg(); this.hide(); } but gives me error of error 1 type or namespace name 'frm_employee_registration' not found (are missing using directive or assembly reference?) c:\users\name\doc...

combine output from 2 linux commands into one output -

in linux there way present output of 2 different commands refer same object give different data in interlaced format without scripting. to explain mean when interlaced format consider following. ls --full-time will show full time stamp , folder name of each child folder in current directory. du -sh ./* will show total size , name of every child folder in current directory. if run 1 command followed other of sizes each on own line folder name next each size , of dates each accompanied folder name on own line. by "interlacing" mean first line out output each command presented, preferably on 1 line. second line of output each command presented in same fashion (ect). i.e data displayed date, size , name of each folder appear on same line despite fact not of data provided same command. (i dont mind if folder name displayed twice since provided both commands). tl;tr : commands below show how use join command above input. individual task of displaying f...

node.js - nodejs paypal pdt return 302 -

i'm using nodejs , express. code run on return paypal. 302 errors in response paypal. saw couple examples use ssl:// instead of https:// nodejs yells saying not valid protocol https module. have working nodejs script pdt , ipn? var purchaseid = req.query.tx; var atoken = myauthtoken; var postdataarray = {'cmd':'_notify-synch','tx': purchaseid, 'at': atoken} var postdata = json.stringify(postdataarray); console.log(postdata); var options = { hostname: 'www.sandbox.paypal.com', port: 443, path: '/cgi-bin/webscr', method: 'post', headers: { 'content-type': 'application/x-www-form-urlencoded', 'content-length': postdata.length } }; var req = https.request(options, function(res) { console.log('status: '+ res.statuscode); console.log('headers: '+ json.stringify(res.headers)); res.setencoding('utf8...

android - How to select only part of a listview based on different requirements by the user? -

i trying develop android mobile application whereby required display part of listviews has @ least 100 items. i,being admin of college,i has listed 100 subjects taught.(all listed in listview.all of subjects have point , in order strudent apply course he/she need have exact of higher points.an indicative sample below: english:24 spanish:16 maths:28 science:26 french:16 management:22 law:30 asian language:10 now student needs enter his/her point , based(exact or lower point)on that, he/she list of subjects he/she eligible apply for. e.g enter points:24 the output in listview should give following: french:16 management:22 english:24 asian language:10 i tried stuck , not complete codes: course.java public class course { private string name; private int points; public course(string name, int points) { this.name = name; this.points = points; } public string getname() { return name; } public int getpoints() { return points; } @override public string tostri...

c# - Entity Framework 7 migration not creating tables -

i working first project using entity framework 7 , connecting sql server database created there no tables in yet. have created dbcontext , created class, set dbset<> inside context. ran commands enable migrations , create first migration, rand command update database. looked work fine, no errors came up, when @ database efmigraitonshistory table created. when @ class created initial migration blank. doing wrong? commands running: dnvm install latest -r coreclr dnx ef migrations add myfirstmigration dnx ef database update context: namespace jobsight.dal { public class jobsightdbcontext : dbcontext { public dbset<navigationmenu> navigationmenu { get; set; } } } table class: namespace jobsight.dal { public class navigationmenu { [required, databasegenerated(databasegeneratedoption.identity)] public int16 id { get; set; } public string controllername { get; set; } public string actionname { get; set...

php - How to Generate Thumbnails in Laravel5.2 When I display image -

when write code display image in blade file time image thumbnails made , can give every time height,width time need image kind of image thumbnails generates can generate multiple thumb of same image in single site. {{$page->image,100,100)}} or <td><?php if ($page->image) { ?><img src="{{ url('/upload/pages/'.$page->image,100,200) }}"/><?php } ?></td> please give suggestion how make kind of thumbnails in advance. a rational way be: create controller , method (or method on existing controller) accepts image name, width & height parameters. method use intervention package mentioned in comments. logic should - first check if image of specified dimensions exists, if doesn't - create (using intervention, simple). - output image contents (don't forget add correct header). add controller/method routes.php, eg: route::get('thumbnails/{image}', 'controller@getthumbnail'); in blade tem...

python - Map attributes to classes both ways -

i have 2 classes, lower , higher1 . when call parse method of instance of lower checks kind of higher class represents, in example show higher1 . creates instance of higher class , returns it. can convert instance of higher class instance of lower calling it's build method. class lower: def __init__(self, data): self.data = data def parse(self): if self.data[0] == "a": value = self.data[1:] return higher(value) else: ... class higher1: def __init__(self, value): self.value = value def build(self): return lower("a" + self.value) so far good, want create classes every possible value of value attribute of higher1 . assuming "green" , "blue" possible values there 2 additionally classes called higher1green , higher1blue . higher1("blue") evaluate instance of higher1blue . higher1("blue").build() evaluate inst...

Combining forecasts into a data frame in R and then exporting into excel -

Image
i'm running multiple auto.arima() forecasts in r generate series of point forecasts confidence intervals i'd able pull directly excel. sample of script i've been using below shown portion of data. require(forecast) # customer gm arima forecasts (1 quarter ahead) f1 <- read.csv("c:/datapath/desktop/dataname.csv") f1 <- ts(f1, frequency = 12, start = c(2014, 1), end = c(2015, 12)) coonan <- f1[,3] gallo <- f1[,4] kempton<- f1[,5] moore <- f1[,6] nekic <- f1[,7] fit.coonan <- auto.arima(coonan, stepwise = false) fc.coonan <- forecast(fit.coonan, h=3, level = c(20, 40, 80)) fit.gallo <- auto.arima(gallo, stepwise = false) fc.gallo <- forecast(fit.gallo, h=3, level = c(20, 40, 80)) fit.kempton <- auto.arima(kempton, stepwise = false) fc.kempton <- forecast(fit.kempton, h=3, level = c(20, 40, 80)) fit.kempton <- auto.arima(kempton, stepwise = false) fc.kempton <- forecast(fit.kempton, h=3, level ...

java - Code with minimum time complexity to find occurrence of max and min Character in a String -

i have find best possible solution find occurrence of min , max character in given string. code using below string prefix="aaaaabbbbddddfeeeee" hashmap<character, integer> alphabetcountmapinit = new hashmap<character, integer>(); //time complexity : o(n) (char c : prefix.tochararray()) { alphabetcountmapinit.put(c, alphabetcountmapinit.get(c) == null ? 1 : alphabetcountmapinit.get(c) + 1); } //time complexity : o(n) int minoccurence = collections.min(alphabetcountmapinit.values()); system.out.println(maxoccurance); //time complexity : o(n) int maxoccurence = collections.max(alphabetcountmapinit.values()); system.out.println(minoccurance); ` can suggest me solution more optimized in terms of time complexity, need iterate around 90^90 number of string records.? you don't have use hashmap. there 26 letters, can use int[] count = new int[26]; count each letter. when have 10 a s, set cou...

c++ - Checking multiple numbers for overflow -

i have trouble detecting overflow. supposed make program reads int c , int n pairs of numbers should multiplied.after numbers multiplied need check if it's integer overflow or not.if it's not overflow print numbers multiplied. in c++; here example : enter: 3 2147483647 , 2147483647 18446744073709551615 , 2 666013 , 1 outputs: 4611686014132420609 overflow! 666013 fin>>c; (i=1;i<=c;i++,p=0){ fin>>a>>b; p=a*b; if (p/b==a) fout<<p<<"\n"; else fout<<"overflow"<<"\n"; } return 0; } you've fallen trap of trying use result test whether there overflow. can't in fact that. signed integer overflow has undefined behaviour, once has happened, you're screwed. must check overlow using operands, before operation. let max maximum representable integer. assuming operands positive, a * b overflows if , if a * b > max . ca...

asp.net mvc - Does the tenant ID stays always the same in the client credential grant flow? -

i developing asp.net mvc application has access office365 apis. used description here in order app access token. now after running application got aad consent flow in order token id, can tenant id. tenant id needed generate valid access token. my question is: can safely store tenantid in db , use everytime call api access token?? or tenantid change time time? worked same tenantid last tries, cause changed application after received tenantid not visit azure ad instead make api calls. can application use same tenantid in order receive access_token? edit: changed "token" tenantid due confusion. in azure active directory (azure ad), tenant representative of organization. dedicated instance of azure ad service organization receives , owns when signs microsoft cloud service such azure, microsoft intune, or office 365. each azure ad tenant distinct , separate other azure ad tenants. how azure active directory tenant as such, existing azure ad's tenant i...

javascript - Angular-formly: Why does the directive behave differently from the type? -

i have 2 input fields, both generated same template. on both setting ... templateoptions: { ... required: true } one input field registered using formlyconfig.settype other using directive. have created js bin here . only first getting required attribute, second not. in docs custom templates (controller option) says: provides ability add custom behavior type without having make entire directive (you can make directive instead if wish). what doing wrong? the problem in second example when angular-formly processing options template, angular-formly sees is: <plain-text> template. hence, doesn't know element place required attribute on. angular-formly attach attributes these elements have ng-model on them because elements attribute makes sense. again, key here angular-formly sees when it's processing template (before it's compiled). doesn't matter directive compiles to. yes, can use own directive, if want leverage features of...

git - Move commits from one branch to another with almost the same file contents but completely different commit history -

ok, have got multi-commit task on branch devel. have move changes branch (production), before month ago, had peculiar system of deployment - after checking on devel, person needed integrate new changes making new commit , integrate manually. don't want that, have 2 branches weren't merged 1,5 years, want move commits, , make new devel branch. the tree looks that: ft1 -----------c-------------- dev ---a---b-------d-------e--- prod --f---------------g------- and want be ft1 -----------c-------------- dev ---a---b-------d-------e--- prod --f---b-------d---g---e--- how can accomplish it? inserting b , d commits between f , g not quite normal workflow, no matter vcs 1 uses. if don't mind applying commits b , d , e on prod branch after g git rebase comes rescue. git rebase --onto prod dev as explained in the documentation , command above checks out dev branch, saves commits in current branch ( dev ) not in a branch (i.e. commits b , d ...

java - Keeping Only One radio Button Checked In an TableRow Inflater? -

i have been trying keep 1 of radio buttons checked every time user able select multiple radio buttons. how can keep single or current selected radio button checked? i have tablelayout has tablerow xml layout being inflatd code. also, onclicklistener applied on radiobutton fetches tag current selected radio button. can please me out this? for ref. table row's xml layout: <tablerow xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/tbldynstorerow" android:layout_margin="0.0dp" android:layout_width="match_parent" > <textview android:id="@+id/tvstorecount" android:textsize="10sp" android:layout_width="wrap_content" android:layout_height="12dp" ...

javascript - How to do something on each third for loop iteration -

this question has answer here: javascript run function inside loop every x iterations 5 answers how can alert on each third loop iteration alert ("some text") on each third iteration, how can make it? for(var = 1; < 20; i++) { alert("some text"); } use modulo operator ( % ): for(var = 1; < 20; i++) { if (i % 3 === 1) { alert("some text"); } }

java - Need help casting from a List<String[]> to an Array -

i using csvparser library univocity , having trouble converting list object in array read from. the method keeps throwing arraystoreexception is: list<string[]> resolveddata; string[] array = new string[7000]; public void parseurls() throws filenotfoundexception { csvparsersettings settings = new csvparsersettings(); settings.getformat().setlineseparator("\n"); csvparser parser = new csvparser(settings); try { resolveddata = parser.parseall(new filereader("c:\\users\\kevin.anderson\\desktop\\book1.csv")); resolveddata.toarray(array); } catch (exception ex) { system.out.println(ex.tostring()); } } is there way items out of list array or there easy way iterate thru items in list string array? thank try this. list<string[]> resolveddata; string[][] array; public void parseurls() throws filenotfoundexception { csvparsersettings settings = new csvparsersettings();...

java - Trying to list all folders/files from internal sdcard android but get a null -

i trying make list of files in external storage comes null. if (environment.getexternalstoragedirectory().exists()) { log.i(file, "is not empty"); file[] files = environment.getexternalstoragedirectory().listfiles(); (file file : files) { log.i("file ", file.getabsolutepath()); } } how make list files external directory i exception caused by: java.lang.nullpointerexception @ com.example.sam.read.fragments.myfragment.oncreate(myfragment.java:138) @ android.support.v4.app.fragment.performcreate(fragment.java:1763) @ android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:913) ...

javascript - Stream a specific song using Soundcloud API -

i'm still learning how use apis - has given me trouble. believe code correct, nothing happens when try stream song using simple javascript onclick function. html: <head> <script src="https://connect.soundcloud.com/sdk/sdk-3.0.0.js"></script> <script src="good.js"></script> </head> <body> <button onclick="playit()">play adele</button> </body> javascript: sc.initialize({ client_id: 'xxxxxxxxxx', }); function playit(){ var sound = sc.stream("/emberwaves/adele-set-fire-to-the-rain-remix", function(sound){ sound.play(); }); } first, use resolve endpoint api url track: http get: https://api.soundcloud.com/resolve.json?url=https://soundcloud.com/emberwaves/adele-set-fire-to-the-rain-remix&client_id=[client_id] response: http/1.1 302 found access-control-allow-headers: accept, authorization,...

python - How do I apply conditional formatting on a pair of rows in Excel? -

i using python , xlwings insert data in excel worksheet. data looks below in excel: b c d e 1 10 20 5 15 30 2 15 10 12 15 20 3 empty 4 22 11 5 8 9 5 10 5 12 2 9 6 empty my aim each pair of rows: 1,2 , 4,5 , change background colors of cells based on number on each column smaller. examples: a1 < a2, a1 black , a2 red. b1 > b2, b1 red , b2 black. d1 = d2, d1, d2 both black. i use xlwings.range("sheet1", "a1").color = (..., ..., ...) talking use excel that. my formula conditional formatting following: =and($b1>$b2, isnumber($b1), isnumber($b2)) it formats correctly first cell of pair, ex. b1 not b2.

android - Responsive Sidebar Using Divi Theme in WordPress -

i trying hide sidebar mobile devices in wordpress site divi theme. have tried use media queries hasn't worked. my media query: @media (max-width:480px) { .menu-decoglobofx-container { display:none; } } i have tried plugin hide widgets , sidebar still displays when test page on mobile device try , see . know how work properly? this should .. use proper page_id @media , (max-width: 479px) { .et_pb_sidebar_0 { display:none !important;} }

javascript - getting a report using karma in gulp task -

i have test task, here is: gulp.task('test', function (done) { return new server({ configfile: __dirname + '/karma.conf.js', singlerun: true }).start(); }); which working fine. issue produces limited output: ie 11.0.0 (windows 7 0.0.0): executed 2 of 2 success which fine on command line. more detailed report produced in file(s) of tests run , succeeded/failed etc. not looking xml or special. text file readable human open file. i know there many reporters choose having trouble choosing best one. additionally not sure how integrate gulp task. thanks in advance. if want produce output file and/or using phantomjs, suggest using karma-html-reporter : npm install --save-dev karma-html-reporter in karma.conf.js : reporters: ['html'] if launching tests in browser chrome or firefox, karma-jasmine-html-reporter. see output, you'll need click debug button in top-right corner of browser : npm install --save-dev ka...

Splitting list based on conditional atoms in prolog -

i have list x = [-n,-b,-s,hello,world] the output require z1 = [-n,-b,-s] z2 = [hello,world] if string begins - should part of z1 list, else part of z2 list. could provide me basic intuition implement this?. with library(apply) , library(yall) it's immediate: ?- partition ([e]>>(e = - _), [-n,-b,-s,hello,world], n, p). n = [-n, -b, -s], p = [hello, world]. to implement in old,plain prolog, visit list , 'cons' element in desired list: divide_dashed([], [], []). divide_dashed([-e|r], [-e|ds], ps) :- !, divide_dashed(r, ds, ps). divide_dashed([e|r], ds, [e|ps]) :- divide_dashed(r, ds, ps).

javascript - AngularJS: Call httpget on value change from textbox -

i have web service returns json file on call parameter id of entry. have angular method returns data returned method. have no idea how recall service when input of id has changed want recall method when new value has been supplied. the parameter pass in id called reference. html returns object reference of 1234 if change value dont know how recall service. this have far: angular: var app = angular.module("mymodule", []) .controller("mycontroller", function ($scope, $http) { var res = $http({ method: 'get', url: 'airportrwebservice.asmx/dashboarddetail', params: { reference : '1234' } }) .then(function (response) { $scope.booking = response.data }); $scope.test = "angular method called"; $scope.reference = '1234'; }); html <!doctype html> <html> <head> <script src="scripts/angular.js"></script> <script s...

javascript - Chart.js label value -

Image
i have question, have idea, how change chart.js label value format? screenshot: how change it, show not "acw (sec): 10" but "acw: 10sec" code looks like: var doughnutdataacw = [ { value: <?php echo gmdate("s", $singleacw); ?>, color: "#35df6b", highlight: "#06cc45", label: "acw (sec)" } you can use tooltiptemplate option: tooltiptemplate: "acw: <%=value%>sec" if need acw part come label: tooltiptemplate: "<%=label%>: <%=value%>sec"

Selenium-Webdriver in Ruby with minitest. How to run specific test case inside a file -

im transitioning rspec minitest test later comparing speed , paralellism, maintenance, etc. in rspec, can run test cases command: rspec path/to/test/suite.rb -e 'should test case' 'should test case' line inside suite.rb file: it 'should test case' ... end but can't seem find way in minitest. not can run individual tests, can use regex expressions $ ruby path/to/test/suite.rb --name /should test case/

multithreading - Am I allowed to simultaneously render from the same buffer object on multiple shared contexts in OpenGL 2.1? -

in apple's documentation, read this: 1 — "shared contexts share texture objects, display lists, vertex programs, fragment programs, , buffer objects created before , after sharing initiated." 2 — "contexts on different threads can share object resources. example, acceptable 1 context in 1 thread modify texture, , second context in second thread modify same texture. shared object handling provided apple apis automatically protects against thread errors." so expected able create buffer objects once, use them render simultaneously on multiple contexts. if that, crashes on nvidia geforce gt 650m backtraces this: crashed thread: 10 dispatch queue: com.apple.root.default-qos exception type: exc_bad_access (sigsegv) exception codes: exc_i386_gpflt … thread 10 crashed:: dispatch queue: com.apple.root.default-qos 0 glengine 0x00007fff924111d7 glelookuphashobject + 51 1 glengine 0x00007fff925019a9 glebindbufferobject + 52 2 gleng...

html - Inline block with dynamic height not aligned to the top -

i have 2 inline-block elements sitting side-by-side acting columns. first column changes height because add contents it. my problem second column follows bottom of expanding first column since both inline-block . want second column stick top , not follow bottom of other element. jsfiddle $("a").click(function(e) { e.preventdefault(); $("<p>lorem ipsum...</p>").appendto($("#dynamic")); }); .col { display: inline-block; width: 20%; margin: 0; background-color: #dadada; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <div class="col" id="dynamic"> <p>lorem ipsum...</p> </div> <div class="col"> <p><a href="#">click me</a></p> </div> the default value vertical-align baseline , change top . $("a").click(funct...

convolution - Fully-connected layer weight dimensions in TensorFlow ConvNet -

i've been coding along this example of convolution net in tensorflow , i'm mystified allocation of weights: weights = { # 5x5 conv, 1 input, 32 outputs 'wc1': tf.variable(tf.random_normal([5, 5, 1, 32])), # 5x5 conv, 32 inputs, 64 outputs 'wc2': tf.variable(tf.random_normal([5, 5, 32, 64])), # connected, 7*7*64 inputs, 1024 outputs 'wd1': tf.variable(tf.random_normal([7*7*64, 1024])), # 1024 inputs, 10 outputs (class prediction) 'out': tf.variable(tf.random_normal([1024, n_classes])) } how know 'wd1' weight matrix should have 7 x 7 x 64 rows? it's later used reshape output of second convolution layer: # connected layer # reshape conv2 output fit dense layer input dense1 = tf.reshape(conv2, [-1, _weights['wd1'].get_shape().as_list()[0]]) # relu activation dense1 = tf.nn.relu(tf.add(tf.matmul(dense1, _weights['wd1']), _biases['bd1'])) by math, pooling layer 2 (conv2 output) has 4 x 4 x 64...

arrays - Simple javascript program -

i'm getting started on learning javascript, , i'm creating simple program takes largest numbers array, , put them in new array, returned in end. the function called largestof(), , example, largestof([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]) should return [27,5,39,1001]. what have far this, , don't know how fix it, or if has way utilizing brackets. function largestof(arr) { var narr = []; (var = 0; < arr.length; i++) { n = arr[i].length; max = 0; for(var j = 0; j < n; j ++) { if (arr[i][j] > max) { max = arr[i][j]; narr.push(max); } } } return narr; } what trying here pretty straightforward. i'm running through every block in array, picking max, , putting max in own array (narr) other max's. i want know how fix have while still doing way. thank you function largestof(arr) { var narr = []; ...

javascript - Error: ng:areq Bad Argument when trying to define controllers in separate files -

my app worked great, had huge app.js, modularize put controllers separate files , set app in more conventional way. i'm getting error above along with: 'argument 'prodpagectrl' not a'. here prodpagectrl "use strict"; angular.module("app.products").controller('prodpagectrl', function($scope, $http) { //grid def / config $scope.gridoptions = { enablefiltering: true, columndefs : [ { field: 'productid', name: 'view product', celltemplate: '<div class="ui-grid-cell-contents"><a data-ui-sref="app.products.readproductpage({productid: row.entity.productid})"><i class="fa fa-eye"></i> </a>' }, { field: 'productid', name: 'edit product', celltemplate: '<div class="ui-grid-cell-contents"><a data-ui-sref="app.produc...

sas macro - In SAS Data Intergration, Create a user written transformation to skip further job execution without giving an error when certain condition is true -

i want create user written transformation skip further job execution when condition true. have tried code %abort; %abort cancel; but these statements gives error, stopped processing because of %abort statement. don't want error message displayed, skip remaining job execution. e.g. if source table has 0 observations out of job without logging error message or warning. hmm, not sure if work in sas di (i don't have test), use below macro: %macro stop_sas; %if "&sysenv" eq "fore" %then %do; %abort cancel; %end; %else %do; endsas; %end; %mend; it checks see if sas running batch job or not, , if is, quits sas quietly. if sas running in interactive mode, abort submitted code, without closing ide. the key statement here endsas command - part looking for.