The Red Spider Project

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

User avatar
scarecrovv
It's pronounced 'double u'
Posts: 674
Joined: Wed Jul 30, 2008 4:09 pm UTC
Location: California

Re: Idea for a fun joint effort: red spider project

Postby scarecrovv » Sat Apr 07, 2012 1:34 am UTC

That's awesome! :D

tidbit
Posts: 3
Joined: Thu Apr 05, 2012 2:42 am UTC

Re: Idea for a fun joint effort: red spider project

Postby tidbit » Sat Apr 07, 2012 4:05 am UTC

thanks :mrgreen:
If you think anything needs to be changed, just say so. Otherwise I'll give the .svg (inkscape) to someone (probably Jplus?) to host on whatever site/repo/floppydisc and make countless copies in any size, if needed.

Pixyn25
Posts: 10
Joined: Thu Feb 02, 2012 6:47 am UTC

Re: Idea for a fun joint effort: red spider project

Postby Pixyn25 » Sat Apr 07, 2012 8:22 am UTC

Hello people! I would like to join this project. ^^
Where should I start?
Also, if we write our code, what (module|namespace|package|.*) should we put it under?

Code: Select all

town.addChangeListener(new ChangeListener(){
   public void stateChanged(ChangeEvent e){
      if(e instanceof NewPersonInTown) throw new WelcomeParty();
   }
}

Take off your shipping goggles and put on the friendshipping goggles instead.

User avatar
Jplus
Posts: 1692
Joined: Wed Apr 21, 2010 12:29 pm UTC
Location: Netherlands

Re: Idea for a fun joint effort: red spider project

Postby Jplus » Sat Apr 07, 2012 9:04 am UTC

scarecrovv wrote:That's awesome! :D

Agree!

tidbit wrote:thanks :mrgreen:
If you think anything needs to be changed, just say so.
I'm not sure whether it needs to be changed, but I'm kind of curious what it would look like if the legs were more string-like, i.e. with the legs the same width over the entire length?
tidbit wrote:Otherwise I'll give the .svg (inkscape) to someone (probably Jplus?) to host on whatever site/repo/floppydisc and make countless copies in any size, if needed.
If you don't mind making a GitHub account and if you don't mind putting a copyright notice with a reference to the red spider project license in your SVG file, then you're also welcome to make your own fork of the project and put the SVG file in the src/ directory by yourself! :D (But don't worry, otherwise I'll be perfectly happy to do it for you.)

Pixyn25 wrote:Hello people! I would like to join this project. ^^
Great! When can you start?
Pixyn25 wrote:Where should I start?
If you're a Windows user, please take a moment to test xkcd-fetch (you need Python for that). Other than that, I can only say: what would you like to do?
Pixyn25 wrote:Also, if we write our code, what (module|namespace|package|.*) should we put it under?
We don't have any guidelines for that (yet). Do whatever seems to make sense to you. Most of the code in our project will be independent of most other code, so a common (module|namespace|package|.*) probably wouldn't help much, but if you think we need some kind of guideline in that direction anyway, please tell us why and propose something.
"There are only two hard problems in computer science: cache coherence, naming things, and off-by-one errors." (Phil Karlton and Leon Bambrick)

coding and xkcd combined

(Julian/Julian's)

User avatar
tastelikecoke
Posts: 1208
Joined: Mon Feb 01, 2010 7:58 am UTC
Location: Antipode of Brazil
Contact:

Re: Idea for a fun joint effort: red spider project

Postby tastelikecoke » Sat Apr 07, 2012 12:04 pm UTC

Jplus asked me to join in. I'll help at whatever I can, but I'm still picking up on programming and CS.

I've been looking for a way to change the text of "Segmentation fault" and add a shout-out to this, but I have no clue how it would be done, considering that message is platform-dependent (I just learned windows doesn't show segfaults, just a "Report to Microsoft"). So maybe a C interpreter instead?

User avatar
Jplus
Posts: 1692
Joined: Wed Apr 21, 2010 12:29 pm UTC
Location: Netherlands

Re: Idea for a fun joint effort: red spider project

Postby Jplus » Sat Apr 07, 2012 10:04 pm UTC

tastelikecoke wrote:Jplus asked me to join in.

Dude(ss). I invited you. You don't suffer from false modesty, do you? ;)

BTW, you're not required to help by any means... If you just want to do your own thing and leave it at that, that's fine too.
"There are only two hard problems in computer science: cache coherence, naming things, and off-by-one errors." (Phil Karlton and Leon Bambrick)

coding and xkcd combined

(Julian/Julian's)

User avatar
Jplus
Posts: 1692
Joined: Wed Apr 21, 2010 12:29 pm UTC
Location: Netherlands

Re: Idea for a fun joint effort: red spider project

Postby Jplus » Thu Apr 12, 2012 12:24 am UTC

This doesn't count as double posting, right? :mrgreen:

I almost completely rewrote the Readme file. See the branch. Feedback would be much appreciated, preferably by at least three people.
I also added an Authors.txt and a Dependencies.md, but those are probably less interesting.

In other news: Neil and I had some fun editing rsshell today (see the issue tracker if you want to get an idea of what happened). Now we have two things that need to be tested on Windows. :P

Another subject: perhaps we could recruit some help in General or Serious Business for legal advice on our xkcd-ified license?

@tastelikecoke: I didn't scare you off, did I? I was just kidding, you're very welcome!
"There are only two hard problems in computer science: cache coherence, naming things, and off-by-one errors." (Phil Karlton and Leon Bambrick)

coding and xkcd combined

(Julian/Julian's)

User avatar
Steax
SecondTalon's Goon Squad
Posts: 3038
Joined: Sat Jan 12, 2008 12:18 pm UTC

Re: Idea for a fun joint effort: red spider project

Postby Steax » Thu Apr 12, 2012 1:04 am UTC

I'm going to take a slight backseat and see where this goes, so I get a better overview on what's going on. I think, as a web developer, my biggest contribution in the long run may be building the site that hosts these various projects and their documentations.

Edit: to be clear, I'm not reconsidering joining, but I'm going to wait till I can see a trend between projects, what the best ones are, and so forth before pitching in on the website end.
In Minecraft, I use the username Rirez.

User avatar
tastelikecoke
Posts: 1208
Joined: Mon Feb 01, 2010 7:58 am UTC
Location: Antipode of Brazil
Contact:

Re: Idea for a fun joint effort: red spider project

Postby tastelikecoke » Sun Apr 15, 2012 12:58 pm UTC

@Jplus: a bit :) but I'm still reading on the python scripts.

User avatar
scarecrovv
It's pronounced 'double u'
Posts: 674
Joined: Wed Jul 30, 2008 4:09 pm UTC
Location: California

Re: Idea for a fun joint effort: red spider project

Postby scarecrovv » Sun Apr 15, 2012 2:12 pm UTC

Is there any reason not to merge readme into master?

User avatar
Jplus
Posts: 1692
Joined: Wed Apr 21, 2010 12:29 pm UTC
Location: Netherlands

Re: Idea for a fun joint effort: red spider project

Postby Jplus » Mon Apr 16, 2012 1:44 pm UTC

Lack of approval? I've asked for opinions but sofar nobody gave one.

(From your post it seems you approve, though. I'd prefer more people to give their opinion, but if nobody else responds after you I guess we can just merge it.)
"There are only two hard problems in computer science: cache coherence, naming things, and off-by-one errors." (Phil Karlton and Leon Bambrick)

coding and xkcd combined

(Julian/Julian's)

User avatar
scarecrovv
It's pronounced 'double u'
Posts: 674
Joined: Wed Jul 30, 2008 4:09 pm UTC
Location: California

Re: Idea for a fun joint effort: red spider project

Postby scarecrovv » Tue Apr 17, 2012 2:46 pm UTC

Sorry, I missed your request for approval. I approve.

User avatar
Jplus
Posts: 1692
Joined: Wed Apr 21, 2010 12:29 pm UTC
Location: Netherlands

Re: Idea for a fun joint effort: red spider project

Postby Jplus » Wed Apr 18, 2012 8:17 pm UTC

If no other feedback is given within 48 hours, I'll merge the new Readme into master.

In other news: we now have a setup script! Yay!
"There are only two hard problems in computer science: cache coherence, naming things, and off-by-one errors." (Phil Karlton and Leon Bambrick)

coding and xkcd combined

(Julian/Julian's)

User avatar
Jplus
Posts: 1692
Joined: Wed Apr 21, 2010 12:29 pm UTC
Location: Netherlands

Re: The Red Spider Project

Postby Jplus » Tue Apr 24, 2012 4:36 pm UTC

*bump*

More news/announcements!

> I updated the thread title, since we're pretty much beyond the "idea stage" by now.

> I've merged the new Readme into master, as I announced in my previous post. Actually I did that Friday already.

> tidbit sent me the svg file of his supercool red spider drawings. I'll add it to the repository soon, perhaps in a new subdirectory (other, etc or share), otherwise just in src. I'm not sure yet. I'm also considering to create a simple homepage with GitHub Pages, so we'll have a place to show the drawings. Of course, we can use that page for other things as well.

> Soon to be merged into master: a new subdirectory in RED_SPIDER_ROOT, extbin ("ext" stands for "external"). This is where rsshell will be installed, and perhaps other red spider commands that we want to be permanently available from the PATH. "Normal" installation (where commands are available only while you run rsshell) will still go into bin.

As always, any opinions will be much appreciated.
"There are only two hard problems in computer science: cache coherence, naming things, and off-by-one errors." (Phil Karlton and Leon Bambrick)

coding and xkcd combined

(Julian/Julian's)

FireRogue
Posts: 15
Joined: Fri Apr 27, 2012 2:52 am UTC

Re: The Red Spider Project

Postby FireRogue » Wed May 09, 2012 1:45 pm UTC

Hello!
I just saw this and noticed that there hasnt been a post in the better part of three weeks. Is that because the discussion moved elsewhere?
Also, I'd love to work on the key program. I'd write it in c++, but I have no prior experience with git, github, or make files and distribution (I usually just write small tidbits for myself) so would someone be able to show me how to do all that stuff? I thought of generating the keywords for a comic by going through the dump file for the individual comics and removing all the boring words (like 'I', 'do', 'that', etc) and storing them all in one file called Keys.[something] by keyword. so like a line would be Hat-Guy: 150, 769, 435 (I just made up the numbers)

Is this project open for working on, and does that sound like a good implementation? If I get an OK ill start working on it as soon as I can.

User avatar
scarecrovv
It's pronounced 'double u'
Posts: 674
Joined: Wed Jul 30, 2008 4:09 pm UTC
Location: California

Re: The Red Spider Project

Postby scarecrovv » Wed May 09, 2012 3:22 pm UTC

There hasn't been much activity recently. I don't know about everyone else, but for me this has been because it's final exam season, and everything is due at once. I'll come back to life in late May, probably.

That said, if you have an idea for something, code it up. I'll be able to give more feedback once you have some code written. I'd be happy to give you some help with Makefiles/Git/etc this weekend when I have a little bit more time. What you're planning on writing sounds similar (though different enough to be interesting) to xkcd-search. You might want to check that out and see what you like and hate about it in order to inform your own design.

Have fun!

User avatar
Jplus
Posts: 1692
Joined: Wed Apr 21, 2010 12:29 pm UTC
Location: Netherlands

Re: The Red Spider Project

Postby Jplus » Thu May 10, 2012 9:38 am UTC

I've also been just too busy, no lack of enthousiasm or ideas here. Will certainly come back. Please feel welcome, go ahead and do whatever you want in the meanwhile!

Some potentially helpful pointers:
Git Immersion
Our Readme (and also our project page on GitHub)
CMake tutorial

Whatever programming language you're going to use, you'll still need to install at least Python 2.7 in order to run the existing programs.
"There are only two hard problems in computer science: cache coherence, naming things, and off-by-one errors." (Phil Karlton and Leon Bambrick)

coding and xkcd combined

(Julian/Julian's)

FireRogue
Posts: 15
Joined: Fri Apr 27, 2012 2:52 am UTC

Re: The Red Spider Project

Postby FireRogue » Tue May 15, 2012 4:27 pm UTC

scarecrovv wrote:What you're planning on writing sounds similar (though different enough to be interesting) to xkcd-search. You might want to check that out and see what you like and hate about it in order to inform your own design.


The idea is to split the search function. One that creates a database (the one I described above) and a second that would use the database to respond to queries. I think that the file-space/time tradeoff is worth it, and it allows us to iron out some of the non-standard annotating that Randal does (I've seen the black hat guy referred to in at least 3 different ways.) The only issue is how to do that. Right now I'm thinking we could have some sort of library that stores sets of keywords that refer to the same thing written in plaintext that individual users could edit to customize their personal search settings. Maybe I should write a third program to help facilitate that, or should I assume that with proper documentation the user will be able to do it manually?

Also, thank you for the links and stuff. I'll read them when I get the chance.

FireRogue
Posts: 15
Joined: Fri Apr 27, 2012 2:52 am UTC

Re: The Red Spider Project

Postby FireRogue » Tue May 15, 2012 5:55 pm UTC

Jplus wrote:DETAILS

  • ...
  • config/: optional configuration files for the user. Only sensible if we write commands that make use of configuration files. No subdirectories.
  • work/: any other user files, possibly generated by the commands in bin/. Subdirectories at will.
  • ...
  • A .gitignore file (or the functional equivalent if we use a VCS other than git). Everything that is not in src/, include/, doc/ or directly in the root directory should be ignored by the VCS.
  • ...
  • Things that I forgot about.


Just another thing i thought of. If we want to include default values for the config or user-dependent files how should we do that? Maybe its worth making a default/ sub-directory in the config/ or work/ folder and have git pick it up? Another alternative is a completely separate defaults/ folder in root.

User avatar
Jplus
Posts: 1692
Joined: Wed Apr 21, 2010 12:29 pm UTC
Location: Netherlands

Re: The Red Spider Project

Postby Jplus » Wed May 16, 2012 12:17 pm UTC

Two more options:
  • Have the install script put the default config files in config/ (either by making a new file or by copying it from src/).
  • Have your program store default configuration internally (or in something that it includes from include/), and fall back on that when no user configuration is given.

Just do whatever seems best to you, if people disagree about something they can always change it later (or only accept your pull request on the condition that you change it). :)
"There are only two hard problems in computer science: cache coherence, naming things, and off-by-one errors." (Phil Karlton and Leon Bambrick)

coding and xkcd combined

(Julian/Julian's)

Tharinock
Posts: 1
Joined: Mon May 21, 2012 2:12 am UTC

Re: The Red Spider Project

Postby Tharinock » Mon May 21, 2012 2:15 am UTC

Is there a getting started guide for contributing somewhere, or any other communication besides here? If this project is still going, i have a couple old projects I can work on dusting off. I could throw in a program that takes 2 inputs, d and r, and gives you the volume of a d dimensional sphere of radius r written in c++. If I look through my old files I can probably find other random things I have.

User avatar
Jplus
Posts: 1692
Joined: Wed Apr 21, 2010 12:29 pm UTC
Location: Netherlands

Re: The Red Spider Project

Postby Jplus » Sun May 27, 2012 10:24 am UTC

The project is still going, but the participants who've contributed most so far are all busy with other things right now. At least scarecrovv and myself are planning to join in again as soon as we can. Please feel welcome!

We still use this thread for general communication (but we simply haven't communicated much). For the hosting of the project and communication about specific issues, we use GitHub. On our project page you'll find our Readme with stuff like 'how to contribute' (it's directly displayed on the bottom of the page when you visit). Please make sure to also read the dependencies.md and the platforms.md. Perhaps have a look at the issues tab.

Note that FireRogue joined in just three days ago!
"There are only two hard problems in computer science: cache coherence, naming things, and off-by-one errors." (Phil Karlton and Leon Bambrick)

coding and xkcd combined

(Julian/Julian's)

User avatar
ahammel
My Little Cabbage
Posts: 2135
Joined: Mon Jan 30, 2012 12:46 am UTC
Location: Vancouver BC
Contact:

Re: The Red Spider Project

Postby ahammel » Sun May 27, 2012 9:35 pm UTC

Woah, two months sort of got away from me there. Sorry guys.

Anyway: I vaguely mentioned a program to give you an RPG-style update in a text box when you reach a programming milestone (i.e. "You have advanced to level 10 in C++!"). The base program is almost done. I'm writing unit tests and a CLI now. I'll push version one to my branch within a few days. Current issues:

- It would be nice if it could be set to run entirely in the background. As it stands, you have to enter a command if you want to see if you've advanced any levels since last you checked. The best solution would be to set a daemon to monitor the folder where you keep all your hacking and have that trigger a check for level advances every time something in that folder is changed. I don't know if there's a cross-platform way to do that, though.
- I have it set up so that counts of source lines of code are normalized by language somewhat. My thinking is that, since it takes way fewer SLOCs to to a particular task in Perl than in C, a C programmer will have written way more lines of code than a Perl programmer of a similar level of experience. The estimates I'm using right at the moment are frankly garbage, though. I took them this website, but the code-sizes are weird there. According to those benchmarks, it takes more Haskell code than C code to accomplish the same task. (All you Haskell hackers should be saying "whaaaaaaat?" about now.) My plan is to get a new set of estimates from something like rosetta code, but it might take me a while to code that up. I if I can't get better estimates pretty soon I think I'll just remove the normalization feature for v1.
- I don't have easy access to a Windows box for testing. I'll have a set of unit tests written pretty soon, though, so we just need a Windows/py.test user to run the tests on his or her machine.
He/Him/His/Alex
God damn these electric sex pants!

FireRogue
Posts: 15
Joined: Fri Apr 27, 2012 2:52 am UTC

Re: The Red Spider Project

Postby FireRogue » Fri Jun 01, 2012 9:17 pm UTC

ahammel wrote:- I don't have easy access to a Windows box for testing. I'll have a set of unit tests written pretty soon, though, so we just need a Windows/py.test user to run the tests on his or her machine.

In a week I will have access to a windows box, so I'll be able to take requests for windows / linux tests

My linux box is a server, so if it ever comes up, I'll be able to test daemonized programs with it.

User avatar
ahammel
My Little Cabbage
Posts: 2135
Joined: Mon Jan 30, 2012 12:46 am UTC
Location: Vancouver BC
Contact:

Re: The Red Spider Project

Postby ahammel » Sun Jun 03, 2012 6:45 pm UTC

@FireRogue: great! I'm just finishing up the unit tests. I'll push to my github later today (just now realizing that it's not already there. Silly me).

I've written the unit tests for the py.test framework, but I've heard good things about nosetests as well. If you prefer to use nose, it shoud be pretty trivial to translate the unit tests. I'm pretty sure the only thing that won't work on both platforms is the pytest.raises statement. The code itself is written in python3, with a call to tkinter to draw the levelling-up announcement.

Edit: testing version pushed to test/level_up on my github.
He/Him/His/Alex
God damn these electric sex pants!

User avatar
Jplus
Posts: 1692
Joined: Wed Apr 21, 2010 12:29 pm UTC
Location: Netherlands

Re: The Red Spider Project

Postby Jplus » Tue Jun 05, 2012 5:30 pm UTC

Nice to hear from you again, Alex!

ahammel wrote:- I have it set up so that counts of source lines of code are normalized by language somewhat. My thinking is that, since it takes way fewer SLOCs to to a particular task in Perl than in C, a C programmer will have written way more lines of code than a Perl programmer of a similar level of experience. The estimates I'm using right at the moment are frankly garbage, though. I took them this website, but the code-sizes are weird there. According to those benchmarks, it takes more Haskell code than C code to accomplish the same task. (All you Haskell hackers should be saying "whaaaaaaat?" about now.) My plan is to get a new set of estimates from something like rosetta code, but it might take me a while to code that up. I if I can't get better estimates pretty soon I think I'll just remove the normalization feature for v1.

This page seems to suggest that Haskell takes slightly fewer bytes than C++ and C. It looks quite reasonable to me.
"There are only two hard problems in computer science: cache coherence, naming things, and off-by-one errors." (Phil Karlton and Leon Bambrick)

coding and xkcd combined

(Julian/Julian's)

User avatar
ahammel
My Little Cabbage
Posts: 2135
Joined: Mon Jan 30, 2012 12:46 am UTC
Location: Vancouver BC
Contact:

Re: The Red Spider Project

Postby ahammel » Thu Jun 07, 2012 1:35 am UTC

Jplus wrote:This page seems to suggest that Haskell takes slightly fewer bytes than C++ and C. It looks quite reasonable to me.

Odd, that's the same place I got my data originally. I apparently did it stupidly, though: I used a summary table which I can't seem to call up right now (bad grad student!) I'll go through the raw data and see if that gives me different numbers.

If only I had some sort of script to automatically count lines of code...
He/Him/His/Alex
God damn these electric sex pants!

User avatar
leo
Posts: 10
Joined: Fri Jun 08, 2012 2:57 am UTC

Re: The Red Spider Project

Postby leo » Fri Jun 08, 2012 2:21 pm UTC

O hai.
I am new around the forum (I actually created the account to post here), but I've been a big fan of Randall's comics for a while. I would like to join in the project, if that is possible. I have subpar programming skills, but I know C and Python (to a beginner-intermediate level). Have you guys considered creating a channel on FreeNode? Anyway, I would be glad to help with anything possible. I can start coding in one or two weeks. I had some ideas, don't know if they are feasible:
    • A board game with xkcd characters (i.e., chess with the set being xkcd characters or Mahjong);
    • A version of Conway's Game of Life with multiplying red spiders of grids;
    • A random text generator that would have some key words, say, "red spider", "nihilist", etc. and would generate a story using them.
Thanks in advance and I apologize in advance for my bad "Engrish". :-)

User avatar
Jplus
Posts: 1692
Joined: Wed Apr 21, 2010 12:29 pm UTC
Location: Netherlands

Re: The Red Spider Project

Postby Jplus » Mon Jun 11, 2012 10:06 am UTC

Hi leo, welcome to the project!

Sure you can join in. If you want to help with existing tasks, check the issue tracker at our github project page. Your level of skill is irrelevant, you'll probably learn how to do the things you want to do anyway. :)

Your ideas seem fun, and at least they should be technically possible. If you can't do it (yet), somebody else can probably jump in to help out.
"There are only two hard problems in computer science: cache coherence, naming things, and off-by-one errors." (Phil Karlton and Leon Bambrick)

coding and xkcd combined

(Julian/Julian's)

User avatar
leo
Posts: 10
Joined: Fri Jun 08, 2012 2:57 am UTC

Re: The Red Spider Project

Postby leo » Tue Jun 12, 2012 6:35 am UTC

Thanks for the welcome. I just pushed a random text generator using Markov chains at my fork: https://github.com/ovvy/the-red-spider-project
Some ideas/criticisms for the code would be welcome. Also, remarks about style and documentation would also be appreciated. I intend to expand on the class as times goes by.

Anyway, should I change something so it would be in accordance to the project? :-).
On a note: I tested out my program against some 'well-behaved' inputs, for instance, Alice in Wonderland ('cause we all love Alice), some lyrics, but it crashes if I input an empty file (because of the call to self.word_size - 3). I will fix it between tomorrow and the next day.

Best regards, leo.

Edit: Also, pushed a ASCII generator that takes as input a path and picks (randomly) a image file there and generates the ASCII art for it. Still fiddling around with the greyscale and trying to setup the environment variables (_HEIGHT and _WIDTH) to be more dynamic. Any ideas would be welcomed. Might still modify the docs for it.
But it's no use going back to yesterday, because I was a different person then.

User avatar
Jplus
Posts: 1692
Joined: Wed Apr 21, 2010 12:29 pm UTC
Location: Netherlands

Re: The Red Spider Project

Postby Jplus » Thu Jun 14, 2012 7:21 am UTC

@leo: Good to see you started! I haven't had the opportunity to look properly at your program yet, but I can tell that you might want to be a bit more 'branchy' with git in order to be more in accordance with the project. Preferably start a new branch for every new thing you start to work on. You can leave your current work on master though, those who pull in your changes will know what to do when the time is there. :)

Cheers!
"There are only two hard problems in computer science: cache coherence, naming things, and off-by-one errors." (Phil Karlton and Leon Bambrick)

coding and xkcd combined

(Julian/Julian's)

User avatar
leo
Posts: 10
Joined: Fri Jun 08, 2012 2:57 am UTC

Re: The Red Spider Project

Postby leo » Thu Jun 14, 2012 3:01 pm UTC

Hey,
thanks for the tip, I am pretty new to git, so I am unsure what are the safer choices for working on a project. I created a branch, will work on it now.
Also, whenever you have the time and if you can, you can criticize my code style. I am trying to be cleaner, but I've never had peer review on the code I wrote in the past.
I am brainstorming some ideas, see if I can make a more xkcd-ish program. Anyway, thanks for the welcome

Cheers.
But it's no use going back to yesterday, because I was a different person then.

User avatar
Jplus
Posts: 1692
Joined: Wed Apr 21, 2010 12:29 pm UTC
Location: Netherlands

Re: The Red Spider Project

Postby Jplus » Fri Jun 15, 2012 8:24 am UTC

Alright, one more thing about the branching: you should name your branches after the things they're about, e.g. "text-generator", "ascii-render", "ascii-render-proportional", etcetera. You can rename your existing "ovvy" branch if you want.

For a nice visual explanation of what's all the branching stuff about, have a look over here. The page describes a specific style of working with branches that we're not adhering to in the red spider project, but it should help you gain some insight. In the red spider project, (so far) "master" is our integration/development branch and all other branches are topic/feature branches. We don't do releases (yet), so release branches, hotfix branches and "production-ready state" branches don't apply to us.
"There are only two hard problems in computer science: cache coherence, naming things, and off-by-one errors." (Phil Karlton and Leon Bambrick)

coding and xkcd combined

(Julian/Julian's)

User avatar
leo
Posts: 10
Joined: Fri Jun 08, 2012 2:57 am UTC

Re: The Red Spider Project

Postby leo » Fri Jun 15, 2012 4:58 pm UTC

Ok then, I reverted master to match the one in the original project and added two branches, one for each script I wrote so far. Anyway, I will use this week to read some git docs and get familiarized with it. In the meantime, I will try to improve my programs. Thanks for the tips once again :wink: I will be able to be more productive eventually, when I grok how to use git effectively. Sorry for my inexperience (and bad Engrish).
But it's no use going back to yesterday, because I was a different person then.

User avatar
Jplus
Posts: 1692
Joined: Wed Apr 21, 2010 12:29 pm UTC
Location: Netherlands

Re: The Red Spider Project

Postby Jplus » Sat Jun 16, 2012 11:55 am UTC

Don't worry, it's OK to be a newbie! Please keep giving us reasons to correct you! :)
"There are only two hard problems in computer science: cache coherence, naming things, and off-by-one errors." (Phil Karlton and Leon Bambrick)

coding and xkcd combined

(Julian/Julian's)

User avatar
BRNMan
Posts: 32
Joined: Tue May 22, 2012 10:29 am UTC

Re: The Red Spider Project

Postby BRNMan » Fri Jul 06, 2012 1:59 pm UTC

Working on features in a desktop background changer for windows that changes it to a random xkcd comic. I can give you the code and resources, but I don't know how you can get it into .exe format or compile it or whatever you want to do with it.

User avatar
Jplus
Posts: 1692
Joined: Wed Apr 21, 2010 12:29 pm UTC
Location: Netherlands

Re: The Red Spider Project

Postby Jplus » Fri Jul 06, 2012 4:53 pm UTC

Please tell us more! What language are you using, what tools are you using to develop and test it, how are you fetching the comics, what else does your program do (if anything)...?
"There are only two hard problems in computer science: cache coherence, naming things, and off-by-one errors." (Phil Karlton and Leon Bambrick)

coding and xkcd combined

(Julian/Julian's)

User avatar
BRNMan
Posts: 32
Joined: Tue May 22, 2012 10:29 am UTC

Re: The Red Spider Project

Postby BRNMan » Tue Jul 10, 2012 5:15 pm UTC

I'm using Visual Studio 2010 express edition and C#. My program is going to display the title, alt text, and number, and will display a background of any xkcd comic on your screen. To fetch the comics my program gets a random comic number, uses a WebClient to get the json code for that comic, looks for the URL of the image within the JSON, downloads tha comic with the WebClient to the debug directory, converts it to a bmp format, and displays it as a wallpaper for Windows computers. I hope that made sense.

User avatar
Jplus
Posts: 1692
Joined: Wed Apr 21, 2010 12:29 pm UTC
Location: Netherlands

Re: The Red Spider Project

Postby Jplus » Wed Jul 11, 2012 8:42 am UTC

Sure that makes sense. As far as I'm concerned you and your program would be very welcome to the project, but I think it's best if you add it yourself (thus becoming a real participant) and in order to do that it's best if you familiarize with the project first. I suggest you start using Git and GitHub (if you didn't do so yet), fork and clone the Red Spider Project (RSP) to your computer, read the Readme carefully, install the RSP and play around with it, for as far as you haven't done these things yet.

The xkcd-fetch command already builds a local database of xkcd comics that can be used by other RSP programs. If you are to integrate your program with the RSP you should consider to have your program rely on that database (and perhaps invoke the xkcd-fetch command) rather than doing the fetching yourself. Once you've installed the RSP, run 'rsshell' and then 'xkcd-fetch -h' to get a manual. Have it download some comics for you (tip: unless you use the '-n' or '-r' option, the command expects you to enter a comic number before terminating) and look at the contents of work/xkcd-fetch to see how the data are stored.

Once you've considered these things, we can determine how exactly to integrate your program with the rest of the RSP. Some of the options are to just copy your entire project folder into a subdirectory of the src directory of the RSP (adding a note to the Readme telling Windows users that they can build your program with Visual Studio), or to put just your source files directly into the src directory and write a CMake build script for it.
"There are only two hard problems in computer science: cache coherence, naming things, and off-by-one errors." (Phil Karlton and Leon Bambrick)

coding and xkcd combined

(Julian/Julian's)

User avatar
Jplus
Posts: 1692
Joined: Wed Apr 21, 2010 12:29 pm UTC
Location: Netherlands

Re: The Red Spider Project

Postby Jplus » Sun Jul 15, 2012 10:48 pm UTC

@BRNMan: today I noticed you already cloned the project more than a week ago. My apologies for my previous post! How's the hacking coming along?

@leo: I finally found some time to have a look at your code. Please check below for an attempt at some constructive comments (spoilered for length, though potentially interesting for any novice programmer).

Spoiler:
First of all, let me emphasize that I'm not an authority on coding style by any means. I'm under the impression that you know how to code; that's the most important thing. I do see some things you could improve upon, but please take them as advice from a (friendly) stranger. I'm mostly doing this because you asked for feedback, it's certainly not criticism! If anything is unclear or needs further elaboration, please ask.

When you start writing a new piece of code, there are a few basic requirements that you should try to meet before doing any 'real' programming. In other words, you should start off with a 'dummy program' that is informative about itself (or rather, its future self) but doesn't do anything yet. The reason is that, ironically, some things are more important than the thing your program is supposed to implement:
  • License information. When viewing your code, the reader should be able to see at a glance who exactly wrote it, and under what conditions they can use it. At the very least this means you should give your full name and list the years in which you worked on the code. In our case, you should also refer to the RSP license so the reader can infer that they're allowed to do virtually anything with your code as long as they give you some credit.
  • Usage information. Either your program should explain how to operate it when you call it without any arguments, or it should have an -h option. randomtext.py and randomascii.py do have a _usage() function which is called when the program is run with less than the minimum amount of arguments; however, when I tried running randomtext.py without arguments it gave me the docstring instead, as well as the usage information of ImageMagick repeated four times. I'm not sure what's causing this, but it must have something to do with the fact that you started implementing your features without making sure that the usage information would stay intact (another tip in this regard: only push you code to your public repo when it behaves reasonably well).
People sometimes advocate doing even more things before you start coding, for example writing a unit test. However, the two things I mentioned above are by far the most important and they should remain error-free during all stages of development.

As far as the visual appearance of you code is concerned, I have a few suggestions.
  • Use stronger indentation. For many people two spaces is not readable enough. In the Python community there is a strong convention to use four spaces per indentation level, but it's a good rule of thumb for any language. Alternatively you could use a single tab, but the disadvantage is that different editors display tabs differently. Most serious text editors (such as Notepad++) offer options to replace tabs automatically by spaces.
  • Hard wrap lines longer than 80 characters (actually, the official Python convention is to wrap to 79 characters). Use additional indentation to indicate that a line is the continuation of the previous line. This is more readable. In Python, you can either break a line between braces/brackets/parentheses (this is preferred) or directly after a backslash.
  • You should avoid starting names with underscores, unless you're writing a library, you want to hide the name from those who import your module and you know what you're doing. In randomascii.py you have global constants that you named (appropriately) with allcaps; there is no need to make them even more distinctive by prepending underscores. Also, there is no reason at all to name your usage function _usage.
  • If you want a more complete (but also more meticulous) overview of officially recommended Python coding style guidelines, you can check out PEP 8.

In the end, it's a matter of experience and taste. It's probably more important to read lots of code from other people than to get feedback on your own code (that's how you learn your primary language as a child!). Within the RSP, I'd recommend that you read src/xkcd-fetch.py and setup.py. Outside the RSP... well, just have a glance at any random GitHub project!


@the others: how's it going?

@everyone: I'm back on board! The next two months I'll spend at least a few hours on the RSP every week. :D
"There are only two hard problems in computer science: cache coherence, naming things, and off-by-one errors." (Phil Karlton and Leon Bambrick)

coding and xkcd combined

(Julian/Julian's)


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 9 guests