Hi,
I have two tables like of this structure
content (content_id, content_type, user_id, time, comment_count)
comments (comment_id, content_id, userid, comment, comment_time)
What I wold like to do is update the comments_count field with sum of comments i.e COUNT(content_id) from the comments table.
I am not able to figure out the right syntax
Thanks
My form works in firefox but not ie. I've tried using a hidden text field (fail)... I tried using an image instead of a submit button (fail)... are there any other solutions?
I just started on the .net compact framework. I want to draw a Sudoku field on the screen. So I put down a PictureBox and defined a method for the Paint event:
private void pictureBoxPlayfield_Paint(object sender, PaintEventArgs e)
{
// use e.Graphics to draw the grid, numbers and cursor
}
This works, but you can see as the grid is drawn. So my question is, what is the right/better way to create such a custom control? Is there maybe a way to enable double buffering?
I want to document the default value of an enum typed field:
/// <summary>
/// The default value is <see cref="Orientation.Horizontal" />.
/// </summary>
public Orientation BoxOrientation;
The compiler warns that it couldn't resolve the reference. Prefixing F: or M: silences the compiler, but E: also does, so I'm unsure what prefix is correct.
In our database tables we keep a number of counting columns to help reduce the number of simple lookup queries. For example, in our users table we have columns for the number of reviews written, photos uploaded, friends, followers, etc. To help make sure these stay in sync we have a script that runs periodically to check and update these counting columns.
The problem is that now that our database has grown significantly the queries we have been using are taking forever to run since they are totally inefficient. I would appreciate someone with more MySQL knowledge than myself to recommend how we can improve it's efficiency:
update users
set photos=(select count(*)
from photos
where photos.status="A"
AND photos.user_id=users.id)
where users.status="A";
If this were a select statement I would just use a join but I'm not sure if that is possible with update.
Thanks in advance for your help!
in my database , dates are stored in DD-mm-yyyy format , how can i sort this to obtain the earliest date ?
Cursor c = myDb.query(TABLE, new String[]{"dob"}, null, null, null, null, "dob");
I have selected it to order by dob field but its not ordered ...
This is the output for the above query
01-03 17:14:51.595: VERBOSE/ORDER DOB(1431): 01-11-1977
01-03 17:14:51.595: VERBOSE/ORDER DOB(1431): 01-12-1988
01-03 17:14:51.614: VERBOSE/ORDER DOB(1431): 15-01-1977
01-03 17:14:51.656: VERBOSE/ORDER DOB(1431): 31-01-1988
I am trying to query the following HQL using GORM:
MailMessage.executeQuery("toId, count(toId) from (SELECT toId, threadId FROM MailMessage as m WHERE receiveStatus = '$u' GROUP BY threadId, toId) as x group by x.toId")
The problem is that count(toId) is a computed field doesn't exist in MailMessage and that I am using a subquery.
I get the following error: java.lang.IllegalArgumentException: node to traverse cannot be null! Ideally, I would like to use a generic executeQuery which will return data of anytype. Is there such a thing?
Hi,
My UIView contains Two UITextField.I need to restrict copy,paste option for one textfield.I don't want to restrict that for another.
When i am using the following code,Both the field gets restricted from copy,paste.
-(BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
if ( [UIMenuController sharedMenuController] )
{
[UIMenuController sharedMenuController].menuVisible = NO;
}
return NO;
}
Can any one provide me the solution to solve my problem.
I have the following SQL query, note I want the literal value '0' in the second
field in the second SELECT statement from the ItemSale table.
How do I express this in LINQ?
I get the error message 'Invalid anonymous type member declarator'.
SELECT BranchNumber,QuantitySold
FROM Department
UNION
SELECT BranchNumber,0
FROM ItemSale
How to express the '0' in LINQ?
var unionQuery = (from dept in Department
select new
{
dept.BranchNumber,
dept.QuantitySold,
})
.Concat(from item in ItemSale
select new
{
item.BranchNumber,
0
});
Hi,
I have one abstract class -let's say myBase. And I want all the classes derived from myBase to have one static field called
public static List<string> MyPArameterNames
{
get {return _myParameterNames;}
}
So, every child class can tell what parameter names it uses; I want static because I do not want to create an instance just for this.
How can I achieve this?
Hello!
There's photologue application, simple photo gallery for django, implementing Photo and Gallery objects.
Gallery object has ManyToMany field, which references Photo objects.
I need to be able to get list of all Photos for a given Gallery. Is it possible to add Gallery filter to Photo's admin page?
If it's possible, how to do it best?
Is there a way to lookup the line number that a given element is at in an xml file via the w3c dom api?
My use case for this is that we have 30,000+ maps in kml/xml format. I wrote a unit test that iterates over each file found on the hard drive (about 17GB worth) and tests that it is parseable by our application. When it fails I throw an exception that contains the element instance that was considered "invalid". In order for our mapping department (nobody here knows how to program) to easily track down the typo we would like to log the line number of the element that caused the exception.
Can anybody suggest a way to do this? Please note we are using the W3C dom api included in the Android 1.6 SDK.
Is it possible to prevent a user from editing the title of a node on the node edit screen?
One of the things I really detest about Drupal is the rigidity of the title & body field in each node.
I have model whith 3 tabels and one is link table with additional field:
Groups
Id
Name
Users
Id
Name
Roles
Id
Name
LinkTable
Id
GroupId
UserId
RoleId
The quuestion is how to add 3 related entities:
Code bellow doesn't work.
using (var db = new dbEntities())
{
db.Groups.AddObject(Group.CreateGroup(1, "TestGroup"));
db.Users.AddObject(User.CreateUser(1, "AdminUser"));
db.Roles.AddObject(Role.CreateRole(1, "Admin"));
db.UserGroupRoles.AddObject(UserGroupRole.CreateUserGroupRole(1, 1, 1, 1));
db.SaveChanges();
}
If I have a domain that I wish to serve "naked" eg http://examp.le/, and efficiently with a CDN, what are my options?
The issue is that the CDNs I looked at all want you to use a CNAME so that they can do geo ip lookup. CNAMES are not meant to be served at the same level as other records, and this apparently breaks some dns resolvers. You at least need SOA and MX records at the same level for a naked domain.
The only solutions are: having A records in your own dns, thus skipping the geo ip, or finding a cdn who will allow delegation of the whole domain so they can do geo ip things for the A record directly.
I've tried googling and can't find any Cdn who offers this. Any ideas? I looked closely at Amazon cloudfront and rackspace cloudfiles. I couldn't work it out for those.
I want to ensure that a user editing a particular model is saved in that models updated_by (FK User) field.
I'm using mostly ModelForms (not necessarily the built in Admin), and wondering:
In what cases would I need to override ModelAdmin.save_model() or ModelAdmin.save_formset()?
Or, is that doing it wrong? If it's just the models' save() method that needs to be overridden, is there a proper way to access the request object there?
In MongoDB, I have a document with a field called "ClockInTime" that was imported from CSV as a string.
What does an appropriate db.ClockTime.update() statement look like to convert these text based values to a date datatype?
hi using Django to create a stock photo site, i have a ImageField in my model, the problem is that when the user update the image field, the original image file isn't deleted from the hard disk.
how can I make to delete those images after an update?
Thanks!
Hello:
I have a simple webpage that displays the credit balance for calling cards. So far without any problems, with HTML, PHP and mysql, I was able to retrieve the balance from a data base. But I have to display the result in ANOTHER PAGE, wich looks akward because the page must reload.
Can I just load this value into a pre-drawed field under the input fields that collect the data from the customer? Such as :
Account Number: 134556
PIN: *
|send|
Balance is: $12.36
Thanks in advanced
packaged maven project contains META-INF/manifest.mf file and in field "Built-by" is login name of current user.
Where or what to set name of author, so maven will use this instead of login name?
What is the upper limit of records for MySQL database table. I'm wondering about autoincrement field. What would happen if I add milions of records? How to handle this kind of situations?
Thx!
I have learnt c and c++ programming languages.i have learnt data structure too. Now i'm confused what to do next?my aim is to be a good programmer. i want to go deeper into the field of programming and making the practical applications of what i have learnt. So,the question takes the form-what to do next?Or is there any site where i can see advantage of every language with it's features? sorry,if there's any language error and thanks in advance.
Hi,
I want to be able to store the current time in millis in an oracle number field. How do I do this via a query?
select systimestamp from dual; returns the actual timestamp. Is there anyway that I can convert this into milliseconds the same way java's System.currentTimeMillis() does?