Search Results

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

Page 97/433 | < Previous Page | 93 94 95 96 97 98 99 100 101 102 103 104  | Next Page >

  • Xpath problem, i have a question about if i can get a elements attribute, if i know what a elements value is.

    - by user577823
    Hi guys, This is the xml file, And my question is, is it possible to get the Article ID, when you have the title of the article?(via xpath) ` crack jack ` Because i am using this right now, it isnt working though. $xml = simplexml_load_file("Articles.xml"); $XElement = new SimpleXMLElement($xml-asXML()); $Articles = $XElement-xpath("Article"); $title = "crack"; $elements = count($Articles); for($i = 0; $i title; if($Titles == $title) //This is not working? i dont know why? { $AID = (string)$Articles[$i][@"ID"]; } } Kind regards, User577823

    Read the article

  • What's the best way to get a bunch of rows from MySQL if you have an array of integer primary keys?

    - by Evan P.
    I have a MySQL table with an auto-incremented integer primary key. I want to get a bunch of rows from the table based on an array of integers I have in memory in my program. The array ranges from a handful to about 1000 items. What's the most efficient query syntax to get the rows? I can think of a few: "SELECT * FROM thetable WHERE id IN (1, 2, 3, 4, 5)" (this is what I do now) "SELECT * FROM thetable where id = 1 OR id = 2 OR id = 3" Multiple queries of the form "SELECT * FROM thetable WHERE id = 1". Probably the most friendly to the query cache, but expensive due to having lots of query parsing. A union, like "SELECT * FROM thetable WHERE id = 1 UNION SELECT * FROM thetable WHERE id = 2 ..." I'm not sure if MySQL caches the results of each query; it's also the most verbose format. I think using the NoSQL interface in MySQL 5.6+ would be the most efficient way to do this, but I'm not yet up to MySQL 5.6.

    Read the article

  • Why is jQuery's .removeClass() adding a space to the class attribute?

    - by Sosh
    I'm having some strange issues with .removeClass() and .addClass() in jQuery. Specifically it seems that when I use .removeClass() the class is indeed removed, but a single space is left in it's place. then when I .addClass("secondclass") I get class=" secondclass" (with the space in front). I'm using jQuery 1.4.1 Is this intended behaviour or a bug? How to stop it?

    Read the article

  • Possible to lock attribute write access by Doors User?

    - by Philip Nguyen
    Is it possible to programmatically lock certain attributes based on the user? So certain attributes can be written to by User2 and certain attributes cannot be written to by User2. However, User1 may have write access to all attributes. What is the most efficient way of accomplishing this? I have to worry about not taking up too many computational resources, as I would like this to be able to work on quite large modules.

    Read the article

  • What does the length attribute do when set on the @Column JPA annontation?

    - by James McMahon
    What exactly does setting the length on a column do in JPA? @Column(name = "middle_name", nullable = false, length = 32) public String getMiddleName() { return this.middleName; } I understand that you can use the annotations to generate the database schema based on the entity objects, but does length do any sort of check or truncation when persistence happens, or it solely used for schema creation? I also realize that JPA can sit on top of various implementations, the implementation I am concerned with in this case, is Hibernate.

    Read the article

  • Why Hibernates ignores the name attribute of the @Column annotation?

    - by svachon
    Using Hibernate 3.3.1 and Hibernate Annotations 3.4, the database is DB2/400 V6R1, running that on WebSphere 7.0.0.9 I have the following class @Entity public class Ciinvhd implements Serializable { @Id private String ihinse; @Id @Column(name="IHINV#") private BigDecimal ihinv; .... } For reasons I can't figure, Hibernate ignores the specified column name and uses 'ihinv' to generate the SQL: select ciinvhd0_.ihinse as ihinse13_, ciinvhd0_.ihinv as ihinv13_, ... Which of course gives me the following error: Column IHINV not in table CIINVHD Did anyone had this problem before? I have other entities that are very alike in the way that they are using # in their database field names and that are part of the PK and I don't have this problem with them.

    Read the article

  • How to coerce type of ActiveRecord attribute returned by :select phrase on joined table?

    - by tribalvibes
    Having trouble with AR 2.3.5, e.g.: users = User.all( :select => "u.id, c.user_id", :from => "users u, connections c", :conditions => ... ) Returns, e.g.: => [#<User id: 1000>] >> users.first.attributes => {"id"=>1000, "user_id"=>"1000"} Note that AR returns the id of the model searched as numeric but the selected user_id of the joined model as a String, although both are int(11) in the database schema. How could I better form this type of query to select columns of tables backing multiple models and retrieving their natural type rather than String ? Seems like AR is punting on this somewhere. How could I coerce the returned types at AR load time and not have to tack .to_i (etc.) onto every post-hoc access?

    Read the article

  • Rails 3: Create an instance with 3 foreign keys.

    - by donald
    Hello, Having a reviews table: # Table name: reviews # # id :integer not null, primary key # wsp_id :integer # service_id :integer # user_id :integer # description :text # rating :integer # created_at :datetime # updated_at :datetime # belongs_to :wsp belongs_to :service belongs_to :user How can I create a review for a service and pass the wsp_id and user_id? Do I need to use nested routes? I am able to do @user.reviews.new(params[:review]) but I'm not being able of passing the wsp_id and the service_id. Here's my Reviews create controller. def create @review = current_user.reviews.new(params[:review]) if @review.save #Saved else #Error, not saved end end What am I doing wrong? Thank you!

    Read the article

  • How to handle ids and polymorphic associations in views if compound keys are not supported?

    - by duncan
    I have a Movie plan table: movie_plans (id, description) Each plan has items, which describe a sequence of movies and the duration in minutes: movie_plan_items (id, movie_plan_id, movie_id, start_minutes, end_minutes) A specific instance of that plan happens in: movie_schedules (id, movie_plan_id, start_at) However the schedule items can be calculated from the movie_plan_items and the schedule start time by adding the minutes create view movie_schedule_items as select CONCAT(p.id, '-', s.id) as id, s.id as movie_schedule_id, p.id as movie_plan_item_id, p.movie_id, p.movie_plan_id, (s.start_at + INTERVAL p.start_minutes MINUTE) as start_at, (s.start_at + INTERVAL p.end_minutes MINUTE) as end_at from movie_plan_items p, movie_schedules s where s.movie_plan_id=p.movie_plan_id; I have a model over this view (readonly), it works ok, except that the id is right now a string. I now want to add a polymorphic property (like comments) to various of the previous tables. Therefore for movie_schedule_items I need a unique and persistent numeric id. I have the following dilemma: I could avoid the id and have movie_schedule_items just use the movie_plan_id and movie_schedule_id as a compound key, as it should. But Rails sucks in this regard. I could create an id using String#hash or a md5, thus making it slower or collision prone (and IIRC String#hash is no longer persistent across processes in Ruby 1.9) Any ideas on how to handle this situation?

    Read the article

  • [Django] How do I filter the choices in a ModelForm that has a CharField with the choices attribute

    - by nubela
    I understand I am able to filter queryset of Foreignkey or Many2ManyFields, however, how do I do that for a simple CharField that is a Select Widget (Select Tag). For example: PRODUCT_STATUS = ( ("unapproved", "Unapproved"), ("approved", "Listed"), #("Backorder","Backorder"), #("oos","Out of Stock"), #("preorder","Preorder"), ("userdisabled", "User Disabled"), ("disapproved", "Disapproved by admin"), ) and the Field: o_status = models.CharField(max_length=100, choices=PRODUCT_STATUS, verbose_name="Product Status", default="approved") Suppose I wish to limit it to just "approved" and "userdisabled" instead showing the full array (which is what I want to show in the admin), how do I do it? Thanks!

    Read the article

  • Nested Resource - How to pass needed keys, and attribute to update?

    - by Jason B
    My nested resources are working for form_for updates, but I have a few toggles that I need to setup to change a status field. So I am using link_to, and accessing the url helper. link_to "toggle", edit_project_expense_path(@project[:id],expense_item[:id]) routes.rb resources :projects do resources :expenses end match '/submit_expense/:id' => 'expenses#submit_expense', :as => 'submit_expense' rake routes edit_project_expense GET /projects/:project_id/expenses/:id/edit(.:format) expenses#edit My question is: How can I also send along :approval_status = "1", with my link_to?

    Read the article

  • jQuery, wont change value but will change any othere attribute...

    - by Phil Jackson
    function send_mail( token, loader ) { $(".send_mail").bind( "click", function() { try{ var to = $(this).attr('ref'); var mail_form = $("#mail_form"); mail_form.find("li:eq(0) input").val("sdsds"); //mail_form.find("li:eq(0) input").attr("ref", "sdsds"); //mail_form.find("li:eq(0) input").attr("value", "sdsds"); $.fancybox(mail_form.html(), { 'autoDimensions' : false, 'width' : 360, 'height' : 200, 'transitionIn' : 'none', 'transitionOut' : 'none', 'scrolling' : 'no', 'showCloseButton' : false }); return false; }catch(err){alert(err);} }); } My problem being that the above will not work yet if I use //mail_form.find("li:eq(0) input").attr("ref", "sdsds"); it will change the ref and even //mail_form.find("li:eq(0) input").attr("value", "sdsds"); will not work... Any ideas whats happening here?

    Read the article

  • C# form - checkboxes do not respond to plus/minus keys - easy workaround?

    - by Scott
    On forms created with pre dotNET VB and C++ (MFC), a checkbox control responded to the plus/minus key without custom programming. When focus was on the checbox control, pressing PLUS would check the box, no matter what the previous state (checked/unchecked), while pressing MINUS would uncheck it, no matter the previous state. C# winform checkboxes do not seem to exhibit this behavior. Said behavior was very, very handy for automation, whereby the automating program would set focus to a checkbox control and issue a PLUS or MINUS to check or uncheck it. Without this capability, that cannot be done, as the automation program (at least the one I am using) is unable to query the current state of the checkbox (so it can decide whether to issue a SPACE key to toggle the state to the desired one). I've gone over the properties of a checkbox in the Visual Studio 2008 IDE and could not find anything that would restore/enable response to PLUS/MINUS. Since I am in control of the sourcecode for the WinForms in question, I could replace all checkbox controls with a custom checkbox control, but blech, I'd like to avoid that - heck, I don't think I could even consider that given the amount of refactoring that would need to be done. So the bottom line is: does anyone know of a way to get this behavior back more easily than a coding change?

    Read the article

  • PHP Regex. How to remove all element anchor tags but keep anchor tags with certain href attribute contain JPG|PNG|GIF

    - by namaku doni
    input <a href="http://mysite.com">My Site</a> <a href="http://mysite.com/image.jpg"><img src="http://mysite.com/image.jpg"/></a> <a href="http://mysite.com/image.gif"><img src="http://mysite.com/image.gif"/></a> <a href="http://yoursite.com">Your Site</a> output <a href="http://mysite.com/image.jpg"><img src="http://mysite.com/image.jpg"/></a> <a href="http://mysite.com/image.gif"><img src="http://mysite.com/image.gif"/></a> Thank's for help

    Read the article

  • How to take value from radio selection and pass that value into a hidden inputs value attribute?

    - by Matthew
    Hello guys, I need to know if this can be done and if so can someone push me in the right direction. Okay I have a series of radio buttons: <input type="radio" name="level_id" id="radio1" value="XXXX" class="radio1" /> <label for="radio1">choice 1</label> <input type="radio" name="level_id" id="radio2" value="XXXX" class="radio2" /> <label for="radio2">choice 2</label> <input type="radio" name="level_id" id="radio3" value="XXXX" class="radio3" /> <label for="radio3">choice 3</label> <label for="radio4">second choice1</label> <input type="radio" name="level_id" id="radio4" value="1" class="radio4" /> <label for="radio5">second choice2</label> <input type="radio" name="level_id" id="radio5" value="2" class="radio5" /> <label for="radio6">second choice3</label> <input type="radio" name="level_id" id="radio6" value="3" class="radio6" /> Now what I am looking to do is if someone selects CHOICE 1 and then selects SECOND CHOICE1 I would like to pass the value of SECOND CHOICE1 into the value of a hidden input. <input type="hidden" name="sub_source" id="sub_source" value="" /> So that when the form is ready to submit the value that gets passed would be: <input type="hidden" name="sub_source" id="sub_source" value="1" />

    Read the article

  • Entity diagram with tables that have foreign keys that point to a non-PK column do not show relation

    - by Jason Coyne
    I have two tables parent and child. If I make a foreign key on child that points to the primary key of parent, and then make an entity diagram, the relationship is shown correctly. If I make the foreign key point to a different column, the relationship is not shown. I have tried adding indexes to the column, but it does not have an effect. The database is sqlite, but I am not sure if that has an effect since its all hidden behind ADO.net. How do I get the relationship to work correctly?

    Read the article

  • How to avoid Foreign Keys constraints for all tables in DB truncate ?

    - by eugeneK
    Hi, for designing purposes i need to truncate all DB which has lots of FK's. I cannot use DELETE command simply because some tables set with Identity of TinyInts and contain about 150 items. this is a query ( truncate all tables in selected DB ) i'm trying to run Declare @t varchar (1024) Declare tbl_cur cursor for select TABLE_NAME from INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' OPEN tbl_cur FETCH NEXT from tbl_cur INTO @t WHILE @@FETCH_STATUS = 0 BEGIN EXEC ('TRUNCATE TABLE '+ @t) FETCH NEXT from tbl_cur INTO @t END CLOSE tbl_cur DEALLOCATE tbl_Cur What the best and easiest way to achieve truncate on DB with many FK's ?

    Read the article

< Previous Page | 93 94 95 96 97 98 99 100 101 102 103 104  | Next Page >