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

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 335
Thread images: 38

File: himegoto.jpg (407KB, 600x800px) Image search: [Google]
himegoto.jpg
407KB, 600x800px
old thread: >>55767074

What are you working on, /g/?
>>
>>55774900
Kill yourself, fucking faggot
>>
first for 12yo girls are sexy
>>
how do you feel about subtracting about subtracting ascii values from chars to convert them to integers?
>>
>>55774971
As far as I know that's the proper way to do it.
>>
>>55774917
shamwow, those are some harsh bros bro

skittle your steez brosephina

we're all jenga in the end brostradamus
>>
>>55774971

Tried and true.
>>
My program crashes, but only sometimes. It never crashes when I'm in debug mode. That's usually a sign of a mishandled pointer, right? I can't find any non-deleted pointers anywhere.
>>
>>55775019
uninitialized variables, maybe?
>>
>>55775019

Have you tried shotgun debugging?
>>
what programs do you guys even make? what is even the point of programming? You're just propagating the senseless consumption of media.
>>
Assembly or C first?
>>
>>55775117
doing it all wrong. prolog first, then ada
>>
>>55775092
>You're just propagating the senseless consumption of media.

You're just propagating the pointless entropy of the universe.
>>
>>55775047
I just found a single unassigned boolean that I don't even remember creating in a file that hardly ever gets used. Removing it seems to have fixed the issue.
Unless of course this is just a fluke sequence of non-crashes that will end any time now. I really find it hard to believe that removing a single variable could fix it, especially since this problem just recently started, after months of no issues.
>>
>>55775144
so, you're agreeing with me
>>
>>55775141
why are you suggesting high level languages for someone that wants to learn low level?
>>
from bs4 import BeautifulSoup
import urllib.request
import re

url = "https://boards.4chan.org/c/thread/2699162/kirino-thread-70"

req = urllib.request.Request(url, headers={'User-Agent': 'Mozzila/5.0'})
html = urllib.request.urlopen(req).read()
soup = BeautifulSoup(html, "html.parser")
links = []

type = ('.jpg', '.png')

for link in soup.findAll('a'):
if link['href'].endswith(type):
links.append(link.get('href'))

print("\n".join(links))


Collects img urls from a thread but I'm getting duplicate entries, any idea why? This is my first Python program.
>>
>>55775179
because if you want to science and actually do real shit you learn high level

if you want to fuck a computer you learn low level
>>
Using IntelliJ, tried to call a method that is listed on Java Documentation. Actually I am LITERALLY just copy pasting from the documentation and am getting compile errors.

https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/ChoiceBox.html
>>
>>55775210
> people who know low level languages can't do "real shit"

have fun holding hands with your interpreter
>>
Trying to learn how to use a graphics library for C++ (SFML), and am using this tutorial:
http://www.mjbshaw.com/2013/02/building-sfml-2-with-c11-on-os-x.html

When I run this code:
cmake -G 'Unix Makefiles' \
-DCMAKE_OSX_ARCHITECTURES='i386;x86_64' \
-DCMAKE_CXX_COMPILER='/usr/bin/clang++' \
-DCMAKE_C_COMPILER='/usr/bin/clang' \
-DSFML_BUILD_FRAMEWORKS='ON' \
-DSFML_INSTALL_XCODE4_TEMPLATES='ON' \
-DCMAKE_CXX_FLAGS='-stdlib=libc++' \
-DCMAKE_C_FLAGS='-stdlib=libc++' ../


I get the error in pic related... How did I fuck up, and how can I fix it?
>>
File: 49548393_p0.jpg (177KB, 707x1000px) Image search: [Google]
49548393_p0.jpg
177KB, 707x1000px
>>55774913
Thanks for the help on HashMap, I was aware of its existence and it's amazing to see a really clever use for it outside of academia.
>>
>>55775219
make sure you have the jdk8 and the java 8 language level set up in your project settings
>>
>>55775233

Try adding "-DCMAKE_SYSTEM_NAME=Darwin". It seems to not recognize your system despite correctly detecting you have Apple's version of Clang as opposed to regular Clang for Windows/Unix.
>>
>>55775117
C -> Assembly -> C
>>
>>55775256
>I was aware of its existence and it's amazing to see a really clever use for it outside of academia.

Maps/Dictionaries are probably the most used structure behind Arrays/Lists
>>
I've never used classes in haskell
I understand how its supposed to define behavior, and that types that support those behaviors can be a member, but what other behavior can there be?
>>
>>55775366
do you mean typeclasses? a typeclass just says some object "can be thought of" as ____

for example, a list can be thought of something you can map over. so can a tree. that's why you can make them both Functors.

are you asking for examples of typeclasses?
>>
>>55775201
4chan api
>>
>>55775210
lol, just lol
>>
>>55775299
Hm... Still not working. Not sure if it helps, but I have the GUI version of CMake
>>
>>55775366
i mean most haskell tutorials guide you this

did you just go in without learning?
>>
>>55775386
yes
I have no idea on how to include typeclasses to the fullest
I need to know when to use it
pls halp

if you could provide an example that'd be great
>>
>>55775256
Hashmaps are used extensively in networking. DHT for example refers to Distributed Hash Table, which is another word for Hash Map.
>>
>>55775420
just read learnyouahaskell.
there's a chapter on typeclasses
>>
I just got done with some stuff for my website.

I had the fellows at /wdg/ help me troubleshoot a massive shitfest that turned out to just be gey.

Apparently loading 2000 lines or so in a single module takes a while.
I switched a very long select element into just a numeric input box.
problem solved.
>>
>>55775436
I did, but I still dont know when to use them
>>
File: ars_longa_vita_brevis.png (152KB, 744x638px) Image search: [Google]
ars_longa_vita_brevis.png
152KB, 744x638px
http://norvig.com/21-days.html
>>
>>55775409

You put the system name after the "../"...

And also, I did a bit more digging and think the dual 32 bit and 64 bit binary setting might be messing with your build also. You could try to only go 64 bit with "-DCMAKE_OSX_ARTITECTURES='x86_64'" or committing the option entire since I'm sure CMake can configure automaically.

macOS hasn't used 32-bit since Lion so I'm sure unless you care about legacy, it would be fine to drop i386.
>>
>>55775452
then you probably don't need them yet. unless you're building something right now that you're having trouble with/you think you might need typeclasses for? if so post details
>>
>>55775210
someone screencap this and attach it to the CS grad meme, please
>>
Do you guys feel like you learn anything from browsing these threads?

I've learned a lot from 4chan about various topics over the years , and I program for school but the professors make it so dry and lifeless. Can memes make me love programming again?
>>
>>55775493
making shit and learning new shit is what makes programming fun
>>
>>55775493
I only visit this place so I can learn the new memes and meme my code that I don't wirte because I spend all my time here
>>
File: 2016-07-25a.png (899KB, 1360x738px) Image search: [Google]
2016-07-25a.png
899KB, 1360x738px
>>55775493
sure, just make a homepage hentai waifu webapp.

I'll be back on this after I finish more with my website
>>
quick, give me something fun to do in haskell

hard mode, the end result is useful
>>
>>55775092
>what is even the point of programming?
I got into it because I liked vidhya. Now I do it to get paid.

