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

/dpt/ - Daily Programming Thread

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

Thread replies: 351
Thread images: 43

File: 1472709082033.jpg (357KB, 850x1229px) Image search: [Google]
1472709082033.jpg
357KB, 850x1229px
old thread: >>56391453

What are you working on, /g/?
>>
>>56394621
old thread isn't even at bump limit
>>
>>56394655
now it is.

What is the best city in Europe to find a programming job, other than London? I can pretty much relocate to anywhere. I only speak english though...
>>
>>56394832
no city is particularly good try getting a job at some specific company and relocate to wherever they are
>>
>>56394832
Go to India.
Every country in the world outsources IT to India, so you'll have plenty of job opportunities.

As long as your not Indian yourself, your genetically superior dick size will allow you to beat the job competition.

Safe travels, friend
>>
How do I determine the operating system during compile time in C/C++?
>>
File: current year.jpg (28KB, 367x390px) Image search: [Google]
current year.jpg
28KB, 367x390px
http://news.sky.com/story/glitch-causes-items-to-be-sold-on-amazon-for-1p-10378980
>why reinvent the wheel when you can use third party software/libraries/services xD
>She told Sky News: "It's disgusting really because this third party software, that is their business, this should not have happened, this is 2014.
>it's the current year you guys, come on, this should not happen, after all it is The Current Year™ xD
>>
>>56395111
Time it with a stopwatch
An SSD will make you faster
Good luck friendo
>>
>>56395111
>how do i google
macros
>>
>>56395111
Preprocessor
>>
File: Screenshot 2016-09-02 14.03.46.png (146KB, 1920x1080px) Image search: [Google]
Screenshot 2016-09-02 14.03.46.png
146KB, 1920x1080px
I have a script that makes a bunch strangers chat with each other on omegle.

https://greasyfork.org/en/scripts/22858-omegle-group-chat
>>
trump

let's see if that CTR faggot shows up
>>
>>56395522
No one is being paid to shill for Hillary by the way. It's a Republican-funded lie and a pathetic attempt to smear her campaign.
>>
>>56395577
thank you for correcting the record
>>
I'm looking for a good HTML editor to write HTML5. I'm just going to create a simple website to show off an upcoming school project, but if it's fun I'm probably going to add HTML and related stuff to my list.

I use NetBeans for Java and Visual Studio for any other programming languages, but what's my best bet for HTML coding?

I would prefer:
>autocomplete
>syntax highlighting
>possibility for dark theme

I'm on Windows btw. Thanks for any tips and recommendations.
>>
>>56395652
I use WebStorm for Javascript, and I love it. I assume it's just as good for HTML5.
>>
>>56395729
Thanks, I'm gonna check this out. I also hear a lot of good stuff about Sublime Text (2 and 3), Brackets and Atom. Anyone ever tried one of these?
>>
>>56394621
What's with this faggy ass shit?
>>
>>56395959
I tried Sublime Text and it was okay. Nothing special.
I chose Webstorm over it because it has fewer annoying default options and the dark colour scheme and text colours were twice as nice to look at
>>
>>56396034
I see that you get a free trial, and I don't really pay for text editors/IDEs, but thanks for the tip! I'm gonna try Sublime and if that doesn't catch my eye I'll move over to Brackets.
>>
>>56396215
You get a month, but then you just reinstall and get another month.
But fair enough, good luck
>>
>>56396240
Oh, well that makes it more interesting. Do I get to keep settings on every reinstall?
>>
Did anything ever come of that updated ren'py mode for Emacs from awhile back? By tripfag Steve Ballmer
>>
guys with this website i learned formal style touch typing in just 4 hours

http://www.keybr.com/

i'm typing much slower than with my old sloppy style, especially since i'm consciously making sure type "correctly", but i'll get better at it for sure and it's much more ergonomic, almost no hand movement is required. and it seems to have potential to make me type faster although to type super fast i will probably have to allow deviations such as typing Y with my left index finger and B with my right index finger sometimes.
>>
>>56394621
sauce?
>>
>>56394621
I thought hime wasn't gay?
>>
Does anyone have experience with LiquidFun?

I can't find any resources on how to use it with Libgdx and the box2D plugin.

Any help would be great
>>
>>56396933
Alright, I'll try it friend.
>>
>>56397195
have you checked this

http://google.github.io/liquidfun/Programmers-Guide/html/index.html
>>
>>56395111

These are standard macros that MUST be defined on compliant compilers for their respective platforms. And yeah, Apple is a special snowflake that doesn't define __unix__ or __unix for their platform, and therefore you have to check for __APPLE__ and __MACH__.

#if defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))
#define PLATFORM_UNIX
#elif defined(__WIN32)
#define PLATFORM_WINDOWS
#else
#define PLATFORM_OTHER
#endif
>>
>>56394621
You didn't even edit it to make it programming related.
>>
>>56397652
You do it
>>
think i enjoy programming more without code-competition, lads.
>>
>>56397927
code prediction, completion and autofill is cancer and i hate it
>>
>>56397927
>>56397965
wow, yeah completion*
>>
>>56397988
well now i just feel silly
>>
>>56397988
>>56398419
or maybe i don't
i can't tell who's correcting who
>>
what does /dpt/ think of Andrei Alexandrescu?
Been watching some of his talks and he's pretty entertaining and not a complete autist like most.
>>
Back again with some c hw help.

I need to test a sudoku solution is correct and find possible solutions for an incomplete sudoku puzzle.

Prof doesn't want us to use recursion or backtracking not that i understand it anyway.

Heres my code to test a solution
int test(int i, int j, char s[][9]){
int k,l,row,col;
//compare rows and columns
//if any value is equal to another then return false
for(k=0; k<9; k++){
if(s[i][k]==s[i][j] && j != k) return 0; //false
if(s[k][j]==s[i][j] && i != k) return 0; //false
}
//find 3x3 starting point
row =(i / 3) * 3;
col = (j / 3) * 3;
//loop through 3x3 grid
for(k=row; k<col+3; k++){
for(l=row; l<row +3; l++){
if(s[k][l] == s[i][j] && !(i == k && j == l)) return 0; //false
}

}
//no repeats, passes check(true)
return 1;

}


Works good. Problem is coming up with possible solutions.

he said declare an array int count[10] all set to zeros; and each time increment count and print out k wherever count[k] = 0.

only help he gave was
 
for(k=0; k<9; k++)
count[s[i][k]++; //for rows


Anybody can help?
>>
hi, if I make my char signed, then I can match against EOF, right?
>>
File: shit nigger what are you doing.jpg (19KB, 366x380px) Image search: [Google]
shit nigger what are you doing.jpg
19KB, 366x380px
>A floating-point number more or less corresponds to what mathematicians call a real number.
>Real numbers include the numbers between the integers.

t. c primer plus, 6th edition
>>
>>56399534
yikes
>>
>>56399534
I guess this is why this book gets such shit reviews.
>>
File: 1437866137883.jpg (49KB, 707x675px) Image search: [Google]
1437866137883.jpg
49KB, 707x675px
>>56399534
Floating points are used to represent reals and all the numbers within the bounds of two integers are real numbers.
>>
>>56399705
correct, but its much better to say that they're rational numbers
>>
>>56399534
They're close to representing most cases of them, it rolls off the tongue unlike rationals.

>>56399705
though numbers within the bounds of two integers are a subset of the reals, that's not what defines a real number. Irrationals and rationals also lie between integers.
>>
>>56399747
Yes, but the book said "include" and not "are"
>>
char == singed short short?
>>
File: still statue.gif (2MB, 2592x1936px) Image search: [Google]
still statue.gif
2MB, 2592x1936px
Which is/are the best source/s to learn C#? Possibly something that lets me make a program/game while learning so I know exactly what I'm doing.
>>
>>56399129
git commit sudoku
>>
guys, my long size is 64 bits
I can't imagine how big a long long would bit
is it 128-bits?
>>
>>56400063
Visual C# Step by Step by Jon Sharp.
>>
>>56400255
platform dependent, use some specific type if you need 128 bits
>>
>>56400255
The integer types don't have to be distinct. On 64-bit Windows, int is 32-bits and long is 32-bits. On 64-bit Linux, long is 64-bits and long long is 64-bits.
>>
>>56400008
char can be signed or unsigned in C and C++. It's implementation dependent. The size is implementation dependent too (though it's almost always 8-bits.) A good program won't make any assumptions about the char type, since this can cause subtle bugs. It's generally good practice to cast your chars to something else before doing anything with them.
>>
Why aren't you using Norsk#, Norwegian on .NET?
>>
File: DSC04630-600.jpg (3MB, 3264x2448px) Image search: [Google]
DSC04630-600.jpg
3MB, 3264x2448px
>>56400329
>8-bits
char should be 9 bits, use a real architecture
>>
>>56400276
Thanks, gonna go read it.
>>
>>56400360
because of the new charset in c11?
>>
My first CS class is using java. Im planning on remaking all the assignments and examples in parallel with another language just for the experience, which should i use?
>>
>>56400427
CuteSharp.
>>
>>56400427
haskell
teaches you to think about manipulating data without mutation
its also pretty straightforward and has very nice concepts you can port over to java (i.e. monads)
>>
>>56400446
haskell is dogshit stop this meme
>>
>>56400140
I very commonly use break. I don't know what your prof is going on about it's utility is amazing and it doesn't really spaghettify your code. On the contrary, trying your best not to use break usually makes your code really obscure.
>>
>>56400454
Name something better.
>>
>>56399009
Andrei's a real cool guy
>>
>>56400454
datafag detected
>>
File: um6ijro.jpg (381KB, 1800x1248px)
um6ijro.jpg
381KB, 1800x1248px
Im trying to make a decision on whether or not I want to invest time in learning Python as a first language. I've learned everything in the tutorial on the Python website. I know I should probably just start working on a project, but I feel like I would be better off investing a year or two of my time into a better language to learn concepts from.

