Search Results

Search found 10804 results on 433 pages for 'attribute keys'.

Page 233/433 | < Previous Page | 229 230 231 232 233 234 235 236 237 238 239 240  | Next Page >

  • list in loop, Nonetype errors

    - by user2926755
    Here is my Code def printList(stringlist): empty = [] if stringlist is None: print empty else: print stringlist def add (stringlist, string): string = [] if string is None else string if stringlist is not None: stringlist.insert(0, string) else: stringlist.append(1) it somehow appears "AttributeError: 'NoneType' object has no attribute 'append'" I was originally looking for the code to be run like this: >>> myList = None >>> printList(myList) [] >>> for word in ['laundry','homework','cooking','cleaning']: myList = add(myList, word) printList(myList) [laundry] [homework, laundry] [cooking, homework, laundry] [cleaning, cooking, homework, laundry]

    Read the article

  • Possible ways of representing data in memory (.net)

    - by This is it
    Hi What are the possible ways of representing data in memory in .Net (or in general)? It would be great if data could be sorted and looked up by key (or multiple keys). We are thinking to use collections, arrays, list of collections/arrays. One object would be in several collections (one sorted asc, other desc, etc.). Maybe this is not a good idea, and we would like to hear some other possible solutions. Thank you

    Read the article

  • Dynamic class_name for has_many relations

    - by vooD
    I'm trying to make has_many relation with dynamic class_name attribute class Category < ActiveRecord::Base has_many :ads, :class_name => ( lambda { return self.item_type } ) end or class Category < ActiveRecord::Base has_many :ads, :class_name => self.item_type end But i got errors: can't convert Proc into String or undefined method `item_type' for #<Class:0xb62c6c88> Thank you for any help!

    Read the article

  • Does Doctrine 1.2 support importing indexes with Doctrine_Core::generateModelsFromDb function?

    - by Coagulant
    Does Doctrine 1.2 support importing indexes with Doctrine_Core::generateModelsFromDb() function? I need to make a migration between 2 database connections, one of them having unique index on 2 fields and one doesn't. And my migration is empty. It looks like Doctrine doesn't support indexes when importing from databae, other than those tied to relationship foreign keys. $changes = Doctrine_Core::generateMigrationsFromDiff($migrationsPath, array('doctrineOld'), array('doctrine'));

    Read the article

  • How to copy items from a dropdownbox to another [C#]

    - by LuRsT
    How can I copy items hardcoded from one dropdown box to another keeping the keys and values? drpTypes.Items.Add(new ListItem("Tipos de Acções", "1")); drpTypes.Items.Add(new ListItem("Tipos de Combustível", "2")); drpTypes.Items.Add(new ListItem("Tipos de Condutor", "3")); drpTypesCreateEdit.Items.AddRange(drpTypes.Items);

    Read the article

  • What is the best nuclear missile crypto system?

    - by The Rook
    You are on a submarine and there is an encrypted message that you want to read. Two people must use their keys at the same time in order to obtain the plain text. What is best cryptographic primitive to use? Are the following two implementations suitable? plain_text=decrypt(Key1 XOR key2,ciper_text,IV) plain_text=decrypt(Key1,rc4_encrypt(key2,ciper_text,IV2),IV1)

    Read the article

  • how to get all 'username' from my model 'MyUser' on google-app-engine ..

    - by zjm1126
    my model is : class MyUser(db.Model): user = db.UserProperty() password = db.StringProperty(default=UNUSABLE_PASSWORD) email = db.StringProperty() nickname = db.StringProperty(indexed=False) and my method which want to get all username is : s=[] a=MyUser.all().fetch(10000) for i in a: s.append(i.username) and the error is : AttributeError: 'MyUser' object has no attribute 'username' so how can i get all 'username', which is the simplest way . thanks

    Read the article

  • Sorting an object?

    - by dfjhdfjhdf
    How to sort this object lexicographically by its keys: var obj = {'somekey_B' : 'itsvalue', 'somekey_A' : 'itsvalue'); so that it outputs like this: for (k in obj) { alert(k + ' : ' + obj[k]); //first "somekey_A : itsvalue"; then "somekey_B : itsvalue" }

    Read the article

  • Creating instance of interface in C#

    - by Max
    I'm working with MS Excel interop in C# and I don't understand how this particular line of code works: var excel = new Microsoft.Office.Interop.Excel.Application(); where Microsoft.Office.Interop.Excel.Application is an INTERFACE defined as: [Guid("000208D5-0000-0000-C000-000000000046")] [CoClass(typeof(ApplicationClass))] public interface Application : _Application, AppEvents_Event { } I'm thinking that some magic happens when the interface is decorated with a CoClass attribute, but still how is it possible that we can create an instance of an interface with a new keyword? Shouldn't it generate a compile time error?

    Read the article

  • How do I do a .count on the model an object belongs_to in rails?

    - by Angela
    I have @contacts_added defined as follows: @contacts_added = Contact.all(:conditions => ["date_entered >?", 5.days.ago.to_date]) Each contact belongs_to a Company. I want to be able the count the number of distinct Companies that @contacts_added belong to. contacts_added will have many contacts that belong to a single company, accessible through a virtual attribute contacts_added.company_name How do I do that?

    Read the article

  • SQL Alter: add multiple FKs?

    - by acidzombie24
    From here ALTER TABLE ORDERS ADD FOREIGN KEY (customer_sid) REFERENCES CUSTOMER(SID); How do i add several keys with SQL Server? is it something like the below? (I cant test ATM and unfortunately i have no way to test queries unless i run it through code) ALTER TABLE ORDERS ADD FOREIGN KEY (customer_sid) REFERENCES CUSTOMER(SID), ADD FOREIGN KEY (customer_sid2) REFERENCES CUSTOMER(SID2); or is it like ALTER TABLE ORDERS ADD FOREIGN KEY (customer_sid, customer_sid2) REFERENCES CUSTOMER(SID, SID2)

    Read the article

  • Animate css attributes: set "bottom" and remove "top"

    - by Slevin
    I'm working on a few animations with jQuery. I have 3-4 elements which should slide in from the top. I defined their positions with css: #element-1 { top:124px; left:0px; right:auto; bottom:auto; } #element-2 { top:230px; left:670px; right:auto; bottom:auto; } #element-3 { top:auto; left:0px; right:auto; bottom:100px; } Then I save their positions initial on pageload, cause i have to manipulate the css value to top: -1000px to hide them and make the "slide in from top" animation possible. var image_margins = []; $('img').each(function() { var obj = $(this), id = obj.attr('id'), mtop = obj.css('top'), mleft = obj.css('left'), mright = obj.css('right'), mbottom = obj.css('bottom'); // save alle margins in array image_margins[id] = {mtop:mtop,mleft:mleft,mright:mright,mbottom:mbottom}; // hide all content elements obj.css({'top':'-1000px'}); }); When the user clicks the animate button, the elements should slide to their saved positions. The problem: i can't remove the top attribute. Some elements only have bottom margins. I tried to set top to auto or '', but it's always 0px in DOM inspector. And bottom don't work if top is set. How can i get rid of the top attribute? $('.button').click(function(){ $('img').each(function() { var image = $(this), id = image.attr('id'), timeout = 0; setTimeout(function() { var mtop, mleft, mright, mbottom; if (image_margins[id].mtop != 'auto') { mtop = image_margins[id].mtop; } else { mtop = ''; } if (image_margins[id].mleft != 'auto') { mleft = image_margins[id].mleft; } else { mleft = ''; } if (image_margins[id].mright != 'auto') { mright = image_margins[id].mright; } else { mright = ''; } if (image_margins[id].mbottom != 'auto') { mbottom = image_margins[id].mbottom; } else { mbottom = ''; } image.animate({'top':mtop,'left':mleft,'right':mright,'bottom':mbottom},500); },timeout); timeout = timeout + 200; }); });

    Read the article

  • How can I read this parameters inside my software? (c#)

    - by Dezigo
    Hello! I have created a shortcut of my .exe file. I want add to '.exe' extra parameters.(on shortcut: Target attribute) Example Target: "C:\Documents and Settings\dezigo\My Documents\c# programm\DirectoryScanner\DirectoryScanner\DirectoryScanner\bin\Debug\DirectoryScanner.exe" + extra parrams(like a method=1) How can I read this parameters inside my software? (c#) Then ,when starting .exe check if(method == 1) { //do something } else { //do something }

    Read the article

  • Image not showing in src tag

    - by Nitesh Panchal
    Hello, Can anybody tell me how do i give absolute path of the img tag's src attribute? The following doesn't work <img alt="NO IMAGE" src="/home/administrator/tiger-info0[1].gif"/> I am working On Ubuntu and i am very sure that image exists on this path.

    Read the article

  • Maintaining software versions

    - by SCM
    I am preparing an Excel sheet in which I have to maintain the version number of different pieces of software developed at our company. Can anyone tell me what kind of information to save along with the version number in that sheet for different types of software? I know only one attribute that is version number, and if anything else so please let me know. Regards

    Read the article

< Previous Page | 229 230 231 232 233 234 235 236 237 238 239 240  | Next Page >