limit

LIMIT on a condition in MySql

Hi all I am trying to get info from a table in this form : table_1 jobid(PK) projectid desc 1 1 whatever 2 1 . 3 1 . 4 2 . 5 2 . . . . . . . . . . What I am trying to get is a query wh...

Can I not load a given mapped property (nhibernate)?

I am using WCF for my project and i need to transit some entities through it. The thing is that some of them have lists inside, with an enormeous ammount of items, and so forth, i cannot pass it through WCF, given its size. How can I, through code, not load a given property from the database, but load all the rest? ...

Only one parameterization of an interface can be implemented—how to work around?

Here's an example of what I'd like to be able to do (in Java): interface MyInterface<E> { public void doSomething(E foo); } class MyClass implements MyInterface<ClassA>, MyInterface<ClassB> { public void doSomething(ClassA fooA) { ... } public void doSomething(ClassB fooB) { ... } } When I try to implement this, th...

VARCHARS: 2, 4, 8, 16, etc.? Or 1, 3, 7, 15, etc.?

I see VARCHAR(255) being used all the time instead of VARCHAR(256), but I also see VARCHAR(16) being used instead of VARCHAR(15). This seems inconsistent to me. If an extra byte is being used to store the VARCHAR's length, shouldn't this rule also apply to the smaller lengths like 2, 4, 8 to be 1, 3, 7, instead? Or am I totally missing ...

[PHP] - Don't allow > 2mb images

HI! How do i check if the users are trying to upload bigger than 2mb files? I would like to deny that and put an error message to the user who is trying to do that. I know it is something like this, but what shall i change the 50000 to to become 2mb? if ($_FILES['imagefile']['size'] > 50000 ) { die ("ERROR: Large File Size"); } ...

How can I speed up a MySQL query with a large offset in the LIMIT clause?

I'm getting performance problems when LIMITing a mysql SELECT with a large offset: select * from table limit m, n; If the offset m is, say, larger than 1,000,000, the operation is very slow. I do have to use "limit m, n" ; I can't use something like "id > 1,000,000 limit n". How can I optimize this statement for better performance? ...

How can I select rows in MySQL starting at a given row number?

Say I have 50 rows in a MySQL table. I want to select the first ten (LIMIT 10), but then I want to be able to select the next 10 on a different page. So how do I start my selection, after row 10? Updated query: mysql_query(" SELECT * FROM `picdb` WHERE `username` = '$username' ORDER BY `picid` DESC LIMIT '$start','$co...

Does the LDAP protocol limit the length of a DN

Does the LDAP protocol specify a maximum length that a DN can take? I've looked through http://tools.ietf.org/html/rfc4514 but I can't find any restrictions that it imposes. ...

Django: Limit SQL execution time

I'm building an API for access to my underlying models, and I would like my users to be able to do some fancy things (like filter on columns with __ operators). The only problem is sometimes these can take a long time. How can I limit a fetch to a certain amount of resources? Time, cpu-cycles, memory, etc. My current code (if it help...

PHP Limit string output by specific characters

Hello, I am trying to limit the number of characters returned from a string using PHP. I've applied a solution that just seemed to crash the server (high load) / infinite loop. So I am asking for alternative, Simply, I am trying to find a solution that cuts the string, display specific amount of characters, but still respect the meanin...

limit size of Queue<T> in C++

I notice the thread of similar question: http://stackoverflow.com/questions/1292/limit-size-of-queuet-in-net That's exactly what I want to do, but I am not using .net but GNU C++. I have no reference to the base class in GNU C++, so java like super.() or .net like base.() will not work. I have been trying to inherite from queue class but...

Cron job: keep last 20 lines

I have a process that dumps millions of lines to the console while it runs. I'd like to run this in a cronjob but to avoid sending multi-MB mails, I'd like to restrict the output in the case of a success (exit == 0) to 0 lines and in case of an error (exit != 0) to the last 20 lines. Any ideas to achieve this with little effort? Maybe a...

Should SQL ranking functionality be considered as "use with caution"

This question originates from a discussion on whether to use SQL ranking functionality or not in a particular case. Any common RDBMS includes some ranking functionality, i.e. it's query language has elements like TOP n ... ORDER BY key, ROW_NUMBER() OVER (ORDER BY key), or ORDER BY key LIMIT n (overview). They do a great job in increas...

Mysql set LIMIT to string

Hi, Say I define an alias 'count' in my Select Query and I want to limit the amount returned to count / 5 (or 20% of the table). How can I do this? Mysql doesn't seem to take anything but integers, not functions. ...

Does OpenFileDialog.Filenames have a limit?

I have a small helper app that I use to "inject" scripts into html pages. I have an openfiledialog promt and i select all the html files in that directory (1403 files) and no matter what i do i see that OFD.filenames.count = 776 is there a limit? thanks OpenFileDialog OFD = new OpenFileDialog(); OFD.Multiselect = true; ...

Need to pull last x number of rows based on date.

I have a table with dates in "Aug 23, 2009" format and 5 values, so that it looks like this SELECT * FROM table; Date | Total | V1 | V2 | V3 | V4 Aug 21, 2009 | 41 | 23 | 8 | 8 | 2 Aug 22, 2009 | 39 | 22 | 8 | 7 | 2 Aug 23, 2009 | 35 | 20 | 6 | 7 | 2 Aug 24, 2009 | 34 | 20 | 6 | 6 | 2 Aug 25, 2009 | 32 ...

Check the open FD limit for a given process in Linux

Hi, I recently had a Linux process which "leaked" file descriptors: It opened them and didn't properly close some of them. If I had monitored this, I could tell - in advance - that the process was reaching its limit. Is there a nice, Bash\Python way to check the FD usage ratio for a given process in a Ubuntu Linux system? EDIT: I no...

How to limit CPU usage in a while loop

How do you limit the CPU of a while loop? In this case, the code which is inside the while loop: Private Sub wait(ByVal time) Dim sw As New Stopwatch sw.Start() Do While sw.ElapsedMilliseconds < time And StillOpen = True Application.DoEvents() Loop sw.Stop() End Sub But now, her...

Limit input box to 0-100

I have an input box that takes values from 0-100. I want to prevent users from writing anything larger or smaller. I've been using the jquery keyfilter plugin to limit the input of a field: http://code.google.com/p/jquery-keyfilter/ This plugin can limit the input to numerals, but not within a range. How do I prevent users from enterin...

Limiting the size of a mysql table

Is it possible to limit the size (in disk size / rows) of a single mysql table? If it is not possible, what is the easiest way to run multiple mysql engines on one physical computer? (my plan is to set one mysql instance's data files to a separate disk partition) ...