Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

/prog/ Challenge

Name: Anonymous 2010-07-29 0:55

Write a web browser and post inside it on /prog/

Name: Anonymous 2010-07-29 1:04

Can't, too busy debugging a compiler.

Name: Anonymous 2010-07-29 1:08

Can I post a video solution?

Name: Anonymous 2010-07-29 1:32

Done.

Name: Anonymous 2010-07-29 1:55

Did it! I can't post the code though, that would involve some for of bootstrapping.

Name: Anonymous 2010-07-29 1:56

>>5
form*

Sorry, I've been awake almost a day now

Name: Anonymous 2010-07-29 8:09

Mines a bi shit. Should I post the code?

Name: Anonymous 2010-07-29 8:38

>>7
/* TODO: Insert scatological/homosexuality joke */

Name: Anonymous 2010-07-29 10:23

>>2
Post your toy compiler source

Name: Anonymous 2010-07-29 12:29

I'm trying to make my version portable with SDL_net and it refuses to compile >_<.

Name: Anonymous 2010-07-29 14:39

>>10
SDL_net is crap and everyone with an ounce of sense uses sockets.  It doesn't take that many #ifdefs to get normal socket code to run on Windows anyway (speaking as someone who's done it).

Name: Anonymous 2010-07-29 15:02

Apparently posting with a UserAgent string of "Mozilla/5.0" gets you banned for being a spambot.

Name: Anonymous 2010-07-29 15:03

>>10
>_<
NOT AN EXCEPTED EMOTICON

Name: Anonymous 2010-07-29 15:06

>>13
You just like to catch, eh? Don't worry, a top will come along shortly to service you.

Name: Anonymous 2010-07-29 15:08

>>1
Done.  Elapsed time: ~20 minutes.  Is a functional web browser.  Does not support HTML.


#!/usr/bin/env python3
import urllib.request, urllib.parse, readline
def browse():
    last_url = ''
    while True:
        if last_url: print("Location:", last_url)
        try:
            url = input("Enter URL: ")
        except (KeyboardInterrupt, EOFError):
            print()
            return
        if last_url: url = urllib.parse.urljoin(last_url, url)
        try:
            req = urllib.request.urlopen(url)
            if req.headers.get_content_maintype() == 'text':
                text = req.readall()
                try:
                    text = text.decode(req.headers.get_content_charset() or 'utf-8', 'replace')
                except LookupError:
                    text = text.decode('utf-8', 'replace')
                print(text)
                last_url = url
            else:
                print("Content type:", req.headers.get_content_type())
                try:
                    loc = input("Save as: ")
                except (KeyboardInterrupt, EOFError):
                    print()
                    print("Canceled")
                    continue
                n = 0
                with open(loc, 'wb') as file:
                    while True:
                        data = req.read(4096)
                        if not data:
                            break
                        n += len(data)
                        file.write(data)
                        print("\rDownloaded:", n, "bytes", end='')
                print()
        except urllib.error.URLError as ex:
            print(ex)
browse()

Name: Anonymous 2010-07-29 16:00

except (KeyboardInterrupt, EOFError):

EXCEPTIONS

Name: Anonymous 2010-07-29 16:42

>>15
Use regular expressions to parse HTML tags and turn them into ANSI escape codes.

Name: Anonymous 2010-07-29 16:44

>>17
Or just use an HTML terminal.

Name: Anonymous 2010-07-29 17:10

>>17
That's non-trivial for nested tags.

Name: Anonymous 2010-07-29 18:03

>>17
Only a complete moron would try to use regular expressions to parse HTML.  Only an inbred, bucktooth moron with advanced syphilis would do so in Python where you can just "import html".

Name: Anonymous 2010-07-29 18:38

InitNetwork();
ReceiveHTTPFile("http://dis.4chan.org/prog/", "archive"+StrU(Date())+".htm");
 If OpenWindow(0, 0, 0, 600, 300, "EXPERT PROGRAMMERS USE BLUB", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    WebGadget(0, 10, 10, 580, 280, "http://www.example.com");
      Repeat
    Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf

Name: Anonymous 2010-07-29 18:38

>>20
You forgot [i]prole[i] and mouthbreather.

Name: Anonymous 2010-07-29 18:47

>>21
Thats actually cheating. Its a mini-IE window in ActiveX.
I'd say its like calling system("firefox")

Name: Anonymous 2010-07-29 18:52

>>23 ur just jealous of Pure BASIC Power
InitNetwork();
If OpenWindow(0, 0, 0, 600, 300, "EXPERT PROGRAMMERS USE BLUB", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    WebGadget(0, 10, 10, 580, 280, "http://dis.4chan.org/prog/");
      Repeat
    Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf

Name: Anonymous 2010-07-29 19:04

>>12
Apparently posting with a UserAgent string of "Mozilla/5.0" gets you banned for being a spambot.
Posting to /prog/?  No.  I use it for my browser.

Name: Anonymous 2010-07-29 19:08

Test if purebasic thing works.

Name: Anonymous 2010-07-29 19:17


#!/usr/bin/sh
#############################
#     web browser v 0.2     #
#############################

# Since version 0.1, firefox is deprecated,
# use chromium-browser. 
# firefox

chromium-browser

Name: Anonymous 2010-07-29 21:10

>>25
Turns out that wasn't it. Apparently my browser had a bug where it occasionally put a null character in the middle of post data, and that's probably what got it labeled as a spambot.

Name: Anonymous 2010-07-29 21:49

>>28
I do believe mod_security would reject you for that.

Name: Anonymous 2010-07-29 21:58

>>13
»=«

Name: Anonymous 2010-07-29 22:02

>>29
That's the only thing it could reasonably have rejected it for.

Name: Anonymous 2010-07-29 22:04

>>27
That's a pretty legit answer

Name: Anonymous 2010-07-30 7:07

>>27
It's installed as just chromium on my computer. Perhaps v0.3 should use $BROWSER if it is defined

Name: Anonymous 2010-07-30 9:59

That purebasic shit is made by trolls
Its impossible to assign arrays. You have to iterate each member of array and structure and set its value.

Name: Anonymous 2010-07-30 11:12

>>34
That's actually how many Basics work. Array assignment is a fairly new idea in that fucked-up funhouse-mirror world of "programming".

Name: Anonymous 2010-07-30 11:33

>>35
Are you being forreal.

Name: Anonymous 2010-07-30 15:01

>>36
Do you have any idea how old BASIC is?

Name: Anonymous 2010-07-30 15:07

>>37
Its name suggests it is quite rudimentary, so... somewhere near the Stone Age of computeing (the normal Stone Age)?

Name: Anonymous 2010-07-30 15:14

>>34
You have to cudder down the whole list?!

Name: Anonymous 2010-11-15 2:51


Don't change these.
Name: Email:
Entire Thread Thread List