Posts

c# - Restrict QueryOver by child collection using nHibernate -

i trying parent entity entities in child collection in list. for example: public class parent { public virtual int id {get;set;} public virtual list<child> children {get;set;} } public class child { public virtual int id {get;set;} public virtual string name {get;set;} } i've tried various combinations of joins , restrictions can't seem hit spot. so please suggestions. current example below: public ilist<lead> getallavailable(string[] names) { var result = session.createcriteria<parent>() .createcriteria("children") .add(expression.in("name", names)).list<parent>(); return result; } edit: this sql equivilent: select * dbo.parent join ( select p.id dbo.parent p join dbo.parenttochildren on p.id = dbo.parentstochildren.parent_id join dbo.child on dbo.parenttochildren.child_id = d...

c# - Listen for MediaEnded event in another window -

i'm making simple c# wpf video player app. i have 2 windows: mainwindow (parent window) contains mediaelement display video. playlistwindow (child window) window contains listbox displays .avi files in approot path. currently, when double-click on listbox item, plays video in mainwindow. have auto-play feature next item in list automatically played when current video ends. i playlistwindow listen mediaended event triggered mediaelement in mainwindow can perform action on listbox in playlistwindow. how can subscribe mediaended event playlistwindow? edit add: ended using different approach shown below. don't think best way it, works me. public partial class mainwindow : window { playlistwindow plwindow = new playlistwindow(); public mainwindow() { initializecomponent(); } private void mainwindow_loaded(object sender, routedeventargs e) { plwindow.owner = this; plwindow.show(); } private void videowindow_...

jasper reports - Fixed header in Excel using JasperReports -

how can create excel report fixed header using japserreports? mean need header fixed when scroll excel file. this possible adding couple properties in jrxml file each report. take @ advanced excel features freeze panes. if wanted freeze after first column header (down left side basically) this: <statictext> <reportelement style="sans_bold" mode="opaque" x="0" y="60" width="104" height="20" forecolor="#ffffff" backcolor="#666666"> <property name="net.sf.jasperreports.export.xls.auto.filter" value="start"/> <property name="net.sf.jasperreports.export.xls.column.width" value="110"/> <property name="net.sf.jasperreports.export.xls.freeze.column.edge" value="left"/> </reportelement> ...

arrays - How to do typeof object[*] in C#? -

i'm new c# have searched web hour , no joy... i need ascertain whether object non-zero index array, i.e. object[*] i've tried: if(v != null && v.gettype() == typeof(object[*])) and if(v object[*]) as overloaded methods method(object v) , method(object[*] v) all result in compilation errors. as can't cast object[*] object[] , test getlowerbound(0) how hell can test type? (please don't tell me bad code/design, it's coming excel cannot change that). try type.isarray , type.getarrayrank , type.getelementtype if necessary. if need call getlowerbound can safely cast object system.array .

iphone - iOS RestKit what is the purpose of [mappingProvider setMapping:forKeyPath:] method? -

i'm working through restkit relationship mapping example , cannot understand purpose of these method calls , or if there's typo in calls. refer to? when object loader encounter content @ these key paths? [objectmanager.mappingprovider setmapping:usermapping forkeypath:@"user"]; [objectmanager.mappingprovider setmapping:taskmapping forkeypath:@"task"]; [objectmanager.mappingprovider setmapping:projectmapping forkeypath:@"project"]; the json file being loaded data has 3 objects: project, tasks , user. note tasks plural . there 3 entities defined in core data model : user, task , project. these start capital letters. finally, nsmanagedobject classes derived data model have relationships: task>assigneduser , user>tasks , project being regular nsobject should @"task" @"tasks"? @implementation rkrelationshipmappingexample - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil { s...

ISO 8601 Date Formatter in Objective for iPhone not setting offset correctly -

thank in advance help. i trying create iso 8601 date formatter iphone application , can not offset come out correctly. need result time zone in gmt , located in est , when tested @ 2:33 pm march 6th 2012 got 2012-03-06t14:33:35+0000 due zone difference need -05:00 show instead of +0000 the code using is: nsdateformatter* dateformatter = [[nsdateformatter alloc] init]; [dateformatter setdateformat:@"yyyy-mm-dd't'hh:mm:ss zz"]; nstimezone *gmt = [nstimezone timezonewithabbreviation:@"gmt"]; [dateformatter settimezone:gmt]; nnsdate *gmtdate = [[nsdate alloc] init]; datestring = [dateformatter stringfromdate:gmtdate]; nslog(@"date string: %@", datestring); have tried setting time zone est? give -0500

osx - Alternatives to _blocksActionWhenModal Cocoa private method? -

our os x application shows modal forms @ times, , 1 of downsides of modal forms menu items don't work when have modal form visible. can click menu item normal, no selectors called on target. this bad because if there's modal form showing, want user able command-q quit app, normal apps on on os x. however, there undocumented method _blocksactionwhenmodal returns yes default. if override return no, menu items start working on modal forms, means can handled properly. i'd find alternative this, i'd prefer not use undocumented method (as apple change new os release). there way of achieving same result here? "not using modal forms" isn't option. for 10.6+, use [nswindow setpreventsapplicationterminationwhenmodal:] on modal window allow quit.