Search Results

Search found 5554 results on 223 pages for 'attribute'.

Page 9/223 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • AngularJS Bind Attribute Presence

    - by Chuck
    I want to bind the presence of an attribute to a variable in AngularJS. Specifically, sandbox for an iframe. Say I have $myCtrl.allowJavascript as a variable, I want to do: <iframe src="..." sandbox /> Where the sandbox attribute is present when allowJavascript == false, and I want the sandbox attribute to disappear when allowJavascript == true. Does AngularJS have a mechanism for this? The closest thing I could find was here, which basically says "it will just work for certain attributes"--but not for sandbox.

    Read the article

  • testing existing attribute of a @classmethod function, yields AttributeError

    - by alex
    i have a function which is a class method, and i want to test a attribute of the class which may or may not be None, but will exist always. class classA(): def __init__(self, var1, var2 = None): self.attribute1 = var1 self.attribute2 = var2 @classmethod def func(self,x): if self.attribute2 is None: do something i get the error AttributeError: class classA has no attribute 'attributeB' when i access the attribute like i showed but if on command line i can see it works, x = classA() x.attributeB is None True so the test works. if i remove the @classmethod decorator from func, the problem disapears. if i leave the @classmethod decorator, it only seems to affect variables which are supplied default values in the super-class's constructor. whats going on in the above code?

    Read the article

  • TextMate Theme Select Attribute Value

    - by HelpAppreciated
    Hello, I need to change the color of certain attributes/tags. I am switching from Dreamweaver and making the skin has been really hard in TextMate. As you can see, I want to change the a and img tags along with all of their attributes. The closest I've come to find is entity.other.attribute-name which only works with id for some reason entity.other.attribute-name.id Bonus would be the scope selector for the value of an attribute, e.g. "Logo" alt in the above example. Thank You!

    Read the article

  • Generate multiple attribute?

    - by acidzombie24
    ATM i cant quiet imagine how this will work. I'm sure it can be done. I notice a pattern use in my attribute where i always use 3 specific attributes together. Take the below as an example [MyAttr(4, @"a"), MyAttr(41, "b"), MyAttr(45, "ab")] Mine is much more complicated but i would like to define one attribute with more params to generate the data above. How might i do that? Lets say my one attribute will look like this MyAttr2(4, 41, "a", "b"); //4+41=45, "a"+"b" = "ab" How might i generate the 3 MyAttr to apply to a class using MyAttr2?

    Read the article

  • When i trid to install ubuntu 11.10 i get an error '"Windows Backend object has no attribute 'iso-path' - see log for details.'

    - by Raja
    I am trying to install Ubuntu 11.10 in windows XP, Everything went as before until the countdown clock reached zero, then I got "Windows Backend object has no attribute 'iso-path' - see log for details. It's done it three times now. (Formatting in between) The end of the log says 11-01 17:20 DEBUG TaskList: New task check_iso 11-01 17:20 DEBUG TaskList: ### Running check_iso... 11-01 17:20 DEBUG CommonBackend: Checking Y:\ubuntu\install\installation.iso 11-01 17:20 DEBUG Distro: checking Ubuntu ISO Y:\ubuntu\install\installation.iso 11-01 17:20 DEBUG Distro: wrong size: 8094031872 900000000 11-01 17:20 DEBUG TaskList: ### Finished check_iso 11-01 17:20 ERROR TaskList: 'WindowsBackend' object has no attribute 'iso_path' Traceback (most recent call last): File "\lib\wubi\backends\common\tasklist.py", line 197, in call File "\lib\wubi\backends\common\backend.py", line 579, in get_iso File "\lib\wubi\backends\common\backend.py", line 565, in use_iso AttributeError: 'WindowsBackend' object has no attribute 'iso_path' 11-01 17:20 DEBUG TaskList: # Cancelling tasklist 11-01 17:20 DEBUG TaskList: # Finished tasklist 11-01 17:20 ERROR root: 'WindowsBackend' object has no attribute 'iso_path' Traceback (most recent call last): File "\lib\wubi\application.py", line 58, in run File "\lib\wubi\application.py", line 130, in select_task File "\lib\wubi\application.py", line 205, in run_cd_menu File "\lib\wubi\application.py", line 120, in select_task File "\lib\wubi\application.py", line 158, in run_installer File "\lib\wubi\backends\common\tasklist.py", line 197, in call File "\lib\wubi\backends\common\backend.py", line 579, in get_iso File "\lib\wubi\backends\common\backend.py", line 565, in use_iso AttributeError: 'WindowsBackend' object has no attribute 'iso_path'

    Read the article

  • '"Windows Backend object has no attribute 'iso-path' - see log for details.' error when trying to install

    - by Raja
    I am trying to install Ubuntu 11.10 in windows XP, Everything went as before until the countdown clock reached zero, then I got "Windows Backend object has no attribute 'iso-path' - see log for details. It's done it three times now. (Formatting in between) The end of the log says ====== 11-01 17:20 DEBUG TaskList: New task check_iso 11-01 17:20 DEBUG TaskList: ### Running check_iso... 11-01 17:20 DEBUG CommonBackend: Checking Y:\ubuntu\install\installation.iso 11-01 17:20 DEBUG Distro: checking Ubuntu ISO Y:\ubuntu\install\installation.iso 11-01 17:20 DEBUG Distro: wrong size: 8094031872 > 900000000 11-01 17:20 DEBUG TaskList: ### Finished check_iso 11-01 17:20 ERROR TaskList: 'WindowsBackend' object has no attribute 'iso_path' Traceback (most recent call last): File "\lib\wubi\backends\common\tasklist.py", line 197, in __call__ File "\lib\wubi\backends\common\backend.py", line 579, in get_iso File "\lib\wubi\backends\common\backend.py", line 565, in use_iso AttributeError: 'WindowsBackend' object has no attribute 'iso_path' 11-01 17:20 DEBUG TaskList: # Cancelling tasklist 11-01 17:20 DEBUG TaskList: # Finished tasklist 11-01 17:20 ERROR root: 'WindowsBackend' object has no attribute 'iso_path' Traceback (most recent call last): File "\lib\wubi\application.py", line 58, in run File "\lib\wubi\application.py", line 130, in select_task File "\lib\wubi\application.py", line 205, in run_cd_menu File "\lib\wubi\application.py", line 120, in select_task File "\lib\wubi\application.py", line 158, in run_installer File "\lib\wubi\backends\common\tasklist.py", line 197, in __call__ File "\lib\wubi\backends\common\backend.py", line 579, in get_iso File "\lib\wubi\backends\common\backend.py", line 565, in use_iso AttributeError: 'WindowsBackend' object has no attribute 'iso_path'

    Read the article

  • InternalsVisibleTo attribute and security vulnerability

    - by Sergey Litvinov
    I found one issue with InternalsVisibleTo attribute usage. The idea of InternalsVisibleTo attribute to allow some other assemblies to use internal classes\methods of this assembly. To make it work you need sign your assemblies. So, if other assemblies isn't specified in main assembly and if they have incorrect public key, then they can't use Internal members. But the issue in Reflection Emit type generation. For example, we have CorpLibrary1 assembly and it has such class: public class TestApi { internal virtual void DoSomething() { Console.WriteLine("Base DoSomething"); } public void DoApiTest() { // some internal logic // ... // call internal method DoSomething(); } } This assembly is marked with such attribute to allow another CorpLibrary2 to make inheritor for that TestAPI and override behaviour of DoSomething method. [assembly: InternalsVisibleTo("CorpLibrary2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100434D9C5E1F9055BF7970B0C106AAA447271ECE0F8FC56F6AF3A906353F0B848A8346DC13C42A6530B4ED2E6CB8A1E56278E664E61C0D633A6F58643A7B8448CB0B15E31218FB8FE17F63906D3BF7E20B9D1A9F7B1C8CD11877C0AF079D454C21F24D5A85A8765395E5CC5252F0BE85CFEB65896EC69FCC75201E09795AAA07D0")] The issue is that I'm able to override this internal DoSomething method and break class logic. My steps to do it: Generate new assembly in runtime via AssemblyBuilder Get AssemblyName from CorpLibrary1 and copy PublikKey to new assembly Generate new assembly that will inherit TestApi class As PublicKey and name of generated assembly is the same as in InternalsVisibleTo, then we can generate new DoSomething method that will override internal method in TestAPI assembly Then we have another assembly that isn't related to this CorpLibrary1 and can't use internal members. We have such test code in it: class Program { static void Main(string[] args) { var builder = new FakeBuilder(InjectBadCode, "DoSomething", true); TestApi fakeType = builder.CreateFake(); fakeType.DoApiTest(); // it will display: // Inject bad code // Base DoSomething Console.ReadLine(); } public static void InjectBadCode() { Console.WriteLine("Inject bad code"); } } And this FakeBuilder class has such code: /// /// Builder that will generate inheritor for specified assembly and will overload specified internal virtual method /// /// Target type public class FakeBuilder { private readonly Action _callback; private readonly Type _targetType; private readonly string _targetMethodName; private readonly string _slotName; private readonly bool _callBaseMethod; public FakeBuilder(Action callback, string targetMethodName, bool callBaseMethod) { int randomId = new Random((int)DateTime.Now.Ticks).Next(); _slotName = string.Format("FakeSlot_{0}", randomId); _callback = callback; _targetType = typeof(TFakeType); _targetMethodName = targetMethodName; _callBaseMethod = callBaseMethod; } public TFakeType CreateFake() { // as CorpLibrary1 can't use code from unreferences assemblies, we need to store this Action somewhere. // And Thread is not bad place for that. It's not the best place as it won't work in multithread application, but it's just a sample LocalDataStoreSlot slot = Thread.AllocateNamedDataSlot(_slotName); Thread.SetData(slot, _callback); // then we generate new assembly with the same nameand public key as target assembly trusts by InternalsVisibleTo attribute var newTypeName = _targetType.Name + "Fake"; var targetAssembly = Assembly.GetAssembly(_targetType); AssemblyName an = new AssemblyName(); an.Name = GetFakeAssemblyName(targetAssembly); // copying public key to new generated assembly var assemblyName = targetAssembly.GetName(); an.SetPublicKey(assemblyName.GetPublicKey()); an.SetPublicKeyToken(assemblyName.GetPublicKeyToken()); AssemblyBuilder assemblyBuilder = Thread.GetDomain().DefineDynamicAssembly(an, AssemblyBuilderAccess.RunAndSave); ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule(assemblyBuilder.GetName().Name, true); // create inheritor for specified type TypeBuilder typeBuilder = moduleBuilder.DefineType(newTypeName, TypeAttributes.Public | TypeAttributes.Class, _targetType); // LambdaExpression.CompileToMethod can be used only with static methods, so we need to create another method that will call our Inject method // we can do the same via ILGenerator, but expression trees are more easy to use MethodInfo methodInfo = CreateMethodInfo(moduleBuilder); MethodBuilder methodBuilder = typeBuilder.DefineMethod(_targetMethodName, MethodAttributes.Public | MethodAttributes.Virtual); ILGenerator ilGenerator = methodBuilder.GetILGenerator(); // call our static method that will call inject method ilGenerator.EmitCall(OpCodes.Call, methodInfo, null); // in case if we need, then we put call to base method if (_callBaseMethod) { var baseMethodInfo = _targetType.GetMethod(_targetMethodName, BindingFlags.NonPublic | BindingFlags.Instance); // place this to stack ilGenerator.Emit(OpCodes.Ldarg_0); // call the base method ilGenerator.EmitCall(OpCodes.Call, baseMethodInfo, new Type[0]); // return ilGenerator.Emit(OpCodes.Ret); } // generate type, create it and return to caller Type cheatType = typeBuilder.CreateType(); object type = Activator.CreateInstance(cheatType); return (TFakeType)type; } /// /// Get name of assembly from InternalsVisibleTo AssemblyName /// private static string GetFakeAssemblyName(Assembly assembly) { var internalsVisibleAttr = assembly.GetCustomAttributes(typeof(InternalsVisibleToAttribute), true).FirstOrDefault() as InternalsVisibleToAttribute; if (internalsVisibleAttr == null) { throw new InvalidOperationException("Assembly hasn't InternalVisibleTo attribute"); } var ind = internalsVisibleAttr.AssemblyName.IndexOf(","); var name = internalsVisibleAttr.AssemblyName.Substring(0, ind); return name; } /// /// Generate such code: /// ((Action)Thread.GetData(Thread.GetNamedDataSlot(_slotName))).Invoke(); /// private LambdaExpression MakeStaticExpressionMethod() { var allocateMethod = typeof(Thread).GetMethod("GetNamedDataSlot", BindingFlags.Static | BindingFlags.Public); var getDataMethod = typeof(Thread).GetMethod("GetData", BindingFlags.Static | BindingFlags.Public); var call = Expression.Call(allocateMethod, Expression.Constant(_slotName)); var getCall = Expression.Call(getDataMethod, call); var convCall = Expression.Convert(getCall, typeof(Action)); var invokExpr = Expression.Invoke(convCall); var lambda = Expression.Lambda(invokExpr); return lambda; } /// /// Generate static class with one static function that will execute Action from Thread NamedDataSlot /// private MethodInfo CreateMethodInfo(ModuleBuilder moduleBuilder) { var methodName = "_StaticTestMethod_" + _slotName; var className = "_StaticClass_" + _slotName; TypeBuilder typeBuilder = moduleBuilder.DefineType(className, TypeAttributes.Public | TypeAttributes.Class); MethodBuilder methodBuilder = typeBuilder.DefineMethod(methodName, MethodAttributes.Static | MethodAttributes.Public); LambdaExpression expression = MakeStaticExpressionMethod(); expression.CompileToMethod(methodBuilder); var type = typeBuilder.CreateType(); return type.GetMethod(methodName, BindingFlags.Static | BindingFlags.Public); } } remarks about sample: as we need to execute code from another assembly, CorpLibrary1 hasn't access to it, so we need to store this delegate somewhere. Just for testing I stored it in Thread NamedDataSlot. It won't work in multithreaded applications, but it's just a sample. I know that we use Reflection to get private\internal members of any class, but within reflection we can't override them. But this issue is allows anyone to override internal class\method if that assembly has InternalsVisibleTo attribute. I tested it on .Net 3.5\4 and it works for both of them. How does it possible to just copy PublicKey without private key and use it in runtime? The whole sample can be found there - https://github.com/sergey-litvinov/Tests_InternalsVisibleTo UPDATE1: That test code in Program and FakeBuilder classes hasn't access to key.sn file and that library isn't signed, so it hasn't public key at all. It just copying it from CorpLibrary1 by using Reflection.Emit

    Read the article

  • (Database Design - products attributes): What is better option for product attribute database design

    - by meyosef
    Hi, I new in database design. What is better option for product attribute database design for cms?(Please suggest other options also). option 1: 1 table products{ id product_name color price attribute_name1 attribute_value1 attribute_name2 attribute_value2 attribute_name3 attribute_value3 } option 2: 3 tables products{ id product_name color price } attribute{ id name value } products_attribute{ products_id attribute_id } Thanks, Yosef

    Read the article

  • Access custom attribute on method from Castle Windsor interceptor

    - by RobW
    I am trying to access a custom attribute applied to a method within a castle interceptor, e.g.: [MyCustomAttribute(SomeParam = "attributeValue")] public virtual MyEntity Entity { get; set; } using the following code: internal class MyInterceptor : IInterceptor { public void Intercept(IInvocation invocation) { if (invocation.Method.GetCustomAttributes(typeof(MyCustomAttribute), true) != null) { //Do something } } } The interceptor is firing OK when the method is called but this code does not return the custom attribute. How can I achieve this?

    Read the article

  • Can XmlMassUpdate be used to delete an attribute?

    - by tlianza
    For example, I have this line: <forms loginUrl="/redirecttosignin.aspx" name="NAME_HERE" requireSSL="false" timeout="60" domain=".blah.com" /> And I want to delete the "name" attribute altogether. I know I can do this to blank it: <forms xmu:key="loginUrl" loginUrl="/redirecttosignin.aspx" name="" /> But, I literally want to get the name attribute out, and leave the other attributes in tact. Couldn't find any examples of that. Thanks!

    Read the article

  • Creating a SelectListItem with the disabled="disabled" attribute

    - by Mark
    I realize Internet Explorer ignores the disabled attribute, but I'm not seeing a way to create, via the HtmlHelper, a SelectListItem that will spit out the following HTML: <option disabled="disabled">don't click this</option> The only properties SelectListItem has are: new SelectListItem{ Name = "don't click this", Value = string.Empty, Selected = false } The only option I see is to Subclass the SelectListItem to add an Enabled property to get the value to the view Not use the HTML helper for DropDownList Create a new HtmlHelper extension that accepts my new EnablableSelectList and adds my disabled attribute.

    Read the article

  • validator="" attribute of <h:inputtext> in jsf causing exception

    - by Amit
    We are trying to migrate from WS5 to WAS7 and the jsf code is causing the following error Original Exception: Error Message: JSPG0227E: Exception caught while translating /jsp/listView/listViewUPD_MAP_UM01.jsp: JSPG0301E: Invalid attribute, validator, for deferred method returning void. Error Code: 500 Target Servlet: /jsp/listView/listViewUPD_MAP_UM01.jsp Error Stack: com.ibm.ws.jsp.translator.JspTranslationException: JSPG0227E: Exception caught while translating /jsp/listView/listViewUPD_MAP_UM01.jsp: JSPG0301E: Invalid attribute, validator, for deferred method returning void. at com.ibm.ws.jsp.translator.visitor.generator.BaseTagGenerator.evaluateAttribute(BaseTagGenerator.java:527)

    Read the article

  • Wondering why DisplayName attribute is ignored in LabelFor on an overridden property

    - by Lasse Krantz
    Hi, today I got confused when doing a couple of <%=Html.LabelFor(m=>m.MyProperty)%> in ASP.NET MVC 2 and using the [DisplayName("Show this instead of MyProperty")] attribute from System.ComponentModel. As it turned out, when I put the attribute on an overridden property, LabelFor didn't seem to notice it. However, the [Required] attribute works fine on the overridden property, and the generated errormessage actually uses the DisplayNameAttribute. This is some trivial examplecode, the more realistic scenario is that I have a databasemodel separate from the viewmodel, but for convenience, I'd like to inherit from the databasemodel, add View-only properties and decorating the viewmodel with the attributes for the UI. public class POCOWithoutDataAnnotations { public virtual string PleaseOverrideMe { get; set; } } public class EditModel : POCOWithoutDataAnnotations { [Required] [DisplayName("This should be as label for please override me!")] public override string PleaseOverrideMe { get { return base.PleaseOverrideMe; } set { base.PleaseOverrideMe = value; } } [Required] [DisplayName("This property exists only in EditModel")] public string NonOverriddenProp { get; set; } } The strongly typed ViewPage<EditModel> contains: <div class="editor-label"> <%= Html.LabelFor(model => model.PleaseOverrideMe) %> </div> <div class="editor-field"> <%= Html.TextBoxFor(model => model.PleaseOverrideMe) %> <%= Html.ValidationMessageFor(model => model.PleaseOverrideMe) %> </div> <div class="editor-label"> <%= Html.LabelFor(model => model.NonOverriddenProp) %> </div> <div class="editor-field"> <%= Html.TextBoxFor(model => model.NonOverriddenProp) %> <%= Html.ValidationMessageFor(model => model.NonOverriddenProp) %> </div> The labels are then displayed as "PleaseOverrideMe" (not using the DisplayNameAttribute) and "This property exists only in EditModel" (using the DisplayNameAttribute) when viewing the page. If I post with empty values, triggering the validation with this ActionMethod: [HttpPost] public ActionResult Edit(EditModel model) { if (!ModelState.IsValid) return View(model); return View("Thanks"); } the <%= Html.ValidationMessageFor(model => model.PleaseOverrideMe) %> actually uses [DisplayName("This should be as label for please override me!")] attribute, and produces the default errortext "The This should be as label for please override me! field is required." Would some friendly soul shed some light on this?

    Read the article

  • FormsAuthentication.SetAuthCookie in OnAuthorization of custom attribute

    - by Prasad
    I am trying to set an auth cookie in OnAuthorization of my custom attribute in asp.net mvc(C#) application. when the session expires(New Session), i am setting an auth cookie again to make it available until the users logout. I have used the following to set the auth cookie, //set forms auth cookie FormsAuthentication.SetAuthCookie(strUserName, true); But when i check HttpContext.User.Identity.IsAuthenticated, it returns false. How to set an auth cookie in OnAuthorization of custom attribute?

    Read the article

  • InternalsVisibleTo attribute ain't workin'!

    - by skb
    I am trying to use the InternalsVisibleTo assembly attribute to make my internal classes in a .NET class library visible to my unit test project. For some reason, I keep getting an error message that says: 'MyClassName' is inaccessible due to its protection level Both assemblies are signed and I have the correct key listed in the attribute declaration. Any ideas?

    Read the article

  • jQuery: Setting 'style' attribute of element with object

    - by JamesBrownIsDead
    I saw this in our codebase the other day: link.attr('style', map({ color: '#9a4d9e', cursor: 'default' })); map is defined as: function map(map) { var cssValue = []; for (var o in map) { cssValue.push(o + ':' + map[o] + ';') } return cssValue.join(';'); } Is map necessarily? Is there a shorter way to do this? It's important to note that the "style" attribute overrides any styles set by a class added/defined in the "class" attribute.

    Read the article

  • jquery 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 custom attribute to HTML tags

    - by Ashwani K
    Hello All: I am adding custom attributes to my HTMLtags something like <li customeId="1"> I am to access this custom attribute in IE but in firefox, I am not able to get the values of these attributes. Any suggestion on how to access custom attribute in FireFox or any other way. I am using HTML 4 for development. Thanks Ashwani

    Read the article

  • Attribute Error in django

    - by itsandy
    Hi all, I am having an attribute error while working with django-registration it says 'NoneType' object has no attribute 'strip' I dropped my db table and created again but the error doesnt go..can anyone help..

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >