Search Results

Search found 6242 results on 250 pages for 'named pipe'.

Page 93/250 | < Previous Page | 89 90 91 92 93 94 95 96 97 98 99 100  | Next Page >

  • Django microblog showing a logged in user only his posts

    - by dana
    i have a miniblog application, with a class named New(refering to a new post), having a foreign key to an user(who has posted the entry). above i have a method that displays all the posts from all the users. I'd like to show to the logged in user, only his posts How can i do it? Thanks in advance! def paginate(request): paginator = New.objects.all() return render_to_response('news/newform.html', { 'object_list': paginator, }, context_instance=RequestContext(request))

    Read the article

  • List of GHC extensions

    - by yairchu
    I wanted to use {-# LANGUAGE OverloadedStrings #-} but I forgot how it's called. This kind of thing isn't hoogle-able, and also it takes some time finding using google*. Is there somewhere a list of GHC extensions named as they are in the LANGUAGE pragma? * My googling search journey: Google Haskell at wikipedia GHC at wikipedia GHC language features Overload string literals OverloadedStrings

    Read the article

  • Why can't I use __getattr__ with Django models?

    - by Joshmaker
    I've seen examples online of people using __getattr__ with Django models, but whenever I try I get errors. (Django 1.2.3) I don't have any problems when I am using __getattr__ on normal objects. For example: class Post(object): def __getattr__(self, name): return 42 Works just fine... >>> from blog.models import Post >>> p = Post() >>> p.random 42 Now when I try it with a Django model: from django.db import models class Post(models.Model): def __getattr__(self, name): return 42 And test it on on the interpreter: >>> from blog.models import Post >>> p = Post() ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid The error message is: ('EOF in multi-line statement', (6, 0)) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /Users/josh/project/ in () /Users/josh/project/lib/python2.6/site-packages/django/db/models/base.pyc in init(self, *args, **kwargs) 338 if kwargs: 339 raise TypeError("'%s' is an invalid keyword argument for this function" % kwargs.keys()[0]) -- 340 signals.post_init.send(sender=self.class, instance=self) 341 342 def repr(self): /Users/josh/project/lib/python2.6/site-packages/django/dispatch/dispatcher.pyc in send(self, sender, **named) 160 161 for receiver in self._live_receivers(_make_id(sender)): -- 162 response = receiver(signal=self, sender=sender, **named) 163 responses.append((receiver, response)) 164 return responses /Users/josh/project/python2.6/site-packages/photologue/models.pyc in add_methods(sender, instance, signal, *args, **kwargs) 728 """ 729 if hasattr(instance, 'add_accessor_methods'): -- 730 instance.add_accessor_methods() 731 732 # connect the add_accessor_methods function to the post_init signal TypeError: 'int' object is not callable Can someone explain what is going on? EDIT: I may have been too abstract in the examples, here is some code that is closer to what I actually would use on the website: class Post(models.Model): title = models.CharField(max_length=255) slug = models.SlugField() date_published = models.DateTimeField() content = RichTextField('Content', blank=True, null=True) # Etc... Class CuratedPost(models.Model): post = models.ForeignKey('Post') position = models.PositiveSmallIntegerField() def __getattr__(self, name): ''' If the user tries to access a property of the CuratedPost, return the property of the Post instead... ''' return self.post.name # Etc... While I could create a property for each attribute of the Post class, that would lead to a lot of code duplication. Further more, that would mean anytime I add or edit a attribute of the Post class I would have to remember to make the same change to the CuratedPost class, which seems like a recipe for code rot.

    Read the article

  • Having trouble using jQuery to set meta tag values

    - by Zhami
    I'm trying to set meta tags using jQuery (please don't reply that this doesn't make sense since search engines blah-blah-blah... I am loading invoking 3rd party Javascript functions that examine these vales, such as Tweetmeme and Facebook). If I use: $('meta[name=some-name]').attr('content', 'some value'); it does work to set the value of an existing meta tag, but does not create a meta tag if such a named one does not exist. If you have insight or experience with this, please reply...

    Read the article

  • Usernames are evil. How can I make Restful Authentication only require an email address and password

    - by Koning WWWWWWWWWWWWWWWWWWWWWWW
    As the title says: how can I use the Restful Authentication Plugin with Ruby on Rails. When I want to create a new user, it requires me to set the (wrong-named, confusing field) login (= username), email address and password. However, I want, like Facebook does, to require the user to enter only an email address and password, not a username. People will also login with this email address. Can anyone help me?

    Read the article

  • String::New: what is it?

    - by JavaMan
    I am from a Java background and is learning C++. I encountered the following C++ code: String source = String::New("'Hello' + ', World'"); As what I understand so far, this should be a call to static member function 'New' of class 'String'. But, I've searched through the whole header file defining 'String', there is not any static member named 'New' in the String class or its super classes. Is there any special meaning attached to String class or the New member function in C++?

    Read the article

  • Rails: three most recent comments with unique users

    - by Dennis Collective
    what would I put in the named scope :by_unique_users so that I can do Comment.recent.by_unique_users.limit(3), and only get one comment per user? class User has_many :comments end class Comment belongs_to :user named_scope :recent, :order => 'comments.created_at DESC' named_scope :limit, lambda { |limit| {:limit => limit}} named_scope :by_unique_users end on sqlite named_scope :by_unique_user, :group = "user_id" works, but makes it freak out on postgres, which is deployed on production PGError: ERROR: column "comments.id" must appear in the GROUP BY clause or be used in an aggregate function

    Read the article

  • Would someone mind giving suggestions for this new assembly language?

    - by Noctis Skytower
    Greetings! Last semester in college, my teacher in the Computer Languages class taught us the esoteric language named Whitespace. In the interest of learning the language better with a very busy schedule (midterms), I wrote an interpreter and assembler in Python. An assembly language was designed to facilitate writing programs easily, and a sample program was written with the given assembly mnemonics. Now that it is summer, a new project has begun with the objective being to rewrite the interpreter and assembler for Whitespace 0.3, with further developments coming afterwards. Since there is so much extra time than before to work on its design, you are presented here with an outline that provides a revised set of mnemonics for the assembly language. This post is marked as a wiki for their discussion. Have you ever had any experience with assembly languages in the past? Were there some instructions that you thought should have been renamed to something different? Did you find yourself thinking outside the box and with a different paradigm than in which the mnemonics were named? If you can answer yes to any of those questions, you are most welcome here. Subjective answers are appreciated! hold N Push the number onto the stack copy Duplicate the top item on the stack copy N Copy the nth item on the stack (given by the argument) onto the top of the stack swap Swap the top two items on the stack drop Discard the top item on the stack drop N Slide n items off the stack, keeping the top item add Addition sub Subtraction mul Multiplication div Integer Division mod Modulo save Store load Retrieve L: Mark a location in the program call L Call a subroutine goto L Jump unconditionally to a label if=0 L Jump to a label if the top of the stack is zero if<0 L Jump to a label if the top of the stack is negative return End a subroutine and transfer control back to the caller exit End the program print chr Output the character at the top of the stack print int Output the number at the top of the stack input chr Read a character and place it in the location given by the top of the stack input int Read a number and place it in the location given by the top of the stack Question: How would you redesign, rewrite, or rename the previous mnemonics and for what reasons?

    Read the article

  • HTTP HEAD Request and System.Web.Mvc.FileResult

    - by mnero0429
    I'm using BITS to make requests to a ASP.NET MVC controller method named Source that returns a FileResult. I know the type FilePathResult uses HttpResponse.TransmitFile, but I don't know if HttpResponse.TransmitFile actually writes the file to the response stream regardless of the request type. My question is, does FileResult only include the header information on HEAD requests, or does it transmit the file regardless of the request type? Or, do I have to account for HEAD requests myself?

    Read the article

  • select SUM in Cake

    - by SpawnCxy
    When I tried using follow code to get the sum of the column named Serviceinfo.services $conditions = array('fields'=>array('SUM(Serviceinfo.services) as servicecount'),'conditions'=>array('time_id BETWEEN ? AND ?'=>array($startid,$endtid))); $services = $this->Serviceinfo->find('all',$conditions); I had to fetch the sum data with services[0][0]['servicecount'] which seems a little weird.And What I expect is services['Serviceinfo']['servicecount'],or more simple one.Then how can I fix this?Thanks in advance!

    Read the article

  • Connecting private IPs

    - by Greg Roberts
    A friend of mine told me there was a way to connect two private IPs without using a proxy server. The idea was that both computers connected to a public server and some how the server joined the private connections and won't use any more bandwidth. Is this true? How's this technique named? Thanks

    Read the article

  • how to import the parent model on gae-python

    - by zjm1126
    main:. +-a ¦ +-__init__.py ¦ +-aa.py +-b ¦ +-__init__.py ¦ +-bb.py +-cc.py if i am in aa.py , how to import cc.py ? this is my code ,but it is error : from main import cc what should i do . thanks updated in normal python file (not on gae),i can use this code : import os,sys dirname=os.path.dirname path=os.path.join(dirname(dirname(__file__))) sys.path.insert(0,path) import cc print cc.c but on gae , it show error : ImportError: No module named cc

    Read the article

  • google-app-engine: json module

    - by fmsf
    Hey i'm using JSON with appengine. I'm using json for comunication, so in the python side i have import json the error i'm getting is this: <class 'django.core.exceptions.ViewDoesNotExist'>: Could not import views.ganttapp. Error was: No module named json In my stand alone this works great, is there any problem with json on the app engine? or should I use another module? I dunno if you can open this but here it goes: http://ganttapp.appspot.com/newgantt you can find the error here

    Read the article

  • wordpress custom post type

    - by codedude
    So I've just made a custom post type for my wordpress theme named "Products". When I create a new post in it and view it, the link is something like this: "http://localhost/wordpress/product/a-product-title" This page views as expected but when I try to go to the supposed parent page: "http://localhost/wordpress/product/" I get a 404 error page. Is there a special template I need to make to view this page? Thanks

    Read the article

  • MYSQL in PHPMYADMIN - create table relationship from one table

    - by Stanley DecoWood
    I want to create a table relationship with MYSQL PHPMYADMIN. I have this Create table: CREATE TABLE students(code_students int(8)not null AUTO_INCREMENT, name_students varchar(25), age_students int(3), degree_program varchar(25), code_advisor int(8)not null, primary key(code_students, code_advisor) ); and i want to make a create table named advise relationship between code_students, code_advisor.

    Read the article

  • adding a js method

    - by Sorin Buturugeanu
    Hi! I have a js function that is named getID which is basically return document.getElementById(id) I want to make another function, getTag that would return getElementsByTagName. The part that I can't seem to manage is that I want to be able to call them like this: getID('myid').getTag('input') = so this would return all the input elements inside the element with the id myid Thanks! ps: getTag would also have to work if it's called by it's own, but then it would just return document.getElementsByTagName

    Read the article

  • parametrized query jqgrid

    - by user300657
    Hey, I have this mysql tables I want to display with jqgrid. The problem appears when I want to display a parametrized query. For example lets say I want to display all students older than 21. I have this variable named age which I want to pass to server.php file where I can construct the XML or JSON. On server I see some variables like $examp = $_REQUEST["q"]; but I dont know where to put $age to be accesed in server.php Thanks

    Read the article

  • Accessing ItemRenderer in AdvancedDataGrid Flex / AS3?

    - by Muhammad Husnain Ashfaq
    i have XMLList data which is used for advanceddatagird dataprovide(by converting it to hierarchal data ), the advanceddatagrid consist of 2 columns,i want to access the ItemRenderer of 2nd colomn (customized item rendrer) by giving the item. i can get the itemRendrer bu using var Obj:Object = itemToItemRenderer(item); i cant understand that obj is IListItemRendrer, but in 2nd colomn i have used the renderer named "ProcessFLowRendrer"? can you tell me how i can access the rendrer of 2nd column, by item not by index ?

    Read the article

  • Validate uniqueness within a recent set

    - by Matchu
    Is there a standard Rails 3 way of detecting uniqueness within a particular scope, or is this custom validation all I can do? class Post < ActiveRecord::Base # [named scope for recent posts] validates do |post| if Post.recent.where('url = ?', post.url).count > 0 errors[:url] = 'has already been posted recently - thanks anyway!' end end end (Haven't yet tried that exact code, so there may be errors, but you get the idea.)

    Read the article

  • python sqlite fails

    - by lakshmipathi
    My program uses sqlite3 plus python. It works fine with python 2.6.2 I moved it another machine and installed 2.6.4 and running the program gave me this error File "", line 1, in File "/opt/python-2.6.4/lib/python2.6/sqlite3/init.py", line 24, in from dbapi2 import * File "/opt/python-2.6.4/lib/python2.6/sqlite3/dbapi2.py", line 27, in from _sqlite3 import * ImportError: No module named _sqlite3

    Read the article

< Previous Page | 89 90 91 92 93 94 95 96 97 98 99 100  | Next Page >