15,891,431 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by ShacharK (Top 70 by date)
ShacharK
26-Sep-13 10:21am
View
I don't see how implementing ISerializable is of any help. I have a custom object that exposes String instead of an object. I need it to be transparent, as if it never existed.
InternalStructureToStringSerializationObject should output a serialized string, and it could be initialized from a string as well.
Instead of: { "Output" : "EncryptedString" }, it should be serialized to "EncryptedString" only.
ShacharK
21-Jul-13 17:28pm
View
Thanks a lot for your help, I tried to avoid this solution as I find it not very elegant, but I guess it is not that bad after all...
ShacharK
21-Jul-13 15:20pm
View
Umm, Lets simplify things a little a bit. I can reduce the problem into that. (Although, I'm afraid that I'll be giving up on some measures of security).
I obviously need all my modules to be loaded during the initialization, as I need to resolve types that exist in modules that aren't loaded as dependencies.
Is there a better way to do that rather than the simple solution of loading all the modules that declare that they are defining types, and need to be loaded? Something like scanning the directory for them when initializing the resolver mechanism?
ShacharK
21-Jul-13 1:35am
View
It knows only the base type, the rest is regular object population... I guess I might have re-implemented something, but it isn't the problem right now...
ShacharK
20-Jul-13 7:28am
View
Of course I'm going to use standard serializers. I wrote my own JsonConverter that knows how to resolve my types, All I need to do is to translate the type of the member that is being populated. If it inherits some base class that has "Id" member, I query the "Id" value and translate it into a new type (I assert for assignability of course...). Then I simply populate the new type instead.
My architecture would look something like this:
Common:
Contains lots of stuff, mostly irrelevant. Mostly wrappers (Reflection, Cryptography wrappers) Also some Error Logging & Asserts, Debugging Utils).
Common.Serialization:
Contained within the Common.dll, exposes a BaseSerializer class, that all serializers must implement, along with the base type for the polymorphic serialization, the identification attribute and the resolver code, which can be used by inheriting Serializers.
Plugins.Serializers.Json: A separate DLL. Implements JsonSerializer (simple wrapper to an existing serializer).
Plugins.Communication.Protocol - Exposes a Command design pattern, with some basic classes, mostly dealing with authentication abstractly.
Plugins.Authentication.Email - Examples for a plugin that implement authentication logic using an email-address and password.
Plugins.Authentication.Email.Protocol - Implements the abstract classes needed for authentication by the forementioned protocol.
Use case in an Application:
The application is configured to use JsonSerializer along with the protocol.
It needs to know to resolve types from Plugins.Authentication.Email.Protocol lazily, if it exists. I just don't want the application to specify the modules it requires manually in any step (especially not the protocol which shouldn't be related to any project and technically be compiled once for several projects).
The only thing I could probably live with is loading the assemblies manually in my executable project, but I really prefer not to do so, as I'm trying to achieve a black-box framework that my project developers could use without touching my code at all, just write / add existing plugins wherever possible.
Thank you again :)
ShacharK
19-Jul-13 11:28am
View
Um, first of all thank you for your answer.
Secondly, I would like to ask you how do you see your suggestions combine with my design.
Lets review the design:
1. A serialized request object is received, we should deserialize it into a Composite Request.
There's the simpler case, The request class is defined within an assembly which was already loaded (statically).
2. Id property of the main object is examined.
3. A matching type is found (or is already cached, because it was previously used...)
4. The deserializer starts to populate the type. Lets say the Type was a registration request.
Here comes the tricker part (at least for me...).
The RegistrationRequest is composite and contains an abstract-class member "Registrator".
If an authentication plugin wants to expose a protocol interface,
it should implement few classes such as "Registrator", "Authenticator", etc.
That way, the run-time binding process that we're reviewing should do the connection.
We have an unloaded email plugin. Now the resolving algorithm, that worked fine with the straight-forward case
needs to know that the ID "12345678" means an EmailRegistrator. (We can assume that the registrator has an identifying attribute that says 12345678...) How does it happen?
ShacharK
15-Feb-13 15:19pm
View
The way I see it, Composition changes the way my requests are serialized.
I'll try to simplify what's on my mind by an example:
Imagine 3 layers of inheritance, I would expect my data structure to contain the parameters of all the layers, lets say the expected serialized object is (123).
If I use composition, I have 3 Parameters Structures, one for each layer, making it look like (1)(2)(3). It is possible to work like that, but not very comfortable in my opinion... In this case, assuming the serialization works properly. Errors and Exceptions can be handled in the same layer, utilizing the fact that the requests can still inherit from one another.
If the Inheritance is used, It is impossible to use the layered error handling, as every Request is inheriting a Parameters class. and although serialization works perfectly fine, lower-level exceptions are being handled in multiple requests.
I guess that Partial classes are just wishful thinking, and that if I ever decide to write such utility, I would choose the composition method before I would choose the Request Inheriting from Parameters class.
ShacharK
15-Feb-13 13:55pm
View
The idea of using partial classes by auto-code generators is very common (Visual Studio Code Designers often use them). All I'm doing is translating data contracts from one language to another to enforce that no dumb mistakes are done.
ShacharK
14-Feb-13 19:44pm
View
Actually, I am building a framework. My intentions are obviously minimizing the amount of boring repetitive code the developer has to write (even worse! duplicate :S). This is extremely error-prone, and might be annoying. Especially, when different people are working on every code base.
As you've mentioned, The client-server interface should be consistent. I obviously agree. I don't see any good reason why a user of my framework would have to change that. Especially when I'm offering many useful abstract base classes whose handling procedures do much of the validations and verification procedures needed by the average server. Anyhow, This is a cool feature to have, and if it works properly, along with some basic target-language communication framework that I can supply. An application's SDK can be created in a really short time.
I don't see why creating a copy of the request parameters on both side of the protocol is not a good solution.
Somebody who uses this framework feature would have synchronized enums, synchronized requests parameters. It ensures that the communication will be stable, as long as the client compiles properly. Serialization methods (Binary, JSON, XML, Protobuf, ...) are all configurable and the settings could be exported as well if I wanted them to. For example I could translate C# attributes to Java Annotations which would contain serialization relevant parameters (i.e JSON Keys)
TRK3 & Sergey, I think you've misunderstood my intentions. According to my design, the server is responsible to export an SDK, which one could simply assimilate into a layered protocol manager which is capable of fixing some issues without annoying the client side developers.
I don't think that I should be concerned about the division of labor. As my design is very "oniony" and every layer has a matching layer on the other side.
Thank you for your time, I really appreciate your efforts to help.
ShacharK
22-Jan-13 17:09pm
View
It is indeed an excellent answer. Your insights were very helpful, I thank you very much for that.
ShacharK
20-Oct-12 4:43am
View
Well, I'm not totally convinced yet, but I do appreciate your efforts, Thank you very much :)
ShacharK
19-Oct-12 20:39pm
View
I will definitely look at it, by the way, is there a way to verify the validity of the sent objects? For debugging purposes, If a field is not found, would I be notified? As it is very important that the entire data is complete...
ShacharK
14-Oct-12 16:12pm
View
Would that be better? Isn't WCF an overkill? I always found this technology far too complicated for any of my needs in the past. I would love to hear your opinion.
ShacharK
13-Oct-12 13:11pm
View
I'm usually a low-level guy, but I really think that a C++ implementation for this project would be an overkill. By the way, are Visual Studio Ultimate 2010 and IIS sufficient for development of C# for Web-platform? are there any helpful add-ons? Thanks a lot.
ShacharK
13-Oct-12 9:04am
View
I would like to write minimal amount of ASP code.
I have no real need for any web features provided by the HTTP protocol.
I use the http server as a platform to have clients communicating with my database using my custom JSON-based protocol.
You send a request, My protocol which I want to implement in C# processes information, makes the desired API Calls, and prints out a simple JSON-object response (instead of an actual website's html)
ShacharK
10-Jul-12 0:19am
View
Well yeah, the storage engine is InnoDB. That's the main reason why I'm surprised... Those are two unrelated queries. All I'm trying to show is that when adding the FK during creation, it fails. But works properly when the table is altered after creation is done.
ShacharK
27-Nov-11 14:43pm
View
I was hoping for an external reference... but never mind, I found something...
ShacharK
24-Nov-11 12:33pm
View
Well, I was hoping for something constructive... A constructive example of how to design a solution, starting from the definition, up to the classification, I have read the theory, As a mathematician myself it makes sense, but is there an example that instead of just sharing their classifier with you, can actually give you hints how to start the design from scratch?
ShacharK
31-Oct-11 4:21am
View
Well, I know that its activated, because there is another software installed on the destination PC that is using the same database... If I only had access to its connection string, life would have been easier.
ShacharK
31-Oct-11 4:19am
View
It's a problem, because I'm actually not testing my application on my computer, but on a customer's computer... So I can't check it :S
ShacharK
30-Oct-11 5:53am
View
Yep, irony :S
ShacharK
30-Oct-11 5:34am
View
Damn it, Found it by myself... I am such an idiot... :)
ShacharK
30-Oct-11 5:20am
View
My ExecuteNonQuery function is located within my DatabaseConnection class, which handles all my SqlCommands (opening connection, setting its SqlConnection as Command's connection, and then executing the command itself...)
ShacharK
30-Oct-11 5:19am
View
Deleted
My ExecuteNonQuery function is located within my DatabaseConnection class, which handles all my SqlCommands (opening connection, setting its SqlConnection as Command's connection, and then executing the command itself...)
ShacharK
30-Oct-11 5:17am
View
I added my GetProcedure method. Does it help you to help me?
ShacharK
30-Oct-11 4:56am
View
Could you please be more specific? Maybe me send me to a relevant reference? This problem is very crucial... It happens quite a lot (unfortunately...)
ShacharK
29-Oct-11 20:36pm
View
Well, my code works when I'm executing it directly using the server, but I just don't get why it wouldn't commit.
ShacharK
29-Oct-11 17:01pm
View
Well, I'm executing my queries in very specific functions, so its not a problem to pool.
I have several main threads, only two of them are accessing the database. The one is actually a timer, used to load data from a specific database table (once in a while... haven't decided what would be the interval left, and I assume it would be for a few seconds once in real time).
The data is loaded into a queue of messages, which are sent by another thread to other instances of my program, and are received by the second database-accessing thread (in other instances), and it can do operations on the database.
So I have actually one reader, and one writer. The reader is used once in a few minutes, The writer runs whenever it gets data from the sockets...
ShacharK
29-Oct-11 16:35pm
View
How can I debug the Procedure code?
By the way, how would you recommend handling multi-threaded database access? Should I be holding a connection for every thread?
ShacharK
29-Oct-11 9:25am
View
Well, I was hoping that there was a way to find them using the SqlClient interfaces in C# (For example, I'm using it to get the table structures, columns and column types... So I was hoping (initially) that maybe I could use this interface to extract more data about the tables.
ShacharK
29-Oct-11 6:10am
View
Oh, Of course... Thank you... I'll use a dictionary instead :)
ShacharK
28-Oct-11 10:38am
View
Thanks :)
ShacharK
28-Oct-11 10:38am
View
Thanks. :)
ShacharK
28-Oct-11 10:04am
View
Well, Thanks, it seems really useful, but I chose implementing a naive solution (extracting the IDs, followed by the rest of the data...), because of C# reasons (I have a database generator, and I don't want to expand it to support views as well...)
Thanks again :)
ShacharK
28-Oct-11 8:00am
View
Yeah I read about it, but should I CREATE the view every time? or should I make it permanent? I need high-performance in this query. Using a view would be more efficient, than selecting the t1.EventID, and then extracting the rest of the data?
ShacharK
28-Oct-11 7:15am
View
Could you please be more specific? Should I CREATE the VIEW within the procedure and then delete it?
ShacharK
26-Oct-11 9:37am
View
I've looked, I couldn't find anything constructive... I was hoping that someone here would have something constructive for me to learn from...
ShacharK
26-Oct-11 4:27am
View
I mean the socket's async receive and send...
ShacharK
26-Oct-11 2:27am
View
I'm actually not interested in using it, Not for now, I'm trying to implement my own logic. Could you please shed light on the RSS method please?
ShacharK
26-Oct-11 2:02am
View
My service is actually server replication, but with some logic applied to the whole business. I want all my system's database to contain the same data (so I could, technically be working offline, and then when a connection is available, update everything... that while assuming that the connection would be available most of the time...).
I didn't say that prioritizing message is not simple, but it would require a scheduler algorithm, like in a process scheduler algorithm of every OS.
You think that I would benefit from sending my messages to the server, and then the server would "broadcast" them using RSS to all of his clients? Could you give me some more information on that? How can it be applied? and a big part of my tree hierarchy is in the LAN (if it matters...)
ShacharK
25-Oct-11 11:06am
View
Deleted
Always nice to know, thank you.
ShacharK
25-Oct-11 11:06am
View
Deleted
Always nice to know, thank you.
ShacharK
25-Oct-11 9:40am
View
Finally... All I was waiting for was someone to say that its just like the regular query syntax... :)
ShacharK
25-Oct-11 8:39am
View
@events should be a multiple-valued column... I know how to do the simple query.
I need to read @events or simply the EventID column from C#
ShacharK
25-Oct-11 7:36am
View
'id' should be the number of the line. The primary key, or something like that would do.
CREATE TABLE table (
id int PRIMARY KEY IDENTITY(1,1)
record int
)
Fill the table with some values... let the id get the designated IDENTITY value.
and then apply the UPDATE query that I've suggested.
ShacharK
25-Oct-11 7:34am
View
Can it? RETURN SELECT ...?
ShacharK
25-Oct-11 7:30am
View
I'm not really interested in it as an output parameter, see it as a "pseudo-code", I just want the multiple values that are returned in the column EventID. How can I get them from an SQL Command?
ShacharK
25-Oct-11 7:10am
View
So did it work for you?
ShacharK
25-Oct-11 4:45am
View
Deleted
Yeah, but dictionaries can locate keys in O(1) because it uses a hashtable (I think according to the documentation). Maybe the O(1) way costs lots of memory.... But I'm storing integers, so boohoo... :)
ShacharK
25-Oct-11 4:14am
View
Deleted
Math is my actual education... Anyway, All I'm saying is, that this map is used to recognize a client of the logical system (the ID from the database) and a physical connection ID to the server. I'm limiting the connection so only one connection can be identified as a client (otherwise, this is just bad use of my code). The only situation that can mess stuff up, is if there was an abnormal DC, and the client is trying to login again. Therefore, the simple mapping logic isn't sufficient for my needs, and I would have to encapsulate it within a more suitable interface & logic.
ShacharK
25-Oct-11 3:26am
View
Deleted
Bill, My design ensures that the match is injective, because only one connection can identify at any time as a single client. I'll be implementing a class that would contain the simple map that would add the functionality, that if a client is already connected, and somebody identifies successfully as this client, the match would simply change.
ShacharK
25-Oct-11 3:03am
View
Deleted
Thanks, it was very lazy of me to ask... The answer was quite obvious :) Thanks again.
ShacharK
25-Oct-11 1:56am
View
I need it because the database that I'm working on has tables with multiple types as possible primary indices, and maybe even multiple. I'm trying to track the changes, if there was simply a row id, and the others would have been unique together life would have been so much easier... but no...
ShacharK
24-Oct-11 8:18am
View
Great, and if I assume that data is variant, can it be converted automatically (or throwing an exception, I don't care...) to the input type of the destinated procedure?
@v1 and @v2 are variants that are supposed to be passed into the procedure...
I mean, exec (@sp_name) @v1 @v2
and the specified procedure is actually expecting integers...
ShacharK
24-Oct-11 1:47am
View
Thanks, I figured out by myself how use the bulk copy interface.
My question is actually, how can I pass the data within the DataTable first to another location within my network that is familiar with the destination's actual connection string, and would be the one that will use the bulkcopy code (using its already active connection to the destination databaes).
I'm afraid that DataTable can not be binary serialized, is there a better way to do it?
ShacharK
22-Oct-11 13:08pm
View
How is it done? The "Allow remote connections..." is checked by default, but what am I supposed to config in the Configuration Manager?
ShacharK
21-Oct-11 20:20pm
View
Yes, but an "interesting" pattern can slow down many brute-force attacks... I didn't say that it makes encryption obsolete... Nothing does, but its another security measure.
ShacharK
21-Oct-11 7:52am
View
I am using a queue of messages.
ShacharK
20-Oct-11 6:54am
View
Do you mean extracting the text in the address bar from your web browser (lets say Firefox) and use it in your application?
ShacharK
20-Oct-11 4:50am
View
According to what you're saying, there shouldn't be any problem with the DROP, but what about the creation? Can I create "randomly" my tables, with my foreign key constraints turned off, and only eventually, after the whole database is built, to actually turn them on (without the SQL telling me that it couldn't find the column that I was referring to)
ShacharK
19-Oct-11 23:13pm
View
Maybe, I don't know. I don't have a good reason to implement it right away, nothing to do with table-return values right away at this moment. Thank you very much anyway, I'll look at it whenever I would actually need that.
ShacharK
19-Oct-11 3:44am
View
I know the purpose of course of every one of the "components" in the deal.
I just didn't realize how the specific is done... All my SELECTS so far were direct queries, I wanted to have the possibility to combine the two.
You say that I could be having an OUTPUT Parameter that is simply assigned with multiple data? I just couldn't find a good example how to combine that with data selection, could you maybe post some pseudo?
ShacharK
17-Oct-11 21:41pm
View
I have written a module that helps me create the procedures in code and then install them query-like... I think it would be sufficient (for now). Thanks anyway :)
ShacharK
17-Oct-11 11:34am
View
Its problematic, because I might be connecting to a remote database and won't have access to it...
My alternative solution is to create the procedures by query during the setup, which is not very pretty because it would be simply a string and can cause troubles in later changes...
The optimal solution would be if I could write the methods as if they were written in the dll, and transform them into SQL query form or something like that...
ShacharK
17-Oct-11 9:44am
View
Found it by myself eventually, thanks a lot anyway :)
ShacharK
16-Oct-11 10:03am
View
Make them anyway, an extra opinion is always welcome...
ShacharK
16-Oct-11 10:02am
View
Deleted
Make them anyway, an extra opinion is always welcome...
ShacharK
16-Oct-11 9:43am
View
Of course, Every inherited Command builds the abstract Command base with different type, that's how I know what I'm building when deserializing them, and what are the values that I'm expecting.
The issue is the possible lack of Encapsulation, and not how to apply the Polymorphism. Whether I should just build an InheritedCommand and hide it behind a regular Command pointer. and then call command.Handle(All The Modules That Handle Might Require);
which of course would be much more aesthetic than a notorious switch-statement. A switch statement on the type would be followed by a cast to the actual command, and a set of operations in the module (Reply, Database Access, etc.) according to the specific properties of the message and state - decent encapsulation... but not very pretty.
ShacharK
16-Oct-11 9:10am
View
Nah, I'm satisfied with my own serialization... Its still not what I was asking.
My switch statement is applied when I'm willing to handle the received message within the handle thread. According to that design, my commands are nothing but structures that organize my data.
My question was whether I should be using virtual Handle methods, that would need some inputs that would contradict the program's logic, and its encapsulation, by giving the method access to many other modules. My "handler" is kind of a main module which operates the Socket modules and Database module. Don't you think that it would be weird?
ShacharK
11-Oct-11 3:37am
View
Are you saying that I should execute the queries by myself when receiving them, instead of letting the SQL to do the job for me?
Show More