[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: 255
Thread images: 35
File: tropes_rorona_7858.jpg (122 KB, 350x503) Image search: [Google]
tropes_rorona_7858.jpg
122 KB, 350x503
Old thread: >>51627659

What are you working on, /g/?
>>
File: EEEEEEEEEHHH.jpg (36 KB, 960x539) Image search: [Google]
EEEEEEEEEHHH.jpg
36 KB, 960x539
>>51634136
>tab-autocompleted "tr"
>tropes_rorona_7858.jpg gets posted instead of "trap programmer.jpg"
>>
C
>>
>>51634177
doomed from birth
>>
>>51634136
>>51634177
Faggot weebshits.
>>
Java
>>
How to run byte code instructions which are presented as text using C?
What about Python?
>>
>>51634136
cats are trash
>>
>>51634177
It's cute anyway
>>
>>51634236
What kind of byte code? Did you mean "machine code"?
>>
File: ruff victory.jpg (58 KB, 620x465) Image search: [Google]
ruff victory.jpg
58 KB, 620x465
>>51634237
This. Fuck shitpaws.
/dog petting thread/.
>>
>Explain dynamic programming to a 5 year old
Histomorphisms
>>
>>51634272
Byte-sized machine instructions.
>>
%FROB%
>>
>>51634353
You're using an 8-bit processor?
>>
>>51634303
>not /rorona petting thread/
into the trash it goes
>>
>>51634404
Are you an idiot? Don't you know what opcode is?
>>
File: 1439586785033.jpg (33 KB, 480x772) Image search: [Google]
1439586785033.jpg
33 KB, 480x772
What are some good books to get started on learning Haskell with?
>>
>>51634136
That is beautiful

Where's the porn?
>>
Reminder that Java is the best performing language for server-side development besides C++

https://www.techempower.com/benchmarks/#section=data-r11&hw=peak&test=plaintext

Also
>aspnet-mvc-mono: 0.0%
>>
>>51634527
don't bother

learn erlang or elixir instead
>>
File: cats.webm (2 MB, 720x404) Image search: [Google]
cats.webm
2 MB, 720x404
>>51634237

You're trash
>>
I'm doing the flavius josephus challenge on codeeval.
It's basically a roulette wheel and I can't get the rollover to work as it should.
After it hits 8 it should be skipping to 1, not 0.
>>
>>51634527
Anything but LYAH
>>
File: jkhgjhg.jpg (70 KB, 623x426) Image search: [Google]
jkhgjhg.jpg
70 KB, 623x426
This is more web dev question but couldnt find the thread. Really need help with this. So I'm working on a project and my job is to create the UI (so it looks like the screenshot).

He said i will have access to the API later so i can get all the data and statistics. I know about divs and tables and all of that, but how would i go about coding this to get it look like this mock up? It looks like a infographic.

Any help with this would be greatly appreciated.
>>
>>51634429
>Don't you know what opcode is?
Yes. Why?
>>
Why do we read "without using boost" so often? Boost is pier-reveewed godtier code, so why NIH this hard
>>
>>51634596
Boost is an extremely heavy dependency that has been mostly deprecated by C++11 and C++14. There's very little that it's still useful for if you're not confined to an old compiler.
>>
>>51634547
spring is at 1.8%

and that's what most java code is written in

still faster than C# tho get rekt windows shills
>>
>>51634589
>I know about divs and tables and all of that
Tell me, do you know CSS? Sounds like you're an absolute beginner
>>
Hey /g/ I'm writing an android app for a project and I am absolutely baffled as to why this is throwing an error.

We have a login screen with a create new account button, and the onClick method for said button points correctly to the right method. The method creates an intent and starts the activity but when it actually calls startActivity() it crashes and throws the exception "Could not execute method for android:onClick".

I don't understand why, because the create new account button correctly calls the method and creates the intent with no issue. Googling points me to the obvious results, but there is no onClick method called after the button is pressed. what is going on here?
>>
>>51634589
http://bootstrapbay.com/themes/admin-dashboard
>>
>>51634642
>>51634665

i know html and css, i guess im not up to par with what you can do with it nowadays

thanks a bunch
>>
>>51634614
Spring is a dinosaur

Rapidoid looks extremely sexy
>>
Is it possible to find a job being a self-taught programmer with no degree?

Furthermore, how do you evaluate at what point are you fit for looking for a job?
>>
File: 1439157332879.jpg (15 KB, 268x265) Image search: [Google]
1439157332879.jpg
15 KB, 268x265
What short books/other reads does /dpt/ suggest to learn more on how information is stored on hard drives, how it's retrieved, and how to write software to overwrite parts of hard drives/etc.?
>>
is OOP just a meme?
>>
>>51634745
OOP is a good tool in certain situations but far too many people view and even teach it as something that always has to be used.
>>
>>51634745
Nah. But using OOP for everything is.
>>
>>51634715

It's possible but it's hard. You just need to make good connections with people and show that you know your stuff.
>>
File: 1432914949979.jpg (17 KB, 284x373) Image search: [Google]
1432914949979.jpg
17 KB, 284x373
What new and funky fresh programming language should I learn? And by "new" I mean something that's only recently been gaining popularity.
>>
>>51634715
>Furthermore, how do you evaluate at what point are you fit for looking for a job?
The point I need money at?
>>
>>51634837

ruby
>>
File: image007.gif (6 KB, 487x334) Image search: [Google]
image007.gif
6 KB, 487x334
/g/
I am looking for advice about numerical interpolation.

Lets say I have net (pic). I have a value for each cross point
for example
[0, 0] = 10
[0, 1] = 3
[1, 0] = 5
[1, 1] = 2

etc


but now based on values I would like to find what value is in point
 
[1.30, 0.15]


What interpolation method would work the best in your opinion?

I am planning to write simple function where function args are x and y, after that functions looks for nearest [x, y] points and calculate values for this point.
>>
Anyone here with experience in JSF and/or primefaces?
>>
File: 1420560395982.webm (2 MB, 1280x800) Image search: [Google]
1420560395982.webm
2 MB, 1280x800
>>
>>51634589
>>51634692
Anon, I do things like this, and I can absofuckinglutely guarantee that you should let him know that this project is out of your experience range.

If he gave you this screenshot and said 'Make this' knowing your current skills, then he's a fool.
>>
>>51634914
Please stop posting this and kill yourself.
>>
>>51634888
What about Go and Rust? I see people either love them or hate them.
>>
>>51634914
>Delphi7
right in the nostalgia - highschool CS classes were fun
>>
>>51634560
You could get any animal to do that. Pretty neat machine though.
>>
>>51634928

cant be that hard can it? Looks like theres already an admin template within the project.
>>
>>51634991
Go is legitimately bad. Well, maybe not bad, but it's nothing special.
Rust is okay, but it gets a bad rep around here because of le SJWs. Also, the syntax is pretty bad, and the safety that it claims to have is really not a big improvement over C++.
>>
File: a mighty ruff victory.jpg (55 KB, 540x292) Image search: [Google]
a mighty ruff victory.jpg
55 KB, 540x292
>>51634560
Cats are shit.
>>
File: diler.jpg (47 KB, 184x184) Image search: [Google]
diler.jpg
47 KB, 184x184
Help me, /g/: It's my first year studying IT. One of the classes is java basics, which was my first attempt at coding. It's amazing, I love it and all that shit, but I heard that Java is a shitty language without future. Seems weird considering how popular it is, but nevermind.

Which language should I learn instead of (or after) Java, career-wise? I don't want any shit for retards like ruby on rails.
>>
>>51634577
What's wrong with LYAH?
>>
>>51635086
>but I heard that Java is a shitty language without future

Did you "hear" that from here?
>>
>>51635086

>bashes rails
>loves java

my sides.
>>
>>51635086
>I don't want any shit for retards like ruby on rails.

You'd be surprised at how popular ruby is becoming.
>>
>>51635086
Learn C. It's a good basis for learning other programming languages.
>>
>>51635037
What project? Another anon linked him to some bootstrap libraries you have to pay for, but his boss is asking him to create the UI for the frontend, I believe.

I'm guessing that screenshot was pulled from some random BI GUI library the boss found on Google.

It would take a very high knowledge of JS, plus whatever responsive UI frameworks you could use to create those controls.

I guess I'd recommend trying to work in Google Charts somehow:
https://developers.google.com/chart/?hl=en
>>
Does /g/ document their hobby project?
>>
>>51635086
>>51635169

> shit for retards like ruby on rails
ruby is a language, rails is a web framework. ruby is a perfectly good language in its own right even though it has a lot of really dumb stuff in it as well

java is still very heavily used for backend systems, but if you don't want to be part of the javasphere because you don't want to compete with h1bs then you should be good with languages in general, not a single language.

basically either learn java or learn (how to be okay with) everything else
>>
>>51635224
Bitch, I don't document my workplace projects.
>>
>>51635257
Because you're a NEET?
>>
>>51635200

It looks like they already have a bootstrap library they paid for, and now he wants me to implement the UI for the front end, yes you are correct. I am just doing front end stuff.

So im assuming i should just learn how to use this bootstrap library/template?
>>
File: 1343209053767.jpg (182 KB, 600x811) Image search: [Google]
1343209053767.jpg
182 KB, 600x811
I know y'all get this question a hundred times a week, but I've lurked for a couple weeks now and have yet to find a definitive answer.

Where should I start /dpt/?

What language should I dive into? Java? C++? Ruby? I've heard these 3 spouted like gospel from various sources. Heard ruby is good for beginners, C++ has great resources, and java is used in fucking everything. Which would be the best starting point?

I've taken a class that focused on VB and Alice, thought it was garbage, blew through the class and moved on.

Looking for something I can do on my own time, budget, and would actually be worth my time. (ie: pick it up at my own pace fast or slow, free or cheap resources, logical jump to other languages, in decently widespread use) I guess I'm just worried I'd spin my wheels trying to jump straight to C++, lack resources for java, or find no demand for ruby.

Merits or flaws of each are appreciated, or let me know if I overlooked something.


Tl;dr ruby, java, C++. Whats the best use of my time as a newbie?
>>
C noob here, I'm starting to write small C programs, in particular my dwm status bar.

(My god, the memory usage is actually less than 500KiB compared to the python equivalent of 9 MB)

Im such a novice though. Is there a better way to get an output of a system command and evaluate it in C? For now, I trigger a bash script to write to file, then I use C to open file and get the output from the file. I know this is wrong and probably not the best practice.

TLDR; Best way to get a system command's output and possible evaluate and parse it

Here's my code for getting the cmus now playing as an example:
char *
getcmusstatus(void)
{
char *co;
char str[12256];
char PAUSED[400];
char STOPPED[400];
int ret;

system("bash /home/marche/bin/cmus-np.bash > /home/marche/.np");

co = readfile("/home/marche/", ".np");
if (co == NULL) {
return smprintf("");
}


sscanf(co, "%[^\n]", str);
free(co);

strcpy(PAUSED, "paused");
strcpy(STOPPED, "stopped");

ret = strcmp(str, PAUSED);
if (ret == 0) {
return smprintf("\uf04c %s", str);
}

ret = strcmp(str, STOPPED);
if (ret == 0) {
return smprintf("");
}

if (strlen(str) == 0) {
return smprintf("");
}


return smprintf("\uf001 %s", str);
}


Pic related is the bar result with all status collected.
>>
>>51635086
Learn Java, it's the most popular language in the world also you get high paying jobs and they're everywhere
>>
>>51635444
C
>>
>>51635444
Either C++ or Java. Ruby blows ass
>>
>>51635610
>says the person who has never touched ruby

You ignorant twat
>>
>>51635669
I don't touch tripfags.
>>
>>51635161
My prof said it too, although far more subtly.

>>51635182
I know, but iOS is popular too and still not the only profitable career option.

>>51635186
Wouldn't it be faster to use Java as the base, considering I'm 3 months into it?

>>51635563
Honestly, I'm probably gonna do this anyway. But thanks for the reassurance.
>>
>>51634177
these umaru pics are reaching levels of autism i didn't think were possible
>>
>>51635733
>My prof said it too, although far more subtly.
most professors don't know the industry very well.

don't trust things they say about it unless you know they got their degree very recently and were previously working as a programmer.
>>
File: PrepareYourAnus.jpg (39 KB, 458x458) Image search: [Google]
PrepareYourAnus.jpg
39 KB, 458x458
>>51634894
fourier transform
>>
>>51635444
C K&R. It'll help you understand how computers work and demonstrate how powerful pointers are
>>
>>51635733
Sure, Java is faster to learn than C.
C gives you a much better foundation for other languages. Most languages are based on C. Since C is a stick-and-stones language, it'll give you a better understanding of what an application actually does.
>>
>>51635468
look at the popen function, it should do what you want.
>>
>>51635444
C
>>
>>51635669
Why would I use a language that's effectively as slow as a tortoise?
>>
>>51635782
>don't trust things they say about it unless you know they got their degree very recently and were previously working as a programmer.
even if they did, they could be ludicrously opinionated and stubborn about it. like the C# weenies that insist that java is straight garbage while the nearly identical C# is infinitely better somehow
>>
>>51635444
Assembly
>>
>>51635468
system() is pretty shit. Use fork() and execv(). If you want to get the output of the program (stdout) of that program back in your main program, you'll need to create a pipe() and then redirect stdout of the child to it using dup(). It might be a bit overwhelming for a total noob, but there are actually heaps of tutorials online for this sort of thing. Just search for "C how to use fork()" or something.
They're not 'C standard', but they are 'POSIX standard'.
I also think glibc might do this all for you, but I don't remember what they're called and I don't use it.
>>
>>51635444
start with java. when you're confident with java you can move on to C++. i can't recommend ruby
>>
Anyone has some simple example of a battleship game in Prolog?
>>
>>51635820
>>51635870
Thanks bros..

I may opt for popen as it looks easier to grasp with my beginner mind.
>>
>>51635944
>popen
>poopen
>>
>>51634837
D
>>
does anyone here unironically use hahasklel for any serious purpose?
>>
>>51635941
This
>>
File: a ruff victory.jpg (65 KB, 500x368) Image search: [Google]
a ruff victory.jpg
65 KB, 500x368
>>51636150
I enjoy how this stuck.
Here, have a ruff victory.
>>
>>51635444

START SOMEWHERE YOU MORON

>I've lurked a couple of weeks now
>Still hasn't learned jackshit
>>
>>51635468
>scanf
TRASH
>>
>>51634837
Rust
Clojure
Ruby
Go
D
>>
hey /g/, rate my one-liner.

function setPassword($username, $password) {
return (new PDO("mysql:host=localhost;dbname=database", "root", "root"))->prepare("UPDATE users SET password=? WHERE username=?")->execute([password_hash($password), $username]);
}
>>
>>51634894
> What interpolation method would work the best in your opinion?
Define "best".

Interpolation is one of those subjects which could easily fill a bookcase. You could fill a book with just the basics.

The main thing is that you're very limited in what you can do if you need to be able to sample near the edges. Most of the better algorithms require more than just the values on either side (i.e. 2 values for 1-D interpolation, 2x2=4 for 2-D, etc).

If you can afford a 4x4 window (i.e. the interpolation point will always be at least one cell from any edge), then cubic interpolation provides first-order continuity (i.e. you don't get obvious banding).

Given a value x, you determine y=f(x) by
i = floor(x) // integer part
f = x - i // fractional part
// determine Hermite spline
y0 = f(i) // value below
y1 = f(i+1) // value above
dy0 = (f(i+1)-f(i-1))/2 // derivative below, f'(i)
dy1 = (f(i+2)-f(i))/2 // derivative above, f'(i+1)
// determine cubic polynomial coefficients
c0 = y0
c1 = dy0
c2 = 3*(y1-y0)-dy1-2*dy0;
c3 = 2*(y0-y1)+dy0+dy1
// evaluate polynomial
y = c0 + f*(c1 + f*(c2 + f*c3));

This is separable, i.e. in 2 or more dimensions, you just interpolate in each dimension in sequence. So for 2-D, you take a 4x4 region, interpolate each row of 4 values using the x coordinate, then interpolate the 4 interpolated results using the y coordinate.
>>
>>51635016
yeah it gives them out an for their instinctual hunting
>>
>>51635082
Can your dog do >>51634560
?
No.
In particular, dogs fail at any non-trivial challenges because they're retarded. Checkmate.
>>
>>51636498
>literally one in a billion cats can do this
>CATS SO SMART BRUH BRUH XD
>>
>>51636498
Yeah. Locating drugs, bodies, landmines and even tracking is so trivial. Your cat locates catnip and spazzes out. Also yes, if you can't get a dog to do that you're shit at training dogs.
>>
Hello thread, I am not entirely sure if it's the right thread to ask for advice but I didn't find another related with my problems. Also, please be gentle.
I graduated last year on Computer Science, I have worked with mobile development (using Xamarin) but since I graduated I have been studying by myself about native android development and I just really like it, more than I liked developing using Xamarin. So I got fired from my job and I am struggling to find another job (mostly because I am searching for native development jobs, not Xamarin ones).
I really wanted to keep myself active by developing apps by myself but I have a few problems doing so. First I just can't get myself to think about an app that I could develop, I don't have any idea of what do to. Second is if I want to create a more elaborated app, I will need a service to fill it with data, and I simply can't afford to buy a server just to host it.
Are there any android developers out there that could give me a light?
TL;DR: Newbie Android Developer needing to find a way to keep active while struggling to find a new job.

Sorry for any grammatical or/and spelling errors, English isn't my first language.
>>
File: quite a ruff victory.jpg (46 KB, 653x510) Image search: [Google]
quite a ruff victory.jpg
46 KB, 653x510
>>51636545
>>51636498
Sorry, I forgot to mention.
Have a ruff victory.
>>
>>51636493
Is this actually true? Pretty cool if so.
>>
>>51636573
>So I got fired from my job

??
>>
>>51636438
>Define "best".

I want to get it working on server as api.
Lets say I have a txt file with 1-10k records.

line example of this txt file
x y value

1204 1204 13


And user ask what value is at point 1023.34 1023.56.
I am not limited in any way on how much data I want to use for a calculation.

In my case real distance between [0, 0] [0, 1] is 1 or 5km but I do not know if it does matter in this case.
>>
I want to learn Javascript.

Should I start with Spidermonkey or Rhino?
>>
>>51636704
>English isn't my first language.
He probably meant that he quit the job?
>>
>>51636755
Exactly, thanks.
Forgot that the term "got fired" means that I quit my job. I didn't really have to add the "from my job".
>>
>>51636545
>literally just bark when you smell something
>no series of actions involved
>no logic required
>no thinking
>hard
Dogfucker pls leave.
>>
>>51636789
Got fired means you did something bad/dumb and they made you leave. "Quit your job" means you left normally.
>>
>>51636804
cats are ass
>>
>>51636743
You should start with cyanide pills.
>>
>>51636804
You aren't just born into this dog-eat-dog world with the ability to sniff out drugs and shit. They go through extensive training. Go pick up your hairballs, shitpaw lover.
>>
>>51636811
Thanks again for clarifying that to me.
>>
File: 1448821505008.png (427 KB, 514x662) Image search: [Google]
1448821505008.png
427 KB, 514x662
How to code a SOCKS proxy server in Python? Any tutorials?
>>
>>51636833
Yes, because they're literally so dumb they need training for trivial tasks. Dogs belong in the trash.
>>
>>51636831
Thanks for the help m8
>>
Shift over, I'm out.
I hope everyone's night is filled wi-- >>51636842 ugly fucking cat --th ruff victories!

>>51636849
You did you as a fetus yet here we are. You're more dumb than a cat, and that's saying a lot.
>>
>>51636866
Too* since I know you're the kind of child to invalidate an entire post based on a typo.
>>
What's the most exhaustive resource on C# and .NET?
>>
Have you guys ever felt that you could do more with your knowledge and abilities?
>>
>>51636922
Yeah so I moved up a notch and went into web dev.
>>
>>51636947
>Moved up
>Web dev
>>
>>51636947
>web dev
>moved up
uh-huh
>>
>>51636972
>>51636979
Web dev is much more challenging than non-web.
>>
>>51636972
>>51636979
I don't know about you but I consider a web dev income at least two notches higher than NEET income.
>>
>>51637017
This is true. Developing web pages takes a huge strength of mind.
>>
>>51637017
uh-huh
>>51637035
Luckily I'm neither of those
>>
>>51637017
Enjoy your dying career senpai.
Web Science is where it's at.
>>
>>51637017
It's harder not to succumb to the urge to commit suicide, I guess.
>>
Give me one good reason why I shouldn't dedicate myself entirely to Windows dev
>>
>>51637083
Because outside of vidya, there are virtually no windows dev jobs.
>>
>>51637083
Why would you limit yourself like that?
>>
>>51637017
> Web dev is much more challenging than non-web.
Only because most of the technologies involved are utter shit developed by either a) people with neither practical experience nor academic knowledge, or b) businesses rushing out early prototypes in order to gain first-mover advantage.
>>
>>51637083
Because C# is good and works on multiple platforms
>>
>>51634589
Hahahahah.
Hey bro,i dont think he wants the buttons and everything to function "live".
If i were you i'd get my hands on AJax.
>>
>>51637083
>Being that much of a kek
>Implying that one can keep their sanity after using the Windows APIs for any extended period of time
>>
>>51636573
if you need employment you should probably find a new job before you leave the old one.

try making a game or something
>>
File: pepe-5124.jpg (20 KB, 306x306) Image search: [Google]
pepe-5124.jpg
20 KB, 306x306
>>51635733
>my prof said it too
Haha,i heard this one as well.
Personally ,i code in Java and if my teacher said that to my face i'd bash his skull,no joke.
If your class is named Java Basics than why is learning Java or not a question?
>>
>>51637083
Holy shit the botnet's learned to reproduce
>>
>>51637175
>frogposting
>Haha
>i'd bash his skull,no joke
I want underages to leave.
>>
File: 1447635367417.jpg (529 KB, 900x1908) Image search: [Google]
1447635367417.jpg
529 KB, 900x1908
>>51634136
I'm a beginner in Java programming. I'm in my second course and have at least general understanding of the stuff.

Someone post that picture with a list of easy-hard level basic java programming tasks. I'll give it a wack and you can all laugh at me.
>>
>>51634136
>Java can only pass by value
huehueheuehueheu
>>
File: pepe-5833.jpg (71 KB, 300x250) Image search: [Google]
pepe-5833.jpg
71 KB, 300x250
>>51637210
Out ,normie.
>>
>>51637248
the only time i have a desire to pass by reference is in performance-critical code and for that i have C++ through the Java Native Interface™
>>
>>51636624
yes, people who are crazy enough to have one of those half-dog half-wolf, hide their food so that they have to look for it.
Otherwise they might hunt any guest you bring to the house...
>>
>>51634837
clojure or erlang/elixir
>>
>>51637317
>Java Native Interface™

