[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 - Python edition
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: 24
File: python.png (8 KB, 200x200) Image search: [Google]
python.png
8 KB, 200x200
old thread >>54284745
What are you working on?
>>
Learning JS with freeCodeCamp.com

I tried so many websites before, treehouse, codeschool, codecademy, I just disliked them all... finally found one I like. FreeCodeCamp is great and it has no geek humor which I hate.

I love to learn programming but I don't want to be triggered by "geek culture"... foo bar etc.
>>
>>54292633
Web dev with Python/Django
Going through eloquentjavascript.net too
>>
>>54292633
is relative import like this supported by python?
from ..shit import shit
>>
Making a new "Ayy lmao" virus
>>
>>54292683
yes
>>
>>54292690
it breaks, telling me i'm trying to do relative import beyond top level package.
>>
>>54292733
Post your code
>>
In biology, lab needed data analyzed. I'm trying to learn how to use R, they have a lot of bioinformatics tools through an organization called bioconductor. Learning the bare ass basics through swirl, a package for R that gives you tutorials on R. Fuck me, I went for the easiest STEM degree and now that I have a job I need to actually learn computer and math shit
>>
>>54292733
Probably the __init__.py files don't exist where you are trying to go up a level
>>
Who /ruby/ master race?

Just started using this shit I love the syntax, looks so crisp and clean
>>
>>54292751
I'm doing django
from ..accs.views import has_posted
dir structure is:
project:
app1
app2
accs
>>54292769
all of them have __init__.py as default in django
>>
>>54292633
learning python :^)
total newbie regarding programming

but typing in gedit is a chore
any recommendations what to use as an IDE?
>>
>>54292665
Jesus christ, what a post.
>>
>>54292790
vim
also python is horrible for a first language
>>
>>54292784
Pretty sure django is set up so you can do

from accs.views import has_posted

Why haven't you bought pycharm yet?
>>
File: 1459797289612.png (47 KB, 1038x619) Image search: [Google]
1459797289612.png
47 KB, 1038x619
>>54292790
I personally like sublime
pycharm is the most popular IDE, but to me it feels clunky, slow,...
>>
>>54292665

how much are they paying you to push this garbage?
>>
>>54292790
sublime text

don't listen to the other anon, get in deep with python, supplement it with Django, make mad monies

>>54292808
On a fast enough laptop, its use is indispensible. Skipping through your project is incredibly fast and smooth, finding definitions, running tests, debugging, automating a lot of tasks, etc. My only complaint is that you'll need a faster system if doing it professionally and your company has a lot of projects, and you need a lot open at a time. Eats through my memory
>>
>>54292790
Pycharm is the best one for python, and if you are in college you get the proffesional edition free for 1 year
>>
>>54292665
anyone remembers when codecademy was good?
no registration, just come to site and you started to code what console told you
>>
>>54292803
how stupid can one be, tried everything except that. Thanks man.

Poorfag using sublime while it's free.
>>
>>54292854
pycharm is free, the community edition at least
>>
>>54292847
It may have been less annoying at one point, but it was always a shitty education platform
>>
>>54292633
Best book for learning x86 assembly?

I already know AVR assembly from a microprocessor class, but looking to learn something more useful. Want something that isn't super expensive or old (no x86 memory segment bullshit; x86 assembly as a compiler would generate for a modern 64-bit system).
>>
Hey guys. I'm really interested in Android app development and I know some Java concepts but where do I learn Android programming from?everyone recommends Thenewboston but its outdated
>>
>>54292869
There's a Google sponsored Udacity course on it that some shill posted about a week ago, but it looked promising.
>>
>>54292854
>Poorfag using sublime while it's free.

—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
B085E65E 2F5F5360 8489D422 FB8FC1AA
93F6323C FD7F7544 3F39C318 D95E6480
FCCC7561 8A4A1741 68FA4223 ADCEDE07
200C25BE DBBC4855 C4CFB774 C5EC138C
0FEC1CEF D9DCECEC D3A5DAD1 01316C36
—— END LICENSE ——
>>
>>54292854
>Thanks man.
No problem. I may be mistaken though. I believe it does that because your main is in manage.py, although if ..accs didn't work, you might be going one level too deep, .accs might work and is better if your import statement is in accs because absolute imports aren't portable
>>
>>54292883
I tried it too but I need to learn git for it. Is it worth it?
>>
What's a decent C++ compiler for Windows? Visual Studio is giving me trouble.
>>
>>54292867
http://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf
>>
>>54292915
Visual Studio
>>
>>54292633
I wish pykids would leave.
>>
>>54292904
git is easy m8, and is absolutely necessary in the modern world
>>
>>54292928
Hmm where do I learn git from,then?
>>
>>54292839
What a clusterfuck. Why do IDEs try to show ever fucking window they have at the same time? I only want two windows up until I need another: the editor and the compiler console. And why don't most IDEs allow you to bring up new windows or switch perspectives using keybinds?

