Search Results

Search found 4118 results on 165 pages for 'attributes'.

Page 13/165 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • PHP Regular Expression to quotations to attributes

    - by atwellpub
    hey Guys, I need to run a string of html through a regex function that checks to see if the attributes are closed in quotes, and if they aren't then close them. for example i want <img src=http://www.domain.com/image.gif border=0> to turn into <img src='http://www.domain.com/image.gif' border='0'> Can anyone help me?

    Read the article

  • How to get attributes of container in jquery ?

    - by Rachel
    How can I get attributes values from an container using jquery ? For example: I have container div as: div id = "zone-3a-2f-2f-2fPortal-2fPages-2fHome-2fZones-2fLeft-2f-7ccomponent-3a-2f-2f-2fSpm-2fComponents-2fPromotion-2f" class = "promotion" here how can I get attribute id value using jquery and than how can I trim the value to get component information ? Thanks.

    Read the article

  • C# Attributes Aren't Supposed to Inherit

    - by Adam
    Since attributes don't inherit in C# (at least I didn't think they did) - how does the following code still display the Hello popup when the MyTestMethod test is run: [TestClass] public class BaseTestClass { [TestInitialize] public void Foo() { System.Windows.Forms.MessageBox.Show("Hello"); } } [TestClass] public class TestClass : BaseTestClass { [TestMethod] public void MyTestMethod() { Assert.IsTrue(true); } }

    Read the article

  • ruby on rails- nested attributes for 'has_one' relationship

    - by Kum
    Hello, I need some help concerning nested attributes in models with 'has_one' relationship. Model Survey has 1 question Model Question has 1 answer How do i build the 'answer' in the code below def new @survey = Survey.new @survey.build_question # build one question @survey.question.answer.build #this part is not working end Please can anybody tell me how to build the answer as the code "@survey.question.answer.build" is not correct. Many many thanks for your help

    Read the article

  • How can I internationalize strings representing C# enum values?

    - by Duke
    I've seen many questions and answers about mapping strings to enums and vice-versa, but how can I map a series of localized strings to enums? Should I just create an extension method like this that returns the proper string from a resource file? Is there a way to localize attributes (like "Description") that are used in solutions like this? Which is the preferred solution - extension method or attributes. It seems to me that this isn't the intended purpose of attributes. In fact, now that I think about it, if I were to use an extension method an attribute seems like something I'd use to specify a key in a resource file for the localized string I want to use in place of the enum value. EDIT - example: Given the following enum, public enum TransactionTypes { Cheque = 1, BankTransfer = 2, CreditCard = 3 } I would like a way to map each type to a localized string. I started off with an extension method for the enum that uses a switch statement and strongly typed references to the resource file. However, an extension method for every enum doesn't seem like a great solution. I've started following this to create a custom attribute for each enumerated value. The attribute has a base name and key for the resource file containing localized strings. In the above enum, for example, I have this: ... [EnumResourceAttribute("FinancialTransaction", "Cheque")] Cheque = 1, ... Where "FinanacialTransaction" is the resx file and "Cheque" is the string key. I'm trying to create a utility method to which I could pass any value from any enumeration and have it return the localized string representation of that value, assuming the custom attribute is specified. I just can't figure out how to dynamically access a resource file and a key within it.

    Read the article

  • undefined method `build_users' with nested models

    - by Cédric
    I've got into trouble with nested attributes. Here is my Account model : class Account < ActiveRecord::Base has_many :products has_many :blogs has_many :openings has_many :users has_one :logo, :class_name => "AccountPicture" has_one :address, :class_name => "AccountAddress" has_and_belongs_to_many :options accepts_nested_attributes_for :logo, :allow_destroy => true accepts_nested_attributes_for :address, :allow_destroy => true accepts_nested_attributes_for :users, :allow_destroy => true end And here is my User model : class User < ActiveRecord::Base belongs_to :account end As you can see, Account accepts nested attributes for logo, address, and users. While testing, i can use nested attributes for logo and address, but not for user. a = Account.new => #<Account id: nil, hostname: nil, subdomain: nil, name: nil, description: nil, base_line: nil, footer: nil, phone_number: nil, mobile_number: nil, email_address: nil, created_at: nil, updated_at: nil> # building the address works fine >> a.build_address => #<AccountAddress id: nil, account_id: nil, country: nil, state: nil, county: nil, city: nil, suburb: nil, zipcode: nil, street: nil, streetno: nil, longitude: nil, latitude: nil, error_code: nil> # building the users fails >> a.build_users NoMethodError: undefined method `build_users' for #<Account:0x7f6862a5f948> from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/attribute_methods.rb:260:in `method_missing' from (irb):2 Thus, in my views, when i use the nested forms, i got this error back : User(#69850615730460) expected, got Array(#69850664775200) Any help would be appreciated. Thanks.

    Read the article

  • Problem parsing an atom feed using simplexml_load_file(), can't get an attribute.

    - by Craig Ward
    Hi, I am trying to create a social timeline. I pull in feeds form certain places so I have a timeline of thing I have done. The problem I am having is with Google reader Shared Items. I want to get the time at which I shared the item which is contained in <entry gr:crawl-timestamp-msec="1269088723811"> Trying to get the element using $date = $xml->entry[$i]->link->attributes()->gr:crawl-timestamp-msec; fails because of the : after gr which causes a PHP error. I could figure out how to get the element, so thought I would change the name using the code below but it throws the following error Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "<?xml version="1.0"?><feed xmlns:idx="urn:atom-extension:indexing" xmlns:media="http://search.yahoo.com/mrss/" xmlns <?php $get_feed = file_get_contents('http://www.google.com/reader/public/atom/user/03120403612393553979/state/com.google/broadcast'); $old = "gr:crawl-timestamp-msec"; $new = "timestamp"; $xml_file = str_replace($old, $new, $get_feed); $xml = simplexml_load_file($xml_file); $i = 0; foreach ($xml->entry as $value) { $id = $xml->entry[$i]->id; $date = date('Y-m-d H:i:s', strtotime($xml->entry[$i]->attributes()->timestamp )); $text = $xml->entry[$i]->title; $link = $xml->entry[$i]->link->attributes()->href; $source = "googleshared"; echo "date = $date<br />"; $sql="INSERT IGNORE INTO timeline (id,date,text,link, source) VALUES ('$id', '$date', '$text', '$link', '$source')"; mysql_query($sql); $i++; }` Could someone point me in the right direction please. Cheers Craig

    Read the article

  • Element Content Versus Attribute for Simple XML Value

    - by MB
    I know the elements versus attributes debate has come up many times here and elsewhere (e.g. here, here, here, here, and here) but I haven't seen much discussion of elements versus attributes for simple property values. So which of the following approaches do you think is better for storing a simple value? A: Value in Element Content: <TotalCount>553</TotalCount> <CelsiusTemperature>23.5</CelsiusTemperature> <SingleDayPeriod>2010-05-29</SingleDayPeriod> <ZipCodeLocation>12203</ZipCodeLocation> or B: Value in Attribute: <TotalCount value="553"/> <CelsiusTemperature value="23.5"/> <SingleDayPeriod day="2010-05-29"/> <ZipCodeLocation code="12203"/> I suspect that putting the value in the element content (A) might look a little more familiar to most folks (though I'm not sure about that). Putting the value in an attribute (B) might use less characters, but that depends on the length of the element and attribute names. Putting the value in an attribute (B) might be more extensible, because you could potentially include all sorts of extra information as nested elements. Whereas, by putting the value inside the element content (A), you're restricting extensibility to adding more attributes. But then extensibility often isn't a concern for really simple properties - sometimes you know that you'll never need to add additional data. Bottom line might be that it simply doesn't matter, but it would still be great to hear some thoughts and see some votes for the two options.

    Read the article

  • How color attributes work in VBO?

    - by Jayesh
    I am coding to OpenGL ES 2.0 (Webgl). I am using VBOs to draw primitives. I have vertex array, color array and array of indices. I have looked at sample codes, books and tutorial, but one thing I don't get - if color is defined per vertex how does it affect the polygonal surfaces adjacent to those vertices? (I am a newbie to OpenGL(ES)) I will explain with an example. I have a cube to draw. From what I read in OpenGLES book, the color is defined as an vertex attribute. In that case, if I want to draw 6 faces of the cube with 6 different colors how should I define the colors. The source of my confusion is: each vertex is common to 3 faces, then how will it help defining a color per vertex? (Or should the color be defined per index?). The fact that we need to subdivide these faces into triangles, makes it harder for me to understand how this relationship works. The same confusion goes for edges. Instead of drawing triangles, let's say I want to draw edges using LINES primitives. Each edge of different color. How am I supposed to define color attributes in that case? I have seen few working examples. Specifically this tutorial: http://learningwebgl.com/blog/?p=370 I see how color array is defined in the above example to draw a cube with 6 different colored faces, but I don't understand why is defined that way. (Why is each color copied 4 times into unpackedColors for instance?) Can someone explain how color attributes work in VBO? [The link above seems inaccessible, so I will post the relevant code here] cubeVertexPositionBuffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexPositionBuffer); vertices = [ // Front face -1.0, -1.0, 1.0, 1.0, -1.0, 1.0, 1.0, 1.0, 1.0, -1.0, 1.0, 1.0, // Back face -1.0, -1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0, 1.0, -1.0, -1.0, // Top face -1.0, 1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, // Bottom face -1.0, -1.0, -1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, -1.0, -1.0, 1.0, // Right face 1.0, -1.0, -1.0, 1.0, 1.0, -1.0, 1.0, 1.0, 1.0, 1.0, -1.0, 1.0, // Left face -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0, 1.0, -1.0, ]; gl.bufferData(gl.ARRAY_BUFFER, new WebGLFloatArray(vertices), gl.STATIC_DRAW); cubeVertexPositionBuffer.itemSize = 3; cubeVertexPositionBuffer.numItems = 24; cubeVertexColorBuffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexColorBuffer); var colors = [ [1.0, 0.0, 0.0, 1.0], // Front face [1.0, 1.0, 0.0, 1.0], // Back face [0.0, 1.0, 0.0, 1.0], // Top face [1.0, 0.5, 0.5, 1.0], // Bottom face [1.0, 0.0, 1.0, 1.0], // Right face [0.0, 0.0, 1.0, 1.0], // Left face ]; var unpackedColors = [] for (var i in colors) { var color = colors[i]; for (var j=0; j < 4; j++) { unpackedColors = unpackedColors.concat(color); } } gl.bufferData(gl.ARRAY_BUFFER, new WebGLFloatArray(unpackedColors), gl.STATIC_DRAW); cubeVertexColorBuffer.itemSize = 4; cubeVertexColorBuffer.numItems = 24; cubeVertexIndexBuffer = gl.createBuffer(); gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, cubeVertexIndexBuffer); var cubeVertexIndices = [ 0, 1, 2, 0, 2, 3, // Front face 4, 5, 6, 4, 6, 7, // Back face 8, 9, 10, 8, 10, 11, // Top face 12, 13, 14, 12, 14, 15, // Bottom face 16, 17, 18, 16, 18, 19, // Right face 20, 21, 22, 20, 22, 23 // Left face ] gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new WebGLUnsignedShortArray(cubeVertexIndices), gl.STATIC_DRAW); cubeVertexIndexBuffer.itemSize = 1; cubeVertexIndexBuffer.numItems = 36;

    Read the article

  • Custom HTML attributes on SelectListItems in MVC2?

    - by blesh
    I have a need to add custom HTML attributes, specifically classes or styles to option tags in the selects generated by Html.DropDownFor(). I've been playing with it, and for the life of me I can't figure out what I need to do to get what I need working. Assuming I have a list of colors that I'm generating the dropdown for, where the option value is the color's identifier, and the text is the name... here's what I'd like to be able to see as output: <select name="Color"> <option value="1" style="background:#ff0000">Red</option> <option value="2" style="background:#00ff00">Green</option> <option value="3" style="background:#0000ff">Blue</option> <!-- more here --> <option value="25" style="background:#f00f00">Foo Foo</option> </select

    Read the article

  • XML/SOAP attributes for a complextype in kSOAP

    - by Soumya
    Hi, I'm trying to parse a SOAP response that contains nested ComplexTypes using the kSOAP library on Android 2.1. <event att1="value1" att2="value2" att3="value3"> <tag2> ... </tag2> <tag3> ... </tag3> </event> I've implemented my own class Event that implements org.ksoap2.serialization.KvmSerializable to parse this response. It is not clear to me if and how I can parse the attributes (att1, att2 and att3) of the event node. Is it even possible with the current kSOAP implementation? Thanks.

    Read the article

  • Repairing malformatted html attributes using c#

    - by jhoefnagels
    I have a web application with an upload functionality for HTML files generated by chess software to be able to include a javascript player that reproduces a chess game. I do not like to load the uploaded files in a frame so I reconstruct the HTML and javascript generated by the software by parsing the dynamic parts of the file. The problem with the HTML is that all attributes values are surrounded with an apostrophe instead of a quotation mark. I am looking for a way to fix this using a library or a regex replace using c#. The html looks like this: <DIV class='pgb'><TABLE class='pgbb' CELLSPACING='0' CELLPADDING='0'><TR><TD> and I would transform it into: <DIV class="pgb"><TABLE class="pgbb" CELLSPACING="0" CELLPADDING="0"><TR><TD>

    Read the article

  • restore default css attributes

    - by pstanton
    hi all. i'm writing a component that is to be used across multiple websites. each website has it's own stylesheets and displays certain things differently. all of my html is wrapped within a div with an id: <div id="myComponent">...</div> my component however is to look consistent across all of the sites. this is fine as i apply styling to most of the attributes in my component. div#myComponent p {font-size:11px;} etc however i've come across a site that removes the border from all input fields input {border: medium none;} i need to 'un-apply' this directive for the input fields within my component, and preferrably use the browser's default styling for inputs, as the border style for input type="text" will need be different to input type="button". how would you achieve this?

    Read the article

  • How to specify argument attributes in CFscript? (CF9)

    - by Henry
    In CF9 doc: Defining components and functions in CFScript, it says: /** *Comment text, treated as a hint. *Set metadata, including, optionally, attributes, in the last entries *in the comment block, as follows: *@metadataName metadataValue ... */ access returnType function functionName(arg1Type arg1Name="defaultValue1" arg1Attribute="attributeValue...,arg2Type arg2Name="defaultValue2" arg2Attribute="attributeValue...,...) functionAttributeName="attributeValue" ... { body contents } How do you specify arg1Attribute? I tried this: public void function setFirstname(string firstname="" displayName="first name"){} but it does NOT work. Also, how do you translate this to script-style? <cffunction name="setPerson"> <cfargument name="person" type="com.Person"/> </cffunction> I tried: function setPerson(com.Person person){} and it does NOT work either. "You cannot use a variable reference with "." operators in this context" it says.

    Read the article

  • How to prevent a javascript/backbone.js cloned model from sharing attributes

    - by user540727
    I'm working with backbone.js models, so I don't know if my question is particular to the way backbone handles cloning or if it applies to javascript in general. Basically, I need to clone a model which has an attribute property assigned an object. The problem is that when I update the parent or clone's attribute, the other model is also updated. Here is a quick example: var A = Backbone.Model.extend({}); var a = new A({'test': {'some': 'crap'}}); var b = a.clone(); a.get('test')['some'] = 'thing'; // I could also use a.set() to set the attribute with the same result console.log(JSON.stringify(a)) console.log(JSON.stringify(b)) which logs the following: {"test":{"some":"thing"}} {"test":{"some":"thing"}} I would prefer to clone a such that b won't be referencing any of its attributes. Any help would be appreciated.

    Read the article

  • Strip tags (with tags inside attributes and nested tags) using javascript

    - by Kokizzu
    What the fastest (in performance) way to strip strings from tags, most solution i've tried that uses regexp not resulting correct values for tags inside attributes (yes, i know it's wrong), example test case: var str = "<div data-content='yo! press this: <br/> <button type=\"button\"><i class=\"glyphicon glyphicon-disk\"></i> Save</button>' data-title='<div>this one for tooltips <div>seriously</div></div>'> this is the real content<div> with another nested</div></div>" that should resulting: this is the real content with another nested

    Read the article

  • Ask for an example code for parsing xml and get attributes by using GData API

    - by ben
    When i use GData API in my app for parsing xml,how could i get attributes and it's value? Wanted a piece of example code.Thanks a lot. xml: <playurls><url islive="0" type="3" bit_stream="1">http://vods.netitv.com//dy2/2010/02/08/cf584b76-3579-4b75-a0c8-f7a473d79f8c.mp4 </url><url islive="0" type="3" bit_stream="2">http://vods.netitv.com//dy/2010/02/08/965bbc65-8ec0-4c50-98ae-c69a831926cc.mp4 </url><url islive="0" type="2" bit_stream="1">http://vods.netitv.com//dy2/2010/02/08/cf584b76-3579-4b75-a0c8-f7a473d79f8c.mp4 </url><url islive="0" type="2" bit_stream="2">http://vods.netitv.com//dy/2010/02/08/965bbc65-8ec0-4c50-98ae-c69a831926cc.mp4 </url></playurls>

    Read the article

  • Arbitrary attributes error with has_one association and Factory Girl

    - by purpletonic
    I'm trying to build a basic shopping cart for a Rails app I'm working on. Nothing special, - the shopping cart has many line_items - each line_item has_one product associated and a quantity with it class Cart < ActiveRecord::Base attr_accessible :line_items has_many :line_items, :dependent => :destroy end class LineItem < ActiveRecord::Base attr_accessible :quantity, :product belongs_to :cart has_one :product end I'm trying to use RSpec to test this association, but i'm doing something wrong as I'm getting an error that says: DEPRECATION WARNING: You're trying to create an attribute 'line_item_id'. Writing arbitrary attributes on a model is deprecated, and I'm not sure why. In my factories.rb file I'm defining the line_item factory as follows: factory :line_item do quantity { Random.rand(1..5) } product end factory :cart do factory :cart_with_two_line_items do ignore do line_item_count 2 end after(:create) do |cart, evaluator| FactoryGirl.create_list(:line_item, evaluator.line_item_count, cart_id: cart) end end end Any pointers where I'm going wrong, it's probably something basic, but I'm still quite new to Rspec. Thanks in advance.

    Read the article

  • md5 hash for file without File Attributes

    - by Glennular
    Using the following code to compute MD5 hashs of files: Private _MD5Hash As String Dim md5 As New System.Security.Cryptography.MD5CryptoServiceProvider Dim md5hash() As Byte md5hash = md5.ComputeHash(Me._BinaryData) Me._MD5Hash = ByteArrayToString(md5hash) Private Function ByteArrayToString(ByVal arrInput() As Byte) As String Dim sb As New System.Text.StringBuilder(arrInput.Length * 2) For i As Integer = 0 To arrInput.Length - 1 sb.Append(arrInput(i).ToString("X2")) Next Return sb.ToString().ToLower End Function We are getting different hashes depending on the create-date and modify-date of the file. We are storing the hash and the binary file in a SQL DB. This works fine when we upload the same instance of a file. But when we save a new instance of the file from the DB (with today's date as the create/modify) on the file-system and then check the new hash versus the MD5 stored in the DB they do not match, and therefor fail a duplicate check. How can we check for a file hash excluding the file attributes? or is there a different issue here?

    Read the article

  • JQuery and form attributes change in IE

    - by bounce
    Hi, I want to change form attributes with JQuery. In other browsers it works fine, but not in IE(6,7,8). Code: action = '/controller/action/id/'; target = 'upload_iframe'; enctype = 'multipart/form-data'; $('#form1').attr("action",action); $('#form1').attr("target",target); $('#form1').attr("enctype",enctype); So what's the problem ? Your help would be appreciated.

    Read the article

  • Modelling a manyToMany relationship with attributes

    - by Javi
    Hello, I have a ManyToMany relationship between two classes, for instance class Customer and class Item. A customer can buy several items and an item can be bought by different customers. I need to store extra information in this relationship, for example the day when the item was bought. I wonder how is this usually modelled in JPA, cause I'm not sure how to express this in code. Do I have to create a new class to model all the attributes of the relationship and make a manyToMany relationship between the other classes or is a better way to do this? Thanks

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >