|
Hi,
dotnethead wrote: Unfortunately Anant, your regex did not match.
Actually i didnt changed the regex. I only suggested a part of solution for your escape character problem. Sorry, that i was not clear what i have posted.
-- modified at 1:55 Friday 25th August, 2006
<marquee>"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
Anant Y. Kulkarni
|
|
|
|
|
Hi,
this is the modified version of my previous regex which i posted.
Regex rx =new Regex(@"^(\d{1,3}?\.){3}\d{1,3}$");
this will check the proper format for ip.
but this will also match no.s greater than 255.
so what you can do is first apply above regex expression for valid format and if found correct you can split the ip and check for each part no. is not greater than 255.
hope this works.
Nitin...
|
|
|
|
|
Thanks I'll give it a shot.
|
|
|
|
|
hi all...
i am trying to delete all the data in printer spooler
here is my code
ProcessStartInfo pns=new ProcessStartInfo("net","stop spooler");
System.Diagnostics.Process.Start(pns);
string syspath=Environment.GetFolderPath(Environment.SpecialFolder.System);
DirectoryInfo drdd= new System.IO.DirectoryInfo(syspath+"\\spool\\PRINTERS");
foreach(System.IO.FileInfo fin in drdd.GetFiles())
{
fin.Delete();
}
pns=new ProcessStartInfo("net","start spooler");
System.Diagnostics.Process.Start(pns);
everything works fine .. but the problem is if we want to print again , then we have to manually go and refresh that printer folder(where the printers are listed ) how can i automate that ..
thanx
Akhil
|
|
|
|
|
If you open your control panel (under XP) ==>
open "Sounds and Audio Devices" ==>
choose the "Audio" tab ==>
"Sound Recording" group-box ==>
Click "Volume..." button
then a window appears allowing you to choose your recording input path.
How can I program it using C# or any other language (4 eg to control selecting mic or line-in input signal)?
Greatly appreciated, this is really a challenging question..
-- modified at 10:08 Thursday 24th August, 2006
لا إله إلا الله
|
|
|
|
|
Hello
For this you must use DirectX. Here is an articles about capturing audio, and choosing which line to capture from.
DirectX.Capture[^]
For more Try the Media section[^] in CP.
I hope this helps.
Regards
|
|
|
|
|
Many thanks for your help , BUT the directX gives you the opportunity to choose among different audio devices, what I need is to be able -after choosing a certain audio device- to enable/disable the line-in or mic within the choosed audio device.
لا إله إلا الله
|
|
|
|
|
Hello
Enabling or disabling audio lines using C# would be problematic, I think. You may not do it entirely using C#. You'll have to make some Win32 API calls.
An article that would do exactly what you are looking for is Here[^]. Take a look at example 4 specially. Unfortunetaly the article is written in C++
I hope this would help, for more articles about audio and video, you may look Here[^]. Again most of them is written in C++.
Regards
|
|
|
|
|
Thanks my bro Nader, I will delve inshallah now into the Win32 APIs .
Thanks for your help
لا إله إلا الله
|
|
|
|
|
Hi,
I have developed a windows application, which open a TCP connection to some machine on some port. Then i can send any commands to the server. I get responses from the server. For example i am opening connection with Mail server and issue POP commands then i can get the list of mail messages, retrieve mail messages from server. Until now there is no problem. But i want to know how can we open a secured connection to server in the above scenario ?
Any help would be appreciable !
<marquee>"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
Anant Y. Kulkarni
|
|
|
|
|
Hello
If you use .net 2.0 then you might want to check AuthenticatedStream clss in your MSDN.
Regards
|
|
|
|
|
I tried posting this to the ASP.NET forum and got no response, so I'll try here.
I will be developing some .NET C# GUIs that will use one or more web services to get and display information. The web services the GUIs use may need to do some things that require the security environment of a process running from the local hard disk, such as accessing the registry, creating a socket connection to a process on the local or a remote host, etc.
All of this is not an issue if I develop the GUIs as C# applications. However, it occurred to me that there might be some advantage in creating them as user control libraries, where the controls are hosted in IE web pages (with the web page .html files and the DLLs containing the C# user control libraries installed locally on each client, not downloaded over the internet). My concern is that an article I have read (15 Seconds : Hosting .NET Windows Forms Controls in IE) indicates that if the hosted user controls access the web services and the web services try to do something like access the registry, create an event log, make a socket connection, etc., then they may fail due to security restrictions. Given that all the user control libraries are local to the machines running them hosted in IE, is there a simple way to set up security so that these controls (and the services they use) have permissions to do essentially the same things that a GUI program could do? I don't want to make the system vulnerable or upset system administrators, so if it isn't a simple and relatively safe thing to do, I'll just go with the native applications.
|
|
|
|
|
In Win32, we can open a file without specifing the ".exe" file which associate with it by "ShellExecute" function . For example:we can open "*.txt" just specifing the filename not needing the "notepad.exe". But how to implement this
in C#?
|
|
|
|
|
System.Diagnostic.Process.Start( "file" ).
I think it's a wrapper around ShellExecute.
|
|
|
|
|
In My XP service pack2 OS SQL Server 2000 not installed it asks me to install latest service pack What is the latest service pack version where its available
SParthis
|
|
|
|
|
For Windows XP it is SP 2
For SQL Server 2000 it is SP 4
|
|
|
|
|
How can I completely remove a macro from an excel spreadsheet?
I'm developing an application in C# that opens an excel spreadsheet and attempts to update the spreadsheet however, this spreadsheet contains a macro that refreshes 2 pivottables upon opening.
Since I'm trying to update the excel sheet at the same time the pivottables are refreshing, I get an error (Excel is a single-threaded application. Only one chunk of code can be executed at a time).
So I'm trying to find out how I can completely remove these macros. I went into "Tools -> Macro -> Macros" and deleted the 2 macros that were listed there however the pivottables still automatically refresh everytime the spreadsheet is opened (thus still giving me an error).
Any ideas?
Thanks in advance.
-Goalie35
|
|
|
|
|
Hello
Goalie35 wrote: this spreadsheet contains a macro that refreshes 2 pivottables upon opening.
If they only refresh the table upon opening, why not waiting until they finish their job, then make your updates?? Maybe you'd put your code in a Try/wait/Try Again pattern!!
Regards
|
|
|
|
|
Hi Nader.
Thanks for the reply.
I actually did use a delay as a temporary solution however we're trying to build our application so that it runs as quickly as possible & setting a delay would have done the opposite we were looking to accomplish.
I did find a solution to this problem however. It turns out that it wasn't the macro that was the problem. There's a pivottable option in excel under "Pivottable Options" where you can disable the refresh when excel opens. This refresh was the process that was conflicting with my application. I then refresh the pivottables in my code.
Thanks.
-Goalie35
|
|
|
|
|
I'm still learning programming.Can anyone help with a coding for a C#(othello) game.Just a simple programme that uses (X and O) for players not the one currently posted on the web cause it is more advanced for what I supposed to do now.
The board's initial setup contains 2 X's on the bottom corners of the board and
2 circles on the top corners of the board.
Player one will be circles and player two will be X's. Player one begins by
putting a circle in a square adjacent to where there is already a circle. If
there are any X's in adjoining squares to where player 1 puts the circle, those
X's become circles. Then player two does the same with X's. The game is won if
one player eliminates the other player entirely, or by having the most X's or
circles when every square on the board is filled.
|
|
|
|
|
You have gotten the game all wrong.
The game starts with two pieces of each color in the center of the board, like this:
OX<br />
XO
Each player places pieces in turn, so that they surrond one or more of the opponents pieces at both ends of a straight line, turning the surronded pieces. Like this:
XOX becomes XXX
XOOOOOX becomes XXXXXXX
A line can be formed horizontal, vertical or diagonal. One move may form several lines.
If a player can not turn any of the opponents pieces, he has to skip that move.
The game ends if all of one players pieces are eliminated, no one of the players can do a move, or when the board is full. The player having the most pieces at the end of the game wins.
The name "Othello" is owned by the company that sells the board game, so it's usually named "Reversi" as a computer game.
---
b { font-weight: normal; }
|
|
|
|
|
kgopa wrote: Infact that was a question from my lecture.
Yes, I see now that the specification is way too well written.
that's how my lecture whants it.Please help me.
What is it that you need help with, then?
---
b { font-weight: normal; }
|
|
|
|
|
how to create menu dynamically in Visual studio 2005.using MenuStrp control.
Hai
|
|
|
|
|
Hello
MenuStrip menu = new MenuStrip();
MenuItem Mi = menu.Items.Add("TestMenu");
Mi.MenuItems.Add("AnotherMenuItem");
Regards
|
|
|
|
|
I have 3 components
Component A (a scheduling engine), B (a windows service) and C (a task)
Component C implements objects of type A.
Component B creates objects of type C by reflection.
Component C needs to access a SQL Server DB but i don't understand why he cannot open a connection to the DB.
This are component A permissions
using System;<br />
using System.Reflection;<br />
using System.Runtime.CompilerServices;<br />
using System.Runtime.InteropServices;<br />
using System.Security.Permissions;<br />
using System.Data.SqlClient;<br />
using System.Net.Mail;<br />
<br />
...<br />
<br />
[assembly: SmtpPermission(SecurityAction.RequestMinimum, Unrestricted = true)]<br />
[assembly: SqlClientPermission(SecurityAction.RequestMinimum, Unrestricted = true)]<br />
[assembly: UIPermission(SecurityAction.RequestMinimum, Unrestricted = false, Window = UIPermissionWindow.AllWindows)]<br />
[assembly: IsolatedStorageFilePermission(SecurityAction.RequestMinimum, UserQuota = 1048576)]<br />
[assembly: SecurityPermission(SecurityAction.RequestMinimum, UnmanagedCode = true)]<br />
[assembly: FileIOPermission(SecurityAction.RequestOptional, Unrestricted = true)]<br />
[assembly: CLSCompliant(true)]<br />
This are component B permissions
using System;<br />
using System.Reflection;<br />
using System.Runtime.CompilerServices;<br />
using System.Runtime.InteropServices;<br />
using System.Security.Permissions;<br />
using System.Diagnostics;<br />
using System.Configuration;<br />
using System.Data.SqlClient;<br />
<br />
using Microsoft.Practices.EnterpriseLibrary.Logging;<br />
<br />
...<br />
<br />
[assembly: SqlClientPermission(SecurityAction.RequestMinimum)]<br />
[assembly: ConfigurationPermission(SecurityAction.RequestMinimum, Unrestricted = true)]<br />
[assembly: EventLogPermission(SecurityAction.RequestMinimum, PermissionAccess = System.Diagnostics.EventLogPermissionAccess.Write, Unrestricted = true)]<br />
[assembly: UIPermission(SecurityAction.RequestMinimum, Clipboard = UIPermissionClipboard.AllClipboard, Unrestricted = false, Window = UIPermissionWindow.AllWindows)]<br />
[assembly: IsolatedStorageFilePermission(SecurityAction.RequestMinimum, UserQuota = 1048576)]<br />
[assembly: SecurityPermission(SecurityAction.RequestMinimum, UnmanagedCode = true)]<br />
[assembly: FileIOPermission(SecurityAction.RequestOptional, Unrestricted = true)]<br />
[assembly: CLSCompliant(true)]<br />
This are component C permissions
<br />
using System;<br />
using System.Reflection;<br />
using System.Runtime.CompilerServices;<br />
using System.Runtime.InteropServices;<br />
using System.Security.Permissions;<br />
using System.Data.SqlClient;<br />
using System.Net.Mail;<br />
<br />
...<br />
<br />
[assembly: SmtpPermission(SecurityAction.RequestMinimum, Unrestricted = true)]<br />
[assembly: SqlClientPermission(SecurityAction.RequestRefuse, Unrestricted = true)]<br />
[assembly: IsolatedStorageFilePermission(SecurityAction.RequestMinimum, UserQuota = 1048576)]<br />
[assembly: SecurityPermission(SecurityAction.RequestRefuse, UnmanagedCode = true)]<br />
[assembly: FileIOPermission(SecurityAction.RequestOptional, Unrestricted = true)]<br />
[assembly: CLSCompliant(true)]<br />
The problem is on the C component
The method which opens a Connection call stack is:
A --> B --> C
I've also tried to create a SqlClientPermission object, add the connection string and call to the Assert method but a SecurityExeption is trowed when connection.Open() method is executed.
Any Idea?
I'm on a Fuzzy State: Between 0 an 1
|
|
|
|