All I really want is a modern vim. Is that so fucking difficult? Every IDE out there today is some kind of windows editor inspired PoS.
>>
>>54292931
https://git-scm.com/book/en/v2
literally on the git website
>>
>>54292889
just installed sublime from the AUR and used this; what difference does it make?
>>
File: git cheat sheet.png (324 KB, 1383x1050) Image search: [Google]
git cheat sheet.png
324 KB, 1383x1050
>>54292931
I think udacity has a course on it too.

I'll post a cheat sheet for it though, and go into detail in my next post
>>
>>54288008
Because the two methods you posted aren't equivalent, and code relying on run time type information is bad practice, and indicates your lack of understanding.

(And your post implies you can't do OOP in C++ without virtual tables and/or templates, which is fucking ridiculous)
>>
>>54292633
Trying to make a checkers game using Python. I have no idea how to make the board
>>
>>54292898
.accs didn't work also, I imported to another app in the project, didn't know django works that way.
>>
>>54292956
>>54292945
Thanks.
Any info for Android learning though?
>>
>>54292954
thats (probably) a license key, without it every 10 or so saves it'll nag you to pay $70 to buy sublime text.

also no more >UNREGISTERED
>>
>>54292920
>Reference manual
How did you expect me to respond? Yes I know most concept in assembly, but AVR is very different from x86. I'd like a more structured approach.
>>
>>54292971
a 2d list
>>
>>54292973
Out of curiousity, can you post the project structure involving where you are importing from, and what you're importing? I think absolute/relative import has different functionality between python versions too
>>
>>54292915
GCC or clang. Download MSYS2 and learn to use pacman.
>>
>>54292954
you will never see popup on save about buying it.. thats all

the license also might be blacklisted in future builds
but since theres not much movement forward it does not really matter

but maybe if your current build works fine you want to backup current package from /var/cache/pacman/pkg/
to someplace safe, so you can always install it whenever...
>>
So I have a simple batch renamer to recursively rename image files and add some padded zeros, but I've noticed that in some situations after sorting the files by their names in the array, they end up like this:

1.png
10.png
100.png
101.png
102.png
...

I understand why this is happening, but is there some simple way to stop this from happening?
>>
>>54292975
>having title bars
Didn't know about the 10 or so saves thing, wow how jewish
I'm not sure I'll be using sublime, vim is a bit more seamless with using gcc/gdb/valgrind etc
>>
>>54292920
This.

>>54292867
>Want something that isn't super expensive or old (no x86 memory segment bullshit; x86 assembly as a compiler would generate for a modern 64-bit system).
Yet, the only pratical point of learning x86 assembly nowadays is to be able to write bootloaders and OS initialization routines... And you'll need to know about real mode and its sweet memory segmentation for that. Otherwise, your knowledge in assembly will be limited to understanding disassembled code better, and that's pretty much all.
>>
>>54292976
Not to mention the instruction set is bloated and only a small subset is actively used by compilers or programmers today. A list of best practices would be nice to have.
>>
>>54293021
Inline assembler in C/C++ and compiler construction. Both of which I'm interested in.
>>
>>54292974
Short term memory problems, huh?
The aforementioned udacity course
>>
File: instantiateNewObject.png (13 KB, 654x156) Image search: [Google]
instantiateNewObject.png
13 KB, 654x156
I decided to try learning Ruby and Ruby on Rails today (I'm a big Perl fan).
the Ruby code in pic related is the same as this JavaScript code, sans the fact that it's dealing with an ORM model, right?
var user = (function(u){
u.name = "David";
u.occupation = "Code Artist";
return u;
})(new User());
>>
>>54293058
ah shit, the pic is wrong. the pic should have been THIS ruby code:
user = User.new do |u|
u.name = "David"
u.occupation = "Code Artist"
end
>>
>>54292998
project:
--app1 #importing here
--app2
--accs
----views #importing a function defined here
>>
>>54293054
Except udacity I mean. How did you learn it?
>>
>>54292474
>>
>>54293081
app1 is a file?
>>
>>54293087
I haven't learned it
>>
http://blog.8thlight.com/micah-martin/2013/05/28/performing-code-katas.html

Has /dpt/ ever seen an artisan coder virtuoso perform a kata?
>>
>>54293092
Math.pow( (1 + monthlyInterestRate), (numberOfYears * 12));

>Enter annual interest rate in percentage: 4.25
>>
>>54293074
>u.new is a method
>u.name is a property

Fuck that shit.
>>
>>54293098
one of djnagos apps, i'm importing to views in it.
drew it clumsy
>>
>>54293092
>>54293121
you need to convert interest rate say you enter 4.25 it needs to be converted to 0.0425 hmmm I wonder how would I do this ;)
>>
Thanks anyway though. Looked at many different places and that's the most recommended one.
>>
>>54293102
This>>54293174 was meant for you.
>>
File: 1460115987647.png (30 KB, 246x200) Image search: [Google]
1460115987647.png
30 KB, 246x200
>>54293121
>>54293142
>I didn't make the percentage entered an actual percentage
I knew my babby eyes weren't catching what they needed to, thanks guys.
>>
>>54293128
Ah you mean you want methods decorated with "()"?
Yeah, I can understand your criticism.
I think it's weird to end blocks with end but I know ruby isn't the first language to do it, and I also think using
| param |
to pass args to blocks/functions is weird, but it works and it isn't distracting me...
... unlike fucking python's sensitive whitespace, no-curlies bullshit
>>
>>54292943
>modern vim

It's called emacs
http://spacemacs.org/
https://github.com/jorgenschaefer/elpy
>>
>>54293217
top
>>
File: scientificpythonecosystemsi.png (91 KB, 603x456) Image search: [Google]
scientificpythonecosystemsi.png
91 KB, 603x456
>>54292633
>pic_related
Learning from the ground up
>>
>>54293217
lel
>>
>>54293128
whats the difference between a method and a property in Kay-style OOP?
both send their message to the receiver (u)
>>
>>54293223
I just got a heck of a lot of cancer.
>>
>>54293223
Still doesn't beat matlab
>>
File: fwdrev.png (79 KB, 1280x974) Image search: [Google]
fwdrev.png
79 KB, 1280x974
Pic related. I have a lot of boolean inputs on this simple function block and it looks very cluttered. I'd like to create struct data type(s) to lessen the number of inputs required to use the block.
What would be the best way to create these structs?
>>
>>54293206
>Ah you mean you want methods decorated with "()"?
Yes, exactly.

It's an immediate clarification on a very important detail.
>>
>>54293223
>90% is C/Fortran/C++ and 10% is actual Python
>>
>Tfw you caught OSTFP posting in /pol/ threads about loving black women
>>
>>54293372
this is exactly why tripfags are cancer.

fuck off
>>
File: ruby_is_a_brony.png (47 KB, 955x497) Image search: [Google]
ruby_is_a_brony.png
47 KB, 955x497
>>54293372
He's literally done that for many months, newfriend.

Just like Ruby being a ponyfag.
>>
>>54292633
Thank you for using a Python image.
>>
>>54293372
whats new? he has posted in these threads about loving his jungle bunnies numerous times
>>
>>54293372

It was never a secret.
>>
File: fizzbuzz of the christ.png (402 KB, 1024x768) Image search: [Google]
fizzbuzz of the christ.png
402 KB, 1024x768
>>54293387
Jesus loves you too
>>
>>54293399
back to /o/ turd
>>
>>54293383
Top kek! I didn't know Ruby was a brony
>>
>>54293327
>It's an immediate clarification on a very important detail.
I'll take it into consideration. I know that a lot of people don't like C++, for example, because it's ambigious what exactly is going on when even operators can be overloaded. You think you're doing simple addition when actually you're calling buttloads of extra code.
>>
>>54293419
>C++
That and silent destruction of data.
>>
>>54293419
>I'll take it into consideration. I know that a lot of people don't like C++, for example, because it's ambigious what exactly is going on when even operators can be overloaded. You think you're doing simple addition when actually you're calling buttloads of extra code.
Only newbies hate expressive functionality. Every modern language is expanding their capabilities in terms of how varied the constructs they can express are
>>
>>54293419
no different than the history of #pragma and gcc

execl("/usr/games/hack", "#pragma", 0); // try to run the game NetHack
execl("/usr/games/rogue", "#pragma", 0); // try to run the game Rogue
// try to run the Tower's of Hanoi simulation in Emacs.
execl("/usr/new/emacs", "-f","hanoi","9","-kill",0);
execl("/usr/local/emacs","-f","hanoi","9","-kill",0); // same as above
fatal("You are in a maze of twisty compiler features, all different");
>>
I am ashamed to know majority of /dpt/ users are degenerates
>>
>>54293453
its only the tripfags, anon.
filter them and all is well
>>
>>54293453
i was going to ask you if x, y and z make me degenerate.
I didn't need to finish writing y before I realized it was an obvious answer.
>>
>>54293453
That's why we try to talk about programming, and not our social interests.

For example, I'm a fairly competent developer and have given many anons here damn good advice.

However, I love loli.

I love all things with loli.

And I'm drunk constantly.
>>
>>54292800
Kys
>>
>>54293488
super degenerate holy shit
>>
>>54292889
Using insecure pgp
>>
File: 1451683513443.gif (2 MB, 400x225) Image search: [Google]
1451683513443.gif
2 MB, 400x225
>>54293453
Is bestiality degenerate?

Horse porn > dog porn
>>
>>54293510
>dae le degenerate xD
>>>/v/
>>
>>54293510
I'm literally drinking at work right now.

Fuck year, Free Beer Fridays.

No loli at work though.

No one IRL can know.
>>
>>54293128
there is no such thing as property in ruby, it's just a method in disguise.

>inb4 :attr_reader attr_writer attr_accessor
they are just metaprogramming functions
>>
>>54293520
Tripfags are the worse time to filter all Tripfags
>>
>Started with python
>Moved to C#, JAVA, Swift.

I fucking love python. It's a beautiful language. Very aesthetic. Swift is a little bit better than the former 2.
>>
>>54293488
Does drinking improve your programming
>>
wikipedia sucks fucking ass at explaining things

why are shadow volumes fill rate intensive, how does the shadow rendering work, what is it that makes them fill rate intensive
>>
>>54293488
The old breed still walk among us, dog bless.
>>
>>54293625
and i'm wondering if using geometry shaders to generate shadow volumes for rendering shadows is appropriate on fill rate limited devices
>>
>>54293585
Yep, C# and Java imo just don't cut it. If you love Python, Swift is almost as expressive, but it has a variety of constructs that give it an edge anyway. A python coworker recommended it to me, and it turned out not to be a meme at all
>>
>>54293537

Are you loli-sim guy?
>>
>>54293656
No.
>>
>>54293537
You should go for therapy it will help. What do you think about Java?
>>
>>54292925
then why do u post in the daily python thread ?
>>
File: ballmer_peak.png (91 KB, 652x592) Image search: [Google]
ballmer_peak.png
91 KB, 652x592
>>54293615
Sort of.

While a meme comic, this image is fairly accurate.

>>54293638
Cracky-chan and the Snacks debacle. I wasn't very old at the time, but I was there.

>>54293700
Java is fine. I prefer the .NET alternative now that pretty much everything is open-source and Xamarin is free.
>>
>>54292790
>typing... is a chore
I have some bad news for you buddy
>>
>>54293650
Yeah you really gain an appreciation for python and it's ease of use for noobs maybe I'm just sentimental because it was my first.

Yeah I just started with swift. Really really really like OSx for developing. Xcode is dreamy af and the iphone simulator makes my loins moist. So fast. I feel like crying when I think of all the time I wasted waiting for my goddam android emulator to start then load then run the app. Why can't windows be that easy.

Why is android studio soooooooooooooooo fucking slow. I have a great computer with ssd 16gb ram and yet it's like a snail's pace.

Then there's the android emulator. Fucking filth.
>>
>>54292790
Spyder is great for python dev.
>>
>>54293778
We're definitely on the same boat, although I've mostly been doing C for 10 years before picking up Python. Even at an advanced level, Python's expressiveness allows you to construct anything you want very easily. I share your sentiment with OS X (although I haven't tried xcode) and Android dev's shittiness. I dropped it in a week
>>
>>54293650
Yeah the same with macs. That turned out to be my "Oh that's not a meme" moment.

