|
Hi,
We are having a web application which is quite big and used by around 300 super users for managing around 5000 staffs.
Now we are implementing SMS functionality into the application which means the users will be able to send and recieve sms. Every two minute the sms server of the third party is pinged to check whether there are any new messages. Also sms are hold in queue and send every time interval of 15 to 30 minutes.
I want this checking and sending process to run in the background of the application all the time, even if the user closes the browser window.
I need some advice on how do i do this ?
Will using thread will achieve this or do I need to create a windows service for it or are there any other options ?
Regards
Vinay
|
|
|
|
|
I guess you use some DB to store this SMS info, then Windows Service will do the job.
|
|
|
|
|
i have a text box which has set visible false
i want as when as i click on check box then that text field should be enable without post-back (or reload page)
how is that possible please help me..
|
|
|
|
|
look into clients side script like javascript or vbscript.
V.
|
|
|
|
|
ok
if i am using update panel and set check box auto post back true still check box is not working
how it will work??
asp code
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<td align="left" colspan="4"><asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True"
oncheckedchanged="CheckBox1_CheckedChanged1" />
<br />
<asp:TextBox ID="TextBox1" runat="server" visible ="false"></asp:TextBox>
<br />
</ContentTemplate>
</asp:UpdatePanel>
server side
protected void CheckBox1_CheckedChanged1(object sender, EventArgs e)
{
if (CheckBox1.Checked==true)
{
TextBox1.Visible = true;
}
if (CheckBox1.Checked==false)
{
TextBox1.Visible = false;
}
}
}
|
|
|
|
|
As I said, use client side script.
set AutoPostBack to false and attach a clientside handler for the checkbox.
In fact, if you don't need to run on the server, entirely remove the server checkbox (runat server) and add an html checkbox.
Help on HTML[^]
Help with javascript[^]
V.
|
|
|
|
|
In a Windows (C#) form, I need to check if the user has the required permissions to write and delete from a directory (that they select).
I have some code that will do the job, but it feels wrong.
I try writing and deleting a test file and if an exception is thrown, then the test fails.
I am a bit unhappy with using exception testing like this, but can't find any other method that does not require reams of code.
Does anyone have another method that does not require exception testing?
Here is my code.
WriteToLog(string Message, Enum LogType) is a general logging method that writes the first parameter to the log file identified by the second parameter.
private bool UserCanWrite()
{
try
{
WriteToLog("Test", LogFiles.Test);
string TestLogPath = "Failed.Log";
if (BaseDirectory.Length == 0)
{
TestLogPath = string.Format("C:\\{0}", TestLogPath);
}
else
{
TestLogPath = string.Format("{0}\\{1}", BaseDirectory, TestLogPath);
}
FileInfo TestLog = new FileInfo(TestLogPath);
TestLog.Delete();
return true;
}
catch
{
MessageBox.Show("You Don't have Read, Write and Delete privileges on the selected Base Directory\n\nPlease have your System Administrator grant those privileges before proceeding", "Higher Level of Privileges Needed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return false;
}
|
|
|
|
|
|
Thanks Mark,
I will check it out.
|
|
|
|
|
I just had a look at the sample code, and they are using a try/catch exception block as well.
FileIOPermission f2 = new FileIOPermission(FileIOPermissionAccess.Read, "C:\\test_r");
f2.AddPathList(FileIOPermissionAccess.Write | FileIOPermissionAccess.Read, "C:\\example\\out.txt");
try
{
f2.Demand();
}
catch (SecurityException s)
{
Console.WriteLine(s.Message);
}
Apart from adding another couple of usings to my code and being a bit shorter, I don't know that this is an improvement.
Is there a reason that the above is better practice than the code I wrote?
|
|
|
|
|
I also said CAS can be declaritive, as in specify an attribute not code; however if you read more about CAS, as you should, you will understand its use and get beyond your naive comments. There is more to coding than just counting the number of lines.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Checking for that sort of thing before you need it is generally not worthwhile -- things change. And maybe the user won't try writing or deleting anyway so you've wasted your time.
Simply let the user try, then deal with any Exceptions that occur at that point.
|
|
|
|
|
This is where the user tries.
The Application reads an XML File and does a bunch of processing of documents in the selected directory.
There are a number of log files that need to be created and the processing should not occur if the log files can not be written.
Due to how the application is installed and used (Admin installs, normal user then runs) the user may not always have the appropriate level of access.
Life would be so much easier without users.
|
|
|
|
|
Sure, so just before you start, begin writing the log file -- "Processing begun by <user> at <date time> ... Reading file <filename> ... "
RCoate wrote: Life would be so much easier without users.
Yes, yes it is. I write mostly Windows Services and batch processing.
|
|
|
|
|
Our watershed group has an IP camera that serves a video stream via a java applet. When we navigate to the camera's web page we see the video streem. The front end of thecode behind the camera's serving page is Is included below.
I am writing a C# Windows Application that has a webbrowser control that navigates to the page. I want to capture still images with a timer tick event. Right now, I have an hack that does a copy from screen on the webbrowser control:
Bitmap BMP_now = new Bitmap(webBrowser1.ClientSize.Width, webBrowser1.ClientSize.Height);
Graphics g = Graphics.FromImage(BMP_now);
g.CopyFromScreen(this.PointToScreen(webBrowser1.Location), new Point(0, 0), webBrowser1.ClientSize);
g.Dispose();
This cumbersome approach has the major drawback that the windows form must always be topmost. There's gotta be a better way.
Here's the source behing the IP Camera's page:
lt;html>
<head>
<TITLE>TRENDnet | CS-7835E0(TV-IP100)</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<link rel="stylesheet" href="style.css" type="text/css">
<script language="JavaScript">
<!--
function MM_preloadImages() {
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_openBrWindow(theURL,winName,features) {
window.open(theURL,winName,features);
}
function MM_swapImgRestore() {
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) {
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() {
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
<style type=text/css>
A:link {FONT-WEIGHT: bold; FONT-SIZE: 14px; COLOR: ff6600; FONT-FAMILY: arial,geneva,sans-serif}
A:visited {FONT-WEIGHT: bold; FONT-SIZE: 14px; COLOR: ff6600; FONT-FAMILY: arial,geneva,sans-serif}
.org-news {FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: ff6600; FONT-FAMILY: arial,geneva,sans-serif}
</style>
</head>
<script language="JavaScript">
function Init() {
if ((navigator.appName != "Netscape") &&
(navigator.userAgent.indexOf('Opera') == "-1"))
{
window.setInterval("ShowFrameRate()", 1000);
}
}
function ShowFrameRate() {
if (1)
{
var fFrameRate = cvcs.GetFrameRate();
window.status = "Frame:" + fFrameRate.toString() + " fps";
}
cvcs.GetRealTimeData() ;
CurrentTime.innerHTML = cvcs.GetTimeString();
GetTrigger();
}
function GetTrigger() {
if (cvcs.GetImageUpload() == 1) {
ImageUpload.innerHTML = "[ON]";
}
else {
ImageUpload.innerHTML = "[OFF]";
}
if (cvcs.GetImageEmail() == 1) {
EmailImage.innerHTML = "[ON]";
}
else {
EmailImage.innerHTML = "[OFF]";
}
}
</script>
|
|
|
|
|
OK, so I discovered the mshtml namespace.
There is a tutorial at http://www.developerfusion.com/code/4712/generate-an-image-of-a-web-page/[^]
The example uses an interface (IHTMLDocument2) and creates an instance of another interface (IHTMLElement) from the document's body. From here it is a render and draw operation. Trouble is, the procedure does not render the applet's stream to the page. Rather, it shows the (blank) html target page that the applet streams into.
However, the mshtml namespace appears to be rich in interfaces, none of which are well documented. It appears that IHTMLElement can be instantiated with other document properties (besides “body) such as “applet” which in turn has an items collection. I have had no luck on this glory path yet. Any ideas?
|
|
|
|
|
Hey guys, I ve got this question, I tried to look for it online but haven't been lucky!
I've got this:
string[] names = new string[] { "Alan Smith", "Anne Dodsworth", "Boyan Mastoni", "Richard Duncan"};
Now I want to fill it from database, so I used a generic list
public List<string> ClassroomList = new List<string>();
then fill it with data from database,
but when I want to assign it to my string I get an error and can't convert it ....
string[] names = new string[10];
foreach (var item in ClassroomList)
{
for (int i = 0; i < names.Length; i++)
{
names[i] = item;
}
}
please help me out.
thanx
|
|
|
|
|
What you are doing there is very odd, filling the array first with the first item, then with the second item, etc.. Eventually you'd have an array with 10 times the same string (the last one in ClassroomList), not a very useful way to spend CPU cycles.
What is your intent? What is the error?
|
|
|
|
|
public List<string> ClassroomList = new List<string>();
...
string[] names=ClassroomList.ToArray();
would probably do it (and it takes care of the array dimension as well, without imposing an artificial limit such as the 10 you had).
|
|
|
|
|
0) Don't use var
1) Don't use foreach in this case
2) Why copy a perfectly good List to an array?
3) If you need an array, why use the List?
|
|
|
|
|
there's more questions than answers here.
|
|
|
|
|
|
Hi
I have an application that uses a 3rd party API that saves a fingerprint image to file,I cannot retrieve the image in any way to a image object in the programming code so I need to save it to disk before i can load it into an Image object to convert the minutiae template between different vendor types. Now due to information law I need to protect that saved fingerprint image, even for the split second it is on the drive before i delete it
So I need to know is there a way I can either
Create a folder, storage space I can save to that only my Assembly can access.
or
Create a virtual drive that encrypts data that gets written into it.
or
Create a folder that requires a password to access it (which I can parse through my program).
Primarily i am using C# to code this application but any C++ console wrapped app that can be of use to me would also help.
Any advice or help will be appreciated.
Hitting my head against the wall on this one
Chona1171
Web Developer (C#), Silverlight
|
|
|
|
|
Chona1171 wrote: I cannot retrieve the image in any way to a image object in the programming code so I need to save it to disk before i can load it into an Image object to convert the minutiae template between different vendor types.
How does the API return the image?
Chona1171 wrote: So I need to know is there a way I can eitherCreate a folder, storage space I can save to that only my Assembly can access.orCreate a virtual drive that encrypts data that gets written into it.orCreate a folder that requires a password to access it (which I can parse through my program).
SqlCe or SqlExpress, using a blob-field. Or use the encryption-routines that come with .NET.
I are Troll
|
|
|
|
|
Eddy Vluggen wrote: SqlCe or SqlExpress, using a blob-field. Or use the encryption-routines that come with .NET.
It's a 3rd party API, right? If it offered support for those things, surely the OP would have thought of them..
|
|
|
|