Posts

Featured post

java - Are there any classes that implement javax.persistence.Parameter<T>? -

i'm using named queries fetch entities database using jpa , hibernate , came across puzzling me: how come there no default implementations of javax.persistence.parameter interface? i rather impressed how @staticmetamodel used criteriabuilder in jpa2 meaning type safety , don't have mess around setting string names. wanted apply similar of jpa1 ejb's i'm working on: dealergroup_.class: public dealergroup_ { public parameter<integer> id = new parameterimpl<integer>("id"); /// etc... } dealergroupfacade.class: // ... public dealergroup fetch(integer id) { typedquery<dealergroup> query = em.createnamedquery("dealergroup.fetchbyid", dealergroup.class); query.setparameter(dealergroup_.id, query); return query.getsingleresult(); } // ... i surprised find there no implementations of parameter interface - of course, implement myself absence makes me suspicious may mistake using in way? should implementing parameter

ruby on rails - 2 way delete relationship -

i have user_relations table. user_id | related_user_id ------------------------- 1 | 15 1 | 17 4 | 56 15 | 1 5 | 34 when destroy row (1 | 15) , want rails automatically delete parallel row (15 | 1) . is there rails way of doing this? this user_relation class: class userrelation < activerecord::base belongs_to :user, :class_name => "user", :foreign_key => "user_id" belongs_to :related_user, :class_name => "user", :foreign_key => "related_user_id" end yes, can write filter in userrelation model, after_destroy :delete_associated def delete_associated ur = userrelations.find_by_related_user_id_and_user_id(related_user_id, user_id) ur.delete if ur end update: to create associated record can write filter this, after_create :create_associated def create_associated userrelations.find_or_create_by_related_user_id_and_user_id(related_user_id, user_id) #check if exist

c# - ToolTip MouseOver function on text in RichTextBox -

Image
this question has answer here: displaying tooltip on mouse hover of text 7 answers im working on code-editor (windows form) , want know how make tooltip in text 1: sample when mousehover text "" tooltip show when mouseleave tooltip gone .or if mouseover different text, text in tooltip inside change . just in actual code-editor. with sample code? tooltip1.autopopdelay = 5000; tooltip1.initialdelay = 1000; tooltip1.reshowdelay = 500; //tooltip1.showalways = true; tooltip1.tooltiptitle = "<)( text tooltip )(>"; tooltip1.usefading = true; tooltip1.useanimation = true; anyone? pls in need .thanks . set tooltip control want show when hovers on it: mytooltip.show("tooltip text goes here", mybutton) or this.tooltip1.settooltip(this.targetcontrol, "my tool tip&

less - Sprites in LESSC -

is there addon lessc allow me to like: less .icon-xyz{ .sprite('image1.png'); } .icon-abc{ .sprite('image2.png'); } that outputs merged sprite in production mode, , stays individual images in development mode? similar how compass works sass there addon node.js: less-sprites. https://github.com/polycode/less-sprites it requires install imagemagick firstly.

mysql - How to achieve unique auto-incremented id for rows across multiple tables? -

i've got several tables in database, let's they're called table1, table 2, etc. tables have primary key column 'id' auto-increment. in current configuration happens when inserting table1, generated id 1. afterwards when inserting table2, generated id happens 1 well. how force absolutely unique ids across tables in database? want when inserting table1, generated id 1, , if afterwards inserting table2, generated id 2? i used mysql server on machine , did not have problem, when installed mysql on local machine, started occur. guess must kind of setting applied mysql configuration? thank you you can use uuid. insert mytable(id, name) values(select uuid(), 'some data'); read more uuid: http://mysqlbackupnet.codeplex.com/wikipage?title=using%20mysql%20with%20guid%20or%20uuid

c# - Dynamically looping through controls has no effect -

i have gui class. pass frmmain (form) gui contructor. have following method access child controls: public void assignevents(frmmain frm) { foreach (control ctl in frm.controls) { ctl.backcolor = color.greenyellow; log.adddata(ctl.name.tostring() + ".backcolor = " + ctl.backcolor.tostring(), 3); } } i new updated color in output (log), takes no effect on controls , still in default color. ideas i'm doing wrong? edit: i call this: // gui.cs public class gui { public gui(frmmain frm){ assignevents(frm); } } // frmmain.cs public frmmain() { initializecomponent(); gui = new m.gui (this); } based on comment, need try go recursively through each controlcollection set backcolor property. try changing code this: public gui(frmmain frm) { assignevents(frm.controls); } public void assignevents(control.controlcollection controls) { foreach (control

javascript - JQuery Modal Dialog with drop-down list and textarea embedded -

i'm new jquery forgive me if easy question. i trying create dialog box, onclick event, comprises of: 1) drop down list 2) text area (height possibly 300px) 3) yes/no buttons i have got stage can display dialog yes/no buttons, struggling include dropdown , textarea field. current code: function placeorder() { if ($('#dialogdiv').length == 0) { $('body').append("<div id='dialogdiv'><div/>"); } var dialogdiv = $('#dialogdiv'); dialogdiv.attr("title", "are sure want place order."); dialogdiv.html("are sure want place order? please select delivery option drop down , enter special requirements in text field."); dialogdiv.dialog({ modal : true, buttons : [ { text : "yes", class : 'green', click : function() { // functionality. }