Search Results

Search found 6 results on 1 pages for 'sledgehammerpl'.

Page 1/1 | 1 

  • Why can't get more speed on iperf on windows xp

    - by SledgehammerPL
    I test my bandwith and throughput using iperf (jperf) on desktop PC with WinXP. I can't get more than 3Mbit/s outside until I change TCP Window size - about 84Kb is ok. but I can't force XP to use this value by default.. I try very many magic spells on Registry, use many TCP Optimisers - but nothing works. I will accept that that everything is ok, when I reboot the PC, run iperf and will see 18.1Mbit - like my Linux box standing very near my Windows XP Box. Is it possible?

    Read the article

  • django admin how to limit selectbox values

    - by SledgehammerPL
    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.

    Read the article

  • django left join with null

    - by SledgehammerPL
    The model: class Product(models.Model): name = models.CharField(max_length = 128) def __unicode__(self): return self.name class Receipt(models.Model): name = models.CharField(max_length=128) components = models.ManyToManyField(Product, through='ReceiptComponent') class Admin: pass def __unicode__(self): return self.name class ReceiptComponent(models.Model): product = models.ForeignKey(Product) receipt = models.ForeignKey(Receipt) quantity = models.FloatField(max_length=9) unit = models.ForeignKey(Unit) def __unicode__(self): return unicode(self.quantity!=0 and self.quantity or '') + ' ' + unicode(self.unit) + ' ' + self.product.genitive The idea: there are a components on stock. I'd like to find out which recipes I can made with components which I have. It's not easy - but possible - I made a SQL view, which gets the solution. But I'm learning python and Django so I'd like to make it Django-style ;D The concept of solution: get the set of recipes which has at last one component: list_of_available_components = ReceiptComponent.objects.filter(product__in=list_of_available_products).distinct() list_of_related_receipts = Receipt.objects.filter(receiptcomponent__in = list_of_available_components).distinct() get recipes (from list_of_related_receipts) which has not at last one component list_of_incomplete_recipes = (SELECT * FROM drinkbook_receiptcomponent LEFT JOIN drinkstore_stock_products USING(product_id) WHERE drinkstore_stock_products.stock_id IS NULL AND receipt_id IN (SELECT receipt_id FROM drinkbook_receiptcomponent JOIN drinkstore_stock_products USING(product_id))) get recipes (from list_of_related_receipts) which are not in "list_of_incomplete_recipes"

    Read the article

  • DJANGO complex modelling

    - by SledgehammerPL
    Hello. I have such model now: receipt contains components. component contain product. The difference between component and product is, that component has quantity and measure unit: eg. component is 100g sugar - sugar is a product. So I need to make lots of components to satisfy different recipes - 100g sugar is not equal 200g sugar I wonder if I can remodel it to kick off components - in pure sql it's rather easy, but I'm trying to USE django - not making workarounds. class Receipt(models.Model): name = models.CharField(max_length=128) (...) components = models.ManyToManyField(Component) class Component(models.Model): quantity = models.FloatField(max_length=9) unit = models.ForeignKey(Unit) product = models.ForeignKey(Product) class Product(models.Model): name = models.CharField(max_length = 128) TIA

    Read the article

  • django modeling

    - by SledgehammerPL
    Concept: Drinks are made of components. E.g. 10ml of Vodka. In some receipt the component is very particular (10ml of Finlandia Vodka), some not (10 ml of ANY Vodka). I wonder how to model a component to solve this problem - on stock I have particular product, which can satisfy more requirements. The model for now is: class Receipt(models.Model): name = models.CharField(max_length=128) (...) components = models.ManyToManyField(Product, through='ReceiptComponent') def __unicode__(self): return self.name class ReceiptComponent(models.Model): product = models.ForeignKey(Product) receipt = models.ForeignKey(Receipt) quantity = models.FloatField(max_length=9) unit = models.ForeignKey(Unit) class Admin: pass def __unicode__(self): return unicode(self.quantity!=0 and self.quantity or '') + ' ' + unicode(self.unit) + ' ' + self.product.genitive class Product(models.Model): name = models.CharField(max_length = 128) (...) 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 I think about making some table which joins real product (on stock) with abstract product (receiptcomponent). But maybe there's easy solution?

    Read the article

  • django access to parent

    - by SledgehammerPL
    model: class Product(models.Model): name = models.CharField(max_length = 128) (...) def __unicode__(self): return self.name class Receipt(models.Model): name = models.CharField(max_length=128) (...) components = models.ManyToManyField(Product, through='ReceiptComponent') def __unicode__(self): return self.name class ReceiptComponent(models.Model): product = models.ForeignKey(Product) receipt = models.ForeignKey(Receipt) quantity = models.FloatField(max_length=9) unit = models.ForeignKey(Unit) def __unicode__(self): return unicode(self.quantity!=0 and self.quantity or '') + ' ' + unicode(self.unit) + ' ' + self.product.genitive And now I'd like to get list of the most often useable products: ReceiptComponent.objects.values('product').annotate(Count('product')).order_by('-product__count' the example result: [{'product': 3, 'product__count': 5}, {'product': 6, 'product__count': 4}, {'product': 5, 'product__count': 3}, {'product': 7, 'product__count': 2}, {'product': 1, 'product__count': 2}, {'product': 11, 'product__count': 1}, {'product': 8, 'product__count': 1}, {'product': 4, 'product__count': 1}, {'product': 9, 'product__count': 1}] It's almost what I need. But I'd prefer having Product object not product value, because I'd like to use this in views.py for generating list.

    Read the article

1