Posts

Showing posts from August, 2012

lxml - Python XML - appending multiple elements to multiple parents elegantly -

is there kind of more elegant way append elements parents parents need appended parents , on? for example: from lxml import etree root = etree.element('root') = etree.element('a') b = etree.element('b') c = etree.element('c') # append 1 one b.append(c) a.append(b) root.append(a) maybe possible append of @ once? or need manually append in example? you can define elements , "append" them in single go if you'd use subelement : root = etree.element('root') = etree.subelement(root, 'a') b = etree.subelement(a, 'b') c = etree.subelement(b, 'c')

swift2 - How do I save an entity into another entity core data swift -

so have users entity , hobby entity, have created relationship of to-many 1 user can have many hobbies. have created inverse relationship well. have generated subclasses entities not sure how save hobby entity user entity. here user subclasses: import foundation import coredata class users: nsmanagedobject { // insert code here add functionality managed object subclass } import foundation import coredata extension users { @nsmanaged var password: string? @nsmanaged var username: string? @nsmanaged var hobby: nsset? } here hobby subclasses: import foundation import coredata class hobby: nsmanagedobject { // insert code here add functionality managed object subclass } import foundation import coredata extension hobby { @nsmanaged var name: string? } i have figured out how add/update/delete items core data not sure how add whole entity another. great! if doing wrong or thinking wrong way please correct me also. first need create subclass

caching - Spring custom @Cacheable annotation using @AliasFor -

i'm trying write annotation annotated @cacheable . goal add few more attributes later access when manually initializing caches. @ first glance seem similar writing custom spring @cacheable annotation , i'm trying use @aliasfor instead of going down parser route. here's have far: @retention(retentionpolicy.runtime) @target({elementtype.method}) @inherited @cacheable public @interface cacheablelocal { @aliasfor(annotation = cacheable.class, attribute = "value") string[] value() default {}; @aliasfor(annotation = cacheable.class, attribute = "cachenames") string[] cachenames() default {}; @aliasfor(annotation = cacheable.class, attribute = "key") string key() default ""; @aliasfor(annotation = cacheable.class, attribute = "keygenerator") string keygenerator() default ""; @aliasfor(annotation = cacheable.class, attribute = "condition") string conditi

downloadTaskWithRequest confusing behaviour (swift , IOS ) -

i not understand following , hope :-) i downloading file url (10 minutes downloadtime), works fine, when download completes. but: when simulate crash or internet-interruption after minute , restart app again, behaves strange me. in case when restarting app download again same sessionid, seems 2 download tasks working in parallel. recognizue jumping progressbar 10% 0% , back. one, starts scratch , one, guess continious old transfer. (not sure). can restart again , there 1 more in queue. can confirm behaviour , know how can: - continue interrupted download task (preferred :-) ) - or how can start scratch only. here code downloading, works fine without interruption. func download_file(surl: string, stolocation: string) { println("start downloading ..."); println("surl : " + surl + " stolocation : " + stolocation); bytesdownloaded=0; var delegate = self; delegate.storepath=stolocation; delegate.progressview=progressvie

PJSIP via CLI on Raspberry -

i new raspberry , voip. interested make door intercom system using raspberry, read of post here , helpful,one of raspberry acting server (asterisk , pbx). able call using sflphonebut desktop mode , interested call using cli , installed "pjsip" reffered of users, don't have idea next (i mean how should start). written after installation supposed try "pjsua" , "pjsystest" in pjsip-apps/bin, doesn't ring bell me. sorry level beginner if don't begin how supposed masters it. i shall thankful. so can't explain of stuff need know, this site should able register pbx. it's documentation high level api of pjsua. if go further on site lead through things have establish call. although can frustrating because there many error can appear. there python test application under pjproject/pjsip-apps/src/python/samples , here should firstly try establish call between 2 clients sure server configured. just info, dest_uri have give in cal

javascript - Force no line-break on pseudo element (:after) -

http://codepen.io/ethanclevenger91/pen/vnjoyp edit: codepen showcases variety of proposed solutions if resize available space in pen, you'll see in top heading, reach point diamond (created via pseudo-element) line-break, last word not, pseudo-element on own line. i'd fashion solution using pure css behaves second heading, last word breaks if pseudo-element breaks. i've implemented via javascript, content of headings come database. html: <div class="container"> <h1 class="alpha">a heading takes entire width</h1> <h1 class="alpha solution1">a solution require javascript</h1> </div> scss: $brand-primary:lightblue; $brand-secondary:darken(lightblue, 40%); @mixin hidpi($ratio) { @media (-webkit-min-device-pixel-ratio: $ratio), (min-resolution: #{round($ratio*96)}dpi) { @content; } } body { position:relative; height:100vh; background:$brand-primary; width:100%; } .container {

java - How to stream music through multiple phones over bluetooth -

i'm trying connect android phones stream music. the set this, phone connected phone b. phone b connected phone c. a <--> b <--> c i want stream music a through b c , hear on c . i've looked a2dp ( here ) appears support 1 device @ time. is there way stream using a2dp b , send c ? i'm trying come solution doesn't involve saving file a onto b , streaming using a2dp. file big , delay before playing should short. are there ways stream file on , send stream b c using a2dp? are there other streaming options on bluetooth? or other streaming classes try , use once data in b ? thanks i found audiotrack class , think sort of solves problem. i can send music file byte[] using bluetoothsocket , bluetoothserversocket classes across many phones need to. once reach end phone create audiotrack object , write bytes , play music stream. the limitation file must .wav file , of specific bit resolution, sample rate , channel s

php - Duplicate Cart Totals on Woocommerce Checkout Page -

Image
trying figure out why cart totals, cart subtotals, shipping, , coupons getting displayed twice on checkout page: the problematic contents of review order page follows: <?php do_action( 'woocommerce_review_order_before_order_total' ); ?> <div> <?php _e( 'cart subtotal: ', 'woocommerce' ); ?> <?php wc_cart_totals_subtotal_html(); ?><br> <?php foreach ( wc()->cart->get_coupons() $code => $coupon ) : ?> <?php wc_cart_totals_coupon_label( $coupon ); ?> <?php wc_cart_totals_coupon_custom( $coupon ); ?><br> <?php endforeach; ?> <?php foreach ( wc()->cart->get_fees() $fee ) : ?> <?php echo esc_html( $fee->name ); ?>&nbsp; <?php wc_cart_totals_fee_html( $fee ); ?><br> <?php endforeach; ?> <?php _e('cart total: ', 'woocommerce'); ?> <?php wc_cart_totals_order_total_html(); ?> </div> <

encoding - HSM KW command to validate ARQC -

i trying send kw command thales hsm, description 1 of field data is: ---------------------------------------------------------------- | pan/pan sequence no | 8b | field fixed @ 8 bytes | ---------------------------------------------------------------- let data 6542000000193400 . does means have convert hex char? yes, mean need decode hexadecimals char before inserting command data. you've written data in hexadecimals. if data in hexadecimals inside application need hex decode bytes. bytes represented char or unsigned char in c/c++ language. note bytes represented (by e.g. debuggers) in hexadecimals. should careful not decode bytes not hexadecimals. check origin , size of hex before start.

Android 6.0 Marshmallow. Cannot write to SD Card -

i have app uses external storage store photographs. required, in manifest, following permissions requested <uses-permission android:name="android.permission.camera" /> <uses-permission android:name="android.permission.write_external_storage" /> and uses following retrieve required directory file sddir = environment .getexternalstoragepublicdirectory(environment.directory_pictures); simpledateformat dateformat = new simpledateformat("mm-dd", locale.us); string date = dateformat.format(new date()); storagedir = new file(sddir, getresources().getstring( r.string.storagedir) + "-" + date); // create directory, error handling if (!storagedir.exists() && !storagedir.mkdirs()) { ... fails here the app works fine on android 5.1 2.3; has been on google play on year. following upgrade of 1 of testing phones (android one) 6, it's returning error when trying create requisite directo

C++ access class private attribute friend funcion with (void * callerobj) parameter -

i have class called sender private attribute issending , friend function sending. inside friend function, want access issending attribute class sender{ private: issending=false; friend void* sending (void * callerobj); } void* sending (void * callerobj){ while(<issending true>){ } } i've tried callerobj->issending callerobj.issending but got compile error. how can access issending friend function (void * callerobj) parameter? since type of callerobj void* , cannot use access member data or member function. after all, original object int* . if sure original object sender* , can cast callerobj sender* , use access member data. sender* senderobj = reinterpret_cast<sender*>(callerobj); if ( senderobj != nullptr ) { while ( senderobj->issending ) { ... } }

PHP Facebook SDK: Facebook can not see the Redirect Uri Param -

i testing out latest facebook php sdk v5 , simple oauth login. following instructions in page here . following instruction manage generate link here: https://www.facebook.com/v2.4/dialog/oauth?client_id=1513255468944783&amp;state=d3325fbba047b203a69b34d6a251b93d&amp;response_type=code&amp;sdk=php-sdk-5.0.0&amp;redirect_uri%5bredirect_uri%5d=http%3a%2f%2fmarket.deremoe.local&amp;scope= here code: http://prntscr.com/8rgljl here page displays: http://prntscr.com/8rglw1 why can't see redirect_uri param in link? the signature of getloginurl in sdk v5 is: getloginurl($redirecturl, array $scope = [], $separator = '&') so should: $loginurl = $helper->getloginurl('http://market.deremoe.local');

mysql - [PHP-PDO What is making my query slowdown? -

we working on private forum solution , have table of "posts" has : 1 index (primary key) unique key ( i.e. slug / seo-url of respective post ) 2 foreign keys ( refering category(id) , user(id) category of post , op of post. now, id ( primary key), category (id) , user(id) int(11) unsigned , have used following , results in 0.2xx seconds (on php page): using php pdo using php-mysqli using php pdo persistent connection , buffered queries query: both give same performance (in range of 0.17-0.2xx seconds) select rows post,category,user post.userid=user.id , post.categoryid=category.id , post.id=1; -> gives result in 0.17 0.28 seconds on average select wors post inner join category on post.categoryid = category.id inner join user on post.userid = user.id -> tag bid faster earlier still on slower part. now when use mybb or phpbb , part of testing, things load all queries including selecting sessions, updating row , inserting within 0.2 seconds. so

sql server - Columns added to table do not synchronise -

i'm working microsoft sync framework. have client database , server database, , every once in while synchronize each other. no failures or anything. however when add new columns on server in tables, these don´t synchronized. if delete scope, gets recreated , new columns part of new scope, when start synchronization, says "invalid columnname 'xy'". i possibly go client , add columns there, not best way it. also, when add new tables on server, don't want go inside scope. far changing scope opportunity but, i'm missing on line in scope: <adapter name="[tblnewtable]" globalname="[tblnewtable]" trackingtable="[tblnewtable_tracking]" selchngproc="[tblnewtable_selectchanges_0e06c509-3402-4898-b8e6-cc8885fa8c35]" > i'm not quite sure random number comes from, since in every adapter name of scope. i couldn't find on microsoft library, maybe has answer 1 of these questions: is there simple way

assembly - Caller save registers in recursion -

in recursion, need save both caller save , callee save registers? following recursion save calle-save register ebx: int rfact(int x) { int result; if (x <= 1) result = 1; else result = n* rfact(x-1); return result; } assembly: rfact: pushl %ebp  .l3: movl %esp, %ebp pushl %ebx subl $4, %esp movl 8(%ebp), %ebx movl $1, %eax cmpl $1, %ebx jle .l3 leal -1(%ebx), %eax movl %eax, (%esp) call rfact imull %ebx, %eax addl $4, %esp popl %ebx popl %ebp ret is there example of recursion save caller-save register?

java - Apache camel netty custom encoder and decoder sample -

apache camel netty tcp component doc( http://camel.apache.org/netty.html ) says, encoder a custom channelhandler class can used perform special marshalling of outbound payloads. must override org.jboss.netty.channel.channeldownstreamhandler. decoder a custom channelhandler class can used perform special marshalling of inbound payloads. must override org.jboss.netty.channel.channelupstreamhandler. could please point me example on how/what in overriding class. want custom tcp encoder/decoder read/write bytes. this class , it's super class encoders , can use example: org.jboss.netty.handler.codec.string.stringencoder there other classes used in examples on netty page "using multiple codecs" heading can @ source code see how use interface. failing it's best @ netty project , @ unit tests encoders.

xaml - Disabling the button based on items selected in the ItemsList -

<button tooltip="duplicate" tooltipservice.showondisabled="true" command="{binding path=duplicateentitycommand }" commandparameter="{binding elementname=gridview, path=selecteditems}"> <image style="{staticresource toolbarimagestyle}" source="/oneplanner;component/resources/icons/duplicate.png"></image> <button.style> <style targettype="{x:type button}" basedon="{staticresource {x:type button}}"> <setter property="isenabled" value="false"/> <style.triggers> <multidatatrigger> <multidatatrigger.conditions> <condition binding="{binding elementname=radgridview, path=selecteditems.cou

objective c - iOS - UIButton requires two taps with UIControlEventTouchUpInside -

for reason uibutton requires 2 taps trigger , don't understand why, not desired functionality , of other buttons work expected here addtarget code: [self.mybutton addtarget:self action:@selector(publishbuttontapped) forcontrolevents:uicontroleventtouchupinside]; my function publishbuttontapped not triggered until second tap in quick succession. there must else overlooking, insight appreciated my button , layout created programmatically, there no xib or storyboard.

python - argsort for a multidimensional ndarray -

i'm trying indices sort multidimensional array last axis, e.g. >>> = np.array([[3,1,2],[8,9,2]]) and i'd indices i such that, >>> a[i] array([[1, 2, 3], [2, 8, 9]]) based on documentation of numpy.argsort thought should this, i'm getting error: >>> a[np.argsort(a)] indexerror: index 2 out of bounds axis 0 size 2 edit: need rearrange other arrays of same shape (e.g. array b such a.shape == b.shape ) in same way... that >>> b = np.array([[0,5,4],[3,9,1]]) >>> b[i] array([[5,4,0], [9,3,1]]) solution: >>> a[np.arange(np.shape(a)[0])[:,np.newaxis], np.argsort(a)] array([[1, 2, 3], [2, 8, 9]]) you got right, though wouldn't describe cheating indexing. maybe make clearer: in [544]: i=np.argsort(a,axis=1) in [545]: out[545]: array([[1, 2, 0], [2, 0, 1]]) i order want, each row. is: in [546]: a[0, i[0,:]] out[546]: array([1, 2, 3]) in [547]: a[1, i

c - Single line Initialization of Array of Structures -

Image
i trying declare , initialize array of structure in 1 line. looks not supported in arrays. in below code, mystructarray[3] gives error whereas mystructarray2[3] works ok. why initialization in 1 line not allowed (i know not practice do, still want know reason if any.) typedef struct mystruct { int structmemint; char structmemchar; }mystruct; int main (void) { struct mystruct mystructarray[3] = {2,'a',5,'b',7,'c'}; struct mystruct mystructarray2[3] = { {2,'a'}, {5,'b'}, {7,'c'}, }; } updated: the point here 1 line initialization without separate braces each array member vs braces. means why not work {2,'a',5,'b',7,'c'} , why must include braces {{2,'a'},{5,'b'},{7,'c'}} ? i comparing behavior multi dimensional array wherein need not separate each row data braces. doubt started because theory , problems of programming c b

soap - Wrapper for Bloomberg Data License Web Services -

i'm looking in bloomberg data license web services . note, different bloomberg api ( session/service/request, b-pipe, etc ). soap-based solution retrieve reference data bloomberg dbs. created test application evaluate solution: var client = new persecuritywsclient("persecuritywsport"); client.clientcredentials.clientcertificate.certificate = new x509certificate2("{path-to-certificate}", "{password}"); client.clientcredentials.username.username = ""; client.clientcredentials.username.password = ""; client.clientcredentials.windows.clientcredential.domain = ""; var companyfields = new string[] { "id_bb_company", "id_bb_ultimate_parent_co_name" , /* ... other fields i'm interested in */ }; var getcompanyrequest = new submitgetcompanyrequest { headers = new getcompanyheaders { creditrisk = true }, instruments = new instruments { instrument = new instrument[] {

openerp - How to take out 'contact' values from a 'Many2one' field in Odoo? -

any many2one field either linked hr.employee or res.users shows values home addresses or contacts in many2one drop down tool. has suggestion on how stop ? you can use domain filter avoid unwanted results. for eg:- in sale order see customers although related object res.patner, because of domain filter( please see code ) <field name="partner_id" on_change="onchange_partner_id(partner_id, context)" domain="[('customer','=',true)]" context="{'search_default_customer':1, 'show_address': 1}" options='{"always_reload": true}'/> here domain filter " domain="[('customer','=',true)]" " ie. records customer field true shown from comments:- if want see system users user res.users instead of res.partner . like:- 'user_id' : fields.many2one('res.users', 'user') hope helps.

javascript - Passing Parameter to Angular Factory from controller -

i couldn't pass parameter angular controller factory. can 1 me on this? works without passing parameter when pass it's not. var app = angular.module('employee', ['ui.grid', 'ui.grid.savestate', 'ui.grid.selection', 'ui.grid.cellnav', 'ui.grid.resizecolumns', 'ui.grid.movecolumns', 'ui.grid.pinning', 'ui.bootstrap', 'ui.grid.autoresize','ui.grid.pagination']); app.controller('empctrl', ['$scope', '$http', '$interval', '$modal', '$log', 'gridservice', function ($scope, $http, $interval, $modal, $log, gridservice) { $scope.loadnextpage = gridservice.loadnextpage("5"); }]); var gridservice = function ($http, $rootscope) { return { loadnextpage: function (hh) { alert(hh); }, gridoptions:gridoptions }; }; app.factory('gridservice', ['$http', '$rootscope'

jasperserver - Unable to create a calculated field or measure in Jaspersoft adhoc view -

according document http://community.jaspersoft.com/documentation/jasperreports-server-user-guide/v56/creating-calculated-field i should able create calculated field or measure jaspersoft adhoc view. don't seem have functionality available me since don't have icon required click on create these things. know if new feature or whether has restrictions on functionality due licencing or something? there way create calculated measure can use work around considering don't have correct icon enable feature ? what version of jasperreports server in? can chek in login page, on bottom left corner there jaspersoft link. there can check license type. feature available commercial edition. guess customer: have tried reaching out jaspersoft support? https://support.jaspersoft.com

python - How to apply image processing in shape file or raster -

i wish use matlab or python image processing arcgis files. goal process shape file or raster normal image. can anypart of , process image algorithm. add coordinates information show in arcgis. searched web , found there way it. can use tif image in matlab. big matlab process cut tif using small area in arcgis. please see code , link of it. there way , easily? suggestion helpful. thank you. clc;close all;clear; %below using matlab blockproc read large file,but failed read tiff % src_filename='f:/1.tif'; % fun = @(block_struct) block_struct.data; % b = blockproc(src_filename,[5 5],fun); % % %----------below how transform coordinates---------------------------------------------------------------- % code from:http://www.cnblogs.com/denny402/p/4684770.html [pic,r]=geotiffread('f:/lenoir/lidar2007/1.tif'); [m,n,~]=size(pic); figure(1),imshow(pic) hold on; scatter(n/4,m/4,500,'r.'); [lon,lat]=pix2map(r,m/4,n/4) figure(2),mapshow(pic,r)

ruby on rails - regular expression a string -

i need regular expression convert following object: "{:email=>[\"has been taken\"], :name=>[\"has been taken\"]}" to email has been taken, name has been taken ▶ str = "{:email=>[\"has been taken\"], :name=>[\"has been taken\"]}" ▶ eval(str).map { |k, v| [k.capitalize, v].join(' ') }.join(', ') #⇒ "email has been taken, name has been taken" with scan : ▶ str.scan(/:(\w+)=>\["(.*?)"\]/).map |k, v| ▷ [k.capitalize, v].join(' ') ▷ end.join(', ') #⇒ "email has been taken, name has been taken"

SNMP MIB ERROR scalar's parent node must be simple node Object Not Imported -

i have following file , x-mib.txt:26: scalar's parent node must simple node object not imported x-mib.txt:35: scalar's parent node must simple node object not imported x-mib.txt:45: scalar's parent node must simple node object not imported x-mib.txt:55: scalar's parent node must simple node object not imported here's mib file (after emitting company name , replacing names "x" , "y") x-mib definitions ::= begin imports module-identity, object-type, notification-type, integer32 snmpv2-smi displaystring rfc1213-mib object-group, notification-group snmpv2-conf y y-mib; x module-identity last-updated "201411060000z" organization "y corporation" contact-info "y corporation www.y.com" description "the structure of management information y x en

java - ByteBuddy and annotations -

i have bunch of webservices running on plain jdk , need intercept public methods in order something. methods using @webparam annotation. subclassing webservice bytebuddy drops @webparam annotation overriding method , service doesn't work anymore expected. here's sample signature public fetch( @webparam( name="query" ) querycriteria query ) and here's how i'm using bytebuddy new bytebuddy( ) .subclass( implementationclass ) .method( ispublic( ).and( isdeclaredby( implementationclass ) ) ) .intercept( methoddelegation.to( new webserviceinterceptor( ) ) .andthen( supermethodcall.instance ) ) .annotatetype( implementationclass.getannotations( ) ) .make( ) i know there's way annotate parameters, requires special knowledge method parameters (because params annotated). i'd ask bytebuddy annotate class same way superclass including parameters of overridden methods. subclass( implementationclass ) .an

json - SNS SQS fanout architecture -

looking @ the documentation pattern says the amazon sqs message contains subject , message published topic along metadata message in json document so when publish sns topic, properties forwarded subject of notification, , default parameter? mean if want send json queues have stringify , set default parameter of notification? if check out examples section of sns docs can see there options specify messages email, https, etc including sqs. if want send queue specific information on notification can put in there , overwrite default parameter. example in node sns.publish({ topicarn: topicarn, messagestructure: 'json', message: json.stringify({ default: json.stringify(defaultmessagejson), sqs: json.stringify(sqsmessagejson) }) })

eloquent - Laravel: How to get relational model from 2D array of IDs -

i have array of ids $bookingpaymentpending[attendee_id][program_id] = array(2) { [416]=> array(2) { [0]=> int(2) [1]=> int(4) } [417]=> array(2) { [0]=> int(2) [1]=> int(4) } } i want collection of relational models attendee , programs . want access $attendee->programs i this.... foreach ($bookingspaymentpending $attendee_id => $program_ids) { $attendees[$attendee_id] = attendee::find($attendee_id)->with(['scheduled_programs' => function($q) use ($program_ids) { $q->wherein('id', $program_ids); }]); } but $attendees isn't right because didn't know how put eloquent model. can show me how properly? there simple eloquent way this? or query builder way go? does give expected output? $attendees = attendee::with('scheduled_programs') ->wherein('id', array_keys($bookingpaymentpending)) ->get(); foreach($attendees $attendee){ var_dump($attendee->sche

html - Getting rid of href in modal implementation -

i using modal displaying information on site people do. modal using written in css(no jquery).when link clicked modal shows , url changes shown: reminder.local/main.php#patient0 so, after modal window closed url becomes: reminder.local/main.php# the problem is, when button pressed goes reminder.local/main.php#patient0 expected , modal window pops again, highly undesirable. any way around this..plzz let me know. example code modal: <a href="#text2" id="appoint">next</a> <div class="lightbox" id="text2"> <div class="box"> <a class="close" href="#">x</a> <p class="title">modal window text</p> <div class="content"> <form> <input type="text" >name <br> <input type="password">

ADB start intent sms android that lists all available SMS -

i tried find way start sms intent in android (samsung) adb : adb shell start -n com.android.mms/.ui.conversationcomposer i managed find package name "com.android.mms" , intent ".ui.conversationcomposer". however start directly new compose message intent, while tried start view smss (it shall lists sms in android phone). when trace down "adb dumpsys window windows", sms listing still uses above intent (ui.conversationcomposer). a workaround launching sms composer , running twice adb shell input keyevent keycode_back how can view without having launch composer view , pressing twice adb? i found work around solution link : adb shell monkey -p your.app.package.name -c android.intent.category.launcher 1

android - How to Get Child position for Linear layout -

i have linearlayout, contains several child imageview (added imageviews dynamically linearlayout horizontally). how can position of child views of linerlayout when doing long press child view(imageview)? added settag: image.setimagebitmap(resizedbitmap); image.settag(fullurl); imageviewlinearlayout.setonlongclicklistener(new view.onlongclicklistener(){ @override public boolean onlongclick(view v) { log.d("mobi","path :"+v.gettag()); return false; } }); added set tag file path return v.gettag() null"? add test.xml <?xml version="1.0" encoding="utf-8"?> <tablelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" > <button android:id="@+id/btnaddimage" style="?android:attr/buttonstylesmall" andr

docker - Error :Could not connect to Redis at redis:6379: Name or service not known -

i trying execute container named redis running right now.but error could not connect redis @ redis:6379: name or service not known . 1 please hell me figure out issue , fix it. naming container doesn't alter hosts file or dns, , depending on how ran container may not accessible via standard port docker port translation. run docker inspect redis , examine ports output, tell port accessible on ip. note, however, connectable on ip host. access off of host need use port above command , host's ip address. assumes local firewall rules allow it, beyond scope of site.

amazon web services - I need to plan for disaster recovery for my AWS Account? -

i thinking if aws account deleted/inaccessible 1 fine day? (may sound weird). have implemented solution this? can have 1 aws account aws account? there several things can do, 1 make sure have @ least 2 administrator accounts, 1 use, , 1 store away in safe place , use emergencies. the second setup seperate aws account 'backup', own set of credentials. can grant cross-account access primary account, backup account allow primary account 'put' or backup objects backup account, if primary account compromised, attacker can't harm second account primary account. the actual process backup services on 1 account going vary depending on services using, concept same - backup data s3 , copy data s3 in primary account s3 in backup account - , make sure primary account has enough access second account 'put' things, not delete. nobody in company should have access both of sets of credentials (assuming company not tiny). you don't want company put out

iphone - UDP Packets IOS 9 LTE Network GCDASYNCUDP -

i have basestation (beaglebone running linux) @ home connected multiple cameras. connect iphone ios9 basestation via tcp , basestation stream video of each camera specific udp port. well. i want able see cameras when not connected local network. when phone connected lte, have iphone connecting public address of router via tcp , port forwarding, data forwarded basestation. connecting , talking on local network tcp client. well. the problem when video streamed via udp on specific port, no different when on local network, basestation has no problem sending packets, iphone not receiving anything. using gcdasyncudpsocket , cellular carrier verizon. i wondering if issue due verizon blocking udp packets? or possibly there needs else done other binding iphone udp socket specific port , calling beginreceiving function. feel if works on local network, should work on cellular network. i have tried ping address of cellphone computer not work. guessing reason because iphone has

c++ - I'm having trouble with formula,program runs fine but the answer seems to be wrong -

the following program should calculate distance between 2 points: header.h class point{ private: double x, y, length; public: point(); point(double a, double b); int set_length(point,point); }; header.cpp #include<iostream> #include"header.h" #include<math.h> using namespace std; point::point() :x(0), y(0) { } point::point(double a, double b){ x = a; y = b; } int point::set_length(point p1, point p2){ length = sqrt(((p2.x - p1.x)*(p2.x - p1.x)) + ((p2.y - p1.y)*(p2.y -p1.y))); return length; } main.cpp #include<iostream> #include"header.h" using namespace std; int main(){ point p1(4, 1); point p2(8, 2); point length; cout << length.set_length(p1, p2) << endl; } the answer should 3 not. could me implement distance formula? you didn't provide actual output get, but, here possible causes of errors: you're on unix-like system

actionscript 3 - mcrypt_decrypt function stuck in eternal loop -

i'm working through decryption function , have hit wall. i'm not experienced actionscript when run function goes on infinite loop. private function mcrypt_decrypt(param1:array, param2:number,param3:number): array { var _loc4_:* = -9.57401312e8; while(_loc4_) { var param3:number = param3 - ((param2 << 4 ^ param2 >>> 5) + param2 ^ _loc4_ + param1[_loc4_ >>> 11 & 3]); _loc4_ = _loc4_ - -1640531527; var param2:number = param2 - ((param3 << 4 ^ param3 >>> 5) + param3 ^ _loc4_ + param1[_loc4_ & 3]); } return [param2,param3]; } from testing see loc4 starts -9.57401312e8 , iteration continues -1640531527 removed each time, in case satisfy while condition? ideas? your function stuck in eternal loop because of this: _loc4_ = _loc4_ - -1640531527; a double minus sign same plus sign. since value never zero, evaluation in loop returns true.

filehelpers - Create FileHelperEngine from Type variable -

i attempting create instance of filehelperengine<> using generic type. example works list public static ilist createlist(type type) { var genericlisttype = typeof(list<>).makegenerictype(type); return (ilist)activator.createinstance(genericlisttype); } is possible similar filehelperengine<>? i tried public static filehelperengine createfilehelperengine(type type) { var genericfilehelperenginetype = typeof (filehelperengine<>).makegenerictype(type); return (filehelperengine)activator.createinstance(genericfilehelperenginetype); } and error unable cast object of type 'filehelpers.filehelperengine`1[nachaparser.model.entrydetail.ppdentrymodel]' type 'filehelpers.filehelperengine'. this not work because attempting go generic engine standard engine. generic engine not inherit standard engine can't directly cast. the following code should work you: public sta

css - Jagged edged border issue in Firefox -

i've created simple css play button using borders, can see here, using css .btn-play { border-left:50px solid black; border-top:40px solid transparent; border-bottom:40px solid transparent; } see also: http://jsfiddle.net/o0exn7ll/ this looks fine in chrome , ie, in firefox edges jagged. i've seen other issues containing jagged edges in firefox using 3d transforms, solved adding transparent outline, that's not solution case. does know if there's way these edges more smooth in firefox? thanks! you can use border-style: inset; css .btn-play { border-left:50px inset black; border-top:40px inset rgba(255, 255, 255, 0); border-bottom:40px inset rgba(255, 255, 255, 0); } demo here

sql - Oracle Database Can set Constraint for Upper Case Values? -

is there anyway can set constraint in database table level have upper or lower case values columns? when create table, can set not null avoid having null values on column. same way, can either uppercase or lower case? you can using check constraint: create table foo ( only_lower varchar(20) not null check (lower(only_lower) = only_lower), only_upper varchar(20) not null check (upper(only_upper) = only_upper) );

javascript - How to you change the text color of the current date using the getDate method? -

the output doesn't change color of current date. when add in sample alert statement within case statement, alert works. when remove , add in style.color = "red", current date doesn't turn red. why that? <head> <script> switch (new date().getday()) { case 0: document.getelementbyid("sun").style.color = "red"; break; case 1: document.getelementbyid("mon").style.color = "red"; break; case 2: document.getelementbyid("tues").style.color = "red"; break; case 3: document.getelementbyid("wed").style.color = "red"; break; case 4: document.getelementbyid("thur").style.color = "red"; break; case 5: document.getelementbyid("fri").style.color = "red"; break; case 6: document.getelementbyid("sat").sty

React-Router 1.0 - 100% Client Side Routing - Page Refresh causes 404 error -

i creating website client use strictly client side react-routing script. here sample of router .... import react 'react'; import { route } 'react-router'; import { generateroute } '../utils/localized-routes'; export default ( <route component={ require('../components/app') }> { generateroute({ paths: ['/', 'audience'], component: require('../components/audience') }) } { generateroute({ paths: ['speaker'], component: require('../components/speaker') }) } { generateroute({ paths: ['board'], component: require('../components/board') }) }, { generateroute({ paths: ['questions'], component: require('../components/parts/askquestion') }) } <route path="*" component={ require('../pages/notfound') } /> </route> ); with being code generateroute: export functi

sql server - Questions about Active Geo-Replication (and how it interacts with local, within-datacenter, redundancy) -

i read this active geo-replication azure sql database article on active geo-replication , have questions. posted these questions on page article haven't gotten reply yet. could use help! “every forced termination results in irreversible loss of replication relationship between primary database , associated online secondary database.” irreversible mean here? mean in order re-establish replication relationship between primary database , associated online secondary database after forced termination, we’d need start on seeding online secondary database? “local data redundancy , operational recovery standard features azure sql database. each database possesses 1 primary , 2 local replica databases reside in same datacenter, providing high availability within datacenter. means active geo-replication databases have redundant replicas. both primary , online secondary databases have 2 secondary replicas.” so, if imagine have active geo-replication , running , primary database

cocoa - OSX App - Associated file types and icons not updating (Launch Services) -

i have mac app open ".png" file types. able application make default app opens ".png" files , double clicking files launch app. however, can't seem update icon on .png files - shows default icon thumbnail of image. i have file called icon.icns in project, , following block in info.plist file: <key>cfbundledocumenttypes</key> <array> <dict> <key>cfbundletypeextensions</key> <array> <string>png</string> </array> <key>cfbundletypeiconfile</key> <string>icon</string> <key>cfbundletypename</key> <string>png</string> <key>cfbundletyperole</key> <string>viewer</string> </dict> </array> what's weird if restart computer, icons update, after second or change system default. thanks!

django - How to add animated figure to sphinx? -

i using sphinx documenting django project. , add documentation includes animated figures. there way ? by storing image in docs folder somewhere , declaring image using restructuredtext : .. image:: ../images/your_image.gif

perl - How can I move perlTk Widget on MacOS? -

if write on mac perltk "hello world" programm: use tk; # main window $mw = new mainwindow; $label = $mw -> label(-text=>"hello world") -> pack(); $button = $mw -> button(-text => "quit", -command => sub { exit }) -> pack(); mainloop; it works. can't move perltk widget on desktop. fixed on x11 programm. how can fix on macos? configuration x11? bad perltk version? on tkx works fine: use tkx; tkx::grid( tkx::ttk__button(".b", -text => "hello, world" ) ); tkx::mainloop();

sorting - Sort By Boolean value in Spring Data -

i'm using spring data , have repo method returning products. need sort result list availability, available products should displayed first. product has boolean field 'available'. in order achieve sorting availability i'm trying define repository method like list<product> findallorderbyavailable(); but doesn't work. idea if achievable spring data? following spring data documentation , have insert by after findall indicate thats criteria starts, , you're missing order asc or desc , should this: list<product> findallbyorderbyavailableasc(); //or desc

python - Writing Data to a .txt File -

i trying write data text file in python , trying user choose name of file string. when comes writing data, shows error. import random name = input("please enter name: ") clas = input("please enter class in: ") #uses list show 3 operators want use ops = ['+', '-', '*'] #defines 2 variables 1 , 0 x = 1 score = 0 #while variable x less or equal 10, loop continue while x <= 10: #selects 2 random integers 1 10 num1 = random.randint(1,10) num2 = random.randint(1,10) #choses operation list `ops` operation = random.choice(ops) #prints 2 numbers , operation in arithmetic question layout print(num1,operation,num2) maths = int(eval(str(num1) + operation + str(num2))) #gets user input there answer question answer = int(input("what answer arithmetic question? ")) #if answer user input equal correct answer user scores point , told correct #otherwise, answer must wrong user told score incorrect

javascript - CSS class toggle with jquery on different id's -

i'm trying write jquery code toggling 2 different class on different ids. since cms strips out inline css, need find solution "display:none" have written 2 css classes, in hopes of toggling between them, not sure if direction go . i'm new stack , jquery info or corrections welcomed here code: css .displaynone{ display:none; } .displayblock{ display:block; } html & javascript <form> <input onclick="javascript:resetform();document.forms[0].reset();" type="reset" value="reset" />&#160; <br /> <br /> <h4>are number 1?</h4> <label> <input name="one" onclick="unhide('hidden-input', this, 'hidden-input2')" type="radio" value="1" /> yes <br /> </label> <label> <input name="one" onclick="unhide('hidden-input2', this, '

Json is only used in android programming to read data from the database right? -

i'm confused when json needed used in android programming. have read couple of tutorials i'm still blur why need json , when use it. json format store data, xml, can use store whatever want or don't use @ all. in terms of database access thing natively android can access local sqlite databases, not suitable projects require centralized database change dynamically (and accessed many devices concurrently), in cases popular solution setup json-rpc server act intermediary between android app , database. from app remotely call method on server execute query , return appropriate results.

Is keeping data ON eats data memory in android? -

in android mobiles or general laptops,keeping data on eats internet data memory little bit?for example ,if kept internet data on in android 1 day mean,does eats 1mb of data without using internet whole day? if not,how can mobile phone detects gets 3g internet or 4g internet or 2g internet? you asked 2 questions: do keeping network data connmgr.getnetworkinfo(connectivitymanager.type_mobile); on consumes bandwitch , charged it? yes. system use connection action requires network. programs try check wi-fi only... if connection made available, can used (and cost money, in internet permission granted app) how can mobile phone detects gets 3g internet or 4g internet or 2g internet? android has system allow programmers check kind of connection available @ moment, , ask user enable moment, or request switch on.

android - Getting gps not working -

can explain me why code not working? tried gps easy posible. debugger didn t find error when run it, doesn t work. can gps enabled , gps disabled msges never gps latitude , longtitude.. here s code: public class getgps extends appcompatactivity { double longtitude; double latitude; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_getgps); locationmanager mlocmanager = (locationmanager)getsystemservice(context.location_service); locationlistener mloclistener = new mylocationlistener(); mlocmanager.requestlocationupdates(locationmanager.gps_provider, 5000, 10, mloclistener); } public class mylocationlistener implements locationlistener { @override public void onlocationchanged(location loc) { latitude = loc.getlatitude(); longtitude = loc.getlongitude(); string text = "my current location is: " + "latitud