jcl

Linux Experts
  • Content Count

    1299
  • Joined

  • Last visited

Everything posted by jcl

  1. Well, that took forever. I said yesterday at the Forums That Shall Not Be Named that I surprised how long it had taken for someone there to mention the rumors that were spreading like wildfire over the weekend. When the threads finally appeared there, BT became the last place in the universe where people weren't discussing the move. Anyhoo, it means zip for the system architecture or user-experience. The x86 and PPC versions are nearly identical.
  2. Erk. C and Python are miles apart, syntactically and semantically. No non-trivial code can shared between them.
  3. Logical OR. A || B is true if either A or B is true. The shell 'short-circuits' the conditional, so B is only evaluated when A is false, making it a useful control structure. For example, if you have some expression that can potentially fail, you can use || to add simple error-handling code like so do_something || handle_error The right-hand side will only be executed if the left-hand side fails. The shell also provides the logical AND operator '&&' and NOT operator '!'. A && B is true iff both A and B are true, and short-circuits so that B is evaluated only if A is true.
  4. jcl

    Ubuntu Dial Up

    I always use sudo without password authentification. On those occasions when typing 'sudo' becomes tedious I just spawn a privileged shell (sudo bash).
  5. jcl

    Ubuntu Dial Up

    What kind of problem?
  6. Yeah. I have no idea how, but I know you can. Edit: It seems that these both provide the equivalent of command substitution: import os output = os.popen('command').read() import commands output = commands.getoutput('command') Except for mounting, everything in your script could be written in Python, so there wouldn't really be much need for this feature.
  7. The kind that was rarely in class
  8. Ah. That version might not have the needed ctor. Incidentally, VC++ didn't conform to ISO C++ until very recently so if you continue to use it you may find yourself adapting a lot of code. The Mozilla C++ portability guide is worth looking over.
  9. I don't know why this is wrong as on the MS developer site it show the same example. It compiles without complaints with the Visual C++ Toolkit 2003. find() is defined as returning sting::npos if the search fails. string::npos is defined as a value of type string::size_type, initialized according to the standard to a value -1. size_type is unsigned, so -1 produces the largest value of size_type (-1 is all-bits-one). The left-hand side of the || handles the case where locationOfChar is interpreted as a signed value (-1) and the right-hand side handles the case where it's an unsigned value.
  10. jcl

    Bush's Resume!

    Actually I think we've all been remarkably restrained. No flames directed at other members, no real argument about the content of the original post, no comments that were really over the top by current standards. Not even much disagreement over emotionally charged issues. The initial post did worry me because it would be pure flame bait in most forums, but either political opinion here is fairly uniform or the people who disagree are biting their tongues.
  11. jcl

    Bush's Resume!

    Right. Among the "political issues" I was considering was the rather high probability that there's no way to provide useful foreign aid as long the majority of the third-world nations exist in their current form. They're politically, economically, and socially unable to make use of it, usually through no fault of people in need. Vast amounts of aid are diverted to politicians for their own gain or to make war on their enemies (foreign and domestic), distribution of what gets through is hampered by the lack of infrastructure and general chaos that's unfortunately not uncommon, and there are
  12. jcl

    Bush's Resume!

    The world isn't that simple. Humanitarian aid is frequently misused on the receiving end and sheer size of the bureaucracy required to administer a muti-hundred-billion dollar aid system would virtually guaranty that the money would be mishandled. Not to mention that no one really has a clue about how to provide large-scale relief. It is not unheard of for relief operations to make things worse. (One possible example of the last point is a theory that food and medical aid to Africa has actually triggered widespread famine by providing enough resources for the population to grow beyond the
  13. jcl

    Bush's Resume!

    The US has proportional voting. The distribution of seats in House is approximately proportional to population and the size of the Senate is proportional to the number of states. Three years, actually. A defection in '01 put the Senate at 50-49-1 for a year and a half. Prior to that there was a period of only about six months when both branches were controlled by the GOP. The last time before that was the 83rd Congress in 1953-5.
  14. Yeah. It was just supposed to incite interest in the standard library. Right. You can combine the editing and reversal in one loop if you wish.
  15. The problem is that you're copying the entire string into CheckHolder reversed, including the terminating null character. The null char is inserted at CheckHolder[0], so CheckHolders ends up being a C string of length 0. You need to start copying from the last non-null character and then insert a null at the end of the reversed string. It is a good idea to the use the string class whenever possible. C strings are a legacy feature. Excursus: It's probably beyond the scope of your assignment, but C++ makes this fairly easy if you use more of the features of the standard library: #include <
  16. It doesn't really matter as long as you're aware of the potential for problems. AFAICT most people still use backticks, at least when they're interacting with the shell. Two keystrokes and broken semantics beats three shifted keystrokes and correct semantics.
  17. Perl's a nightmare, but it can do everything. PHP should be simpler than Perl for what you're doing. It's a domain-specific language focused on server-side scripting, so within that domain it should be easier to use than a general-purpose language. It certainly shouldn't be more difficult than Perl, since it evolved from a set of Perl scripts and so presumably improved on Perl. It is supposedly about as weird as Perl, though.
  18. Perl and Ruby. Probably others. POSIX recommends against using them because they subtly and needlessly change the semantics of the shell language. For example, ~ $ echo '\$x' \$x ~ $ echo $(echo '\$x') \$x ~ $ echo `echo '\$x'` $x Why the difference? No idea.
  19. Okay. The reason I was a bit dubious is that there are people who use server-side scripting when it isn't really necessary and complicate their lives tremendously, but if you've already been advised that it's needed then more power to you. PHP is close to the de facto standard and from what I've seen isn't too horrible. I would use Ruby or Perl myself, but they might require a more effort to learn, and the end result will be the same. (Ruby is arguably the the easiest of the three to learn as a language, but you have get fairly deep into it before you can use for Web scripting, and it's is
  20. for i in $(sed -n '/\.mp4$/p' /tmp/update); do cp $SAMBA/$i $FMOVIES; done
  21. Are you sure? Your first priority should be (X)HTML and CSS. After you have begun work on the site it will become clear what, if anything, you need to supplement HTML. PHP and HTML have an historical relationship but nothing in particular in common. To use PHP as a server-side scripting language you need to know both.
  22. There are a couple bugs. If SalesDump() is called before any records have been stored to the data files, the input operation salesfile >> record_name >> sales >> commision >> ws; will fail, leaving the variables in their default state. record_name is uninitialized, so you end up with a garbage record  Eü· aÿ· 04.85728e-270 . (The string may be different on your machine, but if you examine the program under a debugger it will correspond to the initial value of record_name.) The problem is that the EOF flag isn't set until an EOF is read from the s
  23. Not sure what could be wrong. You might try to produce a minimal test case. Slice code out of the program until it starts working or you've reduced it to a single expression. Edit: Just to be clear, is it a compile-time or run-time error?
  24. Huh. It builds and runs fine with both gcc -std=c++98 -pedantic and icc -strict_ansi. It should be fine unless both compilers are broken. I'll add this to the list of things to check in the standard. Edit: Does it work if you change that line to cout << s; cout.flush(); ?