Open Side Menu Go to the Top
Register
Programming homework and newbie help thread Programming homework and newbie help thread

01-19-2017 , 06:20 AM
Yeah it's good to be able to move quickly to being able to do some little projects, Python is good for that (from what I hear, I've never written any). GUIs and whatnot you can pick up later, better to get a solid grounding in the basics and theory.
Programming homework and newbie help thread Quote
01-27-2017 , 12:50 AM
Curious if anyone thinks something like this would be possible on a raspberry pi.

Preferably, I'd have a specific email address that only certain messages go to on an email client on a pi. When a new message is received, the content of the message is cut and pasted into a specific slack channel. Could leave it connected to slack 24/7 if needed.

Is that too much magic? I know slack offers email integration, but you have to have a paid account to use it. Looking for a way to jury-rig a solution.
Programming homework and newbie help thread Quote
01-27-2017 , 01:57 AM
if all you are doing is checking mail and posting it to slack why mess with all that crap

all you need to do is a set up some flavor of *nix that has a mail server. There are tons of images out there you can get that have a min install of some version of linux and a mail server.

write a script that checks for mail and posts the body to slack. pretty much any language you choose will have libraries to check and parse email.

to post to slack you just have to go into integrations -> build your own
they will give you a url to post to
and then post a json file to that url.

from the command line on *nix it would look something like this

curl -X POST --data-urlencode 'payload={"channel": "#email", "username": "emailbot", "text": "This is posted to #email and comes from a bot named emailbot.", "icon_emoji": ":ghost:"}' https://hooks.slack.com/services/somebigasscode

not sure why you need to have your own mail server. a script on the server could just as easily check gmail/hotmail/yahoo via pop3 or imap.
Programming homework and newbie help thread Quote
01-27-2017 , 02:31 AM
I mean, it doesn't have to be a mail server. I assumed that was only one way of skinning that cat. If I can set up a dedicated email just for the pi and forward only those specific emails to that address, that'd work too.

Appreciate the response. I'll see what I can work out.
Programming homework and newbie help thread Quote
01-27-2017 , 10:45 AM
and if you're super lazy like me just use zapier

https://zapier.com/app/explore

it's a web based tool to move data between different places
they have gmail and slack plugins that let you move data between them.
we use it to get text responses from twillio to slack and bugs from slack to jira
Programming homework and newbie help thread Quote
01-27-2017 , 08:25 PM
awesome, thank you! Looks like it's free and integrates between slack and gmail pretty easily. Setup wasn't bad at all. Just waiting the 15 minutes on the free version to see if it works.
Programming homework and newbie help thread Quote
01-31-2017 , 09:56 PM
this is really dumb but i'm stuck

i am trying to find a recursive algorithm to compute x^(2^n)

I think it's like, return x^2 * recur(x, n div 2) or something?

base case n = 1, return x

my brain's not working
Programming homework and newbie help thread Quote
01-31-2017 , 10:34 PM
recur(x,n-1) * recur(x,n-1)

base case n=0, return x
Programming homework and newbie help thread Quote
01-31-2017 , 10:35 PM
ugh don't know why i didn't see that. thank you.
Programming homework and newbie help thread Quote
02-02-2017 , 03:34 PM


My answer so far:
Quote:
1. As we should generally refrain from doing big-bang integration testing, our logical choices are top-down and bottom-up. After analyzing the system structure I‘ve found that we seem to be introducing circular dependencies with our current design. Our TestCase class depends on TestResult, which depends on TestFailure, which depends on TestCase. I feel that this makes a purely bottom-up integration test strategy more difficult as we would definitely have to write at least one stub to break the circular dependency problem. If we were to use a bottom-up strategy it seems like would have to start the integration process at the AssertionFailedError class, moving next on to the Assert class. From there it seems we run into problems when moving up into the middle layer of the architecture, that is the TestCase, TestResult and TestFailure classes as we run into the aforementioned problem of circular dependency. There seems to be no possible next step from there when using the bottom-up strategy, unless we start introducing stubs. Having taken this into consideration I think that a top-down integration test strategy is our best bet for this particular system.
And now I'm trying to figure out what would be the correct order of integration if using a top-down approach. That is what are the top-level components of the system. It seems to make sense to me that the classes extending the BaseTestRunner are top-level components. But these classes are implementing the TestListener interface which seems to get called by the TestResult class, so I'm not quite sure if they are top-level? Another potential starting point is the Test interface and it's implementations, namely TestDecorator and TestSuite (TestCase not so much since it gets called by TestFailure.

I'm kind of lost at this point and not really sure if I'm heading in the right direction so would appreciate any points to flaws in my arguments as I'm sure there are at least some.
Programming homework and newbie help thread Quote
02-02-2017 , 03:43 PM
Thanks for reminding me how much I always hated UML.
Programming homework and newbie help thread Quote
02-03-2017 , 12:38 PM
I'm glad I'm not the only one who found it hard to dissect.

