Search Results

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

Page 24/111 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • Is this code well-defined?

    - by Nawaz
    This code is taken from a discussion going on here. someInstance.Fun(++k).Gun(10).Sun(k).Tun(); Is this code well-defined? Is ++k Fun() evaluated before k in Sun()? What if k is user-defined type, not built-in type? And in what ways the above function calls order is different from this: eat(++k);drink(10);sleep(k); As far as I can say, in both situations, there exists a sequence point after each function call. If so, then why can't the first case is also well-defined like the second one? Section 1.9.17 of the C++ ISO standard says this about sequence points and function evaluation: When calling a function (whether or not the function is inline), there is a sequence point after the evaluation of all function arguments (if any) which takes place before execution of any expressions or statements in the function body. There is also a sequence point after the copying of a returned value and before the execution of any expressions outside the function.

    Read the article

  • Parse a text file into multiple text file

    - by Vijay Kumar Singh
    I want to get multiple file by parsing a input file Through Java. The Input file contains many fasta format of thousands of protein sequence and I want to generate raw format(i.e., without any comma semicolon and without any extra symbol like "", "[", "]" etc) of each protein sequence. A fasta sequence starts form "" symbol followed by description of protein and then sequence of protein. For example ? lcl|NC_000001.10_cdsid_XP_003403591.1 [gene=LOC100652771] [protein=hypothetical protein LOC100652771] [protein_id=XP_003403591.1] [location=join(12190..12227,12595..12721,13403..13639)] MSESINFSHNLGQLLSPPRCVVMPGMPFPSIRSPELQKTTADLDHTLVSVPSVAESLHHPEITFLTAFCL PSFTRSRPLPDRQLHHCLALCPSFALPAGDGVCHGPGLQGSCYKGETQESVESRVLPGPRHRH Like above formate the input file contains 1000s of protein sequence. I have to generate thousands of raw file containing only individual protein sequence without any special symbol or gaps. I have developed the code for it in Java but out put is : Cannot open a file followed by cannot find file. Please help me to solve my problem. Regards Vijay Kumar Garg Varanasi Bharat (India) The code is /*Java code to convert FASTA format to a raw format*/ import java.io.*; import java.util.*; import java.util.regex.*; import java.io.FileInputStream; // java package for using regular expression public class Arrayren { public static void main(String args[]) throws IOException { String a[]=new String[1000]; String b[][] =new String[1000][1000]; /*open the id file*/ try { File f = new File ("input.txt"); //opening the text document containing genbank ids FileInputStream fis = new FileInputStream("input.txt"); //Reading the file contents through inputstream BufferedInputStream bis = new BufferedInputStream(fis); // Writing the contents to a buffered stream DataInputStream dis = new DataInputStream(bis); //Method for reading Java Standard data types String inputline; String line; String separator = System.getProperty("line.separator"); // reads a line till next line operator is found int i=0; while ((inputline=dis.readLine()) != null) { i++; a[i]=inputline; a[i]=a[i].replaceAll(separator,""); //replaces unwanted patterns like /n with space a[i]=a[i].trim(); // trims out if any space is available a[i]=a[i]+".txt"; //takes the file name into an array try // to handle run time error /*take the sequence in to an array*/ { BufferedReader in = new BufferedReader (new FileReader(a[i])); String inline = null; int j=0; while((inline=in.readLine()) != null) { j++; b[i][j]=inline; Pattern q=Pattern.compile(">"); //Compiling the regular expression Matcher n=q.matcher(inline); //creates the matcher for the above pattern if(n.find()) { /*appending the comment line*/ b[i][j]=b[i][j].replaceAll(">gi",""); //identify the pattern and replace it with a space b[i][j]=b[i][j].replaceAll("[a-zA-Z]",""); b[i][j]=b[i][j].replaceAll("|",""); b[i][j]=b[i][j].replaceAll("\\d{1,15}",""); b[i][j]=b[i][j].replaceAll(".",""); b[i][j]=b[i][j].replaceAll("_",""); b[i][j]=b[i][j].replaceAll("\\(",""); b[i][j]=b[i][j].replaceAll("\\)",""); } /*printing the sequence in to a text file*/ b[i][j]=b[i][j].replaceAll(separator,""); b[i][j]=b[i][j].trim(); // trims out if any space is available File create = new File(inputline+"R.txt"); try { if(!create.exists()) { create.createNewFile(); // creates a new file } else { System.out.println("file already exists"); } } catch(IOException e) // to catch the exception and print the error if cannot open a file { System.err.println("cannot create a file"); } BufferedWriter outt = new BufferedWriter(new FileWriter(inputline+"R.txt", true)); outt.write(b[i][j]); // printing the contents to a text file outt.close(); // closing the text file System.out.println(b[i][j]); } } catch(Exception e) { System.out.println("cannot open a file"); } } } catch(Exception ex) // catch the exception and prints the error if cannot find file { System.out.println("cannot find file "); } } } If you provide me correct it will be much easier to understand.

    Read the article

  • XML Schema for a .NET type that inherits and implements

    - by John Ruiz
    Hi, Please consider the following three .NET types: I have an interface, an abstract class, and a concrete class. My question is how to write the XML Schema to include the properties from the interface and from the abstract class. public interface IStartable { bool RequiresKey { get; set; } void Start(object key); } public abstract class Vehicle { uint WheelCount { get; set; } } public class Car : Vehicle, IStartable { public bool RequiresKey { get; set; } public string Make { get; set; } publilc string Model { get; set; } public Car() {} public void Start(object key) { // start car with key } } I don't know how to complete this schema: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="cars" xmlns="cars" xmlns:c="cars"> <!-- How do I get car to have vehicle's wheelcount AND IStartable's RequiresKey? --> <xs:element name="Car" type="c:Car" /> <xs:complexType name="Car"> <xs:complexContent> <xs:extension base="c:Vehicle"> <xs:group ref=c:CarGroup" /> </xs:extension> </xs:complexContent> </xs:complexType> <xs:group name="CarGroup"> <xs:sequence> <xs:element name="Make" type="xs:token" /> <xs:element name="Model" type="xs:token" /> </xs:sequence> </xs:group> <xs:complexType name="Vehicle"> <xs:sequence> <xs:element name="WheelCount" type="xs:unsignedInt" /> </xs:sequence> </xs:complexType> <xs:complexType name="IStartable"> <xs:sequence> <xs:element name="RequiresKey" type="xs:boolean" /> </xs:sequence> </xs:complexType> </xs:schema>

    Read the article

  • Unable to serialize correctly- c#

    - by ltech
    I had asked this Yesterday If my xsd schema changes to <xs:element name="Document" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="MetaDoc" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="ATTRIBUTES" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="author" type="xs:string" minOccurs="0" /> <xs:element name="max_versions" type="xs:string" minOccurs="0" /> <xs:element name="summary" type="xs:string" minOccurs="0" /> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> My xsd - class generation becomes /// <remarks/> [System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] [System.Xml.Serialization.XmlArrayItemAttribute("MetaDoc", typeof(DocumentMetaDocATTRIBUTES[]), Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)] [System.Xml.Serialization.XmlArrayItemAttribute("ATTRIBUTES", typeof(DocumentMetaDocATTRIBUTES), Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false, NestingLevel=1)] public DocumentMetaDocATTRIBUTES[][][] Document { get { return this.documentField; } set { this.documentField = value; } } If I am deriving to CollectionBase, as shown in my previous post, how would I manage the XmlArrayItemAttribute ? so that I can read this part of my input xml into my strongly types object <Document> <MetaDoc> <ATTRIBUTES> <author>asas</author> <max_versions>1</max_versions> <summary>aasasqqqq</summary> </ATTRIBUTES> </MetaDoc> </Document>

    Read the article

  • Swift CMutablePointers in factories e.g. NewMusicSequence

    - by Gene De Lisa
    How do you use C level factory methods in Swift? Let's try using a factory such as NewMusicSequence(). OSStatus status var sequence:MusicSequence status=NewMusicSequence(&sequence) This errors out with "error: variable 'sequence' passed by reference before being initialized". Set sequence to nil, and you get EXC_BAD_INSTRUCTION. You can try being explicit like this: var sp:CMutablePointer<MusicSequence>=nil status=NewMusicSequence(sp) But then you get a bad access exception when you set sp to nil. If you don't set sp, you get an "error: variable 'sp' used before being initialized" Here's the reference.

    Read the article

  • "Anagram solver" based on statistics rather than a dictionary/table?

    - by James M.
    My problem is conceptually similar to solving anagrams, except I can't just use a dictionary lookup. I am trying to find plausible words rather than real words. I have created an N-gram model (for now, N=2) based on the letters in a bunch of text. Now, given a random sequence of letters, I would like to permute them into the most likely sequence according to the transition probabilities. I thought I would need the Viterbi algorithm when I started this, but as I look deeper, the Viterbi algorithm optimizes a sequence of hidden random variables based on the observed output. I am trying to optimize the output sequence. Is there a well-known algorithm for this that I can read about? Or am I on the right track with Viterbi and I'm just not seeing how to apply it?

    Read the article

  • Does a Postgresql dump create sequences that start with - or after - the last key?

    - by bennylope
    I recently created a SQL dump of a database behind a Django project, and after cleaning the SQL up a little bit was able to restore the DB and all of the data. The problem was the sequences were all mucked up. I tried adding a new user and generated the Python error IntegrityError: duplicate key violates unique constraint. Naturally I figured my SQL dump didn't restart the sequence. But it did: DROP SEQUENCE "auth_user_id_seq" CASCADE; CREATE SEQUENCE "auth_user_id_seq" INCREMENT 1 START 446 MAXVALUE 9223372036854775807 MINVALUE 1 CACHE 1; ALTER TABLE "auth_user_id_seq" OWNER TO "db_user"; I figured out that a repeated attempt at creating a user (or any new row in any table with existing data and such a sequence) allowed for successful object/row creation. That solved the pressing problem. But given that the last user ID in that table was 446 - the same start value in the sequence creation above - it looks like Postgresql was simply trying to start creating rows with that key. Does the SQL dump provide the wrong start key by 1? Or should I invoke some other command to start sequences after the given start ID? Keenly curious.

    Read the article

  • How to column-ify an output from a certain program?

    - by mbaitoff
    I have a program that generates and outputs a sequence of simple sample math homework tasks, like: 1 + 1 = ... 3 + 3 = ... 2 + 5 = ... 3 + 7 = ... 4 + 2 = ... a sequence can be quite long, and I'd like to save space when this sequence is printed by converting it as follows: 1 + 1 = ... 3 + 7 = ... 3 + 3 = ... 4 + 2 = ... 2 + 5 = ... that is, wrapping the lines into the two or more columns. I was expecting the column linux utility to do the job using the -c N option witn N=2, however, it still outputs the lines in one column whatever the N is. How would I do the column-ifying of the sequence of lines?

    Read the article

  • Anonymous iterators blocks in Clojure?

    - by Checkers
    I am using clojure.contrib.sql to fetch some records from an SQLite database. (defn read-all-foo [] (let [sql "select * from foo"] (with-connection *db* (with-query-results res [sql] (into [] res))))) Now, I don't really want to realize the whole sequence before returning from the function (i.e. I want to keep it lazy), but if I return res directly or wrap it some kind of lazy wrapper (for example I want to make a certain map transformation on result sequence), SQL bindings will be gone after I return, so realizing the sequence will throw an error. How can I enclose the whole function in a closure and return a kind of anonymous iterator block (like yield in C# or Python)? Or is there another way to return a lazy sequence from this function?

    Read the article

  • How to specify a child element in XML schema with a name but any content?

    - by mackenir
    I am trying to write some XML schema code to specify that a particular element 'abc' may have a child element with name 'xyz', and that element may have any attributes, and any child elements. At the moment I have this: <xs:element name="abc"> <xs:complexType> <xs:sequence> <xs:element name="xyz"> <xs:complexType> <xs:sequence> <xs:any/> </xs:sequence> <xs:anyAttribute/> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> But when I validate my XML against the schema, I get validation failures complaining about the child elements of the xyz element.

    Read the article

  • How to find the largest square in the number (Java)

    - by Ypsilon IV
    Hello everyone, I want to find the largest square in the number, but I am stuck at some point. I would really appreciate some suggestions. This is what I've done so far: I take the number on the input, factorize into prime numbers, and put the sequence of prime numbers to ArrayList. Numbers are sorted, in a sense, thus the numbers in the sequence are increasing. For example, 996 is 2 2 3 83 1000 is 2 2 2 5 5 5 100000 is 2 2 2 2 2 5 5 5 5 5 My idea now is to count number of occurrences of each elements in the sequence, so if the number of occurrences is divisible by two, then this is the square. In this way, I can get another sequence, where the right most element divisible by two is the largest square. What is the most efficient way to count occurrences in the ArrayList? Or is there any better way to find the largest square? Many thanks in advance!

    Read the article

  • better for-loop syntax for detecting empty sequences?

    - by Dmitry Beransky
    Hi, Is there a better way to write the following: row_counter = 0 for item in iterable_sequence: # do stuff with the item counter += 1 if not row_counter: # handle the empty-sequence-case Please keep in mind that I can't use len(iterable_sequence) because 1) not all sequences have known lengths; 2) in some cases calling len() may trigger loading of the sequence's items into memory (as the case would be with sql query results). The reason I ask is that I'm simply curious if there is a way to make above more concise and idiomatic. What I'm looking for is along the lines of: for item in sequence: #process item *else*: #handle the empty sequence case (assuming "else" here worked only on empty sequences, which I know it doesn't)

    Read the article

  • Anonymous iterator blocks in Clojure?

    - by Checkers
    I am using clojure.contrib.sql to fetch some records from an SQLite database. (defn read-all-foo [] (with-connection *db* (with-query-results res ["select * from foo"] (into [] res)))) Now, I don't really want to realize the whole sequence before returning from the function (i.e. I want to keep it lazy), but if I return res directly or wrap it some kind of lazy wrapper (for example I want to make a certain map transformation on result sequence), SQL-related bindings will be reset and connection will be closed after I return, so realizing the sequence will throw an exception. How can I enclose the whole function in a closure and return a kind of anonymous iterator block (like yield in C# or Python)? Or is there another way to return a lazy sequence from this function?

    Read the article

  • Separating merged array of arithmetic and geometric series

    - by user1814037
    My friend asked me an interseting question. Given an array of positive integers in increasing order. Seperate them in two series, an arithmetic sequence and geometric sequence. The given array is such that a solution do exist. The union of numbers of the two sequence must be the given array. Both series can have common elements i.e. series need not to be disjoint. The ratio of the geometric series can be fractional. Example: Given series : 2,4,6,8,10,12,25 AP: 2,4,6,8,10,12 GP: 4,10,25 I tried taking few examples but could not reach a general way. Even tried some graph implementation by introducing edges if they follow a particular sequence but could not reach solution.

    Read the article

  • MySQL - Counting rows in preparation for greatest-n-per-group not working?

    - by John M
    Referring to SO and other sites have given me examples of how to use MySQL to create a 'greatest-n-per-group' query. My variant on this would be to have a query that returns the first 3 rows of each category. As the basis for this I need to sort my data into a usable sequence and that is where my problems start. Running just the sequence query with row numbering shows that changes in category are mostly ignored. I should have 35 categories returning rows but only 5 do so. My query: set @c:=0; set @a:=0; SELECT IF(@c = tdg, @a:=@a+1, @a:=1) AS rownum, (@c:=tdg) , julian_day, sequence, complete, year, tdg FROM tsd WHERE complete = 0 order by tdg, year, julian_day, sequence Do I have a syntax mistake with this query?

    Read the article

  • R implementation of sorting by reversals

    - by user1357015
    I was wondering if there is an implementation in R where it sorts a permutation of n numbers into the original 1...n sequence and provides the number of reversals needed. Eg an implementation of the "sorting by reversals" or "sorting by translocation" as outlined in this ppt. Specifically, I have a permutation of a sequence of n elements, pi(n), and I want to figure out how close it is to the original sequence. The number of reversals seems a good metric. Thanks!

    Read the article

  • Generating incremental numeric column values during INSERT SELECT statement

    - by Charles
    I need to copy some data from one table to another in Oracle, while generating incremental values for a numeric column in the new table. This is a once-only exercise with a trivial number of rows (100). I have an adequate solution to this problem but I'm curious to know if there is a more elegant way. I'm doing it with a temporary sequence, like so: CREATE SEQUENCE temp_seq START WITH 1; INSERT INTO new_table (new_col, copied_col1, copied_col2) SELECT temp_seq.NEXTVAL, o.* FROM (SELECT old_col1, old_col2 FROM old_table) o; DROP SEQUENCE temp_seq; Is there way to do with without creating the sequence or any other temporary object? Specifically, can this be done with a self-contained INSERT SELECT statement? There are similar questions, but I believe the specifics of my question are original to SO.

    Read the article

  • c programming Language [closed]

    - by ash89
    Write a program in C program to find the sum of the following: The input contain a sequence of two or more positive integers terminated by -1. Write a piece of code to count the ‘incidences’ in this sequence (i.e. the number of pairs of equal, adjacent numbers). For example, the following sequence contains 4 incidences: 4 2 9 9 3 7 7 7 3 3 -1

    Read the article

  • StreamInsight 2.1, meet LINQ

    - by Roman Schindlauer
    Someone recently called LINQ “magic” in my hearing. I leapt to LINQ’s defense immediately. Turns out some people don’t realize “magic” is can be a pejorative term. I thought LINQ needed demystification. Here’s your best demystification resource: http://blogs.msdn.com/b/mattwar/archive/2008/11/18/linq-links.aspx. I won’t repeat much of what Matt Warren says in his excellent series, but will talk about some core ideas and how they affect the 2.1 release of StreamInsight. Let’s tell the story of a LINQ query. Compile time It begins with some code: IQueryable<Product> products = ...; var query = from p in products             where p.Name == "Widget"             select p.ProductID; foreach (int id in query) {     ... When the code is compiled, the C# compiler (among other things) de-sugars the query expression (see C# spec section 7.16): ... var query = products.Where(p => p.Name == "Widget").Select(p => p.ProductID); ... Overload resolution subsequently binds the Queryable.Where<Product> and Queryable.Select<Product, int> extension methods (see C# spec sections 7.5 and 7.6.5). After overload resolution, the compiler knows something interesting about the anonymous functions (lambda syntax) in the de-sugared code: they must be converted to expression trees, i.e.,“an object structure that represents the structure of the anonymous function itself” (see C# spec section 6.5). The conversion is equivalent to the following rewrite: ... var prm1 = Expression.Parameter(typeof(Product), "p"); var prm2 = Expression.Parameter(typeof(Product), "p"); var query = Queryable.Select<Product, int>(     Queryable.Where<Product>(         products,         Expression.Lambda<Func<Product, bool>>(Expression.Property(prm1, "Name"), prm1)),         Expression.Lambda<Func<Product, int>>(Expression.Property(prm2, "ProductID"), prm2)); ... If the “products” expression had type IEnumerable<Product>, the compiler would have chosen the Enumerable.Where and Enumerable.Select extension methods instead, in which case the anonymous functions would have been converted to delegates. At this point, we’ve reduced the LINQ query to familiar code that will compile in C# 2.0. (Note that I’m using C# snippets to illustrate transformations that occur in the compiler, not to suggest a viable compiler design!) Runtime When the above program is executed, the Queryable.Where method is invoked. It takes two arguments. The first is an IQueryable<> instance that exposes an Expression property and a Provider property. The second is an expression tree. The Queryable.Where method implementation looks something like this: public static IQueryable<T> Where<T>(this IQueryable<T> source, Expression<Func<T, bool>> predicate) {     return source.Provider.CreateQuery<T>(     Expression.Call(this method, source.Expression, Expression.Quote(predicate))); } Notice that the method is really just composing a new expression tree that calls itself with arguments derived from the source and predicate arguments. Also notice that the query object returned from the method is associated with the same provider as the source query. By invoking operator methods, we’re constructing an expression tree that describes a query. Interestingly, the compiler and operator methods are colluding to construct a query expression tree. The important takeaway is that expression trees are built in one of two ways: (1) by the compiler when it sees an anonymous function that needs to be converted to an expression tree, and; (2) by a query operator method that constructs a new queryable object with an expression tree rooted in a call to the operator method (self-referential). Next we hit the foreach block. At this point, the power of LINQ queries becomes apparent. The provider is able to determine how the query expression tree is evaluated! The code that began our story was intentionally vague about the definition of the “products” collection. Maybe it is a queryable in-memory collection of products: var products = new[]     { new Product { Name = "Widget", ProductID = 1 } }.AsQueryable(); The in-memory LINQ provider works by rewriting Queryable method calls to Enumerable method calls in the query expression tree. It then compiles the expression tree and evaluates it. It should be mentioned that the provider does not blindly rewrite all Queryable calls. It only rewrites a call when its arguments have been rewritten in a way that introduces a type mismatch, e.g. the first argument to Queryable.Where<Product> being rewritten as an expression of type IEnumerable<Product> from IQueryable<Product>. The type mismatch is triggered initially by a “leaf” expression like the one associated with the AsQueryable query: when the provider recognizes one of its own leaf expressions, it replaces the expression with the original IEnumerable<> constant expression. I like to think of this rewrite process as “type irritation” because the rewritten leaf expression is like a foreign body that triggers an immune response (further rewrites) in the tree. The technique ensures that only those portions of the expression tree constructed by a particular provider are rewritten by that provider: no type irritation, no rewrite. Let’s consider the behavior of an alternative LINQ provider. If “products” is a collection created by a LINQ to SQL provider: var products = new NorthwindDataContext().Products; the provider rewrites the expression tree as a SQL query that is then evaluated by your favorite RDBMS. The predicate may ultimately be evaluated using an index! In this example, the expression associated with the Products property is the “leaf” expression. StreamInsight 2.1 For the in-memory LINQ to Objects provider, a leaf is an in-memory collection. For LINQ to SQL, a leaf is a table or view. When defining a “process” in StreamInsight 2.1, what is a leaf? To StreamInsight a leaf is logic: an adapter, a sequence, or even a query targeting an entirely different LINQ provider! How do we represent the logic? Remember that a standing query may outlive the client that provisioned it. A reference to a sequence object in the client application is therefore not terribly useful. But if we instead represent the code constructing the sequence as an expression, we can host the sequence in the server: using (var server = Server.Connect(...)) {     var app = server.Applications["my application"];     var source = app.DefineObservable(() => Observable.Range(0, 10, Scheduler.NewThread));     var query = from i in source where i % 2 == 0 select i; } Example 1: defining a source and composing a query Let’s look in more detail at what’s happening in example 1. We first connect to the remote server and retrieve an existing app. Next, we define a simple Reactive sequence using the Observable.Range method. Notice that the call to the Range method is in the body of an anonymous function. This is important because it means the source sequence definition is in the form of an expression, rather than simply an opaque reference to an IObservable<int> object. The variation in Example 2 fails. Although it looks similar, the sequence is now a reference to an in-memory observable collection: var local = Observable.Range(0, 10, Scheduler.NewThread); var source = app.DefineObservable(() => local); // can’t serialize ‘local’! Example 2: error referencing unserializable local object The Define* methods support definitions of operator tree leaves that target the StreamInsight server. These methods all have the same basic structure. The definition argument is a lambda expression taking between 0 and 16 arguments and returning a source or sink. The method returns a proxy for the source or sink that can then be used for the usual style of LINQ query composition. The “define” methods exploit the compile-time C# feature that converts anonymous functions into translatable expression trees! Query composition exploits the runtime pattern that allows expression trees to be constructed by operators taking queryable and expression (Expression<>) arguments. The practical upshot: once you’ve Defined a source, you can compose LINQ queries in the familiar way using query expressions and operator combinators. Notably, queries can be composed using pull-sequences (LINQ to Objects IQueryable<> inputs), push sequences (Reactive IQbservable<> inputs), and temporal sequences (StreamInsight IQStreamable<> inputs). You can even construct processes that span these three domains using “bridge” method overloads (ToEnumerable, ToObservable and To*Streamable). Finally, the targeted rewrite via type irritation pattern is used to ensure that StreamInsight computations can leverage other LINQ providers as well. Consider the following example (this example depends on Interactive Extensions): var source = app.DefineEnumerable((int id) =>     EnumerableEx.Using(() =>         new NorthwindDataContext(), context =>             from p in context.Products             where p.ProductID == id             select p.ProductName)); Within the definition, StreamInsight has no reason to suspect that it ‘owns’ the Queryable.Where and Queryable.Select calls, and it can therefore defer to LINQ to SQL! Let’s use this source in the context of a StreamInsight process: var sink = app.DefineObserver(() => Observer.Create<string>(Console.WriteLine)); var query = from name in source(1).ToObservable()             where name == "Widget"             select name; using (query.Bind(sink).Run("process")) {     ... } When we run the binding, the source portion which filters on product ID and projects the product name is evaluated by SQL Server. Outside of the definition, responsibility for evaluation shifts to the StreamInsight server where we create a bridge to the Reactive Framework (using ToObservable) and evaluate an additional predicate. It’s incredibly easy to define computations that span multiple domains using these new features in StreamInsight 2.1! Regards, The StreamInsight Team

    Read the article

  • What are the preferred documentation tools for the major programming languages?

    - by Dave Peck
    I'm interested in compiling a list of major programming languages and their preferred documentation toolsets. To scope this a bit: The exact structure of the answer may vary from language to language, but there appear to be two aspects common to all languages: (1) in-code syntax for documentation, and (2) documentation generators that make use of said syntax. There are also cases where generators are used independent of code. For example, tutorial-style documentation is common in the Python world and is often disconnected from underlying code. Many languages have multiple commonly-used documentation strategies and tool chains, and I'd love to capture this. Finally, there are cross-language tools like Doxygen that also have some traction and would be worth noting here. Here are some obvious target languages to start with: Python, Ruby, Java, C#, PHP, Objective-C, C/C++, Haskell, Erlang, Scala, Clojure If this question catches on, I'll try and keep this section updated with the most recent list. Thanks!

    Read the article

  • Achieving decoupling in Model classes

    - by Guven
    I am trying to test-drive (or at least write unit tests) my Model classes but I noticed that my classes end up being too coupled. Since I can't break this coupling, writing unit tests is becoming harder and harder. To be more specific: Model Classes: These are the classes that hold the data in my application. They resemble pretty much the POJO (plain old Java objects), but they also have some methods. The application is not too big so I have around 15 model classes. Coupling: Just to give an example, think of a simple case of Order Header - Order Item. The header knows the item and the item knows the header (needs some information from the header for performing certain operations). Then, let's say there is the relationship between Order Item - Item Report. The item report needs the item as well. At this point, imagine writing tests for Item Report; you need have a Order Header to carry out the tests. This is a simple case with 3 classes; things get more complicated with more classes. I can come up with decoupled classes when I design algorithms, persistence layers, UI interactions, etc... but with model classes, I can't think of a way to separate them. They currently sit as one big chunk of classes that depend on each other. Here are some workarounds that I can think of: Data Generators: I have a package that generates sample data for my model classes. For example, the OrderHeaderGenerator class creates OrderHeaders with some basic data in it. I use the OrderHeaderGenerator from my ItemReport unit-tests so that I get an instance to OrderHeader class. The problem is these generators get complicated pretty fast and then I also need to test these generators; defeating the purpose a little bit. Interfaces instead of dependencies: I can come up with interfaces to get rid of the hard dependencies. For example, the OrderItem class would depend on the IOrderHeader interface. So, in my unit tests, I can easily mock the behaviour of an OrderHeader with a FakeOrderHeader class that implements the IOrderHeader interface. The problem with this approach is the complexity that the Model classes would end up having. Would you have other ideas on how to break this coupling in the model classes? Or, how to make it easier to unit-test the model classes?

    Read the article

  • Why do iterators in Python raise an exception?

    - by NullUserException
    Here's the syntax for iterators in Java (somewhat similar syntax in C#): Iterator it = sequence.iterator(); while (it.hasNext()) { System.out.println(it.next()); } Which makes sense. Here's the equivalent syntax in Python: it = iter(sequence) while True: try: value = it.next() except StopIteration: break print(value) I thought Exceptions were supposed to be used only in, well, exceptional circumstances. Why does Python use exceptions to stop iteration?

    Read the article

  • Is there any logical relation between different types of UML diagrams?

    - by user363295
    I'm trying to find out ,that is there any relation between different types of UML diagrams, for example, once you developed a use case, should it be an event for each of them in a sequence diagram, or is there any exact relation between the use case and class diagrams. By the way my main focus is on the below diagrams: Use case class diagram activity sequence event if you think I need any extra diagram to be included so it can be used to connecting the above diagrams to each other, please mention it too. Thanks In Advance

    Read the article

  • please look my first project [closed]

    - by gökhan
    good night my project is about that Write a program that uses a loop to calculate the first 15 values of the Fibonacci number sequence and store them in an array, call it FibArr, of size 15 DWORDS. Fibonacci number sequence is described by the following formula: Fib(1) = 1, Fib(2) = 1, Fib(n) = Fib(n -1) + Fib(n - 2). Place each value in the EAX register and display it with a call DumpRegs statement.So I dont have an idea about this topic please help me thanks

    Read the article

  • New monitor connected to HDMI adaptor doesn't show output after booting

    - by Paul
    Hello out there in the multiple monitors’ world. I am a very old newbie in your world and need help. I just purchased a new Asus VH236H monitor and hooked it up the HDMI port of an ATI Radeon HD4300 / 4500 Series display adaptor. I left the old Princeton LCD19 (TMDS) hooked up to the DVI port of the same display adaptor. Both monitors displayed the boot sequence, after I fired good old Sarastro2 (Asus P5Q Pro Turbo – Dual Core E5300 – 2.60 GHz) up. The Asus lacked one half of a second behind the Princeton until the Windows 7 Ultimate SP 1 boot up was complete. Then the Asus displayed “HDMI NO SIGNAL” and went into hibernation. The Princeton stayed lit up as before. Both monitors are displayed on the “Screen Resolution Setup Display” and I plaid around with them for a while. The only thing I accomplished was to shove the desktop icons from the Princeton to the still hibernating Asus. The “Multiple displays:” is set to “Extend these displays”, the Orientation is “Landscape” and the Resolutions are set on both to the “recommended” one. Both monitors show that they work properly in the advanced Properties display. What am I doing wrong, what am I missing? Never mind the opinions about the different resolutions of the two monitors. I always can unhook the Princeton and give it to a Goodwill Store if I do not like the setup. I just would like to make it work. Any constructive help is very much appreciated, Thank you. Thank you Anees Bakrain Only the ATI Radeon HD 4300/4500 Series adapter is displayed in the Device Manager, for that reason I have to assume that the onboard display adaptor is not active. All 40 drivers of Sarastro2 are up to date and the HDMI cable can not be the problem because both monitors displayed the boot sequence up to the moment when Windows 7 was loaded completely. This was the moment, when the Asus monitor lost its signal. Both connectors, HDMI and DVI are connected and removing the DVI connector would not solve my problem of running both monitors simultaneously. However, your suggestions shifted my seventy one year old brain into the next gear. The only question remaining is; “Why the signals to the Asus monitor stop after the sequence is complete”. The ATI Radeon HD 4300/4500 Series adapter seems to be capable of sending simultaneous HDMI and DVI signals, what is done during the boot sequence. Why do the signals change after the boot sequence is complete is the key question or der springende Punkt? Is this a correct assumption slhck?

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >