[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 67
Thread images: 7
File: yF1VCTm.jpg (89 KB, 1366x768) Image search: [Google]
yF1VCTm.jpg
89 KB, 1366x768
old thread: >>51814176

What are you working on, /g/?
And why haven't you done Advent of Code day 12 yet?
>>
First for new threads before 310 posts
>>
Don't create new threads before the bump limit you fucking degenerate scum.
Delete this thread and kill yourself.
>>
Report, ignore and sage all prematurely posted trap threads
>>
>>51819095
>And why haven't you done Advent of Code day 12 yet?
>implying I haven't
>implying I'm proud of this piece of shite code:
with open("Advent12.txt") as myfile:
data=myfile.read()

def deleteRed(items):
if type(items) is dict:
if "red" in items.values():
items.clear()
return items
for i in items.items():
if (type(i[1]) is list) or (type(i[1]) is dict):
items[i[0]]=deleteRed(i[1])
for c,i in enumerate(items):
if (type(i) is list) or (type(i) is dict):
items[c]=deleteRed(i)
return items

#uncomment the following 4 lines for part 2
#import json
#data=json.loads(data)
#data=deleteRed(data)
#data=json.dumps(data)

currNumber=""
total=0

for i in data:
if i.isdigit() or (currNumber=="" and i=="-"):
currNumber+=i
continue
if currNumber=="":
continue
total+=int(currNumber)
currNumber=""

print total
>>
>>51819199
Don't post in this thread, retard.
>>
>>51819199
although I did manage to learn how regex works, so the bottom block could be shortened to
print sum(int(i) for i in (re.findall(r'-?\d+', data)))


>>51819207
it's the new thread ya mong
>>
>>51819207
this

sage
>>
>>51819226
>it's the new thread ya mong
no it isn't, it's invalid because it's a trap thread and it was posted before the bump limit of the previous thread was reached

sage
>>
>>51819237
shit I've been duped

but jannies won't let us post an additional thread at this point right?
>>
>>51819246
It's the new thread. That guy is just mad he didn't get to make it.
>>
>>51819256
fuck off to >>>/lgbt/ fucking fag troll

i bet you're the same guy who's been posting traps since like this summer. get a life, fucking nerd
>>
friendly reminder that by falling for this crossdressing "meme" you're supporting the zionist SJW agenda to flood the job market with females and freaks
>>
>>51819325
>>>/pol/
>>
File: 7a4.png (171 KB, 450x290) Image search: [Google]
7a4.png
171 KB, 450x290
>>51819336
>>
>>51819292
>>51819325
There's nothing wrong with 2D traps you fucking faggots, only the people who like 3D traps are cancer
>>
>>51819199
Updated my code with regex and removing unnecessary type checking

I won't go as far as copying the elegant solution of just adding as you go along, and if I include map(), it's almost pretty much that other guy's solution. I'm pretty content with this refined version of a python beginner's solution
>>
>>51819353
Kill yourself, you trap sympathiser.
>>
>>51819352
guess why OP is posting 2d traps? because it's the closest thing to 3d traps he can get away with posting
>>
question

in Python, how do I reload the file itself? i get you can reload modules etc, but I need to reload the source file
>>
>>51819353
forgot code

import re, json

data=open("Advent12.txt").read()

def deleteRed(items):
if type(items) is dict:
if "red" in items.values():
items.clear()
return items
for i in items.items():
items[i[0]]=deleteRed(i[1])
elif type(items) is list:
for i in items:
deleteRed(i)
return items

#uncomment the following 3 lines for part 2
#data=json.loads(data)
#data=deleteRed(data)
#data=json.dumps(data)

print sum(int(i) for i in (re.findall(r'-?\d+', data)))


>>51819360
stop memeing lad
>>
>>51819363
>>51819372
You fags are the fucking memers. Fucking degenerates.
Don't encourage OPs faggotry and don't post in this shitty thread.
>>
File: 1444519185838.jpg (122 KB, 425x516) Image search: [Google]
1444519185838.jpg
122 KB, 425x516
https://github.com/EZ3CHI3L/Eternity

I wrote a mediocre image viewer and was wondering if anybody could take a look and suggest some things to make it better in regards to the source code.
Organization for instance, I'm trying to make translation units that implement the part of the program that their files name, but I feel as if I now have too much code in my main function due to complications with OpenGL state.

Also where should I start if I want to scale the image using an interpolation algorithm?

Basically any input is appreciated, even if it's "ur a faggit."
>>
>>51819386
post in the old thread for now >>51814176
>>
What are some good 1 hour programming challenges? Stuff that might get asked in an interview or a good practice
>>
>>51819392
http://www.amazon.com/Cracking-Coding-Interview-Programming-Questions/dp/098478280X

I see this mentioned a lot in coding interview threads. Never read it myself though.
>>
>>51819369
Project Euler are quicker challenges, but have harder ones towards the end, though they're less programming challenges and more math challenges

Codeeval has Hard challenges which might take 1 hour, and are more programming challenges
>>
Is this the real thread?
>>
>>51819574
Why the hell did you bump this thread, you degenerate fuck?
>>
>>51819584
Woah, what the hell?
>>
>>51819574
It is the real thread.
>>
All right guys I made a basic text editor. Right now it can load files and then overwrite the original file with your edits. I'm working on a 'save as' feature.
What other (simple) features should it have?
>>
THE LEGIT NEW THREAD

>>51819395
>>51819395
>>51819395
>>
>>51819679
a single man cannot be this butthurt
>>
>>51819700
i wasn't the one who made that thread

but i support it now that it has been made

the fag shill needs to get put in his place

all we have to do is ignore the invalid threads
>>
>>51819700
If I was going to advertise my own thread, I would have done it a long time ago.

a single man cannot be this much of a degenerate
>>
Should I use Debian for programming?
>>
>>51819829
Yes.
>>
>>51819829
Stop bumping your own shitty thread, OP.
>>
>>51819829
Also make certain you use unstable unless you want to be building libraries.
>>
>>51819829
all cool people use osx for coding now

t. watcher of various tech talks
>>
>>51819829
All linuxes are good.
For anything more specific, see >>>/g/flt/
>>
>>51819838
this

sage
>>
THE LEGIT THREAD:

>>51819395
>>51819395
>>51819395

REMINDER TO REPORT, IGNORE AND SAGE ALL PREMATURELY POSTED TRAP THREADS
>>
File: Qeditor_038.png (66 KB, 581x528) Image search: [Google]
Qeditor_038.png
66 KB, 581x528
>tfw using my text editor to edit my text editor
>>
>>51819922
it's shit
>>
>>51819944
Yeah I know but it's the largest program I've made thus far and I'm sticking with it for now.
>>
But ever since I left the city YOU
>>
File: stretchyface computer disposal.jpg (65 KB, 445x488) Image search: [Google]
stretchyface computer disposal.jpg
65 KB, 445x488
>git clone some random project on github
>make
>it starts git cloning and compiling multiple linked dependencies from github before it compiles itself
>look at source code
>it's all useless glue code to interface with the libraries that got downloaded
>>
>>51820154
>>git clone some random project on github

For what purpose?
>>
>>51819916
>>51819916
>>51819916
>>
>>51819916

There's an asspained redditor making duplicate /dpt/s who thinks people actually get banned on /g/.

I don't even know what motivates someone like that.
Nobody gives a fuck about the choice of picture for the programming thread on an anime imageboard.
>>
>>51820783
the main complaint is that the trap threads get posted before the bump limit because the autistic fag shill has to force his himegoto images. it's completely unreasonable to repost threads before the bump limit and it leads to duplicate /dpt/s. i wasn't even the one who made the second /dpt/.
>>
File: coqmeme.jpg (76 KB, 1176x747) Image search: [Google]
coqmeme.jpg
76 KB, 1176x747
Since we seem to have multiple threads..

What do I even do with this meme? I can't make head of tails of this platform.
>>
>>51819916
theres 14 posters in the that thread and 13 in this thread excluding this post. Its over. No ones wants to support your gay agenda. Accept the L and join that thread. I know I am.
>>
Bump :^)
>>
>>51819325
>flood the job market with females and freaks
the job market is flooded with freaks already...
>>
>>51822054
fucks sake, I shouldn't have posted here

people, go to >>51819395 and report/ignore/hide this shit

sage goes in all fields
>>
File: not_today.webm (1 MB, 720x404) Image search: [Google]
not_today.webm
1 MB, 720x404
Ask your beloved programming literate anything.
>>
>>51822292
When did you first forsake yourself?
>>
bamp
>>
so /g/ what are you working on?
>>
>>51823114

Been teaching myself C for 6 days.

Made a calculator that adds two integers entered via stdin user input.

>tfw I feel like a boss even though it's just a fucking two number calculator

Also; can someone give me a simple example of the if-else functions? For example, in my calculator I have a goto going back to firstValue which is the first printf/scanf in the program.

I want to be able to quit the calculator by entering something like "stop" and then an "Are you sure?" answerable with a Yes/Y or a N/No. Currently the scanf only accounts for an integer format (%d).
>>
>>51823343
CAN IT AVERAGE 2 INTS? IN C?!?!
>>
How would I go about making a parser?

Like seriously where do I even start?
>>
>>51823372

Wouldn't it just be easier to add two integers and then divide it by two?

Like damn. So hard to work that out.
>>
>>51823642
>overflow
kill yourself
Thread replies: 67
Thread images: 7

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.