|
I don't come up with the design requirements, I'm just tasked with "getting it done". Just checking to make sure that the filewatcher doesn't support this action. Thanks though.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Well, here's an alternative solution... Instead of pausing the FSW, pause the handler. When you get an event, check to see whether your handler is "paused"... If so, stick the event in a Queue instead. When unpausing, process the Queue first.
|
|
|
|
|
Admittedly, I've never heard of pausing a handler. Could you point me in the right direction?
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Something like this (pseudocode):
Class Watcher
Private System.IO.FileSystemWatcher
Private Bool IsPaused
Private Queue
Public Sub Pause()
IsPaused = true
End Sub
Public Sub UnPause()
While Queue is not empty
ProcessFSWEvent(next item in queue)
IsPaused = false
End Sub
Private Sub FileSystemWatcherEventHandler(sender, eventargs)
If IsPaused Then
Add eventargs to Queue
Else
ProcessFSWEvent(eventargs)
End Sub
Private Sub ProcessFSWEvent(eventargs)
Do whatever you'd normally do with the event
End Sub
|
|
|
|
|
I am currently tasked with building a question and answer faq for one of our top executives. Basic premise is that an employee can post an anonymous question through a web form, which will then save the question and the employee's reply email address to a SQL database and, after this, email our Assistant Chief.
To make things easier for our Assistant Chief and to keep him from having to connect to an internal site (all of this is behind our firewall), I would like to build an application that will accept emails from him so he can send answers from his iPhone or any other mobile device he checks his email through. This application would then take his answer and place it with the user's question, email the user the response and then, if the user has marked that the question can be posted to our internal intranet, post the question and answer for all to see. It will also have to remove the user's email address to keep the anonymity.
Am I chasing a pipe dream here or is it something that can be done? I need to put together a proposal in two weeks, so any help would be appreciated.
Thanks in advance.
|
|
|
|
|
If you need to have an emailing feature as you said, you should get in touch with your networking guys to provide you with a email address which you will then access through the application.
Another idea could be to have an admin section in the same website which will be accessible only to your chief. Now, there you can have a gridview/listview or something with the sorted list of messages. On clicking them, you can provide a page similar to the one we see while replying to the post here.
Once reply button is clicked, you can save the reply next to question and mail to concerned person through SMTP.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Maybe this might help ...
A POP3 Client in C# .NET[^]
Sounds like a "doable" project.
1) People can enter questions to management
2) Questions are forwarded to management for response
3) Management reponses via email
4) Response is forwarded to the anonymous user and possibly posted on a Intranet server.
Sounds cool ...
One thing for sure is that you will need a dedicated email account for the website to read/write emails from. Also, make sure that you "whitelist" the users that can respond to this email account, you don't want to process emails about Viagra. You will have to keep some sort of ID in the subject line so that when the response is processed from management, it gets posted to the correct question.
This project will keep you busy for a while.
|
|
|
|
|
Good ideas...I'm in the process of building on a similar idea. Your feedback will be the grounds for added feature sets.
modified on Wednesday, January 27, 2010 10:00 AM
|
|
|
|
|
Hi all.
Right first off - ive only just installed vb.net (2008), im well used to VB6, but never switched as i could get 6 to do everything i needed. so go easy on me! (assume i now nothing).
im doing a little project for fun, im building a tracking paintball gun. however im new to image processing so im looking for a little help.
What i need to do is to caputre an image from 2 webcams (set at an angle to each other to capture a wide image) at the same time, which cover the paintball field (they may overlap very slightly). I then need to stitch these 2 images together, and create some sort of array of colour values (or maybe i could make 2 arrays first and join them, probably easier)
I then need to somehow detect moving objects between this array, and the previous array(s)
i think some sort of edge detection / high pass filter would help too.
so the 2 main things i need help with are:
Image capture, and extracting colour information per pixel.
oh and the code needs to be efficient enough to do this at a frame rate of approx 10fps
if possible i dont want to use someone else's code to do this, i would like to work it from scratch
|
|
|
|
|
Well.
I try to display the datagridviewbuttoncell, acording to the value of the cell. But I can't succeed. I tried by the following ways.
I mean, suppose....
Private Sub DataGridView1_CellEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEnter
Dim r1 As Integer = e.RowIndex
If Len(Trim(DataGridView1(1, r1).Value)) <> 0 Then
Dim BnCell As New DataGridViewButtonCell
DataGridView1(2, r1) = BnCell
Else
Dim TxtCell As New DataGridViewTextBoxCell
DataGridView1(2, r1) = TxtCell
End If
End Sub
So, like the above if the data is available in column(1), then column(2) of currentcell will be datagridviewbuttoncell
or else datagridviewtextboxcell
Any better ideas for me?
Thanks
|
|
|
|
|
I'm working on a utility to do a find replace operation on Word documents (2003 version not docx)
We've a version of this that uses automation, however it's too slow, and runs into problems with documents linked to excel, and containing macros (and anything else that causes messages to show).
I've got code sorted out that will do this finding and replacing the bytes in a byte array of the file (see below). This works perfectly as long as the length of the bytes I replace is the same as the length of the bytes I need to find. If I change the length of the file the document will no longer open in word.
When I make the change required manually (ie through MS Word), the byte length of the file doesn't change, so I'm assuming there must be a buffer somewhere in the file that is getting used.
Please give me feedback on how to update the file correctly.
Code:
(please excuse the rough nature of this code - I'm prototyping!)
(also DoReplace is based on code downloaded from T'Interweb. Can't remember where, but if its yours, thanks!)
Imports System.IO
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim find As String = "String To Find"
Dim replace As String = "String To Replace"
Dim path As String = "c:\InputPath.doc"
Dim updatedpath As String = "c:\OutputPath.doc"
Dim encoding As System.Text.Encoding = System.Text.Encoding.GetEncoding(1252)
Dim fi As New FileInfo(path)
Dim fs As New FileStream(path, FileMode.Open)
Dim bytes(CInt(fs.Length)) As Byte
fs.Read(bytes, 0, CInt(fs.Length))
fs.Close()
Dim newBytes() As Byte = DoReplace(bytes, encoding.GetBytes(find), encoding.GetBytes(replace))
fs = New FileStream(updatedpath, FileMode.Create)
fs.Write(newBytes, 0, newBytes.Length)
fs.Close()
End Sub
Public Function DoReplace(ByVal bytes As Byte(), ByVal findBytes As Byte(), ByVal replaceBytes() As Byte) As Byte()
Dim newBytes As New Generic.List(Of Byte)
Dim ndx As Integer = 0
For x As Integer = 0 To bytes.Length - 1
' bytes is the original files bytes
If bytes(x) = findBytes(ndx) Then
' findBytes is a byte[] from the"find" string
If ndx = (findBytes.Length - 1) Then
For y As Integer = 0 To replaceBytes.Length - 1
'replaceBytes is a byte[] from the "replace" string
newBytes.Add(replaceBytes(y))
Next
ndx = 0
Else
ndx += 1
End If
Else
If ndx > 0 Then
For y As Integer = 0 To ndx - 1
newBytes.Add(findBytes(y))
Next
End If
ndx = 0
newBytes.Add(bytes(x))
End If
Next
Return newBytes.ToArray
End Function
End Class
|
|
|
|
|
You need to understand the structure and format of a Word file before you can reliably change anything. Changing a number of bytes in the file without knowing exactly what those bytes may be used for is a recipe for disaster.
|
|
|
|
|
Yeah - got it to work after a fashion - by adjusting the empty bytes that are found after the main content of the doc. However handing headers footers and everything else is (as you say) horrible.
I think if I had another couple of years I might take this further, however, I'm off Xmas shopping instead!
|
|
|
|
|
I know it will run somewhat slower, however ...
How about using Office Automation to open each doc, do the string substitution and save the resulting doc. We did some work recently that thankfully involved docs saved in WordML format. Resaving in the middle of your process as WordML may make the substitution easier.
|
|
|
|
|
The '95 versions didn't save an entire document, but they appended changes to the last part of the document. That's a bit faster than writing the entire document anew.
You can find the documentation through the link below. Be warned though, there's dragons there
http://download.microsoft.com/download/0/B/E/0BE8BDD7-E5E8-422A-ABFD-4342ED7AD886/Word97-2007BinaryFileFormat(doc)Specification.pdf
I are Troll
|
|
|
|
|
Eddy Vluggen wrote: there's dragons there
They are everywhere[^].
|
|
|
|
|
Now there's a gem that I still need to revisit.
..I'll plan it right after the course on time-management
I are Troll
|
|
|
|
|
Thanks for the info.
There are indeed Dragons! - Unfortunately this has to work on thousands of documents (corporate rebrand!) and there's no way I can guarantee that every doc will work within my timescales.
We'll just have to get a temp to click on the message boxes that pop up (that are unstoppable!)
|
|
|
|
|
jonegerton wrote: Unfortunately this has to work on thousands of documents (corporate rebrand!)
So I guess you have been tasked with replacing all occurences of "Tiger Woods" with "Tom Watson" or something along those lines?
I tried to make something like that work years ago, i.e. something that tried to re-create the Word "save" logic at a low level. My recollection is that somewhere in the file, there is a field holding the length of the data or (less likely) a checksum. I thought I was adjusting that properly, but never did manage to create "valid" Word documents. Apparently there was some other checksum somewhere that I did not know about. Eventually I ended up doing the job with automation. I managed to work through the message-box-related issues... I think there are ways to detect the error condition and kill Winword.exe. In the worst case, you could just assume an error occured after a certain length of time.
None of this is beautiful, but in the end it proved more workable than manually messing around with the file. And I did try mightily to make that work... I was just out of college, and had been immersed in a thesis that used Intel assembly, and the low-level approach was definitely the one I preferred.
One more thought: the "DOCX" format of Office 2007 is much more regular and well-documented than the old melange of DOC formats. I think a DOCX is basically a zipped-up collection of XML documents and embedded image files. Have you considered converting to DOCX as the first step of the process? It might make your life easier.
|
|
|
|
|
I need to find the encoding of a file that I've opened through code so that I can convert strings to byte arrays using the same encoding.
This includes word documents - the one I'm testing is Windows (1252) - according to EditPad,
The normal examples that return the variations on UTF8/Unicode are not sufficient.
Is there a way to acheive this?
In the course of my code I'm opening the documents as byte arrays via a filestream, so some way of extracting the encoding from there would be most useful.
Thanks in advance for your help
For more information on what I'm actually trying to acheive, see my other post: http://www.codeproject.com/Messages/3303167/Replacing-Bytes-in-an-Office-2003-Word-Document.aspx[^]
modified on Monday, December 14, 2009 9:29 AM
|
|
|
|
|
|
Hi,
I want to automatically expand Combo box on focus event.
I have set the Droppeddown = True in gotfocus event, but this has a side effect. When click event gets fired, it expands dropdown and closes immediately. How can I avoid it?
Mithun Shitole
"Free Your Mind"
http://www.technoyaari.com
modified on Monday, December 14, 2009 5:11 AM
|
|
|
|
|
Dear All,
I have problem with calendar.
I had created popup calendar with text box.
when i select month or year it always close the calendar like when i select day.
It is differenc datetime packer.
Do you have any idea or source code for my issue ?
Thanks you for your help ...
VB.Net
|
|
|
|
|
I totally don't understand your question, if one exists at all. Can you please rephrase your question so that a suitable answer can be thought of? Until then, liquid nitrogen.
|
|
|
|
|
Thanks,
That issue i solved it already.
But i have another thing that.
like DateTime Packer i want to show only Month & Year.
doese it has property for do that or not ?
How can resovle it ?
VB.Net
|
|
|
|