[Solved] How can I make a Put rest call along with POJO using RestTemplate

For PUT use RestTemplate.exchange() method Example MyJaxbRequestDataObjectrequest = createMyJaxbRequestDataObject(); Map<String, String> uriArguments= createUriArguments(); String url = restBaseUrl + “/myputservice/{usertId}?servicekey={servicekey}”; HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_XML); HttpEntity<MyJaxbRequestDataObject> entity = new HttpEntity<MyJaxbRequestDataObject>(request, headers); ResponseEntity<MyJaxbResponseDataObject> responseWrapper = shogunRestTemplate.exchange(url, HttpMethod.PUT, entity, MyJaxbResponseDataObject.class, uriArguments); MyJaxbResponseDataObjectresponse = responseWrapper.getBody(); solved How can I make a Put rest call along with POJO using … Read more

[Solved] When using “ng generate library” what is an Angular “Library”?

An “angular library” in this context refers to self-contained Angular project that stands by itself in the projects/ directory, An Angular Library is summarized as, Many applications need to solve the same general problems, such as presenting a unified user interface, presenting data, and allowing data entry. Developers can create general solutions for particular domains … Read more

[Solved] How to filter an array with multiple parameters

You don’t have pageTypeId property in the object. Because of that, i changed this property to id in the statement, and if you want filter value 1 or 2, i used || characters. Maybe you will edit your code like this, it will work. let tmpArray = [{“id”:”1″},{“id”:”2″},{“id”:”2″},{“id”:”3″},{“id”:”3″}]; this.nodes = tmpArray.filter(x => { return x.id.toString() … Read more

[Solved] How to generate dynamic IF statement

I found my answer with my self. It’s look like this. $abc=””; foreach($setLogic2 as $key => $value){ $abc.= $value[‘Conj’].’ ‘.(int)$value[‘Topic’].’ ‘; } //$abc = “0 And 1 And 1”; if(eval(“return $abc;”) == true) { echo ‘true boolean’; } else if(eval(“return $abc;”) == false){ echo ‘false boolean’; } else{ echo ‘none’; } 1 solved How to … Read more

[Solved] how to extract word from ps -aux

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, $5, … Read more

[Solved] how to show and hide imageview inside recyclerView

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]

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 = $_REQUEST[‘exp_description’]; … Read more

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

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 it, … Read more

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

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 solved Why does this code not output the winner variable?

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

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 device … Read more

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

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); curl_setopt($ch, … Read more

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

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 have … Read more