[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

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

Thread replies: 255
Thread images: 30
File: nichijou0002 copy.jpg (154 KB, 1280x720) Image search: [Google]
nichijou0002 copy.jpg
154 KB, 1280x720
shit tier thread >>54189600

What are you working on /dpt/?
>>
first for traps and Nichijou a shit
>>
>>54198512
>traps
>nichijou is bad

Yeah I'm sure your opinion is worth anything
>>
File: ayyy.jpg (26 KB, 582x583) Image search: [Google]
ayyy.jpg
26 KB, 582x583
>>54198512
u wot
>>
How long it would take an average person to learn how to code? Assuming learning 5 hours a day with the most basic language.
>>
>>54198714
>learning 5 hours a day
probably 2-3 weeks if you actually have something good to learn with. if you're working with someone 1-on-1 that's easily attainable
>>
>>54198749
Really, please dont put me on high expectation.
I'm interested in coding in general, but I'm not confident at math so I never try. Dont have a friend who works as developer so I guess I have to self-learn or go to private school (not sure about its quality tho).
>>
people are finally moving to Rust now
https://www.reddit.com/r/rust/comments/4adabk/the_epic_story_of_dropboxs_exodus_from_the_amazon/
>>
File: 1439102829726.jpg (244 KB, 854x480) Image search: [Google]
1439102829726.jpg
244 KB, 854x480
>mfw I have to read an ISO 9660 filesystem and load an ELF kernel all in real mode x86 assembly.
The worst part is that I'm loading my kernel above low memory, which means I have to switch to protected mode, which means I won't have access to BIOS functions to read the disk so I have to use PIO mode or something, or is there a way around that?
I can't just load the ELF image in low memory because then it would have to be restricted to less than 480 KiB.
Is PIO hard to use?
>>
>>54199035
Also, are there any resources to help me with flow control in assembly? I'm not very good at it, especially with naming labels and such.
>>
File: 59aIQVK.webm (2 MB, 640x640) Image search: [Google]
59aIQVK.webm
2 MB, 640x640
Ask your elegant and much beloved programming literate (IAMA)

>>54199024
Could be multiple reasons: Depends on what scheduler is in use, if the program were preempted, if the hardware were busy, if the memory ram had to recharge, if the process code page were already in the ram/cpu cache before the execution, ...

>>54199030
Depends

>>54197237
>NULL is the string terminator.
It's '\0'

>>54194979
>Forced indentation is cancer (*ahem*python).
fioc.png

>>54198414
>No CoC
You had one job.

>>54198714
~15 weeks.
>>
>>54199195
>multifag
(You)
>>
>>54199195
do you have a qt butt?
>>
Is it guaranteed that without explicitly stating the value of the first enum element, it will always be 0?
>>
>>54199268
What pl ?
>>
>>54199275
C++
>>
>>54199290
yes
>>
>>54199315
thanks
>>
File: computerstate.jpg (77 KB, 1920x1080) Image search: [Google]
computerstate.jpg
77 KB, 1920x1080
>>54199290
"""
An enumerator-definition with = gives the associated enumerator
the value indicated by the constant-expression. If the first enumerator
has no initializer , the value of the corresponding constant is zero. An
enumerator-definition without an initializer gives the enumerator the
value obtained by increasing the value of the previous enumerator by one.
"""

>>54199247
not programming related.
>>
>>54198714
that's a broad question, anon. any hooligan can write a simple hello world program. To actually learn how to program pretty well could take a year of hard studying. Question is to vague though.
>>
Any good guides on learning recursion? Trying to write some scheme stuff and it's kicking my ass
>>
>>54199357
>hard studying
oh please, anon just needs to try out alot of different problems
>>
let insert l x =
let rec loop accu = function
| [] -> List.rev_append accu [x]
| y :: ys as l ->
if x < y then
List.rev_append accu (x :: l)
else
loop (y :: accu) ys in
loop [] l
;;

let print_int ppf n = Format.fprintf ppf "%d" n;;

let print_list pp_a ppf l =
let rec loop ppf = function
| [] -> ()
| [x] -> pp_a ppf x
| x :: xs -> Format.fprintf ppf "%a;@ %a" pp_a x loop xs in
Format.fprintf ppf "@[<hv 2>[@,@[%a@]@;<0 -2>]@]" loop l
;;

let print l = Format.printf "@[%a@]@." (print_list print_int) l;;

let main () =
Random.self_init ();
let length = int_of_string Sys.argv.(1) in
let value = int_of_string Sys.argv.(2) in
let mk_list () =
let rec loop accu =
let accu = Random.int value :: accu in
if Random.int length = 0 then
accu
else
loop accu in
loop [] in
let l = mk_list () in
print l;
let l = List.fold_left insert [] l in
print l
;;

let () = main ();;
>>
File: 24231.jpg (54 KB, 500x500) Image search: [Google]
24231.jpg
54 KB, 500x500
>>54199512
>random access insertion
>into a list
>>
>>54199585
Yes. I know. O(n^2). That's what is cool.
>>
>>54199195
Suggest to me a medium sized project to be completed in the JavaScript programming language. Preferably utilising the more advanced features of JavaScript and with minimal external dependencies.
>>
File: lispfags on suicide watch.png (13 KB, 530x291) Image search: [Google]
lispfags on suicide watch.png
13 KB, 530x291
>>54199600
>>
>>54199673
How is it possible? Inserting in a vector should be longer than in a linked list. Where am I wrong?
>>
>>54199687
Copying two halves of a vector is faster than finding where in the list to insert
>>
>>54199701
There was written after linear search in your picture. So it was a lie.
>>
>>54199722
http://www.codeproject.com/Articles/340797/Number-crunching-Why-you-should-never-ever-EVER-us
>>
>>54199739
Please tell me something I don't already know.
>>
>>54199722
>Can you see the red fuzz at the bottom? The graph is not displayed incorrectly. That red fuzz is the time measurements for vector. 500,000 sorted insertions in a linked-list took some 1 hour and 47 minutes. The same number of elements for the vector takes 1 minute and 18 seconds.

You can test this yourself. The code is attached with this article. For a quick test you can try out the smaller (max 15 seconds) test of up to 40.000 elements at the pastebin and online compiler IdeOne: http://ideone.com/62Emz
>>
>>54199760
Inserting in a linked list after finding the position is O(1).
>>
>>54199760
Second part should also be a quote
>>54199758
It explains the graph - it's sorted insertions, meaning the linear search is to find the location. It does not use a binary search on a vector.
>>
>>54199789
>meaning the linear search is to find the location
Like i Said >>54199775 inserting AFTER finding the position is O(1).
>>
>>54193519
Thank you, that helps a lot
I'm using Java, so would using exceptions be the best thing to do?
>>
>>54199775
1) Touching heap, no cache lines. Talking about big O is nice but not itself predictive of performance. Lists are an example of this, another is sleepsort.
2) AFTER FINDING THE POSITION
>>
File: zi-syntax.png (183 KB, 446x618) Image search: [Google]
zi-syntax.png
183 KB, 446x618
What is /g/'s opinion on Zile?
https://www.gnu.org/software/zile/
Just stumbled upon it, seems ideal and too good to be true...
>>
>>54199793
Yes, and I said
"Copying two halves of a vector is faster than FINDING WHERE IN THE LIST to insert"
>>
>>54199800
>2) AFTER FINDING THE POSITION
Exactly
And to quote picture of >>54199673
>after linear search
So that picture is a lie.
>>
>>54199775
O(1) can be slower than O(n^2) in real world time.
In this case it's lists O(n) search vs array O(n) search - both linear, but dramatic difference in actual real world time.
And the search dominates time spent by the cpu, so the actual insert is practically irrelevant.
>>
>>54199811
Not the subject. The subject is >>54199673 how can it be slower to insert AFTER finding the position).
>>
>>54199816
No it's not. It's a graph of how long it takes to linearly search for the insertion point and then insert an item. I.e. how long it takes to insert after linear search.
>>
>>54199810
>dynamic typing
>>
>>54199830
The picture says explicitly AFTER LINEAR SEARCH.