I keep getting this feeling that I should learn C. Maybe Java even, but all that boilerplate doesn't look like much fun to deal with.
>>
>>56395130
>use a service to automatically undercut competition
>being surprised when 2 of them collide and bring each other down to the minimum price in seconds
why would someone use such a thing?
>>
>>56400329
the size is always 1 byte but a byte can have 8 bits or more
>>
>>56400454
this

>>56400468
it's usually not needed, if you're using it often you might be writing very shitty code
>>
>>56400526
Just do SOMETHING rather than shit posting so much on this godawful thread
>>
What's the best resource for learning Assembly?
>>
>>56400526
you'll waste your time no matter the language because you're too stupid anyway
>>
>>56400580
>so much
>post maybe once or twice a day
>majority of posts are questions related to learning
>>
>>56400651
Alright well I guess I'll just fuck off from this shitty thread. You faggots can go jerk off to your animus and muh Haskell
>>
>>56400656
>>56400665
python and haskell are trash, C is kinda trashy but not full retard trash, learn java but you fell for the java is bad meme so just give up
>>
>>56400677
>you fell for the java is bad meme
I get it now, you're just a retarded autist.

I said as an absolute beginner, writing boilerplate doesn't seem like fun. That's literally all I said about Java. Take your fuckin' meds.
>>
>>56400454
>yet to see a constructive criticism against Haskell
>>
>>56400691
""""boilerplate"""" is good, explicit is better than implicit

https://docs.oracle.com/javase/tutorial/
>>
>>56400738
I never said boilerplate code was bad. I said it didn't seem like something enjoyable to deal with. You seem like a fucking retard so I'm just gonna go look for advice somewhere else.
>>
>>56400806
>>>/reddit/
>>
>>56400738
t. pajeet
>>
>>56400901
t. shart in mart
>>
Can I make this better?
    function S_to_A (S: String) return Integer with Inline=>True is
pragma Unsuppress(Range_Check);
subtype Digit is Integer range 0..9;
subtype Modifier_Range is Integer range -1..1;
Int : Integer := 0;
Temp : Digit;
Pos_Neg : Modifier_Range := 1;
I : Integer := S'First;
begin
while I <= S'Last loop
case S(I) is
when ' ' => exit when Int /= 0;
when '-' =>
Pos_Neg := Pos_Neg - 2;
I := I + 1;
Temp := Character'Pos(S(I)) - 48;
Int := Temp + Int * 10 ;
when others =>
Temp := Character'Pos(S(I)) - 48;
Int := Temp + Int * 10 ;
end case;
I := I + 1;
end loop;

return Int * Pos_Neg;

exception
when Constraint_Error => raise Constraint_Error with "bad input for S_to_A";
end S_to_A;
>>
Anyone recommend any web tutorials/books for object-c programming ?
>>
>>56400995
objective-c* as you can see I am a scrub.
>>
>>56400995
Shits deprecated more or less
>>
>>56401228
My main goal is to develop apps, but initially I want to lean OOP through objective-c.
>>
>>56401334
>I want to lean OOP through objective-c.
>through objective-c.
why.jpg
>>
>>56400677
Wait, if all of those are trash, what's good? Rust? OCaml?
>>
Bls respond. >>56400647
>>
File: 2016-09-03_03-16-05.webm (148KB, 478x334px) Image search: [Google]
2016-09-03_03-16-05.webm
148KB, 478x334px
Anyone used jquery tree view?
https://www.abeautifulsite.net/jquery-file-tree

I'm trying to implement it on my website but it's doing some stupid shit i can't get around, im using C#.

webm related
>>
Does anyone happen to have the screenshot that explains pointers using a dragon dildo analogy?
>>
>>56401366
I don't know.
>>
>try to use Eclipse with cygwin
>doesn't work

>try to use it with MingW
>doesn't work

>try to use it with vs compiler
>doesn't work

What do? I have my path set and stuff but it doesn't want to work. I don't want to go back to visual studio because it runs too bad, and I can't write make files so I need an IDE (with a dark theme and colourful syntax highlighting).
>>
>>56401447
>>56401389
learn glorious java my niggas

https://docs.oracle.com/javase/tutorial/
>>
>>56401486
You're going to get a lot of angry posts from people who only used Java back when it was actually shit, just as a heads-up.
>>
>>56400656
>questions related to learning
Are you the one asking "should I learn python?" LITERALLY EVERY THREAD
Or is there just a constant stream of new posters who are unsure of what language to learn and haven't read any of the hundreds of previous threads with identical discussions
>>
>>56401520
Not much has changed.
>>
>>56401520
>>56401486
Can java be used to develop Apps ?
>>
>>56401559
it absolutely can especially for android all the main android APIs are natively in java
>>
File: java.png (20KB, 577x292px) Image search: [Google]
java.png
20KB, 577x292px
>>56401486
ShitpostVisitorFactoryBuilder<ShitpostReplyEvent> shitpostVisitorFactoryBuilder = new ShitpostVisitorFactoryBuilder<ShitpostReplyEvent>(new ShitpostReplyEvent("(You)"));
shitpostVisitorFactoryBuilder.setShitpostContents(":^)");
ShitpostVisitorFactoryBuildDirector<ShitpostReplyEvent> shitpostVisitorFactoryBuildDirector = new ShitpostVisitorFactoryBuildDirector(shitpostVisitorFactoryBuilder);
shitpostVisitorFactoryBuildDirector.construct().sendShitpost(Shitpost.postIO.out);
>>
File: haskelel.jpg (99KB, 529x598px) Image search: [Google]
haskelel.jpg
99KB, 529x598px
>>56401621
>>
>>56400981
So safe
>>
>>56401621
Sorry, does not compile.
Main.java:13: error: cannot find symbol
ShitpostVisitorFactoryBuilder<ShitpostReplyEvent> shitpostVisitorFactoryBuilder = new ShitpostVisitorFactoryBuilder<ShitpostReplyEvent>(new ShitpostReplyEvent("(You)"));
^
symbol: class ShitpostVisitorFactoryBuilder
location: class ShitpostProduce
Main.java:13: error: cannot find symbol
ShitpostVisitorFactoryBuilder<ShitpostReplyEvent> shitpostVisitorFactoryBuilder = new ShitpostVisitorFactoryBuilder<ShitpostReplyEvent>(new ShitpostReplyEvent("(You)"));
^
symbol: class ShitpostReplyEvent
location: class ShitpostProduce
Main.java:13: error: cannot find symbol
ShitpostVisitorFactoryBuilder<ShitpostReplyEvent> shitpostVisitorFactoryBuilder = new ShitpostVisitorFactoryBuilder<ShitpostReplyEvent>(new ShitpostReplyEvent("(You)"));
^
symbol: class ShitpostVisitorFactoryBuilder
location: class ShitpostProduce
Main.java:13: error: cannot find symbol
ShitpostVisitorFactoryBuilder<ShitpostReplyEvent> shitpostVisitorFactoryBuilder = new ShitpostVisitorFactoryBuilder<ShitpostReplyEvent>(new ShitpostReplyEvent("(You)"));
^
symbol: class ShitpostReplyEvent
location: class ShitpostProduce
Main.java:13: error: cannot find symbol
ShitpostVisitorFactoryBuilder<ShitpostReplyEvent> shitpostVisitorFactoryBuilder = new ShitpostVisitorFactoryBuilder<ShitpostReplyEvent>(new ShitpostReplyEvent("(You)"));
^
symbol: class ShitpostReplyEvent
location: class ShitpostProduce


