Berkeley CSUA MOTD:2001:January:25 Thursday <Wednesday, Friday>
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2001/1/25-26 [Uncategorized] UID:20424 Activity:nil
1/25    A patched version of diff that handles names pipes properly
        is installed in /usr/local/bin; bugs to mconst.
2001/1/25-26 [Computer/SW/Unix] UID:20425 Activity:low
1/24    Anyone used PC Anywhere's file sync feature? Is it good?
        \_ it that the ftp-like feature?
        \_ I don't trust any "file sync" feature.
        \_ Yes.  Not really.
2001/1/25-26 [Politics/Domestic/President/Bush] UID:20426 Activity:nil
1/24    The young left comments on GWB online:
        http://www.washingtonpost.com/wp-dyn/articles/A53300-2001Jan12.html
2001/1/25-26 [Computer/SW/Languages/C_Cplusplus] UID:20427 Activity:high
1/24    At interviews, I've been asking, "Write a C program 'sum' that takes
        two integer arguments and prints out the result.  E.g., 'sum 5 12'
        should print 17 to the screen."  This is a gut check question, but
        everyone seems to have problems with one thing or the other.  Any
        ideas for a better 5-10 minute written C question?  Thanks.
        \_Ask them to construct a simple linked list using pointers. Your
        program should be a 30 second question. If people can't get that right
        then you shouldn't be hiring them. Maybe it's the way you ask the
        question.
           \_ 30 seconds eh? you must write sloppy code.
        \_ Right, no one should miss that question, so... How *exactly*
           are you phrasing it?
           \_ I phrase it just as I've written above.  Try the question
              yourself.  You have 7 minutes, you explicitly do not
              have a computer to test it on, and you do not have man
              pages or books.  Tell us whether you did it right given
              these constraints.
        \_ My favorite one is: write strcpy().  Tells you a lot about a
           person's understanding of C.
           If you want trick questions, take a look at
           http://www.xcf.berkeley.edu/help-sessions/c-tricks.html -- misha.
           \_ The alpha geek at our company notes:
                xxxxx: but the paradigm of x[y] = *(x+y) is actually used
                quite a lot...  especially when you're not sure the size of
                x in which case long x; x[5] is actually *(x + 5 * sizeof(x))
              You learn something new every day. -- Marco
                \_ Hilfinger grilled this sort of thing into us in 60c.
           \_ let us hang our heads for the xcf requiem.
        \_ what kind of problems do people have with this???
           \_ main(int argv, int argc)
              main(char **argv, int argc)
              sum = argv[1] + argv[2];
              x = (int) argv[1];
              several other bad things

              did not:
              initialize sum
              include any header files

              I don't like my question, so I'll try the strcpy() question
              next.  Thanks, misha.
                \_ You don't need header files to printf sum.  You'll get
                   a compiler warning but it will print when executed.
                   If they can't do sum(), they sure as hell can't do a
                   strcpy rewrite.  I suggest a series of 30 second questions
                   in the Hello, World or sum() realm and then give them a
                   shell, gcc, vi/emacs, and 30 minutes to write, and
                   successfully compile something more serious.  After all,
                   they *will* have a computer once they're doing their job
                   on site so why deny them that during the interview?  Just
                   another random viewpoint.  BTW, I assume this is for junior
                   level positions.
        \_ I've been in the industry for 7 years, and every time I need to use
           trivial things like fgets() I still need to look up the man page.
        \_ Knowing what the heck you are building is the hard part.  The
           programming language is the esay part.
        \_ Your question is too easy.  It should sum an arbitrary number of
           arguments from the command line.
           \_ and then compute the last digit of pi.
