/dpt/ - Daily Programming Thread

Generic Code Picture Edition

Previous Thread: What are you working on, Sup Forums?

Other urls found in this thread:

hastebin.com/iyetiwokiy.php
youtube.com/watch?v=h8T3PWauYF4
twitter.com/NSFWRedditImage

First for VHDL

Second for akari-bbs!

Working on {code} tags right now.
Also planning spoiler tags.
What other kind of tags are worth implementing?

This is my code for making an object move around the edges of a square level. It works, but it's pretty fuggin' hideous. Is there any way to fix it up a bit?

hastebin.com/iyetiwokiy.php

That's fucking awful code

>Second for akari-bbs!
not
>Second for akari-bbs[!!]

fucking newfags

Hey /dpt/,
I made a small game in Python and I wanted to give it to a friend to play it. It's just for fun and filled with inside jokes.
I don't want him to see the source code though, I know it's nothing special and it only took me a couple hours to create it but I don't want him to judge my style.

So, is there any way to compile Python files into an executable or something, making it impossible for him to read the source code?

write it in a language he won't understand like Lisp or Haskell or English

I don't know those though and I don't feel like writing it again from scratch. As I said, it's not really something big or important, it's just a project for fun that I started yesterday.

Fuck VHDL

Representing Chisel

how many LOC does the parser have?

Honestly code tags are all we need since embedding a spoiler tag in a code tag may complicate things

for i in sys.argv:
print(sys.argv[i])

TypeError: list indices must be integers or slices, not str

What am I doing wrong?

Your i is a sys.argv[?], not an integer.
You can simply print i, or do for i in len(sys.argv)

Thank you senpai.

[tex] and [aa]

no worries f4m, pythons lack of static typing makes some obvious errors a little hard to track down when you don't know what to look for.

Has anyone tried running a compiler from the Sublime console? It would be pretty ace to compile from Sublime on Wangblows.

Jewgle turned up
{
"cmd" : ["gcc $file_name -o ${file_base_name} && ./${file_base_name}"],
"selector" : "source.c",
"shell": true,
"working_dir" : "$file_path"
}

But I haven't tried it yet.

Is it a meme that you guys learn several coding languages or can you actually program in many languages? I'm reading a book on Java atm and learning it all is quite daunting. I can understand how once you have basic concepts down (like loops and matrixs) you'd learn another language easier, but there is still a lot of stuff to learn.

input parse and sanitation is about 352 loc
presentation-side parse is about 150 loc

I could just exclude code tag regions from [tag] replacement parsing until the end, making {code} its own special case.

What do those do?

it doesnt take long to adjust

Depends, there are sane languages where if you know one you can pick up the others very fast, Java is one of them, Python is another, C/C++ has some additoinal concepts you need to know but otherwise very similar to these, then there are special snowflake languages that ignore the standard ways of going things and do everything different, like Haskell, and Cobol, these are called meme languages on Sup Forums

It's a continuous process. You can be fine learning one language only, but you're better off knowing at least a few. "Knowing" a language means you can use documentation and experience to understand features of the language you may not have seen, not knowing it all by heart.

Fully mastering the java ecosystem is a very daunting task, but in order to "know" java you don't need to know about every library and every single nook and cranny of the spec.

>has never seen minified code
There wouldn't be any spaces either

The first language is the hardest. Java is good because it's popular and has C-like syntax (as opposed to Python or a functional language).

Going from paradigm to paradigm is harder though.

I have just "learned" c++ in less than a month. Its not that hard if you znderstand the basic concept and design behind the language

Has anyone here ever got GLEW to work in Code Blocks? I've tried everything but I just cannot for the life of me get it to work.

Is there a job market for half-pen tester, half-software developers?

>write it in a language he won't understand like Lisp or Haskell or English
kek

I think devops is as close as it gets

>nonfree
kill yourself

>What are you working on, Sup Forums?
I implemented that search box to my C# thing. I have a quarter of an idea how I did it but god damn it fucking works.

no

I'm making a 3D engine from scratch with a friend in C++.

It's been 70 hours, but right now I can render 12000 MattDamon-Cubes rotating in every axis in a 3D space with ~50 fps.

Feels good.

What C# thing?

Damon, son! You were bourne to program.

does anyone have anything on making my own toy p2p network?
like how do i prevent a message going round forever and ever?

my loli waifu simulator. its about 75% done

Know the cost!

Implement a Time-To-Live field in your message header. Each node that routes the message should decrement its value by one. Once the value is zero, the message is discarded.

How much have you programmed? Starting out with TCP sockets in python is a pretty fun way to get started

>I don't want him to judge my style.

Don't be embarrassed, user. Worst case, he'll give you some great tips for the future.

meant to point to Doesn't really matter though because I didn't read your question. Use TTL

how would i know what to set the initial TTL value to?
do i need to build a graph of all of the nodes on the network?

try QT Creator.

Just to update on this and help any fellow anons out because this is really, really convenient...

If you want to run a compiler straight from Sublime, you can go to Tools->Build System->New Build System

Put:

{
"shell_cmd" : "gcc $file_name -o ${file_base_name}",
"working_dir" : "$file_path",
"variants":
[
{
"name": "Run",
"shell_cmd": "gcc $file_name -o ${file_base_name} && ${file_path}/${file_base_name}"
}
]
}
Save as name_of_your_choice.sublime-build

And now when you run "Build" it'll compile and launch your open file from the shell.

I did this for C but in theory you could use any language.

Made me chuckle and warmed my heart. Thanks man.

Fucked that post up somehow, sorry:

If you want to run a compiler straight from Sublime, you can go to Tools->Build System->New Build System

