-  [WT]  [PS]  [Home] [Manage]

Name
Email
Subject   (new thread)
Message
File
Password  (for post and file deletion)
  • Supported file types are: GIF, JPG, PNG, TXT
  • Maximum file size allowed is 5120 KB.
  • Images greater than 200x200 pixels will be thumbnailed.
  • Currently 438 unique user posts. View catalog

  • Blotter updated: 2009-07-22 Show/Hide Show All

Donate to 7chan to keep us going another month: Goal $0/200 Due 3/1 Check IRC for Paypal info
Or donate using Alertpay
Amount (USD)

File 125962830970.png - (82.75KB , 256x256 , 124406518613.png )
6612 No. 6612 Stickied hide watch expand quickreply [Reply] [Last 50 posts]
I've been reading through the recent thread about collaboratively learning a language, and it piques my interest. It gave me the idea to organize this shit to actually help /pr/ learn a new language.

Basically, people post assignments in this thread for the language we're trying to learn. Those assignments will be coded in a file called answer(question number).txt, uploaded here. Once the answer to a given assignment is confirmed correct, the assignment will be officially CLOSED and all other answers to the assignment after its closing (identified by a post by me indicating the assignment is closed) will be deleted.

Follow me so far?

For example, Assignment #1 is to display the words Hello, World. You would then post answer1.txt with the correct code and if it was verified correct I would post about it.

----THREAD RULES----
#1 - This thread is a no-troll zone. All completely off-topic posts will be deleted and may result in a ban.
#2 - DO NOT post your code in the Message section of the post. All answers go in the accompanying .txt file.
#3 - Names/tripcodes are urged in this thread to clear up any confusion.
#4 - The language we are going to be doing assignments in is C. That was the overall consensus I got. If you disagree with this and want to do another language, don't worry, other languages will be included in this later on.
#5 - Remember, we are learning a language here. Hints and tips on the assignment post are allowed and encouraged. Also, no extreme-difficulty assignments allowed. I'll be in charge of what is okay and what is not okay.

Message too long. Click here to view the full text.
53 posts and 21 images omitted. Click Reply to view.
>> No. 8241
File assignment7build0_01.txt - (2.98KB )
8241
Uncommented, far from finished assignment 7. I will implement the dynamic allocation dalek was so kind to help me with and a combat system.

I hope the code is understandable enough for everyone but I will post an updated version tomorrow probably.

~~The master.


File 125872185188.jpg - (280.28KB , 942x1449 , 1181208617331.jpg )
6289 No. 6289 Stickied hide watch expand quickreply [Reply]
Hi guys, I'm crossposting >>/b/389653 here to get /pr/'s help on this issue for the new /local/ board idea I'm working on, but still don't have a really concrete way to approach this using PHP. I'd appreciate some input on a good way to approach this, from a programming standpoint.
29 posts and 1 image omitted. Click Reply to view.
>> No. 8003
Javascript based client side word filters.
Just ask each user what city they're in, and then make the wordfilter all city names to be whatever city they're from.


File 126569606261.gif - (178B , 50x50 , Black.gif )
8271 No. 8271 hide watch quickreply [Reply]
Well, I have several php pages, and one of them takes $_POST arguments, does some stuff with my database, and then returns to the page using $_SESSION['url']. However, rather than taking me back to the form page for a nice "it worked" message, it takes me to the last image in the image array that I'm preloading.

The image preloading code is something like
imageA = new Image();
imageA.src = "http://some.url.here"

Is there some way for me to reset the $_SESION['url] to the page's url, rather than the last accessed URL from the website's point of view?


File 126567439050.jpg - (217.75KB , 800x600 , Atomic_Fractal_Ultra-X.jpg )
8265 No. 8265 hide watch quickreply [Reply]
Hi. I jsut wondered if this was the place to ask for help.
So i have this problem i would need to make a macro or shortkey to spam space and i mean fast as fast as possible in the matter of fact, how should i proceed?

And the need for really fast space -key spamming would be needed for this browser aplication.
thanks for the time and ideas.
>> No. 8266
and by fast i mean like way less than a second^^
>> No. 8270
Supposing you're on Windows you just need to send a message to the browser saying space was pressed. Search for WM_MESSAGE on MSDN and you should find something.


File 126561686953.gif - (204.32KB , 336x336 , 1264687884396.gif )
8246 No. 8246 hide watch quickreply [Reply]
I want to parse a date formatted like this:
Sun, 7 Feb 2010 11:34:04 -0700
to a datetime object in python but after googling I still have no fucking clue how too. Is there any easy way to do this or am I going to have to regex this shit?
>> No. 8267
"Have to" and "regex" should never be in the same sentence ...

just be happy you're coding in a language that has that functionality...

In short, yes, regex for the win...
>> No. 8268
Why regex?
I'd just split() the string and use the substrings.
>> No. 8269
help(time.strptime):
strptime(string, format) -> struct_time

Parse a string to a time tuple according to a format specification.
See the library reference manual for formatting codes (same as strftime()).


File 126369099792.jpg - (61.99KB , 500x666 , 49d4ccb0761d7f3a8d96b472c55155e6a86a0877.jpg )
7641 No. 7641 hide watch expand quickreply [Reply]
Hi /pr/ I have been a programer for about 3 years and for the first time.. I feel like I don't like programing. Have anyone ever felt like that?
7 posts omitted. Click Reply to view.
>> No. 7697
I've been programming full time for 8 years, and on-and-off for much much longer.
I get that feeling now and then.
>> No. 8256
If you've been stuck with 1 language for a LONG time, then yes.

Been doing Perl for 8 years. Just recently took up Verilog so I could advance my other hobby (electronics). Bringing something I do every day and used to love (programming) with something I don't do as often an brought a whole new lease of life to it.

Now I'm throwing around `module`s and 8'hdeadbeef like nobody's business.
>> No. 8264
>>7684
>i fancy thinking about myself as a Software Engineer more than a programmer
I'm sure you do. Hell, that's the whole purpose of the term "software engineer".


File 126559656069.png - (24.53KB , 450x310 , 450px-Hash_table_5_0_1_1_1_1_1_LL_svg.png )
8242 No. 8242 hide watch expand quickreply [Reply]
So I'm looking for a program to run permutations on a list of words (say a dictionary file), adding in common letter substitutions ($ for s, + for t, etc)

I need this because I'm using aircrack, and unlike john, it doesn't have an option to "leet-speak-ize" the dictionary file (and john does not modify the original file, so I can't run john then use the resulting file in aircrack)

my googling has found nothing... I will probably have to code a solution in python myself, I'm pretty green to the whole programming thing so it'll be a nice, managably sized project, but it'll be 10x easier if I've seen example code. (plus I wanna run this test _now_ not when I've written the program in 1-2 weeks)
5 posts omitted. Click Reply to view.
>> No. 8261
This is the correct one liner to find the positions:

findPositions xs = take (length index) $ index <*> [xs]
where index = elemIndices <$> leata
>> No. 8262
findSubSeq = fmap subsequences <$> findPositions

And whith this one we can calculate all the subsequences of the positions. Eg:

findSubSeq "taasts" gives us:

[
[[],[3],[5],[3,5] -- all possible substitions for s
],[[],[0],[4],[0,4]] -- all possible substitions for t
]
>> No. 8263
Next step is something like this and then we are almost there:

zip leatb $ findSubSeq "taats"


File 126541584128.jpg - (1.17MB , 1632x2326 , Edmund_blair_leighton_accolade.jpg )
8188 No. 8188 hide watch expand quickreply [Reply]
#include <iostream> int main() { char *name; std::cin >> name; return 0; }


So I compile it, it compiles fine. I run it, enter some letters for char *name, and I get a segment fault.
Why is this happening?
3 posts omitted. Click Reply to view.
>> No. 8192
>>8190
Wow, I'm an idiot. =/
Thanks. Changed to name[100]
>> No. 8237
What is this shit, using std::cin, so it is C++, use a motherfucking std::string for Christ sake, enough of the char* faggotry.

"Yes!Yes it work, i mean it compile, now what is a segmentation fault?"
>> No. 8255
>>8192

>char name[100];
>std::cin >> name;

hmmmmmm...


File 12616317994.png - (2.66KB , 301x342 , fork.png )
7270 No. 7270 hide watch expand quickreply [Reply]
So I was reading some programming forums, and I go to thinking:

In C++, why do so many people type "std::cout" and "std::cin" when they could just type "using namespace std;" once and be done with it?
20 posts omitted. Click Reply to view.
>> No. 8238
>>8156
If it's a small device why are you even using std::count and not a write call in the first place... just sayin'
>> No. 8252
>>8238
What's the difference?
>> No. 8254
>>8238
If you really need to ask you do not need to ear the answer... just try both, disassemble a C write Hello World and a C++ cout Hello World and you might then be informed to anwser yourself.


File 126531306297.jpg - (76.34KB , 477x700 , csbook.jpg )
8148 No. 8148 hide watch expand quickreply [Reply]
I've been interested in writing a book recently, and I wanted to pick /pr/'s brains for a second. The book would be marketed at people who are curious about computers, how programming works, etc., but who don't want to have a formal education regarding it. So my book would show have a brief overview on what happens on every stage of the computer, from the time you input to the time it outputs.

i.e., I would start with pressing a key, say that the signal was propagated to the keyboards circuit board, diverge at this point into gates, transistors, etc., and then continuing, mentioning t he difference between the polling keyboard and the interrupt mouse, etc. And lest it seem like a pure ce book, I would eventually get to mentioning a *very* brief overview of finite automata, and how these lead to scanners, parsers, how things are then compiled, and so on.

So let me as you, /pr/, is this a book that anyone here would be interested in pre-colege? Assuming it was well written, do you think that this has a market, or is this more of an interesting topic mainly for me? Any ideas, suggestions that you think would make it more interesting?
7 posts omitted. Click Reply to view.
>> No. 8248
>>8202
Bwhahaha, we surely haven't seen this before.

>>8153
>the next TAoCP
Surely isn't pre-college; way too mathematical approach.
>> No. 8251
>>8248
>Surely isn't pre-college; way too mathematical approach.
I was referring to the scope and length.
>> No. 8253
>>8233

Top observational skills you got there.
Although i would question the quality of a post that was simply a useless one word response. Faggot.


Delete post []
Password  
Report post
Reason  
Previous [0] [1] [2] [3] [4] [5] [6] [7] [8] [9]