|
2009/1/13-22 [Computer/Theory] UID:52367 Activity:kinda low |
1/13 I am writing a commandline parser for a class and I could use some tips for algorithms to use. (The project is over and done so I am not cheating, but I am dissatisfied with my end result.) I STFW and didn't come up with too much I liked. I read the source for some shells like tcsh and that is *WAY* too complicated and relies on a lot of other code. I know that browsers and other apps have parsers, too. Is there some simple algorithm they use? I am more interested in algorithms than any implementation itself. \_ Are you looking for something like getopt? Or is this more "read this line and figure out what programs to run/ what outputs to pipe into other outputs"? And what language are you using? \_ C language. I am interested in how something like getopt is designed in terms of its algorithm, particularly for multi- character options. Like how it distinguishes -v from -vv from -vvv for example? Does it read ahead? I am trying to do this without using other functions like strtok() but actually parsing a character at a time. I know I can go read the getopt source, but this is not that complicated. There must be some simple parsing algorithms these parsers implement. \_ You probably want a trie and a simple state machine. \_ Why would you do it a character at a time? Do you mean you don't know how to implement something like strtok? \_ Yes, that's what I mean. What algorithm does it use? Are there better choices? What if I wanted to implement a better strtok or a better getopt? \_ Well, that's not really the interesting part. If you just look at strtok's header it wants you to specify what constitutes a token delimiter. So -v versus -vv is pretty obvious I think... \_ I was once interested in parsing mathematical expressions. However, rather than rolling my own, I just made use of python's expression parser. This proved a good way to parse expressions with very little coding on my part: all I had to write was a little glue/wrapper. \_ Greed -- for lack of a better word -- is good. \_ why does gordon gecko get in more trouble than madoff? \_ If you're interested in this from a theoretical perspective, either take CS164 or try reading the Dragon Book. It's way overkill for basic command line parsing, but you said you were interested in the theory of parsing... that's what a lot of CS164 is about. \_ What is the title of CS 164? Compilers? \_ What is the title of CS 164? \_ http://letmegooglethatforyou.com/?q=CS+164 \_ Back in Spring '92 it was "Programming Languages and Compilers". I took it under Fateman. We only learned a lot about compilers, but very little about programming languages. Other schools have separate classes for the two. |
2009/1/13-15 [Politics/Foreign/Europe] UID:52368 Activity:kinda low |
1/12 I'm thinking of going to the Caribbeans for honeymoon, then maybe Disneyworld. This is for mid-March. Any advice? I'd like to make it as simple as possible... the less work, the better. \_ Isn't Disneyworld for children? \_ Go to EPCOT where they have beer and hot foreign chicks. \_ I went to Disneyland with my wife twice (October and June). Hot MILFs everywhere. But if you go in cold months you probably won't see their bodies under thick clothings. Anyway OP is talking about honeymoon, so MILF or not is not an issue. Plus Disneyworld in another state may be different. probably won't see their hot bodies under thick clothings. Anyway OP is talking about honeymoon, so MILF-or-not is not an issue. Plus Disneyworld outside of SoCal may be different. \_ I wasn't talking about MILFs, but the people working there. They are young, attractive, from foreign countries, and interested in seeing something other than boring Orlando. This hot Moroccan girl started hitting on me when she found out I was from California and told how she wanted to visit, etc. If I had been single I would've offered to host her and show her around. Same thing happened with this Swedish girl who I actually did meet (she was headed here anyway as it turned out) and show around. EPCOT is like a big European hostel for bored, but adventurous (or they wouldn't have signed up) youth with loose European morals. That doesn't help OP, but does address the "for children only" comment. \_ Did you actually end up "showing her around"? \_ If you're interested in Disneyworld, this may not be your speed, but: http://www.slickrock.com -tom |
2009/1/13-22 [Recreation/Food] UID:52369 Activity:nil |
1/13 I need to make a main dish that starts with 'U' for a potluck. All I've come up with is Udon and Unagi. Neither of which really work for a potluck. Any suggestions? \_ Umeboshi. Uno pizza. Uni. Urchin. Ethnic food from Uganda or Ukraine or Urugray, or the United States of America for that matter. Any new dish you invent with a label "U name it!". Any new dish you invent with a label "Unameit". \_ Unmeatloaf? \_ Sounds unamerican. \_ Ugli fruit \_ That's not a potluck, it's a pot-stupid \_ Upside down cake. \- Upma, Uttapam, udder tacos [i am not making that up, YMWTGF(taco, ubre)] \_ Uncle Ben's (yes I cheated) http://www.unclebens.com/recipes \_ Ultra Slimfast or unleavened bread |
2009/1/13-22 [Uncategorized] UID:52370 Activity:low |
1/13 Whatever happened to "the economy is going to blow up like the Death Star" guy? \_ I'm still here. Let's say C = The Death Star We are about to start: The Empire Strikes Back Starring Barack Obama as Lando Calrissian \_ I will pay you five dollars to go away. \_ WHOA, IAN MCKAYE has a soda acct? \_ I did, but someone asked \_ Here's your opportunity to make five bucks. \_ pay the guy to stop asking \_ C? \_ Citigroup \_ which death star? The first on in Ep IV or the second in Ep VI ? \_ we're still in ep IV. Return of the Jedi is later. |
2009/1/13-22 [Computer/HW/Laptop] UID:52371 Activity:nil |
1/13 I've been using Ubuntu as my primary laptop for 3-4 month. But there are still alot of things i need to learn... for example, after an application crashes, where do I look for any sort of logs that might give me a clue what happened? how linux monitor the crashes? So far, i had two bad episode of thunderbird trying to log onto my company's remote LDAP server and actually crashed the entire system... (as if some pull the battery out of my laptop kind of crash). what kind of logs do I look for? Also, when i type dmesg, what text file does it display? thanks \_ If your whole system is crashing, that's a kernel problem, not anything related to your applications. Start by running "cat /proc/sys/kernel/tainted" to see whether you're using any unsupported proprietary drivers. (It sounds like your problem isn't related to applications, but if you ever do want to debug an application crash, you can enable core dumps by adding the line "ulimit -c unlimited" to your .gnomerc file. It'll take effect next time you log in; after that, when any application crashes, it'll leave a file called "core" in its current directory. You can debug it by running "gdb application core".) The data that dmesg displays comes directly from the kernel (not from a file on disk), but it's logged in /var/log/dmesg. \_ thanks!!! kngharv |
2009/1/13-22 [Recreation/Dating] UID:52372 Activity:nil |
1/13 How does one get an officiant for marriage? Do they always have to spend like a day or two talking to the couple? \_ Not unless you're asking for some kind of religious thing. Try Yelp. \_ Ask a friend to join the Church of SubGenius. \_ all they need is a certificate from the city, for the day. \_ city clerk, skip the rest of the stuff |
2009/1/13-22 [Politics/Domestic/President/Bush] UID:52373 Activity:nil |
1/13 Soon, GWB will no longer be a president. Is his approval rating better or worse than Nixon's? \_ just put him in trial for crime against humanity... his approval rating will rise :D |
2009/1/13-22 [Finance/Investment] UID:52374 Activity:nil |
1/13 http://www.cnn.com/2009/CRIME/01/13/missing.pilot.profile/index.html Financial managers are so awesome. People like this makes me want to pull my money out of 401K. You just don't know what kind of people are managing your asset. \_ No. This is not a reason to pull your money out of your 401k. This is the reason why you don't give your financial advisor/wealth manager trading authority in your accounts. The fund managers who run the funds in your 401k are much more stringently regulated than the Bernie Madoffs of the world. The brokerage that holds your account is reasonably regulated as well. This guy is someone people hired as an additional layer on top of that, and gave authority to move assets around as needed. The lesson is that if you hire someone for their investment advice, place the trades yourself (and never give them the authority to do it for you). \_ Or just use low-cost stock/bond index funds for 90% of your 401k and "play" with the other 10%. \_ what about Mervyn's employees with 401(k)'s? It's also the same company that manages a whole lot of other retail employees plans. As I understand it, rollovers have been delayed for a couple months already because of "illiquid assets" in funds with "Stable Value" in the same, and significant "administrative fees" have been nailing them since. |