What would be some characteristics of a system design that would favor one method over the other? Are they considered equally good or is one generally considered better than the other one?
I'm trying to construct some kind of answer that makes sense, but it's hard when the design is extremely confusing and I don't know what to look for either. The professor refuses to answer any questions outside of class hours due to lack of funding for public universities.
Programming homework and newbie help thread Quote
02-03-2017 , 01:00 PM
Quote:
Originally Posted by Mavoor
The professor refuses to answer any questions outside of class hours due to lack of funding for public universities.
What a ****ty professor.
Programming homework and newbie help thread Quote
02-03-2017 , 05:10 PM
Alright I'm really struggling with functional dependencies in database design, could use some clarifications on some things.

Say we are looking at some SQL DDL statements and have 2 tables represented by the relations R1(ABCD), where A is the key st. A->ABCD, which references B from Relation R2, which has R2(BD) where B is the key st. B->D.

If R1 is referencing B from R2 as a foreign key, can we assume for R that it has a functional dependency in the form B->D?
Programming homework and newbie help thread Quote
02-03-2017 , 06:06 PM
Could you clarify, not sure what R represents in this scenario.
Programming homework and newbie help thread Quote
02-03-2017 , 06:07 PM
Quote:
Originally Posted by Mavoor
I'm glad I'm not the only one who found it hard to dissect.

What would be some characteristics of a system design that would favor one method over the other? Are they considered equally good or is one generally considered better than the other one?
I'm trying to construct some kind of answer that makes sense, but it's hard when the design is extremely confusing and I don't know what to look for either. The professor refuses to answer any questions outside of class hours due to lack of funding for public universities.
I haven't studied the theory of integration testing - it wasn't some kind of required core for CS when I was in school, although maybe it was offered in software engineering classes or something. Honestly basically none of the picture you posted makes much sense to me at all.
Programming homework and newbie help thread Quote
02-03-2017 , 06:39 PM
@Mavoor: generally speaking I would take a bottom up approach. In your case start at run(TestResult). It looks like there is an aggregate of tests that make up an interface test. The signature of a test is run(TestResult) and the idea is that for an interface test, the results are aggregated and passed along to other classes. Anyway, I would start by creating an interface test that called run() methods. The run() methods might be test routines that returned all kinds of results to provide path coverage for you interface test. Then maybe develop actual run() methods. Then work your way from there.
Programming homework and newbie help thread Quote
02-18-2017 , 03:29 PM
I somehow feel ashamed asking this because i feel ******ed. I have my mta software development exam on tuesday and can't seefm to figure out the prefix and postfix increment. Like, i know the difference but somehow it applies not on every occasion. ? I just can't figure out when. The one time ++x seems to do nothing and on other examples it is an increment? Trust me, i Googled this for half a day before i bothered you with this super noob question but i just cant get my brain to work somehow. I am sorry. Maybe one of you can give me the answer with a simple example. Thanks
Programming homework and newbie help thread Quote
02-18-2017 , 05:10 PM
Maybe post the example where "++x seems to do nothing"? The rules should apply at all times.

Prefix increment ++x: increments x by one, then the value is used in whatever context.

Postfix increment x++: uses the value in whatever context, then increments the value ready for next use.

Code:
x = 0;
echo x . " " . ++x . " " . x++ . "\n";
echo x . " " . x++ . " " . ++x. " " . "\n";
outputs:
Code:
0 1 1
2 2 4
Programming homework and newbie help thread Quote
02-18-2017 , 05:58 PM
One example would be if you pass in x by value, then ++x would have no effect outside of the function.
Programming homework and newbie help thread Quote
02-18-2017 , 06:58 PM
Yeah sorry, with doing nothing i mean they do the same..?
Example:
Int x = 1;
X++; is now 2
++x is now 3.
Programming homework and newbie help thread Quote
02-18-2017 , 07:08 PM
Sooooo... when i now go to a test question.
Int x = 10
Int y= ++x
Int z= y++
What will be the value of z after all statement are executed?
Now i get this is 11. What i dont get is why x=3 in my above post than.
Programming homework and newbie help thread Quote
02-18-2017 , 07:23 PM
x wasn't 3, but it will be next time you look.

X++ = increment variable, then execute line of code.
++X = execute line of code, then increment variable.

if there is nothing else on the line of code, yes ++x and x++ are functionally identical.

11 is correct (for x and z). some comments:

Code:
Int x = 10   // set x to 10. x is now 10 (x=10)
Int y= ++x   // increment x (x=11), set y to x (y=11) 
Int z= y++   // set z to y (z=11), increment y (y=12)
Programming homework and newbie help thread Quote
02-18-2017 , 07:30 PM
++X is a preincrement, it will do the increment before any other operations.

int x = 10;
int y = ++X (Y = 11 because X is incremented to 11 then Y is set to X)
int z = Y++ (Z=11 because Z is set to Y (11) and then Y is incremented to 12)

int x = 1;
X++ makes X two as X is incremented.
++X makes X 3 as X is incremented again.

In practice, ++X and X++ are the same thing if no other operations are being done. In theory, ++X will be a bit faster.

edit: LOL, _dave_ beat me to it!
Programming homework and newbie help thread Quote
02-18-2017 , 07:34 PM
Wow... than i just have a mistake in my example in my textbook. Omfgggggggg fmlllllll. Spend half a day looking. Thank you very much. I can go to sleep now.
Programming homework and newbie help thread Quote

      
m