Sunday, March 17, 2013
EOS 48: List Editing
Surprisingly, this is not a programming discussion.
This was another one-day-wonder. I like it. I will probably resume full color in a little over a month, and then I will try to get a little something different going. I have plenty to say, but I will go to bed, instead.
Thursday, March 14, 2013
Programming Challenge
So, the other day I was writing a script to generate some macros, when I realized how meta that whole thin is. I guess that is the right word. Well, its the word the kids love, and we are all about making money off of children. Except I don't make money off of this thing. Anyway, feeling the need to make superfluous code, I wrote this.
It was pretty straightforward except I had to learn how to triple nest printed strings.
I hereby present you with a challenge:
First: Figure out what I did did there.
Second: get this to run on your machine.
Third: Create something even more convoluted to do the same task.
There are some stipulations.
1: What you send me must be a single: self contained BASH scrip file. I should only type one command to run the entire thing. No support files allowed!
2: It may employ any standard libraries, compilers, software, and commands that you would expect to find on an academic engineering network. However, assume that I have not customized them at all.
3: The output must be recognizable English. (I am the judge of "recognizable.")
4: Assume that the network connection is turned off for the run.
5: There is no way in hell I am granting that thing root access.
6: I am not obligated to try an run any of these. If I do, then I will grant some leeway if you have a reference that requires an filepath.
You can send the responses to crowbar563@mildlymiffed.com or you can just paste them into the comments.
If anyone actually, responds I will be pleased.
Hopefully, I learn something.
#!/bin/bash
echo "#include <stdio.h>" > hello.cpp
echo "#include <stdlib.h>" >> hello.cpp
echo "#include <string>" >> hello.cpp
echo "#include <fstream>" >> hello.cpp
echo "#include <iostream>" >> hello.cpp
echo "//This program generates an output fiel containing the source code for a 'Hello World!' program!" >> hello.cpp
echo "int main(void)" >> hello.cpp
echo "{" >> hello.cpp
echo " FILE * output1;" >> hello.cpp
echo " output1 = fopen(\"hello.f\",\"w\");" >> hello.cpp
echo " fprintf(output1,\" PROGRAM CASE\\n\");" >> hello.cpp
echo " fprintf(output1,\"c This is a \'Hello World!\' Program!\\n\");" >> hello.cpp
echo " fprintf(output1,\" PRINT *,'Hello World!'\\n\");" >> hello.cpp
echo " fprintf(output1,\" STOP\\n\");" >> hello.cpp
echo " fprintf(output1,\" END\n\");" >> hello.cpp
echo " fclose(output1);" >> hello.cpp
echo "}" >> hello.cpp
g++ hello.cpp -lm -O2 -g -o hello1
./hello1
gfortran hello.f -lm -O2 -g -o hello2
./hello2
echo "#include <stdio.h>" > hello.cpp
echo "#include <stdlib.h>" >> hello.cpp
echo "#include <string>" >> hello.cpp
echo "#include <fstream>" >> hello.cpp
echo "#include <iostream>" >> hello.cpp
echo "//This program generates an output fiel containing the source code for a 'Hello World!' program!" >> hello.cpp
echo "int main(void)" >> hello.cpp
echo "{" >> hello.cpp
echo " FILE * output1;" >> hello.cpp
echo " output1 = fopen(\"hello.f\",\"w\");" >> hello.cpp
echo " fprintf(output1,\" PROGRAM CASE\\n\");" >> hello.cpp
echo " fprintf(output1,\"c This is a \'Hello World!\' Program!\\n\");" >> hello.cpp
echo " fprintf(output1,\" PRINT *,'Hello World!'\\n\");" >> hello.cpp
echo " fprintf(output1,\" STOP\\n\");" >> hello.cpp
echo " fprintf(output1,\" END\n\");" >> hello.cpp
echo " fclose(output1);" >> hello.cpp
echo "}" >> hello.cpp
g++ hello.cpp -lm -O2 -g -o hello1
./hello1
gfortran hello.f -lm -O2 -g -o hello2
./hello2
It was pretty straightforward except I had to learn how to triple nest printed strings.
I hereby present you with a challenge:
First: Figure out what I did did there.
Second: get this to run on your machine.
Third: Create something even more convoluted to do the same task.
There are some stipulations.
1: What you send me must be a single: self contained BASH scrip file. I should only type one command to run the entire thing. No support files allowed!
2: It may employ any standard libraries, compilers, software, and commands that you would expect to find on an academic engineering network. However, assume that I have not customized them at all.
3: The output must be recognizable English. (I am the judge of "recognizable.")
4: Assume that the network connection is turned off for the run.
5: There is no way in hell I am granting that thing root access.
6: I am not obligated to try an run any of these. If I do, then I will grant some leeway if you have a reference that requires an filepath.
You can send the responses to crowbar563@mildlymiffed.com or you can just paste them into the comments.
If anyone actually, responds I will be pleased.
Hopefully, I learn something.
Sunday, March 10, 2013
Time to wake up
The time change got me. It wasn't like I was really late for anything, but waking up late always haunts me. This is mainly because it is the end to one of the four activities that I actually do these days. Eat, sleep, run, and work. Don't go to grad school if you aren't willing to sacrifice everything for your craft, but that will soon be ending. Thus, I must find a real job and get up on time. This necessitates an alarm clock and the ever important question, "what sound shall it make." Now, assuming that we live in a world where alarm clocks will play whatever we want them to, I will run down a list of my top 10 alarm clock songs.
10: "Here it Goes Again" by OKGO
Let us start this thing off with a simple fact. You don't want to be up, but like every day, here it goes again. It is kind of a cartoon thing to say. My advice is to pretend you are in a cartoon as long as you possibly can each morning. I don't know what that will get you, but it has worked for me so far.
9: "Manic Monday" by The Bangles
This song would be higher, but it really is only tied to one day a week. Still, it is surprisingly sunny enough to get you going, and let's face it. On Monday, you need all of the help you can get. I am particularly terrible with Monday mornings, probably why I haven't worked one in years. Ug, if I have to take a forced leave of absence, Monday mornings are what I am knocking off.
8: "What's Up" by 4 Non Blondes
I find myself waking up and singing this song. It's pretty awesome 90's music and useful during the early morning confusion. If you find yourself sleeping through it, you can try the more up-tempo He-Man version. It's got that great disco sound to get you moving. If you find yourself sleeping through that, there is the 10 hour He-Man version. If you find yourself sleeping through that, then seek help. You are either (A) partying harder than Jon St. John, (B) experiencing a severe sleeping disorder, or (C) in a coma.
7: "Talk Dirty to Me" by Poison
Speaking of comas, this is the proper song to listen to while in a coma. I am not saying that it will wake you out of a coma, but according to an episode of "Scrubs" this is the proper one to hear once a day when in such a condition, and Ted and Carla can't be wrong.
Now, my suggestion is to not use the completely awesome Heavy Metal original. Instead, record an a cappella version of yourself doing all of the parts. Come on. Don't be embarrassed. No one would dare make fun of someone in a coma for bad singing, at least not until you have recovered, but then hey, you just got out of a coma. So, they can go pound sand for all you care.
6: "Blitzkrieg Bop" by The Ramones
If you need a throw you out of bed song, this is the one. It is kind of short. So put it on repeat. I, personally, would rig the snooze button to have it start another loop concurrently with the previous one. Keep hitting the snooze button until the indecipherable cacophony is too much to handle.
5: "Everyday is a Winding Road" by Sheryl Crow
This one took me a while. Then, it hit me and the list was complete. Anyway, sometimes, waking up isn't so bad. Sometimes, it is exciting and full of possibility. Usually, these days are the weekends, but they can be any day. Maybe, that is the lesson here. I dunno.
4: "Good Morning Good Morning" by The Beatles
I am not putting a link. If you don't have this song, take a minute and a dollar and download it, or take several minutes and several dollars, and run out to the store and get the album (Sgt Pepper's Lonely Hearts Club Band). Are you back? Now, listen to it? Done? Good. No explanation necessary. I mean, they would woke up the shuttle astronauts with this song, and you didn't have it until just now. Shame on you. Kids these days...
3: "Chelsea Morning" by Neil Diamond
Listen to this song in Chelsea Michigan, on Chelsea Ave. in Rockford Illinois, in the Chelsea neighborhood of New York City, on the Chelsea River in Ireland, or if your name is "Chelsea." If none of those apply, just image that one does and that it is a perfect day. A little delusion can go a long way, or at least until you get a hot shower and some coffee. (If you don't have this in your Neil Diamond collection, what is wrong with you?)
2: "I Got You, Babe." by Sonny and Cher
You know why this song is here. I suppose if you you ever think you may need a do-over. Just play this song on the day of interest, then that night set it to play the next morning. That should be enough to create a time loop, right? Hmm, I've heard this was the plot to "Primer," but no-one is actually clear on that.
1: "It's the End of the World as We Know it" by R.E.M.
There was no question in my mind what was going to be number 1. Part of it is an homage to Independence Day, and part of it is how I like to wake up. It's not enough for me to just take on the day, I have to take on the end of the world. Besides, everything is falling apart anyway. So, you might as well pump yourself up for it. Now, there is a question of version. I know what you are thinking, "How can anything surpass the original REM?" Well, I have to admit that there is something to be said about the Suicide Machines version. First off, I like the faster tempo, and it is part of a great FLCL music video. By the way, if you are not familiar with my favorite Anime (FLCL), the you are missing out. It explains a lot about me.
OK, that is about it. I admit that I should have substituted "Ants Marching" for "Chelsea Morning" but I just didn't want to. You can pretend that things are different in your own little world. I won't stop you.
Also, look to the next post to contain a little programming challenge.
10: "Here it Goes Again" by OKGO
Let us start this thing off with a simple fact. You don't want to be up, but like every day, here it goes again. It is kind of a cartoon thing to say. My advice is to pretend you are in a cartoon as long as you possibly can each morning. I don't know what that will get you, but it has worked for me so far.
9: "Manic Monday" by The Bangles
This song would be higher, but it really is only tied to one day a week. Still, it is surprisingly sunny enough to get you going, and let's face it. On Monday, you need all of the help you can get. I am particularly terrible with Monday mornings, probably why I haven't worked one in years. Ug, if I have to take a forced leave of absence, Monday mornings are what I am knocking off.
8: "What's Up" by 4 Non Blondes
I find myself waking up and singing this song. It's pretty awesome 90's music and useful during the early morning confusion. If you find yourself sleeping through it, you can try the more up-tempo He-Man version. It's got that great disco sound to get you moving. If you find yourself sleeping through that, there is the 10 hour He-Man version. If you find yourself sleeping through that, then seek help. You are either (A) partying harder than Jon St. John, (B) experiencing a severe sleeping disorder, or (C) in a coma.
7: "Talk Dirty to Me" by Poison
Speaking of comas, this is the proper song to listen to while in a coma. I am not saying that it will wake you out of a coma, but according to an episode of "Scrubs" this is the proper one to hear once a day when in such a condition, and Ted and Carla can't be wrong.
Now, my suggestion is to not use the completely awesome Heavy Metal original. Instead, record an a cappella version of yourself doing all of the parts. Come on. Don't be embarrassed. No one would dare make fun of someone in a coma for bad singing, at least not until you have recovered, but then hey, you just got out of a coma. So, they can go pound sand for all you care.
6: "Blitzkrieg Bop" by The Ramones
If you need a throw you out of bed song, this is the one. It is kind of short. So put it on repeat. I, personally, would rig the snooze button to have it start another loop concurrently with the previous one. Keep hitting the snooze button until the indecipherable cacophony is too much to handle.
5: "Everyday is a Winding Road" by Sheryl Crow
This one took me a while. Then, it hit me and the list was complete. Anyway, sometimes, waking up isn't so bad. Sometimes, it is exciting and full of possibility. Usually, these days are the weekends, but they can be any day. Maybe, that is the lesson here. I dunno.
4: "Good Morning Good Morning" by The Beatles
I am not putting a link. If you don't have this song, take a minute and a dollar and download it, or take several minutes and several dollars, and run out to the store and get the album (Sgt Pepper's Lonely Hearts Club Band). Are you back? Now, listen to it? Done? Good. No explanation necessary. I mean, they would woke up the shuttle astronauts with this song, and you didn't have it until just now. Shame on you. Kids these days...
3: "Chelsea Morning" by Neil Diamond
Listen to this song in Chelsea Michigan, on Chelsea Ave. in Rockford Illinois, in the Chelsea neighborhood of New York City, on the Chelsea River in Ireland, or if your name is "Chelsea." If none of those apply, just image that one does and that it is a perfect day. A little delusion can go a long way, or at least until you get a hot shower and some coffee. (If you don't have this in your Neil Diamond collection, what is wrong with you?)
2: "I Got You, Babe." by Sonny and Cher
You know why this song is here. I suppose if you you ever think you may need a do-over. Just play this song on the day of interest, then that night set it to play the next morning. That should be enough to create a time loop, right? Hmm, I've heard this was the plot to "Primer," but no-one is actually clear on that.
1: "It's the End of the World as We Know it" by R.E.M.
There was no question in my mind what was going to be number 1. Part of it is an homage to Independence Day, and part of it is how I like to wake up. It's not enough for me to just take on the day, I have to take on the end of the world. Besides, everything is falling apart anyway. So, you might as well pump yourself up for it. Now, there is a question of version. I know what you are thinking, "How can anything surpass the original REM?" Well, I have to admit that there is something to be said about the Suicide Machines version. First off, I like the faster tempo, and it is part of a great FLCL music video. By the way, if you are not familiar with my favorite Anime (FLCL), the you are missing out. It explains a lot about me.
OK, that is about it. I admit that I should have substituted "Ants Marching" for "Chelsea Morning" but I just didn't want to. You can pretend that things are different in your own little world. I won't stop you.
Also, look to the next post to contain a little programming challenge.
Tuesday, March 5, 2013
Wait, what is going on?
While, I have stories to tell about why I am not updating, will tell you this instead.
Last night I had a dream.
It was set in overside, and some of the races were there. I got to meet William Shatner, who apparently knows my mom in said dream. Also, Ted Nugent made an appearance.
The point of weirdness is this, the dream had one of those classic movie twists with the main family being robots, and the entire town being some kind of wierd enclosed environment entirely made out of wood. It was pretty cool, actually.
The even stranger thing is that I was able to solve this mystery and reveal it to the people. Also I was able to will myself into flight in the dream. Usually, when I realize I am flying I lose that ability. As soon as I notice that something is not conforming to reality my physics and reality engines kick in and override any control I may have over the situation. Strangely enough, I even noted that I am somehow flying even though flight doesn't work for me.
What is the point? I think my point is that my brain is relaxing and allowing itself to be creative again despite the large amount of very concrete tasks ahead of it.
Anyway, I still need to post my comic. I may hold off on posting it until Aaron Diaz posts his next comic, but let's be realistic. I will get mine up sometime this year.
Last night I had a dream.
It was set in overside, and some of the races were there. I got to meet William Shatner, who apparently knows my mom in said dream. Also, Ted Nugent made an appearance.
The point of weirdness is this, the dream had one of those classic movie twists with the main family being robots, and the entire town being some kind of wierd enclosed environment entirely made out of wood. It was pretty cool, actually.
The even stranger thing is that I was able to solve this mystery and reveal it to the people. Also I was able to will myself into flight in the dream. Usually, when I realize I am flying I lose that ability. As soon as I notice that something is not conforming to reality my physics and reality engines kick in and override any control I may have over the situation. Strangely enough, I even noted that I am somehow flying even though flight doesn't work for me.
What is the point? I think my point is that my brain is relaxing and allowing itself to be creative again despite the large amount of very concrete tasks ahead of it.
Anyway, I still need to post my comic. I may hold off on posting it until Aaron Diaz posts his next comic, but let's be realistic. I will get mine up sometime this year.
Subscribe to:
Comments (Atom)
