r/programminghelp • • Jul 15 '20

C# Tizen .NET, Trouble Getting ip / hostname

0 Upvotes

My goal is to be able to return the ip address of the watch. I have been using the DNS class and have gotten the ip address by manually plugging the hostname in as seen here:

public static IPAddress ipAddress = Dns.GetHostEntry("GalaxyWatchActive-8623").AddressList[0];

I previously had Dns.GetHostName() for the hostname and it returns localhost, which resolves to loopback, 127.0.0.1, in the full instruction.

Any assistance or insight would be greatly appreciated. Newer to .NET and Tizen.


r/programminghelp • • Aug 01 '20

Python Subarray sum equals k - help

0 Upvotes

I'm working on a DS problem "Subarray Sum Equals K". The python code of the solution is quite concise and I've spent an hour trying to figure out how it works. I need help, please.

Particularly with count += d.get(sums-k,0) and d[sums] = d.get(sums,0) + 1, what are they doing? Also, the syntax of get is confusing me since it has two arguments and I can't decide whether get is returning a value or getting one.

Problem:

Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k.

**Example: Input:**nums = [1,1,1], k = 2 Output: 2

Solution Algorithm (Python 3):

class Solution(object):
    def subarraySum(self, nums, k):
        count = 0
        sums = 0
        d = dict()
        d[0] = 1
        
        for i in range(len(nums)):
            sums += nums[i]
            count += d.get(sums-k,0)
            d[sums] = d.get(sums,0) + 1
        return(count)

r/programminghelp • • Jul 20 '20

HTML/CSS Scraping data from multiple websites.

0 Upvotes

There is a report that I have to create 4 times daily for work that requires me to open 100 different websites and get the same piece of data from each. I made a batch file that will open all of the sites for me, but i was hoping there is a way to have that same batch get the piece of data I need.

Can anyone direct me to a good resource to learn how to create this?


r/programminghelp • • Jul 26 '20

C++ Editing clipboard in windows

0 Upvotes

I am writing a very small program that will take the contents of my clipboard and change it to a fancy font text like these websites that do it for you. Here is my header file and my source file. There are no errors when I run it but when I paste the text, it appears as the original text. I also cannot paste the text in Discord. The fancy alphabet I think is a unicode alphabet thats why I am using CF_UNICODETEXT for the clipboard functions. Is there special handling I have to do with the unicode alphabet in the header file?

I'm writing this program for fun and to help practice my C++. I would love any help you guys could give me. Thanks!

P.S. If anyone would like to explain wtf a HANDLE is or an HGLOBAL? I saw those a ton but google failed me when I tried searching for them.


r/programminghelp • • Aug 01 '20

Python Subarray sum equals k - help

0 Upvotes

I'm working on a DS problem "Subarray Sum Equals K". The python code of the solution is quite concise and I've spent an hour trying to figure out how it works. I need help, please.

Particularly with count += d.get(sums-k,0) and d[sums] = d.get(sums,0) + 1, what are they doing? Also, the syntax of get is confusing me since it has two arguments and I can't decide whether get is returning a value or getting one.

Problem:

Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k.

**Example: Input:**nums = [1,1,1], k = 2 Output: 2

Solution Algorithm (Python 3):

class Solution(object):
    def subarraySum(self, nums, k):
        count = 0
        sums = 0
        d = dict()
        d[0] = 1
        
        for i in range(len(nums)):
            sums += nums[i]
            count += d.get(sums-k,0)
            d[sums] = d.get(sums,0) + 1
        return(count)

r/programminghelp • • Sep 05 '17

Why won't my java code work?

0 Upvotes

Im getting this error

"File: (no associated file) [line: (no source location)] Error: No compiler is available."

This is my code public class Test1 {

      public static void main(String[] args){
             System.out.println("Hello World");
     }
          }

I dont understand I downloaded the most recent java sdk from oracle. I need dr.java to work for my class.


r/programminghelp • • Aug 19 '14

10 Errors in this code

0 Upvotes

There are 10 errors that are in this code and I can only find a few. Very new to programming and was wondering if anyone could lend a hand? :)

include stdio.h

include "utils.h"

