Hi, I have a web form that allows users to upload files while opening a ticket in our system. The upload is done using the "ajax control toolkit" asyncFileUpload. Currently, the files are saved to a temp directory and will only be save to the permanent location when the user hits the "commit" button. I would like to be able to get rid of temp files that are no longer relevant (e.g. The user leaves the page open for a month without posting the form). What would be the best way to not keep temp files forever. Maybe keeping them files in the session? Maybe keeping them in the viewstate? I could add some JS to the page with a timeout and add some code that runs when the user leaves the page. But these ideas are client side solutions. I wouldn't want someone to tamper with the code and leave me rubbish on my system. Any other idea? Thanks, Summerbulb
SummerBulb
Posts
-
Store files temporarily -
string testing fails:confused: This code:
var allowedChars = "qwertyuiopasdfghjklzxcvbnm1234567890/'קראטוןםפךלחיעכגדשזסבהנמצ";
var card = document.getElementById("cardid").value; for (i=0; i< 10; i++) if (allowedChars.indexOf(card\[i\]) == -1) { alert("Error"); return true; }
is supposed to check an input string. For an unknown reason, it works on ff 3.6.10, but not on IE 7. Help will be highly appreciated. Thanks, Summer Bulb.
-
Allow web users to get a report on the status of my web serviceThe idea is as follows: Multiple clients will be pinging the web service to indicate activity. The web service will store the ping information. I would like to be able to display that information to a user useing his web browser (with a html file or something like that). Am i clear now?
-
Allow web users to get a report on the status of my web serviceHi there, I'm writing a web service that's supposed to monitor client out there, using web clients. I'd like to allow a user to read a status report using a web browser. The naive solution i had thought of was having an <index.html> file, and updating it when needed. The problem is, updates may need to be made very often. Another problem may be that the web service might not have privileges to change the file, since it will be held by the iis, while serving it to the user. Any good ideas or tips? Thanks in advance, Summer Bulb
-
Run as system and logoff user "USER"Hi. I have a program that runs as a scheduled task. The program runs on XP as SYSTEM. The idea is that the program will run in the background, while USER is active. I need the program to logoff USER when specific conditions occur. I tried using
[DllImport("user32.dll")]
public static extern int ExitWindowsEx(int uFlags, int dwReason);but that appears to not log USER off. I think maybe it's logging SYSTEM off, as it is running as SYSTEM. How can i logogg USER? Thanks, SummerBulb.
-
AODL ans .xls filesHi, I'm using the AODL tooolkit to create spreadsheets. The problem is, since AODL is part of open office, all the file come out as .ods files. I'm looking for one of the following solutions: 1. A way to export files to .xls using AODL (i've searched for way of doing this, and found nothing) 2. Another toolkit, that doesn't require the installation of MS-office, and can build spreadsheets using C#. 3. Whatever other solution you think might help me... :^) Thank, SummerBulb
-
Pipe & Fork code - need helpJust to let you know - the code works perfectly. Thank you very much!
-
Pipe & Fork code - need helpCPallini wrote:
For instance while ( ! finished ) { ssize nread = read(fd[0],buf,50); if ( nread == -1 ) { // handle error } else if (nread > 0) { printf("Read %d characters\n", nread); buf[nread]='\0'; printf(buf); write(fileOpen, buf, nread); } }
I already tried rewriting that part. When i get nread=-1 i print a message, just for the debug. The result of that change is an endless loop of messages. For some reason, when it gets to the father, the pipe is empty, or some other pipe error. The father just can't read any info from the pipe. Man, this is frustrating!
CPallini wrote:
where finished is a termination condition (timeout?) that you possibly know better than me.
The thing is - the end condition is an empty pipe...
-
Pipe & Fork code - need help:^) Oh, oops. How did that happen? Anyway, that array is not used later, and iv'e removed it from the code, so that isn't the problem. Thanks anyway.
-
Pipe & Fork code - need helpCPallini wrote:
SummerBulb wrote: while (read(fd[0],buf,50) != 0) { printf("Read line...\n"); buf[50] = NULL; printf(buf); write(fileOpen, buf, 50) You're assuming the read function return either 0 or 50. This is a wrong assumption.
I changes the while condition to
while (read(fd[0],buf,50) > 0)
but that is also wrong, of course. If i'm not mistaken, im getting a -1 return for an unknown reason. Why can't the father read from the pipe?
CPallini wrote:
BTW Haven't you any synchronization requirement (for instance, it is ok if in the output file the content of the three input files is scrambled?)?
I tried very hard to find the sync demand int the text, but i couldn't find it... :) Thanks!
-
Pipe & Fork code - need helpHi there. I am required to write an application in C for Unix that does the following: The program will create 3 child processes which read from 3 different files and write to the same pipe in the parent process. Each child should wait a random amount of time (3 -10 seconds) between writing each 50 characters. The father should read from the pipe and write everything he gets (from all 3 files) into one new file. Here is my Code:
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>int main(int argc, char* argv[])
{
if (argc != 5)
{
printf("Error!\nUsage: tar1.exe <input file 1> <input file 2> <input file 3> <output file>\n");
exit(0);
}int fd\[2\]; int fileOpen; int pids\[3\]; int i; char buf\[51\]; pipe(fd); close(fd\[1\]); //father only reads from pipe for (i=1; i < 4; i++) { switch ((pids\[i\] = fork())) { case -1: printf("Fork error"); break; case 0: close(fd\[0\]); //child only writes to pipe printf("Child %d created. File: %s\\n",i ,argv\[i\]); if ((fileOpen = open(argv\[i\],O\_RDONLY)) == -1) { printf("File %s does not exist.\\n",argv\[i\]); exit(0); } printf("Child %d writing to pipe\\n",i); while (read(fileOpen,buf,50) > 0) { buf\[50\] = NULL; printf("Child %d. Text: %s",i,buf); write(fd\[1\], buf, 50); sleep(rand()%8+3); } close(fd\[1\]); //child done writing close(fileOpen); printf("Child %d done writing to pipe\\n",i); exit(0); break; default: break; } } wait(); wait(); wait(); if ((fileOpen = open(argv\[4\],O\_WRONLY)) == -1) { printf("File %s does not exist.\\n",argv\[i\]); exit(0); } printf("Father reading from pipe.\\n"); //sleep(rand()%8+3); while (read(fd\[0\],buf,50) != 0) { printf("Read line...\\n"); buf\[50\] = NULL; printf(buf); write(fileOpen, buf, 50); //sleep(rand()%8+3); } close(fd\[0\]); close(fileOpen); printf("Done reading!\\n"); return 0;
}
Running the application results with lots of rubbish in the output file. Help will be highly appreciated. Thanks!
-
The best method for designing a low profile client applicationThank you very much for your replies. Does the WCF differ much from the SOAP? (this must sound like a very silly question to someone whoe knows them both well...)
modified on Sunday, December 6, 2009 4:51 AM
-
The best method for designing a low profile client applicationN a v a n e e t h wrote:
Have a thread which does the polling
I don't mind having the application in the background. My dillemma is concerning the CPU, memory and internet bandwidth.
-
The best method for designing a low profile client applicationHi all. I would like to write a program that will function as a client on a remote computer. The idea is that at a given time i will be able to request specific actions from the client application. Remotely, of course. Up to now i have considered two ways of doing this: 1. Use a DB on the server. The client will poll the DB for tasks at a standard rate and act as insrtucted there. 2. Use a web-service. The client will call a getTasks() method at a standard rate. Both of these methods include polling the server at a fixed interval. This is necessary, since i need the client application to respond almost immediateley to server requests. The thing is, i don't want these applications to interfere with the user's use-experience. I don't want him to feel that he has my application running in the background and polling every now and then. So: Are my concerns justified? If so, what would you suggest as a substitute? If not, which of the above would you suggest? Thanks for reading all the way down here. I will really appreciate your responses. SummerBulb.
-
Creating Excel files in C# witout having microsoft excelToo good to be true. I downloaded that lovely package, tried to install it, and got the following message: Please install Microsoft Office 2003 before installing this product. Too bad...
-
Creating Excel files in C# witout having microsoft excelHi. I would like to write a program that creates and midifies excel files. I don't have microsoft excel. Can it be done without having the microsoft excel? If so, where can i find a dll that will do the job? Microsoft.Office.Interop.Excel does not appear in the COM label of the refferences window. Thanks!
-
Connect to a remote MySql DBI don't know why, but copying the dll (MySql.Data.dll) to the location of the application did the trick. I'll apreciate an explaination... Thanks again.
-
Connect to a remote MySql DBHi, i have a c# application that connects to a remote MySql database. The application is meant for a windows 2003 server. I have a refference to mySql.Data in my app. What do i need in order to get the application to connect to the database? Thanks!
-
Using a DISTINCT queryJust to let you know, i solved the problem.
select distinct(name), age from table group by name;
did the job. Thanks.
-
Using a DISTINCT queryHi there, I have tried running a query using the DISTINCT keyword, but the result is not what i am looking for. The table is something like the following:
name age
AA 12
BB 13
cc 18
AA 14
BB 19If i query:
Select Distinct name, age from table;
i get all the rows. I am intested in a result set that will be:
name age
AA 12
BB 13
cc 18Can anyone help? Thank! Edit: 1. I know that distinct works on the combination of the colunms, giving a distinct set of rows, but that is not what i need. I need it to be distincted by the name. 2. Running
Select Distinct(name), age from table;
doesn't give the correct result either.
modified on Sunday, October 11, 2009 10:37 AM