Posts

Showing posts from February, 2014

c# - Is the finally block pointless? -

this question has answer here: why use in c#? 13 answers i'm teaching myself c# , studying try, catch , finally. book i'm using discussing how block runs regardless of whether or not try block successful. but, wouldn't code written outside of catch block run anyway if wasn't in finally? if so, what's point of finally? example program book providing: class myappclass { public static void main() { int[] myarray = new int[5]; try { (int ctr = 0; ctr <10; ctr++) { myarray[ctr] = ctr; } } catch { console.writeline("exception caught"); } { console.writeline("done exception handling"); } console.writeline("end of program"); console.readline()

iis 7.5 - IIS response status 302 then 200 for same URL -

what causes iis 7.5 send response 302 , response 200 same page url request. ie11 f12 developer tool debugger 302 message . condition began when iis web server upgraded iis6 iis7.5. server log shows 2 statuses occurring @ same date time second. server error occurs page request types (html, asp, etc.).

Enqueue laravel event subscriber -

i'm handling multiple events through event subscriber instead making separated events/listeners. enqueue several of these events didn't find way accomplish that. i've followed official documentation ( https://laravel.com/docs/5.2/events#event-subscribers ), there no clue of how choose events want enqueue(neither subscriber). any suggestions? (no individual event/listener, please) thanks in advance! if interested in, i've found solution looking deeper in event dispatcher. implementing contract shouldqueue on eventsubscriber works same separated event/listener , enqueue events on database. should documented in official site. regards.

python - How to save order made by user into a file and then displaying that after the new order is made? -

this first question here , new python user. hoping regarding program. essentially, want program act ordering service fast food. once user inputs order, i'm trying make order , username stored file , displayed later in program. here code far: foodmenu = {'1': 3.50, '2': 2.50, '3': 4.00, '4': 3.50, '5': 1.75, '6': 1.50, '7': 2.25, '8': 3.75, '9': 1.25} itemtotals = {'1': 0, '2': 0, '3': 0,'4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0} textfile = open("order.txt","r") def main() : menu() def menu() : menu = ( """ 1. chicken strips - $3.50 2. french fries - $2.50 3. hamburger - $4.00 4. hotdog - $3.50 5. large drink - $1.75 6. medium drink - $1.50 7. milk shake - $2.25 8. salad - $3.75 9. small drink - $1.25 """ ) return menu

jquery - Javascript loop and insert new object -