9 error in total, is going above character limit
>>
>>56401543
I've asked a few times over the span of a month because I keep feeling like its a shitty language to learn. I excepted that different people would answer at different times, and I'd extrapolate from different adivce. I guess if everyone in this thread is an autist like you who sits in every goddamn thread all day everyday, I'm not going to get different answers or any meaningful advice to consider. If it really triggers your autism that fucking much, I'll ask it every day for you.
>>
>>56401621
It's always 'really made me think' but seriously

Why the fuck is all the coffee here in Australia Arabica when the island of Javs is pretty much on our doorstep an delicious Robusta is right there.
Instead we get shitty imported african Arabica.

Conversely US won't shut up about 'java' (ie tasty, tasty Robusta) even though Java is half the fucking world away and surely south american beans (whatever they plant) would be cheaper...
>>
>>56401673
*expected. I should add I keep feeling like its a shitty language to learn, as I learn it. I clearly have to be very specific because otherwise your retarded autist brain will go into another fit.
>>
>>56401673
>I've asked a few times over the span of a month
goddamnit man what are you doing with your life

no, don't learn python, it's one of the worst languages, it's especially bad for learning
>>
>>56401692
> I know better than Peter Norvig.
Sure thing buddy. Now go back to your tiny dark hole.
>>
What do you guys think about Ada and SPARK?
>>
>>56397163
>dresses up like a cock slut
>isn't gay
>>
>>56401711
meme
>>
>>56401706
>being a fanboy of some literally who
kys
>>
>>56397163
>>56401720
She's whatever you want him to be
>>
>>56401727
how
>>
File: ritchie meme.png (573KB, 587x551px) Image search: [Google]
ritchie meme.png
573KB, 587x551px
>>56401744
>>
>>56401447
Learn OOP through smalltalk if you want to be obscure and hipster.

>>56401744
/g/ is a meme therefore everything mentioned on it is a meme
>>
Serious question. I am planning on changing my career. I am a former mechanical engineer student. I didn't do so well at college because I had no drive, or I simply didn't care about it. I started programming a few months back, and I have found that this is what I want to do for a living. So, my question is: CE, or CS. I have read that both were "memes", and I am probably a retard for asking this question here, but I legit wanna know which career will open more paths into my future. CS seems to be the most obvious one because it deals more directly with software, but I am still debating on which. Thanks in advance.
>>
>>56401803
I don't have an answer for you, but I'm going into CE as a dude who's really into programming and shit. I'll let you know in 4 years if it works out.
>>
>>56401692
>what are you doing with our life
I don't know man. I'm 19 years old and I'm schizophrenic. I sit around at home all day doing nothing. I like computers, and figured I should find some hobby that's worthwhile, but I don't want to waste my time learning a meme language. Half the people I've asked have said its shit, and the other half have said its the best language for a beginner. I keep getting hung up on the idea of wasting all this time learning something with little reward.

I don't want to end up like Terry Davis, man.
>>
>>56401837
Aight mate, I will be here waiting.
>>
>>56401432
Implement your own goddam tree. It's just a simple view that can have instances of itself as child views.
>>56401484
Eclipse is garbage. Try NetBeans, one of JetBrains' IDEs or VS Code.
>>
>>56401886
python = hobby language.
c++; java; C#; VB = work language.
The rest are meme languages used to meme.
>>
File: 1462199377752.jpg (114KB, 640x640px)
1462199377752.jpg
114KB, 640x640px
>>56401903
>C#
>VB
>>
>>56401886
something like this: >>56401903

pick one of the top 4 languages and learn that instead of filthy python

http://www.tiobe.com/tiobe-index/
>>
>>56401706
peter norvig is the poor man's [spoiler]noam chomsky[/spoiler]
>>
>>56401903
>python = meme language.
>c/c++ = work language.
>java; C#; VB = Memeterprise™ language.
>The rest are meme languages used to meme.
FTFY
>>
>>56401366
I don't hate Objective C. Sometimes I think of what features I would like added to C and I accidentally reinvent Obj-C. Things like a first-class closure type, a counted string type, simple interface based object orienting, automatic reference counting and syntatic sugar for properties would be nice to have in C and would make it more powerful without turning it into an overcomplicated mess like C++. It's also nice that Obj-C is a strict superset of C, so you can use C99 features that are not available in C++ like designated initializers. That alone makes it better than C++.

