|
Here it is...
<code>
using ...;
namespace BigOExt
{
public partial class MainForm : Form
{
private System.Threading.Timer timer;
private TableLayoutPanel tlp;
private List<WorkstationTrackerControl> workstationTrackers;
private Point lastPos;
public MainForm()
{
InitializeComponent();
timer = new System.Threading.Timer(new TimerCallback(TimerHandler));
tlp = new TableLayoutPanel();
tlp.ColumnCount = 1;
tlp.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
tableLayoutPanel1.Controls.Add(tlp, 0, 1);
tlp.Dock = DockStyle.Fill;
tlp.AutoScroll = true;
tlp.Scroll += new ScrollEventHandler(tlp_Scroll);
tlp.Paint += new PaintEventHandler(tlp_Paint);
workstationTrackers = new List<WorkstationTrackerControl>();
for (int i = 0; i < 50; i++)
{
WorkstationTrackerControl ctl = new WorkstationTrackerControl();
tlp.RowCount++;
tlp.RowStyles.Add(new RowStyle(SizeType.AutoSize));
tlp.Controls.Add(ctl, 0, tlp.RowCount - 1);
workstationTrackers.Add(ctl);
}
}
void tlp_Paint(object sender, PaintEventArgs e)
{
if (tlp.AutoScrollPosition != lastPos)
{
Debug.WriteLine("");
tlp.AutoScrollPosition = new Point(Math.Abs(lastPos.X), Math.Abs(lastPos.Y));
}
}
void tlp_Scroll(object sender, ScrollEventArgs e)
{
lastPos = tlp.AutoScrollPosition;
}
private void MainForm_Load(object sender, EventArgs e)
{
timer.Change(TimeSpan.Zero, TimeSpan.FromSeconds(1.0));
}
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
foreach (WorkstationTrackerControl ctl in workstationTrackers)
{
ctl.Stop();
}
timer.Change(Timeout.Infinite, Timeout.Infinite);
}
private void TimerHandler(object o)
{
BeginInvoke(new ThreadStart(UpdateAppTime));
}
private void UpdateAppTime()
{
toolStripStatusLabel1.Text = DateTime.Now.ToString();
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
Close();
}
}
}
</code>
|
|
|
|
|
Hello!
Can anyone provide us some guidance, of how to check if the following software applications are installed on a system:
1. The operating system is Windows Server 2003
2. MS SQL Server 2005
3. Internet Information Services - IIS
There are few others, but need to know the way to find out if the software application is installed or not.
Thanks in advance!
Adeel
--
|
|
|
|
|
Windows 2003 server is a little trickey since there are multiple types (Gold, Small Business Server etc) and multiple languages...
However 2003 Gold - English can be determined by detecting
Windows Language is '9'
Windows Version is Major Version '5', Minor Version '2', Service Pack Major '1' and Service Pack Minor '0'
Internet Information Services 5.0 - English
Windows Language = '9'
system32\inetsrv\iisui.dll version >= '5'
system32\inetsrv\iisui.dll < '5.1'
system32\inetsrv\coadmin.dll >= '5'
system32\inetsrv\coadmin.dll < '5.1'
Internet Information Services 5.1 - English
Windows Language = '9'
Reg key 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\IISAdmin' Version < 5.2
Reg Key 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\IISAdmin' Version >= 5.1
Internet Information Services 6.0 - English
Windows Language = '9'
Reg key 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\IISAdmin' Version < 6.1
Reg Key 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\IISAdmin' Version >= 6.0
I'll have to check SQL Server 2005.....
|
|
|
|
|
Hello,
The only way is registry key , actually you could search the registry for all the install softwares in the system , there is a key which will give u information same as control panel(add/remove programes) check for that key....sorry I could not remeber the key path but you can serch that one.
Regards ,
Nishu
|
|
|
|
|
Hi,
I have the following problem to solve and need some help from more experienced programmers/app designers then myself.
I have to create an application (C# + .NET 2.0) that collects some data and stores it in local database (Oracle 10g XE). App's user can synchronize local data with global data stored on remote database (Oracle 9i). There are two additional requirements.
The first one says that users can access the data (local and global) only by using the application, they shouldn't be able to connect to neither local nor remote db using other tools (which leads to conclusion that users couldn't know their passwords). I thought about connecting to DBs using the same login and pass (encrypted and hardcoded) for all users but in that scenario my app won't meet the second requirement. It says that remote DB admin should be able to log user's activity (I mean ACTUAL user).
I know that with Oracle Data Provider for .NET I can connect from many instances of my application as the same DB user and send ClientId (which can for instance be user's identity) as additional connection's parameter and what's really important ClientId does not have to correspond to any database user name. And this ClientId can be used to distingiush ACTUAL users performing operations on the data. Unfortunately the ClientId is new to Oracle Database 10g Release 2 while my client's remote DB is version 9.
I don't have a clue on how to meet these two requirements.
I would appreciate your help.
Best regards
Mans
|
|
|
|
|
I'd imagine you'd create logins for all users, if the list is finite, or a system that passes the Ids of users from a user table and logs actions within the DB itself, and has just a couple of different accounts.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I'd be tempted to use enterprise services so that you don't end up leaving the db passwords on the client machine. Have a table in a DB somewhere with username and password derivative so that users can log in and you can log who does what. Enterprise services can then use the same db username and pwd for all connections.
HTH
Russ
|
|
|
|
|
hi all
im working on a project(Hierarchical Distributed Genetic Algorithm for Image Segmentation).
can any one help me please?
thank you.
hana
|
|
|
|
|
Only if you specify the problem you're having.
|
|
|
|
|
Sure - you need to distribute a genetic algorithm that is heirarchical, and it should segment your image.
If you want more specific help, you'll need to ask more specific questions.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I use the FileSystemWatcher class to monitor a directory for new files.
The directory is usually empty, then i would paste some files in the directory. The files can range anywhere from 1 file to hundreds.
I have a process delay between each event call so as to avoid a sharing violation cause sometimes the event gets triggered but the file is not totally finished saving. For this delay i do:
int x = 0;
while (x<=60000000)
{
int delay = COnvert.ToInt32(x);
x++;
}
What tends to happen for a reason that i am attempting to figure out is say i paste 100 files in there. It may get stuck on the 30th file. I delete the files after i am done with them, so there would be say 70 files from the 100 that i dumped in there left in the folder. So it processed 30 but is stuck somewhere.
Is there something else that i should be aware of when using FIleSytemWatcher?
|
|
|
|
|
Hi,
I don't know why you're having this problem but i know when i tried using the FileSystemWatcher for a similar project(i was downloading in to the folder) i had problems in determining when the file would be completly downloaded.
I solved it in the end but i think it might have been the long-way around.
is it possible for me to send you the source ? That way it might give you an idea for a workaround. (I've just tried describing what i did and i can't really explain it. I'm pretty new to all of this.)
|
|
|
|
|
Sure... Send when you can...
|
|
|
|
|
Why are you performing such a strange busy wait? That's completely useless IMO.
If you really have to wait you should at least use Thread.Sleep so that your application doesn't burn CPU cycles needlessly.
In order to find out if a file has been written completely, I'm using a mechanism that's working reliably so far (written from memory, so no guarantees):
public void WaitForFileCompletion(string path, int maxwait)
{
int wait = 0;
while (true)
{
try
{
FileStream fs = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.None);
fs.Close();
fs.Dispose();
return;
}
catch (IOException)
{
wait += 100;
Thread.Sleep(100);
if (wait > maxwait)
throw new ApplicationException("Timeout reached waiting for completion of file.");
}
}
}
The idea is to open the file exclusively. If another application is still busy writing to the file, this will fail. As soon as opening the file succeeds you can be sure it's been written completely.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hello,
I'm trying to develop an Web or Windows application that will scan text files provided by clients for non-ASCII characters and either remove them or highlight them so I can then replace them with the ASCII equivalent. The text files (generlaly consisting of columns that are tab or comma-delimited) can range from 10 rows to several thousand rows in length.
Can somebody suggest a code approach (C# or even VB.NET) or a link that will assist? I've been doing a great deal of searching on this site and others but have been unable to find a good example.
Thanks,
Kosh
|
|
|
|
|
If you open the file as an ASCII file, all bytes that does not represent an ASCII code (i.e. all codes >= 128) will be replaced with question marks.
What are those non-ASCII "characters", and why are they in the file? Are they characters in some other encoding, and why don't you read the file using that encoding, then?
---
single minded; short sighted; long gone;
|
|
|
|
|
I took the Brain Bench test and was asked this question. I thin the answer should be 0,30,30 but it wasn't listed. What am I doing wrong?
public static void Main() {
Coordinates c1 = new Coordinates();
Coordinates c2 = new Coordinates();
int x = 30;
c1.X = 30;
c2.X = 30;
Test(ref c1, c2, x);
Console.WriteLine("C1.X=" + c1.X.ToString() + ", C2.X=" +
c2.X.ToString() + ", X=" + x.ToString());
Console.Read();
}
public static void Test(ref Coordinates Coord1, Coordinates Coord2, int
X) {
Coord1 = new Coordinates();
Coord2 = new Coordinates();
Coord1.X = 0;
Coord2.X = 0;
X = 0;
}
What is the console output for the above sample code?
Choice 1
C1.X=30, C2.X=30, X=30
Choice 2
C1.X=30, C2.X=0, X=00
Choice 3
C1.X=0, C2.X=0, X=30
Choice 4
C1.X=0, C2.X=0, X=0
Thanks in advance for you help
|
|
|
|
|
brsecu wrote: What am I doing wrong?
Nothing. You are right, whether Coordinates is a class or a struct, it is 0,30,30
|
|
|
|
|
The answer is Choice 3 (0,0,30) if Coordinates is a class, or your answer if Coordinates is a Struct
ALL classes in C# are reference types so regardless if you use the ref keyword or not, they are passed by reference. If Coordinates is a struct instead of a Class then the first parameter is passed by reference and the other 2 are passed by value.
|
|
|
|
|
Nope. Just run the code, and you will see the result is 0,30,30 whether Coordinates is a struct or a class.
The Test() method replaces both Coordinates by new ones, however only the first one makes it back to the caller, thanks to the ref keyword; the second Coordinates is just local to Test().
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
|
What? Are you asking how to convert a bitmap image into a GraphicsPath? You can't.
|
|
|
|
|
So if I have a Trackbar with GraphicsPath as a Tracker , I can't put an Image as GraphicsPath ?
Is there a dll or CustomControl that I can skin with him a TrackBar in WinForm ?
|
|
|
|
|
Epsilone3 wrote: So if I have a Trackbar with GraphicsPath as a Tracker
Uhhh...what? Your subject line suggested you were trying to convert a bitmap image into a GraphicsPath, which is possible, but with great difficulty.
Epsilone3 wrote: I can't put an Image as GraphicsPath ?
No.
Epsilone3 wrote: Is there a dll or CustomControl that I can skin with him a TrackBar in WinForm ?
I think you're asking if there is a way to skin the TrakBar? Not that I know of. You'd probably have to search for a control library that offers one, or write one yourself.
|
|
|
|
|
You asked the reverse twice ( and got the same answer twice, once from me ). It seems to me that you're missing something fundamental here. A path is vector information and a bitmap is raster information. Going vector to raster is easy, the reverse, not so much. You can do it, but expect to spend a long, long time working on it. Expect to end up with something complex enough that it would be salable as a product on it's own. You'd need to find lines in your bitmap, and convert them to paths. Of course, a graphics path cannot recreate a complex bitmap, at least not in a viable way.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|