[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: 38
File: 1435753933225.png (481 KB, 811x599) Image search: [Google]
1435753933225.png
481 KB, 811x599
Old thread: >>51640760

What are you working on, /g/?
>>
>>51648078
But releasing the full source with a nice hierarchy of abstraction would allow a new team to get started much faster, and make it easier to fork the project

>>51648221
It isn't, they're probably worried about legal action and/or other people reading their spaghetti code
>>
>>51648676

Where can I learn PowerShell?
>>
Third for Java
>>
>>51648889
try google
>>
I'm working in assembly, and have a working calculator but have no idea how to check for Two's Complement negative numbers. I get the idea that the first sign bit should be F, but I have no idea what to XOR it with to check that its negative.
>>
is it true you need 10,000 hours to become good at something?
>>
File: ants.png (8 KB, 501x496) Image search: [Google]
ants.png
8 KB, 501x496
Virtual antfarm.
Not even close to as exciting as I anticipated.
>>
>>51648908
I'm looking for books or some other specific useful resource
>>
>>51648919
yes
>>
>>51648966
good thing I'm still young and am 21. hopefully by 30 I'll be good.
>>
>>51648653
Which is which?
>>
Would a public field within a private class be accessible only to the parent class? I'm sure that's how it is but I just want someone else to tell me that it is how it is.
>>
>>51648969
3 hours a day should get you there in time
>>
I'm creating a desktop app in c# in visual studio and I have a group box with 6 checkboxes in it. At least four of them have to be ticked to proceed,how do I get the amount of checked boxes within this group box?
>>
>>51648997
count them
>>
>>51648969
>>51648988
10000 hours / 3 hours/day
=
3334~ days
=
9.13 years

trust this guy
>>
File: boggle_bot_2.webm (447 KB, 944x1056) Image search: [Google]
boggle_bot_2.webm
447 KB, 944x1056
Changed by Boggle bot to use a generator instead of storing discovered words in a list and then entering them.
>>
File: hqdefault.jpg (11 KB, 480x360) Image search: [Google]
hqdefault.jpg
11 KB, 480x360
>>51649056
>>
File: code for neural network.png (62 KB, 838x1108) Image search: [Google]
code for neural network.png
62 KB, 838x1108
I have an assignment to implement drop-out into a neural network that the teacher made. He wants drop-out to be implemented as a class, but the idea to me seems like it would be much better to use a function?
e.g. a function that takes as arguments the matrix of entries of the hidden layer and the probability that an entry is reduced to zero.

but the specification calls for a class in particular.

Should I just make it a class with a single method that works like a function?
I've seen very succinct examples of drop-out but he wants a drop-out that applies a 20% drop-out to the initial input and 50% drop-out to all the hidden layers so I can't use those ultra-succinct ones.

I probably sound like a retard but I have never used python before a couple of weeks ago and aside from that only done small assignments in R and java.
I don't really understand "self" and am much more happy with how in java you declare whether things are ints or arrays or what have you.
>>
>>51648793
shitpaws belong in the trash
>>
File: a ruff victory.jpg (65 KB, 500x368) Image search: [Google]
a ruff victory.jpg
65 KB, 500x368
>>51649092
This.
Ruff victory reporting in.
>>
>>51648919

Not exactly. To be a professional that's (maybe) a decent ballpark number to go by but you should be good/above average/competent at a much earlier point IMO.
>>
Is there any performance differences between using a meme library and not?

What is the performance difference between using Boost libraries and Winapi to do similar things?
>>
File: quite a ruff victory.jpg (46 KB, 653x510) Image search: [Google]
quite a ruff victory.jpg
46 KB, 653x510
>>51649154
>>
>>51648997
Here's a super shitty way to do it that works.

public static int CountYourDumbassCheckboxes()
{
int countOfYourDumbassCheckboxes = 0;

if (cbx1.IsChecked)
{
countOfYourDumbassCheckboxes++;
}
if (cbx2.IsChecked)
{
countOfYourDumbassCheckboxes++;
}
if (cbx3.IsChecked)
{
countOfYourDumbassCheckboxes++;
}
if (cbx4.IsChecked)
{
countOfYourDumbassCheckboxes++;
}
if (cbx5.IsChecked)
{
countOfYourDumbassCheckboxes++;
}
if (cbx6.IsChecked)
{
countOfYourDumbassCheckboxes++;
}
}


//elsewhere in your code...
if (CountYourDumbassCheckboxes() >= 4)
{
//do thing
}
>>
>>51648997
Whenever a checkbox is ticked, increment a number you have somewhere, is how I'd do it.
Then just check if that number is bigger than X.
>>
File: ruff victory.jpg (58 KB, 620x465) Image search: [Google]
ruff victory.jpg
58 KB, 620x465
>>51649185
lol. why not just ++ when a box is checked, and -- when unchecked?
>>
>>51648793
anyone have any ideas how to sort files by last modified on a USB? Downloaded even few programs which ought to properly do it. Issue is that every time I add a new song, it doesn't go to first place, but ends up somewhere in the end instead.
Or to make this programmig related, and idea how to make a script which sorts them and puts them in order suitable for FAT32?
>>
>>51649210
Also a valid way to do it.

Honestly, there's like 7 different ways you could accomplish this. Really just depends on how you like to document the thing happening. The performance for these things are negligible.
>>
Netbeans or Eclipse?
>>
>>51649389
Vim
>>
>>51649154
Well family?
>>
>>51649427
>>51649118
Cats are infinitely better than dogs tá Žbh faá Žm
>>
>>51649493
Wasn't even my post but no they're not.

Cats give you toxoplasmosis which is fucked. That's why dogs hate cats so much, they're trying to defend their owners from the brain parasite that cats give them.

Truly man's best friend.
>>
>>51649493
>>51649518
Oh my god don't you fuckers start this again
>>
>>51649518
>Cats give you toxoplasmosis

>If you're generally healthy, your immune system keeps the parasites in check. They remain in your body in an inactive state, providing you with lifelong immunity so that you can't become infected with the parasite again

Based cats giving us natural parasite vaccines.
>>
first
>>
File: 1435640087389.png (345 KB, 498x568) Image search: [Google]
1435640087389.png
345 KB, 498x568
retoasting

I'm trying to make an IRC bot that announces information grabbed from a website, but I've never done anything that grabs information from websites, can someone point me to resources in how to do it?

using C#
>>
>The realization that PHP has managed to outlast Ruby, Python, Node.js and Groovy
I wonder if it'll survive Go?
>>
>>51649565
>>If you're generally healthy, your immune system keeps the parasites in check. They remain in your body in an inactive state, providing you with lifelong immunity so that you can't become infected with the parasite again

Except that it's been known to cause complications in people and most effects aren't even well known but it's suggested that it affects your cognitive function among other things.
>>
File: smartneko.webm (2 MB, 720x404) Image search: [Google]
smartneko.webm
2 MB, 720x404
Ask your beloved programming literate anything.
>>
>>51649605
does anyone actually use Groovy? Is it gaining popularity or losing it?
>>
>>51649602
The best thing to do is use APIs.

Alternatively, you can scrape the HTML. There are some built-in tools to do this.

http://www.dotnetperls.com/scraping-html.
>>
File: images.jpg (16 KB, 321x400) Image search: [Google]
images.jpg
16 KB, 321x400
Reading pic related, page 111 atm and hopefully from now on i'll see less obvious shit from this book.
>>
>>51649649
That looks like my kitty :3
>>
>>51649661
Not any more, but it was popular for quite some time, It's still in common use around Android though.
>>
I'm learning Python, and I just recently started getting into classes. One thing that perplexes me is why would you have to write out each variable when you're assigning them to the class.
class Point3D(object):
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z

Anyone with decent Python knowledge, is there a way to iterate through x, y, and z without having to type it out like that every single time you create a class? Of course, assuming that self.x = x, self.y = y, etc.
>>
>>51649645
Based cats improving my focus and eliminating my psychotic tendencies with wonderful brain affecting parasites.
>>
When I use snippets on xcode with placeholders, why won't it replace all placeholders with the same name when I fill one of them out?

This really makes them almost useless to me.
Is there a plugin or a setting that fixes this?
I'm really thinking about using Visual Studio on Windows for this alone.
>>
Post programming challanges
>>
>>51649691
>Based cats improving my focus and eliminating my psychotic tendencies with wonderful brain affecting parasites

>Improving focus

More like harming focus. And giving you psychotic tendencies. It probably lowers your IQ as well because all catfags are retarded women.
>>
File: 1439061543070.jpg (162 KB, 1920x1080) Image search: [Google]
1439061543070.jpg
162 KB, 1920x1080
>>51649661
>Groovy
Java OpenJDK:                   1.189619693 seconds time elapsed
Scala: 1.484613540 seconds time elapsed
Scheme Gambit: 1.932229635 seconds time elapsed
Crystal: 3.034363672 seconds time elapsed
Groovy: 19.214711418 seconds time elapsed
>>
>>51649736
Based cats helping me in my goal to become the cute girl.
>>
>>51649740
code?
>>
>>51649734
Accept a Wikipedia URL as a string.

Program serves up a modified HTML and opens a web browser with all links replaced with related porn videos.
>>
What are some good games for practice creating intelligent agents?
No checkers or wumpus world
>>
>>51649780
That would be fun but I don't web dev
>>
>>51649781
what kind of games you into?
>>
>>51649781
Chess if you're autistic.

Maybe Battleship.

Research fuzzy logic.
>>
I wrote a function to check if an array is sorted:

pub fn is_sorted<T: Ord>(list: &[T]) -> bool {
match list.is_empty() {
true => true,
false => list.iter()
.zip(&list[1..])
.all(|(left, right)| left < right)
}
}


Iterator adapters are pretty neat.
>>
>>51649795
Has nothing to do with web dev. You could do this with a scrape in a console app.

It's a practice in straight string replacement, as well as pulling in information via API and web scraping.

Actually very valuable skills to have as a non-web dev.
>>
>>51649798
Cosmic Encounter, but that seems too complex given my current experience with AI development
>>
>>51649781
4 in a row.
>>
File: umaru.jpg (282 KB, 640x961) Image search: [Google]
umaru.jpg
282 KB, 640x961
>>51649686
class Point3D(object):
def __init__(self, **args):
self.__dict__.update(args)

p = Point3D(x=1,y=2,z=3)
print(p.x, p.y, p.z)
>>
>>51649818
I like the way that looks.

My offering:
bool isSorted = source.Zip(source.Skip(1),(a,b)=>b>=a).All(x=>x);
>>
>>51649086
I would just do what the teach wants. Not a big deal.
>>
>>51648793
Learning to program AVRs
Fun as fuck
>>
>>51649937
I didn't know people actually used geany
>>
>>51649665
aight figured out I need API and xml parser, cheers
>>
>>51649781
http://ai.berkeley.edu/project_overview.html
>>
>>51649964
Is the API public? I can help you with doing that really easily in Visual Studio.

There's a tool that accepts the API URI and spits out autogenerated classes and methods.
>>
>>51649649
That's an awesome idea for a project..
>>
File: a mighty ruff victory.jpg (55 KB, 540x292) Image search: [Google]
a mighty ruff victory.jpg
55 KB, 540x292
>>51649493
SHITPAWS!
HITPAWS!S
ITPAWS!SH
TPAWS!SHI
PAWS!SHIT
AWS!SHITP
WS!SHITPA
S!SHITPAW
!SHITPAWS
SHITPAWS!

>2015
>not fighting towards a ruff victory
>>
>>51649979
https://fumbbl.com/help:Fumbbl+API

the API only gives examples, it has no documentation and I don't know if there's more things you can do than the listed examples but I'm still interested in seeing this visual studio thing
>>
>>51649955
My machine is too shit to support anything heavier
Plus its pretty simple to use and straightforward
>>
>>51650047
>vim is heavier than geany
?
>>
what are some nice APIs to play with
>>
>>51649857
Thanks for the reply. That does look a lot quicker to go through than writing each one out.
I was thinking you could also add a __repr__() method that returns (p.x, p.y, p.z)

So all you would have to do is
print p

and it would print your x,y,z values
>>
Quick anon! The python genie will kill and rape your waifu if you don't say something reeeeal nice about python!
>>
>>51650083
OpenGL
>>
>>51650083
Winapi
>>
>>51650083
winAPI
>>
>>51650083
winapi
>>
>>51650083
WINapi
>>
>>51650104
>>51650106
>>51650113
samefag
>>
>>51650135
not even lmao
>>
>>51649185
consider learning about arrays
>>
>>51650076
Vim is a text editor, geany is an ide, the learning curve puts me off, plus i like these buttons to compile/run/build. I can add more configurable ones too
>>
>>51650083
JAF
>>
>>51650083
Direct2D
>>
>>51650104
>>51650106
>>51650113
>>51650133
These btw senpai.
>>
File: xmlclassautogen.png (36 KB, 739x1292) Image search: [Google]
xmlclassautogen.png
36 KB, 739x1292
>>51650020
So that site doesn't have a web service, so you can't use the soap generator.

What you CAN do, is autogenerate classes based on a copy/paste of the XML.

For example, open the first XML example. Copy the XML.

In visual studio, create a new class and put your cursor where you want this class to go.

EDIT -> Paste Special -> Paste XML as Classes.

If all goes well, you should end up with multiple classes like pic related.
>>
>>51650083
windows universal api
>>
this might be more sys admin related but what's the best way to remotely execute a program on another computer, i'm trying to get my raspberry pi to open programs on my computer

what i've done so far is set up a ssh server on my windows machine and i've tried using psexec which works mostly well for the first part, but 1: i have to make myself admin to launch programs in the current user session and 2: authenticating over the network takes like 5 extra seconds and is really slow

should i try to figure out if i've done something wrong with psexec or do you guys know of better ways to do it
>>
>>51650142
Consider learning about deez nutz.

I suppose you could add them to a list and iterate with a foreach statement.
>>
>>51650187
>2015
>xml
>>
File: shitbucket.png (94 KB, 678x942) Image search: [Google]
shitbucket.png
94 KB, 678x942
I knew it.
I knew I should be hosting my own Git repos.
Now I can't access my shit.
>>
>>51648952
if you do real graphics it may be more exciting
>>
>>51650219
Nigger, did you even read the thread?

He's pulling from a website that only serves XML as its APIs.
>>
File: 1429013252170.png (1 MB, 665x1182) Image search: [Google]
1429013252170.png
1 MB, 665x1182
>>51650187
this is amazing, thank you senpai you've shown me the light
>>
>>51650230
I'm at work right now, but I was thinking about throwing together some SDL when I got home. Would be able to have a larger environment as well.
>>
>>51650232
I only read "XML"
>>
>>51650224
lel, you use shithub/shitbucket as a backup for your shit
>>
Probably just some socks and a jumper because my parents are quite poor.
>>
>>51650238
I like helping people with things.

Bonus points if you use something like Resharper or CodeMaid to make the output readable.

You should now be able to create objects from those classes and then read in values as properties from raw XML data using various methods.

I haven't done that part before, but I do have methods for reading in JSON content...doubt they'd be useful for you though.
>>
>>51650240
would allow you to have much bigger antfarms as well (as it'd be on a pixel level rather than character)
what did you use in regards to ant behavior?
>>
>>51650187
>XML
JSON.NET is the only way anon
>>
>>51650224
why not make your project on github?
too autistic to put your work on public?
>>
>>51650278
see
>>51650232
>>
>>51650149
Not the guy from before, but you could just implement a Compile/Run keybinding for vim in vimscript (or just get a plugin if you're really lazy). I have mine hooked up to tmux, so it automatically opens a new terminal for the output.
>>
>>51650149
Makefiles
Vim isn't hard to learn, it just takes long to master
>>
>>51650265
I didn't even know these things existed I'm getting euphoric here
>>
>>51650240
50% chance to chomp, otherwise they just move. Random directions are chosen. I plan on adding in attacking other ants too, and making it so they can't just jump up in the air (I had envisioned it as you're looking at an actual ant farm, not top-down).
>>
File: 22r.png (534 KB, 640x480) Image search: [Google]
22r.png
534 KB, 640x480
13ms for pic related. Am I good, /g/?
>>
>>51650275
>>51650345 meant for you but I replied to myself because I'm a smart cookie.
>>
PROJECT IDEAS GIVE
>>
>>51650392
Using OpenCV bro? I have a book on it lying around, is it worth learning?
>>
>>51650413
Program a robot to throw things at fat people as they walk by.
>>
>>51650413
https://better-dpt-roll.github.io
>>
>>51650413
a meme generating AI
>>
>>51650392
mediocre
>>
>>51650413
do this: >>51649780
>>
File: IMG_20151202_115334~2.jpg (1 MB, 4108x1952) Image search: [Google]
IMG_20151202_115334~2.jpg
1 MB, 4108x1952
Rate my /bookshelf/
>>
>>51650413
A proof assistant, based either on HOL or a type theory of your choosing.
>>
File: itwerks.png (13 KB, 1053x183) Image search: [Google]
itwerks.png
13 KB, 1053x183
>>51648793
multitasking between work and a personal project

PS:
is there a better way to do this?
>>
>>51650453
memeshelf/10
>>
>>51650453
>programming books
Wasted space for manga senpai.
>>
>>51650421
Yes. Well, it's fun, but the imprecision of computer vision may frustrate you.
>>
>>51650466
But I don't have sicp or fractals
>>
>>51650453
Where's SICP? I can't see it
>>
>>51650453
cancer/10
>>
>>51650497
I ordered it on Monday actually
>>
>>51650453
A bit IT-centric? I don't see any CS books either but it appears you do web dev mostly so they might not be necessary.
>>
>>51650507
Give it its own shelf
>>
>>51650517
>>51650507
A shelf in the trash.
>>
>>51648793
What manga is this?
>>
>>51650517
It won't be leaving my desk I'm guessing

>>51650510
Yeah I picked up a lot of It books from a friend but I have since changed my interest
>>
>>51648793
currently reading up for my MIS exam family
>>
>>51650465
make a function
this code is unreadable and unmaintainable
>>
>>51650429
project, not exercise
something with a purpose
there are very few of those on that site and are either too difficult or bore
>>
File: 1448909270335.jpg (336 KB, 1200x882) Image search: [Google]
1448909270335.jpg
336 KB, 1200x882
How to program a simple proxy server using sockets? Links are welcome.
>>
>>51648793
Why do these anime girls want to ruin my life with math and programming? So hard to say no.
>>
>>51650545
what if it's in a function?

is it really better to have 20 lines of if/else than 3 lines with tenary?
>>
>>51650572
these anime girls are your friends, they what is best for you so you can become honorable and manly.
>>
>>51650593
I suck at math. I like to visualize concepts and events. Numbers do nothing for me, they are lifeless, colorless and have no visual element for me to comprehend.
>>
Working on the foundation for my rhythm game server.
There are three entities: server, group and game. They are stored in a tree structure. On top the server. Below that, groups. The leaves are players. The entities communicatie by sending messages to the parent or child. Each entity picks up the message in its event loop. This way I do not need to use mutexes. At least that is the plan...
>>
File: thatsgoldregardsgoldman.jpg (58 KB, 600x656) Image search: [Google]
thatsgoldregardsgoldman.jpg
58 KB, 600x656
Does it make sense to really create traditional client applications anymore?

Wondering if my lightweight jira/bugzilla replacement should be just a web "app" (page) or a regular program..
>>
I have a .exe of a particle simulator. It's very simple, likely only 50 lines or so, and written in C#. Is there a way to disassemble the .exe and end up with C# code I can look at?
>>
>>51650629
>replacing a with based app with a desktop app that does the same thing
Sounds a lot less useful desu
>>
>>51650656
http://ilspy.net/
>>
>>51650619
then git gud. assuming you have average intelligence, you have no excuse to become good at math.
>>
Hey /dpt/ I'm trying to write a script that asks for a list of numbers and returns the median of that list.
def median(n):
num = sorted(n)
length = len(num)
if length % 2 == 0:
return (num[length/2] + num[length/2-1])/2.0
else:
return num[length/2]

how_many = raw_input('How many numbers?')
for i in range(int(how_many)):
new_list = []
number = raw_input('Enter number:')
new_list.append(int(number))

print median(new_list)

It keeps returning the highest number of the list. I know the function works because when I manually put in a list of numbers it returns the correct answer.
What am I doing wrong with my list?
>>
>>51650674

I've tried this and get "// This file does not contain a managed assembly.".
>>
>>51650687
I always outperformed everyone in my high school years. Now I can't read a book without pictures and color without wanting to kill myself.

I think I have assburgers since childhood, I just don't know it.
>>
>>51650702
If you actually do have burgers, you should have above average intelligence. You really have no excuse to not be capable of getting good at math. You just don't study properly.
>>
>>51650700
https://www.jetbrains.com/decompiler/
>>
>>51650541
"structure and interpretation of computer programs"
>>
>>51650625
what kind of rhythm game
>>
File: 1426857463440s.jpg (10 KB, 250x242) Image search: [Google]
1426857463440s.jpg
10 KB, 250x242
I am a mentor for a github patchwork event that'll take place tomorrow at Paris.

I just remembered that github went full SJW and applied their code of conduct to their events.

Is it very likely that I'll be charged with assault by ruby web devs if I utter the 'fork' word or should I just kill myself?

I've read the outline, and it seems like I'll only have to teach how to use github from the web interface (not even git from the command line). What the fuck.
>>
>>51650581
3 lines of ugly code vs 6 lines of sane code
>>
>>51648914
I'm still trying to figure out a way to identify if a number is negative. I tried dividing by 10000000 to isolate the first digit and compare it with F but the computer just interpreted it as -1/2147483648 and returned 0.
>>
>>51650699
anyone?
>>
I wrote a program in my silly toy interpreted language to print random real words in order to spur my imagination to come up with a project idea

one good one was 'allocating shrimps'
>>
>what is the best language to do x in?
The answer is always C.
Prove me wrong.

Protip: You can't.
>>
>>51650801
Just & it with -1. You get zero if the number is positive, non-zero if it isn't.
>>
>>51650755
>Is it very likely that I'll be charged with assault by ruby web devs if I utter the 'fork' word or should I just kill myself?
Bring a book about C and hit them with it as you yell "REPENT SINNERS! REPENT!"
>>
>>51650840
I'm currently learning C as my first language. I'm very excited because I know I'm going to learn a lot and be great at this someday.
>>
>>51650755
Just use "fork" and if anyone talks shit stare at them blankly.
>>
>>51650847
My language is actually the opposite (If statements trigger on 0 instead of 1) so would I just XOR it with -1 instead?
>>
>>51648914
You have to do an and with 0x80000000 (32 bit integers) and check if it's 0.
If you use F, you get a whole nibble, which is not what you want.

lrn2hex
>>
>>51650858
looking someone in the eyes is a microaggression you white male scum.
>>
>>51650869
>0x80000000
Sorry, what's the x mean? I haven't worked in Hex before so to my knowledge, it was just 0-F
>>
>>51650827
Try inputting your list with the smallest number last, and then try it with it first.
>>
>>51650894
Just a prefix, ignore it if you want.
>>
>>51650894
A number starting with "0x" just means that the number is a hex number. It's like "1001010b" for binary, and "018" for octal.
>>
>>51650867
No, just add 1 to it. So it becomes 1 + (x & -1).
In this case 0 means negative, 1 means positive.
>>
>>51650911
>8
>octal
you get my point, though
>>
>>51650840
>what is the best language make shit, slow code in?
>what is the best language to do bad programming practices in?

proved you wrong now give me that small loan of a million memes.
>>
>>51650699
>new_list = []
move this outside the loop, you keep emptying the list so you always end up only with the last value
>>
>>51650927
But that's right, you didn't prove anyone wrong.
>>
>>51650840
>concurrency
>web dev
>gui
>anything
C is one of the most disgusting programming language ever made. Even its author was ashamed of it when talking about it.
>>
>>51650878
>France
He ain't white
>>
>>51650944
>C
>slow
>bad programming practices

are you high or retarded
>>
File: hvEnMpK.png (114 KB, 966x711) Image search: [Google]
hvEnMpK.png
114 KB, 966x711
>It's done clientside
>>
>>51650902
>>51650911
I've never seen that before, thanks for letting me know. One of my main issues is stated here >>51650867 so I'm wondering, you guys say AND but would I have to XOR it since XOR means not equal?

>>51650918
AFAIK I can't actually do that since it doesn't check the accumulator value, but the overflow bit since that's the output whenever I do AND/XOR/OR (I don't have anything that includes a NOT).
>>
>>51650953
>>51650927
idiots
>>
>>51650970
If your assembly branches on 0, just change your logic.
>>
>>51650953
C is for systems, and systems are for me
C can be used for a lot of things~
You can do anything with C! You can make games in C very easily. Since every GUI library is hell to use, you can embrace the NIH and make your own! It's fun!
>>
>>51650942
THANK YOU
>>
>>51650840
Quick, I need a website hosted on our IIS box to serve out a simple page that asks for a ticket number, and then displays the ticket's information from a SQL query.
>>
>>51649211
pedos and other pet tards halp.
>>
>>51651049
Oh, and it needs to be done by EOD today.
>>
>>51651049
gl hf
>>
How useful is JavaFX?
>>
>>51650982
>>51650970
Actually, now that I'm thinking about it, I'm still confused as to why I'm supposed to AND 80000000 (or in my case XOR).

My sign bit is F for a negative number, 0 for a non-negative (input is 4 decimal digits, and the output never exceeds 8 decimal digits). So wouldn't I want to XOR F0000000 (or FFFFFFFF since another anon suggested -1) instead of 80000000? If so, how would this work since the overflow bit (result of XOR for my CPU) would only be 0 if XOR'd against something exactly F0000000 (or FFFFFFFF)
>>
>>51651113
F is not a bit.
It's 4 bits.

Can you post a sample of the code, or name the assembly langage you're working with ?
>>
>>51650751
StepMania like.
>>
>>51651141
Are you the dude I sent the stepfiles to?
>>
>>51651130
It's a custom made assembly language by my university.

I don't know what you mean by sample of the code. If you mean the code for the computer, it's been compiled for us since I guess he didn't want us looking at it.
>>
Is it possible to learn a decent amount of programming by looking through existing codes/programs while occasionally looking up certain features of them?
>>
>>51651175

Why not read a book?
>>
>>51651167
I'm talking about the code you're writing.
Are you this dense, in real life ?
>>
got a super easy project idea but its something to do
one of those mind map programs
like you place circles and rectangles
and can have arrows going to and fro
and you can put text on the arrows and shapes
i could probably do it in a day or two if i have enough time
my other option is allocating shrimps


>>51651175
if you're starting from nothing, no
if you have already read a book, yes
>>
>>51651183
>>51651192
Interesting.
>>
>>51651192
I suggest allocating the shrimp.
>>
>>51651162
Yes, I am. I got the .sm parser working in C++, but I wanted to learn Go. So I decided to start working on a client server based rhythm game.
>>
>>51651240
D:
>>
>>51650962
I think he's saying that even if you wanted to purposely make something bad you should use c
>>
>>51651345
Don't speak for me, rude prick.
>>
If I read a programming book will I understand it? I'm worried that I won't. I'm worried that I'll read one and it'll hit me that I can't learn to program like I've always wanted and I think that scares me off from starting one. I even have a few downloaded. I'm 10% or more done with several courses on Codecademy. I don't know what the fuck my problem is.
>>
>>51651184
INP opsys
MUL en
STA xn
LDA x0
ADD x1
ADD x2
ADD x3
STA x

Note: This isn't actually what the code looks like, I'm just condensing it so I'm not posting 500 lines of garbage. I'm taking inputs for each digit, x3x2x1x0 of a number (xn is one number), where n is that digit, then multiplying that input by an exponent (10^n).

After that, I add all the calculated inputs together so x = sum(xn*10^n) for n <= 3 and that gives me my number x. If the user wants a negative number (that's a separate input for which I do:)

INP opsys
XOR csub
BZE negnumber


Where csub = I 45 (Integer 45, the ASCII value for a dash, or the negative symbol) and BZE branches to the method that calculates a negative number that looks like:

LDA c0
SUB x
STA x

c0 is just the number 0 and from looking in the memory, I do get my intended result stored in x, which is F followed by any 7 bits (a negative number).

My question is, how would I tell if a number is negative? (for example if the user inputs a positive number but subtracts a larger positive number) My original idea was >>51650801 since I thought F......./10000000 = F (where . can be any number but I obviously didn't use that in my code, this is just for representation, since decimals get truncated) but as it turned out, it interpreted FFFFFFFF as -1 instead of the hex number FFFFFFFF.
>>
>>51651358
I wasn't, read it a little more carefully please

I was sharing my interpretation of what you said with another anon, frankly you're the one being rude.
>>
>>51651379
Your interpretation wasn't needed or wanted by anyone involved.
>>
>>51651363
Stop being such a dumb faggot and try it.

You might surprise yourself with how easy it is.
>>
>>51651363
>If I read a programming book will I understand it?
How the fuck do you expect us to know?

> I'm worried that I'll read one and it'll hit me that I can't learn to program like I've always wanted and I think that scares me off from starting one.
Better to find that out now instead of wasting more time on it, then. Also, don't be a little bitch and never open a book because if so you're guaranteeing you won't get better.

> I'm 10% or more done with several courses on Codecademy.
Wow, anon. Impressive.
>>
>>51651404
That's irrelevant.
>>
>>51651363
Try it. Right now. OP's pic is available free online.

https://mitpress.mit.edu/sicp/full-text/book/book.html
>>
>>51651417
>Wow, anon. Impressive.
No, no. I am NOT bragging. The opposite. I was listing that as something similar to not starting a book. I couldn't even finish a course. I never even necessarily got stuck. Just slowly stopped doing it. When I'd go back it felt like I forgot most of it, but even then it's not like I wasn't able to progress at all if I tried hard enough.

I guess I just want motivation advice, except from people who actually program instead of someone in general.
>>
>>51651422
It's not to me.
>>
>>51651363
Get a new attitude. "I'm scared I won't get it :^(( but I tried some on Codecademy :'))" sounds pathetic. Just open a damn book and commit yourself to getting to the end of it in a reasonable amount of time.
>>
>>51651428
Well I was looking into learning C or Java and I've heard that SICP is tough first book, but if you read my post and still thought I should read it, sure. I'll do it. Thanks.
>>
>>51651441
I'm sorry I hurt you, anon. I don't think I could've seen this coming, but that doesn't mean I'm without regret. I hope we can move past this. I feel our bound is close and we shouldn't be fighting.
>>
File: c_primer_plus.jpg (23 KB, 389x499) Image search: [Google]
c_primer_plus.jpg
23 KB, 389x499
>>51651448
Why read SICP if you want to learn C?
Read this.
>>
>>51651468
If your dick's <5 inches I'll forgive you.
>>
>>51651448
My main point was that you should just jump in and try it. I mentioned SICP because it was in the OP post and I knew it was online, but I don't really have a personal opinion on what you should start with.
>>
>>51651371
Post the entire instruction set.

From what I gather, your calculator doesn't work directly with number, but string representations of these numbers ? So basically you have to write an atoi function ?
>>
Added shitty little gravity function to my ant farm
>>
File: ss+(2015-12-02+at+02.10.31).png (59 KB, 640x706) Image search: [Google]
ss+(2015-12-02+at+02.10.31).png
59 KB, 640x706
>>51651586
My calculator works with numbers, I forgot to mention in my code >>51651371 that I subtract 30 in hexadecimal from every INP to convert it from ASCII value to the actual numerical value.
>>
File: ants.png (6 KB, 490x473) Image search: [Google]
ants.png
6 KB, 490x473
Forgot pic
>>
Im making a board game (go,reversi,checkers,etc. ). Can one instance of an object be placed more than one arrays/lists/datastructures?

Because i want to track the number of tokens a player has with each player having their own tokencollection<Token> while letting the board administer its own array of tokens. So if on cell [0,2] there is a token by player one, that token should also appear in player 1's tokencollection<>.

Or is it bad OOP pattern design to let each player have their tokencollection? Its relatively easy to track them in the board array anway. I can also just give each Token an "owner" membervariable.

Is this redundant what im trying to do with this extra tokencollection<> per player?

its c# by the way
>>
>>51651470
Ah, that's one I've got downloaded. I'll do that then.
>>
>>51651670
>Can one instance of an object be placed more than one arrays/lists/datastructures?
Yes. You'd have to store the reference in the list, not the value.
>>
>>51651670
>Can one instance of an object be placed more than one arrays/lists/datastructures?
Yes, after all you're storing references to the instance, not the instance itself.

Why not add an owner variable to the token object and have the board manage all of them?

Also, is it server-client based or just client based?
>>
>>51649493
>owning an animal that doesn't care if you live or die

baka
>>
>>51651670
>I can also just give each Token an "owner" membervariable.
This is probably better, due to stuff like in Checkers when you reach the end.
>>
File: hw problem.png (37 KB, 1887x222) Image search: [Google]
hw problem.png
37 KB, 1887x222
can someone help me understand what this is telling me to do?
>>
>>51651814
That's what makes them so wonderful.
>>
Anyone know why my program prints one extra line? I'm trying to solve part 1 of this http://adventofcode.com/day/2

#include <stdio.h>
#include <stdlib.h>

int main(void)
{
FILE *input; /* input file */
int c = 1; /* table counter */
int i; /* side counter */
int l = 0, w = 0, h = 0; /* dimensions */
int total = 0; /* total area */
int extra = 0; /* extra area */
int sides[2]; /* sides */
int area = 0; /* area */

/* open file */
input = fopen("in/input","r"); /* this is the path to my input file */
if (input == NULL) {
exit(1);
}

/* begin reading file */
while (!feof(input)) {
if (fscanf(input,"%dx%dx%d",&l,&w,&h)) {
sides[0] = 2*h*l; sides[1] = 2*l*w; sides[2] = 2*w*h;
extra = sides[0]; /* smallest side */
for (i = 0; i <= 2; i++) {
if (sides[i] < extra) {
extra = sides[i];
}
}
extra /= 2;
area = sides[0] + sides[1] + sides[2];
total = total + area + extra;
printf("[%4d] a %4d | e %3d | t %7d\n",c,area,extra,total);
} else {
exit(1);
}
c++;
}

/* print area and exit */
printf("\narea: %d\n",total);
fclose(input);
return 0;
}
>>
>>51651926
Count the number of each character in a file. C'mon senpai I've had much worse I've figured out.
>>
>>51651926
Read in a file.

Look at each character. For each character, add a 'point' to that character's index in the array.

Initialized an array that stores 256 integers.

Say we only had a-e.

After the characters
aabbbceee


we would have
[2,3,1,0,4]
>>
>>51651793
How do you store such reference in a list? How do you refer to an instance in c#?

>>51651808
I already have an owner variable, and this is just client side only.

>>51651922
For now it's the easiest way yeah.

thx all.
>>
>>51649086
that code suck, seriously... correct with pep8 or flake8 at first
>>
>>51651976
Well, nevermind, I was just missing a newline character on the fscanf.
>>
>>51652056
>How do you store such reference in a list? How do you refer to an instance in c#?
I'm no C# wizard, but I can give you a Java example. I'm sure it's basically the same.
Token blackGuy = new Token();
List<Token> t1 = new ArrayList<>();
List<Token> t2 = new ArrayList<>();
t1.add(blackGuy);
t2.add(blackGuy);
>>
>>51651983
why so many though? why 256? how do i know where to put abc...z etc compared to ctrl-a or whatever?
>>
>>51652056
>How do you store such reference in a list? How do you refer to an instance in c#?

For example, when you pass an object to a method, you're usually passing the value of the object.

Say you have a list full of dicks.

Here's some example methods:

public void Ayy(List<dicks> dickslist)
{
dickslist = null;
}

public void Lmao(ref List<dicks> dickslist)
{
dickslist = null;
}

public void Tits(List<dicks> dickslist)
{
dickslist.Sort();
}


If you pass your list of dicks to Ayy(), and then check the value of that object after the method is done, you'll find the object you passed did not change.

If you pass your list of dicks to Lmao(), you'll find that your dicks are now gone, as the object has been modified by passing it in with 'ref'.

If you pass your list of dicks to Tits(), then the dicks will be sorted, as you're performing the action on the variable that is referring to the object.
>>
>>51651936
I'd rather get a lizard if I wanted that. At least those do cool shit like change colors.
>>
File: ferret.jpg (103 KB, 500x500) Image search: [Google]
ferret.jpg
103 KB, 500x500
>>51651814
>year of the linux desktop
>not owning ferrets
>>
>>51652372
Ferrets are illegal in my state
They also destroy everything and small like shit
>>
>>51652372
That's way better then a cat though.
>>
>>51652443
>every inch decorated with guns
>ferrets are illegal
I bet even kinder eggs are illegal in your country.
>>
https://air.mozilla.org/the-joy-of-coding-episode-37/

Live streaming of a Mozilla engineer hacking on Firefox.
>>
>>51652520
>requires flash
trash.tiff
>>
>>51652152
> why so many though? why 256?
Because that's how many different byte values there are. 8 bits in a byte 2^8 = 256 combinations.
> how do i know where to put abc...z etc compared to ctrl-a or whatever?
In C, you can just use character literals, e.g. 'A' is just another way of writing 65. Languages where characters are a distinct type typically have ord() and chr() functions for converting between integers and characters.
>>
It's easier to "prototype" designs in Mathematica, so I'm writing something that converts mathematica output to another language for opengl purposes.
Thread replies: 255
Thread images: 38

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.