Search Results

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

Page 63/433 | < Previous Page | 59 60 61 62 63 64 65 66 67 68 69 70  | Next Page >

  • Advice Please: SQL Server Identity vs Unique Identifier keys when using Entity Framework

    - by c.batt
    I'm in the process of designing a fairly complex system. One of our primary concerns is supporting SQL Server peer-to-peer replication. The idea is to support several geographically separated nodes. A secondary concern has been using a modern ORM in the middle tier. Our first choice has always been Entity Framework, mainly because the developers like to work with it. (They love the LiNQ support.) So here's the problem: With peer-to-peer replication in mind, I settled on using uniqueidentifier with a default value of newsequentialid() for the primary key of every table. This seemed to provide a good balance between avoiding key collisions and reducing index fragmentation. However, it turns out that the current version of Entity Framework has a very strange limitation: if an entity's key column is a uniqueidentifier (GUID) then it cannot be configured to use the default value (newsequentialid()) provided by the database. The application layer must generate the GUID and populate the key value. So here's the debate: abandon Entity Framework and use another ORM: use NHibernate and give up LiNQ support use linq2sql and give up future support (not to mention get bound to SQL Server on DB) abandon GUIDs and go with another PK strategy devise a method to generate sequential GUIDs (COMBs?) at the application layer I'm leaning towards option 1 with linq2sql (my developers really like linq2[stuff]) and 3. That's mainly because I'm somewhat ignorant of alternate key strategies that support the replication scheme we're aiming for while also keeping things sane from a developer's perspective. Any insight or opinion would be greatly appreciated.

    Read the article

  • Database design MySQL using foreign keys

    - by dscher
    I'm having some a little trouble understanding how to handle the database end of a program I'm making. I'm using an ORM in Kohana, but am hoping that a generalized understanding of how to solve this issue will lead me to an answer with the ORM. I'm writing a program for users to manage their stock research information. My tables are basically like so: CREATE TABLE tags( id INT AUTO_INCREMENT NOT NULL PRIMARY KEY, tags VARCHAR(30), UNIQUE(tags) ) ENGINE=INNODB DEFAULT CHARSET=utf8; CREATE TABLE stock_tags( id INT AUTO_INCREMENT NOT NULL PRIMARY KEY, tag_id INT NOT NULL, stock_id INT NOT NULL, FOREIGN KEY (tag_id) REFERENCES tags(id), FOREIGN KEY(stock_id) REFERENCES stocks(id) ON DELETE CASCADE ) ENGINE=INNODB DEFAULT CHARSET=utf8; CREATE TABLE notes( id INT AUTO_INCREMENT NOT NULL, stock_id INT NOT NULL, notes TEXT NOT NULL, FOREIGN KEY (stock_id) REFERENCES stocks(id) ON DELETE CASCADE, PRIMARY KEY(id) ) ENGINE=INNODB DEFAULT CHARSET=utf8; CREATE TABLE links( id INT AUTO_INCREMENT NOT NULL, stock_id INT NOT NULL, links VARCHAR(2083) NOT NULL, FOREIGN KEY (stock_id) REFERENCES stocks(id) ON DELETE CASCADE, PRIMARY KEY(id) ) ENGINE=INNODB DEFAULT CHARSET=utf8; How would I get all the attributes of a single stock, including its links, notes, and tags? Do I have to add links, notes, and tags columns to the stocks table and then how do you call it? I know this differs using an ORM and I'd assume that I can use join tables in SQL. Thanks for any help, this will really help me understand the issue a lot better.

    Read the article

  • Unable to relate two MySQL tables (foreign keys)

    - by KPL
    Hello people, Here's my USER table CREATE TABLE IF NOT EXISTS `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(100) NOT NULL, `expiry` varchar(6) NOT NULL, `contact_id` int(11) NOT NULL, `email` varchar(255) NOT NULL, `password` varchar(100) NOT NULL, `level` int(3) NOT NULL, `active` tinyint(4) NOT NULL DEFAULT '1', PRIMARY KEY (`id`,`email`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; And here's my contact_info table CREATE TABLE IF NOT EXISTS `contact_info` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `email_address` varchar(255) NOT NULL, `company_name` varchar(255) NOT NULL, `license_number` varchar(255) NOT NULL, `phone` varchar(30) NOT NULL, `fax` varchar(30) NOT NULL, `mobile` varchar(30) NOT NULL, `category` varchar(100) NOT NULL, `country` varchar(20) NOT NULL, `state` varchar(20) NOT NULL, `city` varchar(100) NOT NULL, `postcode` varchar(50) NOT NULL, PRIMARY KEY (`id`,`email_address`), ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; The system uses username to login users.I want to modify it in such a way that it uses email for login. But there's no email_address in users table. I have added foreign key - email in user table(which is email_address in contact_info). How should I query database?

    Read the article

  • getting attribute as column headers

    - by edwards
    I have the following XML: <DEVICEMESSAGES> <VERSION xml="1" checksum="" revision="0" envision="33050000" device="" /> <HEADER id1="0001" id2="0001" content="Nasher[&lt;messageid&gt;]: &lt;!payload&gt;" /> <MESSAGE level="7" parse="1" parsedefvalue="1" tableid="15" id1="24682" id2="24682" eventcategory="1003010000" content="Access to &lt;webpage&gt; was blocked due to its category (&lt;info&gt; by &lt;hostname&gt;)" /> </DEVICEMESSAGES> I am using the following XSLT: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:strip-space elements="*"/> <xsl:template match="DEVICEMESSAGES/HEADERS"> <xsl:value-of select="@id2"/>,<xsl:text/> <xsl:value-of select="@content"/>,<xsl:text/> <xsl:text>&#xa;</xsl:text> </xsl:template> </xsl:stylesheet> I get the following output: 0001 , Nasher[<messageid>]: <!payload> whereas I need the column headings, too: id2, content 0001 , Nasher[<messageid>]: <!payload>

    Read the article

  • Problems with type and ext attribute of artifact

    - by user315228
    Hi, I have following definition in ivy.xml <dependency org="southbeach" name="ego" rev="4.3.1" conf="properties->asterik" > <artifact name="ego" type="conf" ext="conf" conf="properties->asterik"/> </dependency> I have files with either extension conf or properties which i need at runtime, in ivysettings.xml, i have following: <filesystem name="privateFSa"> <artifact pattern="${localRepositoryLocation}/[artifact].[ext]" /> </filesystem> It always tries to look for ego.jar instead of ego.conf. can please somebody shed light on this? am i doing something wrong or ivy just supports tar,zip,gz, jar and not properties or conf files? I did workaround for now in ivysettings.xml <filesystem name="privateFSa"> <artifact pattern="${localRepositoryLocation}/[artifact].conf" /> </filesystem> but this doesnt looks good to hardcode conf there. Thanks, Almas

    Read the article

  • Strategies for generating Zend Cache Keys

    - by emeraldjava
    ATM i'm manually generating a cache key based on the method name and parameters, then follow to the normal cache pattern. This is all done in the Controller and i'm calling a model class that 'extends Zend_Db_Table_Abstract'. public function indexAction() { $cache = Zend_Registry::get('cache'); $individualleaguekey = sprintf("getIndividualLeague_%d_%s",$leagueid,$division->code); if(!$leaguetable = $cache->load($individualleaguekey)) { $table = new Model_DbTable_Raceresult(); $leaguetable = $table->getIndividualLeague($leagueid,$division,$races); $cache->save($leaguetable, $individualleaguekey); } $this->view->leaguetable = $leaguetable; .... I want to avoid the duplication of parameters to the cache creation method and also to the model method, so i'm thinking of moving the caching logic away from my controller class and into model class packaged in './model/DbTable', but this seems incorrect since the DB model should only handle SQL operations. Any suggestions on how i can implement a clean patterned solution?

    Read the article

  • Factorizing the "rendered" attribute over several JSF elements

    - by Nicolas Raoul
    Given the following JSF fragment: <h:outputText ... rendered="#{bean.r} /> <h:outputText ... rendered="#{bean.r} /> <h:outputText ... rendered="#{bean.r} /> How can I factorize to something that would look like: <h:someKindOfGroupOrSomething rendered="#{bean.r}> <h:outputText ... /> <h:outputText ... /> <h:outputText ... /> </h:someKindOfGroupOrSomething>

    Read the article

  • Sort array with multiple keys

    - by Vincent
    All, I have the following array in array format. The JSON format is shown just for user-friendliness. How can I sort the array ascending with the key "name" in php? "food": [ { "id": 1, "name": "dessert" }, { "id": 2, "name": "maincourse" }, { "id": 3, "name": "entrees" }, { "id": 4, "name": "appetizers" } ]

    Read the article

  • Need sorted dictionary designed to find values with keys less or greater than search value

    - by Captain Comic
    Hi I need to have objects sorted by price (decimal) value for fast access. I need to be able to find all objects with price more then A or less than B. I was thinkg about SortedList, but it does not provide a way to find ascending or descending enumerator starting from given key value (say give me all objects with price less than $120). Think of a system that accepts items for sell from users and stores them into that collection. Another users want to find items cheaper than $120. Basically what i need is tree-based collection and functionality to find node that is smaller\greater\equal to provided key. Please advice.

    Read the article

  • Showing all rows for keys with more than one row

    - by Leif Neland
    Table kal id integer primary key init char 4 indexed job char4 id init job --+----+------ 1 | aa | job1 2 | aa | job2 3 | bb | job1 4 | cc | job3 5 | cc | job5 I want to show all rows where init has more than one row id init job --+----+------ 1 | aa | job1 2 | aa | job2 4 | cc | job3 5 | cc | job5 I tried select * from kal where init in (select init from kal group by init having count(init)2); Actually, the table has 60000 rows, and the query was count(init)<40, but it takes humongus time, phpmyadmin and my patience runs out. Both select init from kal group by init having count(init)2) and select * from kal where init in ('aa','bb','cc') runs in "no time", less than 0.02 seconds. I've tried different subqueries, but all takes "infinite" time, more than a few minutes; I've actually never let them finish. Leif

    Read the article

  • reversing keys/values - create new instance of HashMap

    - by stck777
    I’ve got an existing instance of HashMap simply called sale (it is Map) I use it to log customers and items history. Is there a way to create a new instance of HashMap, that effectively reverses this usage? i.e will show each item purchased as a unique key and the corresponding value as a String set of the customers that have purchased that product. I suspect there is a simple process using keySet() in some way to iterate over the sales map but I just can’t see how to do this. Any help would be much appreciated.

    Read the article

  • NSSortDescriptor for NSFetchRequestController causes crash when value of sorted attribute is changed

    - by AJ
    I have an Core Data Entity with a number of attributes, which include amount(float), categoryTotal(float) and category(string) The initial ViewController uses a FethchedResultsController to retrieve the entities, and sorts them based on the category and then the categoryTotal. No problems so far. NSManagedObjectContext *moc = [self managedObjectContext]; NSEntityDescription *entityDescription = [NSEntityDescription entityForName:@"Transaction" inManagedObjectContext:moc]; NSFetchRequest *request = [[[NSFetchRequest alloc] init] autorelease]; [request setEntity:entityDescription]; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(dateStamp >= %@) AND (dateStamp =< %@)", startDate, endDate]; [request setPredicate:predicate]; NSSortDescriptor *sortByCategory = [[NSSortDescriptor alloc] initWithKey:@"category" ascending:sortOrder]; NSSortDescriptor *sortByTotals = [[NSSortDescriptor alloc] initWithKey:@"categoryTotal" ascending:sortOrder]; NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortByTotals, sortByCategory, nil]; [request setSortDescriptors:sortDescriptors]; NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:request managedObjectContext:managedObjectContext sectionNameKeyPath:@"category" cacheName:nil]; aFetchedResultsController.delegate = self; self.fetchedResultsController = aFetchedResultsController; On selecting a row (tableView:didSelectRowAtIndexPath), another view controller is loaded that allows editing of the amount field for the selected entity. Before returning to the first view, categoryTotal is updated by the new ‘amount’. The problem comes when returning to the first view controller, the app bombs with *Serious application error. Exception was caught during Core Data change processing: Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (1) must be equal to the number of rows contained in that section before the update (1), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted). with userInfo (null) Program received signal: “EXC_BAD_ACCESS”.* This seems to be courtesy of NSSortDescriptor *sortByTotals = [[NSSortDescriptor alloc] initWithKey:@"categoryTotal" ascending:sortOrder]; If I remove this everything works as expected, but obviously without the sorting I want. I'm guessing this is to do with the sorting order changing due to categoryTotal changing (deletion / insertion) but can't find away fix this. I've verified that values are being modified correctly in the second view, so it appears down to the fetchedResultsController being confused. If the categoryAmount is changed to one that does not change the sort order, then no error is generated I'm not physically changing (ie deleting) the number of items the fetchedResultsController is returning ... the only other issue I can find that seem to generate this error Any ideas would be most welcome Thanks, AJ

    Read the article

  • using jquery selector to change attribute in variable returned from ajax request

    - by Blake
    I'm trying to pull in a filename.txt (contains html) using ajax and change the src path in the data variable before I load it into the target div. If I first load it into the div the browser first requests the broken image and I don't want this so I would like to do my processing before I load anything onto the page. I can pull the src values fine but I can't change them. In this example the src values aren't changed. Is there a way to do this with selectors or can they only modify DOM elements? Otherwise I may have to do some regex replace but using a selector will be more convenient if possible. $.ajax( { url: getDate+'/'+name+'.txt', success: function(data) { $('img', data).attr('src', 'new_test_src'); $('#'+target).fadeOut('slow', function(){ $('#'+target).html(data); $('#'+target).fadeIn('slow'); }); } }); My reason is I'm building a fully standalone javascript template system for a newsletter and since images and other things are upload via a drupal web file manager I want the content creators to keep their paths very short and simple and I can then modify them before I load in the content. This will also be distributed on a CD so I can need to change the paths for that so they still work.

    Read the article

  • NHibernate - get List<long> representing primary keys?

    - by Nathan
    I have a situation where I definitely don't want to get the whole domain object. Basically, the entity has a primary key of long (.NET)/bigint(sql server 2005). I simply need to pass the primary key to an external system which will access the database directly - and since the list of ids could be large, I don't want to rehydrate the entire domain object just to get the Id. In linq2sql, I could accomplish this with a projection, but I am restricted to NHibernate 1.2.1.4000, which doesn't support Linq. Is there a way to accomplish this using NHibernate 1.2.1.4000? (I am open to using a named-query if that will work)

    Read the article

  • Calling jQuery method from onClick attribute in HTML

    - by Russell
    I am relatively new to implementing JQuery throughout an entire system, and I am enjoying the opportunity. I have come across one issue I would love to find the correct resolve for. Here is a simple case example of what I want to do: I have a button on a page, and on the click event I want to call a jquery function I have defined. Here is the code I have used to define my method (Page.js): (function($) { $.fn.MessageBox = function(msg) { alert(msg); }; }); And here is my HTML page: <HTML> <head> <script type="text/javascript" src="C:\Sandpit\jQueryTest\jquery-1.3.2.js"></script> <script language="javascript" src="Page.js"></script> </head> <body> <div class="Title">Welcome!</div> <input type="button" value="ahaha" onclick="$().MessageBox('msg');" /> </body> </HTML> (The above code displays the button, but clicking does nothing.) I am aware I could add the click event in the document ready event, however it seems more maintainable to put events in the HTML element instead. However I have not found a way to do this. Is there a way to call a jquery function on a button element (or any input element)? Or is there a better way to do this? Thanks

    Read the article

  • avoid extra xmlns:xsi while adding a attribute to xml root element in C#.net

    - by Rakesh kumar
    Please help me. First pls forgive me if i am wrong. i am createing a xmlfile using c#.net . my Code is like XmlDocument d = new XmlDocument(); XmlDeclaration xmlDeclaration = d.CreateXmlDeclaration("1.0", "utf-8", null); d.InsertBefore(xmlDeclaration,d.DocumentElement); XmlElement root = d.CreateElement("ITRETURN","ITR","http://incometaxindiaefiling.gov.in/ITR1"); XmlAttribute xsiNs = d.CreateAttribute("xsi:schemaLocation", "http://www.w3.org/2001/XMLSchema-instance"); xsiNs.Value = "http://incometaxindiaefiling.gov.in/main ITRMain10.xsd"; root.SetAttributeNode(xsiNs); //root.SetAttribute("xsi:schemaLocation", "http://www.w3.org/2001/XMLSchema-instance"); root.SetAttribute("xmlns:ITR1FORM", "http://incometaxindiaefiling.gov.in/ITR1"); root.SetAttribute("xmlns:ITR2FORM", "http://incometaxindiaefiling.gov.in/ITR2"); root.SetAttribute("xmlns:ITR3FORM", "http://incometaxindiaefiling.gov.in/ITR3"); root.SetAttribute("xmlns:ITR4FORM", "http://incometaxindiaefiling.gov.in/ITR4"); d.AppendChild(root); d.Save("c://myxml.xml"); and i am getting output like this - - root node But My requirement is like + any value please help

    Read the article

  • Why doesn't Javascript recognize the HTML class attribute?

    - by Cornflake
    Can anyone help me with a Javascript question, please? Why does the following code display only message boxes with the word "null" in them? And I think there are not enough of them either. <html> <head> <script type="text/javascript"> function showElementClasses(node) { var els = node.getElementsByTagName("*"); for(var i=0,j=els.length; i<j; i++) alert(els[i].getAttribute("class")); alert("Class: " + els[i].className); } showElementClasses(document); </script> </head> <body class="bla"> <div class="myclass" style="width: 500; height: 400" id="map"></div> </body> </html>

    Read the article

  • How to save to Django Model that Have Mulitple Foreign Keys Fields

    - by Spikie
    I have Models for business Apps class staff_name(models.Model): TITLE_CHOICES = ( ('Mr', 'Mr'), ('Miss', 'Miss'), ( 'Mrs', 'Mrs'), ( 'chief', 'chief'), ) titlename = models.CharField(max_length=10,choices=TITLE_CHOICES) firstname = models.CharField(max_length=150) surname = models.CharField(max_length=150) date = models.DateTimeField(auto_now=True) class meta: ordering = ["date"] get_latest_by = "date" class inventory_transaction(models.Model): stock_in = models.DecimalField(blank=True, null=True,max_digits=8, decimal_places=2) stock_out = models.DecimalField(blank=True,null=True,max_digits=8, decimal_places=2) Number_container = models.ForeignKey(container_identity) staffs = models.ForeignKey(staff_name) goods_details = models.ForeignKey(departments) balance = models.DecimalField(max_digits=8, decimal_places=2) date = models.DateTimeField(auto_now=True) What i want to accomplish is check if the staff have made entry to the table before if yes add the value for the stock in plus (last) balance field and assign to balance if no just assign stock in value to balance field and save these are my codes These are my codes: try: s = staffname.staffs_set.all().order_by("-date").latest() # staffname is the instant of the class model staff_name e = s.staffs_set.create(stockin=vdataz,balance=s.balance + vdataz ) # e is the instant of the class model inventory_transaction e.save e.staffs.add(s) e.from_container.add(containersno) e.goods_details.add(department) except ObjectDoesNotExist: e = staff_name.objects.create(stockin=vdataz,balance=vdataz ) e.save e.staffs.add(staffname) e.from_container.add(containersno) e.goods_details.add(department) I will really appreciate a solution Thanks I hope it make more sense now. iam on online if you need more explanation just ask in the comment.Thank you for your help

    Read the article

  • Updating a session variable on a page that uses enablesessionstate=readonly attribute doesn't fail f

    - by chandmk
    Asp.Net allows you you set the session state to readonly at individual page level or in the web.config for all pages. But it doesn't prevent you from creating a brand new session variable on that page or modify an existing session variable. But when you try to use that session variable it is either not available or its value is not modified. Why wouldn't the asp.net framework throw a run time error, if not compile time error, when a write attempt is made to a session on the pages where that is not allowed?

    Read the article

  • refreshing javascript by renaming src attribute

    - by Eric Fortis
    I want to refresh the output of the script below. Is this json? Do I need to add a crossdomain policy in my site? <div id="nowplaying"> <script src="http://s4.total-streaming.com/xml.php?station=1269&get=js"></script> </div> Edit: This is what I'm trying based on @alexn advise, but still doesn't refresh. <div id="nowplaying"> <script id="nowplaying-script" src="http://s4.total-streaming.com/xml.php?station=1269&get=js"></script> <script> setInterval(function () { $('#nowplaying-script').attr('src', 'http://s4.total-streaming.com/xml.php?station=1269&get=js'); }, 1000); </script> </div> Note Firebug: Resource interpreted as script but transferred with MIME type text/html. xml.php:-1

    Read the article

  • FieldError when annotating over foreign keys

    - by X_9
    I have a models file that looks similar to the following: class WithDate(models.Model): adddedDate = models.DateTimeField(auto_now_add=True) modifiedDate = models.DateTimeField(auto_now=True) class Meta: abstract = True class Match(WithDate): ... class Notify(WithDate): matchId = models.ForeignKey(Match) headline = models.CharField(null=True, blank=True, max_length=10) For each Match I'm trying to get a count of notify records that have a headline. So my call looks like matchObjs = Match.objects.annotate(notifies_made=Count('notify__headline__isnull')) This keeps throwing a FieldError. I've simplified the query down to matchObjs = Match.objects.annotate(notifies_made=Count('notify')) And I still get the same FieldError... I've seen this work in other cases (other documentation, other SO questions like this one) but I can't figure out why I'm getting an error. The specific error that is returned is as follows: Cannot resolve keyword 'notify' into field. Choices are: (all fields from Match model) Does anyone have a clue as to why I can't get this annotation to work across tables? I'm baffled after looking at the other SO question and various Django docs where I've seen this done. Edit: I am using Django 1.1.1

    Read the article

< Previous Page | 59 60 61 62 63 64 65 66 67 68 69 70  | Next Page >