[Solved] How do I replace the middle of a string?

You need look-around assertions. $a =~ s|(?<=<no> ).*(?= </no>)|000|gi; # $a is now “<no> 000 </no> ” Have you considered reading a Perl book or two? You are not learning effectively if you have to come to Stack Overflow to ask that sort of questions that can be easily answered by reading the fine documentation. … Read more

[Solved] Converting a code from c++ 11 to c++ 98?

Convert the range-based for to loops using iterator Stop using auto and write the type manually code: #include <iostream> #include <map> #include <string> int main() { std::string input = “slowly”; std::map<char, int> occurrences; for (std::string::iterator character = input.begin(); character != input.end(); character++) { occurrences[*character] += 1; } for (std::map<char, int>::iterator entry = occurrences.begin(); entry != … Read more

[Solved] How to get a specific given in Firebase [closed]

First of all initiate the database instance FirebaseDatabase firebaseDatabase = FirebaseDatabase.getInstance(); get the reference of your DB where you want to perform the operation DatabaseReference dbRef = firebaseDatabase.getReference(NAME_OF_DATABASE); then use this to get all the user with the name equal to the editText text Query query = profileDbRef .orderByChild(“name”) .equalTo(edittext.getText().toString()); query.addValueEventListener(new ValueEventListener() { @Override public … Read more

[Solved] Python count list and types [closed]

newlist = [] for sublist in yourlist: already_in_list = False for index, newsublist in enumerate(newlist): if sublist == newsublist[:-1]: newlist[index][2] += 1 already_in_list = True if not already_in_list: newlist.append(sublist+[1]) – >>>newlist [[‘personA’, ‘banana’, 1], [‘personB’, ‘banana’, 2], [‘personA’, ‘grape’, 1], [‘personA’, ‘lemon’, 2]] solved Python count list and types [closed]

[Solved] Positioning two child div inside parent div [closed]

.parent{ background:#fff; height:40vh; width:50vw; border: 2px solid black; margin:auto; display: flex; flex-direction: row; justify-content: flex-end; padding:10px; } .child1, .child2{ height:25vh; width: 30px; border: 2px solid red; margin:5px; } <div class=”parent”> <div class=”child1″>1</div> <div class=”child2″>2</div> </div> Check whether it’s working for you. And the same I’ve written in codepen too. https://codepen.io/ak228212/pen/QWajNzj 2 solved Positioning two child … Read more

[Solved] Why am I getting this error ?? java.lang.ClasscastException

The top level object in your JSON file is an array so: class letsRead { public static void main(String [] args) { String inline = “”; try { URL url = new URL(“https://gist.githubusercontent.com/anubhavshrimal/75f6183458db8c453306f93521e93d37/raw/f77e7598a8503f1f70528ae1cbf9f66755698a16/CountryCodes.json”); HttpURLConnection conn = (HttpURLConnection)url.openConnection(); conn.setRequestMethod(“GET”); conn.connect(); int responsecode = conn.getResponseCode(); System.out.println(“Response code is: ” +responsecode); if(responsecode != 200) throw new RuntimeException(“HttpResponseCode: ” … Read more

[Solved] perform arithmetic operations python [closed]

Assuming you want to stick to arithmetic operations (and not strings), use the modulo operator with 10 to get the remainder of division by 10, i.e. the unit: 12345%10 output: 5 For an arbitrary number, you need to compute the position, you can use log10 and ceil: from math import log10, ceil N = 5 … Read more

[Solved] what is wrong incode python? [duplicate]

Just try to correct indentation like shown below: …. try: subdomain = row.find_all(‘td’)[4].text subdomain = subdomain.replace(“*.”,””) if subdomain not in self.foundURLsList: self.foundURLsList.append(subdomain) except Exception as e: pass … Current version of bs4 does not support python 2 Beautiful Soup’s support for Python 2 was discontinued on December 31, 2020: one year after the sunset date … Read more

[Solved] The choice of the day is not through the select, but through the calendar

If I clearly understand you, then you need just add $(‘#dayofweek’).val(arDate[0]); after this line const arDate = e.date.toString().split(‘ ‘);. Here is an example: let restaurantReserve = { init: function() { let _self = this; $(‘#reservation-date’).datepicker({ startDate: ‘+0d’ }).on(‘changeDate’, function(e) { const arDate = e.date.toString().split(‘ ‘); $(‘#dayofweek’).val(arDate[0]); filterTimes(); let input = $(‘[name=”RestaurantReservationForm[date]”]’); input.val(arDate[3] + ‘-‘ + … Read more

[Solved] Format specifier behavior in C [closed]

In first example you are reading it as ’20’ and ‘3’ -> So not equal. In second exmple you are reading it as ’20’ and ‘ 3’-> note space. Its not 2 vs 3. It is 20 vs 3. %d will read whole string. You may want to check with %1d Return from strcmp Returns … Read more