Posts

Showing posts from July, 2011

java - Jersey filter ContainerRequestContext with HttpServletRequest return nullpointer -

i injecting httpservletrequest containerrequestfilter . when trying use abort , getting nullppointerexception . @provider public class authorizationrequestfilter implements containerrequestfilter { @context httpservletrequest httprequest; @override public void filter(containerrequestcontext requestcontext ) throws ioexception { // string auth = requestcontext.getheaderstring("authorization"); uriinfo uriinfo = requestcontext.geturiinfo(); system.out.println(uriinfo.getpath()); //login request if (uriinfo.getpath().equals("resource/users/login")) { return ; } if (httprequest.isrequestedsessionidvalid()== true) { requestcontext.abortwith(response .status(response.status.unauthorized) .build()); } stacktrace :09:28 pm org.apache.catalina.core.standardwrappervalve invoke severe

c# - Variable declaration differences var with cast or -

this question has answer here: initializing 'var' null 2 answers is there background difference between 2 declarations: var x = (string)null; and string x = null; will runtime treat declarations different ways? compiler produce same il? yes, produces same il: void main() { var x = (string)null; string y = null; } produces (with optimizations turned off): il_0000: nop il_0001: ldnull il_0002: stloc.0 // x il_0003: ldnull il_0004: stloc.1 // y il_0005: ret from compilers perspective, assigning null string variable.

android - Replace Action bar with toolbar -

i'm using toolbar replace actionbar. going before replacing. after replacing gives me error: java.lang.runtimeexception: unable start activity componentinfo{com.oi.mmg/com.oi.mmg.eventdetailsscreenactivity}: java.lang.illegalstateexception: this activity has action bar supplied window decor. not request window.feature_action_bar , set windowactionbar false in theme use toolbar instead. without knowing code suggest using parent theme application: theme.appcompat.light.noactionbar the property "windowactionbar" "false" default. and if using appcompat activities should extend "appcompatactivity".

mysql - Rails 4 access table attributes from has_one association -

i have 2 models user , account class user < activerecord::base has_one :account end class account < activerecord::base belongs_to :user end in users controller retrieving users @user = user.list('', false,'company', 'asc') where "list" method described in model retrieve records in users table have 2 columns "id" , "company_name" , in account table have columns "user_id" , "country" now want array @user retrieve company name , country can found user_id in accounts table please tell me how can thankx in advance how about: # app/models/user.rb class user < activerecord::base has_one :account scope :with_account_info, -> { includes(:account) } default_scope{with_account_info} end the final 2 lines merged 1 if prefer that, i.e.: default_scope{ includes(:account) } hth

android - java.lang.NoClassDefFoundError: Exception for Loading Tabs in an Activity -

Image
i try implement activity contains tab views, when want run project, got following exception: java.lang.noclassdeffounderror: com.example.activities.tabbaractivity$sectionspageradapter e/androidruntime(5072): @ com.example.activities.tabbaracitivity.loadmaintabs(tabbaracitivity.java:129) e/androidruntime(5072): @ com.example.activities.tabbaracitivity.access$1(tabbaracitivity.java:122) e/androidruntime(5072): @ com.example.activities.tabbaracitivity$servicemessagehandler.handlemessage(tabbaracitivity.java:370) e/androidruntime(5072): @ android.os.handler.dispatchmessage(handler.java:102) e/androidruntime(5072): @ android.os.looper.loop(looper.java:149) e/androidruntime(5072): @ android.app.activitythread.main(activitythread.java:5061) e/androidruntime(5072): @ java.lang.reflect.method.invokenative(native method) e/androidruntime(5072): @ java.lang.reflect.method.invoke(method.java:515) e/androidruntime(5072): @ com.android.internal.

android - Spinner background too big -

our graphic designer sent me png put inside spinners of our app. but, image appears big in phone. resize it, due different screen sizes, don't think nice solution. i did spinner_selector.xml: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/icono_desplegable_activar" android:state_enabled="true"/> <item android:drawable="@drawable/icono_desplegable" android:state_enabled="false" android:state_window_focused="false"/> </selector> and, then, in layout: <spinner android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/textactivity" android:layout_alignparentstart="true" android:id="@+id/spinneractivity" android:background="@drawable/spinner_selector"/> how can te

c# - How to create a scaling and size-changing Per-Monitor DPI-aware application that is backwards compatable with Windows 7? -

i'm new wpf (and dpi-awareness apis) , writing application running in windows 7, 8.1, , 10. use multiple monitors different per-monitor dpi settings, , interested in making application compatible possible across desktop configurations. i know possible add manifest wpf application, uncomment section dpi awareness, , set true/pm . allows program per-monitor dpi-aware in windows 8.1 , 10 (thus looking clean , sharp on various monitors), run system-aware in windows 7. but can 1 step better? microsoft provides neat tutorial here shows how create per-monitor dpi-aware wpf application. create new object in c++ replace <window> uses windows 8.1 apis not detect dpi change between monitors, re-size application @ runtime, matching change in dpi. end result not app per-dpi aware , sharp looking, when switching between large , small monitors of various sizes, app looks user change same physical size (in inches or centimeters) on screen. the downside microsoft's win32 code

makefile - Counterpart of gcc's -save-temps option in make -

i'm studying compiling , linking processes. running gcc -save-temps option, can temporary files generated during building process. i think there must counterpart of in make also. anybody know way? adding below set cmakelist.txt job , set (cmake_cxx_flags "${cmake_cxx_flags} --save-temps")

javascript - How to save multiple objects to an array in a chrome extension? -

i'm building first chrome extension , want track tv series watch , i'm trying save metadata on series following. i have content script returns title, newest episode (and url of episode) url of cover image of series. trying save code on background script (i have made sure include "storage" under permissions section of manifest file). so far script looks (this developed trying save , fetch javascript object using chrome.storage api? ): var bkg = chrome.extension.getbackgroundpage(); response.aid = new series(response.atitle,response.anewep,response.anewepurl,response.aimage); chrome.storage.sync.set(response.aid, function(){ chrome.storage.sync.get(function(val){ bkg.console.log("the saved title is: ", val.antitle); bkg.console.log("the saved newep is: ", val.annewep); bkg.console.log("the saved newepurl is: ", val.annewepu

excel - How to sum column-b values while column-a values are the same? -

Image
i've simulated problem.. because original plan complex describe: i need c4 8 because a2 = a3 = a4 , , 5 + 2 + 1 results in 8 . using logic, expected results should be: c4:8 c6:10 c10:23 c12:23 well, problem: i can't use sumif due after last day of month (28, 29, 30 or 31) next day 1 again. i'm stucked on that. appreciated. thank time. in c2 enter: =if(a2=a3,"",sum($b$2:b2)-sum($c$1:c1)) and copy down edit#1: the first part of if insures blanks needed. second part of if adds of column b , removes parts of b appear in column c

Are mnemonic for wizard navigation supported in install4j? -

is possible configure mnemonics navigation button in install4j version 6.0.1? searched configuration fields without success , no hint @ documentation. thanks in advance mnemonics not supported. alt-left , alt-right trigger navigation buttons.

php - Pretty Lightbox Not working after fetching data from Ajax -

Image
i have developed code display products when user lands on page.. check below image my issue whenever user clicks on category 01 or other category checkbox, lightbox used on product box in right side gets disable.. please note after clicking on checkbox data fetched using ajax function.. below ajax code : var xmlhttp=makerequestobject(); controlsarray=document.getelementsbytagname('input'); var products = ""; var productsall = ""; var prodall = true; for(var i=0; i< controlsarray.length; i++){ if(controlsarray[i].type=="checkbox" && controlsarray[i].checked){ if(controlsarray[i].value == "all") { productsall=controlsarray[i].value + ","; } else { products+=controlsarray[i].value + ","; prodall = false; } } } if(prodall == true) { products = productsall; } xmlhttp.open('get', 'ajax-

sql server - SQl Azure Database size increase -

we upgrade our sql azure database business edition s1 performance level. though microsoft suggest s0 level, never performance needed (or getting in business edition). however question after 4 days of operation, notice increase in database size 970mb 1.5 gb. though never add data, hardly reach 1gb of data size in our 3 months of operation (from 970 mb). we try rebuild index reduce size 300 mb, again gain it's size in couple of days. we didn't find thing in azure documentation related it. if has experience or knowledge please share us. thanks. edit: as expecting seems log size issue, try rebuild indexes again, , after 1 hr size automatically reduce 1.3 gb seems legitimate considering add more data database , unable delete data (as database timing out issue. ).

php - URL Rewriting to Privately Access Files -

i'm trying build simple website going let users upload files, , privately share them other designated users. problem is: don't want able type in url file able (then see it). i decided try using .htaccess prevent direct url access, however, cannot figure out how access file myself. of uploaded files going go subfolder called "restricted" . my ".htaccess" file is: rewriteengine on rewritecond {%query_string} !^.*key=secret.*$ [nc] rewriterule ^restricted/(.*)$ showfile.php?file=$1 my "showfile.php" file: <?php echo file_get_contents('[...]/restricted/'.$_get['file'].'?key=secret'); ?> however, when open "restricted/test.txt" or other file in restricted folder, redirects "showfile.php?file=test.txt" , however, php error: warning: file_get_contents([...]/restricted/test.txt?key=secret) [function.file-get-contents]: failed open stream: no such file or directory in [...]/showf

javascript - Can't pass options for VLC Mozilla plugin from JS -

i'm trying pass options vlc mozilla plugin's embedded player, nothing happens. <embed type="application/x-vlc-plugin" id="vlc" width="400" height="300" ></embed> <script type="text/javascript"> var target = "http://example.com/videostream/"; var options = new array("--video-filter invert"); vlc = document.getelementbyid("vlc"); var id = vlc.playlist.add(target,"not inverted here",options); vlc.playlist.playitem(id); </script> i've tried same url , args command-line vlc, , works. vlc http://example.com/videostream/ --video-filter invert (anyway, trying various command line options standalone vlc player, e.g. rotation, sepia, grayscale, blur, i've failed. maybe have enable or select vlc.) the real problem want fix video stream format error passing --demux=h264 embedded player (it works deskt

javascript - How to create circle to outer of circle in line of chart in c3.js? -

Image
i started learn c3.js. pretty work with. i got stuck in part, hope can me go forward . how create circle in outer of circle in line chart using c3.js . this example code var chart = c3.generate({ data: { columns: [ ['data1', 30, 200, 100, 150, 150, 250], ['data12', 30, 200, 100, 150, 150, 250] ], type: 'line' }, }); it giving 1 small circle ( dot kind of ) want create 1 more circle different color , inside of circle need show small circle (dot kind of ) . how that? i have tried select circle , apply border .i have tried this d3.selectall('circle').each(function(){ this.style('border-radius: 20px;'); }); this wrong way, not working. how ? is possible in c3.js? you can set size of point using chart options ... point: { r: 20 } ... and can draw border using css #chart .c3-circle { stroke: black; stroke-width: 4; } (assuming drawing chart in container id cha

html - Bootstrap buttons and input on one row while input stretching to fill space horizontally? -

Image
i'm having trouble trying align boostrap buttons , input on 1 line, having input stretching horizontally while snuggling against buttons. here different attempts: in case #1: button group , input group in same column. input stretches horizontally thrown on next line. <h2>#1</h2> <div class="row"> <div class="col-lg-12"> <div class="btn-group" role="group" aria-label="..."> <button type="button" class="btn btn-default">default</button> <button type="button" class="btn btn-primary">primary</button> <button type="button" class="btn btn-success">success</button> <button type="button" class="btn btn-info">info</button> <button type=&q

java - Deserialize JSON by property -

i have simple wrapper class. class wrapper { int id; object command; } command object outside, , cannot create interface hold possible types together. i'd serialize simply: string json = objectmapper.writevalueasstring(wrapper); so get: {"id":"1","command":{"type" : "objecttype", "key0": "val0", ... other properties...}} ideally i'd build registry possible values of type , corresponding class names values, deserialize this: wrapper wrapper = objectmapper.readvalue(bytes, wrapper.class); ( objectmapper com.fasterxml.jackson.databind.objectmapper ) is there way achieve jackson ? you can use the jackson polymorphic type handling . can declare type command property can using @jsontypexxx annotations. here complete example: public class jacksontypeinfoonobject { public static class bean { @jsontypeinfo(use = jsontypeinfo.id.name, property = "type&quo

ide - How to "Stack" code in Android Studio's Editor? -

i've decided dive android development following google's udacity course, till' everything's fine except there's slight thing that's annoying me. as can see in codes on top of each other (organized me , want way). android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin" tools:context=".mainactivityfragment"> but default insists organize this: android:name="com.example.saad.sunshine.app.mainactivityfragment" tools:layout="@layout/fragment_main" android:layout_width="match_parent" android:layout_height="match_parent" /> is there way change default behaviour of android studio want? option in settings?

Calculate a conditional running sum in R for every row in data frame -

i create column equal running sum of data$rating, given 2 conditions true in column 3 , 4, data$year< current year , data$id equal current id. in words should calculate cumulative sum of ratings each id until previous year. , should each row in data frame (about 50,000 rows). given size of data frame, i'd prefer not loop, if @ possible. i've provided short example of how below... > head(data[,c(3,4,13)]) year id rating cumsum 1 2010 13578 2 0 2 2010 13579 1 0 3 2010 13575 3 0 4 2011 13575 4 3 5 2012 13578 3 2 6 2012 13579 2 1 7 2012 13579 4 1 i'm coming spreadsheet background, still thinking in terms of sumifs, etc. (which nicely solve problem in excel), apologies if language isn't precise. data <- data.frame(year = c( rep(2010, 3), 2011, rep(2012, 3) ), id = c(13578, 13579, 13575, 13

java - Analytics dispatcher and configuration management for custom usage -

i looking component act event dispatcher android analytics or whole custom analytics solution. i found pretty neat code released parse android sdk . use part of it, if no other solution appear. maybe there simpler. ideally, have similar aranalytics is, plus custom analytics/usage sender pointing service. are there production-ready components that? you can this // set dispatch period in seconds. googleanalytics.getinstance(this).setlocaldispatchperiod(30); and google has introduced firebase analytics google recommends developer use firebase refer: https://firebase.google.com/docs/analytics/

c# - How to adjust zoom level on windows phone 8.1 map by pushpins -

i working map control in windows phone 8.1(rt) application , have 2 custom push pins on map , 1 in source address , second destination address , want change zoom level according both push pins , means both pins display on screen path current zoom level maplocation.zoomlevel = 14; i want change zoom level according both location you can calculate boundaries of multiple pushpins(positions)in winrt using geoboundingbox.trycompute , set map's view these boundaries. try { geopoint sourcepoint = --source point here--; geopoint destpoint= --dest point here--; //calculate boundries var locations = new list<basicgeoposition>(); locations.add(sourcepoint.position); locations.add(destpoint.position); var boundries = geoboundingbox.trycompute(locations); await smapcontrol.trysetviewboundsasync(boundries, new thickness(100), mapanimationki

c# - Telerik gridview export images not working winforms -

Image
i trying export following gridview (winforms project) telerik export library: output: code: exporttopdf pdfexporter = new exporttopdf(this.systemgridview); pdfexporter.fileextension = "pdf"; pdfexporter.exportvisualsettings = true; pdfexporter.hiddencolumnoption = hiddenoption.donotexport; pdfexporter.pdfexportsettings.enablecopy = true; pdfexporter.runexport(filename); it's possible export images library? i've found link , it's outdated. thank you! found: gridviewpdfexport pdfexporter = new gridviewpdfexport(this.radgridview1); pdfexporter.runexport(@"c:\new.pdf", new pdfexportrenderer()); link

json - Why does response.readEntity(Post.class) return null? -

i'm trying json data rest resource , automatically convert java object json-to-java binding. use jersey framework 2.21 jersey-media-moxy module json provider in client application . i cannot figure out why null instead of proper post object when this: client client = clientbuilder.newclient(); webtarget webtarget = client.target("http://www.travelportland.com/wp-json"); response response = webtarget.path("posts/9").request().get(); post post = response.readentity(post.class); // => null the post class implementation looks (at point want take 'title' field json): @xmlrootelement public class post { private string title; public string gettitle() { return title; } public void settitle(string title) { this.title = title; } } all works fine when try string: string poststr = response.readentity(string.class); or if try other resource: webtarget webtarget = client.target("http://jsonplacehold

javascript - Angularjs HTTP service POST progress event -

since topics subject on year old, asked myself if there any solutions track ajax progress event http service (for loading bar or track how many bytes has downloaded). without use of 3rd parties :) these events: var ajax = new xmlhttprequest(); ajax.addeventlistener("progress") ajax.addeventlistener("load") ajax.addeventlistener("error") ajax.addeventlistener("abort") i've made using promise notify progress : var deferred = $q.defer(); var fd = new formdata(); fd.append("filename", file.name); fd.append("file", file); var xhr = new xmlhttprequest(); xhr.upload.addeventlistener("progress", function (event) { deferred.notify(event); }, false); xhr.addeventlistener("load", function (data) { deferred.resolve(event.target.response); }, false); xhr.addeventlistener("error", function (data) { deferred.reject(event.target.response); }, false); xhr.addeventlisten

javascript - jQuery set class active with anchor -

i have menu : <ul> <li> <a class="scroll-to" href="#one">one</a> </li> <li> <a class="scroll-to" href="#two">two</a> </li> <li> <a class="scroll-to" href="#three">three</a> </li> </ul> and on page, multiple anchor : <a id="two" target="_blank"></a> or <a id="one" target="_blank"></a> i'm looking way set active class menu when scroll anchor (with click or mouse scroll). for example if scroll anchor id="two" need set active li #two . any ideas ? if understand problem, add anchors class, example section , try this: $('.section').hover(function() { var anchor = $(this).attr('id'); $('a[href="#'+anchor+'"]').addclass('active'); }, funct

activerecord - Retrieve records from multiple levels of has_many relationships in Rails -

organization has many project. project has many websites. how websites particular organization rails 4? you can retrieve websites using: @websites = website.includes(:project => :organizations).where(["organization.id = ?", params[:organization]]) make sure params[:organization] actual id of organization of want fetch websites for. you can use has_many :through association . way, able websites simple @organization.websites . a has_many :through association used set many-to-many connection model. association indicates declaring model can matched 0 or more instances of model proceeding through third model. example, consider medical practice patients make appointments see physicians. relevant association declarations this:

Export array of documents from MongoDB in csv -

Image
i'm working on java program pass mongodb neo4j. have export mongo documents in csv file. have, example, document: "coached_team" : [ { "team_id" : "pal.00", "in_charge" : { "from" : { "day" : 25, "month" : 9, "year" : 2013 } }, "matches" : 75 } ] i have export in csv. read other questions, example this , used tip export document. to export in csv use command: z:\path\to\mongo\3.0\bin>mongoexport --db <database> --collection <collection> --type=csv --fields coached_team.0.team_id,coached_team.0.in_charge.from.day, coached_team.0.in_charge.from.month,coached_team.0.in_charge.from.year, coached_team.0.matches --out "c:\path\to\output\file\output.csv but, did not work me:

Sorting by nested dictionary in Python dictionary -

i have below structure { 'searchresult' : [{ 'resulttype' : 'station', 'ranking' : 0.5 }, { 'resulttype' : 'station', 'ranking' : 0.35 }, { 'resulttype' : 'station', 'ranking' : 0.40 } ] } and want get { 'searchresult' : [{ 'resulttype' : 'station', 'ranking' : 0.5 }, { 'resulttype' : 'station', 'ranking' : 0.4 }, { 'resulttype' : 'station', 'ranking' : 0.35 } ] } tried code without success result = sorted(result.items(), key=lambda k: k[1][0][1]["ranking"], reverse=true) if okay changing objects in-place. a = { 'searchresult' : [{ 'resulttype' : &

javascript - How do I remove logs from console.log in ionic? -

i wish build , distribute app built ionic. however, re-initialising console.log() 's not producing desired effect. i have tried reinit console.log function there still logs in application. var console = {}; console.log = function(){}; window.console = console; you use gulp accomplish this. gulp-strip-debug gulp plugin strips console.log()'s, console.info(), debugger,... statements. here's example how gulpfile.js should like: var gulp = require('gulp'); var stripdebug = require('gulp-strip-debug'); gulp.task('strip-debug', function () { // build location folder // strip stuff in these files. return gulp.src('src/js/*') .pipe(stripdebug()) // location output of 'stripped' files // in case, should same build destination .pipe(gulp.dest('dist/js/')); });

c# - WebAPI Token Issuance Authorization -

i using sessions , overriding authorizeattribute manage authorization webapi endpoint, used mvc web application. i've been told issuing tokens best way manage users , roles. i'm trying understand is: why better using session? can provide (simple) example of how issue tokens, when user logs in using webapi endpoint, , how use/track token after has been issued. i've been researching owin , bunch of other stuff , i'm having difficult time finding example of how works. tokens more secure , built asp.net identity framework. no need roll own solution. look @ sections "get access token" , "send authenticated request" link: http://www.asp.net/web-api/overview/security/individual-accounts-in-web-api . endpoint setup in default mvc template. can use postman test.

html - Images are not Centralised (Just) -

(edit: i'm new coding, apologies stupid mistakes) i can't find errors in coding, images positioned off-centre, right :( images have been entered using list format, i'll copy 1 image , relevant css: <nav> <ul> <li> <a href="images/mountains.jpg" target="new"><img src="images/mountains.jpg" alt="mountains"></a> </li> </ul> </nav> (updated) css: li { text-align: center; margin: 0 0 40px; } i cant find what's wrong :( possible table out of line? (reference image in comments) my ul element had default padding, removed padding in universal selector. it's best practice use reset css or normalize , style elements per need.

css3 - css - make the transition works just for one way -

i have following code in css: .item { opacity: 0; transition: opacity 1s linear; -webkit-transition: opacity 1s linear; -moz-transition: opacity 1s linear; } .item.seen { opacity: 1; } when add class seen .item , opacity of item turn 0 1 transition. but when remove class seen .item opacity transition (from 1 0) runs. is there way make transition run when .seen added not when removed? .item { opacity: 0; } .item.seen { opacity: 1; -webkit-transition: opacity 1s linear; -moz-transition: opacity 1s linear; transition: opacity 1s linear; } fiddle: http://jsfiddle.net/qcxt3evn/ (with opacity set 0.2 purpose of seeing clickable element) also, don't forget place standard property after vendor-prefixed (the latter might non-compliant specification)

apache - issues with friendly urls using htaccess and php -

i have problem, may easier if put code. have this: <?php $view = ""; if(isset($_request["view"]) != "" && $_request["view"]) { $view = $_request["view"]; } else { $view = ""; } #view handler $factory = new \api\factory(); $factory->template('header'); switch($view) { #home case '': $factory->view("home/index"); break; case 'about-us': $factory->view("home/about-us"); break; case 'contact': $factory->view("home/contact"); break; #products case 'products': $factory->view("products/index"); break; case 'details': $factory->view("products/details"); break; #how case 'how-to': $factory->view("how-to/index"); break; #tech documents

System.Linq.Enumerable+WhereSelectListIterator`2 error -

i getting error : system.linq.enumerable+whereselectlistiterator 2[consoleapplication1.person,<>f_ _anonymoustype0 2[system.string,system.string]] when try in console application : public class person { public int id; public int idrole; public string firstname; public string lastname; } class program { static void main(string[] args) { list<person> people = new list<person> { new person() {id = 1, idrole = 1, lastname= "anderson", firstname = "brad"}, new person() {id = 2, idrole = 2, lastname= "gray", firstname = "tom"} }; var query = p in people p.id == 1 select new { p.firstname, p.lastname }; console.write( query); console.readline(); }} you need iterate query foreach(var q in query) { console.write( string.format("{0} {1}",new []{ q.firstname ,q

java - Multithread CMU Sphinx 4 Alignment -

Image
i using cmu sphinx 4 align audio transcript. process has automated, i've tweaked alignerdemo exampled , compiled .jar execute terminal (ubuntu 15.04, 8gb, i5 quad). speed critical, when run aligner on large audio file, notice process runs on single thread. sphinx 4 wiki claims multithreaded, need manually enable? if so, how? for comparison, here screenshots of system monitor when running .jar (top) vs running ffmpeg (bottom), multithreaded.

php - PayPal Request keep getting MALFORMED_REQUEST -

i tried send payment paypal. reason malformed_request error. there no more information. not getdata() function exception. here compiled json: { "intent": "sale", "payer": { "payment_method": "paypal", "payer_info": { "first_name": "testvorname", "last_name": "testnachname", "email": "test@example.com", "suffix": "herr" } }, "transactions": [ { "amount": { "currency": "eur", "total": "72.00" }, "item_list": { "items": [ { "quantity": "4", "name": "test1", "price": "8", "currency": "eur&qu

node.js - Twilio Voice URL - Giving HTTP status code 502 when HTTPS (SSL) is implemented -

i have configured ssl of apis ( node.js). have purchased certs godaddy. , verified using openssl command using tlsv1 protocol. but when set twilio number call api ist throwing http status code 502. work when turn off ssl. issue twilio calling https api. error : attempt retrieve content https://api ... returned http status code 502. can please ? it seems twilio priorities ecdhe ciphers. default node server using tls cipher: tls_rsa_with_aes_256_cbc_sha256. aes256-sha cbc cipher , therefore susceptible beast attacks. not use it. added list of ciphers include , execlue in node server. see doc : https://nodejs.org/api/tls.html after adding below options node server ssl settings twilio started communication https apis. ciphers:[ "ecdhe-rsa-aes256-sha384", "dhe-rsa-aes256-sha384", "ecdhe-rsa-aes256-sha256", "dhe-rsa-aes256-sha256", "ecd

javascript - Extjs 6 and Ext.net in the same project? -

is possible cohabit extjs 6 , ext.net 1.7 in same project ? on side not yet tested, have project based on ext.net , want introduce extjs6 components. thanks i think there 0 chance of working. ext.net 1.7 built using ext js 3.4(?). there major breaking changes introduced sencha in ext js 4.x. ext js 5 compatible ext js 4, although still not drop in replacement. ext js 6 not drop in replacement ext js 5. so, no.

plsql - Variables in PL/SQL; always bind variables? -

i read question: are pl/sql variables in cursors same bind parameters? the answers given good. rather use thread , ask clarification (as rule states), wish ask clarification here. should (can) assume every variable in pl/sql statement bind variable? yes, whenever use pl/sql variable in embedded sql bind variable. if don't use in sql, variable of course, because bind variables sql thing only. use in sql in our pl/sql package, function or whatever, becomes bind variable sql engine. declare v_one varchar2(100); v_two varchar2(100); v_three varchar2(100); begin v_one := 'one'; v_two := 'two'; select col_three v_three mytable col_one = v_one; end; v_one, v_two , v_three pl/sql variables. however, there sql in our pl/sql block , using v_one there in clause. v_one bind variable in sql statement. ( v_three return value query. into v_three not sql, pl/sql, sql knows no keyword.) v_two not used in sql, never being used bind variab

scala - oop -- mutual dependency between chessboard and its pieces -

there have been many similar questions on mutual dependencies, each leaves me unsure own design. i writing chess program learn scala. close relationship between board , pieces makes me wonder if piece object should contain reference board belongs to. approach when wrote chess program in java. however, means board not defined until has pieces, , vice-versa. codependency no problem if board instance variable can add pieces build board, goes against immutability. related: the approach here seem suggest defining rules of piece movement in board object: https://gamedev.stackexchange.com/questions/43681/how-to-avoid-circular-dependencies-between-player-and-world the highest voted answer here has similar suggestion: two objects dependencies each other. bad? the selected answer above link different -- moves mutual dependency class definitions interfaces. don't understand why better. the design here mirrors current approach : https://sourcemaking.com/refactoring/change-bid

matlab - Why the rotation doesn't work in this code -

my problem rotate ellipsoid model around origin. i'm using rotation matrices answer doesn't ok. can tell me problem is? below code. 1st defined region , grid size. alpha, beta, gamma rotations around x,y,z axis. calculate ellipsoid radii's in new coordinate (rotated coordinate) check point point if agree ellipsoid formula define epsilon matrix goal based on points locations. @ end plot epsilon matrix xy,xz,yz planes. works alpha,beta,theta =0 , 90 degrees other angles there's not resealable answer. think mistake? fyi: code part of fdtd method maxwell's equations solver. thanks, nx=209; ny=209; nz=209; x_lower=1 ; y_lower=1 ; z_lower=1 ; x_upper=nx ; y_upper=ny ; z_upper=nz ; dz=2.366863905325444e-008 ; dy=2.366863905325444e-008 ; dx=2.366863905325444e-008 ; k_mid=(nz+1-1)/2+1; j_mid=(ny+1-1)/2+1; i_mid=(nx+1-1)/2+1; x_cyto=0 ; y_cyto=0 ; z_cyto=0 ; r_cell=2e-6; alpha=0; beta=0; gamma=0; temp_1=1.334 ; temp_2=1.35; a_cyto=1e-6 ; b_cyto=1e-6 ; c_cyto=1e-6

python - POST-REDIRECT-GET with decrypted streams rather than html docs -

i using on-disk encryption protect client data. after logging in, users must provide symmetric key in order decrypt file off disk: from django.shortcuts import render_to_response, requestcontext django.contrib.auth.decorators import login_required django.http import httpresponse django.conf import settings django.template import template my_lib import decrypt_file import os import magic @login_required def secret_stuff(request): if not request.method == 'post': return render_to_response('reenter_key.html', context_instance=requestcontext(request)) password = request.post.get('symmetric_key') encrypted_file = os.path.join(settings.base_dir, 'templates', 'secret.enc') byte_string = decrypt_file(password, encrypted_file) file_type = magic.from_buffer(byte_string) if b'data' in file_type: return render_to_response('bad_key.html', context_instance=requestcontext(request)) decrypted

javascript - Webdesign workflow - HTML or CSS first? -

i have been designing website year (self taught html, css , javascript) on last project experience designing , code structure issues. i start laying out entire website divs (i add background-color create boxes layout website) , start writing html/content. javascript, write needed. i wondering what's efficient way approach webdesign workflow , avoid extra-work such experienced on previous project. should start writing html, css , finish javascript? start wire framing on pen , paper, or whiteboard if available. after you'll wont have structures problems anymore. you can put out layout gives idea how project , catch lot of development/design problems, html , css simultaneous. once reached point of golden door not golden inside. you'll add js, , change/add css of necessary. should keep question in mind while doing js "do need or css/html too".

c - Allocating memory to a struct using pointers -

i have following linked list: struct node { int d; struct node *next; }; int main() { struct node *l = 0; struct node *k = l; k = malloc(sizeof(struct node)); /* l->d = 8; */ return 0; } why commented code wrong use? don't understand why memory isn't allocated node ``l points since k points same node l , used k -pointer allocate memory it. let's take apart. @ comments struct node{ int d; struct node * next; }; int main(){ struct node * l = 0; // l = 0 (or null) struct node * k = l; // k=l=0 k = malloc(sizeof(struct node)); // k=<some address allocated> /* l->d = 8; // l still 0 */ return 0; } so commented code trying dereference null pointer.

Does it help perf/memory pressure to use an image loader on local resources/icons in Android? -

i use image loading library (picasso) image loading/display remote images, , works well. however, local resources (mostly smaller image icons) i've been putting image directly in xml (via src="@drawable/image_name"). should using picasso (or glide, etc) load these smaller local images? if so, should both lists (shown via recyclerview) , 1 off icons? loading these local resources w/o loader working, improve perf if possible. thanks! standard practice local density specific resources included apk load them via resources, either including them src or background in xml or using resources#getdrawable(). usually image loading library unnecessary local resources because local resources tend small, fast decode , in memory in resources cache managed android. that said, if think have performance problem, measure! if looks particular image heavy activity or fragment slow start because of layout inflation time, may want experiment using image loading library reso

Batch checking for correct ip-range -

im looking better solution. checking computer if computer online , if in correct network. reason rest of batch need network, , printing log lan printer. se code use today. @echo off color f8 title wlan check rem maskin pinger www.vg.no :wlancheck ping www.vg.no>nul if errorlevel 1 goto nonet if errorlevel 0 goto gotnet :nonet color cf echo [wlan check][:::::::::failed!::::::::] echo computer has no internet connection echo connect now!!! timeout /t 15 goto wlancheck :gotnet color cf i use same ping printer. the best solution me if there way " if connected snid blablabla" goto continue echo not connected please retry. ipconfig can used: ipconfig | find /i "my_wlan_connection_name" >nul && goto continue || echo not connected replace my_wlan_connection_name connection name seen in output of ipconfig when connection established.

angularjs - Angular composite (super) directive not allowing 2 way binding on component (child) directives -

i have need create composite directive incorporates separate functional directives. 1 of component directives adds element dom , element binds value in component directive's controller. when composite directive adds component directive in compile function, seems work piece has 2 way binding in component directive not appear compiled , renders {{ctrl.value}} string on screen. realize bit convoluted have included plunk clarify issue. app.directive('compositedirective', function($compile){ return { compile: compilefunction } function compilefunction(element, attrs){ attrs.$set("component-directive", ""); element.removeattr("composite-directive"); element.after("<div>component value when added in composite directive: {{compctrl.myvalue}}</div>"); return { post: function(scope, element){ $compile(element)(scope); }}; } }); app.directive('componentdirective', function(){

python - Changing the xlim by date in Matplotlib -

i trying make visually appealing graph in python. using randal olson's example http://www.randalolson.com/2014/06/28/how-to-make-beautiful-data-visualizations-in-python-with-matplotlib/ here , trying make adjustments. my data simple, dispute_percentage out[34]: 2015-08-11 0.017647 2015-08-12 0.004525 2015-08-13 0.006024 2015-08-14 0.000000 2015-08-15 0.000000 2015-08-17 0.000000 the problem data starts loading @ feb 2015, , want start displaying @ april 2015. here code from __future__ import division collections import ordereddict import pandas pd collections import counter pylab import * import datetime datetime dispute_percentage.plot(kind = 'line') plt.xlabel('date') plt.ylabel('percent') plt.title('percent disputes in fy2015') # remove plot frame lines. unnecessary chartjunk. ax = plt.subplot(111) ax.spines["top"].set_visible(false) ax.spines["bottom"].set_visible(false) ax

GWT: What user.agent is my browser using? -

i using gwt 2.5 , gwt 2.7. suspect running bug caused gwt selecting wrong user.agent property. how can see user.agent property gwt has selected? ideally, able open browsers developer tools , enter window.gwtproperties.getuseragent . return 1 of values have specifide in user.agent something.gwt.xml file. starting point: know in gwt 2.5 user agent selected useragentpropertygenerator. writes javascript function somewhere executed , determines user.agent used. thanks. the xsiframe linker (used default in 2.7) output compilation-mappings.txt file mapping each permutation strong name (equivalent o generated *.cache.js file) permutation property values. looking @ file has been loaded browser, can track user.agent computed , used.

ios - Going in camera instantly when the user load the view in Swift -

this question has answer here: how launch camera on viewdidload uiimagepickercontrollerdelegate? 2 answers i create viewcontroller, , when user loads it, he's automatically redirected camera. know how go in camera when user press button, not when doesn't anything. example, when load snapchat app, you're automatically in camera take picture, perform that. any ideas ? thank's just insert code in method of viewdidload . is, view loaded, whatever in method gets called. take @ page: uiviewcontroller class reference

Python - one result from a list -

i dont know if did choose title, here goes: i have list need produce 1 result not of them! for in range(len(f)): print i+1,d[i] 1 -0.0002 2 0.0 3 0.0 4 0.0 5 -3.2e-05 6 -0.000376 i need last result. use loop of them. there way that? just index last element your_list[-1] so: print(d[-1]) if f not length d use f -1 index list: print(d[f-1])

c# - Post to WebApi and get result HttpClient -

i'm trying send post webapi , next , deserialize result object. im sending post windows phone 8.1. how object sended web api? my constructor: public mytravelspage() { task gettravels = this.gettravels(); } internal async task gettravels() { string uri = "http://localhost:6234/api/services/app/travel/getmytravels"; travelpositions travel = new travelpositions(); travel.userguid = useridentity.userid; string x = jsonconvert.serializeobject(travel); var stringcontent = ""; using (var client = new system.net.http.httpclient()) { // new code: client.baseaddress = new uri(uri); client.defaultrequestheaders.accept.clear(); client.defaultrequestheaders.accept.add(new mediatypewithqualityheadervalue("application/json")); httpcontent content = new stringcontent(x, encoding.utf8); var response = await client.postasync(uri, new stringcontent(x, encoding.utf8, "applicatio

html - Wider input fields in bootstrap modal -

this question has answer here: bootstrap full-width text-input within inline-form 3 answers this how modal looks now. how can modal wider? one thing works using this <span class="input-group-addon" id="sizing-addon1"> but makes fields this . notice grey thing on left. makes last input field smaller vertically. edit: solved! seems trick. input style="width:100%" thanks anyway! here's code. <div class="modal fade" id="examplemodal" tabindex="-1" role="dialog" aria-labelledby="examplemodallabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="moda