Search Results

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

Page 126/433 | < Previous Page | 122 123 124 125 126 127 128 129 130 131 132 133  | Next Page >

  • Regular expression works normally, but fails when placed in an XML schema

    - by Eli Courtwright
    I have a simple doc.xml file which contains a single root element with a Timestamp attribute: <?xml version="1.0" encoding="utf-8"?> <root Timestamp="04-21-2010 16:00:19.000" /> I'd like to validate this document against a my simple schema.xsd to make sure that the Timestamp is in the correct format: <?xml version="1.0" encoding="utf-8"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="root"> <xs:complexType> <xs:attribute name="Timestamp" use="required" type="timeStampType"/> </xs:complexType> </xs:element> <xs:simpleType name="timeStampType"> <xs:restriction base="xs:string"> <xs:pattern value="(0[0-9]{1})|(1[0-2]{1})-(3[0-1]{1}|[0-2]{1}[0-9]{1})-[2-9]{1}[0-9]{3} ([0-1]{1}[0-9]{1}|2[0-3]{1}):[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}.[0-9]{3}" /> </xs:restriction> </xs:simpleType> </xs:schema> So I use the lxml Python module and try to perform a simple schema validation and report any errors: from lxml import etree schema = etree.XMLSchema( etree.parse("schema.xsd") ) doc = etree.parse("doc.xml") if not schema.validate(doc): for e in schema.error_log: print e.message My XML document fails validation with the following error messages: Element 'root', attribute 'Timestamp': [facet 'pattern'] The value '04-21-2010 16:00:19.000' is not accepted by the pattern '(0[0-9]{1})|(1[0-2]{1})-(3[0-1]{1}|[0-2]{1}[0-9]{1})-[2-9]{1}[0-9]{3} ([0-1]{1}[0-9]{1}|2[0-3]{1}):[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}.[0-9]{3}'. Element 'root', attribute 'Timestamp': '04-21-2010 16:00:19.000' is not a valid value of the atomic type 'timeStampType'. So it looks like my regular expression must be faulty. But when I try to validate the regular expression at the command line, it passes: >>> import re >>> pat = '(0[0-9]{1})|(1[0-2]{1})-(3[0-1]{1}|[0-2]{1}[0-9]{1})-[2-9]{1}[0-9]{3} ([0-1]{1}[0-9]{1}|2[0-3]{1}):[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}.[0-9]{3}' >>> assert re.match(pat, '04-21-2010 16:00:19.000') >>> I'm aware that XSD regular expressions don't have every feature, but the documentation I've found indicates that every feature that I'm using should work. So what am I mis-understanding, and why does my document fail?

    Read the article

  • Unable to add SSH pub key for GitHub

    - by Kaushik
    I am trying to set up a new GitHub account as part of learning ruby on rails. My OS is windows. I am having the following problem while trying to add my public key to the GitHub SSH public keys. When I put the key in the text area, supply a name, and click 'Add Key', I am taken to the Job profile page without any confirmation that the key has been added.(I am using SSH client GUI to generate RSA keys). When I come back to the SSH public keys page, I see that the key is not there. I tried this multiple times...without any result. Just as a test, I tried to ssh to the GitHub account using 'ssh -v [email protected]' and here is the verbose output: OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007 debug1: Connecting to github.com [207.97.227.239] port 22. debug1: Connection established. debug1: identity file /c/Users/Administrator/.ssh/identity type -1 debug1: identity file /c/Users/Administrator/.ssh/id_rsa type -1 debug1: identity file /c/Users/Administrator/.ssh/id_dsa type -1 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5github2 debug1: match: OpenSSH_5.1p1 Debian-5github2 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_4.6 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-cbc hmac-md5 none debug1: kex: client->server aes128-cbc hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Host 'github.com' is known and matches the RSA host key. debug1: Found key in /c/Users/Administrator/.ssh/known_hosts:1 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Trying private key: /c/Users/Administrator/.ssh/identity debug1: Trying private key: /c/Users/Administrator/.ssh/id_rsa debug1: Trying private key: /c/Users/Administrator/.ssh/id_dsa debug1: No more authentication methods to try. Permission denied (publickey). Also, why is it looking for the keys in c/Users/Administrator/.ssh/ Is there a possibility of changing this default location? EDIT: With Mozila, I get error msg: Oops! The key has already been taken. The key is invalid. It must begin with 'ssh-rsa' or 'ssh-dss'. My key looks like: ---- BEGIN SSH2 PUBLIC KEY ---- Comment: "[2048-bit rsa, Administrator@Kaushik-THINK, Sun Jan 02 2011 \ 02:40:03]" AAAAB3NzaC1yc2EAAAADAQABAAABAQDoA5xqJozKmAHTGh9hgmagsFOl2hdPzS8ZPV9Ta1 xU0JiUnHef38Rvz/5oqL1wW7SjmZbc/+tCPOfU1lg3UisFXajJhek2bjJ2qsKd4Sjax2Nj ZMYD7djPb8rokUYSKW3bdYyJHtJH+murz04UGdCcZ8HqkMTzqlh3zAIK7SIlCy+mtAi5A/ sm0JbqlNGHB6YrL1aWIcOSolIx2HWt8cWhlK77guT9dPgd0HT59Gn0uhO7UWGLrNdJut0x ian3HdvNYMUXoO/SkNlxvWRgZ1UOhaB+qf4hw5RCGcBbqP3fM4LKpurHZx4wEpgmM0e4EM +2PYdf46uxChNdBl7J5sZF ---- END SSH2 PUBLIC KEY ---- I still can't see the key..so not sure how it says it is already taken.

    Read the article

  • c# Xna keydown with a delay of 1 sec

    - by bld
    Hi!. im writing a tetris in xna. i have a class with a method rotateBlocks. When i press the "Up" arrow key. i wanna have that when i hold the button down for 1 sec or more that it executes the arguments in the first else if(rotating the blocks fast) right now nothing is happening. i have declared oldState globally in the class. if i remove the gametime check in first the else if the block will rotate fast imedietley. if i try to step through the code with linebreaks the resolution get f****d up public void RotateBlocks(loadBlock lb, KeyboardState newState, GameTime gameTime) { _elapsedSeconds2 += (float)gameTime.ElapsedGameTime.TotalSeconds; if (lb._name.Equals("block1")) { if (newState.IsKeyDown(Keys.Up) && !oldState.IsKeyDown(Keys.Up)) { // the player just pressed Up if (_rotated) { lb._position[0].X -= 16; lb._position[0].Y -= 16; lb._position[2].X += 16; lb._position[2].Y += 16; lb._position[3].X += 32; lb._position[3].Y += 32; _rotated = false; } else if (!_rotated) { lb._position[0].X += 16; lb._position[0].Y += 16; lb._position[2].X -= 16; lb._position[2].Y -= 16; lb._position[3].X -= 32; lb._position[3].Y -= 32; _rotated = true; } } if (newState.IsKeyDown(Keys.Up) && oldState.IsKeyDown(Keys.Up)) { // the player is holding the key down if (gameTime.ElapsedGameTime.TotalSeconds >=1) { if (_rotated) { lb._position[0].X -= 16; lb._position[0].Y -= 16; lb._position[2].X += 16; lb._position[2].Y += 16; lb._position[3].X += 32; lb._position[3].Y += 32; _rotated = false; } else if (!_rotated) { lb._position[0].X += 16; lb._position[0].Y += 16; lb._position[2].X -= 16; lb._position[2].Y -= 16; lb._position[3].X -= 32; lb._position[3].Y -= 32; _rotated = true; } _elapsedSeconds2 = 0; } }

    Read the article

  • How to create a "facade" table?

    - by tputkonen
    A legacy database contains a join table which links tables table1 and table2, and contains just two foreign keys: TABLE_ORIG: table1_id table2_id In order to utilize this table using JPA I would need to create a surrogate primary key to the link table. However, the existing table must not be modified at all. I would like to create another table which would contain also a primary key in addition to the foreign keys: TABLE_NEW: id table1_id table2_id All changes to TABLE_ORIG should be reflected in TABLE_NEW, and vice versa. Is this doable in mysql?

    Read the article

  • swt: how to handle copy/paste operation?

    - by javapowered
    Hi I'm using SWT Text component. Do someone know how can I handle copy/paste operation and modify data when copying to the buffer and when copying from the buffer? I don't want just handle Ctrl-C Ctrl-V because there are a lot of other keys to do that thing (Shift-Del/Shift-Insert) and even user can override these keys. Thanks

    Read the article

  • WCF : FaultContract(typeof(ExceptionDetail)) issue

    - by jitus
    I have put the attribute [FaultContract(typeof(ExceptionDetail))] for my operation contract. When I am trying to add the service th' a client app, I get this error - "Custom tool error: Failed to generate code for the service reference 'ServiceReference1'. Please check other error and warning messages for details." But when I comment out the FaultContract Attribute, I am able to add the wcf service reference th' my client app. Would appreciate if somebody can help me solve this mystery. Thanks

    Read the article

  • Maintaining content type pk integrity in a Django deployment

    - by hekevintran
    When you run syncdb in Django, the primary keys of the content types will be recomputed. If I create new models, the next time I run syncdb, the primary keys of the content types will be different. If I have an application running in production, how can I update the database with the new models and keep the integrity of content type pks?

    Read the article

  • are deleted entries counted in the load factor of a hash table using open addressing

    - by Dr. Monkey
    When calculating the load factor of a hashtable with an open-addressing array implementation I am using: numberOfKeysInArray/sizeOfArray however it occurred to me that since deleted entries must be marked as such (to distinguish them from empty spaces), it might make sense to include these in the number of keys. My thinking is that as far as estimating the average number of probes to find an entry, deleted entries should count towards the load factor, but as far as inserting a new key they should not. Which is the proper calculation: including deleted keys or not?

    Read the article

  • What Language is This?

    - by bobber205
    Going through some example code sent to me and honestly, I have no idea what language this is def uniqify(arr): b = {} for i in arr: b[i] = 1 return b.keys() Is it Python? I am also curious what keys() does. It's obvious it returns an array but what does it do the array that calls the function? :P

    Read the article

  • Custom RIA Authentication

    - by cmaduro
    Following the steps in this post: http://forums.silverlight.net/forums/t/177042.aspx Where/How do I add the [Key] attribute on the Name property of the IAuthentication where User is one of my ADO.Net Entity objects? My options so far seem to be: In the designer codebehind of me ADO.Net Entity Model. Create a partial User class and add it there In the AuthenticationService.metadata.cs partial User class. It just does not seem to work no matter where I place the [Key] attribute.

    Read the article

  • c# capture Ctrl+PageUp keystroke

    - by Axarydax
    Hello, I am having trouble capturing Ctrl+PageUp keystroke in a ListView control in WinForms application. I am using this code to capture keystrokes - private void ListViewEx_KeyDown(object sender, KeyEventArgs e) { ... if(e.Control){ if((e.KeyCode ^ Keys.Left) == 0) MessageBox.Show("Left"); //shows messagebox else if((e.KeyCode ^ Keys.PageUp) == 0) MessageBox.Show("PageUp"); //does not ... } Do I need to dive into WndProc to process this key? Thanks.

    Read the article

  • StructureMap with my own attributes in C#

    - by ridecar2
    Hi All, I have an attribute that I have written that has a dependency on the Data Access Layer so I made a constructor that took the DAL class as a parameter (marked with [DefaultConstructor] and another, blank, constructor that is parameterless. When I call a method that depends on the attribute how do I make StructureMap inject the correct type? Thanks Gareth

    Read the article

  • How to use java ee 6 @Resource annotation

    - by javamonkey79
    The java ee 6 api has an annotation @Resource with an attribute 'lookup', however, so does the java se 6 api (here). However, since java ee 6 is dependent on java se 6, it seems you can not get at the ee version of the annotation and the 'lookup' attribute. Is this a bug or is there some other way to use this annotation that I am missing. TIA

    Read the article

  • Using two struts2 taglibs in each other

    - by Milad.KH
    Hi I want to use two struts taglib in each other, something like this: < s:properties value="url-< s:properties value="number"/"/ or < s:properties value="url-${number}"/ but I got the following error in the second one: According to TLD or attribute directive in tag file, attribute values does not accept any expressions. Anybody has a solution ? Thanks

    Read the article

  • convert perl map with multiple key to c++

    - by YY
    I want to convert a code from perl to c++, and my problem is multi key map in perl! example: perl: $address{name}{familyName} = $someAddress; and keys are not unique. I want similar data structure in c++ using map or ...!? also I want to search and obtain values with first key for example I want such %keys{name} in c++ .

    Read the article

  • Updating protected using update_all

    - by Jack
    Since you cannot use the normal 'update' and 'update_attribute' methods from ActiveRecord to update a protected attribute, is the following the best way to update an attribute for a single user? User.update_all("admin = true","id = 1") I'm guessing this doesn't lie in the 'best practice' category, so I'm just curious if there is a more appropriate way.

    Read the article

  • When doing a Schema Export with hbm2ddl, is there a way to specify that you DO NOT want Nullable For

    - by Jon Erickson
    The DDL that is being created is putting all of my many to many associations into 1 table, but I actually want each many to many association in its' own table (for other reasons) Right now hbm2ddl is creating this table (only Table1Key OR Table2Key OR Table3Key should be filled out for any given record, causing this table to have nullable foreign keys): +-----------+ | xRef | +-----------+ | Table1Key | | Table2Key | | Table3Key | | RiskKey | +-----------+ I want hbm2ddl to create the following 3 tables so that there are no nullable foreign keys. +-----------+ +-----------+ +-----------+ | xRef1 | | xRef2 | | xRef3 | +-----------+ +-----------+ +-----------+ | Table1Key | | Table2Key | | Table3Key | | RiskKey | | RiskKey | | RiskKey | +-----------+ +-----------+ +-----------+

    Read the article

  • Confusion with MIDlet attributes in a JAD file

    - by Mithun
    "MicroEdition-Profile" can have multiple values separated by space in the JAD file, where as "MicroEdtion-Configuration" can have only one value. According to JTWI specifications, Minimum requirement for MIDP is 2.0, so this gives us only one option (MIDP 2.0) to put in the JAD file Minimum requirement for CLDC is 1.0, so this gives us two options to put in the JAD file ie: CLDC1.0 and CLDC2.0 I can create an application which is compatible with CLDC1.0 and 1.1. Why are multiple values allowed for Profile attribute but only one value is allowed for Configuration attribute?

    Read the article

  • c# - How do you get a variable's name as it was physically typed in its declaration?

    - by Petras
    The class below contains the field city. I need to dynamically determine the field's name as it is typed in the class declaration i.e. I need to get the string "city" from an instance of the object city. I have tried to do this by examining its Type in DoSomething() but can't find it when examining the contents of the Type in the debugger. Is it possible? public class Person { public string city = "New York"; public Person() { } public void DoSomething() { Type t = city.GetType(); string field_name = t.SomeUnkownFunction(); //would return the string "city" if it existed! } } Some people in their answers below have asked me why I want to do this. Here's why. In my real world situation, there is a custom attribute above city. [MyCustomAttribute("param1", "param2", etc)] public string city = "New York"; I need this attribute in other code. To get the attribute, I use reflection. And in the reflection code I need to type the string "city" MyCustomAttribute attr; Type t = typeof(Person); foreach (FieldInfo field in t.GetFields()) { if (field.Name == "city") { //do stuff when we find the field that has the attribute we need } } Now this isn't type safe. If I changed the variable "city" to "workCity" in my field declaration in Person this line would fail unless I knew to update the string if (field.Name == "workCity") //I have to make this change in another file for this to still work, yuk! { } So I am trying to find some way to pass the string to this code without physically typing it. Yes, I could declare it as a string constant in Person (or something like that) but that would still be typing it twice. Phew! That was tough to explain!! Thanks Thanks to all who answered this * a lot*. It sent me on a new path to better understand lambda expressions. And it created a new question.

    Read the article

  • Php algorithm - How to achieve that without eval

    - by Marcelo
    I have a class that keeps data stores/access data by using words.separated.by.dots keys and it behaves like the following: $object = new MyArray() $object->setParam('user.name','marcelo'); $object->setParam('user.email','[email protected]'); $object->getParams(); /* array( 'user' => array( 'name' => 'marcelo', 'email' => '[email protected]' ) ); */ It is working, but the method unsetParam() was horribly implemented. That happened because i didn't know how to achieve that without eval() function. Although it is working, I found that it was a really challenging algorithm and that you might find fun trying to achieve that without eval(). class MyArray { /** * @param string $key * @return Mura_Session_Abstract */ public function unsetParam($key) { $params = $this->getParams(); $tmp = $params; $keys = explode('.', $key); foreach ($keys as $key) { if (!isset($tmp[$key])) { return $this; } $tmp = $tmp[$key]; } // bad code! $eval = "unset(\$params['" . implode("']['", $keys) . "']);"; eval($eval); $this->setParams($params); return $this; } } The test method: public function testCanUnsetNestedParam() { $params = array( '1' => array( '1' => array( '1' => array( '1' => 'one', '2' => 'two', '3' => 'three', ), '2' => array( '1' => 'one', '2' => 'two', '3' => 'three', ), ) ), '2' => 'something' ); $session = $this->newSession(); $session->setParams($params); unset($params['1']['1']['1']); $session->unsetParam('1.1.1'); $this->assertEquals($params, $session->getParams()); $this->assertEquals($params['1']['1']['2'], $session->getParam('1.1.2')); }

    Read the article

  • Why can't I use resources as ErrorMessage with DataAnnotations?

    - by Jova
    Why can't I do like this? [Required(ErrorMessage = "*")] [RegularExpression("^[a-zA-Z0-9_]*$", ErrorMessage = Resources.RegistrationModel.UsernameError)] public string Username { get; set; } What is the error message telling me? An attribute argument must be a constant expression , typeof expression or array creation expression of an attribute parameter type.

    Read the article

< Previous Page | 122 123 124 125 126 127 128 129 130 131 132 133  | Next Page >