Why do people use functionally programming? Ask Programming |
- Why do people use functionally programming?
- Would you say clients send data "up" to the server or "down" to the server?
- How to solve this "King of the hill" code game?
- How to validate user and password on macOS programmatically?
- Does this sorting algorithm have a name?
- PROGRAMMING
- How do you go about creating something?
- In C++ why make a container of pointers rather than objects?
- How do you guys minimize asks for constant small config changes from stakeholders?
- Question about possible program that may already exist??
- My company uses a dated, bloated, buggy piece of software. I want to propose building our own. But if there's even a 1% change that my software could be used by other companies, should I build it on my own time and 'sell' it to my employer?
- [AWS] Docker Elastic Beanstalk deployment problems: CREATE works but DEPLOY fails
- How to think concurrently?
- Programming languages
- Help interpreting QuickSort question.
- How do I install and run JavaFx on Java 12.0.2 Eclipse?
- Need guidance developing an app
- Where should I build my html table
- Solving Mahjong Solitaire
- Trying to detect if a point is inside a rectangle in TypeScript
- Is it common for fixing the errors while building takes as long as creating the programme?
- If I have just this simple piece of code trying to read a number from the .in file and write it in the .out file, it always reads the number as being 0. Are the files not located where they should be? They are located in the folder with the cpp file in C:\Users\username\source\repos\project\project\
- .NET interface and base class. Differences between C# and VB.
- Image resources for testing corrupted images in various formats.
- Cyclic Tower of Hanoi with Start and Destination not part of the cycle?
Why do people use functionally programming? Posted: 28 Jan 2020 11:06 AM PST Hi, I could never understand the purpose of functional programming, when most of its uses can be easily replicated in an OO oriented languages like C++. You could even do most of it in C. The next question i would like to ask is: "Why even bother?", what speed or usability performance does it give? What niche implementions would use something like Haskell, etc? What is its purpose? Please explain, because i am currently not aware of any benifits it provides. Comming from a low level embedded engineer programming mostly in C99, (B)CPL, Assembler and C++11. [link] [comments] |
Would you say clients send data "up" to the server or "down" to the server? Posted: 28 Jan 2020 02:17 PM PST Just curious on the mental model the industry prefers. On my team, everyone but me thinks of the database/server as a "foundation" that clients "run on top of" and send data "down" to, whereas I view the client as an underling that sends data "up" to some sort of database/server cloud in the sky. This frequently causes confusion on our team and has become a bit of an inside joke. [link] [comments] |
How to solve this "King of the hill" code game? Posted: 28 Jan 2020 10:36 PM PST I found this programming challenge named "king of the hill", where the player is given a 3D boolean array/matrix, where 1 represents solid ground and 0 is air. The player "stands" on top of the ground, and is only allowed to look at the surrounding blocks (front, back left, right, and diagonally). The ground in the surroundings may be elevated or lower than the block the player is on. The player is allowed to move to a 1 block at a time, at a difference in elevation of at most 1. The player cannot move "into" a ground block, they must stand above it. Given that the player is only allowed to look at the terrain within a radius of 1 block, the challenge is to traverse and find the highest point of elevation in the terrain. I am totally lost and have no idea how to approach this problem, aside from a brute Force method. Help would be appreciated [link] [comments] |
How to validate user and password on macOS programmatically? Posted: 28 Jan 2020 03:36 PM PST Hi it seems that my question in StackOverflow is really dumb so I'll ask it here to see if someone is kind enough. I have an application that asks for the username and password of the user. Currently, for Unix systems (most of them) I read the password hash from /etc/shadow but for macOS is way more cumbersome (they use their own standard) so I wanted to know if there is an easy way to validate usernames and passwords. I was thinking of using the "login" program in a weird way for this but it's not the best solution. [link] [comments] |
Does this sorting algorithm have a name? Posted: 28 Jan 2020 05:41 PM PST I am aware of its time complexity, worst case, best case, etc. I've just not seen this listed under the 'classic' sorting algorithms and am wondering if it has a name. Thanks! python3: edit: shitty almost bubble sort. [link] [comments] |
Posted: 28 Jan 2020 08:50 PM PST I have a sensor and a Bluetooth dongle( HC 05) with SPP protocol. We have to connect the sensor to the PC via Bluetooth in which we made our game in unity 3D. The problem now is i have to write a program for the Bluetooth so that 1)unity search for the sensor ( the sensor will be having a mac address and we will be having 5 sensors, other than those 5 sensors it will not allow any other sensor to be paired with, it will reject the pairing). 2) after searching for the sensor it will start pairing with PC in which our unity is installed. i have to write Bluetooth programming, i only know a little bit of C language only. I am new to this problem, so please help me from the basics. It would be of great help. Thank you. [link] [comments] |
How do you go about creating something? Posted: 28 Jan 2020 01:06 PM PST So I've been doing CS for 3 months now, and all I know how to do is copy things and apply things from the books. But I've heard people say ''just think about something you want to create and make it''. Problem is, I haven't got the slightest clue of where to start. Let's say I want to make an application in Java where I pull a JSON file and build them into charts so that a graph can be added and my data to be more clear. How do I take steps? [link] [comments] |
In C++ why make a container of pointers rather than objects? Posted: 28 Jan 2020 01:38 AM PST This is a design question I'm curious about, I've seen different people do it their own way. I'd like to know from a memory, speed, or programming standpoint what difference does it make? For example a vector of objects, they'd be stored in contiguous memory versus pointers which could have a larger range of addresses. I'm guessing this causes CPU longer processing. Could pointers be used to maintain a reference to a specific object, incase of later operations causing address changes? edit: wow I thought I knew c++ but these comments are humbling. Thanks for the insight all [link] [comments] |
How do you guys minimize asks for constant small config changes from stakeholders? Posted: 28 Jan 2020 03:55 PM PST Currently at my company we get a lot of asks from business stakeholders to change simple configurations within the code. These might be hard coded values that weren't meant to be changed in the beginning but now the business wants to constantly change them. Or when the business wants something to be configurable we just tell them to modify JSON configuration files with fixed schemas in S3 that we can read. How do you guys solve this problem? Is there a better solution? [link] [comments] |
Question about possible program that may already exist?? Posted: 28 Jan 2020 03:21 PM PST So I may be lost but I thought this may be the subreddit to ask. The HR department needs assistance from our IT department. In a small explanation, they want automation to help with resume submissions. They are now needing to do manual auto fill of applicants data into other applications? (Website to a specific HR program and vice versa). Would there be a program to assist and or could I do this myself? [link] [comments] |
Posted: 28 Jan 2020 06:25 PM PST I don't really know where to come at this. I won't specify the software I'm using, but suffice to say that it's a Business Process Management tool. I create the processes and web forms in this software. See below for what I'm whining about if you want. However, I'm very interested in proposing to my employer that we build a new tool from scratch and phasing out the current tool. Using OpenJDK Java, MariaDB or MySQL with proper relations that correspond to the Java classes and use Hibernate, Apache or Glassfish, etc. However, it occurs to me that other companies could be interested in my software if I can get my own company interested in it. If I develop the software in-house and/or on company time, my contract says that the IP belongs to my employer. It made me think about an alternative: build it on my own time at home, and pitch it to my employer. And then maybe leave the company and sell it to them? Yeah, I'm really confused. If anyone understands what I'm trying to ask, and has any advice they'd like to share, I'd really appreciate it. Elaboration on the software I'm trashing (optional read): The software I use depends on C#, JS, VisualBasic, only supports SQL Server (which personally drives me up the wall), and is designed to enable non-software people to develop what are basically web apps. My entire day, all day, is built around finding out how to do things in the software and how to make it compatible with everything else. I'm inheriting a database that was designed on-the-fly by people who by their own admission don't have a firm grasp on database architecture. For example, they don't use foreign keys in the database. At all. They store the primary key of a foreign table, but they don't actually create a reference so nothing is enforced. [link] [comments] |
[AWS] Docker Elastic Beanstalk deployment problems: CREATE works but DEPLOY fails Posted: 28 Jan 2020 02:39 PM PST Hi, I am using elastic beanstalk to deploy server that uses Docker. I am using the eb terminal package. When I create my app and run it locally both with just docker and with the It works and I can hit the api and everything. BUT when I edit the code and run It fails with error Also extra info: I don't use Any help will be appreciated. [link] [comments] |
Posted: 28 Jan 2020 02:26 PM PST In our operating systems course, we were challenged to try to think concurrently using semaphores to solve classic problems like the consumer-producer problem and the reader-writer problem. By the end of the course, I still didn't really get the hang of it. How should I learn how to think concurrently and how can I make it second nature? [link] [comments] |
Posted: 28 Jan 2020 04:18 PM PST How do people program in other languages (besides English ) [link] [comments] |
Help interpreting QuickSort question. Posted: 28 Jan 2020 02:07 PM PST Hey there. I was hoping someone could clarify exactly what this question is asking. I don't want the answer but just an interpretation of what this is asking for. Thanks. Consider QuickSort on the array A[1:n] and assume that the pivot element x (used to split the array A[lo:hi] into two portions such that all elements in the left portion A[lo:m] are <=x and all elements in the right portion A[m:hi] are >=x) is the first element of the array to be split(i. e., A[lo]). Construct an infinite sequence of numbers for n and construct an assignment of the numbers 1...n to the n array elements that causes quicksort, with the stated choice of pivot, to (a) execute optimally (that is A[lo:m] and A[m:hi] are always of equal size) (b) execute in the slowest possible way. What I am getting from this question: I think they want the pivot to always be the first element of every array. So when quicksort starts and we do the partition, we use the A[0] of the array. Then when the list splits into two form the partition, we use the first element of those sublists. Is this correct? But what exactly do I need to answer in this question? It tells me to construct infinite sequence of numbers for n...Does that mena they are searching for a particular sequence? What exactly is the question here? I appreciate any help. [link] [comments] |
How do I install and run JavaFx on Java 12.0.2 Eclipse? Posted: 28 Jan 2020 01:32 PM PST So, at first I followed this tutorial: https://www.youtube.com/watch?v=ejx3VxuIc8w&t=453s and followed all of the steps as close as possible (I used the second method starting at 6:00). Everything seemed to be running smoothly until I tried to import the various classes and extend the Application. Everything was underlined red and I wasn't able to fix any of the errors. This is what my code looks like: https://imgur.com/a/huCtzJl I just found out that apparently I can't use this method for Java 12? And I'm at a lose as to how to get JavaFX to run. Please note that I already installed it using the directions from the video and so I can't really re-install it (I don't know how). Is this even possible anymore? Or do I need to use an entirely different IDE to run JavaFX? I would prefer to not, but if I have to then what are some suggestions? Also, if you do know how to install it using Java 12, please be as detailed as possible. I'm still learning and I don't know a lot of technical terms yet. Thank you! Edit: I don't know how to format code so here it goes. I tried to follow the rules in the FAQ, but I don't think I understood how to do it...Sorry if it looks bad. (There are red underlines underneath the javafx and Application after extends.) package application; import javafx.application.Application; } } [link] [comments] |
Need guidance developing an app Posted: 28 Jan 2020 07:25 AM PST Hello, I have a little project in mind and I wanted some help on how should I go about it. The idea is pretty simple: on one device (let's call it client) I can make appointments on available dates and on another device (let's call it master) I can delete the appointment or, after the specified date, either mark as done or reschedule. My inital idea goes like this: I will have a web server which will receive data as JSON from the client, parse it and add to the database, then the master can ask for the server for the data, parse it and show for the user. The problem here is that it just feels wrong for me to host an entire web server just for sending and receiving JSON data, http seems like overkill and I don't really know other ways on doing that. I was planning on using python-flask on the back-end and react native on the front-end. Can you show me other ways on doing that? Since this is a very very small project and the database size will be minimal, are there free options you can show me? P.S.: Sorry if this is a really dumb question, I mostly do software for hobby [link] [comments] |
Where should I build my html table Posted: 28 Jan 2020 09:02 AM PST Hello, my question is really simple: let's assume I have a table on my database and I want to display it as an regular html table, should I build it on the backend and send the table directly to the user or should I get the table data as JSON using ajax and build the table with the parsed data afterwards? What are the pros and cons? [link] [comments] |
Posted: 28 Jan 2020 08:32 AM PST This might be a better math question, but I'm not exactly sure yet. I have a friend who wrote a Mahjong Solitaire game for her website (she calls it Shanghai, apparently because Activision released a version under this name). Recently, she decided to look into the issue of unsolvable puzzles. I suggested she simply write a brute force solver, using depth-first search, and discard unsolvable puzzles (or at least warn the user?). Interestingly, her implementation seems to work swimmingly (and quickly--it finishes in less than a second) for up to 36 moves, which seems like a pretty strong coincidence: every game has 144 tiles and they are taken in pairs, so there are 72 moves in every game. After 36 moves (and this is important: whether she starts it from the beginning or from a half-solved puzzle), it slows to a crawl: it begins backtracking, and instead of a total iteration count in the tens of thousands, it quickly reaches millions. I suspect an infinite loop, but I haven't taken a close look at the code itself. Before I try to help her further though, or perhaps write a solution myself, I figured I should ask around. Really, my questions boil down to:
[link] [comments] |
Trying to detect if a point is inside a rectangle in TypeScript Posted: 28 Jan 2020 11:41 AM PST I have basically an electron app where I need to detect if the user clicked on a rectangle drawn in a canvas. I already figured out how to translate the mouse coordinates to the canvas coordinates, and I know one of the rectangle's corner coordinates, and its width and height. I can figure out if a point is inside of the rectangle pretty easily if the width and height are positive. BUT, is there an easy way to figure that out if the width and height are negative too ? Or is there an easy way to get the coordinates of another point, that would make the width and height positive ? This could be done by doing a bunch of [link] [comments] |
Is it common for fixing the errors while building takes as long as creating the programme? Posted: 28 Jan 2020 11:29 AM PST I have finally finished the first draft of my ongoing project (described in my past posts to this sub). However when I built the project I have 4 "exceptions". All of the error messages are alien to me. I have managed to resolve 1 but that is it.
[link] [comments] |
Posted: 28 Jan 2020 11:08 AM PST The code is literally as follows: #include <iostream> #include <fstream> using namespace std; int main() { int x; ifstream fin("file.in"); fin >> x; fin.close(); ofstream fout("file.out"); fout << x; fout.close(); return 0; } I created a new project and done the same thing with variations (not closing the file, not returning 0, changing the file names etc.) and it still doesn't work. Surprisingly there is just one project that actually works but didn't in the beginning. The code for it is: #include <iostream> #include <fstream> using namespace std; int main() { int n, x, ls, ld, v[100], i; cin >> x; ifstream fin("file.in"); fin >> n; ls = 0; ld = n - 1; for (i = 0; i < n; i++) fin >> v[i]; fin.close(); ofstream fout("file.out"); while (ls <= ld) { if (v[(ls + ld) / 2] < x) ls = (ls + ld) / 2 + 1; else if (v[(ls + ld) / 2] > x) ld = (ls + ld) / 2 - 1; else { fout << "yes"; break; } } if (ld < ls) fout << "no"; fout.close(); return 0; } I'd really appreciate any help, thanks! [link] [comments] |
.NET interface and base class. Differences between C# and VB. Posted: 28 Jan 2020 05:28 AM PST I am currently working on a large system that has some projects in VB.NET and others in C#. It is not reasonable practicable to unify the language. I have done a proof of concept for some new work, and I am attempting to do it in both languages to widen the proof. There are several types of Foo, but they all have a base set of properties and an encode/decode method. FooBase.A and FooBase.B will always be created the same way and have the same behaviour, so I have tried to abstract that away to the base class where it can be dealt with there, rather than being declared in everything that implements IFoo. This works, that I can declare a MyFoo, access myFooObject.A, myFooObject.C, and can encode and decode it and it gives me the C and D properties on decode. Trying to do this in VB.NET, where I have to put the "Implements IFoo.Encode" etc, seems a lot more involved. The only solution I have found so far is to make FooBase implement IFoo, give it a dummy Encode/Decode marked MustOverride, make the base class MustInherit and mark the Encode/Decode in MyFoo as Overrides. This doesn't seem to be the most graceful solution to the problem, given the elegance of the C# one just working without any effort. I am hoping that the ultimate solution for this will be in C# as it is the neater option and some of the C# 8 features look very sweet and may help this in the long run, but I am curious about VB solutions to this type of problem. Thanks! I have had a read through https://stackoverflow.com/questions/2607884/vb-net-class-inherits-a-base-class-and-implements-an-interface-issue-works-in-c and that also points to the mustoverride/mustimplement solution, but I was wondering if anything had been devised since 2010 when that was asked that could help [link] [comments] |
Image resources for testing corrupted images in various formats. Posted: 28 Jan 2020 08:50 AM PST I recently ran into this: https://github.com/YahooArchive/pngjs-image/tree/master/test/png/PngSuite And the original site here: http://www.schaik.com/pngsuite/ It's a nice collection of possible PNG images. Very useful to test if your image processing code properly handles everything. Now I'm wondering if the same thing exists for other image formats. Especially corrupt images. Google for this gives links to repair software exclusively. Adding "-fix -repair" gives more general discussion on corrupt images. The thing is, with the Png suite, it is explained for the corrupt file what exactly was done to it to make it corrupt. Changes a signature byte. Wrong bit depth. missing IDAT chunk. Etc... So it's not some random hex editing, it's targeting specific things that are expected to be there and then aren't or are wrong. So far, googling for it has turned up nothing. I'm thinking GIF, JPG, TIFF, SVG, BMP, etc... RGB color spectrum, CYMK, etc... [link] [comments] |
Cyclic Tower of Hanoi with Start and Destination not part of the cycle? Posted: 28 Jan 2020 08:39 AM PST I know how to write basic algorithms solving the Tower of Hanoi problem both in its standard 3-peg form and its cyclic 3-peg form, but I came across a statement of the problem that seems significantly more complex. The graph for it is (St, A1),(A1,A2),(A2,A3),(A3,A4),(A4,A1),(A1,Dest), that is there are 6 pegs (St, A1-4, Dest), one can move a disk from St to A1, from A1 to Dest, or along the cycle A1->A2->A3->A4->A1. If I can get all the disks on a single peg in the cycle then it becomes more or less a standard cyclic Tower of Hanoi problem but I don't know how to do that with the separate start peg. Is it possible to write a straightforward recursive solution to this problem? [link] [comments] |
You are subscribed to email updates from AskProgramming. To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google, 1600 Amphitheatre Parkway, Mountain View, CA 94043, United States |
No comments:
Post a Comment