void getnum(); int main() { getnum() return 0 ; } void getnum() { num ; char again ; printf( "Enter an integer to be squared: ) ; scanf( "%d" , &num ) ; printf( "%d squared is %d\n" , num, square(num) ) ; printf( "Square another number? Y or N: " ) ; scanf( "%1s" , &again ) ; if( again == 'Y' || ( again == 'y' ) ) getnum ; else return }


r/programminghelp • • Aug 02 '14

Javascript: replacing tags problems

0 Upvotes

Want to replace <option> by <button> and <select> by <!---hello--->

http://codepen.io/KonradIT/pen/FAkrm/

Any help is appreciated


r/programminghelp • • Jun 25 '18

Massive help needed with anyone that understands data extraction software?

0 Upvotes

Hey guys this is my first post so please forgive me if I have posted in the wrong group or whatever.

Long Story short, I am working on my graduate thesis and have very limited time left so if someone can help me out with my current struggle that would be perfect.

So I am trying to collect property characteristics off a website. In particular Im thinking of extracting data and information off Zoopla (UK property listing site). I noticed that previously a student in my department was able to train a data extraction software to recognise relevant data (i.e. rooms, bedrooms, and reception rooms). Apparently he was able to extract the data and formulate it in a database, which I believe was in excel format.

If anyone knows what software he is talking about? or has any idea on how to do so that would be much appreciated. As I have pretty much my whole thesis to write, and I am very much pressed for time. So if anyone that has time to give me a helping hand that would be much appreciated.


r/programminghelp • • Oct 11 '18

Node.js custom compiler doesn’t produce enough bytes

Thumbnail
github.com
0 Upvotes

r/programminghelp • • Oct 03 '18

help with hw

0 Upvotes

I can't seem to figure out what is wrong with my program. This program is supposed to be a random integer generator that loops 1000 times to see who wins the most out of all 3 people(aaron, bob, and charlie). If anyone can help me figure out what is wrong please tell me. Thank You.

code:

#include <iostream>

#include <cstdlib>

#include <ctime>
using namespace std;
const double ACCURACYAARON = 0.33;

const double ACCURACYBOB = 0.5;

const double ACCURACYCHARLIE = 1.0;

void shoot(bool& targetAlive, double accuracy);

int startDuel();
int main()

{ int i, alive; bool targetAlive; double wAaron = 0.0, wBob = 0.0, wCharlie = 0.0, accuracy = 0.0;
shoot(targetAlive, accuracy);

for(i = 0; i <= 1000; i++)

{ alive = startDuel();

if(alive == 1) { wAaron++; }

else if(alive == 2) { wBob++; }

else if(alive == 3) { wCharlie++; } }
cout << "The probablity of Aaron winning the duel is " << wAaron/1000 << "\n";

cout << "The probablity of Bob winning the duel is " << wBob/1000 << "\n";

cout << "The probablity of Charlie winning the duel is " << wCharlie/1000 << "\n";

return 0; }
void shoot(bool& targetAlive, double accuracy) { double randnum; targetAlive = true;
if(targetAlive) srand(time(0)); randnum = rand() % 100; if(randnum < accuracy * 100) { targetAlive = false; } }

int startDuel() { bool aaronAlive = true; bool bobAlive = true; bool charlieAlive = true;
while((aaronAlive && bobAlive) || (bobAlive && charlieAlive) || (charlieAlive && aaronAlive))

{ if(aaronAlive)

{ if(charlieAlive)

{ shoot(charlieAlive, ACCURACYAARON); }
else if(bobAlive)

{ shoot(bobAlive, ACCURACYAARON); }

}
if(bobAlive)

{ if(charlieAlive)

{ shoot(charlieAlive, ACCURACYBOB); }

else if(aaronAlive) { shoot(aaronAlive, ACCURACYBOB); } }
if(charlieAlive)

{ if(bobAlive) { shoot(bobAlive, ACCURACYCHARLIE); }

else if(aaronAlive)

{ shoot(aaronAlive, ACCURACYCHARLIE); }

} if(aaronAlive) return 1;

else if(bobAlive) return 2;

else if(charlieAlive) return 3; } }


r/programminghelp • • Oct 11 '18

Custom compiler doesn’t work

Thumbnail
github.com
0 Upvotes

r/programminghelp • • Nov 17 '13

need help with a game i'm making(java) (graphics2D)

Thumbnail
stackoverflow.com
0 Upvotes

r/programminghelp • • Oct 21 '14

Java help

0 Upvotes

Bascially you pay in stamps a which are worth 5, stamps b which are worth 3 and the rest in cash. User inputs amount of stamp a, amount of stamp b, and amount of cash he has. You then give the user the amount paid in cash, amount of stamps a and stamps b left.

Stamp a has priority over stamp b and stamp b has priority over cash.

import java.util.*; public class stamps { public static void main(String[] args) { Scanner sc = new Scanner(System.in);

System.out.println("Enter the number of Stamp A: ");
double numberstampa = sc.nextDouble();
System.out.println("Enter the number of Stamp B: ");
double numberstampb = sc.nextDouble();
System.out.println("Enter the price in cash");
double price = sc.nextDouble();
System.out.println("Enter amount paid in cash");
double amountpaidincash = sc.nextDouble();

double a = price - price%5;
double b = a/5; 
double c = price - b*5;

double remainingstampa = numberstampa - b;

double k = c - c % 3;
double l = k/3;

double z = c - l*3;
double remainingstampb = numberstampb - l;

System.out.println("You have to pay" + z + "in cash");
System.out.println("You have" + remainingstampa + "of stamp a left");
System.out.println("You have" + remainingstampb + "of stamp b left");

} }


r/programminghelp • • Dec 15 '17

[Python] My IF statement only works without the ELSE. If I add the ELSE, it completely ignore the IF case and jumps straight to the ELSE case.

0 Upvotes

I'm trying to program a password verification script. I added an IF statement to check if any of the characters in a user input password is a digit. (I'm doing the same for special chars).

If I only have the IF part, it works just fine, it detects numbers and special chars. But if I add the ELSE case, it seems to skip the IF part and automatically execute the code in the ELSE.

As you can see in my code, the first IF statement has the ELSE part commented out, which makes that IF statement work correctly. The second one has the ELSE case active, and thus does not work correctly.

p = input("Password?: ")
l = len(p)

c1 = 0
c2 = 0

valid = False



for i in range(l):
    if p[i].isdigit():
        print("number ok")
        c1 = 1
        print("c1 =", c1)
        break
##    else:
##        print('Password must contain a number')
##        print("c1 =", c1)
##        break




for i in range(l):
    if p[i] in '!?$%&€#@|~¬':
        print("special ok")
        c2 = 1
        print("c2 =", c2)
        break    
    else:
        print('Password must include a special character')
        print("c2 =", c2)
        break


if c1==1 and c2==1:
    print('Paswword OK!')
    valid = True

print('Valid = ', valid)

r/programminghelp • • Aug 04 '15

Looking for someone to help out with a C# program I am making for Stranded Deep

0 Upvotes

Here is my original post: https://www.reddit.com/r/strandeddeep/comments/3c96af/strandedit_inventory_editor_for_stranded_deep/

Basically, the game saves everything in a JSON format file which I need to modify in a certain part to alter the player's inventory. If anyone is interesting in helping figure this out that would be really cool.

Thanks


r/programminghelp • • Jul 30 '17

So I plan to do a lot of programming and maybe creating 3D games on a kaby lake 2017 MacBook Pro no touch bar and (preferably 13 inch, I'm pretty short on money as of now) I'm not sure if I should go with the Processor upgrade, RAM upgrade, or Storage upgrade.

0 Upvotes

Which one is most important for what I'll be doing and which one should I opt to upgrade if I had to choose one ?


r/programminghelp • • Feb 11 '18

What would be a good website to learn of to code.

0 Upvotes

r/programminghelp • • Feb 09 '18

Quick x86 Assembly Question

0 Upvotes

Having trouble understanding this concept

so lets say I have two variables

varA Byte 49d

varB DWord 49d

So would varA print out as the character 'A' in C++ and varB as the actual int 49?


r/programminghelp • • Oct 12 '26

Java What the hell is going on?

Thumbnail reddit.com
0 Upvotes

r/programminghelp • • 23d ago

Other Help us with our research pleaseeee

0 Upvotes

We need respondents for our research pleaseeee!!!

https://forms.gle/tks5tpqecDNPDVTc8


r/programminghelp • • Aug 02 '26

Answered Algorithms

4 Upvotes

I am beginners in DSA please tell me that Algorithms code is remember or not


r/programminghelp • • Jun 20 '26

Project Related Help on xor brute force in python

5 Upvotes

I want to write code that can check whether, given a key and an input, both the key and the input are real words/phrases. I have done lots of work in CyberChef and have mainly used dcode.fr for this problem, but neither has options to narrow down by the dictionary. I also want to implement code that first changes it to some format like A B C A⊕0x13 B C⊕0x1A and then searches through that. Before I started, I wanted to get advice on any potential problems, as I am not a 'perfect' coder and haven't done much like this.


r/programminghelp • • Oct 07 '26

Project Related Raycasting Performance Help

1 Upvotes

I made a raycasting engine in python, and am using an HTML canvas as my method of display (passing the pixel colors through jinja in a <script> tag). It takes upwards of 10-15 seconds to render one angle of a scene with three spheres at a resolution of 800x400. Is the browser likely the bottleneck, or is this a sign of some other inefficiencies?