Posts

Showing posts from August, 2014

styles - Changing theme of entire Android application using RadioButtons -

hello have 4 custom defined styles in styles.xml , trying use radiogroup in order select overall style of entire application. <style name="bluetheme" parent="android:theme.light.notitlebar.fullscreen"> <item name="android:windowbackground">@color/blue_background</item> <item name="android:textcolorprimary">@color/blue_text</item> </style> <style name="redtheme" parent="android:theme.light.notitlebar.fullscreen"> <item name="android:windowbackground">@color/red_background</item> <item name="android:textcolorprimary">@color/red_text</item> </style> <style name="greentheme" parent="android:theme.light.notitlebar.fullscreen"> <item name="android:windowbackground">@color/green_background</item> <item name="android:textcolorprimary">@color/green_text...

salt stack - How do I make saltstack wait for 200 OK? -

i have following state: healthy: cmd.run: - name: echo 'true' - onlyif: "curl -i http://127.0.0.1:{{ port }} 2>/dev/null | head -n 1 | awk '$2 ~ /200/ { print \"true\" }" - require: - docker: running the problem checks once , exits, how make waits timeout until gets 200 otherwise exits? while $(curl -i http://localhost:8080/ 2> /dev/null | awk '/200 ok/ { exit 1 }'); count=$(expr $count + 1); sleep 1; [ "$count" -ge "60" ] && exit 1; done

mysql - How can I select columns return with joins method in Active Record without associations? -

i working on rails model, mapped on external (non default) database table. i need make join obtain data need instantiate object. i using active record's functions: self.joins("left outer join accounts on accounts.code = customers.code").select("customers.code, accounts.email, accounts.firstname, accounts.password_hash").where('accounts.code = ?', my_param)[0] the model class is: class user::customer < user self.establish_connection :external_db self.table_name = "customers" attr_accessor :password_hash attr_accessor :firstname attr_accessor :email end this query does: select customers.code, accounts.email, accounts.firstname, accounts.password_hash `customers` left outer join accounts on accounts.code = customers.code (accounts.code = '11111111') so query right, object: #<user::customer id: nil, code: "11111111"> has attributes of table. expected that, because set attr_accessor of ...

php - What if after getting paykey for website paypal api, transaction will complete by user with their paypal account? -

take example , have website have integrated paypal api shopping cart , if user proceed transaction , after received paykey paypal api call. , need redirect page paypal. in between or after redirect if user/customer go own account in paypal , complete transaction paypal admin panel. how i(my website) notified transaction completed initialized (originated website payment page) payment purchases. you can send return url in paypal form send paypal before user payment. input must have name=return , can assign return url if user cancel payment. <?php echo '<input type="hidden" name="return" value="'.$dir_ok.'"> '; echo '<input type="hidden" name="cancel_return" value="'.$dir_error.'"> '; ?>

mongodb - Finding number of inserted documents in a bulk insert with duplicate keys -

i'm doing bulk-insert mongodb database. know 99% of records inserted fail because of duplicate key error. print after insert how many new records inserted database. being done in python through tornado motor mongodb driver, doesn't matter much. try: bulk_write_result = yield db.collections.probe.insert(dataarray, continue_on_error=true) nr_inserts = bulk_write_result["ninserted"] except pymongo.errors.duplicatekeyerror e: nr_inserts = ???? <--- should put here? since exception thrown, bulk_write_result empty. can (except concurrency issues) count of full collection before , after insert, don't roundtrips database line in logfile. there way can discover how many records inserted? regular insert continue_on_error can't report info want. if you're on mongodb 2.6 or later, however, have high-performance solution error reporting. here's complete example using motor's bulkoperationbuilder: import pymongo.errors tornado...

java - WARNING: No mapping found for HTTP request with URI [/projectShaun/home] in DispatcherServlet with name 'DispatcherServlet' -

this question has answer here: why spring mvc respond 404 , report “no mapping found http request uri […] in dispatcherservlet”? 3 answers when start console no errors, when try access following url: http://localhost:8080/projectshaun/home following error: no mapping found http request uri [/projectshaun/] in dispatcherservlet name 'dispatcherservlet dispatcherservlet-servlet: <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://ww...

jquery - Background image scroll smoothly to certain (x,y) point -

i built 'window' div , larger image (its map of world) behind it, user can "grab" , scroll direction. next goal let user choose country , map center around country. since custom map need input coordinates self, no problem here. right (for demo purposes) created point image centers. transition immediate, how can scroll smoothly x,y point using jquery animate property? right now, how scroll points: var country_1 = new position(-700,-800); $("button").click(function(){ country_1.apply(document.getelementbyid('draggableelement')); }); fiddle you can use animate method animate change: var anim = {}; if(!isnan(this.x)) anim.left = this.x; if(!isnan(this.y)) anim.top = this.y; $(element).animate(anim, 1000); demo: http://jsfiddle.net/3gskot27/3/

ruby - net::scp copy/overwriting folder -

say copy folder f_1 local machine target machine m_1 /tmp directory mf_1 . console: [root@m_1 tmp] ls -a | grep mf_1 # => doesn't exist irb: options = {recursive: true} net::scp.upload!(host, user, '~/f_1', '/tmp/mf_1', options) console: [root@m_1 tmp] ls -a | grep mf_1 # => folder exists, fine # then, if try overwrite existing folder... irb: net::scp.upload!(host, user, '~/f_1', '/tmp/mf_1', options) console: [root@m_1 tmp] ls -a | grep mf_1 # => folder exists [root@m_1 tmp] cd mf_1 [root@m_1 m_f1] ls # => f_1 => /tmp/mf_1/f_1 so, instead of mf_1 being overwritten folder copied inside of /tmp/mf_1 , resulting in /tmp/mf_1/f_1 . the question pretty simple, how preserve behavior it's consistent , calling net::scp.upload!(host, user, '~/f_1', '/tmp/mf_1', options) twice in row act same way both when folder exists , doesn't? i ended adding dot, if source dir. not ideal, here's ex...

dependency injection - PHP DI/IoC Container configuration for every object in Application or? -

i have 1 question: need configure di/ioc container every object in application or configure factories ? now have this: 'servicefactory' => function() use ($container) { return new \application\core\factory\servicefactory($container->get('entityfactory'), $container->get('repositoryfactory'), $container->get('cache'), $container->get('file'), $container->get('image')); }, 'repositoryfactory' => function() use ($container) { return new \application\core\factory\repositoryfactory($container->get('database'), $container->get('querybuilder'), $container->get('mapper'), $container->get('language')); }, 'entityfactory' => function() use ($container) { return new \application\core\factory\entityfactory($container->get('language')); }, but then, application loads unnecessary objects other objects not needed. example: in blogserv...

javascript - Angular-redactor: How to setup blur callback? -

the situation: i using angular-redactor editor app. everything working fine except 1 thing. need fire blur event ask confirmation user in case want leave page without saving. the code this redactor textarea: <textarea cols="30" rows="30" ng-model="body" ng-blur="confirmation_email_exit()"redactor=" { minheight: 370, focus: true, plugins: ['fontcolor', 'table', 'fullscreen', 'counter', 'fontfamily'], }"> </textarea> this example of global options working: app.config(function(redactoroptions) { redactoroptions.buttons = ['formatting', '|', 'bold', 'italic']; }); the question: how can fire blur event angular-redactor? i have call in view or setup global option? just use redactor's blurcallback, , can use both in view , in redactoroptions: <textarea cols="30" rows="30...

jquery - How to make synchronous call to google direction api for requesting the services on serverside? -

how json google directions api using jquery? i need make requests "eithel" has mentioned in above link because making multiple requests , need responses , need continue. if use requests services clientside, there delays 1 next response , asynchronous, time responses, next set of codes have been executed , don't want happen. if use requests services serverside through ajax, can make synchronous , workout. "geocode" "distancematrix", getting error "no 'access-control-allow-origin' header present on requested resource. origin 'null' therefore not allowed access". there workaround, please me this. i trying find distance between addresses , put them in matrix, 2 ways, 1 "requests services clientside" window.finddistance = function(){ var distance = 0; var matrixlength = address.length; distancearray = new array(matrixlength); (var = 0; < matrixlength; i++) { distancearray[i] = new array(matrixlength); } ...

c# - Best way to get an ordered list of groups by value from an unordered list -

i'd know if there's more efficient way ordered list of groups value unordered list, using groupby() followed orderby() , this: list<int> list = new list<int>(); ienumerable<ienumerable<int>> orderedgroups = list.groupby(x => x).orderby(x => x.key); for more detail, have large list<t> i'd sort, there lots of duplicate values want return results ienumerable<ienumerable<t>> , groupby() returns ienumerable of groups. if use orderby() , ienumerable<t> , no easy way know whether value has changed 1 item next. group list sort groups, list large ends being slow. since orderby() returns orderedenumerable can sorted on secondary field using thenby() , must internally distinguish between adjacent items same or different values. is there way can make use of fact orderedenumerable<t> must internally group results value (in order facilitate thenby() ), or otherwise what's efficient way use linq ordered list ...

Failed to connect to Dockerized elasticsearch via java-client -

i setup elasticsearch container official repo elasticsearch docker image. run with docker run -dp elasticsearch easy , worked. ps info is container id image command created status ports names 658b49ed9551 elasticsearch:latest "/docker-entrypoint. 2 seconds ago 1 seconds 0.0.0.0:32769->9200/tcp, 0.0.0.0:32768->9300/tcp suspicious_albattani and can access server http-client via port 32769->9200 baihetekimacbook-pro:0 baihe$ curl 10.211.55.100:32769 { "status" : 200, "name" : "scorpia", "cluster_name" : "elasticsearch", "version" : { "number" : "1.4.5", "build_hash" : "2aaf797f2a571dcb779a3b61180afe8390ab61f9", "build_timestamp" : "2015-04-27t08:06:06z", "build_snapshot" : fa...

Draw circle and rectangle in java -

i new java , want draw circle , rectangle using java code. did write code purpose , tried @ own. on panel appearing , shapes not appearing. code of "mypanel" given below import javax.swing.*; import java.awt.*; public class mypanel extends jpanel{ public void paincomponent(graphics g){ super.paintcomponent(g); graphics2d g2 = (graphics2d)g; g2.drawrect(20,20,20,20); g2.setcolor(color.blue); g2.filloval(50,20,20,20); g2.drawstring("hello world", 120, 50); }//end paincomponent }//end test class cdoe of driver class "test" given below. import javax.swing.*; import java.awt.*; public class test{ jframe f; mypanel p; public test(){ f = new jframe(); container c = f.getcontentpane(); c.setlayout(new borderlayout()); p = new mypanel(); c.add(p, borderlayout.center); f.setsize(400,400); f.setvisible(true); f.setdefa...

Docker list only stopped containers -

docker gives way of listing running containers or containers including stopped ones. can done docker ps \ docker ps -a do have way of listing container have been stopped. only stopped containers can listed using: docker ps --filter "status=exited" or docker ps -f "status=exited"

jquery - Fetch week number and week start & end date using bootstrap datepicker -

bootstrap datetimepicker there option available fetch week number , week start , end date calendar. demo link $('#datetimepicker1').datetimepicker({ format: 'dd/mm/yyyy', calendarweeks:true }); something similar html5 week attribute <input type="week"/> i rely on moment provide data looking for, day of week , format functions http://momentjs.com/docs/#/get-set/day/ http://momentjs.com/docs/#/displaying/format/ see fiddle examples started http://jsfiddle.net/spasticdonkey/9lnbp7pw/3/ $('#datetimepicker1').on('dp.change', function (e) { var kk = $("#datepicker").val(); $("#output").html( "week number: " + moment(kk, "dd/mm/yyyy").week() + " of " + moment(kk, "dd/mm/yyyy").weeksinyear() ); $("#output2").html( "day of year: " + moment(kk, "dd/mm/yyyy").dayofyear() ); ...

javascript - Clone an element without the children in jQuery -

i have table , want clone without children. note simplified markup brevity, table has many properties , event handlers want copy. <table data-x="..." class="a b c"> <tr>...</tr> <tr>...</tr> <tr>...</tr> . . . </table> i don't want copy delete children afterwards, i'm not sure think it's not efficient. i don't think can clone element without it's children using jquery can plain javascript. node.clonenode() . won't copy attached event listeners clonenode

asp.net - How to use the map from maps.google.ae (map for UAE) instead of map from maps.google.com -

i use following google map api snippet in asp.net application retrieve latitude , longitude of selected point user. this code show map same https://www.google.com/maps/@25.3812696,58.4464073,6z . instead of map '.com', want see map '.ae'. that map same https://www.google.ae/maps/@25.3812696,58.4464073,6z . both maps google based on country. there way achieve ? <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>location tracking</title> </head> <body> <script type="text/javascript"src="http://maps.googleapis.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> window.onload = function () { var mapoptions = { center: new google.maps.latlng(24, 54), zoom: 14, maptypeid: google.maps.maptypeid.roadmap }; var infowindow = new google.maps.infowindow(); var latlngbounds ...

javascript - Using react-router get data via ajax and pass to next route -

i have auth page, when click submit button data via ajax,then transition , pass data next route login.coffee handlecommit: (event) -> event.preventdefault() $.ajax({ dosomething... }) .done (data) -> this.transitionto 'dashboard',{data:data} but transitonto can't use in async block.so try fix it handlecommit: (event) -> event.preventdefault() this.transitionto 'dashboard' willtransitionfrom: (transition, component, callback) -> $.ajax({ dosomthing... }) .done (data) -> # transition.redirect('dashboard', null, {data:data}) callback() the part 1, problem this.transitionto can't use in async block. part 2, looks fine, via willtransitionfrom hook can data via ajax , transition path. but, aim pass data path too, transition.redirect dosen't work. how can data via async function, correct redirect , pass it? thanks reply

ssrs 2008 r2 - Cannot dynamically insert image into Word document -

we using officewriter 8.6.0 ssrs 2008 r2 generate word documents .rdl's. the word docs being generated in office 2003 format (.doc) the .rdl's created in vs2008, , edited in word via officewriter add-in. .rdl's deployed reporting website, , program runs report , saves resulting byte[] word document. this process working fine, there request change documents include logo in header. logo retrieved table in database @ runtime, there multiple logos of 1 chosen based on existing report parameter. the images .gifs stored in varbinary(max) column. i have followed method shown on softartisan's wiki page , in using image modifier section (without optional size args) when document generated, no image appears in header. does have idea might going wrong?

java - cannot add dynamic jtextfields and save their values -

in previos questions asked similar questions this. in previous projects used gui builder, add jtextfield panel dynamically without builder. don't why reason cannot execute code: public class reference { jframe frame = new jframe(); jpanel mainpanel = new jpanel(); mainpanel main = new mainpanel(); jpanel subpanel = new jpanel(); jbutton addbutton = new jbutton(); jbutton savebutton = new jbutton(); private list<jtextfield> listtf = new arraylist<jtextfield>(); /** * @param args command line arguments */ public static void main(string[] args) { new reference(); } public reference() { frame.add(main); frame.setlayout(new borderlayout()); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.add(addbutton, borderlayout.east); frame.add(savebutton, borderlayout.west); frame.pack(); frame.setsize(500, 300); frame.setvisible(true); ...

vim - How to customize solarize for gvim? -

i have solarized installed , looking great. 1 thing want differently want cursorline increases contrast, instead of decreasing it. seems should able put... hi cursorline guibg=#000000 ... in .vimrc, , indeed, if enter command, works expected. putting in file has no effect. i've tried both before , after "colorscheme solarized." the :hi command must issued after last colorscheme command executed during startup. since plugins shouldn't this, it's in ~/.vimrc . closely; it's unnecessary overhead configure multiple colorschemes; last 1 wins, anyway. if switch colorschemes dynamically, you'd need hook via autocmd colorscheme * hi cursorline guibg=#000000

Object Required Error MS Access SQL -

i'm stuck in sql statement in vba coding. i'm trying complete update query dlookup may not have written code correctly. want workerid , workername come dlookup userid used data here getnextassignee("program", "language", "username") . i'm getting object required error here: "update cfrrr,attendance set assignedto = " & getnextassignee("program", "language", "username") & ", assignedby = " & forms!supervisor!navigationsubform!assignedby.value & ", dateassigned = #" & & "#, actiondate = #" & & "#, workername = " & dlookup(attendance.username, "attendance", "username = userid") & ", workerid = " & dlookup(attendance.userid, "attendance", "workerid = userid") & " cfrrrid = " & rs!cfrrrid here's full code context: set db = currentdb strsql ...

css - How to fix blurry image -

i created test landing page using bootstrap: http://ubersnap.netai.net if visit site , @ iphone screenshot see can hardly read text on screen. however, if resize browser window , maximize windows original size, 100% sharp. why happening? there way make picture sharp first time loads instead of resizing browser window? the image gif if makes difference. try css make image edges crisp. .crisp-edges { image-rendering: -moz-crisp-edges; /* firefox */ image-rendering: -o-crisp-edges; /* opera */ image-rendering: -webkit-optimize-contrast; /* webkit (non-standard naming) */ image-rendering: crisp-edges; -ms-interpolation-mode: nearest-neighbor; /* ie (non-standard property) */ }

meteor - Serving a vCard (.vcf) file through Iron Router -

i'm trying wrap head around how can deliver file through iron router. here trying accomplish: 1) user opens url http://website.com/vcard/:_id 2) meteor generates vcard file begin:vcard version:3.0 n:gump;forrest;;mr. fn:forrest gump org:bubba gump shrimp co. title:shrimp man photo;value=url;type=gif:http://www.example.com/dir_photos/my_photo.gif tel;type=work,voice:(111) 555-1212 tel;type=home,voice:(404) 555-1212 adr;type=work:;;100 waters edge;baytown;la;30314;united states of america label;type=work:100 waters edge\nbaytown\, la 30314\nunited states of ameri ca adr;type=home:;;42 plantation st.;baytown;la;30314;united states of america label;type=home:42 plantation st.\nbaytown\, la 30314\nunited states of ame rica email;type=pref,internet:forrestgump@example.com rev:2008-04-24t19:52:43z end:vcard 3) user gets .vcf file , runs on phone, outlook, etc. thanks! it has little iron router. need can return simple text file. here demo kind of that: http://mete...

html - Delete Button in PHP isn't Working -

i'm trying add php button on site, doesn't seem working. the delete php script is; if(isset($_post["delete"])) { $delquery = "delete emails id=$_post["delete"]"; mysqli_query($connection, $delquery); } and form looks on same file; <form action="email-response.php" method="post"> <input type="hidden" name="hidden" value="<?php echo $row['id']; ?>"> <input type="submit" name="delete" value="delete"> </form> however whenever clicked delete button nothing happening. in relation reply saying $connection function wrong, here function working fetching information posts. define("db_server", "myservername"); define("db_user", "myusername"); //username define("db_pass", "mypassword"); //password define("db_name", "mydbname"); // da...

android - Using findViewById() inside a for loop for multiple checkboxes -

if have many checkboxes ( more 50 ) , there way use mapping of checkboxes , inside loop ? , how assign int inside findviewbyid(int). something : - (array of checkboxes) for(int i=0 ; i<=99; i++) checks[i] = (checkbox)findviewbyid(what-about-this-int-id); you can resource id's dynamically using getresources().getidentifier(..) : https://stackoverflow.com/a/14058142/1715829

sql - How to GROUP BY a new index in a new VIEW -

i have 2 tables (load+road) , want make new view creating new column (flag) indexate count of lines, , group new index. have tried this: (but doesnt work) sprintf(my_cmd, "create view myview(id, rlength, llength, flag) " "select road.id, road.length, load.length, count(*) flag road, load " "where road.id=load.id; " "select id, rlength, llength myview" "group flag"); error: error executing query: error: column "road.id" must appear in group clause or used in aggregate function i using sql. *edit: i dont want new column (flag) appears in last select, want group it.. dont know if can done. if not, thing wanna reach, use group on "select id, rlength, llength " , lines in 1 group, dont have common parameter between thees lines have trying add "flag" the full code (sorry long question): sprintf(my_cmd, "create view myview3(id, rlength, llength, flag) as" " select road.id, roa...

autocomplete - GooglePlacesAutocompleteAdapter (Android Places API) returning results outside of boundary -

it seems sample code google demonstrates google places api android returning results outside of given boundary. ( https://github.com/googlesamples/android-play-places/ ). searching 'hardware' shows results sydney (the hardcoded boundary), (occasionally) shows results far away other cities (including western australia!). i've implemented googleplacesautocompleteadapter in own code , have found similar results. seems boundary field guideline search; can confirm this? this may or may not related, know whether results returned places.geodataapi.getautocompletepredictions same results can expected similar call web services places api? few tests seems web services call returns better results (closer location, more relevant, , overall more results). api docs not seem shed light on -- guess perhaps getautocompletepredictions query performed on 'name' of place rather in 'keyword' search per web service api implementation. thanks help. as per develo...

BIOS rewrite on x86 -

my question rather simple, yet couldn't find out answer. how write on bios memory chip ? allright, write data io devices on x86 (or whatever), process seems accessing io device through port-mapped or memory mapped io. me, modern bios flash memory chip io device, , if writable, must through process. coreboot opensource replacement pc bioses, however, believe uses flashrom rewrite bios chip code, , flashrom proprietary, wonder why hard write bios can't find reliable answer how it. in x86 market there 2 kind of devices: ones standard interface , ones without. case fall in second category. to write flash rom have send specific command specific address. have rom chip of 1kb, responds read requests 000h 0fffh. can send write requests, chip won't consider them. cannot write f-rom read it. have send write command writing, say, 55h address aah , sending page want reflash followed writes data. proprietary interface (there efforts standardize it) , have simplified...

java - Reading values assigned to annotated field -

i new java 8 , spring mvc . have java bean pojo setter , getter. spring web service using reflection maps request parameters pojo. want input validation using annotation. have requirement need read values of annotated field , check atleast 1 value provided. wrote sample code.... not sure how values assigned field. please share sample code if have: public boolean isvalid(string object, constraintvalidatorcontext constraintcontext) { boolean canproceed = false; for(field field : documentsearchrequest_global.class.getdeclaredfields()) { if (field.isannotationpresent(validdocumentmodifieddate.class)) { string name = field.getname(); //iam able name of field system.out.println("1.name : "+ name); system.out.println("2. "+field.gettype().getname()); } } // method[] method = documentsearchrequest_global.class.getdeclaredmethods(); (method me...

c# - Unit test failing assertion in async unit test -

i trying unit test async code. using nunit switch xunit can't tests working. here example code working nunit tests simplified sake of asking question: [testfixture] public class tests { [test] public async task usingasynctask() { // arrange pubsubevent<object> pubsubevent = mock.create<pubsubevent<object>>(); // act await task.run(() => { pubsubevent.publish(new object()); }); // assert mock.assert(() => pubsubevent.publish(null), args.ignore(), occurs.once()); } } add following nuget packages.config: <?xml version="1.0" encoding="utf-8"?> <packages> <package id="justmock" version="2015.1.224.3" targetframework="net45" /> <package id="nito.asyncex" version="3.0.0" targetframework="net45" /> <package id="nunit" version="2.6.4" targetframework="net4...

javascript - The transition doesn't work on the .line elements, they change property but the transition is not applied. Is there any ways to enable it? -

i'm trying create width animation on .line div's, defined 70%/40% 10%. i've added transition .line class (and i've tried add everywhere), , doesn't work, width changing, no transition used. how 1 enable transition on class dynamically added? i'm using uilang dynamically add .hide class, when .more button has class .hide, lines change width. i've added codepen see whats going on. (i've pulled part current project, sorry ugliness). if click less button, .more button appear again. <a class="more">more <div class="more-line"> <div class="line line-70"></div> <div class="line line-40"></div> <div class="line line-40"></div> </div> </a> remove display: block; line 36

android - GCM not delivering Amazon SNS -

i've set aws server , android app push notifications using gcm , sns. the app registers successfully, i.e. broadcastreceiver gets notification registration id. problem no sns notifications go through. is there way check if notification received device, not delivered broadcastreceiver reason? also, maybe i've done wrong (possibly package name)? here manifest: ... <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="my.package.tester" ... > <permission android:name="my.package.permission.c2d_message" android:protectionlevel="signature" /> <uses-permission android:name="my.package.permission.c2d_message" /> <uses-permission android:name="com.google.android.c2dm.permission.receive"/> ... <application ... > <service android:name="my.package.path.to.pushnotificationsservice" > </service> ... <receiver android...

openshift - Action hooks in python: no output -

i've been working on openshift app action hooks written in python. the action hooks run, , work, can not output display when create app. when run rhc app create ... app created, none of status or debug messages try output ever display. the code gets called this: b = library.object() b.build() i have tried: adding logging function object , adding b.showlog() code above. print "message value: {0}".format(variable) inside build hook script print >>sys.stderr, "something bad happened: '{0}'...".format(return_code) inside build hook script when i've written action hooks in bash, echo ... works fine. this exact question doesn't seem have been answered before, though there questions that superficially similar . you don't action hook output during app create. see during "git push" when update code. suggest having output write log file in ~/app-root/data directory instead can view later. also, if...

Returning array in Javascript function after splitting string -

very new javascript , not understanding why tutorial isn't accepting code answer... challenge create function returns array after breaking string separate words. here's have far: function cutname(namestr) { var newarray = namestr.split(' '); return newarray(); } this seems work when called, example returning following when given string "hello work" argument: [ 'hello', 'does', 'this', 'work' ] what heck doing wrong here? shouldn't above code suffice answer? you need remove parenthesis return newarray; . when learning javascript, might want tools jsbin , give lot of helpful feedback , realtime results. javascript function cutname(namestr) { var newarray = namestr.split(' '); return newarray; } var arr = cutname('hello work'); console.log(array.isarray(arr)); console.log(arr); console output true ["hello", "does", "this", "work"] ...

Informix DB error -

i updating couple of rows in table in informix database , not know may cause of error. query: update device set name = 'test_destination' pkid in (select d.pkid numplan n join routepartition rp on rp.pkid = n.fkroutepartition join devicenumplanmap dnpm on dnpm.fknumplan = n.pkid join device d on dnpm.fkdevice = d.pkid join routelist rl on rl.fkdevice = d.pkid join routegroup rg on rg.pkid = rl.fkroutegroup , n.tkpatternusage = 5 d.name='sme_rl' ); the error message is: error: soapenv:clientcould not update row in table.-346could not update row in table.executesqlupdate i tried google error , couldn't information: says 'might occurred because of unexpected error hardware errors or locking conflicts in database'. not sure how proceed don't have idea error. find kind of error in query or thoughts error?

java - Difference between Iterables.tryFind and FluentIterable.firstMatch in Guava -

is there difference between? myobject mywantedobj = iterables.tryfind(mylistofobjects, new predicate<myobject>() { public boolean apply(myobject myobj) { return myobj.getsomeattribute().equals(somefinalvariable); } }).ornull(); and myobject mywantedobj = fluentiterable.from(mylistofobjects).firstmatch(new predicate<myobject>() { public boolean apply(myobject myobj) { return myobj.getsomeattribute().equals(somefinalvariable); } }).ornull(); iterables.tryfind , fluentiterable.firstmatch javadoc equals to: returns optional containing first element in iterable satisfies given predicate, if such element exists. i missing something? iterables.tryfind() pre-dates fluentiterable.firstmatch() quite bit. if you're doing single operation (as in example), doesn't matter use. never have created iterables class if had created fluentiterable first (hindsight 20/20). the power of fluentiterable comes when you...

Oracle - display all within next 12 months -

i trying pull data within next 12 months only. thing can find online "addmonths" can't it, not sure if it's because date in start_date column dd/mm/yyyy? select number, start_date wo_table start_date between sysdate , addmonths(sysdate,12) select "number", start_date wo_table start_date between sysdate , add_months( sysdate, 12 ); or select "number", start_date wo_table start_date between sysdate , sysdate + interval '1' year;

angularjs - Why does not wotk routeProvider in Angular JS? -

i use routeprovider in angular js: .when('/chat/dialog/:id', { controller: 'chatcontroller' }); in controller have: if($routeparams.id) { alert('ok'); } and url looks as: http://site-dev.com/chat/dialog/1 link is: <a href="/chat/dialog/1"></a> why not work routing in angular js? controller: .controller('chatcontroller', ['$scope', '$sce', '$http', '$location', '$anchorscroll', '$timeout', '$routeparams', function ($scope, $sce, $http, $location, $anchorscroll, $timeout, $routeparams, ) { if($routeparams.id) { alert('ok'); } }]) routing: .config(function ($locationprovider, $routeprovider) { $routeprovider .when('/profile/personal/:type', { templateurl: '/public/html/personal.html', controller: 'editprofilecontroller' }) ...

c# - How can I get the value of a dynamically created checkbox when the submit button is clicked? -

i have asp.net page has 2 controls on it, placeholder , submit button. during page_load create checklist of tasks dynamically. each row consists of description, link tutorial, , checkbox. of information in row kept in database. if database says task has been checked, code sets checked property true. problem i'm having when submit button clicked cannot find value of checked property of checkboxes on page(about 23 total). here code create checkboxes... checkbox = new checkbox(); phchecklist.controls.add(checkbox); if (item.attributes.contains("ree_completed")) checkbox.checked = (bool)item.attributes["ree_completed"]; checkbox.enableviewstate = true; checkbox.clientidmode = system.web.ui.clientidmode.static; checkboxid = "checkbox" + (string)item.attributes["ree_sectionnumber"].tostring() + (string)item.attributes["ree_sequencenumber"].tostring(); checkbox.id = checkboxid; here code try , find value of checkbox... forea...

Makefile error on C program "expected ‘)’ before ‘{’ token" -

i error when try make makefile on following c program. int main() { char filename_src[101], filename_dest[101]; printf("\nsource file: "); gets_s(filename_src, 100); printf("\ndestination filename: "); gets_s(filename_dest, 100); if(copy_file(filename_src, filename_dest) == 0) printf("copy successful\n"); else fprintf(stderr, "error during copy!"); copyfile( filename_src, filename_dest ); } int copyfile( const char *test1, const char *test2 ) { int infile, outfile; ssize_t nread; char buffer[bufsize]; if( ( infile = open(test1, o_rdonly) ) == -1 ) return (-1); if( ( outfile = open(test2,o_wronly|o_creat|o_trunc,perm ) == -1) { close(infile); return (-2); } /* read test1 bufsize chars @ time*/ while( (nread = read(infile, buffer, bufsize) ) > 0) { /*write buffer output file*/ if( write(outfile, buffer, nrea...

Decompressing an XML in python from an API request -

i trying use api https://neweden-dev.com/zkillboard_api in python. my code works point: import xml.etree.elementtree et import urllib2 import gzip import zlib url = 'https://zkillboard.com/api/kills/characterid/95089021/xml/' request = urllib2.request(url) request.add_header('accept-encoding', 'gzip,deflate') data = urllib2.urlopen(request) after point, confused. contents = data.read() f = open("export.xml","w") f.write(contents) f.close() above first step. opening file made me realize compressed (duh). so point tried 2 things: f = open("test.xml.gz", "w") f.write(data.read()) f.close() g = gzip.open("test.xml.gz", "rb") file_content = g.read() g.close() which gives me error: traceback (most recent call last): file "c:\users\[filepath]", line 19, in <module> file_content = g.read() file "c:\python27\lib\gzip.py", line 254, in read self._rea...

javascript - Removing item from collection does not trigger remove event -

i have collection listener on remove event. this.listento(this.collectionfiltered, 'remove', this.render, this); i pass collection new view var siteinfoview = new siteinfoview({model: site, parentcollection: this.collectionfiltered}); and remove model it. this.parentcollection.remove(this.model); this doesn't seem trigger event handler, , i'm not sure why. i've verified event doesn't fire creating listener: this.listento(this.collectionfiltered, 'remove', function() {console.log('remove event');}, this); i have thought because i'm trying trigger events across views, i'm able catch changes model passed second view first one. know event firing on this.collectionfiltered first view because view changes reflect model has been removed. can see i'm missing here? update: siteinfoview initialize: initialize: function(options){ this.listento(this.model, 'change', this.render, this); this.parentcollec...

git - Best practices for using docker in an air-gapped environment -

i'm new docker, , use in air-gapped environment. understand can set own repository inside isolated system, don't know how many docker images need docker hub environment. if download them .zip or .tgz archive, great, don't see way hub. can't use docker outside isolated environment. may able use git outside air-gapped environment, getting .zip archives better. advice on how started appreciated. you can following produce archive file image on hub: docker pull image:tag docker save image:tag -o file.tar then transfer file.tar air-gapped machine , do: docker load -i file.tar if have air-gapped network, rather single machine, it's better idea set own registry within network contains curated images.

Docker container access to swarm IPs -

when running docker containers swarm cluster containers have access ips of cluster nodes via env variables or otherwise? i want run elasticsearch instance on each node in swarm cluster. , discovery each other in unicast mode. therefore each elasticsearch instanc needs configured list of ips in cluster. if mean container of 1 node can access container's ip of other node , not possible . have use weave tool connect container across different node or other tool .

objective c - Array reduplication not working -

xcode problem. have nsmutablearray pulling json objects. example company: name, state, address, phone number, etc. i pulling info fine. , want display 1 of each state in table view. works fine shows multibles of same state. want show 1 of each state. using code not return states. have seen lot of examples , should work returns nothing. if skip code below show states. have tried loop. , tried array nsset. nothing working. ideas??? problem code... //create states array...remove duplicate states here nsarray *statesarray = [companies valueforkeypath:@"@distinctunionofobjects.state"]; return statesarray; here whole code. please been struggling week. @interface statestableviewcontroller () @property (nonatomic) nsstring *name; @property (nonatomic) nsstring *state; @end @implementation statestableviewcontroller nsarray *companies; nsarray *statesarray; - (void)viewdidload { [super viewdidload]; nsstring *address = @"http://www.compani...