>>55775117
the stuff you learn in C is actually applicable to things you might want to make in the future. Assembly feels like more of an exercise in learning how does computer work.
>>
>>55775263
I do, I'm able to compile other things and call other methods and even compile other JavaFX projects but this isn't working.
>>
>>55775532
terminal
>>
>>55775117
Assembly for a sane architecture like ARM or 68k.

>>55775179
You're confusing "low level" with "badly designed."

If someone wanted to learn about dynamic typing and closures, would you start by teaching them how to write JSFuck in JavaScript? No? Then why would you teach them C? C is JavaScript-tier crap made by noobs.

All of the low level programming in C is "undefined behavior" anyway.
>>
>>55775502
I just have so many negative associations with it now because of school stress. I'm hoping that I can find some renewed genuine interest and enjoyment, because its starting to feel like a chore doing assignments and such
>>
>>55775549
a terminal?
i'll call it ht, not logo
where do I even start

I guess I could a tui, but then how can a tui be inside a tui
any places to start?
>>
>>55775570
*no logo though
>>
>>55774900

>>>/lgbt/

Fucking faggot trap animeposter
>>
>>55775598
you know he gets off on being called out
don't reply to him
just realize he will do this until he dies or 4chan is deleted
accpet it
>>
what exactly is the point of having a server? If I download a file onto it I can't retrieve it without re-downloading it from that source. I can see as a proxy but I feel like it'd just take a lot of time for little payoff.

>>55775201
you are getting both the images and their links
you need to do a test like if str(link['class']) != 'a'
>>
>>55775603
I'm sick of the gay agenda being pushed, there has to be a way
>>
>>55775642
there is a plan, but I won't say it because he'll be aware of it
just think, what can you do
>>
>>55775642
hime isn't gay
>>
>>55775461
I know I'm being astronomical levels of retarded, but like this?

Or more like this:
cmake -G 'Unix Makefiles' \
-DCMAKE_OSX_ARCHITECTURES='i386;x86_64' \
/DCMAKE_SYSTEM_NAME=Darwin
-DCMAKE_CXX_COMPILER='/usr/bin/clang++' \
-DCMAKE_C_COMPILER='/usr/bin/clang' \
-DSFML_BUILD_FRAMEWORKS='ON' \
-DSFML_INSTALL_XCODE4_TEMPLATES='ON' \
-DCMAKE_CXX_FLAGS='-stdlib=libc++' \
-DCMAKE_C_FLAGS='-stdlib=libc++' ../

>>
>>55775642
the internet is the gay agenda. wake up homes. they have you ese! You've become a farmhand to the 'putadoras
>>
>>55775493
I haven't learned anything from 4chan.
if anything, I've become dumber. I always wonder what kind of things do people learn from 4chan, and what kind of people visit this piece of shit website.

dunno why I'm still here, I guess it's because of the need for """"socialization"""".....
>>
Where is the line drawn on copying code in a professional environment?

I don't mean straight up copy-pasting a full program. I'm talking about something as simple as copying a sorting or pathfinding or fill algorithm straight off a tutorial website.

I'm obviously more than capable of personally writing out a bubble sort, to use a very basic example, but my job isn't to reinvent the bubble sort. It feels like a waste to spend any amount of time re-writing (and potentially accidentally messing up) something so absolutely basic.
>>
I just made my vim experience 1000 times better by finally setting up proper split management mappings.

" Split navigation
nnoremap <C-Down> <C-W><C-J>
nnoremap <C-Up> <C-W><C-K>
nnoremap <C-Right> <C-W><C-L>
nnoremap <C-Left> <C-W><C-H>

" Resizing
nnoremap <C-S-Up> <C-W>+
nnoremap <C-S-Down> <C-W>-
nnoremap <C-S-Left> <C-W><
nnoremap <C-S-Right> <C-W>>

" Easier splitting
nnoremap <M-Up> :aboveleft split<CR>
nnoremap <M-Down> :belowright split<CR>
nnoremap <M-Left> :leftabove vsplit<CR>
nnoremap <M-Right> :rightbelow vsplit<CR>

" Buffer navigation
nnoremap <C-PageUp> :bnext<CR>
nnoremap <C-PageDown> :bprev<CR>


The world must know.
>>
>>55775642
Get off the internet, get rid of your TV, become a NEET and never leave your house again.
>>
>>55775743
and thus you will learn nothing. churning out the shitshow themed crap companies make now. i salute you, you lazy piece of shit.

-love, your mom
>>
>>55775743
Copy-pasting anything from the internet is a terrible idea.

If you're using existing code as a guide (perhaps porting to a new language) and someone can look at what you write as say "yeah, this almost definitely came from this source" seeing them side-by-side, you've copied too much.

If the algorithm is so simple that all correct implementations are practically identical, you probably shouldn't need to copy.
>>
File: 1469340622776.png (91KB, 800x600px) Image search: [Google]
1469340622776.png
91KB, 800x600px
Is /dpt/ the last bastion of /g/ against full autism?

Seriously, this whole board is the definition of hypocrisy.

The gpu threads are the best example. They hate games, they claim they don't play them(they do) but they always have the latest GPUs and always talk about performance.


Now why do they need them? Cause they play games heavily? Or maybe they actually do something resource heavy? Fuck no, these asses play gaes 24/7 and they deny it.

What does it change that they lie about it? They are still a pathetic mess if theu are over 30..
>>
>>55775674

Who cares if he isn't gay or not. The bigger problem is that he's in no way programming related in any sense at all. Editing media to make him seem programming related is retarded and in no way makes the character any more technology related than he will ever be. He's essentially a "forced meme" at this point.

I was fine with Yuki because her original premise at least was somewhat programming related. But it's tiring that a character this old which isn't even programming related keeps on getting posted. It's tolerable but it is honestly tiring and stupid. At least post stuff from Lain, Battle Programmer Shirase or even New Game!. It's honestly better and infinitely more on topic than whatever the Himegoto spammer will ever post.

>>55775711

If you're going to use CMake, at least learn what the basic syntax is. "\" is used so you can write mutiple options on mutiple lines and not run into errors.

You need the following:

cmake -G 'Unix Makefiles' \
-DCMAKE_OSX_ARCHITECTURES='i386;x86_64' \
-DCMAKE_SYSTEM_NAME='Darwin' \
-DCMAKE_CXX_COMPILER='/usr/bin/clang++' \
-DCMAKE_C_COMPILER='/usr/bin/clang' \
-DSFML_BUILD_FRAMEWORKS='ON' \
-DSFML_INSTALL_XCODE4_TEMPLATES='ON' \
-DCMAKE_CXX_FLAGS='-stdlib=libc++' \
-DCMAKE_C_FLAGS='-stdlib=libc++' ../


