• Breaking News

    Monday, November 27, 2017

    C code misbehaving? Ask Programming

    C code misbehaving? Ask Programming


    C code misbehaving?

    Posted: 27 Nov 2017 07:14 PM PST

    ummmm im trying to write a code and an int variable is randomly changing values? literally one line i printf it and its value is 1 (which i swhat its supposed to be) then next line, i do smth unrelated to that variable then i printf variable n again, and its 0 ????? what???? help

    the code just in case

    int chooseFile(INPUT *array, FILE *filePtr){ printf("Saved Values\n"); int i; int n=-1; char choice;

    for(i=0; i<5; i++){ if (array[i].p == 0){ printf("%i. EMPTY\n", i+1); }else{ printf("%i. %.3f %.3f %.3f %.3f %.3f %.3f\n", i+1, array[i].visc, array[i].flow, array[i].p, array[i].rgh, array[i].dmin, array[i].dmax); } if(array[4-i].full == 0){ n = 4-i; } } printf("%i\n", n); //at this point, n is 1 like it should be fflush(stdin); printf("Would you like to use a saved value? (y/n):"); scanf("%lc", &choice); printf("%i\n", n);//print n again and its 0? pourquoiiii if (choice == 'n'){ if (n == -1){ printf("%i\n", n); printf("Choose a set to overwrite:\n"); scanf("%i", &n); n = n -1; } collectInput(&array[n]); } return n; } 
    submitted by /u/ogh1234
    [link] [comments]

    How do I store images on Server from Website

    Posted: 27 Nov 2017 03:16 PM PST

    Hello. I have a website in which I am trying to store the images I upload there onto a server, and then retrieve those files later on.

    I have been able to correctly Store the Img NAMES to SQL on my webserver, however I cant seem to store the images.

    I read somewhere I should store the images on the disk of my server, then store the file paths to SQL. This makes sense, however, I am unsure how to store images on the disk.

    I am looking for easiest way to do this-

    Thanks

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

    Downloaded flash file won't play correctly?

    Posted: 27 Nov 2017 04:33 PM PST

    I recently rediscovered a favorite childhood game--it's a web based flash game but I wanted to download it for offline use. I went into the code, found the embedded .swf file, and downloaded it--but when I opened it on chrome, parts of the game just went missing, it said "error" for "downloading file"--what's going on? I suppose I could just stick with the online version, but after several attempts, I'm curious to see what the problem is. Any help would be appreciated--thank you!

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

    Develop on Windows and iOs

    Posted: 27 Nov 2017 03:45 PM PST

    What would be the best way to sync my code and changes with my PC and iPad? I use Visual Studio Community 2017 for C++, and would like to write code on my iPad (not compile, I am aware I can't do this offline on iPad). I would like to use GitHub (don't have to, but like the idea of it), but cannot find a solution. Any ideas and help is appreciated.

    Thanks, Josh.

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

    How to deal with CORS when client is behind proxy?

    Posted: 27 Nov 2017 05:07 PM PST

    I have a web application that makes a request to a 3rd party api server. This is normally fine, as the 3rd party server has set it's headers properly for CORs. However, I have clients who sit behind a proxy. So all the requests to this 3rd party server gets re-directed and the returned response from the proxy server does not have the headers set up correctly for CORs.

    I get this error: Failed to load https://api.mapbox.com/geocoding/v5/mapbox.places/test.json?access_token=&types=country,region,place: Redirect from 'https://api.mapbox.com/geocoding/v5/mapbox.places/test.json?access_token=&types=country,region,place' to 'https://yvr-proxy.ds.ca:333/?cfru=aHR0cHM6Ly9hcGkubWFwYm94=' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8787' is therefore not allowed access.

    Should the onus be on the client to configure their proxy correctly, or should developers be responsible to figure out a way through this situation?

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

    Is 'reverse phishing' whereby sites lay honey-pots (i.e. purposely insecure forms for SQL injection) a thing? I could see it as a novel and interesting way to find the identity of hackers, and be used as a sort of counter-intelligence measure.

    Posted: 27 Nov 2017 08:31 PM PST

    Questions to ask a prospective employer?

    Posted: 27 Nov 2017 10:27 AM PST

    So I've been doing this a bit and am noticing that retirement is coming up sooner rather than later...and I'm not really digging where I am, career wise.

    What ends up happening is I get excited, show up...pick everything up right away...and start noticing things I can help fix. Or I'll start introducing common idioms and they're seen as "too complicated" (C++ native speaker). Hit a brick wall of resistance to even teaching my skills to others.

    It's weird.

    Usually I come in and I can see right away that the code is a huge mess. Testing procedures are shit, or too complicated...generally manual...code review process, standards, etc... They don't exist or are not read.

    Like I know part is me but no...a lot is really the environments I keep getting myself into. So what I think must be happening is that I'm not asking the right interview questions. So what are some good ones...because this has had a massive impact on my career, life enjoyment...the works. I never feel like I can contribute to my potential and in fact my potential has been waning. I'm shockingly atrophied working for places like that.

    So here's a couple I can think of to ask next time:

    • Can I see your coding standards document?
    • Can I see a representative piece of code?
    • (C++ especially) How stuck are you in legacy methods and styles and what are you doing to try to get out and use modern approaches?
    • Has there been any progress on that? (I've found plenty of places that are planning to fix shit...someday...when it's more convenient).
    • What are you going to do for me, in exchange for my work, to help continue my development? Do I have to justify that training by showing how it can be useful in my current position?

    Anyone think of some good others? Interview questions to the interviewer...I want to go in armed. I don't want to have to keep moving from one thankless position to another.

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

    What salary premium should I demand for a job requiring secret clearance?

    Posted: 27 Nov 2017 02:12 PM PST

    Let's say I make $100K now. What premium should I demand for a job requiring US Secret clearance? Assuming all else equal.

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

    Assembly language vs executables

    Posted: 27 Nov 2017 07:58 PM PST

    So, to my understanding, an .exe file is high-level source code compiled down into "machine code". Another way you could write this program is with direct CPU opcodes, i.e. assembly language. You could then assemble this into a binary your computer could run.

    My question is: Am I right in thinking that when you compile a program, you're not really compiling it into machine code, but more like code for the kernel to process? I guess the kernel does some translation or mapping between the instructions in a .exe file and the actual CPU?

    Even the simplest .exe file from Windows would not run on Linux, even though the underlying CPU is exactly the same?

    Thanks for any insight!

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

    C# Extracting Integers from a String after a specific set of characters.

    Posted: 27 Nov 2017 03:37 PM PST

    I'm using Arduino to scan an RFID card and forward its ID to a Visual Basic project.

    When scanning the card I get these lines

    A new card has been detected. The NUID tag is: In hex: 68 26 19 10 // <--- Here's the ID In dec: 104 38 25 16 PICC type: MIFARE 1KB Card read previously. PICC type: MIFARE 1KB 

    Now what i want is the HEX code on the third line. But can't for the life of me figure out the right methods to use to extract the integers after the "In hex:" and place them in a new integer.

    I'm writing this the program in C#

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

    Entry level developer working at a startup. Advice on getting my first full time job.

    Posted: 27 Nov 2017 07:43 AM PST

    I have been working at a startup for the past 6 months. I was applying to jobs all over for a few months before that, and was getting very little traction. At the time I heard back from the startup, I was in dire need of money so I took the job. It's been stressful but I've been working hard, learned a decent amount and made some money to pay the bills.

    Recently, I've noticed a declining interest in my bosses for the company. They both have a few other projects that are making them money. Allocation of my hours has been very sporadic and stressful: I was switched down to 3 days a week, and then next week given an assignment that had me working till 2AM.

    I am the only developer on the team and I want to be in a situation where I have more experience devs to learn from. With my schedule it's been a struggle to learn new languages which was something I enjoyed but haven't been able to put enough time into. What are the best ways I can revamp my resume and begin my job search again? Also, I have some money saved up so at what point does the stress from this current situation overshadow what I am making hourly?

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

    First day on the first job, got a huge #legacy project to work with. #JSP #webDev

    Posted: 27 Nov 2017 04:47 PM PST

    I just graduated from college and started a new job at a medium sized company today. We managed to get teh development environment set up relatively quickly. Now I am to try and understand a massive and complicated web application (JSP). Not really sure where or even how to approach starting this kind of large problem. If any of you guys had some philosophy tips to approach a situation like this that would be great.

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

    Beginner learning programming. What apps should I have on my computer?

    Posted: 27 Nov 2017 05:21 AM PST

    Hey guys. Starting to get into learning how to program and I just got a new laptop for this purpose. What should I have installed into the laptop that can help me learn or get started in programming?

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

    What kind of entry-level programming jobs are out there? What kind of pay should I be expecting right out of school?

    Posted: 27 Nov 2017 04:01 PM PST

    Populate an email with semi-random info.

    Posted: 27 Nov 2017 03:58 PM PST

    Hey guys is there a software that will pull somewhat random tidbits of information and write it into the email? I'm looking to have an email sent out daily that has random facts written into it to my team so that we can talk about them on a call. These facts would be a data point from the company or a team value etc. Does something like this exist or is it even possible?

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

    Database recommendation, time series?

    Posted: 27 Nov 2017 09:55 AM PST

    I'm looking for database recommendations, probably a time series db? I'm currently using a custom file based system packed as binary data storing around 9,500MB a day, looking to increase to 50,000MB+ per day.

    The system stores device metrics, around 90 metrics per device at a 1 minute resolution. I'll need to query the database back in time by multiple years for multiple devices.

    Potentially querying a total of 100 metrics per minute over a period of 3 years.

    I'll need to be able to summarise the data to 30 minute / 1 day data and look for trends etc etc.

    Any ideas on solutions I should prototype?

    Thanks.

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

    Desktop-based Digital Ocean droplet manager

    Posted: 27 Nov 2017 11:01 AM PST

    I've been thinking about making a desktop (probably Electron based) manager for Digital Ocean droplets. Personally, I only have 1-2 droplets on there and I don't use them for anything crazy - so console access and the site is fine for me. I'm wondering if there is some use case for having the ability to manage all of your droplets in a standalone app, as opposed to having the tab get lost in your browser? Maybe for someone with dozens of droplets?

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

    Why doesn't the government sign corporate websites?

    Posted: 27 Nov 2017 10:08 AM PST

    Right now when someone sees the green padlock in their browser they assume that the site is "safe", but the padlock says nothing but that the connection is encrypted. OTOH, if the government could sign these websites, too, they could assure that the website belonged to a specific corporation, which allows for actual trust. What technical / other barriers prevent this sort of system?

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

    Open source solution for video and auido streaming

    Posted: 27 Nov 2017 07:35 AM PST

    Hi!

    I'm currently working on a programming project, and I want to create something similar to skype, where people(among other things) can communicate with audio and video. To avoid creating an audio and video streaming solution from scratch, I was wondering if any of you have any open source solutions to recommend? :)

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

    Would like to learn programming. Starting point.

    Posted: 27 Nov 2017 09:27 AM PST

    Hello,

    I posted this in /r/askprogrammers as well

    I'm 26 and interested in learning programming. I'm currently a Fixed Op manager for a major dealership but I find it very draining.

    I'd like to learn programming over the next 2-3 years and maybe segway into a new career.

    I know there are many different paths you can take, and I am probably not even aware them all.

    I've read a little about PenTesting, and it seems like it's something I could enjoy doing for a long time. I was wondering what I should start learning if that is the direction I'd like to take.

    But feel Free to tell me why that's a bad idea and suggest alternatives.

    Thanks to anyone reading.

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

    C Language: How do I clear the console from the lines I have printed?

    Posted: 27 Nov 2017 08:37 AM PST

    Doing some assignments in C, and one of the requirements is that the console must be clear after running the programme once without closing the programme.

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

    Best method for unit testing an app that connects to a database

    Posted: 27 Nov 2017 06:05 AM PST

    I'm writing an application that connects to a mysql database (XAMPP with PHPMyAdmin) using Scala with the Spring framework.
    I would like to do unit testing for all of my APIs but this would mean I would need a local database that I could run and clear with each test methods execution.
    What would be a recommended method of doing this?

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

    C language: printf function not working after while loop?

    Posted: 27 Nov 2017 05:40 AM PST

    int main() { char exitSelector = 0; while(exitSelector = 0) printf("Hello World!\n"); exitSelector = 1; return 0; } 

    The programme however does not print "Hello world!". After some experimentation, I found that the while loop seems to be causing the issue. I'm new to C and have only used python.

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

    how do i make my website take in user comments but have those comments emailed to me anonymously?

    Posted: 27 Nov 2017 07:40 AM PST

    using only html

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

    Help with creating a pokemon battle in Java

    Posted: 27 Nov 2017 07:19 AM PST

    Hey r/AskProgramming

    For my computer science final we need to create a program in java. I made a working pokemon battle simulator but am unhappy with the result. It requires the user to type in the pokemon stat values and the pokemon themselves are only able to attack with one move. I'd like to have the user of the program be able to pick from a group of pokemon with predetermined move sets and stat values. However, I have no idea on how to make this happen. Any help would be appreciated. 
    submitted by /u/dododoggy
    [link] [comments]

    No comments:

    Post a Comment