The only problems with Objective C are the message sending syntax, which is awfully verbose, and the fact that there is no real Objective C programming environment you can use on non-Apple devices (GNUstep doesn't count because no one uses it.)
>>
Can you sort a list in O(n) time?
>>
>>56399009
he saved C++ but attempting to read Modern C++ Design may cost you a sanity point
>>
>>56401891
Woah I had no idea VS Code existed. It looks pretty great
>>
>>56402021
yes
>>
>>56402021
not in general. O(nlog(n)) is tight for general sorting

if your elements are from a constant universe then you can do better with radix sort O(kn), though since k = log(n) the difference is more subtle

in real sorts data bandwidth is a huge concern which makes quicksort very strong even though it's O(n^2). and for sufficiently large sorts parallelism is important
>>
>>56401711
Looks alright >>56400981
>>
>>56402021
List<Integer> sort( List<Integer> list) {
List<Integer> res = new ArrayList<> ();
Timer timer = new Timer();
for ( T item:list ) {
timer.schedule(new TimerTask() {
public void run() {
res.add(item);
}
}, item * 100);
}
timer.purge(); // xXx
return res;
}
>>
Hello, i am making a c++ project on a subject to learn more about that subject, having an utility that i will use in the future and start piling up my github with projects to help with my CV, wich C++ version should i stick to? 11?14?17?

Thanks.
>>
>>56402202
The latests stable spec.
>>
>>56402279
Wich is?
>>
>>56402021
Only if it's already sorted.
>>
>>56402202
>>56402279
This, so C++14. C++14 is a refinement of C++11 with a bunch of useful features like relaxed constexpr rules, std::make_unique and standard library string literals. There's no reason to restrict yourself to older standards if it's just a personal project. Also, if you intend to put it on your CV and the person hiring you has C++ expertise, they'll probably appreciate that you are keeping up with modern C++.

C++17 might be a problem, since it's not complete yet and it might change before it's completed, but it would probably be fine to use some of it's more conservative new features like std::as_const if your compiler supports them. Also, you should obviously avoid using things that are in C++11 or C++14, but are deprecated or removed in C++17.
>>
>>56402072
Quicksort is O(n log n) in the average case and only O(n^2) with bad data. The O(n^2) worst case is considered a problem and various efforts are made to pick good pivots so that it's rare.
>>
>>56402122
That's O(m) time where m is the greatest element in the list.

I think on a processor with n indepedently executing cores you could sort a list in O(n)
>>
>tfw actually pretty knowledgeable about sorting algorithms

I bet you plebs have never even heard of Timsort.
>>
>>56402371
Allright, going for c++ 14. TY
>>
>>56402376
in most conventions big-O implies worst case

at any rate my point is that the the real performance of sort is dominated by more practical concerns than worst-case linear-time complexity. small sorts are faster with quicksort because of data bandwidth and large sorts are faster with mergesort because of parallelism, with radix sort conditionally outperforming both in some cases
>>
>>56402404
spaghetti sort is O(1), what else could you possibly need
>>
>>56402404
who #shellsort here?
>>
>>56402530
>not sleepsort
>>
>>56402546
>not jewsort
>>
>>56402579
Is that where you force a wageslave to do the sort manually whilst wasting shekels
>>
>>56402606
must be the one where you copyright the work of another goy and make other goys pay to use it
>>
Trying to do project euler, but I'm only on the second question and I'm fucked. I can't for the life of me see where I'm going wrong - the fast method using binet's formula comes up with a slightly different answer, I can only assume due to floating point inaccuracies. The brute force method though, I've not a single fucking clue why it doesn't just werk.

const LIMIT: u64 = 4000000000;

fn main() {
fast();
brute_force();
}

fn brute_force() {
let mut current_fibs: (u64, u64) = (0, 1);
let mut sum: u64 = 0;

while current_fibs.1 <= LIMIT {
if (current_fibs.1 % 2) == 0 {
sum += current_fibs.1;
}

let next_fib: u64 = current_fibs.0 + current_fibs.1;
current_fibs.0 = current_fibs.1;
current_fibs.1 = next_fib;
}

println!("BF: The sum of even fibonacci numbers not exceeding 4000000000 is: {}", sum);
}

fn fast() {
let mut i = 0;
let mut current_fib: u64 = 0;
let mut sum: u64 = 0;

while current_fib <= LIMIT {
sum += current_fib;

i += 3;
current_fib = fib(i);
}

println!("F: The sum of even fibonacci numbers not exceeding 4000000000 is: {}", sum);
}

// wrong for v large numbers
fn fib(n: i32) -> u64 {
let phi: f64 = (1.0 + f64::sqrt(5.0)) / 2.0;
let phi_hat: f64 = -1.0 / phi;
// 1/sqrt(5) * (Phi^n - phi^n)
let fibf = (1.0 / f64::sqrt(5.0)) * (f64::powi(phi, n) - f64::powi(phi_hat, n));
// Should get rounded towards zero in the explicit cast
fibf as u64
}
>>
>>56394621
a
>>
>>56402668
Ok I needed to call round at the end of binet's as the cast rounds down. So they both come out with the same answer now. Still the wrong one though. fug.
>>
>>56402668
>Rust
Found the problem senpai
>>
>>56402691
I- I just want to learn a meme language.
>>
>>56402694
Haskell
>>
>>56400647>>56401396
Programming experience and the documentation of the chip/instruction set you're working on.
>>
>>56402668
The limit is 4 million not 4 billion, just kill me now.
>>
>>56395577
Wtf i'm a #sHillForHer now
>>
File: 1354564040202.gif (2MB, 350x156px) Image search: [Google]
1354564040202.gif
2MB, 350x156px
>>56394621
>that manga
fucking traps man
>>
>>56394621
I'm working on a set of basic shellscripts that sets up some basic types of projects.
Basic servlets, talk-to-rdbms-projects etc.

And basically, I need to create some simple files.

So far I've got this:
http://pastebin.com/e67BZFUS

Now this isn't too bad, since Emacs does most of the work of dealing with the files.
(insert into an empty buffer, do some simple functions and you get it properly escaped etc.)

However, is there a better way to do this? I don't want to have any external files, since that only leads to "interesting" edge cases popping up.

Assume that it runs on a VM running Ubuntu 16.04 if you want to use specific stuff.
>>
File: 1463226135247.jpg (1MB, 2560x1600px) Image search: [Google]
1463226135247.jpg
1MB, 2560x1600px
how can I code a function that will generate a matrix of n*n and fill it in randomly, where every row and column sum up to 1?
>>
>>56395959
Sublime Text is okay.
But it's not as good as Emacs (or Vim for that matter.)

Those two editors are the gold standards for editors for a reason. They have been around for half a century already, and show now signs of going away. If you want the best tools available, learning Emacs is a great choice, because it will be there for everything.

It has fully fledged IDEs for several languages now, and really good editing modes for the others.
>>
>>56402870

By using doubles?

Google magic squares, steal the algorithms from there, and have fun.
>>
>>56402376
> bad data
It's... when the data is already sorted matey.

It's a good sort, but it's not that much faster than say, heapsort. And heapsort is pretty easy to implement. To the point where if I was asked to implement a sorting algorithm, I'd do it every time, just because it's easy to get right. Quicksort is good, but it's not great.

optimized mergesorts like timsort are also pretty good.
>>
C++, doing vector and matrix calculations, how would one go and vectorize it? I am aware that there are libraries etc, but i want to know how you actually vectorize in c++.
>>
>>56402859
What edge cases are you seeing with external files?
You can make multiple line strings in bash; it will somehow clean your code.
>>
>>56402072
For comparison sorts.

Radix sort is pretty close to O(n), although it's really O(n log m), where m is the max value in the array.
>>
>>56402942
So far with just copying existing files?
Links kill me, sometimes people put things on NFS-shares, or mount SSHFS and hope that things work, etc.

There are just so many weird and shitty things that happen that I don't want more than one file.

Even if I *did* fix all the bugs, and made it bulletproof, it would be so ugly that the obvious and stupid approach would still be better.
>>
>>56402967
People running bash-scripts over ssh are in fact, my number 1 reason for just embedding the files in the file.
>>
>can't write a for loop in python like you do in C

why
it's such a pretty way to make a loop
>>
>>56403116
Because Python is shit.
>>
>>56399534
IEEE 754 was a mistake
>>
currently working on parli.eu, ironing out some annoying bugs currently. Really need to leave php.
>>
File: hexadecimal.png (10KB, 700x118px) Image search: [Google]
hexadecimal.png
10KB, 700x118px
1024 is a hexadecimal number but what is
1023?
>>
Is there any point in learning Python 2? I want to start with 2 because better library support, but how difficult would it be to adjust to and learn 3 later?
>>
>>56403461
Learn Python 3 instead. Most important libraries have been ported.
>>
>>56403417
a positive signed hexadecimal number :^)
>>
Thread seems dead-ish.

>>56403417

1024 can be represented as hexadecimal 0x400
1023 can be represented as hexadecimal 0x3FF
>>
File: watamote fan.gif (574KB, 400x240px) Image search: [Google]
watamote fan.gif
574KB, 400x240px
>Looking for a library at npmjs.com
>lib-name, name-lib, name-lib-next, lib-name-middleware
Sometimes JS ecosystem makes me cringe.
>>
>>56403768
What language would tomoko like the most?
>>
>>56403116
You can, but it's a different syntax.
It's also not exactly the best way of looping, is it?

If you want to iterate over a sequence, why are you dragging indexes into it?

>>> for i in range(1, 10):
... print(i)


But there's the old loop, vs the same loop in C:
for(int i = 1; i < 10; ++i) {
printf(i);
}


It's not that different.
I mean, here's both ways in Python:

>>> list = ['Pop', 'Pop', 'Pop', 'watching', 'niggers', 'drop']
>>> for word in list:
... print(word)
...
Pop
Pop
Pop
watching
niggers
drop
>>> for i in range(0, len(list)):
... print(list[i])
...
Pop
Pop
Pop
watching
niggers
drop
>>>


Both are possible, but the first one is much clearer.
>>
>>56403817
Ruby, since it's Japanese.
>>
>>56395959
Sublime text 3 is great (unlimited trial)
Atom is really good too, IMO it looks better.
I've heard good things about brackets
>>
>>56403872
>Atom is really good too, IMO it looks better.
Slow. 50ms of latency is definitely noticeable
>>
>>56396368
I haven't worked on it for a while, actually.
I got a basic asset database working, but I didn't really do much more than that.

Life got in the way.
>>
>>56400427
DESU, I wouldn't do that, because you're bound to hit some Java-specific things.

For example, if you're using Python, you'll have to remember the differences between Java's lists and arrays AND Python's lists.

And the different ways to loop.

I would much rather suggest you stick to one language, and instead try to program more things in Java to help you understand the underlying principles more.

Your second programming language could easily be something more academic like Prolog, Haskell, Common Lisp or similar, because they will force you to reconsider everything you knew about the things you learned. And you'll then know that it doesn't have to be like in your first language.

