Posts

Showing posts from August, 2012

Better way to proxy an HTTP request using Perl HTTP::Response and LWP? -

i need perl cgi script fetches url , returns result of fetch - status, headers , content - unaltered cgi environment "proxied" url returned web server user's browser if they'd accessed url directly. i'm running script cgi-bin in apache web server on ubuntu 14.04 host, question should independent of server platform - can run perl cgi scripts should able it. i've tried using lwp::useragent::request() , i've got close. returns http::response object contains status code, headers , content, , has "as_string" method turns human-readable form. problem cgi perspective "as string" converts status code "http/1.1 200 ok" rather "status: 200 ok", apache server doesn't recognise output valid cgi response. i can fix using other methods in http::response split out various parts, there seems no public way of getting @ encapsulated http::headers object in order call as_string method; instead have hack perl blessed obj

json - Java-8 JSONArray to HashMap -

i'm trying convert jsonarray map<string,string> via streams , lambdas . following isn't working: org.json.simple.jsonarray jsonarray = new org.json.simple.jsonarray(); jsonarray.add("pankaj"); hashmap<string, string> stringmap = jsonarray.stream().collect(hashmap<string, string>::new, (map,membermsisdn) -> map.put((string)membermsisdn,"error"), hashmap<string, string>::putall); hashmap<string, string> stringmap1 = jsonarray.stream().collect(collectors.tomap(member -> member, member -> "error")); to avoid typecasting in line 4 , i'm doing line 3 line 3 gives following errors: multiple markers @ line - type hashmap<string,string> not define putall(object, object) applicable here - method put(string, string) undefined type object - method collect(supplier, biconsumer, biconsumer) in type stream not applicable arguments (hashmap<string, string>::new, (<no type> map, <no ty

google maps - Embed Street-View in android application -

Image
i want understand possibilities embedding streetview in android application. better understanding, pasting screenshot. require flash player, if yes, possible implement? i able use webview of android show map , directions, not able show street view on top widget. kindly me understand possibility. yes can implement flash player first check whether flash player installed in device or not using flash package name boolean status = false; try { packagemanager pm = freescrollview.mcontext.getpackagemanager(); applicationinfo ai = pm.getapplicationinfo("com.adobe.flashplayer", 0); if (ai != null) status = true; } catch (namenotfoundexception e) { // todo auto-generated catch block e.printstacktrace(); status=false; } if flash player not installed please download flash player using link , try again ( http://helpx.adobe.com/flash-player/kb/archived-flash-player-versions.html )

sql server - t-sql udf to return concatenated field values for one row in any given table -

i'm looking create function table name passed, , id value, , procedure returns single string field values specified row. tables referenced have field called 'id'. i've found other examples can concatenate specified row in table, have been unable find way dynamically specify table. below closest exampel found here : tsql: values of field in row 1 string create function udf_gettablevalues (@tablename varchar(max) = '',@id int = 0) returns varchar(max) begin declare @returnval varchar(max) select @returnval = '' select @returnval = @returnval + ' // ' + t2.n.value('local-name(.)', 'nvarchar(128)') +': ' + t2.n.value('.', 'nvarchar(max)') (select * branch id = 1 xml path(''), type) t1(x) cross apply t1.x.nodes('/*') t2(n) return @returnval end well first off, have come grips fac

listview - Improving the layout of my Android application -

in application, i've implemented descendant navigation. , in pages, i've implemented listviews. how can improve ui simple list views simple list like item 1 item 2 item 3 to this: ******** ******** ******** ******** * itm1 * * itm2 * * itm3 * * itm4 * * * * * * * * * ******** ******** ******** ******** and scrollable? items horizontally aligned. thinking of gridview also. can gridview customized display in single line only? you put items in linearlayout horizontal orientation inside horizontalscrollview . there android class gallery , it's deprecated in api level 16.

java - Converting Program With Only A Constructor To One With A Main Method Instead -

my instructor having trouble grading assignment. created following program in bluej, , uses eclipse. problem couldn't bluej fire piece of code main method, opted use constructor instead. copy/paste of bluej code eclipse shows problematic way is: error: not find or load main class misspelled how convert constructor-only program below program working main method? don't need constructor more. import java.util.scanner; public class randomgame { int usersscore = 0; public randomgame() { scanner userinput = new scanner(system.in); string[] wrongwords = {"mispelled","kobra", "wishfull", "adress", "changable","independant", "emberrass", "cieling", "humerous", "wierd"} ; string[] rightwords = {"arctic", "miscellaneous", "piece", "prejudice", "grateful","ecstasy", "fascinate", "definite&q

How to get accurate GPS location Using google API(Fused Location) in android? -

Image
i using google api location gps in android . got accurate location if moving. if in same location above 15 mins give more locations. my code is: public class locationservicetesting extends service implements locationlistener, connectioncallbacks, onconnectionfailedlistener { // location updates intervals in sec private static int update_interval = 10000; // 10 sec private static int fatest_interval = 5000; // 5 sec private static int displacement = 10; // 10 meters locationrequest mlocationrequest; googleapiclient mgoogleapiclient; location mcurrentlocation,mlastlocation,test3lastlocation,test2lastlocation; string mlastupdatetime; string devicecode = "", imeinumber = ""; protected void createlocationrequest() { mlocationrequest = new locationrequest(); mlocationrequest.setinterval(update_interval); mlocationrequest.setfastestinterval(fatest_interval); mlocationr

java - GWT TreeViewModel not working as expected -

i'm trying make celltree in gwt, reason treeviewmodel no working properly public class channelviewmodel implements treeviewmodel { @override public <t> nodeinfo<?> getnodeinfo(t value) { if(value == null) { window.alert("node 0"); return new defaultnodeinfo<channelrepresentation>(new channelasyncdataprovider(), new channelcell() ); } else if(value instanceof channelrepresentation) { window.alert("node 1"); channelrepresentation feedchannel = (channelrepresentation) value ; return new defaultnodeinfo<entryrepresentation>( new entryasyncdataprovider( feedchannel.getchanneluri() ), new feedentrycell() ); } window.alert("undefined value"); return null; } @override public boolean isleaf(object value) { if(value instanceof entryrepresentation) { window.alert("isleaf: true"); return true; } window.alert(&quo

javascript - Restrict dropPosotion before and after Kendo UI treeview -

when doing drag , drop in kendo ui treeview has 3 positions namely "before", "over" , "after". http://docs.kendoui.com/api/web/treeview#dragend is possible restrict "before" , "after" states , allow drop "over" functionality. note in scenario have 2 trees , i'm dragging element left tree other. in kendotreeview , define drag , drop event handlers follow: drag : function (ev) { if (!$(ev.droptarget).hasclass("k-in k-state-hover")) { ev.setstatusclass("k-denied") } }, drop : function (ev) { if (ev.sourcenode === ev.destinationnode) { ev.setvalid(false); } } in drag check over element , if not set status class k-denied formats clue denied prevents dropping there. in drop check i'm not dropping on top of preventing stack overflow. running example here: http://jsfiddle.net/onabai/mu92b/

How to use pagination in rails 4.2.5 and also have the ability to reorder the list with ajax? -

i'm working on forum-type app in rails v 4.2.5. index page list of questions being discussed in application , default sorted created_at date. using kaminari gem paginate of questions (25 per page). had app set this: questions controller: def index @questions = question.order(:created_at).page params[:page] end index view: # render partial iterates through questions list display # title of questions, include paginate code below. <div class="pagination"> <%= paginate @questions %> </div> i decided wanted users able sort questions different criteria (e.g., total amount of upvotes, total amount of responses question, , asked questions). right now, can click link corresponding type of sort want , ajax new sorted list (a partial) onto page. however, when this, pagination not work , when click see second page of results, becomes unsorted. index view sort links: <div class="sort_selection"> <h3> sort by: </h3&g

json - Mongo DB query at least one property but preferred more ideally all -

"structure":{ "country":{ "name":"some country" }, "city":{ "name":"some city" }, "building":{ "name":"some building" }, "floor":{ "name":"" } } i have collection of object above. need query collection results 1 item. query should include filter 4 fields: country, city, building , floor. if there match 4 ideal scenario. if there no such object in collection, query should return item 3 matches , 1 empty. if there no 3 2 matches , other 2 should empty. and same matching 1 field. it important other fields not match empty. not value not match exclusively "" empty space. how write mongo query this? the query work me this: db.structures.find({"som

gradle - Android multi flavor library referenced from non flavor application - AAPT: No resource found -

i have library contains string resource: <string name="lib_name">mylibrary</string> reference library in application build.gradle: dependencies{ compile project(':mylibrary') ... } in application module have displayed text resource: <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/lib_name" /> there no problem without using flavors. want add new flavor library different text. build.gradle of library: android { ... productflavors { myflavor {} } } then create new resource file new flavor \mylibrary\src\myflavor\res\values\strings.xml: <string name="lib_name">mylibrary flavor</string> but have build error, resource not available anymore: aapt: no resource found matches given name (at 'text' value '@string/lib_name'). i need application has default flavor. resource in 'myflavo

c# - Client to send SOAP request -

trying create c# client (will developed windows service) sends soap requests web service (and gets results). enter image description here it breaks httpwebresponse wr = (httpwebresponse)httprequest.getresponse(); error: an unhandled exception of type 'system.net.webexception' occurred in system.dll additional information: remote server returned error: (500) internal server error. most probably, backend has found kind of problem in soap request body, indicated 500 server error return code. usually, when working soap end points, take wsdl , generate client in c# (using visual studio). soap endpoint react adding ?wsdl after request url? so: https://soap.server.com/myendpoint?wsdl . after getting such wsdl file, can use generate c# client endpoint, e.g. using service references, or wsdl.exe tool. unfortunately, things changed between .net 4.0 , 4.5, knowing targeted runtime needed full answer.

Generic 0 cannot be cast to java.lang.Short -

i have 2 maps in class (i new generics) private map<integer, integer> amap = new concurrenthashmap<integer, integer>(); private map<integer, short> bmap = new hashmap<integer, short>(); if key not exist in map want 0 value. have made wrapper method minimize typing containskey(key) @suppresswarnings("unchecked") private <t extends number> t getvalue (map<integer, t> map, integer key) { return (t) ((map.containskey(key)) ? map.get(key) : 0); } i call like integer = getvalue(amap, 15); //okay in case short b = getvalue(bmap, 15); //15 key not exist for second case gives me: classcastexception: java.lang.integer cannot cast java.lang.short so need : new number(0) , number abstract. how can fix it? edit: my idea arithmetic operations without additional ifs: integer = getvalue(amap, 15); = + 10; one way supply default value argument function: private <t extends number> t getvalue (map<integer,

regex - Remove html which have class x from string in java -

is there way remove html java string have class "abc"? simple regex - replaceall("\\<.*?>","") will remove want remove tag having class "abc". <h1 class="abc">hey</h1> <h1 class="xyz">hello</h1> remove h1 class abc only. note -> have ddo through regex not through parser because instance modifying html in code. don't want additional jar in code. this should work replaceall("<h1[^>]*?class=\"*\'*abc\"*\'*>.*?h1>","")

c# - Namespace error when adding viewmodel -

i come strange problem. @ first it's easy thing trust me it's make me crazy ! i want specify wich file want associate xaml page in datacontext, did on other xaml page don't understand why ! <usercontrol x:class="finalmediaplayer.onglet.musique.home.homemusique" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mui="http://firstfloorsoftware.com/modernui" xmlns:viewmodel="clr-namespace:finalmediaplayer.onglet.musique.home" xmlns:tools="clr-namespace:finalmediaplayer.tools" mc:ignorable="d" d:designheight="300" d:designwidth="300"> <usercontrol.datacontext>

ios - Animate Transition of CollectionView in TableViewCell -

i'm trying figure out way animate layout of uicollectionview embedded in uitableviewcell. the reason why did simple, needed have different uicollectionview in different section of uitableview able scroll horizontally through each uicollectionviews. easy, i'd animate transition when touch cell in uicollectionview , entire collection grow , became page view (full screen) can display more information in each cell of uicollectionview. as don't use parent uicollectionviewcontroller, can't use uicollectionviewlayouttransition. my first try expand height of cell uicollectionview embedded in with: [self.tableview beginupdates]; self.expandedindexpath = tableviewindexpath; [collectionview setcollectionviewlayout:_largelayout animated:yes completion:nil]; [collectionview.collectionviewlayout invalidatelayout]; [self.tableview endupdates]; bad guess because heigh of cell did indeed grow forgot other section of uitableview still in view able con

git - Untracked and changed files are the same -

how can git tell me has changed if it's not tracked? , how can deleted, when it's discovered untracked?: $ git status on branch updated-code-foundation branch ahead of 'origin/updated-code-foundation' 16 commits. (use "git push" publish local commits) changes committed: (use "git reset head <file>..." unstage) deleted: component/portal/src/joppli/acl/aclinterface.php deleted: container/php-apache/config/apache/default.conf deleted: container/php-apache/config/php/php.ini untracked files: (use "git add <file>..." include in committed) component/portal/src/joppli/acl/aclinterface.php container/php-apache/config/ i solve git add . ( no commit needed... ) why occurring? how can prevent occurring? 1. scenario following: you have file tracked , committed repository you git rm file file created again example: git add myfile git commit -m "myfile" git rm

excel - conditional formatting and vba -

Image
in macro using following code: with range("t2:x31") .formatconditions.delete .formatconditions.add type:=xlexpression, formula1:="=$r2=0" .formatconditions.add type:=xlexpression, formula1:="=$ae2" .formatconditions.add type:=xlexpression, formula1:="=$af2" .formatconditions(1).interior.color = rgb(216, 216, 216) .formatconditions(1).font.color = rgb(216, 216, 216) .formatconditions(2).interior.color = rgb(255, 40, 40) .formatconditions(2).font.color = rgb(255, 255, 255) .formatconditions(3).interior.color = rgb(255, 128, 0) .formatconditions(3).font.color = rgb(0, 0, 0) end what in excel when check conditional formatting rules (entered manually): what instead is where ok except row (1046053 instead of 2). how should enter cell reference right formula. try select a2 before set conditions: range("a2").select i never used vba, have suspicion formulas in conditional forma

cakephp 3.x data not saving when Saving data into 2 tables with has many relation -

i have 2 tables clients , branches branches has field client_id relation between them client hasmany branches , branch belongs user, have following code in clients/add.ctp view file <?php echo $this->form->create($client); echo $this->form->input('name'); echo $this->form->input('branch.0.branch_name'); echo $this->form->input('branch.0.email'); echo $this->form->input('profile_link'); ?> , controller code isas follow <?php public function add() { $client = $this->clients->newentity(); if ($this->request->is('post')) { $client = $this->clients->patchentity($client, $this->request->data, [ 'associated' => ['branches'] ]); if($this->clients->save($client)) { $this->flash->success(__('data has been saved.')); } else {

jruby - ScriptingContainer, Ruby Runtime and Variable Map -

(crossposting note: question has been posted @ jruby mailing list (jruby@ruby-lang.org) on december 20 , on jruby forum on january 2nd, hasn't got response yet). this question understanding impact of localcontextscope parameter in presence of multi-threading. we can find @ jruby wiki recipe helps choosing best value localcontextscope parameter. page explains, parameter controls, whether scriptingcontainer and/or ruby runtime and/or variable map shared among threads. however, deeper understanding issue, in particular, part of "system" implemented in 1 of 3 components. as concrete example: when create global variables in ruby, or new classes, or functions , variables in top level context, belong scriptingcontainer, runtime, or variable map? unless knowing this, don't know localcontextscope have use.

deployment - How to check if all modules imported by a Python script are installed without running the script? -

i check if modules imported script installed before run script, because script quite complex , running many hours. also, may import different modules depending on options passed it, running once may not check everything. so, wouldn't run script on new system few hours see failing before completion because of missing module. apparently, pyflakes , pychecker not helpful here, correct me if i'm wrong. can this: $ python -c "$(cat *.py|grep import|sed 's/^\s\+//g'|tr '\n' ';')" but it's not robust, break if word 'import' appears in string, example. so, how can task properly? you use modulefinder standard lib modulefinder using example docs from modulefinder import modulefinder finder = modulefinder() finder.run_script('bacon.py') print 'loaded modules:' name, mod in finder.modules.iteritems(): print '%s: ' % name, print ','.join(mod.globalnames.keys()[:3]) print '-&#

How a plan is split into Job and stage in Spark? -

Image
i'm trying understand how query plan splitted job in spark, how spark decide split workflow in job , stage. my query simple join between big table (22gb) , small table (300mb): select key0 bigtable,smalltable importedkey=keysmalltable and execute shuffledhashjoin , broadcasthashjoin. for shuffledhashjoin 1 job: and 4 stage: for broadcasthashjoin 3 job: and 4 stage: this job's division caused "collect" on driver required when use broadcasthashjoin?

Stream large models in three.js -

i have large model of more 2 million vertices. want stream using three.js remote url. using buffer geometry loading loads in 1 shot. is there loader in three.js can progressive load model. other approach work. i able load type of data(obj, stl or json triangles). any kind of suggestion welcomed. you need implement sort of lod (level of details) optimization. depends on loading. the usual simple approach in case of big planar meshes (like terrain) follows: split entire mesh square pieces; generate several versions of same square: highest lowest level of details (thus, number of vertices); serve corresponding squares in appropriate level of details depending on distance form camera, phase of moon or whatever else factor.

php - Paypal REST API: Retrieve invoice numbers for further processing after payment approved -

i use paypal php sdk shopping app, after executed , approved of buyer's payment, want return payment details can continues further action such update database. i hit url http://example.com/shopping/payment?success=true&paymentid=pay-1tk25581j9941930mk2h3odr&token=ec-9jk21383ks5324308&payerid=reluja6bn3mne , in source code, have $info = $payment->gettransactions(); view payment's details after payment approved, print print_r($info) : array ( [0] => paypal\api\transaction object ( [_propmap:paypal\common\paypalmodel:private] => array ( [amount] => paypal\api\amount object ( [_propmap:paypal\common\paypalmodel:private] => array ( [total] => 56.00 [currency] => gbp [details] => paypal\api\details object ( [_propmap:paypal\common\paypalmodel:private] => array ( [subtotal] => 46.00 [shipping] => 10.00 ) ) ) ) [payee] => paypal\api\payee object ( [_propmap:paypal\common\paypalmodel:private] => array ( [email] => myshop@ex

caching - Cache management and Index management in magento -

why sometime necessary cache management disable , index management re-index in magento.i new in magento if know reply kindly. in development environment advised disable cache because tend make changes in template / layout files reflected on frontend / website advised disable cache in development environment. don't in production. and coming index management, set "save on update" mode each time if make changes products, categories or attributes getting re-indexed automatically , avoids necessity re-index every time manually.

angularjs - $scope variable is undefined when it is set inside a function -

i have following example code in learning app. service job , pulls data out of page json code generated php, far good. service: (function() { 'use strict'; angular .module('app.data') .service('dashboardservice', dashboardservice); dashboardservice.$inject = ['$http']; function dashboardservice($http) { this.getformules = getformules; //////////////// function getformules(onready, onerror) { var formjson = 'server/php/get-formules.php', formurl = formjson + '?v=' + (new date().gettime()); // disables cash onerror = onerror || function() { alert('failure loading menu'); }; $http .get(formurl) .then(onready, onerror); } } })(); then call getformules function in controller , put data inside $scope.formuleitems , test if succeeded , 'o no'... $scope.formuleit

python - Find strings in list using wildcard -

i looking file names in list using wildcard. from datetime import date dt = str("rt" + date.today().strftime('%d%m')) print dt # rt0701 basically need find pattern dt + "*.txt" : rt0701*.txt in list: l = ['rt07010534.txt', 'rt07010533.txt', 'rt02010534.txt'] how can loop? you can use fnmatch.filter() this: import fnmatch l = ['rt07010534.txt', 'rt07010533.txt', 'rt02010534.txt'] pattern = 'rt0701*.txt' matching = fnmatch.filter(l, pattern) print(matching) outputs: ['rt07010534.txt', 'rt07010533.txt']

How Does Java List Global Variable Manage Insert, retrieve & Remove Items when many Insert/retrieve, remove functions are accessing it? -

ok, want store chat messages global variables instead of db because system not use relational db. uses nosql google datastore , write , read data datastore expensive. let see java list global variable public list mylist = new arraylist(); now have 3 functions: public void insert(){ mylist.add(string); } public void remove(){ mylist.remove(string); } public void retrieve(){ string str = mylist.get(i); // } suppose insert, retrieve , remove run concurrently every x seconds timer timer = new timer(); timer.schedule(new insert(), 0, 5000); timer.schedule(new remove(), 0, 3000); timer.schedule(new retrieve(), 0, 4000); if case, how java list global variable manage insert, retrieve & remove items when many insert/retrieve, remove functions accessing it? does adhere rules can know how control properly? arraylist not thread-safe , concurrentmodificationexception . use collections.synchronizedlist() instead.

php - duplicate page content after ajax to the same page -

i have simple registration formulae , want want firstly send ajax , without refreshing page control if insert correct data , redirect other page. problem after send through ajax same page working content of page being duplicate, can see twice... here ajax function registruj () { var name = $('#meno').val(); var priez = $('#priezvisko').val(); var log = $('#login').val(); var mail = $('#mail').val(); var cislotel = $('#cislo').val(); var heslo = $('#heslo').val(); var heslo1 = $('#heslo1').val(); $.post( "", { 'meno': name, 'priezvisko': priez, 'login':log, 'mail':mail, 'cislo':cislotel, 'heslo':heslo, 'heslo1':heslo1, }, function (data) { $('#result').html(data); } ); $('#nove').load(

c# - Using Linq to remove duplicate by column values based on a second column -

i have datatable 2 columns "dt" , "asof", both dates. there rows has duplicate values of dt, find doing: var duplicategroups = dt.asenumerable() .groupby(row => row.field<sqldatetime>("dt")) .where(g => g.count() > 1); but there column, "asof" want rid of 1 of duplicate dts based on "asof" value, ever asof date newest. i can think of loop able creating array of duplicates, finding newest asof, , removing others db table value. however, feel linq has ability able that, possibly comparator. have basic knowledge on it. any ideas? unless really need modify original datatable , create projection give records in each dt group has "newest" asof value: var rows = dt.asenumerable() .orderby(row => row.field<sqldatetime>("asof")) .groupby(row => row.field<sqldatetime&

python - Multiple consumers in same consumer group -

i have 1 producer , 1 consumers in same group (my-group). # send messages asynchronously producer = simpleproducer(kafka, async=true) producer.send_messages("my-topic", "async message") # consume messages, consumer1 consumer1 = simpleconsumer(kafka, "my-group", "my-topic") message in consumer1: print(message) simpleconsumer doesn't support consumer groups, should use kafkaconsumer instead.

c - Writing an integer to stdout in text form using only write() to do writing -

i'm trying write integer in stdout, in text form, write() function , possibly while/if. i want write integer out in text form, it's human-readable, write out in binary form : here tried : main.c : #include "my_put_nbr.h" int main() { my_put_nbr(43); return 0; } my_put_char.c : #include <unistd.h> int my_put_nbr(int nb) { write(1, &nb, sizeof(nb)); return 0; } so how can write integer out in text form write (or putchar) , conditions ? ps : must not use other libraries, can't use printf or whatever ! my github : link text mode , binary mode common in computer science, here reminder ones don't understand mean text form : on unix system, when application reads file gets what's in file on disk , converse true writing. situation different in dos/windows world file can opened in 1 of 2 modes, binary or text. in binary mode system behaves in unix. on writing in text mode, nl (\n, ^j) trans

javascript - How do I add labels to structures in three.js onMouseClick? -

how can add label structure using three.js library onmouseclick? in onmousedown event shoot ray , detect objects intersected. , can open div. please follow this question asked before.

Javascript functions in the rails 4 asset pipeline tree -

i'm trying utilize javascript function via chrome console when put javascript function within rails asset pipeline manifest. here steps i've take create , setup simple rails 4.2.4 app $ rails new javascriptexample $ cd javascriptexample $ rails g scaffold bear name:string $ rake db:migrate i edit app/assets/javascripts/bears.coffee , add console log , function. console.log("asset pipeline sucks") square = (x) -> x * x then fire server $ rails s i visit localhost:3000/bears , in chrome console see first line of code has worked. when attempt command square(5); in console receive error uncaught referenceerror: square not defined(…) why can not way when function loaded application.js ? this coffeescript compiled javascript (function() { var square; console.log("asset pipeline sucks"); square = function(x) { return x * x; }; }).call(this); from this : the var keyword reserved in coffeescript, , trigger syntax err

Convert part of the following chef recipe to Ansible -

i trying convert following chef recipe ansible. equivalent of ?.. familiar ansible. correct there going 3 directories created ?. such /usr/share/agentone/lib ; /usr/share/agentone/etc ; /usr/share/agentone/bin , of them have 0755 mode on ? if node[:platform_family] == 'debian' %w{lib etc bin}.each |dir| directory "/usr/share/agentone/#{dir}" mode '0755' owner 'root' group 'root' action :create recursive true end end directory '/var/log/agentone' directory 'var/run/agentone' link '/usr/share/agentone/logs' '/var/log/agentone' end template '/etc/init.d/agentone' owner 'root' group 'root' mode '750' source 'agentone.init.erb' variables( :version => node[:base][:agent][:agent_artifact][:version] ) end end what best way write in ansible ? the ansible version of this:

c# - MediaElement control doesnot display video only plays the audio of the video in the Grid App -

i'm using mediaelement control inside flipview of itemsdetail page of gridapp of windows 8 store app , i'm facing peculiar type of problem using it. mediaelement not displays video there's black screen on intended video output plays audio of video fine. now peculiar part of problem in grid app there collections of items in group (i know every 1 might know this, sake of getting myself clear) , first item of every group plays video fine mean displays video , audio fine, rest of items of group not displays video plays audio of video. 1 know why happening ? here xaml code : <flipview x:name="flipview" automationproperties.automationid="itemsflipview" automationproperties.name="item details" tabindex="1" grid.rowspan="2" itemssource="{binding source={staticresource itemsviewsource}}"> <flipview.itemcontainerstyle> <style targettype="flipviewitem"> <setter property=&

events - Inputting double digit numbers from keyboard on Tkinter, Python -

so i'm using following enable single digit numbers move numbered tiles on game board. however, can't use same method input double digit numbers. have idea, how make tkinter wait me input several digits 1 number? def key(event): if event.char.isdigit(): j, row in enumerate(board): i, char in enumerate(row): if char.get() == event.char: play(i,j) return root.bind('<key>', key) as mention in previous question - can put keys on list, wait moment , check if there 2 or more chars. import tkinter tk ''' catch 2 (or more) keys pressed in short time , tread 1 text ''' ''' http://pastebin.com/whqkcjkw ''' # --- functions --- # keys buffer keybuf = [] def test_after(): # check if buffer not empty if keybuf: # keys in buffer 1 text text = ''.join(keybuf) # clear buffer keybuf.clear()

java - Set image to random ImageView-Android -

i having annoying problem, because want set image random imageview in android. tell me how random imageview id. in advance probably need set random image imageview's src. so: need define sources image . may declare them this: int img1res = r.mipmap.img1id; int img2res = r.mipmap.img2id; ... then create random int: random r = new random (); int ra = r.nextint(5); when set 5 parameter in code above , states random numbers may 0, 1,2,3 , 4. then , may check random number switch statement : switch (ra){ case 0 : imgview.setbackgroundresource (img1res); break; case 1: imgview.setbackgroumdresource (img2res): break; case ...... .... }

java - Message in Eclipse: "The file cannot be found" -

Image
i don't understand why happening, click "aceptar" eclipse minimizes , impossible work on way. started happenning since started renaming components don't think problem, wouldn't it? of know why happens? because need finish project exam , still have lots of things do. in advance you renamed components, mean? did change class names? did change filenames? if 1 of above correct should refactor names. classname must identical file name. if isn't case ought post code have changed, caused ongoing problem. :) have nice day

Reading a Potentially incomplete File C++ -

i writing program reformat dns log file insertion database. there possibility line being written in log file incomplete. if is, discard it. i started off believing eof function might fit application, noticed lot of programmers dissuading use of eof function. have noticed feof function seems quite similar. any suggestions/explanations guys provide side effects of these functions appreciated, suggestions more appropriate methods! edit: using istream::peek function in order skip on last line, regardless of whether complete or not. while acceptable, solution determines whether last line complete preferred. the specific comparison i'm using is: logfile.peek() != eof i consider using int fseek ( file * stream, long int offset, int origin ); with seek_end and long int ftell ( file * stream ); to determine number of bytes in file, , therefore - ends. have found more reliable in detecting end of file (in bytes). could detect (end of record/line) eor ma

Union of two tables in MATLAB, only taking rows in one table -

suppose have 2 matlab tables: >> x = table({'a' 'b' 'c' 'd'}', (1:4)', 'variablenames', {'thekey' 'thevalue'}) x = thekey thevalue ______ ________ 'a' 1 'b' 2 'c' 3 'd' 4 >> y = table({'b' 'c'}', [998 999]', 'variablenames', {'thekey' 'thevalue'}) y = thekey thevalue ______ ________ 'b' 998 'c' 999 is there procedure (some type/combination of union/join/outerjoin maybe) returns me union of 2 tables, keeps rows 2nd table if there duplication according key choose ( thekey )? example, i'm looking have output: thekey thevalue ______ ________ 'a' 1 'b' 998 'c' 999 'd' 4

javascript - Dynamic object html - alternate between objects drawn by function on canvas and use range/slider to change pattern -

Image
i'm writing web app using html,javascript,css. i have made 2 dynamic functions, 1 draws triangles , other circles. when move slider creates pattern images drawn. when mouseclick on canvas changes triangles circles. the problem after change triangles circles clicking on canvas , try move slider image goes original (triangles). can click on canvas change triangles circles cannot change click. this want do: 1º - want click on canvas , change triangles circles , forth, alternate between figures click on canvas. 2º - after clicking on canvas alternate images - slider must change pattern created shown on canvas - , not go original unless click again on canvas. i provide code bellow. hope can take it. time. <html> <head> <meta charset="utf-8" /> <title>canvas</title> <style> .etiq1{font-family:verdana; font-size:15px;} #screen, #vect{border: 1px solid #000000;background-color:#0000ff;} input {text-