• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Programming |OT| C is better than C++! No, C++ is better than C

Minamu

Member
Is there a good resource online for reading up on code performance? I'm very much a newbie but I'm still very interested in learning more about, let's say, the difference between if statements and switch cases, apart from readability. I've told myself for years that I want to code my own games, most likely in Unity or Unreal, but while I understand a fair amount of the basics, I don't think I could learn to write properly efficient code by self-learning only. I know there's very much an argument to be had for readability over strict performance increases, but while I, as a designer, can write functional code, the programmers on my hobby project always find smarter ways of doing the same thing, much to my chagrin :)
 

Makai

Member
Is there a good resource online for reading up on code performance? I'm very much a newbie but I'm still very interested in learning more about, let's say, the difference between if statements and switch cases, apart from readability. I've told myself for years that I want to code my own games, most likely in Unity or Unreal, but while I understand a fair amount of the basics, I don't think I could learn to write properly efficient code by self-learning only. I know there's very much an argument to be had for readability over strict performance increases, but while I, as a designer, can write functional code, the programmers on my hobby project always find smarter ways of doing the same thing, much to my chagrin :)
If you're doing C++ you can see the assembly that's generated and compare. Unity's so heavy that the difference between if and switch statements are completely negligible in comparison to the rest of the engine. If you want to get really performant you can go way off the deep end and optimize for cache hit

https://www.youtube.com/watch?v=rX0ItVEVjHc

Learn Big O notation before you do any of that so you have a theorhetical foundation about the performance of algorithms.
 
If you're doing C++ you can see the assembly that's generated and compare. Unity's so heavy that the difference between if and switch statements are completely negligible in comparison to the rest of the engine. If you want to get really performant you can go way off the deep end and optimize for cache hit

You can even go deeper. This talk blew my mind

http://schd.ws/hosted_files/llvmdev...d9/LLVM-Conference-US-2016-Code-Alignment.pdf

I wish there was a video of it, but if you thought cache misses were the end of the story, just wait
 
So I am working on an SQL database and I'm having some annoying problems.

I am creating a view where I can see a customers: name, street address, city, province, postal code, and a total of their sales orders.

The stipulation is that the view can only show customers that have purchased over $30,000 over the last 5 years.

So far I have

Code:
CREATE VIEW PREFERRED_CUSTOMERS AS
	SELECT DISTINCT custname, custstreet, custcity, custprov, custpcode, (orderqty*orderprice) AS 'Total Orders'
	FROM dbo.SH_customer c, dbo.SH_salesorder so, dbo.SH_orderprod op
	WHERE c.custno = so.orderno
	AND (orderqty*orderprice) > 30000;

I'm sure there are many thing wrong here and I have yet to even implement the GETDATE() function. My main problem is that it is printing every incremental purchase after $30,000 for every customer.

Does anyone have an idea why it's doing this?
 
So I am working on an SQL database and I'm having some annoying problems.

I am creating a view where I can see a customers: name, street address, city, province, postal code, and a total of their sales orders.

The stipulation is that the view can only show customers that have purchased over $30,000 over the last 5 years.

So far I have

Code:
CREATE VIEW PREFERRED_CUSTOMERS AS
	SELECT DISTINCT custname, custstreet, custcity, custprov, custpcode, (orderqty*orderprice) AS 'Total Orders'
	FROM dbo.SH_customer c, dbo.SH_salesorder so, dbo.SH_orderprod op
	WHERE c.custno = so.orderno
	AND (orderqty*orderprice) > 30000;

I'm sure there are many thing wrong here and I have yet to even implement the GETDATE() function. My main problem is that it is printing every incremental purchase after $30,000 for every customer.

Does anyone have an idea why it's doing this?

You need to use GROUP BY

SELECT name, SUM(money) AS total FROM foo WHERE total>30000 GROUP BY id
 
So i need to create a sub query for that? because anytime i try to create an aggregate function it messes with my other selects

I looked at your original query again, and yea you need first need to do a join so that you get a bunch of rows like this:

custname, custno, custstreet, custcity, custprov, custpcode, orderno, total_price

