limit

PHP : Json decoding question

How do i decode whole feed arround 10k item without memory limit of php? i found a code which break the feed to part: http://pastebin.com/m43c3384f how do modify the code to work with the feed below : GAF_update_projects_vertical_callback({"projects":{"count":2,"items":[{"id":502817,"name":"SEO","url":"http:\/\/www.getafreelancer.com\...

mysql join and limit

Hi, i have a master table page, and a relative table page_lang.In page_lang i hold the page data for each language. Using the the above code SELECT * FROM pages as p RIGHT JOIN pages_lang as l ON l.pageID=p.pageID i get the rows containing common data form pages and language data from page_lang.All OK The problem is when rty to lim...

MySQL Combining UNION and LIMIT Operations

Hi, I have a JOBS and a COMPANIES table, and I want to extract 20 jobs that meet the following criteria a) jobs only from 2 named companies b) there can at most be 10 jobs per company I have tried the following SELECT with UNION DISTINCT, but the problem is that the LIMIT 0,10 applies to the whole result set, whereas I want it to apply...

Limit download count with text file in PHP

if ($_SERVER['REQUEST_METHOD']=='GET' && $_GET['download']==='1') { $handle = fopen('lastdownload.txt','rw'); $date = @fread($handle,filesize('lastdownload.txt')); if (time() - 30 * 60 > $date) { fwrite($handle,time()); header('Content-type: application/zip'); header('Content-Disposition: attachment; filename="dwnld_'.date('d_m_Y...

Limiting MySQL results within query

I'm looking to see if I can get the results I need with a single query, and my MySQL skills are still in their adolescence over here. I have 4 tables: shows, artists, venues and tours. A simplified version of my main query right now looks like this: SELECT * FROM artists AS a, venues AS v, shows AS s LEFT J...

How many variables should a constructor have?

Hello everyone, I realize this is a pretty open question and could get a variety of answers, but here goes. Using C# (or Java, or any OO language), is there a general rule that states how many variables should be passed into the constructor? The number of variables I am passing into the constructor of the extended classes seem to be g...

How to get a user's friends info on Twitter without breaking the Rate Limit

I am trying to do something that appears to be simple, but I can't figure out a way around it without breaking the rate limit. The first API call I'm making is the get a user's friend's IDs. $friends = $to->OAuthRequest('http://twitter.com/friends/ids.json', array(), 'GET'); That returns a huge string with IDs. In my case, I'm follow...

How to get ALL rows starting from row x in MySQL

Hi all, In MySQL, how can I retrieve ALL rows in a table, starting from row X? For example, starting from row 6: LIMIT 5,0 This returns nothing, so I tried this: LIMIT 5,ALL Still no results (sql error). I'm not looking for pagination functionality, just retrieving all rows starting from a particular row. LIMIT 5,2000 seems like...

How to hack MySQL GROUP_CONCAT to fetch a limited number of rows?

I somehow need this feature,but MySQL doesn't support it at this moment. I'm using GROUP_CONCAT(CONCAT(...)) to generate a xml-like stuff. But when the size exceeds the limit,the xml is just broken! So I have to somehow make it only retrieve 5 rows ! ...

j2me post data limit

is there any limit to send data from j2me device to server. I coded a application to send big data to server from j2me client. it works fine in wtk and sonyericsson emulator. but when i tried same code in real device, I can send only 6K data. then, app throws IOException. every 2K, I run flush function of outputstream to seperate data to...

how to limit result based on the fields

How to use ' LIMIT' in mysql database query based on fields . just consider a user has 10 phone number and i would like to get only 5 phone number for that user . I would like to get only 5 phone numbers per user . not only 5 results from database ? ...

How to impose a time limit on a whole script in Python

The user is entering a python script in a Java GUI python-editor and can run it from the editor. Is there a way to take the user's script and impose a time limit on the total script? I'm familiar with how to this with functions / signal.alarm(but I'm on windows & unix Jython) but the only solution I have come up with is to put that scr...

scala mailbox size limit

I can see that scala can solve the Producer-Consumer problem using actors. There is a couple of examples on the web but what is worrying me is the unlimited growth of an actor's mailbox. Suppose the producer produces on a much faster rate than the consumer can consume. Using the traditional synchronized threads approach, I can set up a ...

LIMIT 3 not returning the first three rows in sorted RS (I think)

In my table I have looked manually and found that the top three idle units have been idle for 17, 13 and 13 days. When I use this SQL statement to try and pull the three rows with the highest idle column value, I don't get these numbers, I get 8, 7 and 7. Is there some other command I should use to grab the first 3 rows of a sorted res...

How does Tomcat sandbox web apps?

I have a web app that is being served through Tomcat. My app lets users submit their own workflow which will then be executed on the server. My problem is how to control how much memory each user is taking up on the server. I think Tomcat itself runs apps in a sandbox of its own. I say this because when my app runs out of memory and cras...

Limit string chars - PHP

I am building an RSS script with mysql, and i dont want an extra field in the database... i want to shrink down the body of the article with a "... Read More" but im not sure how i can limit the number of chars echoed out onto the page? Of course not this syntax, but something along the lines of: echo(limit($row['newsBody'], 1000)); ...

PHP: Limit foreach() statement?

How can i limit a foreach() statement? Say i only want it to run the first 2 'eaches' or something? ...

Process n items at a time (using threads)

I'm doing what a lot of people probably need to do, processing tasks that have a variable execution time. I have the following proof of concept code: threads = [] (1...10000).each do |n| threads << Thread.new do run_for = rand(10) puts "Starting thread #{n}(#{run_for})" time=Time.new while 1 do if Time.new - tim...

How can I handle the problem whe AUTO_INCREMENT hit its limit?

Is there any good practice for this? I wish I could solve the problem when primary key hit the limit and not to avoid it. Because this is what will happen in my specific problem. If it's unavoidable... What can i do? This is mysql question, is there Sybase sql anywhere same problem? ...

Howto limit the map in Android?

I'm developing my first Android application and it is based partly on displaying some information in Google Maps. I've managed to set a new center point and a new default zoom level (the area I want to display is a city). Now is it possible to "lock" that new default view somehow? That is, the user should be able to zoom in/out and pan ...