text:
Q: How to prove these using natural deduction I'd like to prove the following logical equivalence by using natural deduction:
$$(\exists x)(p(x) \implies q) \dashv\vdash (\forall x)(p(x)) \implies q.$$
As far as I'm concerned to show that two statements are equivalent we should show proofs for both of the sides. Can anyone help. Thanks in advance

A: For the first direction, $(\exists x)(p(x)\implies q) \vdash (\forall x)(p(x))\implies q$, we could reason as follows (in a natural deduction system):

*

*$(\exists x)(p(x)\implies q)\quad {\sf P}\quad$ 1

*$p(a)\implies q \quad {\sf EI(1)}\quad$ 1

*$(\forall x)(p(x))\quad{\sf P}\quad$ 3

*$p(a)\quad {\sf UI(3)}\quad$ 3

*$q \quad {\sf MP(2,4)}\quad$ 1,3

*$(\forall x)(p(x))\implies q\quad {\sf CondI(3,5)}\quad$ 1

For the converse (which you state to have proven already -- this is just for completeness' sake), we could do:

*

*$(\forall x)(p(x)) \lor \neg (\forall x)(p(x))\quad {\sf LEM}\quad$

*$(\forall x)(p(x)) \implies q\quad{\sf P}\quad$ 2

*$(\forall x)(p(x))\quad{\sf P}\quad$ 3

*$q\quad\sf MP(2,3)\quad$ 2,3

*$p(a)\quad\sf P\quad$ 5

*$p(a)\implies q\quad\sf CondI(5,4)\quad$ 2,3

*$(\exists x)(p(x)\implies q)\quad\sf EG(6)\quad$ 2,3

*$(\forall x)(p(x)) \implies (\exists x)(p(x)\implies q)\quad \sf CondI(3,7)\quad$ 2

*$\neg(\forall x)(p(x))\quad\sf P\quad$ 9

*$(\exists x)(\neg p(x))\quad\sf TI(9)\quad$ 9

*$\neg p(a)\quad\sf EI(10)\quad$ 9

*$p(a)\quad\sf P\quad$ 12

*$\bot\quad\sf BI(11,12)\quad$ 9,12

*$q\quad\sf BE(13)\quad$ 9,12

*$p(a)\implies q\quad\sf CondI(12,14)\quad$ 9

*$(\exists x)(p(x)\implies q)\quad\sf EG(15)\quad$ 9

*$\neg(\forall x)(p(x))\implies (\exists x)(p(x)\implies q)\quad\sf CondI(9,16)$

*$(\exists x)(p(x)\implies q)\quad \sf DisjE(1,8,17)\quad$ 2

Where at line 10, the (somewhat tedious to prove) equivalence between $\neg(\forall x)(p(x))$ and $(\exists x)(\neg p(x))$ was used to keep the proof reasonably short.
The abbreviations used for the respective rules should be easily readable to anyone familiar with natural deduction. If someone would appreciate them being explained explicitly, please let me know in the comments.
The lines in above derivations follow the scheme:

Line number. Formula$\quad$Rule$\quad$Undischarged premises

Added: It is worthwhile to note that the invocation of the Law of Excluded Middle is used essentially in the second proof. The two propositions are inequivalent in intuitionistic logic (the logic which accepts everything from classical logic except LEM (and its sister DNE, $\neg\neg p \vdash p$)).
We also have proven the drinker paradox as a special case (with $q = (\forall x)(p(x))$). It's fun to read about.

A: Just for practice, here's another Fitch style proof, using proof by contradiction (DNE rather than LEM) and only fundamental rules of induction.$$\def\fitch#1#2{\quad\begin{array}{|l}#1\\\hline#2\end{array}}{\fitch{~~1.~\exists x~(p(x)\to q)\hspace{16ex}\textsf{Premise}}{\fitch{~~2.~\forall x~p(x)\hspace{19ex}\textsf{Assumption}}{\fitch{~~3.~[c]~p(c)\to q\hspace{11.5ex}\textsf{Assumption}}{~~4.~p(c)\hspace{19ex}{\forall}\textsf{Elimination 2}\\~~5.~ q\hspace{22ex}{\to}\textsf{Elimination 4,3}}\\~~6.~q\hspace{25ex}\exists\textsf{Elimination 1,3-5}}\\~~7.~(\forall x~p(x))\to q\hspace{16ex}{\to}\textsf{Introduction 2-6}}\\\exists x~(p(x)\to q)~\vdash~(\forall x~p(x))\to q\\~\\\fitch{~~8.~(\forall x~p(x))\to q\hspace{17ex}\textsf{Premise}}{\fitch{~~9.~\neg\exists x~(p(x)\to q)\hspace{12ex}\textsf{Assumption}}{\fitch{10.~\exists x~\neg p(x)\hspace{15ex}\textsf{Assumption}}{\fitch{11.~[c]~\neg p(c)\hspace{12.5ex}\textsf{Assumption}}{\fitch{12.~p(c)\hspace{13.5ex}\textsf{Assumption}}{13.~\bot\hspace{16ex}\neg\textsf{Elimination}\\14.~q\hspace{16.5ex}\textsf{Ex Falso Quodlibet}}\\15.~p(c)\to q\hspace{12ex}{\to}\textsf{Introduction}\\16.~\exists x~(p(x)\to q)\hspace{7ex}\exists\textsf{Introduction 15}\\17.~\bot\hspace{19ex}\neg\textsf{Elimination 16,9}}\\18.~\bot\hspace{22ex}\exists\textsf{Elimination 10,11-17}}\\19.~\neg\exists x~\neg p(x)\hspace{17ex}\neg\textsf{Introduction 10-18}\\\fitch{20.~[a]\hspace{22ex}\textsf{Assumption}}{\fitch{21.~\neg p(a)\hspace{15.5ex}\textsf{Assumption}}{22.~\exists x~\neg p(x)\hspace{12ex}\exists\textsf{Introduction 21}\\23.~\bot\hspace{19ex}\neg\textsf{Elimination 22,19}}\\22.~\neg\neg p(a)\hspace{17ex}\neg\textsf{Introduction 21-23}\\23.~p(a)\hspace{20ex}\neg\neg\textsf{Elimination 22}}\\24.~\forall x~p(x)\hspace{20ex}\forall\textsf{Introduction 20-23}\\25.~q\hspace{26.5ex}{\to}\textsf{Elimination 24,8}\\26.~\exists x~q\hspace{23ex}\exists\textsf{Introduction 25}\\\fitch{27.~[c]~q\hspace{20ex}\textsf{Assumption}}{\fitch{28.~p(c)\hspace{17ex}\textsf{Assumption}}{29.~q\hspace{20ex}\textsf{Reiteration 27}}\\30.~p(c)\to q\hspace{16ex}{\to}\textsf{Introduction 28-29}\\31.~\exists x~(p(c)\to q)\hspace{11ex}\exists\textsf{Introduction 30}\\32.~\bot\hspace{23ex}\neg\textsf{Elimination 31,9}}\\33.~\bot\hspace{26ex}\exists\textsf{Elimination 26,27-32}}\\34.~\neg\neg\exists x~(p(x)\to q)\hspace{14ex}{\neg}\textsf{Introduction 9-33}\\35.~\exists x~(p(x)\to q)\hspace{17ex}{\neg\neg}\textsf{Elimination 34}}\\(\forall x~p(x))\to q~\vdash~ \exists x~(p(x)\to q)}$$

A: Here is a similar proof using a Fitch-style proof checker:

On line 9, rather than taking the negation of the goal, I tool the negation of the material implication equivalence of the goal.  It was (perhaps) easier to reach a contradiction using that technique. Regardless, from that result on line 14, I still had to derive the desired goal.

Kevin Klement's JavaScript/PHP Fitch-style natural deduction proof editor and checker http://proofs.openlogicproject.org/


text:
Q: How to get the data object from a certain template instance in Chrome Console in Meteor? <template name="orderForm">

  {{> photographyServicesForm}}
  {{> videographyServicesForm}}
  {{> onlineProductsForm}}

</template>

If I go to the orderForm page is there a way to get the data inside of the orderForm Blaze template instance when I'm in Chrome Console? I know how to get it inside the orderForm callbacks, events, helpers, and inside the HTML, but I want to be able to easily check up on it and even update it from the Chrome Console.
I also know that there are four different template instances when I go to this orderForm. Obviously Template.orderForm doesn't work because it's not the current template instance.
EDIT
Here's the answer:
<template name="orderForm">

  <div id="orderForm">
    {{> photographyServicesForm}}
    {{> videographyServicesForm}}
    {{> onlineProductsForm}}
  </div>

</template>

Blaze.getData($('#orderForm')[0])
It should be noted that the same data available on the orderForm template is also available to its child templates - photographyServicesForm, videographyServicesForm, onlineProductsForm

A: You want to check out Blaze.getData and Blaze.getView.
With Blaze.getData you can simply do this:
Blaze.getData(document.querySelector('.someelement'))

This works pretty well, but you have to have an element inside the template-instance you can query for.

redpajama_set_name: RedPajamaStackExchange


text:
Q: C# change settings file name In C#, is it possible to change the "Default" name for the settings file without having to create an additional settings file? For example, instead of using:
Properties.Settings.Default.Setting1

I want to use:
Properties.Settings.Group1.Setting1 and Properties.Settings.Group2.Setting2

A: Remember that Settings is a partial class. You can write a partial class Settings with your own properties. In my opinion, this is exactly why it is a partial class.
I wouldn't recommend changing the default Default property. You can, however write the following:
public partial class Settings {

   // provide custom Groups, etc.
   public void Group1 {
      // some specific collection or object
      return Group1.Settings
   }

   public void Group2 {
      // some specific collection or object
      return Group2.Settings
   }
}

...where Group1 and Group2 represent custom classes. Each Group object can have their own methods for saving data, settings, configurations, etc.

A: When you update your setting, add this code to persist
Properties.Settings.OtherName.Setting1 = ...;
Properties.Settings.OtherName.Save();


text:
Q: How to design an application in a modular way? I am looking for pointers, suggestions, links, warnings, ideas and even anecdotical accounts about "how to design an application in a modular way". I am going to use python for this project, but advice does not need to necessarily refer to this language, although I am only willing to implement a design based on OOP.
Here's some context to understand where I come from and what I am trying to achieve...

My project will be a small application that will consume web services and display the results in a variety of ways, including:

*

*notification popup containing just the result of the call

*tab in the main window of the application with graphics plotted from retrieved raw-data

*buffer of messages (visible on domand) where results from various services will pile up

The application will be released as free (as-in-speech) software, and for this reason I would like to make it really easy for other devs to write plugins/modules that will extend the functionality of the main application without needing to change the core code.
At this point in time, plugins should essentially enable a developer to activate a new webservice, by defining the provider, the data manipulation (if any) and the way the data will be presented to the user.
I have extensive experience in developing with drupal which has a powerful modular approach, but that also follows a non-object-oriented design, so I suspect that for python, drupal design might not be the optimal solution.
If this is of any importance - the core will be natively developed for GNU/Linux.
Thank you in advance for your time!

A: As you will deliver some basic functionality with your app, make sure that you code the part that should be extendable/replaceable already as a plugin by yourself. Then you'll best get a feeling about how your API should look like.
And to prove that the API is good, you should write a second and third plugin, because then you will discover that you made a lot of assumptions when writing the first one. Normally things clear up a bit after doing this 2nd and 3rd step.
Now, you should write one more plugin, because the last plugins you wrote resemble the first one in type, input data and presentation (maybe yet another weather webservice). Choose something total different, with absolutely different data, and you will see your API being still too tailored. (Else you did a good job!)

A: Well, probably the first place to start is to sit down and figure out what the plug-in might need to fulfill its purpose.
You'd want to consider two main aspects in your design.

*

*How will your framework pass requests / receive responses from the plug-in?

*What helper classes or modules might be good to provide?

And probably also, since this sounds like a learning project.

*

*What do you want to write yourself, and what are you happy just to pick out of an existing library?

I'd also recommend developing some basic plugins as you design the API. The experience of having to actually use what you design will allow you to see where a given approach might be making things harder than they need to be.

A: Try to keep things loosely coupled, and use interfaces liberally to help.
I'd start the design with the Separation of Concerns.  The major architectural layers are:

*

*Problem Domain (aka. Engine, Back-end): the domain classes, which do all the actual work, have domain knowledge implement domain behaviour

*Persistence: storage management for domain classes, database/filesystem layer

*User Interface: the GUI, which talks to the domain classes

*System Interfaces: talking to other systems, eg. networking, web services

The domain classes do the work, but don't know about the UI.  The persistence layer knows about the domain classes, enough to save/load as required.  The system interface layer abstracts away external systems, which lets you plug a simulator in behind while testing.  The UI should ideally use MVC, for maximum flexibility.
Without putting too fine a point on it, one would not ordinarily look to Drupal as an exemplar of good architectural design.  It has grown rather organically, and there have been many upheavals of the design, as evidenced by the regular plugin breakage upon system upgrades.
I would also echo what MicSim said, regarding carefully designing the plugin interface and writing multiple different plugins to exercise it.  This is the only way to really flesh out the issues of how the app and plugins interact.

A: *

*design the api for your app, carefully (How To Design A Good API and Why it Matters)

*make everything, which could be used independently a module, then group and build larger parts out of the simple parts (KISS)

*don't repeat yourself (DRY)

*write/publish short documentation frequently, for yourself and others (open source mantra) ...

A: Look into the listener-subscriber pattern. Sooner or later, your app will be complex enough that you need to implement callbacks. When you hit that limit, use listener-subscriber (there's an implementation in wxPython).
For example, several modules will want to watch for new data from a number of feeds. Modules that link together might want to update themselves, based on new data.


text:
Q: Time tracking like Expert rating tests I am trying to create an Online Quiz script like expert rating test on ODesk or Elance.
I want to track the time, means how much time have passed and left. I also want to stop the time counter, if the user internet connection is disconnected, so that he can start from where it was disconnected.
One last thing how to disable the last questions, which were attempted by the user. I am using PHP, MySql for it.
Your ideas will be great help for me.
Thanks in Advance

A: I've done something like this. Basically you have the right starting idea.  Create a timer table which stores start times, test id and user id.
On each page load or AJax call you check the current timestamp minus the start time to see how long has gone since they started.  If at any point it passes your limit you redirect them to the test complete page.  Don't worry about the internet connection its actually irrelevant.  This basic rule covers all.

A: I've done something related to this. you have to think about this to begin the idea. Create a timetable that stores begin the time, user id, or testing id.


text:
Q: Google App Engine : Bulkuploader : int64 too big error i am getting this error while uploading data to datastore using bulkuploader. Data used to be uploaded fine with the previous csv file. the new csv file has an extrafield that contains a list of strings. (ex. A,B,E,G,E,F). Following is the error that i get.
Traceback (most recent call last):
  File "/opt/google_appengine_1.6.4/google/appengine/tools/adaptive_thread_pool.py", line 176, in WorkOnItems
    status, instruction = item.PerformWork(self.__thread_pool)
  File "/opt/google_appengine_1.6.4/google/appengine/tools/bulkloader.py", line 764, in PerformWork
    transfer_time = self._TransferItem(thread_pool)
  File "/opt/google_appengine_1.6.4/google/appengine/tools/bulkloader.py", line 935, in _TransferItem
    self.request_manager.PostEntities(self.content)
  File "/opt/google_appengine_1.6.4/google/appengine/tools/bulkloader.py", line 1420, in PostEntities
    datastore.Put(entities)
  File "/opt/google_appengine_1.6.4/google/appengine/api/datastore.py", line 576, in Put
    return PutAsync(entities, **kwargs).get_result()
  File "/opt/google_appengine_1.6.4/google/appengine/datastore/datastore_rpc.py", line 786, in get_result
    results = self.__rpcs[0].get_result()
  File "/opt/google_appengine_1.6.4/google/appengine/api/apiproxy_stub_map.py", line 592, in get_result
    return self.__get_result_hook(self)
  File "/opt/google_appengine_1.6.4/google/appengine/datastore/datastore_rpc.py", line 1556, in __put_hook
    self.check_rpc_success(rpc)
  File "/opt/google_appengine_1.6.4/google/appengine/datastore/datastore_rpc.py", line 1191, in check_rpc_success
    rpc.check_success()
  File "/opt/google_appengine_1.6.4/google/appengine/api/apiproxy_stub_map.py", line 558, in check_success
    self.__rpc.CheckSuccess()
  File "/opt/google_appengine_1.6.4/google/appengine/api/apiproxy_rpc.py", line 156, in _WaitImpl
    self.request, self.response)
  File "/opt/google_appengine_1.6.4/google/appengine/ext/remote_api/remote_api_stub.py", line 248, in MakeSyncCall
    handler(request, response)
  File "/opt/google_appengine_1.6.4/google/appengine/ext/remote_api/remote_api_stub.py", line 397, in _Dynamic_Put
    'datastore_v3', 'Put', put_request, put_response)
  File "/opt/google_appengine_1.6.4/google/appengine/ext/remote_api/remote_api_stub.py", line 177, in MakeSyncCall
    self._MakeRealSyncCall(service, call, request, response)
  File "/opt/google_appengine_1.6.4/google/appengine/ext/remote_api/remote_api_stub.py", line 185, in _MakeRealSyncCall
    request_pb.set_request(request.Encode())
  File "/opt/google_appengine_1.6.4/google/net/proto/ProtocolBuffer.py", line 56, in Encode
    self.Output(e)
  File "/opt/google_appengine_1.6.4/google/net/proto/ProtocolBuffer.py", line 205, in Output
    self.OutputUnchecked(e)
  File "/opt/google_appengine_1.6.4/google/appengine/datastore/datastore_pb.py", line 4400, in OutputUnchecked
    self.entity_[i].OutputUnchecked(out)
  File "/opt/google_appengine_1.6.4/google/appengine/datastore/entity_pb.py", line 2380, in OutputUnchecked
    self.property_[i].OutputUnchecked(out)
  File "/opt/google_appengine_1.6.4/google/appengine/datastore/entity_pb.py", line 1307, in OutputUnchecked
    self.value_.OutputUnchecked(out)
  File "/opt/google_appengine_1.6.4/google/appengine/datastore/entity_pb.py", line 945, in OutputUnchecked
    self.referencevalue_.OutputUnchecked(out)
  File "/opt/google_appengine_1.6.4/google/appengine/datastore/entity_pb.py", line 675, in OutputUnchecked
    self.pathelement_[i].OutputUnchecked(out)
  File "/opt/google_appengine_1.6.4/google/appengine/datastore/entity_pb.py", line 135, in OutputUnchecked
    out.putVarInt64(self.id_)
  File "/opt/google_appengine_1.6.4/google/net/proto/ProtocolBuffer.py", line 402, in putVarInt64
    raise ProtocolBufferEncodeError, "int64 too big"

A: Changing the data type of problematic entries from IntegerProperty to StringProperty might help.
I was having the same problem, as I was storing user_id for Users entity as Integer, but when confronted with a bigger number, it simply can't hold it. So I am storing it as String now.


text:
Q: Tensor algebra $T(A \oplus B)$ is a coproduct of $T(A)$ and $T(B)$ in the category of unitary associative $(R, R)$-algebras. Let $A$ and $B$ be unitary $(R, R)$-bimodules. Let $f_1 \colon T(A) \to C$ and $f_2\colon T(B) \to C$ be identity preserving $(R, R$)-algebra homomorphisms. I need to define morphisms $\iota_1 \colon T(A) \to T(A \oplus B)$ and $\iota_2 \colon T(B) \to T(A \oplus B)$. My intuition told me that they are the inclusion maps. Not sure if this is right. How do I find a unique morphism $\bar{f} \colon T(A \oplus B) \to C$ such that $\bar{f} \circ \iota_i = f_i$.

A: Any left adjoint preserves colimits (MacLane, Categories for the working Mathematician, Theorem V.5.1). Now use that $T(-)$ is left adjoint to the forgetful functor from the category $(R,R)$-algebras to the category of $(R,R)$-modules. In fact, this holds for any monoidal category with $\otimes$-compatible coproducts (loc. cit., Theorem VII.3.2), where we apply this here to the monoidal category of $(R,R)$-modules aka $R$-bimodules.


