How do I compare these ranges of numbers efficiently?

I’m looking for an efficient way of testing eights. What happens is I need to check if a value is eights and discard it.

The numbers I need to check for are:

8.8888, 88.888, 888.88, 8888.8, 88888.00                // 5 digits 88.8888, 888.888, 8888.88, 88888.8, 888888.00           // 6 digits 888.8888, 8888.888, 88888.88, 888888.8, 8888888.00      // 7 digits 8888.8888, 88888.888, 888888.88, 8888888.8, 88888888.00 // 8 digits 

However, these are actually represented in integer form. Which is the number multiplied by 10000.

So 8.8888 is represented as an int64 with the value 88888, and 888888.00 is represented as 888880000

There are quite a few values here to check. My simple approach was to just compare each one directly from a table. But then I thought perhaps I should maybe do something more efficient like masking and comparing each digit. But my crude approach did not work. It seems cumbersome and potentially a bit slow to convert to a string and compare eights that way. This code will run on an embedded system which checks these values many times over so I do need it to be reasonably performant. Note that I won’t have less than 5 digits represented or more than 8.

importing ip ranges list as a text file in angry ip scanner [closed]

I don’t know how to correctly import IP ranges in a text file for angry ip scanner. I copied the IP ranges from some website and import them in a .txt file like 

but the angry ip scanner just scanned the first IPs and not the ranges. I have no idea how to import IP ranges correctly. I also did something like but it didn’t work either.

Greedy heuristic for buying fewest fridges of set temperature for products that can be kept in some temp. ranges?

We have a set of $ n$ products, each $ i$ th product can be kept in a temperature between $ c_i$ and $ h_i$ .

We have to buy fewest number of fridges for these products. The fridges can only have a fixed temperature.

For me I think of this problem as intervals of product temperatures that are placed on the axis. enter image description here

My idea to solve it is to see which product’s temperature range overlaps with most other products temperature ranges, then we can place these products in one fridge.

But the algorithm for this would be inefficient..

What’s a simple greedy solution for this? any ideas?

Do the competition scorecards for D&D tournaments have the same ranges of scores?

D&D tournaments were judged according to a system whereby each party was given points for accomplishing specific tasks and taking certain actions in a competition dungeon. [see this question]

I was curious about whether I could find scores from different events and compare them meaningfully. However, I wasn’t sure if each competition scorecard had the same range of point values. Scores in some other competitions are built such that they can be compared (bowling scores are always between 0 – 300, for example), but if each dungeon had a different range of points I’m not sure I could compare them.

Do the scores for D&D tournament dungeons have the same range between competitions? Can they be compared?

GURPS – How does melee combat work between fighters with different weapon ranges?

Let’s say in a classic fantasy medieval world there are two warriors fighting, one with a spear and the other with a sword or one with a halberd and the other using martial arts with bare hands.

I usually use simple rules for melee combats, ignoring the range of the weapons, but in some cases the difference between the range of the weapons is too big or the player wants to do some special move and asks to take that into account.

I’ve read the advanced combat system, but couldn’t understand exactly what is the rule for this. How can the warrior with the halberd attack the martial artist if he is in close range? And how can the warrior with the sword pass by the spear to get close to his enemy?

Split PDF with Multiple Page Ranges and Multiple Outputs

I need to split 1 PDF file into multiple PDFs, but using specific page ranges.

This CPDF command will split multiple page ranges, but merge them into 1 PDF file.

cpdf in.pdf 1-3,90-97,112-end -o out.pdf

I need a command that will carry out a similar function to the above command, but output each page range to its own PDF.

I’ve looked for solutions to this problem in the PDFTK and CPDF documentation, but haven’t found any help.

How can I insert a series of values from two ranges into incremental rows?

I really couldn’t think of a good way to phrase this in a short enough form for the title. Any suggestions are welcome – I’d be happy to enter a more appropriate title.

I’m preparing a large data set where I have three tables in the following format:

The symbols table has just an id and symbol columns. I have a list of symbols like ‘1’,’2′,’3′,etc. ‘alpha’,’beta’,’gamma’,’delta’, etc. ‘square’,’circle’,etc. ‘cat’,’dog’,’elk’, etc. ‘moon’,’sun’,’star’,etc. and the list goes on.

The teams table is just as simple. id and team_name, with a fairly large list of teams and their names.

The R_team_symbols table is a relational table with id,team_id, and symbol_id.

I was wondering if there’s a one-shot query method I can use to fill the relational table with a range relation for each team.

For instance, say team scorpion utilizes all decimal numbers and all shapes, while team hobnob utilizes the Greek alphabet and only even decimal numbers, and team C uses astronomical symbols, numbers, and animals.

Is there anything I can use like:

INSERT INTO `R_team_symbols`(`team_id`,`symbol_id`) VALUE RANGE FOR `team_id` = '33' VALUES([1...9],[55...62],[122...130]); 

Or something like that? Where I’d end up with several rows with each set of values for each team’s chosen set of symbols?

On top of that, would there be a way to double this up, so I could give a range of team id’s and their specified symbol ranges?

I have A LOT of this to enter; allowing ranges like this (since the symbols are all entered sequentially anyway) would be pretty amazing.

Thanks in advance for any ideas or help anybody might offer.

Algorithm for dividing a range into ranges and then finding which range a number belongs to


  • a minimum
  • a maximum
  • number of ranges
  • a value between minimum and maximum

I’m trying to come up with a method, or two, which would calculate which range the provided value belongs to.

For min=1, max = 10, number of ranges=5 the ranges would be [1,2],[3,4],[5,6],[7,8],[9-10]

The other method would behave like shown below:

  • method(1)->[1-2]
  • method(2)->[1-2]
  • method(3)->[3-4]
  • method(4)->[3-4]
  • method(5)->[5-6]
  • method(6)->[5-6]
  • method(7)->[7-8]
  • method(8)->[7-8]
  • method(9)->[9-10]
  • method(10)->[9-10]

This would be used for generating a legend for a map where the size of the marker depends on the range a value belongs to.

I wonder if there is a nice algorithmic solution for this.

The numbers I work with are integers.


Another example:

For min=1, max = 3, number of ranges=2 the ranges would be

a) [1-2],[3-3]


b) [1-1],[2-3]

The other method would behave like shown below:


  • method(1)->[1-2]
  • method(2)->[1-2]
  • method(3)->[3-3]

or b)

  • method(1)->[1-1]
  • method(2)->[2-3]
  • method(3)->[2-3]

I don’t have a preference for a) or b).

Unity Colliders – How do I detect nearby objects without my detection ranges detecting each other

How can I get both colliders’ types in a trigger overlap message like OnTriggerExit2D(Collider2D other)?


  • objects A and B both have a BoxCollider2D and CircleCollider2D components.

  • Then, object A enters one of the trigger colliders of object B.

  • I can get object B‘s collider type with the is operator.

How can I get A’s collider type?

The reason I want this is that I want only collisions where object A‘s CircleCollider2D touches object B‘s BoxCollider2D.

void OnTriggerExit2D(Collider2D other) {     if (other is BoxCollider2D)         //Do Code } 

Here is a table of what I want: I want only to register trigger overlaps from CircleCollider2D to BoxCollider2D. With the is operator, I can safely remove all collisions to CircleCollider2D but collisions between two BoxCollider2D stay, which I do not want.

+------------------+---------------+------------------+ |  Row to Column   | BoxCollider2D | CircleCollider2D |  +------------------+---------------+------------------+ | BoxCollider2D    | No            | No               |  | CircleCollider2D | Yes           | No               |  +------------------+---------------+------------------+ 

Edit The real questions was to detect nearby objects without the detection range dectecting each other.