[Solved] Writing only lower case letters to file in Python

Code input_f = input(“Enter the file name to read from: “) output_f = input(“Enter the file name to write to… “) fw = open(output_f, “w”) with open(input_f) as fo: for w in fo: for c in w: if c.isalpha(): fw.write(c.lower()) if c.isspace(): fw.write(‘\n’) fo.close() fw.close() input.txt HELLO 12345 WORLD 67890 UTRECHT 030 dafsf434ffewr354tfffff44344fsfsd89087uefwerwe output.txt hello … Read more

[Solved] Accessing members in same namespace in C++ [closed]

You can use forward declaration of your class second and use a pointer. Only the implementation must know the declaration of your class Second. namespace A { class Second; // Forward declaration class First { public: First(); ~First(); private: Second* s; // Pointer on a forward class }; class Second { private: First f; }; … Read more

[Solved] Naming columns in a data table in R

I don’t word with data tables, but this is a solution that would work for data frames, and should hopefully generalize. The strategy is to use the fact that you can fill one vector with another vector, without ever having to use a loop. # make the example data sets D1 <- as.data.frame(matrix(data=(1:(20*181)), nrow=20, ncol=181)) … Read more

[Solved] JQuery .focus() not work in .blur() event in Firefox

$(“#txtfname”).focus(function () { //Check if value is blank or not if ($(“#txtfname”).val() === “” && $(“#txtfname”).val().length >= 2) { $(“#fnamemsg”).hide(); // Hide message } }); var element = document.getElementById(‘txtfname’); element.focus(); element.onblur = function () { if (element.value !== “” && element.value.length < 2) { $(“#fnamemsg”).show(); $(“#fnamemsg”).html(“* Firstname required 2 character”); setTimeout(function () { element.focus(); }, … Read more