Posts

Showing posts from June, 2010

java - Spring error handling does not work -

there many topics, but... have proper return parameters , arguments, read, necessary. wrong? <servlet> <servlet-name>springmvc</servlet-name> <servlet-class>com.vse.uslugi.utilities.web.basedispatcherservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> import org.springframework.web.bind.annotation.exceptionhandler; import org.springframework.web.bind.annotation.responsebody; import org.springframework.web.servlet.dispatcherservlet; public class basedispatcherservlet extends dispatcherservlet { @responsebody @exceptionhandler(exception.class) public string handlethrowable() { return errorservice.html("internal server error"); } @responsebody @exceptionhandler(resourcenotfoundexception.class) public string handleresourcenotfoundexception() { return errorservice.html("page not found"); } } //-------------------- import org.springframework.http.httpstatus; import org.springf

javascript - How to properly block the interface in AngularJS while data is loading? -

in form there many fields data loaded server, there dependent data lists , while performs data loading want freeze interface - example, showing progress bar. layer large z-index , on others , progress-bar in corner. example.. i know how using gwt or vaadin : modal window progressbar long tasks how using angularjs? basically, know how using javascript. the problem quite common.. maybe there ready solutions? i grateful information. all. the easiest option integrate solution promise tracker if need block out screen while application bootstraps ngcloak allows display message while angular initializing.

java - Small factorials on SPOJ -

i trying submit code 'small factorials' problem on spoj. runs on ide shows run time error (nzec) on spoj. please suggest solutions. import java.util.scanner; class factoria { public static void main (string[] args) throws java.lang.exception { int t, n; int multi = 1; scanner tc = new scanner(system.in); t = tc.nextint(); for(int i=0;i<t;i++){ scanner nc = new scanner(system.in); n = nc.nextint(); for(int f=1;f<=n;f++){ multi = multi * f; } system.out.println(multi); multi = 1; } } } your runtime error because try initiate new scanner on system.in when have 1 open. seems fail on java 8 although seems run ok on java 7 - both tested on ideone . there no need initiate new scanner . if remove line scanner nc = new scanner(system.in); and use tc.nextint(); instead of nc.nextint(); should work. i note you

c - Why is the big O runtime of 1D parity checking log(n)? -

so reading code website: http://www.geeksforgeeks.org/write-a-c-program-to-find-the-parity-of-an-unsigned-integer/ and shows how determine whether number has or odd parity. however, don't understand why runtime efficiency log(n). here code reference: # include <stdio.h> # define bool int /* function parity of number n. returns 1 if n has odd parity, , returns 0 if n has parity */ bool getparity(unsigned int n) { bool parity = 0; while (n) { parity = !parity; n = n & (n - 1); } return parity; } the runtime efficiency o(log(n)), n value of integer pass in. however, that's unconventional way use o notation. more frequently, o notation expressed in terms of size of input in bits (the # of bits needed represent input), in case size of input k=o(log2(n)) , runtime o(k). (even more accurately, runtime Θ(s) s number of bits set in n, although assumes bit operations o(1)).

oracle - SQL library trigger -

