Posts

Showing posts from June, 2015

Camel JMS Component with Spring on Weblogic Server -

i not found decent, clear example learn jms component spring configuration. wrote this: <bean id="weblogic" class="org.apache.camel.component.jms.jmscomponent"> <property name="connectionfactory" ref="jmsconnectionfactory"/> </bean> <bean id="jmsjnditemplate" class="org.springframework.jndi.jnditemplate"> <property name="environment"> <props> <prop key="java.naming.factory.initial">weblogic.jndi.wlinitialcontextfactory</prop> <prop key="java.naming.provider.url">t3://${ip}:${port}</prop> </props> </property> </bean> <bean id="jmsconnectionfactory" class="org.springframework.jndi.jndiobjectfactorybean"> <property name="jnditemplate" ref="jmsjnditemplate"/> <property name="jndiname" value=&quo

ruby - Sass: accessing the interpolated @debug and @warn messages from SassEngine#to_tree -

we use sass , scss @ codepen , i'm trying make super-fancy responding @warn , @debug directives in formatted array. don't want parse stdout, i'm trying capture results of debug , warn nodes via sass::engine#to_tree, method. buuuut, we're running trouble. i'm sure i've not read lib long enough, jumpstarting help. here's minimum test-case: https://gist.github.com/tsabat/a91e8ebf9b8ec65f5c77 # ok, class bit sparse, encapsulates # logic empty lib, goal of conversion class cssservice attr_reader :engine, :debugs, :warns, :extras # markup - sass/csss # syntax - 1 of [:sass, :scss] # lib - 1 of %w(bourbon compass) def process(markup:, syntax:, lib: nil) @markup = markup @syntax = syntax @lib = lib @debugs = [] @warns = [] # create sass::engine here, defaults @engine = sassengine.new.get(syntax: syntax, markup: markup_with_imports) output = rendered write_non_render_nodes output end priv

c++ - would `ui.listView->setModel(new QStringListModel(list));` result in a memory leak -

hi in process of learning qt. using following code qstringlist list; list << "item1" << "item2" << "item3" << "item4" << "item5"; ui.listview->setmodel(new qstringlistmodel(list)); now understanding ui.listview->setmodel being passed reference object on heap. wouldn't object need deleted ? suggestions should using boost safe pointer here ? since every time update content of list have call last statement update display. it hard tell little code available, yes creating object on heap address might lose , risk potential memory leak. should define either global pointer object , delete when need new one. better create small class containing reference current qstringlistmodel , define methods create new one, while deleting old one. class listmodelholder { private: qstringlistmodel* model; public: listmodelholder() { model = 0; } ~listmodelholder() { if(model != 0

jquery - how to load Js only one index.php in wordpress -

i want load 2 js file home (index.php) file in wordpress. can't <?php if (is_page('home') ) { ?> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script src="<?php bloginfo('template_directory'); ?>/js/jcarousellite_1.0.1.js" type="text/javascript"></script> <?php } ?> i tried not work. without home if put other page name work fine.. home page (index.php). there anyway load 1 index.php or home page. think need trigger index.php page not home. caz home page not made wordpress page. index. bellow index.php file code. <?php get_header(); ?> <style type="text/css"> .sliderarea .sliderbg .sliderwrap .anyclass ul li { background-color: #03f; border: 2px solid #930; height: 100px; width: 100px; margin-left: 10px; } </style> <div class="slidshow"> <div class="sshow"><

typescript - Angular2 Update View After Form Submission -

i'm creating simple crud application using angular2. app consists of table list current records , form submit new records. what's correct way update table reflect new record after submit form? here's have far. export class personform { data: object; loading: boolean; personform: controlgroup; constructor(private _peopleservice: peopleservice, personformbuilder: formbuilder) { this.personform = personformbuilder.group({ 'name': [], 'age': [] }); } onsubmit(values:any) : void { console.log(values); this._peopleservice.createperson(values).subscribe() } } in above, i'm assuming .subscribe() you'll handle callback update view? and here's view: <h1>people</h1> <table class="ui celled small table "> <thead> <tr> <th>name</th> <th>age</th> </tr> </thead> <tr *ngfor="#per

vb.net - VB - TextChanged not triggering properly after the backspace key is hit? -

