• Breaking News

    Saturday, October 20, 2018

    Question about functional programming languages and ecosystems Ask Programming

    Question about functional programming languages and ecosystems Ask Programming


    Question about functional programming languages and ecosystems

    Posted: 20 Oct 2018 01:23 PM PDT

    (Background: I am a long-term software engineer with over a decade of experience in C and C++, and a few more years of Java, Python and GoLang)

    I want to explore functional programming languages such as Haskell, OCaml etc but in a strictly production context. My question is about what functional programming I should choose. My requirements are: 1. I want to implement production code in a systems context, so I think some sort of C bindings may be useful. 2. I want enough STL-like libraries so that I don't need to implement some basic structures if possible. 3. I want to have enough library support for common algorithms like quick-sort etc. 4. It should be possible to write code that can be maintained well by others who know the language.

    I looked into some functional programming many years ago, and there were some issues with making things completely pure. For example, suppose I need to implement tree-based algorithms, I needed to pass a copy of the entire tree around repeatedly. I think we probably wouldn't need to do that in current functional programming, but such scenarios will be something common in what I do, so I would need a language that would support not passing around copies large data structures.

    Could someone tell me what sort of functional programming language and ecosystem would be the right choice?

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

    VBScript and Folder Copy Help

    Posted: 20 Oct 2018 09:05 PM PDT

    I'm attempting to make a small program that would allow me to copy a users browser data and paste it to a backup directory. Currently I have a snippet of code that looks like this

    CopyFolder "c:\Users\Rick\AppData\Local\Google\Chrome\User Data\Default", "d:\backup"

    What I want to do is have it so that "Rick" my local name would be replaced with the UserName of the pc its ran on, but currently I haven't been able to get it to work. Can anyone help me out or point me in the right direction? Thanks in advance!

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

    A question regarding De Morgan's Law and programming with NOR conditionals

    Posted: 20 Oct 2018 08:36 PM PDT

    Given that De Morgan's laws are:

    • the negation of a disjunction is the conjunction of the negations

    • the negation of a conjunction is the disjunction of the negations

    I am left confused as to me NOR functions as :

    if(!(a || b)) 

    which when a is false or b is false returns false, while

    if(!(a && b)) 

    returns true.

    In regards to neither nor, that's like saying neither nand. It doesn't work. neither a nand b would actually have to say neither a nand b,c as neither implies more than one and like neither, nand must proceed it's variables. I.E Neither a and neither b and c, neither a or neither b or c.

    Unless of course it's meant to be Neither Neither And to which that would just be !!(A&&B) which is just (A&&B), though personally I feel said in an odd way.

    What am I missing? Sorry if I am unclear, it is late and I have been thinking about this too long.

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

    cannot open source pch.h

    Posted: 20 Oct 2018 04:41 PM PDT

    no idea why this happened. just made a simple program and all of a sudden i can't get rid of this error. I followed this guide https://stackoverflow.com/questions/6096384/how-to-fix-pch-file-missing-on-build and it didn't do anything. I also repaired visual studio from the installer, and nothing changed. Anyone have any clue about how to fix this? Also if I need to reinstall visual studio, will my previous programs be erased? Am I able to just copy the folder they are saved in and replace the new installed one with that.

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

    [UI Toolkits] How do assistive technologies work on Linux? Specifically, the Qt Toolkit and how it communicates with accessibility software.

    Posted: 20 Oct 2018 07:28 PM PDT

    Hi, I'm just beginning to do some research on assistive technologies (e.g. for the visually impaired) and I'd like to know the inner workings of these technologies.

    For example, I know that some websites have ARIA attributes that can enable such technologies to make sense of websites, like "this is the main article", or "this is a prompt that pops up and requires user attention", or "this is the cancel button". Another example is the "QtAccessible" class and the entire repertoire of subclasses and APIs available for an application developer.

    So far, so good... but what about the software that actually makes such assistive stuff work? The software that gets an alert and activates the speaker and reads aloud a dialog's text?

    Has anyone had any experience with these tools, not only using them, but programming them?

    I'd like to make my own assistive tool, where do I start? And how can I access all that information (say, a message log that displays in real time what happens in an accessibility-enabled GUI app)?

    Thanks in advance.

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

    How do I clear the search history tied to my gmail account when reformatting doesn't delete it?

    Posted: 20 Oct 2018 07:23 PM PDT

    [edit 2] Resolved, Tolmos is a god! Added flair for resolved too. After reformatting, if I log in to my accounts again, I see awful old search autocompletes and suggestions loaded with past intent in chrome search bars. That makes me think gmail is trying to help me buy shit, but is actually just making it so I can't stream and be logged in to my regular emails on one pc. I know if I reformat and never log in to anything at all, they can't all merge together and f* me, but does anyone know how I can purge gmail's record of my searches when "everything" isn't enough? I'd like to be able to check my email on my computer, but also stream on a seperate account that doesn't flash porn keywords for everyone to see. I could be confused, sorry.

    edit: I'm sure that many of you don't think this has anything to do with programming. Please, guide me an appropriate subreddit for this sort of question because Askreddit is only for "open-ended discussions" and other than programming I can't quantify the category this question falls into.

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

    In android studio how do i set the whole activity "blocked"?

    Posted: 20 Oct 2018 04:52 PM PDT

    something like a login activity, when i click on the login button i want to show a progress bar(circular one) and hide the rest of the activity in a black background with opacity

    edit: i already have the progress bar working

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

    Recommendations for creating a Image/Video Tag Program

    Posted: 20 Oct 2018 04:06 PM PDT

    Hello,

    i hope i chose the right subreddit for this kind of question.

    I want to create a program that can open pictures (mostly jpg, png) and videos (mp4, webm, some gifs) and give them tags / sort them by those tags. If possible with thumbnail previews.

    There are currently 2 options i have thought about:

    1. Write a C# Windows Forms Application
    2. Use Chrome and Javascript with a local database

    Are those options viable? Any kind of recommendations or tips are appreciated! Thanks.

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

    What proxy/IP-cycling process do you use for web scraping?

    Posted: 20 Oct 2018 03:05 PM PDT

    I am making a web scraper with python+selenium that collects google/duckduckgo search results. I am wondering what people who have successfully done something similar in the past used to prevent getting their IP banned.

    I understand the best way to do this, in addition to not making too many requests too fast is to cycle through different IPs and/or use a proxy server that anonymizes their IP.

    Just wondering if anyone can point me to a specific service they used and were successful with.

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

    Where could I go online to hire a freelance back-end web developer (?) to set up

    Posted: 20 Oct 2018 02:55 PM PDT

    multiple servers with already existing python scripts, needs to be tweaked a bit.

    I'm trying to decrease latency with the scripts but I'm not a programmer so it's a bit intimidating. I do not want to be scammed. What's the best general approach to this?

    Upwork is a little sketchy from my experience and I'd be willing to pay whatever, money is not an issue.

    Thank you!

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

    I have an idea but i know absolutely nothing about programming

    Posted: 20 Oct 2018 02:34 PM PDT

    Hello, i'm sorry if this doesn't belong here, i don't know where else i could ask this.

    My hobby is learning languages and I came up with an idea earlier but i have no idea how to do it or if it's even possible, the idea is to take a bunch of media in my target language and then generate thousands of flashcards with subs2srs and build a database of thousands of sentences with video/audio/text, i then want to be able to search for a grammar point or a word that i'm currently learning and be able to see all of the sentences containing that word or grammar point, I can already kind of do this in Anki, but it isn't very efficient and it isn't what anki was made for.

    Is this possible and is there a relatively easy way to do it? if this sounds really stupid please don't be mean lol

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

    What languages are used to create ITSM tools?

    Posted: 20 Oct 2018 12:11 PM PDT

    A strange question I know but I was wondering what languages are being used to create ITSM cloud case management solutions such as ServiceNow and BMC Remedy?

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

    Python Lists

    Posted: 20 Oct 2018 12:01 PM PDT

    Okay, so I got a variable asking for 3 words seperated by commas. How do I add those three words to a list.

    Example:

    Words = "hello,fat,cool"

    list = ["hello", "fat", "cool"]

    ^ How do I do this.

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

    Software for Amazon reviews?

    Posted: 20 Oct 2018 07:45 AM PDT

    Or reviews on any website, really. Is it possible to make a software that tells you the words/phrases that are most used overall in reviews of a certain product?

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

    Problem with snake game. It should start when I press 'p'.

    Posted: 20 Oct 2018 10:03 AM PDT

    include <iostream>

    include <conio.h>

    include <string>

    include <windows.h>

    using namespace std;

    bool gameover;

    bool shutDown;

    const int width = 40;

    const int height = 40;

    int x, y, fruitX, fruitY, score;

    int tailX[400], tailY[400], nTail;

    enum eDirection

    { STOP, LEFT, RIGHT, UP, DOWN };

    eDirection dir;

    void

    StartScreen ()

    {

    system ("cls");

    cout << "\n BUN VENIT - SNAKE!"

    <<"\n\nApasa 'p' pt a incepe!"

    <<"\n\nApasa 'q' pt a opri jocul!"

    <<"\n\nApasa 'i' pt instructiuni!"

    <<"\n\nScorul tau anterior: " << score << endl;

    }

    void

    Instructions ()

    {

    system ("cls");

    cout << "\n Apasa 'w' pentru a merge in sus."

    <<"\n\n Apasa 's' pentru a merge in jos."

    <<"\n\n Apasa 'a' pentru a merge in stanga."

    <<"\n\n Apasa 'd' pentru a merge in dreapta."

    <<"\n\n\n Apasa 'm' pt a ajunge in meniu.\n";

    string input;

    cin >> input;

    if (input == "m")

    StartScreen ();

    }

    void

    FruitSpawn ()

    {

    fruitX = rand () % width;

    fruitY = rand () % height;

    }

    void

    Setup ()

    {

    gameover = false;

    shutDown = false;

    dir = STOP;

    x = width / 2;

    y = height / 2;

    FruitSpawn ();

    score = 0;

    nTail = 0;

    }

    void

    Draw ()

    {

    system ("cls");

    for (int i = 0; i < width + 2; i++)

    {

    cout << "#";

    }

    cout << endl;

    for (int i = 0; i < height; i++)

    {

    for (int j = 0; j < width; j++)

    { 

    if (j == 0)

    cout << "#";

    if (i == y && j == x)

    cout << "O";

     else if (i == fruitY && j == fruitY) 

    cout << "F";

     else { 

    bool print = false;

    for (int k = 0; k < nTail; k++)

     { 

    if (tailX[k] == j && tailY[k] == i)

     { 

    cout << "o";

    print = true;

    }

    }

    if (!print)

    cout << " ";

    }

    if (j == width - 1)

    cout << "#";

    }

    cout << endl;

    }

    for (int i = 0; i < width + 2; i++)

    cout << "#";

    cout << endl;

    cout << "Score :" << score << endl;

    }

    void

    Input ()

    {

    if (_kbhit ())

    {

    switch (_getch ())

    { 

    case 'a':

    dir = LEFT;

    break;

    case 'w':

    dir = UP;

    break;

    case 's':

    dir = DOWN;

    break;

    case 'd':

    dir = RIGHT;

    break;

    case 'x':

    gameover = true;

    break;

    }

    }

    }

    void

    Logic ()

    {

    int prevX = tailX[0];

    int prevY = tailY[0];

    int prev2X, prev2Y;

    tailX[0] = x;

    tailY[0] = y;

    for (int i = 1; i < nTail; i++)

    {

    prev2X = tailX[i];

    prev2Y = tailY[i];

    tailX[i] = prevX;

    tailY[i] = prevY;

    prevX = prev2X;

    prevY = prev2Y;

    }

    switch (dir)

    {

    case LEFT:

    x--;

    break;

    case RIGHT:

    x++;

    break;

    case UP:

    y--;

    break;

    case DOWN:

    y++;

    break;

    case STOP:

    gameover = true;

    }

    if (x == fruitX && y == fruitY)

    score++;

    nTail++;

    FruitSpawn;

    }

    int

    main ()

    {

    do

    {

    StartScreen ();

    string input;

    cin >> input;

    if (input == "p")

    { 

    Setup ();

    if (!gameover)

     { 

    Draw ();

    Input ();

    Logic ();

    Sleep (100);

    }

    }

    else if (input == "i")

    Instructions ();

    else if (input == "q")

    shutDown = true;

    }

    while (shutDown == false);

    return 0;

    }

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

    Some questions about procedural generation...

    Posted: 19 Oct 2018 10:40 PM PDT

    Hi. I want to know how i can procedurally generate an (almost) infinite play-field for a game. However i'm having trouble understanding some things.

    I understand the concept of a seed, used to randomly generate the position and number of objects drawn to the screen. For example, set a random seed, and based on some simple logic, determine how many entities should be drawn, and their x/y position based on that random seed.

    So for example, if i have a 320x240 canvas, using just a seed within those bounds, obviously restricts the play-field to 320x240, yet you could use a camera to move around it and scaled/zoomed. But you still end up with a boundary where the world ends.

    Would i be right to generate a grid of play-fields, each with their own seed relative to a "master seed" ? If that makes sense. Such as having a 3x3 grid each consisting of 320x240 canvases. In terms of having 9 play-fields loaded into memory at any time. As the player traverses onto a new canvas, shift the grids which are loaded in memory, to use the relevant seed? I haven't tried mocking this up in any code yet, but i'm wondering if this makes sense to anyone that can give some feedback on.

    How would i do this? Would it be as simple as using something like (seed + x + y) to generate a seed for relative cells/play-fields?

    What i'm trying to state is that, the starting play-field would be known as 0,0 (as in x,y co-ords), the play-field to the east of that would be 1,0 and the cell to the north would be 0,-1... then simply calculate that value into the "master seed" ?

    Eg; Player moves across the starting canvas to the east, when they collide with the edge of the canvas, generate a new off screen cell based on the cell's coordinates / seed , whilst removing the opposing cell (off screen to the west).

    Would this work?

    For context, this would be applied to a 2d top-down space shooter which should have a seamless (almost) infinite play area.

    Edit; here's a crude diagram i quickly scribbled: https://i.imgur.com/wFvqwXh.png I realise some cells will be identical in the example; but is this the right approach? I would assume that using actual pixel coordinates of each cell would eliminate that repetition.

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

    How to possibly make few grands a month by starting a business?

    Posted: 20 Oct 2018 02:10 AM PDT

    as a programmer (junior) I find making few grands a month pretty much an impossible goal, unless we're talking about getting employed. But I'm not talking about employment, I'm talking about starting a business.

    One could get self employed as a contractor, but this requires an insane amount of knowledge and experience, a lot of non-programming hassle (i.e. searching for clients), which on it's own is a challenge for socially inept people, and very long working hours. Then one is competing against agencies, so good luck running your business without lowering hourly rate and getting only half of this in your pocket due to taxes and health insurance. At the end of the day it's better to stay an employee - way less effort, but the same payment after you look at the big picture.

    Then there is starting a company to either a) rent your developers to other business or b) develop your own product. Option b) is potentially very lucrative, but risky as hell, while option a) less risky, but the profit margins fuking suck.

    Dunno, but I think that in the world in software development going on your own is not that lucrative at all in comparison to 9-5 jobs, which are well paid in most western countries. That's especially the case as swd is one of the longest, hardest, tedious and frustrating and boring processes before any results are achieved.

    Maybe instead I should think about selling sth.Flipping biz?

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

    No comments:

    Post a Comment