Iterating through a generic list of unknown type

Hi,
I am in the process of creating pdf reports for my project.I have to deal with a persistence api to get the data for the report.The data will be in the form of a list,like List<SomeObject>,all these lists returned by the persistence framework contains object of some type which implements a common interface.But through that interface I wont be able to get all the data for my reports.So I am looking for a generic way for iterating through the list,by providing some metadata for the data within the list. I am planning to use reflection to query through the list.Is there any feature of generic,through which I can easily iterate through this unknown type,preferrably a combination of reflection and generics,I want to reduce the LOC.Any suggestions??

If the List returned by the framework isn't parameterized, Like
public List<K> getList(Class<K> classType);
then you have to cast it to the appropriate type. If you are not sure about the type of the Objects in the list, and you have a bunch of class types you could expect from the list, then you could use instanceof operator.
If it could be Class A or B, then
if (obj instanceof A){
A castObject = (A) obj;
else if(obj instanceof B){
B castObject = (B)obj;
}Even to do reflection to invoke methods, you need to know the method Names. Which tells me you have the knowledge of what could come out of the list. So cast them. Invoking methods using reflection is really slow.

Similar Messages

  • Concurrent modification exception while iterating through list

    Hi,
    I have a list of objects. I use for each loop in java to iterate through that list of objects and display them.
    The problem is that while iterating other thread can add or remove some objects from that list, and I get ConcurrentModificationException.
    How can I handle this problem. How can I be sure that I am iteration through the updated list.
    Thank you

    Synchonize on the list before iterating through it, and make sure that other code also synchronizes on the list before adding to it or removing from it. Using a list implementation that simply synchronizes all the methods (e.g. Vector) will not do that, you have to do it yourself.

  • DriverManager iterating through driver lists, will it create an overhead ?

    Folks, i read this on a website:
    "You need a database connection to manipulate the database. In order to create the connection to the database, the DriverManager class has to know which database driver you want to use.
    It does that by iterating over the array (internally a Vector) of drivers that have registered with it and calls the acceptsURL(url) method on each driver in the array, effectively asking the driver to tell it whether or not it can handle the JDBC URL. "
    So does it mean whenever we try to create a db connection, the driver manager would iterate through the entire list of drivers which have registered ??
    In case the number of drivers registered are substantial, won't this create an overhead ?

    So does it mean whenever we try to create a db
    connection, the driver manager would iterate through
    the entire list of drivers which have registered ??
    In case the number of drivers registered are
    substantial, won't this create an overhead ?The number of drivers is never substantial.
    Problems in your code are much more likely to cause more overhead than this feature ever will. Add this one to the "don't worry about it" list.
    %

  • The type Iterator is not generic; it cannot be parameterized with arguments

    Hi all, i have a problem, and i think is a JRE problem
    The error is the following:
    If i share a Web JSF Exadel project enterely, with the .classpath, the .project,
    ect everything go ok. I can Check out the project
    and work with it without problems.
    But if i share only the JavaSource and the Webcontent of the same project
    and the other files and folders like the .classpath, the .project, the ant folder,
    ect are added to the subversion then appear the problem. When i Check out the project and build it (not with shift-alt-x Q but with the Build Project option of the Projec Menu in Eclipse)
    appear an strange error that say: "The type Iterator is not generic; it cannot be parameterized with arguments <E>".
    If i build the project using the build.xml file that came with the project everything is ok, but when i run the project into the Exadel the error
    appear againt.
    The error appear with all the eclipse versions from 3.1 to 3.3 and with all the ExadelStudio Pro versions from 3.5 to 4.0.4 and with the JRE versions 1.5.0_05 and 1.6.0_02
    Any idea will be very appreciated.

    Hi, i think i found a clue to discover the mistery, i deployed the same .war in the ExadelStudio Pro 3.5.1 tomcat and in the ExadelStudio Pro 4.0.1(and 4.0.4) tomcat in the first one everythink work fine but in the second i get the error i described above.
    The ExadelStudio Pro 3.5.1 use Tomcat 5.0 and ExadelStudio Pro 4.0.1 and 4.0.4 use Tomcat 5.5
    There are some problem with the new versions of Tomcat?
    Something related to the use of an old version of the JVM by default?
    There are some problem with the jdk1.5, something related to the posibility that i can't mix code compiled with an old version of jdk with code compiled with the jdk1.5?
    Any suggestion will be very appreciated

  • Systems.Collections.Generic.List T Requires 1 Type of Argument?

    I am having troubles with my code. I am trying to start a list entitles "studentList" and it is supposed to allow the user to enter in a list of student names and their ages. 
    Below is my code and this is a windows Forms:
    <code>
    List<Student> studentList = new List();
            private void btnAddStudent_Click(object sender, EventArgs e)
            private void btnShowStudents_Click(object sender, EventArgs e)
                List<Student> sortedList = studentList.OrderBy(o => o.LastName).
                                                  ThenBy(o => o.FirstName).ToList();
                String outputStr = "";
                foreach (Student s in sortedList)
                    if (outputStr != "")
                        outputStr += "\n--------------\n";
                    outputStr += s.ToString();
                if (outputStr == "")
                    outputStr = "No Student Records Yet!";
                MessageBox.Show(outputStr);
    </code>
    I have other code as well but this is the problem area. I am getting a Systems.Collections.Generic.List<T> Requires 1 Type of Argument error on this line of code: List<Student> studentList = new List(); and I cannot figure out why.
    If I change it to List<string>studentList = new List<string>(); I get an error later on in the code.
    I'm sorry if this is confusing but this is a really complex assignment that I've been working on for hours and I'm completely frustrated because I'm so close to finishing.
    Any help would be appreciated!
    Thanks :)

    I am having troubles with my code.
    If you post this to a C# and not to a VB forum, you'll have the chance all your troubles are gone. :)
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=csharpgeneral
    Armin

  • Cannot implicitly convert type 'Microsoft.SharePoint.SPListItemCollection' to 'System.Collections.Generic.List T '_

    Hi
    I want use SPListItemCollection' to 'System.Collections.Generic.List<T>'.
    How to achieve this.
    Thanks,
    Siva.

    Hi Siva,
    This is how I code it for looping all SPListItem in the SPListItemCollection using Generic List<T>
    public IEnumerable GetEnumerator()
    using (SPSite site = new SPSite(SPContext.Current.Site.Url))
    using (SPWeb web = site.OpenWeb())
    var list = web.Lists["Friends"];
    var query = new SPQuery();
    query.Query = "<FieldRef Name='ID'/>";
    IEnumerable items = list.GetItems(query);
    return items;
    Then calling the method would be
    var items = GetEnumerator();
    foreach(SPListItem item in items)
    Response.Write(item["FirstName"]);
    Murugesa Pandian| MCPD | MCTS |SharePoint 2010

  • SharePoint Online Iterating through Document Libraries CSOM

    Hi,
    I am trying to iterate though a document library and set each document/items whithin to inherit permissions (at the moment each doc/item is using uniquer permissions).
    I am able to get the specific document library that I am interesting in, however I cannot at the moment iterate though each of the items/documents within it, but here is what I have so far:
    Add-Type -Path "Libraries\Microsoft.SharePoint.Client.dll"
    Add-Type -Path "Libraries\Microsoft.SharePoint.Client.Runtime.dll"
    Add-Type -Path "Libraries\Microsoft.SharePoint.Linq.dll"
    Add-Type -Path "Libraries\Microsoft.SharePoint.dll"
    $webUrl = "https://test.sharepoint.com/sites/testsite"
    $username = "####"
    $password = "####"
    $securePass = ConvertTo-SecureString $password -AsPlainText -Force
    $listname = "TestDoc";
    $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($webUrl)
    $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $securePass)
    #variables
    $web = $ctx.Web
    $lists = $web.Lists
    $ctx.Load($lists)
    $ctx.Load($web)
    $ctx.ExecuteQuery()
    #print web URL
    write-host `n "Web Url:" `n $web.Url
    foreach ($list in $lists)
    if ($list.Title -eq "TestDoc")
    #print list name if found
    write-host `n "Found the list:" `n $list.Title `n
    #attempting to iterate through items in the document library
    foreach ($item2 in $list.Items)
    #list the items/documents in the document library
    write-host $item2.Title
    It is the foreach loop I am having trouble at the moment as I am not sure how to loop though each of the items/documents in the document library.
    Any suggestions on the approach I should take would be much appreciated.

    Thanks for the heads up, I have re-worked my script which is simpler and now works like a charm:
    Add-Type -Path "Libraries\Microsoft.SharePoint.Client.dll"
    Add-Type -Path "Libraries\Microsoft.SharePoint.Client.Runtime.dll"
    Add-Type -Path "Libraries\Microsoft.SharePoint.Linq.dll"
    Add-Type -Path "Libraries\Microsoft.SharePoint.dll"
    $webUrl = "https://test.sharepoint.com/sites/testsite"
    $username = "####"
    $password = "####"
    $securePass = ConvertTo-SecureString $password -AsPlainText -Force
    $listname = "TestDoc"
    $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($webUrl)
    $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $securePass)
    #get the List/DocLib and load it for use
    $listUpdate = $ctx.Web.Lists.GetByTitle($listname)
    $ctx.Load($listUpdate)
    $ctx.ExecuteQuery()
    #CAML Query to get all items inclusing sub-folders
    $spQuery = New-Object Microsoft.SharePoint.Client.CamlQuery
    $spQuery.ViewXml = "<View Scope='RecursiveAll' />";
    $itemki = $listUpdate.GetItems($spQuery)
    $ctx.Load($itemki)
    $ctx.ExecuteQuery()
    #iterating through the items and reseting permission inheritence
    for($j=0; $j -lt $itemki.Count; $j++)
    $itemki[$j].ResetRoleInheritance()
    $ctx.ExecuteQuery()

  • Calling a Web Service in a SSRS Report - Error Converting String to Generic List of Strings

    Hello,
    I am using SSRS version 2005 and am trying to call a web service to retrieve data for a SSRS report.  I've looked on Google and MSDN for the past 2 days and have exhausted all options.  Here are the details...
    The web service method I am calling accepts 4 parameters...
    Parameter 1 = Generic list of strings
    Parameter 2 = DateTime
    Parameter 3 = Int
    Parameter 4 = Int
    I have created a function (on the CODE tab in report properties) in my report that gets passed a comma delimited string and returns a Generic List of Strings that I use to format Parameter 1.  The code for the function is as follows:
    Public Function GetIDs(ByVal IDList as String) As List(Of String)
       Dim stringArray() = IDList.Split(",")
       Dim genericList As New List(Of String)(stringArray)
       Return genericList
    End Function
    I am passing a string to the function that looks something like this:
    "1,2,3,4"
    When I try to PREVIEW the report, I get an error that reads:
    "There is an error on line 0 of custom code: [BC30002] Type 'List' is not defined"
    I've tried changing the function declaration to pass back a string array:
    Public Function GetIDs(ByVal IDList as String) As String()
        Return IDList.Split(","c)
    End Function
    This returned the error (from the web service): 
    "Error in line 5 position 22.  Expecting state 'Element'.. Encountered 'Text' with name ", namespace"
    I have also tried changing the function declaration to pass back an array: 
    Public Function GetIDs(ByVal IDList as String) As ARRAY
    This also produced the error:
    "Error in line 5 position 22.  Expecting state 'Element'.. Encountered 'Text' with name ", namespace"
    I know that this particular web service method DOES work because it is coded to accept nulls in the first parameter.  So... when I call the method with nulls, it returns a recordset of ALL data (this works fine).  Only when I pass a string to the function (which "filters" the recordset by the ID list), does the error occur.
    Is SRSS limited with respect to VB.NET code so that the List(Of String) statement is not recognized?  Has anyone done this before and if so, how did you convert a comma delimited string to a Generic List of Strings within a function in the SSRS report?
    Any info would be greatly appreciated.
    Thanks!
    Bob

    Hi Bob,
    By default, in custom code, in order to use a variable or function that is not in the "System" namespace, we need to provide the full name.
    In this case, the full name of the "List" is "System.Collections.Generic.List"
    So, to solve the issue, please use the following code:
    Public Function GetIDs(ByVal IDList as String) As System.Collections.Generic.List(Of String)
    Dim stringArray() = IDList.Split(",")
    Dim genericList As New System.Collections.Generic.List(Of String)(stringArray)
    Return genericList
    End Function
    If you have any more questions, please feel free to ask.
    Thanks,
    Jin Chen
    Jin Chen - MSFT

  • Custom Ribbon tab does not show in generic list

    Hi.
    I'm deploying the following definiton on a generic list, but the new custom tab does not show up. Anyone that can see what I have done wrong?
    Thanks!
    <Elements xmlns=”http://schemas.microsoft.com/sharepoint/“>
    <CustomAction
    Id=”Ribbon.MyTab”
    Title=”Adds a new Ribbon tab to Generic List”
    RegistrationType=”List”
    RegistrationId=”100″
    Location=”CommandUI.Ribbon.ListView”
    >
    <CommandUIExtension>
    <CommandUIDefinitions>
    <CommandUIDefinition
    Location=”Ribbon.Tabs._children”>
    <Tab Id=”Ribbon.MyTab” Sequence=”110″ Description=”" Title=”My Tab Name”>
    <Scaling Id=”Ribbon.MyTab.Scaling”>
    <MaxSize
    Id=”Ribbon.MyTab.Scaling.MyGroup.MaxSize”
    Sequence=”15″
    GroupId=”Ribbon.MyTab.MyGroup”
    Size=”LargeMedium”/>
    </Scaling>
    <Groups Id=”Ribbon.MyTab.Groups”>
    <Group
    Id=”Ribbon.MyTab.MyGroup”
    Sequence=”15″
    Description=”"
    Title=”My Group Name”
    Template=”Ribbon.Templates.MyTab.MyGroup.CustomTemplate”>
    <Controls Id=”Ribbon.MyTab.MyGroup.Controls”>
    <Button
    Id=”Ribbon.MyTab.MyGroup.Button”
    Alt=”Ribbon.MyTab.MyGroup.Button”
    Command=”Ribbon.MyTab.MyGroup.Button_CMD”
    Image16by16=”/_layouts/images/siteIcon.png”
    Image32by32=”/_layouts/images/siteIcon.png”
    LabelText=”Button”
    Sequence=”10″
    TemplateAlias=”o1″
    ToolTipTitle=”Button”
    ToolTipDescription=”Shows a dialog” />
    </Controls>
    </Group>
    </Groups>
    </Tab>
    </CommandUIDefinition>
    <CommandUIDefinition
    Location=”Ribbon.Templates._children”>
    <GroupTemplate Id=”Ribbon.Templates.MyTab.MyGroup.CustomTemplate”>
    <Layout Title=”LargeMedium”>
    <OverflowSection Type=”OneRow” TemplateAlias=”o1″ DisplayMode=”Large”/>
    <OverflowSection Type=”ThreeRow” TemplateAlias=”o2″ DisplayMode=”Medium”/>
    </Layout>
    </GroupTemplate>
    </CommandUIDefinition>
    </CommandUIDefinitions>
    <CommandUIHandlers>
    <CommandUIHandler
    Command=”Ribbon.MyTab.MyGroup.Button_CMD”
    CommandAction=”javascript: alert('Hello World');” />
    </CommandUIHandlers>
    </CommandUIExtension>
    </CustomAction>
    </Elements>

    Hello,
    I was able to use your custom ribbon tab XML just fine.  The only thing is, the copy you provided had a bunch of illegal characters embedded in it (like reverse quotes?), I'm not sure if they're showing up in your version of the XML or not.  Anyway,
    after replacing those with straight quotes and fixing some other misc formatting, it worked fine.  I created an empty SharePoint project and added an empty element, then added your XML to the Element.xml file.  In SP, I created a new custom
    list and the "My Tab Name" tab appeared with a button that displayed "Hello World" when I clicked it. So, I recommend checking the formatting of your XML.  Just look for red squiggles in the editor and fix them.
    Regards,
    - Kemp Brown [MSFT]

  • Avoid iterating through everything

    Hello all,
    Hope you guys can help me with this problem. I have a program that draws anywhere from 1-300,000 letters on a canvas. Each letter is created from a class called StringState which extends Rectangle. What I would like to do is have each letter respond when the user moves the mouse over the letter by growing bigger. I figured I can just see if the letters bounds contains the point where the mouse moved to and if it does change the letters size and repaint around that letter to update the display. This works great from 1-5000 letters but getting up to 10,000 or even higher creates a very visible lag while the program is iterating through the letters to check if the mouse location intersects the letters bounds. What I was wondering is there a way to get this result without iterating through the entire collection of letters to see if it contains the mouse location? Like can I attach some kind of mouse listener to each letter or something like that? The following program just demonstrates how I create and display the letters I haven't really had a chance to create a demonstration of how they would grow when hovered over. The program i'm working on that actually demonstrates this is very large and hard to trim down to show an example so the following code is actually from a previous question I asked and was provided by Aephyr. Thanks in advance for your guys help :)
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
    import java.util.List;
    public class PaintSurface implements Runnable, ActionListener {
         public static void main(String[] args) {
              SwingUtilities.invokeLater(new PaintSurface());
         Tableaux tableaux;
         Random random = new Random();
    //        Point mouselocation = new Point(0,0);
         static final int WIDTH = 1000;
         static final int HEIGHT = 1000;
            JFrame frame = new JFrame();
         public void run() {
              tableaux = new Tableaux();
              for (int i=15000; --i>=0;)
                   addRandom();
              frame.add(tableaux, BorderLayout.CENTER);
              JButton add = new JButton("Add");
              add.addActionListener(this);
              frame.add(add, BorderLayout.SOUTH);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setSize(WIDTH, HEIGHT);
              frame.setLocationRelativeTo(null);
    //                frame.addMouseMotionListener(new MouseListener());
              frame.setVisible(true);
         public void actionPerformed(ActionEvent e) {
              addRandom();
         void addRandom() {
              tableaux.add(
                        Character.toString((char)('a'+random.nextInt(26))),
                        UIManager.getFont("Button.font"),
                        random.nextInt(WIDTH), random.nextInt(HEIGHT));
    //        class MouseListener extends MouseAdapter {
    //            public void mouseMoved(MouseEvent e) {
    //                mouselocation = new Point(e.getX(),e.getY());
    //                frame.repaint();
            class StringState extends Rectangle {
                    StringState(String str, Font font, int x, int y, int w, int h) {
                            super(x, y, w, h);
                            string = str;
                            this.font = font;
                    String string;
                    Font font;
            class Tableaux extends JComponent {
                 Tableaux() {
                      this.enableEvents(MouseEvent.MOUSE_MOTION_EVENT_MASK);
                      lagState = createState("Lag", new Font("Arial",Font.BOLD,20), 0, 0);
                 protected void processMouseMotionEvent(MouseEvent e) {
                      repaint(lagState);
                      lagState.setLocation(e.getX(), e.getY());
                      repaint(lagState);
                      super.processMouseMotionEvent(e);
                 StringState lagState;
                    List<StringState> states = new ArrayList<StringState>();
                    StringState createState(String str, Font font, int x, int y) {
                        FontMetrics metrics = getFontMetrics(font);
                        int w = metrics.stringWidth(str);
                        int h = metrics.getHeight();
                        return new StringState(str, font, x, y-metrics.getAscent(), w, h);
                    public void add(String str, Font font, int x, int y) {
                         StringState state = createState(str, font, x, y);
                            states.add(state);
                            repaint(state);
                    protected void paintComponent(Graphics g) {
                            Rectangle clip = g.getClipBounds();
                            FontMetrics metrics = g.getFontMetrics();
                            for (StringState state : states) {
                                    if (state.intersects(clip)) {
                                            if (!state.font.equals(g.getFont())) {
                                                    g.setFont(state.font);
                                                    metrics = g.getFontMetrics();
                                            g.drawString(state.string, state.x, state.y+metrics.getAscent());
                            if (lagState.intersects(clip)) {
                            g.setColor(Color.red);
                            if (!lagState.font.equals(g.getFont())) {
                                g.setFont(lagState.font);
                                metrics = g.getFontMetrics();
                            g.drawString("Lag", lagState.x, lagState.y+metrics.getAscent());
    }Here is the code that iterates through the letters to see if a letter contains the mouse location:
                if(e.getSource()==canvas&&edit) {
                    for(Letter l : letters) {
                        Rectangle rec = new Rectangle(l.x+l.xoffset,l.y+l.yoffset,l.width,l.height);
                        if(rec.contains(new Point(e.getX(),e.getY()))&&l.resizing==false&&l.defaultSize==l.font.getSize()) {
                            l.resizing = true;
                            new Thread(new ExpandLetter(l)).start();
                        else if(!rec.contains(new Point(e.getX(),e.getY()))&&l.resizing==false){
                            l.font = new Font(l.font.getName(),l.font.getStyle(),l.defaultSize);
                            l.resizeLetter(l.text);
                }However I just learned that this loop itself is taking up a huge amount of memory by saying
    l.font = new Font(l.font.getName(),l.font.getStyle(),l.defaultSize); When I take that line out the lag is reduced by a lot. Also I think that it isn't forgetting the "old" letters font that it is replacing by saying new Font() and after running this loop once my program runs slow and laggy as if it doesn't have enough memory to run fast anymore. Is there something I am doing wrong by initiating a new Font. I would have thought that it wouldn't take up anymore memory because it replaces the old font the the letter "l" has. The loop seems to have some kind of memory leak if someone could point it out to me that would be great. Thanks :)
    Edited by: neptune692 on Feb 16, 2010 8:18 PM

    neptune692 wrote:
    can I attach some kind of mouse listener to each letterTry this:
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.font.*;
    import java.awt.geom.*;
    import javax.swing.*;
    import java.util.*;
    import javax.swing.event.*;
    public class SimplePaintSurface implements Runnable, ActionListener {
        private static final int WIDTH = 1250;
        private static final int HEIGHT = 800;
        private Random random = new Random();
        private JFrame frame = new JFrame("SimplePaintSurface");
        private JPanel tableaux;
        public void run() {
            tableaux = new JPanel(null);
            for (int i = 15000; --i >= 0;) {
                addRandom();
            frame.add(tableaux, BorderLayout.CENTER);
            JButton add = new JButton("Add");
            add.addActionListener(this);
            frame.add(add, BorderLayout.SOUTH);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(WIDTH, HEIGHT);
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
            tableaux.requestFocusInWindow();
        public void actionPerformed(final ActionEvent e) {
            addRandom();
            tableaux.repaint();
        void addRandom() {
            Letter letter = new Letter(Character.toString((char) ('a' + random.nextInt(26))));
            letter.setBounds(random.nextInt(WIDTH), random.nextInt(HEIGHT), 16, 16);
            tableaux.add(letter);
        public static void main(final String[] args) {
            SwingUtilities.invokeLater(new SimplePaintSurface());
    class Letter extends JLabel {
        Font font1;
        Font font2;
        private final FontRenderContext fontRenderContext1;
        private final FontRenderContext fontRenderContext2;
        public Letter(final String letter) {
            super(letter);
            setFocusable(true);
            setBackground(Color.RED);
            font1 = getFont();
            font2 = font1.deriveFont(48f);
            fontRenderContext1 = getFontMetrics(font1).getFontRenderContext();
            fontRenderContext2 = getFontMetrics(font2).getFontRenderContext();
            MouseInputAdapter mouseHandler = new MouseInputAdapter() {
                @Override
                public void mouseEntered(final MouseEvent e) {
                    Letter.this.setOpaque(true);
                    setFont(font2);
                    Rectangle bounds = getBounds();
                    Rectangle2D stringBounds = font2.getStringBounds(getText(), fontRenderContext2);
                    bounds.width = (int) stringBounds.getWidth();
                    bounds.height = (int) stringBounds.getHeight();
                    setBounds(bounds);
                @Override
                public void mouseExited(final MouseEvent e) {
                    Letter.this.setOpaque(false);
                    setFont(font1);
                    Rectangle bounds = getBounds();
                    Rectangle2D stringBounds = font1.getStringBounds(getText(), fontRenderContext1);
                    bounds.width = (int) stringBounds.getWidth();
                    bounds.height = (int) stringBounds.getHeight();
                    setBounds(bounds);
            addMouseListener(mouseHandler);
    }

  • Set Time Interval with custom fields in generic list with view(SPViewCollection.SPViewType.Calendar)

    I need to set time interval range with custom date fields in sharepoint view SPViewCollection.SPViewType.Calendar. How to do that?
    My code is this:
    System.Collections.Specialized.StringCollection viewFields = new System.Collections.Specialized.StringCollection();
    viewFields.Add("FechaInicio");
    viewFields.Add("FechaFin");
    string query = @"<Query>
    <Where>
    <DateRangesOverlap>
    <FieldRef Name=""FechaInicio"" />
    <FieldRef Name=""FechaFin"" />
    <FieldRef Name=""RecurrenceID"" />
    <Value Type=""DateTime"">
    <Week />
    </Value>
    </DateRangesOverlap>
    </Where>
    </Query>";
    SPView newView = reserva.Views.Add("CalendarView", viewFields, query, 0, true, true, SPViewCollection.SPViewType.Calendar, false);
    "FechaInicio" and "FechaFinal" ara datetime fields in my generic list.
    Thanks.

    Hi,
    According to your post, my understanding is that you want to see the calendar view begin and end time for the time interval.
    We can use the SharePoint Manager to view the internal name for the begin and end time for the time interval.
    Open SharePoint Manager 2013->click your site->click
    Lists->select your list name->click Views->select your calendar view name->click the
    Schema Xml to check the internal name for the time interval begin and end.
    We can download the SharePoint Manager in here:
    http://spm.codeplex.com/
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • Generic Method, How parameter type is determined

    For method
    <T> void fromArrayToCollection(T[] a, Collection<T> c) { ... } Why does
    fromArrayToCollection(sa, co);passes and
    fromArrayToCollection(oa, cs); fails.
    oa - Object Array, Object[]
    cs - Collection of String, Collection<String>
    sa - String Array, String[]
    co - Collection of Object, Collection<Object>
    What are the rules governing the type of T inferred by compiler?

    epiphanetic wrote:
    I think you still haven't fully understood the issue.
    I suggest, you also read the same generics tutorial by Gilad Bracha, section 6 from where I found this issue :). Ha! But I think it's misleading that that section uses arrays.
    In his words "It will generally infer the most specific type argument that will make the call type-correct." Its also mentioned that collection parameter type has to be supertype of Array parameter type but no reason is given. I wonder why it fails to infer correct type in second case.Assume you passed in an array of Objects, and a Collection of Strings, and it was possible that T would then be Object. Using Bracha's example implementation:
    static <T> void fromArrayToCollection(T[] a, Collection<T> c) {
       for (T o : a) {
          c.add(o); // correct
    }Now imagine you had this code making use of it:
    Object[] objects = {Integer.valueOf(1), "hi", new Object()};
    Collection<String> strings = new LinkedList<String>();
    fromArrayToCollection(objects, strings);
    String string = strings.iterator().next(); //get first String, which is actually an IntegerTrying to get the first String would give a ClassCastException. So clearly that method cannot not be safely invoked.
    The reason I think he's confusing things by using the array is because you might get it in your head that this would be OK:
    static <T> void fromCollectionToCollection(Collection<T> one, Collection<T> two) {
       for ( T t : one ) {
          two.add(t);
    Collection<Object> col1; Collection<String> col2;
    doSomething(col1, col2);When clearly it's unsafe, as now your Collection of Strings might have a non-String in it! That's why I said this is more a nuance of generic arrays than of type inference proper.

  • OLE Object - Unknown Type

    We modified a customer's Crystal Report to contain an OLE Object (a linked PDF) and it was working fine and updating perfectly. Recently the customer was having problems using the report. Looking at the report, once it opens it tries to update the PDF but we get this error "Some links could not be updated because their sources are presently unavailable". With this message we get a links button and when we look at that the PDF is now an unknown type.
       Also now when we try to create a new report and insert an OLE Object like before, first off PDF is not in the Object Type list. and secondly it inserts it from a file as an icon if/if not the check box is checked.
       Does anyone know what could have changed for OLE PDFs not to work anymore for us? Any help would be greatly appreciated in this.

    Hi Scotty,
    Appears the DDE interpreter to handle PDF's has either been altered or AV software is blocking access now.
    What happens if they simply double click on any PDF file?
    Use ProcessMonitor to see what is happening, try running one of the reports and then look in the log for Access Denied errors.
    Don

  • EWA problem - Session   is ignored due to unknown type EWALERT SolMan

    Hi All,
    We have newly defined early watch report for few systems and report is getting generated successfully in solution manager system for all except one system. The RFCs from solman to satellite system and vice versa are working fine; both connection and authorization tests are successful. SDCCN is active and refresh session job is also running. In job log; there are no errors; but when we check in task log in SDCCN; there is one warning "Session   is ignored due to unknown type EWALERT SolMan"
    Could you please advise how to resolve this error and generate EWA report for missing SCM system. Solution manager is on EHP1 basis package level 6 and the satellite system is SCM system SCM 7.0.
    I have tried deleting all sessions in satellite system and recreated; but no help.
    Thanks,
    Varun

    Hello
    Strange that you have applied the note 727998 and still the error persists.
    I would say let's re-check the note 727998 and try to re-implement it. In satellite system, sdccn rfc to the solman should be the 'Master'. In solman, the service definition rfc should be sdcc_oss. I hope all RFC connections are already working fine.
    Also go through the Note 216952 - Service Data Control Center (SDCC) - FAQ
    Thanks

  • Reference to "System.Collection.Generic.List"

    Encountered a problem when making a .NET method call:
    MT8855.StatusCode SetBluetoothProfile(
    MT8855.BluetoothProfileConfiguration newProfileConfiguration,
    ref List<MT8855.InvalidSettingInfo> invalidList
    Parameters
    newProfileConfiguration
    Type: Anritsu.MMD.MT8855x.TestSet.MT8855.BluetoothProfileConfiguration
    The structure containing the new settings.
    invalidList
    Type: System.Collections.Generic.List (Of <MT8855.InvalidSettingInfo>)
    A list to hold information about any settings that are invalid.
    Return Value
    Status code indicating the success or otherwise of the call.
    What should I do in TestStand to pass the reference of the list? 

    Hi,
    Just also visit this thread
    http://forums.ni.com/t5/NI-TestStand/How-to-iterat​e-though-a-net-dictionary/td-p/1232557
    Regards
    juergen
    =s=i=g=n=a=t=u=r=e= Click on the Star and see what happens :-) =s=i=g=n=a=t=u=r=e=

Maybe you are looking for

  • Cumilating of amount in sec 80 for conveyance

    Dear ALL, when iam running payroll for the month 01.04.2011 annual converyances exemption is giving correctly 9600.but when i run payroll for next month 01.05.2011 the exemption is giving as cumilating and giving more then 9600 this is incresing when

  • Hide Email in Web Gallery

    Hi, I created a web gallery with feedback in Photoshop Cs2 and uploaded into my webpage using Dreamweaver cs3.  What I want is a way (code, script) to hide private email address on the form from viewers but still allow to be emailed.  How do you do t

  • When searching for something on amazon or ebay the top row always goes to the far right of the screen.

    So when i look up something like "shoes" in the amazon search box the top row of items moves over to the far right. And most are no longer even on my screen I checked on I.E. and i had no issues with this so i assume its a firefox issue.

  • Problems with the trackpad

    Hi everybody, I am having a problem with the trackpad of my unibody macbook pro. I can´t use the command previous/forward when I move three thingers in the trackpad because it minimizes the window to the dock. Do you know what can I do? thank you in

  • After Effects 5.5 installation problem

    I'm trying to install the trial for CS5.5 Master Collection, and some products install correctly (like Photoshop), but After Effects gives me an error. My OS is Windows Vista Home Premium, 64 bits. This is the error log that the installation gives me