Posts

Showing posts from March, 2011

java - Regex to add digit between delimiter characters if missing -

i didn't use regex lot , need little bit of help. have situation have digits separated dot char, this: 0.0.1 1.1.12.1 20.3.4.00.1 now ensure each number between . has 2 digits: 00.00.01 01.01.12.01 20.03.04.00.01 how can accomplish that? thank help. you can use string.split() accomplish this: public static void main(string[] args) { string[] splitstring = "20.3.4.00.1".split("\\."); string output = ""; for(string : splitstring) { if(a.length() < 2) { = "0" + a; } output += + "."; } output = output.substring(0, output.length() - 1); system.out.println(output); }

SOLR XML Import combining multiple children -

i'm attempting load xml solr using dataimporthandler, , have no problems getting data in, need transforming format. have tried can think of , googled possible solutions, , stuck. source xml looks this: <authorlist completeyn="y"> <author validyn="y"> <lastname>mohammed</lastname> <forename>arshed abdulhamed</forename> <initials>aa</initials> </author> <author validyn="y"> <lastname>haris</lastname> <forename>sallehuddin mohamed</forename> <initials>sm</initials> </author> <author validyn="y"> <lastname>nuawi</lastname> <forename>mohd zaki</forename> <initials>mz</initials> </author> </authorlist> and end this: <str name="author_1">arshed mohammed</str> <str name="author_2">sallehuddin mohamed

Open button's image on Android when button is visible -

Image
i have large canvas placed multiple buttons. each button has image opened based on button click event. want change such way when button enters screen area, automatically open button image. i guess need find current button view (that visible on screen) , use functions simulate button click event ( view.performclick(); ). not entirely sure, suggestion highly appreciated. can try take both view button view , image @ same position, when click on button view view hide , show image.

ios - Querying the User table with a users objectId queried from another table -

