UPDATE counter_reports
SET `counter`=`counter`+1,`date`=?
WHERE report_id IN(
(SELECT report_id FROM counter_reports WHERE report_name="emails_sent" AND `year`=1 ORDER BY report_id DESC LIMIT 1),
(SELECT report_id FROM counter_reports WHERE report_name="emails_sent" AND `month`=1 ORDER BY report_id DESC LIMIT 1),
(SELECT report_id FROM counter_reports WHERE report_name="emails_sent" AND `week`=1 ORDER BY report_id DESC LIMIT 1),
(SELECT report_id FROM counter_reports WHERE report_name="emails_sent" AND `day`=1 ORDER BY report_id DESC LIMIT 1)
)
Is there any alternative for such sql? I need to update(increment by 1) last counter reports for day,week,month and year.
If I'm adding manually, sql works fine, but with subqueries it fails to launch.
Thanks. :)
I recently got hired as a web developer, and the project that I am overseeing has a formatting issue on one of the pages because one of the divs is out of whack. It is a fairly complex page with quite a bit of php, and from what I can gather, I am missing a </div> tag somewhere, and accordingly everything is messed up.
I am currently using notepad++, which is decent at lining up divs, meaning that if you click on the opening div tag, it will highlight purple and also highlight the closing one. But it seems as though if you have div tags that span several lines (hundreds) it won't work.
Has anyone else run into a similar situation? Is there a better editor I could be using that would do a better job of helping me with my div issue? Or do I have to go through and line up the divs 1 by 1? (there are like over 100). Please let me know!! Thanks
Trying to use something like the below with a char array but it doesn't compile. But the example with short[] works fine. Any idea why? :)
char someChars[] = {'s','h','e','r','r','y'};
BOOST_FOREACH(char& currentChar, someChars)
{
}
short array_short[] = { 1, 2, 3 };
BOOST_FOREACH( short & i, array_short )
{
++i;
}
Hello!
I want to make a loop on a variable that can be altered inside of the loop.
first_var.sort.each do |first_id, first_value|
second_var.sort.each do |second_id, second_value_value|
difference = first_value - second_value
if difference >= 0
second_var.delete(second_id)
else
second_var[second_id] += first_value
if second_var[second_id] == 0
second_var.delete(second_id)
end
first_var.delete(first_id)
end
end
end
How do I do this, because this doesn't work?
What would you say are these kind of questions good way to improve your skills or just waste of time since they have no application in real life(or not).
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=3
I have been finding ways around this for a long time but think it's time I addressed it.
If I have a page that has a dropdown menu, is there anyway I can select a value which will subsequently load other values further down.
Can this be done without a page reload?
I will give you an example.
Say I was making some tools for an admin panel, but first of all they needed to select a member to work with.
They would select the member and then below, the fields about that member would be populated based on what was selected in the first menu.
As I have already asked, can this be done without a page reload?
Thanks for reading.
How can I match the following pattern?
"anything123.anythingelse"
Alphanum of any length, with exactly 1 "." in the middle, and then alphanum of any length?
Thanks.
I would like to create a StringVar() that looks something like this:
someText = "The Spanish Inquisition" #Here's a normal variable whose value I will change
eventually
TkEquivalent = StringVar() #and here's the StringVar()
TkEquivalent.set(string(someText)) #and here I set it equal to the normal variable. When
someText changes, this variable will too...
HOWEVER:
TkEquivalent.set("Nobody Expects " + string(someText))
If I do this, the StringVar() will no longer automatically update! How can I include that static text and still have the StringVar() update to reflect changes made to someText?
Thanks for your help.
(I'm coming from an iPhone dev world. )
In Android do we need to worry what OS version we compile against? In the iPhone world I would usually target a release that's at least 6 months old to limit the number of issues with installing on iPhones with old OSs.
What strategy should I use when choosing what to compile against on the Android?
I have the following interface:
public interface MyFunctor {
int myFunction(int x);
}
And I created a class which implements this interface :
public class Myfunction1 implements MyFunctor {
}
But it show me the error :
implement all abstract method
Please help me.
var array1:Array = new Array();
var array2:Array = new Array();
var obj1:Object = new Object();
array1.push(obj1);
array2.push(obj1);
if i change something in obj1 will array1[0] and array2[0] also change?
Hello, I have a class called User which has 2 properties : login/password. I am trying to authenticate a user in my application using hibernate criteria but my request doesn't work.
[EDIT] The returned value is NULL. I have two users in my database for testing.
Here is my code :
@Override
public User authenticate(String login, String password)
throws NullPointerException {
Session session = this.getSession();
User user = (User) session
.createCriteria(User.class)
.add(
Restrictions.and(
Property.forName("login").eq(login),
Property.forName("password").eq(password)
)).uniqueResult();
if (user == null){
throw new NullPointerException("User not found");
}
return user;
}
Can someone tells me what is wrong with my code?
Happy new Year 2011 !!
do you got the solution for your problem ?
im working on the exact same thing and cant get it to work...
if u could post the solution, it would be much appreciated :o
greetingz
msn: [email protected]
steam : [email protected]
How can I get a specific value from an object?
I'm trying to get a value of an instance
for eg.
ListOfPpl newListOfPpl = new ListOfPpl(id, name, age);
Object item = newListOfPpl;
How can I get a value of name from an Object item??
Even if it is easy or does not interest you can anyone help me??
Edited: I was trying to build a binary tree contains the node of ListOfPpl, and need to sort it in the lexicographic. Here's my code for insertion on the node. Any clue??
public void insert(Object item){
Node current = root;
Node follow = null;
if(!isEmpty()){
root = new Node(item, null, null);
return;
}boolean left = false, right = false;
while(current != null){
follow = current;
left = false;
right = false;
//I need to compare and sort it
if(item.compareTo(current.getFighter()) < 0){
current = current.getLeft();
left = true;
}else {
current = current.getRight();
right = true;
}
}if(left)
follow.setLeft(new Node(item, null, null));
else
follow.setRight(new Node(item, null, null));
}
Good Day,
I have a small form with a combo box (ASP.NET Drop Down List control) and a text box (with a DIV id txtName). When the selected index of the combo box changes, I want to clear out the text box.
I understand that:
$("#txtName").val(''); clears the text box value
The thing is the combo box. It contains a list of integers representing the months of the year. The drop down control is called ddlMonths.
$("#ddlMonths").change(function() {
$("#txtName").val('');
});
I thought by using change, an onSelectedIndexChange event handler would be associated with this control.
I also tried (because I've ran into the client id being mangled in ASP.NET w/ jQuery) this:
$("#<%=ddlMonths.ClientID%>").change(function() {
$("#<%=txtName.ClientID%>").val('');
});
and neither approach seems to be working. Am I missing something?
TIA,
coson
My comments on this answer got me thinking about the issues of constness and sorting. I played around a bit and reduced my issues to the fact that this code:
#include <vector>
int main() {
std::vector <const int> v;
}
will not compile - you can't create a vector of const ints. I suppose I should have known this, but I've never needed to create such a thing before. However, it seems like a useful construct to me, and I wonder if there is any way round this problem - I want to add things to a vector (or whatever), but they should not be changed once added.
There's probably some embarrassingly simple solution to this, but it's something I'd never considered before.
I'm trying to build a pager where it's just Next / Previous buttons that call a jquery function that post a JSON request. Inside the function, the current page "index" is retrieved from a hidden field and passed to the controller. Inside the controller, I reset the index if I'm on the last page of data. How would I pass the new index value back to the view? Or is there a better way to do what i'm trying to do?
Thanks
hi,
i have a blog application were Post belongsTo Category and Category hasMany Post
Post can have a Category or not - in latter case NULL value is present in Post.category_id field.
Now i would like to have following category count with single SQL query
category|post_count
--------------
PHP | 2
JavaScript | 4
SomeOtherCat | 1
NULL | 3
The clue here is that i also want to count posts without category (NULL row above). Is it posibble with one SQL query?
Hello,
I have one page which uses <ui:insert> called master.xhtml which uses one managedbean named MasterBean.java and its of viewScoped. It calls webservice and has all useful data which will be useful in master.xhtml as well as page which is built using master.xhtml (which uses <ui:include>). When i visit data.xhtml (which uses template as master.xhtml) and which uses managed bean as DataBean.java which is also of view scoped, how do i use MasterBean? If i directly use #{Masterbean.property}, won't it create a new instance again? or will it use the bean which is already in view scope? Also how do i use MasterBean in DataBean in such a way that existing MasterBean's instance is used in DataBean. I don't want new instance of MasterBean in DataBean.
Thanks in advance. If i am not clear please let me know.
I know how to detect if a particular GET method is in the url:
$username = $_GET['username'];
if ($username) {
// whatever
}
But how can I detect something like this:
http://www.mysite.com?username=me&action=editpost
How can I detect the "&action" above?
I want to select a date from oracle table formatted like select (to_char(req_date,'MM/YYYY')) but I also want to order the result set on this date format.
I want them to be ordered like dates not strings.
Like this
09/2009
10/2009
11/2009
12/2009
01/2010
02/2010
03/2010
04/2010
05/2010
06/2010
07/2010
08/2010
09/2010
10/2010
11/2010
12/2010
Not like
01/2010
02/2010
03/2010
04/2010
05/2010
06/2010
07/2010
08/2010
09/2009
09/2010
10/2009
10/2010
11/2009
11/2010
12/2009
12/2010
Any way to do this in sql?
full sql is select (to_char(req_date,'MM/YYYY')) as monthYear,count(req_id) as count from REQUISITION_CURRENT t group by to_char(req_date,'MM/YYYY')
Thanks