text:
Q: Explanation for p-value inequality I was trying to go over this paper by Dudoit, Shaffer and Boldric when I came across this statement on page 78 (under section 2.4: Control of family-wise error rate):
$P(P_j\leq x \vert H_j)\leq x,$ for any $x\in[0,1] $
where
$P_j$ are the p-values and $H_j$ are true null hypotheses for $j=1,...,m_0$.
I'm still new in statistics and as simple as the inequality seems, I can't seem to wrap my head around it.  Can someone explain this inqeuality in plain words?
In addition, I'm currently doing a project in multiple hypotheses testing correction on dependent variables and it would be helpful if there are any good papers you can recommend that I read.

A: It looks like the inequality is presuming there are $m_0$ tests you want to run, and in every case, the null hypothesis is true. Then the inequality states that for each test, and for any real number $x ∈ [0, 1]$, the chance of getting a $p$-value less than or equal to $x$ is itself $x$. So, for example, the chance of getting $p \leq .05$ is $.05$. This is equivalent to saying that under the null hypothesis, $p$ is uniformly distributed on $[0, 1]$, as is typically desired.


text:
Q: $\overline{\mathrm{span} \{e_{2n} \ \mid \ n \}} + \overline{\mathrm{span} \{ e_{2n} + \frac{1}{n+1}e_{2n+1} \} }$ is dense but not the entire space
Regarding my previous question: $\overline{\mathrm{span} \{e_{2n} \ \mid \ n \}} \cap \overline{\mathrm{span} \{ e_{2n} + \frac{1}{n+1}e_{2n+1} \} } = 0$, but their sum is dense.

In the context of the above question: $\mathcal{H}$ is a separable Hilbert space, with a total orthonormal set $\{e_n \}_n$. I have able to prove that $$\overline{\mathrm{span} \{e_{2n} \ \mid \ n \}} \cap \overline{\mathrm{span} \{ e_{2n} + \frac{1}{n+1}e_{2n+1} \} } $$ is an internal direct sum and that $$\overline{\mathrm{span} \{e_{2n} \ \mid \ n \}} + \overline{\mathrm{span} \{ e_{2n} + \frac{1}{n+1}e_{2n+1} \} } $$ is dense in $\mathcal{H}$. However, I would now like to prove that $$\overline{\mathrm{span} \{e_{2n} \ \mid \ n \}} + \overline{\mathrm{span} \{ e_{2n} + \frac{1}{n+1}e_{2n+1} \} } \neq \mathcal{H}. $$
I have tried to do so by considering the sequence $$x_n = \frac{1}{n+1}e_{2n+1} = \left( e_{2n} + \frac{1}{n+1}e_{2n+1} \right) - e_{2n},$$ and at its sequence of partial sums $$s_n = \sum_{i=1}^n x_i. $$
The sequence $(s_n)_n$ does converge in $\mathcal{H}$ as, the sequence $(1/n)_n$ is an element of $\ell^2$. However, is its limit in the direct sum from above?

A: You are on the right track: No, the limit is not contained in the direct sum. Which proves the question claim.
The proof depends on a fact in Banach space theory:
Let $B$ be a Banach space and consider closed subspaces $X,Z\subset B$. If $B$ is algebraically isomorphic to the direct sum $X\oplus Z$, then the isomorphism is also topological, i.e., an isomorphism of Banach spaces.
This is implied by the Inverse mapping theorem which states "The inverse of a continuous linear bijection between Banach spaces is continuous." (being a corollary to the Open mapping theorem).
Furthermore, the projectors onto the subspaces are then continuous operators on $B$.
Generalising your choice of $(s_n)$, let $\lambda\in\ell^2(\mathbb N)$ satisfy $\lambda_{2n+1}\neq 0\,$ for infinitely many $n$, but $\lambda_{2n}=0$ for all $n$.
This gives
$$v\:=\:\sum_{n=0}^\infty\lambda_{2n+1}e_{2n+1}\in\mathcal{H}$$
and it is shown, after appropriate choice of $\lambda$, that $v\notin F+G\,$ where $F,G$ denote the closed subspaces in question.
Look at the partial sums
$$\begin{align}v_N & \:=\:\sum_{n=0}^N\lambda_{2n+1}e_{2n+1}\:=\:
\sum_{n=0}^N\lambda_{2n+1}\big[(n+1)\big(e_{2n}+\tfrac1{n+1}e_{2n+1}\big)
 -(n+1)e_{2n}\big]\\[1ex]
 & \:=\:\sum_{n=0}^N\lambda_{2n+1}\sqrt{(n+1)^2+1}\; \frac{e_{2n}+\tfrac1{n+1}e_{2n+1}}{\sqrt{1+\frac1{(n+1)^2}}}
 \quad-\quad\sum_{n=0}^N\,(n+1)\lambda_{2n+1}\,e_{2n}\end{align}$$
which are finite linear combinations, thus certainly $v_N\in F+G$.
It is shown in another post that $F\cap G=\{0\}$, so that we really deal with a direct sum  decomposition $F\oplus G$ here. Then the splitting in the last formula line into $F$- and $G$-components is uniquely determined, and these components are the images under the two projections onto $F$ and $G$ of $v_N$.
If $F\oplus G$ were all of $\mathcal H$, then the projections are continuous by the above fact, and the convergence $v_N\rightarrow v$ implies convergence in $F$ and $G$ separately.
Now many possible choices for $\lambda\in\ell^2(\mathbb N)$ carry on sabotage of convergence in $F$ and $G$. Your choice made in the question  is one of them since the second summand then becomes $\sum_{n=0}^N e_{2n}\,$.
This proves $F\oplus G\not= \mathcal H.\qquad\blacksquare$


text:
Q: How can I Found what is causing crashing page in Mobile? I have a problem:
Cart and checkout page in the mobile version: on scrolls page refreshed and suddenly crashed and in safari, I get this error: a problem repeatedly occurred.
I checked the following ways but I couldn't find what caused this problem:

*

*I enable WP_DEBUG and fix all errors.

*I check each single js file structure in online tools that check the
structure of JS files.

*I create wp-content/mu-plugins and disable unnecessary plugins on these pages.

*I removed .css and .js files of the theme to see if this file caused
this error.

*I checked the console in inspect mode. and there is no error there.

Would you please share your experience what else I should check to see the reason of the


text:
Q: How to Record a sequence of events in a vector I want to create UNDO and REDO for my application.
this is the UNDO REDO class
 const int MAX_NUMBER_OF_UNDO = 8;

class UNDO_REDO
{
private:
    std::vector<std::unique_ptr<Sum_UndoRedo>> undo;
    int currentNumber;
public:
    UNDO_REDO();
    void AddUndo(std::unique_ptr<Sum_UndoRedo>);
    void Pop_Back_Undo();
};

Every time a action is performed it is stored in the undo vector.
i want to record the last 8 actions , when the size of undo vector  increases more than 8  i erase the first element of the vector and than push back the action to the vector and always maintain the size of the vector as 8 which are the last 8 actions performed.
Since i have never done UNDO and REDO before  , is this a good way to do UNDO and REDO ?
Since Erase will move all the vector elements each time i perform erase do i have any alternative method to keep the size as 8 ?


text:
Q: char array to LPCTSTR May I know how I can perform the following conversion?
// el.strCap is char[50]
// InsertItem is expecting TCHAR pointer (LPCTSTR)
// How I can perform conversion?
// I do not have access in both "list" and "el" source code
// Hence, there is no way for me to modify their signature.
list.InsertItem(i, el.strCap);

And No. I do not want to use
WideCharToMultiByte

They are too cumbersome to be used.