Then do the group by on this joined row. Or you could do it the other way around. GROUP BY entirely on the salesorder table, then you'll have a set of rows like (orderno, total_price) and you can do the join on that.

But one thing looks odd to me. Why are you writing WHERE orderno=custno? Is the order number really the same as a customer number? Doesn't the orders table have BOTH a customer number and an order number? Seems like you would want something like WHERE so.custno = c.custno
 
I looked at your original query again, and yea you need first need to do a join so that you get a bunch of rows like this:

custname, custno, custstreet, custcity, custprov, custpcode, orderno, total_price

Then do the group by on this joined row. Or you could do it the other way around. GROUP BY entirely on the salesorder table, then you'll have a set of rows like (orderno, total_price) and you can do the join on that.

But one thing looks odd to me. Why are you writing WHERE orderno=custno? Is the order number really the same as a customer number? Doesn't the orders table have BOTH a customer number and an order number? Seems like you would want something like WHERE so.custno = c.custno

So the customer table has a relationship with salesorders but not with orderprod. Salesorder has a relationship with both.

That's why I had orderno = custno. If i don't put that I get 12000 rows. I think my problem is i think should be using salesorder since it has a relationship with both tables
 
So the customer table has a relationship with salesorders but not with orderprod. Salesorder has a relationship with both.

That's why I had orderno = custno. If i don't put that I get 12000 rows. I think my problem is i think should be using salesorder since it has a relationship with both tables

I guess I'm confused because customers and orders sound like 2 different things. Customer 1 could have orders 1, 2, and 3, while customer 2 has orders 4, 5, and 6. Unless the columns are just poorly named something seems wrong with your join there
 

KooPaL

Member
So I am working on an SQL database and I'm having some annoying problems.

I am creating a view where I can see a customers: name, street address, city, province, postal code, and a total of their sales orders.

The stipulation is that the view can only show customers that have purchased over $30,000 over the last 5 years.

So far I have

Code:
CREATE VIEW PREFERRED_CUSTOMERS AS
	SELECT DISTINCT custname, custstreet, custcity, custprov, custpcode, (orderqty*orderprice) AS 'Total Orders'
	FROM dbo.SH_customer c, dbo.SH_salesorder so, dbo.SH_orderprod op
	WHERE c.custno = so.orderno
	AND (orderqty*orderprice) > 30000;

I'm sure there are many thing wrong here and I have yet to even implement the GETDATE() function. My main problem is that it is printing every incremental purchase after $30,000 for every customer.

Does anyone have an idea why it's doing this?

I am not entirely sure what your data and I can't make assumptions since you did not alias your select clauses but one thing I noticed is that you are missing a join criteria to orderprod table. Since the join is missing, you are introducing a cartesian result which would give you all results of (table1 Join Table2) * every record on orderop table.

Just by assumption since you didnt alias your select I dont know which columns are which, I think you either drop the orderop table if it isnt being pulled in your select. If orderop table is needed, then I imagine customer and sales order are joined by customer_no and sales order and order op are joined by order_no.
 
I guess I'm confused because customers and orders sound like 2 different things. Customer 1 could have orders 1, 2, and 3, while customer 2 has orders 4, 5, and 6. Unless the columns are just poorly named something seems wrong with your join there

I am not entirely sure what your data and I can't make assumptions since you did not alias your select clauses but one thing I noticed is that you are missing a join criteria to orderprod table. Since the join is missing, you are introducing a cartesian result which would give you all results of (table1 Join Table2) * every record on orderop table.

I get what you guys are saying. My join clause is my main problem. I can see how difficult it is to comment on these tables without seeing the data or columns lol.

Have to head to bed as it's 1:30am here but thanks for the inputs. I'll get back to it in the morning and hopefully make some progress. Thanks again!
 

Pokemaniac

