[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 / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vip /vp / vr / w / wg / wsg / wsr / x / y ] [Search | Home]
4Archive logo
/dpt/ - Daily Programming Thread
If images are not shown try to refresh the page. If you like this website, please disable any AdBlock software!

You are currently reading a thread in /g/ - Technology

Thread replies: 310
Thread images: 34
File: 1451844625173.jpg (3 MB, 2480x3508) Image search: [iqdb] [SauceNao] [Google]
1451844625173.jpg
3 MB, 2480x3508
What are you working on, /dpt/?

Old: >>52386154
>>
>>52391746
good thread
thanks
>>
D is literally perfect
>>
Go is good.
>>
>>52391870
spose your right
>>
I made a python script to print images in Minecraft raspberry pi edition
>>
>>52391889
>raspberry pi
the fuck ever are these fuckers? Memes?
>>
good news boys, only took me 3 hours but i got java up and working with notepad and command prompt. turns out you just need to save as "filename.java" and add a new environment variable called PATH with the location of jdk's bin. now i can be nice and comfy all semester without having to fuck with learning how to use an IDE
>>
>>52391889
impressive, how did you go about doing it?
>>
>>52391946
I basically just manually took an RGB value from each block type that exists in pi edition, and then I went through the image pixel by pixel, and compared the pixel's RGB value to each available block's RGB to get the closest color match.
>>
I tried to ask in a /sqt/ but got no answer, so I'll try here.

I bought SICP and want to write code and test ideas as I read through it. Is it reasonable to do this with C/C++, or will it be a nightmare unless I do it with LISP? I'm a professional PHP webdev so I can code and setup an environment for whatever, but I wanna up my game and potentially shift to software deving.
>>
File: 1452127996613.png (1014 KB, 936x1580) Image search: [iqdb] [SauceNao] [Google]
1452127996613.png
1014 KB, 936x1580
>>52391746
THAT'S NOT MAKI
>>
>>52391996
some of the information may be okay to translate, but it will definitely be a challenge trying to do it with C/C++. I'd follow along with a Lisp or at least something about as high-level as Lisp.
>>
>>52391996

I think you'd need LISP, as C/C++ doesn't expose it's AST directly. You'd have to disassemble a compiler to see what the high level symbols resolve to.
>>
>>52392033
>>52392035
Thanks. Will Lisp be a good language to get under my belt for professional purposes? I'm reading the book to get some serious core ideas into my head, but I'm not sure there's much market for Lisp developers. Basically; should I focus on Lisp heavily or just enough to understand the topics and examples in the book?
>>
Haskell's core feature is laziness. Every other design decision is a consequence of lazy evaluation.
>>
>>52392106
LISP is completely irrelevant.
>>
>>52392122