Concatenating strings is a bit iffy to me though.
>>
>>54293128
:name is a method too. Ruby is beautiful but slow
>>
>>54293721
>I wasn't very old at the time, but I was there.
Same. To think this is still the same place, y'know?
>>
I'm a cuck send help

~/Projects/Machine_Learning $ sudo pip install pydot2
[sudo] password for anon:
Requirement already satisfied (use --upgrade to upgrade): pydot2 in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): pyparsing in /usr/local/lib/python2.7/dist-packages (from pydot2)
Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/local/lib/python2.7/dist-packages (from pydot2)
Cleaning up...

~/Projects/Machine_Learning $ python iris.py
[0 1 2]
[0 1 2]
Traceback (most recent call last):
File "iris.py", line 20, in <module>
import pydot2
ImportError: No module named 'pydot2'
>>
>>54293886
you sure you're using the right python and environment?
>>
So I want to get into video game hacking one, because I've never done it and think it would be cool as fuck, and two because I know next to nothing about how computer code structure works and I would love to be able to learn it.

I'm on Ubuntu 16.04 and I need to write a kernel level hack for a video game that uses Easy Anti Cheat.

I guess the first thing to do would be to write a piece of code that overlays a small black dot over a certain application while it's running but I don't even see how to clearly do that.

Next how do I even hide it from EAC? Create 3 programs that communicate and use eachother and if one goes down they all do? What's the best way for this?
>>
>>54293217
>spacemacs
is this shit actually good? I'm getting real fed up with vim's bullshit and I want to move to emacs.
>>
>>54294021
I don't use spacemacs myself (I'm too used to my own config to switch), but I tried it out for a couple days, and it's really nice, especially if you are coming from vim.
>>
Anyone care to point me a site or whatever on how to build a probability table?
Better if c/c++ edition.
>>
>tfw you're a degenerate fuck who procrastinates learning to the end of the day
literally wasting time on the internet for no reason, browsing not interesting content while doing it too
>>
>>54294061
Modal editors are god's gift to programmers. Why can't normies deal with them?
>>
File: 1274657531425.jpg (45 KB, 458x319) Image search: [Google]
1274657531425.jpg
45 KB, 458x319
>>54292808
>not using spyder
>>
>>54293935
~/Projects/Machine_Learning $ python3 iris.py
[0 1 2]
[0 1 2]
Traceback (most recent call last):
File "iris.py", line 20, in <module>
import pydot2
ImportError: No module named 'pydot2

