Criteria criteria = session.createCriteria(Student.class); criteria.add(Restrictions.eq(STD_ID, stdId)); criteria.add(Restrictions.le(START_DATE, dateOfService)); criteria.add(Restrictions.ge(END_DATE, dateOfService)); results = criteria.list();   Is it possible to convert the criteria object to SQL query or while debugging in Eclipse is it possible to see the generated SQL query?
Is there a way to get the (to-be-generated) SQL from a Hibernate Criteria?  Ideally, I would have something like:  Criteria criteria = session.createCriteria(Operator.class);  ... build up the criteria ... ... and then do something like ...  String sql = criteria.toSql()  (But this of course does not exist)   The idea would then be to use the SQL as part of a huge 'MINUS' query (I need to find the differences between 2 identical schemas - identical in structure, not in data - and the MINUS is not supported by Hibernate)  (BTW I know I can check the SQL from the log files)
In a batch file I need to extract a month, day, year from the date command.  So I used the following, which essentially parses the Date command to extract its sub strings into a variable:  set Day=%Date:~3,2% set Mth=%Date:~0,2% set Yr=%Date:~6,4%   This is all great, but if I deploy this batch file to a machine with a different regional/country settings, it fails because month, day and year are in different locations.   How can I extract month, day and year regardless of the date format? What is tail recursion? Transformer VA Ratings, Power factor, and Pulsed current What exactly goes into a transformer's VA rating? At a fundamental level it seems that there has to be a limit to what the VA rating can represent.  For example if I draw 2 Amps-RMS from the secondary of a 30VA rated transformer at 15 Vrms this makes sense as the maximum Complex Power I can draw. Still, at a power factor of 1 my maximum current in the transformer would be sqrt(2) * 2 Amps.   But what if my power factor is abysmally low (ie in a DC rectifier) due to harmonic distortion and while I still draw 2A-RMS I have brief current spikes of 15 Amps? Surely the transformer's magnetics couldn't handle these spikes as I'd expect the core would saturate.  My question is what is the practical limit for VA ratings of transformers? Would brief current spikes that reduce to only 2A-RMS in this case be fine? Obviously the secondary/primary copper losses play a part in the rating but how do the magnetics factor in?  I ask this because I am designing a simple bench power supply using a 125VA transformer with a 24Vrms secondary and am trying to figure out how much power I can draw before the current spikes into the inductor are too much for the transformer. I also don't want to have to resort to active PFC as I don't want to risk messing up any HVAC PCB design.  Thank you I have learnt that the cardinality of the power set of the natural numbers is equal to the cardinality of the real numbers. What is the function that gives the one-to-one correspondence between these two sets?  I have also learnt that there exists no set whose cardinality is strictly between the natural numbers and the real numbers. Is there a proof of this or at least some intuitiveness behind it? Why is "glide symmetry" its own type? Artin's Algebra pages 155 &amp; 156 list the types of symmetry of a plane figure as:   Reflective Rotational Translational Glide   He then goes on to say "Figures such as wallpaper patterns may have two talk about other figures having combinations of independent" symmetries. EDIT: He says "... having combinations of independent translational symmetries". See Joriki's answer.  Why doesn't glide symmetry count as having two independent (reflection + translation) symmetries? If we're going to count combinations, why not have rotation + translation etc. as their own types too? How can I find non-ASCII characters in MySQL? I'm working with a MySQL database that has some data imported from . The data contains non- characters (em dashes, etc.) as well as hidden carriage returns or line feeds. Is there a way to find these records using MySQL? I want to disable the internal Microphone on my laptop and the internal Webcam completely that they're no longer selectable, and no longer available?  I will only use my external Webcam, and my external (USB) headset.  The internal audio should still be available for playback. What do I say to make a new line when using voice recognition? I've found I can make punctuation happen by saying "comma", or "period", but I can't find the word for new line.  I tried "paragraph", and "line break", but it just prints those words. How can I have a "Dear %firstname%" template in my Gmail? It seems to be a very easy thing but I am struggling to see how. I need a "Dear %firstname%,  [cursor here] Kind Regards etc" template in my Gmail account, so every time I click reply, it is already there. How can I do that? I'm having this XML document with namespaces and I want to extract some nodes using XPath.  Here's the document:  &lt;ArrayOfAnyType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/"&gt;   &lt;anyType xsi:type="Document"&gt;     &lt;Id&gt;5&lt;/Id&gt;     &lt;Title&gt;T1&lt;/Title&gt;   &lt;/anyType&gt;    &lt;anyType xsi:type="Document"&gt;     &lt;Id&gt;15&lt;/Id&gt;     &lt;Title&gt;T15&lt;/Title&gt;   &lt;/anyType&gt; &lt;/ArrayOfAnyType&gt;   What's the XPath expression going to be if I want to extract all "anyType" elements with xsi:type="Document"?  I've tried this:   //anyType[@xsi:type="Document"]   and it doesn't work: How can I test two static methods (one invokes the other) with PowerMockito? Unknown error: '' ("The cache has no package named wine-staging-i386") Solution of trigonometric equation $0 = x\cos(x)+2$ How to add a progress bar to a shell script? When scripting in bash or any other shell in *NIX, while running a command that will take more than a few seconds, a progress bar is needed.  For example, copying a big file, opening a big tar file.  What ways do you recommend to add progress bars to shell scripts? I'm having trouble understanding the simple voltage regulator that can be built using a zener diode (from section 2.04 in the Art of Electronics).  I know that it would be better to use amplifiers, et cetera, but I'm just trying to understand how this circuit works.      I don't really understand how the circuit works, but I am guessing that when a load is applied to the output, it drains current from the source (Vin) and thus causes the voltage to drop?  How does the zener diode help to maintain the voltage and thus make this circuit act as a regulator? Most of something is plural or singular? I am writing a literature review. My question is which sentence is correct?   Most of the existing work focus on... Most of the existing work focuses on ... Most of the existing studies focus on ...   Thanks Is liquid cooling necessary for high CPU performance over extended periods? I'm planning on building a system for high CPU and memory performance.  Graphics performance is not a major concern, as I do not plan to use it for gaming.  I noticed that liquid cooling seems to have become common since my last build, and I am wondering if it is needed in my case.  I do not plan to overclock any of the components.  The intended use for the system is primarily development and occasional compute-intensive tasks that will run on all cores continuously for several days to a week.  The system will not normally be in continuous usage like this, but it needs to be capable of occasional extended periods of continuous use at full capacity.  I have included the main components below.  CPU: i7-5960X  Memory: 64GB DDR4  Graphics card: Nvidia GeForce GT 730 2GB  Drive 1: 1TB SSD  Drive 2: 4TB 7200RPM HDD  Power supply: 700W  Is liquid cooling needed for the above build?  If not, is there any advantage in using it?  I have read reviews that mentioned liquid cooling unit failures that resulted in leaks, so I would rather not use it if it is not necessary.  Thanks! cron.hourly sendmail errors even though my scripts do not involve sending mail An application of derivatives problem- to show that $f(x+2)-f(x)>2$ for $f(x)=x\cos(1/x)$ I have this function $$f(x) = x\cos(1/x)$$ defined for all $x \geq 1$.      How do I prove that    $$f(x+2)-f(x)&gt;2$$    for all $x\geq 1$?   I found $$f'(x)= \cos(1/x) + \frac{\sin(1/x)}{x}$$ and $$f''(x)=-\frac{\cos(1/x)}{x^3}.$$ How do i use this information? Suppose there are $2$ permutations given by $p$ and $q$. I need to check whether $p$ belongs to the group generated by $q$, and if so, it's representation in a power of $q$. In other words, I've been given $p$ and $q$, I need to check whether $\exists i \in \{ 0,...,|q|-1 \} \text{ such that } p = q^i$ I know that if $m = \gcd(i, |q|)$, then $|q^i| = \frac{|q|}{m}$. Now, say that such an $i$ exists. Then, $$ |p| = \frac{|q|}{\gcd(i, |q|)} \Rightarrow \gcd(i, |q|) = \frac{|q|}{|p|} $$ Thus, a necessary condition for such an $i$ to exist is: $|p|$ divides $|q|$ Say that this holds, and $\frac{|q|}{|p|} = r$, where r is an integer. Then we just have to solve $\gcd(i, |q|) = r$ for $ i \in \{ 0,...,|q|-1 \}$. Can this be done? If not manually, then by some efficient algorithm? (Note: Just looping over all values of $i$ is not efficient as $i$ may be very large) Edit: Another way I can think of solving this is by writing both $p$ and $q$ as product of disjoint cycles: $$ p = c_1c_2\ldots c_k \text{ and } q = d_1d_2\ldots d_l $$ And thus, as disjoint cycles commute: $$ p^i = c_1^ic_2^i\ldots c_k^i $$ How to proceed after this?