Should/does -MyInterface give MyInterface return types?

The variance-overview.pdf says that List<-E> has Object as the return type of the get method. If this is true, I'm disappointed. I'd expect the following to work quite happily: List<-List<*>> myList = buildList();
List<*> elt1 = myList.get(0);There's no obvious reason why Object should be a supertype of List.

I'm still a bit fuzzy about contravariance, but it all depends on what your buildList() method returns. I think this is all legal code:
    List<Object> list1 = new ArrayList<Object>();
    List<List<*>> list2 = new ArrayList<List<*>>();
    list1.add (new Object());
    list2.add (new ArrayList<Integer>());
    List<-List<*>> list3;
    list3 = list2;
    list3 = list1;
    Object o = list3.get(0); // o is not a List!Either of list1, list2 or list3 will accept list.add(new ArrayList<Integer>()) - however at the price that nothing can be guaranteed about the type of the contents of the array (in the second case, the list is only guaranteed to contain Object).
What you want is for your buildList() method to return List<+List<*>>, the variant case (since you are reading from it).
    List<ArrayList<*>> list1 = new ArrayList<ArrayList<*>>();
    List<List<*>> list2 = new ArrayList<List<*>>();
    list1.add (new ArrayList<Integer>());
    list2.add (new ArrayList<Integer>());
    List<+List<*>> list3;
    list3 = list2;
    list3 = list1;
    List<*> o = list3.get(0); // o is a List