Put:
{
"shell_cmd" : "gcc $file_name -o ${file_base_name}",
"working_dir" : "$file_path",
"variants":
[
{
"name": "Run",
"shell_cmd": "gcc $file_name -o ${file_base_name} && ${file_path}/${file_base_name}"
}
]
}


Save as name_of_your_choice.sublime-build

And now when you run "Build" it'll compile and launch your open file from the shell.

I did this for C but in theory you could use any language.

>tfw labwork in Prolog
Shits comfy

if i have no programming exp but am not retarded, how long realistically can i learn c or c++ and be able to make everything on this list without cheating or looking up the code?

30 years

>N00bz

3 months

Some of those things have components that could take a very long time, depending on what your autism level is.

For example, one could spend a VERY long time developing a Battleship AI that learns from games played and tries to act more humanlike.

A text-based game is trivial, but the actual content could take many months to write and design.

Like anything else you do, you'd want to define your scope of work for each thing going in with acceptance criteria so you can just shit out the project and move on, if your goal is simply to complete them all. You could spend the next 5 years of your life developing a rogue-like.

Why do you name your text board after a lesbian loli.

>text adventure game

Great, what do I win?

After a month of painful learning of JS I decided to abandon webdev and now I'm learning Java.

I was about to abandon programming in general when I had to deal with all those nested and callbacks but then I realized it's not programming that I hate, it's just the "web" part of it

I'm really loving this Java course. I wish I had abandoned the web thing earlier!

I was deciding between Python and Java but ultimately decided to go for Java, as I think it will make it easier if I later want to transition to either C++ or C#

Webdev is pretty cancer, and I think you're on the right track.

You're right about it transferring more fluently to other languages that were based out of C.

C# is easier to get into than Java, but I think any of the languages you mentioned are fine as an intro language for general dev.

Java will have more use for you, i.e. android apps, unless you're going for data crunching shit in python. I love both languages though, Python was a good teacher.

Thanks user! Your encouragement means a lot.

im estatic, im passing my college exercises without even cheating again.

london?

It's a weapon to surpass Metal Gear

why'd you cheat, faggot?

nah? what about it?

learning functions was slowly taking my life away from me. and im shit at coding off the top of my brain so i just find some broken code and debug it normally

I'm trying to find out if you're in my area.

Only women and faggots cheat, so either way, you're probably looking for a cock to suck and I'd be happy to provide.

What programming language is the class?

HEY! BE FUCKING NICE

I asked a single goddamn question, and "HEY! BE FUCKING NICE" is not a valid answer.

You could have even spouted nonsense like "BRAINFUCK!" or "FALSE!" and you would have actually landed on a programming language, however unlikely it may be that a university teaches a class with those languages as the subject.

When should you give up and admit that programming is not the career for you?

> android apps
about that, some beginner questions I have

how much exp would you advise me to have with just pure Java before going into Android ?

and how hard is to get into Android programming once you know the in and outs of Java ?

The sooner, the better.

>how much exp would you advise me to have with just pure Java before going into Android ?
You should be very familiar with the syntax and how to import and use libraries.

>and how hard is to get into Android programming once you know the in and outs of Java ?
It's more tedious than anything, but there are plenty of resources and code examples to build off of.

What country are you from? The space before the question marks is a dead giveaway.

rolling

Slovenia.
>The space before the question marks is a dead giveaway.
Really ? Which country does that ?

the n queens problem
no cheating faggot

It's not a giveaway as to which country you're from, but it IS a giveaway to the countries you're NOT from.

Only non-English-speaking natives constantly put spaces before their end-of-sentence punctuation, so it's safe to say you're not from the US, Canada, or UK.

lol'd fucking hard in the train

Like the fact that I put the dollar sign at the end of the number, like: 100$

checked.

...

Wasted digits.

what would you do with those digets if you had them?

my_dict = {} # empty dictonary
grades = {'Ana':'B', 'John':'A+', 'Denise':'A', 'Katy':'A'}
grades['Sylvan'] = 'F' #she missed half the class
del(grades['Sylvan']) #Suspended for excess tardyness, some people dont want to learn
grades.values()

>C++ is easy if you know Java
>COBOL ignores the standard ways to do stuff
are you high right now or just retarded?

Do any of you do 3D graphics programming? I'm currently doing research on a cloth simulation in WebGL.

once you have a grasp of the general concept of both a high level language and a low level language the only real difference most of the time is syntax.

That's actually a boy, isn't it?

>low level language
assembly?

I would just learn how C compiles and understand how it works. Working with actual Assembly is cool but rarely practical for the average programmer.

I watched this series to get a decent understanding of Assembly on microcontrollers, would recommend.

youtube.com/watch?v=h8T3PWauYF4

I've programmed in various languages since I was a kid and eventually got less shit at it at a certain point.
Still, I won't be able to complete more than 90% of your pic, because even with all that times, there's still concepts I haven't been exposed to, or even bothered to learn.
None the less, I'm confident I can do most of these projects without having practiced them before, specifically.
Also, there are a few projects on the list you can't possibly do as you would recite your alphabet, without looking some material up, I doubt someone ever bothered to memorize the documentation of both NTP, FTP, Telnet and IRC.

So a definite answer would be between what said and .

tfw we started on scheme today in class but i already read sicp

>currently in Business Intelligence
>good with python and SQL
>want to upskill to a more technical job but not sure what to aim for

Thinking backend weeb dev, data engineering, or possibly trying to move into data science through a data analysis role.

Django devving is definitely the easiest of them but not sure what the career prospects would be like after a few years.

What do?

That doesn't help. :(

roling

somebody save that little girl from pbear

kys

you can compile and even compress the files, and there are lots of ways to obfuscate python code easily. also, learn about its internals.

...

Language with best potential to make money fast?