A: If you're using ATL, then you can use the various macros and helper classes that it includes to do the conversion:
char *test = "Hello World";
CA2CT ct(test);
list.InsertItem(i, ct);

Though saying WideCharToMultiByte is too cumbersome is a bit disingenious, in my opinion. It's easy enough to wrap a call to WideCharToMultiByte and make it return an std::wstring or whatever you need. In fact, that's basically what CA2CT is doing under the covers...

A: If your character string is encoded as ISO-8859-1, it's easy to convert to UTF-16:
// Convert an ISO-8859-1 string to a UTF-16 string
wchar_t wstr[50];
for (int i = 0; i < 50; ++i)
{
    wstr[i] = el.strCap[i];
    if (!wstr[i])
        break;
}

But if your data is anything other then ISO-8859-1 (or ASCII which is a subset), then you will need to handle a more complex conversion.  Once you need to do that, you will find that MultiByteToWideChar is not that cumbersome in comparison.

A: You could also use CStringW i.e. list.InsertItem(i, CStringW("blah"));


text:
Q: Replace nodes with radials This is my first exposure to d3.js. I'd like to replace the nodes in the tree with the radial graphs. See this jsfiddle.
I believe this portion
// Declare the nodes…
   var node = svg.selectAll("g.node")
   .data(nodes, function (d) { return d.id || (d.id = ++i); });

needs to be replaced with this.
var rp1 = radialProgress(document.getElementById('div1'))
            .label("RADIAL 1")
            .onClick(onClick1)
            .diameter(150)
            .value(78)
            .render();

When I replaced the declare node portion with the radial code nothing shows.


text:
Q: Microsoft.Office.Interop.Word Listen on the Saved Property I've been searching for a solution to get noticed when a Document turned Dirty (Unsaved)
I know that there is a property  Saved on a word document but my problem is that I need to get notice when that Boolean turn to false. I've been searching for an event with no success.
Events that I've tried :
DocumentChange // this event fired when the a new document is open
WindowSelectionChange // this event fired when the carriage move but not when the document text change

I looked at the Microsoft.Interop event page but none of them seem to work for my case.
I'm out of solution.
Context:
I created a WPF application that upload the document. Inside this application I've a upload button. This button is disable when the Saved property of the document is true and I want to unable it when this flag turn to false. But there is no hook when this property change...

A: I'm not aware of any way you can do exactly what you want - there's no specific event, so the only thing I could think would be to check each time the selection changes (as although this fires when there is no change, it will also fire when there is a change).
Another solution, though: your WPF button is probably bound to an ICommand which has a bool CanExecute() method.  If the command's CanExecuteChanged event is linked to the framework's CommandManager.RequerySuggested event, then the button should update on various events (focus change etc - whenever the framework thinks state may have changed.  It fires a lot!)
public event EventHandler CanExecuteChanged
{
    add { CommandManager.RequerySuggested += value; }
    remove { CommandManager.RequerySuggested -= value; }
}

This is usually how various MVVM framework's RelayCommand / DelegateCommand implementations handle this.

A: Try to use the DocumentBeforeSave method of the Application class. It is fired before any open document is saved.
Also you may consider using a timer object for checking the Saved property value periodically. Be aware, you need to access the Word object model on the main thread to avoid issues because Office applications uses the single threaded apartment model.


text:
Q: Excute powershell SCVMM cmdlets from Asp.Net Web API I'm developing a Web Api in Asp.Net. I need that the web API comunicates with SCVMM, using .Net Framework.
We all know that SCVMM does not provide an API o interface similar to execute functions from c# code, but we have the option to run commands from PowerShell.
The situation is as follows:

*

*From PowrShell prompt I can comunicate without any problem with SCVMM

*From c# code using Cake.Pworsehl Nuget Package I can execute cmdlets with SCVMM commands
and comunicate with SCVNMM without problems.

*Using the functions that I've wrote before, I've created a Dll with all the
functionality that I need, I have also added a TestProject for that dll and all works
fine.

*The problem is that when I call the same functions from the WebApi project using
debugmode in VS 2022 I have the following error:

System.Management.Automation.CmdletInvocationException: 'You do not have access to the  management server VMM NO_PARAM. (Error Id: 1604)
The weird thing is that, as I said before, I can run all funcitons from PowerShell prompt, and execute all the code from TestProjects and even a console application, but if I call the same functions form web api, I get that error.
I'm thinking that the problemas has to be realted with de Identity or something similar, but I can not found any way to specify credentials for run powershell cmdlets form c# code.
This is the function that gives me the error:
public List<Vm> GetVMsBase()
{

    InitialSessionState initialSessionState = InitialSessionState.CreateDefault();
    initialSessionState.ExecutionPolicy = ExecutionPolicy.Unrestricted;
    initialSessionState.ImportPSModule(new string[] { "virtualmachinemanager" });

    using (var myRunSpace = RunspaceFactory.CreateRunspace(initialSessionState))
    {
          myRunSpace.Open();
          using (var pipeLine = myRunSpace.CreatePipeline())
          {
                Command cmd = new Command("Get-SCVirtualMachine");
                cmd.Parameters.Add("VMMServer", "vmmserver.domain.com");
                pipeLine.Commands.Add(cmd);

                return pipeLine.Invoke().Select(vm =>
                new Vm
                {
                    Name = vm.Properties["name"].Value.ToString(),
                    Owner = ((string[])vm.Properties["CustomProperties"].Value)[1],
                    ExpirationDate = DateTime.TryParse(
                                ((string[])vm.Properties["CustomProperties"].Value)[0], new CultureInfo("es-ES"), DateTimeStyles.None, out DateTime dt) ?
                                dt : new DateTime(1800, 1, 1),
                    CreationDate = DateTime.TryParse(
                                vm.Properties["CreationTime"].Value.ToString(), new CultureInfo("es-ES"), DateTimeStyles.None, out DateTime dt2) ?
                                dt2 : new DateTime(1800, 1, 1),
                    Hlnumber = ((string[])vm.Properties["CustomProperties"].Value)[2],
                    State = Enum.TryParse(vm.Properties["VirtualMachineState"].Value.ToString(), out VirtualMachineState vmState) ? vmState : VirtualMachineState.Unknow
                }).ToList();

                if (pipeLine.Error != null && pipeLine.Error.Count > 0)
                {
                    //check error
                }
            }
        }

Is there any way to call or run this code from web api?
thanks for your attention.

A: finaly I'v solved this problem, there was nothing wrong with the code to run powershell cmdlets, the problem was with the configuration of IIS expres (in visual studio) and when deploy the api in IIS 10.
In both cases I have to setup de configuration in a way that Anonymous logon was disabled and the only Authettication method used was "Windows", and that's it.
In IIS express you have to edit the .config file located in the .vs directory of the solution, and in IIS 10 you have to edit your site setting in the Authetication Options.


text:
Q: Adding team members on Onsen IDE I upgraded to the developer level on the Onsen IDE. It seems that at that level it is still not possible to add a team member. At what level is it possible?

A: As described on Monaca's pricing page, it's possible to access Team features with the Gold plan.


text:
Q: Passing Image using Ajax to PHP I am trying to pass an image and a title field value to PHP, I usually process file uploads straight with PHP using the $_FILES array, I am not sure how to create/pass this array using ajax to PHP.
My form:
<form role="form" name="updateProductForm" id="updateProductForm" method="POST" enctype="multipart/form-data">
    <input name="imgOne" id="imgOne" type="file" title="Add Image">
    Update Product

</form>

And I am trying to use this to pass to PHP:
$('#updateProduct').on('click', function() {
    try {
        ajaxRequest = new XMLHttpRequest();
    } catch (e) {
        try {
            ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                alert("Your browser broke!");
                return false;
            }
        }
    }
    ajaxRequest.open("POST", "../Controller/ProductController.php", true);
    ajaxRequest.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    ajaxRequest.send("title=" + $("#title").val() + "&imgOne=" + $("#imgOne"));

    // Create a function that will receive data sent from the server
    ajaxRequest.onreadystatechange = function(){
        if(ajaxRequest.readyState == 4){
            console.log(ajaxRequest);
        }
    }

});

In PHP I am trying this:
if (isset($_POST["edit"])) {
    $id = $_POST["edit"];
    $imgName = $_FILES["file"]["imgName"];
}

Youssef

A: I did that in one of my project, and following code works for me.
Please do required modifications in code as your need.
My Form button:
 <form name="upload_img" enctype="multipart/form-data" id="upload_img">
<input type="file" style="display:none" id="upload-image" name="upload-image"></input>
<button id="upload_image" type="button">Save</button>
</form>

My JQuery/Ajax :
$('#upload_image').click(function()
{
    var form = new FormData(document.getElementById('upload_img'));
    //append files
    var file = document.getElementById('upload-image').files[0];
    if (file) {
        form.append('upload-image', file);
    }
    $.ajax({
        type: "POST",
        url: "URL",
        data: form,
        cache: false,
        contentType: false, //must, tell jQuery not to process the data
        processData: false,
        //data: $("#upload_img").serialize(),
        success: function(data)
        {
            if(data == 1)
                $('#img_msg').html("Image Uploaded Successfully");
            else
                $('#img_msg').html("Error While Image Uploading");
        }
    });
    //alert('names');

});

