• Breaking News

    Sunday, April 14, 2019

    It might be a good idea for an app, or I'm just not using the right keywords on google. I need an app that temporarily shuts down non-productive websites so I can crank on my work. Ask Programming

    It might be a good idea for an app, or I'm just not using the right keywords on google. I need an app that temporarily shuts down non-productive websites so I can crank on my work. Ask Programming


    It might be a good idea for an app, or I'm just not using the right keywords on google. I need an app that temporarily shuts down non-productive websites so I can crank on my work.

    Posted: 14 Apr 2019 07:37 PM PDT

    Preferably like an extension so I don't have to worry about viruses. Thanks in advance

    submitted by /u/bsheelflip
    [link] [comments]

    What is the calling convention described in "Programming from the Ground Up?"

    Posted: 14 Apr 2019 06:42 PM PDT

    For those that have read that book, does the book describe a legit calling convention? I've never seen any documented, used calling convention like the one the author describes (where all arguments to any function are placed onto the stack)

    submitted by /u/extremeaxe5
    [link] [comments]

    What are ways from the outside, to make my code run as fast as possible?

    Posted: 14 Apr 2019 07:26 AM PDT

    Hey there,

    For a school project, we had to make Reversi/Othello algorithms. Tomorrow there will be an end tournament, in which all the AI's need to face off against each other.

    Now I'm not that confident in my code, I've used a simple minimax with alpha-beta pruning approach and I know other groups have way more advanced AI's. But my question was if anyone had any tips for me to make my code run faster. During the tournament there is a time limit of 10 seconds, so I want to try and make use of those 10 seconds as much as possible.

    I'm currently running the project from Eclipse, would it be better to export it to a JAR file? Should I allocate more memory? Should I turn off every other application on my pc? Or will all of these things not help?

    submitted by /u/Sebaku
    [link] [comments]

    Need help with C++

    Posted: 14 Apr 2019 04:08 PM PDT

    I want to create a text-based rpg using C++. I only know the basic syntax of the language. I will continue to learn the language. Is there any advice on where to start or what to do to create a text-based rpg using C++?
    I know that there are other places that probably already answer this but I just want brief and direct help. Thank You.

    submitted by /u/YoloMODS
    [link] [comments]

    Need help messing with a friend

    Posted: 14 Apr 2019 03:57 PM PDT

    I want to know if it's possible to write a program that will send my friend a link to a video at specific times of day

    submitted by /u/Raupubu
    [link] [comments]

    [C++] Why does this "for loop" use n-1 as its condition when ranking numbers from max to min?

    Posted: 14 Apr 2019 05:47 PM PDT

    This is a program meant to rank n numbers from max to min.

    #include <iostream> using namespace std; int main() { int n; //Reading value for n cout<<"How many integers would you like to enter?\n"; cin>>n; //reading n numbers cout<<"Please enter "<<n<<" integers:\n"; int max, min, val; //reading first number cin>>val; max = val; min = val; //reading n-1 integers for(int i = 0;i<n-1;i++){ cin>>val; //if max is less than new value then updating max if(max < val){ max = val; } //if min is greater than new value then updating min if(min > val){ min = val; } } //printing min cout<<"min: "<<min<<endl; //printing max cout<<"max: "<<max<<endl; return 0; } 

    Asking specifically about:

     //reading n-1 integers for(int i = 0;i<n-1;i++){ cin>>val; //if max is less than new value then updating max if(max < val){ max = val; } //if min is greater than new value then updating min if(min > val){ min = val; } } 

    In this for loop, why are they using "n-1" as the i < condition? What's going on?

    submitted by /u/lotyei
    [link] [comments]

    C# help, multiple condition if-then statement

    Posted: 14 Apr 2019 05:02 PM PDT

    I'm incredibly new to this, so this probably has a very simple answer. I'm making a simple little game in Unity, where 2 players traverse a little puzzle grid. I want a win condition that basically states when both players reach a certain grid space, they win the game. I can get it to work if only one player has to win, but it stops working when I add the second player (the game still runs, just nothing happens when the players reach the target grid space).

    This is what I have, attached to the winning grid space:

    public class WinCondition : MonoBehaviour

    {

    // Start is called before the first frame update

    void Start()

    {

    }

    // Update is called once per frame

    void Update()

    {

    }

    void OnCollisionEnter(Collision other)

    {

    if (other.gameObject.tag == "Player 1" && other.gameObject.tag == "Player 2")

    {

    print("You Win!");

    }

    }

    }

    --------------------

    It works when I change this part:

    if (other.gameObject.tag == "Player 1" && other.gameObject.tag == "Player 2")

    To this:

    if (other.gameObject.tag == "Player 1")

    Not sure what I'm doing wrong. Help me, please!

    submitted by /u/Ihaveadogortwo
    [link] [comments]

    3D transformations for a Rubik's Cube

    Posted: 14 Apr 2019 03:50 PM PDT

    Can you pass the elements of an array to a variadic template?

    Posted: 14 Apr 2019 03:49 PM PDT

    I have an array.

    std::array<int, 6> array = {4,6,2,8,1,9};

    and I have a variadic constructor that I can call:

    Object(4,6,2,8,1,9);

    Is there a trick that will let me call Object(array); ?

    submitted by /u/XiPingTing
    [link] [comments]

    Looking for resources on terrain/landscapes in game engine editors.

    Posted: 14 Apr 2019 03:44 PM PDT

    I've become interested in what data structures and algorithms are at play with respect to the terrain. I've attempted to implement something akin to what I've seen with Unity's Terrain and UE4's Landscapes but the result is insufficient. If anyone has any resources on the implementations of terrain and the morphing tools they use it would be greatly appreciated.

    submitted by /u/CursingAkhenaten
    [link] [comments]

    [C++] What are the four errors in this C++ while loop?

    Posted: 14 Apr 2019 02:33 PM PDT

    I can't, for the life of me, find the errors other than it seems certain variables were not declared with a "0" value.

    https://imgur.com/a/GaUftUu

    But there are supposed to be 4 errors.

    submitted by /u/lotyei
    [link] [comments]

    Why is microsoft windows - web browser memory management so terrible?

    Posted: 14 Apr 2019 12:31 PM PDT

    Yes I have too many tabs open, but why does it seem like microsoft/chrome can't swap tabs I haven't opened in days, but constantly swap the tab I just switched away from. So I'll have 50 tabs open, I'll only be switching from two of them, but it seems like the only tab microsoft/chrome swaps is the one I just switched away from... Why?

    The only thing I can think of is that microsoft windows tries to not swap any part of an active process or something like that?

    submitted by /u/cp5184
    [link] [comments]

    Need some multithreading help (Visual C++) - getting confused over mutexes and conditionals and such

    Posted: 14 Apr 2019 12:15 PM PDT

    I write a lot of video filters, and in the past I've used multithreading to speed them up. Like a somewhat worrying amount of my programming, I found some code online and knocked it around a bit until it worked.

    With my latest filter I was hardly getting any speed-up from multithreading. It turned out to be due to the overhead of creating the threads each time - my new filter does many more such launches of new threads than previous ones do.

    A bit of reading introduced me to the concept of a threadpool, but I wasn't able to find a good tutorial that explained all the concepts from scratch for me to fully understand it, so I set about fiddling around with some code I found until it worked. Kind of.

    Each thread - which is self-contained, rather than being a despatcher - gets passed a struct on creation (using CreateThread), which, among other things, includes pointers to a mutex and a conditional variable. It uses these to sit and wait until the main thread decides the threads are needed to do something, at which point the main thread updates other members of the struct (the thread's parameters; each thread has a separate struct, but with pointers to the same mutex and conditional) and calls a notify_all() on the conditional variable. This wakes the thread, which first checks to make sure it has been given some valid parameters (this avoids spurious wakeups, apparently).

    What I'm having trouble with is getting the main thread to recognise when all the threads have completed. I tried setting a counter which each thread decrements when it's finished, but every now and again it doesn't decrement to zero. I'm guessing this is because two threads are clashing and trying to decrement it at the same time, but what's even more confusing is that the main thread can hang, waiting for the counter to reach zero, even if I'm only calling one thread.

    My best guess at the moment is that the thread is completing so quickly that the program is tripping over itself - looping around calling the thread again before the thread is ready and waiting at the conditional, perhaps, which means it misses the next notify_all() and then fails to decrement the counter?

    (I've also tried monitoring each individual thread's parameters for a flag to indicate completion, but this also fails to work all the time. Again I can only guess there's a timing problem when the next notify_all() comes around)

    The worst part is that as soon as I add a few more calls to OutputDebugString() to try and work out what's going on, it slows the program down enough that the problem doesn't occur, so it's really hard to track it down.

    I realise this is a bit vague but the progam is a bit of a behemoth at the moment and it's a plugin to a particular environment (AviSynth), so I didn't want to fill this post up with code, although I'm happy to post any parts that may be relevant. I'm hoping someone might recognise that I've fallen into a common trap, or be able to nudge me in the right direction.


    TLDR; what's the right way for spawned threads in a threadpool to communicate back to the main thread that they have finished their current task, and definitely ready to receive the next notify_all()?

    submitted by /u/wonkey_monkey
    [link] [comments]

    Confused with this Dynamic Programming Problem

    Posted: 14 Apr 2019 10:26 AM PDT

    I am confused about writing recursive code for the following problem.I guess i managed to write iterative form.

    There is a road in form of nx3 list.There are some obstacles on road which are represented by 1's.0 's mean free space on road.there can be only 1 obstacle each line

    So there is a car which can move forward(starting from (0,1)) left forward or right forward(diagonaly).We always go forward cant go backwards or cant stay on the same line.of course we cant move on to obstacles

    The aim is route car to last line with the least possible number of diagonal shifts.

    so if its possible we go forward,if it is not we decide between going right diagonal or left diagonal.

    This is what i wrote so far: (python)

    https://pastecode.xyz/view/06d6345c

    submitted by /u/lastpeony
    [link] [comments]

    Archival data in json/firebase

    Posted: 14 Apr 2019 09:13 AM PDT

    Units of Measure - Survey on Lack of Adoption of UoM libraries

    Posted: 14 Apr 2019 08:09 AM PDT

    This isn't really a traditional programming question like some of the other posts on this subreddit. But more of the general state of UoM libraries in the programming world. This issue is kind of specific but in general, how does one ideally code units and dimensions in programming languages? I'm interested to hear what you do.

    Generally, stuff like this is pretty common (and scary):

    static final double c = 1079252849;

    static final double SPEED_OF_LIGHT = 1079252849;

    static final double SPEED_OF_LIGHT_IN_KM_PER_H = 1079252849;

    I had a survey up on the lack of adoption of unit measurement libraries and got so many interesting responses from different subreddits, enough to make a case for my masters thesis! So if you've used a UoM library or use your own solution (or don't really use one in the field you're working with), I'd like to know why that is the case.

    Here is the link to the questionnaire: https://docs.google.com/forms/d/e/1FAIpQLSfGsH9qSllDPaM5qBuvcSISWNH4fwzl1Gkcf50IOT9F4kABUQ/viewform

    If you're interested in this field and general answers and responses. Check out the responses on my other posts! Feel free to message me or post here for any insights.

    submitted by /u/Alfredius
    [link] [comments]

    Programming Movie Selection Based on Questionnaire using Angular 7 & Firestore

    Posted: 14 Apr 2019 07:55 AM PDT

    Hello everyone! , I am extremely new at using Angular 7 with the firestore and I've ran into a coders block. I'm aiming to show the user what movies he/she is interested in based on the answers thats selected from the questionnaire. Once the user selects the answers , I want to be able to pull from the firestore database and show the movies. Then have the option for the user to try again to see whats best for the user. Could someone help me get on the right path or maybe have examples of how can properly code this? I'm also having issues pulling from the database like for example the only movie in the database is "what men want" and for primary genre I have it as Romance and sub genre chick flick, when selected the movie wont pop up.

    My project is called TheMovieMaster and users can easily sign in by making an account.

    https://github.com/LamarRJ1/TheMovieMaster

    submitted by /u/Xamaslg1
    [link] [comments]

    Regarding Software licencing

    Posted: 14 Apr 2019 05:05 AM PDT

    We have a product that contains features (Let's say feature A, B and C).

    We are about to move it to production (a web application) for a certain client.

    However, as per my boss, we will deploy the product to the client's premises. The client will also have the source code.

    Now, my boss wants to restrict the features for that certain client. He wants to restrict the feature A, so that only features B and C would be available to the client.

    So what are our options? Any suggestions on how we can implement this? How about licensing?

    submitted by /u/senebii
    [link] [comments]

    No comments:

    Post a Comment