You are not logged in.
January Programming Competition
The goal of this months programming competition is to create a simple utility for reformatting one string given a second formatting string. Each person may create a custom syntax for the formatting string or simply duplicate an already existing one. Please use a logical formatting syntax and nothing too cryptic. For example "tar.gz|tgz" could be an example formatting string that would replace all instances of "tar.gz" with "tgz" in the source string.
The following are requirements for each difficulty level. You may expand your program beyond the scope of these guidelines but your program must do at least the following:
Novice - You must create a simple utility that can match and replace characters in a source string with characters from a formatting string. You do not have to worry about case. This is the basic requirement and may be met using any programming method of the users choice. Your program may not simply call a prexisting program. It must do the work internally. Have fun!
Intermediate - Your program must be able to do everything in novice category and also provide an option (maybe a command line switch) to make the process case sensitive. Note that you should be able to do both a case sensitive and unsensitive operation. Also, you must provide a means of setting the range the formatting operation, instead of always operating on the entire string.
Advanced - You must complete all the above with the addition of processing of pre-defined fields. For example, "001|%d" could mean to replace "001" with the current date. This is a simplistic example, but you get the point. You may create as many of these fields as you wish and these don't have to be limited to static information just the date. Something like a counter (numeric or alphanumeric) would be nice too.
Remember, these are basic requirements. You should probably make a better program than I've outlined here. Also, language is not a factor here and zsh/bash style scripts meet the requirements.
Due Date: Sat, January 28
Offline
I'm kind of confused. This seems more like a 1 line command than an application. Is there something I'm just not getting?
Writing stories for a machine.
Offline
That's a really nicely laid out post iBertus, thank you for following the guidelines - you've set a good example
I'm kind of confused. This seems more like a 1 line command than an application. Is there something I'm just not getting?
You've got to write a utility that hase sed-like capabilities dust... I don't know how else iBertus could've explained it, lol! It's not something you could do in one line (unless you use perl and start sufficiently far to the left )
.oO Komodo Dave Oo.
Offline
Heh, now I understand.
Writing stories for a machine.
Offline
For any moderators reading: Would it be possible to sticky each monthly programming competition, this one included?
.oO Komodo Dave Oo.
Offline
For any moderators reading: Would it be possible to sticky each monthly programming competition, this one included?
No problem, but we'll make just one month sticky at a time though, eh?
Dusty
Offline
Komodo wrote:For any moderators reading: Would it be possible to sticky each monthly programming competition, this one included?
No problem, but we'll make just one month sticky at a time though, eh?
No shit sherlock! I meant in the same way as you do for monthly screenshot threads, big D
.oO Komodo Dave Oo.
Offline
This seems more like a 1 line command than an application.
That would be a perfectly valid submission
I picked this type of program because it's a simple starter program for the first competition. Also, it can be expanded greatly by those who feel inspired to over achieve.
Please note a revision to the current guidelines... look up!
Offline
Please note a revision to the current guidelines... look up!
Awwwwwww, that blows away my entire idea of submitting sed wrapped in a shell script. Party-pooper!
Offline
iBertus wrote:Please note a revision to the current guidelines... look up!
Awwwwwww, that blows away my entire idea of submitting sed wrapped in a shell script. Party-pooper!
:twisted: I knew that somebody was going try that :twisted:
Offline
Heh - novice is like 15-20 lines of bash, woot - I'll give you something in all bash... then haskell
Offline
then haskell
you are evil!
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
One question: if it is not allowed to write a wrapper around sed, what is allowed? I mean, if you do a perl/python implementation you're basically writing a wrapper around s/// or sub(), right?
Offline
I agree with LB06. I know it's difficult to come up with challenges (just for the record, I've been trying to think some up myself), but I think this challenge is dead easy in some languages, and tough in others. That's fine for those with multiple languages under their belt, and can pick the best one for the job.
I personally think that making challenges that are actually 'applications' would be better, rather than 'programs', if you get my drift.
No offense to those involved - I promise.
Offline
perhaps the challenge should be restricted to writing it in Bash? That way no string-related libraries could be used...
.oO Komodo Dave Oo.
Offline
yay. lets start something cool...then put a bunch of silly rules on it, and make it as unfun as possible.
hooray for needless administrativa!
If people only know one language..then let them use that language..or.. gasp.. learn a new one!
I should write mine in perl just to spite you all..
*devil horns*
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
One question: if it is not allowed to write a wrapper around sed, what is allowed? I mean, if you do a perl/python implementation you're basically writing a wrapper around s/// or sub(), right?
I think the point is that sed easilly supports the intermediate and advanced portions... yes the novice stuff is very short, code wise, but for a novice it brings to light some very important techniques. I think the true point of this is when you start adding "%foo" fields and case (in)sensitivity stuff.
Offline
LB06 wrote:One question: if it is not allowed to write a wrapper around sed, what is allowed? I mean, if you do a perl/python implementation you're basically writing a wrapper around s/// or sub(), right?
I think the point is that sed easilly supports the intermediate and advanced portions... yes the novice stuff is very short, code wise, but for a novice it brings to light some very important techniques. I think the true point of this is when you start adding "%foo" fields and case (in)sensitivity stuff.
True. Being a perl-novice, I figured that this was the perfect opportunity to make myself a bit familiar with Perl. The actual replace part is no longer than 5 lines, but I've already learned a lot about pipes and command line args.
Btw, I like this assignment. I was just asking if the script that I was working on would be valid, but on second thought it doesn't really matter to me .
Offline
I think the sed constraint was basically to say "use the utilities provided by the language. I mean, even in C you could just use system("sed blah blah");
Offline
yay. lets start something cool...then put a bunch of silly rules on it, and make it as unfun as possible.
hooray for needless administrativa!
Since when did someone put silly rules on it? The specifics of each month's competition are up to the poster, not anyone else, so the 'administrativa', as you so espagnolically put it, isn't involved. Any suggestions I make are just that - suggestions - and have no more weight or authority than anyone else's.
It really DOESN'T matter what people code it in, since they won't win if they do crap code that steals functions from a library, and doesn't implement the functionality itself. Plus, as LB06 and phrakture pointed out, the objective is to learn
.oO Komodo Dave Oo.
Offline
espagnolically?
??
isn't "espagnol"..the french word for.. spanish?
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
Hilarious - I have a javascript implementation. Haskell fails for having some of the worst string handling ever.
Offline
I'm glad everyone seems to be having a good time with this. Yes, the goal is to learn and have fun! I did not want to place any language restrictions on this because the final submission will provide us all with a library of examples for many different languages.
Offline
Yeah, I enjoy this one alot - it's not that difficult of a thing to do, so it gives me the chance to try some crazy obscure stuff (I made a tclsh version too, but it sucked)
Offline
Damn, phrak! You going for the prize in every category?
Offline