|
thank you for your reply it's really appreciated
Agree totally with your considerations, there is lot to optimize in the code, but still that doesn't explain why the Java or the Dart version are much faster (and they don't even have structs). One could point out that it's like comparing apples vs oranges, but Java and C# are very close sharing common traits to the point that the two source codes can be compared line by line. So what's exactly the reason why .NET is so slow here? Do you have an idea?
|
|
|
|
|
Hey guys recently I've been wondering about which would be the best way to implement a localization system based on namespaces.
Let's say that for some reason I wanted to use a few source code files in many different projects, and for some other reason I don't want or cannot build a DLL out of them (which of course would be the "right" way to do this). Let's also say I need to localize that code in a few different languages. Also, the files I'll be sharing all use the same namespace.
Now, the standard localization technique in Visual Studio works real fine and is very easy to maintain and update within the IDE, but it's all tied to the project's main assembly name. So, while I could just copy and paste over all the necessary localization strings for my shared files each time, and prefix all the relevant localized string names with my namespace ID, that would be clumsy and error prone.
I was wondering if there was a way to build up some DLL or resource files and just bundle them up with the source code to be shared. I've been considering for example building up a few resource files within the IDE, using file names that include the namespace and the different culture IDs, and then implementing a custom resource manager using ResXResourceReader or something similar.
Any other ideas ?
P.S.: we are talking C# here.
In theory, there is no difference between theory and practice, but not in practice. - Anonymous
A computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are, in short, a perfect match. - B. Bryson
|
|
|
|
|
You are trying a really weird way of code re-use.
In my opinion, you have to update your tool which you use for your current code sharing such that it can handle the resources also.
|
|
|
|
|
I'm not discussing the way to re-use code here. As I said, I'm perfectly aware the "right" way to do this is by using DLLs to share code.
I'll take your answer as "I don't think what you propose can/should be done".
In theory, there is no difference between theory and practice, but not in practice. - Anonymous
A computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are, in short, a perfect match. - B. Bryson
|
|
|
|
|
Moreno Airoldi wrote: but it's all tied to the project's main assembly name How so?
You can add a *.res file to a project, and name it as you like. You can then add resources there. You could name it after your class, having a *.cs and .res file for it (and optionally a .xaml/.cs.Designer file).
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Of course you can andd a .res file to a project and name it as you like.
What I'm asking is a whole different thing.
I'll try to be more specific.
In a Visual Studio solution, the standard way to add localization is by creating a set of resource files named "Localization" plus the culture ID. So for example you will have "localization.resx", "Localization.it.resx", "Localization.de.resx" for your default language, Italian and German, and so on.
Then, you can use a ResourceManager to get your localized strings:
ResourceManager LocalizationResourceManager = new ResourceManager(Assembly.GetExecutingAssembly().GetName().Name + ".Localization", Assembly.GetExecutingAssembly());
...
string LocalizedString = LocalizationResourceManager.GetString(ResourceName, Culture);
Now this is perfectly fine and of course does not stop me from doing what I need to, even if I share code by copying over source files. But as you see clearly in the ResourceManager constructor, it's tied to the assembly name, simply because the resource file is compiled together with the project's main assembly.
I was simply wondering if there was a way to somehow change this so that the DLLs compiled from the resource files will be tied to a different namespace.
What I'm asking basically is: can I have VS compile a resource file in a project and not automatically assign the resources to the project's main namespace ?
Hope it's more clear now.
EDIT: Just to be even more clear - nothing stops me from naming my resource files "Localization_MYNAMESPACE" or something similar, that's actually what I would most likely do (haven't actually tried this but I'm pretty sure there is no reason why it should not work). I'm just wondering if there are different approaches, and found it quite interesting to investigate how one can configure the way the compiler acts on resource files.
In theory, there is no difference between theory and practice, but not in practice. - Anonymous
A computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are, in short, a perfect match. - B. Bryson
|
|
|
|
|
Moreno Airoldi wrote: but it's all tied to the project's main assembly name
I kind of doubt that. I would suspect that although that is one way to use it there are others.
Moreno Airoldi wrote: Let's also say I need to localize that code in a few different languages.
You don't localize code - you localize applications. There will be differences otherwise little point in having different applications. If you have common blocks that need to be translated then keep them in their own files and then, if necessary, write a tool that merges them in the build process as a pre-build step.
|
|
|
|
|
jschell wrote: You don't localize code - you localize applications. "Or components thereof".
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
jschell wrote: write a tool that merges them in the build process as a pre-build step
You kind of put the finger on exactly what I was thinking of.
However, it's most likely not worth it to develop a specific tool for that, since it would still be easier to manage the localized resources semi-manually instead of having to keep the tool up to date and so on.
In theory, there is no difference between theory and practice, but not in practice. - Anonymous
A computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are, in short, a perfect match. - B. Bryson
|
|
|
|
|
Hi All,
As per the title of this post... I have developed a small Dot Net WinForms C# application which uses a SQL Server Express 2008 as the database to link to which I would like to sell.
What I'd like to do is use some remote hosting service so I can put up the app and DB and give customers a trial of it before they commit to paying for it at which point I can roll it out to their own network or leave them with the hosted service if they don't have their own network.
As I've never deployed an app to a cloud based host, can some kind person give me some recommended cloud hosts who won't charge too much monthly and where I can load my Winforms App (dot Net 4.5) and I can install SQLServer Express 2008?
Basically the host will need to support dot net framework 4.5 (or I have the option to put it on myself
) and SQL Server Express 2008 (or I have the option to put it on myself). The end-user would ideally access the app via a VM.
I've had a look at RackSpace but I'm unsure of which of their options I would need...
Many, many thanks.
-- modified 28-Aug-14 3:52am.
|
|
|
|
|
Hi, I find lots about a 64 bit app calling a 32 bit, but I am struggling with the reverse and would like to start a discussion about this. The scenario is that there are legacy calling applications that call our unmanaged C++ dll's. Our product is graphics intensive, and we could greatly benefit from the increased memory a 64 bit app would give.
So first is is it possible? Fortunately we have an intermediate DLL that interfaces the calling apps to our DLL's. The callers are a variety of languages/environments, but are all 32 bits at this time. The thought is to first get our program compiled into 64 bits (that's another discussion), but assuming that is accomplished, I was thinking of wrapping our program with .Net, and then modifying the calls to the intermediate DLL (32 bits) to instantiate us as a 64 bit dll. Am I on the right track? What issues should I be concerned with? What if the system is 32 bit windows vs 64 bit windows?
Many thanks in advance.
|
|
|
|
|
If you use some kind of remoting you can have one process in 64 bit, even if it is seen as a library, and another one in 32 bit calling it.
You can use .NET remoting or WCF to do the job.
You can't really load 32-bit and 64-bit DLLs in the same process.
|
|
|
|
|
Hi all,
I need the following methods for login module and reset-password module.
a) Salted MD5 technique in „authentication or login module‟ and
b) MD5 hash technique in „change password‟ and „reset password‟ modules.
and how it should work, I write the description below.
When a client requests for the login page, the server should generates a random number, the salt, and sends it to the client along with the page. A JavaScript code on the client computes the MD5 hash of the password entered by the user. It then concatenates the salt to the hash and re-computes the MD5 hash. This result is then sent to the server. The server picks the hash of the password from its database, concatenates the salt and computes the MD5 hash. If the user entered the correct password these two hashes should match. The server compares the two and if they match, the user is authenticated.
Any reference any link which does the same.
|
|
|
|
|
Where are you stuck?
And more important: are you sure you understand the procedure correctly? Never heard it in such a strange way...
|
|
|
|
|
Simple answer: don't.
You're adding a password to the site because you want to protect the user's data. You want to add client-side hashing of the user's password in case someone is intercepting the traffic between the client and the server. But if someone is intercepting the traffic, then they can just read the user's data as they request it. They can also hijack the user's session and authentication cookies, and perform whatever action they want on your site.
To properly protect the communication between the client and the server, you need to install an SSL certificate and ensure that your site is only accessible over HTTPS. (Depending on the nature of your site, you might be able to get away with a free certificate from StartSSL[^].)
Once your site is protected with SSL, you don't need to worry about hashing the password on the client-side.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I have not been able to find an ASP.NET MVC implementation of DropTiles. (preferably MVC5).
|
|
|
|
|
It's an Open Source project that aims at MVVM. I doubt they're going to reimplement it just for another pattern.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I implemented SSL on my web application.
below is my code through which i am getting login.
MD5CryptoServiceProvider md5Hasher = new MD5CryptoServiceProvider();
byte[] hashedDataBytes;
UTF8Encoding encoder = new UTF8Encoding();
hashedDataBytes = md5Hasher.ComputeHash(encoder.GetBytes(txtPassword.Text));
#endregion
SqlCommand com11 = new SqlCommand("For_Login", con);
com11.CommandType = CommandType.StoredProcedure;
com11.Parameters.AddWithValue("@User_Id", ddl.SelectedItem.Text);
com11.Parameters.AddWithValue("@Password", hashedDataBytes);
SqlDataAdapter sda = new SqlDataAdapter(com11);
DataTable dtcheck = new DataTable();
sda.Fill(dtcheck);
if (dtcheck.Rows.Count > 0)
{
// logged in
}
but when I run the application on server n start fiddler, it shows password in clear text
see the image below
<a href="http://www.freeimagehosting.net/"><img src="http://i.imgur.com/A7j8HC8.jpg" alt="Free Image Hosting"></a>
why this is happening? what to do?
|
|
|
|
|
Fiddler isn't showing the SQL-connection, but the posting of "login.aspx" and it's contents. You're hashing it later on.
Since the page is encrypted, one would not be able to see that without access to the certificate.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Ok fine Sir,
Now see my situation. My Web application's security audit is being done. I implemented everything like MD5, SSL etc.
But if my auditor use this fiddler (or may be another tool for testing, i don't know what they are using) and he/she can see the password in the fiddler what should I do/say? I am not getting the point.
If they always use fiddler or any other tool they can easily see the password. then what's the solution so that password between server and client should not be in clear text.
Is there any other methods doing this so that they cant see the password using any tool? or any other client side technique?
please suggest Sir... I am feeling helpless
|
|
|
|
|
demoninside9 wrote: But if my auditor use this fiddler One could explain the expert that it he/she is looking at a stream that is encrypted before it goes over the net.
demoninside9 wrote: Is there any other methods doing this so that they cant see the password using any tool? Yes, but if he/she is using the key to open the lock, then it is not a security risk. If there's another application client side with administrative priviliges, then you already lost and don't need the audit.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi !
After successfully inject .dll file into a target process, i' would like to run it but how can i do this !!
I' know how to do it into my application by adding the dllMain() function ...
But in the target process how can it be achived ??
I read many articles talking about windows Hook but i would like to understand the method !
Thnx
|
|
|
|
|
You're not going to get an answer to that question here. The pRobability of abuse of such a technique is high and were not going to be part to that.
That being said you can find the answer to that question on the web after a simple Google search. I leave it up to you to figure out what to search for.
|
|
|
|
|
|
Good afternoon, I wanted to share with you a problem I'm having, which you can not find a convincing answer.
What is the problem?
It is that database connections are many active and AWAITING COMMAND status SLEEPING, and every time I run a new query to the database, a new connection is added, I see this with sp_who2 from Management Studio.
What is the scenario?
An application of three layers (BUSINESS, DATA and PRESENTATION) which, because it is a client-server application, data is accessed by a Windows service that raises a
console application that instantiates a class that encapsulates access to data and records on the server so it can be accessed through Net Remotting.
Proper operation, can access data and execute everything correctly. At each attempt to access data, I end with Connection.close () method.
The problem is that despite using Connection.close () connections do not die and are all state SLEEPING, and there comes a time when you can no longer accumulate more
and SQL SERVER rejects the connection attempt, because limit was reached in the POOL.
Even if I close the main application, connections are maintained, but if I close the application that instantiates the object, all connections are closed.
Anyone has been in a similar situation? any suggestions?
|
|
|
|
|