This topic has been archived. It cannot be replied.
-
工作学习 / IT技术讨论 / 请开发一个这样的实用的TOOLS,各位自认称职的SYS/NET ADMIN or Developer 请进
-hillman(山大王);
2002-11-25
{580}
(#875221@0)
-
俺不是什么啊命,但是你这个问题确实简单得不得了我现在不想马上告诉你,否则的话你印象不深
-interview(intervieweree);
2002-11-25
{40}
(#875284@0)
-
use NT/2000 script, it is not big deal.
-bjduck(北京烤鸭);
2002-11-25
(#875362@0)
-
here is one implementation. It is really simple. Why don't you do it yourself??
-lusi(丑小鸭);
2002-11-25
(#875575@0)
-
I am not challenging anyone. Programming a simple tool is full of FUN and good exercise to your brain, right? If you Wrote that tool, could you share your source code here. Thanks.
-hillman(山大王);
2002-11-25
(#875750@0)
-
You should really think about it yourself since this is so so so simple.
-jeffrey815(Smartiecat);
2002-11-25
(#875753@0)
-
don't know why you don't develop it by yourself. As Smartiecat said, it is so so simple. Anyway, go to the same place for the source code in VC++ 6.0.
-lusi(丑小鸭);
2002-11-25
(#875756@0)
-
Hahaaha, the code is 'so simple so naive :)' but wrong
-hillman(山大王);
2002-11-25
{691}
(#875777@0)
-
I have no knowledge of system admin, and I don't understand the last example of your requirement, the input 182.3.59.8/27 and output 182.3.58.0/23.To me, they are totally different two strings and the result should be: "Not Found". Please comment.
-lusi(丑小鸭);
2002-11-25
{102}
(#875831@0)
-
Sorry for confusing you. 182.3.59.96/27 means ip block 182.3.59.96 netmask bits length is 27 bits long ( 255.255.255.224 ). ALL Network vendors now use this way to descript IP blocks.
-hillman(山大王);
2002-11-25
(#875847@0)
-
I see. So the real requirement is: if netmask bits is specified by "/##", find out the entry which has the same netmask. Otherwise, find the exact entry. Is my understanding correct?
-lusi(丑小鸭);
2002-11-25
(#875916@0)
-
partially correct. but still not that Simple :). For example: IP/IP Blocks "182.3.59.96/27 , 182.3.59.214, 182.3.59.8/28 ....." are all in the IP block 182.3.58.0/23. Not as simple as you thought. right? :)
-hillman(山大王);
2002-11-25
(#875923@0)
-
one question before I continue: /23 means the first 23 bits in the IP address, right?
-lusi(丑小鸭);
2002-11-25
(#875987@0)
-
Right. TCP/IP fundamental
-hillman(山大王);
2002-11-25
(#875997@0)
-
the first 23 bits starting from MSB.
-lusi(丑小鸭);
2002-11-25
(#875990@0)
-
version 1.1 done. Please go to the same location for the exe. Check whether it meets the requirement. I read about the netMask long ago, and almost forgot it already.
-lusi(丑小鸭);
2002-11-25
(#876133@0)
-
It is OK, could you show the source code. just want to see the algorithm. A minor flaw in your program, it should show ALL the matched entries. But that is OK.
-hillman(山大王);
2002-11-25
(#876271@0)
-
here you go. It doesn't show all the matches because I return once a match is found. You want all the matches?
-lusi(丑小鸭);
2002-11-25
{3267}
(#876275@0)
-
It is good. The algorithm is quite straight forward. Just another minor flaw:If I input 127.0.0.0/8
it will show: Found-> 127.0.0.1
It is not correct
because 127.0.0.0/8 is not INCLUDED in 127.0.0.1
(127.0.0.1 is included in 127.0.0.0/8)
That's ok. easy to fix
But any way, the algorithm is quite straight forward
Seems you used quite a lot of Subs like MakeDWord
MakeSubMask etc. life don't need to be so complicated. ;)
And I also learned the sscanf as C++'s compromise of Regular Expressions. Haha, Thanks.
I will wait for other more simpler solutions..
-hillman(山大王);
2002-11-25
{504}
(#876369@0)
-
You are the ONLY person here want to do something instead of saying 'Oh, simple' then hide... :D
-hillman(山大王);
2002-11-25
(#876019@0)
-
i read what u say and tested some. you are right, it is not easy.i am trying use script, but not easy. it is seemed that it is not system admin job, more like programer. so script is not very easy for that. anyway, i will try.
-bjduck(北京烤鸭);
2002-11-25
{161}
(#876098@0)
-
scripts CAN do it, try try :)
-hillman(山大王);
2002-11-25
(#876115@0)
-
by the way, for i am NT/2000 admin. so i am using VBScript not ShellScript.
-bjduck(北京烤鸭);
2002-11-25
(#876147@0)
-
Kixtart
-ssi(文文);
2002-11-25
(#875647@0)
-
this is too simple!
-macsym(日进斗斤);
2002-11-25
(#875789@0)
-
Could anyone give a script less than 25 lines to solve this simple question?? Come On Admins. GaoShou should show up now la...
-hillman(山大王);
2002-11-25
(#876502@0)
-
IT人是不是“贱-不值钱”了一下啊,这种话题也有这么多人回复!
-arthurxu(ArthurXu OCP8,9i);
2002-11-25
(#876564@0)
-
Take easy, take easy. Just for Fun, not for 贱. Heehee. If you are good, could you give a solution in SQL? Pls don't be so aggressive
-hillman(山大王);
2002-11-25
(#876734@0)
-
Pay me $100, I will do a perfect application to you
-arthurxu(ArthurXu OCP8,9i);
2002-11-27
(#879703@0)
-
My clumsy perl implementation ... all most no error checking ... with some effort you should be able to get it under 25 lines (currently ~40 lines).
-dennis2(Dennis);
2002-11-26
{1073}
(#877439@0)
-
It is also good. but not better than 丑小鸭's. his/her algorithm is simpler and more efficient. Heehee. Is it a good exercise?
-hillman(山大王);
2002-11-26
(#877948@0)
-
i did it in VbScript , but about 80 lines.But i can not put into 20 ines. i gave up.
-bjduck(北京烤鸭);
2002-11-26
(#877560@0)
-
Let me conclude the currently BEST algorithm
-hillman(山大王);
2002-11-26
{731}
(#878102@0)
-
不要把简单复杂化。你这个东东grep一下就完了,还要算法吗?
-pagecho(later);
2002-11-27
{38}
(#879841@0)
-
PLEASE read the question carefully before you say something. DON'T be TOO confident... hehe
-hillman(山大王);
2002-11-27
(#880540@0)
-
if you can grep it. You must be Grep Expert. ;-) . But obvious you are not...
-hillman(山大王);
2002-11-27
(#880541@0)