as far as i'm aware yes. i think it might be an issue with paths for libraries but I don't know how to fix that or even check where it is searching
>>
I am making a captcha solver in C who wants to contribute?
>>
>>54294178
Why are you calling python3 this time when pydot2 is in python2.7's dist-packages?
>>
>>54294193
#include <stdlib.h>
>>
File: 1449282649568.jpg (272 KB, 1402x1465) Image search: [Google]
1449282649568.jpg
272 KB, 1402x1465
I'm trying to enter protected mode but the machine just gets into a reboot loop, cant figure out why.
Had to use pastebin for some code snippets, post was too long for 4chan.

GDT load function and table:
load_gdt:
lgdt [gdt_desc]
ret

section .data
gdt_desc:
dw 24 ; size
gdt:
dd gdt_table ; offset

gdt_table:
times 8 db 0 ; null entry
times 8 db 0 ; data entry
times 8 db 0 ; code entry


GDT encoding function:
extern uint8_t *gdt;

void regparm encode_gdt_entry(short index, uint32_t base, uint32_t limit, uint16_t flags)
{
flags |= 0x10;

uint64_t entry = 0;

entry |= limit & 0xffff;
entry |= (uint64_t) (base & 0xffff) << 16;
entry |= (uint64_t) ((base >> 16) & 0x80) << 32;
entry |= (uint64_t) (flags & 0xff) << 40;
entry |= (uint64_t) ((limit >> 16) & 0x10) << 48;
entry |= (uint64_t) ((flags >> 8) & 0x10) << 52;
entry |= (uint64_t) ((base >> 24) & 0xff) << 56;

((uint64_t *) gdt)[index * 8] = entry;
}