I think it's good that you want to learn and expand your mind, but your first CS class is not the time for that.
>>
I'm trying to learn some ruby, I know the basics and get around them easily but the moment I tried to dive into RoR I got lost completely. Is there any easier framework to start with before using Rails?
>>
>>56403908
I do definitely not have 50ms with Atom
>>
File: 1472160066834.jpg (67KB, 600x600px) Image search: [Google]
1472160066834.jpg
67KB, 600x600px
>>56394621
What's the best way to analyze the date and month for holidays?

Say its Dec 25
I want it to return "Christmas"

I'm thinking maybe switch case?

static void midnight_events(int date, int month) {
// if (date == 25 && month == 12) {
message("It's Christmas");
//}
}
>>
>>56404066

Sinatra. A minimal server looks like this:

require 'sinatra'

get '/' do
"<!DOCTYPE HTML><html><body><p>Hello World</p></body></html>"
end


You define routes, and associate them with an action. So if a GET request is sent on the / path, the block is evaluated, and the return value is sent to the end user. Obviously, you won't be writing HTML within your Ruby scripts in most cases (you should instead use erb templates to write Ruby inside your HTML), but it's an example to show you trivial the framework is.

You may be asking now, "does it scale?" No. And neither does Rails. Get off my lawn, web-dev.
>>
File: whelp.jpg (121KB, 861x434px) Image search: [Google]
whelp.jpg
121KB, 861x434px
 for (int chan = 1; chan < 101; row++)
{
if (chan % 15 == 0)
Console.Write("Fizzbuzz");
else if (chan % 3 == 0)
Console.WriteLine("Fizz");
else if (chan % 5 == 0)
Console.WriteLine("Buzz");
else
Console.WriteLine(chan);


Rate my masterpiece. also, pic related looks hard as fuck... any ideas?
>>
File: meme fizzbuzz 2.png (24KB, 514x323px) Image search: [Google]
meme fizzbuzz 2.png
24KB, 514x323px
>>56404398
>masterpiece
>>
Go is tempting but I can't get over static linking.

With dynamic linking, libraries like libc or libcurl are only loaded into memory once for the whole system.

With static linking every program contains a redundant copy of all code used.

Then there are the security issues, because you'll have to recompile all your binaries for every small library bugfix.

How do you justify static linking other than with short-term convenience?

>inb4 cat-v
>>
>>56404358
Have a list of instances of some struct/object representing holidays, loop through them and react to any that are a match for the current date.
>>
>>56404383
Well, if it's not for web dev, can you hint me what else I can use Ruby for? I just want to learn Ruby in general and since I've been doing web development for a while I thought it was a good idea.
>>
>>56404398
quick thing i came up with in 2 minutes
pyr = lambda n: "\n".join("".join([" ", "*"][n - l - 1 <= i <= n + l - 1] for i in range(2*n - 1)) for l in range(n))
>>
Hello fellow programmers.
I am trying to figure out a name for my developer identify so I can publish Apps to Google Play.
Anyone got any suggestions on how to create a good "Developer Name"?
>>
>>56404716
>Developer Name
Mr. Eatshit Faggot
>>
>>56404579

I use it as a general scripting language. Anything people normally use Python for, I use Ruby for, because it's more comfy. Otherwise, it's great for implementing domain specific languages because of instance_eval and method_missing shit. And... I guess, something something metasploit.
>>
>>56404804
[spoiler]Sorry but I am not into gay scat.[/spoiler]
>>
I just looked at the program of my friend.
Becoming aware that I do not have the skill he possesses makes me sad.
And I know he is just beginning.
Can someone please post the random project generator?
I wanna improve
>>
>>56395652
Netbeans has compatability to edit HTML, CSS, and Javascipt built in. Just enable it in the plugin section. It provides the list of tags and closures so its fairly easy and quick to use.
>>
>>56404530

>How do you justify static linking other than with short-term convenience?

In some cases, it can make programs more portable. I have found that I can make an ARM program run on my phone and my Raspberry Pi 3 if and only if I use static linking. With dynamic linking, the problem is that they have different link paths altogether because Android doesn't like to play like a real Linux system, even if it is one. With static linking, libc is self-contained in the one binary, and so both operating systems are able to load the program without concern for the underlying filesystem.

On Windows, I generally use static linking as a default though, because no one has MinGW's DLLs installed on their computer, and the combined filesize of the DLL and executable is greater than if I had just static linked.
>>
Another editor to look at is Visual Studio Code. Open source, multi platform, tons of plug-ins, and real pleasant to work with. I ditched Sublime Text for VS Code since ST feels like abandonware by now.
>>
How would I go about building my own Web framework for practice?
Which basic things should I attempt to implement?

Also, in what way should I implement user authentication?
>>
>>56400526
You have two options:
1) Learn a language
2) Think about learning a language

And it looks like you've already chosen!
>>
File: projgen.png (2MB, 3840x2160px) Image search: [Google]
projgen.png
2MB, 3840x2160px
>>56404888
you and me both, buddy. What languages you learning? I'm new, doing C# by going through Whitaker's The C# Player's Guide, chap 14 atm.

Have you done any of these projects before?
>>
Any /g/ents mind giving me constructive feedback on this API documentation? https://parli.eu/api-info.html
>>
I've been doing codecademy's Python thing and it wants me to write a function that returns a reversed string.

This is what i came up with:
def reverse(text):
text = list(text)
rev = []

while len(text) > 0:
for char in text:
rev.append(text[len(text)-1])
text.pop()
return "".join(rev)


print(reverse("It works fine, why isn't it accepted?"))

I added the print() for testing in the terminal.
It runs fine in a terminal and gives the exact output you'd expect, but codecademy keeps telling me there's something wrong.
Have i overlooked something?
>>
>>56394621
What's the best place to go in terms of online learning? Saw a post about Lynda earlier.
>>
>>56405096
>purple on light blue
Otherwise fine.
>>
>>56405089
Java
> Difficulty ratings.
YYYYYYYYYEEEEEEEESSSSS!
Oh YES.
That's what I was talking about. You gents finally added it.
>>
>>56404535
I don't understand clearly but this is what I have so far

typedef struct Holiday{
int date;
int month;
char message[50];
} Holiday;

static Holiday Xmas;
static void initialize_holidays() {
Xmas.date = 25;
Xmas.month = 11;
strcpy(Xmas.message, "Merry Xmas");
}
>>
Why does everything that uses GTK shits out errors in the console nearly constantly?

Does no one know how to program for it or is it really just that bad?
>>
>>56405131
yourString = list(yourString)
length = len(yourString)
for length-- += newString
str(newString)
>>
OpenJDK or Oracle's JDK?
>>
Haskell.

bidiHandler :: Broadcaster -> Connection -> IO ()
bidiHandler bc conn = do
_ <- C.forkIO (broadcastThread bc conn)
-- [ 1 ]
forever $ do
-- [2]
msg <- receiveDataMessage conn
-- [3]
case msg of
Text t -> do
let Just payload = t ^? key "payload"
-- [ 4 ]
case t ^? key "type" . _String of
-- [ 5 ]
Just "echo" -> sendTextData conn (mkPayload "echo" payload)
-- [ 6 ]
Just "broadcast" -> BC.signal bc (mkPayload "broadcastResult" payload)
-- [ 7 ]
_ -> wtf conn
_ -> do
wtf conn
>>
>>56405260
It breaks it's API so often nobody cares to fix anything.
>>
About a year ago I made a small prototype in Python. It turned out to generate modest monetary profits. The program has since grown to a few 10000 lines of compact Python code.

Dynamic duck typing is starting to show its problems. The program has some edge cases that occur like once a month, and depend on remote state that is outside of my control.

So now I will rewrite the profitable Python program in a type-safe language.

But the design should be improved too.

What are some good design techniques and patterns for reliable networked software?

Unforeseen errors should be dealt with elegantly and recovered from.

My first step was to store most of the state in a PostgreSQL with properly designed transactions, so there are no race conditions.

But network errors and unforeseen changes in the out-of-control remote state are not dealt with elegantly.

