-
12-01-2004, 12:15 PM
#181
Originally posted by Sepero
bwkaz, don't you have anything to say about this?
If it makes it easier......
<><
-
12-01-2004, 08:55 PM
#182
I really should.
It might make it "easier", but there's the minor detail of how it also makes it "wrong". (At least, "wrong" in terms of what I believe the C++ committees want. I could be wrong.)
<my standard rant on this subject: if you've already seen it, skip this bit>
The std:: namespace was added to the C++ standard library for a reason. If you pull that entire namespace into the default namespace, you eventually will trample on symbols that you've already defined in the default namespace. This will cause no end of compiler errors, until you figure out what the underlying issue is and start doing one of the following things.
</standard rant>
What you can do is only import the individual symbols you require, or (this is better, but takes more work) don't import anything, just use the std:: namespace qualifier everywhere.
And let me just say, beeps are ANNOYING.
-
12-02-2004, 01:00 PM
#183
Originally posted by bwkaz
And let me just say, beeps are ANNOYING.
I'm glad you like it
<><
-
02-16-2005, 03:31 PM
#184
GEEK Prize Challenge
The Open Source Institute is offering a programming challenge for anybody interested. The winner of the contest will get an item worth up to $40 from Amazon.com. Second place winner can get an item worth up to $25.
If you are interested in trying out your skills with over 2500 other programmers for prizes. Check out http://www.osix.net
-
02-16-2005, 03:48 PM
#185
awww, reserected just to show some other places challenges. I was all excited that it was back up. Damn, anyone have any good challenges?
if (i_forgot && this_is_about_code)
language = c++;
-
02-16-2005, 06:34 PM
#186
This one should be easy
-I use mpg123 for playing mp3's
-It recognizes Winamp & xmms generated .m3u files.
-Those files can be stripped down to include just the paths to the mp3 files. i.e. /mnt/Music/Seether/Seether - Broken.mp3
So here's the challange:
-Write a script that pipes output similar to that of ls -RN to a file with a .m3u extension.
--each line in the file should be formatted as /directory/subdirectory/sub-subdirectory/file.mp3
--will need to handle different levels of subdirectories such as:
/mnt/Music/Seether/Seether - Broken.mp3
/mnt/Music/Liz Phair/Exile In Guyville/Liz Phair - Flower.mp3
Bonus:
-Have the script prompt the user for the mp3 directory, for example, mine would be /mnt/Music
-Have prompts for the user to add all subdirectories or individual ones for different artists, etc.
The end result would enable one to generate, manipulate, and play music playlists all from the command line. How cool!
-
02-16-2005, 08:09 PM
#187
psych-major:
find /path -name '*.mp3' >file.m3u
will work, as long as none of the filenames or directories have newlines in them. (Which is actually legal in filenames, but I doubt that the m3u format can handle it.)
-
02-17-2005, 11:39 AM
#188
Duh!!!
Originally posted by bwkaz
psych-major:
find /path -name '*.mp3' >file.m3u
will work, as long as none of the filenames or directories have newlines in them. (Which is actually legal in filenames, but I doubt that the m3u format can handle it.)
That worked perfectly. I'm such a 'tard; I should of thought of it because I used to use an identical command for a batch file in DOS at my last job...
Thanks, for the quick response. I'll try to come up with something a little more challenging next time!
-
02-18-2005, 01:33 AM
#189
Challenge:
Write a script that prints only the first letter of each word that appears in a plaintext file. Only characters A-Z and a-z should be recognized. Carriage returns, punctionation, arabic numerals, etc. should all be ignored.
Demonstration:
Possible contents of the plaintext file:
Code:
How much wood would a woodchuck chuck
If a woodchuck would chuck wood?
A woodchuck would chuck all the wood he could chuck
If a woodchuck would chuck wood.
The result would be:
Code:
h
m
w
w
a
w
c
i
a
w
w
c
w
a
w
w
c
a
t
w
h
c
c
i
a
w
w
c
w
-
02-18-2005, 09:32 AM
#190
Nice one hop-frog. I thinking about trying it with a shell script, but when you mentioned no punctuation, that got my mind really wondering.
-
02-18-2005, 08:08 PM
#191
Hrmm, let's see...
Code:
sed -e 's/[[:space:]]/\n/g' file.txt | sed -e 's/[^A-Za-z]//g' | cut -c 1
perhaps?
-
02-18-2005, 09:45 PM
#192
bwkaz, you're like a regex guru or something. I don't know how you remember all that stuff!
-
02-19-2005, 10:27 AM
#193
Maybe, but I don't think there's any way I'll ever be able to decipher this one:
http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html
-
02-19-2005, 10:49 AM
#194
I can't program perl and I can't really read the code well(though, I would imagine the "?" and ":" pairs are of "if" and "else").
It looks VERY repetitive though. Is there absolutely no way they could've reduced the code with a function or two?
-
02-19-2005, 10:40 PM
#195
Well... maybe, but it's not "code" per se. It's just one enormous regular expression that's meant to be applied to a string to determine whether the string is a valid RFC-822 address. AFAIK there is no such thing as a "function" when talking about regular expressions.
I believe the (?:) stuff isn't "if-else"; I think it introduces a "non-capturing group". It groups the characters in the string being tested, without assigning them to the Perl variables $1, $2, etc. ("capturing" them).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|