|
My Pleasure.
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
Hello,
A 5 would be good to all of you helping newbie programmers
Thanks,
Dan
|
|
|
|
|
Thank you very much for appreciating.
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
Hi,
I have 2 domain names such as www.abc.com and www.xyz.com. I have a machine which is having a manual ip address of 192.168.1.100 and in this machine I have created two websites in the IIS 7.5 in Windows 7, In the binding properties, I have set the ip address assigned/unassigned and the host name to the domain name www.abc.com to one web site and www.xyz.com to the other website, also both the websites run on port 80.
I have a dynalink router, where I have set the Virtual Server => Port Forwarding => Web Server pointing to 192.168.1.100 machine.
I am not able to view the web sites when I give by domain names, when i type www.abc.com I wish to see website1 and www.xyz.com I wish to see website2, When i tried removing the host names from the binding, I am able to view my website1 after typing the domain name www.xyz.com.
Is there anything I am missing or pointing wrongly ? or doing wrong here ? Please advise.
Thanks Vinay
|
|
|
|
|
You don't say what happens when you try to access by domain name. Do you go to the wrong site? Does it say server not available?
Where do you have the DNS entries defined? Do you have nameservers established?
To test your IIS configuration you can go to a machine on your local 192.168 network and add entries to the hosts file for your domains pointing to the 192.168.1.100 address.
|
|
|
|
|
The domain names which I have is pointing to my static IP address 65.149.23.34.
Then in my router I have pointed to the web server of machine 192.168.1.100
In the IIS of the machine 192.168.1.100, I have created two websites and set the host names for both the websites to my domain name.
When I enter the domain names it says page cannot be accessed.
But when I remove the host names from the websites of IIS and access by one domain name, I can access my web page.
Does WINDOWS 7 IIS support only 1 website hosting is it , Do I need to try in windows server 2003 ?
|
|
|
|
|
The only thing I can find with a feature breakdown by OS is here[^] but it doesn't mention host headers. If you are using win 7 professional it doesn't look like a lot of differences. If you are on a lesser version that may be the problem.
|
|
|
|
|
I tried using windows server 2003 and iis 6.0, it worked, I created virtual websites under my website,giving different domain names under the host headers and it worked.
Thanks
Vinay
|
|
|
|
|
Hello coders,
I am getting one problem in the saving the items information. I have taken one textbox for the NumberOfAssets based on which further generates the respective textboxes. And Before saving the information, I want to implement the validation check on those dynamically generated textboxes i.e. those textboxes must not be empty.
For instance, If I enter 3 (integer value) in the "NumberOfAssets" textbox, it further generates the 3 textboxes, And before saving the window form, there must be a validation check for those 3 textboxes.
I could not come up with the solution that how to put the validation using For Loop and where to do it
as well..
please help ...
|
|
|
|
|
Hi,
You'd need to hook up the Validating [^] event.
Below is an example on validating a control from that event;
void onValidating(object sender, CancelEventArgs e)
{
TextBox senderBox = sender as TextBox;
if (senderBox.Text.Length == 0)
{
e.Cancel = true;
System.Media.SystemSounds.Beep.Play();
}
}
..and this is the code to hook up the event. You'd need something similar to this in your For -loop.
myTextBox.Validating += new CancelEventHandler(onValidating);
Good luck
I are Troll
|
|
|
|
|
SCENARIO 1 :
I have 3 projects in my solution:
1) Web Project (Presentation Layer)
2) Class Library Project (Business Logic)
3) Class Library Project (Data Access Layer)
Following are the dependencies among these 3 projects:
1->2->3 (It means I have referenced PL in BL and BL in DAL.
In 3(Data Access Layer) i have written a SQL trigger and in the same trigger i am also calling a function of 2(Business Logic) as i have referenced it already. The code looks like following:
[Microsoft.SqlServer.Server.SqlTrigger(Name = "Trigger1", Target = "test", Event = "FOR INSERT")]
public static void Trigger1()
{
SqlTriggerContext triggContext = SqlContext.TriggerContext;
getData obj = new getData(); //getData is a class in (Business Logic)
DataSet insertTriggerDataSet = new DataSet();
if (triggContext.TriggerAction == TriggerAction.Insert)
{
using (SqlConnection conn = new SqlConnection("context connection=true"))
{
conn.Open();
SqlCommand sqlComm = new SqlCommand();
SqlPipe sqlP = SqlContext.Pipe;
sqlComm.Connection = conn;
sqlComm.CommandText = "select * from test";
//sqlP.Send(sqlComm.CommandText);
//sqlP.ExecuteAndSend(sqlComm);
SqlDataAdapter adapter = new SqlDataAdapter(sqlComm.CommandText, conn);
adapter.SelectCommand.CommandType = CommandType.Text;
called= "trigger.cs";
adapter.Fill(insertTriggerDataSet);
}
}
obj.fetch(insertTriggerDataSet); // fetch is a method in class getData in Business Logic
}
Now the problem is, that is i am registering my assembly of (Data Access Layer) in SQL Server 2005 then due to its all dependencies i am unable to do so (as Data Access Layer is dependent on Business Layer and Business Layer on Presentation Layer, and Presentation Layer is internally dependent on many .NET assemblies)
SCENARIO 2
If i convert my data access layer to SQL Server project then it is impossible to give reference of any other project in my Data Layer as SQL Server Project doesn't accepts references other than SQL Server projects.
My need is to call a method X() of Business Layer in that Trigger (in Data Access Layer) and then in that method X() I have to call a method Y() of my presentation Layer.
Can anyone please suggest me any solution or alternative for this problem?...
Also let me make it clear that I am trying to build an auto update data representation control (like grid view) so whenever a new record is inserted in a SQL table that trigger should work and then it should update the data in used data representation control in presentation layer without any button click or similar event, thats why i am calling all functions internally to create an event while that trigger executes. (Reference Example: Facebook Wall, Twitter stream)
Any help will be appreciated...
Thank you.
|
|
|
|
|
I am using the following code for compression of data at the server:
The job of this method is to execute the specified method passed as a string and return the object as a compressed stream (serializing the object and compressing the serialized stream) to the client application. When value is returned to the client, the decompression takes place there and the decompressed stream is deserialized to obtain the actual object
The method below takes parameters as name of method to be executed including the methodarguments and argumenttypes to distinguish the different overloaded methods and identify the exact method and avoid ambiguity. ExecObject is the object with which the specified method will be invoked.
//SERVER SIDE METHOD
public Stream CompressedMethodCall(string MethodName, object[] MethodArguments, Type[] ArgumentTypes, object ExecObject)
{
object Result;//the object which will be returned by the specified methodname
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter Serializer; //to serialize the object
System.IO.Compression.GZipStream Compressor;//to compress the serialized object
Stream SerializedStream;//contains the stream which is serialized
Stream CompressedStream;//contains the compressed serailized stream
byte[] Buffer;
try
{
MethodInfo mi = ExecObject.GetType().GetMethod(MethodName, ArgumentTypes);
Result = mi.Invoke(ExecObject, MethodArguments);//now result has the object which should be serialized and compressed
if (Result != null)
{
Serializer = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();//binaryformatter is used for compact serialization
SerializedStream = new MemoryStream();
Serializer.Serialize(SerializedStream, Result);//now SeralizedStream has the serialized object
SerializedStream.Position = 0;
Result = null;
CompressedStream = new MemoryStream();
Compressor = new System.IO.Compression.GZipStream(CompressedStream, System.IO.Compression.CompressionMode.Compresstrue);
while (SerializedStream.Position != SerializedStream.Length)
{
long BytesRemaining = SerializedStream.Length - SerializedStream.Position + 1;
if (BytesRemaining < BufferLength)
Buffer = new byte[BytesRemaining];
else
Buffer = new byte[BufferLength];
SerializedStream.Read(Buffer, 0, Buffer.Length);
Compressor.Write(Buffer, 0, Buffer.Length);
}
SerializedStream.Close();
CompressedStream.Position = 0;
return CompressedStream;
}
}
catch (Exception ex)
{
return null;
}
return null;
}
Now the returned value(compressed stream) is used to obtain the actual object. I am doing it this way
//CLIENT SIDE STATIC METHOD
public class DeCompressor
{
const int BufferLength = 4096;
public static object GetObject(Stream CompressedStream)
{
object Result;
BinaryFormatter DeSerializer = new BinaryFormatter();
Stream SerializedStream = new MemoryStream();
CompressedStream.Position = 0;
GZipStream DeCompressor = new GZipStream(CompressedStream, CompressionMode.Decompress,true);
byte[] Buffer;
int Read = 1;
try
{
while (Read > 0)
{
Buffer = new byte[BufferLength];
Read = DeCompressor.Read(Buffer, 0, BufferLength);
if (Read == 0) Read = DeCompressor.Read(Buffer, 0, BufferLength);//sometimes it decompressing 0 bytes eventhough there is data to be decmopressed. If I again call Read() it will decompress. To avoid this, I am using it twice
SerializedStream.Write(Buffer, 0, Read);
}
CompressedStream.Close();
SerializedStream.Position = 0;
Result = DeSerializer.Deserialize(SerializedStream);
SerializedStream.Close();
return Result;
}
catch (Exception ex)
{
Castor.CastorMessageBox.Show(ex.Message);
return null;
}
}
This method is working fine. But sometimes decompression is not producing the exact stream which was produced at server. Due to this, deserialization process is not successful and I am unable to retreive the actual object.
I am using VS2008. Any help would be appreciated
|
|
|
|
|
Hi,
I did not read all that as it lacks PRE tags and hence also readability.
FYI: MSDN on Stream.Read says: Implementations of this method read a maximum of count bytes from the current stream and store them in buffer beginning at offset
|
|
|
|
|
So I have just joined a company that creates .Net web apps. We have a very large Core Class library, made up of about 20 different projects and they are stored is VSS as 20 different projects. These projects have various different functionality but have a strict dependency on each other.
Currently people are using websites in VS and checking these into VSS.
Now if I want to setup this project on my machine I have to
1: get the website from VSS
2: Find out which Core libraries it uses
3: find out the order of the dependency
4: Add each project (Core library) to my solution in the correct order
5: Add a reference from my website to each of the core libraries in my solution
6: Hopefully it compiles and I am good to go, although more often than not there is serious versioning issues but that’s another post
Considering we need the core source for debugging my questions is
1) Is there a better way for Core team to deliver the Core libraries to us so that we can still debug?
2) Any way that we can package the libraries ourselves so that the process of creating a new website is much easier?
Thanks in advance
|
|
|
|
|
A lot of companies insist on making different projects for different parts of the same enterprise wide solution and all it really does is create a large head-ache when it comes time to track everything down and figure out why, when you are debugging, the line numbers don't seem to match up with the code!
The core library should, ideally be merged into one project. You will find a lot of people disagree with me on this point but those are usually the same people that don't like to do merges on check-in ... which is the primary reason, I believe, the projects are so diverged. After-all, how can you add a new file to a project if someone else has the project file checked out. The thought process then follows, more projects=more productivity.
One last thing to consider is to have the core libraries strongly-named. While it doesn't really help with the interdependency fiasco it will at least help track down the errors.
|
|
|
|
|
I tend to agree. While having many files and projects might be advantageous in the early stages, it becomes a hassle when things settle down. I tend to merge those auxiliary projects into just one or a few; my rule of thumb is: if you can't draw the DLL dependency graph by heart, it got to shrink.
|
|
|
|
|
One practice is for the core assemblies to be published to a central point so you get the released assemblies from there instead of the projects. Any updates have to be posted to that central point, including updates to the entire dependency tree.
A lot easier if you put it all into one.
You could also package the core assemblies and deploy then using windows installer, much as you would a third party assembly. Again this would lead to stricter control of the release and update cycle.
|
|
|
|
|
Thank for the replies guys.
One suggestion "One practice is for the core assemblies to be published to a central point so you get the released assemblies from there instead of the projects."
I think we used to do this in my old company, so on all boxes. DEV, QA, UAT we would have the complied assemblies stored in the same area, whenever they were updated they would be published to the common area on all boxes. This way we were always working against the latest version. I am trying to think how this could work while still needing the code to debug?
Also with regard to versioning of core libraries, would I be correct in assuming there should always be backwards compatibility under a major new version is realised, meaning no matter what changes are made to the core dlls, your site should never break?
|
|
|
|
|
The backwards compatability issue is always a problem. There may be a breaking change because the core library developer does not know what you are doing in your web site, but with care they should not break stuff in that manner.
Certainly as far as versioning is concerned, if you don't like the new version, revert to the old version and no problems. The dependency chain should never break in this manner.
You should be able to debug without the code. Just ensure that the .pdb files are deployed with the dlls, and that they are built in debug not release mode. You should have a separate release build set without pdbs for deployment to the production environment.
|
|
|
|
|
That's brilliant advice U.N.C.L.E. about not needing the code just the .pdb, thanks for that one. I am going to try and get a process together and suggest it to management and this will help a lot. When I have my suggested process done I will post it here and maybe you can pick it apart. Thanks again for the advice
|
|
|
|
|
The workflow described beats the purpose of having a "core" set? It's at minimum large, and it sounds like a lot of work to use it..
How big is the entire thing, if the core is made up of 20 different projects?
I are Troll
|
|
|
|
|
I am not excatly sure what you're getting at? The core team develop a library that drive the companies products and services. My team uses a subset of these libraries.
How big is it? Well I am not sure but I'd say pretty small on an commerical scale, only about 3 devs on the core team.
|
|
|
|
|
cullyk wrote: I am not excatly sure what you're getting at?
Twenty projects seemed like a lot; but those are the projects using the core - not the projects that make up the core.
I are Troll
|
|
|
|
|
I am writing a few complicated classes I'd like to unit tests. They depend on other component I'd like to replace when unit testing. I'm not sure on how to go about it.
I don't want constructor with zillion of parameter.
I am trying to get rid of prism / unity container (wondering if it's a good idea though) so I can't use it to load different services depending of the circumstances. One the key reason is that it's not apparent which services are needed for a given (single or set of) object(s) and it was often the case in the past that the big object was loading zillion of services from the container depending on the called method.
Not sure I can use MEF as MEF tends to load everything in a DLL, whereas I'd like to choose individual component myself depending on the circumstances. Plus what if the code is not instantiated through MEF? I would have empty required fields!
Any ideas?
Basically the I have a class like that
class SomeManager
{
HardwareInput hInput;
ILogger logger;
IWebService service;
....
}
And I'd like to replace / set the hInput, logger and service depending of the circumstances.
Ideally I'm happy to have the constructor setup the value and have some dependency injectino code replace those.
I'm thinking to make them public so they could be changed explicitly, but I find that dangerous... although.. the setter could apply some check...
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Hi all,
I have problem in running web service. When I run the web service , I got the error "Request format is unrecognized for URL unexpectedly ending in 'web method name'".
Even though I tried to put below code under system.web in web.config file. It doesn't work. Anybody can help?
<webservices>;
<protocols>;
<add name="HttpGet">;
<add name="HttpPost">;
<protocols>;
<webservices>;
flowerppk
|
|
|
|