Any good books on high reliability software design?
>>
>>56404398
I wanted to be nostalgic and have a solution that looked like it came straight out of Sam's Teach Yourself C++ in 21 Days, which is what I learned from. Terrible book.

My algorithm was bad because my pyramid doesn't have a point ; _ ;
#include <iostream>
#include <vector>
#include <string>

class Pyramid
{
public:
void Loop();
void Print();
private:
std::vector<std::string> mStringVector {};
int mCurrentRow {0};
const int mMaxRow = 6;
int mStarsInRow {1};
};

int main()
{
Pyramid pyr;
pyr.Loop();
pyr.Print();
return 0;
}

void Pyramid::Loop()
{
for( int i = 0; i < mMaxRow; ++i )
{
mStringVector.push_back( std::string() );
int limit = mMaxRow - mCurrentRow;
for( int j = 0; j < limit; ++j )
{
mStringVector[i] += " ";
}
for( int j = 0; j < mCurrentRow + 1; ++j )
mStringVector[i] += "*";
for( int j = mCurrentRow + 1; j > 0; --j )
mStringVector[i] += "*";
++mCurrentRow;
}
}

void Pyramid::Print()
{
for( auto& i : mStringVector )
std::cout << i << std::endl;
}
>>
>>56405240

You're close. Imagine an array of these objects (structs). Then, when you iterate over them, you can compare the user's input to the current Holiday's date & month. If it's a match, then you can print the name of the holiday.
>>
Learning Python 3.5 keep fucking this quiz I'm trying to make
https://github.com/SleepOwl/test-quiz-application/issues/2

Count Vowels Function Iwant to make this function operate from the rest
If the random number is 2, ask the user “How many vowels does the word contain?” and prompt user for input. Assess their answer, and then print an appropriate message.

def vowelcount(word):
correct = word_map[word]['vowels']
ans = input('How many vowels does "{}" contain?'.format(word))
return check(int(ans), correct)

is they are a way to place it's out into the def start_test

I normally wouldn't ask but it's giving me the shits
code in correct formatting is attached in the form of a txt file by the way
>>
>>56405416
how do we do the code windows? sorry newbie here
>>
>>56405535
Did you just have a stroke?
>>
File: Untitled.jpg (7KB, 200x200px) Image search: [Google]
Untitled.jpg
7KB, 200x200px
>>56405558
idspispopd
>>
>>56405564
2 hours sleep mate kinda messes with your grammar

if you look at the code you'll know what I referring to from there
>>
>>56401720
Hey man, crossdressing doesn't make you gay
:^)
>>
>>56405564
>>56405535
import random
import string

vowels = ['a', 'e', 'i', 'o', 'u']
consonants = [x for x in string.ascii_lowercase if x not in vowels]
SelectedWords = ['TRAILER', 'LAPTOP', 'SUNFLOWER', 'SKIPPING', 'AIRPLANE', 'HOUR', 'POTATO', 'HUGE', 'TINY', 'GOOD', 'BAD', 'YES', 'NO', 'WAGON', 'QUESTION', 'LAGOON', 'CAT', 'DUCK', 'GOANNA', 'POSTER', 'FUTURE', 'PRINCESS', 'RHYTHM', 'SUDDENLY', 'SNOW', 'MAGNET', 'TOWEL', 'RUNNING', 'SPEAKER', 'QUICKLY']
word_map = {x:{'consonants':len([y for y in x.lower() if y in consonants]), 'vowels':len([y for y in x.lower() if y in vowels]), 'letters':len(x)} for x in SelectedWords}

def start_test(number_questions):
current_question = 0
correct_questions = 0
if number_questions > len(SelectedWords):
number_questions = len(SelectedWords)
sample_questions = random.sample(SelectedWords, number_questions)
print(' Test 1 START')
print ('---------------------')
for x in sample_questions:
print ("Question {}/{}:".format(current_question+1, number_questions))
print ('---------------------')
current_question += 1
q_type = random.randint(1, 4)
if q_type == 1:
correct = word_map[x]['letters']
ans = input('How many letters does "{}" contain?'.format(x))
elif q_type == 2:
correct = word_map[x]['vowels']
ans = input('How many vowels does "{}" contain?'.format(x))
elif q_type == 3:
correct = word_map[x]['consonants']
ans = input('How many consonants does "{}" contain?'.format(x))
else:
n = random.randint(1, len(x))
correct = x[n-1]
ans = str(input('What is letter {} of "{}"?'.format(n, x))).lower()
print ('correct')
if ans == correct:
print('Well done correct! :)')
correct_questions += 1
else:
print('Wrong :(')

start_test(9)
>>
Just $ fuck (my shit) up
>>
>>56405416
Fixed it. Much less CS grad

void Pyramid::Loop()
{
for( int i = 0; i < mMaxRow; ++i )
{
mStringVector.emplace_back( std::string() );
int limit = mMaxRow - mCurrentRow;

for( int j = 0; j < limit; ++j )
mStringVector[i] += " ";
for( int j = 0; j < 2*mCurrentRow + 1; ++j )
mStringVector[i] += "*";

++mCurrentRow;
}
}
>>
>>56405669
after print wrong it's the following
    print ('You have completed your test!')
print (" Score {}/{}:".format(correct_questions , number_questions))
try_again = input('Would you like to try again? (y/n)').lower()
if try_again == 'y' or try_again == 'yes':
start_test(number_questions)
start_test(9)


try to have the if number 2 to refer to a different function which is the following
def vowelcount(word):
correct = word_map[word]['vowels']
ans = input('How many vowels does "{}" contain?'.format(word))
return check(int(ans), correct)
>>
>>56402935
compiler can do it to some degree with -O3
>>
>>56401903
>>56401933
>python = hobby language.
>c++; java; C#; VB = work language.
>The rest are meme languages used to mem
C# is fine but Visual Basic is never a work language. It's shit. All I know it's used for is highschool programming classes in 1998 and projects by the people who took those classes.
>>
>>56402935
SIMD intrinsics.

The easiest way is like this:
struct Thing {
float x;
float y;

void foo() {
x += y;
}
}

struct 4Things {
__m128 x;
__m128 y;

void foo() {
x = _mm_add_ps(x, y);
}
}


So you do the same thing, just on four objects at once, rather than trying to internally vectorize. Algorithmically, everything stays the same, which isn't true if you want to do operations on a 4x4 matrix represented by 4 __m128s.
>>
>>56405769
One thing I hate about Python is how fragmented it is. C doesn't have this problem.
>>
>>56394621

I need something to do i'm so bored
>>
File: 1425500336437.jpg (8KB, 200x200px)
1425500336437.jpg
8KB, 200x200px
Aight I'm pretty poor and looking for a laptop to code on the fly.

https://www.amazon.co.uk/ES1-131-display-Celeron%C2%AE-Processor-Windows/dp/B01A11XQ76

What I do:
>Python + ML
>Java (work)
>email
>LaTeX

Now I have a rig for most ML shit but I need to do some coding on the fly at times. I need something small with great battery life and CHEAP.
Is link related a decent enough choice? I don't game or watch movies.
>>
>>56405140
Light blue?
>>
File: Screenshot_2016-09-03_19-04-51.png (2KB, 227x42px) Image search: [Google]
Screenshot_2016-09-03_19-04-51.png
2KB, 227x42px
>>56406058
This shit right here. More contrast would not hurt.
>>
File: tegaki.png (8KB, 600x600px) Image search: [Google]
tegaki.png
8KB, 600x600px
>>
>>56406572
homeomorphic endofunctors mapping submanifolds of a Hilbert space
>>
System.out.println(new BigDecimal(1.03f));
System.out.println(new BigDecimal(1.04));
System.out.println(new BigDecimal(1.49));

Expected output
>1.03
>1.04
>1.49

How do i do int in java?

In C++ with <iomanip> it just werks to set precision now i have to do ceiling, floor, half up etc

How do i get the expected output?
>>
>>56406580
http://dlicata.web.wesleyan.edu/pubs/l13git/git.pdf
>>
>>56405504
Hmm, how does this look?

#define MAX_HOLIDAYS 2

typedef struct Holiday{
int date;
int month;
char message[50];
} Holiday;

struct Holiday holidays[MAX_HOLIDAYS];


