i want to know how long the twitter api allows to request from a single account
using oath authentication protocol
requests per day ???
requests per hour???
looking forward
Hello,
I am designing a web application which is a tie in to my iPhone application. It sends massively large URLs to the web server (15000 about.) I was using NearlyFreeSpeech.net, but they only support URLS up to 2000 characters. I was wondering if anybody knows of web hosting that will support really large URLs? Thanks, Isaac
Edit: My program needs to open a picture in Safari. I could do this 2 ways:
send it base64 encoded in the URL and just echo the query parameters.
first POST it to the server in my application, then the server would send back a unique ID after storing the photo in a database, which I would append to a URL which I would open in Safari which retrieved the photo from the database and delete it from the database.
You see, I am lazy, and I know Mobile Safari can support URI's up to 80 000 characters, so I think this is a OK way to do it. If there is something really wrong with this, please tell me.
Edit: I ended up doing it the proper POST way. Thanks.
I am trying to sort/narrow a queryset of objects based on the number of comments each object has as well as by the timeframe during which the comments were posted. Am using a queryset.extra() method (using django_comments which utilizes generic foreign keys).
I got the idea for using queryset.extra() (and the code) from here. This is a follow-up question to my initial question yesterday (which shows I am making some progress).
Current Code:
What I have so far works in that it will sort by the number of comments; however, I want to extend the functionality and also be able to pass a time frame argument (eg, 7 days) and return an ordered list of the most commented posts in that time frame.
Here is what my view looks like with the basic functionality in tact:
import datetime
from django.contrib.comments.models import Comment
from django.contrib.contenttypes.models import ContentType
from django.db.models import Count, Sum
from django.views.generic.list_detail import object_list
def custom_object_list(request, queryset, *args, **kwargs):
'''Extending the list_detail.object_list to allow some sorting.
Example: http://example.com/video?sort_by=comments&days=7
Would get a list of the videos sorted by most comments in the
last seven days.
'''
try: # this is where I started working on the date business ...
days = int(request.GET.get('days', None))
period = datetime.datetime.utcnow() - datetime.timedelta(days=int(days))
except (ValueError, TypeError):
days = None
period = None
sort_by = request.GET.get('sort_by', None)
ctype = ContentType.objects.get_for_model(queryset.model)
if sort_by == 'comments':
queryset = queryset.extra(select={
'count' : """
SELECT COUNT(*) AS comment_count
FROM django_comments
WHERE
content_type_id=%s AND
object_pk=%s.%s
""" % ( ctype.pk, queryset.model._meta.db_table,
queryset.model._meta.pk.name ),
},
order_by=['-count']).order_by('-count', '-created')
return object_list(request, queryset, *args, **kwargs)
What I've Tried:
I am not well versed in SQL but I did try just to add another WHERE criteria by hand to see if I could make some progress:
SELECT COUNT(*) AS comment_count
FROM django_comments
WHERE
content_type_id=%s AND
object_pk=%s.%s AND
submit_date='2010-05-01 12:00:00'
But that didn't do anything except mess around with my sort order.
Any ideas on how I can add this extra layer of functionality?
Thanks for any help or insight.
model:
class Store(models.Model):
name = models.CharField(max_length = 20)
class Admin:
pass
def __unicode__(self):
return self.name
class Stock(Store):
products = models.ManyToManyField(Product)
class Admin:
pass
def __unicode__(self):
return self.name
class Product(models.Model):
name = models.CharField(max_length = 128, unique = True)
parent = models.ForeignKey('self', null = True, blank = True, related_name='children')
(...)
def __unicode__(self):
return self.name
mptt.register(Product, order_insertion_by = ['name'])
admin.py:
from bar.drinkstore.models import Store, Stock
from django.contrib import admin
admin.site.register(Store)
admin.site.register(Stock)
Now when I look at admin site I can select any product from the list. But I'd like to have a limited choice - only leaves. In mptt class there's function:
is_leaf_node() -- returns True if
the model instance is a leaf node (it
has no children), False otherwise.
But I have no idea how to connect it
I'm trying to make a subclass: in admin.py:
from bar.drinkstore.models import Store, Stock
from django.contrib import admin
admin.site.register(Store)
class StockAdmin(admin.ModelAdmin):
def queryset(self, request):
qs = super(StockAdmin, self).queryset(request).filter(ihavenoideawhatfilter)
admin.site.register(Stock, StockAdmin)
but I'm not sure if it's right way, and what filter set.
Hi,
I just started with VS2010 and the feature I was really looking forward too was the new Intellisense, and the Camel casing matching in particular.
But I must say I'm pretty dissapointed with the way it works and am wondering if this is just a setting, or not.
When I type 'OIE' I get the following results:
OrderItemBackerEntity (OIBE)
OrderGarmentActionGroupItemEntity (OGAGIE)
OrderItemClothingEntity (OICE)
OrderItemEntity (OIE) << GOOD
These indeed do match in some way, but why does it match so broad, and not only the fitting one, the last one.
Are these settings, or is this by design?
I have a database which users should not be able to alter data in unless they use the specific app. I know best practice is to use windows authentication however that would mean that users could then connect to the database using any other data enabled app and change values which would then not be audited.
Unfortunately SQL 2008 with its inbuilt auditing is not available.
Any ideas how to ensure that users cannot change anything unless its through the controlling app?
Is there's a bounding box on an application that receives touch events? I created a few sample round rect buttons and placed them in different places in my view. The ones in the center of the view receive touch events (and show the highlighted blue color) but if I place a button near the edges of the view, only parts of them are clickable in the simulator. Is this because of Apples style guidelines? I placed a button exactly where a UITabNavigationItem would appear and only the bottom half of it is clickable.
def mailTo(subject,msg,folks)
begin
Net::SMTP.start('localhost', 25) do |smtp|
smtp.send_message "MIME-Version: 1.0\nContent-type: text/html\nSubject: #{subject}\n#{msg}\n#{DateTime.now}\n", '[email protected]', folks
end
rescue => e
puts "Emailing Sending Error - #{e}"
end
end
when the HTML is VERY large I get this exception
Emailing Sending Error - 552 5.6.0 Headers too large (32768 max)
how can i get a larger html above max to work with Net::SMTP in Ruby
hi, i have a double, the decimal place isn't fix (8-?)
i want to fix the decimal place to six (for example: 1,234567).
this is my double:
CStr(score)
i guess it's quiet simple :P
I have 20 Checkboxes. I need to disable 16 Checkboxes, if 4 checkboxes are selected.
I tryed this begann with this jquery code
$("input[type=checkbox][name=cate]:checked").each(
function()
{
}
);
What i need is if a user selects 4 checkboxes then all other checkboxes should be disabled.
We have a 64bit C#/.Net3.0 application that runs on a 64bit Windows server. From time to time the app can use large amount of memory which is available. In some instances the application stops allocating additional memory and slows down significantly (500+ times slower).When I check the memory from the task manager the amount of the memory used barely changes. The application keeps on running very slowly and never gives an out of memory exception.
Any ideas? Let me know if more data is needed.
I am new to drupal, so sorry for this noob question, but I was wondering how to display articles only in the central column. Currently there are also blog entries, etc and I would like to get rid of them. I have a Views plugin installed but I am not sure how to do this.
I have a daily cron job that grabs 10 users at a time and does a bunch of stuff with them. There are 1000's of users that are part of that process every day. I don't want the cron jobs to overlap as they are heavy on server load. They call stuff from various APIs so I have timeouts and slow data fetching to contend with.
I've tried using a flag to mark a cron job as running, but it's not reliable enough as some PHP scripts may time out or fail in various ways.
Is there a good way to stop a cron job from calling the PHP script multiple times, or controlling the number of times it is called, so there are only 3 instances for example?
I'd prefer a solution in the PHP if possible. Any ideas?
At the moment I'm storing the flag as a value in a database, is using a lock type file any better as in here http://stackoverflow.com/questions/851872/does-a-cron-job-kill-last-cron-execution ?
Hello everyone.
I'm a product manager who works for a small internet company that is developing an iPhone application for a social network. We monetize by offering limited and premium memberships to users (premium members get additional features not available to limited members). For billing on the web, we use a 3rd-party payment gateway that is nearing retirement, and will be replaced by an in-house solution.
The business wants a global launch for our iPhone app using iTunes + in-app purchasing as a payment gateway. The problem with going global using this payment method is that for our web service membership level, available features, and subscription costs are defined by country. For example, in the US premium/limited memberships are available at 5 pricing tiers; in France premium/limited memberships are available at 5 different pricing tiers from the US; and in Chile the service is available for free and all features are available to users.
Is it possible then to have the server-side, based on the user's country of registration, control the level of access, features, and payment options for users on the iPhone? I'd also note that since iTunes Connect does not allow variable pricing by currency and country, each "region" would need 5 in app purchase options.
I argued for a US-only launch for iPhone using iTunes in app purchase until an in-house payment gateway is available. But you know...
I am trying to get a login form I have in django to only allow three login attempts before redirecting to a "login help" page. I am currently using the builtin "django.contrib.auth.views.login" view with a custom template. How do I force it to redirect to another page after n failed login attempts?
def mailTo(subject,msg,folks)
begin
Net::SMTP.start('localhost', 25) do |smtp|
smtp.send_message "MIME-Version: 1.0\nContent-type: text/html\nSubject: #{subject}\n#{msg}\n#{DateTime.now}\n", '[email protected]', folks
end
rescue => e
puts "Emailing Sending Error - #{e}"
end
end
when the HTML is VERY large I get this exception
Emailing Sending Error - 552 5.6.0 Headers too large (32768 max)
how can i get a larger html above max to work with Net::SMTP in Ruby
Hello,
I am currently uploading files in ActionScript 3 using the upload() method of the FileReference class.
I built an uploader than can do simultaneous or parallel uploads, having a variable set the number of maximum uploads at a time.
I noticed that for Internet Explorer I could be uploading 10 or more files simultaneously, but FireFox and Safari seems to cap the number of uploads to 2. That is, when I call the upload method on per say, 3 files, only 2 will get events back (such as ProgressEvent.PROGRESS). Only when one of the 2 uploads finishes, then the 3rd one will start. This behavior does not happen for Internet Explorer. I have tried with a large number of files, and some big files, to make sure this behavior was consistent.
I was wondering if anyone noticed this behavior please, and if so, what is the reason for this behavior please?
I appreciate your help,
Thank you very much,
Rudy
I can set up the following:
mydomain.com (ex m.com)
CNAME points to:
mysubdomain.hostingprovider.com (ex s1.h.com)
subdomain.mydomain.com (ex s2.m.com)
CNAME points to:
www.anotherdomain.com (ex a.com)
There are files in www.anotherdomain.com/mysubfolder/ that I want mydomain.com to be able to access through the subdomain, but I don't want any of the files on the subdomain to be accessable directly.
I have full direct access (ftp) to mydomain.com, but I have opono direct access to www.anotherdomain.com (online booking & shopping cart).
Is there anyway to make it so access to subdomain.mydomain.com can only be accessed by mydomain.com?
I would like to check that I get not more than 3 relations set on a manytomanyfield.
I tried on the clean method to do this :
if self.tags.count()>3:
raise ValidationError(_(u'You cannot add more than 3 tags'))
But self.tags returns not the current updates... only saved objects.
Do you have an idea to access to them ?
Thanks
This code is not working. Please tell me the exact solution
<script src="maps.googleapis.com/maps/api/…; type="text/javascript"></script>
<script type="text/javascript">
function initialize() {
var input = document.getElementById('searchTextField');
/* restrict to multiple cities? */
var options = {
types: ['(cities)'],
componentRestrictions: {country: ["usa", "uk"]}
};
var autocomplete = new google.maps.places.Autocomplete(input, options);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
I am trying to restrict access to certain actions using a before_filter which seems easy enough. Somehow the ApplicationController is not recognizing that the current_user is the owner of the user edit action. When I take the filter off the controller correctly routes the current_user to their edit view information. Here is the code.
Link to call edit action from user controller (views/questions/index.html.erb):
<%= link_to "Edit Profile", edit_user_path(:current) %>
ApplicationController (I am only posting the code that I think is affecting this but can post the whole thing if needed).
class ApplicationController < ActionController::Base
def require_owner
obj = instance_variable_get("@#{controller_name.singularize.camelize.underscore}") # LineItem becomes @line_item
return true if current_user_is_owner?(obj)
render_error_message("You must be the #{controller_name.singularize.camelize} owner to access this page", root_url)
return false
end
end
and the before_filter
class UsersController < ApplicationController
before_filter :require_owner, :only => [:edit, :update, :destroy]
#...
end
I simply get the rendering of the error message from the ApplicationController#require_owner action.
Hi all,
I want to stop my app from loading more annotations after they are all added ( they are added by the user one by one). How would you do that? the following code is what i think is important
(void) loadAndSortPOIs {
[poiArray release];
nextPoiIndex = 0;
NSString *poiPath = [[NSBundle mainBundle] pathForResource:@"pois"
ofType:@"plist"];
poiArray = [[NSMutableArray alloc] initWithContentsOfFile:poiPath];
CLLocation *homeLocation = [[CLLocation alloc]
initWithLatitude:homeCoordinate.latitude
longitude:homeCoordinate.longitude];
for (int i = 0; i < [poiArray count]; i++) {
NSDictionary *dict = (NSDictionary*) [poiArray objectAtIndex: i];
CLLocationDegrees storeLatitude = [[dict objectForKey:@"workingCoordinate.latitude"] doubleValue];
CLLocationDegrees storeLongitude = [[dict objectForKey:@"workingCoordinate.longitude"] doubleValue];
CLLocation *storeLocation = [[CLLocation alloc]
initWithLatitude:storeLatitude
longitude:storeLongitude];
CLLocationDistance distanceFromHome = [storeLocation getDistanceFrom: homeLocation];
NSMutableDictionary *mutableDict = [[NSMutableDictionary alloc]
initWithDictionary:dict];
[mutableDict setValue:[NSNumber numberWithDouble:distanceFromHome]
forKey:@"distanceFromHome"];
[poiArray replaceObjectAtIndex:i withObject:mutableDict];
[mutableDict release];
}
[homeLocation release];
// now sort by distanceFromHome
NSArray *sortDescriptors = [NSArray arrayWithObject:
[[NSSortDescriptor alloc] initWithKey: @"distanceFromHome"
ascending: YES]];
[poiArray sortUsingDescriptors:sortDescriptors];
NSLog (@"poiArray: %@", poiArray);
}
Thank you for your help.
Best regards,
i have one form and i am using PHPMailer to send data from that form to my email. Users can send attachments as well, but i have one rpoblem: how to make PHPMailer to deny attachments larger than 2Mb and to allow only iamge attachments (no other types of documents)?
This is code i using for multiply email attachments with PHPMailer:
foreach(array_keys($_FILES['fileAttach']['name']) as $key) {
$source = $_FILES['fileAttach']['tmp_name'][$key];
$filename = $_FILES['fileAttach']['name'][$key];
$mail->AddAttachment($source, $filename);
}
So, i have this problem with some checkboxes. First of all let me tell you about the "project" itself. It's a webform, the user must complete it and check some checkboxes and radio buttons depending on what he would like to purchase. First of them are 2 radio bullets, numbered 1 and 2, and represent the quantity of the product he wants to purchase. Next to those are about 5 checkboxes that represent the color of the product, it doesn't matter how many of them are, the thing is ... i want, when a user selects 1 at the radio buttons, only 1 checkbox to be active, if he selects 2 then only 2 checkboxes to be available to check. So.. could someone help me? I thought of jQuery but i don't know...
There are two divs, the first div with the id of let's say #radioButtons has 2 radio buttons, and the second div has the rest of the checkboxes.