Member
Is there a good resource online for reading up on code performance? I'm very much a newbie but I'm still very interested in learning more about, let's say, the difference between if statements and switch cases, apart from readability. I've told myself for years that I want to code my own games, most likely in Unity or Unreal, but while I understand a fair amount of the basics, I don't think I could learn to write properly efficient code by self-learning only. I know there's very much an argument to be had for readability over strict performance increases, but while I, as a designer, can write functional code, the programmers on my hobby project always find smarter ways of doing the same thing, much to my chagrin :)

One thing to keep in mind about performance is that "premature optimization is the root of all evil". It's more important that your code works properly than how fast it runs. In general I'd recommend caring more about readability and the quality of the code initially, then refactoring later if there proves to be a bottleneck.

However, this isn't to say you shouldn't care about performance at all when writing new code, it should just generally be more of a secondary concern.

If you're looking to optimize performance, though, I'll definitely echo that learning Big O notation is probably a good place to start.
 

Koren

Member
One thing to keep in mind about performance is that "premature optimization is the root of all evil". It's more important that your code works properly than how fast it runs. In general I'd recommend caring more about readability and the quality of the code initially, then refactoring later if there proves to be a bottleneck.

However, this isn't to say you shouldn't care about performance at all when writing new code, it should just generally be more of a secondary concern.

I'd be careful with that... Choosing the wrong data structure and/or algorithm will possibly require doing everything again from scratch. Planning a bit and thinking about options beforehand may save you headaches later.

That being said, I agree with you that once yoy've chosen the best data structure and algorithm, (non-trivial) optimization shouldn't be a priority before it's working and proved to work too slowly.
 

Minamu

Member
One thing to keep in mind about performance is that "premature optimization is the root of all evil". It's more important that your code works properly than how fast it runs. In general I'd recommend caring more about readability and the quality of the code initially, then refactoring later if there proves to be a bottleneck.

However, this isn't to say you shouldn't care about performance at all when writing new code, it should just generally be more of a secondary concern.

If you're looking to optimize performance, though, I'll definitely echo that learning Big O notation is probably a good place to start.

You can even go deeper. This talk blew my mind

http://schd.ws/hosted_files/llvmdev...d9/LLVM-Conference-US-2016-Code-Alignment.pdf

I wish there was a video of it, but if you thought cache misses were the end of the story, just wait

If you're doing C++ you can see the assembly that's generated and compare. Unity's so heavy that the difference between if and switch statements are completely negligible in comparison to the rest of the engine. If you want to get really performant you can go way off the deep end and optimize for cache hit

https://www.youtube.com/watch?v=rX0ItVEVjHc

Learn Big O notation before you do any of that so you have a theorhetical foundation about the performance of algorithms.

Thanks, this seems really interesting :D
 
I don't understand what's going on here.

Code:
char *stringcheese = malloc(sizeof(char) * len + 1);
fread(stringcheese, len, 1, textfile); //read string from file into stringcheese
printf("%s", stringcheese);
char c = stringcheese[1];
printf("%s\n", c);

the first printf works. The second gjves a segfault core dump. I cant seem to access individual characters in the stringcheese string. Why?
 

Eridani

Member
I don't understand what's going on here.

Code:
char *stringcheese = malloc(sizeof(char) * len + 1);
fread(stringcheese, len, 1, textfile); //read string from file into stringcheese
printf("%s", stringcheese);
char c = stringcheese[1];
printf("%s\n", c);

the first printf works. The second gjves a segfault core dump. I cant seem to access individual characters in the stringcheese string. Why?

I'm pretty sure the issue is that you're using %s to print a character instead of %c, though it's been a while since I've used c. %s works with char * and prints until reaching \0, which shouldn't work if you give it a normal char instead of an address.
 

Pokemaniac

Member
I'd be careful with that... Choosing the wrong data structure and/or algorithm will possibly require doing everything again from scratch. Planning a bit and thinking about options beforehand may save you headaches later.

That being said, I agree with you that once yoy've chosen the best data structure and algorithm, (non-trivial) optimization shouldn't be a priority before it's working and proved to work too slowly.

Yeah, I may have glossed over that a bit. That switch vs if question had me thinking more of micro-optimizations.
 
I'm pretty sure the issue is that you're using %s to print a character instead of %c, though it's been a while since I've used c. %s works with char * and prints until reaching \0, which shouldn't work if you give it a normal char instead of an address.

Fuck that was it. Thanks.
 

Two Words

Member
I'm using the pySerial module and I can't find any documentation on how to loopback. The little I can shows making a serial_for_url and using the address "loop://". But I can't find any code examples. I want to simulate the communication all in software right now by doing a loopback.
 

arit

Member
Yeah, I'm looking for a tutorial that just walks you through it. I've never had to do anything like this before, so I'm looking for something that explains it in order to teach it for the first time. Most things that I'm finding are just explaining how to do serial programming in Python. I need to learn how serial programming works at all.

There is serial data communication, which just means that data is written and read one bit at a time (simplified), how a bit is represented depends on the used protocol (data link layer) e.g. I2C, spi, usb etc...
The easiest way would probably be to just download manuals for some small micro controllers (pic, atmel) and read the chapters which describe the hardware peripherals for the used protocols. Though unless you are bit banging, you'll be mostly writing to a complete register and let the hardware do its part.

Memory mapping would come with something bigger like the AT91SAM (or whatever is used today) and Linux. I think Linux Device Drivers had a section about that (the free online version is old, but should be enough to grasp the concepts).
Of course you can memory map other things (like files), but I guess your questions were mostly targeted at the lower levels.
 

dLMN8R

Member
So I have a complete newbie question for you fine folks.

I do have a programming background, but from 10+ years ago. At the time all I knew was how to create some C++ Windows applications and basic stuff with Windows forms and such. And since then I haven't done any development of any sort - my job doesn't require it and I haven't kept up with anything of the sort as a hobby.

I want to get back into it as a light hobby but really don't know where to start. My high-level longer-term goal is similar to a list-tracking app.

I know there are a million of those things and I'm not doing anything new, but purely as an educational exercise, if I wanted to build an app where I could create a list on one device, store that list in some database in AWS, and sync that list across multiple devices, where should I start?

Creating a basic list app on iOS / Android / Windows is easy and I know what resources to seek out to learn all that. This include looking up API documentation to figure out how to access an existing database. I'm more looking for a super-basic "I KNOW NOTHING ABOUT THIS" intro into how I would build the service-side of this thing on AWS/Azure/whatever.

Where should I start for that kind of thing?
 

Kalnos

Banned
Creating a basic list app on iOS / Android / Windows is easy and I know what resources to seek out to learn all that. This include looking up API documentation to figure out how to access an existing database. I'm more looking for a super-basic "I KNOW NOTHING ABOUT THIS" intro into how I would build the service-side of this thing on AWS/Azure/whatever.

Where should I start for that kind of thing?

Easiest way would to be to spin up a VPS instance on Digital Ocean (or equivalent) and to host your REST API and database there. Then you just make a GET request to myserverip:port/endpoint from your application to retrieve information.

That may be a bit vague but you can literally use any technology combination to accomplish this. Golang/Postgres, Node/Mongo, etc. Just look into REST APIs and you should find your way.
 
So what does memset do here?

Code:
char *mytxt = malloc(sizeof(char) * textlen);
memset(mytxt, '\0', textlen);

Is this setting all the characters in the string to '\0'?
Or is it setting the character at textlen to '\0'?
or neither?
 
So what does memset do here?

Code:
char *mytxt = malloc(sizeof(char) * textlen);
memset(mytxt, '�', textlen);

Is this setting all the characters in the string to '�'?
Or is it setting the character at textlen to '�'?
or neither?

The 3rd argument is the number of bytes to set
 

dLMN8R

Member
Easiest way would to be to spin up a VPS instance on Digital Ocean (or equivalent) and to host your REST API and database there. Then you just make a GET request to myserverip:port/endpoint from your application to retrieve information.

That may be a bit vague but you can literally use any technology combination to accomplish this. Golang/Postgres, Node/Mongo, etc. Just look into REST APIs and you should find your way.

I'm so ignorant of this stuff that I know practically zero of the terminology you used, but the simple fact that I now have something to research further will be helpful :) So thank you!

