Can I use a Criteria to execute a t-sql command to select the max value for a column in a table?
'select @cus_id = max(id) + 1 from customers'
Ta
Ollie
Hi,
given a standard model (called Image) with an autoset 'id', how do I get the max id?
So far I've tried:
max_id = Image.objects.all().aggregate(Max('id'))
but I get a 'id__max' Key error.
Trying
max_id = Image.objects.order_by('id')[0].id
gives a 'argument 2 to map() must support iteration' exception
Any help?
How do I completely disable the max-execution-time for scripts in flex? The configurable max is 60 seconds, but I'm calling off to other interactive processes which will probably run much longer than that. Is there an easy way to disable the maximum script execution time across my entire application?
Is there a eazy way or class to get 12 trangles of a cube
where, only (MIN,MAX) coordinates are know for the BoundingBox cube
i want to use PrimitiveType.TriangleList for rendering face of cube but dont know how to get
static indices array of 12 triangles which can be defined by , MIN ,MAX vertices of the cube .
I am using C# with XNA
Thank…
I'm getting some errors with the following methods:
1) How do I return screenHeight / cellCount as a CGFLoat for the first method?
2) How do I use the equivalent of ObjC's MIN() and MAX() in the second method?
func tableView(tableView: UITableView!, heightForRowAtIndexPath indexPath: NSIndexPath!) -> CGFloat {
var cellCount =…
Whats the mathematical formulae to calculate the MIN and MAX value of an integral type using your calculator. I know you can use Integer.Max or Integer.Min etc or look it up on msdn however I want to know how to calculate it.
Hi,
My table result contains fields:
id count
____________
1 3
2 2
3 2
From this table i have to form another table **score** which should look as follows
id my_score
___________
1 1.0000
2 0.6667
3 0.6667
That is my_score=count/MAX(count)
but if i give the query as
create TEMPORARY TABLE(select…
I'm dealing with a Postgres table (called "lives") that contains records with columns for time_stamp, usr_id, transaction_id, and lives_remaining. I need a query that will give me the most recent lives_remaining total for each usr_id
There are multiple users (distinct usr_id's)
time_stamp is not a unique identifier: sometimes…
Hi, I use one library which is very important and untouchable.
The problem is that library declare min, max function,
so when I include STL header in project, they conflict.
I want to disable min, max function in STL (like #define NOMNMAX) if I could.
If I can't, what would be solution?
Thanks, in advance.
Hi All,
In my application many I time we use MAX(). How can I write a common function where I can pass table name and column name and get MAX().
I mean single function for any table/field.
Thanks,
Tanmay.
It’s time to move on and improve my randomizer I wrote for an example of static checking of code contracts. In this posting I will modify contracts and give some explanations about pre-conditions and post-conditions. Also I will show you how to avoid ContractExceptions and how to replace them with your own exceptions. As a…
I am running Debian 6 and I am trying to increase the file descriptor limit but it does not want to work. This is what I have done:
I edited /etc/sysctl.conf by adding fs.file-max = 64000 at the end and applied the changes using sysctl -p.
I then edited /etc/security/limits.conf and added the following lines: * soft…
Most websites set max-age=31536000 (1 year) on the Cache-control headers of static assets such as logo images. Examples:
YouTube
Yahoo
Twitter
BBC
But there is a notable exception: Google's logo has max-age=691200 (8 days).
I've checked the headers on the Google logo in the past, and it definitely used to be 1…
Hi Every one!
I have a query in LINQ, I want to get MAX of Code of my table and increase it and insert new record with new Code. just like the IDENTITY feature of SQL Server, but here my Code column is char(5) where can be alphabets and numeric.
My problem is when inserting a new row, two concurrent processes get…
I compiled my bison-generated files in Visual Studio and got these errors:
...\position.hh(83): error C2589: '(' : illegal token on right side of '::'
...\position.hh(83): error C2059: syntax error : '::'
...\position.hh(83): error C2589: '(' : illegal token on right side of '::'
...\position.hh(83):…
Summary: I'm trying to write a text string to a column of type varchar(max) using ODBC and SQL Server 2005. It fails if the length of the string is greater than 8000. Help!
I have some C++ code that uses ODBC (SQL Native Client) to write a text string to a table. If I change the column from, say, varchar(100)…
I'm hesitant to ask because I'm sure it's out there, but I just can't seem to come up with the keywords to find the answer. I'm stepping outside my boundaries by starting with subqueries (normally an Access user).
I have a query that has TECH_ID, SEQ_NBR, and PELL_FT_AWD_AMT
SELECT…
I have a table (let's call it log) with a few millions of records. Among the fields I have Id, Count, FirstHit, LastHit.
Id - The record id
Count - number of times this Id has been reported
FirstHit - earliest timestamp with which this Id was reported
LastHit - latest timestamp…
After a few reading about jvm memory (here, here, here, others I forgot...), I am expecting the resident set size of my java process to be roughly equal to the current heap space capacity. That's not what the numbers are saying, it seems to be roughly equal to the max heap space…
I have a little piece of python code in the server script for my website which looks a little bit like this:
console.append([str(x) for x in data])
console.append(str(max(data)))
quite simple, you might think, however the result it's outputting is this:
['3', '12', '3']
3
…
I have added Jacson libs to my android project and now I am getting such warnings in console:
warning: Ignoring InnerClasses attribute for an anonymous inner class
that doesn't come with an associated EnclosingMethod attribute. (This class
was probably produced by a…
I'm using Jongo with Play framework 2, java. I added some data into my MongoDB.
{"_id" : ObjectId("538dafffbf6b562617252178"), ... }
However, when I fetched the ObjectId from the database, it gave me like:
de.undercouch.bson4jackson.types.ObjectId@484431ff instead of…
Working on locking down a *nix server box with some fancy iptable(v1.4.4) rules. I'm approaching the matter with a "paranoid, everyone's out to get me" style, not necessarily because I expect the box to be a hacker magnet but rather just for the sake of learning iptables…
I am using the googleJsonAPIService to manipulate users (CRUD). This is how I get the Directory instance:
def getBuilder() {
def builder
def httpTransport = googleJsonAPIService.makeTransport()
def jsonFactory = googleJsonAPIService.makeJsonFactory()
def…
I finally got Guvcview, a great software for Logitech webcam and it does all the stuff that one wants out of it.
But I'm not satisfy with the video recording, video and audio out of synchronisation also video seems to be in slow motion.
Please help so that I can tweak in…