Makes sense? Also, try the suggestion I told you earlier about ommitting i386 from the OSX architectures line.
>>
>>55775753
How is this different than a tiling wm?
>>
>>55775804
Instead of managing X windows, it manages vim windows. Vim windows are sorta like X windows, except instead of containing a pixel grid, they contain a character grid.
>>
>>55775821
Right. I'm asking what's the advantage? If I have i3 already should I still be using vim splits?
>>
>>55775829
It'll work over SSH, it is less resource intensive, it allows the windows to share buffers, etc. for easy manipulation in vim (though you could probably find a plugin to make everything work between separate vim processes), and it works in cases where you can't use a tiling WM (on a locked down school or work machine, for instance).
>>
>>55775801
Okay... Thank you for all the help, but it doesn't seem like CMake wants to work today... I copied what you told me I needed (and removed the i386), but I get the error in pic related... It probably has to do with my version of OS X, but then again, I'm new to the C/C++ scene
>>
all right can I actually get some advice on this? control flow seems a bit weird, with some preprocessing done in "huffman" and passing in the "" to parseTree manually - in java or python that would be a default argument. Should I make a helper function here?

data Tree a = Leaf a | Branch (Tree a) (Tree a)

huffman :: [(a, Int)] -> [(a, String)]
huffman xs = let t = consume $ map (λ(x, n) -> (Leaf x, n)) xs
in parseTree t ""

consume :: [(Tree a, Int)] -> Tree a
consume [(t, n)] = t
consume nodes = let ((t, m):(s, n):ys) = sortBy (comparing snd) nodes
in consume ((Branch t s, m + n):ys)

parseTree :: Tree a -> String -> [(a, String)]
parseTree (Leaf x) prefix = [(x, prefix)]
parseTree (Branch t s) prefix = (parseTree t ('0':prefix)) ++ (parseTree s ('1':prefix))
>>
>>55775858

What version of CMake are you using?

Type

cmake --version
>>
>>55775903
Version 3.4.2
>>
how much does it take you to learn a new language?
I feel bad, and become quickly demotivated, after just a couple days of trying to learn a language, only to see that i've seen the most basic shit (ints, strings, functions) and nothing else
>>
>>55775942
what language senapi?
>>
>>55775942
personally, I don't learn a new language without a specific project in mind that is especially appropriate for that language

ex, state machine in haskell
>>
>>55775891
yeah, its never a good idea to have a dum argument
just make a general case in a helper private function, and make ur function a genral case
>>
>>55775913

That's not terribly old but you're not up to date. What did you install CMake from? You should have 3.6.1 or at least a 3.5 variant. I think 3.4.2 is before El Capitan.
>>
>>55775961
*make ur function a specific case
>>
>>55775891
yeah, make parseTree private unless its used elsewhere
and make t also private
so something like
huffman xf - parseTree t ""
where parseTree = ...
t = ...
>>
What's a good place to get started into OpenGL?
>>
>>55775976
I installed Cmake from an OpenGL tutorial like a week ago. The GUI version of CMake I have (the one from their website) is 3.6.0, but I'm unsure of where to update the CLI version of Cmake
>>
>>55774900
every time OP posts himegoto it fulfills a part of my life. ty based OP
>>
>>55775954
any lang. right now, I'm learning lua, before I tried C#.

>>55775958
for both langs I just mentioned, I had projects... but I haven't even started them, because I fear I'll have to google whatever stupid problem I'll find, so I want to learn "properly"
>>
>>55776007
Nigga, I've been trying to get a concrete answer and have gotten so lost in so many different ways...

But I found this tutorial, so maybe it can help you? (I had a bit of trouble with the Vertex and Fragment Shaders)

http://www.opengl-tutorial.org/
>>
>>55776007
Learn OpenGL the Hard Way by Zed Shaw
>>
>>55776007
a book
pic related
>>
>>55776021
Maybe you should have a goal in mind before mindlessly learning scripting languages.

You should have started with C desu senpai.
>>
>>55776011

I meant if you installed it from like Maccports, Homebrew, or compiled from source.

The GUI and CLI should update in tandem. You did something wrong somehow. Figure out how to correct your install and try again.

It sucks that setting up software sucks but it's honestly sometimes harder than getting productive with said software.
>>
>>55775961
>>55775982
thanks, will do. tfw more lines of code :(

>>55775997
so private just means in a where block? I guess that makes sense

>>55776021
you'll never get anywhere by "learning properly". just look it up as you go, your code is going to be shit while you're learning anyway. what were your projects?
>>
>>55776021
>>55775942
perhaps someone will recognize my problem... I made a similar post a while ago, and the response from some anon was that I should seek therapy or something.
I'm a very insecure, impatient NEET, you can guess that's not a good mix...

>>55776049
I already know the basics of many langs: C, java, python, golang, bash, ...
>>
>>55776011
Small correction: Just downloaded the binary files for CMake, but I'm not sure where to go from here... I'm told "Cmake is up to date when it clearly isn't
>>
>>55776060
Then maybe you should attempt a project.
It will force you to learn about the language you're using and force you to think programmatically, which is something that is severely lacking in programming tutorials, I notice.
>>
trying to learn shell as of this month and unaware why I need to learn it but I wanna fucking learn it sooooo
>>
>>55776057
You know... That's fine. At least I sort of know where a problem lies which is more than I knew thirty minutes ago... .Thank you anyway. I'm gonna post something on StackOverflow or something
>>
>>55776058
>you'll never get anywhere by "learning properly". just look it up as you go, your code is going to be shit while you're learning anyway.
hmm, OK, guess I should just do it, then

>what were your projects?
>>55776079
a multiplatform map app written in C#, using osmsharp (I didn't even touch it desu)
a (very) lightweight web app for queuing management, using Lua, to run it in cheap routers.

>>55776087
suggestion: read, and learn, these: http://www.shell-fu.org/lister.php?top
the first one can be replaced by "python3 -m http.server"
also, man bash when you need to find some specific thing
>>
>>55775563
this man just compared C to JavaScript
>>
>>55776073
>>55776088

Clean out your install or something before trying again. It's not even a matter of syntax at this point. You need to fix cmake itself on your computer because it is clearly confused on what CMake it is using. You have multiple versions or something going on. Sorry I can't help much in that regard.
>>
>>55776102

thanks anon
>>
>>55776107
C and JavaScript are both crap made by noobs with a lot of "wats" and "gotchas" because noobs don't know how to design a programming language or do a proper implementation.

>b-b-but muh Unix
It's a shit-tier ripoff of Multics.
>>
>>55774957
go home RMS, you're drunk
>>
>>55776179
give me an example of a programming language not made by a "noob"
>>
>>55776179
(0.o) remember there is somthing called differences... no one asked you to use those languages

and yeah im fucking butt hurt
>>
>>55776022
>>55776026
>>55776041
Thanks I'll make sure to look into all of these..
>>
>>55775638

>you need to do a test like if str(link['class']) != 'a'

How do I do that?
>>
>>55776179

What does Unix even have to do with the discussion? Stop shitposting.
>>
File: bjarne.jpg (23KB, 300x225px) Image search: [Google]
bjarne.jpg
23KB, 300x225px
why do so many C++ people hate boost ?

it's so fucking stupid
>>
>>55776282
this

boost IS fucking stupid
>>
>>55776282
the same reason most people hate C++

it tries to do everything and the result is an incredibly unwieldy, hard to use correctly, mediocre standard library
>>
>>55776282
complile_time += (boost::seconds)5;
>>
>>55776308

Not only that but it bloats size to the point where simple programs can't fit in my CPU's L2 cache and compile times are horrendous.
>>
>>55776329
why is that? is your cpu too old ?
>>
just started learning javascript (for money, don't worry)
what's javscript equivalent of gcc or python3
>>
>>55776352
you can always resolve all the problems with more computing power... right? :)
>>
>>55776368
you literally can though
>>
Is c++ the fastest programming language?
>>
>>55776430
binary is
>>
>>55776430
http://sonic-pi.net/
>>
Which is faster?

int main() { exit(); }
int main() {}
>>
>>55776430
no, but considering how much shit you can do it's almost as fast as C
>>
>>55775201

I did it, /dpt!

from bs4 import BeautifulSoup
import urllib.request
import re

url = "https://boards.4chan.org/c/thread/2695685/mamisan"

req = urllib.request.Request(url, headers={'User-Agent': 'Mozzila/5.0'})
html = urllib.request.urlopen(req).read()
soup = BeautifulSoup(html, "html.parser")
links = []

type = ('.jpg', '.png')

for link in soup.findAll('a'):
if link['href'].endswith(type):
links.append(link.get('href'))

links = sorted(set(links))
print("\n".join(links))
>>
>>55776485
why does it matter ? you launch thousands of programs a minute?
>>
File: 2016-07-26-234546_958x1058_scrot.png (167KB, 958x1058px) Image search: [Google]
2016-07-26-234546_958x1058_scrot.png
167KB, 958x1058px
>>55776485
...
>>
File: 2016-07-26-234905_958x1058_scrot.png (170KB, 958x1058px) Image search: [Google]
2016-07-26-234905_958x1058_scrot.png
170KB, 958x1058px
>>55776565
with best, possibly unsafe optimization
>>
>>55776565
>>55776596
>exit is more optimisable than no code at all
I think it's safe to assume from these tests that simply adding exit(0) at the end speeds up your code.
>>
>>55776617
And if you add it to the start, it'll speed your code up even more
>>
>>55776373
which compiler can use multi threading on a single source file?
>>
>>55776654
after tokenising?
>>
>>55776509
can be done with wget in one line
>>
>>55776617
> muh 0.00001 seconds per run
>>
half the people on /g/ love C and the other half despise it, make up your minds already
>>
>>55776745
Can you rephrase that in a way that doesn't sound stupid?
>>
>>55776745
People who hate C are the type of people who program in Windows.
>>
>>55775642
Have you tried killing yourself?
>>
>>55776509
not other anon, but here you go

unless you just wanted to learn beautifulsoup, in which case good job, that looks good

curl boards.4chan.org/c/thread/2695685/mamisam | ack '<a(.*?)</a>' --output '$1' | ack 'src=(.*?.jpg)' --output '$1' | cut -c4-
>>
>>55776745
C is not the right tool for anything anymore unless you code linux kernels or shit like that

I wouldn't even recommend it for beginners unless they are forced to learn it in school
>>
When was the last time you rewrote the Linux kernel in some meme language, /dpt/?
>>
>>55776669
at any point, where it would take advantage of 8 cores instead of 2 or 4
>>
>>55776841
I could imagine that being done with an assembler or brainfuck or some similar language
>>
>>55776835

Are you seriously asking if someone in dpt decided to port over around 15,000,000 + lines of code?
>>
>>55776745
>/g/ is one person
Fuck off.
>>
>>55776950

Inb4 the actual kernel itself is around 200 k lines.. I'm aware that the majority of the code is drivers / architecture code.
>>

<?php

$db_host = 'localhost';
$db_user = 'host';
$db_pass = '';

$db_name = 'chat'

if($connection = mysql_connect($db_host, $db_user, $db_pass)); {

echo 'Connected';
}

if ($databse = mysql_select_db($db_name, $connection)); {
echo "Database has been selected... <br />";
} else {
echo "Database was not found";
} else {
echo "Unable to connect..."
}

?>


why is it giving me an error about my first if statement ?
>>
File: output.webm (2MB, 320x568px) Image search: [Google]
output.webm
2MB, 320x568px
Explosions added! What else should I add?

Also r8
>>
>>55777120
specify your error

should you be using ==?

is $databse defined?

>>55777149
pretty cool anon.

maybe powerups?
>>
>>55777160
Parse error: syntax error, unexpected 'if' (T_IF) in

and yes $database_is defined i believe
>>
>>55777191
is it because you have two else statements?
>>
>>55777212
can you not have 2 else statements? im fairly new to php.
>>
>>55777120
>if($connection =
>=
>>
>>55777120
> if( ); {

this doesn't look right with the ;

but I haven't done php coding in years
>>
>>55777191
I don't think you're supposed to have semicolons after the if condition btw
>>
>>55777224
>>55777226
i removed the semicolons and it didnt do a thing

>>55777219
i deleted the =
didnt do change a thing so i put it back.
>>
File: gross.jpg (6KB, 125x125px) Image search: [Google]
gross.jpg
6KB, 125x125px
>>55777120
>$$$$$$$$$$$$$$$$$$$$$$$$$$$
>>
>>55777219
I think that's okay in perl and php, it assigns the value and evaluates it
>>
>>55777120
>$db_name = 'chat'

here you need a ;
>>
>>55774900
STOP POSTING THIS FUCKING LITTLE FAGGOT RREEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
>>
>>55777261
>>55777241
thx i fixed that one issue.

<?php

$db_host = 'localhost';
$db_user = 'host';
$db_pass = '';

$db_name = 'chat';

if($connection = mysql_connect($db_host, $db_user, $db_pass)) {

echo 'Connected to database server <br />';

if($database = mysql_select_db($db_name, $connection)) {
echo 'Database has been selected</br /> ';
} else {
echo 'Database was not found <br />';
}
} else {
echo 'Unable to connect to mysql server';
}

?>


now its giving me a parse error on line 20 about the '{' and i have no understanding to why it is.
>>
>>55777327
remove } from line 17
>>
>>55777357
unexpected 'else' (T_ELSE) in C:\xampp\htdocs\includes\database\connect.db.php on line 18
now giving me another error.
>>
most haskell code suffers from premature abstraction
>>
I've just seen some C# code do
(int)Math.Floor((double)f)
instead of
(int)f
why?
>>
>>55777327
>now its giving me a parse error on line 20 about the '{' and i have no understanding to why it is.
what's the precise error ?

>>55777364
put the } back in
>>
>>55777364
<?php
$db_host = 'localhost';
$db_user = 'host';
$db_pass = '';
$db_name = 'chat';

if ($connection = mysql_connect($db_host, $db_user, $db_pass)) {
echo 'Connected to database server <br />';

if ($database = mysql_select_db($db_name, $connection)) {
echo 'Database has been selected</br /> ';
} else {
echo 'Database was not found <br />';
}
} else {
echo 'Unable to connect to mysql server';
}
?>
>>
>>55777435
Parse error: syntax error, unexpected '{' in C:\xampp\htdocs\includes\functions\chat.func.php on line 20



with the bracket in this is what the error states.
>>
>>55777452
exact same problem still exists.
>>
>>55777463
>>55777327
nigga you have a double nested else

sort out your fucking indentation and count your brackets
>>
Why are hardware interfaces so weird and retarded?
>>
>>55777454
but there's no { on line 20

it looks fine now, maybe check the rest of your shit code
>>
>>55777471
i counted the brackets and viewed them in my editor, the last else goes for if the server unable to connect.
>>
>>55777496
well then pastebin your latest code to somewhere with linenumbers, include the compiler error
>>
Just write the code like a normal human being.

<?php
$db_host = 'localhost';
$db_user = 'host';
$db_pass = '';
$db_name = 'chat';

$connection = mysql_connect($db_host, $db_user, $db_pass);

if (!$connection) {
echo 'Unable to connect to mysql server';
}

$database = mysql_select_db($db_name, $connection);

if (!$database) {
echo 'Database was not found <br />';
}
?>
>>
>>55777505
<?php

$db_host = 'localhost';
$db_user = 'root';
$db_pass = '';

$db_name = 'chat';

if($connection = mysql_connect($db_host, $db_user, $db_pass)) {

echo 'Connected to database server <br />';

if($database = mysql_select_db($db_name, $connection)) {
echo 'Database has been selected</br /> ';
} else {
echo 'Database was not found <br />';
}
} else { // error here. error: Parse error: syntax error, unexpected '{' in C:\xampp\htdocs\includes\functions\chat.func.php on line 20
echo 'Unable to connect to mysql server';
}

?>

nothing much has changed other then that one error and the db user.
><?php
>$db_host = 'localhost';
>$db_user = 'host';
>$db_pass = '';
>$db_name = 'chat';
>$connection = mysql_connect($db_host, $db_user, $db_pass);
>
>if (!$connection) {
> echo 'Unable to connect to mysql server';
>}
>
>$database = mysql_select_db($db_name, $connection);
>if (!$database) {
> echo 'Database was not found <br />';
>}
>?>

>>55777519
still error on line 20 with that code
>>
>>55777530
Are you using PHP7?
>>
>>55777530
I get no syntax errors when linting this code with php 5.6.23(debian)
>>
>>55776596
What if you try including stdlib.h in "b" code?
>>
>>55777550
>>55777560
my b it was in another file. i got it going somewhat now. thank you so much guys.
>>
File: Zatoichi.jpg (76KB, 1598x814px) Image search: [Google]
Zatoichi.jpg
76KB, 1598x814px
I'm currently building a distributed filesystem/object storage system.

Nodes are just linux boxes running openssh, not node setup other than creating a useraccount and using a script to propagate encryption keys.

metadata is just in a sqlite3 database. everything is encrypted end to end and at rest and data chunks are replicated for redundancy and checked on occasionally to prevent bit rot form destroying your precious files.

Very easy to setup, use and maintain as long as you have some minor linux knowledge. I'm going to be turning it into an android at at some point.

I made it for myself because i hate the over engineered aspect of distributed file systems out right now.

Would this be something that people on /g/ would be interested in? I will eventually put it on github and GPL it.
>>
>>55774900
2d rpg cheese pizza
>>
>>55776282
ok i need to compile your stupid program

oh no your retarded shit requires BOOST!

hol up let me just compile the latest version (~100mb compressed) of boost just so that your one function doesn't stop the program from compiling
>>
>>55776617
>optimizing literally once-per-program functions
Sweet, sweet, premature optimization at its finest. Having fun wasting your time?
>>
>>55777149
Make the UI graphics inline with the rest of the graphical style.
>>
File: 1439391790068.jpg (143KB, 394x260px) Image search: [Google]
1439391790068.jpg
143KB, 394x260px
>>55777682
you have to pay for the privilege to use C++
>>
>>55774900
I'm parsing the output of
7z l Pictures.zip
from my DVD backups to get some contents info, like the most sized wallpaper for example.

#!/usr/bin/perl
use strict;
use warnings;

my ($name, $size, $file, $c) = (undef, 0, $ARGV[1], 0);

# 7zip table
my $table_pattern = qr{
(?<date> \d{4}\-\d{2}\-\d{2})\s+
(?<time> (?:\d{2}:){2}\d{2})\s+
(?<attr> (?:\.|\w){5})\s+
(?<size> \d+)\s+
(?<compressed> \d+)\s+
(?<name> (?:.+\\)+.+)\n?
}x;

open(my $IN, '<', $file) || die $!;

while (<$IN>) {
$c++;
if ($_ =~ $table_pattern) {
my ($w, $s) = ($+{name}, $+{size}); # %+ will be reset
if ($w =~ /wallpapers?/i && $s >= $size) {
$size = $s;
$name = $w;
}
}
}

close($IN);

print "$c record(s)\n\n";
print "MOST SIZED\nNAME : $name\nSIZE : $size\n";
>>
>>55776193
lisp. Now fuck off
>>
>>55776179
thompson and ritchie worked on Multics my man
>>
<?php

function get_msg() {

$query = "SELECT 'Sender', 'Message' FROM 'chat'.'chat'";

$run = mysql_query($query);

$messages = array();

while($message = mysql_fetch_assoc($run)) {
$messages[] = array('sender' =>$message['Sender'],
'message' =>['Message']);

}
return $messages;
}

function send_msg($sender, $message) {

if(!empty($sender) && !empty($message)) {

$sender = mysql_real_escape_string($sender);
$message = mysql_real_escape_string($message);

$query = "INSERT INTO 'chat'.'chat' VALUES (null, '($sender)', '$message')";

if($run = mysql_query($query)) {
return true;
} else {
return false;
}

}else {
return false;
}

}


?>



gives the asoc error: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given.
>>
>>55777967
>For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, mysql_query() returns a resource on success, or FALSE on error.

Start reading documentation, friend. On the other hand, you should really be using PDO, or mysqli, mysql_* is removed in PHP7.
>>
File: hepl.png (54KB, 1187x757px) Image search: [Google]
hepl.png
54KB, 1187x757px
Kinda newbie here, I need some help with .NET json.

I've got standardized json responses with "success" and "message", and a result which varies in type.
What's the best / cleanest way to parse this?

I'd like to have parsing done in one place since it also has to do error handling, so I tried doing simple inheritance - pic related.
What am I doing wrong?
>>
>>55777967
mysql_query($query) probably returns "false" instead of the resource

check it with an if like the others and correct your select

>'chat'.'chat'
>>
anime
>>
>>55778138
is cool
>>
>>55778162
is gay

it's time to grow up ...
>>
File: 1465796133961.jpg (106KB, 644x781px) Image search: [Google]
1465796133961.jpg
106KB, 644x781px
>>55778172
>>
so what git hosting do you guys use
>>
>>55778189
a box plugged into my router
>>
File: maxresdefault.jpg (34KB, 1280x720px) Image search: [Google]
maxresdefault.jpg
34KB, 1280x720px
>>55778216
>>
>>55778273
Back to rebbit.
>>
>>55775092
>You're just propagating the senseless consumption of media
I'm programming a media creation and consumption platform.
>>
>>55775422
Hashmaps/dictionaries/associative arrays are useful any time you need to associate two items, which is basically all the time, not just in networking.

DHT refers specifically to an implementation of a hash table-type lookup where the associations are distributed between nodes in a network but any node can answer a question even about an association that it doesn't specifically own.
>>
how do i 'think' like a programmer, it seems to be exclusive to white guys
>>
>>55778623
>how do i 'think' like a programmer
solve problems algorithmically

your problem solving skills will improve
>>
>>55778659
b-but i am dumbass retard. No amount of learning could fix that.
>>
>>55778684
Why bother then, there's plenty other things you can do.
>>
>>55778012
In your GetType methods, does it throw the exception at the obj line or the type1/2 line?

Set a breakpoint at the type1 line an examine the value of obj.

In your Parse method, try deserializing to a List of your RootObject

RootObject obj = JsonConvert.DeserializeObject<List<RootObject>>(text, settings);


Also, I'm pretty sure you should not have Type1 and Type2, but rather a single type that contains a, b, c, and d. You can break this up after the deserialization.
>>
>>55778684
Carpenters, plumbers, and mechanics can be paid very well.

In fact, most of the tradesmen I know are doing much better than post-college grads.
>>
>>55774900
Posted in SQT but it's kinda relevent to this thread
>Thinking of paying for github £7 a month isn't a lot plus it means all my friends don't need to make accounts on gitlab or bitbucket to work on private repos with me
anyone here pay for github? If so what are your opinions on it
>>
>>55778805

Carpenters, plumbers, and mechanics on average get better pay and more money than post-college grads in this current economy.

It's all getting ready to crash world wide and all the banks / governments are putting out false data + manipulating the stock market to try and delay it.
>>
using regex, how do I match the first character in a string, if I don't know what the string is? all the examples I've seen assumes I know what the string is
>>
>>55775796
I've long abandoned 99% of /g/ threads except for /dpt/ and /wdg/. /v/ will never leave and neither will the smartphone cancer. Honestly, there should just be a consumer electronics board.
>>
>>55779188
actually maybe I don't need to use regex.

I'm trying to use python to take "name_here" and change it to "Name Here", assuming i don't know what the names will be
>>
>>55779188
Why in the name of RMS are you using Regex for that?

^. would be the regex.

Anything that can do regex has a much easier way to do it, though.
>>
>>55775117
You can do both
>>
File: lDPrKMA.png (7KB, 524x161px) Image search: [Google]
lDPrKMA.png
7KB, 524x161px
>>55779253
First look up how to replace a particular character with something else.

Then look up how to do Title Case.

C# has a built-in title case method. I'm sure Python has something similar, or someone has written one you can use. This avoid regex tomfoolery.
>>
>>55779253
Type "help", "copyright", "credits" or "license" for more information.
>>> x = "name_here"
>>> x.replace('_', ' ').title()
'Name Here'
>>
>>55779392
>>55779413
thanks, though I didn't know about the existence of "title". makes things much easier.

here is my shitty method i used 1 minute ago
import os
from os import listdir
from os.path import isfile, join

DIR = os.getcwd()
folders = [ name for name in os.listdir(DIR) if os.path.isdir(os.path.join(DIR, name)) ]

def upperfirst(x):
return x[0].upper() + x[1:]

for folder in folders:
if "_" in folder:
newfolder = upperfirst(folder)
newfolder_first = newfolder.split('_')[0]
newfolder_last = upperfirst(newfolder.split('_')[1])
newname = "%s%s%s" % (newfolder_first,' ',newfolder_last)
print(newname)
>>
File: 134257380020.jpg (34KB, 288x499px) Image search: [Google]
134257380020.jpg
34KB, 288x499px
Who /nogoodideas/ here?

I don't know why I spent all my spare time learning to program when I haven't got the first idea what to do with it.

I don't even have any friends I can help out or work on something with.
>>
>>55779541
i'm sure you've got plenty of ideas.

the difficult part is finding something to do that's within your skill range and not too ambitious.
>>
>>55779541
Get a job, faggot.

I'm in a lucky spot where I'm free to improve processes as a see fit most of the time, so while I do it for work, I'm allowed to be creative and create whatever kind of project that would help us in some way.

I'm working on a drag-and-drop ETL abstraction for literally dragging data from our production DBs to the data warehouse.

The idea is to put it in Unity afterwards and have it in a virtual reality where you can LITERALLY drag and transform the data in a 3D world with the motion controls.
>>
>>55779541

Make video games.
>>
>>55779558
>i'm sure you've got plenty of ideas.
I really don't, I don't even have any bad ideas honestly.

>>55779565
No.
>>
>>55779578
He's going to run into the same trap where he has no idea what game to make. It happened to me. Surely you don't want to make another clone?
>>
>>55779598
I had that problem when I picked up Unity to mess around with.

That and the fact you need a lot of time, motivation and art/audio assets makes vidyadev a really shit proposition.
>>
>>55779565
do you really expect your managers to put on a VR headset and flail their hands in the air to manipulate important data?
>>
>>55779619
Same.
Unity is a great engine and I had the knowledge to build the things I wanted, but I just couldn't think of something truly innovative or interesting(for me). Sure you don't need to make an innovative game for it to be fun or interesting, but i just didn't want to make another rehash or clone. I have the time, motivation and art, just no good solid game ideas that 1 person could finish within 3-4 years.
>>
>>55779598

> Surely you don't want to make another clone?

Why not? They're fun programming exercises. Also, clones sell. Clones + 1 new feature sell even better.

If you want originality there are plenty of idea/ art babbies out there looking to collaborate. There are far many more artists than programmers interested in making games; your skills are a valuable commodity.
>>
>>55779627
Absolutely not.

I'm doing it for fun. The VR part would obviously be on the side or when I have downtime.

It would later allow me to 'gameify' some sort of public API, and give me some gamedev experience.
>>
>>55779671
>There are far many more artists than programmers interested in making games; your skills are a valuable commodity.

Couldn't be further from the truth on that one.
>>
>>55779541
Exact opposite here. I have too many ideas on a project's TODO list and too little time and none to help out. That said, although the code base is quite well documented, it's still moderately big for a one man project and early in development too. That makes jumping in much harder.
>>
>>55779708
This.

Check out vg/agdg/.
90% of the complaints are about finding an artist.
>>
>>55778189
A gogs install on my own server
>>
>>55779727

It is kind of logical. I mean games are more about the assets (Art, Sound, Story) than coding.
>>
How do I get this to print on the same line?

Instead of this:

1
2
3
4

or this:
1 2 3 4 


it should update them. KInda like a timer
>>
>>55774900
Working on a control library for a digital sampling oscilloscope. Literally cancer to work with the device.
>>
how to remove all files in a directory except a few ones?

example
123.png
123-copy.png
678.png
678-copy.png
312.png
312-copy.png
555.png
555-copy.png


i want to remove all except those that say copy at the end?

how do i do this?
>>
>>55779930
use a comma at the end
for i in range(10):
print i,


also
range(0,10)
is the same as
range(10)
>>
>>55774900
Why does suckless not use ANSI C? Why does everyone use C99?
>>
With android activities should I serialize/deserialize or pass an index reference to a static list to access objects?
>>
>>55779978
Uhh what are you doing here? You don't even need to program that if you're using a decent shell just go with a regex negation when executing rm.
>>
>>55779989
because C99 has things lile inline, boolean, floating point arithmetic library
>>
>>55780019
basically i run a image optimizer in my images folder, and the program creates a copy of those images.

now i want to remove the old ones
>>
>>55779989
Why on earth would you restrict yourself to C89? GCC, the compiler you're probably going to use on a GNU/Linux system, has had C99 for ages, and even has C11 support, and even defaults to C11 now.
C99/C11 is a lot nicer to program in, and fixes all sorts of weirdness in the original standard, while still keeping to the spirit of C.
>>
>>55779988
You don't understand
I really don't want the entire output to print out. I want one to print and it disappears for it predecessor and so on. Do you get me? I used range just as an example
>>
>>55779989
Isn't the answer obvious? ANSI C sucks.
>>
File: 1469613108813.png (386KB, 1355x1857px) Image search: [Google]
1469613108813.png
386KB, 1355x1857px
What are you lads planning on working on this weekend?
>>
>>55780053
>>55780066
What sucks about it? What is weird about it?
>>
>>55780058
Use a carriage return.
>>
File: o.png (144KB, 1355x1857px) Image search: [Google]
o.png
144KB, 1355x1857px
>>55780068
your png is now optimized (small filesize)
>>
>>55780068
Going to continue work on my VM
>>
>>55777577
>PHP """"programmers""""
>>
File: 2016-07-27-163406_354x96_scrot.png (8KB, 354x96px) Image search: [Google]
2016-07-27-163406_354x96_scrot.png
8KB, 354x96px
>>55780079
It doesn't seem to work
>>
>>55780075
my_fn(arg)
{
/* do whatever */
}

is valid C89 (implicit int).

Calling a function without a prototype is valid C89.

puts("whatever");
int n;

is invalid C89.

-10 % 2

is implementation defined behaviour in C89 (defined in C99).

But really, C99 adds a lot of things which makes C nicer to write. I use stuff like designated initialisers all of the time, as well as things like variadic macros.
>>
Help me anons! In the following code, I get a segmentation fault if x is larger than y, but not vice versa. What am I not seeing here? (getint() gets the next char from a 2D array of 1's and 0's of dimensions x, y from stdin and converts to an int)

Also bp and np are of dimensions x, y as well

for (int i = 0; i < y; i++){
for(int k = 0; k < x; k++){ *(*(bp+k)+i) = *(*(np+k)+i) = getint(); } }
>>
>>55780385
>post-increment
>>
>>55780431
But the index starts at 0...
>>
>>55780493
Your point?
>>
>>55780431
>>55780493
It makes no difference in the 3rd part of a for loop statement.

>>55780385
I can only assume that getint() doesn't work properly.
>*(*(bp+k)+i) = *(*(np+k)+i) = getint();
bp[k][i] = np[k][i] = getint();
>>
>>55780155
RTFM https://docs.python.org/3/library/functions.html#print
It's even easier in 2.7
>>
>>55780431
>the pre-increment is faster meme
>what is compiler optimisation
>implying that your code is actually performance critical or that you yourself are critical
>>
>>55780515
Here's getint()
int getint()
{
char c = getchar();
while (!(c-'0' >= 0 && c-'0' <=9)){
c = getchar();
}
return c-'0';
}


>>55780506
Huh I thought pre increment in a for loop would increment before the loop ran, guess I know better now
>>
>>55780694
Ok, there is nothing wrong there.
How is 'bp' and 'np' defined?
>>
>>55780538
Well how do you do it in python 2.7?
>>
>>55780724
int **bp, **np
if ((bp = (int **)malloc(y * sizeof(int *))) == NULL || (np = (int **)malloc(y * sizeof(int *))) == NULL){
printf("Error: malloc returned NULL\n");
exit(1);
}

for (int i=0;i<y;i++){
if ((*(bp+i) = (int *)malloc(x * sizeof(int))) == NULL || (*(np+i) = (int *)malloc(x * sizeof(int))) == NULL){
printf("Error: malloc returned NULL\n");
exit(1);
}
}


Sorry if this doesn't format correctly, I'm copying it from vim in termux on my phone

Anyway right after this code, the other code runs and I get the seg fault if x is larger than y
>>
Is this portable (within Linux, and C++14)?
And in what situations would this break?

drv.hpp:
class driver
{
public:
virtual void print() = 0;
};


lib.cxx:
#include <iostream>
#include "drv.hpp"

class foo : public driver
{
void print()
{
std::cout << "This is foo\n";
}
};

foo drv;


main.cxx:
#include <iostream>
#include <dlfcn.h>
#include "drv.hpp"

driver *drv;

int main()
{
void *h = dlopen("./lib.so", RTLD_LAZY);

if (!h)
{
std::cerr << dlerror() << '\n';
exit(1);
}

drv = (driver*) dlsym(h, "drv");

auto err = dlerror();
if (err)
{
std::cerr << err << '\n';
exit(1);
}

drv->print();
return 0;
}


makefile
all:
g++ main.cxx -ldl
g++ lib.cxx -shared -fPIC -o lib.so


Works on my machine, prints "this is foo" to stdout as expected.

I'm writing a virtual machine and I want to be able to dynamically load arbitrary IO devices from shared libraries that support the interface, and I want to do it in C++.
I know how to do it, I know it's portable for C libraries, but I don't know of it's portable for C++ libraries.
>>
>>55780808
You've gotten k and y mixed up in your for loop.
Swap them.
>>
Anons i need your help,
I am facing a problem in c
I want to raise (a+b)/2 to the power of a variable time which can be as big as 10^18 (thats quintillion ), i am using long long int for time and ints for a,b ,
i tried using the function pow and powl but they return inf which stands for infinity, that is because pow converts the result to double which is too small , and the same goes for powl which return long double,
Are there any other functions or ways to make this happen with really numbers?
>>
>>55780868
https://gmplib.org/

Or store your values in arrays and write your own mathematical functions.
>>
>>55774900
How the fuck change value of string with PHP function? I need to import XML file to my website but some values are in Number ID form, not in word
<?php

function import_safety($safety) {
if ($safety == "1"):
$x = "Alarm";
elseif ($safety == "2"):
$x = "Airbag 1X";
elseif ($safety == "3"):
$x = "Airbag 2X";

switch ($x) {
case "4":
$x = "Airbag 4X";
break;
case "5":
$x = "Airbag 6X";
break;
case "6":
$x = "Airbag 8X";
break;
}

return $x;
}

?>
[/code]

etc...

XML node is called "safety" of course
>>
>>55781021
sorry for fuckin up

<?php

function import_safety($safety) {
if ($safety == "1"):
$x = "Alarm";
elseif ($safety == "2"):
$x = "Airbag 1X";
elseif ($safety == "3"):
$x = "Airbag 2X";

switch ($x) {
case "4":
$x = "Airbag 4X";
break;
case "5":
$x = "Airbag 6X";
break;
case "6":
$x = "Airbag 8X";
break;
}

return $x;
}

?>
>>
>>55780854
But k is just a counter and y isn't. Do you mean change i<y to i<x? I'm stepping through the y index of the array and allocating an array of x ints for each pointer.
>>
>>55781041
Oh right. I meant to say k and i.
>>
>>55781048
It worked! Thanks anon
>>
So how bad of a programmer am I if I use vectors instead of dynamically managing arrays. I really dont want to deal with memory leaks in a program thats likely to crash as soon as it misreads one thing.
>>
>>55775117
C, assembly is not required anymore.
>>
If I have a pointer called myObject as a member variable, and I write "myObject = new Object" multiple times without writing "delete myObject", will that cause a memory leak?
>>
>>55781217
Yes. You will have multiple memory leaks.
When dealing with new. Always think about how you are going to delete the new variable. Just call delete before calling new again.
>>
What is the best way to implement order of operations in a program that accepts user input for expressions? Right now I'm doing a series of conditionals to determine the order to execute a function which basically takes two operands and an operator and returns a value. So for example if it wanted to calculate 2 + 4 ÷ 10 it checks the second operator to see if it has higher priority than the first and does

f(2, '+', f(4, '/', 10))


rather than defaulting to

f(f(2, '+', 4), '/', 10)


I'm just wondering if there's a better way than doing a conditional statement to determine the order.
>>
>>55781341
SHUNTING YARD
>>
I want to try doing Test Driven Development, and i see examples for it that are really easy, but over-simplified.

Let's say I write a server-client application, how do i unit test the client when it obviously needs a working server, and how do i unit test the server when it obviously needs a working client?
>>
>>55780726
Read the docs you fucking lazy cunt.
>>
>>55781258
Or use a smart pointer.
>>
>>55781121
Really? Unless you have a very specific reason not to use std::vector (that's what we're talking about, right?) then it's the right thing to do.
>>
>>55781121
But STL containers are the way to go, senpai.
>>
should i learn scheme/lisp after i become practical with java? im currently going over c right now.
>>
If I take the modulus 50 of any integer, it's not possible to return a value over 49, right?
>>
>>55781993
Yup.
>>
>>55781978
Yes, do. Really does make you think of programs in more descriptive terms. I'm interning currently and I noticed that I get frustrated with python because of that.
>>
File: dpt kill yourself.png (459KB, 796x913px) Image search: [Google]
dpt kill yourself.png
459KB, 796x913px
>>55782006
Fuck me.

That means something more complicated is horribly wrong.
>>
>>55782030
ye, i keep seeing those scheme/lisp guys having fun so i wanted to at least try it.

it really makes ya think u kno?
>>
File: 1469244105828.png (376KB, 404x435px) Image search: [Google]
1469244105828.png
376KB, 404x435px
>>55774900
My first game.(pong)
>>
File: d.jpg (98KB, 640x640px) Image search: [Google]
d.jpg
98KB, 640x640px
plz help I deleted a file
Is there any program that searches byte by byte completely all the contents of my (D:) partition until it finds an specific string I give
its on windows
>>
>>55782213
>>/sqt/

It's gone
>>
File: 4smart.png (166KB, 1085x713px) Image search: [Google]
4smart.png
166KB, 1085x713px
Polishing up a program which searches all boards you specify for threads which contains keywords in the title/op that you specify, if keywords match it will download all images in that thread.
>>
File: thread search.webm (79KB, 342x310px) Image search: [Google]
thread search.webm
79KB, 342x310px
>>55782305
Put it in a GUI, nerd.
>>
>>55782305
what language?
>>
>>55782693
>Python File
>>
NEW THREAD

>>55782766

NEW THREAD

>>55782766
>>
>>55782777
You're too early.

Kill yourself, and post someone more competent than richie next time.
>>
>>55782777
Dumbass (nice trips though)
>>
>tfw your code starts getting out of hand

I really need a lemming to help me sanity check and organize everything.
>>
>>55782887
Using a stricter language can help with this
>>
>>55780189
>
-10 % 2

>is implementation defined behaviour in C89 (defined in C99).
C99 defined it the wrong way.
>>
File: 1456316521802.jpg (251KB, 960x960px) Image search: [Google]
1456316521802.jpg
251KB, 960x960px
>>55781704
>talking about 2.7
>links to 3x
I don't understand you. If you don't know the solution you don't have to comment, instead you insult people for asking question

I bet what you're probably referring to is:

python 2.7

x = 'hello'
print x,

python 3x

print(x, endl=" ')

>>
>>55782911
I'm using one of the strictest languages.

If I wasn't, I'd have killed myself by now.

It's less of a
>is it going to work?
and more of a
>is there a better way of doing this?
>>
what's the latest official C++ standard called ?
>>
>>55782954
C++99
>>
>>55782954
C++17
>>
>>55782954
C++65
>>
>>55782963
>>55782979
>>55783009
99 > 65 > 17

Read it and weep.
>>
>>55782954
Rust
>>
>>55783023
17 < 65 < 99

Read it and weep.
>>
>>55782963
>>55782979
>>55783009
>>55783023
>>55783024
>>55783050
go back to plebbit
>>
>>55782954
D
>>
>>55783086
>go back to plebbit
You have to go back.
>>
File: 1460369288292.jpg (191KB, 1920x1080px) Image search: [Google]
1460369288292.jpg
191KB, 1920x1080px
I don't normally come to /g/, and I don't want to make my own thread for it since it's a stupid question, so I came here because the opening post is an anime girl. Why is Maki the /g/ girl?
>>
>>55783097
She isn't.

/g/ doesn't have an official mascot outside of RMS.

Some threads have recurring anime girls that are often posted, as is the 4chan culture, but they aren't necessarily agree-upon mascots.
>>
>>55782925
>links to 3x
I didn't know if you were using 3 or 2.7 so I linked to the latest.
>I bet what you're probably referring to is:
Yes. See, was it that difficult?
>>
File: 1449225783785.jpg (197KB, 1920x1080px) Image search: [Google]
1449225783785.jpg
197KB, 1920x1080px
>>55783161
I see. Thanks for the info.
>>
File: wut.jpg (534KB, 1016x1920px) Image search: [Google]
wut.jpg
534KB, 1016x1920px
>>55783161
>She isn't.
>>
>>55782213
Not programming

>windows
>>
>>55783086
Kill yourself newfag

>>55783097
Since when is maki a /g/ mascot? If there is any /g/ anime mascot it's Rei, Lain or Hime.

Also
>the opening post is an anime girl
I have bad news for you.
>>
>>55783344
>>>>windows
>>
File: Capture.jpg (30KB, 428x198px) Image search: [Google]
Capture.jpg
30KB, 428x198px
Yesterday I asked for something to clarify python interaction with JSON and was able to find some resources from someone posting keywords to search for. I've got a better grasp of how it works now, but the next step is actually making use of what I managed to pull from the JSON.

I have regex that, when I print it, brings back the post number, the 4cdn filename, and the file extension (pic related). What terms would I search for to find out how to actually use the information I've gleaned? Mainly a user specifying a post or range of posts to download the file(s) in question from.
>>
>>55775219
Anyone know JavaFX and can help with this?
>>
>>55783558
>Kill yourself newfag
You have to go back.
>>
>>55783781
>everything I don't like is reddit
>>
>>55783830
>doing the typical reddit thing
>not reddit

You're gonna pay for my firewall.
>>
>>55783696
I tried this code and it works for me
>>
>>55784028
Can you tell me what JavaFX version your using and what IDE if any you are using?
>>
>>55784076
I'm using Netbeans and I'm running javafx.runtime.version=8.0.72
>>
>>55780068
Working on a Text Editor in JavaFX without using the TextArea class.
Thread posts: 335
Thread images: 38


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.