[Solved] Extra from Activity B to Activity A

Write Activity A like this public class MainActivity extends Activity { TextView textView1; Button button1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textView1=(TextView)findViewById(R.id.textView1); button1=(Button)findViewById(R.id.button1); button1.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent intent=new Intent(MainActivity.this,SecondActivity.class); startActivityForResult(intent, 2);// Activity is started with requestCode 2 } }); } // Call Back method to get the … Read more

[Solved] Convert PHP Associate Array [closed]

You can do this by encoding the array in JSON format. Here’s the sample code for your better understanding: <?php $names = array( array( “foo”=> “bar”, ), array( “foo”=> “bar”, ), array( “foo”=> “bar”, ), ); $namesJSON = json_encode($names); echo “<pre>”; echo $namesJSON; echo “</pre>”; ?> This will output the JSON array which is required. … Read more

[Solved] Using SFTP to transfer images from HTML form to remote linux server using PERL/CGI.pm

use CGI qw(:standard); use File::Basename; my ( $name, $path, $extension) = fileparse ( $productimage, ‘..*’ ); $productimage = $name . $extension; $productimage =~ tr/ /_/; $productimage =~ s/[^$safechars]//g; if ( $productimage =~/^([$safechars]+)$/ ) { $productimage = $1; } else { die “Filename contains invalid characters”; } $fh = upload(‘image’); $uploaddir = “../../.hidden/images”; open ( UPLOADFILE, … Read more

[Solved] If I have an array of 5 elements lets say (1,2,3,4,5) how do create a new one with double each integer?

if you want values in a new array, then int[] array ={1,2,3,4,5}; int arrayLength = array.size(); int[] array2 = new int[arrayLength]; for(int i=0; i<arrayLength; i++) { array2[i] = array[i]*2; } If you want values doubles in the same array, then int[] array ={1,2,3,4,5}; for(int i=0; i<array.size(); i++) { array[i]*=2; } 0 solved If I have … Read more

[Solved] Expected ‘:’ Lexical or Preprocessor error

It looks like you are missing a colon, a couple of dots, and a couple of semicolons: [self.ScrollView setScrollEnabled:YES]; // ^ ^ ^ [self.ScrollView setContentSize:CGSizeMake(320, 900)]; // ^ ^ You need to watch out for these small elements of the syntax – Objective C does not tolerate deviations. The worst part about syntax errors is … Read more

[Solved] try and catch error with joptionpane

The warning (which can be ignored) is telling you that the variable e you’ve declared in your catch block is not used. I know with IntelliJ IDEA you can remove the warning by changing the name of e to ignored. I’m not sure if NetBeans has a similar feature. However, your try block is rather … Read more

[Solved] How to check with more RegEx for one address in python using re.findall()

Finally I got answer from here How to combine multiple regex into single one in python? Working fine this import re re1 = r’\d+\.\d*[L][-]\d*\s[A-Z]*[/]\d*’ re2 = ‘\d*[/]\d*[A-Z]*\d*\s[A-Z]*\d*[A-Z]*’ re3 = ‘[A-Z]*\d+[/]\d+[A-Z]\d+’ re4 = ‘\d+[/]\d+[A-Z]*\d+\s\d+[A-z]\s[A-Z]*’ sentences = [string1, string2, string3, string4] generic_re = re.compile(“(%s|%s|%s|%s)” % (re1, re2, re3, re4)).findall(sentence) solved How to check with more RegEx for … Read more

[Solved] Attach an object to another object [closed]

if (Input.GetMouseButtonDown(0)) { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) if (hit.collider == this.gameobject) // this can be checked on parent or child, your call this.transform.parent = yourParentObject; } 1 solved Attach an object to another object [closed]

[Solved] Regex test for “number.number.number”

You’d probably want to create a regex as follows: ^\d+\.\d+\.\d+$ The ^ means “start of phrase”, the $ means “end of phrase”, \d+ says “digit one or more times in a row”, and \. means “.” but must be escaped with the leading \ due to . having a special meaning in regex. 0 solved … Read more

[Solved] how is dart compiled into javascript? [closed]

There is quite a bit of code included that emulates features Dart provides, but that can’t be translated directly to ES5, (like classes, mixins, …). There is also quite some code included that polyfills missing browser features to make the same Dart code work in all browsers like for example jQuery does. This code could … Read more

[Solved] I see an error CS8070 . How i can fix the error?

Add breaks to the end of case “Rock”, case “Scissors” and case “Paper”:: switch (Player1) { case “Rock”: switch (Player2) { case “Rock”: Console.WriteLine(“Draw”); break; case “Scissors”: Console.WriteLine(“Win Player1”); break; case “Paper”: Console.WriteLine(“Win Player2”); break; } switch (Player1) { case “Scissors”: switch (Player2) { case “Rock”: Console.WriteLine(“Win Player2”); break; case “Scissors”: Console.WriteLine(“Draw”); break; case “Paper”: … Read more