im trying make library database. ensure 1 book can borrowed 1 person @ time. have no expirience triggers thought might ask you. create table "book" ( "book_id" integer not null, "condition" varchar2(50), "isbn" varchar2(50) not null, constraint pk_book primary key ("book_id") ); create table "borrowed" ( "book_id" integer not null, "borrowed_id" integer not null, "user_id" integer not null, "date_borrowing" date not null, "date_returning" date not null, "returned" smallint not null, constraint pk_borrowed primary key ("book_i

PHP: Secure a Rest Service with a Token mixed with Timestamp -

i have rest service website calls , want secure calling outside of website as possible. i want create token mixed timestamp, user can call service in 10 minutes (for example) token generated in server. let me explain pseudo codes: 1) server: token generated in server using private key , timestamp: // token valid 10 minutes after 'time' $token = encrypt($pkey, timestamp); // server time 2) client: put token in javascript variable , use in our request timestamp of client: var token = '<?= $token ?>'; var params = { token : token, time : timestamp, // client time data : mydata } 3) server: if time parameter mixed token not equal 10 minutes token, request invalid: // i'm stuck here $something = decrypt($pkey, $_post['token'], $_post['time']); if ($something != $tenminutes) { // invalid request } the question: 1) senario o.k? if yes, exact solution? if no, solution? 2) there senario secure requests i've see

Page numbering for a blog -

i building blog atm i'm not using wordpress etc.. my question is: how can make page numbering system see in many blogs? thanks in advance! if you're making hand , want pagination, can try (assuming you're using sql): decide number of items want per page query db total number of items calculate total number of pages know how many page links print query items using limit , offset

qt - How to use QtQuick tiled canvas? -

i found document here it's ambiguous understand. can give me example of using tiled canvas ? thanks mitch comment know tiled canvas not work (see here ). the bug still appears in qt 5.4.2 shown example: import qtquick 2.0 rectangle { width: 400 height: 400 flickable { id: flick anchors.fill: parent contentwidth: 400 contentheight: 40000 } canvas { parent: flick anchors.fill: parent contexttype: "2d" canvassize: qt.size(flick.contentwidth, flick.contentheight) canvaswindow: qt.rect(flick.contentx, flick.contenty, flick.width, flick.height) tilesize: qt.size(20, 20) renderstrategy: canvas.cooperative onpaint: { (var y = region.y; y < region.y + region.height; y += tilesize.height) { (var x = region.x; x < region.x + region.width; x += tiles

javascript - AngularJS: variable $scope inside a function appears undefined outside the function -

i new angularjs , stuck :\ need help, please! the purpose of code below specific data (an integer) db in order build doughnut chart. run function dataforgraphs() in order value. then, outside function, "loose" value. (during code, made comments explain better situation) uonecontrollers.controller('homectrl', ['$scope', 'graphservice', function ($scope, graphservice) { var ammountoffinishedorders = {}; dataforgraphs(); // calling function function dataforgraphs() { graphservice.getammountoffinishedorders() .success(function (data) { $scope.ammountoffinishedorders = data.getammountoffinishedordersresult; //this console.log shows me value 3. excellent! console.log("value 1:", $scope.ammountoffinishedorders) }) .error(function (error) { $scope.status = 'unable load data:' + error.message; });

vba - Clear All styles except Headings with macro -

i want write macro remove style except headers document. have macro remove styles: sub clearstyle() activedocument.select selection.clearformatting end sub how can improve keep headers style? something should work: for each p in activedocument.paragraphs if left(p.style, 7) <> "heading" p.range.select selection.clearformatting end if next

asp.net - Filling City From Google Api Only -

i have asp textbox. want integrate cities of specific country , provide autocomplete feature in it. accomplished using this. var options = { types: ['(cities)'], componentrestrictions: { country: "in" } }; new google.maps.places.autocomplete(document.getelementbyid('txtplaces'),options); now want provide validation such user has select city auto complete , cannot enter other unknown city. the validation should provide indication user such he/she knows value entered correct , can move on fill next values please me out on this. thanx in advance. observe place_changed -event of autocomplete, when place has geometry -property it's valid place based on suggestions

javascript - JQuery Ajax call to be triggered onClick -

i new javascript, jquery , ajax. trying do: i have button in html code, , want trigger ajax call make request web server running on local machine. this have far: js code: <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script> <script type="text/javascript"> $('call').click(function() { alert("hiii"); $.ajax({ 'url' : 'localhost:8080/blah/blah/blah', 'type' : 'get', beforesend: function() { alert(1); }, error: function() { alert('error'); }, 'success' : function(data) { if (data == "success") { alert('request sent!'); } } }); }); </script> html code: <body> <div> <form> <div class = "buttons"> <input type

ios - UiTbleview Cell Overlapping when scroll more time -

i using uitableview displaying different data in view. using uitableviewcell created code in .m file. total 9 different kind of cell 0 different identifiers , heights cell. when same cell 2 different heights in table start overlapping each other. here putting code height of cell method. - (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath { if(indexpath.row ==0) { return 120.0; } else{ //for action user follow if(condition) { //checking if follow shared or not if() { //checking number of counts if() { if() { if() { return 340.0+(artemp1.count*50.0); } else { return 157.0+(artemp1.count*50.0)

What is the most efficient method to make gifs from images using PHP? -

i'm writing php script take several images , compile them gif. searching resources on subject, have encountered several php specific ways this, such imagemagik or gifcreator resources encounter, including on here, seem rather old. gifcreator hasn't been updated in 3 years, , find fails resize compressed gifs. in last several years, gif , gif creation sites have exploded in popularity, , can't imagine these methods 2009 still efficient way of going task. what efficient (stable, resource efficient) , modern way create gifs collection of images along resizing gifs php? there better libraries available or php not choice task?

python - How do I pull out the first 3 lines of each ppm file? -

all have done opened small file , appended contents list called files . files contains list of tiny ppm lines. how remove first 3 lines of file existence? here's example of .ppm file looks like, it's called, tiny.ppm. p3 5 5 255 255 0 0 100 150 175 100 150 175 100 150 175 100 150 175 100 150 175 255 0 0 100 150 175 100 150 175 100 150 175 100 150 175 100 150 175 255 0 0 100 150 175 100 150 175 100 150 175 100 150 175 100 150 175 255 0 0 100 150 175 100 150 175 100 150 175 100 150 175 100 150 175 255 0 0 my code below, however, want 'files' contain list of 9 lists containing 9 different files' information, , remove first 3 lines of of too. def readfiles(): files = [] files.append(open('tiny.ppm','ru').readlines()) print(files) if want more robust reading images , performing various operations on them, recommend pillow package in python. from pil import image glob import glob def readfiles(): images = [] f

r - ggplot2 Error in eval(expr, envir, enclos) : object 'd' not found -

i trying ggplot graph mardiatest function gives me error follows: error in eval(expr, envir, enclos) : object 'd' not found here reproducible example: setting class mardiatest function setclass("mardia", slots = c(g1p = "numeric", chi.skew="numeric", p.value.skew="numeric", chi.small.skew="numeric", p.value.small="numeric", g2p="numeric", z.kurtosis="numeric", p.value.kurt="numeric", dname="character", dataframe="data.frame")) setgeneric("mardia", function(object) standardgeneric("mardia")) setmethod("show", signature = "mardia", definition = function(object) { n=dim(object@dataframe)[1] cat(" mardia's multivariate normality test", "\n", sep = " ") cat("---------------------------------------", "\n", sep = " ") cat(&qu

list - SMS group APP Inventor2 -

Image
i made app app inventor2 sends sms latitude , longitude, can not make schedule send sms 2 numbers. try sends first number signed up. have tested various possibilities , no longer know how else solve. screenshot of code blocks used:

c# - Web API and MVC in the same project with Session States -

i'm been working around asp .net mvc application going take log in requests different sites different configurations (so cannot use formsauthentication sso way). way decided resolve creating temporal login request tokens, each token used once, , tokens, application make user session. in order avoid generating tokens unnecesarily, thought of asking server first if user wasn't logged in already. , decided attempt via httpclient. code written follows. var client = new httpclient { baseaddress = new uri("http://mywidget.com") }; client.timeout = timespan.frommilliseconds(18000); client.defaultrequestheaders.accept.clear(); client.defaultrequestheaders.accept.add(new mediatypewithqualityheadervalue("application/json")); var response = client.getasync(string.format("/userislogged/{0}", userid)).result; response.ensuresuccessstatuscode(); bool islogged = respons

xml - List unique values of an attribute within a group only for specific criteria in XSL 1.0 -

i need list unique values of attribute in group, when attribute has specific value. making work in xsl 1.0 tricky understand. thanks post, have groupings defined allow me perform counts when attributes match specific criteria. i'm stumped on being able list unique values 1 specific attribute, attribute equal specific value, within members of current group. as always, make more sense example source data , code. here sample xml <?xml version="1.0" encoding="utf-8" standalone="yes"?> <group1> <group2> <locationidentification locationid="0610390" /> <locationidentification1 locationqualifier="12" locationid="uslgb"/> </group2> <group2> <locationidentification locationid="0610612" /> <locationidentification1 locationqualifier="12" locationid="uslax"/> </group2> <group2> <locationidentifica

Julia macro splatting -

why work: function test_func(a, b) + b end test_func((1, 2)...) but not? macro test_func(a, b) + b end @test_func((1, 2)...) is bug in julia? macros operate on surface syntax , @test_func isn't seeing result of splat. instead, sees splat operation itself! always, great way inspect quote , see syntax macro operating on: julia> :(@test_func((1,2)...)) :(@test_func (1,2)...) julia> meta.show_sexpr(ans) (:macrocall, symbol("@test_func"), (:..., (:tuple, 1, 2))) so macro receiving 1 argument (not two), , it's expr(:..., expr(:tuple, 1, 2)) . notice tuple (1,2) is getting passed macro, it's hidden away inside splat operation. dig expr , kind-of-sort-of implement splatting yourself: julia> macro test_func(as...) if length(as) == 1 && isa(as[1], expr) && as[1].head == :... && isa(as[1].args[1], expr) && as[1].args[1].head == :tuple a, b = as[1].arg

javascript - How to load TIFF image with fabric.js? -

from can tell, fabric.js can load either jpg or png files. fails when try load tiff file. idea? fabric.image.fromurl('my_image.tif', function(oimg) { canvas.add(oimg); }); this not problem fabricjs, more browsers in general not support tiff file format . ie , safari being exceptions less mainstream browsers. workarounds however, possible read , parse tiff files manually. read tiff can use example tiff-js . may able plugins browser can decode tiffs (the latter possibly require end-user install plugin well). though, recommend convert tiff example png general use. similarly, not able save out tiff either same reasons above, feel free @ canvas-to-tiff solution (free).

c# - Turkish character in SQLite while using LIKE expression -

select *from urunler musteri %ir%; test data: +---musteri---+---id--+ +-------------+-------+ +---Ä°rem------+---1---+ +---kadir-----+---2---+ +---demir-----+---3---+ returning result: kadir demir if use %Ä°r% Ä°rem returning kadir , demir not returning. there same problem in other turkish characters, not exact solution. programming mono android. [sqlitefunction(name = "toupper", arguments = 1, functype = functiontype.scalar)] public class toupper: sqlitefunction { public override object invoke(object[] args) { return args[0].tostring().toupper(); } } [sqlitefunction(name = "collation_case_insensitive", functype = functiontype.collation)] class collationcaseinsensitive : sqlitefunction { public override int compare(string param1, string param2) { return string.compare(param1, param2, true); } } toupper.registerfunction(typeof(toupper));

java - Display attribute in JComboBox and register another attribute -

i have jcombobox , must show designation of product, , each has code designation, in database have register product code in combo must show designation, how should display designation in combo save code in database? this code return code , designation public resultset getdesignation(jcombobox des) { resultset rs1 = null; try { conn=con.connect(); stmt = conn.createstatement(); string rq1 = "select designation, idproduit produit"; rs1 = stmt.executequery(rq1); while (rs1.next()) { des.additem(rs1.getstring(1)); } stmt.close(); conn.close(); } catch (sqlexception e) { e.printstacktrace(); } finally{ return rs1; } } and code idproduct (code) m.getdesignation(des); int designation=integer.parseint(des.getselecteditem().tostring()); instead of direct population of jcombobox , create product class , in each iteration of while loop extract id , product's name resultset , set properties of product instance. add product instance in collect

excel - Optional argument in VBA causes error while executing -

this question has answer here: vba not accept method calling , gives compile error: syntax error 1 answer i tried create procedure passes 2 arguments, mandatory , optional, before added optional argument procedure running correctly. here code: sub a2(var string, optional num integer = 5) msgbox (num) end sub sub start_a2() a2 ("null_text", 5) end sub when pass second argument, running procedure start_a2 fails @ 1st line: sub start_a2(), vba higlight line yellow , returns syntax error, not provide details. second argument inproperely passed? does work if use call ? such sub start_a2() call a2("null_text", 5) end sub edit : though above work, @so's comment below right on (thanks!); can use sub start_a2() a2 "null_text", 5 end sub

php - Wordpress list category in custom post type -

i have query below want list categories assigned current post viewing. at moment, lists of categories custom post type. possible list individual post? post type called 'resource' , category attached post type called 'resource-category'. <?php $taxonomy = 'resource-category'; $tax_terms = get_terms($taxonomy); ?> <?php foreach ($tax_terms $tax_term) { echo '' . '<a href="' . esc_attr(get_term_link($tax_term, $taxonomy)) . '" title="' . sprintf( __( "view posts in %s" ), $tax_term->name ) . '" ' . '>' . $tax_term->name.'</a>&nbsp;&nbsp;&nbsp; '; } ?> you can use wp_get_post_terms : <?php $taxonomy = 'resource-category'; $tax_terms = wp_get_post_terms($post->id, $taxonomy, array("fields" => "all")); foreach ($tax_terms $tax_term) { echo ''

python - double recursive education example -

this function not making sense me. ive added print statements on place figure out whats going on , still dont it. i'd grateful if explain me. def f(s): if len(s) <= 1: return s return f(f(s[1:])) + s[0] print(f("mat")) this see happening. start string of length 3 , bypass if statement. work on inside f(s[1:]) first. have string of length 2 ("at") again bypasses if statement , enters f(s[1]) gives string of length 1 ("t") enters if statement , returns "t". trail goes cold me. from print statements, see new string of length 2 created , subsequent "a" gets returned. final product ends being "atm". "m" being tagged on end "+ s[0]" part why "atm" , not "tam"? i've spent few hours on , cant make rain. appreciated. expand whole thing out long steps filling in function calls doing. deal brackets deepest/most embedded first. deal function

Use Gulp-imagemin with imagemin-jpeg-recompress plugin? -

i'm experimenting gulp optimize images. find imagemin-jpeg-recompress reduces jpgs more default optimizer comes gulp-imagemin . i'm wondering if there way use gulp-imagemin swap out jpegtran plugin the imagemin-jpeg-recompress . i can't seem find detailed docs how might work together. i'm going answer own question. wrong seems it's easy process. require plugin (in case, want use imagemin-jpeg-recompress plugin). specify plugin use within imagemin via use property of imagemin . believe override bundled jpegtran optimizer comes imagemin . var gulp = require('gulp'); var imagemin = require('gulp-imagemin'); var imageminjpegrecompress = require('imagemin-jpeg-recompress'); gulp.task('optimize', function () { return gulp.src('src/images/*') .pipe(imagemin({ use:[imageminjpegrecompress({ loops:4, min: 50, max: 95, quality:'high' })] })) });

c# - ASP.NET/IIS: How can I serve TCP connections using a custom protocol (i.e. without WCF)? -

i have asp.net mvc website needs administer remote devices. these remote devices speak custom protocol on tcp on non-standard port. communicate these devices, use tcplistener , maintain connections of them. when administration request comes through website, send data appropriate device through tcp connection. i have been able create tcplistener in application_start , serve connections. doesn't work if iis has shutdown (or never started) app pool. i incoming tcp connections on specific port start app pool , connect tcplistener. possible?

sql - JDBC Insert with Postgres Enum -

given following person sql , model code: sql create type sex enum ('male', 'female'); create table person ( id bigserial primary key, name varchar(100) not null, age integer not null, gender sex not null ); code object person { sealed trait gender case object male extends gender case object female extends gender // credit travis brown: http://stackoverflow.com/a/30946172/409976 implicit val gendershows: show[gender] = show.shows { case male => "male" case female => "female" } } case class person private(id: option[long], name: string, age: int, gender: person.gender) i wrote following object creating person : object postgresrepository { val xa = drivermanagertransactor[io]( "org.postgresql.driver", "jdbc:postgresql:person", "postgres", "postgres" ) def insert1(name: string, age: int, gender: gender) =

mysql - Is this SQL query correct -

i'm preparing exam in databases , stumbled upon question: we have database of human resources company, contains tables: applicant(a-id,a-city,a-name) qualified(a-id,job-id) there more tables in database won't relevant question asking. the question was: we want write query displays each pair (job-id,a-city) names of people living in city qualified job. does query solve question? why? select qualified.job-id, applicant.a-city, applicant.a-name qualified, applicant quailified.a-id=applicant.a-id group qualified.job-id, applicant.a-city i think query fine. can't find faults it, lacking actual way check it, , lacking experience sql, me confirm indeed okay. i suspect need select every value want return or compare , need select applicant.a-id select qualified.job-id, applicant.a-id, applicant.a-city, applicant.a-name qualified, applicant quailified.a-id=applicant.a-id group qualified.job-id, applicant.a-city i'm not happy group these,

php - Symfony / Sonata Admin: List form on Edit form -

i have 1 (category) many (product) relationship set up, , i'd have list of products show @ bottom of edit category page. it seems common thing do, haven't found way (or examples of it). have managed product display using sonata_type_collection gives me whole edit form product, when want list of products associated category. two questions here, really: is possible? is discouraged (which explain lack of examples)? if so, why? the fastest way looking overriding edit template. @ admin serivce declaration can so: services: sonata.admin.mail: class: %sonata.admin.category.class% tags: - { name: sonata.admin, manager_type: orm, group: "categories", label: "category" } arguments: - ~ - %skooli.category.class% - ~ calls: - [ settemplate, ["edit", "acmeadminbundle:categoryadmin:edit.html.twig"] ] then, under acmebundle/resource

c++ - Kick out duplicate entries across vectors -

i have vectors , retrieve 1 vector contains entries aren't duplicated anywhere in input vectors. #include <vector> int main() { std::vector<int> = {2, 1, 3}; std::vector<int> b = {99, 1, 3, 5, 4}; std::vector<int> c = {5, 6, 7, 1}; // magic retrieve {2, 99, 4, 6, 7} (order doesn't matter) } is there library function can performing task efficiently? i'm not tied using vectors. solution include lists, sets, or whatever appropriate task. using unordered_map, o(n) space complexity , o(n) time complexity: #include <vector> #include <unordered_map> #include <iostream> std::vector<int> get_unique_values(std::initializer_list<std::vector<int>> vectors) { std::unordered_map<int, size_t> tmp; auto insert_value_in_tmp = [&tmp](int v) { auto = tmp.find(v); if (i == tmp.end()) tmp[v] = 1; else if (i->second != 2) i->second = 2; }; ( auto& vec

java - Why is my Elasticsearch 1.6.0 missing the plugin manager? -

i trying run elasticsearch 1.6.0 using cygwin on 64-bit windows 7 machine. downloaded elasticsearch zip elasticsearch home page, , installed latest version of java , jdk (1.8.0_45) , have set java_home variable right path think. when try execute first step in definitive guide installation process: $ ./bin/plugin -i elasticsearch/marvel/latest i error: error: not find or load main class org.elasticsearch.plugins.pluginmanager i've seen problem earlier versions of elastic, apparently problem fixed i'm not sure why happening.

java - How can IntelliJ refactor class constants to an external class? -

i have series of 30 or private class constants declared , used in fragment.java. want refactor declarations public declarations in constants.java such occurrences of variable_name in fragment.java replaced constants.variable_name tips appreciated on how use this. using android studio built on top of intellij. click menu "refactor", , choose "move...". select constants want move , enter class want move them.

java - How to get location after updates? -

i followed tutorial use google maps api last known location or request location updates if there no such location. here onconnected method @override public void onconnected(bundle bundle) { location location = locationservices.fusedlocationapi.getlastlocation(mgoogleapiclient); if (location == null) { locationservices.fusedlocationapi.requestlocationupdates(mgoogleapiclient, mlocationrequest, this); log.v(tag, "old location" + location); } else { handlenewlocation(location); log.v(tag, "new location"); } } so first conditional supposed request new location. location stored? thought might execute handenewlocation (the code below) private void handlenewlocation(location location) { log.d(tag, location.tostring()); double currentlatitude = location.getlatitude(); double currentlongitude = location.getlongitude(); loc = "latitude: " + double.tostring(currentlatitude) + ", lon

javascript - Normal redirect or preload -

so on net i've come across several ways preload / redirect webpage. now's question proper way handle redirect preload (load next page async while still showing current page) $.get("page.php", function (data) { document.open(); document.write(data); document.close(); window.history.pushstate("title", "title", "/page.php"); $.cache = {}; }, "html"); or should better stay regular redirect? window.location = "page.php"; the next page contains fullscreen video , soundtrack (audio) thanks. you can use ajax load next page asynchronous. here example of simple ajax request using get method, written in javascript . ajax stands asynchronous javascript , xml, , xmlhttprequest object behave ajax, async parameter of open() method has set true: xhr.open('get', 'send-ajax-data.php', true); get-ajax-data.js: // client-side script. // initialize ajax request. var

javascript - Angular data binding not working -

i have been struggling data binding in asp.net webforms, using angularjs. i have following angular: (function () { var app = angular.module("registrationmodule", []); app.factory("exampleservice", exampleservice); function exampleservice($http) { function getdata(id) { return $http.post("legacypage.aspx/getdata", { id: id }) .then(function (response) { return response.data; //data comes json //also tried response.data.d }); }; return { getdata: getdata }; }; app.controller("mainctrl", ["$scope", "exampleservice", mainctrl]); function mainctrl($scope, exampleservice) { $scope.generatetext = "generate"; $scope.loading = false; function oncomplete(data) { u

android studio - Why does Gradle disregard release{} and implement a rule on debug build as well? -

i not sure if happened before, think happened after recent updates of android studio , gradle. namely, trying set output path of release apk. made code this buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' signingconfig signingconfigs.config def outputpathname = "./apk-release.apk" applicationvariants.all { variant -> variant.outputs.each { output -> output.outputfile = file(outputpathname) } } } } this move apk default location ( /build/outputs/apk ) , place next build.gradle file. however, release{} being disregarded , android studio moves debug build location renaming it. either create signed apk or press debug icon test debug release, apk being moved , renamed. , should stay inside default location, right? why happening? bug inside android studio gradle or bug in

c# - bash error code 137 vs 1 when out of memory -

context i run following command in linux bash : mono --debug --debugger-agent=transport=dt_socket,address=198.178.155.198:10000 ./stress.exe stress.exe c# application. what happens at 1 point system out of memory, wanted. error code returned. error code returned (echo $?) code 1 : when program creates throw because it's out of memory. code 137 : when killed os when overloading memory. question why sometime os kills application? why result not same? assuming: mono running sgen based gc linux oom killer enabled your stress.exe alloc'ing managed memory i.e. no native interop, no use of marshaling memory allocators, no code flagged unsafe, etc.. you creating objects , never release refs. lets talk sgen, alloc objects, created in nursery, run out of memory in nursery, when gc sweep , has nursery collection full, live objects move it's major heap. if major head full, more os memory requested. can adjust amount of initial memory allocated

objective c - Playing AVAudioPlayer and SystemSoundID -

i building game sprit kit , i'm using continuous loop of sound using avaudioplayer in didmovetoview method. i'm using 4 other sounds using systemsoundid, have been created outside of didmovetoview method. problem when play game sound playing using avaudioplayer seems drown out other sounds have using systemsound. use avaudio of sounds seem work fine, slows game down little. wondering if there alternative or fix this? forgot mention seems problem when plug earphones in works fine when played without. here code: - (void)didmovetoview:(skview *)view nsurl *playsound = [nsurl fileurlwithpath:[[nsbundle mainbundle]pathforresource:@"junglesound" oftype:@"wav"]]; nserror *error; player = [[avaudioplayer alloc]initwithcontentsofurl:playsound error:&error]; [player play]; player.numberofloops = -1; //continuous play// and outside of method nsstring *soundpath = [[nsbundle mainbundle] pathforresource:@"jump2" oftype:@"wav"];

How to use multiples objects in a function on R -

i'm new in programing i'm in r. have multiples objects similar names (ams.1,ams.2,ams.3, etc) , run function (it's function "crop" package) them , assign new objects (data.final.1, data.final.2) result. that: for(x in 1:119) { assign(paste("data.final", x, sep = "."),crop(a,ams.(x))) } apparently not working. ideas?

android - Open activity only for the first run -

i have button in first layout , want when user clicks on it, shows activity , never shows first activity. i tried : boolean isfirstrun = getsharedpreferences("preference", mode_private) .getboolean("isfirstrun", true); if (isfirstrun) { //show start activity startactivity(new intent(mainactivity.this, firstlaunch.class)); toast.maketext(mainactivity.this, "first run", toast.length_long) .show(); } getsharedpreferences("preference", mode_private).edit() .putboolean("isfirstrun", false).commit(); i doubt, because may won't hit getsharedpreferences() line, , navigated new activity firstlaunch . so think should like, if (isfirstrun) { //show start activity getsharedpreferences("preference", mode_private).edit() .putboolean("isfirstrun", false).commit(); startactivity(new intent(mainactivity.this, firstlaunch.class)); toast

scala - Cassandra Phantom tutorial : Are there any basic tutorials for using Phantom? -

i've looked around couldn't find single tutorial on getting started phantom. although being actively developed dedicated folks, find surprising there no quickstart tutorials around. please share links tutorials if 1 has come across you can checkout phantom-dsl examples in source folder, if not, i've uploaded example github showing how modeling cassandra tables in scala using phantom-dsl according documentation. https://github.com/thiagoandrade6/cassandra-phantom

opengl - Should vertex and fragment shader versions always match? -

suppose have fragment shader starting #version 120 , vertex shader #version 150 compatibility . combination appears work afaict, go against opengl or glsl specifications? couldn't find information discusses issue. if there's none indeed, should take "not forbidden" or "not approved"? no, there no requirement shader versions match. there requirement profiles match, relates mixing desktop , embedded glsl. discussed briefly in glsl specification, implications of mixing different shader versions of compatible profiles not discussed. opengl shading language 4.50  -  3.3 preprocessor  -  p. 14 shaders core or compatibility profiles declare different versions can linked together. however, es profile shaders cannot linked non-es profile shaders or es profile shaders of different version, or link-time error result. when linking shaders of versions allowed these rules, remaining link-time errors given per linking rules in glsl version correspond