>>54199819
>O(1) can be slower than O(n^2) in real world time.
There is always a n after which the O(1) is faster.
>>
>>54199637
Pacman
>>
>>54199845
Yes, it's measuring RANDOM INSERTION into a list or a vector. "after linear search" means that the random insertion consists of INSERTION done AFTER LINEARLY SEARCHING FOR THE POSITION.


>>54199845
Sleepsort: Sorting algorithm with a time complexity of O(n), where N is proportional to the biggest number. Given a precise enough clock, O(1).
>>
>>54199845
>There is always a n after which the O(1) is faster.
That n might not be physically possible in our universe, or less dramatic - limited to say 32 or 64 bit and integers.
That's why asymptotic analysis is not always indicative of actual performance.
>>
>>54199894
>AFTER LINEARLY SEARCHING FOR THE POSITION.
So O(1). The picture is a lie.

>>54199899
Ok, but it's not our case in our CONCRETE problem.
>>
To simplify, this is what you are saying:
(a,b),c
"only c is after a"
>>
Does anyone know here how do I attach smart component to lineat mover in ABB robotstudio?
>>
>>54199907
start, [(linear search, insert)], end
let time = end - start
insert is AFTER linear search

>>54199935
I was gonna say >programming, but I guess that is still programming
>>
>>54199810
looks like lua
>>
>>54199945
OK, I get it. You're trolling.
>>
just learned that AndAlso is the equivalent to &&
>>
>>54199907
>Ok, but it's not our case in our CONCRETE problem.
In the actual problem discussed it's linked list's linear search O(n) + insert O(1) vs array linear search O(n) + insert O(n) and the array comes out on top because the linked list's linear search is so much slower that the array's linear insert can be ignored.
>>
>>54199966
picture say explicitly AFTER LINEAR SEARCH
and you do your best to ignore that
You're trolling anon, and I failed to understand it.
>>
File: lol i trold u xd.jpg (15 KB, 325x184) Image search: [Google]
lol i trold u xd.jpg
15 KB, 325x184
>>54199959
Look, lets forget that you don't speak English for a second. The graph, regardless of whether you can understand the title, is measuring the time it takes to linearly search and then insert.

Do you know another phrase for "X happened and then Y happened"? How about "Y happened after X happened"?
>>
>>54199980
>picture say explicitly AFTER LINEAR SEARCH
Yes, to tell you it's measuring search + insert.
>>
>>54200001
I've been trying to explain this to him for 5 minutes, he's not gonna get it
>>
>>54200001
AFTER is AFTER
Time of inserting AFTER is O(1). Sorry guys. I suck at English, but I know what AFTER means.
>>
>fail to understand
>accuse others of trolling
>Interval (including now)
>say you were just trolling the entire time

How long will the interval last?
>>
>>54200032
Time of doing (A after B) =/= (Time of doing A) after B

If you meant the latter, you likely wouldn't specify "after B", you'd clarify A or something
>>
>>54200032
>Time of inserting AFTER is O(1).
No one is disputing this.
What we are saying is:
array search + insert: O(n) + O(n)
is faster than:
linked list search + insert: O(n) + O(1)

In real world performance doing O(n) + O(n) amount of works takes less time than O(n) + O(1) because the latter O(n) has such large constant factors (in the form of cache misses) that it overshadow everything.
>>
>>54200072
>If you meant the latter,
yoyu clearly say AFTER B to say that it's after and you don't count the time of B.
It it was the former, you would say INCLUDING B to explicitly say that you're including it.
>>
>>54200095
No, it doesn't. It means the former.

It doesn't even matter. Either lists are shit or lists are even more shit.
>>
>>54199810
>end
Trash.
>>
is something wrong with C++? 2GB to compile software? lmao

https://news.ycombinator.com/item?id=8563411
>>
>>54200608
chrome needs like 16gb to build but that's not an issue with the language but rather the compilers
>>
>>54200275
Since they got rid of mandatory parens and curly brackets, the only other way to define scope would be to use the whitespace.

I'll take "end" over that shit any day.
>>
>>54200631
Is it the type system, generics, and templating? Even Rust is slow/huge in compiling
>>
>>54200666
yeah templates probably contribute a lot since compilers need to generate like fuck ton of "duplicate" intermediate code
>>
File: Boredom.jpg (12 KB, 415x415) Image search: [Google]
Boredom.jpg
12 KB, 415x415
        static private void PrintRandomLettersForAWhile(string usrIn)
{
Random rnd = new Random();
for (int i = 0; i < 1500; i++)
{
Console.ForegroundColor = (ConsoleColor)(rnd.Next(16));
Console.BackgroundColor = (ConsoleColor)(rnd.Next(16));
Console.Write(usrIn[rnd.Next(usrIn.Length)] + " ");
}
Console.ReadKey();
}

static private void OrthogonalMeme(string usrIn)
{
foreach (char c in usrIn)
{
Console.Write(c.ToString().ToUpper() + " ");
}
Console.Write(Environment.NewLine);
for (int i = 1; i < usrIn.Length; i++)
{
Console.Write(usrIn[i].ToString().ToUpper() + Environment.NewLine);
}
Console.ReadKey();
}

static private void RollingMeme(string usrIn)
{
for (int j = 0; j < usrIn.Length; j++)
{
for (int i = j; i < usrIn.Length + j; i++)
{
Console.Write(usrIn[i % usrIn.Length].ToString().ToUpper() + " ");
}
Console.Write(Environment.NewLine);
}
Console.ReadKey();
}

static private void ReverseRollMeme(string usrIn)
{
for (int j = usrIn.Length; j >= 0; j--)
{
for (int i = j; i < usrIn.Length + j; i++)
{
Console.Write(usrIn[i % usrIn.Length].ToString().ToUpper() + " ");
}
Console.Write(Environment.NewLine);
}
Console.ReadKey();
}
>>
>>54198714
to become a good web dev: 1 week
to become a good C++ dev: 2+ years
>>
>>54200738
But why
>>
>>54200608
>2016
>having less than 2 GB of memory and calling yourself a developer
>>
>>54200608
>fbthrift
>Facebook's branch of Apache
>Apache
>Facebook
there's your problem
>>
>>54200780

I have no answer for you anon.

I'm currently turning my sights to an ASCII-based console game where I have to pick up all the letters in usrIn from a field made of '.' and surrounded by an ascii box
>>
>>54200738