Entering protected mode:
    enable_a20();

encode_gdt_entry(1, 0x0, 0xffffffff, GDT_RW | GDT_EX | GDT_PR | GDT_SZ);
encode_gdt_entry(2, 0x0, 0xffffffff, GDT_RW | GDT_PR | GDT_SZ);

load_gdt();

asm volatile(
"cli\n"
"mov eax, cr0\n"
"or eax, 1\n"
"mov cr0, eax\n"
"jmp 0x8:pmode_main\n" // problems start to arise here
:
:
: "eax", "cc", "memory"
);


GDT flags:
#define GDT_AC 0x1
#define GDT_RW 0x2
#define GDT_DC 0x4
#define GDT_EX 0x8
#define GDT_PR 0x80
#define GDT_GR 0x100
#define GDT_SZ 0x200


pmode_main:
http://pastebin.com/g21zMQxk

So what am I doing wrong? I cannot figure it out, and I'm not used to debugging kernel programs.
I'm not asking you to debug it, I'm asking someone more experienced with this to point out any obvious or non-obvious mistakes that I'm making.
>>
>>54294193
I'll bring the beer and memes
>>
>>54294227
#include <windows.h>
>>
>>54294225
I was showing that the error occurs regardless of the version.

python2 iris.py
[0 1 2]
[0 1 2]
Traceback (most recent call last):
File "iris.py", line 20, in <module>
import pydot2
ImportError: No module named pydot2
>>
>>54294193
#undef printf
>>
>>54294259
>I was showing that the error occurs regardless of the version.
So pydot2 is also in python3's dist-packages?
>>
>>54294272
no but i'm a dumbass and I have yet to make pydot or pydot2 work.

I recognize that it makes no sense that it would work with python3 but I've been fucking with this for a very long time and i've exhausted a lot of stupid possibilities
>>
If I 'modify' a GPL-licensed code-base by completely obfuscating it to the point of un-usability with my changes included, is that fine?
>>
>>54294241
I just realized I was loading 0x16 into the segments instead of 0x10, however fixing that did not fix the rebooting problem.
>>
>>54294294
Why are you even trying to do a simple ML example (iris) if you can't even figure out how to install a package correctly?

I would just stop and restart cause you're obviously dumb as fuck and shouldn't really be approaching machine learning even if it is baby tier iris examples
>>
>>54292633
I need your opinion, /g/.

Python 2's print is 1000x better than Python 3's print, right?
>>
>>54294375
This.

Learn to make a fucking basic hello world and use packages and libraries before you set out to do advanced concepts.

Walk before you run, etc.
>>
>>54294241
Sounds like you haven't disabled interrupts.
>>
File: cs.jpg (1 MB, 1904x4706) Image search: [Google]
cs.jpg
1 MB, 1904x4706
>>54294376
>what is high-order programming
It's like the new generations are learning nothing at all. You guys are a disgrace to this thread.
>>
>>54294376
Nah.
>>
>>54294399
But I clearly am.
>>
>>54292665
http://ocw.mit.edu/courses/media-arts-and-sciences/mas-771-autism-theory-and-technology-spring-2011/
>>
>>54294408
Dijsktra was a dick tho, should've put Knuth there
>>
>>54294422
Oh yeah, sorry, didn't see it.
>>
>>54294241
use a real language
>>
>>54294453
And what language do you propose I write my bootloader in, huh?
Retard.
>>
>>54294488
rust or assembly
>>
>this is valid C
#include <stdio.h>

main(){
int x = mpow( 5 , 5 );
printf( "%d\n" , x);
return 0;
}

int n,k;
mpow(n,k){
return n*k;
}
>>
File: 1461693492849.jpg (33 KB, 245x389) Image search: [Google]
1461693492849.jpg
33 KB, 245x389
>>54294497
>rust bootloader
>GC bootloader
>>
>>54294497
Can rust compile to 16bit realmode code?
>>
>>54294517
>rust
>gced
wut ?
>>
>>54294390
I have worked in python before. I just haven't had this kind of an issue with a package before.
>>
>>54294518
>Can rust compile to 16bit realmode code?
lel dude we have uefi now, 16bit bootloader is obsolete shit now
>>
File: obliterated by depression.png (65 KB, 161x188) Image search: [Google]
obliterated by depression.png
65 KB, 161x188
>>54294517
holy shit your retarded
>>
>>54294518
Just curious, how do you compile to 16 bit realmode?
Assuming you're using gcc, what params etc?
>>
>>54294569
-m16
>>
>>54294518
http://blog.theincredibleholk.org/blog/2013/11/18/booting-to-rust/
>>
>>54294605
>UEFI
Kill yourself.
>>
>>54292665
it's insane how good the content seems to be in this site, didn't do much in it though, but if it's as good as it looks, that's better than anything i've ever seen.
>>
I have to implement a binary search tree for finding words in an all lower case word bank.

I know my code is goofy... im new

In the main I made 26 trees for each letter of the alphabet, but for some reason only the words that begin with the first letter I call get added to a tree.
why is this?

main.cpp
http://pastebin.com/Nv9zFwGD
dictionaryTree.h
http://pastebin.com/BvCYi3eX

and a list of a-b words for testing
http://pastebin.com/7tDAPRH8
>>
>>54294700
nigga
>>
Anybody got any tips for chronic constipation? I think I'm impacted..
>>
>>54294722
insert your thumb
>>
>>54294722
Kill yourself.
>>
>>54294718
>>54294700

