r/CircleProgramming

39 archived posts · Dec 2012 – May 2023

Random post

u/AbstergoSupplier•
% Exercise 2

% [Ri,Ro,d]
v = [input('Please input a rate at which water enters the cistern: '),input('Please input a rate at which water exits the cistern: '), input('Please enter an initial water level: ')];

[time, depth, t] = overflowEmpty(v);

fprintf('The cistern takes %i minutes to empty/overflow',t)

figure(1)
plot(time,depth,'b-*')
title('Depth of Water in Tank')
xlabel('Time (m)')
ylabel('Depth(ft)')

and then

function [time,depth,t]= overflowEmpty(v)

H=24; %initial Height
t = 0; % Time = initialized to 1
d = v(3); % Depth = starting depth

while 0<d<H
    d = (v(1)-v(2))*t+v(3); %D
86

u/Illuminatesfolly•

Hi guise, the following code compiles perfectly well and runs as expected on mac and linux, but on windows (the operating system of my professor), stdio does not include the function fgetln.

Is there some way that I can fix this problem in under 5 minutes? (the amount of time that I have to make corrections?

Can you please edit / explain with my conventions how to use something like getline or fgets to fix this?

thx.


if you would like the rest of the program and a test file, I can supply that as well -- it is just over 10,000 characters.


void ReadFileAndGatherStats()
{
  FILE* inFile;
86

u/Hetzer•

So I just totally struck out on a job interview for a position I was having serious second thoughts about anyway. It was done over google hangout so I could share my screen to show me writing psuedocode and coding.

The first/only problem they gave me was how to take a group of words (as an array of strings) and group them by anagram. Like if you had an input of (arm, armor, ram, and mar) you would group arm, ram, and mar but leave out armor (I guess). The eventual solution they showed me didn't really answer the initial question, now that I think of it. It was basically create an associative array where each word in the input string is a key and make all of its anagrams be values for th

73

u/Illuminatesfolly•
/*****************************************************************************
 * Chris Campbell (cacampbe) and Denney Kwok (denneyk)
 * ECS 30 Homework 3 Problem 6
 * pointers.c
 *****************************************************************************/

 /**
  * Reminder.
  * Main() should be the first function.
  * Prototypes must define functions before main()
  * No Loops, Arrays or Global Variables (Fields)
  */

 //Inclusions and Definitions
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdbool.h>

 //Fields

 //Prototypes
 void operate(int, int, int);
 void operate2(int, int, int, 
738


u/Illuminatesfolly•

So, it's well known that JARs and the IDEs that make them handle classpaths a little differently.

So, how do I fix the null pointer exception given to me when I attempt to load the configfile for a frame for code like this:

>String ConfigFile = this.getClass().getClassLoader().getResource(".").getPath().concat("ConfigFile.txt");

This code works fine through the IDE but does not work at all in the JAR. Wut do?

56


u/AerateMark•
 document.body.addEventListener('DOMNodeInserted', function(event) {
            if ((event.target.tagName == 'DIV') && (event.target.getAttribute('id') && event.target.getAttribute('id').indexOf('siteTable') != -1)) {
                // whatever you need fired here
            }
        }, true);

le

50

Hey, so I'm reinstalling cygwin, PRAW, and nltk right now. I'm planning on tinkering around with natural language processing on reddit, to see if I can suss out any interesting relationships. I have an SQL server running already that I'm planning on working with.

If anyone is interested in working with me we can set up a git repo and maybe discuss what we want to do.

41