i ajax data: [{"id":125,"price":225,"start":"tue, 26 apr 2016 00:00:00 +0000","user_id":8},{"id":124,"price":200,"start":"wed, 27 apr 2016 00:00:00 +0000","user_id":8},{"id":121,"price":67,"start":"sat, 23 apr 2016 00:00:00 +0000","user_id":8},{"id":114,"price":45,"start":"sun, 08 may 2016 00:00:00 +0000","user_id":9},{"id":113,"price":55,"start":"sun, 24 apr 2016 00:00:00 +0000","user_id":8},{"id":111,"price":55,"start":"wed, 01 jun 2016 00:00:00 +0000","user_id":11},{"id":110,"price":53,"start":"fri, 03 jun 2016 00:00:00 +0000","user_id":8},{"id":107,"price":53,"start":"wed, 03 aug 2016 00:00:00 +000

unity3d - Unity camera auto rotates and causes problems -

i have camera , want camera follow player. player can walk around cube camera must keep radius player. i'm doing player's z x rotation of camera (with equation), problem is, x rotation of camera goes 0 90, @ 90 goes again 0 changes y , z rotation 180. gives me problems because should keep increasing x rotation 180 goes 90 0 again because y axis rotated automatically. how can dissable automatication? camerascene.transform.rotation = quaternion.euler(( 180 * (transform.position.z - boxmin.z) / width), 0, 0); newpos = new vector3(0, mathf.sin(camerascene.transform.eulerangles.x * mathf.deg2rad) * 35 + 25, mathf.sin((camerascene.transform.eulerangles.x-90)* mathf.deg2rad) * 35); camerascene.transform.position = newpos;

java - Gmail account authentication error while sending mail in android application -

i getting following error when trying send message android application gmailapi. "could not connect smtp host: relay.jangosmtp.net, port: 465, response: -1" since 2015 google not allowing "less secure apps" connect through smtp port (this means need ssl or tls certificate). to allow them try this: https://support.google.com/accounts/answer/6010255?hl=en

colors - Android ColorPicker Dialog - Chang theme -

Image
i'm using colorpicker dialog contained in api demos (sdk android)... when use on app, size changed, background color... how can same dialog in api demo, here both pictures: this and i'm getting it's easy, change constructor of colorpickerdialog: public colorpickerdialog(context context, oncolorchangedlistener listener, int initialcolor) { super(context,android.r.style.theme_holo_light_dialog_noactionbar);//set favorite theme //super(context); //this normal constructor mlistener = listener; minitialcolor = initialcolor; }

python - What is the difference between condensed and redundant distance matrices? -

new python , programming in general: the documentation squareform states following: converts vector-form distance vector square-form distance matrix, , vice-versa. converts 1d array squared matrix? where paramenter x: either condensed or redundant distance matrix. and returns: if condensed distance matrix passed, redundant 1 returned, or if redundant 1 passed, condensed distance matrix returned. what difference between condensed , redundant matrices? what relationship between condensed/redundant matrix , vector/square form in takes? the return of pdist papers return condensed distance matrix: returns condensed distance matrix y. each , j (where less j less n), metric dist(u=x[i], v=x[j]) computed , stored in entry ij. am right in thinking in each element y stores distance between particular point , other point? example 3 observations mean condensed matrix 9 elements? if have nxn matrix each pairwise combination set n exi

java - Read a csv file and separate lines into key and value to put in a hash table -

so little info program, implemented hash table separate chaining handle collisions. class tableinput{ object key; object value; tableinput(object key, object value){ this.key = key; this.value = value; } } abstract class hashtable { protected tableinput[] tableinput; protected int size; hashtable (int size) { this.size = size; tableinput = new tableinput[size]; (int = 0; <= size - 1; i++){ tableinput[i] = null; } } abstract int hash(object key); public abstract void insert(object key, object value); public abstract object retrieve(object key); } class chainedtableinput extends tableinput { chainedtableinput(object key, object value){ super(key, value); this.next = null; } chainedtableinput next; } class chainedhashtable extends hashtable { chainedhashtable(int size) { super(size); // todo auto-generated constructor stub

Arduino PINs not behaving equally -

i have burned code on arduino: #include <spi.h> #include <ethernet.h> #include <stdlib.h> using namespace std; #define buffsize 16 #define pin0 0 #define pin1 1 #define pin2 2 #define pin3 3 #define pin4 4 #define pin5 5 #define pin6 6 #define pin7 7 #define pin8 8 #define pin9 9 #define pin10 10 #define pin11 11 #define pin12 12 #define pin13 13 // mac address please view ethernet shield. byte mac[] = {0x90, 0xa2, 0xda, 0x0d, 0x85, 0xd5}; ipaddress server(192, 168, 0, 61); // ip address of raas server // set static ip address use if dhcp fails assign ipaddress ip(192, 168, 0, 62); // initialize ethernet client library // ip address , port of server // want connect (port 8 selected raas): ethernetclient client; string getnextcommand() { int count,i; int temp; string command; seri

ios - Why is the method being run at the end? -

i trying recover animal objects based on parameters. first need retrieve location parse name, since importing more 1 , using geocoder, using strings, , not array. instead of appending imported information array, mutating variable. though happen query go through first object run retrievelocation method, proceed next object imported parse, instead imports runs method, in end 1 object instead of how many supposed imported. let query = pfquery(classname: "animals") query.findobjectsinbackgroundwithblock { (objects: [pfobject]?, error: nserror?) in if(error == nil){ object in objects!{ if let addressobj = object["add"] as? nsdictionary{ if let address = addressobj["address"] as? string{ self.addr = address print("sdfadsf \(self.addr)") } }

java - OutOfMemoryError due to a huge number of ActiveMQ XATransactionId objects -

we have weblogic server running several apps. of apps use activemq instance configured use weblogic xa transaction manager. now after 3 minutes after startup, jvm triggers outofmemoryerror. heap dump shows 85% of memory occupied linkedlist contains org.apache.activemq.command.xatransactionid instances. list root object , not sure needs it. what cause this? we had same issue on weblogic 12c , activemq-ra. xatransactionid object instances created continuously causing server overload. after more 2 weeks of debugging, found problem caused weblogic transaction manager trying recover pending activemq transactions calling method recover() returns ids of transaction seems not completed , have recovered. call method weblogic returned not null number n (always same) , causes creation of n instance of xatransactionid object. after investigations, found weblogic stores default transaction logs tlog in filesystem , can changed persisted in db. thought there problem in tlogs bei

image - how to use texture masks in game Maker? -

Image
first off i'm not totally sure if "texture masks" correct term use here if knows please let me know. so real question. want have object in gamemaker: studio moves around it's texture changes depending on position pulling larger static image behind it. i've made quick gif of might like. it can found here another image might explain "source-in" section of image. this reply same question posted on steam gml forum mrdave: the feature looking draw_set_blend_mode(bm_subtract) basically have draw onto surface , using code above switch draw mode bm_subtract. rather drawing images screen remove them. draw blocks on background , remove area. can draw put on surface onto screen. (remember reset draw mode , surface target after. ) its hard head around first time, isn’t complex once used it.

html - Customer Loading Animation Keyframe/Background Position -

i'm trying create custom loading spinner using keyframes , spritesheet. jsfiddle: http://jsfiddle.net/flignats/aaaaaf6h/ my issue spinner appears sliding (background position) , i'd stationary while spinning. my css: .hi { width: 68px; height: 68px; background-image: url("data:image/png;base64, ... ); -webkit-animation: play 1s steps(23) infinite; -moz-animation: play 1s steps(23) infinite; -ms-animation: play 1s steps(23) infinite; -o-animation: play 1s steps(23) infinite; animation: play 1s steps(23) infinite; } @-webkit-keyframes play { { background-position: 0px; } { background-position: -1496px; } } @-moz-keyframes play { { background-position: 0px; } { background-position: -1496px; } } @-ms-keyframes play { { background-position: 0px; } { background-position: -1496px; } } @-o-keyframes play { { background-position: 0px; } { background-position: -1496px; }

c# - Multiple ClassCleanup Attributes per Test Class -

situation : of integration test classes share common approach setup scenarios in database hence provide abstract base class. takes care of full data cleanup @ end after tests ran: public abstract class integrationtests { ... protected static void cleanup() { ... } } my inherited classes required call base method ensure base cleanup code runs: [testclass] public class foointegrationtests : integrationtests { ... [classcleanup] public static void foocleanup() { ... cleanup(); } } issue : according msdn "[o]nly 1 method in class may decorated [the classcleanup] attribute" cannot decorate cleanup method base class , if did method wouldn't get called. question : want solution which always runs cleanup method base class without implementing in inherited classes, and always runs custom cleanup method inheriting test class if there any. i dislike force inheriting test class explicitly call base class have rememb

html - How to get background-size:cover zoomed on hover -

these codes have: .thumbha { width: 350px; height: 350px; background-position: top center; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; margin-bottom: 20px; margin-right: 20px; float:left; position: relative; z-index:1; } .ombra { background-image:url(http://www.lovatotribe.com/test/wp-content/themes/ggi1/media/img/ombra.png); width: 100%; height:100%; position:absolute; top:0; z-index: -1 } <div class="thumbha" style="background-image:url(http://www.lovatotribe.com/wp-content/uploads/2015/08/confident-shoot.jpg)"> <div class="ombra"></div> </div> so background image of .thumbha zoom when hover on it. how do that? me? you must add css element this: .thumbha:hover { background-size:150%; } changing value of 150% whatever suits you.

java - Deltaspike + Quartz + CronExpressions from custom property file -

i've achieved configuring cronexpression propery file, property file apache-deltaspike.properties, inside .jar file. need take cron expression custom config file: import org.apache.deltaspike.core.api.config.propertyfileconfig; public class myownpropertyfileconfig implements propertyfileconfig { private static final long serialversionuid = 1l; @override public string getpropertyfilename() { return "cfg/myownpropfile.properties"; } @override public boolean isoptional() { return false; } } myownpropfile.properties deltaspike_ordinal=500 property1=value1 property2=value2 quartzjob=0 25 17 * * ? the job: @scheduled(cronexpression = "{quartzjob}") public class myquartzjob implements job { //job code } everything goes when set property: quartzjob=0 25 17 * * ? inside apache-deltaspike.properties, when set in own property file, get: java.lang.illegalstateexception: no config-value found config-key: quartzjob researchin

python - What is difference between str.format_map(mapping) and str.format -

i don't understand str.format_map(mapping) method. know similar str.format(*args, **kwargs) method , can pass dictionary argument (please see example). example: print ("test: argument1={arg1} , argument2={arg2}".format_map({'arg1':"hello",'arg2':123})) can explain me difference between str.format_map(mapping) , str.format(*args, **kwargs) methods , why need str.format_map(mapping) method? str.format(**kwargs) makes new dictionary in process of calling. str.format_map(kwargs) not. in addition being faster, str.format_map() allows use dict subclass (or other object implements mapping) special behavior, such gracefully handling missing keys. special behavior lost otherwise when items copied new dictionary. see: https://docs.python.org/3/library/stdtypes.html#str.format_map

c++ - Is there a better way to do a find with optional insert using unordered_map of objects with no default constructor? -

i have following code: class cevent { public: cevent(std::string const&) {} }; std::unordered_map<std::string, cevent> m_messagelist; cevent& getmessageevent(std::string const& name) { auto = m_messagelist.find(name); if (it == m_messagelist.end()) { auto pair = m_messagelist.emplace(std::piecewise_construct, std::forward_as_tuple(name), // copy-construct 'name' key std::forward_as_tuple(name)); // construct cevent in-place name return pair.first->second; } return it->second; } ( live sample ) i think code pretty clean, don't have find separate emplace . there way better? or "good enough"? know call emplace instead of find first, accomplish both tasks, means creating cevent every time, if no real insert happens. once c++17 released (or if compiler supports prerelease versions), return m_messagelist.try_emplace(name, name).first; should trick.

c++ - Is this a way to defeat elision to keep dtor side effects? -

i make sure destructor side effects retained in function candidate rvo. goal snapshot stack @ entry , exit , have expected stack variables present. code seems work c++11 without using compiler specific options don't know way in earlier versions without adding spurious instances of test create multiple return paths. there technique , work c++11? class test { public: int m_i; test() { m_i = 0; cout << "def_ctor" << endl; } test(const test& arg) { this->m_i = arg.m_i; cout << "copy_ctor" << endl;} ~test() { cout << "dtor needed side effects" << endl; } }; test foo() { test ret; return std::move(ret); } int main() { test x=foo(); } std::move isn't magic, it's function returns reference argument, should able same in version of c++ template<typename t> const t& defeat_rvo(const t& t) { return t; } test foo() { test ret; return defea

JavaScript - Why isn't this working? I can't see the difference -

i'm starting out here i've got these 2 sections of js code. first block example book copied , pasted, second block 1 typed out , (in eyes) identical first block. when run code, second block (the 1 typed) doesn't work. i've looked @ each character , can't find out why. <!doctype html> <html lang="en"> <head> <title>chapter 2, question 2</title> </head> <body> <script> var firstnumber = parsefloat(prompt("enter first number","")); var secondnumber = parsefloat(prompt("enter second number","")); var thetotal = firstnumber + secondnumber; document.write(first number + " added " + secondnumber + " equals " + thetotal); </script> </body> </html> there space in first number. this: document.write(first number + " added " + s

Timing issue while writing from a serial port -

Image
this question going bit vague , apologize that. i have system connected serial port , python script communicates it. script runs system, reads data outputs, writes file data, stops system , repeats previous series of functions defined number of iterations. apart writing data system file, scripts logs system time. ideally, every "run" of system should generate evenly spaced out (in time) data. looked @ time stamps , plotted difference between each of data points , got (y-axis time in mm:ss) want somehow profile section of code each iteration figure out why blips exist. possible background process causing these anomalies? if so, how hone in what's going on @ points? i'll try give tips on how home in on it. don't know if @ least work with. first try sort out if it's python script or connected system hicks occationally. portmon sysinternals of here. if on windows is. can see sent , received on serial port. either have request response type protoco

python - Filtering out keys the are not shared between two nested dictionaries -

i'm newbie python, please bear me learn. i have 2 defaultdicts, 1 nested values: d1 = defaultdict(dd_list) d1 = {'a': {'b1': 12, 'c21': 41}, 'ff': {'h1': 2, 'b1': 32}} d2 = defaultdict(dd_list) d2 = {'a': 22, 'b1': 77, 'g8': 10, 'h1': 37} i filter d1 return key-value pairs keys present in d2: {'a': {'b1': 12}, 'ff': {'b1': 32, 'h1': 2}} i tried using approach described here unable adapt situation. thank in advance! you can solve nested dictionary comprehension : >>> d1 = {'a': {'b1': 12, 'c21': 41}, 'ff': {'h1': 2, 'b1': 32}} >>> d2 = {'a': 22, 'b1': 77, 'g8': 10, 'h1': 37} >>> >>> print({key: {inner_key: inner_value inner_key, inner_value in value.items() if inner_key in d2} ... key, value in d1.items()}) {'

java - Check if two ArrayLists accept the same class (same generic) -

if have 2 empty arraylists, how can check if accept same class of object. the function like, public boolean havesametype(arraylist array1, arraylist array2){ ... }' in general case, want able compare generics of 2 objects in class. edit: in specific case have abstract class public abstract class dog<e extends cat> { ... } and trying compare 2 objects know of class dog (or subclass obviously). cannot dog adog //gives warning because dog should parameterized so correct way create variable?

php - UTF-8 all the way through -

i'm setting new server, , want support utf-8 in web application. have tried in past on existing servers , seem end having fall iso-8859-1. where need set encoding/charsets? i'm aware need configure apache, mysql , php - there standard checklist can follow, or perhaps troubleshoot mismatches occur? this new linux server, running mysql 5, php 5 , apache 2. data storage : specify utf8mb4 character set on tables , text columns in database. makes mysql physically store , retrieve values encoded natively in utf-8. note mysql implicitly use utf8mb4 encoding if utf8mb4_* collation specified (without explicit character set). in older versions of mysql (< 5.5.3), you'll unfortunately forced use utf8 , supports subset of unicode characters. wish kidding. data access : in application code (e.g. php), in whatever db access method use, you'll need set connection charset utf8mb4 . way, mysql no conversion native utf-8 when hands data off applicati

Column size of Google Big Query -

i populating data server google big query. 1 of attributes in table string has close 150+ characters in it. for example, "had reseller test devices in vehicle known working device set power cycle, never got green light checked cell provider , sims active cases modem appears dead,light in not green light". table in gbq gets populated until hits specific attribute. when attribute load, not loaded in single cell. gets splitted different cells , corroupts table. is there restriction on each field of gbq? information regarding appreciated. my guess quote , comma characters in csv data confusing csv parser. example, if 1 of fields hello, world , 2 separate fields. way around quote field, you'd need "hello, world" . this, of course, has problems if have embedded quotes in field. instance if wanted have field said she said, "hello, world" , either need escape quotes doubling internal quotes, in "she said, ""hello, world"

java - How to store object -

how can store bluetooth socket obtained in 1 activity? can use in activity manage connection. or there other way transfer bluetooth socket 1 activity another? since cant transfer complex objects via bundle , try , use different class store information (the socket in instance).

git - How to squash commits using eclipse? -

i use command prompt squash multiple commits, , wondering how can using eclipse! i have looked answer , , have not found useful yet. you cant today. there open ticket that: https://bugs.eclipse.org/bugs/show_bug.cgi?id=316521 bug 316521 - need ability "squash" commits workaround: open history tab select commits want squash. then right-click selected commits , context menu select modify | squash .

How to capitalize the first letter of each word in an array in JavaScript? -

this question has answer here: trying capitalize first character in array of strings, why not working? 6 answers i've been trying last hours understand why code not working well. instead of capitalizing first letters of each item in array code capitalizes letters in array. function titlecase(str) { str = str.tolowercase().split(' '); (var = 0; < str.length; i++){ str[i] = str[i].split(' '); str[i][0] = str[i][0].touppercase(); str[i] = str[i].join(' '); } return str.join(' '); } titlecase("i'm little tea pot"); if want more functional way: const titlecase = str => ( str.split(' ').map(c => c.slice(0, 1).touppercase() + c.slice(1)).join(' ') ); titlecase("i'm little tea pot");

sockets - Linux protocol handler to get packets and processes associated to them -

hi linux networking experts, trying tool monitor sockets created each process, , bandwidth used each process. poll information /proc, miss short-lived sockets created , destroyed between poll cycles. the idea create kernel module registers protocol handler networking subsystem, handler function called each packet received. in handler wanted socket associated sk_buff, , process opened socket. processes waiting socket, go through wait queue socket , check tasks in list. wrote this: #include <linux/module.h> #include <linux/init.h> #include <linux/kernel.h> #include <linux/string.h> #include <linux/fs.h> #include <linux/types.h> #include <linux/kdev_t.h> #include <linux/netdevice.h> #include <linux/skbuff.h> #include <linux/slab.h> #include <net/datalink.h> #include <net/inet_hashtables.h> #include <net/tcp.h> #include <net/inet_common.h> #include <linux/list.h> #include <linux/ip.h>

php - How can i escape from endless loop? -

i'm trying create suffixer(name make). url exploder below.. private function explode_url() { if (!empty($this->suffix) , empty($is)) { // here ------v $url = explode('/', rtrim($_get['url'], $this->define_suffix())); } else { $url = explode('/', trim($_get['url'], '/')); } $str = ''; foreach ($url $key => $value) { if ($key >= 2) { $str = $str . '/' . $value; } else { $data[] = $value; } } $data[] = trim($str, '/'); foreach ($data $data) { if (!empty($data)) { $result[] = $data; } } return $result; } and here function defines suffix. private function define_suffix() { $count = count($this->explode_url()); // <------ here $count = $count - 1; $keys = array('cnt', 'mtd', '

Wordpress Amazon EC2 Database Error -

so, have bitnami wordpress set through m1.small ec2 instance. every hour, site has problem connecting database. way can work rebooting instance. has encountered problem before or possibly have ideas fix? many thanks! (also, if need me provide info i'd glad so) yes, we've had problem before bitnami ami / mysql week. it's because mysql server daemon dies on ec2 instance. to solve, set mysql database on rds , connected wordpress instead. database perform better on rds , won't have worry daemon dying. if rds not option you'll have dig mysql / wordpress logs find out what's going wrong mysql.

android - MediaPlayer: Error (1,-2147483648) in Cordova 6.1.1 with Phaser 2.4.6 -

i trying play audio files on android game built cordova 6.1.1 , phaser.io 2.4.6. media not play on android versions less api 21 or so, , gives error 04-21 21:48:57.546 9659-9671/com.jtronlabs.birdu e/mediaplayer: error (1, -2147483648) 04-21 21:48:57.546 9659-9672/com.jtronlabs.birdu e/mediaplayer: error (1,-2147483648) i have read answers, , nothing has helped. load in audio using phaser's loader class: this.load.audio('background-music', this.arrayofcompatiblemusicfilenames('the_plucked_bird') ); ... //phaser has support load in multiple types of audio formats if first supplied in array not compatible browser. arrayofcompatiblemusicfilenames: function(key){ //old versions of android don't play music, require absolute pathname (instead of relative). generic solution //https://stackoverflow.com/questions/4438822/playing-local-sound-in-phonegap?lq=1 var path = window.location.pathname; path = path.substr( 0, path.lastindexof("/")+

php - Pros and Cons of using API instead of direct DB Access -

i found myself in several discussions throughout week regarding web application under development , whether should leverage api being created. here's situation. have php mvc web application mysql db several mobile apps being developed in house. mobile apps we're building rest api. big question why should php web application use rest api? i've expected use of api third party systems need interface database or systems built on different technology. web app not third party system , services in php. if api on different server web app guess considered third party system... has not been decided yet. to me, seems strange leverage api web app since apis services going limited 50% of functions available in web app leaving me build other 50% unique web app. foresee performance hit web app stepping through service layer rather accessing db directly. on other side see more maintenance having code base web app hitting db , similar functions built api mobile apps. has found in

shiny - R markdown with RGL gives "You must enable Javascript to view this page properly" error -

i have downloadhandler() in shiny generates html document using r markdown. document generates rgl plots, added document using hook_webgl. application running on shiny server. works fine first time download button used, on following occasions error "you must enable javascript view page properly". using rglwidgets, same issues using shinyrgl. > sessioninfo() r version 3.2.4 revised (2016-03-16 r70336) platform: x86_64-pc-linux-gnu (64-bit) running under: ubuntu 14.04.4 lts locale: [1] lc_ctype=en_us.utf-8 lc_numeric=c [3] lc_time=en_us.utf-8 lc_collate=en_us.utf-8 [5] lc_monetary=en_us.utf-8 lc_messages=en_us.utf-8 [7] lc_paper=en_us.utf-8 lc_name=c [9] lc_address=c lc_telephone=c [11] lc_measurement=en_us.utf-8 lc_identification=c attached base packages: [1] stats graphics grdevices utils datasets methods base other attached packages: [1] shiny_0.13.2 rmarkdown_0.9.5 knitr_1.12.3 rglwidget_0.1.143

java - RabbitMQ 3.6.1 / Erlang 18.3 TLS insufficient security failures -

i running rabbitmq 3.6.1/erlang 18.3, , find unable establish tlsv1 or tlsv1.1 session broker using spring amqp 1.5.4.release java client. am, however, able establish tlsv1.2 session broker. rabbitmq broker configured support 3 of tlsv1, tlsv1.1, , tlsv1.2. using java 1.8.0_77-b03 on os x. here rabbitmq configuration: https://gist.github.com/ae6rt/de06d1efecf62fbe8cef31774d9be3d7 erlang on broker reports ssl versions # erl eshell v7.3 (abort ^g) 1> ssl:versions(). [{ssl_app,"7.3"}, {supported,['tlsv1.2','tlsv1.1',tlsv1]}, {available,['tlsv1.2','tlsv1.1',tlsv1,sslv3]}] this error rabbitmq logs upon failure: =error report==== 22-apr-2016::03:19:02 === ssl: hello: tls_handshake.erl:167:fatal error: insufficient security i used tcpdump sniff traff

python - how can I divide the frequency of bigram pair by unigram word? -

below code. from __future__ import division import nltk import re f = open('c:/python27/brown_a1_half.txt', 'ru') w = open('c:/python27/brown_a1_half_out.txt', 'w') #to read whole file using read() filecontents = f.read() nltk.tokenize import sent_tokenize sent_tokenize_list = sent_tokenize(filecontents) sentence in sent_tokenize_list: sentence = "start " + sentence + " end" tokens = sentence.split() bigrams = (tuple(nltk.bigrams(tokens))) bigrams_frequency = nltk.freqdist(bigrams) k,v in bigrams_frequency.items(): print k, v then printing result "(bigrams), frequency ". here, want each bigram pair, divide bigram frequency first appearing unigram word frequency. (for example, if there bigram ('red', 'apple') , frequency "3", want divide frequency of 'red'). obtaining mle prob, "mle prob = counting of (w1, w2) / counting of (w1)" . me plz...

android - Designing REST API for duplicate calls -

when designing rest-ful api, need handle client connectivity status? for example: in android, user wants send billing details email. clicks "send" button, app goes call api endpoint. @ point before api returns response, app loses network connectivity. meanwhile, transaction on server-side (sending bill details user's email) done. user doesn't know , clicks "send" button again. later when checks email, there 2 emails billing details. now understand transactions such shopping basket, client needs include transaction id in request body make idempotent. but, need use method other api calls?

AdWord Script Export to BigQuery "Empty Response" -

utilizing following adwords script export bigquery, bigquery.jobs.insert causing script terminate due "empty response". reason call not getting response? var accounts = ['xxx','xxx']; var config = { bigquery_project_id: 'xxx', bigquery_dataset_id: 'xxx', // truncate existing data, otherwise append. truncate_existing_dataset: true, truncate_existing_tables: true, // reports google drive. write_data_to_drive: false, // folder put intermediate files. drive_folder: 'adwords big query test', // default date range on statistics fields retrieved. default_date_range: '20140101,20140105', // lists of reports , fields retrieve adwords. reports: [{name: 'keywords_performance_report', conditions: 'where impressions>0', fields: {'accountdescriptivename' : 'string', 'date&

c++ - warning: address of local variable 'angles' returned [-Wreturn-local-addr] -

i'm trying return float x, y , z angle values body object ode (open dynamics engine) simulation. float* creature::eulerangles(const float &q0, const float &q1, const float &q2, const float &q3){ float angles[3] = {atan2(2 * (q0*q1 + q2*q3), 1 - 2 * (q1*q1 + q2*q2)), asin( 2 * (q0*q2 - q3*q1)), atan2(2 * (q0*q3 + q1*q2), 1 - 2 * (q2*q2 + q3*q3))}; return angles; } because dbodygetquaternion returns 4 const float quaternions need rotations , i've had immense difficulty trying compile. compile i'm getting warning. could explain me why , means please? float angles[3] = { ... }; defines local array. the statement return angles; returns pointer first element of array. however, array destructed function returns. hence, returned pointer dangling pointer. that's compiler warning about. if dereference returned pointer in calling function, invoke undefined behavior. in order retu