2001/1/25 [Reference/Tax, Politics/Domestic/President/Bush] UID:20428 Activity:very high
1/24    "'I think the evidence is going to become more and more clear that the
        economy is not as hopeful as we would like, which I hope will strengthen
        my case (for a tax cut)," Bush told reporters at the start of the
        meeting."
                \_ I read an interesting discussion on why simplistic view
                   of economics is fundamentally flawed.  What if the
                   economy was in a boom cycle?  Does that mean the
                   reverse is true, that it's time for a tax hike?
                   How would Bush explain this one?
                   \_ It means the economy is doing well _despite_ higher
                      taxes.  Taxes, fees, and regulations hinder economic
                      growth.  The right idea is to set tax levels and other
                      regulations at a high enough level to maintain infra-
                      structure, run the government, do some social welfare,
                      and keep the water drinkable, while limited economic
                      impact as much as possible.  It's a delicate balancing
                      act.  There is no good time for a tax hike, economically
                      speaking.  Taxes are a relatively new concept compared
                      to economics over the course of human history.
                        \_ What are you talking about?  The Romans had
                           taxes.  Is 2000 years relatively new?
                           \_ Yes.  And would you point to a dead and failed
                              mess like Rome that collapsed under it's own
                              weight and mismanagement, not outside influences
                              as a successful way to run a nation?  Yes, the
                              Romans got beat on by various 'barbarians', but
                              taking a step back, it was their own fault they
                              got pounded.  It didn't have to be that way.
                              \_ You dumb, he wasing arguing for the Roman
                                 system or a tax system.  His point was that
                                 2000 years isn't new.  Besides, how do you
                                 foresee the US isn't going to collapse under
                                 its own weight and mismanagement?
                           \_ And the Chinese had taxes 4000 years ago too.
                           \_ As well as a slave-based economy, massive
                              inflation, and not much of a trade deficit,
                              compared to the US.  -John
                                \_ And they drank from lead cups, wore togas,
                                   and had cool parties.
                           \- The Romans certainly did it "their way" --psb
                           "... a capital levy often defeats its own
                           purpose. The return was at once seen to be
                           disappointing. From virtue or from caution,
                           men refused to purchase estates as they came
                           on the market. Money soared in value.
                           The Triumvirs then imposed a levy on the
                           posession of opulent females, arousing
                           indignant protest ... other taxes, novel and
                           crushing, were invented ..."
                           --Sir Ronald Syme, The Roman Revolution, Book XIV.
2001/1/25 [Computer/SW/Mail, Computer/SW/Security] UID:20429 Activity:nil
1/24    Anybody know of any web-based newsgroups that allow you to post
        a question? urlP.
        \_ uh, your question doesn't make sense.  you can access usenet
           newsgroups via your favourite web browser...  there are tons
           of bulletin board type things all over the web...  what the
           hell are you asking?
           \_ For example, http://www.dejanews.com allows you to read articles, but
              you can't post a question.  Using a news reader client, I can
              connect to various public news servers that will allow you to
              post.  However, port 119 (NNTP) is shut down on the network, so
              I can't use any of the news readers.  My only option is to go
              over the web, and most web-based newsgroups that I know of only
              allow you to read, not post.  Question remains - are there any
              web-based public newsgroups that allow you to post?
                \_ you can't post to http://deja.com as an anonymous bastard.
                   you need to register with them and go through http://my.deja.com
2001/1/25-26 [Computer/SW/WWW/Server] UID:20430 Activity:kinda low
1/24    I've heard of companies making daughterboards that process SSL
        sessions to offload the CPU to do the real work.  Anybody know where
        I can find them?  I searched for "SSL daughterboard" and some other
        similar words and couldn't find anything.  Thanks.
        \_ Don't erase correct answers. SSL accelerator cards are made by
                nCipher, Phobos and Rainbow.
        \_ bigIP makes one for their load balancers. http://www.f5.com
                \_ DON'T!  DON'T DO IT!  -John
        \_ Intel makes a box you put in front of the web server.  BigIP/F5
           has an add-in card as stated above.  Ask their sales guys how they
           compare to their other competitors to get the full list.  That
           trick always works.
                \_ The Intel Box 2180 kicks serious butt compared to the F5.
                   The daughtercard does RSA and cipher ops in HW and more
                   the point--  BigIP == BSDi + rainbow card.  Check out
                   http://www.rainbow.com and there is one or two other people out
                   there selling similar products.  THe bad thing there is
                   they only do the SSL symmetric key negotiation RSA ops in
                   HW.  I.e..  you get one per interactive session, so you
                   in effect get little if any speedup in real situations.
                   What blows my mind is that Intel and F5 sell these boxes
                   for ~ $50k+.  They are little more than BSD + regexp
                   parsing http headers in hacked kernel.  ack...
                        \_ Intel has an ssl-decrypt-only box for much less
                           where you put their box inlineon the wire.  SSL
                           goes in the front and decrypted stream comes out
                           the back wire.  I _think_ it was about $1.5k/box
                           or so but I can't recall for sure.  The $50k thing
                           was a full load balancer/ssl decrypter/switch/etc/
                           do everything box.  You can put the ssl-only box
                           in front of your bigip or other load balancer.
                           Can you explain why you say there's no real speed
                           increase with the bigip/rainbox combo in the real
                           world?  I'm not getting it.
