Posts

Showing posts from July, 2013

matlab - Integrating Velocity Over a Complex 2-D Surface -

i'm using matlab calculate the average velocity in cross section of pipe integrating discrete velocity points on surface. points scattered in random pattern form circle (almost). i used scatteredinterpolant create function relating x , y v (velocity) in order create grid of interpolated values. f = scatteredinterpolant(x, y, v,'linear'); vq = f(xq,yq); % xq , yq set of query points the problem having trying calculate the surface area of function, in circular portion contains scatter points. the first way went using quad2d function. int = quad2d(@(x,y) f(x,y), min(x), max(x), min(y), max(y), 'maxfunevals', 100000); however gives incorrect takes area on rectangle , circle. now can define surface area circle in future have work more complex shapes want use points define boundary of scatter points. i'm doing through triangulation, using following command. dt = delaunaytriangulation(x,y); however have no idea how can incorporate these points ...

javascript - Remove input element from cell and preserve the value, when clicked outside of cell or another cell -

i want input elements in cells disappear when click outside of cells or on cell (note clicked cell must active afterwards, have input element). , cell must keep value of input element. when cell clicked, input element must appear (that part solved). html: <table> <tr> <td>content</td> <td>content</td> </tr> <tr> <td>content</td> <td>content</td> </tr> </table> javascript: //this part creates input in td element, allows editing cell content , //when enter pressed removes input leaving cell value (the okay part) $("td").click(function(){ if($(this).find("input").length==0){ var cellcontent = $(this).html(); $(this).empty(); $(this).append("<input type='text' size='"+cellcontent.length+"' value='"+cellcontent+"'>"); ...

mysql - Condense 3 SELECTS down to one table -

the 3 statement (a little contrived simplicity) are: select `user_id` `movie_id` = 1 select `user_id` `movie_id` = 2 select `user_id` `movie_id` = 3 what twofold: join 3 of above single table of id's match 3 of movie_id make of 1 query reduce mysql reads speed performance i sure there simple way it, not strongest sql user, of help! select count(distinct movie_id), user_id table move_id in (1,2,3) group user_id having count(distinct movie_id) = 3 what obtain distinct count of movies per user_id. limits results users having count of 3.

ruby on rails - accepts_nested_attributes_for :models, allow_destroy: true not working -

my params so: "job" => {"title"=>"marketing head", "job_role_id"=>"13", "challenge_assignments_attributes"=>{ "0"=>{"_destroy"=>"true", "challenge_id"=>"13", "id"=>"12"}, "1"=>{"_destroy"=>"true", "challenge_id"=>"13", "id"=>"13"} } } i have in job.rb accepts_nested_attributes_for :challenge_assignments, reject_if: :all_blank, allow_destroy: true and in job_controller.rb permit these challenge_assignments_attributes: [:id, :challenge_id, :_destroy] yet on saving objects don't destroyed. have model set in same way , _destroy key works it. configuration both same yet 1 works , other doesn't. are there other conditions under allow_destroy doesn't work cause i've tried @ source code no avail. for i...

How to change arrow tip in tikz -

Image
is there simple way increase size of arrow tip using like: \tikzset{myptr/.style=->, ????} without designing new arrow style scratch? one solution, quick, scale arrow head number %2 in following: \documentclass[multi=false,tikz,border=2mm]{standalone} \usetikzlibrary{arrows,decorations.markings} \begin{document} \begin{tikzpicture} %1 \draw [->,>=stealth] (0,.5) -- (2,.5); %2 \draw [decoration={markings,mark=at position 1 {\arrow[scale=3,>=stealth]{>}}},postaction={decorate}] (0,0) -- (2,0); \end{tikzpicture} \end{document} this produces: (sorry excessive zoom). much more in answers this question , in this answer, used source . addendum \tikzset approach. code: \documentclass[multi=false,tikz,border=2mm]{standalone} \usetikzlibrary{arrows,decorations.markings} \begin{document} \begin{tikzpicture} \tikzset{myptr/.style={decoration={markings,mark=at position 1 % {\arrow[scale=3,>=stealth]{>}}},postaction={decorate}}} %...

javascript - Routing without template/controller combo? -

i map each route function, rather controller/template. i have 1 page, items change on page scope variables. i'd prefer avoiding controller , template reload, i'd rather swap variables. is possible $routeprovider? apologies being unclear, here example: the app 1 template , 1 controller threadctrl app.controller("threadctrl", function($scope) { $scope.topic = "all"; $scope.sorting = "best"; $scope.articles = get_articles_for_topic(...); $scope.$watch "topic", ... $scope.$watch "sorting", ... }); template example: <div ng-controller="topicctrl"> {{ topic }} - {{ sorting }} <div ng-repeat="article in articles"> ... </div> </div> there 1 template , 1 controller. i'd make use of routing without re-rendering controller , changing scope variables. i understand if example should re-render template + controller default, want know if can. ...

java - Why "if" is not doing anything in this boolean method? -

import java.util.scanner;//import scanner public class review{ //name of program public static void main(string[]args){ // main statement scanner i=new scanner(system.in); system.out.println("enter string"); string b=i.nextline(); system.out.println("enter letter"); char c=i.next().charat(0); system.out.println("answer "+test1(b,c)); } public static boolean test1(string a, char b){ boolean result= true; for(int i=0;i<a.length();i++) if(a.charat(i)==b) result =true; else result=false; return result; } } this program looking checking char in string or not. hello, e = true hello, = false in method test1 , for loop traverse whole line although finds letter string . update this: public static boolean test1(string a, char b){ for(int i=0;i<a.length();i++) { ...

node.js - Socket.io failing to log chat message in console -