Comment your damn code
>>
File: MessageForAnon.jpg (872 KB, 3796x2093) Image search: [Google]
MessageForAnon.jpg
872 KB, 3796x2093
>>54200831
>>
>>54200785
I didn't fall for the 16GB meme, so I have 8
>>
>>54200884
>18MB MEM usage to print these texts

wow
>>
>>54200884
How do I turn on that diagnostic tool?
>>
>>54200895
so much for C# being "much more memory efficient" than java. fucking delusional Csharts
>>
>>54200884
Another!
>>
File: 1436338494329.png (83 KB, 303x641) Image search: [Google]
1436338494329.png
83 KB, 303x641
I'm trying to learn and someone suggested project Euler, but it seems to focus on mathematics. Is project Euler good?
>>
File: 1440721847806.jpg (40 KB, 374x363) Image search: [Google]
1440721847806.jpg
40 KB, 374x363
>>54200884
>Module is optimized and the debugger option 'Just My Code' is enabled.
>>
>>54201115
>Is project Euler good?
For mathematical problems, yes.
>>
Axiom mif : forall (T : Type) (P : Prop), (P -> T) -> (~ P -> T) -> T.
Arguments mif {_} _ _ _.

Axiom mif_true :
forall (T : Type) (P : Prop) (t : P -> T) (f : ~ P -> T) (H : P),
mif P t f = t H.
Arguments mif_true {_} _ _ _ _.

Axiom mif_false :
forall (T : Type) (P : Prop) (t : P -> T) (f : ~ P -> T) (H : ~ P),
mif P t f = f H.
Arguments mif_false {_} _ _ _ _.

Theorem absurd : forall A : Prop, A \/ ~ A.
intro A.
apply mif with (P := A).
auto.
auto.
Qed.

Definition total_order : forall T : Type, (T -> T -> Prop) -> Prop :=
fun T leq =>
(forall x : T, leq x x)
/\ (forall x y : T, leq x y -> leq y x -> x = y)
/\ (forall x y z : T, leq x y -> leq y z -> leq x z)
/\ (forall x y : T, leq x y \/ leq y x).
Arguments total_order {_} _.

Definition max : forall T : Type, (T -> T -> Prop) -> T -> T -> T :=
fun _ leq x y => mif (leq x y) (fun _ => y) (fun _ => x).
Arguments max {_} _ _ _.

Theorem max_is_max :
forall (T : Type) (leq : T -> T -> Prop) (x y : T)
(H : total_order leq),
let m := max leq x y in
(m = x \/ m = y) /\ leq x m /\ leq y m.
intros T leq x y Horder m.
assert (leq x y \/ ~ leq x y).
apply absurd.
case H.
intro H0.
assert (m = y).
unfold m.
unfold max.
apply mif_true with (P := leq x y) (t := fun _ : leq x y => y).
auto.
split.
auto.
rewrite H1.
split.
auto.
apply Horder.
intro H0.
assert (m = x).
unfold m.
unfold max.
apply mif_false with (P := leq x y) (f := fun _ : ~ leq x y => x).
auto.
split.
auto.
rewrite H1.
split.
apply Horder.
assert (leq x y \/ leq y x).
apply Horder.
case H2.
intro H3.
exfalso.
apply H0.
auto.
intro H3.
auto.
Qed.
>>
>>54201125
Fuck off dumb frogposter.
>>
>>54201115
no you should check out https://docs.oracle.com/javase/tutorial/ and do a mid-sized project of your own
>>
File: u mad1.jpg (34 KB, 409x352) Image search: [Google]
u mad1.jpg
34 KB, 409x352
>>54201138
>>
File: newMessage.jpg (905 KB, 1922x3254) Image search: [Google]
newMessage.jpg
905 KB, 1922x3254
>>54201033

This one uses 16MB. I reckon it's debugger overhread, not actual memory use.

I was coding lazy, using + to concat strings so that more might be stored in dseg, but who knows?
>>
>>54201134
I thought so.

>>54201142
I thought people hate Java
>>
>>54201179
We do, he's one of a minority of professional shitstreeters who post here
>>
Couldn't find any code for pausing and resuming download in Java. Need it for my university project. Can anyone help?
>>
>>54201179
>I thought people hate Java
it's just a meme. it's literally the #1 programming language. it's a great language, especially for learning.

www.tiobe.com/index.php/content/paperinfo/tpci/index.html
>>
I just realized that programming is gay and I'm switching to polisci.
>>
>>54201210
And nothing of value was lost
>>
>>54201167
>using + to concat string
that's lazy TO SAY THE LEAST
>>
>>54201190
Ignore this guy

