|
nevermind, i just altered the file format to allow the assembly name as well.
|
|
|
|
|
Hi
I have created web application to upload files. When the client uploades the files, the files should be put on to my server in a specific folder. Can this be done only through FTP or is there any other way to do it? The client could be in different place(one country) and the server could be in different place(another country). Can you send me the code for this?
|
|
|
|
|
Hi
I want to save pdf/tiff/bmp/jpg file formats in database and retrieve the same from database. i am using SQL Server 2000. I have a Windows form where i need to view these files. Right now i am using picturebox control. Files are saved to database and retrieved from database on to picturebox. But with picture box i can view the tiff files and not the pdf. Is there any way to view both tiff files and pdf files? Can you send the coding for this?
|
|
|
|
|
Did you ever get any information on this. I am having the same issue.
|
|
|
|
|
Hey!
I am building a program that recives data från a serail port and then puts it on streams to other units in the program.
Its inportant that this happens with no delay!
I have thougt of using regular stream, but i saw someone usning MemoryStream? maby MemoryStream is a better choce?
I need to be abled to write to this streams to.
What ar the diffrence between MemoryStream and regular stream?
BestRegards
Jimmy
|
|
|
|
|
Hey!
I have a incoming stream on a Serail port, i want to show this in a RichTextBox.
I have seen that i can load RichTextBox with a stream but it only loads whats in the stream at that moment?
Is there an easy way to let teh stream update the RichTextBox? or do i need to take the data out of the stream and then append to RichTextBox manualy?
And one other thing! i have tested to append data to my RichTextBox from another thread, but this is not posible? do i realy have to use the thread that created the RichTextBox? I am using delegates it another class to add data to the RichTextBox in the main form, this means that it will be another thread that adds data to the RichTextBox.
Best Regards
Jimmy
|
|
|
|
|
Hi,
I'm trying to send files (*.bmp;*.doc;*.gif;*.htm;*.html;*.jpg;*.pdf;*.tif;*.xls;*.txt) directly to a printer which should convert it to .tif with GhostScript.
I tried it with GhostScript, the PrintDocument Class, with the Image Class and through the console, but nothing works or just works for some files. I have a solution for converting the picture files, the txt files and the pdf files with the above mentioned methods, but it's a bit slow and not fully to my satisfaction or 100% right.
Isn't there a solution with which I can send every file type directly to the printer, or convert them direcly in the programm?
I hope you can help me.
Sorry when my english is bad
|
|
|
|
|
I am drawing a report using data from database.. I use the GDI+ drawing libraries, system.drawing.dll
The site works on the following computers:
- Microsoft windows 2000 pro Netherlands;
- Microsoft windows 2000 server english;
When i try to use it on a laptop with Windows XP pro SP2 english i get the following error:
"ArgumentExeption:INVALID PARAMETER USED"
I have found out that the error only occurs when the code draws a string. The drawing of rectangles and such work perfectly.
An example of the code on which it crashes is:
<br />
int BlockDateWidth = 2 * 60; <br />
Graphics tmpGraphics = Graphics.FromImage(new Bitmap(1,1)); <br />
.. <br />
.. <br />
objGraphics.DrawString("Startdate", new Font("Arial", 10), Brushes.Black, new PointF( <br />
((BlockDateWidth / 2) - tmpGraphics.MeasureString("Startdate", new Font("Arial", 10), 50).Width) / 2, waMaxHeight - 10)); <br />
i am trying to figure out why it works on 2000 server dutch and english and why it doesn't on that XP and 2003 server machine...
|
|
|
|
|
|
Invalid parameter used.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Invalid parameter used.
Source Error:
Line 270: objGraphics.DrawLine(new Pen(Brushes.Black, 1), BlockDateWidth, 0, BlockDateWidth, waMaxHeight + 10);
Line 271: //Date labels
Line 272: objGraphics.DrawString("Startdate", new Font("Arial", 10), Brushes.Black, new PointF(((BlockDateWidth / 2) - tmpGraphics.MeasureString("Startdate", new Font("Arial", 10), 50).Width) / 2, waMaxHeight - 10));
Line 273: objGraphics.DrawString("Enddate", new Font("Arial", 10), Brushes.Black, new PointF((BlockDateWidth / 2) + ((BlockDateWidth / 2) - tmpGraphics.MeasureString("Startdate", new Font("Arial", 10), 50).Width) / 2, waMaxHeight - 10));
Line 274: //Workareaname and dividing lines
Source File: c:\data\apmis\src\web\chart\milestoneplan.aspx.cs Line: 272
--------------
Thats the problem i get, i increased the height and width but didnt seem to work...
im trying to work on it..
|
|
|
|
|
another thing i wonder about is why it does work if i fade out all DrawString commands and it crashes when i dont... the strings that are being drawn lie within the image borders.
|
|
|
|
|
It appears that the following setting prohibits / fails using the DrawString() command of the graphics object.
objGraphics.CompositingMode = SourceCopy;
it looks like the the SourceOver option works i dont know if it is the combination of settings that i have used:
<code>
objGraphics.SmoothingMode = SmoothingMode.Default;
objGraphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
objGraphics.CompositingMode = CompositingMode.SourceOver;
objGraphics.CompositingQuality = CompositingQuality.GammaCorrected;
objGraphics.InterpolationMode = InterpolationMode.HighQualityBilinear;
</code>
if i had used
<code>SourceCopy</code>
then i get the "INVALID PARAMETER USED" error.
anyway, it works now, if anyone has insight in the real reasons for this to happen, like why <code>Graphics.DrawString</code> can't be used together with
<code>Graphics.CompositingMode.SourceCopy</code>
im glad it works now :->
|
|
|
|
|
How could it be done?thers is no default property for it.
Thanks
MyBlogs
http://weblogs.com.pk/kadnan
|
|
|
|
|
|
I have created an service that communicate with clients via sockets. Now I need some kind of interface to the service so I could close all sockets, get information about the clients and so on.
My idea is to use an singleton object on the server which the (interface-) clients connects to. If a client want to close all sockets it calls a function on the object, and the object then calls a function in the server object which handles all sockets.
But I'm having problem with the communication between the singleton object and the server object. I'm trying to delegate a function on the server object to the client object.
This is the remote object:
public class RemoteObject : MarshalByRefObject
{
public delegate bool CloseSocketsDelegate();
public CloseSocketsDelegate CloseSockets=null;
}
And this is the server object:
public Server()
{
ChannelServices.RegisterChannel( new TcpChannel(5050) );
string url = "tcp://localhost:5050/RemoteObject";
Type serverType = typeof(RemoteObject);
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(RemoteObject), "RemoteObject",
WellKnownObjectMode.Singleton);
RemoteObject rem = (RemoteObject)Activator.GetObject(serverType,url);
rem.CloseSockets = new RemoteObject.CloseSocketsDelegate( this.CloseSockets );
}
How do I solve the security exception? Is there some better way to solve the problem?
|
|
|
|
|
Try doing this when registering the channel
IDictionary props = new Hashtable();
int portNumber = 9876;
props["port"] = portNumber;
props["typeFilterLevel"] =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
try
{
ChannelServices.RegisterChannel(new TcpChannel(props, clientProvider, serverProvider));
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thank, that solved the problem. And it also seems to work as I wanted it too . I changed the server code to this:
public Server()
{
BinaryClientFormatterSinkProvider clientProvider = null;
BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider();
serverProvider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
IDictionary props = new Hashtable();
int portNumber = 5050;
props["port"] = portNumber;
props["typeFilterLevel"] = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
try
{
ChannelServices.RegisterChannel
(
new TcpChannel(props, clientProvider, serverProvider)
);
}
finally
{}
string url = "tcp://localhost:5050/RemoteObject";
Type serverType = typeof(RemoteObject);
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(RemoteObject), "RemoteObject",
WellKnownObjectMode.Singleton);
RemoteObject rem = (RemoteObject)Activator.GetObject(serverType,url);
rem.CloseSockets = new RemoteObject.CloseSocketsDelegate( this.CloseSockets );
}
|
|
|
|
|
I think you are running into a problem using .Net 1.0 remoting in a .Net 1.1 runtime environment. See http://www.thinktecture.com/Resources/RemotingFAQ/changes2003.html[^].
I must warn you right off the bat: delegates don't work well at all across application domains, especially ones that are "remote". There is a good reason why it will now throwing an exception. You can "revert" to old .Net 1.0 behavior but I wouldn't recommend it. Even if you do revert to old behavior it still isn't a good practice to use delegates across applictaion domains especially remoted ones.
Consider if you have three clients where the server triggers
CloseSockets. The three clients might not even been in a state where they are ready to handle the delgate (ie. delegates are not interupts!). Also consider that in many networks, the machine requesting/answering is not the machine making the request or answering. Another machine is doing the NAT/proxy/other network manipulation. Although it might work for "localhost" you can easily run into problem traversing even intranets. Again three clients are connected to the server but the server only sees one IP for each of the client. How does the server know which machine on the "other side" of the NAT/proxy/firewall to contact?<br />
<br />
In general, a client/server network design shouldn't rely on the client telling the server to close socks. Strong server systems never rely on its client communication protocol for run state instructions. Clients telling servers "tell me the answer to 3 + 4" is okay. Clients telling servers to "cut network connections" is bad. I emplore you to consider another way to do whatever it is you are attempting to do.
|
|
|
|
|
Thank you for your thoughts. I really appreciate opinions about the logic about the program sense I haven’t used remoting before.
I will probably not use delegates but probably interfaces instead. I create an interface with some functions that the server will have, implement the functions on the server and then have an interface-reference on the remote object to server. But when I do this I still get the security exception. Is this is also bad design?
The remote object must in some way communicate with the server object, which I think shouldn’t be a problem sense they a running in the same process. CloseSockets will close all sockets that are running (of course not to the clients that are using remoting). An administrator should only use this if something goes wrong, sockets will normally be closed by the clients.
The remoting object should as I said talk to the server. Mostly of the communications will be about the state of the server (like how many sockets that are currently running, again not the clients that are using remoting), but it will be more complex operations too (like StartCoffeeMachine and TurnOfTheTv).
|
|
|
|
|
Using the TV example, the TV remote turns off the TV when you hit "Power". It does not do "a turn off the IR sensor". If it did that your remote is now a brick. As long as you aren't using .Net Remoting to tell .Net Remoting hosted objects (or a higher abstraction the server/IIS) to close then you are okay. For instance, having a web page in IIS to make IIS to kill itself is a receipe for disaster because of race conditions.
You seem to have a misunderstanding on what .Net Remoting happens to be. The client domain and the server domain certainly are not running in the same process. For instance any reference changed on one domain will not automatically appear in the other domain. The client can simulate synchronization by "blocking" on the response from the server. Things like garbage collection can happen at any moment, independently on either the client or server application domains. You can just as easily do an asynchronous response. The client domain is more than happy to process independent of the server domain and vice versa. Also the assumption that only one client is communicating with the server has to be a strong assumption because .Net Remoting will not enforce that. If your client application exits abnormally will the next client application be able to talk to the server?
One feature of .Net Remoting is that the client domain doesn't have to continually "ping" the server to keep objects alive in the server domain. Once again this is done so the client and server domains can operate independently. The client shouldn't bother finding out what the status of the server domain until it is called upon. There is no need to tell .Net Remoting to clean up itself any more than any other .Net technology (although the facilities are there if you want to twiddle the settings).
I wish you luck on whatever it is you are doing but I would recommend staying away from cross domain delegates and using singleton/single call remoting styles for administration tools.
|
|
|
|
|
I don't agree about the intranet thing. If you are concerned about proxies/firewalls, you shouldn't be using TCP, you must be considering using HTTP. Not using delegates means that you won't be able to subscribe to events from the server, do you consider that too to be bad design?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Http is just built upon TCP. If you have any situation where you map "many to one" how do you traverse the firewall/network translation? The server only sees an IP plus any information carried along in the Http header. Simply put, how does the server initialize a connection to the client back? You can do it as a response because the client initialized the connection. It is much harder when the server needs to initialize.
For a client-server situation, delegates aren't the best thing to use. As stated since they are in entirely different application domains (let alone different processors/machines) and since delegates are not interupts how in the world can you possibly use them correctly? How do you gaurentee the client is ready to respond to the delegate? You simply can not.
If you want delegates with a setup like that, put the delegate on the client side. Call the server , check the response, fire the delegate from the client to the client. Expecting a server to figure out how to handle a delegate to a client just work out well (believe me I've tried).
|
|
|
|
|
as topic, how do i obtain the screen resolution of user?for example 1024*768 or 800*600...thz..
|
|
|
|
|
This is slightly complicated by the fact that a user can have multiple screens.
The class/object you want is System.Windows.Forms.Screen.
If you only care about the main screen,
<br />
Screen mainScreen = Screen.PrimaryScreen;<br />
Size dimensions = mainScreen.Bounds.Size;<br />
If you need to support all screens, you will need to operate on the Screen array returned from Screen.AllScreens.
Regards,
Ray
|
|
|
|
|
Hello Friends,
Our clients requirement is that we have to use their DLL which is created by C,C++ code.
What I am doing in my code is that :
1. using using System.Runtime.InteropServices;
2. [DllImport(@"g:\SampleDLL.dll",EntryPoint="test",
SetLastError=true,
CharSet=CharSet.Unicode,
CallingConvention=CallingConvention.Winapi)]
3. static extern int test(int lpLibName);
4. and in code calling test function with parmeter as 10.
But I am getting error that entry point "test" not found in SampleDll.dll, but this methods defination written in that dll itself.
Please help me out of this.
Or tell me is there any other way to use that dll?
Sachin Gedam
(Software Engg.)
Pune India
|
|
|
|
|