/dpt/ - Daily Programming Thread

old thread: Keep overflowing the stack, Hime!

Other urls found in this thread:

hackage.haskell.org/package/brick)
en.wikipedia.org/wiki/Binary_space_partitioning
roguebasin.com/index.php?title=Basic_BSP_Dungeon_generation
github.com/dnschneid/xfce4-genmon-plugin/blob/master/panel-plugin/main.c
arduino.cc/en/Reference/Cast
root.cern.ch/
root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html
twitter.com/NSFWRedditVideo

Please post an anime image next time. Thanks.

>i want to work in computers!
>but I don't want to interact with anyone
>or even come into work
>in fact, just gimmie my paycheck and you can call me on skype sometimes :)

How do these people even function?

that's me, it can get pretty rough desu

I already told you, I want to sip lattes while hacking on my macbook at Starbucks. I want to be a code artisan.

hi /dpt/ I want to start learning C
What's the best place to program in?
I'm using unbuntu
I've been writing some simple programs in Python and just calling them in the terminal
Is this a bad approach?
If it's not too bad can I do the same with a compiler?

Well, I would be fine with living in an apartment or home for months or even years. But I would need the freedom to go when I want within reason (leases etc)
Finding a place to live isn't as hard as a career though

They would know I'm working because they would have a product.

>Because I'll have to be in a certain place at a certain time and would like to keep that to a minimum so I can be other places.
>It has nothing to do with interacting with others.
>I actually have friends around the world and would like a career that would allow me the freedom to be where I want when I want if I can still get the work done.

How do you even reply? If I didn't have people to see, I wouldn't be traveling.

You're an entitled piece of shit and you're not going to get anything like the idealistic job scenario you keep describing.

And you're never going to get it if you keep up that entitlement complex.

I think you have some issues you need to work through.

watching changes on a xml file and sending the changed data via websockets

Nodejs, python or C?

Doing shit from the terminal is completely viable, and is the preferred programming environment for a lot of people.
>If it's not too bad can I do the same with a compiler?
The way to compile and use a basic single source file C program is just
gcc myprog.c -o myprog
./myprog
After your code gets to be more non-trivial, you probably want to look into using Makefiles to automate the compilation process.

node if you're hip, C if you just want it to work

Ah I see
I'll just start playing with it when I start the ansi book tomorrow
Thanks user

I honestly wouldn't mind programming in a workplace environment... although it would certainly take getting used to, since talking with people fucking ruins my concentration.

Is there any realistic scenario where one would make use of an array with 3 or more dimensions?

3D space MUD?
Cellular automata in 3D?

Between the three... if performance is critical, use C. Given that the task is rather I/O bound, you should consider carefully how much work your program is going to be handling.

Otherwise Python.

Okay, so... working with a friend on an idea for a roguelike with some similar mechanics to Binding of Isaac. Don't know if this'll actually go anywhere (it'll probably end up abandoned eventually), but I think I'd at least like to screw around with some random dungeon generation shit anyways. Something I'm thinking about is how the hell I should represent this shit in memory. What I'm thinking about is I'll have some container class I'll call Dungeon. This will contain a vector of another object called Room. Each Room has four pointers to possibly adjacent rooms. The pointers can be null to represent that no such room exists. The first element of the vector will be the entrance to the dungeon, and subsequent elements will be added as the dungeon is generated.

I'm not sure if depth first or breadth first is best for dungeon generation, nor do I know if there are any particularly useful algorithms for this kind of stuff. Does anyone by chance know of any literature on the subject?

I don't remember but I saw somewhere a thing describing how you iteratively partition your dungeon floor until you have the rooms you want

i need help with sparkfun ir sensor library. who uses this library? trying to convert the returned value but it fails to convert the data type no matter what. sigh......

Have you read the documentation before coming here with your questions?

yeah i have 10 tabs open trying to fix it. i am not c++ programmer so this is not working out unfortunately

post code

im stumped Sup Forums
how do I print a Key?
I'm pretty new, I don't know about ChTypes
are Keys a subste of ChTypes?
pic realted

Node if you want to do it in a few minutes and forget about it, otherwise whatever you like.

If you have any C++ specific questions, I can answer them. It's not exactly the most user friendly of languages, but with proper understanding of it, it can be a very powerful tool.

If you are just messing with curses that's fine, but brick (hackage.haskell.org/package/brick) is a terminal UI library that fits Haskell better, as opposed to just being thin wrappers over curses bindings

I want to convert the returned float/string to int so i can do temperature monitoring and logging. it is done with arduino. nothing works though. the code in the picture outputs the temps in decimal every 2 seconds. i been trying for few hours now to convert

Why are ypu só mad user? You seem like a boss that promjses the world butwould ratherinflict misery

>OOP fags
en.wikipedia.org/wiki/Binary_space_partitioning

see i forgot to quote your posts

Oops, (hue) meant for
For my retardation, have another link.
roguebasin.com/index.php?title=Basic_BSP_Dungeon_generation

x64 SSE enabled assembly.

I'm trying to edit this code and i have some questions.

github.com/dnschneid/xfce4-genmon-plugin/blob/master/panel-plugin/main.c

This fairly simple xfce panel plugin which runs a bash command when a preset timer runs out and then displays the string returned by the bash command.

As it is now it only updates, calls the command and prints a new string, one two occations.

It updates when the timer runs out. See function on line 267.

And it updates if any changes has been made to the settings (different timer, location, etc). See fuction on line 630.

The function that makes it update takes a struct as an argument, and is located on line 105.

The program supports a clickable icon which when clicked can run a bash command by itself. The click function is located on line 84.

Thanks for following me so far, now here's my problem. What i'd like to do is call the update function from within the click function so that whenever i click the button, the program updates and generates a new string. However since the update function takes a struct as an argument, and i'm unsure if i can send a struct from within the "ExecOnClickCmd" function, i am unsure how i would go about doing this. And since i'm pretty sure i have to compile this every time i want to see if it works i'm not very drawn to experimenting.

tl;dr How easy would it be to run the DisplayCmdOutput(line 105) fuction from within the ExecOnClickCmd(line 84) function?

>float to int
Use an ordinary cast.

>String to int
If this is an STL string, stoi. Otherwise, atoi/strtol or similar.

Thanks. This looks like an interesting approach to the problem. I'll mull around with it and see if it might be useful.

Hi Sup Forumsuys. I was wondering if i could use SSH from ubuntu to access a raspberry pi (or another ubuntu/windows desktop) to get my data even from university. Should i get a static ip?

Would it be as easy as this?

*edited line 102

Like this sorry, i thought the p_pvPlygin and poPlugin was the same.

Yes you can ssh from Ubuntu to a raspberry pi, even at a university (unless your CS department is retarded and blocks ssh).

A static IP may not be necessary, unless this is going to become a regular thing.

I see no picture. Also, docs say it should be valid.

arduino.cc/en/Reference/Cast

I am going to smash this arduino into million pieces soon. ordinary cast does not work.

picture f--king related

forgot to upload the picture, it is here

Arduino is a pretty damn annoying, yes.

What is a simple library for loading .obj 3D models for use in OpenGL?

arduino casts weridly
try int(MotorTemp) instead

I don't even allow skype calls or phone calls
I only communicate with my clients directly via email, and then indirectly with timesheet submissions and updates posted to team sites and source code repos
it's pretty nice, I must say

same error. sigh. how can arduino be so broken.

>invalid cast from string to int
lel

you are retard, did you even read

Which programming language would you suggest me for building Web services?

I'm thinking about Java(Spring)

this shit still does not work. i give up

Good, you are a looser and a fag. Programming is not for you.

small number of users/personal project? python
large number of users? c or c++

you sound autistic... go troll some other board

you need to learn how to program before you can program.
this is common sense.

Nah, you're a cunt.

If you can't figure out how to cast on any given programming language in 45 minutes, you might be retarded.

Unity

Fucking kill yourself.

lol a cunt?

fuck off or paste the working code then smartass

almost every game engine out there, even shit java ones, even tetris models etc.

What does therm.object() return? Is it a string or integer or float or something completely different?

Why are you even converting anything?

You were given a fine advice that you ignored. We are not planing to do a fag's own work, especially for something that trivial that would be solved if you bothered to actually read about the language you are using.

I don't know of any language that supports implicit or explicit conversion between strings and numeral values. That wouldn't make sense.

No where is it guaranteed that your string won't be something like "ASD2152A---", how could you possibly convert that directly into a number?

Therefore (int) "somestring" isn't valid.

>any language that supports implicit or explicit conversion between strings and numeral values.
python and sql
probably every functional language too, but I don't know any of those

>probably every functional language too, but I don't know any of those
How could you say "probably every functional language" when you do not know any of them?

What python and sql do if the cast fails?

wtf happened to fsf?

>facebook
Did you really think that the actual FSF would have a facebook?
Also, get out you fucking normie.

My problem is so easy not 1 programmer here can fix it lol okay

I knew what i was expecting and i got it

>sql
The transaction fails. Any changes would rollback automatically, with default settings. You've got to handle it.

it used to be legit a couple of months back though, in line with c+=

>normie
autist

in sql
>1 + "1" = 2
>1 + "abc" = 1
an in some cases, sql will interpret 1 + "abc" to mean something else, like to return 1 as the value and name the column {whatever it was} + "abc"

nevermind about python, it actually throws an error
though I was pretty sure it would cast it

>lol okay no one wants to help my stupid ass so I'll just accuse them of not knowing how to do it to bait them to solve my problems for me

You need to use a method or function to do that, read the docs

>1 + "abc" = 1
Which DBMS does this behavior?

MSSQL doesn't.

Oh, I thought you meant the actual FSF, sadly since nobody remembers C+= anymore I didn't know that this is what you meant.

>nobody remembers C+= anymore
It's not that old though. Like 2 years max I think.

i started doing codeforces contests a while ago. Is this a good way to learn something or a waste of time? Also what rating can be considered 'decent' there.

MySQL

to a typical employer, anyone who can do just a few basic problems is employable

MySQL gives me cancer.

I have to manage one MySQL DB at work, and it's the only one that I'm constantly having to fuck with because shit just doesn't werk.

This, pretty much.

These days, programming languages are so abstracted and easy to perform with, that employers are hiring non-programmers as programmers.

For example, a math major buddy got a job as a programmer, with the company basically saying
>"We can teach you C# in a month or two, but we can't teach you differential equations within that time."

I started learning python on codecademy, is that ok or should i stop?

the therm.object returns a float. i read the header file and it states this. i tried to use advice and it did not work then people attack me for it lol when you spend this much time on it you just want it fixed.

don't worry, you're not actually learning anything

good choice
feel free to ask questions here

yeah, learning the syntax of python can be useful

I wish there was shades of color or something to indicate sarcasm.

>and it's the only one that I'm constantly having to fuck with because shit just doesn't werk
it does take some getting used to, that's for sure

laughed heartily, thanks user

lol

Got it working

ok whatever man
because we care that much huh

For anyone trying to learn C++, especially trying to get a better grasp of the standard library, try CERN ROOT.

Yes, it is a data analysis framework, but the catch is, that is comes with a pretty nice C++ interpreter. This means you can prototype and toy with libraries in an interactive fashion. Just like you could do in python or LUA.

root.cern.ch/

There is also the root primer that gives a brief introduction by examples:

root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html

I know I'm late, but

>keeping your server rack next in your muggy basement next to your furnace

wut

>le entitled meme
Man has dreams, automatically makes him better than your sour-ass

Ok, can you suggest me some good book for total python beginner? I never build anything in python, i have experience in c/c++/java/php

if you actually have experience in those languages, then just burn through the codecademy thing, then google "python list comprehension" and you're done
python is way simpler than all 4 of those

Just get into its documentation.

This and then go for documentation for stuff like libraries/modules, functional python and lambdas and OOP.