static void initialize_holidays() {
holidays[0].date = 25;
holidays[0].month = 11;
strcpy(holidays[0].message, "It's XMAS");

holidays[1].date = 0;
holidays[1].month = 0;
strcpy(holidays[1].message, "New Years");
}

for (int i = 0; i < MAX_HOLIDAYS ; i++) {
if(holidays[i].date == user.date) {
return holidays[i].message;
}

}
>>
Is there cross platform 3d game engine that exports C api?
>>
>>56406766
I think Ogre has a C wrapper despite being written in C++.
>>
>>56406611
%02.f?
>>
>>56406811
How? what did you mean by this
>>
File: 1468523512594.jpg (15KB, 450x349px) Image search: [Google]
1468523512594.jpg
15KB, 450x349px
Which is better?
>http://pastebin.com/ivYyFV3k
or
>http://pastebin.com/4L5sVdLb

im leaning towards the second one although the first is easier to understand
>>
>>56406032
Print a sinewave to console in C/++
>>
>>56406619

Fun fact: this can be done without initialize_holidays. Look up how to initialize an array of structs.

Also, make sure to check the month, too!
>>
What OS should I use for programming?

Also how does it feel knowing you guys are my only friends?
>>
>>56397614
>that MUST be defined on compliant compilers for their respective platforms
This is wrong.
Also, you should not use these hacks.
>>
>>56399733
They are not.
>>
>I came across, in our code, the perfect way to find if a number is negative. Convert it to a string and see if the first character is a minus sign. It was in actual production code.

I don't get it, what's supposed to be wrong with this?
>>
>>56407184
It's too portable
>>
>>56403817
Prolog, since it's japanese.
>>
>>56406797
Isn't ogre just a renderer, not a game engine?
>>
>>56407214
You can combine it with other libraries.
>>
>>56406797
ogre is so barebones, if you want a game engine you probably want something more like UE4, otherwise you may as well DIY it from scratch
>>
>>56407246
So writing c export for ogre or making own framework using sdl and some portable version of opengl?
>>
>>56407297
>making own framework using sdl and some portable version of opengl
this
>>
File: crisp.webm (274KB, 360x640px) Image search: [Google]
crisp.webm
274KB, 360x640px
>>56407246
>ogre is so barebones
nigga what
>>
>>56406766
Free open source game engines enough.
But wanting a C api is something else.

Personally i've been playing around with urgo3d.
It's small so you can get to know all the ins and outs in just a few days and had everything you need to make a fully working game.

No C api, just C++
>>
I am retarded and can't figure out why it won't store the amount of taskN ints as I want it to.
>>
File: reee.jpg (28KB, 555x317px)
reee.jpg
28KB, 555x317px
Would like some feedback on this basic python program
should I be separating the quiz questions on separate lines or is it okay how i have it now?
>>
>>56407364
>nano
Tell me you've at least tried vim or emacs.
>>
>>56407333
the learning curve for implementing its features is steep but once you know those things it's not that hard to make yourself, if you know the programming parts then the bulk of the effort of making a game goes into the gameplay, story, art etc
>>>56407341
>urgo3d
>It's small so you can get to know all the ins and outs in just a few days
>>
Can someone send me resources on LiquidFun for Java please.

The only guide I can find is in C++.
http://google.github.io/liquidfun/Programmers-Guide/html/index.html

I've added LiquidFun to my LibGDX project, but I don't know how to get started as I cannot find any resources at all.
>>
>>56400647
A lot of self-loathing and tons of free time
>>
>>56407364
man fgets
>>
>>56407414
>the bulk of the effort
goes into lifting ogre desu
>>
>>56407410
Are you an idiot? look to the left and you clearly see vim LMAO
>>
How math heavy is python?
>>
File: taeyrrtfu.jpg (44KB, 970x316px)
taeyrrtfu.jpg
44KB, 970x316px
>>56407487
i've been shitposting all day and i really need to do some work..
>>
>>56400647
http://www.ikea.com/ms/en_US/customer-service/about-our-products/assembly-instructions/
>>
>>56407487
there is almost no math if you just make simple scripts like web scrapers and such, but ofc if you work directly with math libraries or something there is math involved
>>
>>56407422
see if this helps

http://google.github.io/liquidfun/SWIG/html/index.html

you can also use JNI with C++ directly but avoid it for now
>>
File: 1472568273491.png (929KB, 873x1079px)
1472568273491.png
929KB, 873x1079px
Is the concept of lambda functions supposed to be hard to understand? Because I'm reading SIoCP and it's just so obvious. I have maybe a week of experience using R, and when I read about Lambdas it was clear that anonymous functions are lambdas.
>>
>>56401586
Can I use java to make a program on windows?
I can change os if necessary but it would have to be casual friendly for business use
>>
>>56407634
yes java has great cross-platform support
>>
I could listen to Russ Cox and Rob Pike all day.
>>
>>56407622
>coming to brag about understanding a basic concept
Personality disorder
>>
I want to work in the programming branches of the videogame industry but I want be be employed, not create and indie game. Could I still use Unity and Java?
>>
Yes! I finally solved it.

Euler 44 solution - it's a fucking annoying problem.


def isPent(n):
return (1+(1 + 24*n)**0.5) % 6 == 0

def minPentagon():
i = 1
while True:
i += 1
ni = (3*i**2 - i)/2
for j in range(1, i):
nj = (3*j**2 - j)/2
if isPent(ni+nj) and isPent(abs(ni-nj)):
return abs(ni - nj)
print (Solve())

>>
>>56407694
So that was the question I guess, if it's something basic that everybody gets or it's something that throws people off. I guess it's a basic concept.

Is Lambda the same as abstraction in Haskell?
>>
Is there a good methodology to follow when debugging?

I usually just throw print statements everywhere until I figure out what's happening.
>>
>>56407721

woops,
 print (Solve()) 
should be
 print (minPentagon()) 
>>
>>56407694
>asking a question is bragging
When I was learning to program I often questioned if I actually understood something, mostly because you see a lot of people claiming how complicated something is when it really isn't, so when you do understand it you can come to the conclusion you're missing something when you're not. For me it was pointers, I still don't understand how others don't get it and it made me feel like I didn't get it until I asked other people "is that just this?" "yes".
>>
>>56407733
There's nothing particularly complicated about lambda abstractions
>>
>>56407720
C++ and being able to write things from scratch would be much more useful, unity isn't great at teaching programming
>>
java God here. bow to me, sepples peasants
>>
>>56407622
lambda calculus has nothing to do with lambda in any known programming language.
>>
>>56407749

isn't lambda abstraction literally just executing functions on the fly where you already know what they do?
>>
any good IRC or discord groups for coding?
>>
>>56407748
those people are delusional, they see that not many people use haskell and languages like that so they think it's because it's difficult, when the real reason that that those languages are unpopular is that they're unsuitable for productive work
>>
>>56407781

This to be honest, C++, Python, Java, C# etc are widely used and popular, therefore have more libraries and support available for them, and hence most of the software that is used is programmed in one of those languages.
>>
>>56407767
You shouldn't really think of a lambda abstraction "in terms" of anything else. It's a primitive thing.
>>
>>56407748
this, that's what I was trying to do. There's so much shitposting here on /dpt/ that as a newb it's hard to know when people are serious or not.
>>
which other IDE is really great but also has a debugger like visual studios that is also free?
I can stick to vs if I have to but im just weighing my options as I'm starting my first programming class this semester
also any tips for the class and or just to know in general is always welcome!
>>
>>56407184
>>56407201
No, seriously, this was in a list of 13 programming horrors alongside things like rm -rf and "I crashed the New Zealand stock exchange".

What the fuck is wrong with this?
>>
>>56407720
Having finished and published games on your CV is more impressive than just listing that you know a certain programming language or tech to a lot of employers. Since studios often use proprietary engines anyway it's not like you can get any practice with their tooling without being employed there to begin with. You will most likely need to know C++ though. The only programming positions at AAA developers I've seen where they don't require C++ knowledge is for shit like maintaining their website or that kind of stuff.
>>
>>56407781
>haskell is the only language with lambdas
>>
>>56407487
the core language not at all, the only sense in which it is math heavy is that it is popular among scientists, so it has math-heavy libraries if you want to do a math-heavy project. if you are doing webdev or whatever then not at al
>>
>>56407735
Use the Visual Studio debugger. It's hands down the best debugger out there.
>>
>>56407883
It'd be infinitely easier to just do a
if (num < 0)
>>
>>56407184
it's extremely inefficient. you should only use strings when dealing with actual text. just check if the number is less than 0
>>
File: 1472189212426.png (325KB, 667x670px) Image search: [Google]
1472189212426.png
325KB, 667x670px
>>56407889
>maintaining website