my problem boils down this: i have 6 textboxes expect value between 0 , given number. trying achieve is: if number entered between 0 , specified number (as label), text remain black if number entered exceeds specified number, text turn red the problem here if specified number "10", , user enters 11, turns red, should, however, if hit backspace key (the number entered 1) number remains red, not intended functionality - number 1 should black since it's between 0 , specified number. all of specified numbers hard-coded (i'm in beginner course , i'm doing fun increase functionality of program , haven't gotten adding classes each "assignment" yet) , can technically input negative numbers, don't care @ moment. this subroutine gets added handler of textboxes within groupbox ' handler gets added textboxes in "grpgrades" groupbox private sub txtgradepoints_textchanged(sender object, e eventargs) ' take i

iphone - How can I play music continue in other iOS app when I record audio complete in my app? -

how can play music continue in other ios app when record audio in app? if set audio session inactive flag notify others set well, other app should restart. ios5 avaudiosession this: [[avaudiosession sharedinstance] setactive:no withflags:avaudiosessionsetactiveflags_notifyothersondeactivation error:nil]; note has been deprecated in ios6 , replaced with: [[avaudiosession sharedinstance] setactive:no withoptions:avaudiosessionsetactiveoptionnotifyothersondeactivation error:nil]; there c interface well.

javascript - AngularJS + Jasmine Unit Test: How to make an angular.constant visible inside the angular.forEach()? -

