jcl

Linux Experts
  • Content Count

    1299
  • Joined

  • Last visited

Everything posted by jcl

  1. jcl

    Current Time

    More or less ISO 8601. ISO C #include <time.h> #include <stdio.h> void print_time(void) { struct tm * tm; time_t t; char s[100]; t = time(NULL); tm = localtime(&t); strftime(s, sizeof s, "%Y-%m-%dT%H:%M:%S%z", tm); puts(s); } Win32 #include <stdio.h> #include <windows.h> void print_time(void) { SYSTEMTIME st; TIME_ZONE_INFORMATION tz; GetLocalTime(&st); GetTimeZoneInformation(&tz); printf("%.4hu-%.2hu-%.2huT%.2hu:%.2hu:%.2hu%+.2ld:%.2ld\n", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, tz.Bias / 60, +tz.Bi
  2. That's fine, I was indulging myself. Just so I'm clear were you asking a programming question? If you just wanted ideas for the guessing game send a private message to hitest and tell him to move this thread back to Open Chat. And maybe see if he'll delete everything but your original post to clear the air. And yell at him for both of us.
  3. That script is equivalent to $ modprobe ath_pci && modprobe wlan_scan_sta $ ifconfig ath0 up $ iwconfig ath0 essid "linksys" key 6A4601E10F858AF350C545A658 $ dhcpcd ath0
  4. Watch me over-think this and suggest an AI solution. In principle you can kludge together something like a bayesian network without too much trouble. You have two databases (arrays, lists, files, whatever floats your boat). One contains all of the objects the program knows about (e.g. baseball teams) and the other contains all of the questions the program can ask (e.g. "Is it a sport?"). Then you have a set of relations that associate a probability with each combination of questions, answers, and objects. For example, if the answer to the question "Is it a sport?" is "No" the probability that
  5. CPU is more than adequate. Core is nearly a match for the Athlon 64 at the same frequency. RAM is borderline. Apple skimps on memory. No problem, buy more. Graphics is a good question. It looks like the X1600 meets the requirements for Aero Glass but it's not supported by ATI's Vista drivers. The W2k UI should work if nothing else. Future MacTels will almost certainly easily meet the minimum requirements if Apple doesn't intentionally break compatibility.
  6. It can. That seems extremely unlikely.
  7. The warning is probably because slot is a double and function is declared as returning an int. You're casting the value of slot [edit: another weird typo, I need to run some tests] to int and then assigning it back to a double which is then implicitly converted by the compiler to int. g++ generates warnings when it does implicit conversion. The warning doesn't necessarily mean there's anything wrong: fp to integral conversion is well-defined iff the integeral type can exactly represent the whole part of the fp value. You're (probably) going to get the same result with or without the cast so yo
  8. Has anyone confirmed that WinXP will boot on the MacTels? Apple is using the Extensible Firmware Interface instead of the PC BIOS. Windows currently supports EFI only on Itanium. EFI defines a Compatibility Support Module that provides BIOS emulation but it's optional.
  9. There was nothing inadvertent about it
  10. KDE and GNOME are desktop environments. XDM, GDM, and KDM are display managers. Pedantry is fun.
  11. That would exclude many popular political debates. Intelligent design, abortion, death penalty, terrorism, the role of religion in politics, etc.
  12. Adblock, DOM Inspector, and I've been trying a few of the RSS aggregators.
  13. The author should be shot for claiming that hard reboots are safe-ish. His testing method alone is worth at least a stabbing.
  14. It sounds like he discovered variables.
  15. That's normal. Firefox leaks memory like a seive.
  16. jcl

    Wmf Deliberate

    jcl@ubuntu:~/src$ cat h.asm section .data msg db 0x57,0x6F,0x72,0x73,0x68,0x69,0x70,0x20,0x4D,0x65,0x2E,0xa msglen equ $ - msg section .text global _start _start: mov eax, 4 mov ebx, 1 mov ecx, msg mov edx, msglen int 0x80 mov eax, 1 xor ebx, ebx int 0x80 jcl@ubuntu:~/src$ nasm -f elf h.asm jcl@ubuntu:~/src$ ld -o h h.o jcl@ubuntu:~/src$ ./h Worship Me. Seriously, it's not a big deal. Lots of people go through an assembly phase. Most of them outgrow it and move to better tools. Gibson stands out because he's an evangelist with a talent for self-promotion. (Or a self-pro
  17. The code that uses display is fine, you just need to declare it as something else. Both int display[] = {0,0,0,0,0,0,0,0}; vector<int> display(8, 0); would be fine. (I can't remember if C++ automatically initializes array elements so I did it the old-fashioned way. The vector ctor above creates an eight element vector with elements initialized to 0). The vector solution is preferrable but if you aren't familiar with the container classes you might want to stick with C arrays.
  18. You seem to have changed quite a bit more than that conditional judging from the compiler output. Working from what you posted. #include <iostream> #include <fstream> #include <string> using namespace std; int check_freq(double x); int main() { double Data; string display ("00000000"); ofstream myfile ("test.txt"); Should be an ifstream, I believe if (myfile.is_open() ) { while (! myfile.eof() ) { getline (myfile,Data); You probably want myfile >> Data;. The source you posted and the source you ran through GCC used different getline()s (the global from &
  19. This one is very helpful if you have a slow computer or a computer with a slow harddrive. I did this on my old laptop and it has helped slightly but noticeably (barely). Do you happen to know why? [Clarification: Do you happen to know which directories were responsible?]
  20. jcl

    Wmf Deliberate

    Or some part of the horse, anyway.
  21. The syntax foo[m:n] will give you a slice of the list foo from indices m (inclusive) to n (exclusive). len(foo) will give you the length of the list foo. Sooo... for e in foo[0:len(foo)/2]: print e will print the first half the list. Careful if len(foo) is odd: integer division rounds down. Same trick works with strings.
  22. Nope. That's a single-core Pentium 4 with Hyper-Threading. You're seeing the two HTT logical (as opposed to physical) processors.
  23. Speed Up Boot Times I - Probably safe but of dubious value. Speed Up Boot Times II - Safe, negligible value, possibly annoying. Speed Up Boot Times III - Potentially slightly unsafe and of dubious value. Free Up Memory - Safe but brain damaged. Ensure XP Is Using DMA Mode - Potentially unsafe if the device doesn't support DMA but potentially very beneficial. This is the only item on the list that's likely to have a noticeable effect. It's also the only item that can cause serious, possibly irreparable, damage. Add Correct Network Card Settings - No idea what this does. Remove Annoying Delete C
  24. AFAIK the PIII topped out at 1.4 GHz.
  25. POSIX requirement and Unix tradition. Text lines are terminated by ASCII LFs (0x0a). (Fun project: A sequence of characters that isn't terminated with a newline isn't a line of text according to POSIX. Count how many text files you have that technically aren't text files.). On the other hand CRLF pairs are not uncommon in display and network protocols.