2001/1/25-26 [Computer/SW/Languages/C_Cplusplus] UID:20431 Activity:high
1/25    C question.  I want to declare a variable p which stores the pointer to
        a malloc'ed array of 65536 elements.  Each of these 65536 elements
        in turn stores the pointer to a malloc'ed array or 16 int's.  What's
        the best way to declare p to include as much type information as
        possible?  Sure I can do "int ***p;", but that doesn't contain much
        type information.  Thanks.
        \_ int *** p is the most general way, it's impossible to make better
           recommendations without knowing how this will be used.  If you want
           type information badly, C is probably not the best language for you.
           May I recommend ML?
           \_ How about "int (*(*p))[16];"?
        \_ Using structs is the usual solution to this dereferencing problem.
        \_ if you know the size is 65536 and there at only 16 ints, then you
           could do "int ar[65536][16]". or is there a limit on the size of
           arrays in C? Or if you're using c++, you should be using vector<>:
           vector<vector<int> > ar;-ali.
           \_ But then I can't do "ar = malloc(...);" to allocate the array
              dynamically.
              \_ if you really need dynamically allocate the array (i'm
                 guessing you actually don't), the cleanest thing to do is:
                     typedef double bigarr[65535][16];
                     bigarr *ar = malloc(sizeof(*ar));
                     (*ar)[20][2] = 4;
                        -ali
                 \_ I do need to allocate dynamically, because in BorlandC for
                    plain DOS, the max. size of a statically defined array is
                    65536 bytes, while I can dynamically allocate a block
                    bigger than that (via farmalloc()).
        \_ and what is this crap about ***? why can't use you just use **?
           or did you really mean 'alloced array OR 16 ints" instead of
           "array OF 16 ints". -ali
           \_ I meant the latter.  Basically I'll call malloc() once to
              allocate the 65536-element pointer array, then call malloc()
              65536 times to allocate all of the 16-element int arrays.
              \_ in that case, declare:
                  double (*ar)[16];
                  this declares a pointer to a 16 element array.
                  then ar = malloc(65535*sizeof(ar)) will give you 65525
                  pointers. -ali
2001/1/25 [Politics/Domestic/President/Bush] UID:20432 Activity:nil
1/25    bush is a moron. lets see how long it will take for the
        motd gestapos to censor this.
        \_ can I just say I'm sick of political bashing. If you
           have a specific issue that isn't an emotional vent,
           post it. Otherwise keep yer political judgements to
           yourself.      -Lifelong Berkeley Liberal who wants
                           everyone to rise above it.
                           \_ I pity you.
                                \_ I'd hope the Liberals can
                                   rise above it, because the
                                   conservatives obviously can't.
2001/1/25-27 [Computer/SW/OS/Windows] UID:20433 Activity:high
1/25    Non-preemptive model automatically implies cooperative model right?
        Whereas preemptive assumes OS control anytime (e.g. UNIX).
        \_ Can non-preemptive model include models with no multitasking at all?
           \_ Yes.  It can include a 'program loader model' which is what MSDOS
              uses.
                \_ Think I could get a few bucks for my MS Dos 1.0 bootable
                   floppy on ebay from some computer history collector freak?
                   \_ Don't be gay.
                        \_ Don't be stupid.  It's a valid question even if
                           you're too young or moronic to see that.
                           \_ Don't be gayer.
2001/1/25-26 [Uncategorized] UID:20434 Activity:very high
1/25    ooh ooh ooh. somebody say something mean!  Everybody's being
        nice and polite.  It's annoying.
        \_ yermom likes my dad.
           \_ Your dad?  You mean to say you know who he really is?
        \_ yermom sews socks that smell.
        \_ Did you know that most of our imports come from other
           countries?
           \_ Wrong.  All of our imports come from other countries. -- yuen
              \_ Most is inclusive of all. Besides, that was not
              \_ 'Most' is inclusive of 'All'. Besides, that was not
                 meant to be a statement of truth but an "insightful
                 fact" I learned from a certain person whose name
                 I will not mention on the motd. Obviously, some
                 people's idea of "insightful" includes things that
                 are just plain obvious.
                 \_ huh?
                    \_ I dunno.  Nothing has anything to do with anything.
                       \_ Hey, 'Nothing' is inclusive of 'anything'.
                          Insightfully obvious for plain mentioning.
2001/1/25-27 [Computer/SW/Compilers, Uncategorized/Profanity] UID:20435 Activity:very high
1/25    Which is a more efficient strcpy()?  Is it copying each character
        until you reach \0; or is it calling strlen() to get the length
        of the string and executing a memcpy of that length?
        \_ That probably depends on the CPU architecture, e.g. whether or not
           it has string instructions and how efficient they are.
           \_ Assume Pentium 3 with a Linux 2.x kernel and using gcc 2.95.2.
              \_ with strlen() counting each character until \0 is found.  :-)
                 \_ why?
                    \_ Relax, son, it's a joke.  Move along.
        \_ wc `locate strcpy.c bcopy.c`
        50     337    2163 /usr/src/lib/libc/string/strcpy.c
        47     328    2085 /usr/src/sys/libkern/strcpy.c
        35     112     711 /usr/src/contrib/binutils/libiberty/bcopy.c
       139     685    4175 /usr/src/lib/libc/string/bcopy.c
       271    1462    9134 total

            #include <string.h>

            char *
            strcpy(to, from)
                    register char *to;
                    register const char *from;
            {
                    char *save = to;

                    for (; (*to = *from) != 0; ++from, ++to);
                    \_ != 0 not needed
                    return(save);
            }
                \_ Now do it in 6052, 80286, perl 4.036 (1 line or less),
                   and 3 other languages/scripts of your choice.
                   \_ by "6052" do you mean 6502?  fucking hoszer.
                        \_ Holy shit!  A typo!  And you caught it!  Wow!
                           You are *soooo* smart!  Did you tell yermom?
                           I'd bag on _your_ typo but I'm not as smart as you.
                           \_ I'd bag on your misspelling too fag.
                              \_ Uhm, there wasn't one, son....  Either way,
                                 if the best you can do is toss around "fag"
                                 one liners, maybe you're better off just not
                                 bothering.  Maybe you should try again in a
                                 few years when you're passed your 6th grade
                                 tests.
                                 \_ Suck my dick, cocksucker.
        \_ gcc has a built-in implementation of strcpy, but i can't get it
           to emit on linux, gcc 2.95.2. anyone have better results? -ali
           \_ Try compiling with -Dstrcpy=__builtin_strcpy. The -fhosted or
              -fbuiltin options sound like they should work, but they
              don't. -asaddi
2001/1/25-26 [Uncategorized] UID:20436 Activity:nil
1/25    When is the first IPO of this year?
        \_ A couple of weeks ago.
        \_ Peet's Coffee & Tea and 2 others this week. (from WSJ)
2001/1/25-26 [Health] UID:20437 Activity:moderate
1/25    Construction worker accidentally saws off hand, shoot nails into
        head to end pain:
        http://www.cnn.com/2001/US/01/25/sawed.off.hand.ap/index.html
        \_ His brain must be so small that even one-inch nails can't reach it.
           That explains his behavior.
        \_ Well, he probably was trying to kill himself, right?
        \_ 'Sup, dudes brain must be so's little-ass dat even one-inch nails
            kin't reach it.  Dat 'esplains his behavio'.
        \_ Sheeit, he probably wuz tryin' t'put de smack down on himself,
           right?
        \_ racist fuckers.
                \_ See?  I told you all the other day how important it is to
                   scream "RACISM!" on the motd.  I'm not alone on this.
2017/09/22 [General] UID:1000 Activity:popular
9/22    
Berkeley CSUA MOTD:2001:January:25 Thursday <Wednesday, Friday>