[Solved] Shell Script – Adding memory functionality

You should store the result in a variable like this: result=$((operand1+operand2)) Then your first if statement can check if this variable has a value, and if it does, skip the read and use it instead. if [[ $result == “” ]]; then echo Enter operand1 value: read operand1 else operand1=$result echo “Operand 1 is: $result” … Read more

[Solved] Reason for segmentation fault in this snippet of code [closed]

For logic as far as what I understood, you need to remove some flaws then your logic might work. try this one out : for(i=1;i<=n;i++) { flag=0; c=head; while(c!=b) { if(c->d==b->d) flag++; c=c->next; } if(flag==0 && i==1) { a=(list)malloc(sizeof(node)); a->d=b->d; a->next=NULL; taila=a; } else if(flag==0) { new=(list)malloc(sizeof(node)); new->d=b->d; new->next=NULL; taila->next=new; taila=new; } b=b->next; } 1 … Read more

[Solved] Replacing a certain word in a text file

If you don’t care about memory usage: string fileName = @”C:\Users\Greg\Desktop\Programming Files\story.txt”; File.WriteAllText(fileName, File.ReadAllText(fileName).Replace(“tea”, “cabbage”)); If you have a multi-line file that doesn’t randomly split words at the end of the line, you could modify one line at a time in a more memory-friendly way: // Open a stream for the source file using (var … Read more

[Solved] How to give a variable from another class a value from main method?

You are not setting value to the object’s name variable. public static void main (String[] args) { Playeri user = new Playeri(); Enemyu enem = new Enemyu(); Scanner input = new Scanner(System.in); user.name = input.nextLine(); user.showName(); enem.showUserName(); } } class Playeri { String name; void showName() { System.out.println(“Your name is ” + name + “.”); … Read more

[Solved] Tic-Tac-Toe Game c++ [closed]

a1==b1==c1==’X’ This doesn’t do what you think it does. It compares a1 to the boolean result of b1==c1==’X’, probably giving false. To check whether they are all equal, you need a1==’X’ && b1==’X’ && c1==’X’ solved Tic-Tac-Toe Game c++ [closed]

[Solved] How can i create an new activity on imagebutton click? [closed]

Try this, ImageButton mainButton = (ImageButton) findViewById(R.id.mainButton); mainButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent=new intent(this,NewActivityname.class); startActivity(intent); } });} Add your newactivity class in androidmanifest file solved How can i create an new activity on imagebutton click? [closed]

[Solved] How to do full screen activity? [closed]

Guess this is not possible. Android has to provide a way to the user to get back to home screen or exit an application. Hence, an application cannot get to remove them completely. solved How to do full screen activity? [closed]

[Solved] How to get this city from .txt and add this to database using PHP? [closed]

Its pretty easy. You need to google to read file in PHP and write to database in PHP. Here I’ll start you off: $file_handle = fopen(“cit.txt”, “rb”); while (!feof($file_handle) ) { $line_of_text = fgets($file_handle); // write your insert statement here, depending on your table structure. } solved How to get this city from .txt and … Read more

[Solved] How to parse this xml and retrieve the data in iPhone [duplicate]

hello before posting do some r and D many posts are available just check this link it may helps you in your method – (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict { if([elementName isEqualToString:@”Result”]) { //Initialize the array. arrXMLData = [[NSMutableArray alloc] init]; } else if([elementName isEqualToString:@”Movieoftheweek”]) { currentElementValue = [[NSMutableString alloc] … Read more