fucking gross
no more please
im so done with this
Has anyone else suffered through this kind of job before?
>>
>>56407883
Jump if less than zero is one assembly instruction
atoi is like 50 lines of C
>>
File: 1458235380611.gif (1MB, 200x192px) Image search: [Google]
1458235380611.gif
1MB, 200x192px
>>56407946
My dad keeps asking me to add shit to the Wordpress site some poo in loo company made for his company

I didn't fall for the CS meme to do this kind of shit
>>
>>56407246
>ogre is so barebones, if you want a game engine you probably want something more like UE4, otherwise you may as well DIY it from scratch
That's true for 2D shit.

For 3D you REEEEAAAALLLY don't want to re-write tedious shit like model loaders and raytraces yourself.
>>
>>56407883
it's ungodly inefficient. depending on the language, it's unclear that String(Integer) makes any kind of format promise. it shows unfamiliarity with the most basic programming ideas.
>>
>>56407184
You seriously don't understand?
This is why people need to learn at least a little C.
Too many people have 0 concept of cost.
>>
learning C++ without any previous programming experience

when does the wall come where I realize I shouldve picked another language, up until now only pointers gave me a headache
>>
>>56408015
you'll be fine, i wish i would have started with C++ tbqh
>>
>>56408015
When you see someone write a script that does the same thing your hundred line code does in 20 lines.
Nothing wrong with C++ though.
>>
>>56407999
C wouldn't help you there, at that point you just dont understand basic math. if you can't figure out what being negative means you shouldn't be programming
>>
>>56407184

a signed integer has a bit that you can just check which is way faster
>>
>>56408015
You're using raw pointers instead of smart pointers?

Time to bleach your brain and start over
>>
>>56408015
>when does the wall come where I realize I shouldve picked another language

Try to make extensive use of libraries other people wrote.

They will not be writing in the same language despite writing in what is still C++.
>>
>>56407246
>>56407333
>>56407414

Most people expect a "Game engine" to include a physics engine, networking code, and an entity system (maybe an entity component system).

People see Ogre and think it's barebones because it doesn't have these things, despite the fact that it has a ton of features in its domain of rendering code.
>>
>>56408092
>and an entity system (maybe an entity component system).
That's fucking stupid, you can't usefully abstract that.
>>
>>56407402
do this instead:
quiz1 = input(

if quiz1 == answer 1:
...
quiz2 = input(

if quiz2 == answer 2:


it looks better when executed.
There's no point in asking two questions after eachother before giving both answers.
>>
>>56408015
go look at the boost libraries, e.g. Iterator Facade

C++ is a great language but it has a huge amount of constructs that are intended for experienced programmers. if you look at experienced C++ it will look like a moon language
>>
>>56408138
C++ is not Boost.
>>
>>56408110
u4e and unity both provide ECS abstractions

it's not really different from providing a database
>>
>>56408152
But Boost is C++
>>
>>56408152
yes, and? the dude wants to know what crazy C++ looks like. i'm certainly not endorsing boost
>>
why is C++ hard to learn?
>>
File: 1470789626656.gif (46KB, 100x155px) Image search: [Google]
1470789626656.gif
46KB, 100x155px
NEW THREAD

>>56408204
>>56408204
>>56408204
>>
>>56407123
OK Sweet, I just want to be on the right track.
>>
>>56408186
I wouldn't say it's hard to "learn" as such, unless you're retarded you should be able to start making stuff in it about as quick as in any other language. It does however have a huge amount of stuff in it so learning the full extent of the language is what takes time. I mean the C++14 spec is like 1400 pages, I doubt there's anyone that knows every little thing in there without looking it up.
>>
>>56408186
there are a large number of first-class language constructs that are intended for library implementors, rather than beginners

for example, beginners should in most cases not be using pointers. beginners in most cases should not be using inheritance. beginners SHOULD be using very simple templates, but even modestly complex templates will induce fucking insanity

if you follow a naive C++ tutorial it will teach you to do a bunch of crap that really should be done with libraries. the correct way to learn C++ is to learn the libraries first. but if you have no programming experience, this is a very hard path to take.

ultimately it's not going to ruin you but i would be impressed by any beginner who went from C++ introduction to wizard without learning several languages in between
>>
>>56408117
thank you <333333
>>
>>56404398
Divide it into milestones.
If you're very new to programming, I'd suggest these:

First step: How deep do you want to go? The example goes 5 deep for example, because there are 5 lines.

So read that input.

Second:
There's an equation that tells you how many stars are in each line. Line 1 has 1 star, Line 2 has 3 stars, 3 has 5, etc. It's the series of odd numbers.

Figure out that equation, and make a function that tells you how many stars a given line has.
(For example, f(1) = 1, f(5) = 9, f(13) = 25.)

Step 3:
Loop from 1 to your depth.
For each line, print the correct amount of stars.
If there is no "print this string/char n times" function, create one.
Do not care about indenting it for now.

Finally: There's an equation that lets you find out how many space you need before you print the stars.
Find that equation and put it in a function.

Putting it all together you'd end up with this in Java:

for(int i = 1; i <= depth; ++i) {
repeatChar(' ', numSpaces(i, depth));
repeatChar('*', numStars(i));
}

assuming that repeatChar prints, and doesn't return a string.

It's pretty easy once you get the trick.
But don't feel bad, the author didn't either. :^)
>>
File: 1466329334062.jpg (24KB, 258x263px) Image search: [Google]
1466329334062.jpg
24KB, 258x263px
>>56409566
>imperative
>>
>>56406611
Why are you passing in floating point numbers and not strings? That's not something you should do in BigInteger/BigDecimal in Java.
>>
>>56409598
What's wrong with that? It's a challenge for new programmers, so odds are that he knows loops, but not really recursion.

So why not keep it as simple as possible?
>>
>>56409566
>using the smiley with a carat nose
>>
File: 1462666496055.jpg (95KB, 724x720px)
1462666496055.jpg
95KB, 724x720px
>>56409702
>>
>>56409713
(^: Isn't it beautiful? :^)

>>56409742
I think you forgot the actual post there matey.
>>
File: 1453656893900.png (1021KB, 870x717px) Image search: [Google]
1453656893900.png
1021KB, 870x717px
>>56409762
>>
>>56409598 >>56409742 >>56409774
He's not worth it.
He uses a tripcode.
>>
>>56409774
Your smug animu grils are no match for the power of both an iterative and recursive solution in Python:

#!/usr/bin/python3

def numStars(step) :
return (step * 2) - 1

def numSpaces(step, maxStep) :
return int((numStars(maxStep) - numStars(step)) / 2)

def printStars(step, maxStep) :
print(' ' * numSpaces(step, maxStep), end="")
print('*' * numStars(step))

pyramidDepth = int(input("How deep is your pyramid love? "))

def recursivePyramid(currentStep, maxStep) :
printStars(currentStep, maxStep)
if currentStep < maxStep:
recursivePyramid(currentStep+1, maxStep)

recursivePyramid(1, pyramidDepth)

# Of course, we could just iterate.
for step in range(1, pyramidDepth+1) :
printStars(step, pyramidDepth)
>>
File: 1453648836231.png (681KB, 840x720px)
1453648836231.png
681KB, 840x720px
>>56409898


pyramid k = unlines $ (\n -> spaces n ++ stars n) <$> [0 .. k - 1]
where spaces n = replicate (k - n) ' '
stars n = replicate (2*n+1) '*'

main = (read <$> getLine) >>= (putStrLn . pyramid)
>>
>>56410004

You don't impress me with Haskell.
If you want to impress me, do it with SQL.
>>
>>56410036
>SQL
I'm straight
Thread posts: 351
Thread images: 43


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

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


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