A: You can use jQuery file upload plugin
$('#imgOne').change(function(){

  $.ajaxFileUpload({

        fileElementId: 'imgOne',
        url: "../Controller/ProductController.php",

        dataType: 'json',

        success: function(response)
        {
         //Success Code Here
        },

        error: function()
        {
           //Error Code Here
        }
  });
});

A: *

*First  You need to Select image file through following line of html code
input type="file" id="image_to_upload"

*After that you need to write the following jQuery code to catch this event.

    jQuery.noConflict();
    formdata = new FormData();
    jQuery("#image_to_upload").on("change", function() {
        var file = this.files[0];
        if (formdata) {
            formdata.append("image", file);
            jQuery.ajax({
                url: "destination_ajax_file.php",
                type: "POST",
                data: formdata,
                processData: false,
                contentType: false,
                success:function(){}
            });
        }
    });

*In the destination ajax file you can access image by the following variable

print_r($_FILES);

More Info: http://www.rscoder.com/2020/06/how-to-upload-image-file-using-ajax.html


text:
Q: Query if else if else check true? Hello i want to check if a div has the class active.
the first item works, after that it stops. Can someone tell me how to fix this?
(Its a slider, so it has to work not on click.) It slides automatic.
http://i61.tinypic.com/28h2zb6.jpg
    <script>
$(document).ready(function () {
  if ($('#211').hasClass('item active')){
            $('.vandaag').css("background-color", "blue");
            console.log("werkt1!");}
   else if ($('#218').hasClass('item active')){
            $('.vandaag').css("background-color", "#005993");
            console.log("werkt2!");}

    else if ($('#219').hasClass('active')){
            $('.vandaag').css("background-color", "#005993");
            console.log("werkt3!");}
});

</script>

the number is the id of the image slider. and the .item .active is when the slide is active.
Greetz

A: Don't use else if, because it stops after the first block works.
Instead use if() { } blocks.
 $(document).ready(function() {
        if ($('#211').hasClass('item active')) {
            $('.vandaag').css("background-color", "blue");
            console.log("Works!");
        }
        if ($('#218').hasClass('item active')) {
            $('.vandaag').css("background-color", "#005993");
            console.log("works2!");
        }
        if ($('#219').hasClass('active')) {
            $('.vandaag').css("background-color", "#005993");
            console.log("works3!");
        }
    });

A: You do not need else condition if you want multiple conditions to be executed:
 $(document).ready(function () {
   if ($('#211').hasClass('item active')){
      $('.vandaag').css("background-color", "blue");
      console.log("Works!");}
   if ($('#218').hasClass('item active')){
      $('.vandaag').css("background-color", "#005993");
      console.log("works2!");}
   if ($('#219').hasClass('active')){
      $('.vandaag').css("background-color", "#005993");
      console.log("works3!");}
  });


text:
Q: \nameref using 'unexpanded' text? Suppose I define a custom command \exercise as follows.
\newcounter{exercise}
\newcommand\exercise{%
    \refstepcounter{exercise}%
    \section*{Exercise \theexercise}%
}

Now, in the following example, I want to use \nameref from the hyperref package.
\exercise\label{ex:first}
foo

\exercise\label{ex:second}
see \nameref{ex:first}

\exercise\label{ex:third}
bar

This produces "see Exercise 2" instead of "see Exercise 1". It seems like the 'unexpanded' text is used, expanding into the current counter value. How can I make sure that \nameref{ex:first} produces "Exercise 1"?
(Of course, I could just use Exercise~\ref{ex:first}, but this is more error-prone. And, in the future, I may want to replace "exercise" by "problem" without having to find and replace all occurences in my document.)

Full example:
\documentclass{article}

\usepackage{hyperref}

\newcounter{exercise}
\newcommand\exercise{%
    \refstepcounter{exercise}%
    \section*{Exercise \theexercise}%
}

\begin{document}

\exercise\label{ex:first}
foo

\exercise\label{ex:second}
see \nameref{ex:first}

\exercise\label{ex:third}
bar

\end{document}

A: Indeed, you need to pass the expansion of \theexercise, because hyperref doesn't do it to the title.
\documentclass{article}
\usepackage{hyperref}

\newcounter{exercise}
\newcommand\exercise{%
  \par % just in case
  \refstepcounter{exercise}%
  \begingroup\edef\x{\endgroup
    \noexpand\section*{\unexpanded{Exercise} \theexercise}%
  }\x
}

\begin{document}

\exercise\label{ex:first}
foo

\exercise\label{ex:second}
see \nameref{ex:first}

\exercise\label{ex:third}
bar

\end{document}

This is the (abridged) contents of the .aux file:
\newlabel{ex:first}{{1}{1}{Exercise 1}{section*.1}{}}
\newlabel{ex:second}{{2}{1}{Exercise 2}{section*.2}{}}
\newlabel{ex:third}{{3}{1}{Exercise 3}{section*.3}{}}

It was
\newlabel{ex:first}{{1}{1}{Exercise \theexercise }{section*.1}{}}
\newlabel{ex:second}{{2}{1}{Exercise \theexercise }{section*.2}{}}
\newlabel{ex:third}{{3}{1}{Exercise \theexercise }{section*.3}{}}

with your code.
Note. Why \unexpanded{Exercise}? In the particular case it is obviously unnecessary, but it would be for the German "Übung".

You might use cleveref instead.
\documentclass{article}
\usepackage{hyperref}
\usepackage[nameinlink]{cleveref}

\newcounter{exercise}
\newcommand\exercise{%
  \par % just in case
  \refstepcounter{exercise}%
  \section*{Exercise \theexercise}
}
\crefname{exercise}{Exercise}{Exercises}

\begin{document}

\exercise\label{ex:first}
foo

\exercise\label{ex:second}
see \cref{ex:first}

\exercise\label{ex:third}
bar

\end{document}

The output is the same in both cases.

