|
11/23 |
2014/1/14-2/5 [Computer/SW/Languages/C_Cplusplus] UID:54763 Activity:nil |
1/14 Why is NULL defined to be "0" in C++ instead of "((void *) 0)" like in C? I have some overloaded functtions where one takes an integer parameter and the other a pointer parameter. When I call it with "NULL", the compiler matches it with the integer version instead of the pointer version which is a problem. Other funny effect is that sizeof(NULL) is different from sizeof(myPtr). Thanks. \_ In C, a void pointer is implicitly convertable to any other pointer type, so (void *)0 works in any context where you need a pointer. C++ doesn't allow that conversion, because it isn't typesafe. (That's why you can write "int *p = malloc(4)" in C but not in C++.) Unfortunately, there's no simple equivalent of (void *)0 that works in C++. Recent C++ compilers have added a new keyword "nullptr" that does the right thing, but they've avoided defining NULL to it so they don't break old code. --mconst |
11/23 |
2013/4/29-5/18 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers] UID:54665 Activity:nil |
4/29 Why were C and Java designed to require "break;" statements for a "case" section to terminate rather than falling-through to the next section? 99% of the time poeple want a "case" section to terminate. In fact some compilers issue warning if there is no "break;" statement in a "case" section. Why not just design the languages to have termination as the default behavior, and provide a "fallthru;" statement instead? \_ C did it that way because it was easy to program -- they just \_ C did it that way because it was easy to implement -- they just used the existing break statement instead of having to program a new statement with new behavior. Java did it to match C. \_ I see. -- OP |
2013/4/9-5/18 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Apps, Computer/SW/Languages/Perl] UID:54650 Activity:nil |
4/04 Is there a good way to diff 2 files that consist of columns of floating point numbers, such that it only tells me if there's a difference if the numbers on a given line differ by at least a given ratio? Say, 1%? \_ Use Excel. 1. Open foo.txt in Excel. It should convert all numbers to cells in column A. 2. Open bar.txt in Excel. Ditto. 3. Create a new file in Excel. 4. In cell A1 of the new file, enter this: =IF(foo.txt!A1=0, IF(bar.txt!A1=0, "same", "different"), IF(ABS((b\ ar.txt!A1-foo.txt!A1)/foo.txt!A1)<1%, "same", "different")) 5. Select cell A1. Hit Ctrl-C to copy. 6. Select the same number of cells as the number of cells that exist in foo.txt or bar.txt. Hit Ctrl-V to paste. 7. Hit Ctrl-F. In "Find what:", enter "different". In "Look in:", choose "Values". Click "Find All". Another way is to write a C program to read the two files using fscanf("%f") an do the arithmatic. \_ does this help? #!/usr/bin/python import sys threshold = float(sys.argv[3] if len(sys.argv) > 3 else 0.0000001) list1 = [float(v) for v in open(sys.argv[1]).readlines()] list2 = [float(v) for v in open(sys.argv[2]).readlines()] line = 1 for v1, v2 in zip(list1, list2): if abs((v1 - v2) / v1) >= threshold: print "Line %d different (%f != %f)" % (line, v1, v2) line += 1 \_ Something like this might work ($t is your threshold): $ perl -e '$t = 0.1 ; while (<>) { chomp($_); ($i,$j) = split(/ \t/, $_); if ($i > ((1+$t)*$j) || $i < ((1-$t)*j)) { print "$_\n"; }}' < file |
2012/7/19-11/7 [Computer/SW/Languages/C_Cplusplus] UID:54439 Activity:nil |
7/19 In C or C++, how do I write the code of a function with variable number of parameters in order to pass the variable parameters to another function that also has variable number of parameters? Thanks. \_ The usual way (works on gcc 3.0+, Visual Studio 2005+): #define foo(fmt, ...) printf(fmt, ##__VA_ARGS__) The cool new way (works on gcc 4.3+): template<typename... Args> void foo(char *fmt, Args... args) { printf(fmt, args...); } The old way (works everywhere): void foo(char *fmt, ...) { va_list ap; va_start(ap, fmt); vprintf(fmt, ap); va_end(ap); } --mconst \_ That's very helpful! Thank you!!! \_ Did you say VISUAL STUDIO? Why??!?!?!? All jokes aside, thanks for bringing back motd to the way it used to be. |
2012/1/24-3/3 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Languages/Misc] UID:54296 Activity:nil |
1/24 http://james-iry.blogspot.com/2009/05/brief-incomplete-and-mostly-wrong.html Amusing "history" of computer science. \_ Where's the mentioning of Al Gore the inventor of AlGorithm? |
2011/10/12-11/30 [Computer/SW/Languages/C_Cplusplus] UID:54196 Activity:nil |
10/9 RIP Dennis Ritchie \_ <DEAD>plus.google.com/u/0/101960720994009339267/posts/ENuEDDYfvKP<DEAD> He was a really nice man - met him once when Inferno was first being developed. \_ was he NAMBLA nice? |
2011/8/3-27 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Languages/Python] UID:54156 Activity:nil |
8/3 http://vedantk.tumblr.com/post/8424437797/sicp-is-under-attack \_ http://www.cs.berkeley.edu/~bh/61a.html \_ this is sad \_ "An Update SICP will not be abandoned at Berkeley." |
2011/3/7-4/20 [Computer/SW/Languages/C_Cplusplus] UID:54056 Activity:nil |
3/7 I have a C question. I have the following source code in two identical files t.c and t.cpp: #include <stdlib.h> int main(int argc, char *argv[]) { const char * const * p1; const char * * p2; char * const * p3; p1 = malloc(sizeof *p1); p2 = malloc(sizeof *p2); p3 = malloc(sizeof *p3); free(p1); /* warning in C and C++. Expected. */ free(p2); /* warning in C only. Why warning in C? */ free(p3); /* warning in C++ only. Why no warning in C? */ return 0; } When I compile t.cpp, "free(p2)" generates a warning and "free(p3)" generates no warning, as expected. However, when I compile t.c, the opposite happens. Why? Thx. \_ gcc 4.3 complains about free(p1) and free(p3) in both C and C++. What compiler are you using? \_ MS Visual Studio 2008 command-line for x86 (cl.exe). -- OP \_ Some input. add typedef char * cstr, then replace char * with cstr you will get warnings on all frees. Which means to me that the issue might be that binding of ** is stronger than const. \_ Some input. It may be clearer to add typedef char * cstr; then replace char * with cstr and you will get warnings on all frees. Which means to me that the issue might be that binding of ** is stronger than const. const char * * p2; // const charPtrPtr p2 not array of const char * note, a line const char * string = p2 will not throw any warnings note, a line const char * cstr = p2 will not throw any warnings (if you put it after the malloc(for init)). You can also go: p2 = (const char **)0xdeadbeef since you can modify p2. Funny note: both: *p2 is not const since both: *p2 = (const char *)0xdeadbeef; // or *p2 = (char *) 0xdeadbeef; // will work. no warnings of "assign from incompat ptr type". (put this before the p2 = assignment if you test them both otherwise SEGV) with no warnings of "assign from incompat ptr type". (put this before the p2 = assignment if you test them both otherwise SEGV) This is on gcc 4.4.4. I am assuming here tho that you didn't specifically mean to create a constant charPtrPtr with p2. My question to you is can you explain what you are declaring with p1, p2, p3; that would be a good point to start debugging. Also if you can get a disasm of the code look for push's of absolute values. that should tell you where the const is. RE: cpp vs c. If you put the code as is in g++ you will get errors not warnings. If you cast properly in the malloc and free you won't get any errors. My guess is that g++ has stricter regulations than gcc. I'll answer some more when soda has been rebooted because it's fucking non-interactive right now. |
2011/2/5-19 [Computer/SW/Languages/C_Cplusplus] UID:54027 Activity:nil |
2/4 random C programming/linker fu question. If I have int main() { printf("%s is at this adddr %p\n", "strlen", strlen); } and soda's /proc/sys/kernel/randomize_va_space is 2 (eg; on) why is strlen (or any other libc fn) at the same address every time? \_ I don't pretend to actually know the right answer to this, but could it have something to do with shared libraries? \_ i thought tho the whole point was to randomize the addresses of the shared lib fns so that people couldn't r2libc. |
2010/8/29-9/30 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Languages/Java] UID:53941 Activity:nil |
8/29 ok i give up; why is this throwing an error? #define Lambda(args,ret_type,body) \ class MakeName(__Lambda___) { \ public: ret_type operator() args { body; } } usage: Lambda((int a, int b), int, return a+b) foo; >g++ -o foo foo.cpp foo.cpp: In function ‘int main(int, char**)’: foo.cpp:9: error: expected primary-expression before ‘class’ foo.cpp:9: error: expected `;' before ‘class’ foo.cpp:11: error: expected `}' at end of input ref: http://okmij.org/ftp/cpp-digest/Lambda-CPP-more.html#Ex1 \_ works for me. see /tmp/lambda.cpp \_ nod thanks, i didnt have MakeName defined there. sorry. |
2010/8/8-9/7 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Languages/Web] UID:53914 Activity:nil |
8/8 Trying to make a list of interesting features languages have touted as this whole PL field comes around, trying to see if they have basis in the culture of the time: feel free to add some/dispute 1970 C, "portability" 1980 C++, classes, oop, iterators, streams, functors, templates expert systems 1990 Java, introspection, garbage collection, good threading model CORBA -- collosal failure. RMI nice and light. neural nets 2000 CGI hacks. PHP and Perl hacks. Bad post dot-com crap programming (lots of disposable UI code). organic evolvers - PHP, javascript, flash (ha) \_ Do you guys remember at some point they started to use TCPIP over localhost to do IPC? I think this was around this time, also at the same time people started to make everything MVC I remember when say old apps were suddenly split into server and client component (where client was the webbrowser) because "it was easy and quick to design a UI on the browser" tho I think this died out. \_ Patterns started to become big. 2010 Slow language fast prototyping scripting. Javascript, Ruby on Rails, Python. Use of NoSQL. Protocol buffer. \_ This helps chip companies sell faster and bigger chips. What a waste. Cloud Computing Death of AI |
2010/6/4-30 [Computer/SW/Languages/C_Cplusplus] UID:53849 Activity:nil |
6/4 Is this valid C++ code? std::string getStr(void) { std::string str("foo"); return str; } void foo(char *s); void bar(void) { foo(getStr().c_str()); // valid? } Will foo() receive a valid pointer? Is there any dangling reference or memory leak? Thanks. --- old timer \_ Yes, this is fine (except for the const problem noted below). The temporary std::string object returned by getStr is destroyed at the end of the statement in which you called getStr. \_ It can be a pointer to inside the implementation--it doesn't have to alloc anything. \_ c_str() returns a const char*, not a char*. foo needs to take a const char*, and does not need to deallocate anything (nor is it allowed to modify the contents of the char*). You can cast away the const for legacy functions that don't deal with const well as long as you know the function won't try to change the string. \_ So after I change foo() to "void foo(const char *s);", everything is good, right? Thanks. -- OP \_ Yep. -pp \_ for bonus points think about how many times the copy ctor is used. \_ One? -- OP |
2010/5/25-26 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Languages/JavaScript, Computer/SW/Languages/Misc] UID:53843 Activity:nil |
5/25 The warranty that the 2pir and Syzygryd code will ship with. It's hilarious: http://bit.ly/bqowSx -dans |
2010/2/12-3/9 [Computer/SW/Languages/C_Cplusplus] UID:53708 Activity:nil |
2/12 I need a way to make a really big C++ executable (~200MBs) that does nothing. No static initialization either. Any ideas? \_ static link in lots of libraries? \_ #define a i=0; i=0; i=0; i=0; i=0; i=0; i=0; i=0; i=0; i=0; #define b a a a a a a a a a a #define c b b b b b b b b b b #define d c c c c c c c c c c #define e d d d d d d d d d d #define f e e e e e e e e e e #define g f f f f f f f f f f int main(int argc, char *argv[]) { volatile int i = 0; if (i == 0) return 0; g g g return 0; } This should give you about 210MB in both Linux and Win32. This should give you about 210MB in both Linux and Win32 on x86 machines. \_ I like you. Best motd answer, EVAR. \_ Wow, thanks. That's cool. \_ Just wondering, what is this for? \_ At work we're porting a very large code to a new platform. The executable was seg faulting and I just figured out that the system probably can't handle executables larger than ~100 MBs. (It turned out to be about 54MBs really). I needed a reproducer. -op |
2009/9/28-10/8 [Computer/SW/Languages/C_Cplusplus] UID:53409 Activity:nil |
9/28 http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html Java is #1!!! Followed by C, PHP, C++, Visual Basic, Perl, C#, Python, Javascript, then finally Ruby. The good news is Pascal is going waaaay back up! \_ C is still more popular than C++? I feel much better about myself now. \_ I rather die than to use C++. Piece of shit. |
2009/8/20-9/1 [Computer/SW/Languages/C_Cplusplus, Computer/SW] UID:53294 Activity:nil |
8/20 http://en.wikipedia.org/wiki/Threading_Building_Blocks Anyone use this? Any gotchas? thanks. |
2009/8/7-14 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Languages/Java] UID:53252 Activity:high |
8/6 In C one can do "typedef int my_index_t;". What's the equivalent in C#? Thanks. \_ C#? Are you serious? Is this what the class of 2009 learn? \_ No. I have to learn .NET code at work. I am Class of '93. \_ python is what 2009 learns, see the motd thread about recent cal courses and languages \_ using directive. I think you would have written: using my_index_t = int; http://msdn.microsoft.com/en-us/library/sf0df423(VS.80).aspx Btw using is overloaded to do a few different things, so... enjoy the reserved word ambiguity created for your convenience. -mrauser \_ http://lmgtfy.com/?q=c%23+typedef \_ in C nobody can hear you scream \_ You're kidding me right? Java sucks donkeys, hands down. \_ HERESY. You are dangerously close to THOUGHTCRIME, voter. \_ But Java haz eklipze!!! ZOMG! HAT3R!!!!1! |
2009/7/6-16 [Computer/SW/Languages/C_Cplusplus] UID:53116 Activity:nil |
7/6 I will attempt to write a desktop application for the masses. Should I write it in C++, Java, C#, or Python anticipating that "Shed-Skin" will be mature enough to use to turn my Python into C++ code. Comments please ladies and gentlemen. \_ What OS do the masses use? \_ powershell. \_ What is more important, the ability to do lots of calculations, or rapid development and the ability to modify and add functionality at will? ARe you interested in cross-platform compatibility? |
2009/5/8-14 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Languages/Java] UID:52972 Activity:nil |
5/7 http://james-iry.blogspot.com/2009/05/brief-incomplete-and-mostly-wrong.html \_ 1964 - John Kemeny and Thomas Kurtz create BASIC, an unstructured programming language for non-computer scientists. 1965 - Kemeny and Kurtz go to 1964. This should not have made me giggle so much. \_ GODDAMNIT, now you've got me giggling. \_ 1996 - James Gosling invents Java. Java is a relatively verbose, garbage collected, class based, statically typed, single dispatch, object oriented language with single implementation inheritance and multiple interface inheritance. Sun loudly heralds Java's novelty. 2001 - Anders Hejlsberg invents C#. C# is a relatively verbose, garbage collected, class based, statically typed, single dispatch, object oriented language with single implementation inheritance and multiple interface inheritance. Microsoft loudly heralds C#'s novelty. |
2009/4/6-13 [Computer/SW/Languages/C_Cplusplus] UID:52806 Activity:moderate |
4/6 In C++, if there are several instances of an object, and for debugging purpose I want to see which instance of an object it is, I can do 'printf("%p", pObj);' to print out the address of the object. Is there any way to do something similar in C#? Thanks. \_ CLR objects can get shuffled around in memory nondeterministically. Using the address or something like that won't work for identifying an object. You need an object identifier, a UID or something explicitly in the object to follow it. \_ How do I get an object ID that I can print out? Thanks. \_ How do I get an object ID that I can print out? Thanks. -- OP \_ You need to set it, probably when you instantiate it. \_ I see. Thx. -- OP |
2009/2/25-3/3 [Computer/SW/Languages/C_Cplusplus, Politics/Foreign] UID:52638 Activity:nil |
2/25 Spinoff of the silly food stamp thread below: The US Recommended Daily Intake values (which the current USRDA is based on) were developed during WWII. The methodology was to take "volunteer" subjects (white male conscientious objectors, mostly Quakers) and put them on nutrient-deprivation diets until their systems failed. Then they would add the missing nutrient back in until the systems began to function again. The level of nutrient required to avoid system failure was then established as the RDI. These studies did not examine overall health, or long-term effects of low nutrient levels. What is more, the countries which have something like the USRDA are in complete disagreement about their recommendations, which often vary by a factor of 5 or more from country to country. So when you look at a food product that claims to provide 100% of the USRDA of Vitamin C, that means that it contains enough vitamin C to keep white male Quakers of military age from getting scurvy. It doesn't say anything about how much vitamin C you should have for good health. -tom \_ Ha, that's pretty interesting. Do you have a link? \_ http://gunpowder.quaker.org/documents/starvation-kalm.pdf talks about the project but not specifically the implications for the USRDA. See: "Keys A, Brozek J, Henschel A, Mickelsen O, Taylor HL: The biology of human starvation. Minneapolis: University of Minnesota Press; 1950." -tom |
2009/2/23-26 [Computer/SW/Languages/C_Cplusplus] UID:52622 Activity:low |
2/23 Has anyone read Anathem yet? How good (or bad) is it in comparison to Cryptonomicon? \_ Depends: what did you like/dislike about Cryptonomicon? \_ I started to dislike the overlapping WW2 and present day stories by the 1/2 half of the book. And it seemed like a lot of the technical details were thrown in to prove how smart Stephenson was rather than to add anything to the narrative. \_ Paradoxically, those were the parts I enjoyed. Anyway, Anathem is comprised significantly of technical details and philosophy of science/math. If you thought C was too clever for its own good, you may find A suffers from the same. That said, I enjoyed it as much as C, less than System of the World, about as much as Diamond Age, less than Snow Crash. \_ In the first half of C, I liked the overlapping narrative b/c it kept me guessing how the two stories were related, but I found it tiresome and confusing in the 2d half. WRT the technical details - it just felt like I was reading a watered down, inarticulate version of Applied Crypto. Maybe I will get Anathem a try. Thanks. \_ What if you just thought C was too smarmy for its own good? \_ Don't know that I'd call A smarmy. It does have its fair share of being interested mostly in itself, though. |
2009/2/19-25 [Computer/SW/Languages/C_Cplusplus, Academia/GradSchool] UID:52600 Activity:low |
2/19 Student Expectations Seens as Causing Grade Disputes: http://www.nytimes.com/2009/02/18/education/18college.html \_ "I tell my classes that if they just do what they are supposed to do and meet the standard requirements, that they will earn a C." All well and good, but the problem is that 2.0 is perceived as almost failing. Maybe once employers and grad schools realize that 3.0 is not a minimum effort but a pretty good student then students will adjust expectations accordingly. I got a B in a very difficult upper division math class and I had a recruiter tell me "You must not be very good at math." I told her I was very good and where did she get that idea. "Your report card." So as long as students have to deal with that crap then hell yeah we won't accept a C for spending 40 hours per week on a class even if it's "what we deserve" because the perception is that a C is really a D (pass for credit, but that's about it). Perhaps this is a result of grade inflation, but I don't think students spawned it. Competition did. It used to be fairly easy to get into schools like Stanford and very few students took the SAT. If 80% of the class got C's that was fine. It's not fine anymore and from what I can see from my nieces and nephews kids are working harder than ever even at young grades. My 3rd grade nephew has like 3-4 hours of homework a night. I think we have to do this to complete as this is common in places like Japan, but the older people in the system don't realize how much things have changed and have not adjusted expectations accordingly. You won't get only the top 5% of students in college anymore at most universities and the kids that are there are less motivated by learning. They need that B to be able to survive while at the same time there is a perception that C = poor student. \_ C *IS* poor. My parents used to tell me that C is for inferior native kids, B is for second generation immigrants, and A is for people like us. -hard working immigrant \_ Not with the definition professors are using: "I tell my classes that if they just do what they are supposed to do and meet the standard requirements, that they will earn a C." By the way, your parents sound like real pieces of work. \_ I agree, kids these days have no sense of perspective. They want 100 column terminals, good grades, friendly professors, &c. Back when I went to Cal everyone knew that a C- was the mean and working your butt off to get mean was standard operating procedure b/c the mean student was an asian overachiever just like you. An A was a mythical promised land reserved for future nobel prize winners - the ones who sat in the front row and could correct the mistakes of the nobel prize winner teaching the class. \_ Wasn't there a CSUA'er who took like 39 units in a semester and ended up with a 3.9+ GPA? calbear? I wonder if he's gonna win a Nobel Prize. I had a crap GPA while at Cal but knew lots of people with 3.7's who didn't study 24/7. College just seemed easier for them, like how High School was just easy for most Cal students. \_ I went to HS with calbear. He was wicked smart. Last I heard he dropped out of the PhD program at the farm. But he might still win a nobel prize though. \_ I thought he completed his Ph.D. \_ http://hkn.eecs.berkeley.edu/~calbear/resume/mr.htm \_ Guess I heard wrong. |
2009/2/9-17 [Computer/SW/Languages/C_Cplusplus] UID:52547 Activity:nil |
2/9 I am new to signal handlers in C. I want to clean up some temp files if my program is interrupted. I can catch the interrupt just fine, but signal() doesn't take any args to pass to the handler. So how can I pass it the information it needs to be useful, like the names of the files to delete before exiting? STFW doesn't yield much. \_ You are going to need a global variable. \_ Be careful. Almost every library function can't be used from within a signal handler. Take a look at this website, and take its message to heart ;) <DEAD>www.securecoding.cert.org/confluence/display<DEAD> seccode/11.+Signals+(SIG) \_ You will probably need to do something with sigsetjmp and siglongjmp. Stevens APUE Ch 10 has a good explanation iirc. \_ Depending on your security needs this is a bad idea <DEAD>www.securecoding.cert.org/confluence/display/seccode<DEAD> SIG32-C.+Do+not+call+longjmp%28%29+from+inside+a+signal+handler \_ Didn't know this. Thanks for the link. |
2008/11/26-29 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Languages/Perl] UID:52111 Activity:nil |
11/25 Yargh! They sank the wrong pirate ship! http://news.yahoo.com/s/ap/20081126/ap_on_re_as/as_piracy_1 \_ Oh shit! \_ duh, work with indian java monkeys sometime. \_ That's stereotyping! Other language (C, C++, Perl, etc.) monkeys are also the same. \_ The boat was taken over by pirates! Now no one needs to worry about paying ransom. Why didn't they think of this earlier? Oil prices and environmental awareness are too low as it is. Fire away! |
2008/11/24-29 [Computer/SW/Languages/C_Cplusplus] UID:52093 Activity:nil |
11/23 C++ question: If I have "char *p = new char[10];", is there any real difference between "delete p;" and "delete[] p;" after compilation? The Standard C free() function only has one form and works for freeing both a single character and a character array. Why are there separate forms in C++? Thx. \_ For an array of char, there's no difference. If you have an array of objects, though, delete[] needs to call the destructor for each one. --mconst \_ http://www.parashift.com/c++-faq-lite/freestore-mgmt.html#faq-16.13 \_ Thanks to both replies. -- OP |
2008/10/10-15 [Computer/SW/Languages/C_Cplusplus] UID:51467 Activity:nil |
10/9 Can anybody sumarize what is the basis of Citigroup's suit against WFB and Wachovia? \_ It doesn't matter. WFC has the better argument. C had an exclusivity agreement but the bailout bill trumped it. \_ I'm not asking if it "matters", I'm trying to learn what was at issue. \_ C had an exclusivity agreement \_ C had an exclusivity agreement but the bailout bill trumped it. |
2008/10/8-9 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Languages/Misc] UID:51433 Activity:nil |
10/8 Fossil shows how turtles evolved their shells: http://preview.tinyurl.com/4dqlhk [new scientist] |
2008/9/7-12 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Languages/Java, Computer/SW/Languages/Misc] UID:51093 Activity:nil |
9/7 I want to learn Design Patterns without having to buy the famous book. Is there a place online where I can learn and study it? \_ http://c2.com/cgi/wiki/wiki?DesignPatterns \_ I'll sell you my copy in near mint condition for $25. -abe |
2008/6/9-12 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Security] UID:50194 Activity:nil |
6/8 CSUA code guru please help. I need to see my random number generator with a good seed (I just need random 18 bit identifiers). The usual time(NULL) is OK, except my program might be invoked faster than once a second, and seeding using time() produced the same result. I tried clock() but it seems to return 0. My program needs to be run in Linux/DOS (Watcom 32bit compiler), so I prefer to stick with standard API. What's a good way to get some randomness without using special time function that goes into millisecond precision? Poke at some random bytes? Allocate a random array? This is in C. If I allocate say a 64byte block, and XOR the uninitialized memory, is there any guarantee that it will be a different 64byte block the next time my program is run? Thanks! \_ What are you doing this for? If it's encryption why are reimplementing the (really difficult to get right) wheel? If it's not encryption what is it that needs high quality random numbers? \_ I need to assign ID that are unique within a day to something 30 bit. I am thinking seconds_since_midnight (17 bits) + a random number (13 bits). If I simply seed using time(), my rand() will generate the same number if invoked within a second. So I am now seeding it using the XOR of time() with 64 uninitialized int on the stack (again XORed together). This seems to do the trick. \_ Huh? You only need to seed once. After that you have a supply of random numbers you can draw on. So just seed by time when you start the program. Or are you thinking you are going to invoke main() many times per second? I don't know what you are doing here so it's hard to give good feedback, but think in terms of "now I have a stream of random numbers and I just need to use them." \_ The program exists after generating one ID. \_ Do you mean "exits"? S/w like SSH uses prngd to get around this problem. \_ Use another random number generator to generate the random seed for your random number generator! Oh wait ...... \_ What is wrong with rand? \_ Easiest just to bite the bullet and use non-ANSI C functions. The random array allocations are not at all guaranteed. \_ seed it with time and getpid. Expecting unintialized memory to have random data runs the risk some chowderhead will take your code and comment it out when it generates warnings. \_ Does DOS even have PIDs? Wtf is even using DOS these days... \_ Embedded applications like digital cameras, I guess. http://www.datalight.com/products/romdos \_ you could try opening and reading from a dummy file and then using clock to seed. That way you'll block on IO and the amount of time you do that should be relatively random. \_ I thought about it again and this wouldn't be a good idea especially if you are running the progam often. What will happen is that the file's memory page will be in cache after the first read and you won't have good random behavior. You could try file writes, but in general this is not a very strong randomness anyways. -pp \_ You're not a Debian contributor are you? |
2008/4/2-6 [Computer/SW/Languages/C_Cplusplus] UID:49645 Activity:moderate |
4/2 Is there an interpreted version of C or C++ that can be used for educational purposes? It doesn't have to be full-featured or strictly adhere to the standards, but it's painful for students to change a variable in a for loop and then wait for a compile to see how it changes the result. Something really lightweight would encourage them to play around a lot more and learn more in the process. \_ There are interpreted versions of C around. I know of one at UC Davis, although I don't know the name and have never tried it. \_ Seriously, for this level of programing why are you using C? There's all sorts of better learning languages that aren't going to get bogged down in C land. \_ Because this is to teach students C/C++ in particular and not CS/logic. Same reason why not to use perl or python in this instance. Imagine that you want to teach high school students C/C++. I don't want to use a 'learning language' like Pascal, because the objective it to learn the fundamentals of the C/C++ language. Many already know Java anyway. We can use a real compiler when the projects get more complex, but at Ground Zero an interpreted version of C would be nice. \_ I would argue that the compiling process is a pretty fundamental aspect of C/C++. So becoming comfortable with that (teach them to use make at the same time?) is part of learning the language. For simple programs compiling should be really simple to do. An IDE is even simpler but probably harder to see what is really going on (Visual Studio feels like using MS Office or something instead of seeing the individual steps.) \_ We are using Visual Studio, but it is far too cumbersome to start with. One compile of "Hello world!" takes a few mins even on modern h/w. It would be nice to be able to prototype simple programs or 'play' outside of the compiler. It is a PITA to recompile every time to do a simple change to see what might happen and it restricts people from wanting to experiment. \_ Few mins for hello world? Something seems wrong. At any rate a simple editor + gcc would definitely be easy. Just edit hello.c, gcc hello.c, a.out. Rinse, repeat. Well, good luck. \_ Or "cl hello.c" if Visual Studio is in your path environment variable. \_ well this then, is your biggest problem. were you using a linux host, gcc would compile simple C programs in a fraction of a second. Barring switching over to Linux, you could potentially try using gcc under cygwin, also very fast. -ERic \_ Can't switch to Linux as their lab runs WinXP. \_ reread my whole comment, including the gem about cygwin, which runs fine under winXP. -ERic \_ I read it. I was just explaining why Linux isn't an option. Thanks. \_ Why not use perl? If you have to use C, try cint from CERN: http://root.cern.ch/twiki/bin/view/ROOT/CINT \_ Please, not perl. Python. Ruby. Hell Scheme. Anything but perl. \_ cint looks interesting and I will play around with it. \- long ago, there was "Saber C" ... i dunno what is the current state of Sabre C/codecenter. Do these studnets know how to use gdb? I dont think the "problem" is recompiling, it is syntax and inspecting data structures. Why dont you use lisp. --psb |
2008/3/18 [Computer/SW/Languages/C_Cplusplus, Science/GlobalWarming] UID:49489 Activity:nil 80%like:49494 |
3/18 RIP Arthur C. Clarke http://preview.tinyurl.com/2264p8 [nyt] |
2008/1/14-18 [Computer/SW/Languages/C_Cplusplus, Politics/Domestic/California] UID:48947 Activity:insanely high |
1/14 Why do we put up with plurality voting for stuff like primaries? When the "winners" get around a quarter to a third of the vote something is broken. We should have IRV. And also, national popular vote for president. \_ IRV is not monotonic. What you want approval voting. -dans \_ Actually I'd rather have IRV. I think we discussed this before though. I think monotonicity is mostly irrelevant. The arguments I've seen against IRV are either wrong (use a misconception of what IRV is) or else cite concerns about tactical voting. But we have tactical voting now. The question is whether the situation is improved. I believe we can be a lot more confident in broad support of an IRV winner than a plurality winner. \_ Uh huh. But approval voting has all the advantages you just described, doesn't suffer from being not monotonic, and elimnates tactical voting. As a practical matter, have you ever tried to count the votes in an IRV system? It sucks, and is completely opaque. -dans \- See Arrow Impossibility Theorem \_ Thank you for supporting my point. -dans \- I am not supporting your point. you pretty much cant eliminate tactical or various other pathologies. if you think you can, you dont understand the Arrow Thm ... which is of course quite possible. \_ Actually, you're the one who doesn't understand it. Voting systems can and do eliminate the pathologies mentioned, it's just that a given system cannot eliminate *all* of them. Tactical voting has a very specific definition in this context, and you don't seem to understand it. Indeed, all the arguments I've seen that suggest approval voting is not strategy free seem rooted in the same misunderstanding you hold. -dans \_ What is the specific definition, and who decides it? If there are problems that don't fall into your specific definition, who cares what the definition is, if the problems are real? The fact is that approval voting does not allow ranked choices and has its own pathologies/strategies/whatever. \_ Pathologies != Strategies. Obviously approval voting does not have ranked choices, but that's not the point. The point is that all forms of ranked choice voting I've seen add significant complexity to the process, and can produce oddball results where people's choices get permuted. Both of these considerations are unforgiveable. -dans \_ Approval also adds complexity to the process. IRV is being used already so it is clearly a manageable complexity and obviously "forgiveable". Oddball results I think you're just wrong about. \_ It does not have all the advantages. It does not eliminate tactical voting, duh. If I approve A, but like B better than C, I could vote B even though it hurts A's chances. That is tactical. It does not let you rank your choices which is the entire point. How is monotonicity relevant? Who gives a shit? With approval voting, approving another candidate could lead to my preferred candidate losing. How is that better? \_ You're just wrong. If you vote for A and B in approval voting, then you're saying you're okay with either A or B, and there's no way your vote can help C, who you don't approve of, win. In IRV, if you vote A as you first preference and B as your second, you can actually cause C to win. Whoops. -dans \_ Show me a realistic example where that happens. \_ Read the literature. -dans \_ I have. It doesn't happen in any realistic case. I believe, and I'm not alone in this, that your concerns about being monotonic totally irrelevant. \_ You're making the assertion. \_ It's not my job to do your homework, especially when if you're just going to assert that my example is unrealistic. Don't be disingenuous, and don't bring a knife to a gunfight. -dans \_ I've done my homework and think you're wrong. Many <learned authorities> support using IRV. Show me where we "cause C to win" by voting A. I think you're selectively playing fast and loose with terminology. Examples of this problem: Math Prof at Temple University: http://www.csua.org/u/ki3 Wikipedia: Instant-Runoff Controversies: http://www.csua.org/u/ki4 -dans \_ I read the first example in the first link and it's ridiculous. Range voting is obviously less intuitive when you have averages, and his first example shows C winning even though the majority of the voters either dislike or know nothing about C. The discussion of monotonicity also shows how irrelevant the concern is. Yes, it is unrealistic: it proposes looking at the results after the fact and saying "if I had done such and such then the outcome would be different". How would you ever know to that detail how others would vote? You could easily end up accidentally electing C. The reality of the example is that it is close to a 3 way tie and any winner is "reasonable". Most importantly, the result of the "honest" IRV is reasonable. And how would you translate that into approval voting? All voters ranked \_ <cut mostly irrelevant comments -op> How would you translate the example to approval voting? All voters ranked all 3 candidates. Does that mean they approve them all? approve them all? Let's say they each approve their top two choices. Then B wins. But what if the supporters of A, being crafty, decide to withhold their approval of B, to make A win? In this way, "lying" helps them. So regardless of your terminology the same "problem" exists. \_ I am not advocating for range voting, merely citing an egregious flaw in IRV. Since we're asking for citations, kindly cite all future unnecessary changes of subject and strawman arguments you plan to make before continuing this discussion. -dans \_ I'm sorry you're too dense to comprehend. I'll give up now. I mentioned the range voting because the source advocating it as realistic means the source is dense. \_ You're right. I am dense. If I was sparse I would have also asked you to list all ad hominem attacks you would apply before continuing the discussion. -dans \_ The ball was in your court and you gave a worthless response so I responded in kind. \_ No, it doesn't. They approve of both A and B. One of A or B wins. Notably, in most actual ranked choice systems, e.g. San Francisco, you must rank all candidates. Whoops. -dans \_ In the example below, A or B still wins. So it is the same. Perhaps it is merely a bad example. I found this one far more convincing/damning: http://rangevoting.org/CoreSupp.html However, I still don't agree with that article's conclusion. Pairwise comparisons aren't so meaningful. In this example, C and G are sharply split: you have those 5 voters in the middle who rank C on top and G on the bottom, who give their votes to M. votes to M. Condorcet isn't provably the best winner. (Example from the link:) voter1: A>B>C voter2: A>B>C voter3: A>C>B voter4: A>C>B IRV EXAMPLE. voter5: B>A>C voter6: B>A>C voter7: B>C>A voter8: C>B>A voter9: C>B>A One of IRV's flaws is that it is not monotonic and dishonesty can pay. In the example, suppose voter1, instead of honestly stating her top-preference was A, were to dishonestly vote C>A>B, i.e. pretending great LOVE for her truly hugely-hated candidate C, and pretending a LACK of affection for her true favorite A. In that case the first round would eliminate either C or B (suppose a coin flip says B) at which point A would win the second round 5-to-4 over C. (Meanwhile if C still were eliminated by the coin flip then B would still win over A in the final round as before.) In other words: in 3-candidate IRV elections, lying can help. Indeed, lying in bizarre ways can help. \_ It sounds like your grief is with the imple- mentation of IRV (i.e., mandatory ranking of all candidates). If you allow voters to NOT rank all candidates, this problem appears to evaporate. \_ And lying in approval voting can help. So what? But you said "In IRV, if you vote A as first preference and B as your second, you can actually cause C to win." You haven't shown an example of that, which is what I asked for. \_ No, it can only hurt. Casting a vote for someone you don't want in office helps them. Not voting for someone you do want in office hurts them. -dans \_ Most real people have a top choice. If everyone only votes for who they really want then AV reduces to plurality voting. \_ Really? Show me data. You realize this flies in the face of a fairly large body of psychological, sociological, and hci research about choice, and peoples ability to effectively express their choices. -dans \_ Well *I* always have a top choice. The problem with plurality winners that the majority of the votes did not count. A minority is able to elect the winner. With IRV, the rank system ensures that your preferences get factored in to the outcome. No, IRV does not eliminate tactical voting: with a field of strong candidates with divergent voter preferences there would be tough choices to make as to which of your top 2 choices to rank first. But that's perfectly fine: it's inherent to any runoff system. AV does not solve the problem that IRV solves. It still decides the winner based only on plurality. IRV also solves the 3 candidate spoiler problem while AV does not. \_ I've read the wiki and other articles on most of the voting methods. Although interesting most of them ignore the increased complexity of the system over a simple, "mark an X next to my favorite and drop it in the box" method we use now. Some people say that various methods of anti-voter fraud are too high a burden for voters and are discriminatory but that's nothing next to the complexity of several of these alternative voting schemes. What I got from my reading is that each of these other methods has a different idea of the 'best' way to determine a winner but their idea is based on their own notions of fairness. Fairness is not a measurable absolute. \_ Approval voting is not complicated. Instead of mark an X next to my your favorite candidate, you mark an X next to any candidate you would accept in office. The winner is the one with the most votes so its notion of fairness is pretty close to that of plurality voting. -dans \_ If it "pretty close" then why not just do the simpler way we already have now? Seems like added complexity for no reason. \_ It eliminates spoilers and, more importantly, would make it possible for us to grow viable third parties. -dans \_ What you call a spoiler I call a low support third party candidate. For example, I don't think Nader ruined Gore in 2000. If those people really wanted Gore to win, they understood the voting process and should have voted Gore not Nader. I also don't see the need for third parties. What has happened in this country to third parties is the two major parties have absorbed their platform when it became popular enough eliminating the need for the third party without causing the instability of a multi party mush that you see in some other countries in Europe, Israel, etc. In those place you end up in a situation where an extremist party with a normally trivial number of votes gets joins the majority party coalition and ends up with power that far exceeds their vote count in the general population. I don't see that as a positive. \_ So in other words, you believe something, and whenever someone presents evidence to the contrary you redefine the terms to suit your purposes and state that the evidence is irrelevant. Awesome! P.S. Your assessments of the American two party system as well as politics in "Europe, Israel, etc." show an impressive degree of ignorance. -dans \_ Why did you have to make this personal? What is wrong with you? How about you provide some actual facts or even some contrary opinions instead of personal attacks? I think if you call me a "douche" like you normally do, you'd look really extra super duper smart. Good street cred. \_ There's nothing personal about this. I present facts, cite source, you repeat the same arguments, change the subject, and dissemble. Nothing personal about that, unless you think my pointing out that your bad form is 'personal', in which case, get a thicker skin, and maybe join a debate or forensics society. And, yes, you're being a douche. -dans \_ Of course it completely misses the point that "I could live with this bozo" vs "I really want this guy" are two seperate things. While IRV does have some theoretical issues, in any real world situation they don't actually matter worth a damn. Oh and as to how to count votes, well guess what, there's this magical thing called software. \_ Okay, "mark an X next to any candidate you want in office". Don't be a douche. Of course, since you're advocating a voting system that, by your own admission, is so complex that it requires software to effectively implement the count, you have shown yourself to be utterly unqualified to take part in any discussion of voting systems and methodologies. -dans \_ Suppose I have an election with a total bozo (B) and 2 pretty good candidates. (A and C). Out of 100 people 99 like A and C but like C better. But 1 person likes A and B. In an approval vote system that gets you candidate A. But if B isn't in the race that gives you candidate C. Thus having B in the race changes the results UNLESS people vote with the knowledge that B has no chance. I'm not saying it is likely, but then again neither are the contrived IRV problems, and IRV has big wins because ranking matters. \_ By the numbers, more people wanted A. Get over it. -dans \_ No, more people "approved" A. But the vast majority wanted C. There is a difference. \_ Now you're just arguing with semantics. -dans \_ No, because if C wasn't in the race the \_ No, because if B wasn't in the race the result would be different. But because you have decided on a set of criteria that happily ignores that you don't think it is a problem. You've decided "tactical voting is bad" and then defined tactical voting in a nonsense way so that you don't have to admit that in ANY voting system there will be tactical voting. Oh and once again in real world situations IRV is much less likely to be broken and much less likely for a small group of tactical voters to throw an election. Plus it gives you ranked choices which are a win. \_ You're ignoring his point about ranked choices. Don't be a douche. I've yet to see a case where IRV produces results that are "unreasonable". (Where "reasonable" is intuitive, since no one result is provably "best" for all voting scenarios.) Don't be a douche. Show me some cases where IRV produces "bad" results and let's talk about how bad they really are. \_ Preference inversion (i.e not monotonic). Done. -dans \_ How's that STD going dans? \_ Awesome! I've got a sentient talking boil on my ass that likes your philosophy, and wants to know if you have a newsletter it could subscribe to. As a practical matter, would you actually make fun of someone who had an nasty and possibly life-threatening disease? Wow, what an asshole! -dans \_ the most common STDs are not life-threatening. \_ Yeah, 'Sorry about your syphilis man, Haw Haw!' like I said, what an asshole. -dans |
2008/1/14-18 [Computer/SW/Languages/C_Cplusplus] UID:48939 Activity:nil |
1/14 You know, I'm really tired of C++ books calling the '%' operator 'modulus'. It's remainder folks, not modulus. \_ I've never seen it called 'modulus', just modulo. Remainder doesn't really work. Usually an operator is a verb. Modulo returns a specific remainder. You say "the remainder of <a division>" not "the remainder of A and B." \_ Modulo is worse. It has a specified definition that isn't the same as how C/C++ uses it. \_ According to http://en.wikipedia.org/wiki/Modulo it doesn't have just one definition. Which one do you think is the "real" one? \_ wikipedia is not authorative, not by a long shot. \_ hence my question \_ wikipedia points out the word shift of modulo == remainder. \_ just say "mod". everybody happy? |
2007/12/12-19 [Computer/SW/Languages/C_Cplusplus] UID:48789 Activity:nil |
12/12 In emacs, is there a way to delete 10 least visited files in the buffer? \_ Maybe this: Do C-x C-b to get the buffer list, then move the cursor to each of the bottom 10 lines and press 'd', then press 'x'. It looks like the files in the buffer list are sorted by time of last usage. \_ problem is C-x C-b TAB shows alphabetized list... \_ What version of emacs are you using? The one on soda is 21.1.4. There is no C-x C-b TAB, and C-x C-b does display the files in last usage order. \_ I use Emacs 22.0.50.1 (i386-apple-darwin8.7.1) on OS X and it sorts by order visited. I suspect the ordering of the buffer list is tunable in your .emacs -dans \- note: if you use frames, this may not work as you expect. also i think buffer-menu.el was re-written around for some e22. you can look at the Buffer-menu-sort* functions for display order. also see midnight-mode and clean-buffer-list. |
2007/11/28-12/6 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Languages] UID:48708 Activity:nil |
11/28 T gold indicator forms rare double sell signal http://www.minyanville.com/articles/gold-T-mr/index/a/15012 \_ This is the funniest thing on the motd. Thanks. \_ Agreed. This is superb. |
2007/11/27-30 [Computer/SW/Languages/C_Cplusplus, Computer/SW/OS/Solaris] UID:48701 Activity:high |
11/27 I'm using select to do a nonblocking check to see if a single socket has anything to read off it. Problem is, I can have up to 12228 file descriptors, and Linux fd_set only supports up to 4096. Any idea what I can do about this? (Or a better solution?) -jrleek \- 1. who are you 2. i am busy this week and you didnt mention language [i am not fmailar with stuff like java nio] but you might look at this ucb/cs paper ... matt welsh et al "a design framework for highly scalable systems" as well as some of the discussion around libevent. see the links and graph at http://monkey.org/~provos/libevent \_ Ah, the program is all in 'C', but it needs to run on multiple Unix variants. -jrleek \_ Have you profiled it? Can you port to python or another scripting language with reasonable performance (alas, not ruby at this time)? -dans ruby at this time)? At http://Slide.com, a hot startup in downtown San Francisco (we're hiring!), we open AND close millions of socket connections every day. -dans \_ How could I profile it? This isn't a webserver, it's a server that accepts, and acts on, messages based on a protocol I wrote. (Over TCP). In this case, I need to know about the performance of a tiny part of the code. I'm not sure how to get that information. gprof, for example, doesn't seem to allow me to choose just a small section to profile, and lacks the necessary resoluton anyway. -jrleek \_ What you want is a profiling tool that doesn't work via random sampling but that lets you add profiling hooks into your code. I've written some homegrown things like this in the past to profile very tight loops in massive projects, but I'm sure there are plenty of better tools out there if you poke around. \_ Hint: leek >> dans. Why are you listening to his babbling? \_ Well, I have a lot to learn about network programming, so I'll take what I can get. Thanks for the compliment though. -jrleek \_ Alas, I don't have any better suggestion that gprof, though there must be better tools out there. Another alternative would be to compile the source, look at the ASM output and try to hand optimize. Consider that a WAY last resort, and not worth pursuing unless you're already a fan of ASM. Two problems though: there. Another alternative would be to compile the source, look at the ASM output and try to hand optimize. Consider that a WAY last resort, and not worth pursuing unless you're already a fan of ASM. Two problems though: a) it doesn't really scale if you need to target multiple platforms and b) it's actually tough to beat a *good* modern optimizing compiler even if you really know what you're doing. -dans \_ UPDATE: I just asked one of the guru's and he responded, 'books? what are those' see: http://www.kegel.com/c10k.html It's more of a jumping off point, but it will at least give you tools to work with and references potential implementations. -dans \_ Hint: In the last three years have you... a) worked on a project with me? b) read or hacked any code I've written? c) used a service based on my code or systems I administered? Unless you can answer yes to at least two, you have NO FUCKING IDEA WHAT YOU'RE TALKING ABOUT. Why two? Because I built the systems half (as opposed to the network/routing half) of the anycast DNS rig that runs the roots for over fifty ccTLD's including, amusingly enough, .cx. Thus, the answer to c) is almost always yes. -dans \_ Use poll() instead of select, or do multiple selects with several different fd_sets . -ERic \_ Can you increase the max size of fd_set in /proc? I'm guessing not, but couldn't hurt to look. Also, using select on that many file descriptors will probably result in sucky performance. -dans \_ Do you know where I can read up on getting really good performance out of the POSIX tcp codes? \_ I wish I did. Most of what I know is a collection of voodoo and lore. It's not super complicated, basically you want to use non-blocking sockets and poll. Also, avoid threads unless you know what you're doing. Writing correct threaded code is hard, writing high-performance threaded code is even harder. On Linux, processes are basically threads, but with processes you don't have to handle any locking crap. -dans \_ epoll (linux) or kqueue (bsd) \_ Unfortunately, it needs to run on AIX (IBM's Unix) as well. \- arent you that fellow at livermore? if this is going to run on ibm big iron, maybe if you have a "user services" group they will know this. cray and ibm have some people group they will know this. cray and ibm have had some people stationed here as part of nersc. i am familar with assos, fleebsd, and solaris [/dev/poll] but not aix. btw some of the select vs poll people seem to be unaware of many places where the interface is different, but under the hood they are the same thing. --psb fleebsd, and solaris [/dev/poll] but not aix. --psb \- i have never heard of/used this [i no longer work on aix] but check this out: http://tinyurl.com/26z9jf [pollset] often i would think if there was something that was obscure it probably wouldnt be that good, but in this case 1. ibm has a history of sitting on good things that fail due to obscurity 2. i'm not in the loop [no pun intended] any more on ibm stuff --fmr ibm person \_ We do have such a group, but they don't know much about TCP. It's kind of an odd thing to be doing. I wrote this TCP implementation as a proof-of-concept, but we've never gotten to money to do something better, so I just keep trying to improve it incrementally. -jrleek |
2007/9/27-10/2 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Languages/Python] UID:48202 Activity:moderate |
9/27 Ok so to do the equivalent of the following: bool ? a : b In Python, it is: (bool and [a] or [b])[0] Uh, kick ass? \_ 99 times out of 100 if you use the trinary operator you are doing the wrong thing. \_ 99 times out of 100 if you use the ternary operator you are doing the wrong thing. Oh and python should have "a if bool else b". \_ Python 2.5 adds the ternary operator with the syntax above. See: http://www.python.org/dev/peps/pep-0308 The and-or trick was the most recognizable way to do this prior to 2.5. See: http://www.diveintopython.org/power_of_introspection/and_or.html This also explains why you need to do the wonkiness with wrapping a and b into arrays and then extracting element 0. Curious, why does the pp feel that using the ternary operator is a bad idea? -dans \_ http://tinyurl.com/36zdbe (fogcreek.com) -!pp \_ Most of this discussion convinces me that the ternary operator is a good thing. Many of the posters seem to miss the forest for the trees wrt code readability. At this point, I don't 'parse' the ternary operator, I just think of it as a (slightly) higher-level construct and find it easier to read and understand. YMMV -dans \_ bad coders : ternary operator :: Dubya : U.S. presidency \_ bad coders : code :: Dubya : U.S. presidency "However, there is already controversy surrounding the grant. Explains Dean Clancy, "Ok, so we got all this deodorant and shaving equipment now. So-fricking-what? What I want to know is how we are going to get this stuff on the engineers. Whenever I ask an engineer in Soda, "Why do you smell like Rick Starr's underwear, only worse?", they always give me some story about being allergic to deodorant or not having enough time to shower. Like I always say, you can lead a mouse to a window but you can't always make the mouse click on the window." Telling bad coders to avoid the ternary operator is like giving deodorant to EECS students. It doesn't address the core problem. -dans \_ What about L&S CS? Are they allowed to bathe? \_ I'm not aware of there being any department strictures forbidding EECS students to bathe. I don't know if I'm typical of L&S CS students, but I managed to bathe more or less regularly (or date hot women who have a thing for, possibly stinky, geeks). I suppose there was that one semester Paolo took CS 150 and didn't leave the lab for a week, but I definitely think that's an outlier data point. -dans \_ dans is channeling tjb. \_ i miss tjb. can we get him back? \_ Seconded. The man's a national treasure. \_ I think we can all agree that paolo is an outlier data point. \_ Nah, I'm not going to try to freestyle. Though I am pretty white. -dans \_ I think we can all agree that paolo is an outlier data point. |
2007/9/20-22 [Computer/SW/Languages/C_Cplusplus] UID:48130 Activity:kinda low |
9/20 Is there a way in Twiki to have children inherit settings from a parent? I know there is a WebTopicEditTemplate which you can use for an entire Web, but what I want is to be able to have all of the children under a given topic automatically be populated with a template of settings when created. Is there a way to do that? Right now I copy and paste my settings each time and not only does that take time but there's a chance I forget to do it or else make an error. \_ Setting of arbitrary parent *topic*? I don't know of any feature by default. For my purpose, I wrote a plugin that made twiki use a custom EditTemplate depending on the suffix of a topic name. I imagine similar concept can be used to check the the parent variable. Search twiki site first to see if such plugins already exist. \_ Well, I just want the concept of a child topic inheriting a template from its parent topic. \_ But how do you specify *which* settings it inherit? When you first create a topic, twiki loads the default topic template and loads it in the edit box. Settings are interpreted on the fly by running through the topic text file twice. The settings are just part of normal text as far as it's considered. You need a way to specify which setting to inherit by perhaps wrapping it around a TWikiVariable. And given that you can change the parent of a topic by changing its metadata, interpreting it on the fly is probably the best way to handle it given current twiki behavior. \_ It should inherit all of them. Every Set = from the parent gets set in the child at creation time. If the parent changes later then too bad. \_ Keep in mind that TWiki didn't even have a concept of parent/child until few years ago. At least for the current implementation of new topic template reading, it looked to me like you'd have to actually overwrite that function within twiki's edit script itself and can't be extended with just plugins. That is, grabbing the variable defines from parent and putting it in place during creation. What I was suggesting where the settings are read on-the-fly at each access *can* be done via plug-in. Choosing the right wiki is a difficult task, partly because the ideals of each wiki devel teams are different. Wikis were originally meant to be unrestricted, which is an ideal that TWiki developers still try to hold to. That is one of the reason why there are commercial wiki implementations popping up designed from groun-up to have access restrictions. My main reason for choosing TWiki? It's one of the few that supports versioning of attachments, and rest of my group is still very shy of php, which ruled out MediaWiki. (And I believe MediaWiki has even less access control.) |
2007/9/4-7 [Computer/SW/Languages/C_Cplusplus, Health/Disease/AIDS] UID:47891 Activity:nil |
9/4 http://csua.org/u/jfs (townhall.com, why hide your url?) This was all before politicians gave us the idea that the things we could not afford individually we could somehow afford collectively through the magic of government. \_ it was also before it was empirically proven that the unregulated \_ umm. no. health care system in the U.S. is twice as expensive as everyone else's. \_ Everyone else's healthcare is great until you get sick. |
2007/7/20-22 [Computer/SW/Languages/C_Cplusplus] UID:47355 Activity:nil |
7/20 I was handed a templeted code that builds with gcc3.3.3 but not 3.4.4. I'm not all that hot with templetes, so I'm having trouble figuring out what's wrong. The error I get is: TxBoundedFunctor.cpp:29: error: `template<class RetType, class ArgType> class TxFunctorBase' used without template parameters where TxBoundedFunctor extends TXFunctor extents TxFunctorBase. Like so: // Constructor specifying the pointer to a functor and the dimension. template <class RetType, class VecType> TxBoundedFunctor<RetType, VecType>:: TxBoundedFunctor(size_t dim) : TxFunctor<RetType, VecType>(dim), TxBounds<VecType>(dim) { TxFunctorBase::className += ":TxBoundedFunctor"; } Any idea why it won't build with 3.4.4, but will in 3.3.3? \_ First, it's "template" not "templete". Second, can you post the code to a public file so we don't have to parse it from the motd and guess what comes before it? \_ Note: this is called a 'pastebin' Third, you're never able to get away with dropping template arguments, and it's most likely that GCC dropped a nonconforming extension. Checking the release notes for 3.4: http://gcc.gnu.org/gcc-3.4/changes.html#cplusplus G++ is now much closer to full conformance to the ISO/ANSI C++ standard. This means, among other things, that a lot of invalid constructs which used to be accepted in previous versions will now be rejected. It is very likely that existing C++ code will need to be fixed. This document lists some of the most common issues. Here it is: In a template definition, unqualified names will no longer find members of a dependent base (as specified by [temp.dep]/3 in the C++ standard). members of a dependent base (as specified by [temp.dep]/3 in the C++ standard). \_ That appears to be it, thanks. Prefixing with this-> works. |
2007/7/17 [Computer/SW/Languages/JavaScript, Computer/SW/Languages/C_Cplusplus] UID:47313 Activity:nil |
8/23 Update your life scores, you twinks! \_ Not unless life-god gets a clue and quits classifying co-op rooms as dorms. Maggot. -john \_ Dear Maggot Infested Peon: Nowhere was it said that a co-op was a dorm. Rather, the life god sayeth: "CO-OPS count not. They make the dorms look nice." Perchance we shall allow you to return to the hallowed halls of life when you have mastered the difficult art of clue. The life god requests that you not reproduce at this time. \_ Good thing I have the life god's mother hogtied in my closet to prove my points. -john \_ That's gotta be worth at least a G, if not C. \_ What about those 4 to a room co-op rooms? Dorms like mighty nice compared to them \_ There's a lot of graduates in the wrong section of the life file, too. \_ I lost so who the fuck cares. =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= Welcome to John's special half-assed life point section. This section of the life file exists specifically for those who have it all. Sort of. Well, maybe not really. But we won't get into that right now. John .3C+.7G+.7H+.6J+172.3U 174.5 C's a '63 Mercedes in SF with a busted carb G's in Switzerland but hot H's a coop, what do you want, and J's the fixing stuff I do for it, while U's almost there, all I need is a CD drive. That, and I own soda. \_ the tank should should for an extra life point John Update: I'm not getting the tank, because I found out they wouldn't let me shoot anything with it anyway, thus making the whole exercise pointless. What counts is that I had convinced them to give me a tank. I work for a company called Bull, which is neat, because if they fail, they can easily change the logo to "Bull", or if they get bought by Microsoft, they can change it to "Bill". FDSFSDF 7/17 |
2007/7/17 [Computer/SW/Languages/C_Cplusplus] UID:47312 Activity:nil |
7/13 CSUA Life Roster 1 point each for: key: significant other (out of county rule applies) G car (Chevy Novas do count) C housing (dorms DO NOT count) H own computer running reasonable multi-tasking OS U job (selling lemonade on the corner counts, too) J \_ how about selling Yermom? There are no unofficial rules. All rules are official, and have been laid down. Clarifications are available only from the Life God. The out of county rule is as follows: if you are not in the same county as that which would give you a point, you do not get the point. Please note: the out of county rule applies to all points. Please keep yourselves sorted. __ _____ _ _ _ _ _____ ____ ____ \ \ / /_ _| \ | | \ | | ____| _ \/ ___| \ \ /\ / / | || \| | \| | _| | |_) \___ \ \ V V / | || |\ | |\ | |___| _ < ___) | \_/\_/ |___|_| \_|_| \_|_____|_| \_\____/ Winners at graduation --------------------- Just as a note, any game that allows people like these to call themselves "winners"...you get my point. alawrenc G+C+H+U+J 5 whee... brianm G+C+H+U+J 5 Yes! I really did graduate! Philip Brown G+U+J+H+C 5 I win, I win! \_ and you are? \_ If you have to ask you weren't around before 1992. \_ post1992 update: married. But that happened after, so I still win :-) Dan Wallach G+H+J+C+U 5 G/F: Debra Waldorf \_ creator of the famous salad? House: 1665 Scenic Car: Nissan 240SX Job: Berkeley Systems Computer: Sparc 1+ clone -- a total winner when he graduated May 22, 1993 at 9am. (it should be noted he never got the secret life point) Doug Young G+C+H+U+J 5 Wow...ooooooh...aaaaaah G - Getting married Jul 19 C - 1987 Van H - Which one - I /_OWN_/ two and am buying a 3rd! U - Which one? Linux? NT? J - PeopleSoft ROCKS! kchang G+C+H+U+J 5 LIFE IS SOOOOO GOOD! No $, no honey! 9/1/92 \_ kchang should be the CSUA philosopher. \_ No $, but still has a honey! I work hard for all my 5 points. \_ I run Linux, NT, and 95, I'm so cool! 128RAM 8gigHD, Zip, ViewSonic PT800, Millenium II 8MB, and a lot of warez :) \_ That doesn't change the fact that we had to squish your ass. --root Julie Lin G+C+H+U+J 5 G: if you have to ask... C: 97 toyota corolla H: southside apt U: colocated FreeBSD box J: sysadmin \_in my flakiness I made a mistake that technically allows me to have acheived these things _before_ graduation. \_ It's _at_ graduation that counts. \_this was true\ at and before graduation psb G+C+H+U+J+S 6 Psb is too cool! Scott Drellishak G+C+H+U+J 5 Finally got the U... Nevin Cheung C+U+H+G+J 5 Yeeeess!!! 5/96 Mike Scheel G+C+H+U+J 5 And, I've graduated. Peter Norby H+J+U+G+C 6 Okay, I've won, Now what? \_ How is that 6? Anyways, it's not YOUR car... (-8 randal G+H+J+U+C 5 Beautiful girlfriend whose still at Cal unfortunatly. Moving to Seattle to work at http://Amazon.com. Got a car, choose not to drive it. raytrace H+J+U+C+G 5 Life is here or someting. Am I supposed to be happy now. ryan C+J+G+U+H 5 Life is good! \_ Name them. When did you get the car, and can we have a ride? \_ Is she a good ride? G = (4/??/96) Esa Yu v C = (5/8/96) '96 Mustang Gt U = (6/9/94) 486/DX 33 w/ Linux J = (1/4/96) LBL Sysadmin H = (6/1/95) 2446 Dana St Apt 1 \_ Secret Point \_ Yes, I have it! *Those Who Have Succeeded* hoser components score comment ------------------------------------------------------------------------- Overachievers ------------- alanc C+G+H+U+J 5 Wow...amazing how these things sneak up on you when you're not looking. Now comes the tricky part... graduation. bwli G+C+H+U+J 5 Hard to believe... ivy H+J+C+U+C 5 garyg G+C+H+U+J 5 Pure luck kim G+C+H+U+J 5 Good thing there's no points for sleep marco C+H+U+J+G+S 6 Now all I need is time to *ENJOY* this life... \_ S? Secret? -- Yah. \_ Are you ever going to graduate? russwong G+C+H+U+J 5 sameer G+C+H+U+J 5 seano H+C+J+G 5 I get extra secret life point \_ why does seano get extra life point? \_ it's a secret setol G+C+H+U+J 5 shipley C+H+U+J+G 5 Do extra girlfriend want-a-be's count as extra? Can you set someone up with points and take a percentage? \_ Peter has not noticed that there is a math deficiency going on... \_ Aren't you graduated yet? \_ Or just dropped out? uctt G+C+H+U+J 5 spanking new G, C, and H! WhothefuckamI (if you still care) -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- aubie C+H+U+J 4 I have a harem, but no .sig other. Car's on perminant loan. apt w/3 person shower&gets use. PII 233 w/fBSD, BeOS, Rhapsody. sysadmin fer "Steve's other company." WHAT'S THE FUCKING SECRET LIFE POINT YOU TWINKISH LIFEGOD? Normative Person ---------------- aaron J+C+H 3 G out of county. i might go postal over it so don't push me. \_ Didn't you graduate? ali C+J+J+J+H 3 Ass kicking machines given to you by asskicking employers count, right? amee J+H+G+U 4 Someone teach me to drive stick shift cars, please? aspolito U+H+C+J 4 atom H+C+J+G 4 Duty now for the future! New Girl and New Job! bbehlen G+C+J+H 4 So what if you live with your girlfriend in an apartment, and you both have cars? Does my Indigo at work count? \_No. coganman J+H+C+U 4 The embarrassing thing is that my second year here I was at 4 (GHCJ), then sank down to 2 (HC) for a while. Now I'm at least gainfully employed. My car does, too, count, even if it's powered by two gerbils on treadmills. \_ Update: a couple of the cylinders are misfiring. Call it 1 1/2 gerbils. \_ Update 2: Not only do I possess the Secret Life Point, but I am perhaps the only recipient of the Secret Life Penalty as well \_ What's the penalty? Using the car cylinders for something they weren't intended for? \_ Using that Indian over there, Tonto, to perform an unnatural act. davem C+H+U+J 4 Life is at best, an illusion. davidf C+H+U+J 4 Okay, so I've got a car, an apartment, a Sun, and a handful of jobs. Who cares. Anyone have a spare girlfriend? ;) dpetrou H+U+C+J 4 Languish in your misery. Wallow in your excrement. fab G+H+C+J 4 Would have U, but it's in Orinda (ie., Contra Costa county)... fernando U+H+G+J 4 U: FreeBSD J: Does CEA count? G: She was in LA last summer, but so was I! ksanthan J+C+H+U 4 H - Finally out of the dorms! U - Running Linux! C - My trusty Honda! \_ J? \_ What happened to my Honda? I'm sorry babe, I had to crash that Honda. meyers J+U+C+G 4 J - Documentum! U - Linux! C - way cool Saturn G - way cool gf mogul C+H+U+J 4 Once again I'm in good shape... \_ J is in Marin County, no? \_ Uh, so? -mogul \_ Are the H and U? moray C+H+J+U 4 I don't think I deserve this. Technicalities help me. niloc G+H+V+J 4 You don't know me. :) It's all technicalities anyway. \_ but somebody lovers you somewhere, maybe. nweaver H+U+C+J 4 H: The NickCave (tm) U: P5 133 with Linux C: 95 Saturn Coupe J: Herder of Cats philbo G+C+H+J 4 philfree C+H+J+G 4 scotsman C+H+U+J 4 as for G, I have a roommate.. does that count? sls H+J+U+C 4 sony H+J+C+U+G 5 H: cute studio in Oakland J: It has *NOTHING* to do with my major (thank god). C: I think psb calls it "the de la sol chick car" U: FreeBSD v.2.2.5 G: He's really cool. susann C+G+H+U 4 G: Leo, I lubs you. P.S. Hehehehe. tomcheng C+H+J+U 4 *sigh* We Who Are About To Cry, Salute You ----------------------------------- agee C+H+U 3 Traded a way out of county J for a barely out of county G. ahsrah C+H+J 3 C: can't afford the insurance, but still can afford the tires and CDs 4 it.... H: Jesus Freaks as neighbors J: Screen Savers are important dammit!!! blojo U+H+J 3 Burned to a crisp and bloody as hell. \_ Yum, can I have some? daveh u+h+c 3 dickylee G+J+H 3 i _still_ have more points than ali...no matter how many accounts i lose, no matter how many times i'm banned, _still_ have more points than ali! muahahahahaaa. \_ no you don't, twink \_ ali, yer one fugly cocksucker. jenni G+J+H 3 Now if only the ghia was in in this county..... jwang C+H+J 3 <plus motorcycle cool points> lindsay C+H+J+J 3 man-eater max H+C+J+J 3 Okay. So I lost the G to marriage. But my computer runs Unix and I've ditched the third job. And, yes, the car is mine, too. mikeh H+J+U 3 Woo woo. Housing, at last. Job, if only to pay for U. rsr G+H+J+U 4 runes J+H+C 3 sowings H+J+G 3 Ohnog. Lincoln Myers U+J+C 3 Linux. Working at Network Appliance. But I'm graduated so I lose the game. \_ then move your entry over to the graduates area. lolly H+G+J 3 Too sexy for life ----------------- cje H+J 2 It's not fair, my girlfriend broke up with me... gregory H+J 2 This test is biased by our society and it's damn dependence on cars, not being alone, a stationary existence, an upward moving and speeding career, and using those around you to further your own goals: It makes me sick. kane H+J 2 HA, i had a girlfriend but she got rid of me. I was too much trouble. I think about computers? what ever happened to horses? \_thou damned inconsistency! lisha H+C 2 F*CK! back i go to too sexy. allenp H+U 2 Running Linux aymless H+J 2 VIXENS!!!! \_ *pant* *pant* *pant* drex H+C 2 H: Alpha Epsilon Pi - Single |_ Frats count? \_ frats don't count! \_ Especially loser ones C: '85 Honda Prelude (red) J: Don't want one (I was a reader, but it wasted time I wanted) U: Need to buy 16megs (4 now) G: $#!+ happens, my last girl- friend went psycho, now I fear women. kenji U+J 2 Suckage. \_ shouldn't that be +J+J+J+J? \_ there are even rumors of a +G \_ Doesn't suckage imply G? (Even if only temporarily hired G?) \_ privacy? \_ privacy is not allowed in the life file raja H+J 2 Does having a girlfriend 10K miles, three continents away give me extra bonus points? NO. -- life god Does having three computers in one (Mac and IBM emul) count? \- Three lame computers still don't add up to one real one. stevie J+H 2 \_ Hey, you guys just broke up. You're right. so noted. And, I was lying about the computer. I'd like to mention that I'm completely anti-car, but I'm sure that does me no good. \_ nope, none. donsw H+J 2 The computer at home can be multitasking if I ever use it. But it doesn't run UNIX so I let it rot. Hope it counts. \_ keep hoping... dci G+H 2 badams C+H 2 pure cane sugar . . . jctwu H+J 2 Matt Saunders H+J 2 if I'm hard up for life points, I'll just steal one of your cars. hahnak J+H+U 3 no G, no C. life has been kind to me. mlee C+H 2 I have actually gotten out of that rathole so many of you would despise, but I called "home". G: I should try to get one just.for.the.point. nolram J+H 2 *sigh* Life facing suspension ---------------------- brg 0x1b 4+i Live orthogonally. Zort. Set Phasers on "Spank" ---------------------- anitac G+H+J 3 Three! I have three points now. Can I get out of this category oh Benevolent Life God? benco U 1 I'd give up the U for a G Andy Collins U 1 jon H+U+J 2 No G (yet) well, certainly not in county at least i have a place to sleep 'sides csua. Car is gone. Completely. jkuroda@cs, whee \_ finally. \_ that doesn't stop you though \_ OpenBSD. danh J 1 C - 1980 black GMC van H - my house is rad you are jealous yes G - punk rock girl decided to date girls, oh well \_ I thought danh gets all the babes? \_ girls are icky \_ coming from someone whose lived with ahm, we can understand why you have a distorted view of gurlz Vegetarians (Flounder in our fleshless glory) --------------------------------------------- hh J+C 2 House is in Egypt, so it counts not. \_ Graduates belong at the bottom, Eric. russman G-H-J-J-C 1 G- out of county H- in berkeley J- in SF and LA (out of county) C- in LA U- OS2 should count schoen J+U 2 Linux, of course. If consulting counts: J+J+J. Transcendent of Life -------------------- kosh *+*+*+*+U NaN You are not ready for life. cthulhu D+E+A+T+H 666 *BURP* Dolly S+H+E+E+P aleph-0 Come on, baby, light my fire. zuul Z+U+U+L ZUUL There is no life, only... well, me \_ I thought it went "There is no life, only Nick Weaver." \_ How about "Here is no life but only rock / Rock and no life and the sandy road..." \_ No, it goes "There is no life, only DYNIX/ptx v4.0.1." Yer all hoes. Total L00zerz ------------- Jim Casaburi (casaburi) 0 General meeting, Sep 14 1998 Michael Heldebrant 0 Hows my driving, call: 1-900-9-bite-me, anyways OS/2 gives me my only point \_READ THE DAMN RULES... OS/2 Doesn't count... \_ But it *should* count. I'm protesting. \_ protest noted and quashed. \_ rebel! bhchan 0 "No signs of life here" Do I get a prize for being The most lifeless and not afraid to admit it? Do I? \_ No \_ Isn't it about time for an update Billy? Last I checked you had C, G, J and even H (sorta) thepro 0 I am beyond your petty, lying morality, and so I am beyond having a life. \_ And beyond hope... -imp \_ Who said that morality had anything to do with it?! By the way, I've decided that my REAL county is Ulster, in Ireland. As I've never been there and know no one there, I'll never have to revise my life file, as any girlfriends, boyfriends, jobs, cars, housing, or computers I may get will be out of county. \_ Ulster's a province, not a county, ted. -seano \_ seano stores Ulysses in his butt for handy reference Sam Trenholme 0 \_ Golly, nice quote.-dickylee \_ you're an idiot, dick. -ali \_ Yer stoopit. -dickylee utsai 0 I suck. \_ Yer right, Jeff! Ya do suck. -dickylee LOSER EXTRAORDINAIRE -------------------- AHM 1 I GET THE SECRET LIFE POINT CAUSE I DID SOMETHING TERRIBLY ICKY. \_ AHMS ARE ICKY \_ You obviously have no idea what the secret life point IS, fool. Dead ---- Donald Kubasak - ... NIVRA Judgement of life lies not within this realm. Thus, judge me as the dead. I careth not. To all others, Peace and Happiness in thy Confounded Existence. \_ OK EVERYONE WAVE TO THE FREAKS IN THE PINK FLOYD SECTION - Dr. John Lost by graduation ------------------ Sean Welch G+H+J+U 4 Happiness is a Sun 4 at home. Adam Glass G+H+U+J 4 skip the car, I'm happy enough ^That's pretty scary. ERic Mehlhaff H+J+U+C 4 Amiga UNIX, dude "Moved on to Unlife" Car older than the microprocessor \_(Wow! An xtrek player who didn't flunk out! ) \_ It happens! Can you say the same for MUD players? \_ Wait... Don't you work in San Francisco county????? \_ I do now. The above was at time of graduation... \_Post graduation update: (should I even bother? ) H+U+C+U+U+U+C+C+N 3 (Job in SF.-- out of county rule needs refining!) cgd C+H+U+G 4 There is no comment, only Zuul! dim G+J+H+U+C 5 Too bad I graduated with 4. Jennifer L. Hom G+H+C+J 4 \_ Pretty good write-up. Almost as good as thepro's. Byron C. Go G+H+C+J 4 Lost by graduation, 5/92 -- working on getting into grad school, though, so I may return 04/96 Update: Lost the J for a year and a half while I was at Netcom in San Jose, but gained a U. Now that I'm back in Berkeley I have the J back and retain the U. Ergo, G+H+C+U+J = 5. Doug "Lips" Simpkinson G+C+H+J 4 Lost by graduation, 12/92 Ian Barkley G+C+H+J 4 Lot'o life points - still no life - do CO-OP apartments count as housing? \_ Post grad update: How many points do kids count for? Payam Mirrashidi C+H+J+U 4 Mel Nicholson C+H+G+J 4 lost by graduation twice 96 Update note: Most controvesial G point on record (married -- was counted as I graduated) Also out-of-county did not apply to Jobs back then, as the Life God was not so clueless as to not realize that real jobs are mostly out of county. Van A. Boughner C+H+J+U 4 Lost by graduation, 12/91 -- 95 update: still no G, so life still sucks in some ways (or rather, it never sucks at all.) John D. Owens H+C+G+J 4 20 May 1995, moved on to even more school. RIP. Tobias Rossmann H+C+G+J 4 Lost by Graduation 5/95. Moved to the Farm for another life, i.e. a red reincarnation. Tara Bloyd G-J-C-H 4 Been there, done that. 1/23/97 update: all 5. (been that way for a while, but I was too lazy to update...) \_ Haven't you lost the G point by the marriage rule yet? cdaveb G+C+J+H 4 Can't get the computer point till PowerMac Linux comes out or I bum MachTen off someone. \_ So now what's your excuse? \_I have a PCI Mac- gotta wait a little longer yet- besides- I graduated Eric van Bezooijen H+U+J 3 Lost by graduation 5/93. I think I deserved some kind of comment. How about the fact that I was supposed to beat Dan Wallach at graduation? \_ We tried really hard to get you a gf before graduation -- had you gotten that, you could have beaten Dan, since V graduates before W \_ Actually my name goes under "B" Life update, 8/97: G: Nope, married C: 1989 Honda Civic \_ The 75 odd gerbils have now run 180,000 miles \_ Make that 200,000. They are really working up a sweat. H: My own house! U: K6-200 running FreeBSD J: Active Software, Inc. (ooc) Shannon D. Appel H+U+J 3 Which car is this? 1980 Mustang In this county? Santa Clara Then it counts not. See the out of county rule. Peter Li'ir Key G+H+J+C 3 does a car jointly owned yourself and your s.o. count? or does it have to be solely owned? \_ it counts. \_ dudes with apostrophes in the middle of their name rule Connie Hammond H+G+J 3 G?????? What is the ruling on this? \_ It counts until the wedding David G. Paschich H+U+C 3 Anyone wanna hire me for the weekend? \_ GET BACK TO WORK - pvg \_ What's yer hourly rate? \_ This won't get you the G point. \_BUT, it will get the G-spot humming. Case Larsen C+H+J+U 4 "Anyone wanna hire me for the weekend?" \_ No. \_ see Paschich, D. Donald Tsang H+C+J 3 Real J, but C is British (i.e., not always running). sheikh G+H+J 3 "I need my car back..." Erik Nielsen J+G 2 Lost by grad., 5/92, but now have all 5. Amazing what graduating can do for you... Maybe some of you should try it. lucasp NULL 0 Ohwell. I had H for a while, but now I move on to grad school and dorms again... Never had G, never had U, never had C, summer J's... Oliver Juang C+J+H 3 lost by graduation: 5/92 C+J+H+U 95 update: hope it's not another 3 for the G point. Gene Kan H+U+J 3 yuen C+H+U+J 4 Lost by graduation: 5/93 U: GEOS 2.0, a preemptive multi-tasking multi-thread graphical true OO OS with virtual memory, but which does NOT offer memory protection (cuz it runs on 8086) Maroo Lieuw H+C+U+J 4 Aint life grand. Got a morticycle, a scooter, and a car. (only 1 point? :() ) I finally made it out. 12/95 Got me a Windows NT. dennisc H+J 2 yup yup yup. SECRET SAUCE. Matthew Seidl H+J+U+G 4 Rent controled appartment 3 blocks from campus TCS sysadmin job Sparc I at home (19" color is KEWL) \_ matt - you still have G? \_ Well, he certainly doesn't have the TCS job... \_ By graduation, you twinks. \_ he should be moved. \_ moved. 6/98 update: H - living in GF's House G - Soraya Ghiasi U - PII300 with FreeBSD J - RA C - Prism LSI Slept with The Life God by Graduation ------------------------------------- tmonroe C+H+U+F 2.1416 And it was gooood, too. But you never return my phone calls... Shot the Life God During Graduation ----------------------------------- geordan C+U+J -(2+i) Lives are overrated. I'm returning mine. And fuck you all, anyway. I will find you in the night when you least expect. Vegetarians by graduation "we just don't dig on swine" ----------------------------------------------------- lila H+J 2 I still think men bring only misery and an evil streak, I have a job at the moment, but only till the end of this week. Hopefully I will soon have a real job. After I acquire said job, I will then break down and buy a computer. I am also buying a car, for better or for worse. 970827 \_ lila is a fat ass ugly bitch Jim Ausman C+J 2 Sigh. I had four points three months before graduation. \_ It was the ugly hair cut, Jim. -John Christine Lee F+U+C+K ? trent is the life god; bite me. \_ you've got the J & H, just get your G to buy you C & U (since he can afford it much more than any Taos drone) and you'll be set \_ i already got my C & U off my Taos Drone salary. Now, I have no M (money), so leave my broke-ass alone...btw, now that i'm now a registered student at Cal AGAIN, do i get a 2nd run at Life? --chris \_ You have the M (monkey) -John \_ Your "broke ass" will be worth millions the day you tie the knot, so stop whining. Lars Smith H+J+secret 2+1 Secret life point: if you have to ask, you don't know. G was out of county, computer was mac-a-saurus. My all time high was three (G+H+J) and my largest fluxuation was from 3 to 0 to 1 in 2 months. Greatly misunderstood the purpose --------------------------------- Victor Chang 0 I lose. \_ You're right. Too Lame To Have Entries ------------------------ George W. Herbert Craig Latta Doug Orleans Official Responses from the Life God From comment response ------------------------------------------------------------------------- Dan Wallach do computers at work count? No. If it's not at home, it doesn't count. \_ can work be an unofficial home? \_ If you live there, yes. i have my mail go there, for instance. Eric Mehlhaff how about work-owned computer at home? \_ these should count. Peter Shipley Do extra girlfriend want-a-be's No, and no. count as extra? Can you set someone up with points and take a percentage? Byron C. Go does Microsoft Windows count? Serious questions only. \_ NT takes as much HD space as any version of UNIX and it's as processor-intensive, does it count? \_ It's ain't UNIX, right? \_ Yet another wonderful product from MicroSloth gets DISSED! Scott Drellishak clearly, this scale is faulty. Obviously. Case Larsen Yes, very. Again, obviously. Oliver Juang (does grading count?) If you get paid, yes. work count? above. Eric Hollander Computer is 286, but runs OS/2 counts not. See OS/2. the rules, under "reasonable." \_ Hasn't the OS/2 ruling changed with the new version? \_ Get Real. (Get Round Table) Eric Hollander House is in Egypt. House in Egypt counts not. See the out of county rule. Donald Wihardja Hope it counts. If it's not running a real OS, it doesn't count. Connie Hammond G?????? What is the ruling G is merely a code, on this? not a judgement. Dormie Scum Whaddya mean dorms aren't That's not saying housing? It's better than much. living in the WEB like Roy. Actually, I don't even live in the dorms anymore -- roy \_ I kicked you once when you were sleeping under the WEB tables cause I got all excited about IRC when I was a freshman. It was a formative moment. -John But you live in the WEB, and therefore have computer at home. - Dormie Scum Some dorms are ok. Only No dorm is ok. Unit 2 sux. All dorms suck, some just suck more. Unit 2 has its good points. They're just few and far-between. Scott Drellishak What about slack? Slackfulness has very little, if anything, to do with life. Peter Norby I've achieved negative Possibly, but lifeness lifeness. and life points are much different. Does your gf know this? George Herbert Can I be readmitted to the No - being a space game now that I'm a student cadet doesn't count. again? Besides, life ends upon graduation. Kumaran Santhanam OS/2 2.0 is a preemptive multi- tasking fully reentrant OS. But is it multiuser? It's gotta count. Not. With TCP/IP it is multiuser. ^^^^^^^^^ It's multiuser, complete with passwords, and file protection. I, in fact, run SLIP and have people log in all the time. \_ it doesn't count. ---------------- Dear Life God: how do we go about adding more life point qualifiers? You don't. The rules are final, and clarifications are available only from the Life God. Can we have the point of the week qualifiers (eg: if you do/don't own a copy of wiz war, or disqualify Macs on odd numbered days)? No. Life is not a weekly process, but rather lasts forever, or at least until you graduate. Co-dependent personality (eg: physio or mind fucking) girlfriends should *not* count A girlfriend is a girlfriend. Subjective judgements do not come into play. \_ but some of us can't STAND that term... and we still get the point, right? If you are married you should be disqualified (since you obviously can not be happy in any marriage situation). Although a woman on the side should qualify. ^ \ The author of this obviously doesn't know Mel. His spelling is likewise pathetic. ^ \_ Some errors korekted | \_ use philspell \ Is Mel married, or what? Yes. So is his wife.-^ A wife/husband is not a girlfriend/boyfriend, thus doesn't count for a point. If you have a girlfriend/boyfriend in addition to a wife/husband, you get the point. \_ so is girlfriend soley defined by having sex? does oral sex count? does manual sex count? does S&M count? can you count the number of whip lashes? can whiplashes count for you? \_ see thepro's comments (in his entry above) for a relevant discussion of morality. A girlfriend/boyfriend is defined by both parties agreeing that those terms apply to them in their relationship. Sex is not a requirement in the least. Okay, so define this "SO lock" thing that we've been babbling about. Needs much clarification. >Life God >Do you anyone verify someones score! or can we all cheat The Life Points are automagically verified. Do not dare to offend the Life God. \_ I hereby dare to offend the Life God. "Play that funky music, white boy!" -- tmonroe \_ I ever monkey and happy red! -John >So is the Life God an elected position? Or is it passed on from previous >Life winners to their hand-picked successors? The Life God is immortal, therefore, succession is not an issue. Do not concern yourself with such issues. >O Mr. Life God: >We need a better definition of girlfriend. >\_Do the for-hire ones count? If you have to hire a girlfriend, you don't deserve any points, but since the rules are absolute, it doesn't affect your score other than that the girlfriend for hires counts not. >Mr. Life God: >What bribes are required to gain more life? Suicide will get you a point, in this case. (But only if it is verified as successful.) \_ If this is the super-secret sixth life point, then the Life God is pathetic. It's not. \_ The Life God is still pathetic. >Mr. Life God: >Do girls who want to be your girlfriend count? Only if they actually are your girlfriend. Similiarly, someone who is your girlfriend and doesn't want to be also counts for a point, although the stability of this particular point is questionable. >Oh wise and wonderous Life GOD: >Is it possible to have less than 0 life points? As unfair as it may seem, no. >Does a computer which is tunred off and being used as a doorstop count? >[it's a sparcstation] Yes it counts, though why you would be using it as a doorstop is not clear, unless you have more powerful hardware at your disposal, in which case you couldn't need the sparcstation for a point anyway. >Does it count if you aren't in the dorms but are with your parents? Not even close. >I want a definitive ruling on my motorcycle. It outperforms many people's >cars, it probably costed more than the cars some people are using for their >life points, and it probably has more cc/kg than any car on the road. It >should, therefore, count. Well, where did the definitive ruling go? -hh \_ the motorcycle counts. New questions for Life God -------------------------- >If you have your own workstation at work, and a dedicated ISDN line to >it, and your home computer runs X, such that you can't tell the difference >between it and a real computer, does that count as U? [guessing not] It's the computer at home that matters, not the interface to it. >Why does Solaris count (i.e., define "reasonable")? Because the life god has ruled so. >Hey does living in the student co-ops count as housing? I see a number of >people here claiming that as housing. "Where are you living next semester?" >"Anywhere but the USCA!" CO-OPS count not. They make the dorms look nice in comparision. >What about frats? >What about the losers who drop out but never graduate? When have they 'lost'? >There's a number of them in the non-grad section! -ERic >I think out of county rule needs to be expanded to include all areas in >non-toll phone range of Berkeley. County lines are pretty arbitrarily drawn >around here... >Does it count as graduation when all you get is a piece of paper and >keep on going as a grad student? >Can I have an extra life point for having a network at home? My living >room is a machine room. -raytrace >Hey, Life God, do I look like a bitch? -- tmonroe Motd comments on the life god ----------------------------- |
2007/5/10-14 [Computer/SW/Languages/C_Cplusplus] UID:46584 Activity:nil |
5/10 My company is looking for good C/C++ developers, a sysadmin comfortable with both Windows / Linux (there is a significant vacancy for a senior or mid-ranking person here), and business operations person (day-to- day superversion). See /csua/pub/jobs/snt for more info. -jctwu |
2007/5/4-6 [Computer/SW/Languages/C_Cplusplus] UID:46526 Activity:high |
5/4 28 A B C D DD E F FF G GG H HH J JJ K 30 A B C D DD E F FF G GG H HH J JJ K 32 A B C D DD E F FF G GG H HH J JJ K 34 A B C D DD E F FF G GG H HH J JJ K 36 A B C D DD E F FF G GG H HH J JJ K \_ ? \_ 32 DD. (But I can only dream.) \_ 32 DD. (But I can only dream.) My wife is 34B. My ex-gf is 38D. \_ DD on a 32? Only in plastic. \_ Well, 32D or even 34D is good enough too. -- PP \_ http://www.32dd.net Are those women in the pictures really 32DD? Those busts look so small. \_ My gf is 32C and I like that. 34C and 36C are fine, too, but I don't really care enough to make that some kind of determining factor in a mate. I guess I would say that A cups do not excite me, but anything else is fine. In fact, larger than D is probably not too good either. \_ You just haven't met the right A.... \_ Like I said, it's not a factor I use in choosing a mate. A cups are fine if they are attached to the right girl, but given a choice B is better. \_ pictureP \_ 34C is perfect. |
2007/4/30-5/4 [Computer/SW/Languages/C_Cplusplus, Computer/SW/WWW/Server] UID:46485 Activity:nil |
4/30 Technical question: I have a threaded webserver, one thread waits around and calls accept, then pulls threads out of a thread pool to handle the requests. I want to be able to shut down the webserver cleanly, so I have the main thread wait for a signal to shutdown. It then joins on the accept thread while the accept thread cleans up the threadpool. The only problem is, how do I get the accept thread to exit? I can't get it to stop waiting on accept. Even closing the socket out from under it doesn't always get it to wake up from the accept call. Is there a standard way to handle this? Addendum: Oops, Using C on *nix. \_ Umm, what language are you using? \_ obviously english. :D \_ Use select to see if there is something available on the socket before you accept. Create the accept socket with O_NONBLOCK. It's all in the man page for accept. \_ You generally need to use select(2)/poll(2) on the fd to make sure there is something to read before calling accept(2), or you will run into this problem. Take a look at Stevens, Unix Network Programming Vol. 1 2d Ed., Ch 6 and Ch 27 for fairly detailed examples of how to do this. \_ Use shutdown(fd, SHUT_RDWR) instead of close. It will wake up the accept. |
2007/4/13-16 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Languages/Perl] UID:46288 Activity:kinda low |
4/12 Just finished a programming quiz. Do you think critizing the test was OK? They wanted someone to write code for something that could be done via shell aliases. This was at Riverbed. \_ I assume Riverbed is a company and this was an interview? If so, I think this kind of criticism is a great thing to do. It shows you really know your stuff if you can do both. If they count that against you they are idiots and you don't want to work there anyway. \_ this was actually after the phone screen. Probably not a good sign. Or maybe the manager's worries too much. \_ IMO, the right way to handle something like this is to say, "Oh, this would be really easy to do with shell aliases, and I can show you how I'd do it that way after I write the code to do it..." -dans \_ It makes you think twice about their ability to create well architected code if they cant come up with a good quiz; especially considering what is already out on the net. I have seen too many cases these days crafty perlers who write terrible code. Knowing what $_ means does not you are good engineer or coder. \_ Jesus christ you are an idiot. A programming quiz is not real work. It is a way of saying "prove to me you can do basic tasks in this language." Making it a simple problem means it is something you can actually have someone write in half an hour or so. Most simple tasks are probably easier to do with a shell script than with a real program. So what. That's totally orthogonal to the tester's goal. Oh and I'd almost take dans's advice. Start with answering the problem the way they asked and then mention, as an aside, not a critisism, something like "you know, if this was something I had to solve at work I'd probably just do x instead." You don't come across as too good for the test (which looks very bad, lots of otherwise good engineers are a disaster because they don't work well with others), you show you know your mad shell skillz, and you are letting someone know that you know to use the right tools for the right job. I've seen people rewrite stuff like find | xargs grep because they didn't know diddly about unix. That kind of stuff is never pretty. \- sort of the flip side of this, for a sysadmin interview, i've asked questions like "how would you generate a 10 random numbers between 1-100 from the shell", "how would you generate the numbers 1-100 from the shell" etc and people who would do it in C are slightly missing the point. people who would do it in C are sort of missing the point. i mean it is fine to say "i dont know how i would do it from the shell, but here is the 5line C program, that took 2min to write", but to say "that's dumb to do from the shell" will not serve you well. yeah, there are a lot of people unfamilar with xargs, mapcar, apply, lambda ... while riverbed may be in an inflationary phase, i suspect they are still small enough that they are being careful about who they hire. the OP had an interesting quandry whether to not to de-anonymize himself on the motd ... if he's an active member of the sloda community he faced either a "oh i dont know about his technical chops, but he seems pleasant enough" to "i havent seen his code, but he seems like a dumbass" ... given that various people here have various riverbed connections. various riverbod connections. |
2007/4/5-7 [Computer/SW/Languages/C_Cplusplus] UID:46212 Activity:nil |
4/5 Pyramids might have been built using an internal spiral ramp: http://urltea.com/3uy (independent.co.uk) http://urltea.com/3uz (khufu.3ds.com - pictures ~ p 28) \_ Or by aliens who to this day still visit area 51. \_ The Asgard didn't build the pryamids; the Goa'uld did. -stmg |
2007/3/30-4/2 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Languages/Java] UID:46149 Activity:nil |
3/29 http://www.codinghorror.com/blog/archives/000781.html Coding Horror, Programming and human factors by Jeff Atwood. \_ An interesting link from that page, a test to seperate out people who can never learn to program. With serious scientific paper. http://www.codinghorror.com/blog/archives/000635.html \_ I love this: "To write a computer program you have to ... accept that whatever you might want the program to mean, the machine will blindly follow its meaningless rules and come to some meaningless conclusion." |
2007/3/23-27 [Computer/SW/Languages/C_Cplusplus] UID:46066 Activity:nil |
3/23 In C#, are there pre-defined strings for class names and method names, like __FUNCTION__ in C? Thanks. |
2007/3/22-24 [Computer/SW/Languages/C_Cplusplus] UID:46061 Activity:low Cat_by:auto |
3/22 How do I use strftime (or something else) to print the date in locale format, except using YYYY instead of YY as year? %x gives "11/17/05", I want "11/17/2005". Thanks! \_ did you try %Ex or %EX? \_ did you? \_ no, but I was too lazy to write a test program. I figured op was in a better position to try it and see. \_ It doesn't work on Windows, and no difference on Linux. -op \_ Unless you redefine your locale, you don't. |
2007/3/19-22 [Science/Electric, Computer/SW/Languages/C_Cplusplus] UID:46013 Activity:nil |
3/19 "Linked List Patented in 2006" http://yro.slashdot.org/yro/07/03/19/112247.shtml Was this a joke? \_ not a joke apparently: http://tinyurl.com/3bnwwv |
2007/3/16 [Computer/SW/Languages/C_Cplusplus] UID:45991 Activity:nil |
3/16 I'm trying to watch the Valerie Plame hearing on C-SPAN but all I get is "looking for satellite signal". C-SPAN2 is showing a Competitive Enterprise Institute guy debunking global warming and that shows up fine. Can anyone else get the Plame hearing? wtf. \_ http://cspan.org archives everything, and also streams. \_ i couldn't get foxnews either, so I guess it's just my fux0red sat tv |
2007/3/9-11 [Computer/SW/Languages/C_Cplusplus] UID:45917 Activity:nil 54%like:45865 |
3/9 When I start trn in a shell, I always get this: "*** glibc detected *** malloc(): memory corruption: 0x08091600 *** Abort" But when I run trn inside the shell buffer in emacs, the problem doesn't happen. Any idea? Thanks. |
2007/3/7-9 [Computer/SW/Languages/C_Cplusplus] UID:45893 Activity:nil |
3/7 Do people still write source code that confines to 80 columns? I've been doing this for my C code for years. But ever since I started writing C# code recently, I find 80 columns rather limiting. Thanks. \_ I usually restrict myself to 80 cols for things like C, C++, Perl, Shell, &c. For Java (which is similar to C#), I can't limit myself to 80 cols b/c the stupid language is so verbose. \_ Not for years. |
2007/3/4-6 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Mail, Computer/HW/Memory] UID:45865 Activity:nil 54%like:45917 |
3/4 trn crashes on me upon startup: "*** glibc detected *** malloc(): memory corruption: 0x08091618 *** Abort" Any idea? Thanks. |
2007/3/2-5 [Computer/SW/Languages/C_Cplusplus, Computer/SW/OS] UID:45860 Activity:nil |
3/2 If you are using Wordpress 2.1.1, upgrade to 2.1.2 b/c 2.1.1 downloads were compromised: http://wordpress.org/development/2007/03/upgrade-212 |
2007/2/18-20 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers] UID:45772 Activity:nil |
2/18 Anyone have Richard Stallman's old .emacs config? \- why, you want to borrow some of his abbrev stuff? that about the main unique thing that was in there. well maybe some gdb stuff. --psb \_ the macros were pretty funny. can you put a copy in /tmp? ok thx. |
2006/10/23 [Computer/SW/Languages/C_Cplusplus, Recreation/Dating] UID:44930 Activity:insanely high |
10/23 I started growing in 3rd/4th grade. By 8th grade I was up to a full B, a little too small for a C. By the beginning of 10th grade I was wearing F (yes, I have a lot of stretch marks on my boobs as a result). By graduation I was a full G. Christmas break of my freshman year of Cal I was H. Summer between my sophomore and junior years I was an I. Now I'm a senior at the church and I'm starting to get double boobies again. So I'm pushing a J, I guess. I guess this means I might be heading into the scary bra size territories of 34JJ. Yay, even less choice in bra. Which brings me to my question....excluding pregnancy and weight gain, when the hell will these things stop growing? I know it's different for everyone probably, but generally when does breast size stabilise? Is this all going to stop soon, or am I looking at continuing to grow a cupsize every 6-9 months until my late 20s, and ending up a 34KKK or something? I'm hoping that, since there are quite a lot of men in their 20s here, someone will be able to shed some light on this, and what I've got in store for me. \_ Yawn. Again? \_ Apparently it is god's will that you have an enormous rack. \_ Make an appointment to buy a B/C. Nip/Tuck. Stop trolling the motd. |
2006/10/1-2 [Computer/SW/Languages/C_Cplusplus] UID:44615 Activity:low |
9/30 Got a function that parses data structures. For debugging and stuff. How do I find/print the "name" of the data structure? parseStuff($array_ref, $hash_ref1, $hashref2); sub parseStuff { use Data::Dumper; foreach my $structure(@_) { print "you're looking at a data structure named [?]\n"; print "and it looks like: " . Dumper($structure) . "\n"; } } And then I want it to tell me "array_ref" and spew its contents, then "hash__ref1", etc., for an arbitrary number of arbitrarily named data structures. \_ Without some nasty AST traversal, you really can't. That's why Data::Dumper has the full call, "Dump", that works like this: print Data::Dumper->Dump([$array_ref, $hash_ref1, $hashref2], [qw(array_ref hash_ref1 hashref2)]); --dbushong \_ If you just want a quick hack, the C preprocessor works pretty well: use Filter::cpp; use Data::Dumper; #define DEBUG(x) print q{x}, ": ", Dumper(x) DEBUG($foo); If you want something more general, yeah, you're pretty much stuck using Filter::Simple and doing your own parsing. --mconst |
2006/9/19-22 [Computer/SW/Languages/C_Cplusplus] UID:44458 Activity:nil |
9/19 Dear C++ experts, how did you do on these questions? http://www.gotw.ca/gotw/069.htm |
2006/9/14-16 [Computer/SW/Languages/Python, Computer/SW/Languages/Perl, Computer/SW/Languages/C_Cplusplus] UID:44378 Activity:kinda low |
9/14 http://www.salon.com/tech/feature/2006/09/14/basic I never knew C++ was a higher-level language than BASIC \_ It's salon. So what? \_ More specifically, it's David Brin, who writes decent hard sci-fi. Too bad he apparently didn't get a decent computer education either. \_ More specifically, it's David Brin, who writes decent hard sci-fi. Too bad he apparently didn't get a decent computer education either. [formatd] \_ Still doesn't bother me. He's a fiction writer, not a scientist. \_ A friend of mine was in a technology-related tv show with David Brin, and reports that he's pretty technically naive / clueless. I do like his books, though. - niloc \_ It doesn't bother you that he's saying "the problem with doing X w.r.t educating our children is that <incorrect fact>"? \_ Not at all. It's a slate article online, not an official publication from anyone who has anything to do with education. I give it the weight it deserves: zero. \_ I once read an article by a tech analyst which said the internet was invented in year 1991. \_ Wow that guy is a total idiot. Everyone knows it was the year 1991 when they invented the 1nt@rw3b!1. \_ Quick, someone tell that man about ruby/python/scheme/whathaveyou \_ He already discarded Perl as "too high level" He doesn't seem to understand that crappy != "low-level" \_ He mentions Python os well, and calls C++ "high-level." |
2006/8/30-9/3 [Computer/SW/Languages/C_Cplusplus] UID:44209 Activity:nil |
8/30 Dear motd career advancement specialist, I need to fill out a self appraisal form for my performance review. and I'm curious how other people approach these things. I can rate myself on a scale from 'Exceptional' to 'Not Performing' in several areas (with some guidelines provided). I'm not sure how honest to be and how modest (I don't want to sell myself short but I don't want to sound like an asshole). I've gotten good feedback from my boss in general and I know he's happy with my overall performance. Any advice is appreciated. \_ Here's how mine went: I put "meeting requirements" (the middle one) for everything but a few where i gave myself excellent, b/c i was, and one were i put one tick below avg b/c i was. My boss took it, and one where i put one tick below avg b/c i was. My boss took it, changed all of my answers to excellent, and submitted it. Apparently they put both on file, but his determines the raise I ended up getting. Hurray for boss, boo for stupid pointless system. \_ I put the best rating that I am prepared to defend. I agree that it is pointless. |
2006/8/30-31 [Computer/SW/Editors/Emacs, Computer/SW/Languages/C_Cplusplus] UID:44204 Activity:nil |
3/30 Does anyone know a good, free, C++ code formatter? We'd like to enforce some semi-arbitrary coding guidelines. (Like, a keyword should not be on the same line as a closing brace.) \_ astyle comes with Cygwin http://astyle.sourceforge.net \_ Cool, this looks like it might help. Thanks. (Does anyone else have suggestions?) -op |
2006/8/25-28 [Computer/SW/Languages/C_Cplusplus] UID:44153 Activity:nil |
8/25 Dear C++ experts. Why would there be two "const" in the following method declaration? const bool ILikeMotd() const; \_ The first const refers to the data type returned. The second const says the function doesn't modify an object's member variables. The first const in your example is bad, I believe; it should be something like const bool& or const bool*. |
2006/8/24-26 [Computer/SW/Languages/C_Cplusplus] UID:44122 Activity:nil |
8/23 Dear scoped pointer experts. Let's say I turned a regular ptr into the following: scoped_ptr<MyClass> myObj; Now there is a method that is expecting type MyClass* in the argument. If I simply pass myObj into that method, it will complain "no matching function for call to 'myMethod(scoped_ptr<MyClass>&), candidates are: ... myMethod(MyClass*)" What's the proper way to pass a scoped pointer? Alternatively I can just use the regular ptr and explicitly delete in the destructor, but I'm wondering if this can be done. Thanks. \_ Uh, can't you do myObj.get() to get the raw pointer? http://www.boost.org/libs/smart_ptr/scoped_ptr.htm |
2006/8/23-29 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Editors/IDE, Computer/SW/Languages/Java] UID:44116 Activity:nil |
8/23 I've been primarily developing Java in Eclipse, but I need to do a project with embedded C++, and I'd like a better IDE than Emacs. MS Visual Studio is way too windows-centric. All I really need is something that can do context-assists and autocompletes and flagging of illegal syntax. Suggestions? \_ Have you tried this: http://www.eclipse.org/cdt --oj \_ That looks pretty good, but another project is having a minor crisis so I'll have to investigate later. Thanks. |
2006/7/28-8/2 [Computer/SW/Languages/C_Cplusplus] UID:43824 Activity:nil |
7/27 In C/C++, how come some parameters have "mconst" before the type and some don't? I don't see how it changes anything. -newbie \_ If it's a pointer or reference, then you can't change the contents. \_ Nicely summarized here: http://www.parashift.com/c++-faq-lite/const-correctness.html \_ The answer is 47. -proud American |
2006/7/25-27 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Languages/Java] UID:43805 Activity:nil |
7/25 Found this on digg today, pretty cool collection of computer and programming cheatsheets: http://mypage.bluewin.ch/yuppi/links/cheatsheets.html -John |
2006/7/20 [Computer/SW/Languages/C_Cplusplus] UID:43746 Activity:nil |
7/20 Does anyone know a good, thread-safe, C++ streambuf? We currently have a non-thread-safe streambuf doing our logging, which is bad. I don't really want to have to write my own streambuf, or change all the code to use a whole new library, I'd like to just plug in a safe streambuf. (Although, a whole new library is better than writing my own.) |
2006/7/13-18 [Computer/SW/Languages/C_Cplusplus] UID:43667 Activity:nil |
7/13 How do you get milliseconds in C? I want to do something like: t1=sec; long_operation_that_needs_to_be_benchmarked(); t2=sec; printf("This operation took %f seconds", (t2-t1)); \_ You could try using clock() and CLOCKS_PER_SEC. \_ gettimeofday() \_ I think some OS'es have a gethrtime() call. \_ http://www.quepublishing.com/articles/article.asp?p=23618&seqNum=8&rl=1 struct timeval tv; // Obtain the time of day, and convert it to a tm struct. gettimeofday (&tv, NULL); // then access tv.tv_sec (in second) and tv.tv_usec (in // ***microsecond***). Yes it's missing millisecond, which // is kind of brain-dead. \_ cuz there's a great efficient type in C to from 0 to 100. |
2006/5/20-22 [Computer/SW/Languages/C_Cplusplus, Computer/SW/WWW/Browsers, Computer/SW/Security] UID:43123 Activity:nil 61%like:43119 |
5/19 I need a simple plug-in 128-bit (or so) C encryption library. Semmetric key is easiest, but public key is ok if that's the only thing I can get. Any ideas? \_ symmetric thing I can get. Any ideas? \_ http://mcrypt.sourceforge.net --dbushong \_ Thanks, I'm checking it out. |
2006/5/10-11 [Computer/SW/Languages/C_Cplusplus] UID:43010 Activity:nil |
5/10 I'm trying to port a small project from builsing with MS Visual Studio to GCC in MinGW on windows. Only 1 line is having a compile error. Using STL, the line if(hashmap->find(key)!=0) Has the following error: no match for `std::_Rb_tree_iterator<std::pair<const std::string, int>, std::pair<const std::string, int>&, std::pair<const std::string,int> >& != int' operator Does anyone have any ideas? I'm just trying to compare to see if a pointer to an iterator is null and in compiles fine in MSVC. \_ For gcc, you have to say: if(hashmap->find(key)!=hashmap->end()) It's more annoying, but it will work with Visual C++ too. --mconst \_ Unfortunately, gcc doesn't have null iterators; you have to say if(hashmap->find(key)!=hashmap->end()). You could also change it to if(hashmap->count(key)). --mconst \_ mconst is my savior. -OP, not author of problematic code. \_ Did you try == NULL? \_ Yeah, slightly different error message. -OP \_ mconst is right, but I'll also note that hashmap is not part of the STL. \_ my bad, its actually a map named hashtable. -OP, the benighted maintainance programmer |
2006/4/29-5/2 [Computer/SW/Languages/C_Cplusplus, Computer/SW/WWW/Browsers] UID:42862 Activity:nil |
4/29 C for Cookie: http://tinyurl.com/kmd9z --michener \_ That's awesome. Thanks. -jrleek \_ Fantastic, thanks. Any ideas as to where to find a not-PITA-to- download version of that? -John \_ Firefox VideoDownloader, don't know how well it works, someone just pointed me to it: <DEAD>addons.mozilla.org/firefox/2390<DEAD> -dans |
2006/4/26-29 [Computer/SW/Languages/C_Cplusplus] UID:42832 Activity:nil |
4/25 Hola, this isnt actually GHUBBARD is it? It looks like him except maybe HUBBARD is older: http://csua.org/u/fmn |
2006/4/16-17 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Languages/Perl, Computer/SW/Languages/Python] UID:42756 Activity:nil |
4/16 I'm very disappointed with os x: I made an application bundle around a python script: it executes fine but dropping a file on it doesn't work turns out finder passes a ProcessInfo object and you get that as argv[1] well, you get its UID- and that is the only arg you get so far the on;y way i have found to translate the UID into a process info, and thus to get the path of the file i dragged, is with cocoa i.e. c++ or objective c. doesn't seem to be any decent applescript way to do it, or i could just shell out to osascript i guess this explains why all the droplet hacks use a binary executable to call shell, perl, or python scripts this man-made creation troubles me |
2006/3/30-4/1 [Computer/SW/Languages/C_Cplusplus] UID:42562 Activity:nil |
3/30 In C, what's the purpose of using "extern" for function declarations in .h files that are included by .c files in other modules? Thx. \_ Functions are default globabl scope in C, so extern is redundant. See p 41 Expert C Programming. \_ It's unnecessary. I guess you could use it for emphasis to contrast against 'static', though. See: http://c-faq.com/decl/extern.html |
2006/3/25-27 [Computer/SW/Languages/C_Cplusplus, Computer/Theory, Computer/SW/Unix] UID:42432 Activity:nil |
3/25 The Ultimate Casio Watch: http://www.watchreport.com/2006/03/review_of_the_m.html \- i used to have an older incarnation of the Pathfinder [till it fell off at Mughal Sarai Junction] and a couple of comments: 1. it is good they have changed this to a strap rather than a bracelet design. bracelet not good for these kinds of watches. i nearly lost mine after a b'let failure on a catemaranin 9ft seas, which is not where you want to try and fix something with <1mm springs. 2. i find the themometer of limited use, since while on your wrist you are really measuing the "temperature near you wrist". 3. if you really need a compass, you need to take a real orienteering compass ... these watch compasses are sort of just opportunistic things. 4. some of the featuers like altitude alarm, altitude recording, multiple alarms i dont find that useful [you cant upload the telementry data to a computer can you ... GPS mre useful in this area] and these things tend to make accessing the frequently used function slower and more complicated (like say converting between ft <-> m ... which was my main complaint with my old watch 5. often you can get an older model for vastly cheaper by just sacrificing some function you may not really need [you can get some older p'finder models for around $85 vs $300+ for this one, which is significant if you think of this as a piece of gear rather than your watch]. thanks for posting the link. i am happy to give advice on outdoor gear except for aid climbing and snow and ice. --psb \- i used to have an older incarnation of the Pathfinder [till it fell off at Mughal Sarai Junction] and a couple of comments: 1. it is good they have changed this to a strap and not a bracelet design. bracelet not good for these kinds of watches ... nearly lost mine after a b'let failure on a catemaran ... which is not where you want to try and fix something with <1mm springs. 2. i find the themometer of limited use, since while on your wrist you are really measuing the "temperature near you wrist". 3. if you really need a compass, you need to take a real orienteering compass ... these watch compasses are sort of just opportunistic things. 4. some of the featuers like altitude alarm, altitude recording, multiple alarms i dont find that useful [you cant upload the telementry data to a computer can you ... GPS mre useful in this area] and these things tend to make accessing the frequently used function slower and more complicated (like say converting between ft <-> m ... which was my main complaint with my old watch 5. often you can get an older model for vastly cheaper by just sacrificing some function you may not really need [you can get some older p'finder models for around $85 vs $300+ for this one, which is significant if you think of this as a piece of gear rather than your watch]. thanks for posting the link. i am happy to give advice on outdoor gear except for aid climbing and snow and ice. \_ I wanted to get this watch b/c it was the first casio I've seen that has world atomic timekeeping, is solar powered, water resistant and it has that "indiglo"-like lighting. The compass was an added bonus, but I usually carry my eTrex GPS so its not an essential for me. |
2006/3/13-14 [Computer/SW/Languages/C_Cplusplus] UID:42205 Activity:high |
3/13 Star Trek fans. Rank the series: STNG > Voyager > Original >> Enterprise > DS9 \_ Hell no. Enterprise was definitely not better than DS9 \_ DS9 > STNG > TOS > TAS > Enterprise > Voyager \_ I can agree with this. \_ What is TAS? \_ The ASS^WAnimated Series \_ never heard of it. thanks for the new trivia information. \_ TNG > DS9 > E = V (didn't watch O) \_ B5 > Original > STNG > DS9 > Voyager. Enterprise should never \_ Original > STNG > DS9 > Voyager. Enterprise should never even have been made. I never saw the cartoon. even have been made. I never saw the cartoon. [I said B5. I meant B5. Don't edit my posts. Add your own comments if you have something to say.] \_ not that many ST fans here. \_ TOS > TNG s3-7 > DS9 > TNG s1,2 = TAS > Voy That TOS is the GREATEST ST EV4R is self evident. No other ST show has eps. that come close to 'City on the Edge of Forever', 'Amok Time', 'The Corbomite Maneuver' [ far better than the leem "Picard Maneuver" ], Trouble w/ Tribbles, Devil in the \- you must pay me 5cents. Dark [ "I'm a doctor not a bricklayer" ], &c. TNG also rates lower on than TOS b/c the Enterprise D was such a pos ("The Romulans are scowling Captain, sheilds down to 20%"). It wasn't until the Enterprise E that Picard had a useable ship (though the Defiant/San Paolo was still better). TNG s3-7 are listed separately b/c TNG s1,2 are weak and s2 included one of the worst characters in all of ST, Dr. Pulaski. She was worse than the retarded genetically enhanced Dr. Bashir on DS9. Enterprise is not listed b/c it is not Star Trek. It is a piece of festering maggot infested rancid week old meet that not even vultures will eat. A better question is rank the movies: TWOK > TVH > FC > TUC > TSFS > TMP > TFF > N > G > I Re B5 - What a total piece of crap. JMS sux. If he hadn't killed of Good Kosh and Marcus, then I would say B5 > DS9, but NO JMS had to kill off the two best characters. Not even Garibaldi going rouge, Bad Kosh and the addition of Chekov can redeem JMS. Nothing can. -stmg \_ STMG, isn't it true that TNG 1&2 were terrible because Rodenberry kept trying to recycle old ideas from TOS? Also, isn't it true that production values on TOS were so ridiculous that only the advent of Blake's 7 showed that you could could throw even less money and talent at a SF show and still inspire ludicrous levels of fan loyalty? \_ TNG s1,2 were awful b/c Rodenberry kept trying to recycle TOS plot ideas that they didn't let him film during TOS b/c everyone knew they sucked (and then Majel Barrett aka Nurse Chappel aka Loxanna Trio tried to double recycle them for bad Andromeda/Earth Final Conflict plots). I also don't like s1,2 b/c they have the bad uniforms and Riker doesn't have a proper beard. I don't know too much about B7. I try not to associate w/ B7 and Dr. Who fans. They are really weird, and totally unlike normal people who watch Star Trek. -stmg \_ Hey! The correct term for a fan of the longest running sci fi show in history is "Whovian". \_ excellent posts STMG. I agree Dr. Pulaski is an awful character, and STNG seasons 1&2 were subpar. I was wishing the old ST came back. But things got better after season 2. Why don't people like Voyager as much? I thought it was a good series worthy of the Star Trek name. \_ Voyager had too many tired rehashed plots, and the characters were not strong and didn't seem to have chemistry, and the Vogager ship wasn't interesting. I think the whole thing was sort of been there, done done that. Maybe it would have worked better by being a bit darker and edgier, more towards what Battlestar Galactica is now. \_ Although eps. where 7 walks around w/ in a skin tight suit w/ high heels and a concussion phaser rifle set to kill are entertaining, one gets to the point where one begins to wonder if Jadzia would look better in that outfit. And then one starts to miss Jadzia and then it all goes down hill. BTW have you ever wondered why the Voyager looks like the result of a drunken one night stand between the Enterprise D and the SeaQuest? Maybe Scotty spiked the the Romulan Ale at the Utopia Planitia christmas party some year. BUT I must say that Voyager has ONE redeeming quality: at least it was not Enterprise. \_ STMG, you made me laugh. I think that was brilliant. -- jsjacob \_ there was a history channel documentary about "How William Shatner Changed the World" or something like that. |
2006/2/22-23 [Computer/SW/Languages/C_Cplusplus, Recreation/Music] UID:41950 Activity:nil |
2/22 Does anyone know the name of this piece of orchestral music? It starts with something like this: Key: C-maj, 3/4 (probably) C--- --BC DCBA | C-CA C--- BAED | G---- I heard it while watching the Olympics mixed ice dancing on Sunday around 2-3pm. The team was wearing purple and they got a perfect 6.0. Thanks. \_ From your transcription, it could be Ravel's Bolero, but that's not in 3/4. --scotsman \_ Actually, it is in 3, like most bolero's. \_ Sorry, I'm smoking the crack. Too much Puccini on the brain. You're right. --scotsman \- ravel's bolero is a good guess. it is in 3/4 and C-maj. you could pick out the key but had never heard Bolero? that's funky. do any of you know the ADRIAN HO/Bolero episode in 238 Evans Hall [old CSUA office]? \- i do not watch the olympics but if in 3/4 time may be one of the "standard" competition watlzes for ice skating. some of them appear to be here: http://skatersworld.org/DeskTopDefault.aspx?MediaTitle=blues.mp3&tabid=256 i dont remember well enough to "name that tune" by "sight reading" the motd. oh it looks like the REVENSBURGER is the STANDARD at TORINO. i think that is really crappy piece. my competitive ice skating associate has ceased associating with me otherwise i could ask i suppose. ok tnx. |
2006/2/21-23 [Computer/SW/Languages/Misc, Computer/SW/Languages/C_Cplusplus, Computer/SW/Languages/Java] UID:41946 Activity:nil |
2/21 Silly poll: What is your favorite design pattern? Gang-of-Four or not. \_ Template method: . \_ Houndstooth: . \_ Is that structural or creational? \_ POLKA DOT: . \_ I've never seen a really good reason to use design patterns other than the fact that some of their concepts are built into the language (i.e. Java Swing, etc.). I suppose it makes sense on a language level (better designed, more OO languages, etc.), but I've never seen a very well designed piece of code using the concepts as described by the GOF. In fact, I've seen over designed projects, especially when someone decides to drag in Rational Rose and they go UML crazy. I suppose it works on Really Large Projects (TM), but it certainly holds no place in mid or low level projects, at least not in my experience. I think there's a major disconnect with academia's concept of software engineering and what really goes on in the nitty gritty real world (big surprise). The whole concept keeps on reminding me of the chapter "no magic bullet" from The Mythical Man Month. |
2006/1/21-24 [Computer/SW/Languages/C_Cplusplus] UID:41475 Activity:nil |
1/21 I'm trying to use Apache SSIs to do something like: <!--#ifndef expr="$title" --> <!--#set var="title" val="Default Title" --> <!--#endif --> But there's no #ifdef or #ifndef and #if doesn't like to parse undefined variables. Is there any way to do this sort of thing? \_ Well, you could try <!--#if var="title" val="" -->. But it sounds like you're getting into PHP territory. -tom |
2005/12/21-23 [Computer/SW/Compilers, Computer/SW/Languages/C_Cplusplus] UID:41104 Activity:nil |
12/21 I have a complex chuck of C code, and somewhere it in, I'm freeing a bad pointer. However, this doesn't happen if I run it under gdb. Does anyone know how I can figure out where it's crashing? \_ Valgrind is usually pretty good at finding this stuff. It's slow, though. If the program runs under FreeBSD, you can try running it with MALLOC_OPTIONS=AJX. \_ Is it running in gdb that causes the crash or is it running a debug build that causes the crash? Debug builds null all memory at allocation, I believe there is a way you can tell gcc to set all the memory to some other value than null instead. If all memory is nulled then freeing that null value will do nothing, but in the non debug mode you will free a random int and boom, your code will crash. \_ No, running in gdb DOESN'T crash. Running it normally does. \_ It's obviously freeing an uninitialized pointer. In a a debug build all allocated memory is nulled so you are going to free null, which is valid and doesn't cause a crash. There is a way to make debug builds (or maybe gdb) not null out memory. It has been a while since I debugged c, but I know for a fact that is your issue. \_ try attaching to the pid after it starts? \_ gdb the core dump \_ I don't seem to have a core dump. It just seg faults. (on linux) Is there a way to force a core dump when it frees a bad pointer? (Sometimes it gives an error: free(): invalid pointer 0x9091420!) \_ Don't segfaults dump core? Do you have ulimit set to 0? \_ ulimit in unlimited. Apprently they don't always dump. \_ Is it setuid? -tom \_ no. \_ Above suggestion, and this sort of failure-to-reproduce could mean the bug is in something time-dependant, either using a clock, net IO or bad synchronization between threads. Heisenbugs suck. \_ I think it's because I have lots of if(x) {free(x);} stuff. I could see this happening if I didn't initialize all my pointers to NULL. (I understand gdb helpfully automatically initilizes pointers to NULL for you.) However, I can't find any uninitialized variables. \_ if (x) { free(x); } is pointless if you're using the standard C library. free(NULL) is a no-op. Also, if it's a Heisenbug, check that you're not overflowing stack frames. If you're worried about uninitialized variables, make sure you compile with all compiler warnings on. \_ Good point. \_ How about doing some good old-fashioned trace logging to pinpoint the crash? Unless trace logging prevents the crash from happening as well! |
2005/11/28-30 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Languages/JavaScript, Computer/SW/Languages/Misc] UID:40749 Activity:nil |
11/28 Any recommendations for a provider of unmanaged dedicated servers. My current provider is 2 hours into a network outage today. and they don't have an ETA yet. \_ Check http://www.webhostingtalk.com and see the offer section. Then do a search to see if any of the company you are interested in has any bad review. |
2005/11/28-30 [Computer/SW/Languages/C_Cplusplus] UID:40736 Activity:nil |
11/28 Recommendation for a good business card printing site. There are a zillion of them that pop up when I search for "business card". One that offers a lot of templates would be nice. Thanks. \_ There are general purpose printers and places that specialize in the profession that you're in. What profession are you in? \_ I was happy with just going in to Kinkos with a pdf of my card and having them print them up. I realize that doesn't exactly answer your question, but I found this to be a low hassle method of getting cards. I used Illustrator to make the card. \_ actually this is good feedback also. I didn't consider this option. Thanks. \_ Vistaprint \_ Speedway printing. |
2005/11/22-24 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Editors/Emacs] UID:40695 Activity:kinda low |
11/22 Emacs users: Do your fingers get tired of pressing the Ctrl key so much? \_ No. -mice \_ I use Kinesis keyboards where they map CTRL to thumb operation and I've been really happy since then. \_ http://csua.com/?entry=21074 http://csua.com/?entry=28755 http://csua.com/?entry=38806 \_ No. I don't use the cntl keys for everything -- I try to spread basic navigation between both hands, and leave special functions to my left. So far, this has worked very well for me. -mice \_ No. Actually I've been using only the left Ctrl and Shift keys (instead of both left and right ones) for emacs and everything else, so as to train my left pinkie which is the weakest. It works. -- piano player \- if you are C-f/b/n/p too much, you are probably not doing something correctly/optimally. \_ My keystrokes are far, far from optimal. But then I press a lot of C-a C-e C-a C-e ...... out of no reason but boredom anyway, so being optimal is not my concern. BTW I bind C-q / C-z to scroll down / up one line, and I use them a lot. Also, I don't swap Caps and Ctrl on my PC keyboard. -- piano player \- if you dont use incremetnal search to move, you may want to consider that. \_ what piano piece(s) are you working on? \_ I like Chopin's short pieces like Nocturnes and Etudes. I'm not good enough to play any of his long pieces. With a kid in in the family, I rarely practise now. But on the rare occasion that I play, I find that over the years my left pinkie have gained strength. Now I don't need any wrist action when playing the low notes. I think it's nice to write code and get paid at my job while training my fingers at the same time. BTW, if anyone still remembers the Sun4's in 260 Evans and the TVI920c's in Evans basement, those keyboards were even better for training fingers even though they drove me crazy when a project deadline was coming up. were even better for training fingers too even though they drove me crazy when a project deadline was coming up. -- piano player \_ oh my god yes. I recall how stiff those keys were to press! \_ No, I play FPS games and bind walk and crouch to shift and ctrl. I can press them all day with my pinky. But I was amused to notice that after recently not playing for 6 weeks or so, the next time I tried both my hands got really tired. \_ Nostromo is calling you! http://csua.org/u/e23 (Belkin) \_ lame, it's not even a mouse \_ Yes. very. Emacs and screen both kill my pinky finger. switching the caps and ctrl key helps, but doesn't make it go away. Ultimately, using *nix less helps the most. \_ Yes, so I switched to VIM. -emarkp \_ As a vi user, no, but doing HTML kills them (all of the <>s and ""s) \_ ouch. html is for html-editors \_ No, and don't be such a baby. -meyers |
2005/11/1-4 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Editors/Emacs] UID:40379 Activity:nil |
11/1 In emacs, I'm editing a C++ header file in C++-mode. However, when I tab, it only goes 2 spaces instead of 4. Tabbing in a source file does work, but not a header file. TIA. \_ I think the 2 spaces are for "public:/private:" lines; then another tab and you can get to the 4 spaces for member vars, decls, etc. |
2005/10/12-13 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Languages/Java] UID:40049 Activity:high |
10/11 For future job security - Java or C++? Java: C++ : . \_ English : . \_ For Great Justice! \_ Chinese : .. \_ I would say either all the way to the J2EE field, or get back to plain old C. From my perspective, next 5 year's action is going to be in the embedded space. C is more important than Java in that space. \_ As an embedded guy who knows neither C++ nor Java, I'm glad to hear that! -- !OP \_ COTS or in-house? \_ I am going to guess more Java jobs, but also more Java programmers. You will not lose with C++ in the near future. You can do so many more things with it and there are fewer great C++ programmers. If you know C++ then 'plain old C' comes easily as well, especially if you only knew Java before. C++ programmers. If you know C++ then 'plain old C' comes easily as well, especially compared to people who know only Java. \_ "seee plus plus is yeezee!" - indian programmer \_ "see plus plus is yeezee!" - indian programmer |
2005/10/7-9 [Computer/SW/Languages/C_Cplusplus] UID:40019 Activity:nil |
10/7 I declared a function that takes (char const* const*), which protects array[x] and array[x][y] from being re-assigned (but still allows array to be assigned to a different entity), why do I need to cast a regular (char **) to it? Just like I don't need to cast a (char *) to a (const char *). Is this a known bug because no one uses (char const* const*) or (const char * const *)? \_ Your compiler is broken. This conversion is safe; gcc and Visual C++ both allow it without a cast. (You need both consts, though. Converting char ** to const char ** is not safe.) --mconst |
2005/10/3-5 [Computer/SW/Languages/C_Cplusplus] UID:39966 Activity:nil |
10/3 Windows Explorer question: Is it possible to modify the context menu (right click) to add a custom action? I have templates of spreadsheets I want to copy quickly to certain folders. I envision using the context menu in this manner: Right-click -> Create Template Here -> [template1], [template2], [templateN]. It should have one of those right arrows that will expand into another menu from which I can choose templates 1 thru N. I tried Googling and there's a lot of information on customizing Windows, but I haven't hit on the right search terms for what I'm trying to do as described above. If anyone knows how, or has the right search terms, please let me know. \_ Try "explorer extension" \_ Thanks for this tip. The closest Google match seems like this one from MS: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_int/shell_int_extending/extensionhandlers/shell_ext.asp This article is called "Creating Shell Extension Handlers". I'm not a developer by any means, and this article provides code samples, so I'm afraid I'm over my head here. If someone has the time, can you take a glance and let me know if this is even going down the right path? If it is, I'll try to do some learning, but I'd rather take a path of less resistance and use an app to create these "expanding context menus", if such an app exists. --op \_ You'll probably have a hard time doing this if you aren't a developer. The best you might hope for is to add your templates to the ShellNew folder. But anyway, try: http://csua.org/u/dlq \_ Another nice tip. The "Extending the New Menu" section could be a stop-gap. I would be able to right-click -> New -> template1 ... N; the drawback is that I could have a very long menu. If I could define some arbitrary command with expanding menus, it would be much more flexible. I know the command in my original post is "Create Template Here" but I might as well generalize it. Was the "Creating Shell Extension Handlers" article going down the right path though? --op \_ No, my link is better. \_ You're not going to be able to do this if you aren't a developer. The best you can hope for is to add your templates to the ShellNew folder. \_ There must be a way, because after I install ClearCase on my XP, I see some new items when I right-click on file in ClearCase VOBS. I don't know how, though. \_ An open-source example is TortoiseSVN which I use for subversion. Check http://TortoiseSVN.tigris.org \_ I looked through this briefly, but I don't even know which part of the src to begin with to figure out how they did all that integration. --op |
2005/9/30-10/3 [Computer/SW/Languages/C_Cplusplus] UID:39937 Activity:nil |
9/30 What's the name of the rand() function that returns a float between 0 and 1? Or alternatively, how do I use the normal rand() to return a number between 1 and n? I could % n, but it's not really uniform if n is large... Thanks. \_ Language? \_ C. \_ I strongly suggest looking up public code for the "Marseinne Twister" if you're on a 32-bit platform. Do *not* use "%" if you want uniform. Find the largest value k such that k*n < MAX_RAND (or 2^31-1 for the twister). Any value larger than that should be discarded. Then use %. That gives you uniform distribution. \_ Thanks! \_ 30 seconds with the appropriate manpages turns up drand48. I don't know how random its output is. -gm \_ Which isn't in standard C or C++, but is commonly available on Linux. \_ Are you on a platform w/ /dev/random or /dev/urandom? If so you could use that and normalize to btwn 0-1. \_ Also avoid % because most rand() implementations aren't very random for the low-order bits. random for the low-orbit bits. |
2005/9/21-23 [Computer/SW/Languages/C_Cplusplus, Computer/SW/P2P, Computer/SW/Security] UID:39809 Activity:nil |
9/21 http://tinyurl.com/7swro It's the dawn of the age of uninhibited file sharing! LionShare is creates a neat, private sheltered place where people could shop music and movies to their heart's content without entertainment companies ever knowing. |
2005/9/15-16 [Computer/SW/Languages/C_Cplusplus] UID:39702 Activity:nil |
9/15 Emacs question.. I use meta-Q to reflow a paragraph. How can I set the right-side end-of row width for the text? \_ M-x set-variable <RET> fill-column \- C-x f runs the command set-fill-column --mr. emacs \_ "set-fill-column requires an explicit argument" \- as RMS said to me about 15 yrs ago "universal argument" \_ C-h k C-x f \_ M-x set-variable <RET> default-fill-column to set it for all buffers. Then you can override it in individual buffers by setting fill-column. \- i rarely want to set it for all buffers [or would use a hook or .emacs setting]. also often you want to set it to the current cursor column. anyway, ymmv. |
2005/8/17-20 [Computer/SW/Languages/C_Cplusplus] UID:39150 Activity:nil |
8/17 Bell Labs kills Dept. 1127: http://www.unixreview.com/documents/s=9846/ur0508l/ur0508l.html \_ A massacre! Oh, _Department_ 1127. \_ All high calibar people: Thompson, Kernighan, Ritchie, ... \_ All high caliber people: Thompson, Kernighan, Ritchie killed. \_ All high caliber people: Thompson, Kernighan, Ritchie, ... |
2005/8/3-5 [Computer/SW/Languages/C_Cplusplus, Computer/SW] UID:38968 Activity:low |
8/3 dear motd LGPL expert: I'm using an open source LGPL library at work. I need to make some minor changes to the source code of the library to get something working, and am not sure exactly what I need to do to legally use the modified library in a commercial application. My vague understanding says that I need to make the source code changes "available" (even though the change I made is really simple), but what does this mean? (what exactly do I do to make them available?) \_ Why don't you just submit your bug fix/enhancement to the project team? \_ You are going to distribute the modified library with your commercial product, yes? You can: a. Distribute the source code to the library too. b. Wait for someone to ask you for the source code to the modified library. c. Submit your changes back to the library maintainers, and then it's not an issue. \_ I've been in this spot before and we shipped the src to the library along with the patch containing our changes. We also send the changes to the maintainers, but it took some time for the changes to be incorporated and for us to pick up the new version so shipping the src and the patch covered us until that time. |
2005/8/2-4 [Computer/SW/Languages/C_Cplusplus, Computer/SW/OS/Windows] UID:38948 Activity:nil |
8/2 XP question. The C function CreateThread() returns both a thread ID and a thread handle. What's the difference between them? Thx. \_ A thread handle lets you do stuff with the thread, like kill it (TerminateThread) or get its exit code (GetExitCodeThread). A thread id is just a number, and all you can do with it is call OpenThread to get a thread handle. Thread ids and thread handles are exactly analogous to filenames and file handles -- CreateThread is like a function that creates a new file, and returns both an open file handle and the name of the file. Usually all you care about is the handle. --mconst \_ Very helpful! Thanks! |
2005/8/1-3 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Editors/Vi] UID:38908 Activity:nil |
8/1 What's a reliable website that tells me approximately where an ip address is from? \_ whois -a will give you the ARIN registry entry. \_ use <DEAD>dnsstuff.com<DEAD> - danh \_ use http://lin.kz/?u4f1e - danh \_ use <DEAD>dnsstuff.com<DEAD> - danh |
2005/7/15-18 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Languages/Java] UID:38653 Activity:moderate |
7/15 Is it possible through JNI to write a function which takes a float[] array and through the magic of c casts it to an int array and then returns the int array to Java, not modifying the actual data? If not, is there a good Java way to do the C equivalent of: int* i = (int*) f; ? Don't ask whether I really need to be doing this because there is a good (performance) reason. \_ You can modify your implementation of VMFloat, or create a new class similar to it, to provide an additional method that works on arrays of ints and floats, rather than just on individual 32 bit values. This will entail creating a new shared library, etc. This is probably the cleanest and most efficient way, but obviously will not be portable. I am assuming you know how to write the C necessary to convert the array type while leaving the bit representation unchanged. -- ilyas will not be portable. -- ilyas \_ Do you know of any in-Java way to convert float[] to int[] without using JNI or touching the underlying data? -op \_ If you thought about it, you should be shocked if there were. \_ I do not know of such a way. I think when you are starting to care about performance to the extent where you don't want to just call floatToIntBits on each element of the array, you should either forget platform independence, or use a better language. By the way, the previous poster is wrong, there is no reason Java shouldn't provide this functionality in VMFloat (it provides a function for individual 32 bit values). It just doesn't because it sucks. -- ilyas \_ Sure: for(int i = 0; i < float_array.length; i++){ int_array[i] = java.lang.Float.floatToIntBits(float_array[i]); } If you want to avoid the overhead of a loop, or aren't willing to write your own shared library + class wrapper to do what this loop does in one swipe, or aren't willing to abandon Java, then you lose. -- ilyas \_ I'm already doing the above, but want to avoid an additional O(n) step, and am too lazy to write another JNI wrapper. I guess I do lose. I also saw ByteBuffer has methods for providing IntBuffer and FloatBuffer views, but I can't find a low overhead way to go FloatBuffer->ByteBuffer or IntBuffer->ByteBuffer. \_ For reference, consider how a well-implemented strongly typed language (ocaml) handles this: let float_array = [| 1.0; 2.0; 3.0 |] in let int_array : Int32.t = Obj.magic float_array in ... Obj.magic is an unconditional type cast without promotion. -- ilyas |
2005/7/7-9 [Computer/SW/Languages/C_Cplusplus, Computer/Theory] UID:38465 Activity:nil |
7/7 I never took AI but I'd like to learn something about Bayesian belief, inference, etc. Something like a 10 page intro PDF or a URL would be useful. Recommendation? \_ http://www.cs.ubc.ca/~murphyk/Bayes/bayes.html Kevin is a former Cal grad student, btw. Very smart guy. -- ilyas \- how do you know kevin? http://home.lbl.gov:8080/~psb/ASSOCIATES/Mike+Kevin81.jpg He actually fits into this story: *Boredcast Message from 'psb': Mon Aug 4 15:22:19 2003 ||let's see: A is hosting B for a few days ... B ||who used to date C who is marrying D who was ||interested in A and was told by B to go out with ||A. D was the roomate of the office mate of E who ||used to date X and later dated F who got ||together with B. ||A = psb ||X = rob pike I note in passing B also works on graphical models and was formerly trafficking with various UCLA and Harvard and Berkeley Bayesians. \_ I worked on Kevin's toolbox a long long time ago. We took some classes together also. Kevin interviewed at UCLA for a faculty position, but didn't take it. -- ilyas \_ spasibo ilya! That is exactly what I was looking for. You are a very cool guy. Why do people make fun of you? \_ Probably because I am considered the motd retard. -- ilyas |
2005/7/5-7 [Computer/SW/Languages/C_Cplusplus, Computer/SW/WWW/Server] UID:38414 Activity:low |
7/5 You know what would be cool? Google maps + fast updating traffic condition data in the bay area + xplanet = neat background for my monitor. \_ Yahoo! maps has traffic conditions overlay. \_ Google earth should have licensed firework displays marked. -- ilyas \_ How about an overlay of parking rules and street-sweeping schedules? \_ How about an overlay of where dem hos at? \_ Plus meter-maid schedules. \_ And known speed traps! -John \_ So how hard would it be for you pros who can really do this stuff to jerryrig a Wiki version of Earth or Maps? -- ulysses (I do storm drains, not C) \_ You write software that manages storm drain projects? \_ I haven't written a significant amount of new code of any kind since finishing my master's program. It's an interesting idea, though. The available storm drain software kind of sucks. -- ulysses |
2005/6/23-25 [Computer/SW/Languages/C_Cplusplus] UID:38255 Activity:low |
6/22 Technical question: My friend is trying to program a single-threaded signal based server. He's using the icc compiler on 64-bit linux. However, the following problem comes up. The server is working and calls malloc. Malloc grabs the allocation mutex (thread-safe!), then a signal comes in. The signal interrupts malloc and calls the handler function. The handler function calls malloc, deadlock. Any idea what can be done where to avoid deadlock? \_ what, besides the obvious 'dont use malloc in the interrupt' ? \_ Yeah, besides that. Since I'm not writing the code, I'm not sure, but I guess that option is undesireable. \_ I reccomend the 'don't call malloc in the handler' but here's an alternate hack: Replace both calls to malloc with calls to a new myMalloc(). myMalloc keeps a fixed-size buffer and its own mutex to controll calling malloc itself. When myMalloc is called and the mutex is not free, it returns a pointer to somewhere in the fixed buffer and reduces the bytes free in the preallocated buffer. When myMalloc is called and the mutex is free, it calls malloc normally, then checks if the preallocated buffer is 'too small' and if so performs a realloc on it. Two problems with this are: You need an upper bound to how much memory the handler(s) will need to malloc, and if they want to free the memory too then myMalloc really needs to keep enough preallocated buffers equal to the maximum number of myMalloc calls you will see between times the mutex is freed. \_ What about something simple like writing a function that sets all signals to SIG_IGN, then calls malloc, then sets all the signals back to SIG_DFL? back to your signal handler? |
2005/6/19-20 [Computer/SW/WWW/Browsers, Computer/SW/Languages/C_Cplusplus] UID:38198 Activity:moderate 76%like:38189 |
6/19 Programming Jobs Losing Luster in U.S. http://tinyurl.com/737b8 (nytimes.com) \_ Oh darn. You mean those opportunistic little shits who clogged up all of my project groups in CS classes aren't around anymore? Cry me a fucking river. \_ is there a CSUA password? \_ No, some dumbass disabled it. Just use http://bugmenot.com. \_ Just checked out http://bugmenot.com. what a great site! \_ If you are using firefox there is a nice bugmenot plugin: http://roachfiend.com/archives/2005/02/07/bugmenot \_ err... if you think of it, programming jobs *ARE* manufacturing jobs... manufacturing of software, that is. \_ Some computer jobs could be classified as manufacturing (ex. build/release engineering) but stuff like actual design of new software products and development is more like classical engineering work than manufacturing jobs. \_ just like design of new consumer electronics and other traditional products are done in USA, and manufacturing is done somewhere else. \_ If asian countries can do better at software and engineering, they can also do better at other things. What will the US be left with? More than half the new jobs created are related to real estate. Besides that, what else? Scientists, lots of accountants, MBAs? Service jobs are being outsourced too, and pay tend to be low, and those won't help in balancing the trade deficit. The top people will be making more and more, while the others will become poorer and poorer. "Learn foreign language and become cross-cultural managers"? huh? Once language and become cross-cultural managers"? snicker. Once everything moves to asia, they don't need no stupid cross- cultural managers from the US. I find it a little funny that some people seem to think that we can just let asians do the software and engineering work, and we can just be their managers. \_ What's gonna happen? Possibly, the US will continue hemorrhaging those jobs until the wage differrentials between US and East Asia are not so wide as they are now. Another possibility is to come up with new types of products and jobs to replace them. \_ America has thrived because it's able to invent new things that have never been done. Look at all the cool things that came from America: aeronautics, automobile, consumer electronics, DRAM, LCD, GPS, etc. At first America has the lead on these things, but in a matter of 5-10 years, foreigners find ways to perfect techniques and out produce better automobiles, TVs, stereos, LCDs, DRAM, and other common things. Go to Fry's or Best Buy... how many products are really made in the US? My point is America has never really been good at perfecting existing products. They invent something new, and move on to something else. The way I see software and hardware development is that it's maturing, and a lot of complexities are broken down in such a way that SW dev is more and more like designing automobile and consumer electronics. Despite what we know about OO, scalability, reliability, usability, QA, verification, and other things that complacent Americans think they're the only people who excel at, it's just a matter of time before Indians and Chinese really understand computer science, and catch up. \_ The assumption is that America can out invent the Chinese and Indians. The thing is, the Chinese and Indians ain't bad historically at inventions (compared with say the Japanese), but just haven't had the opportunity (wars, poverty, easier to just copy instead of invent when you are behind) to lead and invent. Once they have lots of engineers doing leading edge work, they will become very competitive with inventing new things. The other thing is that with internet and globalization and how fast information travels, the benefit you get by being the inventor has been reduced. \- Some years ago on the cover of the IEEE Spectrum there was a pictures of the Pentium design team. That should tell you something about the Chinese and Indians as ethnicities vs. nations. See also winners of programming olympiad type stuff. \_ I am thinking more in terms of culture / nation and not race / ethnicity. \_ The advantage America has is one of numbers. We have so few people and so much resources that large numbers of creative minds can simply sit around and tinker w/ things until they make something new. It is not so in Asia (my experience is w/ India, but China is the same from what I'm told). In Asia there are a million people competing for every single dead end job that is out there. If you just want to live you have to stay w/in the system. This societal setup does not allow for the freedom to invent new things b/c if you sit around wasting time tinkering your kids end up starving to death. \- The US universites benefitted from the Oxbridge braindrain. They got some big names who were paid ass there and were picked up here. On the other hand some junior faculty and grad student types I have known seem to feel kind of threatened by russians and chinese people who are way better at math than they are ... these people are not mathematicians but in related disciplines like stat, finance, econ etc. People losing out to competition are not happy. But the structural metaphor isnt outsourcing but a raising of the bar in a field like applied stat. \_ "the West won the world not by the superiority of its ideas or values or religion but rather by its superiority in applying organized violence. Westerners often forget this fact, non-Westerners never do." \_ Where's this from? cultural managers from the US. \_ Bet they said this about the huns or the Ottomans as well. \_ Or the Mongols. |
2005/6/13-15 [Computer/SW/Languages/C_Cplusplus] UID:38097 Activity:nil |
6/13 Sometimes I accidentally type Ctrl-X in vim and am consigned to some sort of vim purgatory where the program no longer responds to input, not even the ctrl commands that it "helpfully" lists at the bottom of the screen for "Ctrl-X mode." Can anyone tell me how to escape from this? And no, "use emacs" is not a helpful response. \_ Let me guess: you enter this mode by typing C-x C-s to save. The problem is the C-s, not the C-x; C-s suspends terminal output. Hit C-q to resume it. You can just hit escape (or, I think, any other key) to get out of Ctrl-X mode. -gm \_ Thanks, you rule. |
2005/6/10 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Languages/Java] UID:38078 Activity:nil |
6/10 I'm trying to write my own Java properties file reader so that I can get something similar to C's #include macro, but I'm having problems getting the properties back from System.getProperty(). For example, I'll call System.getProperty("foo") and get null back, but printing out all properties (via System.getProperties().list(System.out) ) clearly shows "foo=bar" in the output. I've tried loading the file using different charset names (ascii, utf8, several other usual suspects) but that hasn't helped. Has anyone seen something like this before? TIA. |
2005/5/15-17 [Computer/SW/Languages/C_Cplusplus] UID:37692 Activity:nil |
5/15 Has anyone upgraded from a 300D (digital rebel) to the new Rebel XT? I was thinking of cl'ing my 300D and getting an XT this summer b/c the XT is lighter/smaller than the 300D and has usb 2.0, but I wanted to know if the reduced weight and size is noticable. |
2005/5/14-17 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Database] UID:37675 Activity:nil |
5/14 Jobs available in my group at Amazon http://www.amazon.com/exec/obidos/tg/stores/jobs/pre-sales-marketplace-management/-/1/103-6511325-3219840 Interested? Send me your resume -larryl \_ Leisure Larry? \_ No location? |
2005/5/6-11 [Computer/SW/Languages/C_Cplusplus] UID:37562 Activity:moderate |
5/6 (Not a homework question) You have a horizontal gap of length L and \_ bullshit. \_ double-bullshit. I made a paperclip chain and am curious how to most easily drape it (and I'm a big nerd). a rope/chain/cable with mass per unit length w, and there is vertical gravity of acceleration g. What length of cord should you use to bridge the gap to as to minimize the tension at the anchor points? \_ A suspension like this is described by a hyperbolic cosine, the least amount of tension is produced when the rope or chain is exactly the length of L. Let me know if you need more proof. -scottyg \- re: hyperbolic cos: also and probably more commonly known as Cantenary arc/arch [like the st. louis object]. you can google from "cantenary" ... somebody probably has the solved integral that gives you a closed form for arc length. this name actually comes from the idea of "hanging chain", so appropos to you underlying physical model. and now lets talk about the feynman sprinkler. \_ And when you can't find the answer, search for "catenary." \_ Perhaps you misunderstood. The gap width is L. Trying to bridge that with a cord onle L long would require infinite tension when under gravity. \_ it is a simple optimization problem that reduces down to the more string you have, the greater the weight, and therefore the greater the tension. L is the minimum amount of string one would need to span the gap, therefore it is also the optimized length for minimum tension. See the equations below for tens- ion, T, as they are correct. BTW, I have a degree in Physics, and not CS, if that gives me any more credit. -scottyg \_ "assume the horse is a sphere"... sorry, nope. it doesn't. \_ no it wouldn't. \_ assuming an infinite tensile-strength cord, yes it would. Take a reasonably heavy rope or chain and try to pull it to be absolutely straight while not supported in the middle. You can't do it. \_ but that's not what we're trying to do. you can straighten it by pushing in the middle. in any case the answer is "as straight as you can". \_ What I'm trying to do is find what length of paper clip chain will bridge a gap L with minimum tension. The answer is NOT L, because that has extremely high tension which bends the paper clips all out of shape. But the answer is not 100L either, because that is way too much extra weight. \_ you don't have to pull the ends to straighten the chain. you can straighten it theoretically without bending. \_ Based on what little I remember about CE, scottyg is right. A cable w/ uniform weight per unit length is described as a cantenary. You need two equations to determine the length, L, of the cable. Assuming that you know the separation between the endpoints (X) and the "sag" (S) (the distance from the horizontal passing through the end points and the lowest point of the cable), you can use the following equations: EQ1.1 The half length, L/2, equation: EQ 1.1 The half length, L/2, equation: y^2 - (L/2)^2 = c^2 EQ2.1 The parameter, c, equation: EQ 2.1 The parameter, c, equation: y = c cosh (X/c) Since y = S + c you can simplify to: EQ 1.2: L = 2(2c^2 - 2Sc - S^2)^(1/2) EQ 2.2: S/c + 1 = cosh (X/c) You can use excel or some such to solve for c in EQ 2.2 and then it is simple to substitute into EQ 1.2 to get L. iirc, in most cases it is simpler to just think of the thing as a parabola. then it is simple to substitute into EQ 1.2 to get L. Now that I re-read your question, it seems like you want to minimze S as well as L right? I don't remember enough calc to help you out there, but I think that you probably need to do this by minimizing the tension T at the end points. The equation for T at the end points is: EQ 3.1: T = w(c^2 + (L^2)/4)^(1/2) Good luck! \_ Hmm, what scottyg claims above is that tension T is minimum when the string length L equals to the gap width X. Now, as L approaches X, S approaches 0. Using your equations, as X approaches L, S approaches 0. Using your equations, we get this: limit(L->X) S = 0; limit(X->L) S = 0; EQ 2.2: S/c + 1 = cosh (X/c) limit(L->X) (S/c + 1) = limit(L->X) cosh (X/c) 1 = limit(L->X) cosh (X/c) 0 = limit(L->X) X/c thus limit(L->X) c = infinity limit(X->L) (S/c + 1) = limit(X->L) cosh (X/c) 1 = limit(X->L) cosh (X/c) 0 = limit(X->L) X/c thus limit(X->L) c = infinity EQ 3.1: T = w(c^2 + (L^2)/4)^(1/2) limit(L->X) T = limit(L->X) (w(c^2 + (L^2)/4) limit(X->L) T = limit(X->L) (w(c^2 + (L^2)/4) ^(1/2)) = infinity I don't see how the tension is minimum in this case, using your presumably correct equations. --- L&S CS major your equations. --- L&S CS major your presumably correct equations. So scottyg is wrong. --- L&S CS major \_ I think that what scottyg is getting at is that you have to balance the tension at the end points against the tensile strength of the material that makes up the cable in order to find the min sag and length. \_ Sorry, but this "L is the minimum amount of string one would need to span the gap, therefore it is also the optimized length for minimum tension" seems to contradict that. \_ Okay, I see your point. When I originally posted the equations I was probably wrong about the minimizing the tension at the end points. Anyway, do you see anything wrong w/ balancing the tensile strength of the material w/ the tension at the end points to get the optimal length and sag? \_ Not at all. That seems like a very reasonable way to think about it. |
2005/4/11-14 [Computer/SW/Languages/C_Cplusplus] UID:37140 Activity:low |
4/11 I've been programming professionaly for about 4 years but my background is in the sciences, so sometimes I feel my knowledge of CS concepts and/or theory has a few holes. Would you care to reccomend a book that would help me fill out areas I might have missed? I'm not looking for a language book, or an "all about [compilers|databases|graphics]" but rather "these are the data structures, here are some smart algorithms, heres how to architect something". --Thanks \_ Get a copy of CLR. Other algorithms/programming books I've like include 'Algorithms in C' by Sedgwick and 'Expert C Programming' by van der Linden. \_ Huh? I tried STFW. \_ Cormen, Leiserson, Rivest, Intro to Algorithms - yap \_ http://theory.lcs.mit.edu/~clr \_ What about Design Patterns? Useful or hype? \_ Thumbs up from me. Not that we shouldn't learn how to write them from scratch, but I think STL and Boost and design patterns are all really useful for a wide range of software problems these days. \_ Check out the lecture notes on MIT Open Courseware, excellent stuff! -ray \_ I thought DP was all hype. It did nothing for me, but I've mostly been doing systems, network and security programming. Might be useful if you are doing application programming. FYI, my background was science but I've been a coder for about 5 yrs so a lot of stuff that I didn't know I picked up by eiether taking courses via SITN or bumming books from co-workers. \_ Design Patterns are very useful. Even if you don't know anything about it you will notice much of your code actually fit one or more of the design patterns once you start reading it. I am an application programmer. \_ What are Design Patterns? \_ When you see the code of a large application, sometimes you will wonder why it is written that way, and how did whoever wrote it decide to write it the way it is. Design Patterns is the attempt to systematize the above, as opposed to learning it through experience or sheer intelligence. At least that is my understanding. \_ Check out the lecture notes on MIT Open Courseware, excellent stuff! -ray \_ http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science/6-170Laboratory-in-Software-EngineeringFall2001/LectureNotes/index.htm \_ http://tinyurl.com/53tpe (owc.mit.edu) check out lecture notes 12/13/14 on design pattern. |
2005/3/31-4/3 [Computer/SW/Languages/C_Cplusplus, Computer/SW/OS/Windows] UID:37010 Activity:nil |
3/31 From the "shit I could have told you myself" department: "95% of IT Projects Not Delivered On Time" http://it.slashdot.org/it/05/03/31/1527257.shtml?tid=218 \- what %age of IT projects are not worth doing? i sure see a lot of churn which involves people trying to justify their jobs. if an organization grows 5% over 10yrs but computers become 10x more powerful and 1/5th the size, some stuff is upgraded too often needlessly. \_ Sure, but not all upgrades are needless due to continual increases in number crunching and data storage demand, and a lot of systems which really ought to be upgraded, aren't. I think most of the waste comes from inefficient process-heavy organizations. -John |
2005/3/30 [Computer/SW/Languages/C_Cplusplus] UID:36968 Activity:insanely high |
3/30 What is the difference between > < and |. The former has to do with std input output. But it seems to be just a special case of |. \_ can the op use "the former" to refer to a plurality? Is "the formers" a more accurate way to write? \_ No, you can only use former and latter. Two choices, not three. \_ My question was unclear. In the sentence "A & B were the first to arrive. C & D arrived last." Can "the former," and "the latter" be used to refer to "A & B" and "C & D," respectively, eventhough the referred to items are plural? \_ < and > always involve files. | links between programs. \_ > < connect stout and stdin respectively to a file. | connects stdout of one process to stdin of another using pipe(2). --jwm \_ So then > < is implemented as a special case of |. \_ not quite but close \_ > and < open a file as file descriptor 1 and 0 respectively man pipe(2) and dup2(2). A pipe is not a special case of a file, but both can be accessd through file descriptors. |
2005/3/28-30 [Computer/SW/Languages/C_Cplusplus] UID:36927 Activity:nil |
3/28 Is there any tool that can take a bunch of cpp and .h files and draw up an inheritance tree and a calling tree, like "a is called by b, b is called by c1 and c2, c1 is called by d, d and c2 are called by main"? and "new Foo() has as members the following classes, which each interit from ... and have as members these classes..." \_ Egypt (http://www.gson.org/egypt builds call graphs for C. I don't know if it works for C++; it'll probably output a call graph with mangled names or something. It doesn't do inheritance graphs. -gm |
2005/3/5-8 [Computer/SW/Languages/C_Cplusplus] UID:36540 Activity:low |
3/5 How many pieces of 8.5 x 11 paper can I fit in an envelope before I need to use 2 stamps? \_ I've heard "seven" as the conventional wisdom, but the official constraint is "1 ounce", so the exact count would presumably depend on the type of paper used. -alexf \_ What's the weight of the paper? 20 lb. paper is 500 sheets of double-wide, double-tall paper. So that's 2000 sheets to weight. For normal 20 lb. paper one sheet weighs 20 * 16 / 2000 ounces. Which makes 6.25 sheets/oz. What about the weight of an envelope? \_ If you are using ave printer/copy machine paper, 5 or less sheets is generally okay for 1 stamp. \_ Is it correct, then, that with 2 stamps, I could send up to 10 sheets? -op \_ yes. \_ If you are using a regular envelope I wouldn't send more 7 or so sheets b/c the thing might fall apart. \_ From http://www.usps.com/customersguide/dmm100.htm#PostageRates "Tip: One ounce is approximately equal to four sheets of paper plus a standard envelope." Or you can use the gsm (grams per sq meter) to calculate. For me, I just go to the cafeteria at work and weight it with the salad scale. |
2005/2/19-20 [Computer/SW/Graphics, Computer/SW/Languages/C_Cplusplus] UID:36257 Activity:nil |
2/19 M$ on '1337 Speak: http://www.microsoft.com/athome/security/children/kidtalk.mspx \_ I guess when you have billions of dollars, you can waste money on useless primers like this. \_ This is old and has already been posted: http://csua.com/?entry=36232 |
2005/2/19-20 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Editors/Emacs] UID:36247 Activity:nil |
2/18 Emacs guru please help. I am running shell within emacs and have a couple hundred lines of text beyond the current prompt, which I use one by one as some command argument. Somehow it just all disappeared (from the current prompt to the end). It is not a c-w because I couldn't yank it back. I didn't save it to another file/buffer. Is there anyway to get it back? |
2005/2/17 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers] UID:36210 Activity:high |
2/17 I need to write some code using sockets that will work on both Windows and LINUX. Ideally, I'd like to just use the standard POSIX sockets and have the code work on both platforms. Based on info from MSDN, it looks like this is possible but I'd like to ask people on the MOTD if they've encountered any inconsistencies or other issues doing things this way. Thanks. -emin \_ It mostly works, except for a few little things (WSAStartup, closesocket, ioctlsocket, etc.). As long as you're not doing anything complicated, a few #defines are all you need. --mconst \_ What language? (I assume C or C++.) Which compiler on Windows? Which on Linux? What are your library options? \_ Sorry, language=either C or C++ is fine, compilers=Visual C/C++ on Windows and gcc on LINUX, library options=whatever I need to get it to work, but preferably standard stuff. Thanks. -emin \_ I recommend wxWidgets (formerly wxWindows). It's got sockets and should compile on both platforms without source code changes. \_ Someone else recommended sdl_net a while ago, but beware: it's LGPL. |
11/23 |