|
How can I open (popup... not in browser) notepad from browser.
For example: I have some .txt file in my database. I want to open it from browser, where user can edit the .txt file and at this time database will be update internally.
OR
I have some file which I want to open in notepad from browser, it will be display on popup.
JUST LIKE:
Windows Platform where we use
System.Diagnostics.Process.Start(@"C:\Documents and Settings\Billah\My Documents\Data Grid.txt"); OR
System.Diagnostics.Process.Start("notepad.exe",@"C:\Documents and Settings\Billah\My Documents\Data Grid.txt");
If I start a process from ASP.NET using System.Diagonistics.Process.Start method. It start in the background (we can see it in task manager), but I can't see it on the browser.
private void Page_Load(object sender, System.EventArgs e)<br />
{<br />
System.Diagnostics.Process.Start("Notepad.exe");<br />
}
IIS Admin Service runs as a local system
So, how can I see the notepad which runs at background?
Thank you
BILLAH
-- modified at 4:49 Sunday 28th May, 2006
|
|
|
|
|
Billah wrote: If I start a process from ASP.NET using System.Diagonistics.Process.Start method. It start in the background (we can see it in task manager), but I can't see it on the browser.
Also, you should realise that it is running it on the server, not the client. If you have the client browser running on the same machine as the server then you are obviously getting confused about what is running as part of the server and what is running as part of the client.
You cannot run applications on the client because it is a security risk for the person using the client.
Billah wrote: I have some .txt file in my database. I want to open it from browser, where user can edit the .txt file and at this time database will be update internally.
Create a page with a big text box and load the text in to that. On the post back you can update the database.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Dear Colin Angus Mackay,
Thank you for your reply.
I want a popup notepad which will retrieve data from database. Now it will display in IE. If possible, please Send me a project which display a popup notepad with data or without data where user can edit text and save it in Hard Drive.
Thankyou
BILLAH
|
|
|
|
|
Billah wrote: I want a popup notepad which will retrieve data from database.
Notepad cannot retrieve data from the database. It is beyond the scope of the application.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Hi everyone,
I have a set of data(I call it a docket), which I can quite happily represent with an object. Now the data contained in this object has to be sent to various customers - only they all need it in different formats! And worse still, some of the "general" formats change between customers - so for exapmple, one customer needs the data in a fixed width file, whilst another needs it in fixed width, but in a slightly different fixed width format.
So, taking the one problem of multi-version fixed width format (I think the answer to this will enable my to solve the other formatting problems), how can I use OOP technology in C# to implement a writer/formatter type object? I've had a look in the .net framework, and seen many objects called formatters, but I'm not sure how these have been implememnted, or even if their definition of formatter is the same as mine...
Thanks,
Martin.
|
|
|
|
|
Hi all, i posted a msg earlier, but unfortunately nobody happened to know the answer.. so its more like a challange...
can you figure out the algorithm for the following problem:
Consider a = {a , a , a ,...., a } //random values within set a
----------i----0--1---2-----n //these are the sub values
also
b = {b , b , b ,...., b } //random values's within set b
-i----0---1---2------n //these are the sub values
And
S = a + b
-i----i----i //these are the sub values
Find an algorithm O(n), that can return the n largest number(s) using c#..
Thanx soo much in advance..
Elie
|
|
|
|
|
Eliee wrote: but unfortunately nobody happened to know the answer
Perhaps noone knew the question...
The C# language does not use sets. Would that be a set in the same manner as it's used in Pascal? What are the sub values you are talking about? Why are you adding the two sets? Where should the algorithm be looking for the largest numbers?
---
b { font-weight: normal; }
|
|
|
|
|
HEy there Guffa..
Well a set could be intstantialized and taken to be as an array of values.. so take it as in this perspective.. The sub values are the elements of an array..
S is the set where the combinations of values of both {a} & {B} are combined..
What is required is to look in S and to find the greatest value (s) and directly return it with a speed algorithm of O(n)..
Hope i helped u a bit..
Thanx 4 all participating in this question..
Elie
|
|
|
|
|
Eliee wrote: Well a set could be intstantialized and taken to be as an array of values.. so take it as in this perspective.. The sub values are the elements of an array..
So the sub values are the values? Why do you call them sub values, then?
Eliee wrote: What is required is to look in S and to find the greatest value (s) and directly return it with a speed algorithm of O(n)..
What does the two sets and the combining of them have to do with anything, then? Isn't that totally irrelevant?
Unless the values are sorted (which would make the entire question rather silly), you have to check each value to find the largest. Just loop through the values.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa, assume that we have like a dozens of long (sets/arrays), and we choose only two (a and b) out of the collection; i wanna choose two sets (combined into one set/array) and then return the n largest number(s) usuing c#, with an algorithm as efficient as O(n)...
U got me pal?! Hope i cleared things a bit..
//remember the long sets/arrays arent sorted.. so pay attention to efficiency
Elie
|
|
|
|
|
Eliee wrote: so pay attention to efficiency
Gosh! That's a bit of a schoolmarm comment.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Is there any reason you want to combine the sets? If you mean that the combined set should not have duplicates, that seems like a lot of unnecessary work if it only is going to be used to find the largest value.
Otherwise just find the largest value in each set, then pick the largest of those two.
Are you making something that is going to be used for something, or is it just a school assignment?
---
b { font-weight: normal; }
|
|
|
|
|
Okay, if you want to find the n largest numbers in a large array of numbers, here's one way to do it:
(I'm a VB.Net regular myself, and I don't really have the time to figure out how to produce guaranteed-to-work C# code, so I'll do pseudo-code here)
Define a variable smallestSelected to hold the smallest eligable number, and initialize it to zero.
Define an array, say largestNumbers, large enough to hold n values.
Define a variable smallestSelectedIndex to hold the index of the smallest selected number in the largestNumbers array
Define a rolling index variable, say index, to hold an index into the largestNumbers array.
Loop through all your array's elements, and if the current element value > smallestSelected, then:
if the largestNumbers array is full (index == n-1):
replace the element in largestNumbers at smallestSelectedIndex with the current value
if the largestNumbers array is not yet full,
set the largestNumbers array element at index to the current value; increment index;
At this point you should determine the new smallest value from the largestNumbers array will be and to do this you will either have to sort it, or loop over it to find that number.
If you're opting for the sorting approach you could make largestNumbers a sorted list of kinds, and there'd be no need for a rolling index pointer since you could always pick the first element (which is the smallest number), remove it, and add the new value.
The result of this should be O(n) on the original array, but a slight overhead on each iteration that yields a value that is larger than the current smallest eligable number.
This is a bit off the top of my head, so if there's any really bad flaws to the logic, feel free to comment on it ;o)
Hope this helps,
Danny
|
|
|
|
|
Hello people !!. I'm developing in vs 2005 and I've a problem that may be you can help me to solve it.
I have a winform, a boolean attribute for a state and a timer. The timer see the state and if is closing then it start fading out. So the only things I have is a timer to animate fade out on mouse leave event.
The problem is this example run excelent in Visual Studio 2003, but a flick appear in VS 2005 when I leave the form. May be a problem with winfows.form or system.drawing
Any ideas??
I have this very simple code:
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace WindowsApplicationTest
{
public class Form1 : Form
{
private bool m_closing;
private System.ComponentModel.IContainer components = null;
private System.Windows.Forms.Timer timer1;
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout();
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 20;
this.timer1.Tick += new System.EventHandler (this.timer1_Tick);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font ;
this.BackColor = System.Drawing.SystemColors.Control;
this.ClientSize = new System.Drawing.Size(292, 266);
this.DoubleBuffered = true;
this.ForeColor = System.Drawing.Color.White ;
this.Name = "Form1";
this.Text = "Form1";
this.MouseEnter += new System.EventHandler(this.Form1_MouseEnter);
this.MouseLeave += new System.EventHandler (this.Form1_MouseLeave);
this.ResumeLayout(false);
}
#endregion
public Form1()
{
this.SetStyle( ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer, true );
InitializeComponent();
}
private void Form1_MouseLeave(object sender, EventArgs e)
{
m_closing = true;
}
private void Form1_MouseEnter(object sender, EventArgs e)
{
this.m_closing = false;
this.Opacity = 1;
}
private void timer1_Tick(object sender, EventArgs e)
{
if (m_closing)
{
if (this.Opacity > 0)
{
this.Opacity = this.Opacity - 0.01;
}
else
{
Close();
}
}
}
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
Thanks a lot !!!!
|
|
|
|
|
Have you tried enabling double buffering?
|
|
|
|
|
yeap, I try that when I start havinf the problem but the problem still there. You'll see that the problem is with VS 2005 but not in vs 2003.
Thanks.
|
|
|
|
|
I found the problem ...
See this link:
http://www.dotnet247.com/247reference/msgs/42/214827.aspx
Yes, that is what I found. I hadn't seen the flickering before because my
form was too small.
However, this is true. The flickering occures when the underlaying window is
switched to "layered mode". Actually it flickers even if you set alpha to
255 (fully opaque).
Switching to layered mode involves three steps.
1. Checking the os version - it has to be NT 5 or latter
2. Set WS_EX_LAYERED window style
3. SetWindowLayeredAttributes this method is not defined in user32.dll for
versions before Win2k that's why first step is necessary.
When a Windows Forms control is created it is not a layered window. And it
switches to this mode when set the opacity to some value less then 1.
So my solution is to switch to layered mode in some early stage of the form
life. As soon as the form is created before to become visible. Otherwise
we'll see the flickering.
Javier is completely correct that the layered window has to be fully
redrawn. But it goes only when the window (form) resizes. You can still
invalidate some portions of the form and it will works how ot supposed to
work.
Layered window could even show better performance in some situations.
How internaly layered windows work is all painting is redirected to
off-screen buffer and when the painting's done alpha blending is applied to
the resulting picture and the result is drawn on the screen. This of course
is done internaly in windows and it uses the video card hardware support for
alpha blending if it has any.
Becuse all winodw is double buffered Windows doesn't send WM_PAINT when the
form is moved for example or when some part of the form is uncovered. In
such cases Windows uses double buffered image.
When children control is moved on the form it updates as much as it is
necessary. So the performance hit is not so big.
Anyway, my first solution that I was planning to post involved P\Invoke and
calling all API functions necessary to switch to "layered mode", but then I
found that if one set Opacity to value less then 1 and then return it back
to 1 the form class doesn't switch to the "normal mode" and leave the window
layered.
So the easiest way to get rid if this flickering is by overriding
OnControlCreated method and adding the following two lines:
this.Opacity = 0.9;
this.Opacity = 1;
No more flickering .
Thanks a lot people !!!
|
|
|
|
|
hello
i would like insert a image in sql Data base with oledb Connection.
please help me.
vahid
|
|
|
|
|
|
i think following code will help u:
1st Step: Take pic. box
2nd Step: Take a Button and Text box to take the image, which u want to save into Database
private void btnBrowse_Click(object sender, System.EventArgs e)<br />
{<br />
OpenFileDialog ofd = new OpenFileDialog( ) ;<br />
ofd.Filter = "Image files |*.jpg" ;<br />
if ( ofd.ShowDialog( ) == DialogResult.OK ) <br />
{ <br />
txtPath.Text = ofd.FileName ; <br />
try<br />
{<br />
FileStream f = new FileStream ( txtPath.Text, FileMode.Open ) ;<br />
byte[ ] buff = new byte [ f.Length ] ;<br />
f.Read ( buff, 0, ( int ) f.Length ) ;<br />
MemoryStream ms= new MemoryStream(buff,0,buff.Length);<br />
Image i = Image.FromStream ( ms ) ;<br />
img.Image = i ; <br />
f.Close();<br />
}<br />
catch(Exception ee) <br />
{ <br />
MessageBox.Show("An error has occured.\n" + ee.Message); <br />
} <br />
}<br />
}<br />
3rd Step: Create table where take one field which will image type
CREATE TABLE [dbo].[tableName] ([img_name] [image] NULL )
ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
<br />
string dbcon = "data source=ServerName;database=dbName;user id=sa;password=";<br />
private void linklblInsertPicture_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)<br />
{<br />
FileStream st = new FileStream ( txtPath.Text, FileMode.Open ) ;<br />
byte[ ] buff = new byte [ st.Length ] ;<br />
st.Read ( buff, 0, ( int ) st.Length ) ;<br />
<br />
try<br />
{ <br />
using(SqlConnection conn = new SqlConnection())<br />
{ <br />
conn.ConnectionString = dbcon;<br />
conn.Open();<br />
SqlCommand cmd = new SqlCommand();<br />
cmd.Connection = conn;<br />
cmd.CommandText = "insert into tableName(imageName) values(@pict)";<br />
cmd.Connection = conn;<br />
cmd.CommandType = CommandType.Text;<br />
cmd.Parameters.Add("@pict",buff);<br />
cmd.ExecuteNonQuery();<br />
}<br />
}<br />
catch(SqlException sqle)<br />
{<br />
Console.WriteLine(sqle.Message);<br />
}<br />
st.Close();<br />
}<br />
<br />
private void linklblShowPicture_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)<br />
{<br />
try<br />
{<br />
using(SqlConnection conn = new SqlConnection())<br />
{<br />
conn.ConnectionString = dbcon;<br />
conn.Open();<br />
SqlCommand cmd = new SqlCommand();<br />
cmd.Connection = conn;<br />
cmd.CommandText = "select imageName from tableName where .... ";<br />
\\here u can use track id in datatabel to select, update or delete image<br />
cmd.Connection = conn;<br />
cmd.CommandType = CommandType.Text;<br />
<br />
SqlDataReader r = cmd.ExecuteReader();<br />
if(r.Read())<br />
{<br />
byte[ ] b = ( byte[ ] ) r [ 0 ] ;<br />
MemoryStream st = new MemoryStream( ) ;<br />
st.Write ( b, 0, b.Length ) ;<br />
Image i = Image.FromStream ( st ) ;<br />
img.Image = i ; <br />
}<br />
}<br />
}<br />
catch(SqlException sqle)<br />
{<br />
Console.WriteLine(sqle.Message);<br />
}<br />
}
Thankyou
BILLAH
|
|
|
|
|
|
Hi.
What work do the throw statement, alone.
What exception it force to take place?
Best wishes
|
|
|
|
|
The throw keyword *edit*(when used by itself, alone, i.e. throw; )*/edit* can only be used within a catch block. Throw will simply throw the exception that was caught within the catch block. Last modified: Saturday, May 27, 2006 8:10:31 PM --
|
|
|
|
|
Judah Himango wrote: The throw keyword can only be used within a catch block. Throw will simply throw the exception that was caught within the catch block.
Sorry to correct you, but throw can also be used outside of a catch block. The general purpose of this is to initiate an user generated exception. E.g.
if (!File.Exists("test.txt")) {
throw new FileIOException("File was not found");
}
else {
....
}
Graham.
|
|
|
|
|
Graham N wrote: Sorry to correct you, but throw can also be used outside of a catch block.
Sorry to correct you, but the OP was talking about the throw keyword alone, that is without specifying an exception. That can only be used inside a catch block.
---
b { font-weight: normal; }
|
|
|
|
|