Using boolean variables in C Ask Programming |
- Using boolean variables in C
- Is there a way to make video games bot in nodejs?
- Advice on flattening styling layers?
- ASAP Java Assistance, Willing to pay
- Weird issue with file i/o
- Display empty star rating if numerical average is 0
- What language/skill do you think should be learned when learning to program?
- Is there a text editor that can represent its code as a diagram?
- template function that acts different depending on which type of vector is passed to it?
- Painting text on a canvas, and the after effects
- Can you figure out this algorithm?
- Best way to monitor changes to 1m+ profiles via API?
- Whats wrong with my sort algorithm?
- Using Telnet in C++ (Linux)
- Wondering if my idea is possible and what it would take to program such a thing
- Azure Service Fabric Plugin for Eclipse no longer available?
- Socket Linux Help
- ALSA MMAP Access help
- URGENT: fix my algorithm before a deadline
- Would like a way to access a property created on the initial thread of a program using async/await pattern in C# from any subsequent thread, similar to a request or thread identifier (code called from both Asp.Net API and console app)
- Javascript Array help
Posted: 27 Apr 2018 12:52 PM PDT What is the proper way to use boolean variables in C.
Actually is it even "good design" to use booleans in C rather than integers? [link] [comments] |
Is there a way to make video games bot in nodejs? Posted: 27 Apr 2018 09:13 PM PDT I want to make a bot like in this video where the the bot calculated the numbers on the screen and respond according to all the logic based on the screen shots. [link] [comments] |
Advice on flattening styling layers? Posted: 27 Apr 2018 09:02 PM PDT I'm building a fast, specialized HTML processor in C which converts basic HTML into style instructions. I'm already perfectly fine extracting all tags into one array and storing their effective range on the resultant (human displayed) text. This, for example, is what I'm printing out from my The resultant, human displayed text (which all the above indexes are anchored to) is: The original HTML is: The issue is that the styling system I'm using only lets me have one layer of formatting, so no nesting allowed. I'm trying to think of a good, high speed way to make this into a simplified, 1D range like as follows: 6-11: bold 11-26: bold+italics 26-28: bold 28-36: p-block+link I'm an int array with a length the size of the total text range would work if I gave each text format a unique bit. I could then perform a pass over the array for each formatting range and apply the bitmask that corresponds to the tag. I'd then of course need to reinterpret all the bitmasks. Any thoughts on how I could be more efficient? I'm trying to make this super fast and so every little bit is important! [link] [comments] |
ASAP Java Assistance, Willing to pay Posted: 27 Apr 2018 07:28 PM PDT halfway completed through a basic menu program, desperately need help since i've hit a wall. Willing to pay LTC / ETH for assistance with completion of this program. What is left: Struggling to catch output statements to print, configuration of sales tax and regular pricing, action/itemlistener and need help with borderlayout/panels. Msg me directly or post here if interested in helping. will be fairly compensated for time and effort. [link] [comments] |
Posted: 27 Apr 2018 06:52 PM PDT Hi everyone, I've run into a really odd problem and was hoping someone has seen something similar. I'm working on an assignment that uses file i/o. My current function is adding a line to the end of my file (Adding an item to a food menu). My program reads the file when I run it and should update the information to account for the new item that was added. When I run the function to add a line and re-run the program, it does not appear that the line was accounted for when reading the file when I run the program. HOWEVER, if I open the file (like physically open the .txt file in terminal) and save it, the program runs perfectly as intended and notices the update. Why could it be that when I open the text file in terminal before running, it makes the program function properly. I am using C++ Here is an example of a run of the program https://imgur.com/a/LsLBECA [link] [comments] |
Display empty star rating if numerical average is 0 Posted: 27 Apr 2018 02:35 PM PDT In my Wordpress plugin, visitors can leave a star rating on the post as comment feedback. This star rating is shown elsewhere as a post archive table, providing an overview of data on each post (author/rating/etc). It is working as expected, except (a) the posts without any comments show nothing and (b) the stars are a bit too large. The math in this snippet s throwing me a bit, where I am trying to figure out how to show 5 empty stars for posts with no comments, and make the stars a bit smaller. Any help would be appreciated! [link] [comments] |
What language/skill do you think should be learned when learning to program? Posted: 27 Apr 2018 05:26 PM PDT also, is there anything you wished you had learned sooner, like what you use for a job? [link] [comments] |
Is there a text editor that can represent its code as a diagram? Posted: 27 Apr 2018 05:25 PM PDT Diagrams / flow charts are great for visualizing what a program does and the pieces that do each thing. However, the only diagrams I've heard of are separate files from the code itself, meaning you need to update the code *and* the diagram each time you make a change. Is there a text editor that is smart enough to represent code as a diagram? This way, the code and the diagram would always be in sync. Ideally, I'd also be able to add blocks visually, then "zoom in" to them on a text level to fine-tune them. [link] [comments] |
template function that acts different depending on which type of vector is passed to it? Posted: 27 Apr 2018 01:19 PM PDT I'm writing a program for class where i have to use a single template function that sorts the vector thats passed to it then returns the sorted vector. That part i understand, i know how to sort all the primitive data types and i know how to use template functions, what i DON'T know how to do is make the function KNOW which type of vector was passed to it (vector<int>, vector<double>, vector < char>, vector < string> . is there any way to implement like a "if vector V is a char vector..." or something? this is c++ btw [link] [comments] |
Painting text on a canvas, and the after effects Posted: 27 Apr 2018 09:17 AM PDT So I was thinking about how applications like web browsers, word processors, etc paint text on a canvas which is pretty straightforward. But I then started to wonder how the copy/paste function works. When text is rendered onto a web browser canvas, for instance, it is now a graphic item. So how does highlighting this text work? I suppose this is really no different than any GUI which implements textboxes for example. It seems there must be underlying map of sorts to help the UI find and locate these objects, because even the act of selecting text must result in a repaint of the canvas. [link] [comments] |
Can you figure out this algorithm? Posted: 27 Apr 2018 04:28 PM PDT I posted on programminghelp and it didn't get a response. I have a simple program for class due at midnight that i have to create a simple sorting algorithm using 1 stack, 1 queue, and outputting to a vector. It has to be a template function and work for all primitive data types. i got it to correctly get the first and last element correct but the ones inside aren't. Please help template<typename T> vector<T> mysort(vector<T> data) { vector<T>outvector; stack<T> mystack; queue<T> myqueue; for (int i = 0; i < data.size(); i++) { mystack.push(data[i]); } for (int i = 0; i < data.size(); i++) { } return outvector; } [link] [comments] |
Best way to monitor changes to 1m+ profiles via API? Posted: 27 Apr 2018 11:38 AM PDT I'm building a vehicle data tracker for my dad's small car lot, essentially just for fun, something for us to watch/play with together. We've quickly piled up more vehicle profiles than we (read: our software) can handle. Originally, the process was simple:
This worked well for the first few thousand vehicles, but it's gotten to the point where it basically won't run anymore. The API we use only allows 100 profiles to be fetched at a time. I could run this task back to back to back, but that just seems wrong. The issue is essentially finding the most efficient way of watching a URL and waiting for the output to change. I've never built anything of this nature, just curious what the best way to go about something like this would be. Is it a matter of raw computing power that I don't have, or is there an inherent flaw in my approach? I'm guessing the latter, thanks! [link] [comments] |
Whats wrong with my sort algorithm? Posted: 27 Apr 2018 03:01 PM PDT I'll leave my code at the end because its lengthy. My sort algorithm is supposed to sort everything from smallest to biggest (don't worry about main, i've got some weird requirements for my assignment, focus on the sort function) It sorts the first 2, and then gives me gibberish for the rest. so if i pass it a vector of 10 integers in random order, it successfully gives me the first 2 smallest then breaks down. i've never seen that. usually if an algorithm is broken it breaks after the first loop, its weird it does 2 successful loops and then breaks. here's the code include <iostream>include <string>include <vector>include <stack>include <queue>using namespace std; template<typename T> vector<T> mysort(vector<T> data) { vector<T>outvector; } int main() { int intarray[10]= { 1,5,8,16,60,4,2,17,6,30 }; double Intarray[10]; vector<double> intvector; vector<double> outintvector; vector<int>finalintvector; for (int i = 0; i < 10; i++) { Intarray[i] = (double)intarray[i]; intvector.push_back(Intarray[i]); } } [link] [comments] |
Posted: 27 Apr 2018 07:24 AM PDT I want to write a program that runs telnet commands and I for the life of me can't seem to find what the include lines and commands should be. I have telnet installed on my CentOS7 VM and can use it in a terminal but is there a guide to use the library in C++? [link] [comments] |
Wondering if my idea is possible and what it would take to program such a thing Posted: 27 Apr 2018 10:31 AM PDT Not sure if this is the right place to ask, but no hurt in trying. I'm looking to have a program or indicator developed that uses data on trading charts, specifically the site Trading View. There is an indicator on Trading View called the TTM Squeeze. What I'd want to do with my program is be able to find any stock or cryptocurrency that is currently in a squeeze. Here is a quick look at the TTM Squeeze indicator on Trading View and how it works. As you can see, when a stock or cryptocurrency is in a squeeze, there are red dots leading up to price action. Two green bars after a squeeze indicate momentum up, two pink bars after a squeeze indicate momentum down. So yeah, if there was some way I could create a scanner that identifies which stocks and cryptocurrency are in squeezes, that would be great! (at various time frames: 1 week, 1 day, 1 hour, 4 hour, 2 hour, 1 hour, 45 minutes, 30 minutes, 15 minutes) Let me know your thoughts on my idea and if anything like this would be possible. Appreciate it. [link] [comments] |
Azure Service Fabric Plugin for Eclipse no longer available? Posted: 27 Apr 2018 08:53 AM PDT The instruction on How to install the SF plugin has this link http://dl.microsoft.com/eclipse/azure/servicefabric to install the plugin. But it is empty, is this no longer supported? [link] [comments] |
Posted: 27 Apr 2018 08:15 AM PDT I am new to using the sys/socket library in linux and have a few questions. There is a server that I am trying to connect with to request information. Every example online seems to have the same 3 examples all stolen from one another and no one seems to break it down easily enough (at least for me!). I want to open a connection on some IP address and port no. then I would like to send a plain text command and read the output. I am doing the following: it says that I have too many decimals points in the integer for IP address but what notation should I be using? Also, is this the correct way to set up a connection using socket? Where do I say which port to use? Thanks! [link] [comments] |
Posted: 27 Apr 2018 01:55 AM PDT Hello everybody, I'm currently learning to use the Linux ALSA. As an exercise I wrote a program to record audio. Basic recording works, as well as the use of snd_pcm_mmap_readi. Now im struggeling with using the "full" mmapped access. You can find the code here: https://github.com/LLKJS/DMAaudio It needs libasound2-dev installed to compile. My problem is in file rec.c in the function read_mmap(), I guess the write access is wrong but I'm not sure how to do this correctly. I'd highly appreciate any help (and gerneral hints on how to improve this code;) ) [link] [comments] |
URGENT: fix my algorithm before a deadline Posted: 27 Apr 2018 04:05 PM PDT I posted a while ago but the thread died. I have till midnight to submit this algorithm. i created a sorting algorithm for class and needed to use a template function, exactly 1 stack, and exactly one queue. Don't pay too much attention to main, but my algorithm gives me correct first and last in each sort but the middle is all messed up. please help include <iostream>include <string>include <vector>include <stack>include <queue>using namespace std; template<typename T> vector<T> mysort(vector<T> data) { } int main() { 55.2, 31.01, 12.13, 99.99, 48.16 }; "daybreak","seventeen", "benign", "nine", "homecoming", "one", "freightcar" }; } [link] [comments] |
Posted: 26 Apr 2018 10:23 PM PDT I have a program that I need to resolve what the current transaction is in a lot of the end methods, we call a lot of these and it would be really helpful to allow the database repository methods to resolve a couple of minor things (username to allow data audits for instance). I can put a property of an interface type defining a method that can do that on the data manager, and then create a class per api or app to resolve the username accordingly. This works well but I'm using the httpcontext for the api and it seems to get dropped whenever we use a bunch of threads in parallel, and from what I've seen it isn't threadsafe anyway. (I know iis usually handles the parallel threads for you so we don't need to do this, but many methods are also called from worker applications so it's very helpful to make them parallel) It's frustrating because it works for a while, but eventually is dropped - I can see a .ConfigureAwait(false) would do this, but I've eliminated all these from our codebase. It's possible this is in a library we're calling or simply in the nature of using Task.WhenAll or the ParallelForEachAsync library. A custom SyncronizationContext gets dropped even faster (after the first await in a method). Is there any way to set up a property to track the request without putting a parameter on every repository and entity manager method in the system? Additional code, the session is set in the globas.asax.cs and called before database calls in the repository - the problem is currently in the GetSessionId: ISessionInformation interface: API Implementation of interface: [link] [comments] |
Posted: 27 Apr 2018 12:23 AM PDT I'm having HUGE HEADACHE trying to solve this. In an online made up store, the following are product SKU names, the quantity of each item ordered, and the location of the item in the warehouse. It needs to output the product SKU name and quantity only. INPUT: OUTPUT: I'm so lost as how to delete all the fluff in between the product SKU's!!! Can anyone help? [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