>>54201210
Are you a cruzmissile now?
>>
File: Cruzin' for a bruisin'.webm (395 KB, 854x480) Image search: [Google]
Cruzin' for a bruisin'.webm
395 KB, 854x480
>>54201258
>cruz
i shiggy diggy
>>
>>54200895
Python. baka
>>
>>54201167
>using + to concat strings so that more might be stored in dseg
What's dseg and why would it help?
>>
>>54201272
I like how the tranny is for the tranny hater, and how pol is for the tranny lover
>>
>>54201179
You don't learn much in Java. Most of the shit people used to do in C, C++ can be done using inbuilt functions and apis.
>>
>>54201258
>Are you a cruzmissile now?

Never was and never will be. I'm voting for GJ, but out of the current honest contenders, I'd prefer to see Trump win. He's probably less destructive than Hillary could be.
>>
>>54201278
dseg is part of the final binary created once your code has compiled and linked. It's the "data segment" of the file. Other segments include the "code segment" where the instructions for the computer are kept. Storing stuff in dseg makes your binary unnecessarily large, and increases memory use as the dseg is normally loaded into memory on execution.

By using + to concat two strings A and B, I'm telling the compiler "There are two strings here, I want you to store A and B in dseg for quick use" and because of optimisation it will also store the result of A + B

A more memory efficient way to do this is probably
string A = "Uru";
string B = "Guay"
string.Format("{0}{1}", A, B);
>>
>>54201349
>By using + to concat two strings A and B, I'm telling the compiler "There are two strings here, I want you to store A and B in dseg for quick use" and because of optimisation it will also store the result of A + B
Do you really know what the compiler does?
>>
>>54201317
as if python isn't infinitely worse in that regard
>>
>>54201378

Turns my english into computer gibberish more efficiently than I could.
>>
>>54201349
for fuck's sake, even C# has StringBuilder, stupid shitter

https://msdn.microsoft.com/en-us/library/system.text.stringbuilder(v=vs.110).aspx
>>
>>54195199
kys
>>
>>54199794
Anyone else please?
>>
>>54199794
in this case, most likely
>>
>>54201345
>has tried to shitpost on pol
>has never tried to read pol

I used to like OSGTP but then he missed the joke. Now I'm a rubyrider.
>>
>>54201515

