|
Hello
Use the the Unifi.Utils DLL s that has contain many function for sending through network.then how u capture that Image and what function u use.
Ishak
|
|
|
|
|
sounds like something i could definetely use - where could i find it or information about it??
|
|
|
|
|
Hai
If u need contact me thro ugh mail rugfy@yahoo.com,I will send
Ishak
|
|
|
|
|
i m trying to make a vcd cutter like software in vb.net. i m using a binery reader to split the files.if i split the file from begnige it's playes fine but if i try to split it from sommeware middle the the clip is not working.can any one help me in this
|
|
|
|
|
Mike the Red already did. You've got alot of research to do in learning about the VCD format. I suggest Google or Yahoo to start.
We can answer questions about the VB/VB.NET language itself. What your asking has nothing to do with VB. We won't do your research for you because you wouldn't learn anything from us doing all the leg work.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
I do want to search paragraphs for strings.
I managed to do so, if the string is somewhere inbetween like the word "ten" in "I had ten cups of tea!".
But what I was not able to do is the following:
Searchstring is at the end of the sentence like "See you at ten." In there I did not mangage to erease the ".". Maybe the left function will work. But I have to take care not to eliminate too much, because I will have to keep 1.2 (meaning the dot inbetween) but I will have to remove it when it looks like "1.".
In general:
1.x (where x is any nonprintable character or nothing) should be 1
1.2.x (x like above) should be 1.2
but 1.2.3 should remain 1.2.3!
Any suggestions? I thought I could use the find operation which I got through recording a macro and using the find operation. But then I will get the 8 in 8.1 and 8.1.1 as well.
Well maybe I should really try to use the left and right function to eliminate the dots etc.
So any suggestion is very welcome!
Stephan.
|
|
|
|
|
Use the Instr() function. It is not affected by the character after the search pattern. For example, I tested Instr() on the folowing string:
"Ten people ordered ten cups of tea at ten."
and the function correctly returned the position of all three occurences of the substring "ten".
Robert
|
|
|
|
|
well yes I guess I will get every occuring of the string but I just tried and it didn't do it totally correct.
Example:
I do have the enumartion of the chapters.
Lets say they are 8, 8.1, 8.1.1, 8.2 and so on
If I do use instr() on them to search for "8" then it matches all of them! But I do not want 8.1, 8.1.1 and so on in this case.
What I want to do is a strict stringmatching. So like in your example if the last "ten" would look like "ten.twenty" then I would like to get the "ten" but ignore the ".twenty" afterwards.
So my search should parse through the paragraphs to find the string.
another example:
Let's say I do have these two paragraphs
If you want to know more about this product please have a look at clause 8.1.2.
To find the cheapest product in our shop please have a look at chapter 8.
So let's assume we do want to get the "8" but not the 8.1.2.
Instr() searches every occurence of "8" within a string. But in my example above there would be a hit in "8.1.2" aswell, which is not desired.
That's my problem. As you might have realized in the second paragraph, there is a dot and a linefead afterwards. So if I compared this string, after having split it in parts at the blanks, to "8" it would not match, because of the dot and linefead.
So what I am looking for is a solution to remove things like that, to get the hit, but not to influence the string matching in any other case, so e.g. if the "8" would have been somewere near the center of the paragraph, without anything behind.
Well, as I said in my last posting, I guess I will have to find a way using left() and right() to check what is behind the string, so to find out if it is 8.1.2 or 8. and linefeed.
But thanks anyway.
Stephan.
|
|
|
|
|
Hi,
In that case, use the String.ToCharArray to copy the text into a character array, then enumerate the characters looking for your target string. Then you can use the index to check the next <n> characters and determine whether you consider it a match or not.
It may take a little effort to get the loop logic correct, but so would using combinations of Left() and Right(). PLus I think it will run a lot faster than trying to do the same thing with left and right calls.
Good Luck,
Robert
|
|
|
|
|
Is this function available in VBA for Word? Because I can't find it there. And the editior just asks for the end of the command at the dot.
I guess this function is only available in .net but not in VBA.
Stephan.
|
|
|
|
|
I guess I could have done similar operations by using left() and right() parsing one character after the next one or copying it into an array, but well, I guess the result and the speed would be the same if not worse because of first copying it and afterwards parsing the array.
I did the following:
* I checked if the length of the searchstring is equal, then I found it
* I checked if the length of the searchstring is one smaller (or the string in the paragraph one bigger respectively). If so I take the last char (with right and length operations) and compare it to the non printable or to a dot (this will get the 8.1. or 8.1x where x is the linefeed or tab or ...)
* I checkd if the length of the searchstring is two smaller (or the string in the paragraph two bigger respectively). If so I once again take the last char to check, if it is a nonprintable. if it is, then I do have something like 8.1.x and not 8.1.2 e.g.
Except in the first case I do range.select the paragraph and have a look for this word, by using the comparestring. I just tried with a test document, and it worked with the testtext which is part of a bigger one. Well I know this might not be correct in every case but it matches most of these cases.
And besides I do parse every word in the paragraph, and if I find a possible match (using the InStr()) the operations above take place. To avoid parsing strings once again in the same paragraph, I marked those I already did the operations from above.
Well, I guess I will try the other solution (rebuild the tochararray operation and the comparing every char) as well to find out which of those has fewer errors or even none!
Thanks anyway!
Stephan.
|
|
|
|
|
I am trying to get label2 to divided evenly into label1. Numbers are being randomly placed into label1 and label2. I have written the following procedure but the numbers that are being placed in the label boxes are not dividing evenly. Below is my code. Any help is appreciated.
Sub fillnumdiv()
'Needed to make Do Until Loop work
lblNum1.Text = 3
lblNum2.Text = 2
Do
'Checks all of the conditions for the number to be placed in the label box for the first number.
Randomize()
lblNum1.Text = CInt(Int((145 * Rnd())))
Randomize()
lblNum2.Text = CInt(Int((145 * Rnd())))
Loop Until CDec(Int(lblNum1.Text) Mod Int(lblNum2.Text)) = 0 And
Int(lblNum2.Text) <> 0
End Sub
|
|
|
|
|
Why does this have the stench of homework around it?
Your constantly picking two random numbers and seeing if one divides evenly into the other. If it fails, you're picking two more, and so on, and so on... The chances of the RNG picking two number that divide evenly into each other are pretty low, so of course, it takes a long time to find two numbers that match your criteria.
I have no idea what your homework assignment is, but, how about picking a random number for one and then contantly trying random numbers to divide into it. In other words, pick a random number for label1, then in a do loop, keep picking random numbers until you find one that divides evenly into the first.
This will have the effect of trying to hit a stationary target, instead of a moving one.
There are other, much better ways of doing this, but, then again, it's your homework, isn't it?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
What you are saying makes more sense. Thanks. Really, it isn't a homework problem. I am doing a flashcard program for my daughter. She is learning how to add and subtract and I already have those done along with multiplication so I figured I would go ahead and put division in there. This is my first project. I am trying to teach myself how to use vb.net.
|
|
|
|
|
OK. If you want two numbers that are evenly divisible and do it quickly, generate two random numbers, put one of those numbers into one of the textbox's. Then, multiply the two numbers together and put the result in the other textbox. This will quickly give you two numbers that are evenly divisible.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
does anyone of you know how to get the length of a string array?
My code looks like this
<br />
mystring = ActiveDocument.Paragraphs(index)<br />
mydata = Split(mystring, " ")<br />
So in the beginning I do not know the size of the array. But I do need to know if the word I am searching for, is in this array. Therefor I have to parse the array to search it. But if I do not know the upper limit, this causes a "out of bounds" error. So I do need the upper limit to avoid the error to be thrown.
Could anyone please tell me how to get the length so I could do the following (in VBA!) ?
<br />
For i = 0 to upperlimit<br />
if mydata(i) = mysearchstring then<br />
do something<br />
end if<br />
Next
Thanks!
Stephan.
|
|
|
|
|
Try UBound(mydata,1)
An optimist's glass is half full.
A pesimist's glass is half empty.
An engineer goes and gets the right size glass.
|
|
|
|
|
thanks, it works!
Stephan.
|
|
|
|
|
There are at least 3 ways to do what you want:
1. As already mentioned, use ubound. ubound is a vb only feature and is convenient because it returns the upper bound of the array which is usefull for loops.
2. mydata.Length basically returns the count of array items. This available in any language of .net. It is less convenient for loops because you must subtract 1 from it.
3. For Each loop:
For Each str As String In MyData
'Do Something
Next
You don't have to know the array bounds to loop through the items.
|
|
|
|
|
I'm a novice at code writing (newbie is something my kids would call it) and need some advice.
I need to write some code that enables me to access and manipulate data from a database object. This code has to validate the data away from the database. I would personally like to use an object that has methods that read and write to the database and properties that manage validation. This would make life easier when using the properties or field values with other objects. The problem with business objects is the time it takes to create the object.
If I want to run a datagrid based on a collection of business objects it takes too long to create the object collection (for example sales orders). Linking the datagrid to a dataview and using a datatable to hold the values is far quicker. The business objects method appears to provide a better method of creating sales orders without access to the database using a localised copy of any necessary data (part codes, etc).
One other point, the database is provided by a third party and I'm writing an additional interface (this is allowed and part of the software contract) that provides additional facilities. So that the interface isn't restricted by hard coding I have created configuration files that identify table field names, label descriptions, table column headers, table widths, column orders and properties used to create a tab control interface such as top,left,width (for the placement of text boxes) and group properties (used to create different tab pages). I've done this because I'm just a little concerned that if I leave the company they won't be able to change any of the intferface.
I know I can't avoid hard coding validation but the data screens can be configured without hard coding. I currently use a tab deliminated file (so we can use commas in field names or sql commands) but will propbably change to xml as excel is rubbish for tab deliminated (places double quatation marks without asking) and I wan't a columned interface for users to read/write to the configuration files.
What is everyone's thoughts on this. Time to retrieve and refresh data is important. The ability to travel half way around the world and create a 'dummy' sales order to enter into the database is also equally as important.
Any advice would be gratefully appreciated.
Fawxes
An optimist's glass is half full.
A pesimist's glass is half empty.
An engineer goes and gets the right size glass.
|
|
|
|
|
System.IO.IOException: Insufficient system resources exist to complete the requested service.
at System.IO.__Error.WinIOError(Int32 errorCode, String str)
at System.IO.__Error.WinIOError()
at System.IO.FileInfo.MoveTo(String destFileName)
at SPC_Polish_Services.CommonFunction.MoveFile(String oldPath, String fileName, String subDir, Int32 fid, String type)
I'm trying to movefile a file in my windows service.
I've no idea at all how to solve this problem..
please help me...thanks~
sayhigh_soon
|
|
|
|
|
We need to see the code that your using to move the file. The error you posted isn't supplying enough information. Also, is the service running under the Local System account, or an account created for this service?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
thanks for your reply.
The service is running under local system account.
<br />
'********************************************************************<br />
' Process: MoveFile<br />
' Input: oldPath, fileName, subDir ['Save'|'Error'], fid, Type ['NEW' | 'UV']<br />
' Output: Move file to destination folder<br />
'********************************************************************<br />
Public Sub MoveFile(ByVal oldPath As String, ByVal fileName As String, ByVal subDir As String, ByVal fid As Integer, ByVal type As String)<br />
Dim Conn As New SqlConnection(strConn)<br />
Dim fi As New FileInfo(oldPath)<br />
Dim targetDir As String = ConfigurationSettings.AppSettings("dirPath" & type).Trim & "\" & subDir<br />
Dim newPath As String = targetDir & "\" & fileName<br />
Dim tblStatusName As String = ConfigurationSettings.AppSettings("tblStatusName" & type).Trim<br />
Dim errorMsg As String<br />
Dim attempt As Integer = 0<br />
<br />
If File.Exists(newPath) Then<br />
'Extra: To ensure delete only normal file (destination folder)<br />
File.SetAttributes(newPath, FileAttributes.Normal)<br />
File.Delete(newPath)<br />
End If<br />
<br />
'Try for another 5 attempts if meet "it is being used by another process" error<br />
Do<br />
Try<br />
'Set the Read-Only file (source folder) to normal file before move to destination folder<br />
If File.Exists(oldPath) Then<br />
File.SetAttributes(oldPath, FileAttributes.Normal)<br />
<br />
'If target folder not exist then create the folder<br />
If Not Directory.Exists(targetDir) Then<br />
Directory.CreateDirectory(targetDir)<br />
End If<br />
fi.MoveTo(newPath)<br />
<br />
'Log<br />
EvtLog("File successfully moved to " & newPath, localhost.EventLogEntryType.Information, 5)<br />
DBLog(logTableName, type, oldPath, "File successfully moved to " & newPath, logName, logSource)<br />
End If<br />
<br />
GoTo final<br />
<br />
Catch ex As Exception<br />
errorMsg = ex.ToString<br />
<br />
If InStr(errorMsg, "it is being used by another process") <> 0 Then<br />
<br />
If attempt <= 5 Then<br />
EvtLog("*** Sub MoveFile Attempt " & attempt & " fail(" & oldPath & "): " & ex.ToString, localhost.EventLogEntryType.Error, 15)<br />
DBLog(logTableName, type, oldPath, "Sub MoveFile Attempt " & attempt & " fail: " & ex.ToString, logName, logSource)<br />
<br />
attempt += 1<br />
<br />
'Wait for 30 seconds before go for another attempt<br />
Thread.CurrentThread.Sleep(30000)<br />
End If<br />
<br />
Else<br />
GoTo email<br />
End If<br />
End Try<br />
Loop While attempt <= 5<br />
.....<br />
.....<br />
.....<br />
End Sub<br />
sayhigh
|
|
|
|
|
A little convoluted, don't you think?
First, strip out all the logging code and get it down to just what is essential for making 5 attempts at moving the file.
Get rid of this line, you never use the object:
Dim Conn As New SqlConnection(strConn)
Rewrite the code and NEVER use "Goto"'s.
Get rid of the "fid" parameter in your method header, you never use it.
Get rid of the "type" parameter in your method header. All you use it for is logging information, which is not an essential part of what this function does.
KEEP IT SIMPLE! Get it down to a working function first, then add the logging code you need.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|