i'm walking through socket.io tutorial on creating chat room , , i'm having trouble getting app log chat message console. the app logging when user connects & disconnects, not logging when message passed through. any thoughts? the relevant parts of index.html page: <script src="/socket.io/socket.io.js"></script> <script src="http://code.jquery.com/jquery-1.11.1.js"></script> <script> var socket = io(); $('form').submit(function() { socket.emit('chat message', $('#m').val()); $('#m').val(''); return false; }); </script> <body> <ul id="messages"><ul> <form action=""> <input id="m" autocomplete="off" /><button>send</button> </form> </body> my index.js file: var express = require('express'); var app = express(); var http = require('h...

opengl - Ambient and Specular lighting not working correctly in GLSL -

in lighting scene, reason ambient lighting isn't working @ all. whole model same brightness, no matter way facing. tried getting rid of attenuation still has same results. along that, specular lighting shining, no matter camera is. supposed shine based on player position. here screenshot of ambient problem: imgur.com as can see, part of sphere facing away light (located @ [0.0,4.0,0.0]) same color part facing light. ambient factor supposed 0.2 of fragment color. vertex shader source: layout(location = 0) in vec3 positions; layout(location = 1) in vec2 texcoords; layout(location = 2) in vec3 normals; out vec3 new_normal; out vec3 worldpos_out; out vec2 pass_texcoords; struct matrices { mat4 projection; mat4 worldmatrix; mat4 modelmatrix; mat3 normalmatrix; }; uniform matrices mat; void main(void) { pass_texcoords = texcoords; vec4 newposition = vec4(positions, 1); vec4 worldpos = (mat.modelmatrix * newposition); mat4 camera = mat.proje...

swift - UnsafeMutablePointer.null() does not work? (Is unavailable?) -

in swift, null, used unsafemutablepointer.null() did not work. xcode says unavailable , should use nil literal instead gives me error message. have fix? thanks. i stumbled upon post while trying answer question myself, , found worked me let nullptr = unsafemutablepointer<int>(nil) // nil null pointer

r - Calculating a mean from data held in multiple files -

i trying write r script calculates mean of specified pollutant (nitrate or sulfate) based on data 1 or more of 332 monitor stations. data each station held in separate file, numbered 1:332. new r and, fair chooses me, should homework problem. have written script below, works 1 file: pollutantmean <- function(directory, pollutant, id = 1:332) { filepath <- "/users/jim/documents/coursera/2_r_prog/data" for(i in seq_along(id)) { if(id < 10) { name <- paste("00", id[i], sep = "") } if(id >= 10 && id < 100) { name <- paste("0", id[i], sep = "") } if(id >= 100) { name <- id[i] } } file <- paste(name, "csv", sep = ".") station <- paste(filepath, directory, file, sep = "/") monitor <- read.csv(station) i...

How to make dynamic views with ionic angularjs -

Image
i'm using ionic framework new application. i have issue, want know how possible insert views dynimacally. i make request server requesting news, response in in json : { "title":"news 1", "image":"http://www.server.com/news_image1.png", "description":"news_description" }, { "title":"news 2", "image":"http://www.server.com/news_image2.png", "description":"news_description" }, { "title":"news 3", "image":"http://www.server.com/news_image3.png", "description":"news_description" } i want insert data dynmaically ion-view , able swipe between news image below : so if have idea how can possible ! you slide box , use ng-repeat dynamically create slides. although if making bunch of slides use collection repeat. check out slide boxes here http://ionicframework.com/docs/api/directive/ionslide...

javascript - angularjs not using $rootscope and $broadcast -

so i'm trying find way prevent using $rootscope ,$broadcast , $apply. let me show code first: app.controller('firstcontroller', function ($scope, servicechatbuddy, socketlisteners){ $scope.chatbuddy = servicechatbuddy; $scope.$on('user delete:updated', function (event, id) { $scope.chatbuddy.users[id]['marker'].setmap(null); delete $scope.chatbuddy.users[id]; }); $scope.$on('loadposition:updated', function (event, data) { $scope.$apply(function () { $scope.chatbuddy.users[data.id] = data.obj; }); // , bunch more these }); }) the socketlisteners 3rd party libary (socket.io )which implemented in factory broadcast data when event has occured socketmodule.factory('socketlisteners', function ($rootscope, decoratefactory) { var sockets = {}; ...

node.js - MongoDB: best design for messaging app -

this question has answer here: mongodb relationships: embed or reference? 9 answers a simple design problem. want build facebook messenger. let's john , marry chatting, better approach? 1) 1 document per conversation , messages array of message object { participants: ['john', 'marry'], messages: [ { sender: 'john', content: 'howdy', time_created: new date() }, { sender: 'marry', content: 'good u', time_created: new date() }, ... ] } 2) 1 document per message { participants: ['john', 'marry'], sender: 'john', message: 'howdy', time_created: new date() } // document 1 { participants: ['john', 'marry'], sender: 'marry', message: 'good u', time_created: new date() } // document 2 .... which approach has better performance...

html - Cannot center a fluid image in a fluid Div -

i'm having issue horizontally centering fluid image in fluid div. looking high , low, solutions others have found not working me, either i'm trying hard (i doubt it) or i'm working different medium. html: <body> <div id="backgrouddiv"> <img src="images/numbertwo.png" alt="" id="fsbg"/> </div> </body> css: body { margin: 0px } #fsbg { width: auto; height: 100%; min-width: 1040px; position: absolute; min-height: 585px; } #backgrouddiv { width: 100%; height: 1080px; text-align: center; display: block; background-color: #bf2527; top: 0px; left: 0px; right: 0px; bottom: 0px; } "margin: auto" nothing width of variable. in code is, left edge of image "numbertwo" centered on page. want center of image centered. behaves should scaling-wise, not in middle of page! any appreciated, it's been driving me wall. l...

jframe - Java Game actionPerformed questions -

hi i've made game similar doodle jump jumper/object jumping next platform on top , if fall of lose. anyway game works there 1 problem, i've make if press on space bar jumper/object jumps up, ok here problem: if keep holding on space bar jumper keep moving until let go of space bar, how make when press or hold on space bar jumper/object jumps ones rather keeps going until let go of space bar? here's what's going on in code: here action performed class jumper jumps or down static boolean gameplay=false; public void actionperformed(actionevent e) { // todo auto-generated method stub if (gameplay==true){ if (jumper==true){ doodleheight+20; } if (jumper==false){ doodleheight=doodleheight-10; } here have keys controls jumps public void keypressed(keyevent e) { // todo auto-generated method stub if (e.getkeycode()==keyevent.vk_space){ jumper=true; } } @override public void key...

multithreading - Thread priority in Python -

for music sampler , have 2 main threads (using threading ) : thread #1 reads sound files from disk , in real-time, when needed (example: when press c#3 on midi keyboard, need play c#3.wav possible!) or ram if sound has been loaded in ram , thread #2 preloads files ram, 1 after another. thread #2 should done in background, during free time , should not prevent thread #1 job quickly. in short, thread #1 should have higher priority thread #2. how threading or other python thread managament module? or possible pthread_setschedparam ? how? i'm not big expert i'll handle problem this: #!/usr/bin/python2.7 # coding: utf-8 import threading, time class foo: def __init__(self): self.allow_thread1=true self.allow_thread2=true self.important_task=false threading.thread(target=self.thread1).start() threading.thread(target=self.thread2).start() def thread1(self): loops=0 while self.allow_threa...

machine learning - How do I choose a linkage method for Hierarchical Agglomerative Clustering? -

i understand hac has several options in terms of linkage functions. have: single linkage produces "straggly" clusters complete linkage produces tight, spherical clusters average linkage sort of compromise between two ward's method, based more off variance actual distance what i'm trying figure out is, how know 1 of these want use? there datasets "straggly" clusters preferable spherical ones? or more function of intend clustering data? it depends on data. single-linkage works reasonably on clean data. if have dirty data, other linkages may better. ward similar k-means. may choice if want talk centroids , data partitioned disjoint subsets. the other problem slink (for single-linkabe) fast. others work in o(n^3) not usable on large data sets. compare e.g. dbscan runs in o(n log n) if done well, or kmeans in o(n)...

javascript - ReactJS localhost Ajax call: No 'Access-Control-Allow-Origin' header -

working on reactjs tutorial spinned local server >npm install -g http-server >http-server -c-1 and got local server working fine located @ http://localhost:8080 though, when attempted use ajax call within 1 of components, got following error in chrome console: xmlhttprequest cannot load http://localhost:8080/comment.json. no 'access-control-allow-origin' header present on requested resource. origin 'null' therefore not allowed access. response had http status code 405. this ajax call snippet: var commentbox = react.createclass({ loadcommentsfromserver: function(){ $.ajax({ url: this.props.url, datatype: 'json', cashe: false, crossdomain:true, headers: {'access-control-allow-origin': '*'}, success: function(data){...

swift - Click on keyword in UILabel -

Image
my following code in swift. to sum up, have uitableview tweets, each row tweet. can know hashtags king of code : for hashtag in tweet.hashtags { attributedtext.setattributes(hashtagattrs, range: hashtag.nsrange) } but useful if want highlight these keywords (hashtags) to put text of tweet in label, write : @iboutlet weak var tweettextlabel: uilabel! tweettextlabel?.text = tweet.text so have tableview what want able click on hashtag , research same information new hashtag. ask : how can click on hashtag, directly in label ? thank much! [update] i succeed access hashtag uitextview instead of uilabel, code : func textview(textview: uitextview, shouldinteractwithurl url: nsurl, inrange characterrange: nsrange) -> bool { let tweettableview = tweettableviewcontroller() tweettableview.searchtext = url.absolutestring return true } but problem can't reload data in tableview. have new tweets in tweet variable, cell doesn't update. functi...

mysqli - MYSQL and PHP output data limit -

when retrieving data mysql server seems limiting output results. please refer following attachments code: <style> tr,td { border:1px red solid; } </style> <?php include('./connect.php'); if (!$connect) { die('could not connect: ' . mysql_error()); } $db_selected = mysqli_select_db($connect, db_name); if (!$db_selected) { die('can\'t use ' . db_name . ': ' . mysql_error()); } //execute sql query , return records $result = mysqli_query($connect, "select * jobs order id desc limit 1"); echo "<table style='border:1px solid red'>"; while($row = mysqli_fetch_array($result)) { echo '<tr><td>reference number:</td><td>'; echo $row['id'];'</td></tr>'; echo '<tr><td>first name:</td><td>'; echo $row['firstname'];'</td...

internationalization - Language selector in Play 2.4 & Scala 2.11.6 -

i'm trying implement simple page language selector , localized message: |...en...|▼| a message in english ideally when user changes language page should reload updated message , different selected language |....fr....|▼| un message en français but can't work: page stays same , thing changes play_lang cookie. controller package controllers import javax.inject.inject import play.api.mvc._ import play.api.i18n._ import play.api.data._ import play.api.data.forms._ class test @inject() (val messagesapi: messagesapi) extends controller i18nsupport { def index = action { implicit request => ok(views.html.test()) } def changelanguage() = action { implicit request => val referrer = request.headers.get(referer).getorelse("/") val form = form("language" -> nonemptytext) form.bindfromrequest.fold( errors => badrequest(referrer), language => redirect(referrer).withlang(lang(language)) ) ...

java - Change specific element in RecyclerView -

i'm having bit of trouble android's new recyclerview. want create settings activity each option cardview. inside each cardview there's 2 textviews, title , subtitle. goal when user clicks on specific cardview, want able change cardview's subtitle text. problem when try use following code, doesn't that. textview subtitle = (textview) findviewbyid(r.id.subtitle); subtitle.settext("blah blah blah"); when click on first cardview changes fine. problem when click on second one: changes first 2nd one's text. i heard assigning each textview custom id when onbindviewholder method called can put textview subtitle = (textview) findviewbyid(r.*something*.subtitle1); subtitle.settext("blah blah blah"); would correct course of action, and, if so, how go doing so? here's code far: optionsadapter.java package com.alexbeschler.reversepolishnotation; import android.graphics.typeface; import android.support.v7.widget.recyclerview; impor...

database - How to delete rows in MYSQL where a column doesn't contain certain data -

a database in charge of fixing got filled spam. there table called url in database. there column called alias . there 2,000 correct alias rows should there , other 100,000+ spam . have comma separated list of correct values should there. example value in alias z6j6h , 5 letters/numbers. how can delete every row not contain value in list? delete (table) alias not in ('asdfg', 'abcde')

how to convert JSON array into JavaScript 2D array -

this question has answer here: how convert array of objects array of arrays 3 answers i want convert following json js 2d array, not sure how in html. [{"fields": {"diameter": 23.0, "neighbourhood": "west end"}, "model": "hug.tree", "pk": 345}, {"fields": {"diameter": 14.0, "neighbourhood": "mount pleasant"}, "model": "hug.tree", "pk": 484}] the result should like: [[23.0, 'west end'], [14.0, 'mount pleasant']] thank much! this work fields of "fields", not diameter or neighborhood . demo : var items = [{"fields": {"diameter": 23.0, "neighbourhood": "west end"}, "model": "hug.tree", "pk": 345}, {"fields...

javascript - Meteor.publish callback not being called -

i have simple project single meteor.publish call: boxes = new meteor.collection("boxes"); if (meteor.isserver) { meteor.startup(function () { boxes.remove({}) //clearing database boxes.insert({ //adding 1 element database boxes: [1], currentid: 1 }); }); console.log("publish1") meteor.publish("boxes", function() { console.log("publish2") //this not run! ever! return boxes.find(); }); } for reason meteor.subscribe not seem working (the collections return empty), placed couple of console.log in code. reason server code prints "publish1" not print "publish2", while if try same in example project print both. note: removed autopublish package. you need subscribe on client. work me: boxes = new meteor.collection("boxes"); if (meteor.isserver) { meteor.startup(function () { boxes.remove({}) //clearing database boxes.insert({ //adding 1 element database ...

html - How do I make my toggle button scroll up slightly when I scroll down the page? -

i making website have multiple pages , each page potentially long @ first wanted way have access menus , stuff in sidebar. changed nav isn't fixed more , scrolling down page looks weird because toggle quite low down page (due being below nav @ top of page). sow how toggle, sidebar , content scroll top of page , have both toggle , sidebar become fixed content side being scrolled?. it may simple solution cant think of how , solution find this , looks quite bit little right? this have @ moment html, body { margin: 0; padding: 0; border: 0; } { display: inline-block; padding: 1em; text-decoration: none; color: #fff; background: rgba(0, 0, 0, 0.5); border-radius: 0 5px 5px 0; } #a, #b { position: absolute; transition: 700ms; } #a { top: 0px; width: 200px; bottom: 0px; background: orange; } #b { top: 0px; left: 200px; right: 0; bottom: 0px; background: green; } /*hide checkbox*/ #toggle { display:...

How can I use CommandArgument of LinkButton in jQuery? -

i have 5 link buttons. , want send command argument web method load on page scroll. $.ajax({ type: "post", url: "default.aspx/getcustomers", data: '{pageindex:'+pageindex+'}', contenttype: "application/json; charset=utf-8", datatype: "json", success: onsuccess, failure: function (response) { alert('hell 1'); }, error: function (response) { alert('hell 2'); } }); no can't use commandargument in jquery because stores in viewstate of page. can use data-... attribute instead. <asp:linkbutton id="btnsave" runat="server" text="save" data-id="<%# databinder.eval(container.dataitem, "id") %>" /> <script> var id = $('#btnsave').data('id'); // use id </script>

javascript - PHP Mysqli Parallel Connection doesnt go through when IP is incorrect -

i have small application used connect several databases across multiple ips, takes input ip, username, password. 3 free text fields , users can provide value. database selected in next screen. the purpose of page validate if credentials valid. var arrayinput = [ip, username, password]; $.ajax({ url: 'login.php', type: 'post', data: { arrayinput }, success: function (data) { console.log(data); }, error: function (data) { console.log(data); } the php file below. < ? php mysqli_report(mysqli_report_all | mysqli_report_strict); $ip=$_post['arrayinput'][0]; $username=$_post['arrayinput'][1]; $password=$_post['arrayinput'][2]; try { $mysqli = mysqli_connect($ip,$username,$password); mysqli_close($mysqli); $data = array('type' => 'success', 'message...

model view controller - When Passing checkbox values as JSON in Jquery, I get an error: 500 Internal Server -

i want pass checkbox value json, when debugging code error: networkerror: 500 internal server error - http://localhost:2020/labaccess/labaccesscheck" circular reference detected while serializing object of type 'system.reflection.runtimemodule' what's problem? use code in view , control. $(function () { $("#getaccess").change(function () { alert('asa') var newvalue = true;//$(this).checkbox; var itemid = '2' ; alert('ii') $.ajax({ type: "post", url: "/labaccess/labaccesscheck", data: { itemid: '67' }, datatype: "json", traditional: true, success: function (data) { //alert(data.itemid); //alert(data.itemid); }, error: function (xmlhttprequest, textstatus, errorthrown) { } }); })...

javascript - Bootstrap table toggle ...how to close previous toggle if a new one is opened? -

first of all, jsfiddle of code here: http://jsfiddle.net/ae1lxcc1/3/ i have bootstrap table people can open , close toggle additional information. each have different ids toggle-00001 , toggle-00002 , may toggle-43894 . i use each id: $(".toggle-00001").on('click', function (event){ event.preventdefault(); $(this).closest('tr').toggleclass("row-selected"); $(this).closest('tr').next('tr').toggleclass("row-selected"); $(".details-00001").slidetoggle("fast"); $(this).html(function(i,html) { if (html.indexof('color-grey') != -1 ){ html = html.replace('icon-grey','icon-green'); } else { html = html.replace('icon-green','icon-grey'); } return html; }); }); is there simple way, without rewriting of code, make if new 1 toggled, other 1 closed? in other words, i'd there 1 toggle open @ times, user can...

neo4j - What is the most performant way to create the following MATCH statement and why? -

the question: performant way create following match statement , why? the detailed problem: let's have place node variable amount of properties , need nodes potentially billions of nodes it's category. i'm trying wrap head around performance of each query , it's proving quite difficult. the possible queries: match place node using property lookup: match (entity:place { category: "food" }) match place node iscategory relationship food node: match (entity:place)-[:iscategory]->(category:food) match place node food relationship category node: match (entity)-[category:food]->(:category) match food node iscategoryfor relationship place node: match (category:food)-[:iscategoryfor]->(entity:place) and variations in between. relationship directions going other way well. more complexity: let's throw in little more complexity , need find place nodes using multiple categories. example: find place nodes category foo...

Ionic serve does not load angular js and ionic css -

i new in ionic field. created new app in localhost folder(c:\xampp\htdocs). when go " http://localhost/ionapp/www/ " works fine when run app "ionic serve" command blank page. when viewed page source found ionic.css , ionic.bundle.js file not loaded during ionic serve. , in console error "angular not defined". can please me fix this? here index.html should load css , js files <!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> <title></title> <link href="lib/ionic/css/ionic.css" rel="stylesheet"> <link href="css/style.css" rel="stylesheet"> <!-- if using sass (run gulp sass first), uncomment below , remove css includes above <link href="css/ionic.app.css" rel="stylesheet...

How to send a data array to my Applet and manipulation it by Applet and return new data in response apdu? -

update 1: installed applet on javacard(i used source code accepted answer in question) .when send generatedkey command via opensc ,it returns 9000 response instead of sending xored data! created project javacard version 2.2.1 , card compattible version. why expected data not recieved opensc? i want send random byte array including example 24 elements javacard applet , applet supposed change array using specific method. example method xor each elements 0x05 , returns result array in apdu response. to aim above goal wrote following program far: package keygeneratorpackage; import javacard.framework.*; public class keygeneratorpackage extends applet { private static final byte hw_cla = (byte) 0x80; private static final byte hw_ins = (byte) 0x00; public static void install(byte[] barray, short boffset, byte blength) { new keygeneratorpackage().register(barray, (short) (boffset + 1), barray[boffset]); } public void process(apdu...

ruby - How do I kill the chef process on the chef server? -

i got myself bit of pickle. i got 1-core, 1gb memory vps digital ocean , took shot @ installing chef server on box, though the guide had few warnings chef requires @ least 4 cores , more memory. during chef-server-ctl reconfigure step, ran postgresql errors (if you're curious, more here ) , mistakenly hit ctrl-c kill process. noticed several chef processes running , restarted server try , kill them, still persisted. root@hal:~# ps aux | grep chef root 597 0.0 0.0 4212 72 ? ss 07:39 0:00 runsv opscode-erchef opscode 611 0.0 0.0 4356 88 ? s 07:39 0:00 svlogd -tt /var/log/opscode/opscode-erchef opscode 612 0.7 3.7 534704 38400 ? ssl 07:39 0:09 /opt/opscode/embedded/service/opscode-erchef/erts-5.10.4/bin/beam.smp -k true -a 5 -- -root /opt/opscode/embedded/service/opscode-erchef -progname oc_erchef -- -home /var/opt/opscode/opscode-erchef -- -noshell -boot /opt/opscode/embedded/service/opscode-erchef/releases/1.5....

PopupWindow overlaps soft buttons on Android 5.0 -

Image
i have simple popupwindow create following code (the code in c#, java code should same) view popupview = layoutinflater.from(this.activity).inflate(resource.layout.lectionfooter, null); var popup = new popupwindow(popupview, viewgroup.layoutparams.matchparent, viewgroup.layoutparams.wrapcontent, false) { outsidetouchable = true, animationstyle = resource.style.footeranimation }; popup.setbackgrounddrawable(new bitmapdrawable()); popup.showatlocation(rootview, gravityflags.bottom, 0, 0); on pre-lollipop devices, popup looks fine, on android 5.0, popup overlaps soft buttons: here's popupwindow on android 4.4 device: does have idea why happens , how can fixed? this possible bug in android api 21 that's why introduced popup.setattachedindecor(true/false); method in api 22 there workout, can set right y coordinate popup follows: rect rect = new rect(); getwindow().getdecorview().getwindowvisibledisplayframe(rect); int winheight = getwind...

c++ - Protobuf cannot be linked on ubuntu -

i try use protobuf somehow linking fails (here snippet): linking cxx executable app cmakefiles/app.dir/msg.pb.cc.o: in function `evoswarm::protobuf_assigndesc_a_5fto_5fb_2eproto()': msg.pb.cc:(.text+0x133): undefined reference `google::protobuf::internal::generatedmessagereflection::newgeneratedmessagereflection(google::protobuf::descriptor const*, google::protobuf::message const*, int const*, int, int, int, int, int, int)' msg.pb.cc:(.text+0x190): undefined reference `google::protobuf::internal::generatedmessagereflection::newgeneratedmessagereflection(google::protobuf::descriptor const*, google::protobuf::message const*, int const*, int, int, int, int, int, int)' cmake finds shared object file of protobuf , uses during linking: /usr/bin/c++ -std=c++11 cmakefiles/app.dir/main.cpp.o cmakefiles/app.dir/msg.pb.cc.o -o app -rdynamic -lprotobuf -lpthread and here smaller version of cmakelists.txt cmake_minimum_required (version 2.8) project(app) # build ...