It wasn't really that I don't want to research stuff, it's just that I have absolutely no idea where to start. So your post will help point me in the right direction.
 

Kalnos

Banned
I'm so ignorant of this stuff that I know practically zero of the terminology you used, but the simple fact that I now have something to research further will be helpful :) So thank you!

It wasn't really that I don't want to research stuff, it's just that I have absolutely no idea where to start. So your post will help point me in the right direction.

Just know that the general topic you're looking to get into here is backend web development and lucky for you 'TODO' lists are all the rage in order to learn it haha.
 
I've got a database-related question. I'm building a web app for listening to podcasts (actually, I've already built it, I'm re-implementing it in Java instead of Python) and I want to store a history of podcasts the user has listened to (more precisely, items from a podcast feed).
For that, there's a table that stores the user ID, the podcast item ID and a timestamp. Now, I would like to limit the number of entries allowed per user in this table (so, for each user, it only stores the last 100 or so items they listened to). It's mostly a theoretical concern since I'll most likely be the only user for this thing (unless something unexpected happens) but I'd like to know how to solve this and on which layer of the application. I'm using Spring Boot with Spring Data JPA for database access and PostgreSQL.
 

Koren

Member
For that, there's a table that stores the user ID, the podcast item ID and a timestamp. Now, I would like to limit the number of entries allowed per user in this table (so, for each user, it only stores the last 100 or so items they listened to).
Why not simply deleting the older entries when you add new ones? (or replacing the oldest one instead of creating a new one, once the limit is reached...)

You want something server-side that reject the creation of a new record if a given number of records filling a condition is reached?

I'm curious, is it possible?
 
Hey guys, I have a question regarding a client's line of business app thats been tickling my brain.

I am building a web app for them that is hosted in Azure(using .NET MVC). The site can be accessed from anywhere by managers, but customer service agents should only be able to log in from their work terminal.

The problem is I can't figure out a way to limit access that way. I was thinking of registering each terminal by it's mac address, and then when the user logs in make sure they are logging in from a known mac, but I can't get that from a .Net MVC app for obvious reasons. I could do it by IP but that could get messy if my client doesn't have/want a static IP.

Does anyone have any ideas on how I can accomplish this?
 

Pokemaniac

Member
Hey guys, I have a question regarding a client's line of business app thats been tickling my brain.

I am building a web app for them that is hosted in Azure(using .NET MVC). The site can be accessed from anywhere by managers, but customer service agents should only be able to log in from their work terminal.

The problem is I can't figure out a way to limit access that way. I was thinking of registering each terminal by it's mac address, and then when the user logs in make sure they are logging in from a known mac, but I can't get that from a .Net MVC app for obvious reasons. I could do it by IP but that could get messy if my client doesn't have/want a static IP.

Does anyone have any ideas on how I can accomplish this?

I don't really know the specifics of that environment, but I can give you some general suggestions.