Similar Messages

  • Should Collections be used as return types across threads?

    I am wondering when, if ever, it is appropriate to use a Collection as the return type of a method in a multi-threaded environment. Here is our situation:
    We have four classes -- Widget, WidgetManager, ClientA, and ClientB. ClientA and ClientB are running in different Threads from each other and from the WidgetManager.
    The WidgetManager class that uses a Collection of Widgets internally, and passes the Collection (or an Iterator over it) out as a return value of a method to ClientA, which is running in another thread. ClientA would start to go through it using next() and hasNext() of the Iterator. If the WidgetManager were to get a request from ClientB running in another thread to eliminate a Widget, it would attempt to remove it from the Collection. If ClientA were still looping through the Iterator, this would throw an IllegalStateException b/c the system would be in an inconsistent state. The Iterator given to the ClientA is directly linked to the actual Collection in the WidgetManager (am I right so far?).
    In my opinion, in most cases we don't want to synchronize Collections. In the example above, if we had passed out a synchronized Collection, then the WidgetManager couldn't touch the collection while the client was looping through the Iterator. If the client got hung up while looping, then the WidgetManager would be hung up. In this case, I think that it will be better to use the toArray() method of Collection to just dump out the contents to a plain array of Objects. Actually, the WidgetManager could convert this array of Objects to an array of Widgets before passing it out, which would give us the type checking that we don't get with Containers.
    The condition where you would want to use a synchronized Collection would be when you actually want the client to do some writing or removing from the Collection. I would expect this to be pretty rare since you usually dont want to give clients access to an interal member (the Collection) of a class.
    I think that it is also possible to have read-only Collections, but I think (don't know for sure) that you would still have the same IllegalStateException or synchronization probelms.
    Can someone point out the errors in my thinking? Or should you generally only use Collections as internal members in a multi-threaded environment, and use toArray() whenever you want to pass the Collection's data outside of the class?
    Thanks for any help.
    Keith

    I haven't tested what happens when you synchronize the
    Collection, but I think that you are right. But this
    causes the problem that I mentioned in the first post.
    That is, what happens if your client STARTS running
    through the Iterator, and then stops or gets hung up
    for some reason? I assume that you're still blocked.
    And it's pretty important to me in this case to not
    t be blocked -- WidgetManager is the highest level
    class in the system.
    I'd like to know if anyone has tested this.
    The Iterator implementations used in java.util do not use any synchronization by itself, (which is what you would expect since synchronization over multiple method call will involve much more complications and slower performance) . With iterator, you have to provide the necessary synchronization yourself to maintain thread-safety like this
    Iterator itr = get Iterator from collectionInstance ;
    synchronized(collectionInstance) {
    while(itr.hasNext())
    process itr.next() ...
    As long as your client code gracefully exits the synchronized block on a stop( or hangup, given that it is detected and handled fast enough), it will not be a problem.
    Also, I'd like an example of when you WOULD want to
    return a Collection. I'm specifically interested in
    when you would want to return one in a multi-threaded
    environment, but I'm beginning to wonder when you
    would EVER want to return one from a method.
    Collections are great for internal uses, but you lose
    type-checking and you expose the internals of your
    class to modification when you use them as return
    types. And if you're returning a read-only
    Collection, you might as well return an array, right?Using a read-only proxy will be much faster and space-efficient than toArray().

  • Covariant return types over Generic return types.

    Feeling rather slow on the uptake having only just discovered covariant return types (thanks again cowwoc), I've been looking over one of our soon to be released APIs and think using covariants makes muchos sense for it but there's one issue:
    public interface Foo {
         Foo get();
    public interface Bar {
         Bar get();
    public interface FooBar
              extends Foo, Bar {
         FooBar get();
    }Which isn't allowed, as the compiler states the return types are incompatible (I think incorrectly as it's been further overridden). Its generic equivalent is:
    public interface FooX<T> {
         T get();
    public interface BarX<T> {
         T get();
    public interface FooBarX
              extends FooX<FooBarX>, BarX<FooBarX> {
         FooBarX get();
    }Which works, and well, but the extra hassle of declaring/using generics is turning out to be a pain for our users (this pattern is used extensively). Does anyone have any simple suggestions/recommendations to resolve either the covariant issue or simplify the generics one? Also does anyone have any preferences to which one they prefer (and why)?
    Incidentally does anyone know the the rationale behind not allowing the first example, when clearly it can't be abused (can it)?

    BobDavies wrote:
    . it is because you can not override a method or its definition with the same signatur, which does not include return type.What do you mean "does not include return type"?
    method signature does not count the return type. i think java does allow you to repeat definitions in a sub class but when you put up a different retyrn type, it sees it as an attempt to do overriding, so it flags it out.
    the fact that it works is becuase you are not extending anything but itsself:I am aware of the reasons for the Generic version working, it achieves our aim, I just don't like it when in use. And was wondering why the joining covariants do not work. I still can't see the reason for the FooBar not being allowed when you are allowed to return subtypes. You cannot break the inheritance/return types expectations like this can you? E.g. if I write a bit of code using Foo, it will still work with FooBar, and the same with Bar using FooBar, no? Can you show me an example of why this isn't allowed?your generic version should NOT work either; it is working becuase you are confused:
    public interface FooBarX extends FooX<FooBarX>, BarX<FooBarX> only equals to
    public interface FooBarX extends FooBarX, FooBarX

  • Is there a way to end a method that has no return type?

    Without using an exception, as they are costly I am told, and without using may if then statements, is it possible to end a method if some criteria isn't met.
    example.
    public void doThis(){
      // the method relies on the state of some
      // other things.
      if(!someBoolean) endHere
      // then following is the rest of the method.
      // I'd like to be able to do this so that the "meat"
      // of the method is located under the conditions
      // that must be met.
    }... Any thoughts?
    Thank You

    No need to hide or commit ritual suicide, the "void" keyword could lead you to think that your method can't use the return statement. At least you wrote code to investigate and didn't spend 10 or 20 posts asking for verification. Be aware, some folk will tell you that there should be only one exit point from the method, often this is true. In large methods you can get lost in the execution path if there are multiple exit points. I think it's a judgement call.
    As for returning a bogus boolean, but, from a design point of view, if your method really doesn't have anything to return to its caller then the signature should reflect that with a return type of void (I know you are suggesting returning the bogus boolean for a different reason, and you've abandoned the idea anyway, I'm just being pedantic here)(indulge me). Returning a bogus boolean makes the class method more difficult to understand from a design and JavaDoc point of view because I, as the user of your method, will see it returing a boolean and expect to be able to use that value, and it might color my view of what the method does.
    Lee

  • "Primitive Type Returned", when I try to configure the data return type.

    I am basically following this tutorial, Getting started with ColdFusion and Flash Builder 4 beta, but instead of using the database provided, I am using SQL Server 2008.  I am now stuck on the part titled, "Configuring the data return type".  In step 5 of this section, I submit my credentials and then I get a popup titled:
    Primitive Type Returned
    The operation returned a response of the type "Object".
    You may either update server code to fix the returned data or Click OK to set "Object" as the return type of this operation.
    I am not sure if "server code" would be my database and/or the Coldfusion code that was provided in this tutorial.  I am thinking that its the former, however I am new to both technologies.  Would anyone know why FlashBuilder will not strong type this data for me?

    Hi,
    Thanks for your feedback!
    The server code here means the ColdFusion code provided in the tutorial.
    The "Configure return type" step is performed to change the return type of the function.
    If you notice after importing the CFC in the Flash Builder the return type of getAllData was Object but with this step you are trying to change it to a Strong Type.
    So context click on the getAllData function,select 'Configure return type', enter "EmployeeSalesData" click NEXT , enter valid RDS credentials in the security dialog and click FINISH.
    This should have ideally set your return type to "EmployeeSalesData"(Strong type).
    Also if you are extremely new to this i suggest you to pick up a pre-release build of Flash Builder which has a COOL feature which can help you get started pretty fast and simplify most of these workflows.
    To avail for the pre-release build please send a mail to [email protected]
    Hope this helps!
    Thanks,
    Balaji
    http://balajisridhar.wordpress.com

  • HT2534 I already made an accoount, so how can I change it so that I do not have to choose a type of credit card. Cause it does not give me the option of NONE

    I already made an accoount, so how can I change it so that I do not have to choose a type of credit card. Cause it does not give me the option of NONE

    Did you follow the instructions on that page exactly ? The instructions work for me e.g. selecting a free app in the App Store app and tapping on 'free', then 'install app' and 'create new apple id' - filling in my details then gave a 'none' option on the payment details :

  • What does or should "public function create(): Node"  return exactly?

    Seit gegrüsst
    I playing around with javafx for a project, evaluating this technology.
    When I'm displaying things on the screen through "CustomNodes" I have to override the "public function create(): Node" method.
    In examples found on google, there's often created a new Group or something like that and than be returned.
    Why can't I just return "this"?
    What does or should "public function create(): Node" return exactly? And why is this so?
    thx for response
    carpe noctem
    livevil
    Edited by: livevil on Oct 14, 2008 4:28 PM
    Edited by: livevil on Oct 14, 2008 4:29 PM

    "public function create(): Node" method should return a graphic
    representation of the class.
    For example, FunctionGraph class below draws a mathematical functiuon:
    import javafx.scene.*;
    import javafx.scene.paint.*;
    import javafx.scene.geometry.*;
    import javafx.scene.transform.*;
    import javafx.ext.swing.*;
    import java.lang.Math;
    import java.lang.System;
    public class FunctionGraph extends CustomNode{
        attribute scale:Number = 1;
        attribute xMin: Number;
        attribute xMax: Number;
        attribute dx: Number = 1;
        attribute color: Color;
        attribute func: function(a: Number):Number;
        public function create():Node{
          var n = (xMax - xMin) / dx;
          var polyline = Polyline{ stroke: color };
          for(i in [0..n]){
            var x = xMin + i * dx;
            var y =  (this.func)(x);
            insert(   x * scale ) into polyline.points;
            insert( - y * scale ) into polyline.points;  
          return Group{ content: [ polyline] };
    var w = 300;
    var h = 300;
    var xMin = -7;
    var xMax = 7;
    var dx = 0.05;
    var scale = 20;
    SwingFrame{
        width:  300
        height: 300
        title: "Function Graph"
        content: Canvas{
          content:  Group{
                transform: Translate.translate(w/2, h/2)
                content: FunctionGraph {
                    xMin: xMin
                    xMax: xMax
                    scale: scale
                    dx: dx
                    color: Color.BLUE
                    func: function(x:Number):Number{ return Math.sin(x); }               
        visible: true
    }

  • WCF returning "The content type text/html of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8)"

    I have a WCF service I am trying to run on a new installation of 64-bit Windows Server 2008 IIS. Although it runs fine on Windows 2003 IIS, it is throwing the error in the thread title, which appears to be a server config issue, but I am not sure. Googling and searching the MSDN forums did not turn up a solution. I tried running WCF Logging, but that didn't help either.
    Does anyone have any suggestions on how to solve this probelm?
    Here is the error:
    The content type text/html of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
    <title>500 - Internal server error.</title>
    <style type="text/css">

    I have the same issue on Windows 7 machine. The service works fine using a SoapUI client but a .Net client faisl to get a response.
    Hi,
    I have a WCF service which works perfectly when using SoapUI but throws error in my .Net client.
    {"The content type text/html; charset=UTF-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first
    1024 bytes of the response were: '<HTML><HEAD><link rel=\"alternate\" type=\"text/xml\" href=\"http://xyz.mysite.com/ysa/Broker.svc?disco\"/><STYLE type=\"text/css\">#content{ FONT-SIZE: 0.7em;
    PADDING-BOTTOM: 2em; MARGIN-LEFT: 30px}BODY{MARGIN-TOP: 0px; MARGIN-LEFT: 0px; COLOR: #000000; FONT-FAMILY: Verdana; BACKGROUND-COLOR: white}P{MARGIN-TOP: 0px; MARGIN-BOTTOM: 12px; COLOR: #000000; FONT-FAMILY: Verdana}PRE{BORDER-RIGHT: #f0f0e0 1px solid; PADDING-RIGHT:
    5px; BORDER-TOP: #f0f0e0 1px solid; MARGIN-TOP: -5px; PADDING-LEFT: 5px; FONT-SIZE: 1.2em; PADDING-BOTTOM: 5px; BORDER-LEFT: #f0f0e0 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #f0f0e0 1px solid; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e5e5cc}.heading1{MARGIN-TOP:
    0px; PADDING-LEFT: 15px; FONT-WEIGHT: normal; FONT-SIZE: 26px; MARGIN-BOTTOM: 0px; PADDING-BOTTOM: 3px; MARGIN-LEFT: -30px; WIDTH: 100%; COLOR: #ffffff; PADDING-TOP: 10px; FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #003366}.intro{MARGIN-LEFT: -15px}</STYLE><TITLE>Broker
    Service</TITLE></HEAD><BODY><DIV id=\"content\"><P class=\"head'."}
    I have the same service hosted on my local machine and when I point to the local service I can execute the operation with no issues. The message encoding is Soap11. I tried changing to Soap12 but I get exact same error. Any ideas greatly appreciated.
    I do have windows Activation Features installed and I am using .Net Framework 4.
    Thanks
    Sofia Khatoon

  • Ipad keyboard does not give me enough room to type

    ipad keyboard does not give me enough room to type

    Try hold keyboard key down to split or undock keyboard.

  • [Eclipse Problem] Selection does not contain a main type?

    well i am using a GUI builder software which generates java code, i made a simple one to test and it will not compile.
    import java.awt.*;
    import javax.swing.*;
    public class name  {
         @SuppressWarnings("unused")
         private void initComponents() {
              panel1 = new JPanel();
              label1 = new JLabel();
              textField1 = new JTextField();
              panel1.setLayout(new FlowLayout());
              label1.setText("Name:");
              label1.setHorizontalAlignment(SwingConstants.LEFT);
              panel1.add(label1);
              textField1.setColumns(12);
              textField1.setText("hi");
              panel1.add(textField1);
         private JPanel panel1;
         private JLabel label1;
         private JTextField textField1;
    }it should make a basic swing GUI but it just gives me the error "Selection does not contain a main type"
    I did not select in eclipse "use public static void main" i know im not supposed to because this has no main method, but how am i to compile this? =X
    Edited by: -Johnny- on May 14, 2008 6:44 PM
    Edited by: -Johnny- on May 14, 2008 6:44 PM

    -Johnny- wrote:
    ya i used javac instead of eclipse then running it complains like you say
    but is there any way to compile this code and it will work? I was hoping to use this GUI builder for business purposes but it seems like a waste of money so far if i can't make working java application with it =\The code is fine. You need to learn the basics. Start with the intro tutorials at the Sun type and start reading and coding.
    Here is what the rest could look like:
    import java.awt.*;
    import javax.swing.*;
    public class name
        @SuppressWarnings("unused")
        private void initComponents()
            panel1 = new JPanel();
            label1 = new JLabel();
            textField1 = new JTextField();
            panel1.setLayout(new FlowLayout());
            label1.setText("Name:");
            label1.setHorizontalAlignment(SwingConstants.LEFT);
            panel1.add(label1);
            textField1.setColumns(12);
            textField1.setText("hi");
            panel1.add(textField1);
        private JPanel panel1;
        private JLabel label1;
        private JTextField textField1;
        public name()
            initComponents();
        public JPanel getPanel()
            return panel1;
        private static void createAndShowUI()
            JFrame frame = new JFrame("name");
            frame.getContentPane().add(new name().getPanel());
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        public static void main(String[] args)
            java.awt.EventQueue.invokeLater(new Runnable()
                public void run()
                    createAndShowUI();
    }Edited by: Encephalopathic on May 14, 2008 7:10 PM

  • Error 136 Functions that can be compossed must declare a return type

    Hello,
    I have downloaded the EF Final Release driver and Im working with Oracle 11g express.
    I have the following Procedure:
    PROCEDURE ProductosPedido(
    Datos Out SYS_RefCursor) IS
    BEGIN
    OPEN Datos FOR
    SELECT Nombre,
    TO_NUMBER(Precio * (SELECT SUM(unidades)
    FROM DETALLES_PEDIDO
    WHERE PRODUCTO = PRODUCTO.ID)) Importe
    FROM PRODUCTO;
    END;
    And the following config section:
    <oracle.dataaccess.client>
    <settings>
    <add name="System.Productospedido.RefCursor.Datos" value="implicitRefCursor bindinfo='mode=Output'"/>
    <add name="System.Productospedido.RefCursorMetaData.Datos.Column.0" value="implicitRefCursor metadata='ColumnName=Nombre;BaseColumnName=Nombre;BaseSchemaName=System;BaseTableName=Producto;NativeDataType=nvarchar2;ProviderType=NVarchar2;DataType=System.String;ColumnSize=50;AllowDBNull=true;IsKey=false'" />
    <add name="System.Productospedido.RefCursorMetaData.Datos.Column.1" value="implicitRefCursor metadata='ColumnName=Importe;NativeDataType=number;ProviderType=Decimal;DataType=System.Decimal;AllowDBNull=false;IsKey=false;ColumnSize=8'" />
    </settings>
    </oracle.dataaccess.client>
    I have imported succesfully in my EF Model, but when I try to consume the Procedure it gives me Error 136 Functions that can be compossed must declare a return type
    Any solutions?
    Thanks and best regards!

    A stored procedure does not have a ReturnType, therefore IsComposable="false" and it cannot be used in LINQ queries.
    This limitation is imposed by EF and not by ODP.
    You may want to create a stored function which has a ReturnType ref cursor, and include this stored function into your model. Then, under the same namespace, you create a class with a "stub" method/function and use EdmFunction() to map this stub to the stored function. For example,
    class myFuncClass
    [EdmFunction("Model.Store", "MY_STORED_FUNC_1")]
    public static <your_complex_type_or_DbDataRecord> MyFunc_1(int? column1, ...)
    throw new NotSupportedException("Direct calls are not supported");
    You should be able to call myFuncClass.MyFunc_1(x) in your LINQ query. Your stored function MY_STORED_FUNC_1 will be called in the generated query.

  • M127fn phone does not give signal fax when pressing 1,2,3

    Hi, I am Marc and I am new to this forum. Kindly excuse me of any wrong doing on a prior notice. Thanks! I bought the HP M127fn 4in1 unit one month ago and I am still not able to use this unit fully. On my old fax, Panasonic KX-FP342, when the phone rings and I answer, I can make a normal phone call or press the fax signal button to give a fax signal if it is a fax. However, If I do not answer, the panasonic unit picks up the line and gives a fax signal automatically after 5 unanswered ringtones. With the HP M127FN, I am not able to do this procedure. For description, I have the HP unit connected to the wall outlet and 2 phones in my house. One of the phones is connected to the HP Printer extension port and the second phone is connected to another separate socket ( to the same phone number ). When the phone rings for 5 times and I dont answer, the machine picks up the line and gives a fax signal automatically ( which is the normal procedure). But, the problem is when I answer the line. When I pick up the line and the caller asks me to give him a fax signal, I press 1,2,3 ( i tried this using the normal line and the extension line ) but nothing happens on both lines. So i appologize to the caller and ask him/her to call again which is really annoying me since I get around 10 to 15 faxes per day. I want the unit to answer automatically give a fax signal ( regardless of the caller's type ) after 5 ringtones and I want to answer the phone and be able to give a fax signal by myself if necessary. Fax answer type = automatic, rings type = all rings, extesion phone line = yes, rings to answer =5. Please Help!!!! 

    Hi , Welcome to the HP Forums! I see that your HP Laserjet m127fn phone, does not give signal fax when pressing 1,2,3. I am happy to help!  According to page 48 of your printer's user guide:  LCD control panel 1. On the product control panel, press the Setup button.
    2. Select Fax Setup, and then select Fax Recv. Setup.
    3. Select Extension Phone.
    4. Make sure that the On option is selected.
    With this setting turned on, you can alert the product to pick up the incoming fax call by pressing 1-2-3 sequentially on the telephone keypad. Turn this setting off only if you use pulse dialing or if you have a service from your telephone company that also uses the 1-2-3 sequence. The telephone company service does not work if it conflicts with the product. 5. Press the Back button to return to the Fax Recv. Setup menu.
    6. Select Answer Mode.
    7. Select Fax/Tel, and then press the OK button. With this setting, the product automatically picks up all calls and determines if the call is a voice or fax call. If the call is a fax call, the product handles the call as an incoming fax. If the incoming call is detected as a voice call, the product generates an audible synthesized ring to alert you of an incoming voice call. 8. Press the Back button to return to the Fax Recv. Setup menu.
    9. Select Fax/Tel Ring Time.
    10. Select the number of seconds after which the product should stop sounding the Fax/Tel audible ring to notify you of an incoming voice call, and then press the OK button. Hope this information helps!  “Please click the Thumbs up icon below to thank me for responding.”

  • Bounded Return Type

    If I have following code:
    public class Cell<X>
       X value;
      public Cell<? super X> copyToAndReturn(Cell<? super X> other)
          other.value = value ;
          return other;
      static void foo()
         Cell<String> c = new Cell<String>();
         Cell<Object> o = new Cell<Object>();
         o = c.copyToAndReturn(o);
    }Then the line:
         o = c.copyToAndReturn(o);gives a compile error:
    Type mismatch: cannot convert from Cell<capture#3-of ? super String> to Cell<Object>
    Object is indeed super class of String. If I have done something wrong in the assignment then what should be the type of assigned variable?

    panopticon wrote:
    The error is in assigning return type to Cell<? super String> to a variable of Cell<Object>.And you are surprised by this why?
    Cell<String> sc = new Cell<String>();
    Cell<? super String> ssc = sc;
    Cell<Object> oc = ssc; // woups..Just because Object is a supertype of String it's not necessarily the supertype represented by the wildcard. If you want more control over the type, use a type variable:
    public <C extends Cell<? super X>> C copyToAndReturn(C other) {
        other.value = value ;
        return other;
    }Sadly the JLS does not allow lower bounds on type parameters, otherwise the solution would be somewhat sexier:
    public <S super X> C copyToAndReturn(Cell<S> other) {
        other.value = value ;
        return other;
    }With kind regards
    Ben

  • Sys.sql_Module does not give full defination of store procedure

    I want to get a defination of a store procedure by using sys.sql_Module
    Beflow is the query i use 
    SELECT  
    @spTxt =ISNULL(smsp.definition, ssmsp.definition)) 
    FROM sys.all_objects AS sp
    LEFT OUTER JOIN sys.sql_modules AS smsp ON smsp.object_id = sp.object_id
    LEFT OUTER JOIN sys.system_sql_modules AS ssmsp ON ssmsp.object_id = sp.object_id
    WHERE (sp.type = N'P' OR sp.type = N'RF' OR sp.type='PC')and(sp.name=@SpName 
    and SCHEMA_NAME(sp.schema_id)=@SchemaName)
    @SchemaName = SCHEMA 
    ANd @SpName = Store procedure Name.
    This query does not give me complete store procedure.
    Is there any other table i need to join and I can get full defination?
    Thank you.
    BM19.23

    You're confusing what's being stored vs what's being displayed. The full proc is being stored in the definition column. It's just that SSMS won't display the full content of the cell.
    The following is a proc that we use to overcome this situation... (I have no clue who the original author is)
    CREATE PROCEDURE [dbo].[LongPrint]
    @String NVARCHAR(MAX)
    AS
    Example:
    exec LongPrint @string =
    'This String
    Exists to test
    the system.'
    /* This procedure is designed to overcome the limitation
    in the SQL print command that causes it to truncate strings
    longer than 8000 characters (4000 for nvarchar).
    It will print the text passed to it in substrings smaller than 4000
    characters. If there are carriage returns (CRs) or new lines (NLs in the text),
    it will break up the substrings at the carriage returns and the
    printed version will exactly reflect the string passed.
    If there are insufficient line breaks in the text, it will
    print it out in blocks of 4000 characters with an extra carriage
    return at that point.
    If it is passed a null value, it will do virtually nothing.
    NOTE: This is substantially slower than a simple print, so should only be used
    when actually needed.
    DECLARE @CurrentEnd BIGINT, /* track the length of the next substring */
    @offset TINYINT /*tracks the amount of offset needed */
    SET @string = REPLACE( REPLACE(@string, CHAR(13) + CHAR(10), CHAR(10)) , CHAR(13), CHAR(10))
    WHILE LEN(@String) > 1
    BEGIN
    IF CHARINDEX(CHAR(10), @String) BETWEEN 1 AND 4000
    BEGIN
    SET @CurrentEnd = CHARINDEX(CHAR(10), @String) -1
    SET @offset = 2
    END
    ELSE
    BEGIN
    SET @CurrentEnd = 4000
    SET @offset = 1
    END
    PRINT SUBSTRING(@String, 1, @CurrentEnd)
    SET @string = SUBSTRING(@String, @CurrentEnd+@offset, 1073741822)
    END /*End While loop*/
    GO
    To use the proc, you'd do something like this...
    DECLARE @sql VARCHAR(MAX)
    SELECT @sql = sm.definition FROM sys.sql_modules sm WHERE sm.object_id = 892230629
    EXEC dbo.LongPrint @sql
    HTH,
    Jason
    Jason Long

  • WRT610N V2 wired as 2ndary router to wired router, does not give IP address wirelessly

    My WRT610N V2 is wired as 2ndary router to a wired router but it does not give IP address wirelessly to connected PCs.
    It is getting DHCP IP address in the 192.168.1.xxx range from the 1st router, on its internet port, and issuing properly an IP addresses in the 10.10.1.xxx range thru its LAN port  when wired to a laptop.
    But if I connect to its 10.10.2.xxx wireless network with another laptop, the wifi adapter utility software shows the laptop is connected, but the laptop is not receiving an IP address.  Please help in correcting this, as I need to use this router to give internet access wirelessly to guest laptops.
    I know DDWRT does this kind of bridging with secondary DHCP when both routers are connected wirelessly, but it seems to me that if the 1st and 2nd router are wired together, DDWRT shuld not be needed for 2ndary HCP to take place.
    And 2ndary DHCP is indeed working for those laptops wired to the 2ndary Cisco router: seems to me it should be able to do it also wirelessly.

    In the upper right search bar type in 'two routers' to find your answer.

Maybe you are looking for