[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: 37
File: 1442679913825.jpg (162 KB, 1920x1200) Image search: [Google]
1442679913825.jpg
162 KB, 1920x1200
Previous thread: >>53776398

What are you working on, /g/?
>>
>>53779743
the leaves in that thumbnail look like little nigger shits.
>>
>>53779743
How are people supposed to find the thread without an anime trap as the OP image
>>
>>53779795
shut up or i'll post a car thread next time
>>
How many of you actually write tests in your own projects? How much of them are you actually using?

http://strawpoll.me/7233917
>>
>>53779937
I run tests that I think will break it

Not exactly writing tests when you know what you're doing.
>>
>>53779795
I second this. Plz need more anime qts, they make my heart pound.
>>
>>53779937
I make tests only for the most complex pieces of code I write.
>>
>>53778978
>doesn't mean it's "pure" or "good", just makes it more cluttered and verbose
>Haskell
>verbose
k tard
>>
>>53779743
Why is this allowed?
Class Foo {
public:
Foo();
private:
int a;
}

Foo::Foo() : a(0) { }

Initialization lists are ugly as fuck. What's even the point of calling something a "constructor" if the compiler initializes everything before hand?
>>
>>53780122

What language are you even talking about? Are you seriously asking what the point of a constructor is? How is a supposed to be initialized? If this is c++ Initialization lists are just one of too many ways to write a constructor. You can also just do int a = value in c++11.
>>
>>53780169
Yes, that's C++ but that's not what I'm asking. Everywhere I read about C++ constructors, everyone of them suggests to use initialization lists pretty much in every case. You could do something like

Class Foo {
public:
Foo(int num);
private:
int a;
}

Foo::Foo(int num) {
this.a = num;
}


But apperently it's inefficient. Now, they all say this type of constructor makes a copy of num and passes it to a, in the end it destroys num, right? But isn't it the same case if I had done it as

Foo::Foo(int num) : a(num) { }

?
>>
>>53779937
Test First is most retarded idea I've ever heard
>>
>>53780026
>java
>verbose
epic meme
>>
>>53780264

DESU it doesn't really matter, because if the speed of a constructor never really matters, or if it does its a poor design. Just use whatever constructor you prefer.
>>
>>53780264
No the number is copied in both examples.
>>
>>53780460
hey, you said it not me
but for real java is fucking verbose, it's difficult to imagine any program where the code in some other language wouldn't be at most 1/2 the length of the java version
>>
>>53780585
epic meme
>>
how do you do effective test-driven development?
>>
>>53780626
you don't

TDD is a retarded meme for normies
>>
>>53780626
You don't because it's a shitty way to develop that encourages lazy code.
>>
>>53780264
>But apperently it's inefficient.
It is inefficient because all members have been allocated and initialized before the constructor body begins to run.

This is very important. Consider what would happen if that weren't the case.
Class Foo {
public:
Foo();
private:
int m_a;
Bar m_b;
Zoz m_z;
}


Foo::Foo() {
m_a = this->m_z.zozFunction(); // <- this code can work if and only if m_z is ready to go - that is
// space has been allocated, and
// the Zoz constructor has been called and ran to completion
}


If the Zoz object m_z were not constructed prior to entering the constructor body, what should that code do? At what point should m_z be ready to go?

P.S. this is a pointer, not an object.

Foo::Foo(int num) {
this.a = num; // <- error
this->a = num; // <- correct
(*this).a = num; // <- also valid
}
>>
File: a month of pee.png (46 KB, 512x384) Image search: [Google]
a month of pee.png
46 KB, 512x384
I realized I forgot to close the game from a gif from earlier, so this girl was just wandering around from Jan 25, 1996 until Feb 17, 1996 with no toilet... she made a mess of the park. I'm surprised something didn't glitch out with her AI.
>>
>>53780658
how does it encourage lazy code?

I thought the code would be better if you have to constantly write test for every possible input condition
>>
>>53780680
TDD is literally
>write lots of tests
>do the bare minimum to pass the tests
>>
>>53780264
>they all say this type of constructor makes a copy of num and passes it to a, in the end it destroys num, right?
No. Copying an int is usually a single instruction, and you don't "destroy" individual local variables, the stack pointer will be changed regardless.

Stop trying to optimize something the compiler knows a lot better than you.
>>
>>53780698
oh

so, is there any situation where you would want to use a test framework?
>>
>>53780722
Tests are always a good idea.
Just don't write them first.
>>
>>53780671
>no poo
stop
also, whats the point if you don't include detailed rape scenes
>>
>>53780722
Use tests to ensure edge cases are caught and that your code works well, not as a means to an end.
>>
>>53780751
>also, whats the point if you don't include detailed rape scenes

What are you talking about? There are rape scenes. Why else did you think I put in a genetics system? There's even impregnation if the girl has reached menarche (at about 12yo)
>>
>>53780671
kys (but nice job on the game)
>>
>>53780756
>>53780740
thanks
>>
Guys how do I tell if the integer is odd?
>>
>>53780669
Now I get it, thanks.
>>
>>53780802
You have to test said integer against every odd number from 1 to (2^64 - 1)
>>
>>53780802
certain CPUs have custom op codes for testing odd integers

otherwise you're fucked
>>
>>53780815
That assumes it is unsigned. He should test from -2^32 to 2^32 - 1.
>>
>>53780669
Also please consider http://stackoverflow.com/questions/15679977/constructor-initialization-vs-assignment.

You cannot assign const members, but you can initialise them in the initializer list.
>>
>>53780845
INT_MIN to INT_MAX
>>
>>53780845
>He

You're being sexist right now.

I can't really tell is it against women or men though.
>>
>>53780802

if (var & 0x1)
{
std::cout << "Odd";
}
else
{
std::cout << "Even";
}


There is no need for any calculations in binary to find out if the number is odd. That info is stored in the LSB of any integer.
>>
>>53779743
Well I installed truffle on arch, time to learn the damned thing.
>>
>>53780892
implementation defined
>>
>>53780912
Truffle?
>>
>>53780915
Most systems implement the 2-complement representation so I guess it is a valid method for most.
>>
>>53780779
i like this project already, source?
>>
File: loli chasing me.gif (3 MB, 509x381) Image search: [Google]
loli chasing me.gif
3 MB, 509x381
>>53780789

I can't kill myself until I finish the game.

>>53780936

http://pastebin.com/XuxrsQ2Y
>>
>>53780949
why not just host it on a git service anon, im sure that'd be easier
>>
How do you know if a double is a natural number?
>>
>>53780949
>http://pastebin.com/XuxrsQ2Y
Y NO github?
>>
File: popup.png (42 KB, 512x384) Image search: [Google]
popup.png
42 KB, 512x384
>>53780963

I have it on a private git repo, but not public.
>>
>>53780949
Looks like you're working on NPC Path-finding?
Pretty cool man.
>>
>>53780949
Your trees are rendering behind the player even if the player should be partly blocked by it. Have you thought about z-ordering?

Nvm, if this is the intended effect.
>>
>>53780984

I do do z-ordering, but I swapped the graphics and forgot to update which y-level was the "bottom" of the image so there are some cases (like fences) where it doesn't appear as it should.
>>
>>53780978
What do you plan to do after you finish the game?
>>
>>53780978
ah okay
did you make the art yourself?
>>
>>53780997
I don't think I laughed so hard in a while. When I looked at the africans it was fucking over
>>
File: home icon.png (45 KB, 640x480) Image search: [Google]
home icon.png
45 KB, 640x480
>>53781008

I made the art for
>>53780997
and the pic of this post

but not for:
>>53780978
>>53780949
>>53780671
>>
>>53781036
how long have you been working on this?
>>
File: 5 skin genes 5x size.png (36 KB, 1320x960) Image search: [Google]
5 skin genes 5x size.png
36 KB, 1320x960
>>53781005

I don't know, continue on with my life? I don't expect to finish for quite some time though.

>>53781022

Each pool simply defines the probability for a given gene to get the recessive vs dominant allele. Pic related, it's the 5 skin-tone-affecting genes and their effects (the hair/eye colours is not affected by them, those have 5 and 4 genes that affect them respectively - I just made some have different hair/eye colour in the pic to make it match)

>>53781048

Since 2013 on and off.
>>
>>53780978
How about milfs?I hope your game allows the player to kidnap them as well.
>>
>>53781064
i think you misunderstand the game.
>>
>>53781062
>implementing genetics in loli raping game
well, that's level of autism i haven't seen some time

keep it up mate
>>
File: bladder code.png (62 KB, 815x1317) Image search: [Google]
bladder code.png
62 KB, 815x1317
>>53781064

if I do, there will be less content for them. Like they might primarily be there as breeding-slaves to make lolis. So dialogue will be limited and there will probably only be one sex position. This would also apply to any lolis that you kidnapped who grew up into adults.

I'm not sure how I should handle time with respect to breeding though. I like the idea of having selective breeding for the gene system, but that doesn't really make much sense given how time passes right now... I could make it be less realistic where girls pregnancies don't last as long and they grow from like 0 to 5yo pretty fast. I thought about having like an "aging machine" that costs a lot of in-game currency that can speed up loli aging for the purpose of breeding... or I could make it unrealistic in that lolis can get pregnant at any age... I'm really not sure! Or maybe you'll only get to play like 1 day per month or something.

>>53781134

Wait until you see the digestive/urine system.
>>
>>53781146
Time Machine seems like a reasonable solution.

How do you earn money ingame?
>>
File: hyperlinks bug finally fixed.gif (2 MB, 623x435) Image search: [Google]
hyperlinks bug finally fixed.gif
2 MB, 623x435
>>53781232

There's no way yet but some ideas I have so far are:

-earn x amount periodically (could be depending on what your job is - and your stats could determine which jobs you can do.)
-sell lolis / produce cp and sell it on the black market. I was planning on having a loli-trading site thing using the in-game internet. pic related.
>>
File: item choosing GUI.gif (763 KB, 632x475) Image search: [Google]
item choosing GUI.gif
763 KB, 632x475
Money would also be used to buy items or for upgrading your basement (pic related)
>>
>>53781271
Teach me to make a game
>>
>>53781271
What do you use for path finding? Simple A*?
>>
>>53780585
Do you even know how to code?
>>
>>53781322
>code
no
>>
File: [start][end]07887250.png (5 KB, 320x192) Image search: [Google]
[start][end]07887250.png
5 KB, 320x192
>>53781299

Yeah I use A*. What heuristic they use or what weights are easily swappable. so that way you could attach high weights to walking onto grass/road/etc instead of paths/sidewalks, but if they're running they could do a custom weight for being far away from danger (the player) or something. Also custom predicates too instead of just having a goal position, which is what I use for the park wandering. For the L2 norm heuristic I had to keep track of what "global" position the levels were in, and also what scale they had relative to worldspace, since the interiors of the houses I've made so far have a 2:1 relationships (2 tiles in a house = 1 tile outside) in order to make house interiors not tiny, and then I had to make the pathing systme aware of multiple levels as well, since you could potentially have the start pos be inside of one house, but then it could have to go outside, then into another building then up some stairs to another level, etc.

pic related, I made a nice debug vizualizer for the explorded pathspace of A* for queries. Green=start, red=end, blue = path, yellow=search space explorded
>>
File: 1458048975032.png (539 KB, 709x697) Image search: [Google]
1458048975032.png
539 KB, 709x697
>>53781260
Why did I laugh anon. Why.
>>
>>53780949
src/Utility/Assert.hpp:5:79: warning: overflow in implicit constant conversion [-Woverflow]
const int PROJPATHLEN = sizeof(__FILE__) - sizeof("src/Utility/Assert.hpp") - 1;
^
>>
>>53779743
Help me pls /g/. I have never programmed before, but I really want to try. What would be the best language to start out trying to learn? I asked my dad, and he said anything but C#.
>>
>>53781500
you should try C#, it's easy and better than java, and now it supports any platform that exsist
>>
I'm aware that in an array you can not change the size of the array once it is set.

In a 2D array I have a defined number of arrays it can hold but the size of the arrays inside of it varies and I don't know how to define them.

public static void main(String[] args){

String maryHad = "Mary had a little lamb. Its fleece was white as snow.";
String[] maryHadArray = maryHad.split("\\.");

String[][] maryHadArrayExplode = new String[maryHadArray.length][];


System.out.println(maryHadArray[0]);

for(int i = 0; i < maryHadArray.length; i++){

String[] toHold = maryHadArray[i].split(" ");
maryHadArrayExplode[i][]; // How do I define this array to hold in position i an array of size x
for(int j = 0; j < toHold.length; j++)
maryHadArrayExplode[i][j] = toHold[j];

}
}
>>
>>53781528
why not using lists/vectors?
>>
>>53781500

First learn C, then learn some sort of scripting language, like Python or Ruby.
>>
>>53781539
I could do that but the problem becomes so trivial I don't know if that's cheating or not. I believe that inventing the wheel is beneficial in terms of gaining knowledge.

If it isn't possible to define the size of an array within an array then I'd resort to using lists.
>>
>>53780964
It never is.
>>
>>53781528
remove the for loop and do
maryHadArrayExplode[i] = toHold;

>you can not change the size of the array once it is set.

This is partially incorrect and has to do with pointers, but i'm too lazy to explain right now
>>
File: 8631_40d7_676.jpg (84 KB, 676x896) Image search: [Google]
8631_40d7_676.jpg
84 KB, 676x896
>>53781624
Thank you!
>>
programming pleb here working on some hw what is another data type I can use for an array already used string,int,boolean ?
>>
>>53781744
Do a struct.
>>
>>53781764
just using java
>>
>>53781781
you can have array of objects of some class
>>
>>53781781
Well then, do an array of objects.
Make some shitty vector object that holds 3 floats or something.
>>
The real reason that initializer lists are useful (required) in C++ is because of value semantics.

struct A {
/* no default constructor */
A (int x) { ... }
};

struct C {
A a;

C (B b2, int x)
// ERROR: A() doesn't exist
{
a = A(x);
}
};
>>
>>53781271
Damn. How the hell did you make this, is there a mechanism you followed?
>>
>>53782010
**The building part. RCT comes to mind.
>>
>>53779743
Working on Ansible playbooks to automate setups of things I hardly understand in the first place.
>>
>Cofound startup with good friend
>He does design and frontend development, I do backend work
>Work on a project for two years
>Almost finished, just gotta finish a feature
>He starts to have doubts
>Commits less and shit
>Today he tells me that he's just bailing

Fuck. I'm useless at design, so I need a partner to help me with this. But I don't know any other fucking designers.

How am I supposed to pick somebody?
>>
>>53782032
>>53782010

What do you mean? The thing is just a grid and I used bitmasks to see if there was a wall north/south/east/west, so like 1<<1 was west, 1<<2 was east... and so on, and then some other bit was whether the cell was filled or not, so it was pretty easy to check all that.

It's just a grid.
>>
>>53781653

w2c dress
>>
Which self-balancing binary tree is the easiest to implement?
>>
>>53782092

Easiest, or least amount of code? RB-trees have a lot of cases, especially for deletion...
>>
>>53780892
Oneliner style is much better.
std::cout << (var & 0x1?"Odd":"Even");
>>
>>53782296

fb moving haskell

sorry c/c++ neets. tough luck
>>
I have a windows c++ console application is it possible to make it's functions to be called directly from cmd?
How do the programs do it?

program.exe funcion param param

send help
>>
>>53779563
Do a
printf("%d\n", (int)key[i]); 
at each step and think about it. I put in "i" because j and k are such that they are always j == k so that's redundant. Just use one index var and call it i (yes I get that this is a remnant from earlier attempts).
>>
>>53782305
Haskell is useful for writing robust, high quality and reliable software. You can write the same stuff in any other language. But Haskell is designed based on solid mathematical principles. It is statically typed which allows the compiler to detect certain classes of bugs which are impossible for compilers for C++, Java, Python etc. to detect. Haskell compiler can also perform optimizations which cannot be performed for other mainstream languages. Haskell focuses on modularity and composability by virtue of pure functions with no state changes. Code with state changes is neatly separated from code without state changes, allowing you to zero in easily, onto the bugs. Haskell emphasizes a different style of programming with an extremely minimalistic and simple syntax( devoid of colons, braces, brackets and other ugly looking special characters) making your code look like a Mozart or Beethoven masterpiece.
Its a truism in the Haskell community that if your code compiles, then it will do what you want it to do.
>>
>>53782312
the args in your main() function (usually an array of strings) are taken from the command line. You'll need to do some coding to make it call the functions by parsing the arguments.
>>
>>53782312
just make an argv[i] switch case and call functions inside the case
>>
>>53782374
>>53782396
So that's the point of the main parameters
Thanks i'll have to do some tweaking like you mentioned
>>
>>53780698
I don't understand the problem
>>
>>53782367
Two dollars have been deposited into your account.
>>
File: 1457030087752.jpg (44 KB, 337x397) Image search: [Google]
1457030087752.jpg
44 KB, 337x397
>That moment when you realise your code is unsalvageable and you have to start again
>>
File: R (27).jpg (42 KB, 633x600) Image search: [Google]
R (27).jpg
42 KB, 633x600
Anyone know a good, formal book about wordpress? One that doesn't use expressions like "code ninja" or "php wizard" would be sufficient.

I know webdev is shit but i quit my job and i gotta make money alright, no judgerino.
>>
need a project idea
I have no idea what to make senpai
I know C, C++, Python, would do well to learn Java I guess

I want to make something of a deck tracker for a card game but I have no idea how it would work without image recognition which is beyond me

I also want to practice the basic algos and data structures every wizard needs to know, i.e. dijkstra's, A*, avls, minimax, alpha-beta pruning, whatever, but I don't know what sort of project I would want to make where I can apply this sort of stuff

Just something I can spend a couple weeks on maybe

Any ideas? Any little projects you've done in the past you might want to mention?

thanks guys
>>
>>53782895
https://www.codeeval.com
>>
>>53782895
>something of a deck tracker for a card game

I assume you mean Hearthstone. Those deck trackers work by getting info from the log files, not image recognition.

They are actually pretty simple.
>>
>>53782951
No it's not hearthstone, but I'll see if there are log files for my game, really doubt it though

>>53782909
these are exercises, not projects
>>
>>53783021
>>53782951
Found what looks like it should be the log (output_log.txt, same filenam hearthstone uses for its log), all it has are errors (Count not find bus 'HeroInteraction', bunch of unity errors, etc)

Oh well
>>
Just took a Java quiz. Took me about an hour and I made a 67% on it

What am I doing wrong lads? These quizzes have no code on them BTW if they do it's really simple like how to instantiate an object using animal

The questions are mostly definitions but a lot are true or false where they change one little thing so if you know 3/4 for whatever it's asking one thing will make it all class and youre fucked. Am I just dumb. Were doing generics and stuff right now
>>
>>53782876
>>
>>53783271
First of all, stop talking like a retard.
Secondly, you probably are just dumb.

Programming courses nowadays are designed to be passable by basically everyone. The weeding out is done in your math classes.
>>
IS it a bad or good sign im taking a long time to get linked lists understood?
>>
>>53783471
Imagine it as a train. Each slot on the list is a wagon that is "linked" to the next one, i.e it points to the next wagon until there's none (NULL)
>>
>>53781500
java

https://docs.oracle.com/javase/tutorial/

don't listen to the stupid fucking neckbeards
>>
>>53783471
It's a good sign that you haven't given up. Don't think of programming as a competition, at least not a competition with the faggots in this thread.
>>
>>53782648
instead of putting all the effort into writing the tests instead of the actual code, why don't you focus on writing solid actual code, and you can still test it afterwards, you don't have to write the tests before you write the code
>>
>>53783529
I get that, i'm still trying to fully understand how traversing it works

>>53783546
nah, i'm just reading/studying up for the courses ahead, people tell me C++ is a painful language too anyways
>>
I have been reading the PE32 spec from Microsoft... for leisure purposes.
>>
>>53783471
if you're new programming it's ok but otherwise i'd say it's really bad
>>
>>53783927
>new programming
*new to programming
>>
holy shit python is fun as fuck
>>
>>53783580
>using a tripcode
Please leave 4chan forever.
You're cancer.
>>
WHY DO NCURSES METHODS TAKE Y COORDINATES FIRST, THEN X?

WHY DOES NCURSES DEFINE THE ORIGIN AT THE UPPER LEFT HAND SIDE OF THE SCREEN

WHAT THE FUCK
>>
>>53784082
>insulting literally the only good tripfag we have in these threads
hello newfriend.
>>
Hey, /dpt/, I'm having a very specific problem with an SQL database:
>>53784031

How do I do this?
I assume it's some kind of check, because unique didn't work right.
basically, many people can be in one group, but only one of them can be a leader.

How do I check that the group is unique with leader=true? but NOT group unique with leader=FALSE?
>>
File: coq.jpg (74 KB, 1045x636) Image search: [Google]
coq.jpg
74 KB, 1045x636
>>53782876
>formal
>wordpress
>not coq
>>
>>53784087
YX is dumb even for terminal-based stuff. But y increasing downwards is how screens and gfx libs behave even to this day.
>>
>>53784087
(y,x) is perfectly sensible, think of how you'd access an array of strings (lines on a page), you pick which line first (y), then the location in the line (x)

same idea with the origin, we read from left to right and top to bottom
>>
>>53784099
There are no good tripfags.
They're all attention whores.
>>
>>53784308
Ruby is a faggot but a cool faggot, like Freddie Mercury
>>
>>53783927
yeap, never done it before, i've only tried C++ with very little java
>>
Okay. I need to try and make the tiniest Hello World ever in an .exe. Because GCC seems to be adding a little bit of bloat, even when you strip all of the symbols away. And also, for the lulz.
>>
>>53783560
How do I do a boolean operation on a float?
For example I have two variable A and B with the values 21(10101) and 17(10001), how do I '&' them together to get 17? I've tried casting them to bool but it doesn't work.
>>
>>53784383
> tiniest Hello World
COM format was the best for it.
>>
>>53784436
cast them to int? Just a suggestion.

Retard
>>
>>53784436
I havent gotten that far yet
that or i need to go revise again
>>
>>53784436
> cast them to bool
> BOOL
You deserve a graduate programmer pic mate. Someone please do it?
>>
>>53784470
Thanks I never thought of that, retard. It doesn't work.
>>
>>53784487
Yes, exactly: fuck off with your unnecessary comments kiddo.
>>
>>53784436
It doesn't work because float variables are not stored the way you think they are. For how it's done, you should check
https://pt.wikipedia.org/wiki/IEEE_754

As to how you do it using boolean operators, you'd need an adder
https://en.wikipedia.org/wiki/Adder_(electronics)#Full_adder
>>
>>53784383
Stripping symbols really doesn't do shit. using -Os to optimize the code for size does a lot more. Also, I bookmarked this a while ago because it seemed neat but I've never read it.
http://nullprogram.com/blog/2016/01/31/
>>
>>53784491
Okay, again, it was something I tried not something I expected to work. It is a simple question. Stop being condescending.
>>
How do y'all join open source projects? I just wanna code for fun whenever i have time.
The open source projects on source forge sound more like a job interview, fuck that shit.
>>
>>53784496
>it doesn't work
How? what do you mean? Are you ready to get exposed dumbfuck? Try casting them to bool instead.
>>
>>53784436
>21
>(10101)
>float
It's 01000001101010000000000000000000 actually
>>
>>53784522
The problem is that it isn't returning anything or even allowing me to and two floats.
>>
>>53784436
reinterpret_cast
>>
>>53784533
please elaborate.
>>53784538
Won't give him 17 back, right? Maybe it all comes down to a misunderstanding?
>>
>>53784511
bitwise AND on 17.0f and 21.0f would result in 17.0f dumbass

>Adder_(electronics)
this is /dpt/, not /diy/

>>53784556
see http://www.h-schmidt.net/FloatConverter/IEEE754.html
>>
>>53784517
browse github repos in your language of preference, find issues that you understand, try to fix them (or even add some functionality) and submit a PR.
>>
File: OnlyBadFeelings.jpg (65 KB, 1280x720) Image search: [Google]
OnlyBadFeelings.jpg
65 KB, 1280x720
>>53784104
Can anyone please help me with this?

I can't figure out how to make this work.
Basically, I need to be able to insert rows with duplicate values, but only if one of the values is NOT true.

Does anyone have an idea?
Or, how do I create a UDF that could do this?

I've been stuck on this single thing for well over an hour.
>>
>>53784556
float A=21,B=17;
std::cout<<A&B;

Literally I need this to return 17 but it isn't allowing me to use none bool values and obviously I can't cast to bool because it just truncates it.
>>
File: multipledefinitions.png (26 KB, 858x158) Image search: [Google]
multipledefinitions.png
26 KB, 858x158
>>53784569
???
>>
>>53784569
I'll even use the basic parameters for the assignment:
program id, committee member, chair
program id and chair CAN be the same IF chair is 0, but NOT if chair is 1.
There can be many 0 chairs for each program, but only one 1 chair for each program.
>>
>>53784596
How about you
-> >>53784470
>cast them to int
?
((int)a & (int)b)
>>
>>53784596
Never mind, I got it. cout doesn't like bitwise operations evidently.
>>
>>53784611
yes, user-defined function.

if I can't create a constraint that does this:
>>53784617
I need to be able to create a function that accepts a program id as a parameter, where the parameter value is only known on insert, and the column is the idea of a program

so basically, how do I pass a parameter to a user-defined function, extracted from an insert command such that I can match input to a column's values using a select statement?
>>
>>53784596
Question unclear: do you want it to bitfiddle floats in a way that is dependent on the IEE 754 representation, or do you want to & values stored as floats as if they were ints? In the former case, do look into reinterpret_cast.
>>
>>53784655
is the ID*
>>
File: heres your You.jpg (53 KB, 612x629) Image search: [Google]
heres your You.jpg
53 KB, 612x629
>>53784563
>Adder_(electronics)
>this is /dpt/, not /diy/
>>
>>53784655
actually, you know what... fuck it.
I'll make the chair a completely different table and use a join that can output nulls...
>>
>>53784655
Listen: I don't even know what kind of Rajeesh-friendly DB engine you're using, but this is not a programming related question, the programming part is TRIVIAL. So if you think we are here to implement it in whatever database administration lang you use because you're too dumb to do it yourself - or rather to make it get called at the right time, which is worse - you can fuck off.
>>
Why can't /dpt/ answer questions without being pretentious? Does /dpt/ not remember what it was like to be new to programming?
>>
>>53784673
he was obviously asking in the context of C++, not electronics hardware
>>
>>53784761
It's the same logic as the circuit, you just need to apply it. That link may have not been the best choice, here's another one with a better understanding (even has the code)
https://en.wikipedia.org/wiki/Addition#Computers
>>
What context is the conditional OR operator used under?
>>
>>53784848
he's not even talking about addition, he's talking about bitwise and, jeez
>>
>>53784848
I already figured it out anon, I appreciate the assistance though. The problem was that I was trying to cast A&B to float as a return value in a float function instead of casting it to int before the return and then casting the answer to float.
>>
Idk how to figure this thing pls explain /g/ ?
>>
>>53785409
output = {}
for word in sentance:
size = len(word)
if size in output:
output[size] = output[size]+1
else:
output[size] = 1
>>
>>53785473
fucking disgusting kill yourself

>the maximum word length is 10 letters

it should be a 10 element int array, not whatever garbage {} is
>>
>>53785565
Not sure if troll or Java baby.
>>
>>53785572
KILL YOURSELF
>>
File: 1458360928300.jpg (41 KB, 348x367) Image search: [Google]
1458360928300.jpg
41 KB, 348x367
>mfw a delusional freetard actually DIRECTLY contributed to the pooinlooification and destruction of their own livelihoods and salaries by contributing to an open sores project near me.

explain yourselves.
>>
what the fuck microsoft now has native bash, visual studio is open source, WHAT IS HAPPENING, WHATS THEIR GAME
>>
>>53785604
i'm not a freetard and i don't do open sores but having shit on your shithub account is a pretty good resume filler
>>
>>53784854
what do you mean, isn't it obvious? when you can either choose one or the other. Apples or oranges, if there aren't any apples nor any oranges, return false.
>>
>>53785616
>visual studio is open source
It's not, though.
>>
>>53785616
>visual studio is open source
the fuck are you smoking?
>>
>>53785630
No I mean because if it only returns true if the second value is true isn't it the same as &&?
>>
>>https://www.hackerrank.com/challenges/maximise-sum
how the fuck does something like this have below 20% success rate
def exercises(arr,mod):

arrlen = len(arr)
newSub = []
highestMod = 0;
newHighestMod = 0;
for i in range(1,arrlen+1):
for j in range(0,arrlen):
if j+i <= arrlen:
newSub.append(arr[j:j+i])
for i in range(0, len(newSub)):
for j in range(0,len(newSub[i])):
newHighestMod += newSub[i][j]
newHighestMod %= mod
if(newHighestMod > highestMod):
highestMod = newHighestMod
newHighestMod = 0
else:
newHighestMod = 0
print highestMod
exercises([3,3,9,9,5],7)


probably not optimal at all but still
>>
>>53785646
>if it only returns true if the second value is true
That isn't the case, though. You're just retarded.
>>
>>53785642
>>53785637
Sorry, .NET and visual studio code are open source.
>>
>>53785662
>YOUR RETARTED
Is that the only word /dpt/ knows or is it just you posting the same response to every post?
>>
>>53785675
you're literally retarded, OR returns true if either is true
>>
>>53785646
No man, it only returns true if either one is true.

if(true OR true)

returns true
if(false OR true)

returns true
if(true OR false)

returns true

only
if(false OR false)

return false.
>>
>>53785675
hes right though, you are retarded
>>
>>53785675
No, but when someone says something retarded it is a valid response.
>>
>>53785675
I know this word is used lightly by many people but in your case, considering you can't even figure out the difference between two extremely simple logical operations, he's right - you're indeed retarded
>>
>>53785604
no degree and a github account with lots of contributions and repos is the only thing to land you a good job
>>
>>53785686
(you)

>>53785684
You realise I'm talking about conditional OR not bitwise OR right?
>>
File: 1458685022208.jpg (34 KB, 500x273) Image search: [Google]
1458685022208.jpg
34 KB, 500x273
>>53785702
>>53785621
>the jews have codemonkeys destroying their own livelihood just to get a meager one in the first place
>>
>>53785705
u so funy xDDDDDDD
>>
>>53785705
>You realise I'm talking about conditional OR not bitwise OR right?

Oh look guys, this retard is trying to transition into "hurr durr I was only pretendin, yall got le trolled"
>>
whats haskell's niche other than elitism
whats fp's niche?
whats ocammel's niche?
>>
File: 1455297682398.gif (4 MB, 444x250) Image search: [Google]
1455297682398.gif
4 MB, 444x250
>>53785705
>>You realise I'm talking about conditional OR not bitwise OR right?
Can you teach me to bait as well as you mister?
>>
>>53785717
>>53785721
You both seem pretty unintelligent.
>>
File: 3RBIQ9s.png (54 KB, 1274x840) Image search: [Google]
3RBIQ9s.png
54 KB, 1274x840
>>
>>53785713
>spending 4 years on a degree instead of learning the good parts at home
kek hold me /fit/
>>
>>53785724
https://github.com/Gabriel439/post-rfc/blob/master/sotu.md
You probably could consider "best in class" ones as haskell's niches.
>>
>>53785760
>he's a softwareonly babby
>>
File: leddit_conspiracy.png (406 KB, 1025x510) Image search: [Google]
leddit_conspiracy.png
406 KB, 1025x510
I have 15yo game and I would like to somehow edit some of game setting (gold, amount of building) while its running. Probably it is the best to change those values while game is loaded into ram.

Do you know any good papers/tutorials about this?
>>
>>53785772
what does that even mean
>>
>>53785565
>doesn't understand pseudo code
>>
>>53785796
it probably means that you're not a cs graduate meme. If you were you would have gotten this by yourself btw
>>
File: 1458741827488.jpg (44 KB, 620x372) Image search: [Google]
1458741827488.jpg
44 KB, 620x372
>>53785796
what do you think it means?

you're the disgrace to STEM, the meme profession

Did you think /g/ was only occupied by shit tier majors? No, just the 90% of Sturgeon's Law are CS majors here.
>>
>>53785812
>studying cs only to get more memes into your system
javascript frameworks werent enough?
>>
>>53785822
>Did you think /g/ was only occupied by shit tier majors
if by shit tier major you mean cs then no but most software related jobs are, which is what we were talking about you idiot.
>>
>>53785705
the only difference is that it "short circuits" so that it doesn't evaluate the second operand so if the second operand produces a side effect it doesn't do it if the first operand is true
>>
>>53785713
open source software can't really compete with proprietary software, there will still be plenty of market share for non-free software
>>
>>53785796
he's an electrical engineering grad that comes in here from time to time to talk down "softwareonly babbies" to delude himself into thinking he's superior for working on electronics hardware
>>
I am trying to make a printer class as an intro into JAVA.
I am very well aware that I have no fucking idea what programming is and I want to start rectify it by using java, which I neeeeeeed to be able to use.
I want to use the int value in printing method to be accessed by the maintenance method in order to emulate very simple maintenance bitchings.
Am I going too complex for a beginner?

package oOPConcepts;

public class printer {

//I am trying to make a printer class

int power = 0;
int print;
String scan;
int maintenance;
String settings;

//turns it on and off
void turnPower(int newValue){
if(power == 1){
System.out.println("Printer is ready");
}else{
System.out.println("Printer is offline");
}
}
//it should be able to print, after a certain value, let's say 5, it should redirect to the maintenance method.
//it should also ask the user to replenish the cartridges after two uses
void printing(int Printing){
print = Printing;
print += 0;
}


void scanning(String Scanning){
scan = Scanning;

}

void maintenancy (int maintenancy){

if(maintenance == 1){
System.out.println("paper is stuck, please take out the paper manually");
}if(maintenance ==2){
System.out.println("The inkcartridge is empty, please put a new one.");
}else{
System.out.println("Everything's fine");
}
}

}
>>
Need some help with planning an app.

I want it to be a quiz app that reads a question aloud. The user may interrupt at any time by touching a button then speaking an answer. That answer is then checked against the correct one.

This seems daunting but basically all the pieces exist in Android already and I just have to put them together with intents, right?
>>
>>53785804
it's python or someshit and you can write much cleaner code with a normal fucking array, not some DISGUSTING meme language construct, the size of the array should definitely be specified explicitly (even in the pseudo code) to refer to the fact that the word length can be no more than 10
>>
>>53785616
>WHAT IS HAPPENING, WHATS THEIR GAME
I don't know, but I like it.

It's making my life easier, and even my co-worker who only wrote in Python on Linux is now learning C# so he can work with me on my projects.
>>
>>53785965
>too complex
not really, that's what I remember was one of the first examples when I was learning OOP
anyway, start by reading a book

btw if java's your first language I hope you wont hate yourself by the end of the semester
>>
>>53785970
>basically all the pieces exist in Android already and I just have to put them together with intents, right?
In the same way that a massive car parts warehouse has pretty much all of the things you need to walk in and build a car.

Have you ever written an Android app before? Or a desktop application, for that matter?
>>
>>53785970
RTFM
>>
>>53785994
Well, I need to be able to do it, since many classes require JAVA.... at least I get therapy
>>
>>53786015
BTW, isn't ORacle's Tutorial doc the best exercise and learning book for java there is?
It is also always kept up to date, so.... it must be good enough.
>>
>>53786002
Long ago, no mobile apps but desktop ones. I've made quiz applications in the past but they've always been multiple choice or fill in the blank type things.

I guess what I'm asking is that I don't need to code the voice recognition myself, right?
>>
>>53786055
>I guess what I'm asking is that I don't need to code the voice recognition myself, right?
Use Google or Microsoft's APIs for this.

Microsoft actually just released their voice recognition API to the public:
https://www.microsoft.com/cognitive-services/en-us/speech-api
>>
>>53785965
print += 0;


Amazing.
>>
Are there any good codegolf sites with active communities with .com down?
>>
>>53786178
>with .com down
what
>>
i know this may sound dumb, but, if I compile a haskell file into a binary, and I share that binary with someone, will they need the libraries I had or even the haskell system to run it?
>>
>>53786215
codegolf.com is down.
>>
>>53785965
Hi, it is me again.
I am now aware that I need to use the scanner class in order to manipulate the turnPower and some other methods in that class.
Should I use Scanner on a Class?
Or should it be a invoked(?) in the main class?
>>
>>53779743
tried to generic-ify cellular automata using map/reduce/higher-order-template-functions

from the outside it looks fairly nice
world = world.automate!(a => sum(a) > 4 ? 1 : 0);


it takes a function as a template argument, which in turn takes a 3x3 multidimensional array centred around each square in the world, and is used to produce the corresponding square in the next iteration

on the inside though it is fucking horrifying. It's just one hideous hack after another

produces some pretty pictures though (let's see if this works)
#####################   #######   ##############################################
#################### ##### #####################################
#################### ### ################### #############
################### ################## ############
############## #### ########### ###########
############ ## ######### ##########
######## ####### #########
####### ## ###### ######
####### #### ## ##### #####
###### ###### ###### #### ### ####
##### ###### ######## ###### ###
#### #### ######## ########### ### ###
### ## ######### ############# ##### ####
### #### ######### ############### ############
#### ####### ### ############################# ###################
################################################################################
>>
>>53786466
fucken
>>
File: QCCsFcR.png (44 KB, 1231x645) Image search: [Google]
QCCsFcR.png
44 KB, 1231x645
>>53786497
Came out fine for me.
>>
>>53786466
>on the inside though it is fucking horrifying. It's just one hideous hack after another
Story of my life.
>>
File: Screenshot_20160331_223713.png (6 KB, 611x308) Image search: [Google]
Screenshot_20160331_223713.png
6 KB, 611x308
>>53786522
what kind of CSS sorcery is that?
>>
>>53786466
Would blow up with bazooka/ 10.
>>
>>53786547
http://zixaphir.github.io/appchan-x/
>>
>>53786221
codegolf stack exchange maybe
>>
>>53786528
;_;
It seems like I could do some interesting stuff with it if I just ignore how fucking awful it is on the inside, but I just can't help but to cringe every time I see it
>>
>>53786497
>>53786522
>>53786547
Looks absolutely fine for me on default Firefox shit.
>>
>>53786601
>I just can't help but to cringe every time I see it

Everybody does this, lad. Start refactoring or something.
>>
There is literally nothing wrong with Java
>>
>>53786798
this

it's literally the best programming language
>>
Hi guys Java is my first programming language and after programming in it for 20 weeks I honestly don't feel like programming anymore. Is this normal?
>>
Doing OpenGL 2.0 in C++. Shits fun so far, but why are transformations always done in what seems to be reverse order?
>>
File: d1xBkqX.png (40 KB, 1298x644) Image search: [Google]
d1xBkqX.png
40 KB, 1298x644
>>53785409
Over 9000 hours in GNU + MS Paint
>>
>>53786798
>>53786842
>>53786876
you guys don't forget to poo in loo today
>>53779743
Writing a microkernel + small user space for ARM64 in pure assembly senpai
>>
>>53786876
>Is this normal?
For Java, C and whoever responds to me's favorite language, yeah.
>>
>>53786953
No I like shitting outside in my backyard
>>
>>53786965
Well just don't rape any squirrels or goats coming nearby sanjeep
>>
>>53786876
what do you want to do? do you want to make an actual program? then get to it
Thread replies: 255
Thread images: 37

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.