[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: 43
File: DPT.png (389 KB, 934x1000) Image search: [Google]
DPT.png
389 KB, 934x1000
Old thread: >>54708536

What are you working on /g/?
>>
first
>>
You guys use mech keyboards, right? What's your favorite switch?
>>
I'm making a Hello World application, gonna start a git repo and looking for about 5 volunteer developers to help out. Anyone interested?
>>
>>54713742
Don't really have a favorite yet, but I've been using clears.
>>
>>54713745
>working for free
>>
>>54713742
blues. I like it loud.
>>
>>54713753

I used reds initially, but my K65 broke a while ago and I've been looking to upgrade from this Microsoft basic keyboard I've been using in the interim. I think I'd like browns or blacks. Blues seem annoying if you do a lot of typing (which, naturally, programming entails).
>>
File: screen.1464062088.png (36 KB, 735x750) Image search: [Google]
screen.1464062088.png
36 KB, 735x750
how do you prevent yourself from getting lost in your own spaghetti

is it a bad idea to put huge comment blocks around everything?
>>
File: 1392076251417.jpg (22 KB, 575x316) Image search: [Google]
1392076251417.jpg
22 KB, 575x316
/g/, help a brother out
I got accepted into three universities I can't decide

Mathematics Computer Science - UC San Diego
Computer Science - UC Irvine
Computer Science - UC Davis

I'm more inclined to Irvine because I heard they have a school just for computer science, and their program left me drooling

But people tell me I should go to San Diego, though I'm not sure if the "math" part will make employers less likely to interview me

Help a brother out, I can't decide for the shit of myself.
>>
>>54713793
>is it a bad idea to put huge comment blocks around everything?


There is a famously bad comment style:

i=i+1; /* Add one to i */

and there are worse ways to do it:

/**********************************
* *
* Add one to i *
* *
**********************************/

i=i+1;


pikestyle, '89
>>
>>54713742
>>54713790
i dunno, i really enjoy the clicking sound of blues when im typing
>>
File: example.jpg (40 KB, 1000x200) Image search: [Google]
example.jpg
40 KB, 1000x200
Working on a little project in java, but need some help on implementing a gridbaglayout.

Never used gridbag before, and reading the tutorial on oracle isn't helping.

Attaching a drawing of what I want to put on a jframe that is 1000x200.

If someone could write up or explain how to put this into a gridbaglayout I would really appreciate it.
>>
>>54713790
It's a very satisfying sound to hear the steady strumming of the keys as you type.
>>
>>54713806
I went to UCI. it was good. i can't imagine how to compare my experience to the experience you would get at UCI vs the ones that you might get at UCSD or UCD.

don't stress about math making employers less inclined to interview you. It'll be 90% on you (whether you make your resume appealing, etc...)
>>
>>54713790
That's what clears are for. You get the clicky feel without them being as loud.
>>
>>54713814
I think im actually going to do that, because python doesn't seem to have region blocks
>>
>>54713806
honestly, they are all probably equally good CS programs, give or take. most of the stuff you gotta know to be competitive you're gonna have to teach yourself anyway--I would pick the school that is located where I'd like to live the most... although these all seem to be in California, so I dunno
>>
File: 1406803019377.jpg (103 KB, 1280x720) Image search: [Google]
1406803019377.jpg
103 KB, 1280x720
>>54713793
>Proportional width font
>>
>>54713909
I will never use monospaced fonts.
I just dont like them/they don't look good on windows.
>>
File: 1462977816032.jpg (158 KB, 500x705) Image search: [Google]
1462977816032.jpg
158 KB, 500x705
Does anyone have that list of practice programs to make? I don't remember if they were in order of difficulty or just a roll.
>>
>>54713864

God damn it. There's like 1/2 100% keyboards that have clears and they're fucking expensive.
>>
>>54713919
Enjoy your extremely dense code and complete inability to line anything other than tabs up.
>>
>>54713887
>these all seem to be in California,
yeah the University of California system is nitpicky about members being in California.
>>
File: vs.png (10 KB, 556x340) Image search: [Google]
vs.png
10 KB, 556x340
>>54713919
>I just dont like them/they don't look good on windows.

Disable cleartype
>>
>>54713942
>Remotely worrying about lining things up
Do you not use an IDE or something? Everything is automatically formatted as I type. I also have a hotkey that correctly formats my document in case the auto doesn't kick in.

The problems you mentioned are non-existent.
>>
>>54713957
>implying people who don't live in California give enough of a shit about California to know what universities are in California
die Californian scum
>>
>>54713939
Oh, I got a Poker II with clears off of Massdrop.
>>
>>54713961
what font?
>>
File: Z1hIX.gif (2 MB, 452x250) Image search: [Google]
Z1hIX.gif
2 MB, 452x250
>>54714007

god damn fuckin minis fuckin god damn tenkeyless fuckin keys crammed together fucking BULLSHIT. fuck.
>>
>>54713980
>The problems you mentioned are non-existent.
Can you correctly line up arguments like in >>54713961's image?
Also, your code is still incredibly dense.

>>54713961
Your font looks like shit. Maybe that's just because it's kind of small.
>>
>>54714070

GohuFont, lad.
>>
>>54713668

I probably should have asked here first.
>>
>>54713991
the name gives it away. UC means "University of California".

I don't know how clueless you can possibly be about universities, but if you had done enough cursory checking to learn what he was asking about in the first place, it should have made this obvious.

and if you're going to have a tantrum, go do it outside or something. take a walk and then come back.
>>
>>54714073
I want more space on my desk. It's great for typing.
>>
File: andale.png (5 KB, 749x130) Image search: [Google]
andale.png
5 KB, 749x130
>>54714080

I typically use Andale Mono or Dina. It's actually hard to find bitmap monospace fonts. There's about 20 of them, and for some reason, VS has a hard time rendering a handful of them.

Really narrows down the selection, unfortunately. I refuse to use font smoothing of any variety because it looks like somebody smeared vaseline on my god damned screen.

I wish people would design more bitmap fonts :(

>>54714127

I need a 100% keyboard.
>>
>>54714127
Just get a bigger desk. I use 2 desks perpendicular to each other.

Number pads are great so are a full set of function keys and Page Up, Page Down, Home and End.
>>
>>54714177
The only real advantage is the numpad. Using the Fn key works really well.
>>
File: trash.png (13 KB, 733x728) Image search: [Google]
trash.png
13 KB, 733x728
The prospect of going for a anti-aliased pixel look for my animation app has proven to be a needlessly difficult one.

pic related is the only working method a have so far, and this is just making over 1000 instances of one small black rectangle being drawn based on every change the x or y has.

Tried using grids to no avail, and using lines don't give the pixel feel at all. I don't want to be "that guy", but any simple suggestion would be nice.
>>
Reminder that Andrei is working on separating the standard library and GC
>>
>>54714277
>anti-aliased
>pixel feel
Wait, so do you want to see pixels or do you want it to be anti aliased? Do you have any examples of what you're aspiring towards?
>>
File: hatena-download[1].jpg (61 KB, 551x202) Image search: [Google]
hatena-download[1].jpg
61 KB, 551x202
>>54714308
shit, i meant aliased. Basically, something like Flipnote Studio for mobile.
>>
>>54713863
How was UCI's program? Did you like the school/social/program in general?

I'm thinking of going in SD just for the reputation and the location, but I see that the place is really socially dead and competitive and I may regret choosing it just for the location over Irvine or Davis
>>
>>54713793
> the end-of-line comments
>>
I need to learn C# with visual studio 2015 for work

Any good tutorials out there?
>>
Anyone with iOS/ObjC experience want to make a quick $5?
>>
>>54714535
Try >>>/craigslist/ soliciting faggot
>>
No Hime no code.
>>
File: 1463502196189.jpg (2 MB, 3264x2448) Image search: [Google]
1463502196189.jpg
2 MB, 3264x2448
>>54714752
is this satisfactory for your trap needs?
>>
>>54714482
Theres like 1000 good tutorials

You really cant go wrong mate, just google C# with Visual Studio, its an unwrittten rule that if you code on the MS stack, you use Visual Studio

Anyone reccomend any other IDEs?
>>
>>54714792

This manly homo has never posted face, so I must assume, despite the effort at a womanly body, that the face is a trainwreck.
>>
>>54713526
#include <stdio.h>

int main(){

int c = 5, d;
d = ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c;

printf("%d\n", d);

return 0;

}


How much is d?
>>
>>54714899
>How much is d?

It's free. You can download DMD for free on dlang.org
>>
>>54714825
thanks m8, I'm just gonna use the msdn one.
>>
>>54714921
That's not the correct answer. The correct answer is 138.
>>
>>54714934
No it isn't.
>>
>>54714899
it's garbage + some value
>>
>>54713806
Go to one which hopefully gives you a chance at industry experience at 2/3/4 year

I would bet that math cs @ san diego doesn't do that
>>
>>54713886
"""
Comment
More
moar
"""
>>
>>54715005
Afaik math cs and cs both get internships at silicon valley/prestige industries

it's really up to the side projects/knowledge of the field
>>
Lads, can I work for a big silicon valley company if I graduate from a mediocre canadian uni?
>>
>>54715098
Canada is still a thing nowadays?
>>
File: case.jpg (11 KB, 530x164) Image search: [Google]
case.jpg
11 KB, 530x164
When I compile my code, will case2 take up more memory?
>>
>>54713806
I'm not sure but I'd hardly think math would deter employers
>>
>>54715125
depends on the compiler and if it optimizes that
>>
it's 2 am and I can't think very well right now

do cosine and sine functions care about whether or not the angle is in radians or degrees?

>Math.Cos(pi/2);
vs
>Math.Cos(90);
>>
>>54715206
yes, the first is usually correct
>>
>>54715208
thanks mate
>>
>>54714792
Shave your legs and clean those socks dirty fag.
>>
>>54715138
Is it a valid optimization? Could break code that does weird stuff with pointers for instance.
>>
>>54714104
I can't wait until your state sinks into the ocean
>>
Why can you not post longer comments in dpt?
You should be able to post a fuckload of code using code brackets.
>>
>>54715400
Just use a pastebin dubs mcnewfag.
>>
who /SICP/ here? I feel like my head is about to explode from the autism of lisp tbqh.
>>
>>54715996
This is why I went straight to Haskell and skipped lisp
>>
>>54715996
It's a pretty comfy book for a pretty comfy and fun language.
>>
>>54716048
Will it make me a better programmer though?
>>
>>54716070
I ask because I can't stop thinking in C tbqh familia, and I really feel like I need to be thinking in Scheme in order to get this book properly.
>>
>>54716070
>>54716088
If you sit down and try to do the exercises, yeah. But running your eyes over the words without practice is useless.

New things are always hard. I'm currently trying to get used to reading assembly. It's taking a very long time to mentally parse what everything does because I'm not used to assembly's syntax.
>>
>>54716088
It just takes time.
>>
>>54713806
UCSD
>>
>>54716158
>>54716149
Alright familias, I'm gonna plunge head first into this meme then. I just created a procedure definition (not a function) that finds the average of three numbers and almost came from excitement, so I think it's fair to say that I'm already warming up to Scheme.
>>
File: 34059874.gif (397 KB, 1092x417) Image search: [Google]
34059874.gif
397 KB, 1092x417
>>
im having some trouble wrapping my head around the x64 (windows ABI) calling convention
>Additionally, the caller is responsible for allocating parameter space to the callee, and must always allocate sufficient space for the four register parameters, even if the callee doesn’t have that many parameters
this doesn't make sense to me, why would you allocate space on the stack for the parameters if they're passed in through registers anyways?
>>
>>54713742
MX Blues, but the only others I've used are greens.
>>
File: 1463892872593.jpg (71 KB, 437x458) Image search: [Google]
1463892872593.jpg
71 KB, 437x458
>>54713742
Clears.
>>
>>54713742
Deffo black
>>
File: primejacky.webm (3 MB, 1280x548) Image search: [Google]
primejacky.webm
3 MB, 1280x548
/dpt/-chan, dai suki~

Ask your much beloved programming literate anything (IAMA)

>>54716186
>gif
>not webm
This is the technology board so we expect some use of the said technology.

>>54716070
Yes

>>54714899
Undefined.

>>54713806
>Mathematics Computer Science - UC San Diego
>java school

>Computer Science - UC Irvine
>java school

>Computer Science - UC Davis
>python/c/c++ school

UC Davis seems to be the most interesting (content wise):

Not a java school (google "the perish of java schools")

An optional introduction to programming in python (ECS 10)
An introduction to computer science with C (ESC 30)
An introduction to OOP with C++ and to UNIX (ESC 40)
An introduction to computer architecture and x86 assembly programming (ESC 50)
course book: http://heather.cs.ucdavis.edu/~matloff/50/PLN/CompSystsBook.pdf
An introduction to algorithms with C++ (ESC 60)

From here, you have access to the specialized courses, especially

Computer Graphics (ESC 175)
Computer Architecture (ESC 154A/B)
Programming Languages (ESC 140A/B)
Software Engineering (ESC 160)
Operating Systems and System Programming (ECS 150)

http://www.cs.ucdavis.edu/courses/descriptions/

>>54716422
it's explained here
https://msdn.microsoft.com/en-us/library/ew5tede7.aspx
>>
File: tastingcitrus.webm (1 MB, 640x640) Image search: [Google]
tastingcitrus.webm
1 MB, 640x640
>>54715125
What language and what implementation ?
If you are not modifying nor taking the addresses of n and m, it should be the same (constant folding)
>>
>>54716570
Gif is still the easier option.
>webm to display bitmap text on a solid background.
>>
File: dpt_Sqtlmaoooooo,png.png (127 KB, 1280x720) Image search: [Google]
dpt_Sqtlmaoooooo,png.png
127 KB, 1280x720
So im js earning so dont rape me.
Also the design is irrelevant it's the idea that counts.

I try to make a simpe 1box page, is it engouh if i just DIV the and position the id="box" div? Or do i have to DIV the background aswell?

I've got this so far:

<html>
<head>
<title> TTestinggggg </title>
</head>
<body>
<div id="Box">
<h1>Main header</h1>
<p>Main paragraph</p>
</div>
</body>
</html>
>>
>>54716744
Just* Learning*

Sorry, didin' sleep yet, almost 11:00 here :) All nighter
>>
>>54716744
There's a thread for webdev m8
>>
>>54716744
Well I don't know html/design well the pattern I see usually is that you have a container of some sort and then a container for each significant portion (main content, sidebar...)
But really you're asking about how you're supposed to do something very basic here.
You can of course make a div for the background too if you want that.
>>>/g/wdg
>>
>>54716793
Damn, thanks!
I guess i will try..
it's my first night on web-dev...
I was in contact with it before but now i take it serious u know haha

even pulled a all nighter to read some books and watch tuts
>>
>>54716857
Don't ever sacrifice sleep when learning. It's like working out. The stuff you do during the day is just stimulating growth. This lass
Anna Tebelius Bodin
www.annatebeliusbodin.se
Wrote a book about it which I found useful. Explains a lot of things. But the most important to take from it is just what I said. That and that stressing yourself out is a great way to block practically any learning due to signal substances to the hypocampus.
>>
>>54716885
lol didin't knwo that!
Thanks for this tip i guess!
I do this really often so i think i need to stop lol
>>
>>54713919
KYS
>>
Going through Sam's Teach Yourself C
and only in lesson 4 he started talking about Hexadecimals.
Have I come unprepared if that's incredibly foreign to me?
>>
>>54716936
Yeah you're tired as fuck most likely. So probably note that down.
Or at least see how well you remember that post tomorrow.
>>
>>54717067
No. Doesn't matter. It's just how you represent numbers sometimes and have extremely little to do with programming. It's like how you could learn an alternative number system and do math with it. You get the same result in either.

It's just that binary and hexadecimal is very common in programming. Memory locations are often noted in hexadecimal for instance.
>>
>>54713835
just use windowbuilder and look at the code like anyone else that's still forced to use swing
>>
>>54717067
That's a math thing really

Go pause for a minute and look up some ways of converting hexadecimal back and forth between decimal or binary, and learn about base systems.
>>
I realized yesterday that I haven't programmed anything for fun in over 5 years. Give me some neat little utility program I can write, I don't have any ideas at the moment that are a good re-enrty point. I'd like to write a 3d renderer from scratch in a while.
>>
File: Dijkstra_Animation.gif (8 KB, 283x222) Image search: [Google]
Dijkstra_Animation.gif
8 KB, 283x222
Does anyone have a short Dijkstra's Algorithm solution?
>>
>>54717212
First thing that shows up in google:
http://www.vogella.com/tutorials/JavaAlgorithmsDijkstra/article.html
>>
>>54713526
hello friends,
looking for any books i can read before getting into a programming language

also there's a whole heap uploaded to this google drive

https://drive.google.com/folderview?id=0B8Y8T2uBc3hGWEkwWmw5QldNeXc
>>
You're all shit at programming and you never talk about anything interesting.
You're all Lisp/Haskell/Python/Java/JS/functional memers.
Fuck you all to hell.
>>
>>54717255
You ok, anon?
>>
>>54717255
Define "anything interesting"
>>
>>54717089
>>54717129
Cool good to know
>>
>>54717198
>in a while
Write a raymarcher. They're really simple. Just use a distance field. That's what they're best at.
>>
>>54717255
Please say something interesting. This is a give and take relationship. If you can't deal with I'm breaking up. House is mine.
>>
>>54717269
NO, I'M NOT FUCKING OKAY.
I WASTE SO MUCH OF MY TIME HERE INSTEAD OF BEING PRODUCTIVE AND I FUCKING HATE YOU ALL.
WHY DO I SPEND MY TIME WITH YOU FAGS
>>
>>54717326
Because you're here forever.
>>
>>54717326
>>54717255
Wow, the epitome of good content.
We should all strive to be like this anon: demanding that other anonymous strangers provide entertainment for you, just because you're a special snowflake.
>>
>>54717344
What is it that keeps making me come back here even though I fucking hate it every time.
>>
>>54717355
>>54717324
I'm not demanding entertainment. that wasn't even my main point.
I'm just expressing how much I hate you all. I just want you all to know that.
>>
>>54717374
Freedom
>>
>>54717410
I don't think I understand.
>>
>>54717406
Why though? There must be a reason. Most of my posts are when I'm slightly stuck in a small problem. If people with bigger issues did that maybe shit would be more interesting and educational.
>>
Has any of you developed a game and sold it on Steam (or for free)? I'm interested in seeing the fruits of /dpt/'s labor
>>
>>54717417
Everywhere else in the world you have some form of accountability. Here you don't. You can truly express yourself as you wish and it's addicting.
>>
>>54717429
>Why though?
Idk, I'm probably not very mentally stable right now. I usually am though.

>>54717442
Makes sense.
>>
>>54717438
There's multiple devs who have over on >>>/vg/agdg
>>
>>54717438
>Gaymes
>>>/vg/agdg
>>
>>54717456
>>54717457
I'd rather see what /dpt/ has made rather than those losers desu but okay
>>
>>54717482
The only real "game development" I can remember seeing on /dpt/ is the loli rape dungeon simulator, but that's been posted on /agdg/ as well if I'm not mistaken.
>>
>>54713742
Browns, so I don't annoy the ever living hell out of my co-workers.

>>54717198
Obviously, the most fun project would be something that you are uniquely interested in or suits a particular need of yours.

Personally, I'm working with the Cortana API for lewd things.

>Hey Cortana, open up 5 tabs of futa doujins
>>
>Learning C++ this year
I struggle to keep up with big projects with lots of lines and classes etc, not because I am stupid or don't know how to code, but because I hate typing and typing, I was used to Java and javascript etc, and they all had this awesome IDE's with auto completion, while I cant find good C++ one, Code Cocks and Cock Light doesnt do it, maybe just code lite but thats the minimum, no suggestions based on what you need, no good telesense or anything, at most word completion. I need something with boilerplates and such, but yet again the only thing that is near to that is Atom.io with plugins and it sucks for so many reasons (aside its atomio, it sucks coz you don't have (much like intellij idea) any ongoing compiler that sees errors before you compile)

So is there any alternatives actually ? I don't want to go to visual studio, except for C#.
>>
>>54717630
Eclipse or Netbeans
>>
>>54717630
Visual Studio is literally what you're looking for.
>>
>>54717630
Code in Atom.io
Use VS for debugging/build.

Intelisense is overrated. Just include stdafx.h and compile quickly. Intelisense doesn't even catch errors in the order I care about. It's annoying. I'm pretty sure atom could do what you need anyhow.
>>
>>54717630

terse, smartly designed code > c++ header and boilerplate hell > java enterprise oop coding with huge names everywhere
>>
>>54717672
>>54717630
Isn't this what you wanted?
https://blogs.aerys.in/jeanmarc-leroux/2015/07/31/atom-plugins-for-c-development/
>>
File: android-logo.png (80 KB, 1600x1600) Image search: [Google]
android-logo.png
80 KB, 1600x1600
What's the best most recent Android tutorial for complete Android beginners?
>>
>>54717733
What are you going to do on android?
Because you don't want to learn android. I'd recommend picking up some sort of framework.
>>
>>54717450
probably due to you being underage b&
>>
>>54717753
I don't have any projects in mind yet, but I want to start with the general (basic) app development: creating visual interface, managing views, passing data through multiple views, storing some basic data in the filesystem, basic networking.
>>
>someone branched my shitty unfinished personal project with zero documentation besides comments
are github bots a thing or something?
>>
>>54717792
>are github bots a thing or something?
Yes.
>>
File: 1461544318733.jpg (68 KB, 540x476) Image search: [Google]
1461544318733.jpg
68 KB, 540x476
>>54717801
for what purpose?
>>
File: 1450854754202.jpg (138 KB, 679x700) Image search: [Google]
1450854754202.jpg
138 KB, 679x700
>>54713806
UCSD - 2/3 Upper division CS courses, 1/3 math courses. Math - CS has 15 upper division CS courses at most. "Pure" CS has 23 upper division CS courses at most.

Essentially, you're only getting 2/3 out of the major that you want, and the rest is mathematics.

The other universities (Davis, Irvine) are pure Computer Science courses.

Think well. I honestly can't tell what's best for you, maybe /g/ has a better opinion of this.
>>
>>54713745
for sure
>>
>>54717942
I honestly don't see it for UCSD.
It's not enough course load to make one a math person
It's not enough course load to make one ready to take on real life jobs

It's really half assed if that's true, he could though, stay a bit longer to make up for the classes that aren't on his major assuming he can take them
>>
Anyone else use emacs -nw? I've gotten into the habit of using it lately.
>>
File: 1444001187199.jpg (27 KB, 455x334) Image search: [Google]
1444001187199.jpg
27 KB, 455x334
>>54718109
>emacs
>>
>>54718117
I've seen the cropped face of the girl here so many times, but I've never seen the full image.

Figures this happened in Aggieland.
>>
>>54717996
>>54717942
>8 classes

employers/Internships most likely won't care much about this if you have done projects on the side, really

it doesn't matter which one he goes to if he puts in the effort imho
>>
>>54718109
yes, but I use emacsclient -t with emacs running as a daemon
>>
>want functional programming jobs
>only have angular javascript ones
it's ogre
>>
>>54718320
>functional programming jobs
get a load of this guy
>>
>>54718320
>functional programming
>a job
>>
>>54718379
>>54718387
http://www.monster.com/jobs/search/?q=scala
>>
File: 1445213079970.jpg (2 MB, 3289x4421) Image search: [Google]
1445213079970.jpg
2 MB, 3289x4421
Working on a java program and ran into a problem with stopping a looping clip and starting and looping a new one.

This class's method is called to start the music
public void run() 
{
try
{
audioIn = AudioSystem.getAudioInputStream(getClass().getResource("music/1.wav"));
clip = AudioSystem.getClip();
clip.open(audioIn);
clip.loop(Clip.LOOP_CONTINUOUSLY);
}
catch (UnsupportedAudioFileException | IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (LineUnavailableException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}


}

It works fine, but when I need it to end, I call the same class but a different method.
public void end()
{
clip.stop();
try
{
audioIn = AudioSystem.getAudioInputStream(getClass().getResource("music/done.wav"));
clip2 = AudioSystem.getClip();
clip2.open(audioIn);
clip2.loop(Clip.LOOP_CONTINUOUSLY);
}
catch (UnsupportedAudioFileException | IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (LineUnavailableException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}

The problem occurs when clip.stop is called. I get a null pointer exception. I think it has something to do with the first clip since it is threaded. Here is the main that calls either method.
public static void main(String[] args) 
{
PlayMusic p = new PlayMusic();

if(args != null)
{
p.end();
}
else
{
(new Thread(p)).start();
}
}


Would really appreciate some guidance here!
>>
File: 1.jpg (48 KB, 445x138) Image search: [Google]
1.jpg
48 KB, 445x138
Is my programming wrong or is google wrong or am I a complete retard?

I don't understand why these are giving two vastly different results.

spoiler alert: I'm shit-tier at maths
>>
>>54718481
log 10 or 2
>>
>>54718481
Math.log is the natural log (base e)
The other one is log base 10.
>>
File: desktop-1420226358.jpg (92 KB, 351x400) Image search: [Google]
desktop-1420226358.jpg
92 KB, 351x400
Hey fags I'm transitioning from C# to Java for android dev, any tips?
And don't sperg out, I know it's a shit language, I literally have to.
>>
>>54718507
>>54718491

So I'm just making a list of predicted outcomes for an 'n log(n)' algorithm...

Should I be using the base 10 or base 2. The google results are giving expected results. The code one is giving wildly inflated values,
>>
>>54718528
Xamarin is now free, so you don't need to do that

if it's for a job well good luck
>>
>>54713526
Tryin' to write fizzbuzz. What am I doin' wrong?
#include <stdio.h>

int main(int argc, char *argv[]) {
int i;
int count = 50;

void divisible_check (initial, divisor) {
while(initial > 0) {
initial = initial / divisor;
if(initial == 1) { break }
}

for(i=0; i < count; i++) {
if(i/3 == 1) {
printf("fizz\n");
} if(i/5 == 1) {
printf("buzz\n");
} else {
printf("%d", i);
}
}
}
>>
>>54718544
Your syntax is all messed up.
>>
>>54718464
Shinobu a best.

Set a breakpoint and debug line by line, or look at the stack trace and identify the thing that's null.
>>
>>54718540
I'm asking more about the differences between the languages, things I need to look out for.
>Xamarin is now free
That's actually fucking awesome but yeah, it's for a job.
>>
http://haste-lang.org/
>Haste is an implementation of the Haskell programming language geared towards web applications. Haste is based on the de facto standard GHC compiler, which means that it supports the full Haskell language, including GHC extensions and produces highly optimized code but comes with an extended set of standard libraries.


what if someone uses this and meme the output into code review
>>
>>54718544
Did you copy and paste a bunch of random code snippets together? That syntax isn't even close to correct.
>>
the iced coffee suggestion was great

i made it like this just a little instant coffee and fill up the cup with milk

https://www.youtube.com/watch?v=Q45hUxzu0QQ
>>
>>54718544
hope you don't need up in the cs grad image macro
>>
>>54718588
>Did you copy and paste
No sir. I wrote this garbage all by myself.
>>
>>54717630
Xcode if you're on a mac
>>
>>54718597
END
>>
>>54718539
Are you trying to take the logarithm of n and multiply by n?

I'm not entirely sure what you mean by the expression
40 log(40)
.
>>
>>54718539
In Big-O notation, log is log base 2.

You're using Math.Log that uses log base e (natural).

Use
Math.Log(number, base)
, so in your case
Math.Log(40, 2)
.
>>
File: vzIbs4x.jpg (970 KB, 1200x1673) Image search: [Google]
vzIbs4x.jpg
970 KB, 1200x1673
>>54718566
what's null is clip.

at the top of the class I have Clip clip;
inside of the first method that runs the first song initializes clip with the first song.

we leave this method and this class and do other things. when it comes time to stop the first song, we call the class again but instead call the end() method which then tries to clip.close(); but does not see the first song that was put into it from the run() method.

when the run() method is called, a new thread is created for it. I am wondering if this means if it creates a copy of clip from the declaration in the class Clip clip and does what it wants with this copy. If that's the case, when the end() method is called, it only sees Clip clip; and nothing has been put into it yet according to it, throwing a null pointer exception.

How would I get around this? Is there a way to close the thread that started looping the first song within the end() method?

Also, I agree about shinobu.
>>
>>54718643

I love you

thanks
>>
https://godbolt.org/g/lm3GDd
>identical assembly
why is gcc < 6.1 so shit
>>
I'm writing a steganography encoder/decoder in Java, but I'm having memory troubles. [spoiler]Quelle surprise[/spoiler]

Data is encoded on a color channel basis. That is, each byte is hidden in the LSB of 8 color channels. So I need access to individual pixels.

Reading the image into a buffered image gives me this, but doing so requires a lot of memory, as the image is uncompressed in memory.

Here's where I run into trouble. It's going to be deployed as a webservice, and the machine it's going to run on has practically free no memory.
It runs perfectly fine on any machine with more than a couple of hundred megs of memory, but sadly the free Amazon shit has practically none left after deploying the webservice to a Tomcat server.

So my questions is, is there a stream that reads image files, color channel by color channel? Is there a stream that I can pass byte[4], filling it with a single pixel's ARGB color channels?

Do ImageInputStreams do this? I've tried testing it out, but I can't get it to work at the moment.
>>
>>54718749
does it have to be in java?
can you not write it in C and then use JNI to expose it in java?
>>
>reading an article on virtual tables
>look at author name
>Ranjeet Mewada
had a hearty kek
>>
>>54718653
Sorry anon, I'm a C# dev, so I'm not familiar with multithreading practices in Java.

Where is clip declared? If you had two threads going, which thread would be referred to if you say 'clip'?

I think you'd need to identify a specific instance of a thread and store that in something static that you can refer to and affect.
>>
>>54718762
Sure, it can most likely be written in C. I'm not that great with C, but I can probably figure something out.

What stream in C gives me the ability to read an image on a pixel-by-pixel or colorchannel-by-colorchannel basis, without reading the entirety of the image into memory first?
>>
>>54718749
FileInputStream might be fine since you're using the individual bytes anyway
>>
File: donutheaven.jpg (223 KB, 1920x1080) Image search: [Google]
donutheaven.jpg
223 KB, 1920x1080
>>54718781
> If you had two threads going, which thread would be referred to if you say 'clip'?

This is the problem. In my code, this is how the first song plays and loops:
(new Thread(p)).start();

I've never used threads in java before so I don't know exactly how to manage this but I got it to perform what I wanted it to correctly.

clip is declared globally at the top of the class. It is simply
Clip clip;


I've been googling for the past few hours trying to find someone that can help me with this issue but I guess nobody has had this issue before.. which I highly doubt.
>>
>>54718826
stdin :^)
>>
>>54718826
forget it will probably be worse
>>
>>54718539
The thing is that it doesn't matter. The difference between log in base A and log in base B is literally just a factor of log(A) / log(B) which is neglected in Big O notation anyway (meaning O(1.5 n) is the same as O(n)).
>>
>>54718826
Why don't you just read it bit by bit with Java?

I don't know much about the image file structure, but as long as you can recognize where one pixel starts and where it ends, it shouldn't be a problem.
>>
>>54718749
>sadly the free Amazon shit has practically none left after deploying the webservice to a Tomcat server
>b-but there's no need for C and C++ anymore
>h-hardware is plenty now
>n-no need for efficiency
enjoy your cup of java :^)
>>
>>54718836
Well I'm not familiar with java threads either but looking at it you don't save the thread pointer. The null pointer exception is probably that your stop method on the clip class frees the memory the thread is trying to use. So save the thread pointer and yield/stop it before you call the stop function on the clip.

Just my 5c..
>>
>>54718728
Why should it be different? Unless you're casting between a floating point number and an integral number, casting does pretty much nothing in C except for suppressing compiler warnings.
>>
I can't show the code because it's on my work computer and not uploaded anywhere just yet - but would anyone know why when looping through in C# and executing a bunch of Update queries, why the connection closes after the first iteration through the loop?
>>
>>54718835
Problem is, apart from BMPs, the pixels aren't stored as four sequential bytes.

Doing it with a FileInputStream would leave you with a corrupted file (with hidden, decodable data), whereas storing the bits in the pixels gives you a readable image, seemingly indistinguishable from the original file.

>>54718876
Writing my own file reader, that can decode PNGs on a pixel-by-pixel basis, is far out of the project scope. But that is indeed possible.

>>54718845
Gee thanks anon, that really helped me out ;~))

>>54718881
Thakns :~)
>>
Dear goyim,

does anyone have some handy resources to leaern datastructures and algorithms?

My professor uses Cormen's book, and I'd like some video material to go over stuff like:

- how Invariants work
- induction proofs
- regular sotring algo's
- analysis (big O notation) of scalability
- how to rewrite sum notation (with sigma) to regular formula with n like n(n+1)/2.
>>
>>54718911
because "movl $1, %eax" is wrong in the first function when "n == f"; gcc 6.1 fixed this bug; clang never had it and icc doesn't optimize this anyway
>>
>>54718836
how does the whole shit work
does clip need to be global? Make a new one each time
Don't know java so i googled this
http://stackoverflow.com/questions/877096/how-can-i-pass-a-parameter-to-a-java-thread
>>
File: umaruic.webm (1 MB, 640x360) Image search: [Google]
umaruic.webm
1 MB, 640x360
>>54718728
it's simple. first you are doing a writing to *n

*n = 1;

then in both cases you fetch the value of *n but *n hasn't been modified since that writing thus the compiler already know the last value of *n and thus can replace the fetch by that value.

return *n is replaced with return 1

if you want gcc to fetch the value of *n, you must declare n volatile.

int f(volatile int *n, float *f) {
*n = 1;
*f = 0.1f;
return *(char*) n;
}

int g(volatile int *n, float *f) {
*n = 1;
*f = 0.1f;
return (char) *n;
}

f:
movl $1, (%rdi)
movl $0x3dcccccd, (%rsi)
movsbl (%rdi), %eax
ret
g:
movl $1, (%rdi)
movl (%rdi), %eax
movl $0x3dcccccd, (%rsi)
movsbl %al, %eax
ret
>>
>>54718967
https://www.coursera.org/course/algs4partI

google around if the course videos are gone
>>
>>54718967
I have this video tutorial and it's awesome.

http://rutracker.online/torrent-38555.html
>>
>>54718989
>but *n hasn't been modified since that writing
what if it was modified by "*f = 0.1f;"?
>if you want gcc to fetch the value of *n
I dont, I just want it to generate correct code
>>
>>54713793
Use variables to break up way too deeply nested function calls. For example, if you did
keyboard = sibling_transform...layers[0]

it would make the code 100x easier

In general leverage variables and functions for readability, if you have a block of code that has a specific purpose don't be afraid to break it off into a function.
>>
>>54718989
>it's simple
>For every complex problem there is an answer that is clear, simple, and wrong.-- H. L. Mencken
>>
>>54719026
>what if it was modified by "*f = 0.1f;"?
That violates the strict aliasing rule.
>>
>>54718989
>icecream falls towards her
>somehow magically teleports away from her the next frame
Annoys the crap out of me.
>>
>>54719029
>Use variables to break up way too deeply nested function calls

Yes that's a good idea, but only if the function is being called more than once.

>don't be afraid to break it off into a function

Doesn't throwing things in functions add a tiny bit of overhead though, or is it just a case of premature optimization?

I'm used to using #region blocks with C#, which made it easy for me to separate things
>>
>>54719138
one other slight problem with functions is that you have to pass every variable you're using by reference(unless you want to make them global)
>>
If I wanted to find the "nearest neighbour" of a new point being appended to and ordered 1 dimensional vector/list data set are there any efficient algorithms/objects I can use other than just looping through the data set and using comparators?
>>
>>54719001
>>54719011
thx breh
>>
>>54719026
>what if it was modified by "*f = 0.1f;"?
it's forbidden to access *n if the last value stored is not of a compatible type.
http://port70.net/~nsz/c/c11/n1570.html#6.5p7
>>
>>54719156
Is the set ordered?
Is this the only way of inserting?

There's plenty of ways of doing insertion to get an ordered set.
>>
>>54719092
not really; the first function must work even when f == n; the second doesn't
>>
>>54719187
>it's forbidden to access *n
the first function doesn't access "*n"
>>
>>54719191
>Is the set ordered?
Yes.
>Is this the only way of inserting?
Now that I think about it I'm actually only interest in returning the subset of all elements in the ordered list that are greater than than a specified point, the point itself does not need to be inserted into the set.

I'm using python will something like
numpy.where
be efficient enough?
>>
>>54719199
It's undefined behaviour to access a pointer through a non-compatible type, so by accessing *n though an int pointer and *f though a float pointer, the compiler is allowed to assume that they do not point to the same place.
However, the char pointer cast in f() is still valid, as accessing things through char pointers is always valid.
>>
File: umarusecret.webm (2 MB, 960x540) Image search: [Google]
umarusecret.webm
2 MB, 960x540
>>54719187
>>54719026
if *n and *f are of compatible types, the fetch is done.

int f(int *n, char *f) {
*n = 1;
*f = 2;
return *(char*) n;
}

int g(int *n, char *f) {
*n = 1;
*f = 2;
return (char) *n;
}

f:
movl $1, (%rdi)
movb $2, (%rsi)
movsbl (%rdi), %eax
ret
g:
movl $1, (%rdi)
movb $2, (%rsi)
movsbl (%rdi), %eax
ret


>>54719207
char* is a compatible type.
>>
>>54719220
>it's ordered
Ok. pick a good sorting algorithm
>Now that I think about it I'm actually only interest in returning the subset of all elements in the ordered list that are greater than than a specified point, the point itself does not need to be inserted into the set.
Yeah ok so you just need to find the index then.
>numpy.where
>I use python
And why are you concerned about performance? You shouldn't be using python if that's a concern.
Just go for it. Maybe check if it's optimized for ordered sets. If it's not just write a binary search instead, they're fast and extremely easy to implement.
>>
>>54719260
>binary search
Thanks I think this is what I need.

>You shouldn't be using python if that's a concern.
I know, but it's the only language I know, but I am concerned about performance so I'm looking for some algorithm/function that's wrapped a more efficient routine.
>>
File: 1445511667448.gif (1 MB, 320x180) Image search: [Google]
1445511667448.gif
1 MB, 320x180
>>54719241
>those kneesocks
>that skirt
>>
>>54719311
holy fuck that gif has me on the floor right now

that fucking caption dude
>>
File: forms.png (40 KB, 552x681) Image search: [Google]
forms.png
40 KB, 552x681
how do I generate the forms into positions like these (just an example, this was put manually) when I click the "play" button? tried to do it the stupid way like but it gave me an error when I click play. where did I go wrong? [spoiler]please no bully[/spoiler]

 private void playToolStripMenuItem_Click(object sender, EventArgs e)
{
for (int i = 1; i <= 5; i++)
{
Form2[] f2 = new Form2[i];
f2[i].MdiParent = this;
f2[i].Text = ctr.ToString();
f2[i].StartPosition = FormStartPosition.Manual;

f2[1].Location = new Point(200, 1);
f2[2].Location = new Point(200, 400);
f2[3].Location = new Point(300, 400);
f2[4].Location = new Point(400, 400);
f2[5].Location = new Point(500, 400);
f2[i].Show();


}


}
>>
>>54719348
what's the error
>>
>>54719239
>undefined behaviour to access a pointer through a non-compatible type
correct
>accessing *n though an int pointer and *f though a float pointer, the compiler is allowed to assume
it's not allowed to assume that for write accesses
>>
Okay guys, i am ready to code some stuffs. What's the current community project of dpt ?
>>
>>54719241
>if *n and *f are of compatible types, the fetch is done
doesn't matter in the case of the first function: the fetch must always be done regardless of type compatibility of the pointer parameters
>>
>>54719382
recursive recursive functions that automate some sort of task
>>
>>54719382
make a program to play a game, like the ending of wargames
>>
File: error.png (34 KB, 767x575) Image search: [Google]
error.png
34 KB, 767x575
>>54719368
>>
>>54719382
https://github.com/irungentoo/toxcore/blob/master/docs/TODO.md
>>
>>54719378
>it's not allowed to assume that for write accesses
Yes it is. That's the whole damn point.
The strict aliasing rule exists so compilers can optimise better.

void fn(int *, float *);

int n;
fn(&n, (float *)&n);

is undefined behaviour (assuming fn access both of those pointers in any way)
>>
>>54719414
for (int i = 1; i <= 5; i++)

to
for (int i = 0; i < 5; i++)
>>
>>54719414
arrays start at 0 in C# anon..
>>
>>54719348
why are you using separate windows for each deck?
>>
>>54719414
pajeet tier
rethink your logic
>>
>>54713526
how come people use defective languages that rely on looping constructs but pretend like they're not plebs?
>>
>>54716744
>scripting languages
>programming
>>
>>54719414
Unless I'm too tired and not seeing something, this is horrible.

Delete everything and try this.

Form f2 = new Form();
f2.MdiParent = this;
f2.Text = ctr.ToString();
f2.StartPosition = FormStartPosition.Manual;

f2[1].Location = new Point(200, 1);

for (int i = 0; i < 4; i++)
{
f2 = new Form();
f2.MdiParent = this;
f2.Text = ctr.ToString();
f2.StartPosition = FormStartPosition.Manual;
f2.Show();

f2.Location = new Point(200 + 100 * i, 400);
}
>>
>>54719414
should you be using ( and not [, not done any vb.net in a while
>>
>>54719450
because they work and if it works then who gives a fuck about being considered a 'pleb'
>>
>>54719457

I mean this.

Form f2 = new Form();
f2.MdiParent = this;
f2.Text = ctr.ToString();

f2.Location = new Point(200, 1);

for (int i = 0; i < 4; i++)
{
f2 = new Form();
f2.MdiParent = this;
f2.Text = ctr.ToString();
f2.Show();

f2.Location = new Point(200 + 100 * i, 400);
}
>>
>>54719138
>but only if the function is being called more than once
Even if it is just for readability and you're only using it once, the cost of using a variable is nearly zero.

The cost of using a function is nearly zero as well. And if your code is logically ordered enough you don't need to pass by reference, depends on situation though obviously.
>>
>>54718973
>because "movl $1, %eax" is wrong in the first function when "n == f"
No, that is a valid optimization because of strict aliasing.
>>
>>54719463
t pajeet
>>
>>54719429
still getting that error

>>54719448
because the assignment calls for it.

>>54719457
>>54719470
I'll tweak around with this, thanks man
>>
>>54719399
>the fetch must always be done regardless of type compatibility of the pointer parameters
no since p = n and *p and *n are compatible. the compiler already knowing the value of *n. it also does know the value of *p which is the same as (type of *p)*n
>>
File: 1462835753286.jpg (28 KB, 550x550) Image search: [Google]
1462835753286.jpg
28 KB, 550x550
>>54719432
>in C# anon
what language do they fucking not lmao
>>
>>54719399
>the fetch must always be done regardless of type compatibility of the pointer parameters
The function only sees one constant stored to *n, and the function is supposed to return *n, so it's perfectly valid to just constantly fold it away and return the constant directly.
>>
>>54719416
Nice try but tox never had anything to do with /dpt/
>>
>>54719541
lua
>>
>>54719547
it's a /g/ project
>>
>>54719418
>Yes it is. That's the whole damn point.
you're wrong; also: if what you say it's true (the compiler is allowed to assume), why did the assumption change in gcc 6.1?
>fn(&n, (float *)&n); is undefined behavior
correct, this invocation is undefined behavior; it doesn't prove that all invocations are undefined behavior
your argument sounds like
>a + b can't ever overflow regardless of the values of a and b because 1 + 2 doesn't overflow
do you see the problem with this?
>>
>>54719541
https://en.wikipedia.org/wiki/Comparison_of_programming_languages_%28array%29#Array_system_cross-reference_list
>>
post programming PTSD
>write new line of code
>hit the save hoykey three times for good measure
>>
>>54719491
>that is a valid optimization
you're wrong; why was it removed in gcc 6.1? hint: it's not valid
>>
>>54719571
>>54719548

lua is literally the only notable one, and that's being generous.
>>
>>54719561
no, the author advertised on 4chan but also on reddit and hackernews at the same time.
>>
File: 608.jpg (67 KB, 709x765) Image search: [Google]
608.jpg
67 KB, 709x765
>>54719587
>finished a program for an assignment
>ready to be submitted and wait for the result
>turns out your code is identical to another guy's code so you both get a zero
Thread replies: 255
Thread images: 43

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.