how make angular.constant visible inside angular.foreach()? in below sample, angular.constant accessible in parent , child describe blocks. trying optimize code, using hash , looping through run tests, started using angularjs.foreach(). but, appears that, angular.constant not visible inside angular.foreach(). idea why constant not accessible (while service is) inside angular.foreach()? describe("utilsservice:", function(){ beforeeach(module('utilsservice')); var kib; var gib; beforeeach(inject(function(_kib_){ kib = _kib_; })); beforeeach(inject(function(_gib_){ gib = _gib_; })); var utilsservice; beforeeach(inject(function(_utilsservice_){ utilsservice = _utilsservice_; })); describe('constant values', function() { /* below test works fine */ it("kib constant in describe", function(){ console.log("kib value " + kib); expe

ios - concatenate backslash in swift -

Image
this question has answer here: (swift) how print “\” character in string? 2 answers how concatenate backslash in swift? i.e. "some string" + "\" escaping backslash gives me "some string\\" want "some string\" any ideas on how accomplish this? edit: don't want print out string, want concatenate backslash. escaping backslash store string 2 backslashes want one. edit 2: think figured out. used "\"" , seems work me. the double backslash solution correct (see console output in small sample)

jquery - Active and not active marker on click using google maps -

how achieve having custom active state on click , when not active defaults original custom marker. i've tried various attempts closet i've gotten it. has solved before? jquery(function($) { var is_internetexplorer11 = navigator.useragent.tolowercase().indexof('trident') > -1; var marker_url = (is_internetexplorer11) ? 'map_marker_highlight.png' : 'map_marker_highlight.png'; var activeicon = { url: 'map_marker.png', // marker 20 pixels wide 32 pixels tall. //size: new google.maps.size(32, 32), // origin image 0,0. //origin: new google.maps.point(130.3065885, -193.6986437), // anchor image base of flagpole @ 0,32. anchor: new google.maps.point(16, 40) }; var locations = [ ['<b>name</b><br>address<br>state<br>', 34.845244, -80.371634, 4], ['<b>name</b><br>address<br>state<br>

orm - Best Way to convert one Edmx Entity to one Business entity -

i developing 1 application in data access edmx entities , have fill each business entity after retriving data edmx entity like:- var tblproducts = tblproductsdata .select(t => new tblproduct() { categoryid = t.categoryid, description = t.description, id = t.id, image = t.image, insdt = t.insdt, price = t.price, quantity = t.quantity, status = t.status, title = t.title, tblcategory = new efdbfirst.models.tblcategory() { id = t.tblcategory.id, status = t.tblstatus.statusid, title_category = t.tblcategory.title_category }, tblstatu = new efdbfirst.models.tblstatu() {

html5 - Google Web Engine Api Channel vs Node.js+Socket.io -

please, me choose 1 use university project (i want develop shared multiuser whiteboard). in particular, interested in performance of message exchange between users , server using channel api , socket.io : 1 quicker , why? i have implemented initial version of whiteboard http://jvyrushelloworld.appspot.com/ following tutorial: http://blog.greweb.fr/2012/03/30-minutes-to-make-a-multi-user-real-time-paint-with-play-2-framework-canvas-and-websocket/ code used pretty same, except side , message exchange method: used python, google channel api message exchange; guy wrote tutorial used play 2 framework , web sockets. as see, web socket tutorial version works faster (don't know if mistake or google api channel performance issue). of course, lot of optimization can done improve performance, wonder if worth go on using channel api project or better switch socket.io?

Writing script for Autohotkey for invoking 'Shift+F5' keystrokes -

i have run few applications browser , ticketing tool. but, need continuously press shift+f5 keystrokes reloading pages of browser , ticketing tool. can use script through autohotkey invoking 'shift+f5' keys repeatedly every 20 seconds regular interval? can please me writing script autohotkey invoking 'shift+f5' keystrokes? i assume want able turn feature on/off #singleinstance force #installkeybdhook #persistent #f5:: ; [win]+[f5] start timer settimer, refreshpage, 20000 traytip, refresh, started, 1 tooltip, refresh active return +#f5:: ; [shift]+[win]+[f5] stop timer settimer, refreshpage, off traytip, refresh, stopped, 1 tooltip return refreshpage: send, +{f5} return

Php script to redirect to m3u8 with proper sessionid -

i sorry if wrong section. need help. have few questions actually. bought iptv subscription provider. able play channels on android, want play on kodi. however, found out method use encrypt channels , not. there's encrypted page accessed using login credentials , within page(i think it's json file), there's session id. session id goes in m3u8 link such: http://website.com/index.m3u8?sessionid= how create script load json file,get session id , connect url plays? session id expires every 15 minutes. assume use php have no idea how code. able understand tiny bit of code however. also, link proper session i'd doesn't play in kodi in chrome.on android. assume user-agent issue? have set url such in kodi( http://website.com/index.m3u8|user-agent= ) proper useragebt doesn't work. assume blocked usage of user agent. lot, , sorry if wrong section.

sql server - sqlcmd not returning error -

i running following sqlcmd via power shell $dump = sqlcmd -s $server -q $sqlcommand -t $querytimeout -b -h -1 -w i trying write output screen $message = "error while executing sql {0}, error details {1}" -f "$sqlcommand","$dump" write-warning $message but $dump empty i not familiar sqlcmd.exe description of expectations think sqlcmd sending information down error stream. seemingly odd common practice , therefore occurrence. problem here variable $dump collect information send output stream. can redirect error stream output stream redirector. more information can @ about_redirection so using following accomplish that: $dump = sqlcmd -s $server -q $sqlcommand -t $querytimeout -b -h -1 -w 2>&1 the linked document describes 2>&1 as sends errors (2) , success output (1) success output stream. now $dump should contain looking for. careful though might contain more information expect.

html - Jquery on ready function not doing anything -

following tutorial uses jquery document ready function can't bit work or anything. threw in alert , won't trigger idea i'm doing wrong? thanks. <html> <head> <title>coulthard</title> <link rel=stylesheet href="blanket.css" type="text/css" media=screen> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { alert("works"); $("#slideshow").css("overflow", "hidden"); $("#slideshownav").css("visibility", "visible"); $("#slideshownav a[href=#image1]".addclass("active"); $("#slideshownav").localscroll({ target:'#slideshow', axis: 'x' }); $("#slideshownav a").click(function(){ $("#slideshownav a").removeclass("active"); $(this).addclass(

javascript - How to handle log out #appcelerator -

i have created page log user in if user opening app first time, how handle , direct him login page. wanted use if (login == false) {//redirect}; it doesn't work titanium sdk studio. you can use titanium.app.properties this. example if(titanium.app.properties.getbool("isfirstlogin",false)){ //user logged in first time } and whenever user logged in set isfirstlogin true. titanium.app.properties.setbool("isfirstlogin",true); if want log user out again in future, can remove property titanium.app.properties.removeproperty("isfirstlogin");

python 2.7 - TKinter Does Not Work -

this question has answer here: why no module named tkinter? 2 answers i working on python v2.x windows os. notice tcl (including tkinter) installed while having python installed. but when verify typing 'import tkinter' on python idle, there error: "importerror: no module named tkinter" could give me advice? thanks. in python2, import tkinter in python3 import tkinter

android - Using one instance webview for multi page -

i want paging web's content in android application. example, use flipview display each page of web content, , don't know how using same webview created, loaded url display on each flipview page. anyone suggest me ! thanks suggestions ! use webview.cangoback() property. @override public boolean onkeydown(int keycode, keyevent event) { // check if key event button , if there's history if ((keycode == keyevent.keycode_back) && mywebview.cangoback()) { mywebview.goback(); return true; } // if wasn't key or there's no web page history, bubble default // system behavior (probably exit activity) return super.onkeydown(keycode, event); } for more details please visit. http://developer.android.com/guide/webapps/webview.html hope

c# - using a method invoker in an if statement -

what trying check whether item in list box selected. the method being run on separate thread need use method invoker believe. string list = ""; lbxlist.invoke(new methodinvoker(delegate { list = lbxlist.selecteditem.tostring(); })); if (list != null) { //do } this code blow if selected item null because string list wont hold it, need way combine top 2 lines if statement checking null. thanks this should do: string list = ""; lbxlist.invoke(new methodinvoker(delegate { if (lbxlist.selecteditem != null) list = lbxlist.selecteditem.tostring(); })); //do just place if-statement inside anonymous method. note .tostring highly unlikely ever return null anything, documentation of object.tostring states overriding types should implement method return meaningful value. since know .selecteditem not null, checking null not necessary. can leave in if want, if you're afraid .tostring should return null, instead change code this

perl - Ignoring GET error of an unexisting webpage -

i use www::mechanize fetch , process web pages. have piece of code, looping through list of web pages. looks approximately this: while (<$readfilehandle>) { $mech->get("$url"); } now problem occurs when 1 of web pages in list not exist reason(which ok). issue in case - program returns error , exits. error looks that: error geting <url> not found @ <path/file.pl> line ... how can ignore such type of error? want program keep running. you need use eval {}; this: while ( $url = readline($readfilehandle) ) { chomp $url; eval { $mech->get($url); }; if ($@) { #error processing code } }

html - Can't remove margins from page -

i having trouble removing side margins page building. have tried setting padding , margin 0 no success. please see attached picture , code. html <!doctype html> <html> <head> <title>socialsweeper</title> <meta charset="utf-8"> <link rel="stylesheet" href="css/style.css"> <?php if (isset($_cookie['userdata'])) { ?> <script> window.location.href = "explore.php"; </script> <?php } ?> </head> <body> css @charset="utf-8"; @import url(http://fonts.googleapis.com/css?family=open+sans:400italic,700italic,700,400); html, body { direction: ltr; padding: 0; margin: 0px; font-family: 'open sans', sans-serif; letter-spacing: 1.5px; } try css : * { margin: 0; padding: 0; }

ruby on rails 3 - How can I run only one test for only one spec file in RubyMine -

i'd run 1 test 1 spec file in request folder in rubymine. can test files spec:request task. can me run particular test? if understand question correctly, can right-click on test or spec name , click run {test_name} . alternatively, should able place mouse cursor inside text of test name , press ctrl + shift + f10 .

android - Preferred method of working with logical objects -

i'm having array of objects represented json string coming api server. let's suppose have movie categories , actual movies belong each category: [ { "id": "1", "name": "action", "movies": [ { "id": "1", "name": "movie 1", "description": "movie 1 description", "other": "other..." }, { "id": "2", "name": "movie 2", "description": "movie 2 description", "other": "other..." } ] }, { "id": "2", "name": "drama", "movies": [ { "id": "3", "name": "movie 3", "description": "m

laravel updateOrCreate() with dynamic table -

i'm working project tables created time depending on user adding new properties, model have below class hotel extends model { public function __construct($hotel) { $this->table = $hotel; } protected $fillable = ['date', 'sold', 'sold_diff', 'rev', 'rev_diff', 'row', 'date_col', 'sold_col', 'rev_col']; } and can use table in controller doing $hotel_table = new hotel($table); but use model::updateorcreate() when i'm adding or updating rows in table, , i'm not sure how that. this signature updateorcreate function "static model updateorcreate( array $attributes, array $values = array())" for update or create, can pass condition must met update table first argument , values updated second. for example. $primarykey = isset($request->input('id')) ? $request->input('id') : null; $mymodel = model::updateorcreate([&

Android notifications don't work if set to next day -

i've made program, uses broadcastreceiver create alarm (which activated after several days). when time comes, supposed play notification. i've tried setting time few minutes, hours , notification plays. however in real life testing when time on 1 day notification doesn't work. is there limit broadcast receivers can set in future? here code: [http://pastebin.com/jnxvextk] let's today sunday 5:00. if set alarm @ sunday 7:09 - ring. but if set alarm wednesday @ 3:00 - won't work. and cannot set emulator such long period. i've been trying program on tablet , there notification fails show if alarm set ring after few days. fallow 2 steps , schedule task 1.create date object date dateobj=new date(year-1900,month,day,hour,min); year - scheduling year month-scheduling month(0-11) day-scheduling day (1-30) hour scheduling hour (24 hrs format )(0-24) min scheduling min 0-59 2. set alarm dateobj.gettime() returns milli seconds ala

Php Soap function arguments -

i'm trying create simple php soap server. the problem although set specific parameters types in wsdl file, in case set integer, can make method calls php parameter type(string, array, assoc array). theoretically , if php parameter type not same wsdl parameter type should not throw error? in case if call function array on server array, i call same function string on server string etc. how cand edit code below method "domybooksearch" accept integers declared on wsdl. client code: try{ $sclient = new soapclient('sample.wsdl',array('trace'=>true)); print_r($sclient->domybooksearch('test')); //i call function string, , not integer wsdl } catch(soapfault $e){ var_dump($e); } server code: $server = new soapserver("sample.wsdl"); function domybooksearch($yourname){ return 'works'; //return string } wsdl: <types> <xsd:schema xmlns="http://www.w3.org/2001/xmlschema" targ

c# - building dynamic table from json serialized list object -

i'm trying serialized json list via ajax , create dynamic table in html jquery mobile page. list comes sql database in code behind. don't know if i'm returing json object right, , how access ajax success function. my goal create dynamically table of members in html. i created member class: public class member { public member() { // // todo: add constructor logic here // } public string fname { set; get; } public string lname { set; get; } } this function return member list in code behind: (written in class connects sql) public list<member> return_member_list() { list<member> member_list = new list<member>(); string fname; string lname; sqlconnection user_con = connect("actconstring"); sqlcommand user_command = create_command(user_con, "select m_first_name, m_last_name member"); sqldatareader rdr = user_command.executere

Django, annotation and ordering using data from other table -

in app there users request items , users donate items. fetch users made donations. these models: class itemrequest(models.model): item_type = models.foreignkey(itemtype) description = models.charfield(max_length=1024, default='', blank=true) quantity = models.integerfield() user = models.foreignkey(user) completed = models.booleanfield(default=false) completed_dt = models.datetimefield() class donation(models.model): item_request = models.foreignkey(itemrequest, related_name='donation') user = models.foreignkey(user, related_name='donor') quantity_offered = models.integerfield(default=0) quantity_accepted = models.integerfield(default=0) more specifically, fetch top-5 donors "completed" donations (where item_request.completed=true) . can 1 query? (user.objects .filter(donor__item_request__completed=true) .annotate(c=count('donor')) .order_by('-c')[:5]) y

asp.net - VB.NET/ SQL Server 2012 - Invalid column name -

when pressing 'register' button, visual studio 2012 giving me error in sql statement sqlvalidate = "select * users username=" + txtusername.text.tostring the error being: invalid column name 'cdarwin' where ' cdarwin ' username entered in txtusername . can tell me whats wrong? this full code sub: public sub register() dim username string = txtusername.text dim surname string = txtsurname.text dim password string = txtpassword.text dim name string = txtname.text dim address1 string = txtaddress1.text dim address2 string = txtaddress2.text dim city string = txtcity.text dim email string = txtemail.text dim country string = drpcountry.text dim dob date = caldob.selecteddate dim occupation string = txtoccupation.text dim worklocation string = txtworklocation.text dim age integer = date.today.year - caldob.selecteddate.year dim projectmanager string = "n/a" dim team

encoding - UTF-8 decoding with ascii code in it with Python -

from question , answer in utf-8 coding in python , use binascii package decode utf-8 string '_' in it. def toutf(r): try: rhexonly = r.replace('_', '') rbytes = binascii.unhexlify(rhexonly) rtext = rbytes.decode('utf-8') except typeerror: rtext = r return rtext this code works fine utf-8 characters: r = '_ed_8e_b8' print toutf(r) >> 편 however, code not work when string has normal ascii code in it. ascii can anywhere in string. r = '_2f119_ed_8e_b8' print toutf(r) >> doesn't work - _2f119_ed_8e_b8 >> should '/119편' maybe, can use regular expression extract utf-8 part , ascii part reassmeble after conversion, wonder if there easier way conversion. solution? quite straightforward re.sub : import re bytegroup = r'(_[0-9a-z]{2})+' def replacer(match): return toutf(match.group()) rtext = re.sub(bytegroup, replacer, r, flags=re.i)

css - HTML5 Issue with backround-image and accompanied float image above it. Also cannot adjust opacity. -

i coding website kids , assignment class. trying put image in body background having text on top of it. image did show floating box above mid page , not float right edge of page. including .css file. image file in same file else , there link file. h1 { color: green; text-align: center; } h2 { color: green; text-align: center; } #header { height:100px; background:black; text-align: center; text color: green; } body { margin:0; padding:0; width:100%; height:1000px; margin:0; dislay:block; color: #000000; background-image:url('trees.jpeg') &nbsp; background-repeat: no-repeat; } #footer { height:50px; background:black; text color:green; text-align:left-side; } #content { height:1000px; } table { width:100%; height:500px; } the link in page looks so <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <link rel=&

ios - Changing App Name with plist data files -

i have app uses plist (stored locally) save data. (the app address book app). code use involving plist below: - (nsstring *)infodatafilename { nserror *err = nil; nsurl *dir = [[nsfilemanager defaultmanager] urlfordirectory:nsdocumentdirectory indomain:nsalldomainsmask appropriateforurl:nil create:yes error:&err]; nsstring *path = [[dir path] stringbyappendingstring:@"/infodata.plist"]; return path; } however, changed name of app. redownloaded app onto phone, , none of original data showing up. how can make data original plist show in new plist? thanks much! when changed app's name, changed bundle id, created entirely new app, independent of old version. changed bundle id used be, , problem solved. you can view/change bundle id in project overview > general > identity > bundle identifier.

osx - how to change extended file attributes of files on mac? -

i had ios projects in macbook,one day copied them pc based on windows system, day copied them macbook , found projects can not run. opened 1 of projects xcode, says "builde successfully",but app can not deployed on iphone simulator if simulator running!?!?!?! check files using "ls -l" command , found difference between normal xcode project files , new created xcode project files symbol. files problem: drwx------+ 49 dingvimer staff 1.6k normal file: drwx------@ 60 dingvimer staff 2.0k how can change '+' symbol '@' , project run normally? i appreciate kindness of helping me figure out (^-^). you can use ls -l@ see extended attributes. show like: drwxr-xr-x@ 5 cody staff 170 mar 30 08:46 test.xcodeproj lastupgradecheck 4 lastupgradecheck - name of attribute (sometimes there can com.apple.blablabla) , 4 - value. use xattr command set/delete extended attributes. see man xattr (its quite short , the

VS 2012 Task list doesn't work in Typescript -

is there way make task list work in typescript projects? it doesn't recognize "todo" comments. user tasks can created. update: i've raised bug on codeplex site . your best bet raise bug on codeplex site typescript team can allocate developer , release. http://typescript.codeplex.com/

asp.net - where to put shared mvc partial views? -

i have application split in multiple controllers. however, number of views can shared between controllers. include such in shared folder, feel @ time becomes folder pollution gets dumped in there. so partial views, best , normal place include views shared between controllers? should continue include them in shared folder or ok reference partial views in full views no exist in same folder? create subfolders in ~/views/shared if there there.

rest - Is possible to access google drive user data through admin account? -

i trying use google drive rest api. use case is, have google domain users , 1 admin. , need access , manipulate users data admin account. possible? if possible can 1 how? you have use service account authorize requests. here can find guide explains how. i'd recommend reading documentation using service accounts may quite dangerous.

python - Select all possible subarrays of length n -

how can 2d array containing possible consecutive sub-arrays of length? for example, array ['a', 'b', 'c', 'd', 'e'] , , n 3, result should be [['a', 'b', 'c'] ['b', 'c', 'd'] ['c', 'd', 'e']] i found similar question relating python lists, i'd numpy, need perform on many different arrays, each of large. basically, speed issue here. third , final no-loop answer: def substrings(n, x) return numpy.fromfunction(lambda i, j: x[i + j], (len(x) - n + 1, n), dtype=int) you'll have profile of these solutions find 1 that's performant. if 1 of these solutions best, please select correct answer.

hardware - Grove Seeed Studio sensors not working properly with Intel Edison -

i've been trying run simple scripts on intel edison try different grove seeed studio sensors , cannot manage make them work. my board configured correctly, firmware date, , cables have been connected correctly shown on different tutorials. can connect board through ide, via ssh, , serial. i've been using templates provided intel-xdk ide because i'd develop using javascript , nodejs. "onboard led blink" template has worked perfectly. board blinked onboard led light board listening machine, other templates have failed make sensors work. example, running "local temperature" template aims retrieve local temperature temperature sensor, prints sample reading grove kit temperature sensor , stays there without printing temperatures in console. has been case other sensors , other templates "touch notifier" template when running prints sample reading touch sensor , performs no other actions when touching touch sensor. i tried moving away inte

python 3.x - How do I input an integer on a new line -

i trying make input integer on new line using python, error when this. #inputs mymath integer print = ("give me number , double you.") mymath = int(input + "\n") #multiplies mymath(the variable) times 2 result = eval("2 * mymath") the error says "typeerror: unsupported operand type(s) +: 'builtin_function_or_method' , 'str'" using python 3.5.1. here want: yourval = int(input("double number:\n")) result = yourval*2 print(result)

server - localhost- this site can't be reached -

i'm trying use red5 project. installed , gave ip 127.0.0.1 , port 5080. searched services.msc start server not find red5. searched windows explorer , there shortcut start red5. clicked , tried connect in browser 127.0.0.1:5080. still couldn't connect. searched using netstat , saw 5080 not used. doing wrong? i found problem. red5.bat not find path jdk because of semicolon @ end of path jdk in environment variable. start server after removed semicolon. hope helps facing problem.

ruby - Get all attributes for elements in XML file -

i'm trying parse file , of attributes each <row> tag in file. file looks this: <?xml version="1.0" standalone="yes"?> <report> <table> <columns> <column name="month"/> <column name="campaign"/> <!-- many columns --> </columns> <rows> <row month="december 2009" campaign="campaign #1" adgroup="python" preview="not available" headline="we write apps in python" and="many more attributes here" /> <row month="december 2009" campaign="campaign #1" adgroup="ruby" preview="not available" headline="we write apps in ruby" and="many more attributes here" /> <!-- many such rows --> </rows></table></report> here full file: http://pastie.org/7268456#2

excel - VSTO 2010 Intranet deployment (.Net 4.0) -

i m novice in vsto. i have excel template published in local intranet. problem computer can run template other cannot. (all users have same roles) is there local policis have create or edit let user computer in local network run template. thanks help. 1>seems user directly trying run file network location. suggest better create installer, quite easy using click once. 2>try sign .vsto trusted publisher. 3>try set security on shared location using http://msdn.microsoft.com/en-us/library/9w6bd8f1(vs.80).aspx http://msdn.microsoft.com/en-us/library/k64zb6we(v=vs.80).aspx

matlab - How to open Digital surface model (DSM) image? -

i have digital surface model (dsm) image. tried open imread() image processing toolbox shows me white image. when open matrix of image found arrays have values dont show anything. can me? dsm not format supported matlab. here list of formats: http://in.mathworks.com/help/matlab/import_export/supported-file-formats.html you can try converting image supported matlab format using online converters or software irfanview, provided format change not alter image properties purpose.

PowerShell / Azure VM - Move preferred language to the top of the list -

Image
i have issue date time format on azure vm changes this: mm/dd/yyyy if move language english (australia) top of list, date time format changes this: dd/mm/yyyy which want. i need in powershell automated. if have logged in , want change timezone on vm, use script change time zone in windows 7 or windows 8 (powershell) if want change timezone when creating new azure vm, add new azurevmconfig using add-azureprovisioningconfig , in set timezone parameter, example: new-azurevmconfig -name "domainvm" -instancesize small -imagename $img ` | add-azureprovisioningconfig -windows –password $password -timezone <your time zone> ` | new-azurevm -servicename $servicename

java - Array gets overwritten for no apparent reason -

problem have written loop in fill array sum objects. works fine, loop gets next iteration overwrites first index of array. what have tried tried see if maybe problem resides in different piece of code (such sum class). not find disturb loop. tried find other variables same name (even in other methods, since desperate) , see if maybe changed iterator somewhere else. couldn't find related that. tried looking around on internet , find related accidentally overwriting arrays couldn't find either. code public task(object[] parameters) { this.number_of_sums = integer.parseint((string)parameters[0]); this.variables_per_sum = integer.parseint((string)parameters[1]); this.sum_parameters = new object[this.variables_per_sum]; this.sums = new sum[this.number_of_sums]; int z = 0; for(int = 0; < this.number_of_sums; i++) { int x = 0; for(int j = (2 + z); j < ((this.variables_per_sum + 2) + z); j++) {

.net - Printing in WPF with MVVM - Display PrintDialog from view, but print with ViewModel -

first, take @ this question , answer . in supplied code in answer, there no call printdialog.showdialog() , example using dialog object print something. however, printdialog view, , visual print view, think of should go in view. data view in viewmodel, view print should built view, fired off printer (just view fires off visuals screen). right way think of mvvm in manner? i thinking of displaying printdialog user view, passing dialog viewmodel printing, seems break idea behind mvvm. first, moderators typically close open ended, discussion questions this. should narrow question can definitively answered. second, time pass "view" oriented viewmodel, violating separation of concerns. also, activity in viewmodel block unit test completing execution should immediate red flag breaking mvvm. in case, print dialog displaying , waiting input or being in modal state cause unit test time out or hang. the solution pass service class in performs work of printing gr

google maps - Cannot find user location: -

i think have done using google maps api v2 position not shown , camera doesn't changes position. the map loads stays in 0,0 location , never moves. in device, see gps signal looking position , have tested outside. here code: mainactivity.java: public class mainactivity extends fragmentactivity implements locationsource,locationlistener, onmapclicklistener, onmylocationchangelistener { final int rqs_googleplayservices = 1; private googlemap mymap; private locationmanager lm; public location mylocation; public tipobusca busca; private enum tipobusca {busca_parada, busca_localizacao_inicial, busca_localizacao, busca_endereco, busca_drag}; public string tiporequest; private criteria mycriteria; public textview textview; public onmylocationchangelistener locationlistener; @override protected void oncreate(bundle savedinstancestate) {

Run Python .py File from any folder -

i'm starting create lots of python scripts. these scripts made run on number of files same folder script in. want store script in organized folder, , able access script folder navigate in console. how do this? thanks! i think can use access scripts anywhere: >> python [path]\script.py

jwplayer - How to eliminate black bars? -

i using jwplayer 6.3 embed videos in html/javascript application. have outer div holds container div video embedded. container centered in both directions within outer div. outer div dimensions of browser window. i'm calling jwplayer("container").setup({options}) embed video. good. the app shows different videos @ different times calling jwplayer("container").setup({options}) again different video. want have each video fill outer div best can, while still keeping own aspect ratio. video aspect ratio guaranteed different of outer div @ given time. if choose stretching: "bestfit", i'll dreaded black bars (™). fine if choose color these bars (i choose white). q1: can i/how specify color of bars? if detect size of video @ run time, specify width , height embed (via .setup()) aspect ratio, , use stretching: "exactfit". q2: can i/how can detect size of video @ run time? thanks fred ross-perry you should use exactfit,

javascript - Making a count object by initializing properties from iterating through elements in an array -

alright, i'm working on final problem of javascript-koans. code , dataset i'm given follows: products = [ { name: "sonoma", ingredients: ["artichoke", "sundried tomatoes", "mushrooms"], containsnuts: false }, { name: "pizza primavera", ingredients: ["roma", "sundried tomatoes", "goats cheese", "rosemary"], containsnuts: false }, { name: "south of border", ingredients: ["black beans", "jalapenos", "mushrooms"], containsnuts: false }, { name: "blue moon", ingredients: ["blue cheese", "garlic", "walnuts"], containsnuts: true }, { name: "taste of athens", ingredients: ["spinach", "kalamata olives", "sesame seeds"], containsnuts: true } ]; it("should count ingredient occurrence (imperative)", function () { var ingredientcount = { "{ingred

activerecord - Rails polymorphic associations - has_many condition error -

i'm using rails 3.2.8 , i'm having troubles polymorphic associations. have model activity polymorphic related polymorphic model contribution can asset_file, biography, dynamic_annotation or citation. so grandfather activity...the father contribution , sons (of contributions) biographies, asset_file, dynamic_annotations or citations. i model thing aggregate of concepts have next code: has_many :activities, :order => 'created_at desc', :dependent =>:delete_all has_many :contributions, :through => :activities, :source => :activable, :source_type => "contribution" has_many :dynamic_annotations, :through => :contributions, :source => :contributable, :source_type => "dynamicannotation", :conditions => {"contributions.c_state" => "accepted"} has_many :biographies, :through =>