Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
bomblol
Jul 17, 2009

my first crapatar
Jewel had it right in the first place... but the real issue is that the code I had written had flaws in it that used anything other than the constructor I had supplied anyway. Once I fixed that (and wrote the rest of the program) it was all good.
I'm not saying it was the best way to do it, but the way I did it was create a 52-item array and then fill it with the respective numbers in a random order, so that as I iterated through the creation of each object in a routine matter they would be given a random place in the deck. It is definitely not the best implementation but it was an assignment for a class, so it wasn't really in my interests to spend an inordinate amount of time on it, or look up features of the language that we hadn't discussed yet.
Regardless I learned alot from all the stuff you guys had to say, so thanks!

bomblol fucked around with this message at 08:36 on Dec 15, 2012

Adbot
ADBOT LOVES YOU

raminasi
Jan 25, 2005

a last drink with no ice
I'm of the opinion that if you're just learning enough C++ to get your homework assignment done then going into any serious theoretical depth about why the hell it behaves the way it does is probably not worth the time you'd have to put in. Not worthless, just not cost-effective.

Gozinbulx
Feb 19, 2004
I don't even know if this is the appropriate place to ask this but does anyone know of a simple emailing script with actually allows SMTP authentication and SSL connections and such?

I have one now that I use for alerts for certain triggers in Task Scheduler, but it only takes the host address of the SMTP server and nothing else, rendering it effectively useless for 99% of email servers.

Any help would be appreciated.

ToxicFrog
Apr 26, 2008


Gozinbulx posted:

I don't even know if this is the appropriate place to ask this but does anyone know of a simple emailing script with actually allows SMTP authentication and SSL connections and such?

I have one now that I use for alerts for certain triggers in Task Scheduler, but it only takes the host address of the SMTP server and nothing else, rendering it effectively useless for 99% of email servers.

Any help would be appreciated.

mailx looks fairly complicated, but it supports SMTP over SSL, SMTP with STARTTLS, and LOGIN, PLAIN, and CRAM-MD5 authentication. You should be able to use that to connect to the SMTP server and then pipe the actual mail contents through it, I think.

Gozinbulx
Feb 19, 2004
That looks promising.

Only problem is, I'm using a windows machines. I know I know..

Thank you anyways though, I'll see where this leads me.

ToxicFrog
Apr 26, 2008


Gozinbulx posted:

That looks promising.

Only problem is, I'm using a windows machines. I know I know..

Thank you anyways though, I'll see where this leads me.

If you can use Cygwin, it doesn't come with mailx, but it does come with email, msmtp and ssmtp, which look like they also do what you need.

Depending on how scary mailx's dependencies are, you might also be able to build a windows native version of it (or one of the other programs mentioned above) using mingw.

I've heard reference to blat as a mailx replacement for windows, but I don't know if it supports the SSL and AUTH features you need.

Gozinbulx
Feb 19, 2004
I did end up finding Blat. It has AUTH (login and pw) features but not SSL. So close!

I'll see about what you said though.

Thanks for all the help guys.

Strong Sauce
Jul 2, 2003

You know I am not really your father.





I'm trying to setup this thing for my company where a user logs in from a third party site, and through an iframe on our site load this user's information.

Trying to figure out the best way to approach this. The idea I see is to give them an "API key", and then have them call a route on our site that return a unique key based off some of the user's credentials. Then append it onto the url in the iframe and we verify on our end if the key matches up.

Is there a better way or is this typically the general way people have been display unique data to a third-party? Someone at my company suggested using OAuth but that doesn't seem like the way to go... Can you bypass asking the user for permission in an OAuth flow?

Doctor w-rw-rw-
Jun 24, 2008

Strong Sauce posted:

I'm trying to setup this thing for my company where a user logs in from a third party site, and through an iframe on our site load this user's information.

Trying to figure out the best way to approach this. The idea I see is to give them an "API key", and then have them call a route on our site that return a unique key based off some of the user's credentials. Then append it onto the url in the iframe and we verify on our end if the key matches up.

Is there a better way or is this typically the general way people have been display unique data to a third-party? Someone at my company suggested using OAuth but that doesn't seem like the way to go... Can you bypass asking the user for permission in an OAuth flow?

Depends on the form of OAuth? It's not super well-specified. OAuth might not be that bad.

nielsm
Jun 1, 2009



As far as I remember, OAuth doesn't specify what the service provider (site whose data you, the consumer, want to access on the user's behalf) should present of UI, or if it should even present one at all. Basically you do a sideband request to the service provider, get a temporary key back, redirect the user's browser to an URL on the service provider's site, and the service provider then sends the user back to your site with a full token. Most service providers then want to give the user a chance to sign in or otherwise confirm access when they are transferred there.
(One example: Instagram's OAuth 2.0 implementation will return a token to you immediately if the user is already signed in and has approved your application once, while Twitter's OAuth 1.0 implementation will always ask for confirmation, even for applications the user has already approved once.)

Strong Sauce
Jul 2, 2003

You know I am not really your father.





Well basically there can be zero interaction between us and the user for the third-party. The user has no actual access to our site, we just have data that the third-party stored on our site that they want to show the user. So I think in this case we would be the service provider, while the third-party "consumes" our tokens to get access to their data (and the user's) from our site. They'd also have to pass over data like the user's login name to us so we can associate the data.

I think the flow would be, they sign onto the third party's site, they would do the oauth handshake with us in the background, then they'd pass the token through to the iframe src, then once we get that we just do a lookup and display the proper data.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
So does the data on your site belong to the user, or to the other service? Does the user have a login to sign in to your site, or do they just log in to the other service and the other service automatically has access?

Is your site essentially acting like a glorified database?

BirdOfPlay
Feb 19, 2012

THUNDERDOME LOSER
Real stupid personal project/teaching myself database stuff question. The goal is to write a program that handles class grading. There will be two simple DB's, a Student DB with a record linking a student's names to an internal ID# and Assignment DB with individual records (?) for a singluar assignment linked to some student.

The question: should I keep track of a student's grade in the Student DB?

I'm leaning towards no, if a user asks for a students grade, just compute it at run time. I say this because it means that any function that plays with the Assignment DB must either: a) be "safe" (not cause changes that would change the stored grade) or b) check to see if a student's or all students' grades have been affected. Also, it means that the DB should be protected and only accessed via my program (or, at least, ones that can be trusted), because if they change the Assignment DB, the Student DB wouldn't be updated.

Am I looking at this from the wrong angle though? Which would be the "standard" approach to this situation?

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
In general the only time you should store something you can calculate is if calculating it is too slow.

raminasi
Jan 25, 2005

a last drink with no ice
And if you're unsure, err on the side of assuming that it won't be too slow.

Deus Rex
Mar 5, 2005

jetbrains has a 75% off sale for the next 24 hours: http://www.jetbrains.com/specials/index.jsp

akadajet
Sep 14, 2003

Deus Rex posted:

jetbrains has a 75% off sale for the next 24 hours: http://www.jetbrains.com/specials/index.jsp

And given how slow their web server is right now I might need 24 hours to buy anything.

BirdOfPlay
Feb 19, 2012

THUNDERDOME LOSER

Plorkyeran posted:

In general the only time you should store something you can calculate is if calculating it is too slow.

GrumpyDoctor posted:

And if you're unsure, err on the side of assuming that it won't be too slow.

So I normally go "memory is cheap, store anything you may reference again," assuming that access is always faster than recalculating. This probably holds true more for run-time usage then data storage, but I understand y'all's logic and get that speed is not always a top tier priority (and even if it is...).

Thanks for clearing that up for me.

epswing
Nov 4, 2003

Soiled Meat

akadajet posted:

And given how slow their web server is right now I might need 24 hours to buy anything.

Yeah, really. I'm getting This webpage has a redirect loop, Error 310 (net::ERR_TOO_MANY_REDIRECTS).

akadajet
Sep 14, 2003

epalm posted:

Yeah, really. I'm getting This webpage has a redirect loop, Error 310 (net::ERR_TOO_MANY_REDIRECTS).

Some static analysis tools should be able to help clear that up. :v:

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

BirdOfPlay posted:

So I normally go "memory is cheap, store anything you may reference again," assuming that access is always faster than recalculating. This probably holds true more for run-time usage then data storage, but I understand y'all's logic and get that speed is not always a top tier priority (and even if it is...).

Thanks for clearing that up for me.

That's not necessarily true. Cache misses cost a lot more than recalculating, and you can screw the cache if you don't manage it properly.

gariig
Dec 31, 2004
Beaten into submission by my fiance
Pillbug

BirdOfPlay posted:

So I normally go "memory is cheap, store anything you may reference again," assuming that access is always faster than recalculating. This probably holds true more for run-time usage then data storage, but I understand y'all's logic and get that speed is not always a top tier priority (and even if it is...).

Thanks for clearing that up for me.

Be careful about what you are calculating and what you are storing. An example I could think of is a report card. It would be pretty easy to not store report cards in the database and just rebuild them on the fly. However, a report card is immutable but grades can change that require a new report card. Like if a student is out sick for an extended period of time around report cards but makes up the work later. That student probably failed the first time but passed the second time. Do you want to be able to pull both report cards or just the last report card the assignments table reflects?

Unperson_47
Oct 14, 2007



Deus Rex posted:

jetbrains has a 75% off sale for the next 24 hours: http://www.jetbrains.com/specials/index.jsp

Thanks for the heads up. I was able to get my order in but due to their site being broken most the morning, I am now worried that my order didn't really take and there's no way to check on the status of an order. The only thing I was told is that it could take up to 12 hours for the order to take place. I'm afraid that in 12 hours I'll find out that my transaction was cancelled and I missed out on the sale.

They're using element5 for transactions and it looks like that site is/was also experiencing traffic overload so it might be best just to hold off until this afternoon if anyone else is thinking about jumping on the deal.

Unperson_47 fucked around with this message at 18:31 on Dec 20, 2012

Posting Principle
Dec 10, 2011

by Ralp
They're dead, best to wait for a while.

Dietrich
Sep 11, 2001

I really want to give jetbrains my money for some youtrack licenses so this is sad.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

I just tried a couple time and was able to order PyCharm.

Except, now that I completed my order, I haven't got an email from them with license information.

akadajet
Sep 14, 2003

I was able to get as far as the checkout button and then got a blank page. So I don't really know if it worked.

LP0 ON FIRE
Jan 25, 2006

beep boop
In Objective-C, what is faster: A NSString comparison or an NSMutableArray count? I'm guessing the count.

Posting Principle
Dec 10, 2011

by Ralp

Thermopyle posted:

I just tried a couple time and was able to order PyCharm.

Except, now that I completed my order, I haven't got an email from them with license information.

Order page mentions that it can take up to 12 hours to process. I'm guessing they're going to be taking a long time today. If in doubt, phone them.

armorer
Aug 6, 2012

I like metal.

Jerry SanDisky posted:

Order page mentions that it can take up to 12 hours to process. I'm guessing they're going to be taking a long time today. If in doubt, phone them.

I just dropped in here to mention this sale, but I see you already know of it. It is up now, or at least it was 20 minutes or so ago. I was able to purchase IntelliJ.

EDIT: I also didn't get an email with license info yet though.


Dietrich posted:

I really want to give jetbrains my money for some youtrack licenses so this is sad.

It is only for personal licenses to the IDE apps, I don't think YouTrack is included.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

LP0 ON FIRE posted:

In Objective-C, what is faster: A NSString comparison or an NSMutableArray count? I'm guessing the count.

Yes. Modulo some internal abstraction penalties, the count is just a load from a field, whereas the comparison is, well, a string comparison, i.e. a loop over two arrays. And the abstraction penalties should be higher for NSString than NSMutableArray for various reasons that are hard to explain.

LP0 ON FIRE
Jan 25, 2006

beep boop

rjmccall posted:

Yes. Modulo some internal abstraction penalties, the count is just a load from a field, whereas the comparison is, well, a string comparison, i.e. a loop over two arrays. And the abstraction penalties should be higher for NSString than NSMutableArray for various reasons that are hard to explain.

Thanks. The array is very small, but I'm not sure if that makes it grab the count any faster than if it was larger. Probably not since you just said it's just a load from a field.

Bunny Cuddlin
Dec 12, 2004

Thermopyle posted:

I just tried a couple time and was able to order PyCharm.

Except, now that I completed my order, I haven't got an email from them with license information.

I haven't either, nor have they billed my card. I have a reference number though so hopefully even if the transaction was cancelled I'll be able to cajole them into giving me a copy of pycharm for $25

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

rjmccall posted:

And the abstraction penalties should be higher for NSString than NSMutableArray for various reasons that are hard to explain.

I'd love to hear you try explaining this anyway. Though maybe in the Mac/iOS thread.

Deus Rex
Mar 5, 2005

I ordered IntelliJ about 2 hours ago and just got my license info.

armorer
Aug 6, 2012

I like metal.

Deus Rex posted:

I ordered IntelliJ about 2 hours ago and just got my license info.

Did others get their license info? I still haven't gotten mine and my card doesn't appear to have been charged.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



armorer posted:

Did others get their license info? I still haven't gotten mine and my card doesn't appear to have been charged.

Nope - only have confirmation emails from their payment processor who hasn't taken my money yet :\

armorer
Aug 6, 2012

I like metal.

Munkeymon posted:

Nope - only have confirmation emails from their payment processor who hasn't taken my money yet :\

I don't even have that much, although I saved the confirmation number that came up in broweser after I bought it. I will wait it out - they were slammed yesterday. I suppose I can use the free trial in the meantime.

epswing
Nov 4, 2003

Soiled Meat

Munkeymon posted:

Nope - only have confirmation emails from their payment processor who hasn't taken my money yet :\

Same.

Adbot
ADBOT LOVES YOU

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

edit: Oops, wrong thread.

Thermopyle fucked around with this message at 22:15 on Dec 21, 2012

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply