I am with you! Thank god I am not the only sane person here. When garbage like this is on the front page of Slashdot, perhaps it is time to stop reading it.
Haha! This article is rated purple (2 levels above the lowest -- black) already. Wow.
Anyhow. The fact that the TwIP program requires an IP stack to work is the prime indication that it doesn't really do all that much. Since it can work with raw socket access, and switches the addresses around, well, props, but TFA's "header" code comment says this:
updating the ICMP checksum
which is then contradicted by the code comment before the address swap:
Since we only swap bytes in the IP header, we do not need to update the IP header checksum.
using ICMP and IP interchangeably..?
timothy, take this down. Now. It's your only chance to save face with this article.
i didn't know either, so i looked it up -- it's the/. firehose quality filter [slashdot.org]. When you're logged in, you can see the popularity color on the left side of the summary heading. You can also increase/decrease this rating. See screen cap [tinypic.com]. Also, when browsing the front page of/., you can filter based on the color...see top-right of screenshot. The rating colors are ROYGBIV + Black. Red is the highest (most popular), black is the lowest. submitted articles initially have the color rating of blue.
I had seen the color filtering before on the front page, but never looked into enough to find out. I learned something new. Hope you did too!
Which is damn annoying since my browser window is already set to use half the screen horizontally (the other half is two xterms one above the other) so it's already not very wide...
Oh, TCP/IP is actually pretty easy. You don't need to handle the entire payload of an ethernet frames (1500 bytes). Just set the MTU to something tiny and let the TCP stack segment it for you. I was thinking pretty much the same thought as you. I hereby dub the concept IPoT (IP over Twitter). The minimum MTU allowed for TCP/IP is 88 bytes. Assuming you have to encode them in something 7-bit-clean (say base64), this means that you would need 118 bytes. 160 is a piece of cake. You'd get an MTU of 120
He is talking about the IP Stack, not the computer science stack structure.
Calling it an IP stack is an over-exaggeration.
This is a cleverly written (no doubt) program using ICMP knowledge to ping back a response packet.
Please dont call that a stack!!
I knew I picked the right man when I cited this guy's PhD thesis in my dissertation. Folk who write things like this know their shit, and are probably safe citations, despite the use of Twitter.
I'd have thought that someone that spent his time studying and implementing minimal-waste embedded network stacks and coming up with something like Contiki would be annoyed by the huge waste of bytes that is Twitter.
As another poster noted below, you can make it even shorter by omitting "unsigned." The only operations performed on the members of s are & and +, which operate identically on signed and unsigned integers.
I tried this particular piece of code out and it works! Of course, the ping buffer and the IP swap is just so obviously simple... WOW!
The "everything is a file" unix philosophy really does kick in and pull its weight in this example. Sockets, network devices, hardware block devices... You can write an app to do pretty much anything with any of these, with just file streams. Oh, yeah... dd'ing entire flash drives, netcating sockets, rsync'ing root partitions over. I often am completely amazed by the complexity that simple pieces can produce.
Now everyone - stop talking bad about twitter... it's awesome, it's simple and it's given random people the idea that I'm interesting & intelligent;)
I hope this isn't a new trend of 7337 |-|@(|0%$ to try to brag of their mad skill by seeing what code can fit in a Tweet.
The less the code doesn't mean better performance. The less code can mean less functionality and error checking. The less code does mean less documentation The less code could mean harder readability.
We need less people taking their time and effort making unreadable small code and more effort in making good and useful applications and libraries. Granted such exercises may be useful to allow you to think of problems differently but you can get the same effect by changing languages say from C to LISP. Also these examples seem to take in include headers which accounts for thousands of lines of code, which are often limited to either the OS or even just the Programming language.
It is like me saying I can make a Web Browser using a shell script with 2 lines.
Very cool program! Taught me some things about IP. The program could be made one byte shorter by using for(;;) instead of while(1) and it is not strictly necessary to use "unsigned short" instead of "short" afaict. I wonder what other interesting programs that can be written in only 140 bytes.
that program just echoes stdin to stdout (maybe some char manipulations) and YOU have to connect this crap to some prog, which provides the network abilities (netcat might be suitable, i guess)
It's not an IP stack at all (and requires one to function). It replies to a packet that is assumed to be a ping without any error checking. In other words, it's a very short, clever, but minimally functional ping function. The fact that it's short is nice, but that's about it.
Yes, I can do the same thing with Mono on OSX in less bytes.
I prefer C myself, but don't act like this is somehow special, its just a matter of having a set of supporting libraries that happen to make this particular task require very little visible code.
And you, like the 'author' are ignoring all the code that goes into the libraries to make this happen, namely the fact that its riding on top an existing IP stack, not actually creating its own.
If you are using the BSD sockets API to 'create your own IP sta
I wrote my own compiler/language just now. What it does is it disregards your entire source code and then outputs that mac crashing bug. I fail to see your point...
I'm a c/c++ fan but just because you can do something in less lines doesn't mean it is better. Maybe if you said that in your language the mac crash ap compiles to 80bytes and requires only 10 operations then i'd be impressed. Buuuut in that case then asm is the greatest language ever.
Article mod: -1 Overrated (Score:5, Insightful)
The underlying system must provide a way for user programs to receive and send IP packets.
This is where I stopped reading. Just... no. This is just a program that echoes every single thing back to the originator.
Re:Article mod: -1 Overrated (Score:5, Insightful)
Yeah, I've got a program for the author that fits in a tweet:
#include
int main() {
puts("You're a moron and a braggart.");
}
Parent
Re: (Score:2, Insightful)
Apparently, slashdot could use a -1, Don't be a dick moderation.
Just give the story a - and move on.
Re: (Score:2)
I am with you! Thank god I am not the only sane person here.
When garbage like this is on the front page of Slashdot, perhaps it is time to stop reading it.
Addendum (Score:5, Interesting)
Haha! This article is rated purple (2 levels above the lowest -- black) already. Wow.
Anyhow. The fact that the TwIP program requires an IP stack to work is the prime indication that it doesn't really do all that much. Since it can work with raw socket access, and switches the addresses around, well, props, but TFA's "header" code comment says this:
updating the ICMP checksum
which is then contradicted by the code comment before the address swap:
Since we only swap bytes in the IP header, we do not need to update the IP header checksum.
using ICMP and IP interchangeably..?
timothy, take this down. Now. It's your only chance to save face with this article.
Parent
Re: (Score:2)
I haven't seen a story get pwned into the ground this fast before. ... I must be new here.
Re: (Score:2)
Re:Addendum (Score:4, Informative)
where are you seeing these "rating colors"?
i didn't know either, so i looked it up -- it's the /. firehose quality filter [slashdot.org]. When you're logged in, you can see the popularity color on the left side of the summary heading. You can also increase/decrease this rating. See screen cap [tinypic.com]. Also, when browsing the front page of /., you can filter based on the color...see top-right of screenshot. The rating colors are ROYGBIV + Black. Red is the highest (most popular), black is the lowest. submitted articles initially have the color rating of blue.
I had seen the color filtering before on the front page, but never looked into enough to find out. I learned something new. Hope you did too!
Parent
How did you get it to use the full width? (Score:2)
Mine looks like: http://img340.imageshack.us/img340/8872/slashdot.png [imageshack.us]
Which is damn annoying since my browser window is already set to use half the screen horizontally (the other half is two xterms one above the other) so it's already not very wide...
Re: (Score:2)
ion and firefox 3.0.11. I trimmed the top at the tabs though, too much info in them to put in here :)
Re: (Score:3, Insightful)
using the IP stack that already exists on the OS.
Responding to IP requests using someone elses IP stack does not mean you actually created your own stack.
Re: (Score:2)
Pretty Cool (Score:1)
Now if you could figure out a way to encode a full 1500 byte packet into 160 characters you'd make some big money.
Re:Pretty Cool (Score:4, Interesting)
Sounds kind-of like this [stackoverflow.com].
Parent
Re: (Score:3, Informative)
Awesome, I love the difference between the first two approaches!
If you're not sure whether to click the link: It is a competition to compress images into 140 chars.
Re: (Score:2)
Oh, TCP/IP is actually pretty easy. You don't need to handle the entire payload of an ethernet frames (1500 bytes). Just set the MTU to something tiny and let the TCP stack segment it for you. I was thinking pretty much the same thought as you. I hereby dub the concept IPoT (IP over Twitter). The minimum MTU allowed for TCP/IP is 88 bytes. Assuming you have to encode them in something 7-bit-clean (say base64), this means that you would need 118 bytes. 160 is a piece of cake. You'd get an MTU of 120
Relevance check please (Score:5, Insightful)
Shit doesn't smell like roses when it is made to fits into a tweet or is in any other way related to Twitter.
Novel, but pointless (Score:1)
That's no stack. A stack has a queue, and a set of operations that can be done on items entering and leaving that queue. Description fail!
Re: (Score:3, Insightful)
Re: (Score:2)
I don't think anyone is talking about "the computer science stack structure".
comment.c: In function âmainâ(TM): (Score:2)
comment.c:1: error: âover-exaggerationâ(TM) undeclared (first use in this function)
Geek alert (Score:1, Informative)
I knew I picked the right man when I cited this guy's PhD thesis in my dissertation. Folk who write things like this know their shit, and are probably safe citations, despite the use of Twitter.
I'd have thought that someone that spent his time studying and implementing minimal-waste embedded network stacks and coming up with something like Contiki would be annoyed by the huge waste of bytes that is Twitter.
For those who are interested ... (Score:1, Informative)
... in low level system programming, I recommend reading a good book, like this [amazon.com], and not spending any more time reading this.
Seriously.
At least 3 ways to make it smaller: (Score:3, Insightful)
Here comes the lameness filter:
unsigned short s[70];*l=s+6;t;main(){for(;;){read(0,s,140);s[10]&=65280;s[11]+=8;t=l[1];l[1]=*l;*l=t;write(1,s,140);}}
And with those 9 chars perhaps you could make it better.
Re: (Score:2)
Re:At least 3 ways to make it smaller: (Score:4, Funny)
Yeah, but for(;;) loops forever, whereas while(1) only loops while 1 is true. It's completely different! What if 1 becomes false?!
Parent
not very complicated ... and that's the good part (Score:3, Interesting)
I tried this particular piece of code out and it works! Of course, the ping buffer and the IP swap is just so obviously simple ... WOW!
The "everything is a file" unix philosophy really does kick in and pull its weight in this example. Sockets, network devices, hardware block devices ... You can write an app to do pretty much anything with any of these, with just file streams. Oh, yeah ... dd'ing entire flash drives, netcating sockets, rsync'ing root partitions over. I often am completely amazed by the complexity that simple pieces can produce.
Now everyone - stop talking bad about twitter ... it's awesome, it's simple and it's given random people the idea that I'm interesting & intelligent ;)
I hope this isn't a new trend. (Score:4, Insightful)
I hope this isn't a new trend of 7337 |-|@(|0%$ to try to brag of their mad skill by seeing what code can fit in a Tweet.
The less the code doesn't mean better performance.
The less code can mean less functionality and error checking.
The less code does mean less documentation
The less code could mean harder readability.
We need less people taking their time and effort making unreadable small code and more effort in making good and useful applications and libraries. Granted such exercises may be useful to allow you to think of problems differently but you can get the same effect by changing languages say from C to LISP. Also these examples seem to take in include headers which accounts for thousands of lines of code, which are often limited to either the OS or even just the Programming language.
It is like me saying I can make a Web Browser using a shell script with 2 lines.
#!/bin/bash
apachectl start
Re:I hope this isn't a new trend. (Score:5, Insightful)
If you converted Apache into a web browser that might actually be worthy of a story...
Parent
Re: (Score:2, Funny)
It is like me saying I can make a Web Browser using a shell script with 2 lines.
#!/bin/bash
apachectl start
If that's what you're using as a web browser, you're doing it wrong.
Re: (Score:2)
> It is like me saying I can make a Web Browser using a shell script with 2 lines.
Besides your server / browser confusion:
Your implementation needs an external program to function, his does not.
Re: (Score:3, Informative)
I hope this isn't a new trend of 7337 |-|@(|0%$ to try to brag of their mad skill by seeing what code can fit in a Tweet.
Oh it is. [twitter.com]
Re: (Score:2)
Nah, it's really nothing new. We've been playing perl golf for how long now?
Very cool (Score:4, Insightful)
Re: (Score:2)
I can do it in 1 byte, hell 1 bit.
Since he's completely ignore the fact that he's actually using the stack already built into the OS and not writing his own.
Just write everything into the compiler and supporting libraries, which is what is being done here.
This isn't a IP stack in a tweet, its a twit who is sensationalising and ignoring all the things that make his statement an outright lie.
I can create a human life from a few chemicals and in a matter of minutes have a living breathing baby or a full grown
Do I need an emacs OS browser VM to use it? (Score:2)
Or is it enough, to boot a normal JavaScript based virtual machine on a normal browser, to use this?
Bullshit! (Score:2)
It's not an IP stack (Score:4, Insightful)
Re: (Score:2)
It doesn't even function as a ping function, some pings will cause it to generate the wrong checksum in the reply.
similarly big accomplishment (Score:5, Funny)
impressive, huh?
Re: (Score:3, Funny)
man, I'm so f*cking 1337!
Re: (Score:2)
That's not a web browser! *This* is a web browser:
lynx
(And yes, it runs on Linux...)
Re: (Score:2)
That's not a web browser! *This* is a web browser:
lynx
(And yes, it runs on Linux...)
Too simple. Try this:
browser="lynx";begin_comment="Now starting ";echo $begin_comment $browser; `$browser`;end_comment="terminated";echo $browser $terminated;
All in one line of code. Now, that is some l33t coding skills, yo!
Re: (Score:2)
browser="lynx";begin_comment="Now starting ";echo $begin_comment $browser; `$browser`;end_comment="terminated";echo $browser $terminated;
Crap! That should have read:
browser="lynx";begin_comment="Now starting ";echo $begin_comment $browser; `$browser`;end_comment="terminated";echo $browser $end_comment;
Maybe this twitter guy is better at this than I am.
Cool yet small... (Score:3, Informative)
Check out this 4KB realtime demo called 'Receptor'. (Download [daimi.au.dk] / Video [capped.tv])
Great! (Score:2)
TwERP (Score:2)
Re: (Score:2)
Yes, I can do the same thing with Mono on OSX in less bytes.
I prefer C myself, but don't act like this is somehow special, its just a matter of having a set of supporting libraries that happen to make this particular task require very little visible code.
And you, like the 'author' are ignoring all the code that goes into the libraries to make this happen, namely the fact that its riding on top an existing IP stack, not actually creating its own.
If you are using the BSD sockets API to 'create your own IP sta
Re:A message to C haters (Score:4, Insightful)
I'm a c/c++ fan but just because you can do something in less lines doesn't mean it is better. Maybe if you said that in your language the mac crash ap compiles to 80bytes and requires only 10 operations then i'd be impressed. Buuuut in that case then asm is the greatest language ever.
Parent
Re: (Score:2, Insightful)
Please. Emacs can crash a Mac and create an IP stack in one command.