Search Results

Search found 2761 results on 111 pages for 'sequence generators'.

Page 1/111 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Configuring JPA Primary key sequence generators

    - by pachunoori.vinay.kumar(at)oracle.com
    This article describes the JPA feature of generating and assigning the unique sequence numbers to JPA entity .This article provides information on jpa sequence generator annotations and its usage. UseCase Description Adding a new Employee to the organization using Employee form should assign unique employee Id. Following description provides the detailed steps to implement the generation of unique employee numbers using JPA generators feature Steps to configure JPA Generators 1.Generate Employee Entity using "Entities from Table Wizard". View image2.Create a Database Connection and select the table "Employee" for which entity will be generated and Finish the wizards with default selections. View image 3.Select the offline database sources-Schema-create a Sequence object or you can copy to offline db from online database connection. View image 4.Open the persistence.xml in application navigator and select the Entity "Employee" in structure view and select the tab "Generators" in flat editor. 5.In the Sequence Generator section,enter name of sequence "InvSeq" and select the sequence from drop down list created in step3. View image 6.Expand the Employees in structure view and select EmployeeId and select the "Primary Key Generation" tab.7.In the Generated value section,select the "Use Generated value" check box ,select the strategy as "Sequence" and select the Generator as "InvSeq" defined step 4. View image   Following annotations gets added for the JPA generator configured in JDeveloper for an entity To use a specific named sequence object (whether it is generated by schema generation or already exists in the database) you must define a sequence generator using a @SequenceGenerator annotation. Provide a unique label as the name for the sequence generator and refer the name in the @GeneratedValue annotation along with generation strategy  For  example,see the below Employee Entity sample code configured for sequence generation. EMPLOYEE_ID is the primary key and is configured for auto generation of sequence numbers. EMPLOYEE_SEQ is the sequence object exist in database.This sequence is configured for generating the sequence numbers and assign the value as primary key to Employee_id column in Employee table. @SequenceGenerator(name="InvSeq", sequenceName = "EMPLOYEE_SEQ")   @Entity public class Employee implements Serializable {    @Id    @Column(name="EMPLOYEE_ID", nullable = false)    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="InvSeq")   private Long employeeId; }   @SequenceGenerator @GeneratedValue @SequenceGenerator - will define the sequence generator based on a  database sequence object Usage: @SequenceGenerator(name="SequenceGenerator", sequenceName = "EMPLOYEE_SEQ") @GeneratedValue - Will define the generation strategy and refers the sequence generator  Usage:     @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="name of the Sequence generator defined in @SequenceGenerator")

    Read the article

  • SQL SERVER – 2011 – Introduction to SEQUENCE – Simple Example of SEQUENCE

    - by pinaldave
    SQL Server 2011 will contain one of the very interesting feature called SEQUENCE. I have waited for this feature for really long time. I am glad it is here finally. SEQUENCE allows you to define a single point of repository where SQL Server will maintain in memory counter. USE AdventureWorks2008R2 GO CREATE SEQUENCE [Seq] AS [int] START WITH 1 INCREMENT BY 1 MAXVALUE 20000 GO SEQUENCE is very interesting concept and I will write few blog post on this subject in future. Today we will see only working example of the same. Let us create a sequence. We can specify various values like start value, increment value as well maxvalue. -- First Run SELECT NEXT VALUE FOR Seq, c.CustomerID FROM Sales.Customer c GO -- Second Run SELECT NEXT VALUE FOR Seq, c.AccountNumber FROM Sales.Customer c GO Once the sequence is defined, it can be fetched using following method. Every single time new incremental value is provided, irrespective of sessions. Sequence will generate values till the max value specified. Once the max value is reached, query will stop and will return error message. Msg 11728, Level 16, State 1, Line 2 The sequence object ‘Seq’ has reached its minimum or maximum value. Restart the sequence object to allow new values to be generated. We can restart the sequence from any particular value and it will work fine. -- Restart the Sequence ALTER SEQUENCE [Seq] RESTART WITH 1 GO -- Sequence Restarted SELECT NEXT VALUE FOR Seq, c.CustomerID FROM Sales.Customer c GO Let us do final clean up. -- Clean Up DROP SEQUENCE [Seq] GO There are lots of things one can find useful about this feature. We will see that in future posts. Here is the complete code for easy reference. USE AdventureWorks2008R2 GO CREATE SEQUENCE [Seq] AS [int] START WITH 1 INCREMENT BY 1 MAXVALUE 20000 GO -- First Run SELECT NEXT VALUE FOR Seq, c.CustomerID FROM Sales.Customer c GO -- Second Run SELECT NEXT VALUE FOR Seq, c.AccountNumber FROM Sales.Customer c GO -- Restart the Sequence ALTER SEQUENCE [Seq] RESTART WITH 1 GO -- Sequence Restarted SELECT NEXT VALUE FOR Seq, c.CustomerID FROM Sales.Customer c GO -- Clean Up DROP SEQUENCE [Seq] GO Reference: Pinal Dave (http://blog.SQLAuthority.com) Filed under: Pinal Dave, PostADay, SQL, SQL Authority, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, SQLServer, T SQL, Technology

    Read the article

  • SQL Server v.Next (Denali) : Deriving sets using SEQUENCE

    - by AaronBertrand
    One complaint about SEQUENCE is that there is no simple construct such as NEXT (@n) VALUES FOR so that you could get a range of SEQUENCE values as a set. In a previous post about SEQUENCE , I mentioned that to get a range of rows from a sequence, you should use the system stored procedure sys.sp_sequence_get_range . There are some issues with this stored procedure: the parameter names are not easy to memorize; it requires multiple conversions to and from SQL_VARIANT; and, producing a set from the...(read more)

    Read the article

  • 10 CSS Grid Layout Generators

    - by Jyoti
    There are a lot of online generators which are of no use to any designers, however some can help designers to an extent. Some example of online generators are favicon generators, background generators, button generators, and badge generators. Some of the useful kinds are the ones that solve one purpose with quick and easy steps, [...]

    Read the article

  • C#/.NET Little Wonders: Use Cast() and TypeOf() to Change Sequence Type

    - by James Michael Hare
    Once again, in this series of posts I look at the parts of the .NET Framework that may seem trivial, but can help improve your code by making it easier to write and maintain. The index of all my past little wonders posts can be found here. We’ve seen how the Select() extension method lets you project a sequence from one type to a new type which is handy for getting just parts of items, or building new items.  But what happens when the items in the sequence are already the type you want, but the sequence itself is typed to an interface or super-type instead of the sub-type you need? For example, you may have a sequence of Rectangle stored in an IEnumerable<Shape> and want to consider it an IEnumerable<Rectangle> sequence instead.  Today we’ll look at two handy extension methods, Cast<TResult>() and OfType<TResult>() which help you with this task. Cast<TResult>() – Attempt to cast all items to type TResult So, the first thing we can do would be to attempt to create a sequence of TResult from every item in the source sequence.  Typically we’d do this if we had an IEnumerable<T> where we knew that every item was actually a TResult where TResult inherits/implements T. For example, assume the typical Shape example classes: 1: // abstract base class 2: public abstract class Shape { } 3:  4: // a basic rectangle 5: public class Rectangle : Shape 6: { 7: public int Widtgh { get; set; } 8: public int Height { get; set; } 9: } And let’s assume we have a sequence of Shape where every Shape is a Rectangle… 1: var shapes = new List<Shape> 2: { 3: new Rectangle { Width = 3, Height = 5 }, 4: new Rectangle { Width = 10, Height = 13 }, 5: // ... 6: }; To get the sequence of Shape as a sequence of Rectangle, of course, we could use a Select() clause, such as: 1: // select each Shape, cast it to Rectangle 2: var rectangles = shapes 3: .Select(s => (Rectangle)s) 4: .ToList(); But that’s a bit verbose, and fortunately there is already a facility built in and ready to use in the form of the Cast<TResult>() extension method: 1: // cast each item to Rectangle and store in a List<Rectangle> 2: var rectangles = shapes 3: .Cast<Rectangle>() 4: .ToList(); However, we should note that if anything in the list cannot be cast to a Rectangle, you will get an InvalidCastException thrown at runtime.  Thus, if our Shape sequence had a Circle in it, the call to Cast<Rectangle>() would have failed.  As such, you should only do this when you are reasonably sure of what the sequence actually contains (or are willing to handle an exception if you’re wrong). Another handy use of Cast<TResult>() is using it to convert an IEnumerable to an IEnumerable<T>.  If you look at the signature, you’ll see that the Cast<TResult>() extension method actually extends the older, object-based IEnumerable interface instead of the newer, generic IEnumerable<T>.  This is your gateway method for being able to use LINQ on older, non-generic sequences.  For example, consider the following: 1: // the older, non-generic collections are sequence of object 2: var shapes = new ArrayList 3: { 4: new Rectangle { Width = 3, Height = 13 }, 5: new Rectangle { Width = 10, Height = 20 }, 6: // ... 7: }; Since this is an older, object based collection, we cannot use the LINQ extension methods on it directly.  For example, if I wanted to query the Shape sequence for only those Rectangles whose Width is > 5, I can’t do this: 1: // compiler error, Where() operates on IEnumerable<T>, not IEnumerable 2: var bigRectangles = shapes.Where(r => r.Width > 5); However, I can use Cast<Rectangle>() to treat my ArrayList as an IEnumerable<Rectangle> and then do the query! 1: // ah, that’s better! 2: var bigRectangles = shapes.Cast<Rectangle>().Where(r => r.Width > 5); Or, if you prefer, in LINQ query expression syntax: 1: var bigRectangles = from s in shapes.Cast<Rectangle>() 2: where s.Width > 5 3: select s; One quick warning: Cast<TResult>() only attempts to cast, it won’t perform a cast conversion.  That is, consider this: 1: var intList = new List<int> { 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 }; 2:  3: // casting ints to longs, this should work, right? 4: var asLong = intList.Cast<long>().ToList(); Will the code above work?  No, you’ll get a InvalidCastException. Remember that Cast<TResult>() is an extension of IEnumerable, thus it is a sequence of object, which means that it will box every int as an object as it enumerates over it, and there is no cast conversion from object to long, and thus the cast fails.  In other words, a cast from int to long will succeed because there is a conversion from int to long.  But a cast from int to object to long will not, because you can only unbox an item by casting it to its exact type. For more information on why cast-converting boxed values doesn’t work, see this post on The Dangers of Casting Boxed Values (here). OfType<TResult>() – Filter sequence to only items of type TResult So, we’ve seen how we can use Cast<TResult>() to change the type of our sequence, when we expect all the items of the sequence to be of a specific type.  But what do we do when a sequence contains many different types, and we are only concerned with a subset of a given type? For example, what if a sequence of Shape contains Rectangle and Circle instances, and we just want to select all of the Rectangle instances?  Well, let’s say we had this sequence of Shape: 1: var shapes = new List<Shape> 2: { 3: new Rectangle { Width = 3, Height = 5 }, 4: new Rectangle { Width = 10, Height = 13 }, 5: new Circle { Radius = 10 }, 6: new Square { Side = 13 }, 7: // ... 8: }; Well, we could get the rectangles using Select(), like: 1: var onlyRectangles = shapes.Where(s => s is Rectangle).ToList(); But fortunately, an easier way has already been written for us in the form of the OfType<T>() extension method: 1: // returns only a sequence of the shapes that are Rectangles 2: var onlyRectangles = shapes.OfType<Rectangle>().ToList(); Now we have a sequence of only the Rectangles in the original sequence, we can also use this to chain other queries that depend on Rectangles, such as: 1: // select only Rectangles, then filter to only those more than 2: // 5 units wide... 3: var onlyBigRectangles = shapes.OfType<Rectangle>() 4: .Where(r => r.Width > 5) 5: .ToList(); The OfType<Rectangle>() will filter the sequence to only the items that are of type Rectangle (or a subclass of it), and that results in an IEnumerable<Rectangle>, we can then apply the other LINQ extension methods to query that list further. Just as Cast<TResult>() is an extension method on IEnumerable (and not IEnumerable<T>), the same is true for OfType<T>().  This means that you can use OfType<TResult>() on object-based collections as well. For example, given an ArrayList containing Shapes, as below: 1: // object-based collections are a sequence of object 2: var shapes = new ArrayList 3: { 4: new Rectangle { Width = 3, Height = 5 }, 5: new Rectangle { Width = 10, Height = 13 }, 6: new Circle { Radius = 10 }, 7: new Square { Side = 13 }, 8: // ... 9: }; We can use OfType<Rectangle> to filter the sequence to only Rectangle items (and subclasses), and then chain other LINQ expressions, since we will then be of type IEnumerable<Rectangle>: 1: // OfType() converts the sequence of object to a new sequence 2: // containing only Rectangle or sub-types of Rectangle. 3: var onlyBigRectangles = shapes.OfType<Rectangle>() 4: .Where(r => r.Width > 5) 5: .ToList(); Summary So now we’ve seen two different ways to get a sequence of a superclass or interface down to a more specific sequence of a subclass or implementation.  The Cast<TResult>() method casts every item in the source sequence to type TResult, and the OfType<TResult>() method selects only those items in the source sequence that are of type TResult. You can use these to downcast sequences, or adapt older types and sequences that only implement IEnumerable (such as DataTable, ArrayList, etc.). Technorati Tags: C#,CSharp,.NET,LINQ,Little Wonders,TypeOf,Cast,IEnumerable<T>

    Read the article

  • using Quick Sequence Diagram Editor for sequence diagrams

    - by Jason S
    Anyone have experience with Quick Sequence Diagram Editor? The combination of instant display + text source code + Java implementation is very attractive to me, but I can't quite figure out how to make the syntax do what I want, and the documentation's not very clear. Here's a contrived example: al:Actor bill:Actor atm:ATM[a] bank:Bank[a] al:atm.give me $10 atm:al has $3=bank.check al's account balance al:atm.what time is it atm:al.it's now atm:al.stop bugging me atm:al.you only have $3 atm:bill.and don't you open your mouth bill:atm.who asked you? bill:atm.give me $20 al:atm.hey, I'm not finished! atm:bill has $765=bank.check bill's account balance atm:yes I'm sure, bill has $765=bank.hmm are you sure? atm:bill.here's $20, now go away atm:great, he's a cool dude=bank.I just gave Bill $20 al:atm.what about my $10? atm:al.read my lips: you only have $3 Here's the result from QSDE in single-threaded mode: and in multi-threaded mode: I guess I'm not clear what starts/ends those vertical bars. I have a situation which is single-threaded, but there's state involved, and all the messages are asynchronous. I guess that means I should use an external object to represent that state and its lifetime. What I want is for one timeline to represent the message sequence al:atm.give me $10 atm:bank.check al's account balance bank:atm.al has $3 atm:al.you only have $3 and another timeline to represent the message sequence bill:atm.give me $20 atm:bank.check bill's account balance bank:atm.bill has $765 atm:bank.hmm are you sure? bank:atm.yes I'm sure, bill has $765 atm:bill.here's $20, now go away atm:bank.I just gave Bill $20 bank:atm.great, he's a cool dude with the other "wisecracks" representing other miscellaneous messages that I don't care about right now. Is there a way to do this with QSDE?

    Read the article

  • Sequence for authentication on a decoupled client?

    - by A T
    Using a sequence diagram and example code could you explain to me how authentication works when the client is completely separated from the server? I.e.: you haven't generated any of the client using a server-side template engine, rather you are communicating using REST (SOAP xor HTTP) xor RPC (XML xor JSON) with javascript on the client-side. Specifically I would like to know the sequence of: Authenticating using basic auth (user+pass) with "my" server Authenticating using OAuth2, e.g.: with Facebook, with facebook's server then whatever extra steps are needed for "my" server And how it could be implemented. (feel free to use psuedo-code [like below] or [preferably] prototyped simply using BackboneJS, AngularJS, EmberJS, BatmanJS, AgilityJS, SammyJS xor ActiveJS. if cookie.status in [Expired, Tampered, Wrong IP, Invalid, Not Found]: try auth(user,pass): if user is in my db: try authenticate(user,pass) if successful: login user # give session-cookie here? else: present user with "auth failed" msg else if user not in db: redirect to "edit-profile" page PS: I have written an example (editable) auth sequence diagram; based on facebooks' documentation.

    Read the article

  • 10 CSS Grid Layout Generators

    - by Jyoti
    There are a lot of online generators which are of no use to any designers, however some can help designers to an extent. Some example of online generators are favicon generators, background generators, button generators, and badge generators. Some of the useful kinds are the ones that solve one purpose with quick and easy steps, especially useful for new designers, following is a list of some useful CSS grid layout generators. Grid Layout Generator By PageColumn: Blueprint Grid CSS Generator: Grid Generator By NetProtozo: Grid Generator By DegisnByGrid: Grid System Generator: YUI CSS Grid Builder: Variable Grid System: Firdamatic: CSS Sourced Ordered Variable Border Columed Page Maker: Grid Designer:

    Read the article

  • Is my sequence diagram correct?

    - by Dummy Derp
    NOTE: I am self studying UML so I have nobody to verify my diagrams and hence I am posting here, so please bear with me. This is the problem I got from some PDF available on Google that simply had the following problem statement: Problem Statement: A library contains books and journals. The task is to develop a computer system for borrowing books. In order to borrow a book the borrower must be a member of the library. There is a limit on the number of books that can be borrowed by each member of the library. The library may have several copies of a given book. It is possible to reserve a book. Some books are for short term loans only. Other books may be borrowed for 3 weeks. Users can extend the loans. Draw a use case diagram for a library. I already drew the Use Case diagram and had it checked by a community member. This time I drew sequence diagrams for borrowing a book and extending the date of return. Please let me know if they are correct. I drew them using Visual Paradigm and I dont know how to keep a control of the sequence numbers. If you do, please let me know :) Diagrams

    Read the article

  • How to visualize timer functionality in sequence diagram?

    - by truthseeker
    I am developing software for communication with external device through serial port. To better understand the new functionality I am trying to display it in sequence diagram. Flow of events is as follows. I send to the device command to reset it. This is asynchronous operation so there is some delay between request and response (typically 100 ms). There can be case when the answer never comes (for example device is not connected to the specified port or is currently turned off). For this purpose I create a timer with period twice the maximum answer time. In my case it is 2 * 125 ms = 250 ms. If the answer comes in predefined time interval, I destroy already running timer. If the answer doesnt come in predefined interval, timer initiates some action. After this action we can destroy it. How to effectively model this situation in sequence diagram? Addendum 1: Based on advices made by scarfridge i drew following UML diagram. Comment by Ozair is also helpful for simplifying the diagram even more.

    Read the article

  • How to depict Import a file action in the Sequence diagram

    - by user970696
    Everyone says sequence diagrams are so easy but I just cannot figure this out. Basically user clicks on an 'Import from temp folder' button, the program opens a window with a list populated with filenames, user clicks on a filename, clicks on OK and the document is imported. I know the order of the actions but how to depict e.g. populating a list, or selecting an item from a list? So I assume the objects would be like: [USER] [ImportDialogWindow] [ListOfFiles:STRING] [?where to go with selected file]

    Read the article

  • Task Sequence boots to logon screen instead of task sequence mode

    - by Ben M.
    I'm running a task sequence, and so that users don't accidentally interfere, I have the task sequence reboot to currently installed operating system, which as I understand, is supposed to boot to a sort of single user mode and all that shows is task sequence progress. However, this does not happen, it boots up like normal and comes to the logon screen and the task sequence runs in background. How can I adjust this behavior to the desired result?

    Read the article

  • How to learn to draw UML sequence diagrams

    - by PeterT
    How can I learn to draw UML sequence diagrams. Even though I don't use UML much I find that type of diagrams to be quite expressive and want to learn how to draw them. I don't plan to use them to visualise a large chunks of code, hence I would like to avoid using tools, and learn how to draw them with just pen and paper. Muscle memory is good. I guess I would need to learn some basics of notation first, and then just practice it like in "take the piece of code, draw a seq. diagram visualising the code, then generate the diagram using some tool/website, then compare what I'd drawn to what the tool result. Find the differences, correct them, repeat.". Where do I start? Can you recommend a book or a web site or something else?

    Read the article

  • ORA-03113 in code. In addition, TNS-12535 and ORA-03137 in alert file

    - by user1348107
    I've got an exception that contain ORA-03113: (SiPPSS.GetPrintWorkDirectDetail) - ERR:ORA-03113: end-of-file on communication channel Process ID: 7448 Session ID: 30 Serial number: 9802 ?????:12110937 ????:T855 Oracle.DataAccess.Client.OracleException ORA-03113: end-of-file on communication channel Process ID: 7448 Session ID: 30 Serial number: 9802 ?? Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck) ?? Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, String procedure, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, Boolean bCheck) ?? Oracle.DataAccess.Client.OracleCommand.ExecuteReader(Boolean requery, Boolean fillRequest, CommandBehavior behavior) ?? Oracle.DataAccess.Client.OracleDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) ?? System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) ?? SiPPSS.VSireiMeisaiDsTableAdapters.V_SIREI_MEISAITableAdapter.FillByRunningNoAndProcNo(V_SIREI_MEISAIDataTable dataTable, String RUNNING_NO, String PROC_NO) ?? C:\SVM\trunk\SiPPSSServer\Server\Dao\View\VSireiMeisaiDs.Designer.vb:? 386 ?? SiPPSS.GetPrintWorkDirectDetail.Execute(BLogicParam param) ?? C:\SVM\trunk\SiPPSSServer\Server\BLogic\Screen\Printing\Rprt0701\GetPrintWorkDirectDetail.vb:? 105 In this case, the oracle alert log as beblow: Fatal NI connect error 12170. VERSION INFORMATION: TNS for 64-bit Windows: Version 11.2.0.1.0 - Production Oracle Bequeath NT Protocol Adapter for 64-bit Windows: Version 11.2.0.1.0 - Production Windows NT TCP/IP NT Protocol Adapter for 64-bit Windows: Version 11.2.0.1.0 - Production Time: 01-11?-2012 13:50:45 Tracing not turned on. Tns error struct: ns main err code: 12535 TNS-12535: TNS: ??????·???????? ns secondary err code: 12560 nt main err code: 505 TNS-00505: ??????????? nt secondary err code: 60 nt OS err code: 0 Client address: (ADDRESS=(PROTOCOL=tcp)(HOST=10.41.102.53)(PORT=1794)) Thu Nov 01 13:54:17 2012 Thread 1 cannot allocate new log, sequence 1880 Private strand flush not complete Current log# 1 seq# 1879 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO01.LOG Thread 1 advanced to log sequence 1880 (LGWR switch) Current log# 2 seq# 1880 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO02.LOG Thu Nov 01 13:54:21 2012 Archived Log entry 1118 added for thread 1 sequence 1879 ID 0xe48db805 dest 1: Thu Nov 01 14:40:12 2012 Thread 1 cannot allocate new log, sequence 1881 Private strand flush not complete Current log# 2 seq# 1880 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO02.LOG Thread 1 advanced to log sequence 1881 (LGWR switch) Current log# 3 seq# 1881 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO03.LOG Thu Nov 01 14:40:16 2012 Archived Log entry 1119 added for thread 1 sequence 1880 ID 0xe48db805 dest 1: Thu Nov 01 15:27:42 2012 Thread 1 cannot allocate new log, sequence 1882 Private strand flush not complete Current log# 3 seq# 1881 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO03.LOG Thread 1 advanced to log sequence 1882 (LGWR switch) Current log# 1 seq# 1882 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO01.LOG Thu Nov 01 15:27:46 2012 Archived Log entry 1120 added for thread 1 sequence 1881 ID 0xe48db805 dest 1: Thu Nov 01 16:23:48 2012 Thread 1 cannot allocate new log, sequence 1883 Private strand flush not complete Current log# 1 seq# 1882 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO01.LOG Thread 1 advanced to log sequence 1883 (LGWR switch) Current log# 2 seq# 1883 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO02.LOG Thu Nov 01 16:23:52 2012 Archived Log entry 1121 added for thread 1 sequence 1882 ID 0xe48db805 dest 1: Thu Nov 01 17:05:50 2012 Thread 1 cannot allocate new log, sequence 1884 Private strand flush not complete Current log# 2 seq# 1883 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO02.LOG Thread 1 advanced to log sequence 1884 (LGWR switch) Current log# 3 seq# 1884 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO03.LOG Thu Nov 01 17:05:55 2012 Archived Log entry 1122 added for thread 1 sequence 1883 ID 0xe48db805 dest 1: Thu Nov 01 17:26:52 2012 Fatal NI connect error 12170. VERSION INFORMATION: TNS for 64-bit Windows: Version 11.2.0.1.0 - Production Oracle Bequeath NT Protocol Adapter for 64-bit Windows: Version 11.2.0.1.0 - Production Windows NT TCP/IP NT Protocol Adapter for 64-bit Windows: Version 11.2.0.1.0 - Production Time: 01-11?-2012 17:26:52 Tracing not turned on. Tns error struct: ns main err code: 12535 TNS-12535: TNS: ??????·???????? ns secondary err code: 12560 nt main err code: 505 TNS-00505: ??????????? nt secondary err code: 60 nt OS err code: 0 Client address: (ADDRESS=(PROTOCOL=tcp)(HOST=10.41.102.62)(PORT=1286)) Thu Nov 01 17:27:16 2012 Fatal NI connect error 12170. VERSION INFORMATION: TNS for 64-bit Windows: Version 11.2.0.1.0 - Production Oracle Bequeath NT Protocol Adapter for 64-bit Windows: Version 11.2.0.1.0 - Production Windows NT TCP/IP NT Protocol Adapter for 64-bit Windows: Version 11.2.0.1.0 - Production Time: 01-11?-2012 17:27:16 Tracing not turned on. Tns error struct: ns main err code: 12535 TNS-12535: TNS: ??????·???????? ns secondary err code: 12560 nt main err code: 505 TNS-00505: ??????????? nt secondary err code: 60 nt OS err code: 0 Client address: (ADDRESS=(PROTOCOL=tcp)(HOST=10.41.102.62)(PORT=1285)) Thu Nov 01 18:08:39 2012 Thread 1 advanced to log sequence 1885 (LGWR switch) Current log# 1 seq# 1885 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO01.LOG Thu Nov 01 18:08:40 2012 Archived Log entry 1123 added for thread 1 sequence 1884 ID 0xe48db805 dest 1: Thu Nov 01 19:33:21 2012 Thread 1 cannot allocate new log, sequence 1886 Private strand flush not complete Current log# 1 seq# 1885 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO01.LOG Thread 1 advanced to log sequence 1886 (LGWR switch) Current log# 2 seq# 1886 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO02.LOG Thu Nov 01 19:33:25 2012 Archived Log entry 1124 added for thread 1 sequence 1885 ID 0xe48db805 dest 1: Thu Nov 01 20:32:25 2012 Thread 1 cannot allocate new log, sequence 1887 Private strand flush not complete Current log# 2 seq# 1886 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO02.LOG Thread 1 advanced to log sequence 1887 (LGWR switch) Current log# 3 seq# 1887 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO03.LOG Thu Nov 01 20:32:29 2012 Archived Log entry 1125 added for thread 1 sequence 1886 ID 0xe48db805 dest 1: Thu Nov 01 21:13:07 2012 Thread 1 advanced to log sequence 1888 (LGWR switch) Current log# 1 seq# 1888 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO01.LOG Thu Nov 01 21:13:08 2012 Archived Log entry 1126 added for thread 1 sequence 1887 ID 0xe48db805 dest 1: Thu Nov 01 22:00:00 2012 Setting Resource Manager plan SCHEDULER[0x3006]:DEFAULT_MAINTENANCE_PLAN via scheduler window Setting Resource Manager plan DEFAULT_MAINTENANCE_PLAN via parameter Thu Nov 01 22:00:00 2012 Starting background process VKRM Thu Nov 01 22:00:00 2012 VKRM started with pid=32, OS id=4048 Thu Nov 01 22:00:59 2012 Thread 1 cannot allocate new log, sequence 1889 Private strand flush not complete Current log# 1 seq# 1888 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO01.LOG Thread 1 advanced to log sequence 1889 (LGWR switch) Current log# 2 seq# 1889 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO02.LOG Thu Nov 01 22:01:03 2012 Archived Log entry 1127 added for thread 1 sequence 1888 ID 0xe48db805 dest 1: Thu Nov 01 22:32:36 2012 Thread 1 advanced to log sequence 1890 (LGWR switch) Current log# 3 seq# 1890 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO03.LOG Thu Nov 01 22:32:37 2012 Archived Log entry 1128 added for thread 1 sequence 1889 ID 0xe48db805 dest 1: Thu Nov 01 22:33:18 2012 Errors in file d:\oracle\diag\rdbms\siporex\siporex\trace\siporex_ora_11884.trc (incident=101313): ORA-03137: TTC protocol internal error : [12333] [8] [49] [50] [] [] [] [] Incident details in: d:\oracle\diag\rdbms\siporex\siporex\incident\incdir_101313\siporex_ora_11884_i101313.trc Thu Nov 01 22:33:21 2012 Trace dumping is performing id=[cdmp_20121101223321] Thu Nov 01 22:40:43 2012 Thread 1 cannot allocate new log, sequence 1891 Private strand flush not complete Current log# 3 seq# 1890 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO03.LOG Thread 1 advanced to log sequence 1891 (LGWR switch) Current log# 1 seq# 1891 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO01.LOG Thu Nov 01 22:40:47 2012 Archived Log entry 1129 added for thread 1 sequence 1890 ID 0xe48db805 dest 1: Thu Nov 01 23:47:30 2012 Thread 1 cannot allocate new log, sequence 1892 Private strand flush not complete Current log# 1 seq# 1891 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO01.LOG Thread 1 advanced to log sequence 1892 (LGWR switch) Current log# 2 seq# 1892 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO02.LOG Thu Nov 01 23:47:34 2012 Archived Log entry 1130 added for thread 1 sequence 1891 ID 0xe48db805 dest 1: Fri Nov 02 00:49:31 2012 Thread 1 cannot allocate new log, sequence 1893 Private strand flush not complete Current log# 2 seq# 1892 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO02.LOG Thread 1 advanced to log sequence 1893 (LGWR switch) Current log# 3 seq# 1893 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO03.LOG Fri Nov 02 00:49:35 2012 Archived Log entry 1131 added for thread 1 sequence 1892 ID 0xe48db805 dest 1: Fri Nov 02 01:43:12 2012 Thread 1 cannot allocate new log, sequence 1894 Private strand flush not complete Current log# 3 seq# 1893 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO03.LOG Thread 1 advanced to log sequence 1894 (LGWR switch) Current log# 1 seq# 1894 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO01.LOG Fri Nov 02 01:43:17 2012 Archived Log entry 1132 added for thread 1 sequence 1893 ID 0xe48db805 dest 1: Fri Nov 02 01:52:51 2012 Errors in file d:\oracle\diag\rdbms\siporex\siporex\trace\siporex_ora_6124.trc (incident=101273): ORA-03137: TTC protocol internal error : [12333] [4] [80] [82] [] [] [] [] Incident details in: d:\oracle\diag\rdbms\siporex\siporex\incident\incdir_101273\siporex_ora_6124_i101273.trc Fri Nov 02 01:52:54 2012 Trace dumping is performing id=[cdmp_20121102015254] Fri Nov 02 02:00:00 2012 Clearing Resource Manager plan via parameter Fri Nov 02 02:43:37 2012 Thread 1 cannot allocate new log, sequence 1895 Private strand flush not complete Current log# 1 seq# 1894 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO01.LOG Thread 1 advanced to log sequence 1895 (LGWR switch) Current log# 2 seq# 1895 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO02.LOG Fri Nov 02 02:43:41 2012 Archived Log entry 1133 added for thread 1 sequence 1894 ID 0xe48db805 dest 1: Fri Nov 02 04:46:18 2012 Thread 1 cannot allocate new log, sequence 1896 Private strand flush not complete Current log# 2 seq# 1895 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO02.LOG Thread 1 advanced to log sequence 1896 (LGWR switch) Current log# 3 seq# 1896 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO03.LOG Fri Nov 02 04:46:22 2012 Archived Log entry 1134 added for thread 1 sequence 1895 ID 0xe48db805 dest 1: Fri Nov 02 04:51:41 2012 Errors in file d:\oracle\diag\rdbms\siporex\siporex\trace\siporex_ora_4048.trc (incident=101425): ORA-03137: TTC protocol internal error : [12333] [4] [67] [85] [] [] [] [] Incident details in: d:\oracle\diag\rdbms\siporex\siporex\incident\incdir_101425\siporex_ora_4048_i101425.trc Fri Nov 02 04:51:44 2012 Trace dumping is performing id=[cdmp_20121102045144] Fri Nov 02 05:54:44 2012 Thread 1 cannot allocate new log, sequence 1897 Private strand flush not complete Current log# 3 seq# 1896 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO03.LOG Thread 1 advanced to log sequence 1897 (LGWR switch) Current log# 1 seq# 1897 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO01.LOG Fri Nov 02 05:54:48 2012 Archived Log entry 1135 added for thread 1 sequence 1896 ID 0xe48db805 dest 1: Fri Nov 02 07:00:34 2012 Thread 1 cannot allocate new log, sequence 1898 Private strand flush not complete Current log# 1 seq# 1897 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO01.LOG Thread 1 advanced to log sequence 1898 (LGWR switch) Current log# 2 seq# 1898 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO02.LOG Fri Nov 02 07:00:38 2012 Archived Log entry 1136 added for thread 1 sequence 1897 ID 0xe48db805 dest 1: Fri Nov 02 08:32:41 2012 Thread 1 cannot allocate new log, sequence 1899 Private strand flush not complete Current log# 2 seq# 1898 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO02.LOG Thread 1 advanced to log sequence 1899 (LGWR switch) Current log# 3 seq# 1899 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO03.LOG Fri Nov 02 08:32:45 2012 Archived Log entry 1137 added for thread 1 sequence 1898 ID 0xe48db805 dest 1: Fri Nov 02 09:48:57 2012 Thread 1 advanced to log sequence 1900 (LGWR switch) Current log# 1 seq# 1900 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO01.LOG Fri Nov 02 09:48:58 2012 Archived Log entry 1138 added for thread 1 sequence 1899 ID 0xe48db805 dest 1: Fri Nov 02 10:18:15 2012 Thread 1 cannot allocate new log, sequence 1901 Private strand flush not complete Current log# 1 seq# 1900 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO01.LOG Thread 1 advanced to log sequence 1901 (LGWR switch) Current log# 2 seq# 1901 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO02.LOG Fri Nov 02 10:18:19 2012 Archived Log entry 1139 added for thread 1 sequence 1900 ID 0xe48db805 dest 1: Fri Nov 02 10:22:58 2012 Thread 1 cannot allocate new log, sequence 1902 Private strand flush not complete Current log# 2 seq# 1901 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO02.LOG Thread 1 advanced to log sequence 1902 (LGWR switch) Current log# 3 seq# 1902 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO03.LOG Fri Nov 02 10:23:02 2012 Archived Log entry 1140 added for thread 1 sequence 1901 ID 0xe48db805 dest 1: Fri Nov 02 10:27:38 2012 Thread 1 cannot allocate new log, sequence 1903 Checkpoint not complete Current log# 3 seq# 1902 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO03.LOG Thread 1 cannot allocate new log, sequence 1903 Private strand flush not complete Current log# 3 seq# 1902 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO03.LOG Thread 1 advanced to log sequence 1903 (LGWR switch) Current log# 1 seq# 1903 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO01.LOG Fri Nov 02 10:27:45 2012 Archived Log entry 1141 added for thread 1 sequence 1902 ID 0xe48db805 dest 1: Fri Nov 02 10:32:27 2012 Thread 1 cannot allocate new log, sequence 1904 Checkpoint not complete Current log# 1 seq# 1903 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO01.LOG Thread 1 cannot allocate new log, sequence 1904 Private strand flush not complete Current log# 1 seq# 1903 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO01.LOG Thread 1 advanced to log sequence 1904 (LGWR switch) Current log# 2 seq# 1904 mem# 0: D:\ORACLE\ORADATA\SIPOREX\REDO02.LOG Fri Nov 02 10:32:34 2012 Archived Log entry 1142 added for thread 1 sequence 1903 ID 0xe48db805 dest 1: Fri Nov 02 10:35:42 2012 Errors in file d:\oracle\diag\rdbms\siporex\siporex\trace\siporex_ora_15856.trc (incident=101353): ORA-03137: TTC protocol internal error : [12333] [8] [49] [50] [] [] [] [] Incident details in: d:\oracle\diag\rdbms\siporex\siporex\incident\incdir_101353\siporex_ora_15856_i101353.trc Fri Nov 02 10:35:44 2012 Trace dumping is performing id=[cdmp_20121102103544] I don't know main reason of this issue as well as how to fixing it. Please help me.

    Read the article

  • How would one run a task sequence within a task sequence in SCCM 2012 SP1

    - by BigHomie
    A Shining Example: Inside all of my task sequences I have a group that installs driver packages conditionally based on computer model: And of course, this list does nothing but grow. The fact that it grows isn't a big deal, what is a big deal is that every time it changes I have to manually copy and paste those changes across every task sequence I have, which of course leaves huge room for human error. The same goes for other groups of tasks that are common across task sequences. Looking for a solution where I could centrally manage these tasks, be it link other task sequences to a group within another task sequence, or create a separate task sequence and link to that. I came across a solution by John Marcum (SCCM MVP) that mentioned this ability, but this was a while ago and I can't find the link to it anymore to see if it's even still being updated/maintained, but I'm looking for more of a free solution, or even using Powershell or the ConfigMgr SDK is fine with me, I'm no stranger to either. Update Getting close: http://msdn.microsoft.com/en-us/library/jj217869.aspx

    Read the article

  • Calling next value of a sequence in jpa

    - by Javi
    Hello, I have a class mapped as an Entity to persist it in a database. I have an id field as the primary key so every time the object is persisted the value of the id is retrieved from the sequence "myClass_pk_seq", a code like the following one. @Entity @Table(name="myObjects") public class MyClass { @Id @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="sequence") @SequenceGenerator(name="sequence", sequenceName="myClass_pk_seq", allocationSize=1) @Column(name="myClassId") private Integer id; ... } I need to get the next value of the sequence myClass_pk_seq to reserve that value (get the next value of the sequence and the current value is incremented), but without saving the object. How can I call the next value of a sequence when it's defined like this? Thanks.

    Read the article

  • Is there a tool to do round trip software engineering between a sequence diagram and a group of objects that message back and forth?

    - by DeveloperDon
    Is there a tool to do round trip software engineering between a sequence diagram and a group of objects that message back and forth? Perhaps this seems a little exotic, but it seems like a function that includes message calls or even method invocations on other objects could be automatically converted to a sequence diagram given that it is not hard to do manually. Similarly, when a sequence diagram is modified, based on the message name and type of message, should it not be possible to add a message or method to the calling object?

    Read the article

  • Increment sequence when updating freebusy in icalendar?

    - by user302038
    I'm new to icalendar, but I couldn't find an answer to this specific situation. My web site has a shared calendar where users can add and update events. They can also indicate on the web site if they will be attending an event. I want to add a button to let them download the calendar as published icalendar events. When they indicated they will be attending an event, I want the event in the icalendar file to be set as "busy", otherwise as "not busy". So I can easily increment the sequence number on the event if the event is changed, but must I increment the sequence number if the user changed whether or not they will attend the event? I don't think that is a "mandatory" reason to increment the sequence, but I'm not sure. What will happen if the user changes their busy status for an event and re-downloads without the sequence number changing? I suppose I can keep a separate sequence number for each time the user changes their attendance status, then add the event sequence number and attendance sequence number together for the "final" event sequence number that's downloaded, but do I have to do it that way?

    Read the article

  • Hibernate sequence should only generate when ID is <=0

    - by Tim Leys
    Hi all, I'm using the folowing sequence in my code. (I got the sequence and @Id @SequenceGenerator(name = "S912_PRO_SEQ", sequenceName = "S912_PRO_SEQ", allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "S912_PRO_SEQ") @Column(name = "PRO_ID", unique = true, nullable = false, precision = 9, scale = 0) public int getId() { return this.id; } And using the following sequence / triggers in my DB. CREATE SEQUENCE S912_PRO_SEQ nomaxvalue minvalue 20; CREATE OR REPLACE TRIGGER S912_PRO_B_I_TRG BEFORE INSERT ON S912_project REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW ENABLE begin IF :NEW.pro_ID IS NULL THEN select S912_PRO_SEQ.nextval into :new.pro_ID from dual; END IF; end; I was wondering if there is a way to let hibernate generate a sequence ONLY if the ID is <=0 (not set) or if the ID already exists. I know for most cases my trigger would fix the situation. But I do not want to rely completely on it. I hope someone can help me out :p

    Read the article

  • Specifying distinct sequence per table in Hibernate on subclasses

    - by gutch
    Is there a way to specify distinct sequences for each table in Hibernate, if the ID is defined on a mapped superclass? All entities in our application extend a superclass called DataObject like this: @MappedSuperclass public abstract class DataObject implements Serializable { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE) @Column(name = "id") private int id; } @Entity @Table(name = "entity_a") public class EntityA extends DataObject { ... } @Entity @Table(name = "entity_b") public class EntityB extends DataObject { ... } This causes all entities to use a shared sequence, the default hibernate_sequence. What I would like to do is use a separate sequence for each entity, for example entity_a_sequence and entity_b_sequence in the example above. If the ID were specified on the subclasses then I could use the @SequenceGenerator annotation to specify a sequence for each entity, but in this case the ID is on the superclass. Given that ID is in the superclass, is there a way I can use a separate sequence for each entity — and if so, how? (We are using PostgreSQL 8.3, in case that's relevant)

    Read the article

  • Sequence Generators in T-SQL

    - by PaoloFCantoni
    We have an Oracle application that uses a standard pattern to populate surrogate keys. We have a series of extrinsic rows (that have specific values for the surrogate keys) and other rows that have intrinsic values. We use the following Oracle trigger snippet to determine what to do with the Surrogate key on insert: 'IF :NEW.SurrogateKey IS NULL THEN SELECT SurrogateKey_SEQ.NEXTVAL INTO :NEW.SurrogateKey FROM DUAL; END IF;' If the supplied surrogate key is null then get a value from the nominated sequence, else pass the supplied surrogate key through to the row. I can't seem to find an easy way to do this is T-SQL. There are all sorts of approaches, but none of which use the notion of a sequence generator like Oracle and other SQL-92 compliant DBs do. Anybody know of a really efficient way to do this in SQL Server T-SQL? BTW we're using SQL Server 2008 if that's any help. TIA, Paolo

    Read the article

  • More Fun with C# Iterators and Generators

    - by James Michael Hare
    In my last post, I talked quite a bit about iterators and how they can be really powerful tools for filtering a list of items down to a subset of items.  This had both pros and cons over returning a full collection, which, in summary, were:   Pros: If traversal is only partial, does not have to visit rest of collection. If evaluation method is costly, only incurs that cost on elements visited. Adds little to no garbage collection pressure.    Cons: Very slight performance impact if you know caller will always consume all items in collection. And as we saw in the last post, that con for the cost was very, very small and only really became evident on very tight loops consuming very large lists completely.    One of the key items to note, though, is the garbage!  In the traditional (return a new collection) method, if you have a 1,000,000 element collection, and wish to transform or filter it in some way, you have to allocate space for that copy of the collection.  That is, say you have a collection of 1,000,000 items and you want to double every item in the collection.  Well, that means you have to allocate a collection to hold those 1,000,000 items to return, which is a lot especially if you are just going to use it once and toss it.   Iterators, though, don't have this problem.  Each time you visit the node, it would return the doubled value of the node (in this example) and not allocate a second collection of 1,000,000 doubled items.  Do you see the distinction?  In both cases, we're consuming 1,000,000 items.  But in one case we pass back each doubled item which is just an int (for example's sake) on the stack and in the other case, we allocate a list containing 1,000,000 items which then must be garbage collected.   So iterators in C# are pretty cool, eh?  Well, here's one more thing a C# iterator can do that a traditional "return a new collection" transformation can't!   It can return **unbounded** collections!   I know, I know, that smells a lot like an infinite loop, eh?  Yes and no.  Basically, you're relying on the caller to put the bounds on the list, and as long as the caller doesn't you keep going.  Consider this example:   public static class Fibonacci {     // returns the infinite fibonacci sequence     public static IEnumerable<int> Sequence()     {         int iteration = 0;         int first = 1;         int second = 1;         int current = 0;         while (true)         {             if (iteration++ < 2)             {                 current = 1;             }             else             {                 current = first + second;                 second = first;                 first = current;             }             yield return current;         }     } }   Whoa, you say!  Yes, that's an infinite loop!  What the heck is going on there?  Yes, that was intentional.  Would it be better to have a fibonacci sequence that returns only a specific number of items?  Perhaps, but that wouldn't give you the power to defer the execution to the caller.   The beauty of this function is it is as infinite as the sequence itself!  The fibonacci sequence is unbounded, and so is this method.  It will continue to return fibonacci numbers for as long as you ask for them.  Now that's not something you can do with a traditional method that would return a collection of ints representing each number.  In that case you would eventually run out of memory as you got to higher and higher numbers.  This method, though, never runs out of memory.   Now, that said, you do have to know when you use it that it is an infinite collection and bound it appropriately.  Fortunately, Linq provides a lot of these extension methods for you!   Let's say you only want the first 10 fibonacci numbers:       foreach(var fib in Fibonacci.Sequence().Take(10))     {         Console.WriteLine(fib);     }   Or let's say you only want the fibonacci numbers that are less than 100:       foreach(var fib in Fibonacci.Sequence().TakeWhile(f => f < 100))     {         Console.WriteLine(fib);     }   So, you see, one of the nice things about iterators is their power to work with virtually any size (even infinite) collections without adding the garbage collection overhead of making new collections.    You can also do fun things like this to make a more "fluent" interface for for loops:   // A set of integer generator extension methods public static class IntExtensions {     // Begins counting to inifity, use To() to range this.     public static IEnumerable<int> Every(this int start)     {         // deliberately avoiding condition because keeps going         // to infinity for as long as values are pulled.         for (var i = start; ; ++i)         {             yield return i;         }     }     // Begins counting to infinity by the given step value, use To() to     public static IEnumerable<int> Every(this int start, int byEvery)     {         // deliberately avoiding condition because keeps going         // to infinity for as long as values are pulled.         for (var i = start; ; i += byEvery)         {             yield return i;         }     }     // Begins counting to inifity, use To() to range this.     public static IEnumerable<int> To(this int start, int end)     {         for (var i = start; i <= end; ++i)         {             yield return i;         }     }     // Ranges the count by specifying the upper range of the count.     public static IEnumerable<int> To(this IEnumerable<int> collection, int end)     {         return collection.TakeWhile(item => item <= end);     } }   Note that there are two versions of each method.  One that starts with an int and one that starts with an IEnumerable<int>.  This is to allow more power in chaining from either an existing collection or from an int.  This lets you do things like:   // count from 1 to 30 foreach(var i in 1.To(30)) {     Console.WriteLine(i); }     // count from 1 to 10 by 2s foreach(var i in 0.Every(2).To(10)) {     Console.WriteLine(i); }     // or, if you want an infinite sequence counting by 5s until something inside breaks you out... foreach(var i in 0.Every(5)) {     if (someCondition)     {         break;     }     ... }     Yes, those are kinda play functions and not particularly useful, but they show some of the power of generators and extension methods to form a fluid interface.   So what do you think?  What are some of your favorite generators and iterators?

    Read the article

  • create a random sequence, skip to any part of the sequence

    - by Michael Xu
    Hi everyone, In Linux. There is an srand() function, where you supply a seed and it will guarantee the same sequence of pseudorandom numbers in subsequent calls to the random() function afterwards. Lets say, I want to store this pseudo random sequence by remembering this seed value. Furthermore, let's say I want the 100 thousandth number in this pseudo random sequence later. One way, would be to supply the seed number using srand(), and then calling random() 100 thousand times, and remembering this number. Is there a better way of skipping all 99,999 other numbers in the pseudo random list and directly getting the 100 thousandth number in the list. thanks, m

    Read the article

  • oracle sequence init

    - by gospodin
    I wanted to export 3 tables from db1 into db2. Before the export starts, I will create the sequences for those 3 tables. CREATE SEQUENCE TEST_SEQ START WITH 1 INCREMENT BY 1; After the export, I will reinitialize sequnce values to match the max(id) + 1 from the table. CREATE OR REPLACE PROCEDURE "TEST_SEQUENCE" AUTHID CURRENT_USER is v_num number; begin select max(ID) into v_num from TABLE_1; EXECUTE IMMEDIATE 'ALTER SEQUENCE TEST_SEQ INCREMENT BY ' || v_num; EXECUTE IMMEDIATE 'ALTER SEQUENCE 1TEST_SEQ INCREMENT BY 1'; end; / show errors; execute TEST_SEQ; This procedure compiles and executes without problems. But when I want to check t he last value of the sequence, like select TEST_SEQ.nextval from dual; I still get the "1". Can someone tell me why my procedure did not impact my sequence? ps. I am using oracle sql developper to pass sql. Thanks

    Read the article

  • Which Oracle table uses a sequence?

    - by Jaú
    Having a sequence, I need to find out which table.column gets its values. As far as I know, Oracle doesn't keep track of this relationship. So, looking up for the sequence in source code would be the only way. Is that right? Anyone knows of some way to find out this sequence-table relationship?

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >