Search Results

Search found 761 results on 31 pages for 'tail'.

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

  • Using watch with pipes

    - by Tom
    Hi! I'd like to run this command: watch -n 1 tail -n 200 log/site_dev.log | grep Doctrine But it does not run, because "I think" that the grep tries to run on the watch instead of the tail... Is there a way to do something like watch -n 1 (tail -n 200 log/site_dev.log | grep Doctrine) Thanks a lot!

    Read the article

  • "Tail" a logstash server query

    - by phatmanace
    Assuming I have a logstash server chocked full of logs being loaded regularly, is there a reasonably elegant way that I can tail the results of a continuously executing query on the logstash server and show this in a terminal window e.g some-special-logstash-command.sh | egrep -v "(searchword1|searchword2)" the idea being that the command pipes stuff out of logstash and to my grep query that filters and shows me the filtered output for. .. of course if there is a logstash command that can do the grep piece for me as well, then that works too :) motivation for doing this, is that assuming all of my events from my estate is being loaded into logstash, then would be nice to have a terminal window with a continuous tail of interesting events as they occur scrolling past the screen. -Ace

    Read the article

  • Grep only shows last match

    - by Bannix
    I've got a problem with grep. When I use it as followed, it only shows the last match in every line and what follows after it. For example: If I use tail -F example.log | grep -a -i -e "word1" -e "word2" -e "word3" and example.log contains word1 this word2 is word3 a test only "word3 a test" will be displayed. How can I display the whole line and not only the last matched string in a line + rest of the line? I hope you can understand what I mean and help me :) Greetings, Bannix

    Read the article

  • Javascript tail recursion

    - by Misha Moroshko
    Why the following code runs so.... slow....... ? <html><body><script type="text/javascript"> var i = 0; f(); function f() { if (i == 5000) { document.write("Done"); } else { i++; tail(); } } function tail() { var fn = tail.caller; var args = arguments; setTimeout(function() {fn.apply(this, args)}, 0); }; </script></body></html>

    Read the article

  • Screen tail -f window closes immediately

    - by t.heintz
    I have this in my ~/.screenrc file: startup_message off screen -t top 0 top screen -t log 2 tail -f /path/to/application/log/* screen -t action 1 #caption always "%?%F%{.R.}%?%3n %t%? [%h]%?" hardstatus alwayslastline "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<" When I start screen, it opens all three windows, but as soon as I try to switch to window 2, it closes immediately. I would assume there is a problem with the shell and it exits instantly, but I can't find anything wrong with it. I have tried using quotation marks around the path and the entire command, which only leads to "file not found" errors. The command works just fine when I enter it directly into a shell. The screen version is: Screen version 4.00.02 (FAU) 5-Dec-03 Help?

    Read the article

  • Colorize Monitoring of Logs

    - by Ian
    I sometimes monitor apache and php error logs using tail under FreeBSD. Is there any way to get colorized output, either using tail or some other command line app? Alternatively, what is your favorite way to monitor the various web-related logs in realtime?

    Read the article

  • Tail recursion in Erlang

    - by dagda1
    Hi, I am really struggling to understand tail recursion in Erlang. I have the following eunit test: db_write_many_test() -> Db = db:new(), Db1 = db:write(francesco, london, Db), Db2 = db:write(lelle, stockholm, Db1), ?assertEqual([{lelle, stockholm},{francesco, london}], Db2). And here is my implementation: -module(db) . -include_lib("eunit/include/eunit.hrl"). -export([new/0,write/3]). new() -> []. write(Key, Value, Database) -> Record = {Key, Value}, [Record|append(Database)]. append([H|T]) -> [H|append(T)]; append([]) -> []. Is my implementation tail recursive and if not, how can I make it so? Thanks in advance

    Read the article

  • Sorting a list in OCaml

    - by darkie15
    Hi All, Here is the code on sorting any given list: let rec sort lst = match lst with [] -> [] | head :: tail -> insert head (sort tail) and insert elt lst = match lst with [] -> [elt] | head :: tail -> if elt <= head then elt :: lst else head :: insert elt tail;; [Source: Code However, I am getting an Unbound error: Unbound value tail # let rec sort lst = match lst with [] -> [] | head :: tail -> insert head (sort tail) and insert elt lst = match lst with [] -> [elt] | head :: tail -> if elt <= head then elt :: lst else head :: insert elt tail;; Characters 28-29: | head :: tail -> if elt <= head then elt :: lst else head :: insert elt tail;; ^ Error: Syntax error Can anyone please help me understand the issue here?? I did not find head or tail to be predefined anywhere nor in the code

    Read the article

  • Java 8 Stream, getting head and tail

    - by lyomi
    Java 8 introduced a Stream class that resembles Scala's Stream, a powerful lazy construct using which it is possible to do something like this very concisely: def from(n: Int): Stream[Int] = n #:: from(n+1) def sieve(s: Stream[Int]): Stream[Int] = { s.head #:: sieve(s.tail filter (_ % s.head != 0)) } val primes = sieve(from(2)) primes takeWhile(_ < 1000) print // prints all primes less than 1000 I wondered if it is possible to do this in Java 8, so I wrote something like this: IntStream from(int n) { return IntStream.iterate(n, m -> m + 1); } IntStream sieve(IntStream s) { int head = s.findFirst().getAsInt(); return IntStream.concat(IntStream.of(head), sieve(s.skip(1).filter(n -> n % head != 0))); } IntStream primes = sieve(from(2)); PrimitiveIterator.OfInt it = primes.iterator(); for (int prime = it.nextInt(); prime < 1000; prime = it.nextInt()) { System.out.println(prime); } Fairly simple, but it produces java.lang.IllegalStateException: stream has already been operated upon or closed because both findFirst() and skip() is a terminal operation on Stream which can be done only once. I don't really have to use up the stream twice since all I need is the first number in the stream and the rest as another stream, i.e. equivalent of Scala's Stream.head and Stream.tail. Is there a method in Java 8 Stream that I can achieve this? Thanks.

    Read the article

  • A F# tail-recursive question

    - by ksharp
    Recently, I'm learning F#. I try to solve problem in different ways. Like this: (* [0;1;2;3;4;5;6;7;8] -> [(0,1,2);(3,4,5);(6,7,8)] *) //head-recursive let rec toTriplet_v1 list= match list with | a::b::c::t -> (a,b,c)::(toTriplet_v1 t) | _ -> [] //tail-recursive let toTriplet_v2 list= let rec loop lst acc= match lst with | a::b::c::t -> loop t ((a,b,c)::acc) | _ -> acc loop list [] //tail-recursive(???) let toTriplet_v3 list= let rec loop lst accfun= match lst with | a::b::c::t -> loop t (fun ls -> accfun ((a,b,c)::ls)) | _ -> accfun [] loop list (fun x -> x) let funs = [toTriplet_v1; toTriplet_v2; toTriplet_v3]; funs |> List.map (fun x -> x [0..8]) |> List.iteri (fun i x -> printfn "V%d : %A" (i+1) x) I thought the results of V2 and V3 should be the same. But, I get the result below: V1 : [(0, 1, 2); (3, 4, 5); (6, 7, 8)] V2 : [(6, 7, 8); (3, 4, 5); (0, 1, 2)] V3 : [(0, 1, 2); (3, 4, 5); (6, 7, 8)] Why the results of V2 and V3 are different?

    Read the article

  • Doubly linked lists

    - by user1642677
    I have an assignment that I am terribly lost on involving doubly linked lists (note, we are supposed to create it from scratch, not using built-in API's). The program is supposed to keep track of credit cards basically. My professor wants us to use doubly-linked lists to accomplish this. The problem is, the book does not go into detail on the subject (doesn't even show pseudo code involving doubly linked lists), it merely describes what a doubly linked list is and then talks with pictures and no code in a small paragraph. But anyway, I'm done complaining. I understand perfectly well how to create a node class and how it works. The problem is how do I use the nodes to create the list? Here is what I have so far. public class CardInfo { private String name; private String cardVendor; private String dateOpened; private double lastBalance; private int accountStatus; private final int MAX_NAME_LENGTH = 25; private final int MAX_VENDOR_LENGTH = 15; CardInfo() { } CardInfo(String n, String v, String d, double b, int s) { setName(n); setCardVendor(v); setDateOpened(d); setLastBalance(b); setAccountStatus(s); } public String getName() { return name; } public String getCardVendor() { return cardVendor; } public String getDateOpened() { return dateOpened; } public double getLastBalance() { return lastBalance; } public int getAccountStatus() { return accountStatus; } public void setName(String n) { if (n.length() > MAX_NAME_LENGTH) throw new IllegalArgumentException("Too Many Characters"); else name = n; } public void setCardVendor(String v) { if (v.length() > MAX_VENDOR_LENGTH) throw new IllegalArgumentException("Too Many Characters"); else cardVendor = v; } public void setDateOpened(String d) { dateOpened = d; } public void setLastBalance(double b) { lastBalance = b; } public void setAccountStatus(int s) { accountStatus = s; } public String toString() { return String.format("%-25s %-15s $%-s %-s %-s", name, cardVendor, lastBalance, dateOpened, accountStatus); } } public class CardInfoNode { CardInfo thisCard; CardInfoNode next; CardInfoNode prev; CardInfoNode() { } public void setCardInfo(CardInfo info) { thisCard.setName(info.getName()); thisCard.setCardVendor(info.getCardVendor()); thisCard.setLastBalance(info.getLastBalance()); thisCard.setDateOpened(info.getDateOpened()); thisCard.setAccountStatus(info.getAccountStatus()); } public CardInfo getInfo() { return thisCard; } public void setNext(CardInfoNode node) { next = node; } public void setPrev(CardInfoNode node) { prev = node; } public CardInfoNode getNext() { return next; } public CardInfoNode getPrev() { return prev; } } public class CardList { CardInfoNode head; CardInfoNode current; CardInfoNode tail; CardList() { head = current = tail = null; } public void insertCardInfo(CardInfo info) { if(head == null) { head = new CardInfoNode(); head.setCardInfo(info); head.setNext(tail); tail.setPrev(node) // here lies the problem. tail must be set to something // to make it doubly-linked. but tail is null since it's // and end point of the list. } } } Here is the assignment itself if it helps to clarify what is required and more importantly, the parts I'm not understanding. Thanks https://docs.google.com/open?id=0B3vVwsO0eQRaQlRSZG95eXlPcVE

    Read the article

  • Recognizing Tail-recursive functions with Flex+Bison and convert code to an Iterative form

    - by Viet
    I'm writing a calculator with an ability to accept new function definitions. Being aware of the need of newbies to try recursive functions such as Fibonacci, I would like my calculator to be able to recognize Tail-recursive functions with Flex + Bison and convert code to an Iterative form. I'm using Flex & Bison to do the job. If you have any hints or ideas, I welcome them warmly. Thanks!

    Read the article

  • tail -f in a webbrowser

    - by compie
    I've created a Python script that monitors a logfile for changes (like tail -f) and displays it on a console. I would like to access the output of the Python script in a webbrowser. What would I need to create this? I was thinking about using Django and jQuery. Any tips or examples are greatly appreciated.

    Read the article

  • Getting useful emails from Hudson instead of tail of ant log

    - by Rick
    A team member of mine recently setup some Hudson continuous-integration builds for a number of our development code bases. It uses the built in ant integration configured in simple way. While, it is very helpful and I recommend it strongly, I was wondering how to get more more concise/informative/useful emails instead of just the tail of the ant build log. E.G., Don't want this: > [...truncated 36530 lines...] > [junit] Tests run: 32, Failures: 0, Errors: 0, Time elapsed: 0.002 sec ... (hundred of lines omitted) ... > [junit] Tests run: 10, Failures: 0, Errors: 0, Time elapsed: 0.001 sec > [junit] Tests FAILED > > BUILD FAILED I assume, that I could skip the build-in ant support and send the build log through a grep script, but I was hoping there was a more integrated or elegant option.

    Read the article

  • Can someone describe through code a practical example of backtracking with iteration instead of recursion?

    - by chrisapotek
    Recursion makes backtracking easy as it guarantees that you won't go through the same path again. So all ramifications of your path are visited just once. I am trying to convert a backtracking tail-recursive (with accumulators) algorithm to iteration. I heard it is supposed to be easy to convert a perfectly tail-recursive algorithm to iteration. But I am stuck in the backtracking part. Can anyone provide a example through code so myself and others can visualize how backtracking is done? I would think that a STACK is not needed here because I have a perfectly tail-recursive algorithm using accumulators, but I can be wrong here.

    Read the article

  • Clojure - tail recursive sieve of Eratosthenes

    - by Konrad Garus
    I have this implementation of the sieve of Eratosthenes in Clojure: (defn sieve [n] (loop [last-tried 2 sift (range 2 (inc n))] (if (or (nil? last-tried) (> last-tried n)) sift (let [filtered (filter #(or (= % last-tried) (< 0 (rem % last-tried))) sift)] (let [next-to-try (first (filter #(> % last-tried) filtered))] (recur next-to-try filtered)))))) For larger n (like 20000) it ends with stack overflow. Why doesn't tail call elimination work here? How to fix it?

    Read the article

  • "tail -f" alternate which doesn't scroll the terminal window

    - by Jagtesh Chadha
    I want to check a file at continuous intervals for contents which keep changing. "tail -f" doesn't suffice as the file doesn't grow in size. I could use a simple while loop in bash to the same effect: while [ 1 ]; do cat /proc/acpi/battery/BAT1/state ; sleep 10; done It works, although it has the unwanted effect of scrolling my terminal window. So now I'm wondering, is there a linux/shell command that would display the output of this file without scrolling the terminal?

    Read the article

  • Help me to refactor this F# code to tail recursion

    - by Kev
    I write some code to learning F#. Here is a example: let nextPrime list= let rec loop n= match n with | _ when (list |> List.filter (fun x -> x <= ( n |> double |> sqrt |> int)) |> List.forall (fun x -> n % x <> 0)) -> n | _ -> loop (n+1) loop (List.max list + 1) let rec findPrimes num= match num with | 1 -> [2] | n -> let temp = findPrimes <| n-1 (nextPrime temp ) :: temp //find 10 primes findPrimes 10 |> printfn "%A" I'm very happy that it just works! I'm totally beginner to recursion Recursion is a wonderful thing. I think findPrimes is not efficient. Someone help me to refactor findPrimes to tail recursion if possible? BTW, is there some more efficient way to find first n primes?

    Read the article

  • Bash edit file and keep last 500 lines

    - by icelizard
    I am looking to create a cron job that opens a directory loops through all the logs i have created and deletes all lines but keep the last 500 for example. I was thinking of something along the lines of tail -n 500 filename filename Would this work? I also not sure how to loop through a directory in bash Thanks in advance.

    Read the article

  • "watching" a log on FreeBSD vs Linux

    - by Cory J
    On Linux systems I can watch -n1 tail /var/log/whatever.log or watch -n1 grep somestuff /var/log/whatever.log To show updates to a log every 1 seconds. On FreeBSD however, the watch command does something else entirely. Who knows a good FreeBSD command for what I'm trying to do? =)

    Read the article

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