Search Results

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

Page 4/433 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • PostgreSQL, Foreign Keys, Insert speed & Django

    - by Miles
    A few days ago, I ran into an unexpected performance problem with a pretty standard Django setup. For an upcoming feature, we have to regenerate a table hourly, containing about 100k rows of data, 9M on the disk, 10M indexes according to pgAdmin. The problem is that inserting them by whatever method literally takes ages, up to 3 minutes of 100% disk busy time. That's not something you want on a production site. It doesn't matter if the inserts were in a transaction, issued via plain insert, multi-row insert, COPY FROM or even INSERT INTO t1 SELECT * FROM t2. After noticing this isn't Django's fault, I followed a trial and error route, and hey, the problem disappeared after dropping all foreign keys! Instead of 3 minutes, the INSERT INTO SELECT FROM took less than a second to execute, which isn't too surprising for a table <= 20M on the disk. What is weird is that PostgreSQL manages to slow down inserts by 180x just by using 3 foreign keys. Oh, disk activity was pure writing, as everything is cached in RAM; only writes go to the disks. It looks like PostgreSQL is working very hard to touch every row in the referred tables, as 3MB/sec * 180s is way more data than the 20MB this new table takes on disk. No WAL for the 180s case, I was testing in psql directly, in Django, add ~50% overhead for WAL logging. Tried @commit_on_success, same slowness, I had even implemented multi row insert and COPY FROM with psycopg2. That's another weird thing, how can 10M worth of inserts generate 10x 16M log segments? Table layout: id serial primary, a bunch of int32, 3 foreign keys to small table, 198 rows, 16k on disk large table, 1.2M rows, 59 data + 89 index MB on disk large table, 2.2M rows, 198 + 210MB So, am I doomed to either drop the foreign keys manually or use the table in a very un-Django way by defining saving bla_id x3 and skip using models.ForeignKey? I'd love to hear about some magical antidote / pg setting to fix this.

    Read the article

  • Joining Tables Based on Foreign Keys

    - by maestrojed
    I have a table that has a lot of fields that are foreign keys referencing a related table. I am writing a script in PHP that will do the db queries. When I query this table for its data I need to know the values associated with these keys not the key. How do most people go about this? A 101 way to do this would be to query this table for its data including the foreign keys and then query the related tables to get each key's value. This could be a lot of queries (~10). Question 1: I think I could write 1 query with a bunch of joins. Would that be better? This approach also requires the querying script to know which table fields are foreign keys. Since I have many tables like this but all with different fields, this means writing nice generic functions is hard. MySQL InnoDB tables allow for foreign constraints. I know the database has these set up correctly. Question 2: What about the idea of querying the table and identifying what the constraints are and then matching them up using whatever process I decide on from Question 1. I like this idea but never see it being used in code. Makes me think its not a good idea for some reason. I would use something like SHOW CREATE TABLE tbl_name; to find what constraints/relationships exist for that table. Thank you for any suggestions or advice.

    Read the article

  • XPath ordered priority attribute search

    - by user94000
    I want to write an XPath that can return some link elements on an HTML DOM. The syntax is wrong, but here is the gist of what I want: //web:link[@text='Login' THEN_TRY @href='login.php' THEN_TRY @index=0] THEN_TRY is a made-up operator, because I can't find what operator(s) to use. If many links exist on the page for the given set of [attribute=name] pairs, the link which matches the most left-most attribute(s) should be returned instead of any others. For example, consider a case where the above example XPath finds 3 links that match any of the given attributes: link A: text='Sign In', href='Login.php', index=0 link B: text='Login', href='Signin.php', index=15 link C: text='Login', href='Login.php', index=22 Link C ranks as the best match because it matches the First and Second attributes. Link B ranks second because it only matches the First attribute. Link A ranks last because it does not match the First attribute; it only matches the Second and Third attributes. The XPath should return the best match, Link C. If more than one link were tied for "best match", the XPath should return the first best link that it found on the page.

    Read the article

  • How to change the attribute value of svg file

    - by rafiq7s
    Hello, In samplexml.svg there is a node <image width="744" height="1052" xlink:href="image1.png"/> I need to replace "image1.png" with another value like "image2.png". Please guide me with sample code how to to that. I could get the attribute value "image1.png". Here is the code: > <?php $xdoc = new DomDocument; > $xdoc->Load('samplexml.svg'); $tagName > = $xdoc->getElementsByTagName('image')->item(0); > $attribNode = > $tagName->getAttributeNode('xlink:href'); > > echo "Attribute Name : > ".$attribNode->name; echo "<br > />Attribute Value : > ".$attribNode->value; ?> Here is samplexml.svg: > <svg> <g> <title>Test title</title> > <image x="0" y="0" width="744" > height="1052" > xlink:href="image1.png"/> </g> </svg> Please help me, how to change this attribute value. Regards, rafiq7s

    Read the article

  • Customer Attribute, not sorting select options

    - by Bosworth99
    Made a module that creates some customer EAV attributes. One of these attributes is a Select, and I'm dropping a bunch of options into their respective tables. Everything lines up and is accessible on both the front end and the back. Last thing before calling this part of things finished is the sort order of the options. They come out all scrambled, instead of the obvious default or alphabetical (seemingly at random... very wierd). I'm on Mage v1.11 (Pro/Enterprise). config.xml <config> <modules> <WACI_CustomerAttr> <version>0.1.0</version> </WACI_CustomerAttr> </modules> <global> <resources> <customerattr_setup> <setup> <module>WACI_CustomerAttr</module> <class>Mage_Customer_Model_Entity_Setup</class> </setup> <connection> <use>core_setup</use> </connection> </customerattr_setup> </resources> <models> <WACI_CustomerAttr> <class>WACI_CustomerAttr_Model</class> </WACI_CustomerAttr> </models> <fieldsets> <customer_account> <agency><create>1</create><update>1</update></agency> <title><create>1</create><update>1</update></title> <phone><create>1</create><update>1</update></phone> <mailing_address><create>1</create><update>1</update></mailing_address> <city><create>1</create><update>1</update></city> <state><create>1</create><update>1</update></state> <zip><create>1</create><update>1</update></zip> <fed_id><create>1</create><update>1</update></fed_id> <ubi><create>1</create><update>1</update></ubi> </customer_account> </fieldsets> </global> </config> mysql4-install-0.1.0.php <?php Mage::log('Installing WACI_CustomerAttr'); echo 'Running Upgrade: '.get_class($this)."\n <br /> \n"; //die ( 'its running' ); $installer = $this; /* @var $installer Mage_Customer_Model_Entity_Setup */ $installer->startSetup(); // bunch of attributes // State $installer->addAttribute('customer','state', array( 'type' => 'varchar', 'group' => 'Default', 'label' => 'State', 'input' => 'select', 'default' => 'Washington', 'source' => 'WACI_CustomerAttr/customer_attribute_data_select', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'required' => true, 'visible' => true, 'user_defined' => 1, 'position' => 67 ) ); $attrS = Mage::getSingleton('eav/config')->getAttribute('customer', 'state'); $attrS->addData(array('sort_order'=>67)); $attrS->setData('used_in_forms', array('adminhtml_customer','customer_account_edit','customer_account_create'))->save(); $state_list = array('Alabama','Alaska','Arizona','Arkansas','California','Colorado','Connecticut','Delaware','Florida','Georgia', 'Hawaii','Idaho','Illinois','Indiana','Iowa','Kansas','Kentucky','Louisiana','Maine','Maryland','Massachusetts','Michigan', 'Minnesota','Mississippi','Missouri','Montana','Nebraska','Nevada','New Hampshire','New Jersey','New Mexico','New York', 'North Carolina','North Dakota','Ohio','Oklahoma','Oregon','Pennsylvania','Rhode Island','South Carolina','South Dakota', 'Tennessee','Texas','Utah','Vermont','Virginia','Washington','West Virginia','Wisconsin','Wyoming'); $aOption = array(); $aOption['attribute_id'] = $installer->getAttributeId('customer', 'state'); for($iCount=0;$iCount<sizeof($state_list);$iCount++){ $aOption['value']['option'.$iCount][0] = $state_list[$iCount]; } $installer->addAttributeOption($aOption); // a few more $installer->endSetup(); app/code/local/WACI/CustomerAttr/Model/Customer/Attribute/Data/Select.php <?php class WACI_CustomerAttr_Model_Customer_Attribute_Data_Select extends Mage_Eav_Model_Entity_Attribute_Source_Abstract{ function getAllOptions(){ if (is_null($this->_options)) { $this->_options = Mage::getResourceModel('eav/entity_attribute_option_collection') ->setAttributeFilter($this->getAttribute()->getId()) ->setStoreFilter($this->getAttribute()->getStoreId()) ->setPositionOrder('asc') ->load() ->toOptionArray(); } $options = $this->_options; return $options; } } theme/variation/template/persistent/customer/form/register.phtml <li> <?php $attribute = Mage::getModel('eav/config')->getAttribute('customer','state'); ?> <label for="state" class="<?php if($attribute->getIsRequired() == true){?>required<?php } ?>"><?php if($attribute->getIsRequired() == true){?><em>*</em><?php } ?><?php echo $this->__('State') ?></label> <div class="input-box"> <select name="state" id="state" class="<?php if($attribute->getIsRequired() == true){?>required-entry<?php } ?>"> <?php $options = $attribute->getSource()->getAllOptions(); foreach($options as $option){ ?> <option value='<?php echo $option['value']?>' <?php if($this->getFormData()->getState() == $option['value']){ echo 'selected="selected"';}?>><?php echo $this->__($option['label'])?></option> <?php } ?> </select> </div> </li> All options are getting loaded into table eav_attribute_option just fine (albeit without a sort_order defined), as well as table eav_attribute_option_value. In the adminhtml / customer-manage customers-account information this select is showing up fine (but its delivered automatically by the system). Seems I should be able to set the sort-order on creation of the attributeOptions, or, certainly, define the sort order in the data/select class. But nothing I've tried works. I'd rather not do a front-end hack either... Oh, and how do I set the default value of this select? (Different question, I know, but related). Setting the attributes 'default' = 'washington' seems to do nothing. There seem to be a lot of ways to set up attribute select options like this. Is there a better way that the one I've outlined here? Perhaps I'm messing something up. Cheers

    Read the article

  • Is the location of SSH keys on Windows fixed?

    - by user16654
    I read an article: Determine whether you've already generated SSH keys which says that ssh in Windows, keys are in C:\Documents and Settings\userName\Application Data\SSH\UserKeys\ but I have found the keys to be in C:\Documents and Settings\userName\Application Data.SSH . Is there a setting to determine where to put these keys or am I reading the wrong documentation or what?

    Read the article

  • Display action-specific authorisation message for [Authorize] attribute

    - by FreshCode
    Is there a way to display an action-specific authorisation message for when an [Authorize] or [Authorize(Roles="Administrator")] attribute redirects the user to the sign-in page? Ideally, [Authorize(Roles="Administrator", Message="I'm sorry Dave. I'm afraid I can't let you do that.")] public ActionResult SomeAdminFunction() { // do admin stuff return View(); } As I understand it, attributes are not meant to add functionality, but this seems purely informational. One could do this inside the action, but it seems inelegant compared to the use of an attribute. Alternatively, if (!Request.IsAuthenticated) { if (!User.IsInRole("Administrator")) SetMessage("You need to be an administrator to destroy worlds."); // write message to session stack return RedirectToAction("SignIn", "Account"); } Is there an existing way to do this or do I need to override the [Authorize] attribute?

    Read the article

  • Create automatically table that is composed by its primery key and 2 other foreign keys

    - by user210481
    I have table A with a primary id, a table B with a primary key id also and another table C with a primary key id and rows Aid and Bid where Aid and Bid are foreign keys of C and the primary keys of A and B respectively. One way of populating these DB would be populating table A, table B and table C separately. I would like to know if there is a more clever way of doing it, where I could populate A first and at the same time I populate B, I can indicate that an entry in C should be also created. Any idea and suggestion on how to populate them is welcome. I'm trying to take advantage of the foreign keys structure Thanks

    Read the article

  • C#: Making sure parameter has attribute

    - by slayerIQ
    I have an attribute lets call it SomeAttribute and a class i need to make sure the class is passed a type which has SomeAttribute. So this is how i do it now: public class Test() { public Test(SomeType obj) { if(!obj.GetType().IsDefined(typeof(SomeAttribute), false)) { throw new ArgumentException("Errormessage"); } } } But this means that i don't get any errors at compile time but somewhere at runtime, if obj does not have the attribute. Is there a way to specify in the method declaration that the parameter must have some attribute ? So i get errors i compile time when using the wrong parameters.

    Read the article

  • python class attribute

    - by chnet
    Hi, i have a question about class attribute in python. class base : def __init__ (self): pass derived_val = 1 t1 = base() t2 = base () t2.derived_val +=1 t2.__class__.derived_val +=2 print t2.derived_val # its value is 2 print t2.__class__.derived_val # its value is 3 The results are different. I also use id() function to find t2.derived_val and t2.class.derived_val have different memory address. My problem is derived_val is class attribute. Why it is different in above example? Is it because the instance of class copy its own derived_val beside the class attribute?

    Read the article

  • Working with foreign keys - cannot insert

    - by Industrial
    Hi everyone! Doing my first tryouts with foreign keys in a mySQL database and are trying to do a insert, that fails for this reason: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails Does this mean that foreign keys restrict INSERTS as well as DELETES and/or UPDATES on each table that is enforced with foreign keys relations? Thanks! Updated description: Products ---------------------------- id | type ---------------------------- 0 | 0 1 | 3 ProductsToCategories ---------------------------- productid | categoryid ---------------------------- 0 | 0 1 | 1 Product table has following structure CREATE TABLE IF NOT EXISTS `alpha`.`products` ( `id` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT , `type` TINYINT(2) UNSIGNED NOT NULL DEFAULT 0 , PRIMARY KEY (`id`) , CONSTRAINT `prodsku` FOREIGN KEY (`id` ) REFERENCES `alpha`.`productsToSku` (`product` ) ON DELETE CASCADE, ON UPDATE CASCADE) ENGINE = InnoDB;

    Read the article

  • Backup those keys, citizen

    - by BuckWoody
    Periodically I back up the keys within my servers and databases, and when I do, I blog a reminder here. This should be part of your standard backup rotation – the keys should be backed up often enough to have at hand and again when they change. The first key you need to back up is the Service Master Key, which each Instance already has built-in. You do that with the BACKUP SERVICE MASTER KEY command, which you can read more about here. The second set of keys are the Database Master Keys, stored per database, if you’ve created one. You can back those up with the BACKUP MASTER KEY command, which you can read more about here. Finally, you can use the keys to create certificates and other keys – those should also be backed up. Read more about those here. Anyway, the important part here is the backup. Make sure you keep those keys safe! Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!

    Read the article

  • Is there a canonical source supporting "all-surrogates"?

    - by user61852
    Background The "all-PK-must-be-surrogates" approach is not present in Codd's Relational Model or any SQL Standard (ANSI, ISO or other). Canonical books seems to elude this restrictions too. Oracle's own data dictionary scheme uses natural keys in some tables and surrogate keys in other tables. I mention this because these people must know a thing or two about RDBMS design. PPDM (Professional Petroleum Data Management Association) recommend the same canonical books do: Use surrogate keys as primary keys when: There are no natural or business keys Natural or business keys are bad ( change often ) The value of natural or business key is not known at the time of inserting record Multicolumn natural keys ( usually several FK ) exceed three columns, which makes joins too verbose. Also I have not found canonical source that says natural keys need to be immutable. All I find is that they need to be very estable, i.e need to be changed only in very rare ocassions, if ever. I mention PPDM because these people must know a thing or two about RDBMS design too. The origins of the "all-surrogates" approach seems to come from recommendations from some ORM frameworks. It's true that the approach allows for rapid database modeling by not having to do much business analysis, but at the expense of maintainability and readability of the SQL code. Much prevision is made for something that may or may not happen in the future ( the natural PK changed so we will have to use the RDBMS cascade update funtionality ) at the expense of day-to-day task like having to join more tables in every query and having to write code for importing data between databases, an otherwise very strightfoward procedure (due to the need to avoid PK colisions and having to create stage/equivalence tables beforehand ). Other argument is that indexes based on integers are faster, but that has to be supported with benchmarks. Obviously, long, varying varchars are not good for PK. But indexes based on short, fix-length varchar are almost as fast as integers. The questions - Is there any canonical source that supports the "all-PK-must-be-surrogates" approach ? - Has Codd's relational model been superceded by a newer relational model ?

    Read the article

  • how to COPY Attribute value in a new attribute

    - by Mukesh
    How to copy data of attribute to new attribute in the same column in sql original data <root> <child attr='hello'></child> </root> Result 1 <root> <child attr='hello' attr2='hello'></child> </root> Result 2(with a modification) <root> <child attr='hello' attr2='**H**ello **W**orld'></child> </root>

    Read the article

  • XML databinding to TreeView (or Tab control), bind attribute based on different attribute

    - by Number8
    Hello, I have some xml: <Test> <thing location="home" status="good"/> <thing location=work" status="bad"/> <thing location="mountains" status="good"/> </Test> The leaves on the TreeView are the values of the status attribute; the nodes will be the value of the location attribute. +--bad ¦.....+--work +--good .......+--home .......+--mountains Currently, I populate the TreeView (or Tab control) manually, iterating through the xml, adding the nodes to the appropriate leaf. Can this be done via databinding? I'm guessing a Converter will be involved... Thanks for any advice.

    Read the article

  • RSA keys - virtual hosts

    - by Bosworth99
    Pardon my noobness, but I just got started with VPS (linux) hosting; setting up passwordless ssh for multiple users has proved to be kind of a pain. Currently I'm the single user of this ubuntu 10.04 LTS VPS (linode.com). I was able to establish a single rsa passkey under my home/user/.ssh/authorized_keys location. Fine. PuTTy works as expected, and Filezilla (sftp) links up as required. I've been working on a single site that this user owns, and thats not been a problem. Now, I want to set up some other sites, and I've chosen Webmin with the VirtualMin plugin to make this work. I made another user (or, rather, virtualmin did), but I've been unable to get FileZilla to link up to this new user. Could anyone with experience here explain what the setup is supposed to look like? IE - can I use a single rsa key pair for all accounts (if, for example, I give ownership of files to the original user?). Or is it standard practice to create a separate key pair for each user, and establish a separate putty/filezilla login for each? I've spent enough time dinking around with this to be frustrated. "Sever rejected the provided key" error sucks after the fifth hour. I'm about to set up an ftp server and call it a day. Any thoughts would be most welcome -

    Read the article

  • How do you hit modifier keys when touch typing?

    - by Bob Ueland
    I am a programmer and I want to learn to touch type. As all programmers know, using modifier keys like Control, Command and Alt are essential. When programming I think that every second or third word I use involves a modifier key. But most touch typing learning software do not address these keys, it is as if they do not exist. Not only do they not let you practice them, they do not even tell you which fingers to use to hit them. Actually there is a touch typing game that I use called StarTyper (http://lidenanna.com) that lets you practice modifier keys and even make up your own custom words containing modifier keys. But not even this game tells you which fingers to use when hitting the modifier keys. Has anybody addressed this problem. Or are there just homespun methods that work for one person but not for the other?

    Read the article

  • Foreign keys vs partitioning

    - by Industrial
    Hi! Since foreign keys are not supported by partitioned mySQL databases for the moment, I would like to hear some pro's and con's for a read-heavy application that will handle around 1-400 000 rows per table. Unfortunately, I dont have enough experience yet in this area to make the conclusion by myself... Thanks a lot! References: http://stackoverflow.com/questions/1537219/how-to-handle-foreign-key-while-partitioning http://stackoverflow.com/questions/2496140/mysql-partitioning-with-foreign-keys

    Read the article

  • Selecting element by data attribute

    - by zizo
    Is there an easy and straight-forward method to select elements based on their data attribute? For example, select all anchors that has data attribute named customerID which has value of 22. I am kind of hesitant to use rel or other attributes to store such information, but I find it much harder to select an element based on what data is stored in it. Thanks!

    Read the article

  • Add attribute to embed tag using jquery

    - by Rob
    I have the following embed tag: <embed type="application/x-shockwave-flash" width="640" height="505" src="url_to_video" allowscriptaccess="always" allowfullscreen="true"></embed> I have about five of theses on a page, and I'd like to add the attribute wmode="opaque" to all of them. However, I tried to do it like this and it didnt' work: $j("embed").attr('wmode','opaque'); Is there another way I can dynamically set the attribute wmode="opaque" ? Thanks!

    Read the article

  • Sort array by keys of another array.

    - by marbrun
    Hello There are 2 arrays, both with the same length and with the same keys: $a1 = [1=>2000,65=>1354,103=>1787]; $a2 = [1=>'hello',65=>'hi',103=>'goodevening']; asort($a1); The keys of a1 and a2 are id's from a database. a1 gets sorted by value. Once sorted, how can we use the same sorting order in a2? Thanks!

    Read the article

  • change a frame's attribute by pressing a button

    - by asavu
    Hi. Suppose we have a JFrame named frame1 with a String attribute named credentials set inittially to null. I have a jButton named button1 attached to the frame and I want to change the frame1 String credentials attribute by pressing button1. I need some piece of advice regarding the ActionListener code especially. Could you guys pls help me? Thank you.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >