Search Results

Search found 50462 results on 2019 pages for 'list view'.

Page 12/2019 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • iPhone scrolling the view up when keyboard is open

    - by Rob
    I understand that this problem is incredibly common and I have read through quite a few answers but am having trouble understanding how the code works. This works: -(void)textFieldDidBeginEditing:(UITextField *)sender { if ([sender isEqual:txtLeaveAddyLine1]) { //move the main view, so that the keyboard does not hide it. if (self.view.frame.origin.y >= 0) { [self setViewMovedUp:YES]; } } } In this example, txtLeaveAddy is the very first UITextField that is hidden by the keyboard and it works like a charm. As I cycle through the text fields on the screen it scrolls up when the user enters into that txtLeaveAddyLine1 field. However, when I try to add the fields below the txtLeaveAddyLine1 field - nothing happens. For example: -(void)textFieldDidBeginEditing:(UITextField *)sender { if ([sender isEqual:txtLeaveAddyLine1]) { //move the main view, so that the keyboard does not hide it. if (self.view.frame.origin.y >= 0) { [self setViewMovedUp:YES]; } } if ([sender isEqual:txtLeaveAddyLine2]) { //move the main view, so that the keyboard does not hide it. if (self.view.frame.origin.y >= 0) { [self setViewMovedUp:YES]; } } } Am I not using this function correctly?

    Read the article

  • MVC alternatives: examples of MVA & AVC?

    - by Phillip Oldham
    I'm interested in learning about the alternative patterns to Model-View-Controller, specifically the Model-View-Adapter and Application-View-Controller patterns. Google results tend to be either a high-level overview or Java-based. Can anyone either provide, or point me to, an example of these patterns in either PHP, Python or JavaScript?

    Read the article

  • issue with tab bar view displaying a compound view

    - by ambertch
    I created a tab bar application, and I make the first tab a table. So I create a tableView controller, and go about setting the class identity of the view controller for the first tab to my tableView controller. This works fine, and I see the contents of the table filling up the whole screen. However, this is not what I actually want in the end goal - I would like a compound window having multiple views: - the aforementioned table - a custom view with data in it So what I do is create a nib for this content (call it contentNib), change the tab's class from the tableView controller to a generic UIViewController, and set the nib of that tab to this new contentNib. In this new contentNib I drag on a tableView and set File's Owner to the TableViewController. I then link the dataSource and delegate to file's owner (which is TableViewController). Surprisingly this does not work and I receive the error: **Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x3b0f910'** This is bewildering to me since the file's owner is the TableViewController, which has been assigned to be both the dataSource and delegate. Does someone have either insight into my confusions, or a link to an example of how to have a compound view include a tableView? *update* I see this in the Apple TableView programming guide: "Note: You should use a UIViewController subclass rather than a subclass of UITableViewController to manage a table view if the view to be managed is composed of multiple subviews, one of which is a table view. The default behavior of the UITableViewController class is to make the table view fill the screen between the navigation bar and the tab bar (if either are present)." <----- I don't really get what this is telling me to do though... if someone can explain or point me to an example I'd be much appreciated!

    Read the article

  • Mvc3 IEnumerable<QuestionModel> have a List<QuestionOptionModel> property. When I post, I get null list

    - by user1649439
    There is a example here. I am trying to use this technique in a large form with a list(List) but when I post back, the Viewmodel.Order that should’ve contained list of items and activities return with the lists empty. My QuestionModel.cs like this. public int Id { get; set; } public string QuestionText { get; set; } public System.Nullable<bool> OptionType1 { get; set; } public System.Nullable<bool> OptionType2 { get; set; } public List<QuestionOptionModel> OptionList = new List<QuestionOptionModel>(); When I post back "IEnumerable questions" List OptionList comes null. How can I do this?

    Read the article

  • Would this predicate work ? this came on my quiz to find the position of element X in a data structure called list

    - by M.K
    example: position(1,list(1,list(2,nil)),Z). Z = 1. position(3,list(1,list(2,list(3,nil)),Z). Z = 3. where Z is the position of element X in a data structure of a list in the above format Here was my solution: position(X,list(nil),0). %empty list position(X,list(X,T),1). %list with X as head or first element position(X,list(H,T),Z):- position(X,list(T,nil),Z1), %X is in tail of list (H,T) Z is Z1 + 1.

    Read the article

  • How to convet DataTable to List on runtype with out existin class property [closed]

    - by shamim
    Work on VS2010 C#,Have one DataTable ,want to convert this DataTable to List Suppose: Table dt; On run time want to create similar field from a datatable and fill fields in List.There is no existing class for list properties. ListName=TableName List property name=Table column name List Property type=Table column type List items=Table rows Note: Recently work on EF.To fullfill my project requirement, need to give flexibility to use to input and execute ESQL at runtime .I don’t want to put this execute result on datatable or List ,want to put this result on list. List has no existing class and property,don’t want to convert DataTable on list Type:DataRow If have any query please ask,Thanks in advanced.

    Read the article

  • Trying to use a list iterator to print out entire linked list in Java. Infinite loop for some reaso

    - by Matt
    I created my list: private static List list = new LinkedList(); and my iterator: ListIterator itr = list.listIterator(); and use this code to try to print out the list... Only problem is, it never comes out of the loop. When it reaches the tail, shouldn't it come out of the loop, because there is no next? Or is it going back to the head like a circular linked list? It is printing so quickly and my computer locks up shortly after, so I can't really tell what is going on. while (itr.hasNext()) System.out.println(itr.next());

    Read the article

  • Clone MySQL DB - errors with CREATE VIEW/SHOW VIEW privileges

    - by user43537
    Running MySQL 5.0.32 on Debian 4.0 (Etch). I'm trying to clone a WordPress MySQL database completely (structure and data) on the same server. I tried a dump to an .sql file and an import into a new empty database from the command line, but the import fails with errors saying the user does not have the "SHOW VIEW" or "CREATE VIEW" privilege. Trying it with PHPMyAdmin doesn't work either. I also tried doing this with the MySQL root user (not named "root" though) and it shows an "Access Denied" error. I'm terribly confused as to where the problem is. Any pointers on cloning a MySQL DB and granting all privileges to a user account would be great (specifically for MySQL 5.0.32). Thanks!

    Read the article

  • DRUPAL probl [tid] field : in View how to link Taxonomy term to MY view (and not to taxonomy/term)

    - by davezen
    SUMMARY : I have a view where I need to replace the term link "taxonomy/term" by my view link, because the view uses arguments to find content with terms how can I put in link argument the term which is display : [term_name1] link "display_view/term_name1", [term_name2] link "display_view/term_name2" I used [tid] field to put argument in link display_view/[tid] but it only display the first term, and not the real term (for example if multiple taggs it only display the first) and put all the terms in one single link : [term_name1 term_name2] link "display_view/term_name1" so why [tid] or [tid_1] don't run ? is there another field, or do I need php ? really need help ! :) DESCRIPTION : Hello, I made a view table to display store content it display : user name, title, taxonomy term to type (book, disc...), taxonomy term for taggs (subject of objects) for example : USER | TITLE | TERM TYPE (only one) | TERM SUBJECTS (taggs) user1 | James Brown disc | disc | soul jamesbrown user2 | rolls book | book | cars rolls travel so I display different types of terms and in subjects it can have a multiple because it's taggs I use arguments so it can have display for example only store from an user, or from an taxonomy (for examples only the disc, or the disc about soul) so I can link display_view/argtermtype/argtermsubject (I separate the type and subject) MY NEED : what i want is the terms of the view don't redirect on taxonomy/term but on my view so I have to : change the link of terms in view to redirect on display_texts/all/all replace [all] with the [term] argument MY PROBLEM : I can't have the right field of terms displayed in the links of terms in fields, I : checked "Output this field as a link" put the link "display_view/[tid]" for term type and "display_view/all/[tid]" for term subjects NOT checked "Link this field to its term page" what it does : [tid] put in link FOR ALL THE LINE the SAME TERM and it put all the terms in one single link ! that's to say, it creates the links : USER | TITLE | TERM TYPE (only one) | TERM SUBJECTS (taggs) user1 | James Brown disc| [disc] display_texts/disc (ok !) | [soul jamesbrown] (BAD only one link!) display_texts/all/disc (BAD it's not the new term !) what I need : USER | TITLE | TERM TYPE (only one) | TERM SUBJECTS (taggs) user1 | James Brown disc| [disc] display_texts/disc| [soul] display_texts/all/soul [jamesbrown] display_texts/all/jamesbrown) MY QUESTION : so how can I put in argument the term which is display ? I try things like [tid_1] but doesn't work is there any list of fields somewhere ? or do i have to use php code ? how to separate link terms ? if I check "Link this field to its term page" links are separate but it replace my link by "taxonomy/term" link think's in advance for any idea !

    Read the article

  • Why is this removing all elements from my LinkedList?

    - by Brian
    Why is my remove method removing every element from my Doubly Linked List? If I take out that if/else statements then I can successfully remove middle elements, but elements at the head or tail of the list still remain. However, I added the if/else statements to take care of elements at the head and tail, unfortunately this method now removes every element in my list. What am I do wrong? public void remove(int n) { LinkEntry<E> remove_this = new LinkEntry<E>(); //if nothing comes before remove_this, set the head to equal the element after remove_this if (remove_this.previous == null) head = remove_this.next; //otherwise set the element before remove_this equal to the element after remove_this else remove_this.previous.next = remove_this.next; //if nothing comes after remove_this, set the tail equal to the element before remove_this if (remove_this.next == null) tail = remove_this.previous; //otherwise set the next element's previous pointer to the element before remove_this else remove_this.next.previous = remove_this.previous; //if remove_this is located in the middle of the list, enter this loop until it is //found, then remove it, closing the gap afterwards. int i = 0; for (remove_this = head; remove_this != null; remove_this = remove_this.next) { //if i == n, stop and delete 'remove_this' from the list if (i == n) { //set the previous element's next to the element that comes after remove_this remove_this.previous.next = remove_this.next; //set the element after remove_this' previous pointer to the element before remove_this remove_this.next.previous = remove_this.previous; break; } //if i != n, keep iterating through the list i++; } }

    Read the article

  • Help with abstract class in Java with private variable of type List<E>

    - by Nazgulled
    Hi, It's been two years since I last coded something in Java so my coding skills are bit rusty. I need to save data (an user profile) in different data structures, ArrayList and LinkedList, and they both come from List. I want to avoid code duplication where I can and I also want to follow good Java practices. For that, I'm trying to create an abstract class where the private variables will be of type List<E> and then create 2 sub-classes depending on the type of variable. Thing is, I don't know if I'm doing this correctly, you can take a look at my code: Class: DBList import java.util.List; public abstract class DBList { private List<UserProfile> listName; private List<UserProfile> listSSN; public List<UserProfile> getListName() { return this.listName; } public List<UserProfile> getListSSN() { return this.listSSN; } public void setListName(List<UserProfile> listName) { this.listName = listName; } public void setListSSN(List<UserProfile> listSSN) { this.listSSN = listSSN; } } Class: DBListArray import java.util.ArrayList; public class DBListArray extends DBList { public DBListArray() { super.setListName(new ArrayList<UserProfile>()); super.setListSSN(new ArrayList<UserProfile>()); } public DBListArray(ArrayList<UserProfile> listName, ArrayList<UserProfile> listSSN) { super.setListName(listName); super.setListSSN(listSSN); } public DBListArray(DBListArray dbListArray) { super.setListName(dbListArray.getListName()); super.setListSSN(dbListArray.getListSSN()); } } Class: DBListLinked import java.util.LinkedList; public class DBListLinked extends DBList { public DBListLinked() { super.setListName(new LinkedList<UserProfile>()); super.setListSSN(new LinkedList<UserProfile>()); } public DBListLinked(LinkedList<UserProfile> listName, LinkedList<UserProfile> listSSN) { super.setListName(listName); super.setListSSN(listSSN); } public DBListLinked(DBListLinked dbListLinked) { super.setListName(dbListLinked.getListName()); super.setListSSN(dbListLinked.getListSSN()); } } 1) Does any of this make any sense? What am I doing wrong? Do you have any recommendations? 2) It would make more sense for me to have the constructors in DBList and calling them (with super()) in the subclasses but I can't do that because I can't initialize a variable with new List<E>(). 3) I was thought to do deep copies whenever possible and for that I always override the clone() method of my classes and code it accordingly. But those classes never had any lists, sets or maps on them, they only had strings, ints, floats. How do I do deep copies in this situation?

    Read the article

  • Working around Gmail mailing-list "feature."

    - by Paul J. Lucas
    I'm using Google Apps for my domain's e-mail via IMAP. Whenever I send mail to a mailing list, I don't receive a copy of my own mail back in my inbox. According to Google, this is a "feature." Is there a way to disable this "feature" so that all mail I send to mailing lists appears in my inbox just like all other e-mail? Perhaps something along the lines of this method for disabling Google's spam filter??

    Read the article

  • Working around Gmail mailing-list “feature.”

    - by Paul J. Lucas
    I'm using Google Apps for my domain's e-mail via IMAP. Whenever I send mail to a mailing list, I don't receive a copy of my own mail back in my inbox. According to Google, this is a "feature." Is there a way to disable this "feature" so that all mail I send to mailing lists appears in my inbox just like all other e-mail? Perhaps something along the lines of this method for disabling Google's spam filter??

    Read the article

  • Android programming - How to acces [to draw on] XML view in main.xml layout, using code

    - by user556248
    Ok I'm a newbie at Android programming, have a hard time with the graphics part. Understand the beauty of creating layout in XML file, but lost how to access various elements, especially a View element to draw on it. See example of my layout main.xml here; <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/root" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/Title" android:text="App title" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="#000000" android:background="#A0A0FF"/> </LinearLayout> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/PaperLayout" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" android:orientation="horizontal" android:focusable="true"> <View android:id="@+id/Paper" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </LinearLayout> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content"> <Button android:id="@+id/File" android:layout_width="fill_parent" android:layout_weight="1" android:layout_height="34dp" android:layout_alignParentTop="true" android:layout_centerInParent="true" android:clickable="true" android:textSize="10sp" android:text="File" /> <Button android:id="@+id/Edit" android:layout_width="fill_parent" android:layout_weight="1" android:layout_height="34dp" android:clickable="true" android:textSize="10sp" android:text="Edit" /> </LinearLayout> </LinearLayout> As you can see I have a custom app title bar, then a View filling middle, and finally two buttons in bottom. Catching button events and responding to, for example changing title bar text and changing View background color works fine, but how the heck do I access and more importantly draw on the view defined in main.xml UPDATE: That for your suggestion, however besides that I need a View, not ImageView and you are missing a parameter on canvas.drawText and an ending bracket, it does not work. Now this is most likely because you missed the fact that I am a newbie and assuming I can fill in any blanks. Now first of all I do NOT understand why in my main.xml layout file I can create a View or even a SurfaceView element, which is what I need, but according to your solution I don't even specify the View like Anyways I edited my main.xml according to your solution, and slimmed it down a bit for simplicity; <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/root" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/Title" android:text="App title" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="#000000" android:background="#A0A0FF"/> </LinearLayout> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/PaperLayout" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" android:orientation="horizontal" android:focusable="true"> <com.example.MyApp.CustomView android:id="@+id/Paper" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <com.example.colorbook.CustomView/> </LinearLayout> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content"> <Button android:id="@+id/File" android:layout_width="fill_parent" android:layout_weight="1" android:layout_height="34dp" android:layout_alignParentTop="true" android:layout_centerInParent="true" android:clickable="true" android:textSize="10sp" android:text="File" /> </LinearLayout> </LinearLayout> In my main java file, MyApp.java, I added this after OnCreate; public class CustomView extends ImageView { @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.drawText("Your Text", 1, 1, null); } } But I get error on the "CustomView" part; "Implicit super constructor ImageView() is undefined for default constructor.Must define an explicit constructor" Eclipse suggests 3 quick fixes about adding constructor, but none helps, well it removes error but gives error on app when running. I hope somebody can break this down for me and provide a solution, and perhaps explain why I can't just create a View element in my main.xml layotu file and draw on it in code.

    Read the article

  • How to scroll table view with toolbar at the top of the view

    - by Jakub
    Hello, I have a view with a toolbar at the top and a table view with text fields in it's cells. When I want to edit the text fields placed in the bottom of the table view the keyboard is hiding the text field being edited (as the table view is not scrolled up). I tried to implement http://cocoawithlove.com/2008/10/sliding-uitextfields-around-to-avoid.html but this makes my whole view move up (the toolbar and the table view) while I would like to have the toobar at the top of the view for the whole time. I modified the mentioned code to something like this: - (void)textFieldDidBeginEditing:(UITextField *)textField { CGRect textFieldRect = [tableView.window convertRect:textField.bounds fromView:textField]; CGRect viewRect = [tableView.window convertRect:tmpTableView.bounds fromView:tableView]; CGFloat midline = textFieldRect.origin.y + 0.5 * textFieldRect.size.height; CGFloat numerator = midline - viewRect.origin.y - MINIMUM_SCROLL_FRACTION * viewRect.size.height; CGFloat denominator = (MAXIMUM_SCROLL_FRACTION - MINIMUM_SCROLL_FRACTION) * viewRect.size.height; CGFloat heightFraction = numerator / denominator; if (heightFraction < 0.0) { heightFraction = 0.0; } else if (heightFraction > 1.0) { heightFraction = 1.0; } UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) { animatedDistance = floor(PORTRAIT_KEYBOARD_HEIGHT * heightFraction); } else { animatedDistance = floor(LANDSCAPE_KEYBOARD_HEIGHT * heightFraction); } CGRect viewFrame = tableView.frame; viewFrame.origin.y -= animatedDistance; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationBeginsFromCurrentState:YES]; [UIView setAnimationDuration:KEYBOARD_ANIMATION_DURATION]; [tableView setFrame:viewFrame]; [UIView commitAnimations]; } and - (void)textFieldDidEndEditing:(UITextField *)textField { CGRect viewFrame = tableView.frame; viewFrame.origin.y += animatedDistance; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationBeginsFromCurrentState:YES]; [UIView setAnimationDuration:KEYBOARD_ANIMATION_DURATION]; [tableView setFrame:viewFrame]; [UIView commitAnimations]; } This made my toolbar stay at the top, but unfortunately the table view overlays the toolbar and the toolbar is not visible. Any ideas how to solve this?

    Read the article

  • LinQ: Add list to a list

    - by JohannesBoersma
    I have the following code: var columnNames = (from autoExport in dataContext.AutoExports where autoExport.AutoExportTemplate != null && ContainsColumn(autoExport.AutoExportTemplate, realName) select GetDbColumnNames(autoExport.AutoExportTemplate, realName)).ToList(); Where the function GetDbColumns() returns an List<string>. So columNames is of the type List<List<string>>. Is it possible to create a List<string>, so each element of the list of GetDbColumns is added to the result of the LinQ query?

    Read the article

  • How do you load a view on top of another view in the iPad

    - by Magician Software
    How do you load a view on top of another view in the iPad like in the wordpress app when it asks you to setup your blog. Can you show or post me some sample code. I have an NSUSerdefaults setup so it will display this on the first launch. I would like this view to look like this http://uplr.me/files/p45064.png See how it has the shaddows and the view is darkened in the back. Thats what I am trying to do.

    Read the article

  • Hiding master view in split view app..???

    - by Mahesh
    Hello friends, I have created split view based ipad app, where master view is table view while Detail view display images.. I need to display the image fit to screen 100% in landscape mode. This could be on button event or double tap event.. Does any one know about it. Thanks in advance.

    Read the article

  • Java: Combine 2 List <String[]>

    - by battousai622
    I have two List of array string. I want to be able to create a New List (newList) by combining the 2 lists. But it must meet these 3 conditions: 1) Copy the contents of store_inventory into newList. 2) Then if the item names in store_inventory & new_acquisitions match, just add the two quantities together and change it in newList. 3) If new_acquisitions has a new item that does not exist in store_inventory, then add it to the newList. The titles for the CSV list are: Item Name, Quantity, Cost, Price. The List contains an string[] of item name, quantity, cost and price for each row. CSVReader from = new CSVReader(new FileReader("/test/new_acquisitions.csv")); List <String[]> acquisitions = from.readAll(); CSVReader to = new CSVReader(new FileReader("/test/store_inventory.csv")); List <String[]> inventory = to.readAll(); List <String[]> newList; Any code to get me started would be great! =] this is what i have so far... for (int i = 0; i < acquisitions.size(); i++) { temp1 = acquisitions.get(i); for (int j = 1; j < inventory.size(); j++) { temp2 = inventory.get(j); if (temp1[0].equals(temp2[0])) { //if match found... do something? //break out of loop } } //if new item found... do something? }

    Read the article

  • List<T> paging asp.net

    - by user1397978
    Using a three-tier architecture, I have a list of objects List<object> careerList = new List<object>(); ModuleDTO module = new ModuleDTO(); careerList = module.getDegreeCodeByQualification(qualificationCode); which I then add to a gridview like so: gridViewMaster.DataSource = careerList; gridViewMaster.DataBind(); What I'd like to do is then enable paging on the gridview. My gridview so far is: <asp:GridView ID="gridViewMaster" runat="server" AutoGenerateColumns="False" GridLines="None" BorderWidth="1px" CellPadding="2" DataKeyNames="Grouping" ForeColor="Black" onrowdatabound="gridViewMaster_RowDataBound" CssClass="mGrid" PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt" OnPageIndexChanging="gridView_PageIndexChanging" AllowPaging="True" > Is it possible to do enable paging on a list's without having to change that list to a Datatable or Dataview? If there is a way, this would help a lot. So far my events are as follows: protected void gridView_PageIndexChanging(object sender, GridViewPageEventArgs e) { gridViewMaster.PageIndex = e.NewPageIndex; List<object> careerList = new List<object>(); ModuleDTO module = new ModuleDTO(); careerList = module.getDegreeCodeByQualification(qualificationCode); ModalProgress.Show(); System.Threading.Thread.Sleep(1000); JobPanel.Visible = true; gridViewMaster.DataSource = careerList.Distinct(); gridViewMaster.DataBind(); } Someone PLEASE HELP ME!!! Thank you

    Read the article

  • How to filter List<T> with LINQ and Reflection

    - by Ehsan Sajjad
    i am getting properties via reflection and i was doing like this to iterate on the list. private void HandleListProperty(object oldObject, object newObject, string difference, PropertyInfo prop) { var oldList = prop.GetValue(oldObject, null) as IList; var newList = prop.GetValue(newObject, null) as IList; if (prop.PropertyType == typeof(List<DataModel.ScheduleDetail>)) { List<DataModel.ScheduleDetail> ScheduleDetailsOld = oldList as List<DataModel.ScheduleDetail>; List<DataModel.ScheduleDetail> ScheduleDetailsNew = newList as List<DataModel.ScheduleDetail>; var groupOldSchedules = ScheduleDetailsOld .GroupBy(x => x.HomeHelpID) .SelectMany(s => s.DistinctBy(d => d.HomeHelpID) .Select(h => new { h.HomeHelpID, h.HomeHelpName })); } } Now i am making it generic because there will be coming different types of Lists and i don't want to put if conditions this way i want to write generic code to handle any type of list. I came up with this way: private void HandleListProperty(object oldObject, object newObject, string difference, PropertyInfo prop) { var oldList = prop.GetValue(oldObject, null) as IList; var newList = prop.GetValue(newObject, null) as IList; var ListType = prop.PropertyType; var MyListInstance = Activator.CreateInstance(ListType); MyListInstance = oldList; } i am able to get the items in MyListInstance but as the type will come at runtime i am not getting how to write linq query to filter them, any ideah how to do.

    Read the article

  • python add two list and createing a new list

    - by Adam G.
    lst1 = ['company1,AAA,7381.0 ', 'company1,BBB,-8333.0 ', 'company1,CCC, 3079.999 ', 'company1,DDD,5699.0 ', 'company1,EEE,1640.0 ', 'company1,FFF,-600.0 ', 'company1,GGG,3822.0 ', 'company1,HHH,-600.0 ', 'company1,JJJ,-4631.0 ', 'company1,KKK,-400.0 '] lst2 =['company1,AAA,-4805.0 ', 'company1,ZZZ,-2576.0 ', 'company1,BBB,1674.0 ', 'company1,CCC,3600.0 ', 'company1,DDD,1743.998 '] output I need == ['company1,AAA,2576.0','company1,ZZZ,-2576.0 ','company1,KKK,-400.0 ' etc etc] I need to add it similar product number in each list and move it to a new list. I also need any symbol not being added together to be added to that new list. I am having problems with moving through each list. This is what I have: h = [] z = [] a = [] for g in hhl: spl1 = g.split(",") h.append(spl1[1]) for j in c_hhl: spl2 = j.split(",") **if spl2[1] in h: converted_num =(float(spl2[2]) +float(spl1[2])) pos=('{0},{1},{2}'.format(spl2[0],spl2[1],converted_num)) z.append(pos)** else: pos=('{0},{1},{2}'.format(spl2[0],spl2[1],spl2[2])) z.append(pos) for f in z: spl3 = f.split(",") a.append(spl3[1]) for n in hhl[:]: spl4 = n.split(",") if spl4[1] in a: got = (spl4[0],spl4[1],spl4[2]) hhl.remove(n) smash = hhl+z #for i in smash: for i in smash: print(i) I am having problem iterating through the list to make sure I get all of the simliar product to a new list,(bold) and any product not in list 1 but in lst2 to the new list and vice versa. I am sure there is a much easier way.

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >