infinite

Bash: infinite sleep (infinite blocking)

时光毁灭记忆、已成空白 提交于 2019-11-27 19:15:22
问题 I use startx to start X which will evaluate my .xinitrc . In my .xinitrc I start my window manager using /usr/bin/mywm . Now, if I kill my WM (in order to f.e. test some other WM), X will terminate too because the .xinitrc script reached EOF. So I added this at the end of my .xinitrc : while true; do sleep 10000; done This way X won't terminate if I kill my WM. Now my question: how can I do an infinite sleep instead of looping sleep? Is there a command which will kinda like freeze the script?

Is there any way to separate infinite and finite lists?

走远了吗. 提交于 2019-11-27 18:16:45
问题 For example, I am writing some function for lists and I want to use length function foo :: [a] -> Bool foo xs = length xs == 100 How can someone understand could this function be used with infinite lists or not? Or should I always think about infinite lists and use something like this foo :: [a] -> Bool foo xs = length (take 101 xs) == 100 instead of using length directly? What if haskell would have FiniteList type, so length and foo would be length :: FiniteList a -> Int foo :: FiniteList a

How do streams stop?

北城以北 提交于 2019-11-27 18:14:12
问题 I was wondering when I created my own infinite stream with Stream.generate how the Streams which are in the standard library stop... For example when you have a list with records: List<Record> records = getListWithRecords(); records.stream().forEach(/* do something */); The stream won't be infinite and running forever, but it will stop when all items in the list are traversed. But how does that work? The same functionality applies for the stream created by Files.lines(path) (source: http:/

Loading

六月ゝ 毕业季﹏ 提交于 2019-11-27 15:14:50
效果图: 代码: <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>loading</title></head><style type="text/css"> .box{ width: 100%; margin: 50px auto; padding: 3%; overflow: hidden; box-sizing: border-box; background-color: #cccccc; } .load{ width: 300px; height: 200px; border: 1px gray solid; display: flex; align-items: center; justify-content: center; box-sizing: border-box; float: left; background-color: #eeeeee; margin-left: 45px; } .loading{ position: relative; } .loading i{ width:15px; height: 15px; background-color: black; border-radius: 50%; display: block; position: absolute

Recursive MySQL query?

可紊 提交于 2019-11-27 14:54:39
I have a set of data that's organized hierarchically that should be able to grow to an arbitrary size. I need to retrieve the entire tree, but I can't figure out how to do it with just SQL. My current solution is to create a temporary table and use a recursive function to successively query branches of the tree and then store the result in the temporary table which I subsequently query again to produce my desired result. My question is, what I'm doing is essentially what a join does correct? Constructing an intermediate table and then querying over the results. It seems like there should be a

Why does this Haskell code work successfully with infinite lists?

可紊 提交于 2019-11-27 10:48:51
问题 I have some Haskell code that does work correctly on an infinite list, but I do not understand why it can do so successfully. (I modified my original code -- that did not handle infinite lists -- to incorporate something from some other code online, and suddenly I see that it works but don't know why). myAny :: (a -> Bool) -> [a] -> Bool myAny p list = foldr step False list where step item acc = p item || acc My understanding of foldr is that it will loop through every item in the list (and

How can I represent an infinite number in Python?

一世执手 提交于 2019-11-27 09:58:06
How can I represent an infinite number in python? No matter which number you enter in the program, no number should be greater than this representation of infinity. In Python, you can do: test = float("inf") In Python 3.5, you can do: import math test = math.inf And then: test > 1 test > 10000 test > x Will always be true. Unless of course, as pointed out, x is also infinity or "nan" ("not a number"). Additionally (Python 2.x ONLY), in a comparison to Ellipsis , float(inf) is lesser, e.g: float('inf') < Ellipsis would return true. Since Python 3.5 you can use math.inf : >>> import math >>>

Using Tumblr Like Button with Infinite Scroll

不打扰是莪最后的温柔 提交于 2019-11-27 08:59:26
I'm trying to use the new Tumblr like buttons within Infinite Scroll (allowing your theme a like button on individual Tumblr posts from the homepage) they work for the first 15 posts of the first 'page' but then as soon as it loads another page the like button stops working. These are the instructions given from Tumblr on the Docs page: Function: Tumblr.LikeButton.get_status_by_page(n) Description: Call this function after requesting a new page of Posts. Takes the page number that was just loaded as an integer. Function: Tumblr.LikeButton.get_status_by_post_ids([n,n,n]) Description: Request

How to implement an infinite image loop?

半城伤御伤魂 提交于 2019-11-27 08:50:53
问题 I am currently working on a 2D shooter with moving background. The background is just a simple image. I want to implement that the image is moving endless from top to bottom. I thought about determining the part of the image that is at the bottom outside the visible part of the frame and paint it on the top again. @Override public void paint(Graphics go) { Graphics2D g = (Graphics2D) go; g.fillRect(0, 0, this.getWidth(), this.getHeight()); g.drawImage(this.imgBackground, 0, this.yBackground,

Continuous Looping Page (Not Infinite Scroll)

好久不见. 提交于 2019-11-27 07:29:52
I'm looking for resources that create scrolling functions like the ones found on these sites: Outpost Journal Unfold Once the scroll bar hits the bottom of the page, I want it to loop back to the top. I'm familiar with with the infinite scroll, and this is not what I want. I've also found scripts that will write/add the same content to the bottom of the page, but none that loop back to the top of the page. Try this: $('document').ready(function() { $(document).scroll(function(){ if(document.documentElement.clientHeight + $(document).scrollTop() >= document.body.offsetHeight )$(document)