[Solved] how to extract word from ps -aux

[ad_1] Since it’s not clear what you’re trying to do: If you expect the following output: yypasswd then do ps -ef | grep yypasswd | awk ‘{print $8}’ if you want the following output: testacc 25124194 2512312620 0 08:00:53 pts/0 0:00 then do ps -ef | grep yypasswd | awk ‘{print $1, $2, $3, $4, … Read more

[Solved] how to show and hide imageview inside recyclerView

[ad_1] You need just add field in your adapter where you will save currently active item. Then call notifyDataSetChanged. Also you should update your onBindViewHolder like this: private int currentPosition = -1; @Override public void onBindViewHolder(@NonNull MyViewHolder holder, int position) { holder.textView.setText(items.get(position)); if (currentPosition == position) { holder.img1.setVisibility(View.INVISIBLE); holder.img2.setVisibility(View.VISIBLE); } else { holder.img1.setVisibility(View.VISIBLE); holder.img2.setVisibility(View.INVISIBLE); } … Read more

[Solved] Error in an update mysql query execution with php and mysqli [duplicate]

[ad_1] You need to escape the single quotes using php’s str_replace, e.g.: $exp_title = str_replace(“‘”, “\'”, $_REQUEST[‘exp_title’]); $exp_description = str_replace(“‘”, “\'”, $_REQUEST[‘exp_description’]); $exp_time = $_REQUEST[‘exp_time’]; $update=”UPDATE experience SET exp_title=””.$exp_title.”” , exp_description='”.$exp_description.”‘ , exp_time=””.$exp_time.”” WHERE expid='”.$id.”‘”; However, you should really really use preparedstatements instead of concatenating strings and escaping characters, e.g.: $exp_title = $_REQUEST[‘exp_title’]; $exp_description = … Read more

[Solved] perl script error: Can’t exec “module”: No such file or directory at ./prog line 2 [closed]

[ad_1] From the Perl documentation for system: If there are no shell metacharacters in the argument, it is split into words and passed directly to execvp. So, your command is being passed in as three separate commands. Try putting quotes around it for a start. i.e. system (‘”module add openssl”‘); If that does not fix … Read more

[Solved] Why does this code not output the winner variable?

[ad_1] Try: import random class player: def __init__(self, name): self.name = name self.score = random.randint(1,6) print(self.name, self.score) player_1 = player(“Richard”) player_2 = player(“Bob”) winner=”” if player_1.score > player_2.score: winner = player_1.score print(winner) elif player_2.score> player_1.score: winner = player_2.score print(winner) else: print(“Tie.”) Output: 7 [ad_2] solved Why does this code not output the winner variable?

[Solved] Angular 2 ngFor for nested json [duplicate]

[ad_1] Try this code to separate your devices into 2 groups : <div *ngFor=”let drop of config”> <ng-container *ngIf=”drop.id === ‘imu_device’; else gpsBlock”> <h1>IMU Device</h1> <ul> <li *ngFOr=”let sub1 of drop.fields”> {{sub1}}</li> </ul> </ng-container> <ng-container #gpsBlock> <h1>Gps Device</h1> <ul> <li *ngFOr=”let sub1 of drop.fields”> {{sub1}}</li> </ul> </ng-container> </div> You loop on config, and conditionnally display … Read more

[Solved] How to force file to download which is output of json file

[ad_1] You can use file_get_contents like this: <?php $details1=json_decode(file_get_contents(“http://2strok.com/download/download.json”), true); $details2=json_decode(file_get_contents($details1[‘data’]), true); $file_url = $details2[‘data’]; header(‘Content-Type: application/octet-stream’); header(“Content-Transfer-Encoding: Binary”); header(“Content-disposition: attachment; filename=\”” . basename($file_url) . “\””); readfile($file_url); ?> Or you can use cURL: <?php $ch = curl_init(); $url = “http://2strok.com/download/download.json”; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); $url2 = json_decode($output)->data; curl_setopt($ch, CURLOPT_URL, $url2); … Read more

[Solved] Send 2 e-mails with mail()

[ad_1] My first guess is that you’re sending an email to “[email protected]” which will surely won’t work. Unless I’m mistaken, it should work if $to is a valid email address. edit Alright, then check this out, not really a direct answer to the first problem. But I’d consider using something like this: https://github.com/Synchro/PHPMailer Unless you … Read more

[Solved] php + Highcharts.js + convert from mysql to mysqli causes error [duplicate]

[ad_1] If you are going to convert your code to mysqli_*, then it should be in a prepared statement manner. Lets re-establish your MySQL connection in db.inc.php: <?php $conn = new mysqli(“localhost”, “Datenbank-Username”, “Datenbank-Passwort”, “Datenbank-Name”); /* CHECK CONNECTION */ if (mysqli_connect_errno()) { printf(“Connect failed: %s\n”, mysqli_connect_error()); exit(); } /* CHANGE CHARACTER SET TO utf8 */ … Read more

[Solved] Null pointer exception on button send [closed]

[ad_1] Just write your if loop after declaration of your all the views in your onCreate() as below: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); buttonSend = (Button) findViewById(R.id.buttonSend); textTo = (EditText) findViewById(R.id.editTextSendTo); textSubject = (EditText) findViewById(R.id.editTextName); textMessageContact = (EditText) findViewById(R.id.editTextContact); textMessageEmail = (EditText) findViewById(R.id.editTextEmail); textMessageAmount = (EditText) findViewById(R.id.editTextAmount); spinner = (Spinner) findViewById(R.id.spinner); buttonSend.setOnClickListener(new … Read more

[Solved] Trouble writing a select query [closed]

[ad_1] It looks like vb code if you want c# code then use following code cmd = new SqlCommand(“select name from wq where id='” + TextBox1.Text + “‘”, con); con.Open(); dr = cmd.ExecuteReader(); dr.Read(); TextBox2.Text = dr[0].ToString(); dr.Close(); con.Close(); 7 [ad_2] solved Trouble writing a select query [closed]