Search Results

Search found 974 results on 39 pages for 'outer'.

Page 33/39 | < Previous Page | 29 30 31 32 33 34 35 36 37 38 39  | Next Page >

  • Where clause on joined table used for user defined key/value pairs

    - by Steve Wright
    Our application allows administrators to add “User Properties” in order for them to be able to tailor the system to match their own HR systems. For example, if your company has departments, you can define “Departments” in the Properties table and then add values that correspond to “Departments” such as “Jewelry”, “Electronics” etc… You are then able to assign a department to users. Here is the schema: In this schema, a User can have only one UserPropertyValue per Property, but doesn’t have to have a value for the property. I am trying to build a query that will be used in SSRS 2005 and also have it use the PropertyValues as the filter for users. My query looks like this: SELECT UserLogin, FirstName, LastName FROM Users U LEFT OUTER JOIN UserPropertyValues UPV ON U.ID = UPV.UserID WHERE UPV.PropertyValueID IN (1, 5) When I run this, if the user has ANY of the property values, they are returned. What I would like to have is where this query will return users that have values BY PROPERTY. So if PropertyValueID = 1 is of Department (Jewelry), and PropertyValueID = 5 is of EmploymentType (Full Time), I want to return all users that are in Department Jewelry that are EmployeeType of Full Time, can this be done? Here's a full data example: User A has Department(Jewelry value = 1) and EmploymentType(FullTime value = 5)User B has Department(Electronics value = 2) and EmploymentType(FullTime value = 5)User C has Department(Jewelry value = 1) and EmployementType(PartTime value = 6) My query should only return User A using the above query UPDATE: I should state that this query is used as a dataset in SSRS, so the parameter passed to the query will be @PropertyIDs and it is defined as a multi-value parameter in SSRS. WHERE UPV.PropertyValueID IN (@PropertyIDs)

    Read the article

  • Retrieve only the superclass from a class hierarchy

    - by user1792724
    I have an scenario as the following: @Entity @Table(name = "ANIMAL") @Inheritance(strategy = InheritanceType.JOINED) public class Animal implements Serializable { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "S_ANIMAL") @SequenceGenerator(name = "S_ANIMAL", sequenceName = "S_ANIMAL", allocationSize = 1) public int getNumero() { return numero; } public void setNumero(int numero) { this.numero = numero; } . . . } and as the subclass: @Entity @Table(name = "DOG") public class Dog extends Animal { private static final long serialVersionUID = -7341592543130659641L; . . . } I have a JPA Select statement like this: SELECT a FROM Animal a; I'm using Hibernate 3.3.1 As I can see the framework retrieves instances of Animal and also of Dog using a left outer join. Is there a way to Select only the "part" Animal? I mean, the previous Select will get all the Animals, those that are only Animals but not Dogs and those that are Dogs. I want them all, but in the case of Dogs I want to only retrieve the "Animal part" of them. I found the @org.hibernate.annotations.Entity(polymorphism = PolymorphismType.EXPLICIT) but as I could see this only works if Animal isn't an @Entity. Thanks a lot.

    Read the article

  • How to update child iFrame's entire html (header+body) inside jQuery's post

    - by knappy
    I have a chat webpage for Firefox that is structured like this ..... Outer HTML -----|......Frameset Frame ------------|...... header: contains jQuery post has returned data: rdata = new_iFrame_html_str, the entire html string of the iFrame that should be updated ------------|...... iFrame --------------------|...... header: contains jQuery --------------------|...... body: chat messages that depends on the header jQuery to behave properly QUESTION: I can't this jQuery post to work, i.e. I can't find a way for this post to update the ENTIRE iFrame (header + body). Things I've tried and FAILED with javascript and jQuery: top.frames['framesetFrame_name'].document.getElementById('iframe_id').contentDocument.body.innerHTML = new_iFrame_html_str; I don't like this because it's only changing the body, not the header, so the behavior generated from jQuery can't be shown top.frames['framesetFrame_name'].document.getElementById('iframe_bucinid').contentWindow.location.reload(); I do not want to reload because a reload makes the iFrame flicker, bad for a chat program top.frames['framesetFrame_name'].document.getElementById('iframe_id').contents().html = new_iFrame_html_str; Not updating anything that shows :( top.frames['framesetFrame_name'].document.getElementById('iframe_id').contentWindow.location.href = new_iFrame_html_str; This is actually the wrong form here, because it should be = url_of_new_content $( top.frames['framesetFrame_name'].document.getElementById('iframe_id') ).html( new_iFrame_html_str ) ; Not updating anything that shows :(

    Read the article

  • How to filter node list based on the contents of another node list

    - by ~otakuj462
    Hi, I'd like to use XSLT to filter a node list based on the contents of another node list. Specifically, I'd like to filter a node list such that elements with identical id attributes are eliminated from the resulting node list. Priority should be given to one of the two node lists. The way I originally imagined implementing this was to do something like this: <xsl:variable name="filteredList1" select="$list1[not($list2[@id_from_list1 = @id_from_list2])]"/> The problem is that the context node changes in the predicate for $list2, so I don't have access to attribute @id_from_list1. Due to these scoping constraints, it's not clear to me how I would be able to refer to an attribute from the outer node list using nested predicates in this fashion. To get around the issue of the context node, I've tried to create a solution involving a for-each loop, like the following: <xsl:variable name="filteredList1"> <xsl:for-each select="$list1"> <xsl:variable name="id_from_list1" select="@id_from_list1"/> <xsl:if test="not($list2[@id_from_list2 = $id_from_list1])"> <xsl:copy-of select="."/> </xsl:if> </xsl:for-each> </xsl:variable> But this doesn't work correctly. It's also not clear to me how it fails... Using the above technique, filteredList1 has a length of 1, but appears to be empty. It's strange behaviour, and anyhow, I feel there must be a more elegant approach. I'd appreciate any guidance anyone can offer. Thanks.

    Read the article

  • Data historian queries

    - by Scott Dennis
    Hi, I have a table that contains data for electric motors the format is: DATE(DateTime) | TagName(VarChar(50) | Val(Float) | 2009-11-03 17:44:13.000 | Motor_1 | 123.45 2009-11-04 17:44:13.000 | Motor_1 | 124.45 2009-11-05 17:44:13.000 | Motor_1 | 125.45 2009-11-03 17:44:13.000 | Motor_2 | 223.45 2009-11-04 17:44:13.000 | Motor_2 | 224.45 Data for each motor is inserted daily, so there would be 31 Motor_1s and 31 Motor_2s etc. We do this so we can trend it on our control system displays. I am using views to extract last months max val and last months min val. Same for this months data. Then I join the two and calculate the difference to get the actual run hours for that month. The "Val" is a nonresetable Accumulation from a PLC(Controller). This is my query for Last months Max Value: SELECT TagName, Val AS Hours FROM dbo.All_Data_From_Last_Mon AS cur WHERE (NOT EXISTS (SELECT TagName, Val FROM dbo.All_Data_From_Last_Mon AS high WHERE (TagName = cur.TagName) AND (Val > cur.Val))) This is my query for Last months Max Value: SELECT TagName, Val AS Hours FROM dbo.All_Data_From_Last_Mon AS cur WHERE (NOT EXISTS (SELECT TagName, Val FROM dbo.All_Data_From_Last_Mon AS high WHERE (TagName = cur.TagName) AND (Val < cur.Val))) This is the query that calculates the difference and runs a bit slow: SELECT dbo.Motors_Last_Mon_Max.TagName, STR(dbo.Motors_Last_Mon_Max.Hours - dbo.Motors_Last_Mon_Min.Hours, 12, 2) AS Hours FROM dbo.Motors_Last_Mon_Min RIGHT OUTER JOIN dbo.Motors_Last_Mon_Max ON dbo.Motors_Last_Mon_Min.TagName = dbo.Motors_Last_Mon_Max.TagName I know there is a better way. Ultimately I just need last months total and this months total. Any help would be appreciated. Thanks in advance

    Read the article

  • JPA entitylisteners and @embeddable

    - by seanizer
    I have a class hierarchy of JPA entities that all inherit from a BaseEntity class: @MappedSuperclass @EntityListeners( { ValidatorListener.class }) public abstract class BaseEntity implements Serializable { // other stuff } I want all entities that implement a given interface to be validated automatically on persist and/or update. Here's what I've got. My ValidatorListener: public class ValidatorListener { private enum Type { PERSIST, UPDATE } @PrePersist public void checkPersist(final Object entity) { if (entity instanceof Validateable) { this.check((Validateable) entity, Type.PERSIST); } } @PreUpdate public void checkUpdate(final Object entity) { if (entity instanceof Validateable) { this.check((Validateable) entity, Type.UPDATE); } } private void check(final Validateable entity, final Type persist) { switch (persist) { case PERSIST: if (entity instanceof Persist) { ((Persist) entity).persist(); } if (entity instanceof PersistOrUpdate) { ((PersistOrUpdate) entity).persistOrUpdate(); } break; case UPDATE: if (entity instanceof Update) { ((Update) entity).update(); } if (entity instanceof PersistOrUpdate) { ((PersistOrUpdate) entity).persistOrUpdate(); } break; default: break; } } } and here's my Validateable interface that it checks against (the outer interface is just a marker, the inner contain the methods): public interface Validateable { interface Persist extends Validateable { void persist(); } interface PersistOrUpdate extends Validateable { void persistOrUpdate(); } interface Update extends Validateable { void update(); } } All of this works, however I would like to extend this behavior to Embeddable classes. I know two solutions: call the validation method of the embeddable object manually from the entity validation method: public void persistOrUpdate(){ // validate my own properties first // then manually validate the embeddable property: myEmbeddable.persistOrUpdate(); // this works but I'd like something that I don't have to call manually } use reflection, checking all properties to see if their type is of one of their interface types. This would work, but it's not pretty. Is there a more elegant solution?

    Read the article

  • RadioButtonGroup with each RadioButton added in components?

    - by futureal
    Hi, Working in Flex 3, I have a series of components being rendered on a canvas, each of which should represent a single potential selection, ideally in a RadioButtonGroup. So in my parent canvas I am defining the RadioButtonGroup, and each component provides a single RadioButton. However, this doesn't seem to work. Suppose there is a component called aComponent defined as such: <mx:Canvas ...> ... <mx:RadioButton id="someButton" groupName="myRadioButtonGroup" ... /> </mx:Canvas> The outer canvas: <mx:Canvas ...> ... <mx:Script> public function doesSomething():void { var myComponent:aComponent = new aComponent(); outerCanvas.addChild(myComponent); } </mx:Script> ... <mx:RadioButtonGroup id="myRadioButtonGroup" /> </mx:Canvas> So my guess was that at this point if, say, four of these components were added, the radio buttons would behave in mutually exclusive fashion and I'd be able to access myRadioButtonGroup.selectedValue to get the current selection. However, it doesn't seem to work that way. Is what I'm trying to do even possible, or have I maybe just missed something? Thanks!

    Read the article

  • How do you compare using .NET types in an NHibernate ICriteria query for an ICompositeUserType?

    - by gabe
    I have an answered StackOverflow question about how to combine to legacy CHAR database date and time fields into one .NET DateTime property in my POCO here (thanks much Berryl!). Now i am trying to get a custom ICritera query to work against that very DateTime property to no avail. here's my query: ICriteria criteria = Session.CreateCriteria<InputFileLog>() .Add(Expression.Gt(MembersOf<InputFileLog>.GetName(x => x.FileCreationDateTime), DateTime.Now.AddDays(-14))) .AddOrder(Order.Desc(Projections.Id())) .CreateCriteria(typeof(InputFile).Name) .Add(Expression.Eq(MembersOf<InputFile>.GetName(x => x.Id), inputFileName)); IList<InputFileLog> list = criteria.List<InputFileLog>(); And here's the query it's generating: SELECT this_.input_file_token as input1_9_2_, this_.file_creation_date as file2_9_2_, this_.file_creation_time as file3_9_2_, this_.approval_ind as approval4_9_2_, this_.file_id as file5_9_2_, this_.process_name as process6_9_2_, this_.process_status as process7_9_2_, this_.input_file_name as input8_9_2_, gonogo3_.input_file_token as input1_6_0_, gonogo3_.go_nogo_ind as go2_6_0_, inputfile1_.input_file_name as input1_3_1_, inputfile1_.src_code as src2_3_1_, inputfile1_.process_cat_code as process3_3_1_ FROM input_file_log this_ left outer join go_nogo gonogo3_ on this_.input_file_token=gonogo3_.input_file_token inner join input_file inputfile1_ on this_.input_file_name=inputfile1_.input_file_name WHERE this_.file_creation_date > :p0 and this_.file_creation_time > :p1 and inputfile1_.input_file_name = :p2 ORDER BY this_.input_file_token desc; :p0 = '20100401', :p1 = '15:15:27', :p2 = 'LMCONV_JR' The query is exactly what i would expect, actually, except it doesn't actually give me what i want (all the rows in the last 2 weeks) because in the DB it's doing a greater than comparison using CHARs instead of DATEs. I have no idea how to get the query to convert the CHAR values into a DATE in the query without doing a CreateSQLQuery(), which I would like to avoid. Anyone know how to do this?

    Read the article

  • Nhibernate, can i improve my MAPPING or Query

    - by dbones
    take this simple example A staff class which references other instances of the staff class public class Staff { public Staff() { Team = new List<Staff>(); } public virtual int Id { get; set; } public virtual string Name { get; set; } public virtual IList<Staff> Team { get; set; } public virtual Staff Manager { get; set; } } The Fluent Mapping public class StaffMap : ClassMap<Staff> { public StaffMap() { Id(x => x.Id); Map(x => x.Name); References(x => x.Manager).Column("ManagerId"); HasMany(x => x.Team).KeyColumn("ManagerId").Inverse(); } } Now I want to run a query, which will load all the Staff and eager load the manager and Team members. This is what I came up with IList<Staff> resutls = session.CreateCriteria<Staff>() .SetFetchMode("Team", FetchMode.Eager) .SetResultTransformer(Transformers.DistinctRootEntity) .List<Staff>(); however the SQL (does what i want) has duplicate columns, 2 team2_.ManagerId and 2 team2_.Id SELECT this_.Id as Id0_1_, this_.Name as Name0_1_, this_.ManagerId as ManagerId0_1_, team2_.ManagerId as ManagerId3_, team2_.Id as Id3_, team2_.Id as Id0_0_, team2_.Name as Name0_0_, team2_.ManagerId as ManagerId0_0_ FROM [SelfRef].[dbo].[Staff] this_ left outer join [SelfRef].[dbo].[Staff] team2_ on this_.Id=team2_.ManagerId The question is, should this be happening? did i do something wrong in the query or map? or is it a feature of the HHib im using (which is Version 2.1.0.4000)? many thanks in advance

    Read the article

  • Gradual memory leak and slowdown in loop

    - by Benji XVI
    I have a simple foundation tool that exports every frame of a movie as a .tiff file. Here is the relevant code: NSString* movieLoc = [NSString stringWithCString:argv[1]]; QTMovie *sourceMovie = [QTMovie movieWithFile:movieLoc error:nil]; int i=0; while (QTTimeCompare([sourceMovie currentTime], [sourceMovie duration]) != NSOrderedSame) { // save image of movie to disk NSAutoreleasePool *arp = [[NSAutoreleasePool alloc] init]; NSString *filePath = [NSString stringWithFormat:@"/somelocation_%d.tiff", i++]; NSData *currentImageData = [[sourceMovie currentFrameImage] TIFFRepresentation]; [currentImageData writeToFile:filePath atomically:NO]; NSLog(@"%@", filePath); [sourceMovie stepForward]; [arp release]; } [pool drain]; return 0; As you can see, in order to prevent very large memory buildups with the various transparently-autoreleased variables in the loop, we create, and flush, an autoreleasepool with every run through the loop. However, over the course of stepping through a movie, the amount of memory used by the program still gradually increases, and the speed at which frames are processed drops precipitously. (From ~0.5 seconds per frame at the start, to ~2 seconds per frame by the 250th frame.) The only thing I can think can be causing the gradual memory leak is a buildup of the NSAutoreleasePool objects themselves. Am I right in thinking they will only be deallocated when the outer pool is released? If so, is there a better memory management solution here? Creating a pool every run through the loop seems a little hacky. And if not, what is causing the slow memory leak? (It is not NSStrings, and much too slow to be NSImages or NSDatas.) And what could be causing the slowdown?

    Read the article

  • Problem with inner classes of the same name in Visual C++

    - by starblue
    I have a problem with Visual C++, where apparently inner classes with the same name but in different outer classes are confused. The problem occurs for two layers, where each layer has a listener interface as an inner class. B is a listener of A, and has its own listener in a third layer above it (not shown). The structure of the code looks like this: A.h class A { class Listener { Listener(); virtual ~Listener() = 0; } [...] } B.h class B : public A::Listener { class Listener { Listener(); virtual ~Listener() = 0; } [...] } B.cpp B::Listener::Listener() {} B::Listener::~Listener() {} I get the error B.cpp(49) : error C2509: '{ctor}' : member function not declared in 'B' The C++ compiler for Renesas sh2a has no problem with this, but then it is more liberal than Visual C++ in some other respects, too. If I rename the listener interfaces to have different names the problem goes away, but I'd like to avoid that (the real class names instead of A or B are rather long). Is what I'm doing correct C++, or is the complaint by Visual C++ justified? Is there a way to work around this problem without renaming the listener interfaces?

    Read the article

  • Join with Three Tables

    - by John
    Hello, In MySQL, I am using the following three tables (their fields are listed after their titles): comment: commentid loginid submissionid comment datecommented login: loginid username password email actcode disabled activated created points submission: submissionid loginid title url displayurl datesubmitted I would like to display "datecommented" and "comment" for a given "username," where "username" equals a variable called $profile. I would also like to make the "comment" a hyperlink to http://www...com/.../comments/index.php?submission='.$rowc["title"].'&submissionid='.$rowc["submissionid"].'&url='.$rowc["url"].'&countcomments='.$rowc["countComments"].'&submittor='.$rowc["username"].'&submissiondate='.$rowc["datesubmitted"].'&dispurl='.$rowc["displayurl"].' where countComments equals COUNT(c.commentid) and $rowc is part of the query listed below. I tried using the code below to do what I want, but it didn't work. How could I change it to make it do what I want? Thanks in advance, John $sqlStrc = "SELECT s.loginid ,s.title ,s.url ,s.displayurl ,s.datesubmitted ,l.username ,l.loginid ,s.title ,s.submissionid ,c.comment ,c.datecommented ,COUNT(c.commentid) countComments FROM submission s INNER JOIN login l ON s.loginid = l.loginid LEFT OUTER JOIN comment c ON c.loginid = l.loginid WHERE l.username = '$profile' GROUP BY c.loginid ORDER BY s.datecommented DESC LIMIT 10"; $resultc = mysql_query($sqlStrc); $arrc = array(); echo "<table class=\"samplesrec1c\">"; while ($rowc = mysql_fetch_array($resultc)) { $dtc = new DateTime($rowc["datecommented"], $tzFromc); $dtc->setTimezone($tzToc); echo '<tr>'; echo '<td class="sitename3c">'.$dtc->format('F j, Y &\nb\sp &\nb\sp g:i a').'</a></td>'; echo '<td class="sitename1c"><a href="http://www...com/.../comments/index.php?submission='.$rowc["title"].'&submissionid='.$rowc["submissionid"].'&url='.$rowc["url"].'&countcomments='.$rowc["countComments"].'&submittor='.$rowc["username"].'&submissiondate='.$rowc["datesubmitted"].'&dispurl='.$rowc["displayurl"].'">'.stripslashes($rowc["comment"]).'</a></td>'; echo '</tr>'; } echo "</table>";

    Read the article

  • Link Button on asp.net user control not firing

    - by andyriome
    Hi I have a user control, which is added to another user control. The nested user control is built up of a gridview, an image button and a link button. The nested user control is added to the outer control as a collection object based upon the results bound to the gridview. The problem that I have is that my link button doesn't work. I click on it and the event doesn't fire. Even adding a break point was not reached. As the nested user control is added a number of times, I have set image button to have unique ids and also the link button. Whilst image button works correctly with its java script. The link button needs to fire an event in the code behind, but despite all my efforts, I can't make it work. I am adding the link button to the control dynamically. Below is the relevant code that I am using: public partial class ucCustomerDetails : System.Web.UI.UserControl { protected override void CreateChildControls( ) { base.CreateChildControls( ); string strUniqueID = lnkShowAllCust.UniqueID; strUniqueID = strUniqueID.Replace('$','_'); this.lnkShowAllCust.ID = strUniqueID; this.lnkShowAllCust.Click += new EventHandler(this.lnkShowAllCust_Click); this.Controls.Add(lnkShowAllCust); } protected override void OnInit (EventArgs e) { CreateChildControls( ); base.OnInit(e); } protected override void OnLoad(EventArgs e) { base.EnsureChildControls( ); } protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { CreateChildControls( ); } } protected void lnkShowAllCust_Click(object sender, EventArgs e) { this.OnCustShowAllClicked(new EventArgs ( )); } protected virtual void OnCustShowAllClicked(EventArgs args) { if (this.ViewAllClicked != null) { this.ViewAllClicked(this, args); } } public event EventHandler ViewAllClicked; } I have been stuggling with this problem for the last 3 days and have had no success with it, and I really do need some help. Can anyone please help me?

    Read the article

  • How to compare two arrays of integers order-insensitively

    - by stdnoit
    I want Java code that can compare in this way (for example): <1 2 3 4> = <3 1 2 4> <1 2 3 4> != <3 4 1 1> I can't use hashmap table or anything; just pure code without library. I know there are two ways. sort them and compare the array index by index use two for loops and compare the outer index with the inner index. I have been trying with this but still not working: for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { if(a[i] != a[j] && j == n) return false; } } return true; anything wrong with the code ? thanks

    Read the article

  • How to add additional condition to the JOIN generated by include?

    - by KandadaBoggu
    I want to add additional criteria to the LEFT OUTER JOIN generated by the :include option in ActiveRecord finder. class Post has_many :comments end class Comment belongs_to :post has_many :comment_votes end class CommentVote belongs_to :comment end Now lets say I want to find last 10 posts with their associated comments and the up comment votes. Post.find.all(:limit => 10, :order => "created_at DESC", :include => [{:comments => :comment_votes]) I cant add the condition to check for up votes as it will ignore the posts without the up votes. So the condition has to go the ON clause of the JOIN generated for the comment_votes. I am wishing for a syntax such as: Post.find.all(:limit => 10, :order => "created_at DESC", :include => [{:comments => [:comment_votes, :on => "comment_votes.vote > 0"]) Have you faced such problems before? Did you managed to solve the problem using the current finder? I hope to hear some interesting ideas from the community. PS: I can write a join SQL to get the expected result and stitch the results together. I want to make sure there is no other alternative before going down that path.

    Read the article

  • whats a sure shot way to make sure objects appear correctly positioned on stage

    - by dubbeat
    Hi, I've being having a lot of trouble recently getting objects (UIComponents containing movieclips) to appear correctly in the right positions. For example, my current dilema is I have a container that is 3 layers deep. outer layer inner layer display layer This hiearachy was built in CS4 as a movieclip. In the display layer in CS4 I figured out where I want to place 16 different "box" movieclips. I dont want to create these boxes maunually at design time, instead I want to add them at run time. So I know what container I want to add my boxes to. I know what positions they "would" be at in CS4 environment. Whats the best way to add them in the correct locations with code? The "box" I'm trying to add in a movieclip held inside of a UIComponent. Is there a "rule of thumb" to do this type of thing? I'm sure I'm going to encounter this problem again and again and I'd like to just blow the problem out of the water once and for all with the "right way" to do this.

    Read the article

  • callback on a variable which is inside a .each() loop

    - by Stoic
    I have this function, which is doing an asynchronous call to FB.api method. Now, i am looping over some data and capturing result of the above method call successfully. However, I am using a .each loop and I really can not figure out how to place my callback in this method, so that the outer method is only executed once. Here are the functions I am using: ask_for_perms($(this).val(),function(result) { $('#some-div').html('<a onclick = "get_perms(result);" >get perms</a>'); }); function ask_for_perms(perms_requested,cb) { var request = []; $.each(perms_requested,function(i,permission) { FB.api({ method: 'users.hasAppPermission', ext_perm: permission }, function(response) { if (response == 0) request.push(permission); request.join(','); cb(request); // cb is called many times here. }); }); } I am trying to return the request string from ask_for_perms function. Can anyone suggest me on where to place a proper callback to ask_for_perms. Right now, however, it works for me, but the callback is being called many times since it is inside a for loop. referencing: returning a variable from the callback of a function

    Read the article

  • Named Range Breaks Code

    - by Daniel
    I have one workbook with several sheets. I populate the listboxes (pulling static data from cells) on the 2nd sheet, click a button and it runs fine. When I populate the listboxes with a named range, the listbox populates the way I want, but I get an error because the code thinks that I didn't select anything in the listbox, even though I did. So it passes through "" instead of "title". Is this a common issue? The named range isn't a problem because it passes through the data to the listbox and I know it's selecting data because as soon as the listbox loses focus, it spits out the contents of the cell into cell A1. What's even stranger is that I have the contents of the listbox set to Msg1. So A1 gets populated with Msg1 (what I actually selected in the listbox). But when I try and use Msg1 in the code, it tells me that Msg1 is "". Again, this only happens when I use the dynamic named range, not with static data in cells K1:K9. Private Function strEndSQL1 As String Dim strSQL As String strSQL = "" 'Create SQL statement strSQL = "FROM (SELECT * FROM dbo.Filter WHERE ID = " & TextBox1.Text & " And Source IN (" & Msg1 & ")) a FULL OUTER JOIN " strSQL = strSQL & "(SELECT * FROM dbo.Filters WHERE ID = " & TextBox2.Text & " And Source IN (" & Msg1 & ")) b " strSQL = strSQL & "ON a.Group = b.Group strEndSQL = strSQL End Function

    Read the article

  • SQL with HAVING and temp table not working in Rails

    - by chrisrbailey
    I can't get the following SQL query to work quite right in Rails. It runs, but it fails to do the "HAVING row_number = 1" part, so I'm getting all the records, instead of just the first record from each group. A quick description of the query: it is finding hotel deals with various criteria, and in particular, priortizing them being paid, and then picking the one with the highest dealrank. So, if there are paid deal(s), it'll take the highest one of those (by dealrank) first, if no paid deals, it takes the highest dealrank unpaid deal for each hotel. Using MAX(dealrank) or something similar does not work as a way to pick off the first row of each hotel group, which is why I have the enclosing temptable and the creation of the row_number column. Here's the query: SELECT *, @num := if(@hid = hotel_id, @num + 1, 1) as row_number, @hid := hotel_id as dummy FROM ( SELECT hotel_deals.*, affiliates.cpc, (CASE when affiliates.cpc 0 then 1 else 0 end) AS paid FROM hotel_deals INNER JOIN hotels ON hotels.id = hotel_deals.hotel_id LEFT OUTER JOIN affiliates ON affiliates.id = hotel_deals.affiliate_id WHERE ((hotel_deals.percent_savings = 0) AND (hotel_deals.booking_deadline = ?)) GROUP BY hotel_deals.hotel_id, paid DESC, hotel_deals.dealrank ASC) temptable HAVING row_number = 1 I'm currently using Rails' find_by_sql to do this, although I've also tried putting it into a regular find using the :select, :from, and :having parts (but :having won't get used unless you have a :group as well). If there is a different way to write this query, that'd be good to know too. I am using Rails 2.3.5, MySQL 5.0.x.

    Read the article

  • NHibernate + Cannot insert the value NULL into...

    - by mybrokengnome
    I've got a MS-SQL database with a table created with this code CREATE TABLE [dbo].[portfoliomanager]( [idPortfolioManager] [int] NOT NULL PRIMARY KEY IDENTITY, [name] [varchar](45) NULL ) so that idPortfolioManager is my primary key and also auto-incrementing. Now on my Windows WPF application I'm using NHibernate to help with adding/updating/removing/etc. data from the database. Here is the class that should be connecting to the portfoliomanager table namespace PortfolioManager { [Class(Table="portfoliomanager",NameType=typeof(PortfolioManagerClass))] public class PortfolioManagerClass { [Id(Name = "idPortfolioManager")] [Generator(1, Class = "identity")] public virtual int idPortfolioManager { get; set; } [NHibernate.Mapping.Attributes.Property(Name = "name")] public virtual string name { get; set; } public PortfolioManagerClass() { } } } and some short code to try and insert something PortfolioManagerClass portfolio = new PortfolioManagerClass(); Portfolio.name = "Brad's Portfolios"; The problem is, when I try running this, I get this error: {System.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'idPortfolioManager', table 'PortfolioManagementSystem.dbo.portfoliomanager'; column does not allow nulls. INSERT fails. The statement has been terminated... with an outer exception of {"could not insert: [PortfolioManager.PortfolioManagerClass][SQL: INSERT INTO portfoliomanager (name) VALUES (?); select SCOPE_IDENTITY()]"} I'm hoping this is the last error I'll have to solve with NHibernate just to get it to do something, it's been a long process. Just as a note, I've also tried setting Class="native" and unsaved-value="0" with the same error. Thanks! Edit: Ok removing the 1, from Generator actually allows the program to run (not sure why that was even in the samples I was looking at) but it actually doesn't get added to the database. I logged in to the server and ran the sql server profiler tool and I never see the connection coming through or the SQL its trying to run, but NHibernate isn't throwing an error anymore. Starting to think it would be easier to just write SQL statements myself :(

    Read the article

  • Time complexity of a powerset generating function

    - by Lirik
    I'm trying to figure out the time complexity of a function that I wrote (it generates a power set for a given string): public static HashSet<string> GeneratePowerSet(string input) { HashSet<string> powerSet = new HashSet<string>(); if (string.IsNullOrEmpty(input)) return powerSet; int powSetSize = (int)Math.Pow(2.0, (double)input.Length); // Start at 1 to skip the empty string case for (int i = 1; i < powSetSize; i++) { string str = Convert.ToString(i, 2); string pset = str; for (int k = str.Length; k < input.Length; k++) { pset = "0" + pset; } string set = string.Empty; for (int j = 0; j < pset.Length; j++) { if (pset[j] == '1') { set = string.Concat(set, input[j].ToString()); } } powerSet.Add(set); } return powerSet; } So my attempt is this: let the size of the input string be n in the outer for loop, must iterate 2^n times (because the set size is 2^n). in the inner for loop, we must iterate 2*n times (at worst). 1. So Big-O would be O((2^n)*n) (since we drop the constant 2)... is that correct? And n*(2^n) is worse than n^2. if n = 4 then (4*(2^4)) = 64 (4^2) = 16 if n = 100 then (10*(2^10)) = 10240 (10^2) = 100 2. Is there a faster way to generate a power set, or is this about optimal?

    Read the article

  • problem with "select new Object ... join ... where"

    - by jacob
    Hi, I'm having a problem with an HQL query Three classes ClassOne is my BusinessObject public class ClassOne { private int id; private int status; private Set<ClassTwo> classTwos; + other fields/getters/setters/constructor etc } ClassTwo is referenced in a set of ClassOne and is kind of the history of an object of ClassOne public class ClassTwo { private int id; private int oldStatus; private int newStatus; private String message; //+ getters/setters/constructor etc } ClassThree is my DTO/VO with just one classTwo (not the whole history) public class ClassThree { private int id; private int status; private ClassTwo classTwo; public ClassThree(int pId, int pStatus, ClassTwo pClassTwo) { id=pId; status=pStatus; classTwo=pClassTwo; } //+ getters/setters etc } Now I'd like to create an HQL query like this: I'd like to get all objects of ClassThree with a certain status and if it exists the newest ClassTwo with a certain newStatus. For example: I'd like to get all the DTOs (ClassThree) of ClassOne whose status is now 1, but earlier in their history it has been 2 and I'd like to have the latest ClassTwo object which has 2 as newStatus. SELECT new ClassThree(c1.id, c1.status, c2) FROM ClassOne c1 LEFT JOIN c1.classtwos c2 (...) and (...) is where I don't know what to do, I'm not even sure if it's a join / join fetch Looked around and tried quite a lot already, but no clue. Especially with the join fetch I get some Hibernate errors like org.hibernate.QueryException: query specified join fetching, but the owner of the fetched association was not present in the select list. Fetching the BusinessObject like that is no problem SELECT distinct(c1) FROM ClassOne c1 LEFT OUTER JOIN FETCH c1.classtwos c2 and I get the ClassTwos as my field. Thanks in advance, Jacob P.S.: One thing might be important, ClassTwo has no reference to ClassOne!!

    Read the article

  • regex match css class name from single string containing multiple classes

    - by effectica
    I have a long string that contains multiple css classes. With regex I would like to match every class name as I then need to replace these class names like so: <span>CLASSNAME</span> I have tried for hours to come up with a solution and I think I am close however for certain class names I am not able to exclude closing curly brackets from the match. Here is a sample string I have been carrying out testing on: #main .items-Outer p{ font-family:Verdana; color: #000000; font-size: 50px; font-weight: bold; }#footer .footer-inner p.intro{ font-family:Arial; color: #444444; font-size: 30; font-weight: normal; }.genericTxt{ font-family:Courier; color: #444444; font-size: 30; font-weight: normal; } And here is the the regex I came up with so far: ((^(?:.+?)(?:[^{]*))|((?:\})(?:.+?)(?:[^{]*))) Please look at the screenshot I am attaching as it will show more clearly the matches I get. My problem is that I would obviously like to exclude curly brackets from any match.

    Read the article

  • Mulitple variable containing "for loop" is not working in my code...

    - by OM The Eternity
    Below is the code I am working with and the last for loop i am iterating is not working... I think i am doing something wrong using multiple variable in a for loop,also I m aware of the fact that it can be done. $updaterbk = "SELECT j1. * FROM jos_audittrail j1 LEFT OUTER JOIN jos_audittrail j2 ON ( j1.trackid != j2.trackid AND j1.field != j2.field AND j1.changedone < j2.changedone ) WHERE j1.operation = 'UPDATE' AND j2.id IS NULL "; $selectupdrbk = mysql_query($updaterbk); while($row1 = mysql_fetch_array($selectupdrbk)) { $updrbk[] = $row1; } foreach($updrbk as $upfield) { if(!in_array($upfield['field'],$exist)) { $exist[] = $upfield['field']; $existval[] = $upfield['oldvalue']; //echo $updqueryrbk = "UPDATE `".$upfield['table_name']."` SET "; } } print_r($existval); for($i=0;$j=0;$i<count($exist);$j<count($existval);$i++;$j++) { $updqueryrbk.= $exist[$i]['field']."=".$existval[$j]['oldvalue'].","; $updqueryrbk.="="; $updqueryrbk.= $existval[$j]['oldvalue']; $updqueryrbk.=","; }

    Read the article

  • Getting JQuery UI Sortable to work on asp.net ListView items?

    - by Xaisoft
    I have the following ListView in which I am using the JQuery UI sortable function to be able to sort the items in the ListView. The problem is that I can't put a sortable class on the table in the ItemTemplate because it does not work, if I put a class="sortable" on the outer div, it works, but it allows me to sort everything within the ListView, I just want to be able to move sort the tables. Here is the markup <div> //Works here, but hr's become sortable too. <asp:ListView ID="lvwDocuments" runat="server"> <LayoutTemplate> <h3> Documents</h3> <asp:PlaceHolder ID="itemPlaceHolder" runat="server"> </asp:PlaceHolder> </LayoutTemplate> <ItemTemplate> <table class="sortable"> //Does not work Here <tr> <td> <p class="title"> <a runat="server" href='<%#Eval("url") %>'> <%#Eval("title") %></a></p> <br /> <p> <%#Eval("description") %></p> </td> </tr> </table> </ItemTemplate> <ItemSeparatorTemplate> <hr /> </ItemSeparatorTemplate> </div> Also, How can I preserve the sort order even after the page is refreshed.

    Read the article

< Previous Page | 29 30 31 32 33 34 35 36 37 38 39  | Next Page >