So, if they want each individual customer service agent to only be able to log in from their specific terminal (your phrasing isn't 100% clear), then static IPs are basically a necessity. In that case, you'd need to make that clear to your client.

If they just want the customer service agent portal to only be available to any agent from any workstation, then your options open up a bit. Basically the two best approaches I can think of are to either only make the service available at some network location which only the workstations can see, or to identify the workstations using an IP address (either some range that is exclusively dedicated to them or a list of static IPs).

Also, depending on the exact details, it may make things easier if you split up your app so that the manager and customer service agent bits are accessed through separate endpoints. If your application architecture can tolerate that, it might help you to keep the users separate.

Regardless, network topology is really important when you want to restrict access to specific machines. It will decide which options are on the table.
 

Somnid

Member
Hey guys, I have a question regarding a client's line of business app thats been tickling my brain.

I am building a web app for them that is hosted in Azure(using .NET MVC). The site can be accessed from anywhere by managers, but customer service agents should only be able to log in from their work terminal.

The problem is I can't figure out a way to limit access that way. I was thinking of registering each terminal by it's mac address, and then when the user logs in make sure they are logging in from a known mac, but I can't get that from a .Net MVC app for obvious reasons. I could do it by IP but that could get messy if my client doesn't have/want a static IP.

Does anyone have any ideas on how I can accomplish this?

You need static IPs. Also, this is essentially a negative value feature. If admins can log in and this is secure then there is no reason anyone else shouldn't be able to. You're basically creating work to make the product worse. There is no security value in this.
 
Hey guys, I have a question regarding a client's line of business app thats been tickling my brain.

I am building a web app for them that is hosted in Azure(using .NET MVC). The site can be accessed from anywhere by managers, but customer service agents should only be able to log in from their work terminal.

The problem is I can't figure out a way to limit access that way. I was thinking of registering each terminal by it's mac address, and then when the user logs in make sure they are logging in from a known mac, but I can't get that from a .Net MVC app for obvious reasons. I could do it by IP but that could get messy if my client doesn't have/want a static IP.

Does anyone have any ideas on how I can accomplish this?

being hosted means static IPS are needed. If they were hosting the app on their own server in-house, it could restrict non-manager accounts to only be accessible on the local subnet.
 

Zoe

Member
I've got a database-related question. I'm building a web app for listening to podcasts (actually, I've already built it, I'm re-implementing it in Java instead of Python) and I want to store a history of podcasts the user has listened to (more precisely, items from a podcast feed).
For that, there's a table that stores the user ID, the podcast item ID and a timestamp. Now, I would like to limit the number of entries allowed per user in this table (so, for each user, it only stores the last 100 or so items they listened to). It's mostly a theoretical concern since I'll most likely be the only user for this thing (unless something unexpected happens) but I'd like to know how to solve this and on which layer of the application. I'm using Spring Boot with Spring Data JPA for database access and PostgreSQL.

Do you actually have storage concerns, or is this an arbitrary limit?

A better approach would probably be to periodically purge the table of rows older than X, and when you're querying the table for display, just return the top 100 rows for the user.
 
Do you actually have storage concerns, or is this an arbitrary limit?

A better approach would probably be to periodically purge the table of rows older than X, and when you're querying the table for display, just return the top 100 rows for the user.

It's an arbitrary limit. That approach does sound better. The cleanup is something I can do as a periodical cleanup job from the application. Thanks for the input.
 

Slavik81

Member
Over the past year I noticed a three-year old project of mine, guardonce, slowly gathering some attention. I basically never told anyone besides my coworkers about it, so I was pretty surprised to see people starting to use it. I guess it shows up in Google when people are searching for tools to convert between include guards and pragma once. Apparently investing a little time into writing a README does pay off.

I was a little embarrassed, though, because I literally wrote it to try to learn Python. It was a useful tool, which I used to convert a few of my repositories, but it was pretty ugly under the hood. So, I rebuilt it. This weekend I finally packaged it up and gave it a real release.

I think the most fun part of the entire thing was designing and implementing the language used to specify the include guard pattern. My B.Sc. is EE, not CS, so I never studied compilers. It was a good learning experience.
 

Slavik81

Member
So much effort for pretty much nothing

BPXEJo1.gif
I put so much effort into trying to learn Vulkan, only to find that my machine didn't have complete drivers (Intel Haswell)... I basically burned out before I actually got going.

Posts like this are what inspire me to give it another try... But I really should avoid distractions and hammer out my thesis. One day I'll have the time to learn Vulkan. One day...
 

Makai

Member
I put so much effort into trying to learn Vulkan, only to find that my machine didn't have complete drivers (Intel Haswell)... I basically burned out before I actually got going.

Posts like this are what inspire me to give it another try... But I really should avoid distractions and hammer out my thesis. One day I'll have the time to learn Vulkan. One day...
It works on Linux with your CPU. It might even work on Windows if you use this beta driver

https://software.intel.com/en-us/bl...204404-graphics-driver-for-windows-78110-1540
 

Slavik81

Member
It works on Linux with your CPU. It might even work on Windows if you use this beta driver

https://software.intel.com/en-us/bl...204404-graphics-driver-for-windows-78110-1540
Yeah. When Vulkan released early this year I was patching Mesa to get the vulkan branch to compile on Ubuntu 14.04. It kinda worked, but apparently they needed kernel changes to finish it.

I should have just waited for the official release of my drivers, but six months is a lot to ask from a guy who thought he could have it immediately if he just put in a little effort.
 

Makai

Member
Yeah. When Vulkan released early this year I was patching Mesa to get the vulkan branch to compile on Ubuntu 14.04. It kinda worked, but apparently they needed kernel changes to finish it.

I should have just waited for the official release of my drivers, but six months is a lot to ask from a guy who thought he could have it immediately if he just put in a little effort.
I sent my code to my friend who uses Linux and it immediately worked for him, so it's probably fine now.
 

zeemumu

Member
I'm having trouble understanding the pumping lemma. How would you go about showing that a regular language that requires less or equal 0's than ones isn't regular?
 
Hey guys I was wondering if anyone could explain the use cases of closures for me?

What I mean by that is, I know what a closure is, and I know how to create a closure. I know they can be useful for example in Python to create decorators.

Outside of that what I'm interested in finding out is why I would use them and in what cases it would be useful/beneficial.
 
Hey guys I was wondering if anyone could explain the use cases of closures for me?

What I mean by that is, I know what a closure is, and I know how to create a closure. I know they can be useful for example in Python to create decorators.

Outside of that what I'm interested in finding out is why I would use them and in what cases it would be useful/beneficial.
A common use case are callbacks. Say you have a function that does some computation asynchronously (you call the function and it immediately returns and it starts the computation in a background thread) and you want to do something with the result. The way this is often handled is by passing in a closure that does something with the result of the computation. Very common in Javascript for instance.
 
Programming gaf, it's been a while since I post here after graduating from college. I'm just curious if anyone would kindly share some good machine learning courses. I know the Andrew Ng course is one many people recommend. Any other resources?
 
I don't really know the specifics of that environment, but I can give you some general suggestions.

So, if they want each individual customer service agent to only be able to log in from their specific terminal (your phrasing isn't 100% clear), then static IPs are basically a necessity. In that case, you'd need to make that clear to your client.

If they just want the customer service agent portal to only be available to any agent from any workstation, then your options open up a bit. Basically the two best approaches I can think of are to either only make the service available at some network location which only the workstations can see, or to identify the workstations using an IP address (either some range that is exclusively dedicated to them or a list of static IPs).

Also, depending on the exact details, it may make things easier if you split up your app so that the manager and customer service agent bits are accessed through separate endpoints. If your application architecture can tolerate that, it might help you to keep the users separate.

Regardless, network topology is really important when you want to restrict access to specific machines. It will decide which options are on the table.


being hosted means static IPS are needed. If they were hosting the app on their own server in-house, it could restrict non-manager accounts to only be accessible on the local subnet.

Thanks! It looks like IP checking is the best route.


You need static IPs. Also, this is essentially a negative value feature. If admins can log in and this is secure then there is no reason anyone else shouldn't be able to. You're basically creating work to make the product worse. There is no security value in this.

I kind of get what your saying, but I kind of don't. This app is going to be a LoB app used in several stores to process customer data. We don't want anyone logging in outside of those stores to do anything. The "admins" in this case are literally the owners of the business who may need to approve stuff remotely, or just check on daily stats.
 

Pokemaniac

Member
Thanks! It looks like IP checking is the best route.




I kind of get what your saying, but I kind of don't. This app is going to be a LoB app used in several stores to process customer data. We don't want anyone logging in outside of those stores to do anything. The "admins" in this case are literally the owners of the business who may need to approve stuff remotely, or just check on daily stats.

While I'm not 100% sure how you'd do this with Azure (it probably involves some sort of tunnel), have you considered just only making this available on the internal network (via one of the non-publicly routable IP blocks) and just having the owners use a VPN for remote access? If only a handful of people actually need remote access, then I question the value of fully exposing it to the public Internet. That way you wouldn't even need access controls.
 
Top Bottom