Can we avoid the \edef\x{\endgroup trick? Yes, of course.
\documentclass{article}
%\usepackage{xparse} % not needed for LaTeX 2020-10-01 or later
\usepackage{hyperref}
\usepackage[nameinlink]{cleveref}

\ExplSyntaxOn
\NewDocumentCommand{\exercise}{}
 {
  \gooz_exercise:ne { \exercisename } { \theexercise }
 }
\cs_new_protected:Nn \gooz_exercise:nn
 {
  \par % just in case
  \refstepcounter{exercise}
  \section*{#1~#2}
 }
\cs_generate_variant:Nn \gooz_exercise:nn { ne }
\ExplSyntaxOff

\newcommand{\exercisename}{Exercise}
\newcounter{exercise}
\crefname{exercise}{\exercisename}{\exercisename s}

\begin{document}

\exercise\label{ex:first}
foo

\exercise\label{ex:second}
see \cref{ex:first} or \nameref{ex:first}

\exercise\label{ex:third}
bar

\end{document}

Note that cleveref is not necessary, just remove the relevant calls if you prefer \nameref.


text:
Q: Table Cellpadding and Border Color Issue I am having some trouble with cellpadding when creating a table and border color within the table.
Not sure if there is some other table related CSS that is overriding the cellpadding I am trying to give a new table.
Any suggestion on how I can get the correct cellpadding and border color within the table?
This is a screenshot of the table I am trying to replicate:

Here is a screenshot of the table I have created.

Here is the CSS and table HTML:

table, td, th {
  border: 1px solid black;
  height: 30px !important;
  display: table-cell;
  vertical-align: middle;
}

table {
    border-top-width: 2px;
    border-right-width: 2px;
    border-bottom-width: 2px;
    border-left-width: 2px;
    width: 70%;
}

tbody {
    display: table-row-group;
    vertical-align: middle;
    border-color: inherit;
}

tr {
    display: table-row;
    vertical-align: inherit;
    border-color: inherit;
}

tr td {
    border-color: #e0dede !important;
}

      Spring <80°
      Summer >80°
      Fall <80°

      Number of Days per Week
      1
      2
      1

      Duration
      Through the remainder of the season

        Turn on watering hose to a slight trickle and         lay it at the base of the tree for approximately 20 to 30 minutes.  Repeat this step on the other side of the tree

A: Your code almost works already. You just have to add border-collapse: collapse; to the table rule to avoid double borders, and add padding to the td rule:

table,
td,
th {
  border: 1px solid black;
  height: 30px !important;
  display: table-cell;
  vertical-align: middle;
}

table {
  border-top-width: 2px;
  border-right-width: 2px;
  border-bottom-width: 2px;
  border-left-width: 2px;
  width: 70%;
  border-collapse: collapse;
}

tbody {
  display: table-row-group;
  vertical-align: middle;
  border-color: inherit;
}

tr {
  display: table-row;
  vertical-align: inherit;
  border-color: inherit;
}

tr td {
  border-color: #e0dede !important;
  padding: 4px 10px;
}

      Spring <80°
      Summer >80°
      Fall <80°

      Number of Days per Week
      1
      2
      1

      Duration
      Through the remainder of the season

      Turn on watering hose to a slight trickle and lay it at the base of the tree for approximately 20 to 30 minutes.  Repeat this step on the other side of the tree

BTW, I would rather use separate rules for table th and td, where you can define different border styles. Also, your forst css rule would actually apply display: table-cell to the table...

A: I advice you to not set all border on td and not on table because it will create you an extra space between the table and the cell border.
So you should set the CSS below to remove the space between the cells:
table{
  border-collapse: collapse;
  border-spacing: 0;
  border:0;
}

and this CSS to make exterior broder larger:
tbody > tr > td:first-child{
  border-left:2px solid black !important;
}
tbody:first-child > tr:first-child > td {
  border-top:2px solid black !important;
}
tbody > tr > td:last-child{
  border-right:2px solid black !important;
}
tbody:last-child > tr:last-child > td {
  border-bottom:2px solid black !important;
}

DEMO

table, td, th {
  border: 1px solid black;
  height: 30px !important;
  display: table-cell;
  vertical-align: middle;
}

table {
    border-top-width: 2px;
    border-right-width: 2px;
    border-bottom-width: 2px;
    border-left-width: 2px;
    width: 70%;
}

tbody {
    display: table-row-group;
    vertical-align: middle;
    border-color: inherit;
}

tr {
    display: table-row;
    vertical-align: inherit;
    border-color: inherit;
}

tr td {
    border-color: #e0dede !important;
}

/*ADDED*/
table{
  border-collapse: collapse;
  border-spacing: 0;
  border:0;
}

tbody > tr > td:first-child{
  border-left:2px solid black !important;
}
tbody:first-child > tr:first-child > td {
  border-top:2px solid black !important;
}
tbody > tr > td:last-child{
  border-right:2px solid black !important;
}
tbody:last-child > tr:last-child > td {
  border-bottom:2px solid black !important;
}

      Spring <80°
      Summer >80°
      Fall <80°

      Number of Days per Week
      1
      2
      1

      Duration
      Through the remainder of the season

        Turn on watering hose to a slight trickle and         lay it at the base of the tree for approximately 20 to 30 minutes.  Repeat this step on the other side of the tree

A: You were almost there - all I have done below is remove the attributes from your table tag, add border collapse to the table and add padding to the td and th (plus remove all the extra stuff that wasn't needed)

td,
th {
  border: 1px solid black;
  height: 30px;
  vertical-align: middle;
  padding: 5px;
}

table {
  border: 2px solid black;
  border-collapse: collapse;
  width: 70%;
}

tr td {
  border-color: #e0dede;
}

      Spring <80°
      Summer >80°
      Fall <80°

      Number of Days per Week
      1
      2
      1

      Duration
      Through the remainder of the season

      Turn on watering hose to a slight trickle and lay it at the base of the tree for approximately 20 to 30 minutes.  Repeat this step on the other side of the tree


text:
Q: Bash adds extra space between characters On one particular directory, bash is adding an extra tab worth of space between cursor points/characters that I type.
For example:
~(master)$              l                 s

If I am still typing once it reaches the end of that line, rather than creating a new line as expected, the characters that I type appear to overwrite each other in the last space on the line.  If I hit return(enter) the command will execute as it normally would.
This is ONLY occurring on one particular directory.. In other directories, bash operates as usual.
So far this has occurred over a two day period.  In that time I have restarted bash, my computer, worked in other directories with no issues.
declare -p git_branch git_dirty

outputs:
declare -- git_branch="(master)" declare -- git_dirty="*"

type find_git_branch find_git_dirty update_terminal_cwd

outputs:
find_git_branch is a function
find_git_branch ()
{
local branch;
if branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null); then
    if [[ "$branch" == "HEAD" ]]; then
        branch='detached*';
    fi;
    git_branch="($branch)";
else
    git_branch="";
fi
}
find_git_dirty is a function
find_git_dirty ()
{
local status=$(git status --porcelain 2> /dev/null);
if [[ "$status" != "" ]]; then
    git_dirty='*';
else
    git_dirty='';
fi
}
update_terminal_cwd is a function
update_terminal_cwd ()
{
local SEARCH=' ';
local REPLACE='%20';
local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}";
printf '\e]7;%s\a' "$PWD_URL"
}

Bash debug outputs:
+ w
12:46  up 21:23, 3 users, load averages: 1.40 1.69 1.69
USER     TTY      FROM              LOGIN@  IDLE WHAT
holiday  console  -                Mon15   21:22 -
holiday  s000     -                11:13      53 grunt
holiday  s001     -                11:53       - w


text:
Q: How to extend a given function to an odd function with period 2 (Fourier Series) This is the question.
f(x) = 7x^2 + 4

I want to know how to extend the above fuction to become a odd function with period 2.

A: $g(x) = f(x), 0\leq x\leq 1,$
$g(x) = -f(x), -1 \leq x \leq 0,$
$ g(x) = g(x+2)$ to define g(x) in x $\in \mathbb R$


text:
Q: Display last and next month in a simple calendar Here is the demo.
I created a simple calendar and it works out for the current month. However I have "<<" and ">> to indicate last and next month, clicking them just not working.
A piece of code:
prevMonth:function(){
    var month = $('.u-start-month').text(),
        year = $('.u-start-year').text();
    if(month <= 1){
        month = 12;
        --year;
    }
    else{
        --month;
    }
    this.initDate(year, month, $.proxy(function(){
        this.dir = 'left';
        this.init(year, month);
    }, this));
},

Did I miss something?

A: Nothing was missing it just seems you never hooked up an event handler for the function. So just add this
jQuery
 $('.u-start-prev').on('click',function(){

        Start.prevMonth();

    });
     $('.u-start-next').on('click',function(){

        Start.nextMonth();

    });

And it seems to be working after that. Here is the fiddle with it working. Let me know if I misunderstood something.
http://jsfiddle.net/44LpP/2/

A: Add the onclick event directly in your HTML code: http://jsbin.com/piqatota/1/edit?html,js,output

<<

            Start Calander
            -

>>


text:
Q: How to edit this code to only paste the value using VBA? I have this code in VBA to copy and paste into the next empty cell in column DK, but given that the original cell is a function, the pasted value shows up as 0. Is there any way to paste only the value of the original cell?
Sub CopyToDK()
Range("CN59").Copy Range("DK" & Rows.Count).End(xlUp)
End Sub

A: If you only want to copy the value, you can do this...
Sub CopyToDK()
Range("DK" & Rows.Count).End(xlUp) = Range("CN59")
End Sub

A: Range("CN59").Copy
Range("DK" & Rows.Count).End(xlUp).PasteSpecial xlPasteValues


text:
Q: Iteration error in Excel sheet When I tried to select items from the item list using Excel sheet through Java environment, only the first item is selected and executed. The next set of iteration is not happening.
int i=1;

while (i<=sheet.getLastRowNum()  )
{

    row = sheet.getRow(i);

    String w = row.getCell(0).getStringCellValue();
    //  Processing : logic on "items" from excel

    i++;
}

A: OK then try this sample firstly before your code. Check every column and row is visited. Maybe better way is using Iterators.
try {

    FileInputStream file = new FileInputStream(new File("C:\\test.xls"));

    //Get the workbook instance for XLS file
    HSSFWorkbook workbook = new HSSFWorkbook(file);

    //Get first sheet from the workbook
    HSSFSheet sheet = workbook.getSheetAt(0);

    //Iterate through each rows from first sheet
    Iterator<Row> rowIterator = sheet.iterator();
    while(rowIterator.hasNext()) {
        Row row = rowIterator.next();

        //For each row, iterate through each columns
        Iterator<Cell> cellIterator = row.cellIterator();
        while(cellIterator.hasNext()) {

            Cell cell = cellIterator.next();

            switch(cell.getCellType()) {
                case Cell.CELL_TYPE_BOOLEAN:
                    System.out.print(cell.getBooleanCellValue() + "\t\t");
                    break;
                case Cell.CELL_TYPE_NUMERIC:
                    System.out.print(cell.getNumericCellValue() + "\t\t");
                    break;
                case Cell.CELL_TYPE_STRING:
                    System.out.print(cell.getStringCellValue() + "\t\t");
                    break;
            }
        }
        System.out.println("");
    }
    file.close();
    FileOutputStream out =
        new FileOutputStream(new File("C:\\test.xls"));
    workbook.write(out);
    out.close();

} catch (FileNotFoundException e) {
    e.printStackTrace();
} catch (IOException e) {
    e.printStackTrace();
}


text:
Q: Unwanted row deletion in Hibernate, when mapping many-to-one I have the following mapping in my hibernate application. When I delete a row from this Booking table, the correspondent rows in the User and item tables are deleted. I use delete method of hibernate Session. I tried cascade="all" and "none". But neither of them worked.
I have some Users and some items. Each user can have 0..* rows and each item can have0..* rows in the Booking table!
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
    <class name="my.hibernate.operations.Booking" table="testBooking" catalog="efeu">
        <id name="id" type="java.lang.Long">
            <column name="id" />
            <generator class="native" />
        </id>

        <many-to-one name="userID" column="user_id"
            not-null="true" class="my.hibernate.actors.User" />
        <many-to-one name="itemID" column="item_id"
            not-null="true" class="my.hibernate.items.Item" />

        <property name="startDate" type="java.sql.Date" not-null="true">
            <column name="start_date" length="10" />
        </property>

        <property name="endDate" type="java.sql.Date">
            <column name="end_date" length="10" />
        </property>
    </class>
</hibernate-mapping>

It provieds me with the following error:
org.hibernate.exception.ConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`efeu`.`testbooking`, CONSTRAINT `FKEC7473671463A66C` FOREIGN KEY (`user_id`) REFERENCES `testuser` (`id`))
    org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:128)
    org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)
    org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)
    org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110)
    org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:129)
    org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)
    $Proxy8.executeUpdate(Unknown Source)
    org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:56)
    org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:3134)
    org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:3337)
    org.hibernate.action.internal.EntityDeleteAction.execute(EntityDeleteAction.java:100)
    org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:362)
    org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:354)
    org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:280)
    org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:326)
    org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52)
    org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1214)
    org.hibernate.internal.SessionImpl.forceFlush(SessionImpl.java:1233)
    org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:182)
    org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:49)
    org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:90)
    org.hibernate.internal.SessionImpl.fireSave(SessionImpl.java:757)
    org.hibernate.internal.SessionImpl.save(SessionImpl.java:749)
    org.hibernate.internal.SessionImpl.save(SessionImpl.java:745)
    my.hibernate.items.ItemDAO.save(ItemDAO.java:35)
    actions.subscriber.BookItem.cancellBooking(BookItem.java:118)
    actions.subscriber.BookItem.execute(BookItem.java:101)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452)
    com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254)
    com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
    org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    interceptors.LoginInterceptor.intercept(LoginInterceptor.java:52)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
    org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)
    org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)

root cause

com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`efeu`.`testbooking`, CONSTRAINT `FKEC7473671463A66C` FOREIGN KEY (`user_id`) REFERENCES `testuser` (`id`))
    com.mysql.jdbc.SQLError.createSQLException(SQLError.java:931)
    com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
    com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
    com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1169)
    com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:693)
    com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1404)
    com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1318)
    com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1303)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:122)
    org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)
    $Proxy8.executeUpdate(Unknown Source)
    org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:56)
    org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:3134)
    org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:3337)
    org.hibernate.action.internal.EntityDeleteAction.execute(EntityDeleteAction.java:100)
    org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:362)
    org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:354)
    org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:280)
    org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:326)
    org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52)
    org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1214)
    org.hibernate.internal.SessionImpl.forceFlush(SessionImpl.java:1233)
    org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:182)
    org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:49)
    org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:90)
    org.hibernate.internal.SessionImpl.fireSave(SessionImpl.java:757)
    org.hibernate.internal.SessionImpl.save(SessionImpl.java:749)
    org.hibernate.internal.SessionImpl.save(SessionImpl.java:745)
    my.hibernate.items.ItemDAO.save(ItemDAO.java:35)
    actions.subscriber.BookItem.cancellBooking(BookItem.java:118)
    actions.subscriber.BookItem.execute(BookItem.java:101)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452)
    com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254)
    com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
    org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    interceptors.LoginInterceptor.intercept(LoginInterceptor.java:52)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
    org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)
    org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)

Anyway, due to requests I copy the structure of all tables, however I know it is not needed! Attention! These tables have been made automatically by Hibernate!
CREATE TABLE `testuser` (
  `id` bigint(20) NOT NULL,
  `user_type` varchar(8) NOT NULL,
  `username` varchar(30) DEFAULT NULL,
  `password` varchar(128) DEFAULT NULL,
  `forename` varchar(128) DEFAULT NULL,
  `surname` varchar(128) DEFAULT NULL,
  `userlevel` varchar(30) DEFAULT NULL,
  `email` varchar(120) DEFAULT NULL,
  `phone_number` varchar(25) DEFAULT NULL,
  `address` varchar(150) DEFAULT NULL,
  `regDate` datetime DEFAULT NULL,
  `birthday` datetime DEFAULT NULL,
  `payable` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `testbooking` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) NOT NULL,
  `item_id` bigint(20) NOT NULL,
  `start_date` date DEFAULT NULL,
  `end_date` date DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `FKEC747367A12BE486` (`item_id`),
  KEY `FKEC7473671463A66C` (`user_id`),
  CONSTRAINT `FKEC7473671463A66C` FOREIGN KEY (`user_id`) REFERENCES `testuser`
(`id`),
  CONSTRAINT `FKEC747367A12BE486` FOREIGN KEY (`item_id`) REFERENCES `testitem`