I don't shitpost on /pol/. The only threads I really frequent are the ones about black women (which happen daily)
>>
Would it be a bad idea to use "(´・ω・`)" as the name of my project? It seems like it shows fine in my browser.
>>
>>54201125
>>54201157
>>>/b/
>>
>>54201526
yes use a proper name
>>
>>54201536
(´・ω・`)
>>
>>54201526
No, you should use a proper name instead. Like 'frob`.
>>
>>54201526
If you're going to use a weeb name, at least stick to only ASCII characters, and only 7-bit ASCII at that.
>>
File: 1460752551846.png (138 KB, 237x270) Image search: [Google]
1460752551846.png
138 KB, 237x270
>>54201563
>7-bit ascii
>bit
not a portable
>>
>>54201563
>only 7-bit ASCII at that
Because there is an other ASCII?
>>
>>54201513
Thank you! Would it have to be a custom exception in this case then?
>>
>>54201345
Even though I'm going to filter you now, i agree with you on the Trump opinion. Hillary is a fucking shady bitch, way worse than anything Trump could be.
>>
>>54201570
7-bit ASCII is the most portable you stupid fuck.
Extended ASCII (8-bit ASCII) is not standard.

>>54201590
Yes, extended ASCII.
>>
>>54201598
>Yes, extended ASCII.
What is it?
>>
>>54201591
just something with a name that kinda describes the problem, like IllegalArgumentException, or a custom exception like InvalidInputException
>>
>>54201593
>Even though I'm going to filter you now

But why? I didnu muffins.
>>
>>54201621
Why use a trip?
>>
>>54201614
https://en.wikipedia.org/wiki/Extended_ASCII
It's 8-bit ASCII, someone added an extra bit on top of standard 7-bit ASCII, however the upper 128 characters of extended ASCII is not standard.
>>
>>54201598
>most portable
>portable
>>
>>54201616
>IllegalArgumentException
nvm it's intended for method arguments so in your case depending on how you implement it to be 100% 'correct' you should probably use a custom exception or maybe some sort of networking related exception if there is one
>>
>>54201650
Yes, portable.
>>
>>54201657
the most portable format for a native 64 bit pointer is not very portable
>>
>>54201669
And? I'm not talking about pointers, you idiot.
Are you brain damaged?
>>
>>54201699
They just failed to understand what is ASCII 7 bits.
>>
>>54201699
The first thing to do when realising you're wrong is to calm down, it's not the end of the world to have made a mistake on the internet. Relax, and enjoy being corrected.
>>
>>54201709
I can see that.
>>
>>54201714
how was he corrected though wtf is >>54201669 on about
>>
>>54201699 >>54201709 >>54201714 >>54201725
He was joking that bits aren't portable
>>
>>54201733
But bits are portable.
>>
>>54201748
>implying
>>
C question:

How do I correctly use a function as an argument for another function and more importantly, how to return the passed function value correctly?

Something like this:
int func1( int (*func2)(int)){
return (*func2)(int)
}

All of the examples deal with void functions, so they don't return anything I can't get a working example.
>>
>>54201809
use lisp
>>
>>54201818
>I need help doing X
>Do Y instead, even though it's got absolutely nothing to do with X and it's also the worst possible solution.
>>
>>54201733
>bits
>huehue
>>
>>54201788
>The C++ Programming Language - Fifth Edition.png
>Image shows The C Programming Language
I don't get it.
>>
>>54201809
I believe you just use it like any other function
int func1(int (*func2)(int)) {
return func2(3);
}
in C++ you've got member bs so it's different

>>54201839
>worst possible solution
He didn't say Python
>>
>>54201904
>He didn't say Python
Yeah you're right, I apologize.
I meant third worst possible solution, with Python being second and Haskell being first.
>>
send help
I want to make a simple translator on Qt i think i will use the microsofts translator but how would i go about using it? when i try to connect through qt qnetworkaccessmanager it says
"Authentication Required" But i don't have any idea how to enter from Qt
>>
>>54201394
I don't know shit about python to comment.
>>
>>54201928
At least Haskell has static typing
>>
>>54201904
Okay, thanks. How would I call such a function then?
func1(func2(3))? Doesn't seem to work that way.
>>
Why is it so fucking hard to come up with names for things? I have a main thing and sub things and sub sub things and I have no idea which names to use on which.
Would Window -> views -> spites work?
or Window -> containers -> sprites?
>>
>>54202061
You need func1 to take an extra variable that you can pass to func2.
>>
>>54201865
>huehuehue
>>
What file extension should I be using for x86 assembly files with NASM?
.S
.s
.asm
others?
>>
i thought someone should make a parody lang, a lang that's intentionally as bad as possible

but then it would pretty much just be a python clone
>>
>>54202061
func1(&func2)
>>
>>54202154
I believe .asm is the standard for NASM, and .S for GAS.
>>
>>54202169
the & is not required
>>
>>54202199
Ah, well it might be in C++
>>
I noticed that the Linux kernel is using a lot of C in the boot code for x86?
https://github.com/torvalds/linux/tree/master/arch/x86/boot
Is all this or at least some of it running in 16 bit real mode? if so, how are they compiling C code to 16 bit real mode x86? to my knowledge GCC does not provide that capability.
It would be really helpful if I could compile some C code into a flat binary for use in my bootloader.
>>
>>54202236
nope
>>
File: tree.png (28 KB, 718x486) Image search: [Google]
tree.png
28 KB, 718x486
How would I do this without mutability?
>>
>>54202240
Binutils maybe?
Not sure if it's what you want but, see
http://wiki.osdev.org/GCC_Cross-Compiler
and for compiler arguments
http://wiki.osdev.org/Bare_Bones#Writing_a_kernel_in_C
>>
On some websites when i try to access them a web browser prompt appears asking me for my credentials what is that called?

Without credentials i can't access the website
>>
>>54202095
>>54202169
Alright, it works with or without &.
Trouble was I was using a c++ compiler, complained about conversions. Switched to C, all is fine, everything works.
I thought C was compatible with C++ compilers?
>>
>>54202339
Most C is, but it's more likely that you were compiling with some kind of strict option that raises errors for certain implicit conversions
>>
>>54202327
Whoops, Leaf x -> x should be Leaf x -> Some x
>>
>>54202240
Its grub that uses 16-bit mode. Kernel already starts in protected mode.
>>
>>54202339
>>54202362
Couldn't you just put it in an
extern "C"
block?
>>
>>54198714
le code meme
i code le program i am le leet
le kodewithklossy le came from instagram
how do i code web
>>
>>54202335
Not quite what I want.
Those pages you linked are for writing 32bit protected mode C, i.e after you've loaded your kernel into memory and jumped to it.
I'm currently faced with doing a lot of stuff in assembly prior to jumping to the kernel proper, I assumed that there's no way around it and everyone has to go through it when writing a kernel (unless they use multiboot like fucking faggots), but Linux kernel clearly shows C code calling BIOS functions.

>>54202389
https://github.com/torvalds/linux/blob/master/arch/x86/boot/a20.c
Correct me if I'm wrong, but a20.c is clearly making BIOS calls here, the BIOS can only be called in real mode (correct me if I'm wrong), therefore this C code is executing in 16bit real mode.
>>
>>54202406
>>>/out/
>>
>>54202433
>BIOS
so 2006
>>
>>54202557
Fuck off, UEFI is cancer.
>>
>2016
>Not accessing arrays with the happy face operators

#include <stdio.h>

int main(void) {
char string[] = "I am a string";
printf("%c%c%c\n", string<:2:>, string<:5:>, string<:7:>);
return 0;
}


What, do you want your programs to be sad to look at?
>>
File: tcg.jpg (30 KB, 844x312) Image search: [Google]
tcg.jpg
30 KB, 844x312
>>54202588
>UEFI is cancer
No. It's a weapon. A weapon forged by our enemies.

Those who "defend" my freedom but never talk about the TCG are just traitors who don't defend my freedom.
>>
>>54201653
Thank you, I think it's ProtocolException I might need to use
>>
>>54202339
you might check what standard of C was the compiler using
gcc is c by default, g++ forces c++ im sure
>>
>>54198799
Lesson one: don't say coding
>>
>>54203089
STFU
>>
>>54200275
FUCK off python FAG, you're the CANCER of the programming world.
>>
>>54200748
>1 week
seems like exaggeration
>>
>>54202720
wtf is this shit
>>
>>54203213
web dev is VERY simple

try this to get started

https://code.org/learn
>>
>>54202720
Wait what

Are those valid?
>>
>>54203121
>uses only python
It's ok for you to say coding anon
>>
>>54199687
Vectors are cache firendly. Lists are not
>>
Daily reminder to filter ALL tripfags. Out of the myriad cancers that afflict this board, they are the easiest to purge. If you don't want to filter them, then above all DO NOT RESPOND to them.
>>
File: vlcsnap-2011-02-14-14h22m16s206.png (634 KB, 960x720) Image search: [Google]
vlcsnap-2011-02-14-14h22m16s206.png
634 KB, 960x720
Will my programs get smaller as I go through Comp Eng? It seems like a lot of the problems I'm assigned I do real roundabout ways of solving. The thing I'm working on now is a program that takes user input, stores it into an array, then sorts the array from greatest to least. But it also needs the original indices from the unsorted array, so I'm thinking I need to create a separate array just to store those.
Feels like I'm not doing it the way I'm supposed to and it's bumming me out.
>>
>>54203250
welp at least I know where to start now
Thanks
>>
>>54203256
>>54203217

digraphs
>>
File: 1456539015834.jpg (346 KB, 1177x916) Image search: [Google]
1456539015834.jpg
346 KB, 1177x916
panic: runtime error: cgo argument has Go pointer to Go pointer [recovered]
>>
>>54203327
oh
>>
>>54203295
>Feels like I'm not doing it the way I'm supposed to
That's normal when you're learning, don't worry
>>
if constant == variable vs if variable == constant
>>
>>54203378
The first one is yodaspeak
>>
>>54203378
if variable == constant
>>
>>54203378
>if constant == variable

This'n.
>>
>>54203378
constant == variable prevents variable = constant bugs.
>inb4 only pajeet makes those errors
you've never programmed before
>>
>>54203409
>>54203462
shiggy

it makes it less readable for no real benefit

i thought everyone agreed that yoda style a shit
>>
>>54203378
worked with 2 mil sloc south korean code base before where they did #1 everywhere
it's fucking shit, #2 any time of the day
>>
>>54203479
>less readable

get the fuggout.
>>
What do you guys name your for loop variables? I hate calling them x, y etc.
>>
>>54202240
https://github.com/torvalds/linux/blob/master/arch/x86/boot/Makefile
>>
>>54203577
For loop initializers?

i,j,k,m,n,x,y in order if I ever need that many
>>
>>54203590
read it, nothing useful in there.
>>
>>54203577
>I hate calling them x, y etc.

x and y are just fine. i and j also common.
>>
File: steve_ibm-640x714.jpg (137 KB, 640x714) Image search: [Google]
steve_ibm-640x714.jpg
137 KB, 640x714
The classes Man and Woman both inherit from the abstract class Person

I want to implement a addPartner(Person p) algorithm for both, but constrain it to heterosexual partners. I.e. woman has addPartner(Man m) and man has addPartner(Woman w). Is there any way of using inheritance in this case?
>>
>>54203577
forLoopIndexTopLevel, forLoopIndexAtLevelOne, forLoopIndexAtLevelTwo, etc.
>>
>>54203577
i
>>
>>54203659
No, what you do is you stop being a bigoted, homophobic cis shitlord.
>>
>>54203659
Yes.
>>
>>54202720
C++ standard committee actually wanted to get rid of digraphs/trigraphs in C++14/17, but IBM was against the decision, claiming they still have customers without access to ASCII codepage who want to code in modern C++.
>>
D J A N G O
J
A
N
G
O
>>
>>54203686
how?
>>
>>54203709
>they still have customers without access to ASCII codepage who want to code in modern C++
but how
>>
>>54203659
So like this?

class Person
{
public:
virtual bool isMan() = 0;
virtual bool isWoman() = 0;

virtual void addPartner(Person person)
{
}
};

