Search Results

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

Page 155/433 | < Previous Page | 151 152 153 154 155 156 157 158 159 160 161 162  | Next Page >

  • How can I prevent MEF from throwing an exception when an Export is not found?

    - by Kilhoffer
    I have a class with an IList<T> property decorated with the [ImportMany(allowRecomposition = true)] attribute. There are some conditions in which the application might not find any available Exports of the requested type. Right now, it's throwing a CompositionException if no Exports of the requested type are found. I dislike application flow being determined by thrown exceptions, so I would rather not catch and react in this case. Rather, I just want program execution to continue. Is there a flag or something I can set to make this Import optional? I know for single import properties, you can do this: [Import(AllowDefault = true)] but 'AllowDefault' is not an option on the ImportMany attribute.

    Read the article

  • data is not getting ordered by date

    - by raging_boner
    Can't get list sorted by date. How to show data ordered by date? XDocument doc = XDocument.Load(Server.MapPath("file.xml")); IEnumerable<XElement> items = from item in doc.Descendants("item") orderby Convert.ToDateTime(item.Attribute("lastChanges").Value) descending where item.Attribute("x").Value == 1 select item; Repeater1.DataSource = items; Repeater1.DataBind(); Xml file looks like this: <root> <items> <item id="1" lastChanges="15-05-2010" x="0" /> <item id="2" lastChanges="16-05-2010" x="1" /> <item id="3" lastChanges="17-05-2010" x="1" /> </items> </root>

    Read the article

  • RichFaces Toolbargroup centering a group

    - by Jeremiah
    Hello there I am trying use a toolbar so that it has three parts part A is aligned left part B is aligned Center part C is aligned right both the right and left i can use the location attribute ... but since there is no center attribute i am not able to center part b. I can use a rich:spacer but this makes the toolbar rigid and when the screen size is reduced the toolbar gets overlapped ... is there any i can center this without the toolbar getting over lapped. Any suggestions or workarounds is welcome cheers

    Read the article

  • LDAP "Insufficient Access"

    - by mon4goos
    I am trying to create an LDAP filter string. In each LDAP entry there is an attribute called "status" that has many values, some of which are of the regex form "[ab][0-9][1-9]". For example, "a20" or "b81". All other values for the "status" attribute are just alphabetical characters. I only want to let through entries that have a "status" value of the first form. When I construct an LDAP filter such as (status=a*) I get an "Insufficient Access" error. However, if I change the query to (status=a1*) that works fine. Is there any reason for this? If there behavior is unavoidable, can anyone thing of a way to get only the entries I want.

    Read the article

  • Java JPA @OneToMany neededs to reciprocate @ManyToOne?

    - by bguiz
    Create Table A ( ID varchar(8), Primary Key(ID) ); Create Table B ( ID varchar(8), A_ID varchar(8), Primary Key(ID), Foreign Key(A_ID) References A(ID) ); Given that I have created two tables using the SQL statements above, and I want to create Entity classes for them, for the class B, I have these member attributes: @Id @Column(name = "ID", nullable = false, length = 8) private String id; @JoinColumn(name = "A_ID", referencedColumnName = "ID", nullable = false) @ManyToOne(optional = false) private A AId; In class A, do I need to reciprocate the many-to-one relationship? @Id @Column(name = "ID", nullable = false, length = 8) private String id; @OneToMany(cascade = CascadeType.ALL, mappedBy = "AId") private List<B> BList; //<-- Is this attribute necessary? Is it a necessary or a good idea to have a reciprocal @OneToMany for the @ManyToOne? If I make the design decision to leave out the @OneToMany annotated attribute now, will come back to bite me further down.

    Read the article

  • Parameterise Service start option in WiX installer

    - by Jamiec
    I have a ServiceInstall component in a WiX installer where I have a requirement to either start auto or demand depending on parameters passed into the MSI. So the Xml element in question is <ServiceInstall Vital="yes" Name="My Windows Service" Type="ownProcess" Account="[SERVICEUSERDOMAIN]\[SERVICEUSERNAME]" DisplayName="My Service" Password="[SERVICEUSERPASSWORD]" Start="demand" Interactive="no" Description="Something interesting here" Id="Service" ErrorControl="ignore"></ServiceInstall> WiX will not allow using a PArameter for the Start attribute, so Im stuck with completely suplicating the component with a condition, eg/ <Component Id="ServiceDemand" Guid="{E204A71D-B0EB-4af0-96DB-9823605050C7}" > <Condition>SERVICESTART="demand"</Condition> ... and completely duplicating the whole component, with a different setting for Start and a different Condition. Anyone know of a more elegant solution? One where I don;t have to maintain 2 COmponents whjich do exactly the same thing except the Attribute for Start?

    Read the article

  • Composite Primary and Cardinality

    - by srini.venigalla
    I have some questions on Composite Primary Keys and the cardinality of the columns. I searched the web, but did not find any definitive answer, so I am trying again. The questions are: Context: Large (50M - 500M rows) OLAP Prep tables, not NOSQL, not Columnar. MySQL and DB2 1) Does the order of keys in a PK matter? 2) If the cardinality of the columns varies heavily, which should be used first. For example, if I have CLIENT/CAMPAIGN/PROGRAM where CLIENT is highly cardinal, CAMPAIGN is moderate, PROGRAM is almost like a bitmap index, what order is the best? 3) What order is the best for Join, if there is a Where clause and when there is no Where Clause (for views) Thanks in advance.

    Read the article

  • Application settings methods? c++

    - by flyout
    I am thinking about adding configurable settings to an application, and I think the easiest ways are an external file or win registry (its a win only app). Which way would be better? I was wondering, an user with not enough permissions may not be able to create/write the config file. And in the case of the registry, would todays antivirus allow me to add/edit/remove keys? Or they only monitor certain keys? Also, if someone knows a class/lib to manage config settings (in pure win32) in vc++ please post it.

    Read the article

  • How to set attribs in GWT?

    - by Jonas Byström
    I'm not getting any effect out of DOM.setElementAttribute, am I doing something wrong? class MyListBox extends com.google.gwt.user.client.ui.ListBox { .... protected void setHoverAutoWidth() { addDomHandler(new MouseOverHandler() { public void onMouseOver(MouseOverEvent event) { DOM.setElementAttribute(getElement(), "width", "auto"); } }, MouseOverEvent.getType()); addDomHandler(new BlurHandler(){ public void onBlur(BlurEvent event) { DOM.setElementAttribute(getElement(), "width", "100px"); } }, BlurEvent.getType()); } } (I know there are less hacky ways to change the width than to set the style attribute directly, but I don't care about css right now.) Edit: Oops, just realized that width does not change the style width, just adds a width attribute to the tag (which explains why nothing happens). Any suggestions on how to modify the style are still welcome!

    Read the article

  • Is there a way to enforce/preserve order of XML elements in an XML Schema?

    - by MarcoS
    Let's consider the following XML Schema: <?xml version="1.0" encoding="UTF-8"?> <schema targetNamespace="http://www.example.org/library" elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:lib="http://www.example.org/library"> <element name="library" type="lib:libraryType"></element> <complexType name="libraryType"> <sequence> <element name="books" type="lib:booksType"></element> </sequence> </complexType> <complexType name="booksType"> <sequence> <element name="book" type="lib:bookType" maxOccurs="unbounded" minOccurs="1"></element> </sequence> </complexType> <complexType name="bookType"> <attribute name="title" type="string"></attribute> </complexType> </schema> and a corresponding XML example: <?xml version="1.0" encoding="UTF-8"?> <lib:library xmlns:lib="http://www.example.org/library" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.org/library src/library.xsd "> <lib:books> <lib:book title="t1"/> <lib:book title="t2"/> <lib:book title="t3"/> </lib:books> </lib:library> Is there a way to guarantee that the order of <lib:book .../> elements is preserved? I want to be sure that any parser reading the XML will return books in the specified oder, that is first the book with title="t1", then the book with title="t2", and finally the book with title="t3". As far as I know XML parsers are not required to preserve order. I wonder whether one can enforce this through XML Schema? One quick solution for me would be adding an index attribute to the <lib:book .../> element, and delegate order preservation to the application reading the XML. Comments? Suggestions?

    Read the article

  • Write PEM encoded certificate in file - java

    - by user1349407
    Good day. I recently create X.509 certificate by using bouncy castle API. I need to save the certificate result rather than display the result. I tried to use FileOutputStream, but it does not work. regards the result is like follows -----BEGIN CERTIFICATE----- MIICeTCCAeKgAwIBAgIGATs8OWsXMA0GCSqGSIb3DQEBCwUAMBsxGTAXBgNVBAMT... -----END CERTIFICATE----- The code is belows import java.io.FileOutputStream; //example of a basic CA public class PKCS10CertCreateExample { public static X509Certificate[] buildChain() throws Exception { //create the certification request KeyPair pair = chapter7.Utils.generateRSAKeyPair(); PKCS10CertificationRequest request = PKCS10ExtensionExample.generateRequest(pair); //create a root certificate KeyPair rootPair=chapter7.Utils.generateRSAKeyPair(); X509Certificate rootCert = X509V1CreateExample.generateV1Certificate (rootPair); //validate the certification request if(!request.verify("BC")) { System.out.println("request failed to verify!"); System.exit(1); } //create the certificate using the information in the request X509V3CertificateGenerator certGen = new X509V3CertificateGenerator(); certGen.setSerialNumber(BigInteger.valueOf(System.currentTimeMillis())); certGen.setIssuerDN(rootCert.getSubjectX500Principal()); certGen.setNotBefore(new Date(System.currentTimeMillis())); certGen.setNotAfter(new Date(System.currentTimeMillis()+50000)); certGen.setSubjectDN(request.getCertificationRequestInfo().getSubject()); certGen.setPublicKey(request.getPublicKey("BC")); certGen.setSignatureAlgorithm("SHA256WithRSAEncryption"); certGen.addExtension(X509Extensions.AuthorityKeyIdentifier, false, new AuthorityKeyIdentifierStructure(rootCert)); certGen.addExtension(X509Extensions.SubjectKeyIdentifier, false, new SubjectKeyIdentifierStructure(request.getPublicKey("BC"))); certGen.addExtension(X509Extensions.BasicConstraints, true, new BasicConstraints(false)); //certGen.addExtension(X509Extensions.KeyUsage, true, new BasicConstraints(false)); certGen.addExtension(X509Extensions.KeyUsage, true, new KeyUsage(KeyUsage.digitalSignature | KeyUsage.keyEncipherment)); certGen.addExtension(X509Extensions.ExtendedKeyUsage, true, new ExtendedKeyUsage(KeyPurposeId.id_kp_serverAuth)); //extract the extension request attribute ASN1Set attributes = request.getCertificationRequestInfo().getAttributes(); for(int i=0;i!=attributes.size();i++) { Attribute attr = Attribute.getInstance(attributes.getObjectAt(i)); //process extension request if(attr.getAttrType().equals(PKCSObjectIdentifiers.pkcs_9_at_extensionRequest)) { X509Extensions extensions = X509Extensions.getInstance(attr.getAttrValues().getObjectAt(0)); Enumeration<?> e = extensions.oids(); while(e.hasMoreElements()) { DERObjectIdentifier oid = (DERObjectIdentifier)e.nextElement(); X509Extension ext = extensions.getExtension(oid); certGen.addExtension(oid, ext.isCritical(), ext.getValue().getOctets()); } } } X509Certificate issuedCert = certGen.generateX509Certificate(rootPair.getPrivate()); return new X509Certificate[]{issuedCert, rootCert}; } public static void main(String[] args) throws Exception { X509Certificate[] chain = buildChain(); PEMWriter pemWrt = new PEMWriter(new OutputStreamWriter(System.out)); pemWrt.writeObject(chain[0]); //pemWrt.writeObject(chain[1]); pemWrt.close(); //write it out //FileOutputStream fOut = new FileOutputStream("pkcs10req.req"); //fOut.write(chain[0].toString()); //fOut.write() //System.out.println(chain[0].toString()); //fOut.close(); } }

    Read the article

  • Is there a reason why a base class decorated with XmlInclude would still throw a type unknown exception when serialized?

    - by Tedford
    I will simplify the code to save space but what is presented does illustrate the core problem. I have a class which has a property that is a base type. There exist 3 dervived classes which could be assigned to that property. If I assign any of the derived classes to the container then the XmlSerializer throws dreaded "The type xxx was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically." exception when attempting to seralize the container. However my base class is already decorated with that attribute so I figure there must be an additional "hidden" requirement. The really odd part is that the default WCF serializer has no issues with this class hierarchy. The Container class [DataContract] [XmlRoot(ElementName = "TRANSACTION", Namespace = Constants.Namespace)] public class PaymentSummaryRequest : CommandRequest { /// <summary> /// Gets or sets the summary. /// </summary> /// <value>The summary.</value> /// <remarks></remarks> [DataMember] public PaymentSummary Summary { get; set; } /// <summary> /// Initializes a new instance of the <see cref="PaymentSummaryRequest"/> class. /// </summary> public PaymentSummaryRequest() { Mechanism = CommandMechanism.PaymentSummary; } } The base class [DataContract] [XmlInclude(typeof(xxxPaymentSummary))] [XmlInclude(typeof(yyyPaymentSummary))] [XmlInclude(typeof(zzzPaymentSummary))] [KnownType(typeof(xxxPaymentSummary))] [KnownType(typeof(xxxPaymentSummary))] [KnownType(typeof(zzzPaymentSummary))] public abstract class PaymentSummary { } One of the derived classes [DataContract] public class xxxPaymentSummary : PaymentSummary { } The serialization code var serializer = new XmlSerializer(typeof(PaymentSummaryRequest)); serializer.Serialize(Console.Out,new PaymentSummaryRequest{Summary = new xxxPaymentSummary{}}); The Exception System.InvalidOperationException: There was an error generating the XML document. --- System.InvalidOperationException: The type xxxPaymentSummary was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically. at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterPaymentSummaryRequest.Write13_PaymentSummary(String n, String ns, PaymentSummary o, Boolean isNullable, Boolean needType) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterPaymentSummaryRequest.Write14_PaymentSummaryRequest(String n, String ns, PaymentSummaryRequest o, Boolean isNullable, Boolean needType) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterPaymentSummaryRequest.Write15_TRANSACTION(Object o) --- End of inner exception stack trace --- at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id) at System.Xml.Serialization.XmlSerializer.Serialize(TextWriter textWriter, Object o, XmlSerializerNamespaces namespaces) at UserQuery.RunUserAuthoredQuery() in c:\Users\Tedford\AppData\Local\Temp\uqacncyo.0.cs:line 47

    Read the article

  • Linq to XML query returining a list of strings

    - by objectsbinding
    Hi all, I have the following class public class CountrySpecificPIIEntity { public string Country { get; set; } public string CreditCardType { get; set; } public String Language { get; set; } public List<String> PIIData { get; set; } } I have the following XML that I want to query using Linq-to-xml and shape in to the class above <?xml version="1.0" encoding="utf-8" ?> <piisettings> <piifilter country="DE" creditcardype="37" language="ALL" > <filters> <filter>FIRSTNAME</filter> <filter>SURNAME</filter> <filter>STREET</filter> <filter>ADDITIONALADDRESSINFO</filter> <filter>ZIP</filter> <filter>CITY</filter> <filter>STATE</filter> <filter>EMAIL</filter> </filters> </piifilter> <piifilter country="DE" creditcardype="37" Language="en" > <filters> <filter>EMAIL</filter> </filters> </piifilter> </piisettings> I'm using the following query but I'm having trouble with the last attribute i.e. PIIList. var query = from pii in xmlDoc.Descendants("piifilter") select new CountrySpecificPIIEntity { Country = pii.Attribut("country").Value, CreditCardType = pii.Attribute("creditcardype").Value, Language = pii.Attribute("Language").Value, PIIList = (List<string>)pii.Elements("filters") }; foreach (var entity in query) { Debug.Write(entity.Country); Debug.Write(entity.CreditCardType); Debug.Write(entity.Language); Debug.Write(entity.PIIList); } How Can I get the query to return a List to be hydrated in to the PIIList property.

    Read the article

  • how do you get qTip to have proper width when loading content via ajax

    - by ooo
    i have an asp.net mvc site and here is a dynamic tooltip using qTip Here is my code: $('a.showNutritionInfo').each(function() { $(this).qtip({ content: { text: '<img src="../../images/ajax-loader1.gif" alt="" />', style: { width: 450 }, url: '/Tracker/NutritionInfo/' + $(this).attr('id'), method: 'get' } }); }); this works perfectly EXCEPT the width attribute listed above is ignored. No matter what i put in that width attribute, i get the same size width tooltip which is about half of the width that i need. the height is perfectly fine. any ideas? is this a bug in the product ?

    Read the article

  • SQL Server: Primary Key Schema Largely Guid but Sometimes Integer Types...

    - by Code Sherpa
    OK, this may be a silly question but... I have inherited a project and am tasked with going over the primary key relationships. The project largely uses Guids. I say "largely" because there are examples where tables use integral types to reflect enumerations. For example, dbo.MessageFolder has MessageFolderId of type int to reflect public emum MessageFolderTypes { inbox = 1, sent = 2, trash = 3, etc... } This happens a lot. There are tables with primary keys of type int which is unavoidable because of their reliance on enumerations and tables with primary keys of type Guid which reflect the primary key choice on the part of the previous programmer. Should I care that the PK schema is spotty like this? It doesn't feel right but does it really matter? If this could create a problem, how do I get around it (I really can't move all PKs to type int without serious legwork and I have never heard of enumerations that have guid values)? Thanks.

    Read the article

  • python: calling constructor from dictionary?

    - by Jason S
    I'm not quite sure of the terminology here so please bear with me.... Let's say I have a constructor call like this: machineSpecificEnvironment = Environment( TI_C28_ROOT = 'C:/appl/ti/ccs/4.1.1/ccsv4/tools/compiler/c2000', JSDB = 'c:/bin/jsdb/jsdb.exe', PYTHON_PATH = 'c:/appl/python/2.6.4', ) except I would like to replace that by an operation on a dictionary provided to me: keys = {'TI_C28_ROOT': 'C:/appl/ti/ccs/4.1.1/ccsv4/tools/compiler/c2000', 'JSDB': 'c:/bin/jsdb/jsdb.exe', 'PYTHON_PATH': 'c:/appl/python/2.6.4'} machineSpecificEnvironment = Environment( ... what do I put here? it needs to be a function of "keys" ... ) How can I do this?

    Read the article

  • How to position columns in select list based on a variable.

    - by Rohit
    I am creating a dynamic grid which is created by selecting the format defined in the below XML.My select list includes all columns in this XML,I want to position these columns columns on the basic of position attribute in XML. <gridFormat> <column property="CustomerID" dbName="CustName" HeaderText="Customer" IsVisible="0" Position="1" /> <column property="CustomerName" dbName="FacilityName" HeaderText="Facility" IsVisible="1" Position="3" /> <column property="FacilityInternalID" dbName="Pname" HeaderText="Patient" IsVisible="1" Position="2" /> </gridFormat> I cannot select them in the order specified by the position attribute. I can do it in C# by looping around the returned datatable and specifically position columns using datatable.columns.setordinal() method. Is there any better way in SQL or C# to accomplish this.

    Read the article

  • How to handle this type of model validation in Ruby on Rails

    - by randombits
    I have a controller/model hypothetically named Pets. Pets has the following declarations: :belongs_to owner :has_many dogs :has_many cats Not the best example, but again, it demonstrates what I'm trying to solve. Now when a request comes in as an HTTP POST to http://127.0.0.1/pets, I want to create an instance of Pets. The restriction here is, if the user doesn't submit at least one dog or one cat, it should fail validation. It can have both, but it can't be missing both. How does one handle this in Ruby on Rails? Dogs don't care if cats exists and the inverse is also true. Can anyone show some example code of what the Pets model would look like to ensure that one or the other exists, or fail otherwise? errors.add also takes an attribute, in this case, there is no particular attribute that's failing. It's almost a 'virtual' combination that's missing.

    Read the article

  • How do I get the path of the current executed file in python?

    - by Sorin Sbarnea
    This may seam a newbie question but it is not. It looks that common approaches are not always working: Currently I know only two options but none of them looks to work an all cases. sys.argv[0] This means using path = os.path.abspath(os.path.dirname(sys.argv[0])) but this does not work if you are running from another python script from another directory, and this can really happen in real life. __file__ this means that path = os.path.abspath(os.path.dirname(__file__)) but I found that this doesn't work: py2exe that doesn't have a __file__ attribute but there is an workaround. when you run from IDLE with execute() there is no __file__ attribute OS X 10.6 where I get NameError: global name '__file__' is not defined Related questions with incomplete answers: http://stackoverflow.com/questions/1296501/python-find-path-to-file-being-run http://stackoverflow.com/questions/1483827/python-path-to-current-file-depends-on-how-i-execute-the-program http://stackoverflow.com/questions/2259503/how-to-know-the-path-of-the-running-script-in-python http://stackoverflow.com/questions/509742/python-chdir-to-dir-the-py-script-is-in

    Read the article

  • How to iterate over every property of an object in javascript?

    - by OverloadUT
    Is there a way to iterate over every property of an object using the Prototype JavaScript framework? Here's the situation: I am getting an AJAX response in JSON that looks something like this: {foo: 1, bar: 2, barobj: {75: true, 76: false, 85: true}} If I evaluate that json response in to a variable response, I want to be able to iterate over each property in the response.barobj object to see which indexes are true and which are false. Prototype has both Object.keys() and Object.values() but oddly seems to not have a simple Object.each() function! I could take the results of Object.keys() and Object.values() and cross-reference the other as I iterate through one, but that is such a hack that I am sure there is a proper way to do it!

    Read the article

  • Should I use parameters in template scripting to control the output, or a separate specialized template?

    - by asawyer
    Would it be considered best practice to use a single template that changes it's output based on script values, or have multiple templates, and use the view to pick the correct one instead? For example, in this underscope template: <script type="text/template" id="SkillsetTemplate"> <div class='RegularMode <%= (skillset.get('InEditMode')===false)?'show':'hide' %>'> </div> <div class='EditMode <%= (skillset.get('InEditMode')===true)?'show':'hide' %>'> </div> </script> I use a backbone model to bind against, and use the InEditMode attribute to pick which content to render. Should I instead have a normal mode, and an edit mode template, and use the attribute on the model to pick the template ? For background purposes, I am using backbone.js with underscore templates and an MVC3 backend.

    Read the article

  • how do i convert RSAParameters from .net to .pem file so i can use it in php

    - by netuser24
    Hello i have a private and public keys for RSA generated in .net in this format string privateKey = "<RSAKeyValue>" + "<Modulus>...kCFhsjB4xMW49mrx5B/Ga...</Modulus>" + "<Exponent>...</Exponent>" + "<P>...7bRCrQVgVIfXdTIH3iY8x...</P>" + "<Q>...4SiQDhrAZADuFDTr7bRCrQVgVIfXdTIH3iY8x...</Q>" + "<DP>...ZADuFDTr7bRCrQVgVIfXdT...</DP>" + "<DQ>...4SiQDhrAZADuFDTr...</DQ>" + "<InverseQ>...sjB4xMW49mrx5B/Ga...</InverseQ>" + "<D>...SiQDhrAZADuFDTr7bRCrQVgVIf...</D>" + "</RSAKeyValue>"; how can i convert this so i can use it in php openssl functions to encrypt and decrypt data? i need both public and private keys converted. maybe with openssl bash command in linux where can i specify my own modulus, exponent and so on? any ideas? thanks

    Read the article

  • How do I parse this invalid JSON string in jQuery?

    - by LesterDove
    Hi, I am looking to access the various bits of data in this data attribute: <div class="location" data="{id: 4, point: {lng: -71.413364, lat: 41.673681}, category: 'Restaurant'}"> The data attribute is easy enough to reach in jQuery, of course. But the string seems to be a non-standard or invalid form of JSON. I've tried JSON.parse() and also a basic JS method of splitting the array. By all accounts, it just seems to be an invalidly-serialized string. Will I need to reformat the data string? (it doesn't come from me, and it's used by other routines that I'd rather not break, so...)

    Read the article

  • python dictionary with constant value-type

    - by s.kap
    hi there, I bumped into a case where I need a big (=huge) python dictionary, which turned to be quite memory-consuming. However, since all of the values are of a single type (long) - as well as the keys, I figured I can use python (or numpy, doesn't really matter) array for the values ; and wrap the needed interface (in: x ; out: d[x]) with an object which actually uses these arrays for the keys and values storage. I can use a index-conversion object (input -- index, of 1..n, where n is the different-values counter), and return array[index]. I can elaborate on some techniques of how to implement such an indexing-methods with reasonable memory requirement, it works and even pretty good. However, I wonder if there is such a data-structure-object already exists (in python, or wrapped to python from C/++), in any package (I checked collections, and some Google searches). Any comment will be welcome, thanks.

    Read the article

< Previous Page | 151 152 153 154 155 156 157 158 159 160 161 162  | Next Page >