(`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;

CREATE TABLE `testitem` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `item_type` varchar(8) NOT NULL,
  `title` varchar(30) DEFAULT NULL,
  `author` varchar(128) DEFAULT NULL,
  `item_status` varchar(30) DEFAULT NULL,
  `publication_date` datetime DEFAULT NULL,
  `publisher` varchar(80) DEFAULT NULL,
  `language` varchar(3) DEFAULT NULL,
  `duration` int(11) DEFAULT NULL,
  `trackNumber` int(11) DEFAULT NULL,
  `pages_number` int(11) DEFAULT NULL,
  `edition` int(11) DEFAULT NULL,
  `isbn` bigint(20) DEFAULT NULL,
  `serial_number` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=latin1;

A: If I understand your problem correctly, Booking is a junction entity between User entity and Item entity. Judging by the entity names, User is the owner of the relationship.
In this case, the Hibernate mapping for User entity should look like this:-
<hibernate-mapping>
    <class name="...User" ...>
        <id name="id" column="user_id">
            <generator class="native"/>
        </id>

        <set name="bookings" inverse="true" cascade="all-delete-orphan">
            <key column="user_id"/>
            <one-to-many class="Booking"/>
        </set>

        ...
    </class>
</hibernate-mapping>

The User entity looks something like this:-
public class User {

    private Long id;
    private Collection<Booking> bookings = new HashSet<Booking>();
    ...

    // assuming if you want to create bi-directional relationship between User and Booking
    public void addBooking(Booking booking) {
        booking.setUser(this);
        bookings.add(booking);
    }

    // getters and setters
    ...
}

To remove a booking from the user, instead of deleting it directly from the Booking entity, you will want to do it this way:-

*

*First, you get hold of the user object first, ex: session.load(User.class, <someUserId>);

*Find and remove the booking object from user.getBookings() collection.

*Update the user object ( session.saveOrUpdate(user); ) and the cascade will automatically remove the entry from the Booking table.


text:
Q: How to retrieve ResultSet from CallableStatment after executeUpdate() I am executing a store procedure in Java. One of procedure returns multiple rows.
int haveResults = Param.callableStatement.executeUpdate();
System.out.println(haveResults);
if (haveResults > 0) {
    System.out.println("I have results"); //This statement is printed
    ResultSet rs = Param.callableStatement.getResultSet();
    while (rs.next()) { //This is where I am getting error:NullPointerException
        //If I comment 'while(rs.next())' then code is giving output but then it can't handle multiple rows
        itr1 = listOutParam.iterator();
        while (itr1.hasNext()) {
            Object obj = null;
            obj = ParameterGetter.getParameter(itr1.next().toString(), counter1);
            list.add(obj);
            counter1++;
        }
        System.out.println(list.toString());
        list1.add(list);
        counter1 = counter2;
    }
}
}

I tried using execute() but then if is returning false value indicating the procedure is not executing successfully.

A: If you want to retrieve a ResultSet from a CallableStatement you need to use execute() instead of executeUpdate()
if (Param.callableStatement.execute()) {
     ResultSet rs = Param.callableStatement.getResultSet();
     ...
}


text:
Q: Why is my Scheduled Task not running I have a scheduled task which takes the hostname and other Calendar information from a JSP page. For the "HOUR_of_Day" input, I always add 12 and pass the total to Calender since it uses a 24 - hour format. What I did worked fine yesterday evening but it is not working this morning. It does not run anymore at the scheduled time. I certainly have done something wrong and need some direction. Below is my code:
import java.util.Calendar;
import java.util.Timer;
import java.util.TimerTask;

public class ScheduledTask extends TimerTask {

     String hostname = null;

     //The default no - arg constructor
     //=============================
     public ScheduledTask(){

     }

     /**
      * Another overloaded constructor
      * that accepts an object
      * @param scanHostObj

    public ScheduledTask(ScanHost scanHostObj){

        hostname = scanHostObj.getHostname();

    }

    /**
     * Another overloaded constructor
     * that accepts a string parameter
     * @param nodename
     */
    public ScheduledTask(String nodename){
       hostname = nodename;
    }

    /**
     * The run method that executes
     * the scheduled task
     */
    public void run() {

        new ScanUtility().performHostScan(hostname);

    }

    public void executeScheduledScanJob(ScanHost hostObj, Scheduler schedulerObj){

        /**
         * Get the various schedule
         * data, convert to appropriate data type
         * and feed to calender class
         */
        String nodename = hostObj.getHostname();
        String dayOfScan = schedulerObj.getDayOfScan();
        String hourOfScan = schedulerObj.getHourOfScan();
        String minuteOfScan = schedulerObj.getMinuteofScan();

        //Convert String values to integers
        //===================================
        final int  THE_DAY =  Integer.parseInt(dayOfScan);
        final int  THE_HOUR = Integer.parseInt(hourOfScan);
        final int  REAL_HOUR = THE_HOUR + 12;
        final int  THE_MINUTE = Integer.parseInt(minuteOfScan);

        /**
         * Feed these time values to the Calendar class.
         * Since Calendar takes a 24 - hour format for hours
         * it is better to add 12 to any integer value for
         * hours to bring the real hourly format to the 24
         * format required by the Calendar class
         */
        Calendar scheduleCalendar = Calendar.getInstance();
        scheduleCalendar.set(Calendar.DAY_OF_WEEK,  THE_DAY);
        scheduleCalendar.set(Calendar.HOUR_OF_DAY,   REAL_HOUR);
        scheduleCalendar.set(Calendar.MINUTE,    THE_MINUTE);

        /**
         * Then Initialize the timer Object
         * and pass in parameters to it method
         * cancel out all tasks/jobs after running them
         */

         Timer scheduledTimeObj = new Timer();
         ScheduledTask scheduledTaskObj = new ScheduledTask(nodename);

        scheduledTimeObj.schedule(scheduledTaskObj, scheduleCalendar.getTime());

        scheduledTimeObj.cancel();
        scheduledTaskObj.cancel();

    }

}

A: You could try to replace
  scheduleCalendar.set(Calendar.HOUR_OF_DAY,   REAL_HOUR);

With this:
 scheduleCalendar.set(Calendar.HOUR,   THE_HOUR);

This one will take 12 hour format.
Additionally, you can set AM_PM to AM or PM. If you try to parse a PM date, use PM here.
scheduleCalendar.set(Calendar.AM_PM,   Calendar.PM);


text:
Q: JLabel doesnt move I've wanted to move a little Picture. It's an ImageIcon in a JLabel. My plan was to press a JButton executing an while loop wich moves it every second 50px to the right.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class Game extends JFrame implements ActionListener{

JButton jbUUp;
JButton jbUDw;
JButton jbUSh;

public static ImageIcon shot;
public static ImageIcon spL;
public static ImageIcon spR;

public static JLabel LspL;
public static JLabel LspR;
public static JLabel Lshot;

public static int shPosUser = 150;
public static int shPosKI = 150;
public static int shXPosUser = 180;

Game(){setLayout(null);
       setDefaultCloseOperation(EXIT_ON_CLOSE);
       setSize(1000, 500);
       getContentPane().setBackground(Color.WHITE);

       spR = new ImageIcon("src/spR.jpg");
       LspR = new JLabel(spR);
       LspR.setSize(170, 170);
       LspR.setLocation(820, shPosKI);
       LspR.setVisible(true);

       spL = new ImageIcon("src/spL.jpg");
       LspL = new JLabel(spL);
       LspL.setSize(170, 170);
       LspL.setLocation(10, shPosUser);
       LspL.setVisible(true);

       shot = new ImageIcon("src/shot.gif");
       Lshot = new JLabel(shot);
       Lshot.setSize(21, 15);
       Lshot.setLocation(shXPosUser, shPosUser + 77);
       Lshot.setVisible(false);

       jbUUp = new JButton("U");
       jbUUp.setSize(60, 30);
       jbUUp.setLocation(10, 350);
       jbUUp.addActionListener(this);

       jbUDw = new JButton("D");
       jbUDw.setSize(60, 30);
       jbUDw.setLocation(10, 420);
       jbUDw.addActionListener(this);

       jbUSh = new JButton("S");
       jbUSh.setSize(60, 30);
       jbUSh.setLocation(10, 385);
       jbUSh.addActionListener(this);

       add(LspR);
       add(LspL);
       add(Lshot);
       add(jbUUp);
       add(jbUDw);
       add(jbUSh);
       }

public void actionPerformed(ActionEvent e){if(e.getSource() == jbUUp){User.moveUp();}

                                           if(e.getSource() == jbUDw){User.moveDown();}

                                           if(e.getSource() == jbUSh){User.shot();}
                                          }

}

These are the two classes
public class User {

User(){}

public static  void moveUp(){Game.shPosUser = Game.shPosUser - 10;
                             Game.LspL.setLocation(10, Game.shPosUser);}

public static  void moveDown(){Game.shPosUser = Game.shPosUser + 10;
                               Game.LspL.setLocation(10, Game.shPosUser);}

public static void shot(){Game.Lshot.setVisible(true);
                          while(Game.shXPosUser < 500){timeout(1000);
                                                       Game.shXPosUser = Game.shXPosUser + 50;
                                                       System.out.println(Game.shXPosUser);
                                                       Game.Lshot.setLocation(Game.shXPosUser, Game.shPosUser);
                                                        }
                          Game.Lshot.setVisible(false);
                          Game.shXPosUser = 180;
                          Game.Lshot.setLocation(Game.shXPosUser, Game.shPosUser );
                          }

public static void timeout(int time){try{Thread.sleep(time);}
                                     catch(Exception e){}
                              }

}

Now my problem is that the Picture doesn't move. The Coordinates are changed but its not relocated.

A: You have to repaint the frame to view changes, so call repaint() method of JFrame to update the ui.
for example,
if(e.getSource() == jbUUp){
    User.moveUp();
    repaint();
}

Hope it'll work.

A: The JLabel is moving. The screen isn't being repainted, so it can't show the new position of the JLabel. Somewhere in the Game file, you need to call repaint(); to repaint the screen;

A: First of all:

*

*Post properly formatted code when you ask a question. The indentation of your code is all over the place. If you want us to take the time to read your code, then make sure the code is readable.

*Get rid of all the static variables. That is not how the static keyword should be used.

*Follow Java naming conventions. Variable names should NOT start with an upper case character.

My plan was to press a JButton executing an while loop wich moves it every second 50px to the right

You can't use a while loop. The Thread.sleep() inside the loop will prevent the GUI from repainting itself until the loop finishes executing, in which case you will only see the icon in its final position.
The solution is to use a Swing Timer. The Timer will generate an event at which time you can calculate the new location. You will then need to stop the Timer when you want the animation to finish.
Read the section from the Swing tutorial on How to Use Swing Timers for more information.


text:
Q: In number ring $D=\mathbb Z[\sqrt{-5}]$ I am stuck in reading Marcus book, Chapter 3.
Let $D=\mathbb Z[\sqrt{-5}]$.
I need to verify that $$(1-\sqrt{-5})=(2,1+\sqrt{-5})(3,1-\sqrt{-5}).$$
I proved that $(1+\sqrt{-5})=(2,1+\sqrt{-5})(3,1+\sqrt{-5})$.
According to Marcus book,  $(2,1+\sqrt{-5}),(3,1+\sqrt{-5}),(3,1-\sqrt{-5})$ are prime ideals. Why?
I know the target is to prove the factorization of ideal $(6)$ is unique of prime ideals.

A: I'll do $\langle2,1+\sqrt 5 \rangle$. You'll get the idea.
The idea is that the quotient by a prime ideal should yield a domain:
So we have the ring $D=\mathbb Z[\sqrt 5]$ which I'm going to describe as $\mathbb Z[x]/\langle x^2-5\rangle$. We are further quotienting by the ideal $I=\langle 2, 1+x \rangle$ in this ring. Noticing that $x^2-5 = (x-1)(x+1)-2\cdot2\in\langle 2, 1+x \rangle$, we have
$$D/I\cong \mathbb Z[x]/\langle 2,1+x\rangle/\langle x^2-5 \rangle \cong \mathbb Z[x]/\langle 2, x+1 \rangle \cong \mathbb Z/2\mathbb Z,$$
which is a domain.


text:
Q: Selecting Current Date I have created following code for selecting the current date in the textbox.
$('#rstStartDTM').data("DateTimePicker").minDate(new Date("01/01/1970"));
$('#rstStartDTM').data("DateTimePicker").maxDate(
  new Date($.now()));

rstStartDTM is my textbox id.
But it is not reflecting in the textbox. Can anyone help me to solve this issue. Thank you.

A: Have a look at this js fiddle :-
Date picker default date
$('#rstStartDTM').datetimepicker();
$('#rstStartDTM').data("DateTimePicker").date(new Date());

A:
   $(document).ready(function () {
       $('#rstStartDTM').datepicker({
           dateFormat: "dd-mm-yy"
       });

   });
</script>

You can try this first and then in your textbox set attribute
ClientIDMode="Static" and then set another attribute  AutoPostBack="True"


text:
Q: CPU on Ubuntu running high In the terminal I used "top" to check the processes and how much of the CPU was being used as I thought max was 100%, so I restored 292,000 photos with recoverjpeg on my sda1 HDD, I opened the folder and the Nautalis is  fluctuating between 130% and 170% , should I close the program and am I at risk of my gpu locking up ?

A: When you are looking at the CPU% or Load factor you have to divide by the number of CPU Cores x Hyper Threading. So if you have a quad core processor with hyper threading it's in interpreted as 8 CPU's.
If your CPU% shows 200% and it is 8 CPUs then your real CPU usage is 25%.
If your load factor show ".92" and you have 8 CPUs then your real load factor is ".115". In your Conky you would massage your load factor (for 5 minutes, 10 minutes and 15 minutes) by using:
${execpi .001 (awk '{printf "%s/", $1}' /proc/loadavg; grep -c processor /proc/cpuinfo;) | bc -l | cut -c1-4} ${execpi .001 (awk '{printf "%s/", $2}' /proc/loadavg; grep -c processor /proc/cpuinfo;) | bc -l | cut -c1-4} ${execpi .001 (awk '{printf "%s/", $3}' /proc/loadavg; grep -c processor /proc/cpuinfo;) | bc -l | cut -c1-4}

The Real CPU percentage can never go over 100% and the Real load factor can never go over 1 so you have to mentally do the math dividing by the number of CPUs or use Conky for accurate results instead of Top or whatever program you were using.

Conky vs top screen example
Comparing top CPU% to Conky's CPU%:

Firefox is consuming the most CPU%. In top it is listed at 27.8% in Conky it is listed at 3.37%. Taking Conky's percentage and multiplying by 8 (the number of CPUs) yields 27%.