How to call a method in another class in Java?

You should capitalize names of your classes. After doing that do this in your school class, Classroom cls = new Classroom(); cls.setTeacherName(newTeacherName); Also I’d recommend you use some kind of IDE such as eclipse, which can help you with your code for instance generate getters and setters for you. Ex: right click Source -> Generate … Read more

:nth-letter pseudo-element is not working [closed]

There is no :nth-letter pseudo-element (and no :first-char) in CSS. The :first-letter pseudo-element (which the question mentions in the title and in the prose but does not use in the code) works, but to color other letters, you must wrap each of them in an element of its own, normally span.

htaccess redirect for non-www both http and https

Try this rule: RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$ RewriteCond %{HTTPS}s ^on(s)| RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] Here’s an explanation: The first condition tests if the HTTP header field Host has the required format (contains exactly one period). The second condition tests if the concatenated value of the value of the HTTPS variable (values on and off) and s … Read more

SQL add filter only if a variable is not null

You can translate your requirement into : SELECT route_id [ROUTE_ID] FROM route_master(NOLOCK) WHERE route_ou = 2 AND (@l_s_query is null OR route_query = @l_s_query) AND lang_id = 1 OPTION (RECOMPILE) The OPTION (RECOMPILE) is optional but can give better execution plans at the expense of extra compilation time as discussed in the canonical article on … Read more

Xcode 4 – clang error

Apparently, you’ve set custom compiler flags for the include paths. Go to your target’s build settings and check this option: Other C flags If you have something in it, you may replace it by the -iquote version. Otherwise, still in the build settings, check the value of the following options: Header Search Paths User Header … Read more

Group and count by month

You need to use the $month keyword in your group. Your new Date().getMonth() call will only happen once, and will try and create a month out of the string “$bookingdatetime”. db.booking.aggregate([ {$group: { _id: {$month: “$bookingdatetime”}, numberofbookings: {$sum: 1} }} ]);

Remove XML Node using java parser

Alternative DOM Approach Alternatively, instead of doing a brute force traversal of the XML document you could use the XPath capabilities in the JDK to find the “B” element with value “13” and then remove it from its parent: import java.io.File; import javax.xml.parsers.*; import javax.xml.transform.*; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import javax.xml.xpath.*; import org.w3c.dom.*; public class … Read more