well I fixed it anyway... took less time than it did to write that post.
>>
>>54294722
if you r a woman, you can put a finger in your vagina to push the excrement (not a joke, it's advised by doctors)

if you are a man, medicine or diet (dry fruits rich in fibers)
>>
>>54294528
>>54294548

How does Rust get away with not having a garbage collector?
It's the most garbage filled language out there
>>
>>54294827
because programming language theory is a thing.
>>
>>54294535
Well in your 2nd case, you tried to run a file with python3 that imported a package that isn't in python3's dist-packages

I can only imagine you have no idea which python you were using initially. 'python' could well be referencing python3, it could even be referencing python2.6 or a python2.7 somewhere else.

Stop fucking about
>>
>>54294408
>that pic
>muh sekrit klub of science

>hating based shaw
>>
>>54292665
5 Java points have been deposited into your Oracle account, Thank You
>>
>>54294827
i thought rust had some kind of optional GC? I thought i read that ages ago somewhere... maybe i'm getting mixed up with something else.
>>
anyone with phyx experience?
what would the pxgeometry class for a cone be?

pxconvexmesh? pxtrianglemesh?
>>
>>54294972
>phyx
PhysX*
>>
>>54294931
>i thought rust had some kind of optional GC?

GC doesn't jive with memory safety, my dude.
>>
>>54294972
are there no cylinder primitives? Maybe it only works with meshes?

Probably have to generate a cone mesh yourself, or use a utility library if that's the case.

I know almost nothing about PhysX except that it's a physics engine and that I hate the name.
>>
>>54295037
but... the that's the opposite of true.
>>
>>54294931
https://www.rust-lang.org/faq.html#is-rust-garbage-collected
>>
>>54294733
I think it may be coming to that. Will that even work?

>>54294738
I have a few years left before I need to resort to that.

>>54294816
That's awesome. Can't wait for the next opportunity to offer constipation advise to a female. This should be added to the list of female privilege.
>>
>>54294863
python
python3
python2 all have the same import error for a package that I have installed.
>>
>>54295042
Then we know pretty much the same.

There's only box, capsule, plane and sphere.
Plus height field which is obviously not what I want, and then convex and triangle meshes.

I probably need to use the convex class to generate it. I would use a capsule but the endpoints need different diameters.
>>
File: 1401422575662.jpg (82 KB, 623x527) Image search: [Google]
1401422575662.jpg
82 KB, 623x527
>>54294865
>shaw
>based

His teaching style is absolutely horrible for beginners.

His stuff is only good if you already learned the topic a long time ago and want a quick refresher, and even then there are still better resources.

I mean, just look at this:
https://zedshaw.com/
See the blog article at the top, "Taking Down Tim Hentenaar". Someone criticized Shaw's shitty book (in a really respectful and constructive way), and Shaw here wrote out an entire ad-hominem diatribe; it's really fucking embarrassing, and I felt embarrassed just reading that shit.

I don't know how anyone takes this clown seriously.
>>
>>54295081
Your best bet is to isolate a virtualenv so you know for sure that its pip installs pydot2 with its python, instead of your default global pip installing in location1, but your default global python located in location2. You can have many install locations of the same python version
>>
>>54294844
>programming language theory
https://unqualifiedreservations.wordpress.com/2007/08/02/whats-wrong-with-cs-research/
>>
File: piliersdelademocratie.png (116 KB, 2372x1549) Image search: [Google]
piliersdelademocratie.png
116 KB, 2372x1549
>>54294302
If you can manually obfuscate it into an earthly hell, your superpower will be in the bounds of the license. But the license specifies that source code is "the preferred form for modification", so if you yourself can't even use what you produced, (because you used a tool in my mind) then it's not the actual source code.

also IANAL, just a GNU/fag
>>
Throwing out prototype after prototype for a 3DS homebrew I'm making for an xmas present.
I can't pin-point the 'fun'. The person this is for likes zelda games like Link's Awakening, Oracle of Seasons/Time, and games like the older pokemon and harvest moon.
I just can't capture the charm of any of those games and I'm starting to get bummed out.
>>
Daily reminder to filter tripfags, one of the many cancers of this board. If you're using 4chan X (or any fork of it), just click the arrow next to the post number and select filter -> tripcode. It's that simple.

If you aren't able to filter, then the least you can do is NOT RESPOND to their posts. They live off (You)s and starving them of those will cause them to leave.
>>
File: 1451683583776.gif (2 MB, 400x600) Image search: [Google]
1451683583776.gif
2 MB, 400x600
>>54295253
So naive
>>
>>54295053

Not for their model.
>>
>>54294408
"Coding Then" is still after CS turned to crap.
>>
>>54295153
>One: Guy Steele is a system software designer, not a PL researcher.

Stopped here. Guy Steele wrote the lambda papers, if the lambda paper are not plt then nothing is.
>>
faggots
>>
was python more popular back in version 2.7 or is it just a baseless feeling?
>>
>>54295520
python is still 2.7 from what I can tell. python 3 is effectively a different language because it's not backwards compatible.
>>
>>54295520
Python 3 fixed a lot of the broken functionality of Python 2, making it backwards incompatible. A lot of packages using Python 2 won't work on Python 3 anymore, so it's all sour grapes. People are just lazy.
>>
File: yes.png (44 KB, 461x338) Image search: [Google]
yes.png
44 KB, 461x338
how is xor swap done with floating point values?

pls respond
>>
>>54294865
>based shaw
>based
His writing style is perfect for beginners and he encourages a certain amount of "have faith that this just does as we tell it to right now" but his teaching style is absolutely abysmal. "Search for the answer yourself" is great for people who have already been taught more than just extremely simple conditionals but terrible for beginners aka his target audience.

He falls really short in explaining how OOP works with Python and he never really goes into any kind of brief detail about explaining how things work, leaving brand new programmers who honestly want to learn something short-changed because they can't really do anything except read code. Sure you can call it a springboard but you can also call codeacademy the same thing and that's even more trash.
>>
>>54292790
Sublime text is pretty great. Or just notepad++ is pretty nice too
>>
>>54295579
there's very little different about python 3 from 2.

It's normal for rather large programs to work fine from one type to the next, more so in non mathematical GUI programs
>>
>>54294517
>>54294827
>>54294931

Rust doesn't have any GC, not even an optional one. Rust, like C++, uses RAII. Object comes into scope, constructor is called. Object leaves scope, destructor is called. Everything is deterministic, and memory management is ultimately the job of the programmer.
>>
>>54292915
Install cygwin and get g++. Then use it like you would linux. Also, get apt-cyg for package management.
>>
>>54295767
>Rust, like C++, uses RAII
>Object comes into scope, constructor is called. Object leaves scope, destructor is called.
no, rust has ownership
>>
>>54292931
If you're lazy and have windows, use the githib gui. Its easy, but learn git anyways. Its useful. Gui is good for noobs.
>>
>>54295796

Rust definitely uses RAII.
>>
>>54295747
>It's normal for rather large programs to work fine from one type to the next

Examples? I very much doubt that. Seems like the changed a lot of subtle rules for handling very basic syntax like calling functions. Any modestly large project written for 2 won't compile for 3. Easy to port sure, but it's a pain. There's a reason most langugaes don;t break backwards compatibility when they release new versions, even when there were issues with previous versions.
>>
>>54295830
Ownerships is a generalization of RAII.
>>
C++.
I need to pass a pair<string,vector<int> > and i want to make it on the fly.
I.e. my function has a string argument and i want to do something like

function1(string bla)
{
function2(pair<string,vector<int> >(bla,vector<int>()));
}

but compiler cries.
What's the correct syntax?
>>
>>54293970
Deleting your /bin folder seems to work for me
>>
>>54295905
std::make_pair(bli, bla)
>>
>>54295843
>even when there were issues with previous versions.
You really don't know much about Python2 and what tried to keep it together. Hell, in py3.5, OrderedDicts were 4 to 100x faster in various cases due to it being direcly implemented in C. So many things in py2 were a clusterfuck including the underlying logic which is why py3 came out
>>
>>54295938
I wanted to avoid creating a temporary ~variable~ and then giving it to the function, as p is in your code.
Or is g++ going to be smart enough?
>>
>>54295905

void f1(const std::string& str)
{
std::vector<int> v;
auto p = std::make_pair(str, v);
f2(p);
}
>>
>>54295966
and what is your point exactly?
>>
>>54294193
bool OP_is_a_fag = true;
>>
>>54295905
VS2015
function2({bla, {} })
>>
>>54292665
S H I L L
H
I
L
L
>>
>>54294376
print "abc" vs print ("abc")? I agree anon.
>>
>>54295978

Whether you give a variable a name or not, you were still creating a temporary. Anyways, I deleted my old post because I realized I fucked something up. See >>54295983
>>
>>54292683
>>54292683
you can even do
 from shit import shit as shit


if you use multiple modules with functions that are similary named. If you have the shit and crap modules, and import both as this:


 from shit import shit as shit

 from crap import crap as crap


you can use
shit.turd()
and
  crap.turd()
>>
>>54295905
#include <string>
#include <utility>
#include <vector>

void function2(const std::pair<std::string, std::vector<int>> &p)
{
}

void function1(const std::string &s)
{
function2({s, {}});
}

int main(int, const char **)
{
function1("test");
return 0;
}
>>
>>54295153
tl;dr
>>
What is the point of setters and getters, other than for sanitizing input?

A lot of code examples of setters and getters don't even touch the input. what's the point?
>>
>>54292800
why?
>>
>>54292808
No love for NetBeans?
>>
>>54296165
It's a pajeet meme
>>
>>54296166
Not the one who posted, but there's a lot of underlying stuff that a person should learn that python does automatically. I think that if you want to get your feet wet try out python. Then when you go forward and you want to actually learn programming, go to something like C++ or C
>>
>>54296165

They're awful. Everything should be immutable anyway.
>>
>>54296165
If you dont know, just use public fields. dont fall for cargo cult programing
>>
>>54296165
encapsulation.

>>54296222
mutation is useful sometimes. But i agree, everything should be immutable by default.
>>
>>54296222
You sound like 90's /g/ talking about Java.

>What is the point of free-standing procedures, other than for one-method strategy patterns?

>They're awful. Everything should be in a class anyway.
>>
>>54296292
>encapsulation.
You realize this has been debunked as a meme for over a decade now right?
>>
Can I find something like tryruby.org but for other languages?
>>
>>54296348
>>encapsulation.
>debunked as meme.

How?
>>
>>54296348
kill yourself
>>
>>54295676
You don't. XOR swap is deprecated. If you really must know you do pointer casts.
double d = 123.456;
uint64_t i = *((uint64_t*)&d);
>>
>>54296348
no
>>
>>54296403
Obviously, you've been saying dumb shit this whole thread
>>
>>54296165
as an analogy, when you get your mail at the post office, the clerk gets it for you, the post office doesn't just expose all mail and leave the responsibility to the client to do all the work of finding the right mail and to not mess with other people's mail
>>
>>54296423
Everything I've said is right though.
>>
>>54296424
I don't get mail at the post office, some guy walks by my house and leaves the mail in a mailbox next to my door.

The function should be doing that for me, also.
>>
>>54296450
if it's too big for your mail box or it's signed for you have to go and collect it
>>
>>54296424
Just because encapsulation analogies are rife memes doesn't mean they mean anything in the real world
Thread replies: 255
Thread images: 24

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.