Posts

Showing posts from February, 2010

Google Analytics Reporting API V4 php fatal error -

dose meet error when calling $analytics->reports->batchget($body); please me. catchable fatal error: argument 1 passed react\promise\promise::__construct() must callable, null given, called in /path/to/google-api-php-client/vendor/react/promise/src/deferred.php on line 25 , defined in /path/to/google-api-php-client/vendor/react/promise/src/promise.php on line 16 this php vision issue. vision 5.4.19, vision higher 5.4.45 it's work

Scrolling is not smooth while using 3 recyclerviews inside nestedscrollview in android -

i have 3 recyclerviews in single layout file have horizontally aligned layoutmanagers , these recyclerviews inside nestedscrollview , i've set nestedscrolling each of 3 recyclerviews false too. <?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/framelayout" android:background="@drawable/background"> <android.support.v4.widget.nestedscrollview android:layout_width="match_parent" android:layout_height="wrap_content"> <linearlayout android:id="@+id/linearlayout" android:layout_width="match_parent" android:layout_height="match_parent" an

node.js - Nodejs google oAuth2 invalid credentials -

Image
i have following piece of code allows user create google calendar events. check if user has access token set, if not initiate regular oauth2 authorisation process , + save access token , refresh token inside user profile. subsequent request allow user create calendar events via access token set in profile. here code: function getnewtoken() { const authurl = oauth2client.generateauthurl({ access_type: 'offline', scope: scopes }); return authurl; } module.exports = { insert(req, res, next) { user.findbyid(req.user._id, (err, user) => { if (user.accesstoken) { oauth2client.setcredentials({ refresh_token: user.refreshtoken }); const calendar = google.calendar('v3'); calendar.events.quickadd({ auth: oauth2client, calendarid: 'primary', text: 'test calendar' }, (err, data) => { if (err) {

javascript - What is the difference between "selectRootElement" and "createViewRoot" -

in "renderer" section, official documentation not specify... "not yet documented" url selectrootelement selects root element dom: selectrootelement(selector: string): element {...} while createviewroot creates shadowdom root @ hostelement : createviewroot(hostelement: any): {...} you can see difference in source code .

angular - Angular2: Delete element from the list animation -

i have simple list (tasks) cards (task). when delete task, confirmation dialog called. if user confirms deletion, http call made. if it's successful variable isdeleted set true , send list item toggling class. here encounter few problems: if click on item , not delete (on confirmation choose 'no'), , click on item , delete - both of these items class (why? id's different). <div class="vb-task-card" [ngclass]="{'vb-deleted': task.id === selecteditemid && isdeleted}"> // here comes rest of layout <button (click)="ondeletetask(task)"> delete</button> </div> if user clicks on button following function called: public ondeletetask(task) { this.selecteditemid = task.id; this.deletetask.emit(task); } how add fade out animation item delete? p.s. if need more code or full code - let me know! thanks in advance! so, i've figured out. isdeleted setted

c++ - how to use gdb to debug a GUI program -

i know how debug console program, if program has gui? example, there calc icon, when push down, call methods. want know methods call. have source codes have no idea file corresponds what, , want back-track codes implement if click on icon. there conceptually isn't difference between debugging gui application , console application - both come down procedural programming - action calls particular function. there's no difference whether trigger of action pressing button on gui, or typing in command in console. can use debugger both of them (visual or command line). if have source, , know triggering mechanism is, should easy enough follow along in source code see functions called trigger (eg. not @ runtime). have question tagged qt , uses connect function connect 'signals' (events) either other signals or 'slots'. associates callback function, particular event, searching source starting place.

c# - Proper usage for MvxFileDownloadCache.Clear -

i'm trying cleanup unwanted http image data have loaded via mvximageviewloader. i've found function clear in filedownloadcache seems need. var downloadcache = mvx.resolve<imvxfiledownloadcache>(); downloadcache.clear(_imagechart1viewloader.imageurl); periodically calls function (once second looks of it) deletes files in private list private readonly list<string> _todeletefiles = new list<string>(); clear adds image url list. except once call function i'm still able see image. i.e. stays in memory. so need know place calling clear , using in correct way. call every time exit detailview downloads image url. mvvmcross v4.2.2 (latest)

reactjs - React Tutorial - Cannot read property 'toString' of undefined -

i need learn react in next day , started official tutorial. until state of code getting error , not sure how around it: </head> <body> <div id="content"></div> <!-- script type="text/babel" src="scripts/example.js"></script --> <script type="text/babel"> var commentbox = react.createclass( { render: function() { return ( <div classname = "commentbox"> <h1>comments</h1> <commentlist /> <commentform /> <comment /> </div> ); } }); var commentlist = react.createclass({ render: function () { return ( <div classname = "commentlist"> <comment author = "michael johnson">this 1

broadcastreceiver - How to make android application listen to specific NFC chip? -

i'm creating application action if hit nfc chip , know following information nfc in android please correct me if wrong you can't register actions of nfc receiver in manifest file , activities . each nfc chip has it's own unique id . what want is while application in background or it's closed , if hit nfc chip id (ex 1234) app lunched , action. is possible ? if yes, how can achieved? edit here code , open when check nfc chip , action android.nfc.action.tech_discovered when open action android.intent.action.main mainactivity.java public class mainactivity extends appcompatactivity { public static final string action_check_in= "checked"; public static final string action_check_out= "unchecked"; private nfcadapter mnfcadapter; boolean ischeckedin = false; private static final string tag = "mainactivity"; @override protected void oncreate(bundle savedinstancestate) { super.oncre

sql server - Insert into sql Max +1 only numbers (prevent characters) -

i'm using code (select (max(code) +1 isnumeric([code]) = 1) i want max +1 numbers of column preventing characters characters. note: question tagged mysql when answer posted. you can use substring_index() split values , re-unite them: (select concat(substring_index(max(code), '-', 1), '-', substring_index(max(code), '-', -1) + 1 ) . . . code '%new-1%' ) this assumes wildcards not have hyphens in them, , values after "1" numbers. also, doesn't pad number zeroes, idea such codes -- ensures same length , sort correctly.

c# - Xamarin-Monogame cross platform on Windows, using Visual Studio -

i trying organize monogame project in way simplify cross-platform targeting. however, since working on windows, xamarin studio doesn't offer "monogame universal app" or "monogame/ios" templates, templates shared projects , android projects : xamarin studio on windows not include ios templates. developers working on windows need add code files project-specific android project or manually add either pcl or shared code project. since monogame project, feel of game logic , drawing should abstracted through monogame classes. if create new android solution in xamarin studio, creates single project contains main activity along game class references mono.android , opentk directly. furthermore, included about*.txt files imply should accessing resources through designer-built resource class, tied directly android. otoh, if create "shared monogame xamarin project" in xamarin studio, it's empty (only game1 template class, not reference mon

Docker find all layers in an image -

docker has changed it's backend , "docker history" command no longer shows layer ids of layers in image. more details here: https://github.com/docker/docker/issues/20131 although understand why it's showing "missing", still havent found new way extract information i'm looking for. know how can find layers in image? i'd able cross-reference layers on different images know when layer used more once service, why used id shown in history command until recentely. any appreciated, thank you.

c++ - Parse elements from array in json file using boost -

i have json file looks this: { "type": "2d", "data": [ [ "26", "17", "1" ], [ "13", "29", "1" ], [ "13", "30", "1" ], .... in data, each array have meaning need assign variable each 1 (in loop), like: int first = 26; int second = 17; int third = 1; i doing (i defined before v): boost_foreach(boost::property_tree::ptree::value_type &v2, v.second.get_child("data")) { boost_foreach (boost::property_tree::ptree::value_type& itempair, v2.second) { cout << itempair.second.get_value<std::string>() << " "; } } } just print each variable, handle have them set, not eac

html - Image + Text in DIV and keep aspect ratio -

i have following requirements: i need div image + text inside. the div should keep aspect ratio , images inside of divs should have same height (to this, use: maintain aspect ratio of div css ). the image inside of div should stretched in order fill parent div . i prepared jsfiddle i have 2 main issues: as can see, left div higher, because has text inside. collides padding-bottom: 150% -approach used preserve aspect ratio of divs when size changed. goal, however, divs have same size no matter if/how text have inside. moreover, change opacity of background image when hover div. however, text-opacity should not change. think can achieved via js. how? add text position:absolute .inner-text{ position:absolute; width:100%; height:100%; text-align:center; z-index:1; } .event:hover .inner-text{ background:rgba(255,255,255,0.5) } <div class="bit-3"> <div class="event" style="background-image: url(https://c

datastax - CsvReporter not spitting out metrics in cassandra -

i have added following file on cassandra node /etc/dse/cassandra/metrics-reporter-config.yaml csv: - outdir: '/mnt/cassandra/metrics' period: 10 timeunit: 'seconds' predicate: color: "white" usequalifiedname: true patterns: - "^org.apache.cassandra.metrics.cache.+" - "^org.apache.cassandra.metrics.clientrequest.+" - "^org.apache.cassandra.metrics.commitlog.+" - "^org.apache.cassandra.metrics.compaction.+" - "^org.apache.cassandra.metrics.droppedmetrics.+" - "^org.apache.cassandra.metrics.readrepair.+" - "^org.apache.cassandra.metrics.storage.+" - "^org.apache.cassandra.metrics.threadpools.+" - "^org.apache.cassandra.metrics.columnfamily.+" - "^org.apache.cassandra.metrics.streaming.+" and added line etc/dse/cassandra/cassandra-env.sh ​

android - GCM notification results=[error=NotRegistered] -

i using node gcm. the notifications working fine in devices of customer. phones have issue not notifications after time period. after checking logs saw below error in calls. {"multicast_id":7040074623564131000,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"notregistered"}] i not canonical_ids 1 or above, response or on responses before it. i followed steps mentioned in canonical registration id , message id format , did not canonical ids in response. in phones, gcm works fine i'm not sure how proceed here , debug. notregistered - message, say, there no gcm device registered passed id. check id. you must send push notifications on devices, registered in gcm , in app (via developer console). you can test different rest clients postman. send data on special url using json.

C# ASP.NET WebApi route template not working with uri parameters -

i have asp.net webapi application following controller , route: webapiconfig.cs var constraintresolver = new defaultinlineconstraintresolver(); constraintresolver.constraintmap.add("validdate", typeof(dateconstraint)); controller.cs [httpget] [route("deleted/{from:validdate?}/{to:validdate?}", name = "getdeleteddata")] [swaggerresponse(httpstatuscode.ok, type = typeof(ienumerable<simpleclass>), description = "response")] public async task<httpresponsemessage> get( [fromuri]string = "", [fromuri]string = "" ) { } constraint public class dateconstraint : ihttprouteconstraint { public bool match( httprequestmessage request, ihttproute route, string parametername, idictionary<string, object> values, httproutedirection routedirection ) { object value; if (!values.trygetvalue(parametername, out value))

routing - Rails 4.2+: deep nesting resources when it's required to display data from entire resource chain -

i'm familiar guideline not nest more 1 level deep, , understand various discussions having shortest urls possible both in , out of code. most of stackoverflow questions , googling i've done answer presenting use cases 1 doesn't have access elements in entire chain. but do when have access parent resources further chain every page you're working with? /{account_slug}/applications/{application_uuid}/borrower/employments/{uuid} when dealing single employment record, have display account-specific information take parent account object via account_slug , application information. , technically, borrower db query, since there 1 each application, don't have add id/slug in url. general advice like: /employments/{uuid} but if that, in controller code (and elsewhere) still have do: @employment = employment.find_by(uuid: params[:uuid]) @account = @employment.borrower.application.account so have walk entire parent association chain , execute association

Qt: Correct implementation of floating widgets -

Image
i've inherited class qwidget. no code, changes editor. the way use it: focuswidget = new focuswidget(this); //this points mainwindow focuswidget->show(); focuswidget->hide(); now widget appears (it looks ugly because of bad 4k scaling), @ top left corner of mainwindow. intend use application full screen. is usage correct? how can make floating widget? if want multiple widgets that, how can control position?

How to save and stop MS Office process with powershell? -

i need close word/excel/powerpoint documents taskbar powershell script. stop-process kills process doesnt save changes made. need save , close document. able word following script: $wd = [runtime.interopservices.marshal]::getactiveobject('word.application') $wd.documents | % { $_.close() } get-process | ?{$_.processname -eq "winword"} | stop-process when same excel , powerpoint error message , changes not saved. excel have done follows: $excel = [runtime.interopservices.marshal]::getactiveobject('excel.application') $excel.activeworkbook | % { $_.close() } get-process | ?{$_.processname -eq "excel"} | stop-process for powerpoint: $ppt= [runtime.interopservices.marshal]::getactiveobject('powerpoint.application') $ppt.presentations | % { $_.close() } get-process | ?{$_.processname -eq "powerpoint"} | stop-process error displayed is: + $excel.activeworkbook | % { $_.close() } +

php - Return nested keys in mongodb -

i'm tying nested keys mongodb record structured : { "_id" : objectid("ju5ts0m3h4shf0r3x4mpl3"), "statuses" : { "f1r5t1d1n33dt0f1nd" : { "ko status" : [...], "ok status" : [...] }, "s3c0nd1d1n33dt0f1nd" : { "ko status" : [...], "ok status" : [...] }, "th1rd1d1n33dt0f1nd" : { "ko status" : [...], "ok status" : [...] } } the output expect : [ "f1r5t1d1n33dt0f1nd", "s3c0nd1d1n33dt0f1nd", "th1rd1d1n33dt0f1nd", ] i need ids only , because under "ok status" , "ko status" large amounts of data, impact performance. i searched through mongo doc , so, found nothing. how query php mongoclient and/or plain mongodb queries ? it possible ? try use array_keys() li

html - How to position the check box inside li element to center? -

i have list of items div content , span check box. want position check box span center of li element. <li class="e-list e-state-default e-list-check"> <div class="cont-bg"> content here varies </div> <span > <input class="e-lv-check e-checkbox e-js e-input" type="checkbox"/> </span> </li> content loaded dynamically height , width varies. couldn't set padding positioning. tried on positioning using vertical-align well. nothing worked. .e-list.e-state-default { background-color: #fff; border-color: #c8c8c8; } .e-list { border-bottom: 1px solid #c8c8c8; font-size: 12px; } .cont-bg { font-size: 17px; height: 100px; padding-left: 5px; padding-top: 10px; width: 80%; display: inline-block; } .e-list .e-lv-checkdiv { float: right; } .e-list { border-bottom: 1px solid #c8c8c8; font-size: 12px; } .e-list { line-height: norma

validation - Override Bootstrap Material Design event listener for <input> element -

i have angular2 component uses bootstrap material design look'n'feel @component({ selector:'inputcustom', template:` <div class="form-group label-floating has-error"> <label class="control-label" for="input">type here</label> <input class="form-control" id="input" type="text"> <p class="help-block">some error text</p> <span class="material-input"></span> </div> `}) class inputcustom{....} i use angular2 track field changes , want control visuals of component manually i.e. when in error state applying class 'has-error' outer <div> element. currently when apply class 'has-success' angular2 controller component, bootstrap overrides class 'has-error' . how can override/stop bootstrap md tracking validation/input events on <input> elements?

How to calculate number of years per country in R? -

this question has answer here: numbering rows within groups in data frame 3 answers what easiest way calculate number of years per country in r? please see sample below. 1) how can create "#years" variable? observation period in real data 1990 2010, years ordered ascendingly. 2) also, possible start "0", instead of "1"? country year #years 2000 1 2001 2 2002 3 b 2000 1 b 2001 2 b 2002 3 here 1 option ave base r years <- with(df1, ave(year, country, fun=seq_along)) if need start 0 years <- years -1 df1$years <- years an option using data.table library(data.table) setdt(df1)[, years := seq_len(.n), country]

apriori algorithom in machine learning in action -

the apriori algorithom def apriorigen(lk, k): #creates ck retlist = [] lenlk = len(lk) in range(lenlk): j in range(i+1, lenlk): l1 = list(lk[i])[:k-2]; l2 = list(lk[j])[:k-2] l1.sort(); l2.sort() if l1==l2: #if first k-2 elements equal retlist.append(lk[i] | lk[j]) #set union return retlist l3 = [frozenset([0, 1, 2]), frozenset([0, 1, 3]), frozenset([1, 2, 4])] l4 = apriorigen(l3, 4) print l4 the result : [frozenset([0, 1, 2, 3])], the algorithm right? why [frozenset([0, 1, 2, 4])] not including?

unity3d - UI prefabs: buttons does not retain onclick() settings -

i have simple prefab, made prefab button , panel. button placed inside panel child of panel. did save prefab , good. then, did add click event on button; did add gameobject script want use placed, , select correct method use. did update prefab , deleted scene. now, when instantiate prefab in scene resources.load("myuiprefab"); show correctly panel, button , colors/settings. but there nothing connected click button itself; result in button doing nothing. isnt' prefab, way save object used @ later time? in case should retain click settings. bug or unfortunate implementation of new unity ui system? makes little sense make prefab out of button or gui element, if click() or other delegate not filled. gameobjects stored in prefab can hold references other objects inside same prefab, or other prefabs. true object references, events, whatever. if want event persist, must have event handler in same prefab , have called button. can simple handler method raise

Spring security Basic authentication with Token authorization -

i want provide token based authorization spring rest application based on basic authentication. a login/token request (post /path/to/login) => basic authentication , return token all other requests => token authentication how can that? (spring 4.x) although spring getting started guide here - https://spring.io/guides/gs/securing-web/ relates spring boot. pretty applicable basic spring 4.x

azure - AZCopy between storage accounts and keep access rights -

suppose operation between storage accounts: azcopy /source: https://sourceaccount.blob.core.windows.net/mycontainer1 /dest: https://destaccount.blob.core.windows.net/mycontainer2 /sourcekey:key1 /destkey:key2 /pattern:abc.txt in mycontainer1 have permission "blob ..", in mycontainer2 permission becomes "private ..." . there way prevent happen / force same permission on "new" container? azcopy doesn't support this. it's designed transferring blobs/files. need reconfigure permission of destination container yourself.

Use a combination of SHA1+MD5 -

i'm trying use secure way create checksum files (larger 10gb !). sha256 secure enough me algorithm process expensive , not suitable. know both sha1 , md5 checksums insecure through collisions. so think fastest , safest way combining md5 sha1 : sha1+md5 , don't think there way file (collision) same md5 , sha1 both @ same time . so combining sha1+md5 secure enough file checksum? or there attack collision ? i use c# mono in 2 way (bufferstream , without bufferedstream) public static string getchecksum(string file) { using (filestream stream = file.openread(file)) { var sha = new sha256managed(); byte[] checksum = sha.computehash(stream); return bitconverter.tostring(checksum).replace("-", string.empty); } } public static string getchecksumbuffered(stream stream) { using (var bufferedstream = new bufferedstream(stream, 1024 * 32)) { var sha = new sha2

javascript - Java - ScriptEngineManager nashorn Math.random does not work -

i call follow function functionname "random" , parameter "1 , 50". private string callfunction(string functionname, string[] parameter) throws filenotfoundexception, scriptexception, nosuchmethodexception { scriptenginemanager engine = new scriptenginemanager().getenginebyname("nashorn"); engine.eval(new filereader(mypath + functionname + ".js")); invocable invocable = (invocable) engine; object result; if (parameter == null) { result = invocable.invokefunction(functionname); } else { result = invocable.invokefunction(functionname, parameter); } system.out.println(result); return (string) result; } the content of random.js looks like: function random(min, max){ return math.floor(math.random() * (max - min +1)) + min; } the results never between 1 , 50. more 100. if use not in java works. work math nashorn/javascr

c - change the nodes of a linked list -

the code list nodes is: struct list{ int value; struct list *next; }; i want make swap function this: void swap(struct list *head , int v) user gives number v , program search in list , changes next node. example if user gives 3 , list contains :2 -1 7 3 -5 4 swap function make list :2 -1 7 -5 3 4 ideas ? i made following code swap : void swap(struct list *head, int v){ struct list *before=null; struct list *found=null; struct list *after=null; if(head==null){ printf("case of empty list !\n); } before=head; found=head; while(found->next !=null){ if (found->value==v){ after = before->next; before = found->next; } before = found; found = found->next; after = found->next; } return; } try way : search int v in linked list till

authorization - Nest auth: An error occured. Connecting to xx is currently unavailable -

my app has been running fine several months, since yesterday when me or else tries log app using webview gives error: an error occured. connecting appname unavailable. please contact me more information. this happens after fill in email/password , press on accept. does else experience issue, or know way solve it? users error message when have exceeded quota. if @ product on developer.nest.com see limit on tokens has been met. in order continue add users, need submit product review nest. once approved, token limit increased.

In C++, macro usage before semicolon in function declaration -

can please explain me following code: #ifndef some_def #define some_def #endif class base_class{ public: base_class() some_def; ~base_class() some_def; bool init(int arg1, int arg2) some_def; }; i not able understand usage of macro after every function. regards, navnish in case, nothing, unless some_def defined somewhere else, example: #define some_def { cout << "default definition" << endl; } if some_def defined that, every function in class includes some_def have body.

installation - ClickOnce - installing an app gives 'Cannot Start Application' error -

i have simple windows application want distribute through website running on azure. publish app locally first , manually copy on artifacts web server @ location ../fold/apps/tools publish location: c:\users\myusername\documents\publish installation folder url: https://somewebsite/fold/apps/tools/ update location same installation folder. the files copied on "application files" folder, myapp.application, publish.htm , setup.exe. now log onto website , download app using https://somewebsite/fold/apps/tools/myapp.application clickling on downloaded files shows me 'cannot start application' popup. clicking on details button shows following error in log file. sources deployment url : file:///c:/users/myusername/downloads/myapp.application deployment provider url : https://somewebsite/fold/apps/tools/myapp.application error summary below summary of errors, details of these errors listed later in log. * activation of c:\users\myusername\download

javascript - In 'Visual Studio 2015 Test Explorer', getting Message: Uncaught SyntaxError: Unexpected token import -

i using karma, jasmine in visual studio 2015 update 2 run unit test application. i have used 'karma test adapter' so. my karma.conf.js is: module.exports = function (config) { config.set({ // base path used resolve patterns (eg. files, exclude) basepath: '', // frameworks use // available frameworks: https://npmjs.org/browse/keyword/karma-adapter frameworks: ['jasmine'], // list of files / patterns load in browser files: [ { pattern: 'src/test/app.component.spec.js', included: true }, { pattern: 'src/**/*spec.ts', included: false }, { pattern: 'src/**/**/*spec.ts', included: false }, { pattern: 'src/**/**/**/*spec.ts', included: false }, { pattern: 'node_modules/zone.js/dist/zone.js', included: true, watched: false }, { pattern: 'node_modules/zone.js/dist/long-stack-trace-zone.js', included: true, watched: false }, { pattern: '

php - Multiple Image Upload only uploading one image in Symfony 3? -

i'm building function upload multiple images our website, , far have upload form: <?php namespace tyson\adminbundle\form; use doctrine\orm\entityrepository; use symfony\component\form\abstracttype; use symfony\component\form\formbuilderinterface; use symfony\component\form\extension\core\type\submittype; use symfony\component\form\extension\core\type\filetype; use symfony\component\form\extension\core\type\integertype; class iutype extends abstracttype { public function buildform(formbuilderinterface $builder, array $options) { $builder->add('id', integertype::class); $builder->add('image', filetype::class, array( 'attr' => array( 'multiple' => 'true', 'data_class' => null ) )); } public function getname() { return 'iu'; } } this displayed on twig file this: <div class="ta

c# - N-Tier Architecture using ASP.NET 5 ( MVC 6 ) -

Image
i reading asp.net core features , decide transfer current solution ( mvc 5 ) mvc 6 got little bit confused regarding integrated di. have architecture cemamanager ( representative layer ) has reference helpers, resource, viewmodel , bll. bll has reference viewmodel, database , dll. dll has reference database. typical n-tier architecture using di , repository pattern. when investigate mvc6 there startup.cs di initialize. means if want separate bll , dal have reference mvc6 , logic go thru layer? time it's gonna heavy , hard maintain , scale or wrong? is there way export startup.cs or di method layer? maybe know articles read or examples? personally have few things change overall structure, i'm guessing full design review isn't you're asking for. on actual question, no - other layers not need reference mvc. for application, ioc needs configured , initialized in presentation layer. presentation layer needs reference chain (direct or indirect refe

java - URLConnection receive wrong text from php server -

i have app has 4 activities.in first activity want request text website (php file). first time press button data works fine in next times press button, returns correct text concatenates previous text.see example: first press: returns: "abc" second press: returns: "abcabc" (must return abc) third press: returns: "abcabcabc" (must return abc) . i clear text view each time. i close connection each time. i close bufferedreader each time. i close. activity1: try{ url u = new url(uu); httpurlconnection con = (httpurlconnection) u.openconnection(proxy.no_proxy); con.setdooutput(true); con.setusecaches(false); printstream pr = new printstream(con.getoutputstream()); pr.print("code=3&arg1=" + str); bufferedreader br = new bufferedreader(new inputstreamreader(con.getinputstream(),"utf-8")); string l; while ((l=br.readline())!=null){ z = z + "\n" + l; } br.close();

localization - Not able to read strings from region specific folders in Android -

i trying override locale configuration in app. but, not able differentiate between language , regions. i trying following code override locale. getting locale override. example : "de_de", "de_at" public static locale getlocalefromstring(@nonnull final string locale) { string[] split = locale.split("_"); if (split != null || split.length > 1) { string language = split[0]; string country = split[1]; return new locale(language, language, country); } return locale.getdefault(); } the structure of resource folders is: values/strings.xml (default strings) values-de-rde/strings.xml values-de-rat/strings.xml if, define values-de/strings.xml, application start reading folder. means locale overriding works in app, how android system not able read string region specific folders. (my device language english.) any appreciated. the arguments passed location&#

winrt xaml toolkit - Tint an Image Universal app -

is possible tint image color(universal app)?. winrtxamltoolkit sounds promising (colorextensions). there 0 documentation tho. you use colorextensions add hue overlay image, runs on cpu , pixel shader better choice. i'm not sure lumia imaging sdk uses, sounds might have need.

java - EJB timer ignores TransactionTimeout -

i have ejb timer in ear, deployed on jboss 6.4. in 99% of cases timer works fine, takes bit long finish , throws persistenceexception: transaction rolled in different thread! . i have found due transacion timeout value low. not want edit default value rather override method-specific timeout. solve split functionality 2 methods: 1 method annotated @timeout , 1 work. here timer implememntation: @singleton public class mytimer implements sometimerinterface { @ejb private somemanager mymanager; @resource private timerservice timerservice; private timer timer; @override public void starttimer() { // timer scheduled fire every 7th minute scheduleexpression schedule = new scheduleexpression(); schedule = schedule.hour("*").minute("*/7").second("00"); timerconfig config = new timerconfig(); config.setpersistent(false); timer = timerservice.createcalendartimer(schedule, co

android - What actual viewport size are the Samsung S6 and Samsung S7 mobile phones? -

i trying optimise latest , newest samsung models. for s5 display 1080x1920 432 dpi resolution, 3dppx. translates 360x640w viewport. is there way work out viewport if have display , resolution details only? it depends on browser user's using. chrome frame consumes around 60px, given status bar 25px, can assume have 85px less actual size. i recommend using javascript window.innerheight proper measurement. sources: - https://mydevice.io/devices/ - height of status bar in android

string - Comma Separated Integer between 1-9999 Regex -

i'm struggling come regex list of integers separated comma , ranging between 1-9999. this have far: "(^[1-9][0-9]{3}|[1-9][0-9]{2}|[1-9][0-9]|[1-9](,[1-9][0-9]{3}|[1-9][0-9]{2}|[1-9][0-9]|[1-9])*)$" i don't want allow spaces , should't end in comma, should allow: 1,2,9999 1 43,5 an integer netween 1 , 9999 can matched (?:[1-9]|[1-9][0-9]{1,3}) that synonymic [1-9][0-9]{0,3} details : [1-9] - digit 1-9 range | - or [1-9][0-9]{1,3} - integer 10 till 9999 . or [1-9] - digit 1-9 range [0-9]{0,3} - 0 3 digits so, list of integers separated comma can witten as: \a(?:[1-9]|[1-9][0-9]{1,3})(?:,(?:[1-9]|[1-9][0-9]{1,3}))*\z or shorter version \a[1-9][0-9]{0,3}(?:,[1-9][0-9]{0,3})*\z here regex demo explanation : \a - unambiguous start of string [1-9][0-9]{0,3} - integer regex block (?: - beginning of non-capturing group match 0 or more sequences of: , - comma [1-9][0-9]{0,3} - 1 till 9999 intege

python - How do I link accounts in the Google Adwords API using just a customer ID? -

i'm having hard time understanding google's api documentation , hoping here. to me, extremely new developer, google api documentation makes no sense whatsoever. i using google adwords python library, , code may useful: https://github.com/googleads/googleads-python-lib/blob/b80b8b3741a55f1d00c5974bc58f92540663c6f6/examples/adwords/v201603/account_management/create_account.py . however, need link existing account extending invitation , marking pending. i'm not trying create new account. so begin writing in python? don't understand documentation , need create account based on given customer id. tips , tricks great! to link existing account mcc account, need use managedcustomerservice , mutatelink method. in python, this: # create service object managed_customer_service = client.getservice('managedcustomerservice', version='v201605') # construct operation, operator "add" , status "pending" results in new invitation

autohotkey - No decode delegate error in AHK while using ImageMagick -

in windows when run convert.exe source.tif -compress group4 output.pdf there no error , output created successfully. however, when use autohotkey error: error: 0x80041771 - source: imagemagickobject.magickimage.1 description: convert: 420: no decode delegate image format `' @ error/constitute.c/readimage/508: convert: 410: no images defined `' @ error/convert.c/convertimagecommand/3235: my code: im := comobjcreate("imagemagickobject.magickimage.1") im.convert(22_2r.tif,-compress group4,niach.pdf)

Android alert dialog text is not visible -

hi using custom theme customize alert dialog.my problem when ever set background color color texts become invisible.here code <style name="customdialogfragment" parent="android:theme.dialog"> <item name="android:windownotitle">true</item> <item name="android:windowbackground">@android:color/transparent</item> <item name="android:background">@color/black</item> <item name="textcoloralertdialoglistitem">@color/white</item> </style> any appreciated , in advance you need set <item name="android:textcolor">#54d66a</item> // add hex color code edit you should use android:textcolorprimary <item name="android:textcolorprimary">#54d66a</item>

xml - How to grab element by index when elements have different parents -

this question has answer here: how select specified node within xpath node sets index selenium? 4 answers i trying grab elements of index 3 , 4 in following xml: <automated> <group> <test><id>testid</id>...</test> <test>...</test> <test>...</test> <!-- 3? --> </group> <test>...</test> <!-- 4? --> </automated> as far aware, expression //x used grab elements type x . expression attempting use grab 3rd , 4th elements is: //test[3] , //test[4] however, element //test[4] not return anything. upon further investigating, i've realized //test[1] return both elements 1 , 4. first child of first element, , second (first test?) child. is there way achieve want do? the other thing can think of (since i'm using in c# , have acc

python - update figure inside loop -

i'm new python matplotlib , want make figure updated in loop. simple test code. want draw 3 graphs, each 2 seconds, different slopes each time. of course, know should read more matplotlib need quick. wrong below? thanks! #!/usr/bin/env python import matplotlib.pyplot plt import numpy np import time def demo(a): y = [xt*a+1 xt in x] ax.plot(x,y) if __name__ == '__main__': plt.ion() fig, ax = plt.subplots() ax.set_ylim([0,15]) x = range(0,5) in range(1,4): demo(a) time.sleep(2) i thought plt.ion() makes interactive , ax.plot(x,y) take effect instantly (but guess not). tried adding ax.draw() after ax.plot(x,y) requires arguments artist or don't know yet :). also, have error message coming (ubuntu 14.04.lts). xlib: extension "xinputextension" missing on display ":1.0". x error: baddrawable (invalid pixmap or window parameter) 9 major opcode: 62 (x_copyarea) resource id: 0x0 edit : add