Search Results

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

Page 67/433 | < Previous Page | 63 64 65 66 67 68 69 70 71 72 73 74  | Next Page >

  • Get the value of an attribute Jquery

    - by Abu Hamzah
    i am trying to get EmployeeId withitn the DOM something like this: var o = obj[$(this).attr("EmployeeId")]; but getting undefined when i debug i see the following: $(this)[0].data data "{EmployeeId: 'A42345'}" here is my source code: $.ajax({ type: "POST", url: url, data: "{EmployeeId: '" + id + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (response) { var obj = (typeof response.d) == 'string' ? eval('(' + response.d + ')') : response.d; var o = obj[$(this).attr("EmployeeId")]; //<<<<undefined

    Read the article

  • Basic question about encryption - what exactly are keys?

    - by Tomas
    Hi, I was browsing and found good articles about encryption. However, none of them described why the key lenght is important and what exactly the key is used for. My guess is that could work this way: 0101001101010101010 Key: 01010010101010010101 //the longer the key, the longer unique sequence XOR or smth: //result Is this at least a bit how it works or I am missing something? Thanks

    Read the article

  • Hyphen in Array keys

    - by Vincent
    All, I have an array with hyphens in the key name. How do I extract the value of it in PHP? It returns a 0 to me, if I access like this: print $testarray->test-key; This is how the array looks like testarray[] = {["test-key"]=2,["hotlink"]=1} Thanks

    Read the article

  • How to implement iterator as an attribute of a class in Java

    - by de3
    Hi, let's say I have this simple MyArray class, with two simple methods: add, delete and an iterator. In the main method we can see how it is supposed to be used: public class MyArray { int start; int end; int[] arr; myIterator it; public MyArray(){ this.start=0; this.end=0; this.arr=new int[500]; it=new myIterator(); } public void add(int el){ this.arr[this.end]=el; this.end++; } public void delete(){ this.arr[this.start]=0; this.start++; } public static void main(String[] args){ MyArray m=new MyArray(); m.add(3); m.add(299); m.add(19); m.add(27); while(m.it.hasNext()){ System.out.println(m.it.next()); } } And then MyIterator should be implemented somehow: import java.util.Iterator; public class myIterator implements Iterator{ @Override public boolean hasNext() { // TODO Auto-generated method stub return false; } @Override public Object next() { // TODO Auto-generated method stub return null; } @Override public void remove() { // TODO Auto-generated method stub } } MyIterator should iterate arr from MyArray class, from start to end values; both are also attributes of MyArray. So, as MyIterator should use MyArray attributes, how should MyIterator be implemented? Perhaps I can send the current object in the initialization: it=new myIterator(this); But I guess it's not the best soultion. Or maybe MyArray itself should implement Iterator interface? How is this solved?

    Read the article

  • Hibernate entities stored as HttpSession attribute values

    - by njudge
    I'm dealing with a legacy Java application with a large, fairly messy codebase. There's a fairly standard 'User' object that gets stored in the HttpSession between requests, so the servlets do stuff like this at the top: HttpSession session = request.getSession(true); User user = (User)session.getAttribute("User"); The old user authentication layer (which I won't describe; suffice to say, it did not use a database) is being replaced with code mapped to the DB with Hibernate. So 'User' is now a Hibernate entity. My understanding of Hibernate object life cycles is a little fuzzy, but it seems like storing 'User' in the HttpSession now becomes a problem, because it will be retrieved in a different transaction during the next request. What is the right thing to be doing here? Can I just use the Hibernate Session object's update() method to reattach the User instance the next time around? Do I need to?

    Read the article

  • Consequent attribute calculations with a queuing system

    - by vrinek
    For all of the following assume these: rails v3.0 ruby v1.9 resque We have 3 models: Product belongs_to :sku, belongs_to :category Sku has_many :products, belongs_to :category Category has_many :products, has_many :skus When we update the product (let's say we disable it) we need to have some things happen to the relevant sku and category. The same is true for when a sku is updated. The proper way of achieving this is have an after_save on each model that triggers the other models' update events. example: products.each(&:disable!) # after_save triggers self.sku.products_updated # and self.category.products_updated (self is product) Now if we have 5000 products we are in for a treat. The same category might get updated hundreds of times and hog the database while doing so. We also have a nice queueing system, so the more realisting way of updating products would be products.each(&:queue_disable!) which would simply toss 5000 new tasks to the working queue. The problem of 5000 category updates still exists though. Is there a way to avoid all those updates on the db? How can we concatenate all the category.products_updated for each category in the queue?

    Read the article

  • Jquery change name attribute

    - by kevin
    Hi thereive got a jquery function that attempts to change the id, name and class of an elements the id and class change seems to work but for some curious reason, trying to change the name of the element never works, the code is below, any clues would be helpful $(document).ready(function () { $("table select").live("change", function () { var id = $(this).attr('id'); if ($(this).attr('classname') != "selected") { var rowIndex = $(this).closest('tr').prevAll().length; $.getJSON("/Category/GetSubCategories/" + $(this).val(), function (data) { if (data.length > 0) { $("#" + id).attr('classname', 'selected'); $("#" + id).attr('id', 'sel' + rowIndex); $("#" + id).attr('name', 'sel' + rowIndex); // this never works var position = ($('table').get(0)); var tr = position.insertRow(rowIndex + 1); var td1 = tr.insertCell(-1); var td2 = tr.insertCell(-1); td1.appendChild(document.createTextNode('SubCategory')); var sel = document.createElement("select"); sel.name = 'parent_id'; sel.id = 'parent_id'; sel.setAttribute('class', 'unselected'); td2.appendChild(sel); $.each(data, function (GetSubCatergories, Category) { $('#parent_id').append($("<option></option>"). attr("value", Category.category_id). text(Category.name)); }); } }); } }); });

    Read the article

  • JavaScript: Changing src-attribute of a embed-tag

    - by Mike
    I have the following scenario. I show the user some audio files from the server. The user clicks on one, then onFileSelected is eventually executed with both the selected folder and file. What the function does is change the source from the embedded object. So in a way, it is a preview of the selected file before accepting it and save the user's choice. A visual aid. HTML <embed src="/resources/audio/_webbook_0001/embed_test.mp3" type="audio/mpeg" id="audio_file"> JavaScript function onFileSelected(file, directory) { jQuery('embed#audio_file').attr('src', '/resources/audio/'+directory+'/'+file); }; Now, this works fine in Firefox, but Safari and Chrome simply refuse to change the source, regardless of Operating System. jQuery finds the object (jQuery.size() returns 1), it executes the code, but no change in the HTML Code. Why does Safari prevent me from changing the <embed> source and how can I circumvent this?

    Read the article

  • SQL Server Composite Primary Keys

    - by Colin
    I am attempting to replace all records for a give day in a certain table. The table has a composite primary key comprised of 7 fields. One such field is date. I have deleted all records which have a date value of 2/8/2010. When I try to then insert records into the table for 2/8/2010, I get a primary key violation. The records I am attempting to insert are only for 2/8/2010. Since date is a component of the PK, shouldn't there be no way to violate the constraint as long as the date I'm inserting is not already in the table? Thanks in advance.

    Read the article

  • Creating attribute sets and attributes programatically magento

    - by digital_paki
    I am using the code listed on the following link =: http://www.magentocommerce.com/wiki/5_-_modules_and_development/catalog/programmatically_adding_attributes_and_attribute_sets Everything works until the point: // Just add a default group. else { $this->logInfo("Creating default group [{$this->groupName}] for set."); $modelGroup = Mage::getModel('eav/entity_attribute_group'); $modelGroup->setAttributeGroupName($this->groupName); $modelGroup->setAttributeSetId($id); // This is optional, and just a sorting index in the case of // multiple groups. // $modelGroup->setSortOrder(1); $model->setGroups(array($modelGroup)); } I am unsure where the object reference would need to be set from - I am attempting to have this as a separate file that can be automated - I am running this file by doing a require_once 'app/Mage.php'; Mage::app(); Any help in this would be greatly appreciated Thanks

    Read the article

  • Rspec and Rails 3 - Problem Validating Nested Attribute Collection Size

    - by MunkiPhD
    When I create my Rspec tests, I keep getting a validation of false as opposed to true for the following tests. I've tried everything and the following is the measly code that I have now - so if it's waaaaay wrong, that's why. class Master < ActiveRecord::Base attr_accessible :name, :specific_size # Associations ---------------------- has_many :line_items accepts_nested_attributes_for :line_items, :allow_destroy => true, :reject_if => lambda { |a| a[:item_id].blank? } # Validations ----------------------- validates :name, :presence => true, :length => {:minimum => 3, :maximum => 30} validates :specific_size, :presence => true, :length => {:minimum => 4, :maximum => 30} validate :verify_items_count def verify_items_count if self.line_items.size < 2 errors.add(:base, "Not enough items to create a master") end end end And here it the items model: class LineItem < ActiveRecord::Base attr_accessible :specific_size, :other_item_type_id # Validations -------------------- validates :other_item_type_id, :presence => true validates :master_id, :presence => true validates :specific_size, :presence => true # Associations --------------------- belongs_to :other_item_type belongs_to :master end The RSpec Tests: before(:each) do @master_lines = [] @master_lines << LineItem.new(:other_item_type_id => 1, :master_id => 2, :specific_size => 1) @master_lines << LineItem.new(:other_item_type_id => 2, :master_id => 2, :specific_size => 1) @attr = {:name => "Some Master", :specific_size => "1 giga"} end it "should create a new instance given a valid name and specific size" do @master = Master.create(@attr) line_item_one = @master.line_items.build(:other_item_type_id => 1, :specific_size => 1) line_item_two = @master.line_items.build(:other_item_type_id => 2, :specific_size => 2) @master.line_items.size === 2 @master.should be_valid end it "should have at least two items to be valid" do master = Master.new(:name => "test name", :specific_size => "1 mega") master_item_one = LineItem.new(:other_item_type_id => 1, :specific_size => 2) master_item_two = LineItem.new(:other_item_type_id => 2, :specific_size => 1) master.line_items << master_item_one master.should_not be_valid master.line_items << master_item_two master.line_items.size.should === 2 master.should be_valid end I'm very new to Rspec and Rails - and I've been failing at this for the past couple of hours. Thanks for any help in advance.

    Read the article

  • Get Array value by string of keys

    - by Esben Petersen
    Hello, i'm building a template engine for my next project, which is going great. It replaces {tag} with a corresponding value. But, i want {tag[0][key]} to be replaced as well. All i need to know is how to get the value, if i have the string representation of the array and key, like this: $arr = array( 0=>array( 'key'=>'value' ), 1=>array( 'key'=>'value2' ) ); $tag = 'arr[0][key]'; echo($$tag); This is a very simple version of the problem, i hope you understand it. Or else i would be happy to anwser any questions about it :) Thanks for any help in advantage

    Read the article

  • Accessing value attribute in Protovis lines

    - by Luce
    I'm using Protovis Arc layout and I'd like to color links between nodes accoriding to the 'value' property defined in dataset. How can I access it? Dataset is defined like that: Nodes: ... {nodeName:"Books"} ... Links: ... {source:1, target:4, value:20} ... arc.link.add(pv.Line).strokeStyle(function(d) d.value 10 ? "#cc0000" : "#eeeeee"); - does not work

    Read the article

  • Sorting XML file by attribute

    - by LibraRocks
    Hi, I have a following XML code: <Group> <GElement code="x"> <Group> <GElement code="x"> <fname>a</fname> <lname>b</lname> </GElement> <GElement code ="f"> <fname>fa</fname> </GElement> </Group> </GElement> <GElement code ="f"> </GElement> </Group> I would like to have the output sorted by "code" like: <Group> <GElement code ="f"> </GElement> <GElement code="x"> <Group> <GElement code ="f"> <fname>fa</fname> </GElement> <GElement code="x"> <fname>a</fname> <lname>b</lname> </GElement> </Group> </GElement> </Group> The depth of the tree can be endless i.e. the GElement can have another Group and so on. Any ideas?

    Read the article

  • What's wrong with foreign keys?

    - by kronoz
    I remember hearing Joel mention in the podcast that he'd barely ever used a foreign key (if I remember correctly). However, to me they seem pretty vital to avoid duplication and subsequent data integrity problems throughout your database. Do people have some solid reasons as to why (to avoid a discussion in lines with SO principals)? Edit: "I've yet to have a reason to create a foreign key, so this might be my first reason to actually set up one."

    Read the article

  • Session scoped bean as class attribute of Spring MVC Controller

    - by Sotirios Delimanolis
    I have a User class: @Component @Scope("session") public class User { private String username; } And a Controller class: @Controller public class UserManager { @Autowired private User user; @ModelAttribute("user") private User createUser() { return user; } @RequestMapping(value = "/user") public String getUser(HttpServletRequest request) { Random r = new Random(); user.setUsername(new Double(r.nextDouble()).toString()); request.getSession().invalidate(); request.getSession(true); return "user"; } } I invalidate the session so that the next time i got to /users, I get another user. I'm expecting a different user because of user's session scope, but I get the same user. I checked in debug mode and it is the same object id in memory. My bean is declared as so: <bean id="user" class="org.synchronica.domain.User"> <aop:scoped-proxy/> </bean> I'm new to spring, so I'm obviously doing something wrong. I want one instance of User for each session. How?

    Read the article

  • How many keys are too many in memcached?

    - by jack
    I currently have about 650,000 items in memcached (430MB memory used) and the number is still increasing. It's expected to exceed 1,000,000 items before going flat. Current hit/miss ratio is 25:1 so the efficiency is pretty good. I just wanted to ask is one million items in memcached on single server too many? If no, how many is too many?

    Read the article

  • NHibernate SchemaUpdate adding existing foreign keys again?

    - by afsharm
    I'm using SchemaUpdate to synchronize my hbms with existing database. Database has recently created based on hbms and is completely up-to-date. But SchemaUpdate generates all foreign key constraints again. For example suppose you have Student and Teacher. Student has association to Teacher with name ArtTeacher. ArtTeacher is a foreign key from Student to Teacher. Suppose database is up-to-date and currently holde Student, Teacher and their foreign key relation. So HBM and Database are equivalent. Know SchemaUpdate must not do anything but when I see its generated scripts, it re-produce that foreign key again. Why this happens? Is there any way to avoid it?

    Read the article

  • step attribute not working with HTML5 <input type="range"> on Safari

    - by Claudiu
    Are there known issues with range inputs not working fully on Safari? I have the following input element: <input type=?"range" min=?"0" max=?"360" step=?"0.0001" value=?"0">? On Chrome, the input goes according to the step variable. On Safari, it only goes by integer values. Even setting the step to 10 still makes it go by increments of 1. I'm confused because I thought Chrome and Safari both used WebKit.

    Read the article

  • Converting keys of an array/object-tree to lowercase

    - by tstenner
    Im currently optimizing a PHP application and found one function being called around 10-20k times, so I'd thought I'd start optimization there. function keysToLower($obj) { if(!is_object($obj) && !is_array($obj)) return $obj; foreach($obj as $key=>$element) { $element=keysToLower($element); if(is_object($obj)) { $obj->{strtolower($key)}=$element; if(!ctype_lower($key)) unset($obj->{$key}); } else if(is_array($obj) && ctype_upper($key)) { $obj[strtolower($key)]=$element; unset($obj[$key]); } } return $obj; } Most of the time is spent in recursive calls (which are quite slow in PHP), but I don't see any way to convert it to a loop. What would you do?

    Read the article

  • MySQLi String comparisons using keys

    - by asdasd
    I have a table with lets say 2 columns. id number, and value. Value is a string (var char). Lets say i have a number x, and a list of numbers a1, a2, a3, a4, a5..... where x is not in the list. All of these numbers correspond to a unique row in the table. I want to know if the string value for x in the table is contained in one of the string values for any table entry for a1, a2, a3, a4... Lets say i have these rows: x, aaa a1, bbb a2, ccc a3, ddd a4, aaabbbcc then i want somehow a confirmation that yes, the value for x is included in one of the values in my list of numbers (a4 contains x). I know i can do this in a couple queries and shove it down some PHP and get my answer. But can i do this with one query?

    Read the article

< Previous Page | 63 64 65 66 67 68 69 70 71 72 73 74  | Next Page >