Why?
>>
>>52392106
will you get a job working with Lisp daily? probably not, but there's a lot you can learn from it and apply your knowledge to. working with Lisp helps you with pretty much anything involving domain specific languages or metaprogramming (meaning macros, preprocessors, etc.) just reading SICP will help you pick up on a lot of that knowledge, so even if you don't work your ass off to learn Lisp and use it everywhere you can still get most of the good stuff out of it.
>>52392107
maybe, but the rest of the language could be made strict without much consequence (although I'm not sure whether that means that Haskell would have been very similar had it originally been made as a strict language (with similar ideas in all other aspects) ).
>>
File: 1452479864694.gif (414 KB, 400x485) Image search: [iqdb] [SauceNao] [Google]
1452479864694.gif
414 KB, 400x485
>>52392122
It's good to learn with because it's pure, there's no bloat.
>>
I'm in master's program for CS and I'm rather depressed. I want to drop out, but I'm 21 and unmotivated to get a real job. Kill meeeeeeeeee
>>
>>52391996
>I bought SICP
Why? You can just download the PDF.
>>
>>52392264
With pleasure... heh

*puts finger on trigger*

Any last words?
>>
File: Courage_on_G.jpg (48 KB, 500x375) Image search: [iqdb] [SauceNao] [Google]
Courage_on_G.jpg
48 KB, 500x375
>>52392266
Can you smell your SICP? I thought so.
>>
>>52392292
Vote ... for ... Trump
>>
>>52392225
Sounds good. I'll fire up some basic Lisp tutorials as I'm going through it but won't bother trying to master the language.

>>52392266
I'm a big physical book reader and just never found a way to zone in on e-books and long PDFs. Having a physical copy will definitely promote my attention to and follow-through of reading.
>>
>>52392310
but then trump would win and bring back american jobs and there'd be no need for you to kill yourself
>>
>>52391746
Right now i'm making a script in Python. The user inputs an IP address and it returns whether or not the that IP belongs to a Military, Government, or a honeypot. The script then returns not to scan or do anything to it to that IP address . I know it's a retarded script, but i'm a beginner.
>>
>>52392339
>trump win
>bring back american jobs

LOL
>>
>>52392369
How can you tell if an IP belongs to a military, government or a honeypot?
>>
which is better, a summer research helper position at my university (paid) or an internship at credit suisse (paid) for summer after my junior year? i should add that the credit suisse internship doubles as a job interview and if they like me i would have a job upon graduation http://strawpoll.me/6523015
>>
>>52392422
credit suisse duh

sounds like you're just bragging
>>
>>52392446
i haven't been given it, and i fully intend to try to pursue both but i'm just preparing for the unlikely possibility of being accepted for both and having to back out of one
>>
The more I use Rust, the more I'm frustrated by its overly simplistic type system.
>>
>>52392369
>python
Why is this place so infested with python kiddies?
>>
>>52392528
The Holy FizzBuzz of Christ was written in Python, boyo
>>
>>52392410
Various sites online like this: http://blog.smart-ip.net/2013/01/dangerous-ipv4-ranges.html I also had a few various "DO NOT SCAN" files for some reason. Those files supposedly contained honeypots and other sketchy shit.
>>
>>52392122
I use Clojure at work and am going to start sneaking in Common Lisp into the toolchain.
>>
>>52392310
>>>/pol/
>>
>>52392562
Why are some of them just labeled "Do not scan!"?
>>
>>52392528
Because people want to learn how to program and don't know where to start. Python is an alright building ground for most that have little to no experience with programming.
>>
>>52392673
Please stop perpetuating this meme, python is horrible for new programmers.
>>
File: 1452457058921.jpg (72 KB, 500x351) Image search: [iqdb] [SauceNao] [Google]
1452457058921.jpg
72 KB, 500x351
>>52392659
No idea, let's ping it and find out what it is.
>>
>>52392676
Very strong arguments
>>
Why doesn't Java have fixed point numbers? Why must everything be float?
>>
Which programming language do you guys use for web applications? Any favorite framework?
>>
>>52392690
Fuck that
>>
>spend time setting up a dynamic array lua entity system in C
>seems to work pretty good
>add SDL to engine
>only notice one entity on screen
>moves extremely fast (as many times as that entity should be on the level, say, 5)
>console still tells me there are 5

I don't even know where the issue is now. I seem to be having any memory issues at the time being, but for all the entities to converge is weird.
>>
>>52392769
*don't seem to be
>>
why does this work?

struct key {
char *word;
int count;
} keytab[] = {
"auto", 0,
"break", 0
};


is the compiler playing tricks on me? like how multidimensional arrays are actually just one contiguous array in memory? speaking of multidimensional arrays:

int fug[5][10];


how does the compiler know where fug[4][x] is in memory? does it calculate the size of the array's data type and increment the index (4 * x) * sizeof(int)?

am i even asking the right questions?
>>
>>52392510

Simplistic? If argue the exact opposite.
>>
>>52392769
lel, don't arrays start from 0?
>>
>>52392830
I have it set so the array on the C side just contains a number ID, and a function keeps track of available numbers (starting from 1).

That way, C has lua call entity[ID].
>>
>>52392735

https://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html
>>
trying to HTTP post a byte array (audio file) to vocaroos api, http response comes back and has no location in the header (which it should, to tell user the file ID)

what does this mean
>>
>>52392739
yesod
>>
I became interested in nim after seeing it mentioned here.
What problems does the language have, barring community & libraries?
>>
>>52392849
You should post the code so people can understand what you're trying to accomplish
>>
>>52392893
Welcome to the fold.
>>
I haven't begun refining/sorting it yet to make it look nicer, but here is 1 individual object in the lua script

objTest = { 
ID,
offset = {
x,
y
},
physics = {
xs,
ys
},
hitbox = {
x,
y,
w,
h
},
grounded = false,
dir = 1
}

function objTest:new()
self.hitbox.x = self.offset.x;
self.hitbox.y = self.offset.y;
self.hitbox.w = 16;
self.hitbox.h = 16;
end

function objTest:update( dt )

end

function objTest:draw()
SCR_DrawRect ( self.hitbox );
end


C calls these functions to run the object

function EntityAdd ( objtype, ID, x, y ) 
if _G[objtype] then
entity[#entity+1] = entityMT:import( objtype );

entity[#entity].ID = ID;
entity[#entity].offset.x = x;
entity[#entity].offset.y = y;

if entity[#entity].new then
entity[#entity]:new();
end
end
end

function EntityUpdate ( ID, dt )
if entity[ID].update then
entity[ID]:update( dt );
end
end

function EntityDraw ( ID, dt )
if entity[ID].draw then
entity[ID]:draw();
end
end


with the entity structure being

function table.shallow_copy(t) 
local t2 = {};
for k,v in pairs(t) do
t2[k] = v;
end
return t2;
end

entity = {}

entityMT = {}
entityMT.__index = entityMT

function entityMT:import( objtype )
local newObj = table.shallow_copy( _G[objtype] );
self.__index = self;
return setmetatable(newObj, self);
end


What am I doing wrong on the lua end? I do not believe it is the C end that is messing up. Also, can't I just put the entity functions in the table itself?
>>
>>52392714
Python is not a good "stepping stone" language. If you want to actually learn programming and not just python, you need to learn with a language that does not hide everything from the user like python does. The abstraction in python is horrible for new programmers because they are not learning anything about programming, they do not know how their code works or what it does. It also encourages heavy usage of 3rd party libraries, which is bad for a similar reason. "Copy and paste this and then type 5 lines of your own" is not teaching a new programmer anything. If you want to just learn python to make cool meme programs like generic 4chan image scraper #54255328 without actually understanding what your code does or how it works, then go ahead. If you want to learn to program you do not start with python, period. Encouraging new programmers to start with python is stupid.
>>
>>52393091

but jumping straight into low-level programming leads to an endless procession of questions like this >>52392809

i'm hoping eventually i will come out of it with a better understanding than if i had just jumped into python, but the journey seems a bit harder -- which i guess probably isn't necessarily even a bad thing
>>
Now with character animation.
>>
>>52393123
You're going to find it harder trying to learn something like a C language coming from python than you would learning it from scratch, because you not only have to learn the new language from scratch (Your python knowledge will be 99% inapplicable), you're also going to have to unlearn bad habits that python has taught you. Python is its own thing, you don't learn stuff that helps you program in other languages in python.
>>
>>52393150
will there be anime girls
>>
>>52393163

how many people who are python programmers will ever realistically need to learn a lower-level language though? unloaded question, by the way. curious
>>
>>52392809
your calculation is wrong but otherwise you are correct. (it should be (10*4+x)*sizeof(int)) there are 50 ints in total, grouped by 10. fug[4] begins from 40.
>>
>>52393181
Only the one behind the keyboard programming the thing.
I'm planning to just stick to flat shaded untextured blocks. Because art asset creation is way too much of a time sink and desu I'm not that great at modeling or texturing things >.<
>>
>>52392928
i forgot to quote you in it >>52393000
>>
>>52393209
Well, that's the thing. Like I said, if you just want to learn python then that's fine, but python doesn't teach you how to program - it just teaches you how to python. If you want to really learn how to program then you should be learning a lower level language.
>>
>>52393163
Can you give a specific example of code or a coding style in Python that is not supported to C?
>>
>>52392809
> why does this work?
The compiler overlooks the fact that you forgot the braces.

> how does the compiler know where fug[4][x] is in memory?
(char*)fug + (4 * 10 + x) * sizeof(int);

Given
> T a[N]
&a[i] is
> (char*)a + i*sizeof(T);

"Multi-dimensional" arrays are just arrays of arrays, i.e. T is an array. Indexing a multi-dimensional array means that "a" is itself an array-subscript expression, so the compiler just applies the rules recursively.
>>
>>52391746
>picture
Simply Ebin(a)
>>
Oh shit, emacs open PDFs
>>
>>52393229
That's nonsense. Programming in any language teaches you how to program. Some of them are more likely to make you learn certain concepts than others, but that's really not that significant.

>>52393236
Well, all of it's "possible" if you don't mind writing a large chunk of what's basically a Python runtime first.

But most idiomatic Python is a long way from idiomatic C. E.g. in C you tend to go to some effort to calculate array sizes up front so that you don't have to keep resizing as you go, have the caller create an array which the callee populates, etc.
>>
Java a shit
>>
>>52393316

It would be a pretty shitty operating system if it couldn't open PDFs.
>>
>>52393249
>(char*)fug + (4 * 10 + x) * sizeof(int);

the compiler casts the array index to a char pointer? that's pretty cool, didn't even know you could do that.
>>
>>52393365
fug is an int pointer. int* + x actually compiles to value of pointer + x * sizeof int. he casted it to char* so it 'x' wont get multiplied
>>
>>52393209
> how many people who are python programmers will ever realistically need to learn a lower-level language though?
It depends upon your threshold for "Python programmer".

If you include everyone who did a ten-hour Programming 101 course at their local college, then not many.

If you mean people who're likely to actually do significant work in Python, then a large chunk already know C or C++ and a large chunk of those who don't will eventually learn it for some reason or another (the main exception being web devs; unless you're employed or contracted by the web host rather than the client, you typically don't get to use languages which compile to native code).
>>
>>52393365
The cast to char* is just so that everything is in raw (byte) addresses.
>>
>>52393249
>The compiler overlooks the fact that you forgot the braces.

looks like i was overcomplicating everything. for some reason i assumed that the array initialization was somehow skipping over the struct referencing(dereferencing?) and directly initializing the struct's members contiguously in memory, if that makes any sense. i think it was because the syntax was the same as you would use to initialize a normal array of a basic data type. doesn't make shit for sense in retrospect. anyway, thanks
>>
>>52393323
No, it's not, you don't learn any useful programming concepts in python except the very core fundamentals which even a 6 year old could learn to do in C. Accept that you made a shitty choice, cut your losses and start learning C.
>>
hey have you nerds seen this https://github.com/mshang/python-elevator-challenge/

seems right up your alley

I'd do it myself but I don't know python well enough to design enterprise quality elevators :<
>>
>>52393000
I don't think lua should be that complex, m80
>>
>>52393606
You not liking a language doesn't make it bad, nor does it mean that it won't teach you programming.

I don't consider forcing you to learn how to implement your own basic container types (because the language doesn't have any) to be a positive aspect.

If you *want* to learn how to implement data structures, it's entirely possible to do that in any language (I learned most of it in Basic, and I mean something not very far removed from the original Dartmouth dialect, not VB).
>>
File: image001.jpg (236 KB, 1624x626) Image search: [iqdb] [SauceNao] [Google]
image001.jpg
236 KB, 1624x626
Who thought this was a good idea?
>>
>>52393896
Okay, I'm listening, what are these programming concepts you learn in python? "import doeverythingforme" isn't teaching you anything, you know.
>>
>>52393902
APL Consultants of Japan LTD.
>>
>>52393913
I have a sneaking suspicion that this is the guy who insists you implement every library before you use it.
>>
>>52393913
this is shitty bait
if you so desire you can build your own array class from the ground up
the point of python is that it is quick to get something working so you dont have to get bogged down in the details
>>
File: >tfw no sequel.png (2 MB, 1920x1080) Image search: [iqdb] [SauceNao] [Google]
>tfw no sequel.png
2 MB, 1920x1080
>>52391746
Wrangling a herd of genetic algorithms.

Cheeky bastards...
>>
>>52393955
And how is not learning the details at all useful for someone who is trying to learn to program?
>>
>>52393902
>There are real companies using APL

Lord have mercy.
>>
>>52394001
because there's more to programming than knowing how to define a struct? at an intermediate stage you have to know how to combine different pieces together at the least
i agree that python shouldn't be a beginner's only language, but you wouldnt say that java is a useless language to start learning with if it has all of the shit in the standard libraries, no?
>>
>>52394001
In roughly the same way that learning to drive is easier if you don't have to first build the car from a pile of iron ore.

Figuring out a path to a goal is easier the closer to the goal you are. You can't teach a beginner "this is how you add/subtract/multiply values, here's how to use an array, now use that knowledge to write a first-person shooter".

If you take a complete beginner and start with "this is how you manipulate a linked list", "this is how you manipulate a btree", etc, their response (either internally or vocally) is going to be "what's the point?".

It's more effective to demonstrate how to perform concrete tasks with higher-level building blocks, then move to the lower levels once there's some understanding of how programs work.

When I started, the first lesson revolved around READ and PRINT[1] so you could immediately make the program actually do something tangible. Once that's understood, you can start dealing with calculations, storing data in arrays, etc.

[1] PRINT *literally* printed stuff; this was on an ASR-33.
>>
Where umaru chan edition of dpt?????
>>
>>52394234
We don't talk about her anymore after the incident.
>>
>>52393902
>probably runs fucking horribly slow
>(FFFFFFFF*-1)/10 readability
>more of a meme than brainfuck
>why is this being taken seriously
>>
File: de Lubac.jpg (63 KB, 386x600) Image search: [iqdb] [SauceNao] [Google]
de Lubac.jpg
63 KB, 386x600
How do people actually deploy software?
What does it even mean to "deploy" software?
Also, what is the purpose of things like travis CI?
Also, in learning C++ should I start on the syntax or go into OOP?
I already know C, my biggest problem is that I always write C, I can't stop no matter how hard I try.
I want to C++.
Python can wait lol.
>>
>>52394249
Learn D in between to break the habits
>>
>>52394244
What incident?
>>
>>52394249
OOP. Let the encapsulation flow through you.
>>
>>52394249
fuck OOP, that can come much later. Learn the syntax first because thats most of what you're going to use in C++ anyways.
>>
>>52394265
Just don't dude.
>>
>>52394249
Writing C++ without OOP is among the best ways to write code if you care about performance (which is why you write C++ and not in some other more convenient language, right?).

If you want to be more efficient in some way do some metaprogramming. We don't have good performance oriented languages right now, that's why you don't feel right about things I think.
>>
I wrote this C program.
main[1<<30]={1};

But when I compiled it with gcc -mcmodel=medium, the output binary was really big. Why is C so bloated?
>>
>teacher said that the more {} the slower the code is
>>
With these slew of databases out there, how are you supposed to know what to use given any particular use case?

All I learned so far is the concept of a relational database, and not the differences between commercial options.
>>
>>52394409
>compiler creates bloated binary
>why is the language bloated???///
just quit programming and get a burger flipping job or smth
>>
>>52394503
https://www.youtube.com/watch?v=YgHNtzxO0y8
>>
>>52394409
nice try
>>
>>52394472
>teacher said that ?: is faster than if
>>
>>52394472
if you're worrying about brackets slowing your code down,then pre-optimization has already ruined you beyond repair
>>
I feel like I did this really poorly, how could I do it better though?


def setup(self):
for i in [2,3,3,4,5]:
done = False #is there a better way to retry if I've already placed a piece here?
while not done:
#this is all okay
self.rotation = random.randint(0,1)
self.x = random.randint(0,9-i*self.rotation)
self.y = random.randint(0,9-i*(not self.rotation)) * 10
#is there a better way to check if I've already placed a piece, so that I don't loop through it twice?
if all(self.board[self.x+(j*(self.rotation)) + self.y+(j*10*(not self.rotation))] == blankchar for j in range(i)):
for j in range(i):
self.board[self.x+(j*(self.rotation)) + self.y+(j*10*(not self.rotation))] = i
done = True
>>
>>52394823
Write it in a better language
>>
>>52394472
Only blank space makes the program slower
>>
>>52394876
>>52394472
everybody knows loops are the only thing that seriously slow down your program, you should really unroll those.
>>
>>52394887
https://en.m.wikipedia.org/wiki/Duff%27s_device
>>
>>52394887
especially while(1) loops. Those things slow it to a crawl
>>
>>52394944
speaking of, what's the deal with those?

There's always a break or return on condition, unless you actually want an infinite loop, so shouldn't they be considered bad practice?
>>
Are there design philosophy differences in having void functions with pass-by-references as opposed to having many separate char/int/double functions that return one value?
>>
>>52395033
Infinite loops aren't exactly rare
>>
>>52395045
There's not much point in splitting up a function unless it can justifiably be said to be doing more than one action.

For example, if your function is more than a page long, then that function is obviously doing a lot more than its name describes and should be refactored.
>>
>>52393960
Bulge
>>
Anybody else here know that feel where you work on project after project for years, getting really close to finishing each time, only to be stopped by some unexpected and unavoidable roadblock? I fucking hate this feeling.

It feels like I can't do anything.
>>
>>52395139
my only roadblock is never enough time/life issues get in the way.
>>
File: 1451844694882.png (2 MB, 2519x1996) Image search: [iqdb] [SauceNao] [Google]
1451844694882.png
2 MB, 2519x1996
>>52395139
I usually get bored and start working on something else before I finish a project, not because of any roadblocks.
>>
>>52395202
Your image cant possibly be safe for posting. This is practically pron.
>>
>>52395218
Silly anon, there isn't any nudity.
>>
>>52395218

it is porn. you can literally see her figurative vagina
>>
>>52395218
By that logic, women are literally porn since all they wear is yoga pants.
>>
Have any anons worked on AAA games? Is it basically a big ass clusterfuck?
>>
>LAST REPLY 33 MINUTES AGO
WHY IS /dpt/ SO SLOW?
>>
>>52395596
It's written in Python
>>
>>52395139
I'm sure you've been working on a project for years :)
>>
>>52395139
>unexpected and avoidable

Questioning this.
>>
https://github.com/danakj/openbox/blob/master/openbox/frame.c#L128

It this idiomatic Xlib? Something about creating over 40 new X windows just to render decorations seems absurd.
>>
File: gifany.gif (40 KB, 352x232) Image search: [iqdb] [SauceNao] [Google]
gifany.gif
40 KB, 352x232
>>52395624
ayyy


...


lamo
>>
>>52393902
>hey anon, quick job. the client says you only have to debug 18 lines of code
>>
File: 1413404713040.gif (1 MB, 200x200) Image search: [iqdb] [SauceNao] [Google]
1413404713040.gif
1 MB, 200x200
>>52395624
>>
I used simple makefiles and vim on my GNU/Linux laptop to work on my school Java projects. It also helped that I already knew what to do once I started taking classes that used C.
>>
>>52396165
>doing uni project in java
>write bash scripts to build the project
>still have move all the java files to eclipse project so faggots in the group using windows can do their part
I don't understand why is it that ant or maven build files are always fucking long even when they do only a simple task.
The build files being in xml doesn't help.
>>
>>52394249
Travis CI is a service for continious integration. Basically the simple thing you can do is for Travis CI to automatically test any new code commited to a repo and report any failures. You can configure it to do things like use different compilers or versions of software and to run tests to make sure things still work.

To deploy software generally means to run and configure the software on some computer. For example you deploy your web application to the production server. With tools like Travis CI you can automate the entire deployment so that once it completes successful testing it can deploy it.
>>
Just downloaded an open source image editor. It built with no errors, compiled in less than a second, and opens and exits faster than Windows photo viewer.

Why can't all OSS be like this? Instead we're stuck with heaping piles of shit like GIMP which takes 20+seconds to boot up. Or paint.net, which takes 5 seconds. What the fuck are they doing? I haven't tried compiling either from scratch but I guarantee you, on Windows, it's a huge pain in the ass involving dependency chains and cmake retardation.

Why is 99% of OSS so shit?
>>
>>52396203
I understand your pain, I was going to set up a Java group project but I said fuck it and used an IDE. Have you tried gradle? I tried it recently for a personal project and the build script isn't that bad, it is written in Groovy
>>
>>52396296
>like GIMP which takes 20+seconds to boot up
Not on Linux. Probably because the Windows version relies on its own local GTK+ which is not exactly small.

>paint.net
>.net
>>
>>52396203
>gradle
>MINUTES to start up
>>
>>52396296
>paint.net
not foss
>>
>>52396463
Wow, you're right. It's so shitty I just assumed it was open source. Goddammit.
>>
I need something to work on, /dpt/

I got sick of working on my music player, adding more and more features is just a lot of treading the same ground, I found a nice dictionary and made a password generator and a typing speed tester.

Now what? I'm not all that competent and I feel like I'm limited with C# because all my applications are UI driven.

Any ideas?
>>
>>52396583
Learn C. Write some openGL code. Maybe a hardware-accelerated UI framework.
>>
>>52396609
>Learn C

I'd like to get done learning C# really, I can barely string things together, I'm nowhere near ready to learn another language yet.
>>
>>52396617
Learning C will help you understand C# much better. I promise.
>>
>>52396638
I think the leap from barely understanding one language to trying to write a framework using hardware acceleration and a different language is far too great.

Even if I understood the language, I don't know how I'd even begin writing a framework, let alone one that interacts with complex concepts like hardware acceleration.
>>
What's something I that would take less than a month to develop and be something I can put on my github and portfolio?
>>
>>52396662
stick with one language until you've nailed it lad

hopping from one to the other isn't a great idea
>>
>>52396701
A C compiler. Not optimizing, obviously.
>>
>>52396701
A simple Lisp/Scheme interpreter.
Okay, a very simple usable one is a matter of days.
>>
>>52396617
Guy who actually knows C# here
>>52396638
this guy's yanking your chain.

C# has almost nothing to do with C/C++
In fact its roots are as an improved Java tied to the .NET Framework.

The only real relation C# has to idiomatic C++, is that certain language constructs are the same. In other words, it has pointers, albeit you have to use them in unsafe{} scope.

C# in turn has almost no relation to idiomatic C.
>>
>>52396701
an openGL virtual of you own body

you'll need a camera to capture all the bits, probably with flash to get the inside parts. maybe you can get one of those 360 ones and make a panorama out of it as well?
>>
>>52391746
why do these threads always have an image of something completely unrelated to programming?
>>
>>52396748
To annoy you.
>>
>>52396734
Do you know C? Learning C will help you understand any C-style language better. This includes Java and C# obviously (and even Javascript), because they inherit a lot of syntax and cruft from C.

Learning C peels away a lot of the abstractions you take for granted and forces you to figure out how they really work, which, again, makes you a better programmer in general and aids your understanding of other languages.

Learning C will help you understand why Strings are so shit in C#, for instance.
>>
>>52396617
>I'm nowhere near ready to learn another language yet.
That's exactly why you need to learn another one. Only by having used multiple languages of different kinds makes it possible to understand the advantages and disadvantages of each one and thus getting more proficient in the general "programming" category.
>>
>>52396734
Can you recommend a decent project that would give me a moderate challenge and get me to cover a lot of very useful topics?

I've been doing a lot of UI driven applications that are generally simple when it comes to code, I don't feel like I'm really learning anything other than the basics at the moment.
>>
I was going to learn to program VR and make my waifu. Where do I start with VR?
>>
File: 1452351559589.gif (131 KB, 600x338) Image search: [iqdb] [SauceNao] [Google]
1452351559589.gif
131 KB, 600x338
I'm bored, /dpt/.
>>
>>52396802
An engine that has support for it. Unity and UnrealEngine are probably the two you'd want to look at.
>>
>>52396736
I'd just like to interject. What you're referring to as a panorama is in actually a series of images put together in a slideshow, or as I've taken to calling it, std::vector<Picture>, or "Turntable".
There really is a panorama, and people are using it, but panoramas are in actuality a series of shots stitched together to produce a wide angle image.

>>52396781
Have you already tried LINQ?
If you haven't, then you probably want to start integrating your music player with a real database, and then begin creating search queries using LINQ.
You can also try dicking around by extending IEnumerable or other built-in .NET data structures with extension methods.
This is where the real power of C# comes in that separates it from the crowd.

If you want to brush up on your software engineering chops, I suggest you look up WPF and MVVM, also called MVCVM by those who don't want people to forget about the controller.
>>
>>52396818
Oh, great, I wanted to learn unreal anyway. Thanks. Also, advice on AI coding?
>>
>>52396812
I just finished reading a manga that broke my heart
>>
>>52396762
Admittedly I don't understand idiomatic C too well--I often get stuck because I hate learning about I/O in any language, and C has it the worst.

You're correct in that everything is much more manual in C, but the problem is that idiomatic C does not translate to idiomatic C++, because of OOP.

At best, I believe that what you will learn from C is how to appreciate managing resources (memory), and the usefulness of pointers and references.

Possibly also a healthy hate of I/O.
>>
>>52396819
My music player uses JSON to save/load libraries, and I use LINQ for my library windows display, I possibly could've used a SQLite database or something but this seemed just as good.

I don't really understand it particularly well though I must say, the syntax is very confusing.
>>
>>52396836
Which one? Sand Chronicles?
>>
>>52395979
Anyone?
>>
>>52396828
>AI Coding

Think from the perspective of the thing you're trying to give AI to.

I don't know a great deal about it generally, but I know that if you want to emulate a certain behaviour it's much easier to walk through that behaviour in your head and think of each logical step you'd need to take in order to achieve the desired outcome.
>>
>>52396853
If you program some extension methods for the IEnumerable interface using lazy evaluation, then you will understand how LINQ works.

If query expressions are too confusing (they're designed to resemble SQL and relational database queries), you should try the regular notation, also called dot notation.
Dot notation is designed to resemble classical programming.
Treat it as if you're writing a pipe and filter application and that you're simply chaining functions together.
>>
>>52396866
I want to take a shot at the Turing test.
>>
>>52396869
As an example for an extension method, try implementing Python's Zip function in C#.
https://docs.python.org/2/library/functions.html#zip

For reference, C#'s IEnumerable Zip function is not similar to Python's Zip function.
>>
I'm having a hard time motivating myself to do projects. This slump is horrible and I want it over. I want to do some lover level programming because for the pas year its been mostly web development. Any ideas of nice projects that will invigorate me? I like C but I guess C++ is fine as well.
>>
>>52396853
>>52396819
Woops, for some reason I forgot to write the second half of my post.

I'm already using WPF, and I'm competent enough at databinding. From what I understand MVVM is a concept that describes the idea of having your UI reflect your current data and having the changes on the UI directly modify the data, without the middle man.

That's all I really took from my time on Google, because most of what I saw in actual code was a giant mess of almost indecipherable nonsense.

>>52396869
>>52396881
I barely understood any of what you wrote there, learning all this syntax and what each word means is quite hard in a second language - especially when your first language is ancient and nigh on dead, and only recently came up with a word for a microwave.
>>
>>52396861
Onnanoko Tokidoki Otokonoko
>>
>>52396875

Good luck with that one, you'd need some serious computational power and an absolute metric fuckload of data.

Get in touch with IBM and ask if you can use the "Watson" backend.
>>
>>5239690
I see.
>>
>>52396902
>>52396913
>my linking skillz
>>
Any OpenGL wizards here? What the fuck are OpenGL extensions for? Do I really need to manually load all this bullshit? Is there some wiki or API doc that tells me which are actually useful?

I'm writing a 2D renderer.
>>
>>52396909
Are you being sarcastic, or is that a possibility?
>>
>>52396928
http://www.ibm.com/smarterplanet/us/en/ibmwatson/watson-cloud.html
>>
File: 1451754894694.png (132 KB, 354x599) Image search: [iqdb] [SauceNao] [Google]
1451754894694.png
132 KB, 354x599
Why is it taboo to modify prototypes of standard JavaScript objects, /dpt/?

It seems so useful.
>>
>>52396959
I wanna stick my dick in this.
>>
>>52396926
>I'm writing a 2D renderer.
>Do I really need to manually load all this bullshit?
No, immediate mode or 1.1 vertex arrays will work just fine.
If you want fragment shaders you need to load about 4 function pointers for compiling and linking shaders and passing uniforms.
>>
>>52396959
Because if some other idiot did it, you would overwrite it.
>>
>>52396942
Thanks, m8. First I'll do animations, then I'll dedicate my life to making the perfect AI waifu.
>>
>>52396969
>mentioning your gender on an anonymous imageboard

Fuck off attention whore.
>>
>>52396959
How the fuck is that useful?
>>
>>52396975
Thanks. Seems like the official wiki and stackoverflow recommend I do stuff like download Python frameworks to generate dynamic extension lists... which is the dumbest fucking thing I've ever heard.
>>
>>52392338
Stop you right there! There are many lisps, doesn't SICP use scheme???
>>
>>52396881
public static IEnumerable<Tuple<A, B>> Zip<A, B>(this IEnumerable<A> a, IEnumerable<B> b)
{
var enumA = a.GetEnumerator();
var enumB = b.GetEnumerator();
while (enumA.MoveNext() && enumB.MoveNext())
yield return new Tuple<A, B>(enumA.Current, enumB.Current);
}
>>
>>52396986
*I wanna stick ether my dick if I have one or my strap on in this.
>>
>>52397009
Scheme is a Lisp.
>>
Have you read your "Lambda: The ultimate imperative" today?
>>
>>52396969
No problem. Just print her out and do whatever.
It's your paper(cuts on your dick).
>>
File: err.jpg (101 KB, 939x535) Image search: [iqdb] [SauceNao] [Google]
err.jpg
101 KB, 939x535
any javascript guru's here? Wat do?
>>
>>52397064
Is that client-side Javascript?
I didn't know that VS could do it.
>>
anybody here has experience with editing word documents with c#?
I got a word document (.doc) that only allows to edit those grey areas (pic related).
I want to create a program that automaticly fills these areas with content, but how are these grey areas even called and how do i acces them via openxml sdk?
>>
>>52397064
Have you considered that $.shortcut_dropdown is undefined or null?
>>
>>52397089
This desu.
>>
File: insert.png (13 KB, 1130x224) Image search: [iqdb] [SauceNao] [Google]
insert.png
13 KB, 1130x224
>>52397080
forgot pic
>>
>tfw can't use WIN32_LEAN_AND_MEAN because you need to set Sleep granularity

I fucking hate programming on Windows sometimes.
>>
>>52396900
Sorry for the late response, I just took a fat ogre shit in my swamp.

Your understanding of MVVM is flawed.
MVVM is something called a design pattern (proven solution style to a known problem), and its primary duty is to separate the front-end logic from the back-end logic.
This is done using the View and the Model.
The View holds all the front-end logic--the XAML you've hopefully been writing by hand.
The Model holds all of the data and logic related to modifying and producing the data,

The controller still exists in MVVM, and is often called the "glue". It's the logic that the View binds to. It safely separates the View from the Model so that the View does not need to tailor itself to the model, and the model does not need to tailor itself to the front-end.

In design-patterns, this is called a bridge.

The ViewModel is also a part of that bridge, and what it does is translate between the View and the Model.
The controller being the glue is what allows the View and the ViewModel to communicate and update each other. This process is called binding, and simply refers to message sending between the front-end XAML and back-end C#.
>>
File: ss1.png (108 KB, 960x827) Image search: [iqdb] [SauceNao] [Google]
ss1.png
108 KB, 960x827
>>52391746

>>52396882
>>52396882
>>
>>52397169
>there are cargo-cult programmers just like this posting in my /dpt/
>there are people who unironically use "design patterns"
>>
File: 1450760738926.jpg (33 KB, 500x375) Image search: [iqdb] [SauceNao] [Google]
1450760738926.jpg
33 KB, 500x375
There are twelve men on an island.

Eleven weigh exactly the same amount, but one of them is slightly lighter or heavier.

You must figure out which.

The island has no scales, but there is a see-saw -- the exciting catch:

you can only use it three times.
>>
>>52396748
cuz people on here are super gay
>>
What's the best way to reverse a string in JavaScript senpai?

//reverse1: 5223ms
function reverse1(s){
return s.split("").reverse().join("");
}

//reverse2: 2334ms
function reverse2() {
var val = "";

for(var i = 1; i <= this.length; i++) {
val += this[this.length - i];
}

return val;
};

time = Date.now();

for(var i = 0; i <= 1000000; i++) {
reverse("this is a test string");
}

console.log("reverse1: " + (Date.now() - time));

time = Date.now();

for(var i = 0; i <= 1000000; i++) {
reverse2("this is a test string");
}

console.log("reverse2: " + (Date.now() - time));


An extra ~3 seconds every million loops is worth the shortened version, right?
>>
>>52397177
Binary search. You need to discover at most 6 bits of information, which is less than 2^3, so it's easily doable by treating each individual as a bit and performing a binary search comparing them.
>>
>>52391746
Is this why the hugbox was created?
>>
File: 1447681262004.jpg (14 KB, 314x518) Image search: [iqdb] [SauceNao] [Google]
1447681262004.jpg
14 KB, 314x518
>>52397197
>>
>>52397174
>design patterns are bad because muh enterprise
Please, if you don't understand the basic need of separating the output-producing logic from the logic that does the raster equivalent of pretty-printing, then your programs must be unmaintainable by anyone but you.
>>
>>52397177
Do we know if it's lighter or heavier? If we do then weigh 6 and 6, followed by 3 and 3 of the lighter/heavier side, followed by any 2 of the lighter/heavier side.
>>
>>52397213
Literally a binary search, congratulations.
>>
>>52397216
If you don't know if it's lighter or heavier it doesn't work, though, since if it's heavier and you weigh 3 and 3 of the lighter side they would be equal.
>>
File: file.png (821 KB, 2400x1066) Image search: [iqdb] [SauceNao] [Google]
file.png
821 KB, 2400x1066
>mfw trying to do a colapsible side-menu on android
W-why they can't just add it in a simple way?
>>
>>52397233
you would need one more operation
>>
>>52397169
Extension methods are a special kind of function in C#. They allow you to populate an existing namespace outside of your own source code.
In this case it would be IEnumerable.
So for example, if you wanted to run a function like
dynamic foo = new List<Integer>() {1, 2, 3 , 4, 5};
foo.Transpose();//rotates list 90 degrees clockwise

Transpose() is not a function available in IEnumerable's list of function prototypes.
So to add it, you would create an extension method.
In this case the extension method would be something like
public static class Extensions {
public static IEnumerable<IEnumerable<T>> Transpose(this IEnumerable<T> data) {
foreach(T item in data) {
yield return item;
}
}
}

It does what it says on the tin. The key thing to note here is the parameter "this IEnumerable<T> data".
The "this" keyword denotes that it's a function that pulls data from its own object, and that "data" is used to refer to that object. Useful because you can't ordinarily access it outside of the namespace.
The "static" function specifier and "static" class specifier denote that the function should always be publically accessible, which makes sense for extension methods, and so it's a requirement.
>>
>>52397272
actually that first block would be
List<Integer> foo = new List<Integer>() {1, 2, 3 , 4, 5};
List<List<Integer>>bar = foo.Transpose();//rotates list 90 degrees clockwise


note the difference--functions used in IEnumerable always return something, and IEnumerable goes hand-in-hand with LINQ.
>>
On GitHub, how is merging different from pulling your fork to the upstream?
>>
>>52397174
>Design patterns are bad

This is what happens when you learn programming from /dpt/

Nothing but destructive
>>
>>52397111
>>52397080
bump?
>>
>>52396900
I can also see the basic problem you're having.
It seems the main problem with the way you're learning C# is that you only know syntax.

You're pretty much code-monkey tier right now and don't understand OOP really at all.

Unfortunately I don't have anything for you regarding that. I can explain things to people who already have a strong foundation in imperative programming paradigms but I can't teach anyone the basics of anything.
>>
>>52393163
This is total bullshit.

Having learned 8 programming languages including Python, I can safely say that at least 95% of the concepts are shared by all of them. The differences come down to syntax and individual language features. Almost all of programming simply involves being able to break down problems into smaller sub problems which can be solved one at a time. This skill doesn't depend on whatever language you're using.
>>
>>52397089
>>52397105

idk but its only doing it in IE

any ideas?
>>
Well it took me hours, but I finally understand the basics of x86 instruction encoding.

Time to make a shitty JIT assembler.

What music are you listening to while you work /dpt/? For me, it's https://www.youtube.com/watch?v=LJFSbmET880

>>52397400
Yeah, you're right. I can't think of any major language you could learn that would make it more difficult to learn any second one.
>>
>>52397400
>being able to break down problems into smaller sub problems which can be solved one at a time.
that's what qualifies you as a programmer.

to become a good one you also need the theory and design techniques
>>
>>52397400
I like you.
>>
>>52397213
We want to find out if they are heavier or lighter.
>>
>>52397461
>>52397400
You two should fuck.
>>
>get project idea
>google search it
>someone already made it, and did it better than you would have
>>
>>52397362
My problem is the exact opposite of that, I understand the principles and the logic required to achieve an outcome, it's understanding the syntax and words that I have a huge issue with.

The language I learned growing up is devoid of any computing related terms, it's ancient and essentially worthless.

If I had a better understanding of the syntax and the words used to describe concepts I'd be a lot better off.
>>
>>52397476
code it anyway, then make it better than the other one
>>
>>52397401
What is the $.shortcut_dropdown variable?
>>
>>52397498
Let me guess, Alice by CMU.

Anyways since that's out of the way I'll just recommend you this book.
C# In Depth by Jon Skeet.
It's up to C# 5.0, but you can catch up to 6.0 using Microsoft's videos.
http://it-ebooks.info/book/3010/

The guy who wrote the book is part of the committee that designed C#.
>>
>>52397435
>What music are you listening to while you work /dpt/?
this playlist https://www.youtube.com/playlist?list=PLkS3vp3gs6_teWWhuIwpuzvVG0cJ4mvMl
>>
>>52397532
>Let me guess, Alice by CMU.
No, my actual spoken native language.
>>
>>52397519

$.shortcut_dropdown = $('#shortcut');
>>
>>52397564
That sucks.

If it makes you feel any better, from the point of view of a native English speaker, the vast majority computing terminology is as arcane to a layman as it is to you.

I don't think anyone would understand what the "static" keyword would do until looking it up.
>>
>>52393226
>>52393150
What do you use to program that, if I know C# can I get into this kind of stuff easily ?
>>
>>52397605
http://docs.unity3d.com/ScriptReference/index.html
>>
>>52397579
What is the HTML of #shortcut?
>>
Is there a dynamic way to create an object with N parameters in java?

I have this situation where i must create an object to supply the values for a query. The query is dynamic and the amount of parameters varies.
Let's say i have
 SELECT * FROM table WHERE field = ? AND field2 = ? AND field3 = ?

This is created in a way that field 2 and 3 might not exist, and so the object i create cannot have them at all, not even as null.
So,
queryObject = new Object[]{"field1", "field2", null};
doesn't work when i don't have the field 3 parameter, because null is still accepted as an input, and the query fails.

How would you guys go about it? My solution is bothering me to the bone.

if(dataInicial != null && !dataInicial.toString().equals("") && dataFinal != null
&& !dataFinal.toString().equals("") && almoxarifadoId != null && !almoxarifadoId.equals("")
&& tipoMovimento != null && !tipoMovimento.equals(""))
queryObject = new Object[]{new Integer(999009), dataInicial, dataFinal, almoxarifadoId, tipoMovimento};
else if(dataInicial != null && !dataInicial.toString().equals("") && dataFinal != null
&& !dataFinal.toString().equals("") && almoxarifadoId != null && !almoxarifadoId.equals("")
&& (tipoMovimento == null || tipoMovimento.equals("")))
queryObject = new Object[]{new Integer(999009), dataInicial, dataFinal, almoxarifadoId};
else if(dataInicial != null && !dataInicial.toString().equals("") && dataFinal != null
&& !dataFinal.toString().equals("") && (almoxarifadoId == null || almoxarifadoId.equals(""))
&& (tipoMovimento == null || tipoMovimento.equals("")))
queryObject = new Object[]{new Integer(999009), dataInicial, dataFinal};

On and on for 9 else-if blocks.
>>
>>52397594
Stuff like that is relatively easy to understand, if you change a method over to static you can no longer access non-static variables and shit, so you can grasp the function of something relatively quickly when it makes a difference that you can see immediately.

Trying to piece together what all the different syntax means from a code snippet online is quite a challenge when you have no frame of reference for what those words mean generally.
>>
why do all these "top" companies ask for assessments? how exactly do they help?
>>
>>52397435
>What music are you listening to while you work /dpt/?
new retro
https://www.youtube.com/watch?v=8iNczzhZmbc
>>
>>52397579
Just check if $.shortcut_dropdown is defined before running your code.

if($.shortcut_dropdown != undefined) {

}


I don't get why it would be undefined in IE if it's defined correctly in your HTML.
>>
>>52397320
Anyone?
>>
wew
>>
File: 1442672041750.png (159 KB, 1920x971) Image search: [iqdb] [SauceNao] [Google]
1442672041750.png
159 KB, 1920x971
>>52397861
Needs more variables.
>>
>>52397641

      <div id="shortcut">
<ul>
<li>
<a ui-sref="dashboard.inbox" class="jarvismetro-tile big-cubes bg-color-blue">
<span class="iconbox">
<i class="fa fa-envelope fa-4x"></i>
<span>
Mail <span class="label pull-right bg-color-darken">14</span>
</span>
</span>
</a>
</li>
<li>
<a href="#calendar.html" class="jarvismetro-tile big-cubes bg-color-orangeDark"> <span class="iconbox"> <i class="fa fa-calendar fa-4x"></i> <span>Calendar</span> </span> </a>
</li>
<li>
<a href="#gmap-xml.html" class="jarvismetro-tile big-cubes bg-color-purple"> <span class="iconbox"> <i class="fa fa-map-marker fa-4x"></i> <span>Maps</span> </span> </a>
</li>
<li>
<a href="#invoice.html" class="jarvismetro-tile big-cubes bg-color-blueDark"> <span class="iconbox"> <i class="fa fa-book fa-4x"></i> <span>Invoice <span class="label pull-right bg-color-darken">99</span></span> </span> </a>
</li>
<li>
<a href="#gallery.html" class="jarvismetro-tile big-cubes bg-color-greenLight"> <span class="iconbox"> <i class="fa fa-picture-o fa-4x"></i> <span>Gallery </span> </span> </a>
</li>
<li>
<a href="javascript:void(0);" class="jarvismetro-tile big-cubes selected bg-color-pinkDark"> <span class="iconbox"> <i class="fa fa-user fa-4x"></i> <span>My Profile </span> </span> </a>
</li>
</ul>
</div>
>>
>>52397895
Why not just use an array?
What game is that?
>>
File: 1450206408395.gif (1 MB, 430x342) Image search: [iqdb] [SauceNao] [Google]
1450206408395.gif
1 MB, 430x342
>>52393256
You shut your fucking whore mouth, Ebina-chan is pure and the best girl.
>>
File: umaru9.jpg (651 KB, 1406x925) Image search: [iqdb] [SauceNao] [Google]
umaru9.jpg
651 KB, 1406x925
>>52397933
>>
>>52397895
>>52397861
truly, this is the power of C++
>>
>>52397999

But the first one is C.
>>
>>52397999
It's C
>>
File: 1447512453613.png (9 KB, 500x500) Image search: [iqdb] [SauceNao] [Google]
1447512453613.png
9 KB, 500x500
What does merge do in Git? Does it just add all the commits from your branch to the master?
>>
>>52396926
OpenGL extensions are for very specific things and often get added to later versions of OpenGL
For 2D you don't need to concern yourself with them
>>
>>52397655
anybody? bitte
>>
>>52398080

yea i think so
>>
>>52398100
>anybody? bitte
Erw├Ąge eine Nicht-Meme Sprache zu lernen
>>
>>52397655
put that shit into assertions and catch the assertion error

and before posting anything that disgusting ever again format it on separate lines for each condition

revolting
>>
>>52398080
Merges can happen between any branches, and it applies the changes from one branch to another. Usually people merge stuff onto master, though.

Most commits have a single parent (the commit that came before it), but "merge commits" are special in that they have multiple parents.

Sometimes both branches make changes to the same spot in the same file, so git can't merge it automatically using its algorithms. In that case, it's called a "merge conflict" and you generally have to manually resolve it (but usually it's easy once you get the hang of it).

Hope this helps, anon.
>>
>>52398023
>>52398021
oh I thought they were the same person for some reason
never mind
>>
>>52392510
Maybe compared to something like Coq or Idris, but it has a better type system than 90% of languages out there
>>
>>52398154
The error happens when the query is being executed on postgres, i can't catch it because it's not an error per se.
>>
>>52398212
>assertion error
Oh. Sorry, i'll try that.
>>
>>52398134
Dieses
>>
>>52397655
Yes, if you pass a fucking list/array/whatever to the object. Surprisingly, those allow a dynamic number of entries.
>>
>>52397612
>Unity
>>>/vg/agdg
>>>/3/
>>>/v/
>>
>>52397861
Post ~/misaki/butt.png please.
>>
>>52398461
Fuck off, retard.

Plenty of people use Unity for simple applications unrelated to gaming for it's cross-platform capabilities combined with easy GUI design.
>>
I have a list of unsorted integers with repetitions. How can I make this into a list of integers with no repeat? I'm using C#. I know there are many ways to do this, but I want to know the fastest way because my program is computation intensive.

example:
13 13 5 13 5 3 2 1 2 8 1

output:
1 2 3 5 8 13
>>
>>52398559
Put 'em in a set.
>>
>>52398559
Do it with all the ways you know, measure execution time, post here
>>
How to decompose a float:
let exponent x =
let rec div accu x =
if x >= 2. then
div (succ accu) (x /. 2.)
else
accu, x in
let rec mult accu x =
if x < 1. then
mult (succ accu) (2. *. x)
else
-accu, x in
if x >= 2. then
div 0 x
else if x < 1. then
mult 0 x
else
0, x
;;

let mantisse x =
let rec loop accu x =
if x = 0. then
List.rev accu
else
let accu, x =
if x >= 1. then
1 :: accu, x -. 1.
else
0 :: accu, x in
loop accu (2. *. x) in
loop [] x
;;

let split x =
let exp, x = exponent x in
let mantisse = mantisse x in
mantisse, exp
;;
>>
>>52398559
For small list like that brute force should be fastest
Otherwise maybe HashSet
>>
>>52398461
What experience in the field qualifies you to make these assertions?

I mean, I don't like Unity, but I can't deny that plenty of people use it for valid reasons. I know a bunch of script kiddies do too, but that's irrelevant to the former group.
>>
>>52398592
* oh and to sort them QuickSort is usually best
>>
>>52398559
>C#
>computation intensive
Should have written it in C.
>>
hey guys, i have to program in c a 2d matrix where a char moves randomly like this
 A . . . . . . . . . .

B C D . . . . . . .

. F E . . . . . . .

H G . . . . . . . .

I . . . . . . . . .

J . . . . . . . Z .

K . . R S T U V Y .

L M P Q . . . W X .

. N O . . . . . . .

. . . . . . . . . .


where is the wrong part?

    i=1; j=1;
matrice[i][j] = lettere[k];
k++;
while (k<26) {
r = rand() % 4;
if (r==0) {
i++;
if (i<10) {
if (matrice[i][j]=='.') {
libero=1;
}
else {
i--;
r++;
}
}
}
if (r==1) {
j--;
if (j>=0) {
if (matrice[i][j]!='.') {
libero=1;
break;
}
else {
j++;
r++;
}
}
}
if (r==2) {
i--;
if (i>=0) {
if (matrice[i][j]!='.') {
libero=1;
break;
}
else {
i++;
r++;
printf("%d", r);
}
}
}
if (r==3) {
j++;

if (j<9) {
if (matrice[i][j]!='.') {
libero=1;
break;
}
else {
j--;
r=0;
}
}
}
if(libero=1) {
matrice[i][j] = lettere[k];
k++;
libero=0;
}

}
>>
>>52398713
C# can be just as fast as long as you don't need SIMD
>>
Is it worth investing time learning ASP.NET MVC? Seems like the old WebForms blows it out of the water productivity wise.
>>
>>52398774
For the CV, yes. For yourself, no, it's shit.
>>
>>52398774
I got ass cancer last time I delved into MVC, but apparently it's pretty valued in the 'stry.
>>
>>52398807
Shit. I've been seeing more and more people requiring it. I've given it a try, it just seems like I have to jump through a lot of hoops to get the same things done.
>>
>>52398866
Don't forget. To be hire you need to have done things, not to be capable of doing things.
>>
File: ss2.png (97 KB, 1144x860) Image search: [iqdb] [SauceNao] [Google]
ss2.png
97 KB, 1144x860
>>52391746

>>52396882
>>52396882
>>
>>52398894
I'm already experienced in WebForms. It's what we use where I work and I have a few projects under my belt.

The problem as I see is that all that experience is going to be wasted. I could start working using MVC on small projects, but it would be hard getting other devs on board with the idea.

I basically had to force them to learn EntityFramework and Linq in general.
>>
>>52392743
>>52392743
pussies. hold up.
>>
>>52398999
>>52398999
>>52398999
NEW
>>
>>52397207
That has nothing to do with "muh design patterns". Read SICP.
>>
>>52398715
You're going to have to go into more detail if you want help. You are probably going to need some way to backtrack, because it is possible to end up in a corner. Look at the following sequence
A B C
H I D
G F E

after I you won't be able to place J, so you will need to backtrack and try a different sequence.
>>
>>52399950
the program needs to stop in that case
>>
>>52395033
while(1) are often appropriate

it could be for example do something -> check condition -> do something more -> repeat
>>
>>52392676
>>52392528
these
>>
>>52398715
>variable names not in english
Fix this before anything else
>>
Jack and Jill have decided to separate and divide their property equally. Each of their N mansions has a value between 1,000,000 and 40,000,000 dollars. Jack will receive some of the mansions; Jill will receive some of the mansions; the remaining mansions will be sold, and the proceeds split equally.
Neither Jack nor Jill can tolerate the other receiving property with higher total value.
The sum of the values of the mansions Jack receives must be equal to the sum of the values of the mansions Jill receives. So long as the value that each receives is equal, Jack and Jill would like each to receive property of the highest possible value.Given the values of N mansions, compute the value of the mansions that must be sold so that the rest may be divided so as to satisfy Jack and Jill.
Is it possible to code something like this ? is there a specific algoritm for this kind of problem /dpt/ ?
>>
>>52392107
>>52392225
Haskell without laziness is like C without pointers or Smalltalk without objects.
>>
>>52400595
https://en.wikipedia.org/wiki/Fair_cake-cutting
>>
>>52392528
I like the for loops in python and the fact that you have functional style.

I still mainly program in Java/C#
Thread replies: 310
Thread images: 34
Thread DB ID: 404542



[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 / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vip /vp / vr / w / wg / wsg / wsr / x / y] [Search | Home]

[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 / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vip /vp / vr / w / wg / wsg / wsr / x / y] [Search | 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.
This is a 4chan archive - all of the shown content originated from that site. This means that 4Archive shows their content, archived. If you need information for a Poster - contact them.
If a post contains personal/copyrighted/illegal content, then use the post's [Report] link! If a post is not removed within 24h contact me at [email protected] with the post's information.