|
Eddy Vluggen wrote: your question is too vague And already posted three or four times elsewhere.
|
|
|
|
|
Didn't view the message history, but good reminder why I should have
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
This isn't even a question. It's ironic that someone so lazy that cannot even type a question would post the same non-question multiple times.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Maybe it was an understated Eureka moment:
it window application form work in KIOSK (!!!)
(Yippee)
|
|
|
|
|
hi,
I'm reading about the flyweight design pattern. In my understanding it's basically something like 'use shared pointers/references to big objects in order to safe memory'.
Example: I'm writing a website, that contains 1MB pictures all over it. All the pictures are the same. Now, instead of transferring the picture x times, I. transfer it only once and let the website content always refer to that already transferred picture.
Am I right about that?
The often used example with the letters and glyph does really confuse me here, so I'd like to recheck.
I can't understand, why it would be better to have a referred letter instead of a simple char inside a class...
I really appreciate any help here!!
regards
modified 8-Feb-16 15:04pm.
|
|
|
|
|
You will need to be more specific about what you mean by "transferring".
Are you talking about content in a web page? FTP? What?
What / why 1 MB images? For display in a browser? Why not thumbnails?
|
|
|
|
|
Thank you for the answer!
yes, I was assuming a web page. But apparently the example was not appropriate and therefore missleading.
Maybe we should just skip the example.
So the "flyweight" in the "flyweight" pattern refers small objects, that all share some heavy ressource?
|
|
|
|
|
Yes; I would agree with your last statement.
"Small objects" that container references / pointers to "big" / data objects.
|
|
|
|
|
thank you
|
|
|
|
|
Hello All,
Could any one suggest how can I design the following the problem in C++?
How to provide access to a component of a Class to some third person. The constraints are
1. The third person should not be able to see the other details of the class!
2. the component should be accessible to only that particular third person!
I have a solution to the problem. But I would like to know other approaches to solve the issue.
Thanks in advance
~SSETH
|
|
|
|
|
sseth21k wrote: I have a solution to the problem. But I would like to know other approaches to solve the issue. You might want to explain your existing solution so that
a) people don't waste time on writing a suggestion for the same
b) people might give you tips how to improve it
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
class AccountInterface
{
public :
virtual void CheckAccount() = 0;
};
class Accountant
{
private:
AccountInterface * accountDept;
public:
Accountant():accountDept(NULL){}
void SetCompanyAccDept(AccountInterface *accDept){accountDept = accDept;}
void AuditCompany()
{
if (accountDept)
accountDept->CheckAccount();
else
printf("Compnay info not set");
}
};
class company : private AccountInterface
{
private:
virtual void CheckAccount()
{
printf("Only Granted Accountant should have access to this");
}
public:
void SetAccuntant(Accountant *accountant)
{
accountant->SetCompanyAccDept(this);
}
};
int main (int argc, char *argv[])
{
company c1;
Accountant ac1;
c1.SetAccuntant(&ac1);
ac1.AuditCompany();
}
I tried to demonstrate the idea with a company its account deptartment and an accountant.
Account Details should not be public. (no Public access)
The Accountant should not be able to access other details of the company ( No friend)
Company is responsible for granting access permission --Private Inheritance..( is a relationship with base class but no exposed to public)
Thanks,
SSETH
|
|
|
|
|
I'm not certain what problem you are trying to solve but that sounds far too complicated and unwieldy. The usual way to restrict things is by allocating permission levels to both users and data. That way you can grant or restrict access to individual people at run time.
|
|
|
|
|
Thanks for respond ..I dont know if you are really getting the what exactly I am trying to target in the code.. without friend and making public accessibility I want to restrict the permission to some particular user...
The way I am achieving is just one of the use case of Private Inheritance..
Could you please post here your approach(Design) in C++..
Thanks in advance..
|
|
|
|
|
SSETH wrote: Could you please post here your approach(Design) in C++.. I did in my previous message. The way you control access to different features is by taking decisions at run time, as to what facilities and data a particular user has access to. Doing it your way is nigh on impossible, and would need regular changes in the code.
|
|
|
|
|
First off of course this is a made up problem that should never be implemented specifically in code. Parts, depending on what you mean, might be implemented in they system but not code specifically (design versus code.)
But approaching it code wise.
sseth21k wrote: 1. The third person should not be able to see the other details of the class!
The implementation via class A. You have an API class that returns a proxy B. The caller uses B. B internally is implemented such that A supplies all the behavior.
Specifically in C++ this means that A will NOT be in an include file. Rather it should be a source file. In ractical wise you would probably put in its own package with its own include file
Code wise you could tighten this even further by delivering a binary rather than source code. Then all they could see would be the Proxy.
sseth21k wrote: the component should be accessible to only that particular third person!
There is a credential class. It has specific data that identifies the caller.
The API (above) is modified to take an instance of the credential class. The API checks the data to 'match' to the 'third person'. If it matches it returns the Proxy. If it doesn't match it returns null.
|
|
|
|
|
This is probably the first question I have asked on CP, so please be gentle , also my terminology might be a bit all over the place.
I admit I am pretty much a beginner as far as entity framework and architecture are concerned. I am in a bit of quagmire, I have inherited several applications that rely on one database and that database has one datacontext project which all these applications plug into.
Currently we are using TFS and each of these .Net applications have a project reference to this data context project, which is fine if you do not need to branch out and if it is a single programmer outfit.
Now I want to implement a better release strategy after a few D-Days and issues with half finished code (not caused by me). I want to go with the Gitflow strategy where I have three types of branches, a release (golden) branch, a trunk development branch and a day to day development branch. Now with several projects all tied together by a single datacontext project it is painful creating new branches, merging up, as it is huge and we lose track of changes. I agree there is very tight coupling and this needs to be reduced, I want to come up with a sane way of splitting the context and the applications into single entities. I agree what ever I do it will be time consuming but I would love a few opinions and experiences on people who have battled with this issue.
Thanks for reading,
|
|
|
|
|
A (current release) Entity Framework app is not limited to one "DbContext" per database (if that's what you're referring too).
The "entity class definitions" are what's "common" here; a given DbContext is simply a class that identifies the entities too be used in a given "context" (i.e. program / app).
I can have 3 tables: A, B and C.
One context can include tables A, B and C; another just B and C ... like a "view".
So; I don't see DbContext classes as limiting your ability to move forward.
|
|
|
|
|
Thanks for clearing that up for me, in that case I shall have multiple DbContexts referring to the same table but only sections I need for different applications. Thanks again,
|
|
|
|
|
|
git (regardless of process on top of it) is not well suited for handling multiple deliverables unless in fact those deliverables are real deliverables.
So for example if your company has a logging library that has its own sprints, its own requirements, schedule and delivered versions then that is a deliverable library. And the applications in the rest of the company would use a delivered version of that library.
With git that would then exist in its own repository.
In comparison what often happens is that there are several large entities which compose a single delivered application/system. A change in one part of the system invariably requires a change in another one or even several entities. All entities are manage in one sprint and a release involves all of the entities at the same time.
I am guessing you have the second. And it is unlikely you will ever have the first. Possible just not likely.
The only way to really ease the burden with the second is to very carefully manage dependencies. And that is not something that technology does - it requires a person. Thus if you add a new feature then the back end code is finished and, hopefully if possible, QAd, before the front end is even started. Obviously this is a probably when modifying existing code but then you can add new functionality as different endpoints and denigrate the old endpoints for removal in a future sprint. Again this is a manual process.
darkliahos wrote: I would love a few opinions and experiences on people who have battled with this issue.
A good a conscientious project manager can help a lot. There are not a lot of those however.
|
|
|
|
|
Here's some thoughts on a potential design for a file transfer application. I welcome any input you may have:
Purpose
Provide a real-time file transfer service that allows users to upload/download files to/from a server and to provide automatic synchronization between the server and the user machines.
A user-specified folder structure can be defined on the local machine. When a file or folder is added, modified, or deleted (Known as a Change) in any file or folder in this structure is the added, modified, or deleted on the server accordingly.
When a Change occurs, all users must be notified, and automatic folder/file synchronization between the server and the local file structures must be automatic and transparent to the users.
Proposed Solution (Prototype)
- The local machine will run a FileSystemWatcher hosted by a windows service.
- FTP wil be used to transfer files to/from the server.
- A SignalR service will be hosted on the server and function as the mechanism for maintainin connection to and communicating Changes Messages between clients.
A Change Message contains the following data:
1. Client Id (GUID) - The ID of the client originating the change
2. Item Type - File or Folder
2. Name - Full path and name of the file or folder
4. Action - Create, Modify, Delete
5. Location - Client or Server
Use Case 1 - File Added
A user drags a file into a folder called c:\TheApp\SomeFolder\MyFile.txt. The file does not already exist in the folder. The FileSystemWatcher detects the new file, FTP's it to the server with progress reporing. Once the upload is commplete then the client transmists a message to the server as such:
Client: {6FD41E1C-0057-44E4-B1AA-E0A4A263ABA3}
ItemType: File
Name: "c:\TheApp\SomeFolder\MyFile.txt"
Action New
Location: Client
The server recieves the message, verifys that the file exists on the server, then generates and sends the following message to all clients except the sender:
Client: {6FD41E1C-0057-44E4-B1AA-E0A4A263ABA3}
ItemType: File
Name: "SomeFolder\MyFile.txt"
Action New
Location: Server
The client recieves the message and then initiates an FTP of the file "SomeFolder\MyFile.txt" to "c:\TheApp\SomeFolder\MyFile.txt".
Use Case 2 - Folder Deleted
A user removes the folder c:\TheApp\SomeFolder. The FileSystemWatcher detects the change and transmists a message to the server as such:
Client: {6FD41E1C-0057-44E4-B1AA-E0A4A263ABA3}
ItemType: Folder
Name: "c:\TheApp\SomeFolder\"
Action Delete
Location: Client
The server recieves the message, verifys that the folder exists on the server, deletes the folder "SomeFolder", then generates and sends the following message to all clients except the sender:
Client: {6FD41E1C-0057-44E4-B1AA-E0A4A263ABA3}
ItemType: File
Name: "SomeFolder\MyFile.txt"
Action New
Location: Server
The client recieves the message and then deletes the folder "c:\TheApp\SomeFolder".
Issue - Simultaneous Changes by Mutiple Users
User A changes the contents of a file but does NOT save and leaves the file in an edited state. User B changes the contents of the same file and saves it. User A then saves changes to the file.
The local component of the application could use the date/time stamp of the file to determine the disposition of the file, but there may be differences in those date/times. The simplest implementation could be to run the last action received on the file.
|
|
|
|
|
What happens if a user is not logged on? Do they get "synced" when they log on?
How "current" does the syncing have to be? Why?
Design choices are premature at this point; IMO.
|
|
|
|
|
Gerry Schmitz wrote: What happens if a user is not logged on? Do they get "synced" when they log on?
Yes
Gerry Schmitz wrote: How "current" does the syncing have to be? Why?
Real-time. This app wil be applying business rules to documents placed in the folder structure, so it's important to keep the folders/files as up to date as possible. For example, there may be a requirement to destroy a doc automatically after a certain date/time. The server would send a Destroy message to the clients, and then doc would be removed.
Gerry Schmitz wrote: Design choices are premature at this point; IMO
Not sure I agree. We've been discussing and documenting the requirements for a year now. It's time to prototype, so I'm looking for technologies that will fulfil the requirements and then to get started.
Thanks for your input.
If it's not broken, fix it until it is
|
|
|
|