Complete dogshit to actually use.
>>
>>51637436
not with jnigen
>>
https://www.youtube.com/watch?v=FqjSYtKWyX8

something for one of you guys to work on?

also kek
https://www.youtube.com/watch?v=tDLmPQ53tSM
>>
bit of an emergency
I have this script

#change the version numbers into ordinal integers.
#data currently requires manual fixing before using this.

#read data into list
f = open('/home/roger/Documents/python/distrowatchdata.csv','r')
distro_info=[]
for line in f:
distro_info.append(line.split(','))
f.close()

#get the data in the right order
package_info = []
for x in range(len(distro_info[0])-3):
temp = []
for y in range(len(distro_info)-1):
temp.append(distro_info[y+1][x+3])
print (temp)

package_info.append(temp)


#write the values as ordinal integers
count = 0
pairs=[]
for x in package_info:

pair = {}

setx = set(x)
sorted_setx = sorted(setx)

setx.clear()

i=0
for y in sorted_setx:
pair[y] = i
i+=1

pairs.append[pair]


print(pairs)
for m in range(len(distro_info[0]) - 3):
for n in range(len(distro_info[0])-1):
#print(distro_info[n+3])
distro_info[n+1][m+3] = pairs[distro_info[n+1][m+3]]

count+=1


f = open('/home/roger/Documents/python/distrowatchdata.csv','w')
for x in distro_info:
for y in x:
f.write(','+str(y))
f.write('\n')

f.close()


and this data:
http://pastebin.com/901tHxL5

and this error:
Traceback (most recent call last):
File "/home/roger/Documents/python/orderversions.py", line 16, in <module>
temp.append(distro_info[y+1][x+3])
IndexError: list index out of range


and a due date tomorrow for a paper associated with the data.

yes, I know I'm shit.
please help.
>>
>>51637566
Looks like your list index is out of range, roger
>>
>>51637045
Websites will always be needed. Can't say that much about non-systems programs.
>>
>>51637566
Fencepost error, Roger.
>>
>>51637566
Sup, Rodge. Kinda went outta bounds there.
>>
>>51637582
I know.

Iterating through lists of lists is hard. I've tried everything I can think of.
>>
>>51637566
Based Roger Rabbit
>>
>>51637132
I know right, but I wasn't planning to quit so soon.
Anyway, it was a shitty company and I wasn't feeling motivated, so working there was a torture.
I have 0 experience with game developing but for a "independent developer", it's the way to go.
>>
>>51637607
I'll tell you right now you probably shouldn't be doing
    distro_info[y+1]

inside a loop that iterates over each item in the list.

Once you reach the end of the list, there will not be a y+1 for you to access. Either add a check that will tell you if you're at the end of the list, or come up with a better function.
>>
>>51637658
That's why there's the len(distro_info)-1 in there. Unless I'm an idiot that doesn't know python functionality well enough, that should offset it, right?
>>
I haven't coded anything in 2 months in C++.

I want to start again but I feel like I've gotten rusty. Anyone have that Programming Challenges image so i could do a few and regain my thunder?
>>
>>51637741
In before that one guy who complains about roll images
>>
>>51637714
len(distro_info)

returns the length of the list, let's say it's 10.

In your loop you bring it down to 9, so your loop will run from 0 to 9. But once you reach 9, guess what y+1 is trying to do? 10, and distro_info[10] won't work.

I recommend doing something like this if you want to access indices.
for index, value in enumerate(distro_info):
if index != len(distro_info)-1:
# do a thing that does y+1 here


enumerate() produces a list of pairs, the first item
being the index and the second being the value.
>>
File: 1445555658968.png (302 KB, 1920x1080) Image search: [Google]
1445555658968.png
302 KB, 1920x1080
>>51637741
>>
>>51637820
ty
>>
>>51637714
Nah, you should do -2. One for the last item on the list, one for starting from zero instead of for one.
>>
>>51637779
I see now why caffeine is so important.

Thanks. I'll try that in 20.
>>
File: 1419391157732.png (344 KB, 1024x576) Image search: [Google]
1419391157732.png
344 KB, 1024x576
>Writing backend to handle incoming requests through single websocket pipe per user
>Determine what all the requests do, have to filter out all the commands, design the styling, syntax, as well as the database and database queries to tie everything together
>Finished 6 hour session today
>It all works almost flawlessly
This is a triumphant feel.
>>
>>51637820
I wish most of these weren't just weird, esoteric math problem solvers.
>>
>>51637779
Instead of running a conditional each loop, just go through the list, but skip the first element, and use y-1 instead.
>>
beaglebone or arduino?
>>
How do I use c++ overload functions with cin input?
>>
can someone tell me what i'm doing wrong? it's c++

it tells me
/tmp/cciBAYlY.o: In function `main':
huffman.cpp:(.text+0x1c): undefined reference to `readTraceLevel(int, char**)'
huffman.cpp:(.text+0x22): undefined reference to `traceLevel'
huffman.cpp:(.text+0x36): undefined reference to `traceLevel'
huffman.cpp:(.text+0x4b): undefined reference to `traceLevel'
collect2: error: ld returned 1 exit status


these are the files
// main program
#include <cstdio>
#include "trace.h"
using namespace std;


int main(int argc, char** argv)
{
readTraceLevel(argc, argv);
if(traceLevel > 0){ printf("tracing is on.\n");}
if(traceLevel == 1){printf("trace level is 1.\n");}
if(traceLevel == 2){printf("trace level is 2. \n");}
return 0;
}


// trace.h
#include <cstdio>
using namespace std;

extern int traceLevel;

void readTraceLevel(int argc, char** argv);


// trace.cpp
#include <cstdio>
using namespace std;
#include <cstring>
#include "trace.h"
int traceLevel = 0;

// Function readTraceLevel reads the trace level. If -t1 is included when program is run, then trace level is 1.
// If -t2 is included when program is run, then trace level is 2. Otherwise, it is 0.

void readTraceLevel(int argc, char** argv)
{
char firstCommand[] = "-t1";
char secondCommand[] = "-t2";
int token=1;
traceLevel = 0;
while(token<argc)
{
if(strcmp(firstCommand,argv[token])== 0)
{
traceLevel = 1;
}
if(strcmp(secondCommand,argv[token])== 0)
{
traceLevel = 2;
}
token++;
}
}

pls help idk what i'm doing wrong
>>
>>51637936
BeagleBone is used in the actual industry because it's open source hardware. Arduino is mostly used by hobbyists.
>>
>>51634560
It's open source

https://github.com/rachelnicole/robokitty
>>
>>51637945
Ignoring shit like weird indention in some bits, using namespace std, and lack of include guards, it looks like it SHOULD work.
Are you linking the files together properly?
>>
File: my_problem.png (65 KB, 900x594) Image search: [Google]
my_problem.png
65 KB, 900x594
Hi /g/

How do I make an empty JList display as an empty box? Right now my empty JList displays as a tiny dot in my GUI, but I need a large white box. Even setting the fixed cell width and height doesn't fix it. Any clue?

nameList = new JList <String>(Names);
nameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
nameList.addListSelectionListener(new ListListener());
JScrollPane scrollPane = new JScrollPane(nameList);
scrollPane.getViewport().add(nameList);
thisPanel.add (scrollPane); //a JPanel
nameList.setFixedCellWidth (275);
nameList.setFixedCellHeight(275);
nameList.setVisibleRowCount (9);
thisPanel.add(nameList);
>>
>>51638005
Create a seperate pane and use setPrefferedSize(new Dimension(275,275);
and add that panel to your thisPanel.
>>
>>51637945
You have to specify both files when compiling.
g++ main.c trace.c -o tracing
>>
File: 1426298214397.png (29 KB, 751x902) Image search: [Google]
1426298214397.png
29 KB, 751x902
>tfw I only know VB.NET
should I just give up?
>>
File: 1437663010095.jpg (93 KB, 679x453) Image search: [Google]
1437663010095.jpg
93 KB, 679x453
it seems the .clone() function is broken and not a good idea to use it. So no problem I write my own clone method. The only Problem is that I have an interface instance in my Object.

public class Foo{
public TestInterface test;
public Foo(TestInterface test){
this.test = test;
}
}


new Foo(new TestInterface(){
//do stuff
}


how do I duplicate the interface instance without clone? the instance might have some private variables and just passing a pointer is not an option. Or did I miss something?
>>
>>51638215
i knew that too. i have no idea why i didn't think to do that
>>
>>51638269
>Learn Java SE and stuff like data structures,linux and bash,read networking book ,read about HTML/CSS/JS and XML,JSON etc...
>go for Java SE.
>Become God.
>>
>tfw forgot everything you've learned and have to start all over again

fucking hell senpai

should i just learn webdev instead
>>
>>51638311
>Java
>>
>>51638215
thanks
>>
>>51638277
Well if you are forgetting stuff I'd put it into a Makefile. It really does make shit easier.
>>
File: nhsNumber.png (63 KB, 1206x1054) Image search: [Google]
nhsNumber.png
63 KB, 1206x1054
Porting a bunch of functions from the existing perl codebase at work to C++ to give things a speed boost when running on largeish data sets. I've overcommented because the source I'm working from is at least 15 years old, has 0 comments and I find perl a bit cryptic at the best of times; I don't want someone to come along in another 15 years and wonder what prick wrote a load of uncommented code that they now have to port. It's mostly checksum generation/validation with patient numbers, sample IDs etc.
>>
>>51634527
>snake
>in /dog petting thread/

baka
>>
>>51634316

so no inbetween things will mess up during the update and draw loops?
>>
So to run Java apps, your users have to install the entire Java runtime?
>>
>>51637779
when you say "y+1", where is y initialized?
>>
>>51638274
>>51637945
>>51638492

>this much redundant code
disgusting dysfunctional programmers
>>
>>51638523
dumb catfag
>>
>>51638523
Yes. Can't see any other way.
>>
>>51638269
Hi Highschool Junior in Mass

Go learn C
>>
>>51635330

Look into d3.js or something similar. There are plenty of data visualisation libraries out there.
>>
>>51638625
Or c#.. or java.. or anything else, just broaden your horizons
>>
>>51638557
this is what python kids actually believe
>>
>>51638734
>python kid
>python
>not a statically typed language
don't you dare call me that again
>>
>>51638492
If you need any help with perl explaining I may be able to help. I'll be here for a few hours, just post snippets.
>>
Write a program that averages two fizzbuzzes
>>
I have a linked list & a function to add things to the beginning, but now I want new things to append on the end. I tried basing it off the pseudocode on some college's website but I think I fucked it up.

ListElement::ListElement(string initialvalue)
{
value = initialvalue;
nextElement = NULL; //initially, there is no nextelement following this one
}

class LinkedList
{
public:
LinkedList();
void add(string value);
void print();
ListElement* first=NULL;
};

LinkedList::LinkedList()
{
first=NULL;
}

void LinkedList::add(string value)
{
//add to beginning
// ListElement* mynewelement = new ListElement(value);
// mynewelement->nextElement = first;
// first = mynewelement;
current = first;
while (current!=NULL && current < value) {
previous = current
current = current->nextElement
if (current = first) {
mynewelement->nextElement = first;
first = mynewelement;
}
else
previous->nextElement = mynewelement;
mynewelement->nextElement = current;
}
}
>>
http://159.203.142.122/editor.php

working on WYSIWYG text editor. Please try to break it and then report bugs back to me! info is on the right, just hover over blue bar
>>
>>51638784
I've gotten all the really idiosyncratic bits working so it's just basic translating now but thanks for the offer.
>>
>>51638950
H4CKER ALERT
>>
>>51638950
>working on WYSIWYG text editor
you mean like notepad?
>>
>>51638950
cool IP ahmed
>>
>>51639106
Yes but with syntax highlighting
>>
>>51638950
>WYSIWYG text editor
kek

>Please try to break it and then report bugs back to me
it's clearly pretty fucking broken
>>
>>51638950
your text editor is pretty shit
in the course of me trying to jump around your bracket autocompleting, html tags popped up in my code.
>>
>>51639135
sounds useless
>>
Can someone please help me link Boost libraries to Codeblocks?

I did what the nigga in this video did, but I'm getting the error at 3:10 no matter what.

https://www.youtube.com/watch?v=49d0Abl2t0E
>>
>>51639226
thats because it detected what you were trying to do wand was writing your html for you
>>
>>51637566
You're approaching this a little wrong which makes coding complex.

distro_info should be a list of lists, like this:

#sample data file
1,2,3,4,5
10,20,30,40,50

#sample distro_info
[
[1, 2, 3, 4, 5],
[1, 2, 3, 4, 5],
]


If you throw away all your code and rewrite it like this, it should be much easier.
>>
>>51639246
i cant read that fast, what is the error
>>
>>51638950
it is cool and a great project to work on WYSIWYG editors are a great way to learn but man you have a long way to go before it is presentable
>>
>>51639279
It's just giving like 300000 errors.

And I can't tell what he did to make it work in the video. Since it clearly works after that part.
>>
>>51639289
start at the top
>>
>>51639304
I did. I did exactly what he did in the video but for some reason after that happens he somehow makes it work.
>>
>>51639315
start at the top with the errors
>>
Is Java bad for non-Android and non-enterprise applications?
>>
>>51639216
>>51639226
>>51639286
It may have looked like shit in the last couple minutes cause I was testing something real quick.

Also I don't know what bracket autocompleting you're talking about
>>
>>51639334
>is Java bad [rest of question]
yes
yes it is
>>
>>51639229
Syntax highlighting is useless?
>>
File: JavatwothirdsofApacheProjects.png (36 KB, 771x383) Image search: [Google]
JavatwothirdsofApacheProjects.png
36 KB, 771x383
>>51639334

No it isn't.
>>
File: errors.png (106 KB, 1917x914) Image search: [Google]
errors.png
106 KB, 1917x914
>>51639304
>>51639331
It's the same as in the video man.

Just a bunch of non-nonsensical errors that goes on for hundreds of lines. Didn't link correctly for some reason but im not sure why since it works for the guy in the video...

pic relate
>>
>>51639391
But that's all enterprise and mobile
>>
>>51639429
How do you distinguish enterprise and consumer? Is a java backend for a website enterprise? is a videogame in java consumer?
>>
>>51639448
Enterprise is enterprise and mobile runs on phones
>>
>>51639246
>>51639393
p-please... anyone ;-;
>>
>>51639460
Right but what do you mean by enterprise? give me an example of a non-enterprise application
>>
>>51639470
Any application that isn't enterprise
>>
>>51639462
1. Are you on windows or linux
2. Show me your compiler options
3. where is the library being linked from (is it a shared library in the local folder?)
>>
File: errors1.png (61 KB, 1157x545) Image search: [Google]
errors1.png
61 KB, 1157x545
>>51639496
>1. Are you on windows or linux
windows
>2. Show me your compiler options
pic related
>>
Any DBA's present?
I'm in the process of designing a database structure for a project, and I'm wondering how performant using a GUID-Token system as a unique ID across tables is.

I.E. All the characters on a map, the map itself, all the players involved, all have a shared GUID in their respective rows in their respective tables, so when you load up any given game it runs a query to pull all the records with that GUID to pop in all the info.
But I'm wondering if there's a more efficient way to do that
>>
>>51639531
gross
>>
>>51639531
>not clang
>>
>>51639391
>Apache projects
>Popular is good
good work anon
>>
>>51639554
>clang
>ever
It's called clang because it's the sound it makes when you drop it after it failed to compile your standard-compliant program, again.
>>
>>51639334
Nothing about java is inherently bad, but it has a lot of very well documented negatives because of how long it's been around.

It's not a bad place to start, or to code in general, because of the wealth of documentation that exists and the amount of industry that uses it.
But, if you can help it, just use C#. It's Java refactored by microsoft, which makes it exactly as efficient (I.E. Not) but way, way fucking cleaner to write with.
>>
LALRPOP (a Rust parser generator) is broken on the latest nightly, so I can't work on my latest project. To pass the time I am writing a monadic parser combinator library since I've never actually used one before and I thought making one would give insight into them.

>>51639573
kek
>>
>>51639541
>>51639554
>Saying memes instead of helping

t-thanks guys
>>
>>51639597
>but it has a lot of very well documented negatives because of how long it's been around.
>negatives
>ie. things that are "inherently bad"
>>
>>51639651
Let me rephrase:
Well documented complaints.

All languages have inherent negatives to them. Java is bloated, memory inefficient, and will quickly spiral out of control into single object factory page enterprise spaghetti code.
That said, overall, it's a solid language.
>>
>>51639531
Have you made sure you've got the proper libraries? (not 32 bit on a 64 bit computer, e.g), and have you made sure you downloaded the windows-specific libraries? .a files are used on the windows platform but typically you see .dll files instead. also:

>GNU GCC Compiler
>GNU's Not Unix GNU's Not Unix C Compiler Compiler
>>
>>51639675
>Have you made sure you've got the proper libraries? (not 32 bit on a 64 bit computer, e.g), and have you made sure you downloaded the windows-specific libraries? .a files are used on the windows platform but typically you see .dll files instead. also:

Yup. I looked at 2 videos and followed them.

I guess I'll try again with a new project and start from the beginning.

Is this easier to do on Memeux?
>>
>>51637779
finally got it working. the + and - weren't worth it.
that method doesn't easily let me go by row instead of column.

>>51639262
maybe. it wouldn't make two-dimensional lists much easier. I would still need the nested loops.
>>
>>51639560

np
>>
>>51639338
ok now it doesn't really seem broken but you need to work on it more and add more features
>>
>>51639246
>>51639393
>>51639462
>>51639531
>>51639496
Yayyyyyyy. I got it to work :^)

Turns out the mistake I made was that I needed to link the libboost_filesystem library file with D for the debug one and no-D for the release.

Silly mistake but im glad i got it to work. I will remember this for next time I see someone with this problem because i am positive somehow has fucked this up before and scratched their anus wondering why it won't work
>>
whats the best programming language for writing compilers
>>
>>51640055
C
>>
>>51640055
Haskell

Lex and Yacc
Thread replies: 255
Thread images: 35

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.