class Man: public Person
{
public:
bool isMan()
{
return true;
}

void addPartner(Person person)
{
if (person.isMan())
return;

Person::addPartner(person);
}
};
>>
>>54203821
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4210.pdf
>There are real customers who use EBCDIC. We cannot reveal their names due to confidentiality agreements. One key example is some of the major banks in North America who continue to use IBM machines to perform check clearing operations
.
>>
>>54203821
You don't want to know.
>>
>>54203659
>>54203853
it's disgusting, you're not supposed to do type checking

Man should have addPartner(Woman woman) and Woman should have addPartner(Man man). you should not be allowed to pass a Man to Man.addPartner()
>>
abstract class Human<OtherSex> {
public abstract void addPartner (OtherSex other);
}
class Man : Human<Woman> {
public override void addPartner (Woman woman) {
woman.addPartner (this);
}
}
abstract class Woman : Human<Man> {
public override void addPartner (Man man) {
man.addPartner (this);
}
}
>>
>>54198414
summarized what does the spring framework do ?
I've heard about a dozen variations of the Spring Framework and how people use it for quick development but it never says anywhere black on white what it does.

I've heard people using it for web deveolpment, or "normal" java developement, which left me a little bit confuse d

Heres my understanding, spring enables dependency injection which enables us to use objects more liberal because we can tell spring which dependencies(objects that we create?) to use in our code

is that correct ?
>>
* prefix, dettached
() postfix, attached
[] postfix, attached

auto
= {}
{}

Literally why
>>
File: 1441726832138.gif (920 KB, 500x359) Image search: [Google]
1441726832138.gif
920 KB, 500x359
I posted this in /agdg/, but no one could help me.
http://pastebin.com/p7n7qhim
This is my collision detection for a game, and it's jerky as hell. The player snaps to platforms, or sometimes he'll just pass right through them.
>>
>>54203603
>i,j,k,m,n,x,y
>6 nested loops in one outter loop
>O(n^7) complexity minimum

jesus fucking christ, what abomination have you ever written that needed these many loops?
>>
>>54204081
use box2d or implement a better algorithm
>>
>>54204129
to validate xml, gotta go deep
>>
File: 56152254_p1.png (381 KB, 1000x913) Image search: [Google]
56152254_p1.png
381 KB, 1000x913
>>54198414
I want teach lewds to Hakase.
>>
Wich book(s) increased your powerlevel beyond human standars?
>>
File: mvwFQcY.jpg (51 KB, 500x315) Image search: [Google]
mvwFQcY.jpg
51 KB, 500x315
>>54204133
>implement a better algorithm
That's what I'm trying to do, but I can't figure out what's wrong.
>>
>>54204235
The bible
>>
>>54204002
>Man can only haveWoman as partner
>Woman can only have Man as partner
>>
>>54204252
sorry but your code looks like you're barely even trying, you're setting the position and velocity so of course it will snap to platforms, and you're only checking if they're colliding at that instant in time, you should use some other algorithm

http://gamedev.stackexchange.com/questions/18604/how-do-i-handle-collision-detection-so-fast-objects-are-not-allowed-to-pass-thro
>>
Is Go considered harmful?
>>
I'm a noob. Heard ruby was good for programmer work, is it worth picking up as a first language to have as a fallback down the line? Plan is to learn it alongside my current course for the next ~year.
>>
>>54204216
DELETE THIS
>>
>>54204381
yes
>>
Sad panda copy
>>
>>54200738

> static
> static
> static
> static

You disgust me.
>>
File: pc.png (378 KB, 1450x1080) Image search: [Google]
pc.png
378 KB, 1450x1080
Better late than never, I guess.

Additionally, someone create a new one without retarded difficulties and all that crap!
>>
>>54204422
great for writing shit quick
>>
>>54204472
roll
>>
>>54204472
rolle and I'm actually going to fucking do it this time not say "lmao that ones too easy" or "lmao thats a waste of time" i'm actually going to fucking do it and post the result here just fucking watch
>>
>>54204520
if you do it ill hire you ;^)
>>
>>54204339
Yes, like in the Bible. It's how God made the world.
>>
>>54204523
>days b/w 2 dates
bitch thats too easy next roll
>>
    int i = 0;
Cookie cookiesArray[] = req.getCookies();

for (Cookie cookie : cookiesArray)
{
if (cookie.getName().equals("addControllerCookie"))
{
i = 1;
break;
}
}
if(i == 0)
{
Cookie addControllerCookie = new Cookie("addControllerCookie", "true");
resp.addCookie(addControllerCookie);
}



Is there a better way to do this? I'm trying to look at the cookies in a request and see if a certain one is present. If it isn't present, I want to add it

the way I did it just feels dumb
>>
>>54204537
>>>>>>>>>>>palindrome checker
def is_palindrome(str)
str == str.reverse
end


reroll
>>
>>54204553
>higher/lower
what the fuck is this
def is_higher(a, b)
if b > a
puts "b is higher"
elsif a > b
puts "a is higher"
else
raise "fuck you"
end
end

reroll
Thread replies: 255
Thread images: 30

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

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.