i'm trying query user table users objectid queried table. here's code: func queryfriendstable() { var queryfriends = pfquery(classname: "activity") queryfriends.wherekey("type", equalto: "friend") queryfriends.wherekey("fromuser", equalto: pfuser.currentuser()!) queryfriends.includekey("touser") var queryusertable = pfuser.query() queryusertable!.wherekey("objectid", matcheskey: "touser", inquery: queryfriends) queryusertable!.findobjectsinbackgroundwithblock { (objects: [anyobject]?, error: nserror?) -> void in if error == nil { // find succeeded // found objects if let objects = objects as? [pfobject] { object in objects { self.friendnamesarray.addobject(object["username"]!) println(self.friendnamesarray) } } }

meteor - Private files not showing up on github -

i using github version control , heroku app hosting. app built using meteor js. app folder has folder called private , contains .json files. pushed master copy onto github, files in private folder not there. steps: git add . git commit -m 'push master' git push origin master i checked private folder after following these steps files not there. have confirmed files in local private folder. can help? thanks!

html - Giving src of img tag dynamically from asp:fileupload control -

this looks quite challenging , may impossible way want.i have html image (img tag) , want use image upload asp:fileupload control.i facing lot of problems way out me @ moment.i have tried below : <img id="target" alt="[example]" runat="server" /> with code-behind : target.src = "~/images/" + filename; dont worry filename,it works fine.the image gets uploaded , works fine.but cropping disabled since image still on server.so, how can use image on client side? other suggestions? can give src of img dynamically using eval? use image control , set image in server side. or cliente side, check this solution !

Using multiple Scala TypeClass instances in function parameters -

i created group of case classes want implement different behaviors using scala typeclass. code sample below works expected. case class querybuilder(s: string) abstract class a() case class b() extends case class c() extends abstract class s() case class x() extends s case class y() extends s trait buildablequery[t] { def toquery(p: t): querybuilder } implicit object bquerybuilder extends buildablequery[b] { def toquery(p: b): querybuilder = { querybuilder("query of b") } } implicit object cquerybuilder extends buildablequery[c] { def toquery(p: c): querybuilder = { querybuilder("query of c") } } implicit object xquerybuilder extends buildablequery[x] { def toquery(p: x): querybuilder = { querybuilder("query of x") } } implicit object yquerybuilder extends buildablequery[y] { def toquery(p: y): querybuilder = { querybuilder("query of y") } } def toquery[a: buildablequery](value: a): querybuilder = (implicitly[buildablequery[a

python - translate() function error -

the translate function giving me error i'm giving 2 members , should passing 1. correct code based on books i'm using currently. i'm using python 3.4. import string fhand=open("c:\python34\leos code\mbox.txt") dictsort = dict() #decorate dictionary line in fhand: line = line.translate(none, string.punctuation) line = line.lower() words = line.split() word in words: if word not in dictsort: dictsort[word]= 1 else: dictsort[word] += 1 #sort dictionary dictlst = [] k,v in dictsort.items(): dictlst.append((v,k)) dictlst.sort(reverse=true) k,v in dictlst[:10]: print (k,v) a line of code should added , translate line modified: remove_punctuation_map = dict((ord(char), none) char in string.punctuation) line = line.translate(remove_punctuation_map) there change in python 3.x tuple needs passed translate function, needs created in dictionary before , passed translate method.

c# - Use two identical classes/interfaces under different namespaces interchangeably? -

i'm writing web application want allow 3rd party developers write "plugins" can loaded application modify behaviour standard. so conventional wisdom suggest having this: public interface iplugin { void execute (iplugincontext context); } third party developers can implement interface, monkey around context, register code application execute (usually attached message , pre/post condition). my problem how expose these interfaces. simplest thing seems create myapplication.sdk library has interfaces , classes want expose. means main application needs reference library, sdk being used build application, sounds little back-to-front. is there anyway have iplugin interface in both applications , main web application use sdk's iplugin interface if own? in both identical? when build pluginable system, interfaces , supporting classes want expose plugin authors contract between , plugin authors. therefore, right both application , plugins reference sa

mysql - Update a range of post dates with SQL query in phpMyadmin -

i trying update number of post(around 7000) in wordpress database post dates within range of dates using sql query: update `wp_posts` set post_date="2015-07-22 20:31:30" post_date between '2015-07-31 00:00:00' , '2015-12-14 00:00:00' , post_status="publish" i need find posts has dates 2015-07-31 00:00:00 2015-12-14 00:00:00 , update them 2015-07-22 20:31:30 , make them published my server running sql server 5.5.44 what doing wrong here? thanks in query you're selecting posts publish status instead of update them publish . try query instead: update `wp_posts` set post_date="2015-07-22 20:31:30", post_status="publish" post_date between '2015-07-31 00:00:00' , '2015-12-14 00:00:00' , post_type = "post" i added post_type condition don't want change revisions or other posts type.

c# - How to implement ReadXml for SomeClass : IList<IFoo> where all instances of IFoo are IFoo<T> of varying T -

i have class need serialize/deserialize, , i'm half way there - have serialization functional, resulting in below xml. however, since i'm implementing ixmlserializable myself, i'm uncertain implementation of readxml should like, given somegenericclass<t> serialized using attribute-based flagging rather explicit implementation if ixmlserializable <?xml version="1.0" encoding="utf-16"?> <foocontainer fooname="dosomething"> <somegenericclassofstring xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" value="foobar" name="firstparam" description="first paramater serialized" /> <somegenericclassofint32 xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" value="10000" name="nextparam" description="second serialized parameter&

javascript - Href in <a> not working properly -

i having issues href's on web page. when page loads, check screen width, , if small enough mobile changing href of tags in header. here javascript looks like. $(function () { var hrefs = [$('#btn_services').attr('href'), 'http://jdcservices.ca' + '#mobileservices']; $(window).on('resize', function () { $('#btn_services').attr('href', function () { return hrefs[$(window).width() > 1240 ? 0 : 1]; }); }).trigger('resize'); } this code changes href /services.aspx page #mobileservices div. below header changing. <a href="#" id="logo"></a> <nav> <a href="#" id="menu-icon"></a> <ul> <li><a id="btn_home" href="/index.aspx" class="current">home</a></li> <li><a href="/safety.aspx">safety</a>&l

scala - How to write to Kafka from Spark Streaming -

i'm using spark streaming process data between 2 kafka queues can't seem find way write on kafka spark. i've tried this: input.foreachrdd(rdd => rdd.foreachpartition(partition => partition.foreach{ case x:string=>{ val props = new hashmap[string, object]() props.put(producerconfig.bootstrap_servers_config, brokers) props.put(producerconfig.value_serializer_class_config, "org.apache.kafka.common.serialization.stringserializer") props.put(producerconfig.key_serializer_class_config, "org.apache.kafka.common.serialization.stringserializer") println(x) val producer = new kafkaproducer[string,string](props) val message=new producerrecord[string, string]("output",null,x) producer.send(message)

javascript - Jasmine jQuery: Check if element is visible -

hello got question regarding unit testing jasmine (plugin: jquery) how test if object within dom of document. thing use tooltip function activated when event simulated. when there simulation of effect, object attached dom , want check if visible or not. it("test 1: should invoke tooltip() function.", function () { spyevent = spyonevent('.span_width', "mouseover"); $('.span_width').simulate('mouseover'); expect('mouseover').tohavebeentriggeredon('.span_width'); expect(spyevent).tohavebeentriggered(); # test check if .tooltip visible??? # in jquery be: $('.tooltip').is(':visible'); }); you commented in jquery be: $('.tooltip').is(':visible'); yes would. in jasmine unit

c++ - Creating and using func pointer to method of friend class -

i have 2 classes: enum class enumtype { typ1, typ2, }; class { private: rettype func1(arg1type, arg2type, arg3type); rettype func2(arg1type, arg2type, arg3type); public: a(); rettype func(enumtype, arg1type, arg2type, arg3type); } class b { private: arg1type a; arg2type b; arg3type c; public: int functionfromb(enumtype); } so primary use this: int b::functionfromb(enumtype x) { a* objecta; for(int i=0; i<whatever; i++) { objecta->func(x, a+i, b+(2*i), c+(3*i)); } } rettype a::func(enumtype x, arg1type a, arg2type b, arg3type c) { switch(x) { case enumtype::typ1: return func1(a, b, c); case enumtype::typ2: return func2(a, b, c); default: return func1(a, b, c); } } unfortunately not want run switch every loop , thought this: in class write "friend class b" remove a::func() make function ptr in b::functionfromb() make switch in b::functionfrom

oh my zsh - Wrong bullet train oh-my-zsh theme render -

i have encoding error when prompt rendered. i installed bullet-train theme oh-my-zsh plugin. i installed powerline fonts indicated in bullet-train.zsh-theme file though, terminal doesn't seems care. it seems right colors there "?" characters instead of normal rendering. whereas should rendered this: https://github.com/caiogondim/bullet-train-oh-my-zsh-theme i have macbook pro , use iterm2. i fixed changing settings iterm2: simply change font compatible 1 (powerline fonts)

python - How to Print a Specific Value in an Array from a CSV File -

i imported csv file , made data array. wondering, can i'm able print specific value in array? instance if wanted value in 2nd row, 2nd column. how go adding 2 values together? thanks. import csv import numpy np f = open("test.csv") csv_f = csv.reader(f) row in csv_f: print np.array(row) f.close() to specific values within array/file, , add together: import csv f = open("test.csv") csv_f = list(csv.reader(f)) #returns value in second row, second column of file print csv_f[1][1] #returns sum of 2 specific values (in example, value of second row, second column , value of first row, first column sum = int(csv_f[1][1]) + int(csv_f[0][0]) print sum

On using Titanium parallel dialect of Java -

titanium explicitly parallel dialect of java developed @ uc berkeley support high-performance scientific computing on large-scale multiprocessors, including massively parallel supercomputers , distributed-memory clusters 1 or more processors per node [ berkley ]. the link 1 of few sources says project. searching site(stackoverflow) have hardly seemingly new parallel dialect of java. my question is: are using language develop parallel applications? what experience developing parallel application using titanium compared - say- hadoop mapreduce as countless linux distributions , titanium "framework" built same role : fit creator's needs first , given @ at time there weren't many possibilities choose from. the project 20 years old ( started around '96-'98), realising how technology has evolved in last couple of years , it's obvious though concepts used still found, implementation isn't up-to-date . so comming first po

xml - Post Request Payload to SOAP Webservice using Java -

using request payload, web service, operation names, soap action , required details, need invoke soap web service. has done without generating proxy , other classes. i request payload string, corresponding webservice , operation details program , need directly post payload webservice attaching required webservice policy. please suggest way achieve it. kindly let me know if not clear thanks

how to upload File in angularjs frontend -

Image
i want upload data api following signature want double check how data received.i have used ordinary modules in angular upload file want check how file pushed api. want file collection of bytes reaches api here uploading file. internal transfer protocol change bytes ? notice file has type of collection of bytes. how should upload for use ng-file-upload . using upload service call api this: upload.upload({ url: '/api/uploadfile', fields: {filename: 'filename', fileext: '.doc'}, file: file }) the file uploaded type arraybuffer , can need on end. here snippet download using filesaver,js : $http.post('/api/downloadfile', 'filename', {responsetype: "arraybuffer"}). success(function(data) { var blob = new blob([data], { type: '.doc' }); saveas(blob, file.filename); })

asp.net - How to fix "System.Net.WebException: The operation has timed out" error from .Net 1.1 Framework -

our asp.net 1.1 webservice application hosted in windows 2003 server . .net windows service application calling webservice hosted in above server every 30 seconds. we have added retry call mechanism if network error happens while calling web service. we getting below exception client application while calling web service: system.net.webexception: operation has timed out @ system.web.services.protocols.webclientprotocol.getwebresponse(webrequest request) @ system.web.services.protocols.httpwebclientprotocol.getwebresponse(webrequest request) @ system.web.services.protocols.soaphttpclientprotocol.invoke(string methodname, object[] parameters) after error generated, in next attempt execute out error. on research, have found "this caused stale dns entry proxy or if request not received before socket times out." below link http://blogs.msdn.com/b/jpsanders/archive/2009/01/07/you-receive-one-or-more-error-messages-when-you-try-to-make-an-http-request-in-an

java - Backspace \b Chacacter Scope with regard to OS? -

i looked extensively, unable find information regarding scope of \b character in java. note: using eclipse, , know provides limited no support character. (side question if want answer: looking console eclipse plugin supporting \b char) i want know 2 things: can write backspace char file delete written test? (i don't need this, reduces compatibility if can't program) can delete newline ( \r\n or either) character \b ? can write backspace char file delete written test? no. can delete newline ("\r\n" or either) character \b. no. the situations characters \b interpreted when writing screen, console or terminal. characters written file not treated this. this not java-specific restriction. rather inherent in way operating systems 1 handle writing data files. 1 - ... every os have encountered.

javascript - Hiding a row in table using ngAnimate -

i'm trying hide row in table has content. i'm facing few issues.. 1) after height set 0 border still shows up. how hide whole div ? 2) since there colspan="5" content when it's hidden table width shrinks <table> <tr> <td class="item0">test td 1</td> <td class="item1">test td 2</td> <td class="item2">test td 3</td> <td class="item3">test td 4</td> <td class="item4">click content</td> </tr> <tr> <td colspan="5"> <div ng-hide="show" class="cssslideup"> lorem ipsum dolor sit amet, consectetur adipiscing elit. integer pulvinar nisi sit amet luctus efficitur. vivamus eu risus suscipit, ultricies tortor eu, sodales tellus. sed sed feugiat massa. cras mollis, erat eget pellentesque porttitor, mauris lectus ultricies neque, varius iaculis qua

java - Trying to use the certificate to connect in a web server -

i ve been trying use 2 different certificates communicate in web server( web server 1). when use first one, can communicate web server without problem. when try use second one, have problems: if change certificate , make conection web server, returns information had used in first certificate. when close , open tomcat 8, can use second one, can't use first 1 again. i´ve been using more 1 certificate , , using same method in web server(web server 2) without problem. follow code bellow: public string sendxml(string xmlcabecalho, string xmlenvnfse) throws exceptionservicoabrasf { try { signxml signxml = new signxml(this.keystoreservice.getkeystore(), this.keystoreservice.getaliascert(), this.keystoreservice.getpasswordpfx()); xmlenvnfse = signxml.signandsend(xmlenvnfse); loadinfocertificate(); return executarservicoenvionfse(xmlcabecalho, xmlenvnfse); } catch (exception ex) { throw new exceptionservicoabrasf("failure sing.

javascript - How to wait till the end of $compile in angularJS -

i'm loading template , compiling against scope using $compile service. var template = "<div> .. {{somecompilingstuff}} ..</div>"; var compiled = $compile(template)(cellscope); and using in popover cellelement.popover({ html: true, placement: "bottom", trigger: "manual", content: compiled }); my template quite complex , may take time compile. how can make sure angular has finished compiling template before using in popover ? edit : tried force angular $apply() before creating popover, work generate javascript errors not acceptable me. $compile allows use called clone attach function allows attach elements document. here example may able use: var template = "<div> .. {{somecompilingstuff}} ..</div>"; var compiled = $compile(template)(cellscope, function (clonedelement) { cellelement.popover({ html: true, placement: "bottom", trigger: "manual"

sql server - How to concatenate a column value with single quotes in sql? -

how concatenate column value single quotes , comma in sql? select tpaa_id dbo.sheet tpaa_id not null at present query returns, value .. abc123 abc456 we have around 1000 records. i expect return 'abc123', 'abc456', you can use variable concatenation: declare @result nvarchar(max) select @result = isnull(@result + ', ', '') + '''' + tpaa_id + '''' dbo.sheet tpaa_id not null select @result

Behavior of a conditional breakpoint in Python when using assignment -

recently debugging code , inadvertently set conditional breakpoint following: my_var = some_val when in reality wanted my_var == some_val obviously not want got me curious behavior when debugging (and other things happen under hood). statement executed , stored? i.e. if first line used condition my_var take on some_val every time line come across? i noticed because hit breakpoint "condition" evaluating true . was wondering happens beneath layer out of curiosity. it evaluated not stored. reason because can overwrite __eq__ method, x == y function call. short example : class a: def __eq__(self, other): print "evaluated !" = a() == 1 # prints "evaluated !"

html - How to display elements in block -

http://i.stack.imgur.com/tisal.png want display elements in 1 block gray have big margin left if replicate code, this: #holder { width: 300px; height: 300px; border: 1px solid black; } #gray { width: 100%; height: 33.333%; background-color: gray; } #red { width: 100%; height: 33.333%; background-color: red; } #orange { width: 100%; height: 33.333%; background-color: orange; } <div id="holder"> <div id="red"> </div> <div id="gray"> </div> <div id="orange"> </div> </div> if have current code though fixed, please post here :)

c++ - ReplaceSubstring function glitch -

i'm working on function accepts 3 c-strings , objective replace word user finds anywhere on sentence 1 he/she inputs. below code of function: void replacesubstring(char str1[], char str2[], char str3[]) { char *a= new char(sizeof(str1)); char *b= new char(sizeof(str1)); int len=0; for(unsigned int ind= 0; ind< sizeof(str1); ind++) { for(unsigned ind1= 0; ind1< sizeof(str2); ind1++) a[ind]= str1[ind+ ind1]; a[ind]= '\0'; if(strcmp(str1, str2)) { for(unsigned int y= 0; y< sizeof(str3); y++) { b[len]= str3[y]; len++; } ind+= (sizeof(str2)- 1); } else { cout<< "error! no match found!"<< endl; } } cout<< b<< endl; } let show example of output: enter string: i love man

raspbian - Run omxplayer "Always on top" from java code -

i have raspberrypi2 (1gb ram version) raspbian os. need execute omxplayer play video. if execute new process, omxplayer on background. need omxplayer on top. how it? omxplayer has not switch stay on top example mplayer (-ontop). i found ( https://askubuntu.com/questions/7377/how-to-start-an-app-with-always-on-top-set ) wmctrl. tried run java execute omxplayer , after execute: processbuilder pb2 = new processbuilder("bash", "-c", "wmctrl -a omxplayer"); process p2 = pb2.start(); // start process. but not working, because javafx working framebuffer, not x11. source: why javafx application not have frame when run on raspberrypi? i feeling not possible tu run omxplayer on java in fullscreen on raspberrypi. code run omxplayer new process: public class omxplayer { private int xposition; private int yposition; private int width; private int height; /** constructor. * * */ omxplayer (int xposition, int yposition

wpf - SSH.NET real-time command output monitoring -

there long running script script.sh on remote linux machine. need start , monitor it's activity in real time. script during it's activity may output stdout , stderr . searching way capture both of streams. i use renci ssh.net upload script.sh , start it, great see solution bounded library. in mind perfect solution new method: var realtimescreen= ...; var commandexecutionstatus = sshclient.runcommandasync( command: './script.sh', stdouteventhandler: stdoutstring => realtimescreen.updatestdout(stdstring) stderreventhandler: stderrstring => realtimescreen.updatestderr(stderrstring)); ... commandexecutionstatus.continuewith(monitoringtask => { if (monitoringtask.completed) { realtimescreen.finish(); } }); use sshclient.createcommand method . returns sshcommand instance. the sshcommand class has extendedoutputstream property returns stream both stdout , stderr. see sshcommandtest.cs : public void test_

Azure Powershell script fails when run through task scheduler -

i have powershell script wrote backup local sqlserver azure blob. based on 1 took msdn, added feature delete old backups on 30 days old. when run user, works fine. when added task scheduler, set run me, , manually ask run, works fine. (all output captured in log file, can see working). when run task scheduler @ night when i'm not logged in (the task scheduler set run script me) fails. specifically, claims azure subscription name not know when call set-azuresubscription. then, fails when trying delete blob with: get-azurestorageblob : can not find azure storage credential. please set current storage account using "set-azuresubscription" or set "azure_storage_connection_string" environment variable. the script in question: import-module sqlps import-module azure $storageaccount = "storageaccount" $subscriptionname = "subname" $blobcontainer = "backup" $backupurlcontainer = "https://$storageaccount.blob.core.wind

phpstorm - IDEA Omni code suggestion -

Image
is possible have omni code suggestion? for example: in picture up, want have suggestion checkmodelvalues word... update: showing settings: please try main menu | code | completion | cyclic expand word (backward) such completion in strings. action search words above/before caret position , offer one-by-one (i.e. next invocation show next word). p.s. ordinary cyclic expand word action offer words located below/after caret position.

mysql - Maria DB Update and replace -

i'm getting error message when run this: update catalog_product_entity_text set value = replace (value, 'xxxxx') value 'yyyyy'; error: #1064 - have error in sql syntax; check manual corresponds mariadb server version right syntax use near ')' @ line 1 any ideas? thanks i obtained same error expression: update catalog_product_entity_tex set value = replace (value, 'yyyyy', 'xxxxx') value '%yyyyy%'; the solution using alias: update catalog_product_entity_tex c set c.value = replace (c.value, 'yyyyy', 'xxxxx') c.value '%yyyyy%';

html - Divide single table into 2 table in mobile view with bootstrap -

Image
i have single table in desktop. client wants shown 2 tables in mobile view. there way achieve without duplication of html or should take div method instead of table? desktop view: mobile view: you can use 2 table this pic code <!doctype html> <head> <meta charset="utf-8"> <style> .tb_1{ float:left; width:50%; } .tb_2{ float:right; width:50%; } @media screen , (max-width: 619px) { .tb_1{width:100%;} .tb_2{width:100%;} } </style> </head> <body> <table class="tb_1" border="1"> <tr> <td>1</td> <td>2</td> <td>3</td> </tr> <tr> <td>6</td> <td>7</td> <td>8</td> &l

distributed system - Creating threads in Storm Bolt -

i want fire multiple web requests in parallel , aggregate data in storm topology? of following way preferred 1) create multiple threads within bolt 2) create multiple bolts , create merging bolt aggregate data. i create multiple threads within bolt because merging data in bolt not simple process. see there concerns around found on internet https://mail-archives.apache.org/mod_mbox/storm-user/201311.mbox/%3ccaaylz+puz44gnsnnj9o5hjtr2rzlw=ckm=fgvcfwbnw613r1qq@mail.gmail.com%3e didn't clear reason why not create multiple threads. pointers help. on side note mean should not use java8's capabilities of parallel streams mentioned in https://docs.oracle.com/javase/tutorial/collections/streams/parallelism.html ? increase number of tasks bolt, spawning multiple instances of same. , increase number of executors (threads) handle them evenly. make sure #executors <= #tasks . storm rest you.

xamarin - Layout is Orientation =vertical when device rotate it wont work -

Image
i have following layout set orientation = vertical. when rotate emulator landscape, show layout in landscape. i want layout in orientation vertical device rotate landscape. how solve problem? appreciate help. <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/mylinearlayout" android:minwidth="25px" android:minheight="25px"> <textview android:id="@+id/mylabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="put name here :" /> <edittext android:id="@+id/myeditbox" android:inputtype="textmultiline" android:textcolor="@android:color/background_dark" andr

java - AuthError On YouTube Search List Execute -

i exploring youtube api , creating java application can search authorized users token. authorization follows. private static credential authorize(string storedirectory) throws exception { // load client secrets yt.data_store_dir = new java.io.file(".",".store/"+storedirectory); yt.datastorefactory = new filedatastorefactory(yt.data_store_dir); googleclientsecrets clientsecrets = googleclientsecrets.load(yt.json_factory, new inputstreamreader(new bytearrayinputstream(yt.client_secret_json.getbytes(standardcharsets.utf_8)))); if (clientsecrets.getdetails().getclientid().startswith("enter") || clientsecrets.getdetails().getclientsecret().startswith("enter ")) { system.out.println( "enter client id , secret https://code.google.com/apis/console/?api=plus " + "into client string."); system.exit(1); } string[] permissoins = { plusscopes.plus_login, p

How to properly configure the DNS configuration of the VirtualBox to resolve docker containers hostnames within the local network? -

here context i have 3 container : container 1 : rest api container 2 : web application a.k.a "the dashboard" container 3 : database my goal i want stack run on top of mac osx or windows in order build coherent application accessible local network. what need - dns configuration when web application served container 2 client on local network, browser need communicate rest api running on container 1 . i able setup within web application hostname of container 2 e.g. server-api.local

android - How can I have a icon at center and wheel icons around it layout -

i have circlular icon in middle of wheel , wheel has 4 buttons of clickable . how can build layout seen in image image wheel button i have done r&d gama - wheel , not have icon @ center .kindly help.

c# - Deep diving into the implementation of closures -

Image
consider following code block: int x = 1; d foo = () => { console.writeline(x); x = 2; }; x = 3; foo(); console.writeline(x); the output is: 3,2. i'm trying understand happens behind scenes when code running. the compiler generates new class: the question if how x variable get's changed. how x inside <>_diplayclass1 changing x inside program class. doing behind scenes? var temp = new <>c_displayclass1(); temp.x = this.x; temp.<main>b_0(); this.x = temp.x; it helps @ de-compiled code: // decompiled jetbrains decompiler // type: program // assembly: test, version=0.0.0.0, culture=neutral, publickeytoken=null // mvid: d26ff17c-3fd8-4920-befc-ed98bc41836a // assembly location: c:\temp\test.exe // compiler-generated code shown using system; using system.runtime.compilerservices; internal static class program { private static void main() { program.\u003c\u003ec__displayclass1 cdisplayclass1 = new program.\u003c\u003ec_

php - Swagger Laravel 5 - [Semantical Error] Couldn't find constant name -

can clear error please? i'm using latrell\swagger laravel , i've defined on 1 of models: use swagger\annotations swg; /** * @swg\parameter( * partial="body_recipienttag", * name="body", * description="recipient tag created", * type="recipienttag", * paramtype="body", * required=true, * allowmultiple=false * ) * @swg\model(id="recipienttag") * * @swg\property(name="id",type="integer",format="int64",description="unique identifier recipient tag") * @swg\property(name="name", type="string", description="the name of recipient tag") * @swg\property(name="recipient_tag_group_id", type="integer", format="int64", description="the recipient tag group id tag belongs to") * @swg\property(name="location_id", type="integer", format="int64"

android - how to save listview items/adapter in fragment and restore from back stack -

i've been tried search problem couldn't solution. i've got problem saving listview items in fragment. case have several fragments let fragment a, fragment b , fragment c, , fragment has listview, item of listview can changed when user scroll (just timeline in social media apps). when change fragment a, used addtobackstack(null) method. the problem is, how save listview , restore if button pressed? onsaveinstancestate() never called because activity host never killed, change fragment using this: public void changefragment(fragment fragment, colordrawable colordrawable){ fragment newfrag = fragment; colordrawable newcolor = colordrawable; string backstatename = fragment.getclass().getname(); fragmentmanager manager = getsupportfragmentmanager(); boolean fragmentpopped = manager.popbackstackimmediate (backstatename, 0); if (!fragmentpopped){ //fragment not in stack, create it. fragmenttransaction ft = manager.begintran